def test_recreate_vmi(vnc_api_client, vmi_1, vn, vnc_lib, project): vpg = mock.Mock() vmi_1.virtual_port_group_back_refs = [{"uuid": vpg.uuid}] vnc_lib.virtual_port_group_read.return_value = vpg vnc_lib.project_read.return_value = project vnc_api_client.recreate_vmi_with_new_vlan(vmi_1, vn, 10) # detach from vpg vpg.del_virtual_machine_interface.assert_called_with(vmi_1) # update vpg assert vnc_lib.virtual_port_group_update.call_args_list[0] == mock.call( vpg) # delete vmi vnc_lib.virtual_machine_interface_delete.assert_called_once_with( id=vmi_1.uuid) # create new vmi created_vmi = vnc_lib.virtual_machine_interface_create.call_args[0][0] utils.verify_vnc_vmi(created_vmi, vn_name="dvs-1_dpg-1", vlan=10) # attach vmi to vpg vpg.add_virtual_machine_interface.assert_called_once_with(created_vmi) # update vpg assert vnc_lib.virtual_port_group_update.call_args_list[1] == mock.call( vpg)
def test_update_vlan( minimalistic_topology, vmware_controller, vcenter_api_client, vnc_test_client, vmware_dpg, vmware_vm, ): # User creates a DPG (dpg-1) and the event is properly handled dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg) vmware_controller.handle_update(dpg_created_update) # dpg-1 should be created in VNC created_vn = vnc_test_client.read_vn(models.generate_uuid(vmware_dpg.key)) assert created_vn is not None # User creates a VM (vm-1) in dpg-1 and the event properly handled vm_created_update = vcenter_api_client.create_vm(vmware_vm) vmware_controller.handle_update(vm_created_update) # VMI (esxi-1_dvs-1_dpg-1) should be created in VNC previous_vmi = vnc_test_client.read_vmi( models.generate_uuid("esxi-1_dvs-1_dpg-1")) assert previous_vmi is not None # CVFM shuts down # User changes the VLAN ID of dpg-1 and the event is not handled vcenter_api_client.reconfigure_dpg(vmware_dpg, 6) # CVFM starts up - sync vmware_controller.sync() # VMI's VLAN ID should be updated in VNC current_vmi = vnc_test_client.read_vmi(previous_vmi.uuid) utils.verify_vnc_vmi(current_vmi, vlan=6)
def test_vmi_sync_create( minimalistic_topology, vmware_controller, vcenter_api_client, vnc_test_client, vmware_dpg, vmware_vm, ): # User creates a DPG (dpg-1) and the event is properly handled dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg) vmware_controller.handle_update(dpg_created_update) # CVFM shuts down # User creates a VM (vm-1) in dpg-1 and the event is not handled vcenter_api_client.create_vm(vmware_vm) # CVFM starts up - sync vmware_controller.sync() # VPG (esxi-1_dvs-1) should be created in VNC created_vpg = vnc_test_client.read_vpg( models.generate_uuid("esxi-1_dvs-1")) assert created_vpg is not None # VMI (esxi-1_dvs-1_dpg-1) should be created in VNC and should be # attached to VPG (esxi-1_dvs-1) created_vmi = vnc_test_client.read_vmi( models.generate_uuid("esxi-1_dvs-1_dpg-1")) utils.verify_vnc_vmi( created_vmi, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, ) utils.verify_vmi_bindings(created_vmi, created_vpg)
def test_dpg_reconfiguration_from_invalid_vlan( topology_with_two_nodes, vnc_test_client, vcenter_api_client, vmware_controller, vmware_dpg_invalid_vlan, vmware_vm_1_invalid_dpg, vmware_vm_2_invalid_dpg, ): # dpg-1 created in dvs-1 with invalid VLAN 0 dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_invalid_vlan) vmware_controller.handle_update(dpg_created_update) # vm-1 created on host esxi-1 with single interface in (dvs-1, dpg-1) vm_created_update_1 = vcenter_api_client.create_vm(vmware_vm_1_invalid_dpg) vmware_controller.handle_update(vm_created_update_1) # vm-2 created on host esxi-2 with single interface in (dvs-1, dpg-1) vm_created_update_2 = vcenter_api_client.create_vm(vmware_vm_2_invalid_dpg) vmware_controller.handle_update(vm_created_update_2) # No created objects in VNC API for invalid DPG vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 0 with pytest.raises(vnc_api.NoIdError): vnc_test_client.read_vn(models.generate_uuid("dvportgroup-1")) # dpg-1 VLAN reconfigured from 0 to 5 dpg_reconfigured_update = vcenter_api_client.reconfigure_dpg( vmware_dpg_invalid_vlan, 5) vmware_controller.handle_update(dpg_reconfigured_update) vnc_vn = vnc_test_client.read_vn(models.generate_uuid("dvportgroup-1")) assert vnc_vn.name == "dvs-1_dpg-1" vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 2 created_vmi = vmis["esxi-1_dvs-1_dpg-1"] utils.verify_vnc_vmi( vnc_vmi=created_vmi, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, ) created_vmi = vmis["esxi-2_dvs-1_dpg-1"] utils.verify_vnc_vmi( vnc_vmi=created_vmi, vmi_name="esxi-2_dvs-1_dpg-1", vpg_name="esxi-2_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, )
def test_vm_renamed( minimalistic_topology, vnc_test_client, vmware_controller, vcenter_api_client, vmware_vm, vmware_dpg, ): # User creates a DPG (dpg-1) dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg) vmware_controller.handle_update(dpg_created_update) # User creates a VM (vm-1) vm_created_update = vcenter_api_client.create_vm(vmware_vm) vmware_controller.handle_update(vm_created_update) # A VPG (esxi-1_dvs-1) and a VMI (esxi-1_dvs-1_dpg-1) should be created # in VNC vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 1 vpgs = vnc_test_client.read_all_vpgs() assert len(vpgs) == 1 created_vpg = vpgs["esxi-1_dvs-1"] created_vmi = vmis["esxi-1_dvs-1_dpg-1"] utils.verify_vnc_vpg( vnc_vpg=created_vpg, vpg_name="esxi-1_dvs-1", pi_names=["xe-0/0/0"], vmi_names=["esxi-1_dvs-1_dpg-1"], ) utils.verify_vnc_vmi( vnc_vmi=created_vmi, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, ) # User renames vm-1 to vm-1-renamed vm_renamed_update = vcenter_api_client.rename_vm(vmware_vm, "vm-1-renamed") vmware_controller.handle_update(vm_renamed_update) # User removes vm-1-renamed from vCenter vm_removed_update = vcenter_api_client.remove_vm(vmware_vm) vmware_controller.handle_update(vm_removed_update) # esxi-1_dvs-1 and esxi-1_dvs-1_dpg-1 should be deleted from VNC with pytest.raises(vnc_api.NoIdError): vnc_test_client.read_vpg(created_vpg.uuid) with pytest.raises(vnc_api.NoIdError): vnc_test_client.read_vmi(created_vmi.uuid)
def test_vpg_exists( minimalistic_topology, vmware_controller, vcenter_api_client, vnc_test_client, vmware_vm, vmware_dpg, vmware_dpg_2, ): # User creates a DPG (dpg-1) and the event is properly handled dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg) vmware_controller.handle_update(dpg_created_update) # User creates DPG (dpg-2) and the event is properly handled dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_2) vmware_controller.handle_update(dpg_created_update) # User creates a VM (vm-1) in dpg-1 and the event properly handled vm_created_update = vcenter_api_client.create_vm(vmware_vm) vmware_controller.handle_update(vm_created_update) # VMI (esxi-1_dvs-1_dpg-1) should be created in VNC previous_vmi = vnc_test_client.read_vmi( models.generate_uuid("esxi-1_dvs-1_dpg-1")) assert previous_vmi is not None previous_vpg = vnc_test_client.read_vpg( models.generate_uuid("esxi-1_dvs-1")) assert previous_vpg # CVFM shuts down # User connects vm-1 to dpg-2 vcenter_api_client.add_interface(vmware_vm, vmware_dpg_2) # CVFM starts up - sync vmware_controller.sync() # VPG (esxi-1_dvs-1) should stay the same in VNC current_vpg = vnc_test_client.read_vpg( models.generate_uuid("esxi-1_dvs-1")) assert utils.not_deleted_from_vnc(previous_vpg, current_vpg) # VMI (esxi-1_dvs-1_dpg-2) should be created in VNC and should be # attached to VPG (esxi-1_dvs-1) created_vmi = vnc_test_client.read_vmi( models.generate_uuid("esxi-1_dvs-1_dpg-2")) utils.verify_vnc_vmi( created_vmi, vmi_name="esxi-1_dvs-1_dpg-2", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-2", vlan=6, )
def test_dpg_sync_vlan_id( minimalistic_topology, vmware_controller, vcenter_api_client, vnc_test_client, vmware_dpg_1, vmware_vm, ): # User creates a DPG (dpg-1) and the event is properly handled dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_1) vmware_controller.handle_update(dpg_created_update) # User creates a VM (vm-1) with single interface in dpg-1 vm_created_update_1 = vcenter_api_client.create_vm(vmware_vm) vmware_controller.handle_update(vm_created_update_1) vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 1 created_vmi = vmis["esxi-1_dvs-1_dpg-1"] utils.verify_vnc_vmi( vnc_vmi=created_vmi, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, ) # CVFM shuts down # User changes the VLAN ID of dpg-1 to 10 and the event is not handled vcenter_api_client.reconfigure_dpg(vmware_dpg_1, 10) # CVFM starts up - sync vmware_controller.sync() # VLAN ID of esxi-1_dvs-1_dpg-1 should be changed to 10 vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 1 created_vmi = vmis["esxi-1_dvs-1_dpg-1"] utils.verify_vnc_vmi( vnc_vmi=created_vmi, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=10, )
def test_pi_no_port_conn( topology_with_two_nodes, vmware_controller, vcenter_api_client, vnc_test_client, vmware_vm_1, vmware_vm_2, vmware_dpg, ): # There is a portgroup in vCenter (dpg-1) vcenter_api_client.create_dpg(vmware_dpg) # There are two VMs on two different ESXis (vm-1 and vm-2), connected to # dpg-1 vcenter_api_client.create_vm(vmware_vm_1) vcenter_api_client.create_vm(vmware_vm_2) # PI of esxi-2 is not connected to the port pi = [ pi for pi in vnc_test_client.read_all_physical_interfaces() if pi.name == "xe-0/0/2" ][0] vnc_test_client.remove_ports_from_physical_interface(pi) # Synchronization starts vmware_controller.sync() # The sync process should be successful for vm-1 and unsuccessful for vm-2 created_vpg = vnc_test_client.read_vpg( models.generate_uuid("esxi-1_dvs-1")) assert created_vpg is not None created_vmi = vnc_test_client.read_vmi( models.generate_uuid("esxi-1_dvs-1_dpg-1")) utils.verify_vnc_vmi( created_vmi, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, ) with pytest.raises(vnc_api.NoIdError): vnc_test_client.read_vpg(models.generate_uuid("esxi-2_dvs-1")) with pytest.raises(vnc_api.NoIdError): vnc_test_client.read_vmi(models.generate_uuid("esxi-2_dvs-1-dpg-1"))
def test_vm_created( minimalistic_topology, vnc_test_client, vmware_controller, vcenter_api_client, vmware_vm, vmware_dpg_1, ): dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_1) vmware_controller.handle_update(dpg_created_update) vm_created_update = vcenter_api_client.create_vm(vmware_vm) vmware_controller.handle_update(vm_created_update) vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 1 vpgs = vnc_test_client.read_all_vpgs() assert len(vpgs) == 1 created_vpg = vpgs["esxi-1_dvs-1"] created_vmi = vmis["esxi-1_dvs-1_dpg-1"] utils.verify_vnc_vpg( vnc_vpg=created_vpg, vpg_name="esxi-1_dvs-1", pi_names=["xe-0/0/0"], vmi_names=["esxi-1_dvs-1_dpg-1"], ) utils.verify_vnc_vmi( vnc_vmi=created_vmi, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, ) utils.verify_vmi_bindings(created_vmi, created_vpg)
def test_vm_created_on_two_nodes( topology_with_spine_switch, vnc_test_client, vmware_controller, vcenter_api_client, vmware_vm_1, vmware_vm_2, vmware_vm_3, vmware_vm_4, vmware_vm_5, vmware_dpg_1, vmware_dpg_2, vmware_dpg_3, ): # dpg-1 created on dvs-1 dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_1) vmware_controller.handle_update(dpg_created_update) # dpg-2 created on dvs-1 dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_2) vmware_controller.handle_update(dpg_created_update) # dpg-3 created on dvs-2 dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_3) vmware_controller.handle_update(dpg_created_update) # vm-1 created on host esxi-1 with single interface in (dvs-1, dpg-1) vm_created_update_1 = vcenter_api_client.create_vm(vmware_vm_1) vmware_controller.handle_update(vm_created_update_1) # vm-2 created on host esxi-2 with two interfaces in (dvs-1, dpg-1) and ( # dvs-2, dpg-3) vm_created_update_2 = vcenter_api_client.create_vm(vmware_vm_2) vmware_controller.handle_update(vm_created_update_2) # vm-3 created on host esxi-1 with two interfaces in (dvs-1, dpg-1) and ( # dvs-2, dpg-3) vm_created_update_3 = vcenter_api_client.create_vm(vmware_vm_3) vmware_controller.handle_update(vm_created_update_3) # VM4 created on host esxi-1 with one interface in (dvs-1, dpg-2) vm_created_update_4 = vcenter_api_client.create_vm(vmware_vm_4) vmware_controller.handle_update(vm_created_update_4) # VM5 created on host esxi-2 with one interface in (dvs-1, dpg-2) vm_created_update_5 = vcenter_api_client.create_vm(vmware_vm_5) vmware_controller.handle_update(vm_created_update_5) vpgs = vnc_test_client.read_all_vpgs() assert len(vpgs) == 4 created_vpg = vpgs["esxi-1_dvs-1"] utils.verify_vnc_vpg( vnc_vpg=created_vpg, vpg_name="esxi-1_dvs-1", pi_names=["xe-0/0/1", "xe-0/0/5"], vmi_names=["esxi-1_dvs-1_dpg-1", "esxi-1_dvs-1_dpg-2"], ) created_vpg = vpgs["esxi-1_dvs-2"] utils.verify_vnc_vpg( vnc_vpg=created_vpg, vpg_name="esxi-1_dvs-2", pi_names=["xe-0/0/2", "xe-0/0/6"], vmi_names=["esxi-1_dvs-2_dpg-3"], ) created_vpg = vpgs["esxi-2_dvs-1"] utils.verify_vnc_vpg( vnc_vpg=created_vpg, vpg_name="esxi-2_dvs-1", pi_names=["xe-0/0/3", "xe-0/0/7"], vmi_names=["esxi-2_dvs-1_dpg-1", "esxi-2_dvs-1_dpg-2"], ) created_vpg = vpgs["esxi-2_dvs-2"] utils.verify_vnc_vpg( vnc_vpg=created_vpg, vpg_name="esxi-2_dvs-2", pi_names=["xe-0/0/4", "xe-0/0/8"], vmi_names=["esxi-2_dvs-2_dpg-3"], ) vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 6 for vmi in list(vmis.values()): if "dpg-1" in vmi.name: expected_vlan = 5 elif "dpg-2" in vmi.name: expected_vlan = 6 elif "dpg-3" in vmi.name: expected_vlan = 7 utils.verify_vnc_vmi(vnc_vmi=vmi, vlan=expected_vlan) vpg_name = "_".join(vmi.name.split("_")[:-1]) utils.verify_vmi_bindings(vmi, vpgs[vpg_name])
def test_dpg_reconfiguration( topology_with_two_nodes, vnc_test_client, vcenter_api_client, vmware_controller, vmware_dpg, vmware_vm_1, vmware_vm_2, ): # dpg-1 created in dvs-1 with VLAN 5 dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg) vmware_controller.handle_update(dpg_created_update) # vm-1 created on host esxi-1 with single interface in (dvs-1, dpg-1) vm_created_update_1 = vcenter_api_client.create_vm(vmware_vm_1) vmware_controller.handle_update(vm_created_update_1) # vm-2 created on host esxi-2 with single interface in (dvs-1, dpg-1) vm_created_update_2 = vcenter_api_client.create_vm(vmware_vm_2) vmware_controller.handle_update(vm_created_update_2) vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 2 created_vmi = vmis["esxi-1_dvs-1_dpg-1"] utils.verify_vnc_vmi( vnc_vmi=created_vmi, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, ) created_vmi = vmis["esxi-2_dvs-1_dpg-1"] utils.verify_vnc_vmi( vnc_vmi=created_vmi, vmi_name="esxi-2_dvs-1_dpg-1", vpg_name="esxi-2_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, ) # dpg-1 VLAN reconfigured from 5 to 15 dpg_reconfigured_update = vcenter_api_client.reconfigure_dpg( vmware_dpg, 15) vmware_controller.handle_update(dpg_reconfigured_update) vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 2 created_vmi = vmis["esxi-1_dvs-1_dpg-1"] utils.verify_vnc_vmi( vnc_vmi=created_vmi, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=15, ) created_vmi = vmis["esxi-2_dvs-1_dpg-1"] utils.verify_vnc_vmi( vnc_vmi=created_vmi, vmi_name="esxi-2_dvs-1_dpg-1", vpg_name="esxi-2_dvs-1", vn_name="dvs-1_dpg-1", vlan=15, )
def test_add_new_node( topology_update_msg_timeout, minimalistic_topology, vnc_test_client, vmware_controller, vcenter_api_client, vmware_dpg_1, vmware_dpg_2, vmware_vm_1, vmware_vm_2, vnc_monitor, lock, sync_finished, ): topology_update_msg_timeout = 1 vnc_monitor_greenlet = gevent.spawn(vnc_monitor.start) # create a DPG dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_1) vmware_controller.handle_update(dpg_created_update) # create a VM in a DPG vm_created_update = vcenter_api_client.create_vm(vmware_vm_1) vmware_controller.handle_update(vm_created_update) with lock: # change topology - add a new node and a new dvs supported by this node existing_pi_uuid = vnc_test_client.read_all_physical_interface_uuids()[ 0 ] existing_pi = vnc_test_client.read_physical_interface(existing_pi_uuid) pr = vnc_test_client.read_physical_router(existing_pi.parent_uuid) pi = vnc_test_client.create_physical_interface( "xe-0/0/1", "11:22:33:44:55:03", pr ) esxi = vnc_test_client.create_node("esxi-2", "10.10.10.12") port = vnc_test_client.create_port( "eth1", "11:22:33:44:55:01", esxi, "dvs-2" ) vnc_test_client.add_port_to_physical_interface(pi, port) vcenter_api_client.add_host("esxi-2") sync_finished.wait() # create a new DPG in the new DVS dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_2) vmware_controller.handle_update(dpg_created_update) # create a new VM in the new DPG vm_created_update = vcenter_api_client.create_vm(vmware_vm_2) vmware_controller.handle_update(vm_created_update) # verify that VPGs and VMIs exist for all VMs and DPGs vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 2 vpgs = vnc_test_client.read_all_vpgs() assert len(vpgs) == 2 created_vpg_1 = vpgs["esxi-1_dvs-1"] created_vmi_1 = vmis["esxi-1_dvs-1_dpg-1"] created_vpg_2 = vpgs["esxi-2_dvs-2"] created_vmi_2 = vmis["esxi-2_dvs-2_dpg-2"] utils.verify_vnc_vpg( vnc_vpg=created_vpg_1, vpg_name="esxi-1_dvs-1", pi_names=["xe-0/0/0"], vmi_names=["esxi-1_dvs-1_dpg-1"], ) utils.verify_vnc_vmi( vnc_vmi=created_vmi_1, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, ) utils.verify_vnc_vpg( vnc_vpg=created_vpg_2, vpg_name="esxi-2_dvs-2", pi_names=["xe-0/0/1"], vmi_names=["esxi-2_dvs-2_dpg-2"], ) utils.verify_vnc_vmi( vnc_vmi=created_vmi_2, vmi_name="esxi-2_dvs-2_dpg-2", vpg_name="esxi-2_dvs-2", vn_name="dvs-2_dpg-2", vlan=6, ) utils.verify_vmi_bindings(created_vmi_1, created_vpg_1) utils.verify_vmi_bindings(created_vmi_2, created_vpg_2) vnc_monitor_greenlet.kill()
def test_remove_node( topology_update_msg_timeout, topology_with_two_nodes, vnc_test_client, vmware_controller, vcenter_api_client, vmware_dpg_1, vmware_dpg_2, vmware_vm_1, vmware_vm_2, vnc_monitor, lock, sync_finished, ): topology_update_msg_timeout = 1 vnc_monitor_greenlet = gevent.spawn(vnc_monitor.start) # create a DPG dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_1) vmware_controller.handle_update(dpg_created_update) # create a VM in a DPG vm_created_update = vcenter_api_client.create_vm(vmware_vm_1) vmware_controller.handle_update(vm_created_update) # create a new DPG in the new DVS dpg_created_update = vcenter_api_client.create_dpg(vmware_dpg_2) vmware_controller.handle_update(dpg_created_update) # create a new VM in the new DPG vm_created_update = vcenter_api_client.create_vm(vmware_vm_2) vmware_controller.handle_update(vm_created_update) with lock: # change topology - remove a node (esxi-2) and a dvs (dvs-2) supported # by this node vnc_test_client.vnc_lib.physical_interface_delete( ["default-global-system-config", "qfx-1", "xe-0/0/2"] ) vnc_test_client.vnc_lib.port_delete( ["default-global-system-config", "esxi-2", "eth2"] ) vnc_test_client.vnc_lib.node_delete( ["default-global-system-config", "esxi-2"] ) sync_finished.wait() # verify that VPGs and VMIs exist for all VMs and DPGs vmis = vnc_test_client.read_all_vmis() assert len(vmis) == 1 vpgs = vnc_test_client.read_all_vpgs() assert len(vpgs) == 1 created_vpg_1 = vpgs["esxi-1_dvs-1"] created_vmi_1 = vmis["esxi-1_dvs-1_dpg-1"] utils.verify_vnc_vpg( vnc_vpg=created_vpg_1, vpg_name="esxi-1_dvs-1", pi_names=["xe-0/0/0"], vmi_names=["esxi-1_dvs-1_dpg-1"], ) utils.verify_vnc_vmi( vnc_vmi=created_vmi_1, vmi_name="esxi-1_dvs-1_dpg-1", vpg_name="esxi-1_dvs-1", vn_name="dvs-1_dpg-1", vlan=5, ) utils.verify_vmi_bindings(created_vmi_1, created_vpg_1) vnc_monitor_greenlet.kill()