Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from __future__ import unicode_literals
from netmiko.cisco_base_connection import CiscoSSHConnection
class BrocadeNetironSSH(CiscoSSHConnection):
pass
"""Dell PowerConnect Driver."""
from __future__ import unicode_literals
from paramiko import SSHClient
import time
from os import path
from netmiko.cisco_base_connection import CiscoSSHConnection
class SSHClient_noauth(SSHClient):
def _auth(self, username, *args):
self._transport.auth_none(username)
return
class DellPowerConnectBase(CiscoSSHConnection):
"""Dell PowerConnect Driver."""
def session_preparation(self):
"""Prepare the session after the connection has been established."""
self.ansi_escape_codes = True
self._test_channel_read()
self.set_base_prompt()
self.disable_paging(command="terminal datadump")
# Clear the read buffer
time.sleep(.3 * self.global_delay_factor)
self.clear_buffer()
def set_base_prompt(self, pri_prompt_terminator='>', alt_prompt_terminator='#',
delay_factor=1):
"""Sets self.base_prompt: used as delimiter for stripping of trailing prompt in output."""
prompt = super(DellPowerConnectSSH, self).set_base_prompt(
pri_prompt_terminator=pri_prompt_terminator,
from __future__ import unicode_literals
import re
import socket
import time
from netmiko.cisco_base_connection import CiscoSSHConnection
from netmiko.cisco_base_connection import CiscoFileTransfer
from netmiko.ssh_exception import NetMikoTimeoutException
class LinuxSSH(CiscoSSHConnection):
def session_preparation(self):
"""Prepare the session after the connection has been established."""
self.ansi_escape_codes = True
return super(LinuxSSH, self).session_preparation()
def _enter_shell(self):
"""Already in shell."""
return ""
def _return_cli(self):
"""The shell is the CLI."""
return ""
def disable_paging(self, *args, **kwargs):
"""Linux doesn't have paging by default."""
return ""
"""Dell EMC Networking OS10 Driver - supports dellos10."""
from netmiko.cisco_base_connection import CiscoSSHConnection
from netmiko.scp_handler import BaseFileTransfer
import os
import re
class DellOS10SSH(CiscoSSHConnection):
"""Dell EMC Networking OS10 Driver - supports dellos10."""
def save_config(
self,
cmd="copy running-configuration startup-configuration",
confirm=False,
confirm_response="",
):
"""Saves Config"""
return super().save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
)
class DellOS10FileTransfer(BaseFileTransfer):
"""Dell EMC Networking OS10 SCP File Transfer driver."""
"""Dell Force10 Driver - supports DNOS9."""
from __future__ import unicode_literals
from netmiko.cisco_base_connection import CiscoSSHConnection
class DellForce10SSH(CiscoSSHConnection):
"""Dell Force10 Driver - supports DNOS9."""
def save_config(
self, cmd="copy running-configuration startup-configuration", confirm=False
):
"""Saves Config"""
return super(DellForce10SSH, self).save_config(cmd=cmd, confirm=confirm)
from __future__ import unicode_literals
import re
import time
from netmiko.cisco_base_connection import CiscoSSHConnection
class RuckusFastironBase(CiscoSSHConnection):
"""Ruckus FastIron aka ICX support."""
def session_preparation(self):
"""FastIron requires to be enable mode to disable paging."""
self._test_channel_read()
self.set_base_prompt()
self.enable()
self.disable_paging(command="skip-page-display")
# Clear the read buffer
time.sleep(0.3 * self.global_delay_factor)
self.clear_buffer()
def enable(
self, cmd="enable", pattern=r"(ssword|User Name)", re_flags=re.IGNORECASE
):
"""Enter enable mode.
"""Support for Extreme SLX."""
import time
from netmiko.cisco_base_connection import CiscoSSHConnection
class ExtremeSlxSSH(CiscoSSHConnection):
"""Support for Extreme SLX."""
def enable(self, *args, **kwargs):
"""No enable mode on Extreme SLX."""
pass
def exit_enable_mode(self, *args, **kwargs):
"""No enable mode on Extreme Slx."""
pass
def special_login_handler(self, delay_factor=1):
"""Adding a delay after login."""
delay_factor = self.select_delay_factor(delay_factor)
self.write_channel(self.RETURN)
time.sleep(1 * delay_factor)
"""
CiscoTpTcCeSSH Class
Class to manage Cisco Telepresence Endpoint on TC/CE software release. Also working for Cisco
Expressway/VCS
Written by Ahmad Barrin
"""
from __future__ import unicode_literals
import time
import re
from netmiko.cisco_base_connection import CiscoSSHConnection
class CiscoTpTcCeSSH(CiscoSSHConnection):
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(CiscoTpTcCeSSH, self).__init__(*args, **kwargs)
def disable_paging(self, *args, **kwargs):
"""Paging is disabled by default."""
return ""
def session_preparation(self):
"""
Prepare the session after the connection has been established
This method handles some of vagaries that occur between various devices
early on in the session.
import time
from os import path
from paramiko import SSHClient
from netmiko.cisco_base_connection import CiscoSSHConnection
class SSHClient_noauth(SSHClient):
"""Set noauth when manually handling SSH authentication."""
def _auth(self, username, *args):
self._transport.auth_none(username)
return
class CalixB6Base(CiscoSSHConnection):
"""Common methods for Calix B6, both SSH and Telnet."""
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(CalixB6SSH, self).__init__(*args, **kwargs)
def session_preparation(self):
"""Prepare the session after the connection has been established."""
self.ansi_escape_codes = True
self._test_channel_read()
self.set_base_prompt()
self.disable_paging()
self.set_terminal_width(command="terminal width 511")
# Clear the read buffer
time.sleep(.3 * self.global_delay_factor)
self.clear_buffer()
from __future__ import unicode_literals
import re
import time
from netmiko.cisco_base_connection import CiscoSSHConnection
class BrocadeFastironSSH(CiscoSSHConnection):
"""Brocade FastIron aka ICX support."""
def session_preparation(self):
"""FastIron requires to be enable mode to disable paging."""
self._test_channel_read()
self.set_base_prompt()
self.enable()
self.disable_paging(command="skip-page-display")
@staticmethod
def normalize_linefeeds(a_string):
"""Convert '\r\n\r\n', '\r\r\n','\r\n', '\n\r' to '\n."""
newline = re.compile(r'(\r\n\r\n|\r\r\n|\r\n|\n\r|\r)')
return newline.sub('\n', a_string)
def enable(self, cmd='enable', pattern=r'(ssword|User Name)', re_flags=re.IGNORECASE):
"""Enter enable mode.