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

Basic Test Classes using RESTAPI Driver to test Cisco Nexus platforms.

These Classes are based on the original ssh event driver so same tests occur with same configuration. What’s different between the tests is the resulting driver output which is what the tests in this class presents to its parent class.

You will notice in this file there are test methods which are skipped by using ‘pass’. This is because these tests apply to ssh only OR because rerunning the test would be redundant.

class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_restapi_events.TestCiscoNexusRestBaremetalDevice(*args, **kwds)

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusBaremetalDevice

Tests for Cisco ML2 Nexus baremetal RESTAPI device driver.

get_init_side_effect(action, ipaddr=None, body=None, headers=None)
get_init_side_effect2(action, ipaddr=None, body=None, headers=None)
setUp()

Sets up mock ncclient, and switch and credentials dictionaries.

test_automated_port_channel_creation_deletion(*args, **kwargs)

Basic creation and deletion test of 1 auto port-channel.

test_automated_port_channel_w_user_cfg(*args, **kwargs)

Basic creation and deletion test of 1 auto port-channel.

test_create_delete_automated_vpc_and_vm(*args, **kwargs)

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

test_create_delete_basic_bm_ethernet_port_and_vm(*args, **kwargs)
test_create_delete_basic_eth_port_is_native(*args, **kwargs)
test_create_delete_basic_port_channel(*args, **kwargs)

Basic creation and deletion test of 1 learned port-channel.

test_create_delete_learn_vpc_and_vm(*args, **kwargs)
test_create_delete_switch_ip_not_defined(*args, **kwargs)
test_failure_inconsistent_learned_chgrp(*args, **kwargs)

Learning chgrp but different on both eth interfaces.

test_failure_inconsistent_new_chgrp(*args, **kwargs)

Started as newly created chgrp but one if had chgrp configured.

test_new_host_mapping_db(*args, **kwargs)
test_vpcids_depleted_failure(*args, **kwargs)

Verifies exception when failed to get vpcid.

class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_restapi_events.TestCiscoNexusRestBaremetalResults

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

Unit tests driver results for Cisco ML2 Nexus.

test_results = {‘driver_result_unique_vPC_del1’: [[‘api/mo/sys/intf/aggr-[po469].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-267”, “nativeVlan”: “”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-267].json’, ‘1.1.1.1’, ”, 1], [‘api/mo/sys/intf/aggr-[po469].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-267”, “nativeVlan”: “”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-267].json’, ‘2.2.2.2’, ”, 1]], ‘delete_port_channel_driver_result’: [[‘api/mo/sys/intf/aggr-[po469].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-267”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-267].json’, ‘1.1.1.1’, ”, 1]], ‘add_port_channel_driver_result’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po469].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+267”}}}’, 0]], ‘delete_vm_port_ethernet_driver_result’: [[‘api/mo/sys/intf/phys-[eth1/10].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “-265”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-265].json’, ‘1.1.1.1’, ”, 1]], ‘delete_port_ethernet_driver_result’: [[‘api/mo/sys/intf/phys-[eth1/10].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “-267”, “nativeVlan”: “”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-267].json’, ‘1.1.1.1’, ”, 1]], ‘driver_result_unique_auto_vPC_vm_add1’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-265”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+265”}}}’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-265”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+265”}}}’, 0]], ‘driver_result_unique_auto_vPC_add_usr_cmd_rest’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” } } } ] } }, {“vpcEntity”: { “children”: [ { “vpcInst”: { “children”: [ { “vpcDom”: { “children”: [ { “vpcIf”: { “attributes”: { “id”: “1001” }, “children”: [ { “vpcRsVpcConf”: { “attributes”: { “tDn”: “sys/intf/aggr-[po1001]” } } } ] } }] } } ]} } ] } } ] } }’, 0], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “isExplicit”: “no”, “pcMode”: “active” },”children”: [ { “pcShadowAggrIf”: {“attributes”: { “id”: “po1001” } } }, { “pcRsMbrIfs”: { “attributes”: { “isMbrForce”: “yes”, “tDn”: “sys/intf/phys-[eth1/10]”} } } ] } } ] } } ] } }’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” } } } ] } }, {“vpcEntity”: { “children”: [ { “vpcInst”: { “children”: [ { “vpcDom”: { “children”: [ { “vpcIf”: { “attributes”: { “id”: “1001” }, “children”: [ { “vpcRsVpcConf”: { “attributes”: { “tDn”: “sys/intf/aggr-[po1001]” } } } ] } }] } } ]} } ] } } ] } }’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “isExplicit”: “no”, “pcMode”: “active” },”children”: [ { “pcShadowAggrIf”: {“attributes”: { “id”: “po1001” } } }, { “pcRsMbrIfs”: { “attributes”: { “isMbrForce”: “yes”, “tDn”: “sys/intf/phys-[eth1/20]”} } } ] } } ] } } ] } }’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+267”, “nativeVlan”: “vlan-267”}}}’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+267”, “nativeVlan”: “vlan-267”}}}’, 0]], ‘driver_result_unique_vPC_add1’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po469].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+267”, “nativeVlan”: “vlan-267”}}}’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po469].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+267”, “nativeVlan”: “vlan-267”}}}’, 0]], ‘add_port_ethernet_driver_result’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/phys-[eth1/10].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “+267”, “nativeVlan”: “vlan-267”}}}’, 0]], ‘driver_result_unique_auto_vPC_add1’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” } } } ] } }, {“vpcEntity”: { “children”: [ { “vpcInst”: { “children”: [ { “vpcDom”: { “children”: [ { “vpcIf”: { “attributes”: { “id”: “1001” }, “children”: [ { “vpcRsVpcConf”: { “attributes”: { “tDn”: “sys/intf/aggr-[po1001]” } } } ] } }] } } ]} } ] } } ] } }’, 0], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “ctrl”: “graceful-conv”} } } ] } },{ “stpEntity”: { “children”: [ { “stpInst”: { “children”: [ { “stpIf”: { “attributes”: { “id”: “po1001”, “mode”: “trunk” } } } ] } } ] } }] } }’, 0], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “isExplicit”: “no”, “pcMode”: “active” },”children”: [ { “pcShadowAggrIf”: {“attributes”: { “id”: “po1001” } } }, { “pcRsMbrIfs”: { “attributes”: { “isMbrForce”: “yes”, “tDn”: “sys/intf/phys-[eth1/10]”} } } ] } } ] } } ] } }’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” } } } ] } }, {“vpcEntity”: { “children”: [ { “vpcInst”: { “children”: [ { “vpcDom”: { “children”: [ { “vpcIf”: { “attributes”: { “id”: “1001” }, “children”: [ { “vpcRsVpcConf”: { “attributes”: { “tDn”: “sys/intf/aggr-[po1001]” } } } ] } }] } } ]} } ] } } ] } }’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “ctrl”: “graceful-conv”} } } ] } },{ “stpEntity”: { “children”: [ { “stpInst”: { “children”: [ { “stpIf”: { “attributes”: { “id”: “po1001”, “mode”: “trunk” } } } ] } } ] } }] } }’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “isExplicit”: “no”, “pcMode”: “active” },”children”: [ { “pcShadowAggrIf”: {“attributes”: { “id”: “po1001” } } }, { “pcRsMbrIfs”: { “attributes”: { “isMbrForce”: “yes”, “tDn”: “sys/intf/phys-[eth1/20]”} } } ] } } ] } } ] } }’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+267”, “nativeVlan”: “vlan-267”}}}’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+267”, “nativeVlan”: “vlan-267”}}}’, 0]], ‘driver_result_unique_auto_vPC_vm_del1’: [[‘api/mo/sys/intf/aggr-[po1001].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-265”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-265].json’, ‘1.1.1.1’, ”, 1], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-265”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-265].json’, ‘2.2.2.2’, ”, 1]], ‘driver_result_unique_auto_vPC_add_usr_cmd_nxapi_cli’: [[‘ins’, ‘1.1.1.1’, ‘int port-channel 1001 ;spanning-tree port type edge trunk ;no lacp suspend-individual’, 0], [‘ins’, ‘2.2.2.2’, ‘int port-channel 1001 ;spanning-tree port type edge trunk ;no lacp suspend-individual’, 0]], ‘driver_result_unique_auto_vPC_inconsistency_failure’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” } } } ] } }, {“vpcEntity”: { “children”: [ { “vpcInst”: { “children”: [ { “vpcDom”: { “children”: [ { “vpcIf”: { “attributes”: { “id”: “1001” }, “children”: [ { “vpcRsVpcConf”: { “attributes”: { “tDn”: “sys/intf/aggr-[po1001]” } } } ] } }] } } ]} } ] } } ] } }’, 0], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “ctrl”: “graceful-conv”} } } ] } },{ “stpEntity”: { “children”: [ { “stpInst”: { “children”: [ { “stpIf”: { “attributes”: { “id”: “po1001”, “mode”: “trunk” } } } ] } } ] } }] } }’, 0], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “isExplicit”: “no”, “pcMode”: “active” },”children”: [ { “pcShadowAggrIf”: {“attributes”: { “id”: “po1001” } } }, { “pcRsMbrIfs”: { “attributes”: { “isMbrForce”: “yes”, “tDn”: “sys/intf/phys-[eth1/10]”} } } ] } } ] } } ] } }’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” },”children”: [ { “pcRsMbrIfs”: { “attributes”: { “status”: “deleted”,”tDn”: “sys/intf/phys-[eth1/10]”} } } ] } } ] } } ] } }’, 0], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “status”: “deleted” } } } ] } } ] } }’, 0]], ‘driver_result_unique_auto_vPC_del1’: [[‘api/mo/sys/intf/aggr-[po1001].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-267”, “nativeVlan”: “”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-267].json’, ‘1.1.1.1’, ”, 1], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” },”children”: [ { “pcRsMbrIfs”: { “attributes”: { “status”: “deleted”,”tDn”: “sys/intf/phys-[eth1/10]”} } } ] } } ] } } ] } }’, 0], [‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “status”: “deleted” } } } ] } } ] } }’, 0], [‘api/mo/sys/intf/aggr-[po1001].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-267”, “nativeVlan”: “”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-267].json’, ‘2.2.2.2’, ”, 1], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” },”children”: [ { “pcRsMbrIfs”: { “attributes”: { “status”: “deleted”,”tDn”: “sys/intf/phys-[eth1/20]”} } } ] } } ] } } ] } }’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ { “interfaceEntity”: { “children”: [ { “pcAggrIf”: { “attributes”: { “id”: “po1001” , “status”: “deleted” } } } ] } } ] } }’, 0]], ‘add_port_ethernet_native_driver_result’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-265”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/phys-[eth1/10].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “+265”, “nativeVlan”: “vlan-265”}}}’, 0]], ‘add_vm_port_ethernet_driver_result’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-265”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/phys-[eth1/10].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “+265”}}}’, 0]], ‘driver_result_unique_vPC_add1_vm’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-265”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po469].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+265”}}}’, 0], [‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-265”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po469].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+265”}}}’, 0]], ‘driver_result_unique_vPC_del1_vm’: [[‘api/mo/sys/intf/aggr-[po469].json’, ‘1.1.1.1’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-265”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-265].json’, ‘1.1.1.1’, ”, 1], [‘api/mo/sys/intf/aggr-[po469].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-265”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-265].json’, ‘2.2.2.2’, ”, 1]], ‘delete_port_ethernet_native_driver_result’: [[‘api/mo/sys/intf/phys-[eth1/10].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “-265”, “nativeVlan”: “”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-265].json’, ‘1.1.1.1’, ”, 1]]}
class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_restapi_events.TestCiscoNexusRestDevice(*args, **kwds)

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDevice

Unit tests for Cisco ML2 Nexus restapi device driver

setUp()
test_create_delete_dhcp(*args, **kwargs)
test_create_delete_diff_switch_same_host(*args, **kwargs)
test_create_delete_dual(*args, **kwargs)
test_create_delete_duplicate_port_transaction(*args, **kwargs)
test_create_delete_duplicate_ports(*args, **kwargs)
test_create_delete_portchannel(*args, **kwargs)
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)
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_same_switch_diff_hosts_same_vlan(*args, **kwargs)
test_nexus_vm_migration(*args, **kwargs)
class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_restapi_events.TestCiscoNexusRestDeviceInit(*args, **kwds)

Bases: networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_events.TestCiscoNexusDeviceInit

Verifies interface vlan allowed none is set when missing.

get_init_side_effect(action, ipaddr=None, body=None, headers=None)
restapi_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_restapi_events.TestCiscoNexusRestDeviceResults

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’: [[‘api/mo/sys/intf/aggr-[po2].json’, ‘6.6.6.6’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-268”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-268].json’, ‘6.6.6.6’, ”, 1], [‘api/mo/sys/intf/aggr-[po2].json’, ‘7.7.7.7’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-268”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-268].json’, ‘7.7.7.7’, ”, 1]], ‘delete_port2_driver_result2’: [[‘api/mo/sys/intf/phys-[eth1/20].json’, ‘8.8.8.8’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “-267”}}}’, 0]], ‘add_port_channel_driver_result’: [[‘api/mo.json’, ‘2.2.2.2’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-268”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po2].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+268”}}}’, 0]], ‘duplicate_add_port_driver_result’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/phys-[eth1/10].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “+267”}}}’, 0]], ‘add_port2_driver_result2’: [[‘api/mo.json’, ‘8.8.8.8’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/phys-[eth1/20].json’, ‘8.8.8.8’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “+267”}}}’, 0]], ‘add_port2_driver_result3’: [[‘api/mo.json’, ‘6.6.6.6’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-268”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po2].json’, ‘6.6.6.6’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+268”}}}’, 0], [‘api/mo.json’, ‘7.7.7.7’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-268”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po2].json’, ‘7.7.7.7’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+268”}}}’, 0]], ‘delete_port_channel_driver_result’: [[‘api/mo/sys/intf/aggr-[po2].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-268”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-268].json’, ‘2.2.2.2’, ”, 1]], ‘dual_add_port_driver_result’: [[‘api/mo.json’, ‘4.4.4.4’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-269”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/phys-[eth1/3].json’, ‘4.4.4.4’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “+269”}}}’, 0], [‘api/mo.json’, ‘4.4.4.4’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-269”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/aggr-[po2].json’, ‘4.4.4.4’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “+269”}}}’, 0]], ‘migrate_add_host2_driver_result’: [[‘api/mo.json’, ‘3.3.3.3’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/phys-[eth1/20].json’, ‘3.3.3.3’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “+267”}}}’, 0]], ‘add_port2_driver_result’: [[‘api/mo.json’, ‘1.1.1.1’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-265”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/phys-[eth1/20].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “+265”}}}’, 0]], ‘del_port_driver_result’: [[‘api/mo/sys/intf/phys-[eth1/10].json’, ‘8.8.8.8’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “-267”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-267].json’, ‘8.8.8.8’, ”, 1]], ‘dual_delete_port_driver_result’: [[‘api/mo/sys/intf/phys-[eth1/3].json’, ‘4.4.4.4’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “-269”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-269].json’, ‘4.4.4.4’, ”, 1], [‘api/mo/sys/intf/aggr-[po2].json’, ‘4.4.4.4’, ‘{“pcAggrIf”: {“attributes”: { “trunkVlans”: “-269”}}}’, 0]], ‘add_port_driver_result’: [[‘api/mo.json’, ‘8.8.8.8’, ‘{“topSystem”: { “children”: [ {“bdEntity”: { “children”: [ {“l2BD”: {“attributes”: {“fabEncap”: “vlan-267”, “pcTag”: “1”, “adminSt”: “active”}}}, ]}}]}}’, 0], [‘api/mo/sys/intf/phys-[eth1/10].json’, ‘8.8.8.8’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “+267”}}}’, 0]], ‘delete_port2_driver_result’: [[‘api/mo/sys/intf/phys-[eth1/20].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “-265”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-265].json’, ‘1.1.1.1’, ”, 1]], ‘duplicate_del_port_driver_result’: [[‘api/mo/sys/intf/phys-[eth1/10].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: { “trunkVlans”: “-267”}}}’, 0], [‘api/mo/sys/bd/bd-[vlan-267].json’, ‘1.1.1.1’, ”, 1]]}
class networking_cisco.tests.unit.ml2.drivers.cisco.nexus.test_cisco_nexus_restapi_events.TestCiscoNexusRestInitResults

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’: [[‘api/mo/sys/intf/phys-[eth1/10].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo/sys/intf/phys-[eth1/20].json’, ‘1.1.1.1’, ‘{“l1PhysIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo/sys/intf/phys-[eth1/10].json’, ‘8.8.8.8’, ‘{“l1PhysIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo/sys/intf/phys-[eth1/20].json’, ‘8.8.8.8’, ‘{“l1PhysIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo/sys/intf/phys-[eth1/3].json’, ‘4.4.4.4’, ‘{“l1PhysIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo/sys/intf/aggr-[po2].json’, ‘4.4.4.4’, ‘{“pcAggrIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo/sys/intf/phys-[eth1/20].json’, ‘3.3.3.3’, ‘{“l1PhysIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo/sys/intf/aggr-[po2].json’, ‘2.2.2.2’, ‘{“pcAggrIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo/sys/intf/aggr-[po2].json’, ‘6.6.6.6’, ‘{“pcAggrIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0], [‘api/mo/sys/intf/aggr-[po2].json’, ‘7.7.7.7’, ‘{“pcAggrIf”: {“attributes”: {“mode”: “trunk”, “trunkVlans”: “”}}}’, 0]]}