Skip to content

Commit

Permalink
Merge branch 'Juniper:master' into serial_port_disconnect_on_bad_pass…
Browse files Browse the repository at this point in the history
…word
  • Loading branch information
Aaron-MJohn authored Aug 29, 2024
2 parents c428e0b + a64698b commit 8de68da
Show file tree
Hide file tree
Showing 75 changed files with 89 additions and 90 deletions.
7 changes: 6 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
## Release 2.7.1.dev0 - 12 JAN 2024
## Release 2.7.2 - 12 APR 2024
## Features Added

## Bugs Fixed

## Release 2.7.1 - 12 APR 2024
## Features Added
- Added customer juniper paramiko module as a dependency which supported aes128 and aes257 cipher #1299
## Bugs Fixed

## Release 2.7.0 - 12 JAN 2024
## Features Added
- Support added for Python 3.10 and above version
Expand Down
3 changes: 1 addition & 2 deletions development.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
-r requirements.txt

coverage # http://nedbatchelder.com/code/coverage/
mock # http://www.voidspace.org.uk/python/mock/
nose2 # https://docs.nose2.io/en/latest/
pep8 # https://github.com/jcrocholl/pep8
pyflakes # https://launchpad.net/pyflakes
coveralls # https://coveralls.io/
ntc_templates # user needs to explicitly install this
cryptography==3.2
cryptography==3.2
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
21 changes: 18 additions & 3 deletions lib/jnpr/junos/utils/sw.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,16 @@ def reboot(
:returns:
* reboot message (string) if command successful
"""

if self._multi_VC_nsync is True or self._multi_VC is True:
vc_members = [
re.search(r"(\d+)", x).group(1)
for x in self._RE_list
if re.search(r"(\d+)", x)
]
vc_members.remove(self.dev.facts["vc_master"])
vc_members.insert(len(vc_members), self.dev.facts["vc_master"])

if self._dev.facts["_is_linux"]:
if on_node is None:
cmd = E("request-shutdown-reboot")
Expand All @@ -1220,9 +1230,14 @@ def reboot(
cmd = E("request-reboot")

try:
return self._system_operation(
cmd, in_min, at, all_re, other_re, vmhost, member_id
)
if member_id is not None:
for m_id in member_id:
if m_id in vc_members:
return self._system_operation(
cmd, in_min, at, all_re, other_re, vmhost, member_id=m_id
)
else:
return self._system_operation(cmd, in_min, at, all_re, other_re, vmhost)
except RpcTimeoutError as err:
raise err
except Exception as err:
Expand Down
4 changes: 2 additions & 2 deletions lib/jnpr/junos/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION = "2.7.1.dev0"
DATE = "2024-Jan-12"
VERSION = "2.7.2.dev0"
DATE = "2024-Apr-12"

# Augment with the internal version if present
try:
Expand Down
Loading

0 comments on commit 8de68da

Please sign in to comment.