Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-netmiko for openSUSE:Factory checked in at 2021-03-02 12:36:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-netmiko (Old) and /work/SRC/openSUSE:Factory/.python-netmiko.new.2378 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-netmiko" Tue Mar 2 12:36:28 2021 rev:13 rq:876142 version:3.3.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-netmiko/python-netmiko.changes 2020-10-23 16:09:10.235756834 +0200 +++ /work/SRC/openSUSE:Factory/.python-netmiko.new.2378/python-netmiko.changes 2021-03-02 14:27:15.282005411 +0100 @@ -1,0 +2,14 @@ +Tue Mar 2 07:42:15 UTC 2021 - Martin Hauke <mar...@gmx.de> + +- Update to version 3.3.3 + New Drivers + * Add Ericcson IPOS Support + * Adtran Telnet Support + Performance Improvements + * Juniper Performance Improvements + * Cisco ASA Performance Improvements + Bugs and Enhancements + * Improve Authentication Exception Handling + * FIX Cryptography Lib Change Issue + +------------------------------------------------------------------- Old: ---- netmiko-3.3.2.tar.gz New: ---- netmiko-3.3.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-netmiko.spec ++++++ --- /var/tmp/diff_new_pack.ituAI4/_old 2021-03-02 14:27:15.762005992 +0100 +++ /var/tmp/diff_new_pack.ituAI4/_new 2021-03-02 14:27:15.762005992 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-netmiko # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-netmiko -Version: 3.3.2 +Version: 3.3.3 Release: 0 Summary: Multi-vendor library to simplify Paramiko SSH connections to network devices License: MIT ++++++ netmiko-3.3.2.tar.gz -> netmiko-3.3.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/EXAMPLES.md new/netmiko-3.3.3/EXAMPLES.md --- old/netmiko-3.3.2/EXAMPLES.md 2020-10-01 17:50:06.000000000 +0200 +++ new/netmiko-3.3.3/EXAMPLES.md 2021-02-01 21:44:50.000000000 +0100 @@ -33,7 +33,7 @@ - [Genie example](#using-genie) #### Configuration Changes -- [Configuration changes](#configuration-changes) +- [Configuration changes](#configuration-changes-1) - [Configuration changes from a file](#configuration-changes-from-a-file) #### SSH keys and SSH config_file @@ -407,6 +407,10 @@ ## Using TTP ```py +from netmiko import ConnectHandler +from getpass import getpass +from pprint import pprint + cisco1 = { "device_type": "cisco_ios", "host": "cisco1.lasthop.io", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/PKG-INFO new/netmiko-3.3.3/PKG-INFO --- old/netmiko-3.3.2/PKG-INFO 2020-10-01 18:02:42.000000000 +0200 +++ new/netmiko-3.3.3/PKG-INFO 2021-02-01 21:51:04.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: netmiko -Version: 3.3.2 +Version: 3.3.3 Summary: Multi-vendor library to simplify Paramiko SSH connections to network devices Home-page: https://github.com/ktbyers/netmiko Author: Kirk Byers @@ -184,7 +184,7 @@ If you find an issue with Netmiko, then you can open an issue on this projects issue page here: [https://github.com/ktbyers/netmiko/issues](https://github.com/ktbyers/netmiko/issues). Please make sure you've read through the common issues and examples prior to opening an issue. Please only open issues for bugs, feature requests, or other topics related to development of Netmiko. If you simply have a question, join us on Slack... - If you have questions or would like to discuss Netmiko, a #netmiko channel exists in [this Slack](https://pynet.slack.com) workspace. To join, use [this invitation](https://join.slack.com/t/pynet/shared_invite/enQtNTA2MDI3NjU0MTM0LTIyZDdhMTBlOWNmNDJhNjkxZTEyMDg3NTRkOWIxMTUwOTAzYmQ0ZjMwMGMyNTM4N2E1YzA3YWQ1MWFiOWM1YzU). Once you have entered the workspace, then you can join the #netmiko channel. + If you have questions or would like to discuss Netmiko, a #netmiko channel exists in [this Slack](https://pynet.slack.com) workspace. To join, use [this invitation](https://join.slack.com/t/pynet/shared_invite/zt-km2k3upf-AkWHY4YEx3sI1R5irMmc7Q). Once you have entered the workspace, then you can join the #netmiko channel. --- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/README.md new/netmiko-3.3.3/README.md --- old/netmiko-3.3.2/README.md 2020-09-23 19:56:50.000000000 +0200 +++ new/netmiko-3.3.3/README.md 2021-02-01 21:44:50.000000000 +0100 @@ -176,7 +176,7 @@ If you find an issue with Netmiko, then you can open an issue on this projects issue page here: [https://github.com/ktbyers/netmiko/issues](https://github.com/ktbyers/netmiko/issues). Please make sure you've read through the common issues and examples prior to opening an issue. Please only open issues for bugs, feature requests, or other topics related to development of Netmiko. If you simply have a question, join us on Slack... -If you have questions or would like to discuss Netmiko, a #netmiko channel exists in [this Slack](https://pynet.slack.com) workspace. To join, use [this invitation](https://join.slack.com/t/pynet/shared_invite/enQtNTA2MDI3NjU0MTM0LTIyZDdhMTBlOWNmNDJhNjkxZTEyMDg3NTRkOWIxMTUwOTAzYmQ0ZjMwMGMyNTM4N2E1YzA3YWQ1MWFiOWM1YzU). Once you have entered the workspace, then you can join the #netmiko channel. +If you have questions or would like to discuss Netmiko, a #netmiko channel exists in [this Slack](https://pynet.slack.com) workspace. To join, use [this invitation](https://join.slack.com/t/pynet/shared_invite/zt-km2k3upf-AkWHY4YEx3sI1R5irMmc7Q). Once you have entered the workspace, then you can join the #netmiko channel. --- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/__init__.py new/netmiko-3.3.3/netmiko/__init__.py --- old/netmiko-3.3.2/netmiko/__init__.py 2020-10-01 17:50:06.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/__init__.py 2021-02-01 21:44:50.000000000 +0100 @@ -23,7 +23,7 @@ # Alternate naming Netmiko = ConnectHandler -__version__ = "3.3.2" +__version__ = "3.3.3" __all__ = ( "ConnectHandler", "ssh_dispatcher", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/adtran/__init__.py new/netmiko-3.3.3/netmiko/adtran/__init__.py --- old/netmiko-3.3.2/netmiko/adtran/__init__.py 2020-09-23 19:56:50.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/adtran/__init__.py 2021-02-01 21:44:50.000000000 +0100 @@ -1,3 +1,3 @@ -from netmiko.adtran.adtran import AdtranOSSSH +from netmiko.adtran.adtran import AdtranOSSSH, AdtranOSTelnet -__all__ = ["AdtranOSSSH"] +__all__ = ["AdtranOSSSH", "AdtranOSTelnet"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/adtran/adtran.py new/netmiko-3.3.3/netmiko/adtran/adtran.py --- old/netmiko-3.3.2/netmiko/adtran/adtran.py 2020-09-23 19:56:50.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/adtran/adtran.py 2021-02-01 21:44:50.000000000 +0100 @@ -22,7 +22,7 @@ def check_enable_mode(self, check_string="#"): return super().check_enable_mode(check_string=check_string) - def enable(self, cmd="enable", pattern="", re_flags=re.IGNORECASE): + def enable(self, cmd="enable", pattern="ssword", re_flags=re.IGNORECASE): return super().enable(cmd=cmd, pattern=pattern, re_flags=re_flags) def exit_enable_mode(self, exit_command="disable"): @@ -49,3 +49,10 @@ class AdtranOSSSH(AdtranOSBase): pass + + +class AdtranOSTelnet(AdtranOSBase): + def __init__(self, *args, **kwargs): + default_enter = kwargs.get("default_enter") + kwargs["default_enter"] = "\r\n" if default_enter is None else default_enter + super().__init__(*args, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/arista/arista.py new/netmiko-3.3.3/netmiko/arista/arista.py --- old/netmiko-3.3.2/netmiko/arista/arista.py 2020-10-01 17:50:06.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/arista/arista.py 2021-02-01 21:44:50.000000000 +0100 @@ -17,7 +17,18 @@ self.disable_paging(cmd_verify=False, pattern=r"Pagination disabled") self.set_base_prompt() - def check_config_mode(self, check_string=")#", pattern=""): + def enable( + self, + cmd="enable", + pattern="ssword", + enable_pattern=r"\#", + re_flags=re.IGNORECASE, + ): + return super().enable( + cmd=cmd, pattern=pattern, enable_pattern=enable_pattern, re_flags=re_flags + ) + + def check_config_mode(self, check_string=")#", pattern=r"[>\#]"): """ Checks if the device is in configuration mode or not. @@ -27,11 +38,7 @@ Can also be (s2) """ self.write_channel(self.RETURN) - # You can encounter an issue here (on router name changes) prefer delay-based solution - if not pattern: - output = self._read_channel_timing() - else: - output = self.read_until_pattern(pattern=pattern) + output = self.read_until_pattern(pattern=pattern) output = output.replace("(s1)", "") output = output.replace("(s2)", "") return check_string in output diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/base_connection.py new/netmiko-3.3.3/netmiko/base_connection.py --- old/netmiko-3.3.2/netmiko/base_connection.py 2020-10-01 17:50:06.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/base_connection.py 2021-02-01 21:44:50.000000000 +0100 @@ -619,6 +619,11 @@ if delay_factor == 1 and max_loops == 150: max_loops = int(self.timeout / loop_delay) + # FIX: Cleanup in future versions of Netmiko + if delay_factor < 1: + if not self._legacy_mode and self.fast_cli: + delay_factor = 1 + channel_data = "" i = 0 while i <= max_loops: @@ -708,6 +713,12 @@ (default: 20) """ delay_factor = self.select_delay_factor(delay_factor) + + # FIX: Cleanup in future versions of Netmiko + if delay_factor < 1: + if not self._legacy_mode and self.fast_cli: + delay_factor = 1 + time.sleep(1 * delay_factor) output = "" @@ -940,16 +951,6 @@ msg = msg.lstrip() raise NetmikoTimeoutException(msg) - except paramiko.ssh_exception.SSHException as no_session_err: - self.paramiko_cleanup() - if "No existing session" in str(no_session_err): - msg = ( - "Paramiko: 'No existing session' error: " - "try increasing 'conn_timeout' to 10 seconds or larger." - ) - raise NetmikoTimeoutException(msg) - else: - raise except paramiko.ssh_exception.AuthenticationException as auth_err: self.paramiko_cleanup() msg = f"""Authentication to device failed. @@ -965,6 +966,16 @@ msg += self.RETURN + str(auth_err) raise NetmikoAuthenticationException(msg) + except paramiko.ssh_exception.SSHException as no_session_err: + self.paramiko_cleanup() + if "No existing session" in str(no_session_err): + msg = ( + "Paramiko: 'No existing session' error: " + "try increasing 'conn_timeout' to 10 seconds or larger." + ) + raise NetmikoTimeoutException(msg) + else: + raise if self.verbose: print(f"SSH connection established to {self.host}:{self.port}") @@ -1273,16 +1284,10 @@ cmd_verify = cmd_echo output = "" - delay_factor = self.select_delay_factor(delay_factor) - # Cleanup in future versions of Netmiko - if delay_factor < 1: - if not self._legacy_mode and self.fast_cli: - delay_factor = 1 if normalize: command_string = self.normalize_cmd(command_string) - self.write_channel(command_string) cmd = command_string.strip() @@ -1446,6 +1451,7 @@ :param cmd_verify: Verify command echo before proceeding (default: True). :type cmd_verify: bool """ + # Time to delay in each read loop loop_delay = 0.2 @@ -1643,7 +1649,9 @@ output = self.read_until_prompt() return check_string in output - def enable(self, cmd="", pattern="ssword", re_flags=re.IGNORECASE): + def enable( + self, cmd="", pattern="ssword", enable_pattern=None, re_flags=re.IGNORECASE + ): """Enter enable mode. :param cmd: Device command to enter enable mode @@ -1652,6 +1660,9 @@ :param pattern: pattern to search for indicating device is waiting for password :type pattern: str + :param enable_pattern: pattern indicating you have entered enable mode + :type pattern: str + :param re_flags: Regular expression flags used in conjunction with pattern :type re_flags: int """ @@ -1663,15 +1674,20 @@ if not self.check_enable_mode(): self.write_channel(self.normalize_cmd(cmd)) try: - output += self.read_until_prompt_or_pattern( - pattern=pattern, re_flags=re_flags - ) + output += self.read_until_pattern(pattern=re.escape(cmd.strip())) + if pattern not in output: + output += self.read_until_prompt_or_pattern( + pattern=pattern, re_flags=re_flags + ) self.write_channel(self.normalize_cmd(self.secret)) - output += self.read_until_prompt() + if enable_pattern: + output += self.read_until_pattern(pattern=enable_pattern) + else: + output += self.read_until_prompt() + if not self.check_enable_mode(): + raise ValueError(msg) except NetmikoTimeoutException: raise ValueError(msg) - if not self.check_enable_mode(): - raise ValueError(msg) return output def exit_enable_mode(self, exit_command=""): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/cisco/cisco_asa_ssh.py new/netmiko-3.3.3/netmiko/cisco/cisco_asa_ssh.py --- old/netmiko-3.3.2/netmiko/cisco/cisco_asa_ssh.py 2020-09-23 19:56:50.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/cisco/cisco_asa_ssh.py 2021-02-01 21:44:50.000000000 +0100 @@ -8,15 +8,34 @@ class CiscoAsaSSH(CiscoSSHConnection): """Subclass specific to Cisco ASA.""" + def __init__(self, *args, **kwargs): + kwargs.setdefault("fast_cli", True) + kwargs.setdefault("_legacy_mode", False) + kwargs.setdefault("allow_auto_change", True) + return super().__init__(*args, **kwargs) + + def check_config_mode(self, check_string=")#", pattern=r"[>\#]"): + return super().check_config_mode(check_string=check_string, pattern=pattern) + + def enable( + self, + cmd="enable", + pattern="ssword", + enable_pattern=r"\#", + re_flags=re.IGNORECASE, + ): + return super().enable( + cmd=cmd, pattern=pattern, enable_pattern=enable_pattern, re_flags=re_flags + ) + def session_preparation(self): """Prepare the session after the connection has been established.""" - self._test_channel_read() - self.set_base_prompt() if self.secret: self.enable() else: self.asa_login() + self.disable_paging(command="terminal pager 0") if self.allow_auto_change: try: @@ -28,11 +47,7 @@ # Disable cmd_verify if the terminal width can't be set self.global_cmd_verify = False - self.disable_paging(command="terminal pager 0") - - # Clear the read buffer - time.sleep(0.3 * self.global_delay_factor) - self.clear_buffer() + self.set_base_prompt() def send_command_timing(self, *args, **kwargs): """ @@ -104,6 +119,7 @@ i = 1 max_attempts = 10 self.write_channel("login" + self.RETURN) + output = self.read_until_pattern(pattern=r"login") while i <= max_attempts: time.sleep(0.5 * delay_factor) output = self.read_channel() @@ -126,6 +142,16 @@ cmd=cmd, confirm=confirm, confirm_response=confirm_response ) + def normalize_linefeeds(self, a_string): + """Cisco ASA needed that extra \r\n\r""" + newline = re.compile("(\r\n\r|\r\r\r\n|\r\r\n|\r\n|\n\r)") + a_string = newline.sub(self.RESPONSE_RETURN, a_string) + if self.RESPONSE_RETURN == "\n": + # Delete any remaining \r + return re.sub("\r", "", a_string) + else: + return a_string + class CiscoAsaFileTransfer(CiscoFileTransfer): """Cisco ASA SCP File Transfer driver.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/cisco/cisco_nxos_ssh.py new/netmiko-3.3.3/netmiko/cisco/cisco_nxos_ssh.py --- old/netmiko-3.3.2/netmiko/cisco/cisco_nxos_ssh.py 2020-10-01 17:50:06.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/cisco/cisco_nxos_ssh.py 2021-02-01 21:44:50.000000000 +0100 @@ -24,7 +24,7 @@ def normalize_linefeeds(self, a_string): """Convert '\r\n' or '\r\r\n' to '\n, and remove extra '\r's in the text.""" - newline = re.compile(r"(\r\r\n|\r\n)") + newline = re.compile(r"(\r\r\n\r|\r\r\n|\r\n)") # NX-OS fix for incorrect MD5 on 9K (due to strange <enter> patterns on NX-OS) return newline.sub(self.RESPONSE_RETURN, a_string).replace("\r", "\n") @@ -32,6 +32,39 @@ """Checks if the device is in configuration mode or not.""" return super().check_config_mode(check_string=check_string, pattern=pattern) + def save_config( + self, + cmd="copy running-config startup-config", + confirm=False, + confirm_response="", + ): + self.enable() + + if confirm: + output = self.send_command_timing( + command_string=cmd, strip_prompt=False, strip_command=False + ) + if confirm_response: + output += self.send_command_timing( + confirm_response, strip_prompt=False, strip_command=False + ) + else: + # Send enter by default + output += self.send_command_timing( + self.RETURN, strip_prompt=False, strip_command=False + ) + else: + # NX-OS is very slow on save_config ensure it waits long enough. + # FIX: this is a hack as delay_factor will be set to .1 via fast_cli=True in + # send_command so increase max_loops. + output = self.send_command( + command_string=cmd, + strip_prompt=False, + strip_command=False, + max_loops=5000, + ) + return output + class CiscoNxosFileTransfer(CiscoFileTransfer): """Cisco NXOS SCP File Transfer driver.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/cisco_base_connection.py new/netmiko-3.3.3/netmiko/cisco_base_connection.py --- old/netmiko-3.3.2/netmiko/cisco_base_connection.py 2020-10-01 17:50:06.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/cisco_base_connection.py 2021-02-01 21:44:50.000000000 +0100 @@ -13,9 +13,17 @@ """Check if in enable mode. Return boolean.""" return super().check_enable_mode(check_string=check_string) - def enable(self, cmd="enable", pattern="ssword", re_flags=re.IGNORECASE): + def enable( + self, + cmd="enable", + pattern="ssword", + enable_pattern=None, + re_flags=re.IGNORECASE, + ): """Enter enable mode.""" - return super().enable(cmd=cmd, pattern=pattern, re_flags=re_flags) + return super().enable( + cmd=cmd, pattern=pattern, enable_pattern=enable_pattern, re_flags=re_flags + ) def exit_enable_mode(self, exit_command="disable"): """Exits enable (privileged exec) mode.""" @@ -81,6 +89,12 @@ ): """Telnet login. Can be username/password or just password.""" delay_factor = self.select_delay_factor(delay_factor) + + # FIX: Cleanup in future versions of Netmiko + if delay_factor < 1: + if not self._legacy_mode and self.fast_cli: + delay_factor = 1 + time.sleep(1 * delay_factor) output = "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/ericsson/__init__.py new/netmiko-3.3.3/netmiko/ericsson/__init__.py --- old/netmiko-3.3.2/netmiko/ericsson/__init__.py 1970-01-01 01:00:00.000000000 +0100 +++ new/netmiko-3.3.3/netmiko/ericsson/__init__.py 2021-02-01 21:44:50.000000000 +0100 @@ -0,0 +1,3 @@ +from netmiko.ericsson.ericsson_ipos import EricssonIposSSH + +__all__ = ["EricssonIposSSH"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/ericsson/ericsson_ipos.py new/netmiko-3.3.3/netmiko/ericsson/ericsson_ipos.py --- old/netmiko-3.3.2/netmiko/ericsson/ericsson_ipos.py 1970-01-01 01:00:00.000000000 +0100 +++ new/netmiko-3.3.3/netmiko/ericsson/ericsson_ipos.py 2021-02-01 21:44:50.000000000 +0100 @@ -0,0 +1,144 @@ +import re + +from netmiko.base_connection import BaseConnection + + +class EricssonIposSSH(BaseConnection): + def check_enable_mode(self, check_string="#"): + """ + Check if in enable mode. Return boolean. + """ + return super().check_enable_mode(check_string=check_string) + + def enable(self, cmd="enable 15", pattern="ssword", re_flags=re.IGNORECASE): + """Enter enable mode.""" + return super().enable(cmd=cmd, pattern=pattern, re_flags=re_flags) + + def disable_paging(self, command="terminal length 0", delay_factor=1): + """Disable paging default to a Cisco CLI method. + + :param command: Device command to disable pagination of output + :type command: str + + :param delay_factor: See __init__: global_delay_factor + :type delay_factor: int + """ + return super().disable_paging(command=command, delay_factor=delay_factor) + + def set_terminal_width(self, command="terminal width 512", delay_factor=1): + """CLI terminals try to automatically adjust the line based on the width of the terminal. + This causes the output to get distorted when accessed programmatically. + + Set terminal width to 511 which works on a broad set of devices. + + :param command: Command string to send to the device + :type command: str + + :param delay_factor: See __init__: global_delay_factor + :type delay_factor: int + """ + return super().set_terminal_width(command=command, delay_factor=delay_factor) + + def send_config_set(self, config_commands=None, exit_config_mode=False, **kwargs): + """Ericsson IPOS requires you not exit from configuration mode.""" + return super().send_config_set( + config_commands=config_commands, exit_config_mode=exit_config_mode, **kwargs + ) + + def exit_enable_mode(self, exit_command="disable"): + """ + Exits enable (privileged exec) mode. + """ + return super().exit_enable_mode(exit_command=exit_command) + + def check_config_mode(self, check_string=")#", pattern=""): + """ + Checks if the device is in configuration mode or not. + """ + return super().check_config_mode(check_string=check_string, pattern=pattern) + + def config_mode(self, config_command="configure", pattern=""): + """ + Enter into configuration mode on remote device. + """ + if not pattern: + pattern = re.escape(self.base_prompt[:16]) + return super().config_mode(config_command=config_command, pattern=pattern) + + def exit_config_mode(self, exit_config="end", pattern="#"): + """ + Exit from configuration mode. + Ercisson output : + end Commit configuration changes and return to exec mode + """ + return super().exit_config_mode(exit_config=exit_config, pattern=pattern) + + def save_config(self, cmd="save config", confirm=True, confirm_response="yes"): + """Saves configuration""" + if confirm: + output = self.send_command_timing( + command_string=cmd, strip_prompt=False, strip_command=False + ) + + if confirm_response: + output += self.send_command_timing( + confirm_response, strip_prompt=False, strip_command=False + ) + else: + output += self.send_command_timing( + self.RETURN, strip_prompt=False, strip_command=False + ) + else: + output = self.send_command( + command_string=cmd, strip_prompt=False, strip_command=False + ) + return output + + def commit(self, confirm=False, confirm_delay=None, comment="", delay_factor=1): + """ + Commit the candidate configuration. + + Commit the entered configuration. Raise an error and return the failure + if the commit fails. + + Automatically enters configuration mode + + """ + + delay_factor = self.select_delay_factor(delay_factor) + + if confirm_delay and not confirm: + raise ValueError( + "Invalid arguments supplied to commit method both confirm and check" + ) + + command_string = "commit" + commit_marker = "Transaction committed" + if confirm: + if confirm_delay: + command_string = f"commit confirmed {confirm_delay}" + else: + command_string = "commit confirmed" + commit_marker = "Commit confirmed ,it will be rolled back within" + + if comment: + if '"' in comment: + raise ValueError("Invalid comment contains double quote") + comment = f'"{comment}"' + command_string += f" comment {comment}" + + output = self.config_mode() + + output += self.send_command_expect( + command_string, + strip_prompt=False, + strip_command=False, + delay_factor=delay_factor, + ) + + if commit_marker not in output: + raise ValueError(f"Commit failed with the following errors:\n\n{output}") + + self.exit_config_mode() + + return output diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/juniper/juniper.py new/netmiko-3.3.3/netmiko/juniper/juniper.py --- old/netmiko-3.3.2/netmiko/juniper/juniper.py 2020-09-23 19:56:50.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/juniper/juniper.py 2021-02-01 21:44:50.000000000 +0100 @@ -13,22 +13,26 @@ methods. Overrides several methods for Juniper-specific compatibility. """ - def session_preparation(self): - """ - Prepare the session after the connection has been established. + def __init__(self, *args, **kwargs): + # Cisco-IOS defaults to fast_cli=True and legacy_mode=False + kwargs.setdefault("fast_cli", True) + kwargs.setdefault("_legacy_mode", False) + return super().__init__(*args, **kwargs) - Disable paging (the '--more--' prompts). - Set the base prompt for interaction ('>'). - """ - self._test_channel_read() + def session_preparation(self): + """Prepare the session after the connection has been established.""" self.enter_cli_mode() + cmd = "set cli screen-width 511" + self.set_terminal_width(command=cmd, pattern=r"Screen width set to") + # Overloading disable_paging which is confusing + self.disable_paging( + command="set cli complete-on-space off", + pattern=r"Disabling complete-on-space", + ) + self.disable_paging( + command="set cli screen-length 0", pattern=r"Screen length set to" + ) self.set_base_prompt() - self._disable_complete_on_space() - self.set_terminal_width(command="set cli screen-width 511", pattern="set") - self.disable_paging(command="set cli screen-length 0") - # Clear the read buffer - time.sleep(0.3 * self.global_delay_factor) - self.clear_buffer() def _enter_shell(self): """Enter the Bourne Shell.""" @@ -38,21 +42,6 @@ """Return to the Juniper CLI.""" return self.send_command("exit", expect_string=r"[#>]") - def _disable_complete_on_space(self): - """ - Juniper tries to auto complete commands when you type a "space" character. - - This is a bad idea for automation as what your program is sending no longer matches - the command echo from the device. So we disable this behavior. - """ - delay_factor = self.select_delay_factor(delay_factor=0) - time.sleep(delay_factor * 0.1) - command = "set cli complete-on-space off" - self.write_channel(self.normalize_cmd(command)) - time.sleep(delay_factor * 0.1) - output = self.read_channel() - return output - def enter_cli_mode(self): """Check if at shell prompt root@ and go into CLI.""" delay_factor = self.select_delay_factor(delay_factor=0) @@ -87,9 +76,16 @@ """Checks if the device is in configuration mode or not.""" return super().check_config_mode(check_string=check_string) - def config_mode(self, config_command="configure"): + def config_mode( + self, + config_command="configure", + pattern=r"Entering configuration mode", + **kwargs, + ): """Enter configuration mode.""" - return super().config_mode(config_command=config_command) + return super().config_mode( + config_command=config_command, pattern=pattern, **kwargs + ) def exit_config_mode(self, exit_config="exit configuration-mode"): """Exit configuration mode.""" @@ -139,6 +135,12 @@ """ delay_factor = self.select_delay_factor(delay_factor) + # Commit is very slow so this is needed. + # FIX: Cleanup in future versions of Netmiko + if delay_factor < 1: + if not self._legacy_mode and self.fast_cli: + delay_factor = 1 + if check and (confirm or confirm_delay or comment): raise ValueError("Invalid arguments supplied with commit check") @@ -173,22 +175,24 @@ # Enter config mode (if necessary) output = self.config_mode() # and_quit will get out of config mode on commit + if and_quit: - prompt = self.base_prompt - output += self.send_command_expect( - command_string, - expect_string=prompt, - strip_prompt=False, - strip_command=False, - delay_factor=delay_factor, - ) + expect_string = re.escape(self.base_prompt) else: - output += self.send_command_expect( + expect_string = None + + try: + fast_cli_state = self.fast_cli + self.fast_cli = False + output += self.send_command( command_string, + expect_string=expect_string, strip_prompt=False, strip_command=False, delay_factor=delay_factor, ) + finally: + self.fast_cli = fast_cli_state if commit_marker not in output: raise ValueError(f"Commit failed with the following errors:\n\n{output}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/netgear/netgear_prosafe_ssh.py new/netmiko-3.3.3/netmiko/netgear/netgear_prosafe_ssh.py --- old/netmiko-3.3.2/netmiko/netgear/netgear_prosafe_ssh.py 2020-09-23 19:56:50.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/netgear/netgear_prosafe_ssh.py 2021-02-01 21:44:50.000000000 +0100 @@ -25,10 +25,10 @@ def check_config_mode(self, check_string="(Config)#"): return super().check_config_mode(check_string=check_string) - def config_mode(self, config_command="configure", pattern=r")#"): + def config_mode(self, config_command="configure", pattern=r"\)\#"): return super().config_mode(config_command=config_command, pattern=pattern) - def exit_config_mode(self, exit_config="exit", pattern="#"): + def exit_config_mode(self, exit_config="exit", pattern=r"\#"): return super().exit_config_mode(exit_config=exit_config, pattern=pattern) def save_config( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/ssh_autodetect.py new/netmiko-3.3.3/netmiko/ssh_autodetect.py --- old/netmiko-3.3.2/netmiko/ssh_autodetect.py 2020-09-23 19:56:50.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/ssh_autodetect.py 2021-02-01 21:44:50.000000000 +0100 @@ -10,7 +10,7 @@ connection (see the *netmiko.ssh_dispatacher.ConnectHandler* function). The only acceptable value for the 'device_type' argument is 'autodetect'. -The auto-detection is solely based on the *SSH_MAPPER_BASE* dictionary. The keys are the name of +The auto-detection is solely based on *SSH_MAPPER_BASE*. The keys are the name of the 'device_type' supported for auto-detection and the value is another dictionary describing how to handle the auto-detection. @@ -101,7 +101,7 @@ }, "dell_force10": { "cmd": "show version", - "search_patterns": [r"S4048-ON"], + "search_patterns": [r"Real Time Operating System Software"], "priority": 99, "dispatch": "_autodetect_std", }, @@ -116,7 +116,7 @@ }, "dell_os10": { "cmd": "show version", - "search_patterns": [r"Dell EMC Networking OS10-Enterprise"], + "search_patterns": [r"Dell EMC Networking OS10.Enterprise"], "priority": 99, "dispatch": "_autodetect_std", }, @@ -189,6 +189,7 @@ "dispatch": "_autodetect_std", }, "cisco_wlc": { + "cmd": "", "dispatch": "_autodetect_remote_version", "search_patterns": [r"CISCO_WLC"], "priority": 99, @@ -205,8 +206,27 @@ "priority": 99, "dispatch": "_autodetect_std", }, + "fortinet": { + "cmd": "get system status", + "search_patterns": [r"FortiOS"], + "priority": 99, + "dispatch": "_autodetect_std", + }, } +# Sort SSH_MAPPER_BASE such that the most common commands are first +cmd_count = {} +for k, v in SSH_MAPPER_BASE.items(): + count = cmd_count.setdefault(v["cmd"], 0) + cmd_count[v["cmd"]] = count + 1 +cmd_count = {k: v for k, v in sorted(cmd_count.items(), key=lambda item: item[1])} + +# SSH_MAPPER_BASE will be a list after this +SSH_MAPPER_BASE = sorted( + SSH_MAPPER_BASE.items(), key=lambda item: int(cmd_count[item[1]["cmd"]]) +) +SSH_MAPPER_BASE.reverse() + class SSHDetect(object): """ @@ -259,7 +279,7 @@ best_match : str or None The device type that is currently the best to use to interact with the device """ - for device_type, autodetect_dict in SSH_MAPPER_BASE.items(): + for device_type, autodetect_dict in SSH_MAPPER_BASE: tmp_dict = autodetect_dict.copy() call_method = tmp_dict.pop("dispatch") autodetect_method = getattr(self, call_method) @@ -327,7 +347,7 @@ return cached_results def _autodetect_remote_version( - self, search_patterns=None, re_flags=re.IGNORECASE, priority=99 + self, search_patterns=None, re_flags=re.IGNORECASE, priority=99, **kwargs ): """ Method to try auto-detect the device type, by matching a regular expression on the reported diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/ssh_dispatcher.py new/netmiko-3.3.3/netmiko/ssh_dispatcher.py --- old/netmiko-3.3.2/netmiko/ssh_dispatcher.py 2020-10-01 17:50:06.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/ssh_dispatcher.py 2021-02-01 21:44:50.000000000 +0100 @@ -1,7 +1,7 @@ """Controls selection of proper class based on the device type.""" from netmiko.a10 import A10SSH from netmiko.accedian import AccedianSSH -from netmiko.adtran import AdtranOSSSH +from netmiko.adtran import AdtranOSSSH, AdtranOSTelnet from netmiko.alcatel import AlcatelAosSSH from netmiko.arista import AristaSSH, AristaTelnet from netmiko.arista import AristaFileTransfer @@ -39,6 +39,7 @@ from netmiko.eltex import EltexSSH, EltexEsrSSH from netmiko.endace import EndaceSSH from netmiko.enterasys import EnterasysSSH +from netmiko.ericsson import EricssonIposSSH from netmiko.extreme import ExtremeErsSSH from netmiko.extreme import ExtremeExosSSH from netmiko.extreme import ExtremeExosTelnet @@ -146,6 +147,7 @@ "eltex": EltexSSH, "eltex_esr": EltexEsrSSH, "enterasys": EnterasysSSH, + "ericsson_ipos": EricssonIposSSH, "extreme": ExtremeExosSSH, "extreme_ers": ExtremeErsSSH, "extreme_exos": ExtremeExosSSH, @@ -238,6 +240,7 @@ FILE_TRANSFER_MAP = new_mapper # Add telnet drivers +CLASS_MAPPER["adtran_os_telnet"] = AdtranOSTelnet CLASS_MAPPER["apresia_aeos_telnet"] = ApresiaAeosTelnet CLASS_MAPPER["arista_eos_telnet"] = AristaTelnet CLASS_MAPPER["aruba_procurve_telnet"] = HPProcurveTelnet diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/tplink/tplink_jetstream.py new/netmiko-3.3.3/netmiko/tplink/tplink_jetstream.py --- old/netmiko-3.3.2/netmiko/tplink/tplink_jetstream.py 2020-10-01 17:50:06.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/tplink/tplink_jetstream.py 2021-02-01 21:44:50.000000000 +0100 @@ -1,7 +1,6 @@ import re import time -from cryptography import utils as crypto_utils from cryptography.hazmat.primitives.asymmetric import dsa from netmiko import log @@ -124,7 +123,12 @@ class TPLinkJetStreamSSH(TPLinkJetStreamBase): - def _override_check_dsa_parameters(parameters): + def __init__(self, **kwargs): + dsa._check_dsa_parameters = self._override_check_dsa_parameters + + return super().__init__(**kwargs) + + def _override_check_dsa_parameters(self, parameters): """ Override check_dsa_parameters from cryptography's dsa.py @@ -142,14 +146,12 @@ It's still not possible to remove this hack. """ - if crypto_utils.bit_length(parameters.q) not in [160, 256]: + if parameters.q.bit_length() not in [160, 256]: raise ValueError("q must be exactly 160 or 256 bits long") if not (1 < parameters.g < parameters.p): raise ValueError("g, p don't satisfy 1 < g < p.") - dsa._check_dsa_parameters = _override_check_dsa_parameters - class TPLinkJetStreamTelnet(TPLinkJetStreamBase): def telnet_login( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko/utilities.py new/netmiko-3.3.3/netmiko/utilities.py --- old/netmiko-3.3.2/netmiko/utilities.py 2020-10-01 17:50:06.000000000 +0200 +++ new/netmiko-3.3.3/netmiko/utilities.py 2021-02-01 21:44:50.000000000 +0100 @@ -52,6 +52,7 @@ "extreme_vdx": "show running-config", "extreme_vsp": "show running-config", "extreme_wing": "show running-config", + "ericsson_ipos": "show configuration", "hp_comware": "display current-configuration", "huawei": "display current-configuration", "fortinet": "show full-configuration", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko.egg-info/PKG-INFO new/netmiko-3.3.3/netmiko.egg-info/PKG-INFO --- old/netmiko-3.3.2/netmiko.egg-info/PKG-INFO 2020-10-01 18:02:42.000000000 +0200 +++ new/netmiko-3.3.3/netmiko.egg-info/PKG-INFO 2021-02-01 21:51:04.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: netmiko -Version: 3.3.2 +Version: 3.3.3 Summary: Multi-vendor library to simplify Paramiko SSH connections to network devices Home-page: https://github.com/ktbyers/netmiko Author: Kirk Byers @@ -184,7 +184,7 @@ If you find an issue with Netmiko, then you can open an issue on this projects issue page here: [https://github.com/ktbyers/netmiko/issues](https://github.com/ktbyers/netmiko/issues). Please make sure you've read through the common issues and examples prior to opening an issue. Please only open issues for bugs, feature requests, or other topics related to development of Netmiko. If you simply have a question, join us on Slack... - If you have questions or would like to discuss Netmiko, a #netmiko channel exists in [this Slack](https://pynet.slack.com) workspace. To join, use [this invitation](https://join.slack.com/t/pynet/shared_invite/enQtNTA2MDI3NjU0MTM0LTIyZDdhMTBlOWNmNDJhNjkxZTEyMDg3NTRkOWIxMTUwOTAzYmQ0ZjMwMGMyNTM4N2E1YzA3YWQ1MWFiOWM1YzU). Once you have entered the workspace, then you can join the #netmiko channel. + If you have questions or would like to discuss Netmiko, a #netmiko channel exists in [this Slack](https://pynet.slack.com) workspace. To join, use [this invitation](https://join.slack.com/t/pynet/shared_invite/zt-km2k3upf-AkWHY4YEx3sI1R5irMmc7Q). Once you have entered the workspace, then you can join the #netmiko channel. --- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/netmiko.egg-info/SOURCES.txt new/netmiko-3.3.3/netmiko.egg-info/SOURCES.txt --- old/netmiko-3.3.2/netmiko.egg-info/SOURCES.txt 2020-10-01 18:02:42.000000000 +0200 +++ new/netmiko-3.3.3/netmiko.egg-info/SOURCES.txt 2021-02-01 21:51:04.000000000 +0100 @@ -83,6 +83,8 @@ netmiko/endace/endace_ssh.py netmiko/enterasys/__init__.py netmiko/enterasys/enterasys_ssh.py +netmiko/ericsson/__init__.py +netmiko/ericsson/ericsson_ipos.py netmiko/extreme/__init__.py netmiko/extreme/extreme_ers_ssh.py netmiko/extreme/extreme_exos.py @@ -167,6 +169,7 @@ netmiko/zte/zte_zxros.py tests/__init__.py tests/add_delay.sh +tests/asa.out tests/brocade_fastiron_commands.txt tests/brocade_netiron_commands.txt tests/ciena_saos_commands.txt @@ -193,6 +196,7 @@ tests/test_dell.sh tests/test_dellos10.sh tests/test_enterasys_switch.py +tests/test_ericsson_ipos.py tests/test_extreme_switch.py tests/test_hp.sh tests/test_hp_comware.sh @@ -264,23 +268,27 @@ tests/__pycache__/test_netmiko_autodetect.cpython-36-pytest-5.1.2.pyc tests/__pycache__/test_netmiko_autodetect.cpython-36-pytest-5.2.1.pyc tests/__pycache__/test_netmiko_autodetect.cpython-38-pytest-5.1.2.pyc +tests/__pycache__/test_netmiko_autodetect.cpython-38-pytest-6.0.2.pyc tests/__pycache__/test_netmiko_commit.cpython-36-PYTEST.pyc tests/__pycache__/test_netmiko_commit.cpython-36-pytest-5.1.2.pyc tests/__pycache__/test_netmiko_commit.cpython-36-pytest-5.2.1.pyc tests/__pycache__/test_netmiko_commit.cpython-36-pytest-5.4.1.pyc tests/__pycache__/test_netmiko_commit.cpython-38-pytest-5.1.2.pyc +tests/__pycache__/test_netmiko_commit.cpython-38-pytest-6.0.2.pyc tests/__pycache__/test_netmiko_config.cpython-36-PYTEST.pyc tests/__pycache__/test_netmiko_config.cpython-36-pytest-5.1.2.pyc tests/__pycache__/test_netmiko_config.cpython-36-pytest-5.2.1.pyc tests/__pycache__/test_netmiko_config.cpython-36-pytest-5.4.1.pyc tests/__pycache__/test_netmiko_config.cpython-36-pytest-5.4.3.pyc tests/__pycache__/test_netmiko_config.cpython-38-pytest-5.1.2.pyc +tests/__pycache__/test_netmiko_config.cpython-38-pytest-6.0.2.pyc tests/__pycache__/test_netmiko_config_acl.cpython-36-PYTEST.pyc tests/__pycache__/test_netmiko_config_acl.cpython-36-pytest-5.1.2.pyc tests/__pycache__/test_netmiko_config_acl.cpython-36-pytest-5.2.1.pyc tests/__pycache__/test_netmiko_config_acl.cpython-36-pytest-5.4.1.pyc tests/__pycache__/test_netmiko_config_acl.cpython-36-pytest-5.4.3.pyc tests/__pycache__/test_netmiko_config_acl.cpython-38-pytest-5.1.2.pyc +tests/__pycache__/test_netmiko_config_acl.cpython-38-pytest-6.0.2.pyc tests/__pycache__/test_netmiko_exceptions.cpython-36-PYTEST.pyc tests/__pycache__/test_netmiko_exceptions.cpython-36-pytest-5.1.2.pyc tests/__pycache__/test_netmiko_exceptions.cpython-36-pytest-5.4.3.pyc @@ -292,6 +300,7 @@ tests/__pycache__/test_netmiko_scp.cpython-36-pytest-5.4.1.pyc tests/__pycache__/test_netmiko_scp.cpython-36-pytest-5.4.3.pyc tests/__pycache__/test_netmiko_scp.cpython-38-pytest-5.1.2.pyc +tests/__pycache__/test_netmiko_scp.cpython-38-pytest-6.0.2.pyc tests/__pycache__/test_netmiko_session_log.cpython-36-PYTEST.pyc tests/__pycache__/test_netmiko_session_log.cpython-36-pytest-5.1.2.pyc tests/__pycache__/test_netmiko_session_log.cpython-36-pytest-5.2.1.pyc @@ -311,6 +320,7 @@ tests/__pycache__/test_netmiko_tcl.cpython-36-pytest-5.4.1.pyc tests/__pycache__/test_netmiko_tcl.cpython-36-pytest-5.4.3.pyc tests/__pycache__/test_netmiko_tcl.cpython-38-pytest-5.1.2.pyc +tests/__pycache__/test_netmiko_tcl.cpython-38-pytest-6.0.2.pyc tests/__pycache__/test_utils.cpython-36-PYTEST.pyc tests/__pycache__/test_utils.cpython-36-pytest-5.1.2.pyc tests/__pycache__/test_utils.cpython-36-pytest-5.2.1.pyc @@ -335,6 +345,7 @@ tests/unit/.netmiko.yml tests/unit/__init__.py tests/unit/test_base_connection.py +tests/unit/test_ssh_autodetect.py tests/unit/test_utilities.py tests/unit/__pycache__/__init__.cpython-36-pytest-5.1.2.pyc tests/unit/__pycache__/__init__.cpython-36-pytest-5.2.1.pyc @@ -348,6 +359,7 @@ tests/unit/__pycache__/test_base_connection.cpython-36-pytest-5.4.3.pyc tests/unit/__pycache__/test_base_connection.cpython-38-pytest-5.1.2.pyc tests/unit/__pycache__/test_base_connection.cpython-38-pytest-6.0.2.pyc +tests/unit/__pycache__/test_ssh_autodetect.cpython-38-pytest-6.0.2.pyc tests/unit/__pycache__/test_utilities.cpython-36-PYTEST.pyc tests/unit/__pycache__/test_utilities.cpython-36-pytest-5.1.2.pyc tests/unit/__pycache__/test_utilities.cpython-36-pytest-5.2.1.pyc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/setup.cfg new/netmiko-3.3.3/setup.cfg --- old/netmiko-3.3.2/setup.cfg 2020-10-01 18:02:42.000000000 +0200 +++ new/netmiko-3.3.3/setup.cfg 2021-02-01 21:51:04.000000000 +0100 @@ -1,5 +1,5 @@ [bdist_wheel] -universal = 1 +universal = 0 [metadata] license_file = LICENSE Binary files old/netmiko-3.3.2/tests/__pycache__/conftest.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/__pycache__/conftest.cpython-38-pytest-6.0.2.pyc differ Binary files old/netmiko-3.3.2/tests/__pycache__/test_netmiko_autodetect.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/__pycache__/test_netmiko_autodetect.cpython-38-pytest-6.0.2.pyc differ Binary files old/netmiko-3.3.2/tests/__pycache__/test_netmiko_commit.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/__pycache__/test_netmiko_commit.cpython-38-pytest-6.0.2.pyc differ Binary files old/netmiko-3.3.2/tests/__pycache__/test_netmiko_config.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/__pycache__/test_netmiko_config.cpython-38-pytest-6.0.2.pyc differ Binary files old/netmiko-3.3.2/tests/__pycache__/test_netmiko_config_acl.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/__pycache__/test_netmiko_config_acl.cpython-38-pytest-6.0.2.pyc differ Binary files old/netmiko-3.3.2/tests/__pycache__/test_netmiko_scp.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/__pycache__/test_netmiko_scp.cpython-38-pytest-6.0.2.pyc differ Binary files old/netmiko-3.3.2/tests/__pycache__/test_netmiko_show.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/__pycache__/test_netmiko_show.cpython-38-pytest-6.0.2.pyc differ Binary files old/netmiko-3.3.2/tests/__pycache__/test_netmiko_tcl.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/__pycache__/test_netmiko_tcl.cpython-38-pytest-6.0.2.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/tests/asa.out new/netmiko-3.3.3/tests/asa.out --- old/netmiko-3.3.2/tests/asa.out 1970-01-01 01:00:00.000000000 +0100 +++ new/netmiko-3.3.3/tests/asa.out 2021-02-01 20:20:50.000000000 +0100 @@ -0,0 +1,127 @@ +Type help or '?' for a list of available commands. +twb-dc-fw1> login +Username: login +Password: ************ +%Login failed +ERROR: Invalid username +Username: admin +Password: ************ +twb-dc-fw1# terminal pager 0 +twb-dc-fw1# +twb-dc-fw1# configure terminal +twb-dc-fw1(config)# +twb-dc-fw1(config)# terminal width 511 +twb-dc-fw1(config)# +twb-dc-fw1(config)# end +twb-dc-fw1# +twb-dc-fw1# +twb-dc-fw1# +twb-dc-fw1# show version + +Cisco Adaptive Security Appliance Software Version 9.5(2) +Device Manager Version 7.5(2) + +Compiled on Sat 28-Nov-15 00:16 PST by builders +System image file is "disk0:/asa952-lfbff-k8.SPA" +Config file at boot was "startup-config" + +twb-dc-fw1 up 1 year 118 days + +Hardware: ASA5506, 4096 MB RAM, CPU Atom C2000 series 1250 MHz, 1 CPU (4 cores) +Internal ATA Compact Flash, 8192MB +BIOS Flash M25P64 @ 0xfed01000, 16384KB + +Encryption hardware device : Cisco ASA Crypto on-board accelerator (revision 0x1) + Number of accelerators: 1 + + 1: Ext: GigabitEthernet1/1 : address is 0062.ec29.70fc, irq 255 + 2: Ext: GigabitEthernet1/2 : address is 0062.ec29.70fd, irq 255 + 3: Ext: GigabitEthernet1/3 : address is 0062.ec29.70fe, irq 255 + 4: Ext: GigabitEthernet1/4 : address is 0062.ec29.70ff, irq 255 + 5: Ext: GigabitEthernet1/5 : address is 0062.ec29.7100, irq 255 + 6: Ext: GigabitEthernet1/6 : address is 0062.ec29.7101, irq 255 + 7: Ext: GigabitEthernet1/7 : address is 0062.ec29.7102, irq 255 + 8: Ext: GigabitEthernet1/8 : address is 0062.ec29.7103, irq 255 + 9: Int: Internal-Data1/1 : address is 0062.ec29.70fb, irq 255 +10: Int: Internal-Data1/2 : address is 0000.0001.0002, irq 0 +11: Int: Internal-Control1/1 : address is 0000.0001.0001, irq 0 +12: Int: Internal-Data1/3 : address is 0000.0001.0003, irq 0 +13: Ext: Management1/1 : address is 0062.ec29.70fb, irq 0 + +Licensed features for this platform: +Maximum Physical Interfaces : Unlimited perpetual +Maximum VLANs : 5 perpetual +Inside Hosts : Unlimited perpetual +Failover : Disabled perpetual +Encryption-DES : Enabled perpetual +Encryption-3DES-AES : Enabled perpetual +Carrier : Disabled perpetual +AnyConnect Premium Peers : 2 perpetual +AnyConnect Essentials : Disabled perpetual +Other VPN Peers : 10 perpetual +Total VPN Peers : 12 perpetual +AnyConnect for Mobile : Disabled perpetual +AnyConnect for Cisco VPN Phone : Disabled perpetual +Advanced Endpoint Assessment : Disabled perpetual +Shared License : Disabled perpetual +Total UC Proxy Sessions : 2 perpetual +Botnet Traffic Filter : Disabled perpetual +Cluster : Disabled perpetual + +This platform has a Base license. + +Serial Number: JAD20190034 +Running Permanent Activation Key: 0x303efb44 0x74718d1c 0xcc339db4 0xa088349c 0x861606ab +Configuration register is 0x1 +Image type : Release +Key Version : A +Configuration last modified by admin at 11:20:46.104 PST Mon Feb 1 2021 +twb-dc-fw1# +twb-dc-fw1# +twb-dc-fw1# +twb-dc-fw1# configure terminal +twb-dc-fw1(config)# +twb-dc-fw1(config)# +twb-dc-fw1(config)# +twb-dc-fw1(config)# end +twb-dc-fw1# +twb-dc-fw1# +twb-dc-fw1# +twb-dc-fw1# configure terminal +twb-dc-fw1(config)# +twb-dc-fw1(config)# logging buffered notifications +twb-dc-fw1(config)# +twb-dc-fw1(config)# end +twb-dc-fw1# +twb-dc-fw1# +twb-dc-fw1# show run | inc logging buffer +logging buffer-size 500000 +logging buffered notifications +twb-dc-fw1# +twb-dc-fw1# configure terminal +twb-dc-fw1(config)# +twb-dc-fw1(config)# logging buffered notifications +twb-dc-fw1(config)# no logging console +twb-dc-fw1(config)# logging buffered warnings +twb-dc-fw1(config)# +twb-dc-fw1(config)# end +twb-dc-fw1# +twb-dc-fw1# +twb-dc-fw1# show run | inc logging buffer +logging buffer-size 500000 +logging buffered warnings +twb-dc-fw1# +twb-dc-fw1# configure terminal +twb-dc-fw1(config)# +twb-dc-fw1(config)# logging buffered notifications +twb-dc-fw1(config)# no logging console +twb-dc-fw1(config)# logging buffered warnings +twb-dc-fw1(config)# +twb-dc-fw1(config)# end +twb-dc-fw1# +twb-dc-fw1# +twb-dc-fw1# show run | inc logging buffer +logging buffer-size 500000 +logging buffered warnings +twb-dc-fw1# +twb-dc-fw1# exit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/tests/etc/test_devices.yml new/netmiko-3.3.3/tests/etc/test_devices.yml --- old/netmiko-3.3.2/tests/etc/test_devices.yml 2020-08-30 00:16:43.000000000 +0200 +++ new/netmiko-3.3.3/tests/etc/test_devices.yml 2021-02-01 19:44:51.000000000 +0100 @@ -83,6 +83,7 @@ username: admin password: '{g76l%m30WlJ' allow_auto_change: True + session_log: asa.out arista_sw: device_type: arista_eos diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/tests/juniper.out new/netmiko-3.3.3/tests/juniper.out --- old/netmiko-3.3.2/tests/juniper.out 2020-09-30 22:21:26.000000000 +0200 +++ new/netmiko-3.3.3/tests/juniper.out 2021-02-01 20:30:29.000000000 +0100 @@ -1,31 +1,7 @@ --- JUNOS 12.1X44-D35.5 built 2014-05-19 21:36:43 UTC -pyclass@srx1> show system - ^ -syntax error, expecting <command>. - pyclass@srx1> show version Hostname: srx1 Model: srx100h2 JUNOS Software Release [12.1X44-D35.5] -pyclass@srx1> show system version - ^ -syntax error, expecting <command>. - -pyclass@srx1> cat - ^ -unknown command. - -pyclass@srx1> cat /etc/issue - ^ -unknown command. - -pyclass@srx1> display - ^ -unknown command. - -pyclass@srx1> display version - ^ -unknown command. - pyclass@srx1> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/tests/test_ericsson_ipos.py new/netmiko-3.3.3/tests/test_ericsson_ipos.py --- old/netmiko-3.3.2/tests/test_ericsson_ipos.py 1970-01-01 01:00:00.000000000 +0100 +++ new/netmiko-3.3.3/tests/test_ericsson_ipos.py 2021-02-01 21:44:50.000000000 +0100 @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +""" +This will run an ssh command successfully on an Ericsson IPPOS. +SSH must be enabled on the device + +""" + +from netmiko.ssh_dispatcher import ConnectHandler + + +def main(): + """ + This will run an ssh command successfully on an Ericsson IPPOS. + SSH must be enabled on the device + """ + + ericsson_connect = { + "device_type": "ericsson_ipos", + "ip": "1.1.1.1", + "username": "admin", + "password": "admin", + } + + net_connect = ConnectHandler(**ericsson_connect) + output = net_connect.send_command("show ip int brief") + print(output) + + output_commit = net_connect.commit() + print(output_commit) + + +if __name__ == "__main__": + main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/tests/test_suite_alt.sh new/netmiko-3.3.3/tests/test_suite_alt.sh --- old/netmiko-3.3.2/tests/test_suite_alt.sh 2020-09-23 19:56:50.000000000 +0200 +++ new/netmiko-3.3.3/tests/test_suite_alt.sh 2021-02-01 21:44:50.000000000 +0100 @@ -11,17 +11,6 @@ && py.test -x -s -v test_netmiko_show.py --test_device juniper_vmx \ && py.test -x -s -v test_netmiko_config.py --test_device juniper_vmx \ \ -&& echo "Nokia SR-OS CLI" \ -&& py.test -x -s -v test_netmiko_show.py --test_device sros2 \ -&& py.test -x -s -v test_netmiko_config.py --test_device sros2 \ -&& py.test -x -s -v test_netmiko_scp.py --test_device sros2 \ -\ -&& echo "SR-OS MD" \ -&& py.test -x -s -v test_netmiko_show.py --test_device sros1_md \ -&& py.test -x -s -v test_netmiko_config.py --test_device sros1_md \ -&& py.test -x -s -v test_netmiko_scp.py --test_device sros1_md \ -&& py.test -x -s -v test_netmiko_commit.py --test_device sros1_md \ -\ && echo "Cisco IOS-XE SSH (including SCP)" \ && py.test -v test_netmiko_scp.py --test_device cisco3 \ && py.test -v test_netmiko_show.py --test_device cisco3 \ @@ -128,3 +117,14 @@ # && py.test -v test_netmiko_commit.py --test_device cisco_xr_azure \ # # && py.test -v test_netmiko_session_log.py --test_device cisco881_slog \ +#&& echo "Nokia SR-OS CLI" \ +#&& py.test -x -s -v test_netmiko_show.py --test_device sros2 \ +#&& py.test -x -s -v test_netmiko_config.py --test_device sros2 \ +#&& py.test -x -s -v test_netmiko_scp.py --test_device sros2 \ +#\ +#&& echo "SR-OS MD" \ +#&& py.test -x -s -v test_netmiko_show.py --test_device sros1_md \ +#&& py.test -x -s -v test_netmiko_config.py --test_device sros1_md \ +#&& py.test -x -s -v test_netmiko_scp.py --test_device sros1_md \ +#&& py.test -x -s -v test_netmiko_commit.py --test_device sros1_md \ +#\ Binary files old/netmiko-3.3.2/tests/unit/__pycache__/test_base_connection.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/unit/__pycache__/test_base_connection.cpython-38-pytest-6.0.2.pyc differ Binary files old/netmiko-3.3.2/tests/unit/__pycache__/test_ssh_autodetect.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/unit/__pycache__/test_ssh_autodetect.cpython-38-pytest-6.0.2.pyc differ Binary files old/netmiko-3.3.2/tests/unit/__pycache__/test_utilities.cpython-38-pytest-6.0.2.pyc and new/netmiko-3.3.3/tests/unit/__pycache__/test_utilities.cpython-38-pytest-6.0.2.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netmiko-3.3.2/tests/unit/test_ssh_autodetect.py new/netmiko-3.3.3/tests/unit/test_ssh_autodetect.py --- old/netmiko-3.3.2/tests/unit/test_ssh_autodetect.py 1970-01-01 01:00:00.000000000 +0100 +++ new/netmiko-3.3.3/tests/unit/test_ssh_autodetect.py 2021-02-01 21:44:50.000000000 +0100 @@ -0,0 +1,7 @@ +#!/usr/bin/env python +from netmiko.ssh_autodetect import SSH_MAPPER_BASE + + +def test_ssh_base_mapper_order(): + "SSH_MAPPER_BASE should be sorted based on the most common command used." "" + assert SSH_MAPPER_BASE[0][1]["cmd"] == "show version"