From d2db9e108d6b839b6368130d63eb5118f46a02f6 Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez <baptiste.jonglez@inria.fr> Date: Tue, 3 Jan 2023 14:48:30 +0100 Subject: [PATCH] Improve performance for Dell force10 and OS10 devices Defining a pattern is necessary to get good performance, otherwise Netmiko falls back to a sleep-based mechanism (read_channel_timing) for many common operations. --- netmiko/dell/dell_force10_ssh.py | 18 ++++++++++++++++++ netmiko/dell/dell_os10_ssh.py | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/netmiko/dell/dell_force10_ssh.py b/netmiko/dell/dell_force10_ssh.py index 9ce811f6..715e7d80 100644 --- a/netmiko/dell/dell_force10_ssh.py +++ b/netmiko/dell/dell_force10_ssh.py @@ -5,6 +5,24 @@ from netmiko.cisco_base_connection import CiscoSSHConnection class DellForce10SSH(CiscoSSHConnection): """Dell Force10 Driver - supports DNOS9.""" + def session_preparation(self) -> None: + """Prepare the session after the connection has been established.""" + self._test_channel_read(pattern=r"[>#]") + self.set_base_prompt() + self.set_terminal_width() + self.disable_paging() + + def check_config_mode( + self, + check_string: str = ")#", + pattern: str = r"[>#]", + force_regex: bool = False, + ) -> bool: + """ + 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: str = "copy running-configuration startup-configuration", diff --git a/netmiko/dell/dell_os10_ssh.py b/netmiko/dell/dell_os10_ssh.py index 4c2ed0d5..e6427eb4 100644 --- a/netmiko/dell/dell_os10_ssh.py +++ b/netmiko/dell/dell_os10_ssh.py @@ -10,6 +10,24 @@ import re class DellOS10SSH(CiscoSSHConnection): """Dell EMC Networking OS10 Driver - supports dellos10.""" + def session_preparation(self) -> None: + """Prepare the session after the connection has been established.""" + self._test_channel_read(pattern=r"[>#]") + self.set_base_prompt() + self.set_terminal_width() + self.disable_paging() + + def check_config_mode( + self, + check_string: str = ")#", + pattern: str = r"[>#]", + force_regex: bool = False, + ) -> bool: + """ + 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: str = "copy running-configuration startup-configuration", -- GitLab