quick_netmiko package

Submodules

quick_netmiko.quick_netmiko module

This is a simple class to get command from Cisco devices

exception quick_netmiko.quick_netmiko.BadProtocol(value)[source]

Bases: Exception

Exception for Protocol Exceptions

exception quick_netmiko.quick_netmiko.BadSshDeviceType(value)[source]

Bases: Exception

Exception for a bad ssh device type Exceptions

exception quick_netmiko.quick_netmiko.BadTelnetDeviceType(value)[source]

Bases: Exception

Exception for a bad telnet device type Exceptions

exception quick_netmiko.quick_netmiko.FailedDnsLookup(value)[source]

Bases: Exception

Exception for DNS Exceptions

class quick_netmiko.quick_netmiko.QuickNetmiko(device_ip_name: str, device_type: str, username: str, password: str, protocol: Optional[str] = 'ssh')[source]

Bases: object

Class to run commands and get output

Parameters
  • device_ip_name (String) – The device name or ip address

  • device_type (String) – The device type see ssh_connections, and telnet_connections

  • username (String) – The username to use

  • password (String) – The password to use

  • protocol (String) – One of the following {‘ssh’, ‘telnet’} default: ssh

Return type

None

Returns

None

Raises
  • BadProtocol – If protocol is not one of the following {‘ssh’, ‘telnet’}

  • BadSshDeviceType – If protocol is ssh and device_type is not one in ssh_connections

  • BadTelnetDeviceType – If protocol is telnet and device_type is not one in telnet_connections

  • FailedDnsLookup – If a hostname is not able to be looked up via DNS

  • FailedDnsLookup – If there is a timeout when looking up a hostname

protocols = {'ssh', 'telnet'}
send_commands(commands: Union[List[str], str]) str[source]

Method to send a list of commands or single command to a device and get the results

Parameters

commands (List or String) – The list of commands or single command to get data for

Return type

String

Returns

The results from the commands

Raises

TypeError – If commands is not a list or string

ssh_connections = {'arista_eos': 'arista_eos_ssh', 'arista_eos_ssh': 'arista_eos_ssh', 'aruba_os': 'aruba_os_ssh', 'aruba_os_ssh': 'aruba_os_ssh', 'cisco_ios': 'cisco_ios_ssh', 'cisco_ios_ssh': 'cisco_ios_ssh', 'cisco_nxos': 'cisco_nxos_ssh', 'cisco_nxos_ssh': 'cisco_nxos_ssh', 'cisco_xr': 'cisco_xr_ssh', 'cisco_xr_ssh': 'cisco_xr_ssh', 'eos': 'arista_eos_ssh', 'ios': 'cisco_ios_ssh', 'iosxe': 'cisco_ios_ssh', 'iosxr': 'cisco_xr_ssh', 'nxos': 'cisco_nxos_ssh'}
telnet_connections = {'arista_eos': 'arista_eos_telnet', 'arista_eos_telnet': 'arista_eos_telnet', 'cisco_ios': 'cisco_ios_telnet', 'cisco_ios_telnet': 'cisco_ios_telnet', 'cisco_nxos': 'cisco_nxos_telnet', 'cisco_nxos_telnet': 'cisco_nxos_telnet', 'cisco_xr': 'cisco_xr_telnet', 'cisco_xr_telnet': 'cisco_xr_telnet', 'eos': 'arista_eos_telnet', 'ios': 'cisco_ios_telnet', 'iosxe': 'cisco_ios_telnet', 'iosxr': 'cisco_xr_telnet', 'nxos': 'cisco_nxos_telnet'}

Module contents

init for package