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)

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.brocade module

class networking_generic_switch.devices.netmiko_devices.brocade.BrocadeFastIron(device_cfg)

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)

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.cisco300 module

class networking_generic_switch.devices.netmiko_devices.cisco300.Cisco300(device_cfg)

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.dell module

class networking_generic_switch.devices.netmiko_devices.dell.DellNos(device_cfg)

Bases: networking_generic_switch.devices.netmiko_devices.NetmikoSwitch

Netmiko device driver for Dell Force10 switches.

ADD_NETWORK = ('interface vlan {segmentation_id}', 'name {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.DellPowerConnect(device_cfg)

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.hpe module

class networking_generic_switch.devices.netmiko_devices.hpe.HpeComware(device_cfg)

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)

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)

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)

Bases: networking_generic_switch.devices.netmiko_devices.NetmikoSwitch

ADD_NETWORK = ('set vlans {network_name} vlan-id {segmentation_id}',)
ADD_NETWORK_TO_TRUNK = ('set interface {port} unit 0 family ethernet-switching vlan members {segmentation_id}',)
DELETE_NETWORK = ('delete vlans {network_name}',)
DELETE_PORT = ('delete interface {port} unit 0 family ethernet-switching vlan members',)
DISABLE_PORT = ('set interface {port} disable',)
ENABLE_PORT = ('delete interface {port} disable',)
PLUG_PORT_TO_NETWORK = ('delete interface {port} unit 0 family ethernet-switching vlan members', 'set interface {port} unit 0 family ethernet-switching vlan members {segmentation_id}')
REMOVE_NETWORK_FROM_TRUNK = ('delete interface {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)

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.ovs module

class networking_generic_switch.devices.netmiko_devices.ovs.OvsLinux(device_cfg)

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.ruijie module

class networking_generic_switch.devices.netmiko_devices.ruijie.Ruijie(device_cfg)

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}')

Module contents

class networking_generic_switch.devices.netmiko_devices.NetmikoSwitch(device_cfg)

Bases: networking_generic_switch.devices.GenericSwitchDevice

ADD_NETWORK = None
ADD_NETWORK_TO_TRUNK = None
DELETE_NETWORK = None
DELETE_PORT = None
DISABLE_PORT = 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.

PLUG_PORT_TO_NETWORK = None
REMOVE_NETWORK_FROM_TRUNK = None
SAVE_CONFIGURATION = 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_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.

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’.