The networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events Module

class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusBaremetalDevice(*args, **kwds)

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_base.TestCiscoNexusBase

Unit tests for Cisco ML2 Nexus baremetal device driver.

baremetal_profile = {‘local_link_information’: [{‘switch_info’: {‘switch_ip’: ‘1.1.1.1’}, ‘port_id’: ‘Ethernet 1/10’}]}
baremetal_profile_is_native = {‘local_link_information’: [{‘switch_info’: {‘switch_ip’: ‘1.1.1.1’}, ‘port_id’: ‘Ethernet 1/10’}]}
baremetal_profile_vPC = {‘local_link_information’: [{‘switch_info’: {‘switch_ip’: ‘1.1.1.1’}, ‘port_id’: ‘Ethernet 1/10’}, {‘switch_info’: {‘switch_ip’: ‘2.2.2.2’}, ‘port_id’: ‘Ethernet 1/20’}]}
setUp()

Sets up mock ncclient, and switch and credentials dictionaries.

test_configs = {‘test_config_vPC’: TestConfigObj(nexus_ip_addr=None, host_name=’unused’, nexus_port=’Ethernet 1/10’, instance_id=’testvm1’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’baremetal:none’, profile={‘local_link_information’: [{‘switch_info’: {‘switch_ip’: ‘1.1.1.1’}, ‘port_id’: ‘Ethernet 1/10’}, {‘switch_info’: {‘switch_ip’: ‘2.2.2.2’}, ‘port_id’: ‘Ethernet 1/20’}]}, dns_name=’baremetal1’, vnic_type=u’baremetal’), ‘test_config_vm’: TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’baremetal1’, nexus_port=’Ethernet 1/10’, instance_id=’testvm2’, vlan_id=265, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’), ‘test_config1’: TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’unused’, nexus_port=’Ethernet 1/10’, instance_id=’testvm1’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’baremetal:none’, profile={‘local_link_information’: [{‘switch_info’: {‘switch_ip’: ‘1.1.1.1’}, ‘port_id’: ‘Ethernet 1/10’}]}, dns_name=’baremetal1’, vnic_type=u’baremetal’), ‘test_config_native’: TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’unused’, nexus_port=’Ethernet 1/10’, instance_id=’testvm1’, vlan_id=265, vxlan_id=0, mcast_group=None, device_owner=’baremetal:none’, profile={‘local_link_information’: [{‘switch_info’: {‘switch_ip’: ‘1.1.1.1’}, ‘port_id’: ‘Ethernet 1/10’}]}, dns_name=None, vnic_type=u’baremetal’)}
test_create_delete_basic_bm_ethernet_port_and_vm(*args, **kwargs)

Basic creation and deletion test of 1 ethernet port.

test_create_delete_basic_eth_port_is_native(*args, **kwargs)

Basic creation and deletion test of 1 ethernet port.

test_create_delete_basic_port_channel(*args, **kwargs)

Basic creation and deletion test of 1 port-channel.

test_create_delete_learn_vpc_and_vm(*args, **kwargs)

Basic creation and deletion test of 2 learn port-channel and vm.

test_create_delete_switch_ip_not_defined(*args, **kwargs)

Create/delete of 1 ethernet port switchinfo is string.

test_new_host_mapping_db(*args, **kwargs)
class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusBaremetalResults

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_base.TestCiscoNexusBaseResults

Unit tests driver results for Cisco ML2 Nexus.

test_results = {‘add_port_ethernet_native_driver_result’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>265’, ‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<native\>\s+\<vlan\>\s+\<vlan_id\>265[\x00-\x7f]+\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>265’], ‘driver_result_unique_vPC_del1’: [‘\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~\s]+\<no\>\s+\<switchport\>\s+\<trunk\>\s+\<native\>[\x00-\x7f]+\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>267’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’, ‘\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~\s]+\<no\>\s+\<switchport\>\s+\<trunk\>\s+\<native\>[\x00-\x7f]+\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>267’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’], ‘delete_vm_port_ethernet_driver_result’: [‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>265’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>265’], ‘delete_port_ethernet_driver_result’: [‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~\s]+\<no\>\s+\<switchport\>\s+\<trunk\>\s+\<native\>[\x00-\x7f]+\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>267’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’], ‘add_vm_port_ethernet_driver_result’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>265’, ‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>265’], ‘driver_result_unique_vPC_add1_vm’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>265’, ‘\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>265’, ‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>265’, ‘\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>265’], ‘driver_result_unique_vPC_add1’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’, ‘\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<native\>\s+\<vlan\>\s+\<vlan_id\>267[\x00-\x7f]+\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>267’, ‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’, ‘\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<native\>\s+\<vlan\>\s+\<vlan_id\>267[\x00-\x7f]+\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>267’], ‘add_port_ethernet_driver_result’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’, ‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<native\>\s+\<vlan\>\s+\<vlan_id\>267[\x00-\x7f]+\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>267’], ‘driver_result_unique_vPC_del1_vm’: [‘\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>265’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>265’, ‘\<port-channel\>\s+\<interface\>469\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>265’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>265’], ‘delete_port_ethernet_native_driver_result’: [‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~\s]+\<no\>\s+\<switchport\>\s+\<trunk\>\s+\<native\>[\x00-\x7f]+\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>265’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>265’]}
class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDevice(*args, **kwds)

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_base.TestCiscoNexusBase, networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDeviceConfig, networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDeviceResults

Unit tests for Cisco ML2 Nexus device driver.

setUp()

Sets up mock ncclient, and switch and credentials dictionaries.

test_create_delete_dhcp(*args, **kwargs)

Tests creation and deletion of ports with device_owner of dhcp.

test_create_delete_diff_switch_same_host(*args, **kwargs)

Test create/delete of two Ports, diff switch/same host.

test_create_delete_dual(*args, **kwargs)

Tests creation and deletion of dual ports for single server

test_create_delete_duplicate_port_transaction(*args, **kwargs)

Tests creation and deletion same port transaction.

test_create_delete_duplicate_ports(*args, **kwargs)

Tests creation and deletion of two new virtual Ports.

test_create_delete_portchannel(*args, **kwargs)

Tests creation of a port over a portchannel.

test_create_delete_router_gateway(*args, **kwargs)

Tests creation and deletion of ports with device_owner of router_gateway.

test_create_delete_router_ha_intf(*args, **kwargs)

Tests creation and deletion of ports with device_owner of router_ha_interface.

test_create_delete_router_intf(*args, **kwargs)

Tests creation and deletion of ports with device_owner of router_interface.

test_create_delete_same_switch_diff_hosts_diff_vlan(*args, **kwargs)

Test create/delete two Ports, same switch/diff host & vlan.

test_create_delete_same_switch_diff_hosts_same_vlan(*args, **kwargs)

Test create/delete two Ports, same switch & vlan/diff host.

test_nexus_vm_migration(*args, **kwargs)

Verify VM (live) migration.

Simulate the following: Nova informs neutron of live-migration with port-update(new host). This should trigger two update_port_pre/postcommit() calls.

The first one should only change the current host_id and remove the binding resulting in the mechanism drivers receiving:

  • PortContext.original[‘binding:host_id’]: previous value
  • PortContext.original_top_bound_segment: previous value
  • PortContext.current[‘binding:host_id’]: current (new) value
  • PortContext.top_bound_segment: None

The second one binds the new host resulting in the mechanism drivers receiving:

  • PortContext.original[‘binding:host_id’]: previous value
  • PortContext.original_top_bound_segment: None
  • PortContext.current[‘binding:host_id’]: previous value
  • PortContext.top_bound_segment: new value
class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDeviceConfig

Bases: object

Unit tests Config for Cisco ML2 Nexus device driver.

test_configs = OrderedDict([(‘test_config1’, TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’testhost1’, nexus_port=’ethernet:1/10’, instance_id=’testvm1’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config2’, TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’testhost2’, nexus_port=’ethernet:1/20’, instance_id=’testvm2’, vlan_id=265, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config3’, TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’testhost1’, nexus_port=’ethernet:1/10’, instance_id=’testvm2’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config4’, TestConfigObj(nexus_ip_addr=‘8.8.8.8’, host_name=’testhost4’, nexus_port=’ethernet:1/10’, instance_id=’testvm1’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config5’, TestConfigObj(nexus_ip_addr=‘8.8.8.8’, host_name=’testhost5’, nexus_port=’ethernet:1/20’, instance_id=’testvm2’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config_dhcp’, TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’testhost1’, nexus_port=’ethernet:1/10’, instance_id=’testvm1’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’network:dhcp’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config_dual’, TestConfigObj(nexus_ip_addr=‘4.4.4.4’, host_name=’testdualhost’, nexus_port=’ethernet:1/3,portchannel:2’, instance_id=’testdualvm’, vlan_id=269, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config_migrate’, TestConfigObj(nexus_ip_addr=‘3.3.3.3’, host_name=’testhost6’, nexus_port=’ethernet:1/20’, instance_id=’testvm1’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config_portchannel’, TestConfigObj(nexus_ip_addr=‘2.2.2.2’, host_name=’testpchost’, nexus_port=’portchannel:2’, instance_id=’testpcvm’, vlan_id=268, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config_portchannel2’, TestConfigObj(nexus_ip_addr=‘6.6.6.6’, host_name=’testhost3’, nexus_port=’portchannel:2’, instance_id=’testpcvm’, vlan_id=268, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config_portchannel3’, TestConfigObj(nexus_ip_addr=‘7.7.7.7’, host_name=’testhost3’, nexus_port=’portchannel:2’, instance_id=’testpcvm’, vlan_id=268, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config_router_gw’, TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’testhost1’, nexus_port=’ethernet:1/10’, instance_id=’testvm1’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’network:router_gateway’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config_router_ha_intf’, TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’testhost1’, nexus_port=’ethernet:1/10’, instance_id=’testvm1’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’network:router_ha_interface’, profile={}, dns_name=None, vnic_type=u’normal’)), (‘test_config_router_intf’, TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’testhost1’, nexus_port=’ethernet:1/10’, instance_id=’testvm1’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’network:router_interface’, profile={}, dns_name=None, vnic_type=u’normal’))])
class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDeviceFailure(*args, **kwds)

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_base.TestCiscoNexusBase, networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDeviceConfig, networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDeviceResults

Negative Unit tests for Cisco ML2 Nexus device driver.

setUp()

Sets up mock ncclient, and switch and credentials dictionaries.

test_connect_failure(*args, **kwargs)

Verifies exception handling during ncclient connect.

test_create_trunk_failure(*args, **kwargs)

Verifies exception during create trunk interface driver.

test_create_vlan_failure(*args, **kwargs)

Verifies exception during edit vlan create driver.

test_delete_trunk_failure(*args, **kwargs)

Verifies exception during delete trunk interface driver.

test_delete_vlan_failure(*args, **kwargs)

Verifies exception during edit vlan delete driver.

test_edit_fail_on_try_1(*args, **kwargs)

Verifies reconnect during ncclient edit.

test_get_nexus_type_failure(*args, **kwargs)

Verifies exception during ncclient get inventory.

test_ncclient_fail_on_connect_other_exceptions(*args, **kwargs)

Test that other errors during connect() sequences are still handled.

If the old ncclient is installed, we expect to get a TypeError first, but should still handle other errors in the usual way, whether they appear on the first or second call to connect().

test_nexus_extended_vlan_range_failure(*args, **kwargs)

Test that extended VLAN range config errors are ignored.

Some versions of Nexus switch do not allow state changes for the extended VLAN range (1006-4094), but these errors can be ignored (default values are appropriate). Test that such errors are ignored by the Nexus plugin.

test_nexus_host_not_configured(*args, **kwargs)

Test handling of a host not found in our configuration.

If a host is not found in the cisco configuration the driver should silently ignore (unknown host name is logged) and no database or switch configuration is performed. Exercise against all APIs.

test_nexus_invalid_segment(*args, **kwargs)

Test handling of a non VLAN segment.

Pass a FLAT segment type into the driver. Verify that no exceptions are raised (non-VLAN segments are logged only) and that no database or switch configuration is performed.

test_nexus_missing_fields(*args, **kwargs)

Test handling of a NexusMissingRequiredFields exception.

Test the Cisco NexusMissingRequiredFields exception by using empty device_id value during port creation.

test_nexus_ncclient_disconnect(*args, **kwargs)

Test handling of closing ncclient sessions.

When multi neutron-server processes are used verify that ncclient close_session method is called.

test_nexus_segment_none(*args, **kwargs)

Test handling of segment is None.

Verify that None segments do not throw an exception in _port_action_xxx. None segments passed to the event handlers are logged and are not processed.

class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDeviceInit(*args, **kwds)

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_base.TestCiscoNexusBase, networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDeviceConfig

Verifies interface vlan allowed none is set when missing.

mock_init()
setUp()

Sets up mock ncclient, and switch and credentials dictionaries.

test_verify_initialization(*args, **kwargs)
class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDeviceResults

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_base.TestCiscoNexusBaseResults

Unit tests driver results for Cisco ML2 Nexus.

test_results = {‘delete_port2_driver_result3’: [‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>268’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>268’, ‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>268’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>268’], ‘delete_port2_driver_result2’: [‘\<ethernet\>\s+\<interface\>1\/20\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>267’], ‘add_port_channel_driver_result’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>268’, ‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>268’], ‘duplicate_add_port_driver_result’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’, ‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>267’], ‘add_port2_driver_result2’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’, ‘\<ethernet\>\s+\<interface\>1\/20\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>267’], ‘add_port2_driver_result3’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>268’, ‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>268’, ‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>268’, ‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>268’], ‘delete_port_channel_driver_result’: [‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>268’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>268’], ‘dual_add_port_driver_result’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>269’, ‘\<ethernet\>\s+\<interface\>1\/3\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>269’, ‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>269’, ‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>269’], ‘migrate_add_host2_driver_result’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’, ‘\<ethernet\>\s+\<interface\>1\/20\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>267’], ‘add_port2_driver_result’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>265’, ‘\<ethernet\>\s+\<interface\>1\/20\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>265’], ‘del_port_driver_result’: [‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>267’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’], ‘dual_delete_port_driver_result’: [‘\<ethernet\>\s+\<interface\>1\/3\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>269’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>269’, ‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>269’], ‘add_port_driver_result’: [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’, ‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>267’], ‘delete_port2_driver_result’: [‘\<ethernet\>\s+\<interface\>1\/20\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>265’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>265’], ‘duplicate_del_port_driver_result’: [‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>267’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’]}
class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusInitResults

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_base.TestCiscoNexusBaseResults

Unit tests driver results for Cisco ML2 Nexus.

test_results = {‘duplicate_init_port_driver_result1’: [‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<vlan_id\>None’, ‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<vlan_id\>None’, ‘\<ethernet\>\s+\<interface\>1\/3\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<vlan_id\>None’, ‘\<ethernet\>\s+\<interface\>1\/20\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<vlan_id\>None’, ‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<vlan_id\>None’, ‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<vlan_id\>None’, ‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<vlan_id\>None’], ‘duplicate_init_port_driver_result2’: [‘\<ethernet\>\s+\<interface\>1\/20\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<vlan_id\>None’, ‘\<ethernet\>\s+\<interface\>1\/20\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<vlan_id\>None’, ‘\<portchannel\>\s+\<interface\>2\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<vlan_id\>None’, None, None, None, None]}
class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusNonCacheSshDevice(*args, **kwds)

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_base.TestCiscoNexusBase

Unit tests for Cisco ML2 Nexus device driver in non-cache ssh mode.

setUp()
simple_add_port_ethernet_driver_result = [‘configure\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’, ‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~]+\s+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<add\>\s+\<vlan_id\>267’]
simple_delete_port_ethernet_driver_result = [‘\<ethernet\>\s+\<interface\>1\/10\<\/interface\>\s+[ -~\s]+\<switchport\>\s+\<trunk\>\s+\<allowed\>\s+\<vlan\>\s+\<remove\>\s+\<vlan\>267’, ‘\<no\>\s+\<vlan\>\s+<vlan-id-create-delete\>\s+\<__XML__PARAM_value\>267’]
test_configs = {‘test_config1’: TestConfigObj(nexus_ip_addr=‘1.1.1.1’, host_name=’testhost1’, nexus_port=’ethernet:1/10’, instance_id=’testvm1’, vlan_id=267, vxlan_id=0, mcast_group=None, device_owner=’compute:test’, profile={}, dns_name=None, vnic_type=u’normal’)}
test_create_delete_basic(*args, **kwargs)

Basic creation and deletion test of 1 ethernet port.

test_edit_fail_on_try_1(*args, **kwargs)

Verifies reconnect during ncclient edit.