networking_generic_switch.devices.netmiko_devices package¶
Submodules¶
networking_generic_switch.devices.netmiko_devices.arista module¶
-
class
networking_generic_switch.devices.netmiko_devices.arista.
AristaEos
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
ADD_NETWORK
= ('vlan {segmentation_id}', 'name {network_name}')¶
-
DELETE_NETWORK
= ('no vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('interface {port}', 'no switchport access vlan {segmentation_id}', 'no switchport mode trunk', 'switchport trunk allowed vlan none')¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'switchport mode access', 'switchport access vlan {segmentation_id}')¶
-
networking_generic_switch.devices.netmiko_devices.aruba module¶
-
class
networking_generic_switch.devices.netmiko_devices.aruba.
ArubaOSCX
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
Built for ArubaOS-CX
-
ADD_NETWORK
= ('vlan {segmentation_id}', 'name {network_name}')¶
-
ADD_NETWORK_TO_TRUNK
= ('interface {port}', 'no routing', 'vlan trunk allowed {segmentation_id}')¶
-
DELETE_NETWORK
= ('no vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('interface {port}', 'no vlan access {segmentation_id}')¶
-
DISABLE_PORT
= ('interface {port}', 'shutdown')¶
-
ENABLE_PORT
= ('interface {port}', 'no shutdown')¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'no routing', 'vlan access {segmentation_id}')¶
-
REMOVE_NETWORK_FROM_TRUNK
= ('interface {port}', 'no vlan trunk allowed {segmentation_id}')¶
-
networking_generic_switch.devices.netmiko_devices.brocade module¶
-
class
networking_generic_switch.devices.netmiko_devices.brocade.
BrocadeFastIron
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
ADD_NETWORK
= ('vlan {segmentation_id} by port', 'name {network_name}')¶
-
DELETE_NETWORK
= ('no vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('vlan {segmentation_id} by port', 'no untagged ether {port}')¶
-
PLUG_PORT_TO_NETWORK
= ('vlan {segmentation_id} by port', 'untagged ether {port}')¶
-
QUERY_PORT
= ('show interfaces ether {port} | include VLAN',)¶
-
clean_port_vlan_if_necessary
(port)¶
-
get_wrong_vlan
(port)¶
-
plug_port_to_network
(port, segmentation_id)¶
-
networking_generic_switch.devices.netmiko_devices.cisco module¶
-
class
networking_generic_switch.devices.netmiko_devices.cisco.
CiscoIos
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
ADD_NETWORK
= ('vlan {segmentation_id}', 'name {network_name}')¶
-
DELETE_NETWORK
= ('no vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('interface {port}', 'no switchport access vlan {segmentation_id}', 'no switchport mode trunk', 'switchport trunk allowed vlan none')¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'switchport mode access', 'switchport access vlan {segmentation_id}')¶
-
-
class
networking_generic_switch.devices.netmiko_devices.cisco.
CiscoNxOS
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
Netmiko device driver for Cisco Nexus switches running NX-OS.
-
ADD_NETWORK
= ('vlan {segmentation_id}', 'name {network_name}', 'exit')¶
-
ADD_NETWORK_TO_TRUNK
= ('interface {port}', 'switchport mode trunk', 'switchport trunk allowed vlan add {segmentation_id}', 'exit')¶
-
DELETE_NETWORK
= ('no vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('interface {port}', 'no switchport access vlan', 'exit')¶
-
DISABLE_PORT
= ('interface {port}', 'shutdown', 'exit')¶
-
ENABLE_PORT
= ('interface {port}', 'no shutdown', 'exit')¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'switchport mode access', 'switchport access vlan {segmentation_id}', 'exit')¶
-
REMOVE_NETWORK_FROM_TRUNK
= ('interface {port}', 'switchport trunk allowed vlan remove {segmentation_id}', 'exit')¶
-
networking_generic_switch.devices.netmiko_devices.cisco300 module¶
-
class
networking_generic_switch.devices.netmiko_devices.cisco300.
Cisco300
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
ADD_NETWORK
= ('vlan {segmentation_id}',)¶
-
DELETE_NETWORK
= ('no vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('interface {port}', 'no switchport access vlan', 'switchport trunk allowed vlan remove all')¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'switchport mode access', 'switchport access vlan {segmentation_id}')¶
-
networking_generic_switch.devices.netmiko_devices.cumulus module¶
-
class
networking_generic_switch.devices.netmiko_devices.cumulus.
Cumulus
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
Built for Cumulus 4.x
Note for this switch you want config like this, where secret is the password needed for sudo su:
[genericswitch:<hostname>] device_type = netmiko_cumulus ip = <ip> username = <username> password = <password> secret = <password for sudo> ngs_physical_networks = physnet1 ngs_max_connections = 1 ngs_port_default_vlan = 123 ngs_disable_inactive_ports = False
-
ADD_NETWORK
= ['net add vlan {segmentation_id}']¶
-
DELETE_NETWORK
= ['net del vlan {segmentation_id}']¶
-
DELETE_PORT
= ['net del interface {port} bridge access {segmentation_id}']¶
-
DISABLE_BOND
= ['net add bond {bond} link down']¶
-
DISABLE_PORT
= ['net add interface {port} link down']¶
-
ENABLE_BOND
= ['net del bond {bond} link down']¶
-
ENABLE_PORT
= ['net del interface {port} link down']¶
-
ERROR_MSG_PATTERNS
= [re.compile('ERROR: Command not found.'), re.compile('command not found'), re.compile('is not a physical interface on this switch')]¶
-
NETMIKO_DEVICE_TYPE
= 'linux'¶
-
PLUG_BOND_TO_NETWORK
= ['net add bond {bond} bridge access {segmentation_id}']¶
-
PLUG_PORT_TO_NETWORK
= ['net add interface {port} bridge access {segmentation_id}']¶
-
SAVE_CONFIGURATION
= ['net commit']¶
-
UNPLUG_BOND_FROM_NETWORK
= ['net del bond {bond} bridge access {segmentation_id}']¶
-
-
class
networking_generic_switch.devices.netmiko_devices.cumulus.
CumulusNVUE
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
Built for Cumulus 5.x
Note for this switch you want config like this, where secret is the password needed for sudo su:
[genericswitch:<hostname>] device_type = netmiko_cumulus_nvue ip = <ip> username = <username> password = <password> secret = <password for sudo> ngs_physical_networks = physnet1 ngs_max_connections = 1 ngs_port_default_vlan = 123 ngs_disable_inactive_ports = False
-
ADD_NETWORK
= ['nv set bridge domain br_default vlan {segmentation_id}']¶
-
DELETE_NETWORK
= ['nv unset bridge domain br_default vlan {segmentation_id}']¶
-
DELETE_PORT
= ['nv unset interface {port} bridge domain br_default access']¶
-
DISABLE_PORT
= ['nv set interface {port} link state down']¶
-
ENABLE_PORT
= ['nv set interface {port} link state up']¶
-
ERROR_MSG_PATTERNS
= [re.compile('Invalid config'), re.compile('Config invalid at'), re.compile('ERROR: Command not found.'), re.compile('command not found'), re.compile('is not a physical interface on this switch'), re.compile('Error: Invalid parameter'), re.compile('Unable to restart services'), re.compile('Failure during apply')]¶
-
NETMIKO_DEVICE_TYPE
= 'linux'¶
-
PLUG_PORT_TO_NETWORK
= ['nv set interface {port} bridge domain br_default access {segmentation_id}']¶
-
SAVE_CONFIGURATION
= ['nv config save']¶
-
send_config_set
(net_connect, cmd_set)¶ Send a set of configuration lines to the device.
- Parameters
net_connect – a netmiko connection object.
cmd_set – a list of configuration lines to send.
- Returns
The output of the configuration commands.
-
networking_generic_switch.devices.netmiko_devices.dell module¶
-
class
networking_generic_switch.devices.netmiko_devices.dell.
DellNos
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
Netmiko device driver for Dell Force10 (OS9) switches.
-
ADD_NETWORK
= ('interface vlan {segmentation_id}', 'description {network_name}', 'exit')¶
-
ADD_NETWORK_TO_TRUNK
= ('interface vlan {segmentation_id}', 'tagged {port}', 'exit')¶
-
DELETE_NETWORK
= ('no interface vlan {segmentation_id}', 'exit')¶
-
DELETE_PORT
= ('interface vlan {segmentation_id}', 'no untagged {port}', 'exit')¶
-
PLUG_PORT_TO_NETWORK
= ('interface vlan {segmentation_id}', 'untagged {port}', 'exit')¶
-
REMOVE_NETWORK_FROM_TRUNK
= ('interface vlan {segmentation_id}', 'no tagged {port}', 'exit')¶
-
-
class
networking_generic_switch.devices.netmiko_devices.dell.
DellOS10
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
Netmiko device driver for Dell PowerSwitch switches.
-
ADD_NETWORK
= ('interface vlan {segmentation_id}', 'description {network_name}', 'exit')¶
-
ADD_NETWORK_TO_TRUNK
= ('interface {port}', 'switchport mode trunk', 'switchport trunk allowed vlan {segmentation_id}', 'exit')¶
-
DELETE_NETWORK
= ('no interface vlan {segmentation_id}', 'exit')¶
-
DELETE_PORT
= ('interface {port}', 'no switchport access vlan', 'exit')¶
-
DISABLE_PORT
= ('interface {port}', 'shutdown', 'exit')¶
-
ENABLE_PORT
= ('interface {port}', 'no shutdown', 'exit')¶
-
ERROR_MSG_PATTERNS
= ()¶ Sequence of error message patterns.
Sequence of re.RegexObject objects representing patterns to check for in device output that indicate a failure to apply configuration.
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'switchport mode access', 'switchport access vlan {segmentation_id}', 'exit')¶
-
REMOVE_NETWORK_FROM_TRUNK
= ('interface {port}', 'no switchport trunk allowed vlan {segmentation_id}', 'exit')¶
-
-
class
networking_generic_switch.devices.netmiko_devices.dell.
DellPowerConnect
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
Netmiko device driver for Dell PowerConnect switches.
-
ADD_NETWORK
= ('vlan database', 'vlan {segmentation_id}', 'exit')¶
-
ADD_NETWORK_TO_TRUNK
= ('interface {port}', 'switchport general allowed vlan add {segmentation_id} tagged', 'exit')¶
-
DELETE_NETWORK
= ('vlan database', 'no vlan {segmentation_id}', 'exit')¶
-
DELETE_PORT
= ('interface {port}', 'switchport access vlan none', 'exit')¶
-
DELETE_PORT_GENERAL
= ('interface {port}', 'switchport general allowed vlan remove {segmentation_id}', 'no switchport general pvid', 'exit')¶
-
ERROR_MSG_PATTERNS
= (re.compile('\\% Incomplete command'), re.compile('VLAN was not created by user'), re.compile('Configuration Database locked by another application \\- try later'))¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'switchport access vlan {segmentation_id}', 'exit')¶
-
PLUG_PORT_TO_NETWORK_GENERAL
= ('interface {port}', 'switchport general allowed vlan add {segmentation_id} untagged', 'switchport general pvid {segmentation_id}', 'exit')¶
-
REMOVE_NETWORK_FROM_TRUNK
= ('interface {port}', 'switchport general allowed vlan remove {segmentation_id}', 'exit')¶
-
networking_generic_switch.devices.netmiko_devices.fake module¶
-
class
networking_generic_switch.devices.netmiko_devices.fake.
Fake
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
Netmiko device driver for Fake switches.
-
ADD_NETWORK
= ('add network {segmentation_id}',)¶
-
ADD_NETWORK_TO_TRUNK
= ('add network {segmentation_id} to trunk {port}',)¶
-
DELETE_NETWORK
= ('delete network {segmentation_id}',)¶
-
DELETE_PORT
= ('delete port {port}',)¶
-
DISABLE_PORT
= ('disable {port}',)¶
-
ENABLE_PORT
= ('enable {port}',)¶
-
ERROR_MSG_PATTERNS
= ()¶ Sequence of error message patterns.
Sequence of re.RegexObject objects representing patterns to check for in device output that indicate a failure to apply configuration.
-
NETMIKO_DEVICE_TYPE
= 'linux'¶
-
PLUG_PORT_TO_NETWORK
= ('plug port {port} to network {segmentation_id}',)¶
-
REMOVE_NETWORK_FROM_TRUNK
= ('remove network {segmentation_id} from trunk {port}',)¶
-
networking_generic_switch.devices.netmiko_devices.hpe module¶
-
class
networking_generic_switch.devices.netmiko_devices.hpe.
HpeComware
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
ADD_NETWORK
= ('vlan {segmentation_id}',)¶
-
DELETE_NETWORK
= ('undo vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('interface {port}', 'undo port access vlan')¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'port link-type access', 'port access vlan {segmentation_id}')¶
-
networking_generic_switch.devices.netmiko_devices.huawei module¶
-
class
networking_generic_switch.devices.netmiko_devices.huawei.
Huawei
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
For Huawei Network Operating System VRP V3 and V5.
-
ADD_NETWORK
= ('vlan {segmentation_id}',)¶
-
DELETE_NETWORK
= ('undo vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('interface {port}', 'undo port default vlan {segmentation_id}')¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'port link-type access', 'port default vlan {segmentation_id}')¶
-
networking_generic_switch.devices.netmiko_devices.huawei_vrpv8 module¶
-
class
networking_generic_switch.devices.netmiko_devices.huawei_vrpv8.
Huawei
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
For Huawei Next-Generation Network Operating System VRP V8.
-
ADD_NETWORK
= ('vlan {segmentation_id}', 'commit')¶
-
DELETE_NETWORK
= ('undo vlan {segmentation_id}', 'commit')¶
-
DELETE_PORT
= ('interface {port}', 'undo port default vlan {segmentation_id}', 'commit')¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'port link-type access', 'port default vlan {segmentation_id}', 'commit')¶
-
networking_generic_switch.devices.netmiko_devices.juniper module¶
-
class
networking_generic_switch.devices.netmiko_devices.juniper.
Juniper
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
ADD_NETWORK
= ('set vlans {network_name} vlan-id {segmentation_id}',)¶
-
ADD_NETWORK_TO_TRUNK
= ('set interfaces {port} unit 0 family ethernet-switching vlan members {segmentation_id}',)¶
-
DELETE_NETWORK
= ('delete vlans {network_name}',)¶
-
DELETE_PORT
= ('delete interfaces {port} unit 0 family ethernet-switching vlan members',)¶
-
DISABLE_PORT
= ('set interfaces {port} disable',)¶
-
ENABLE_PORT
= ('delete interfaces {port} disable',)¶
-
PLUG_PORT_TO_NETWORK
= ('delete interfaces {port} unit 0 family ethernet-switching vlan members', 'set interfaces {port} unit 0 family ethernet-switching vlan members {segmentation_id}')¶
-
REMOVE_NETWORK_FROM_TRUNK
= ('delete interfaces {port} unit 0 family ethernet-switching vlan members {segmentation_id}',)¶
-
save_configuration
(net_connect)¶ Save the device’s configuration.
- Parameters
net_connect – a netmiko connection object.
- Raises
GenericSwitchNetmikoConfigError if saving the configuration fails.
-
send_config_set
(net_connect, cmd_set)¶ Send a set of configuration lines to the device.
- Parameters
net_connect – a netmiko connection object.
cmd_set – a list of configuration lines to send.
- Returns
The output of the configuration commands.
-
networking_generic_switch.devices.netmiko_devices.mellanox_mlnxos module¶
-
class
networking_generic_switch.devices.netmiko_devices.mellanox_mlnxos.
MellanoxMlnxOS
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
ADD_NETWORK
= ('vlan {segmentation_id}', 'name {network_id}')¶
-
DELETE_NETWORK
= ('no vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('interface ethernet {port}', 'no switchport access vlan', 'no switchport mode')¶
-
PLUG_PORT_TO_NETWORK
= ('interface ethernet {port}', 'switchport mode access', 'switchport access vlan {segmentation_id}')¶
-
networking_generic_switch.devices.netmiko_devices.nokia module¶
-
class
networking_generic_switch.devices.netmiko_devices.nokia.
NokiaSRL
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
ADD_NETWORK
= ('set tunnel-interface vxlan0 vxlan-interface {segmentation_id} type bridged', 'set tunnel-interface vxlan0 vxlan-interface {segmentation_id} ingress vni {segmentation_id}', 'set tunnel-interface vxlan0 vxlan-interface {segmentation_id} egress source-ip use-system-ipv4-address', 'set network-instance mac-vrf-{segmentation_id} type mac-vrf', 'set network-instance mac-vrf-{segmentation_id} description OS-Network-ID-{network_name}', 'set network-instance mac-vrf-{segmentation_id} vxlan-interface vxlan0.{segmentation_id}', 'set network-instance mac-vrf-{segmentation_id} protocols bgp-evpn bgp-instance 1 vxlan-interface vxlan0.{segmentation_id}', 'set network-instance mac-vrf-{segmentation_id} protocols bgp-evpn bgp-instance 1 evi {segmentation_id}', 'set network-instance mac-vrf-{segmentation_id} protocols bgp-evpn bgp-instance 1 ecmp 8', 'set network-instance mac-vrf-{segmentation_id} protocols bgp-vpn bgp-instance 1 route-target export-rt target:1:{segmentation_id}', 'set network-instance mac-vrf-{segmentation_id} protocols bgp-vpn bgp-instance 1 route-target import-rt target:1:{segmentation_id}')¶
-
DELETE_NETWORK
= ('delete network-instance mac-vrf-{segmentation_id}', 'delete tunnel-interface vxlan0 vxlan-interface {segmentation_id}')¶
-
DELETE_PORT
= ('delete network-instance mac-vrf-{segmentation_id} interface {port}.{segmentation_id}', 'delete interface {port} subinterface {segmentation_id}')¶
-
PLUG_PORT_TO_NETWORK
= ('set interface {port} subinterface {segmentation_id} type bridged', 'set network-instance mac-vrf-{segmentation_id} interface {port}.{segmentation_id}')¶
-
commit
(net_connect) → str¶ Try to commit the Nokia SRL configuration.
- Parameters
net_connect – a netmiko connection object.
-
send_commands_to_device
(cmd_set)¶
-
networking_generic_switch.devices.netmiko_devices.ovs module¶
-
class
networking_generic_switch.devices.netmiko_devices.ovs.
OvsLinux
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
DELETE_PORT
= ('ovs-vsctl clear port {port} tag', 'ovs-vsctl clear port {port} trunks', 'ovs-vsctl clear port {port} vlan_mode')¶
-
PLUG_PORT_TO_NETWORK
= ('ovs-vsctl set port {port} vlan_mode=access', 'ovs-vsctl set port {port} tag={segmentation_id}')¶
-
networking_generic_switch.devices.netmiko_devices.pluribus module¶
-
class
networking_generic_switch.devices.netmiko_devices.pluribus.
Pluribus
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
ADD_NETWORK
= ('vlan-create id {segmentation_id} scope fabric ports none description {network_name} auto-vxlan',)¶
-
DELETE_NETWORK
= ('vlan-delete id {segmentation_id}',)¶
-
DELETE_PORT
= ('vlan-port-remove vlan-range all ports {port}',)¶
-
PLUG_PORT_TO_NETWORK
= ('vlan-port-remove vlan-range all ports {port}', 'port-vlan-add port {port} untagged-vlan {segmentation_id}')¶
-
networking_generic_switch.devices.netmiko_devices.ruijie module¶
-
class
networking_generic_switch.devices.netmiko_devices.ruijie.
Ruijie
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
-
ADD_NETWORK
= ('vlan {segmentation_id}', 'name {network_name}')¶
-
DELETE_NETWORK
= ('no vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('interface {port}', 'no switchport access vlan {segmentation_id}', 'no switchport mode trunk', 'switchport trunk allowed vlan none')¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'switchport mode access', 'switchport access vlan {segmentation_id}')¶
-
networking_generic_switch.devices.netmiko_devices.smc module¶
-
class
networking_generic_switch.devices.netmiko_devices.smc.
SupermicroSmis
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
A class to represent a Supermicro SMIS switch
-
ADD_NETWORK
= ('vlan {segmentation_id}', 'name {network_name}')¶
-
DELETE_NETWORK
= ('no vlan {segmentation_id}',)¶
-
DELETE_PORT
= ('interface {port}', 'no switchport access vlan {segmentation_id}', 'no switchport mode trunk', 'switchport trunk allowed vlan none')¶
-
PLUG_PORT_TO_NETWORK
= ('interface {port}', 'switchport mode access', 'switchport access vlan {segmentation_id}')¶
-
networking_generic_switch.devices.netmiko_devices.sonic module¶
-
class
networking_generic_switch.devices.netmiko_devices.sonic.
Sonic
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.netmiko_devices.NetmikoSwitch
Built for SONiC 3.x
Note for this switch you want config like this, where secret is the password needed for sudo su:
[genericswitch:<hostname>] device_type = netmiko_sonic ip = <ip> username = <username> password = <password> secret = <password for sudo> ngs_physical_networks = physnet1 ngs_max_connections = 1 ngs_port_default_vlan = 123 ngs_disable_inactive_ports = False
-
ADD_NETWORK
= ['config vlan add {segmentation_id}']¶
-
ADD_NETWORK_TO_TRUNK
= ['config vlan member add {segmentation_id} {port}']¶
-
DELETE_NETWORK
= ['config vlan del {segmentation_id}']¶
-
DELETE_PORT
= ['config vlan member del {segmentation_id} {port}']¶
-
ERROR_MSG_PATTERNS
= [re.compile("VLAN[0-9]+ doesn\\'t exist"), re.compile('Invalid Vlan Id , Valid Range : 1 to 4094'), re.compile('Interface name is invalid!!'), re.compile('No such command')]¶
-
NETMIKO_DEVICE_TYPE
= 'linux'¶
-
PLUG_PORT_TO_NETWORK
= ['config vlan member add -u {segmentation_id} {port}']¶
-
REMOVE_NETWORK_FROM_TRUNK
= ['config vlan member del {segmentation_id} {port}']¶
-
SAVE_CONFIGURATION
= ['config save -y']¶
-
send_config_set
(net_connect, cmd_set)¶ Send a set of configuration lines to the device.
- Parameters
net_connect – a netmiko connection object.
cmd_set – a list of configuration lines to send.
- Returns
The output of the configuration commands.
-
Module contents¶
-
class
networking_generic_switch.devices.netmiko_devices.
NetmikoSwitch
(device_cfg, *args, **kwargs)¶ Bases:
networking_generic_switch.devices.GenericSwitchDevice
-
ADD_NETWORK
= None¶
-
ADD_NETWORK_TO_TRUNK
= None¶
-
DELETE_NETWORK
= None¶
-
DELETE_PORT
= None¶
-
DISABLE_BOND
= None¶
-
DISABLE_PORT
= None¶
-
ENABLE_BOND
= None¶
-
ENABLE_PORT
= None¶
-
ERROR_MSG_PATTERNS
= ()¶ Sequence of error message patterns.
Sequence of re.RegexObject objects representing patterns to check for in device output that indicate a failure to apply configuration.
-
NETMIKO_DEVICE_TYPE
= None¶
-
PLUG_BOND_TO_NETWORK
= None¶
-
PLUG_PORT_TO_NETWORK
= None¶
-
REMOVE_NETWORK_FROM_TRUNK
= None¶
-
SAVE_CONFIGURATION
= None¶
-
UNPLUG_BOND_FROM_NETWORK
= None¶
-
add_network
(segmentation_id, network_id)¶
-
check_output
(output, operation)¶ Check the output from the device following an operation.
Drivers should implement this method to handle output from devices and perform any checks necessary to validate that the configuration was applied successfully.
- Parameters
output – Output from the device.
operation – Operation being attempted. One of ‘add network’, ‘delete network’, ‘plug port’, ‘unplug port’.
- Raises
GenericSwitchNetmikoConfigError if the driver detects that an error has occurred.
-
del_network
(segmentation_id, network_id)¶
-
delete_port
(port, segmentation_id)¶
-
plug_bond_to_network
(bond, segmentation_id)¶
-
plug_port_to_network
(port, segmentation_id)¶
-
save_configuration
(net_connect)¶ Try to save the device’s configuration.
- Parameters
net_connect – a netmiko connection object.
-
send_commands_to_device
(cmd_set)¶
-
send_config_set
(net_connect, cmd_set)¶ Send a set of configuration lines to the device.
- Parameters
net_connect – a netmiko connection object.
cmd_set – a list of configuration lines to send.
- Returns
The output of the configuration commands.
-
unplug_bond_from_network
(bond, segmentation_id)¶
-
-
networking_generic_switch.devices.netmiko_devices.
check_output
(operation)¶ Returns a decorator that checks the output of an operation.
- Parameters
operation – Operation being attempted. One of ‘add network’, ‘delete network’, ‘plug port’, ‘unplug port’.