diff --git a/lib/jnpr/junos/cfg/phyport/base.py b/lib/jnpr/junos/cfg/phyport/base.py index b87ea7538..e018d8f65 100644 --- a/lib/jnpr/junos/cfg/phyport/base.py +++ b/lib/jnpr/junos/cfg/phyport/base.py @@ -6,7 +6,6 @@ class PhyPortBase(Resource): - """ [edit interfaces ] diff --git a/lib/jnpr/junos/cfg/user.py b/lib/jnpr/junos/cfg/user.py index 549b92ebf..7763d4aef 100644 --- a/lib/jnpr/junos/cfg/user.py +++ b/lib/jnpr/junos/cfg/user.py @@ -8,7 +8,6 @@ class User(Resource): - """ [edit system login user ] diff --git a/lib/jnpr/junos/cfg/user_ssh_key.py b/lib/jnpr/junos/cfg/user_ssh_key.py index bb3208c7c..f4010f34e 100644 --- a/lib/jnpr/junos/cfg/user_ssh_key.py +++ b/lib/jnpr/junos/cfg/user_ssh_key.py @@ -7,7 +7,6 @@ class UserSSHKey(Resource): - """ [edit system login user authentication ] diff --git a/lib/jnpr/junos/device.py b/lib/jnpr/junos/device.py index 8fec872c3..641806803 100644 --- a/lib/jnpr/junos/device.py +++ b/lib/jnpr/junos/device.py @@ -54,7 +54,6 @@ class _MyTemplateLoader(jinja2.BaseLoader): - """ Create a jinja2 template loader class that can be used to load templates from all over the filesystem, but defaults @@ -1023,7 +1022,6 @@ def __repr__(self): class DeviceSessionListener(SessionListener): - """ Listens to Session class of Netconf Transport and detects errors in the transport. @@ -1045,7 +1043,6 @@ def errback(self, ex): class Device(_Connection): - """ Junos Device class. diff --git a/lib/jnpr/junos/exception.py b/lib/jnpr/junos/exception.py index 3393d860d..b62b3d871 100644 --- a/lib/jnpr/junos/exception.py +++ b/lib/jnpr/junos/exception.py @@ -14,7 +14,6 @@ class FactLoopError(RuntimeError): class RpcError(Exception): - """ Parent class for all junos-pyez RPC Exceptions """ @@ -87,7 +86,6 @@ def __repr__(self): class CommitError(RpcError): - """ Generated in response to a commit-check or a commit action. """ @@ -107,7 +105,6 @@ def __repr__(self): class ConfigLoadError(RpcError): - """ Generated in response to a failure when loading a configuration. """ @@ -127,7 +124,6 @@ def __repr__(self): class LockError(RpcError): - """ Generated in response to attempting to take an exclusive lock on the configuration database. @@ -138,7 +134,6 @@ def __init__(self, rsp): class UnlockError(RpcError): - """ Generated in response to attempting to unlock the configuration database. @@ -149,7 +144,6 @@ def __init__(self, rsp): class PermissionError(RpcError): - """ Generated in response to invoking an RPC for which the auth user does not have user-class permissions. @@ -164,7 +158,6 @@ def __init__(self, rsp, cmd=None, errs=None): class RpcTimeoutError(RpcError): - """ Generated in response to a RPC execution timeout. """ @@ -181,7 +174,6 @@ def __repr__(self): class SwRollbackError(RpcError): - """ Generated in response to a SW rollback error. """ @@ -208,7 +200,6 @@ def __repr__(self): class ConnectError(Exception): - """ Parent class for all connection related exceptions """ @@ -249,7 +240,6 @@ def __repr__(self): class ProbeError(ConnectError): - """ Generated if auto_probe is enabled and the probe action fails """ @@ -258,7 +248,6 @@ class ProbeError(ConnectError): class ConnectAuthError(ConnectError): - """ Generated if the user-name, password is invalid """ @@ -267,7 +256,6 @@ class ConnectAuthError(ConnectError): class ConnectTimeoutError(ConnectError): - """ Generated if the NETCONF session fails to connect, could be due to the fact the device is not ip reachable; bad @@ -278,7 +266,6 @@ class ConnectTimeoutError(ConnectError): class ConnectUnknownHostError(ConnectError): - """ Generated if the specific hostname does not DNS resolve """ @@ -287,7 +274,6 @@ class ConnectUnknownHostError(ConnectError): class ConnectRefusedError(ConnectError): - """ Generated if the specified host denies the NETCONF; could be that the services is not enabled, or the host has @@ -298,7 +284,6 @@ class ConnectRefusedError(ConnectError): class ConnectNotMasterError(ConnectError): - """ Generated if the connection is made to a non-master routing-engine. This could be a backup RE on an MX @@ -309,7 +294,6 @@ class ConnectNotMasterError(ConnectError): class ConnectClosedError(ConnectError): - """ Generated if connection unexpectedly closed """ @@ -320,7 +304,6 @@ def __init__(self, dev): class JSONLoadError(Exception): - """ Generated if json content of rpc reply fails to load """ diff --git a/lib/jnpr/junos/factory/cmdview.py b/lib/jnpr/junos/factory/cmdview.py index b03cff8de..5ae8f3060 100644 --- a/lib/jnpr/junos/factory/cmdview.py +++ b/lib/jnpr/junos/factory/cmdview.py @@ -1,5 +1,4 @@ class CMDView(object): - """ View is the base-class that makes extracting values from XML data appear as objects with attributes. diff --git a/lib/jnpr/junos/factory/factory_loader.py b/lib/jnpr/junos/factory/factory_loader.py index a030a05eb..9e1d641cb 100644 --- a/lib/jnpr/junos/factory/factory_loader.py +++ b/lib/jnpr/junos/factory/factory_loader.py @@ -4,6 +4,7 @@ originate from any kind of source: YAML, JSON, program. For examples of YAML refer to the .yml files in this jnpr.junos.op directory. """ + # stdlib from copy import deepcopy import re @@ -29,7 +30,6 @@ class FactoryLoader(object): - """ Used to load a of data that contains Table and View definitions. diff --git a/lib/jnpr/junos/factory/state_machine.py b/lib/jnpr/junos/factory/state_machine.py index 7053b76dd..f49ffcec3 100644 --- a/lib/jnpr/junos/factory/state_machine.py +++ b/lib/jnpr/junos/factory/state_machine.py @@ -810,9 +810,9 @@ def parse_using_regex(self, event): val, result[list(self._view.REGEX.keys()).index(key)], re.I ) if obj and len(obj.groups()) >= 1: - result[ - list(self._view.REGEX.keys()).index(key) - ] = obj.groups()[0] + result[list(self._view.REGEX.keys()).index(key)] = ( + obj.groups()[0] + ) items = convert_to_data_type(result) tmp_dict = dict(zip(self._view.REGEX.keys(), items)) if len(tmp_dict) > 0: diff --git a/lib/jnpr/junos/factory/view.py b/lib/jnpr/junos/factory/view.py index 9e80309d9..e19d0a06d 100644 --- a/lib/jnpr/junos/factory/view.py +++ b/lib/jnpr/junos/factory/view.py @@ -11,7 +11,6 @@ class View(object): - """ View is the base-class that makes extracting values from XML data appear as objects with attributes. diff --git a/lib/jnpr/junos/factory/viewfields.py b/lib/jnpr/junos/factory/viewfields.py index f774fbea9..c61d9e0b8 100644 --- a/lib/jnpr/junos/factory/viewfields.py +++ b/lib/jnpr/junos/factory/viewfields.py @@ -1,5 +1,4 @@ class ViewFields(object): - """ Used to dynamically create a field dictionary used with the RunstatView class diff --git a/lib/jnpr/junos/facts/__init__.py b/lib/jnpr/junos/facts/__init__.py index 821a7b595..7ac4317ae 100644 --- a/lib/jnpr/junos/facts/__init__.py +++ b/lib/jnpr/junos/facts/__init__.py @@ -31,6 +31,7 @@ The following dictionary keys represent the available facts and their meaning: """ + import sys import jnpr.junos.facts.current_re diff --git a/lib/jnpr/junos/ofacts/session.py b/lib/jnpr/junos/ofacts/session.py index 278f5f26b..f857021af 100644 --- a/lib/jnpr/junos/ofacts/session.py +++ b/lib/jnpr/junos/ofacts/session.py @@ -1,6 +1,7 @@ """ facts['HOME'] = login home directory """ + from lxml.builder import E diff --git a/lib/jnpr/junos/resources/autosys.py b/lib/jnpr/junos/resources/autosys.py index 7605c828d..4911ad530 100644 --- a/lib/jnpr/junos/resources/autosys.py +++ b/lib/jnpr/junos/resources/autosys.py @@ -1,6 +1,7 @@ """ Pythonifier for AutoSys Table/View """ + from jnpr.junos.factory import loadyaml from os.path import splitext diff --git a/lib/jnpr/junos/resources/bgp.py b/lib/jnpr/junos/resources/bgp.py index 1e4969f55..c8b3474bf 100644 --- a/lib/jnpr/junos/resources/bgp.py +++ b/lib/jnpr/junos/resources/bgp.py @@ -1,6 +1,7 @@ """ Pythonifier for BGP Table/View """ + from jnpr.junos.factory import loadyaml from os.path import splitext diff --git a/lib/jnpr/junos/resources/interface.py b/lib/jnpr/junos/resources/interface.py index 60ef76fe0..6b58a2541 100644 --- a/lib/jnpr/junos/resources/interface.py +++ b/lib/jnpr/junos/resources/interface.py @@ -1,6 +1,7 @@ """ Pythonifier for interface table/view """ + from jnpr.junos.factory import loadyaml from os.path import splitext diff --git a/lib/jnpr/junos/resources/staticroutes.py b/lib/jnpr/junos/resources/staticroutes.py index 5f4efc4a4..fdd0d650b 100644 --- a/lib/jnpr/junos/resources/staticroutes.py +++ b/lib/jnpr/junos/resources/staticroutes.py @@ -1,6 +1,7 @@ """ Pythonifier for Static route Table/View """ + from jnpr.junos.factory import loadyaml from os.path import splitext diff --git a/lib/jnpr/junos/resources/syslog.py b/lib/jnpr/junos/resources/syslog.py index f886efe77..76601d167 100644 --- a/lib/jnpr/junos/resources/syslog.py +++ b/lib/jnpr/junos/resources/syslog.py @@ -1,6 +1,7 @@ """ Pythonifier for Syslog Table/View """ + from jnpr.junos.factory import loadyaml from os.path import splitext diff --git a/lib/jnpr/junos/resources/user.py b/lib/jnpr/junos/resources/user.py index 78568e722..8532b40c2 100644 --- a/lib/jnpr/junos/resources/user.py +++ b/lib/jnpr/junos/resources/user.py @@ -1,6 +1,7 @@ """ Pythonifier for User Table/View """ + from jnpr.junos.factory import loadyaml from os.path import splitext diff --git a/lib/jnpr/junos/transport/tty.py b/lib/jnpr/junos/transport/tty.py index b356ee61e..0de9338d0 100644 --- a/lib/jnpr/junos/transport/tty.py +++ b/lib/jnpr/junos/transport/tty.py @@ -14,7 +14,6 @@ class Terminal(object): - """ Terminal is used to bootstrap Junos New Out of the Box (NOOB) device over the CONSOLE port. The general use-case is to setup the minimal diff --git a/lib/jnpr/junos/transport/tty_netconf.py b/lib/jnpr/junos/transport/tty_netconf.py index ceac91be5..1d5133de4 100644 --- a/lib/jnpr/junos/transport/tty_netconf.py +++ b/lib/jnpr/junos/transport/tty_netconf.py @@ -38,7 +38,6 @@ class PY6: class tty_netconf(object): - """ Basic Junos XML API for bootstraping through the TTY """ diff --git a/lib/jnpr/junos/utils/fs.py b/lib/jnpr/junos/utils/fs.py index 6d56bb5b6..fd31ec887 100644 --- a/lib/jnpr/junos/utils/fs.py +++ b/lib/jnpr/junos/utils/fs.py @@ -7,7 +7,6 @@ class FS(Util): - """ Filesystem (FS) utilities: diff --git a/lib/jnpr/junos/utils/start_shell.py b/lib/jnpr/junos/utils/start_shell.py index cef26eddc..f6ac93565 100644 --- a/lib/jnpr/junos/utils/start_shell.py +++ b/lib/jnpr/junos/utils/start_shell.py @@ -14,7 +14,6 @@ class StartShell(object): - """ Junos shell execution utility. This utility is written to support the "context manager" design pattern. For example:: diff --git a/requirements.txt b/requirements.txt index c18bc21d0..c318527ec 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ lxml>=3.2.4 # ncclient version 0.6.10 has issues with PyEZ(junos-eznc) and needs to be avoided ncclient>=0.6.15 -paramiko>=1.15.2 scp>=0.7.0 jinja2>=2.7.1 PyYAML>=5.1 diff --git a/setup.py b/setup.py index 9971110f7..981a023d1 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,9 @@ from setuptools import setup, find_packages import versioneer +import os +# Install customer paramiko +os.system("pip install git+https://github.com/Juniper/paramiko.git@v3.4.0-JNPR") # parse requirements req_lines = [line.strip() for line in open("requirements.txt").readlines()] install_reqs = list(filter(None, req_lines))