Skip to content

Commit

Permalink
Use updated paramiko (Juniper release) with additional support for ae…
Browse files Browse the repository at this point in the history
…s128 and aes257 ciphers.

* Updated custom juniper paramiko

* nd

* Fixed python style format

* Fixed python style format

* Updated custom paramiko v3.4.0-JNPR
  • Loading branch information
dineshbaburam91 authored Apr 10, 2024
1 parent 7cf0340 commit 1710c82
Show file tree
Hide file tree
Showing 24 changed files with 15 additions and 35 deletions.
1 change: 0 additions & 1 deletion lib/jnpr/junos/cfg/phyport/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class PhyPortBase(Resource):

"""
[edit interfaces <name>]
Expand Down
1 change: 0 additions & 1 deletion lib/jnpr/junos/cfg/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class User(Resource):

"""
[edit system login user <name>]
Expand Down
1 change: 0 additions & 1 deletion lib/jnpr/junos/cfg/user_ssh_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class UserSSHKey(Resource):

"""
[edit system login user <name> authentication <key-type> <key-value> ]
Expand Down
3 changes: 0 additions & 3 deletions lib/jnpr/junos/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1023,7 +1022,6 @@ def __repr__(self):


class DeviceSessionListener(SessionListener):

"""
Listens to Session class of Netconf Transport
and detects errors in the transport.
Expand All @@ -1045,7 +1043,6 @@ def errback(self, ex):


class Device(_Connection):

"""
Junos Device class.
Expand Down
17 changes: 0 additions & 17 deletions lib/jnpr/junos/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class FactLoopError(RuntimeError):


class RpcError(Exception):

"""
Parent class for all junos-pyez RPC Exceptions
"""
Expand Down Expand Up @@ -87,7 +86,6 @@ def __repr__(self):


class CommitError(RpcError):

"""
Generated in response to a commit-check or a commit action.
"""
Expand All @@ -107,7 +105,6 @@ def __repr__(self):


class ConfigLoadError(RpcError):

"""
Generated in response to a failure when loading a configuration.
"""
Expand All @@ -127,7 +124,6 @@ def __repr__(self):


class LockError(RpcError):

"""
Generated in response to attempting to take an exclusive
lock on the configuration database.
Expand All @@ -138,7 +134,6 @@ def __init__(self, rsp):


class UnlockError(RpcError):

"""
Generated in response to attempting to unlock the
configuration database.
Expand All @@ -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.
Expand All @@ -164,7 +158,6 @@ def __init__(self, rsp, cmd=None, errs=None):


class RpcTimeoutError(RpcError):

"""
Generated in response to a RPC execution timeout.
"""
Expand All @@ -181,7 +174,6 @@ def __repr__(self):


class SwRollbackError(RpcError):

"""
Generated in response to a SW rollback error.
"""
Expand All @@ -208,7 +200,6 @@ def __repr__(self):


class ConnectError(Exception):

"""
Parent class for all connection related exceptions
"""
Expand Down Expand Up @@ -249,7 +240,6 @@ def __repr__(self):


class ProbeError(ConnectError):

"""
Generated if auto_probe is enabled and the probe action fails
"""
Expand All @@ -258,7 +248,6 @@ class ProbeError(ConnectError):


class ConnectAuthError(ConnectError):

"""
Generated if the user-name, password is invalid
"""
Expand All @@ -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
Expand All @@ -278,7 +266,6 @@ class ConnectTimeoutError(ConnectError):


class ConnectUnknownHostError(ConnectError):

"""
Generated if the specific hostname does not DNS resolve
"""
Expand All @@ -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
Expand All @@ -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
Expand All @@ -309,7 +294,6 @@ class ConnectNotMasterError(ConnectError):


class ConnectClosedError(ConnectError):

"""
Generated if connection unexpectedly closed
"""
Expand All @@ -320,7 +304,6 @@ def __init__(self, dev):


class JSONLoadError(Exception):

"""
Generated if json content of rpc reply fails to load
"""
Expand Down
1 change: 0 additions & 1 deletion lib/jnpr/junos/factory/cmdview.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class CMDView(object):

"""
View is the base-class that makes extracting values from XML
data appear as objects with attributes.
Expand Down
2 changes: 1 addition & 1 deletion lib/jnpr/junos/factory/factory_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,7 +30,6 @@


class FactoryLoader(object):

"""
Used to load a <dict> of data that contains Table and View definitions.
Expand Down
6 changes: 3 additions & 3 deletions lib/jnpr/junos/factory/state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion lib/jnpr/junos/factory/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class View(object):

"""
View is the base-class that makes extracting values from XML
data appear as objects with attributes.
Expand Down
1 change: 0 additions & 1 deletion lib/jnpr/junos/factory/viewfields.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class ViewFields(object):

"""
Used to dynamically create a field dictionary used with the
RunstatView class
Expand Down
1 change: 1 addition & 0 deletions lib/jnpr/junos/facts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
The following dictionary keys represent the available facts and their meaning:
"""

import sys

import jnpr.junos.facts.current_re
Expand Down
1 change: 1 addition & 0 deletions lib/jnpr/junos/ofacts/session.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
facts['HOME'] = login home directory
"""

from lxml.builder import E


Expand Down
1 change: 1 addition & 0 deletions lib/jnpr/junos/resources/autosys.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Pythonifier for AutoSys Table/View
"""

from jnpr.junos.factory import loadyaml
from os.path import splitext

Expand Down
1 change: 1 addition & 0 deletions lib/jnpr/junos/resources/bgp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Pythonifier for BGP Table/View
"""

from jnpr.junos.factory import loadyaml
from os.path import splitext

Expand Down
1 change: 1 addition & 0 deletions lib/jnpr/junos/resources/interface.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Pythonifier for interface table/view
"""

from jnpr.junos.factory import loadyaml
from os.path import splitext

Expand Down
1 change: 1 addition & 0 deletions lib/jnpr/junos/resources/staticroutes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Pythonifier for Static route Table/View
"""

from jnpr.junos.factory import loadyaml
from os.path import splitext

Expand Down
1 change: 1 addition & 0 deletions lib/jnpr/junos/resources/syslog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Pythonifier for Syslog Table/View
"""

from jnpr.junos.factory import loadyaml
from os.path import splitext

Expand Down
1 change: 1 addition & 0 deletions lib/jnpr/junos/resources/user.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Pythonifier for User Table/View
"""

from jnpr.junos.factory import loadyaml
from os.path import splitext

Expand Down
1 change: 0 additions & 1 deletion lib/jnpr/junos/transport/tty.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/jnpr/junos/transport/tty_netconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class PY6:


class tty_netconf(object):

"""
Basic Junos XML API for bootstraping through the TTY
"""
Expand Down
1 change: 0 additions & 1 deletion lib/jnpr/junos/utils/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class FS(Util):

"""
Filesystem (FS) utilities:
Expand Down
1 change: 0 additions & 1 deletion lib/jnpr/junos/utils/start_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class StartShell(object):

"""
Junos shell execution utility. This utility is written to
support the "context manager" design pattern. For example::
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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))
Expand Down

0 comments on commit 1710c82

Please sign in to comment.