From 83b8ebc9837c568165400609aa6df0a60b7ada29 Mon Sep 17 00:00:00 2001 From: dkumbhar Date: Wed, 4 Nov 2020 04:33:18 +0000 Subject: [PATCH] trunk added more cases Change-Id: I6f4518bf3f1b3f5ff4d025131677a25b457a07e2 --- .../tests/scenario/test_trunk.py | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) diff --git a/vmware_nsx_tempest_plugin/tests/scenario/test_trunk.py b/vmware_nsx_tempest_plugin/tests/scenario/test_trunk.py index 49dc668..b6826ab 100644 --- a/vmware_nsx_tempest_plugin/tests/scenario/test_trunk.py +++ b/vmware_nsx_tempest_plugin/tests/scenario/test_trunk.py @@ -200,6 +200,104 @@ class TestTrunkService(feature_manager.FeatureManager): sg=self.sg) return networks + def _test_trunk_child_subport_add(self, topology): + project_id = topology['project_id'] + parent1_port = topology['parent1_port'] + parent2_port = topology['parent2_port'] + child1_p1 = topology['child1_p1'] + child2_p1 = topology['child2_p1'] + child1_p2 = topology['child1_p2'] + child2_p2 = topology['child2_p2'] + sg_name_dict = dict(name=topology['sg']['name']) + parent1_id = parent1_port['port']['id'] + parent2_id = parent2_port['port']['id'] + trunk_parent1 = self.create_trunk_parent_port(provider=True, + project_id=project_id, + parent_port=parent1_id, + trunkportname='p11') + print("parent1 Trunk port id:::::" + str(trunk_parent1)) + child1_id = child1_p1['port']['id'] + child2_id = child2_p1['port']['id'] + child1_trunk_p1 = self.add_subport_to_parent(provider=True, + vlan_id=101, + project_id=project_id, + child_port=child1_id, + childportname='child11', + trunkportid=trunk_parent1) + print("Child trunk port is " + str(child1_trunk_p1)) + child2_trunk_p1 = self.add_subport_to_parent(provider=True, + vlan_id=102, + project_id=project_id, + child_port=child2_id, + childportname='child22', + trunkportid=trunk_parent1) + print("Child trunk port is " + str(child2_trunk_p1)) + trunk_parent2 = self.create_trunk_parent_port(provider=True, + project_id=project_id, + parent_port=parent2_id, + trunkportname='p22') + print("parent2 Trunk port id:::::" + str(trunk_parent2)) + child1_id = child1_p2['port']['id'] + child2_id = child2_p2['port']['id'] + child1_trunk_p2 = self.add_subport_to_parent(provider=True, + vlan_id=101, + project_id=project_id, + child_port=child1_id, + childportname='ch11_p2', + trunkportid=trunk_parent2) + print("Child trunk port is " + str(child1_trunk_p2)) + child2_trunk_p2 = self.add_subport_to_parent(provider=True, + vlan_id=102, + project_id=project_id, + child_port=child2_id, + childportname='ch22_p2', + trunkportid=trunk_parent2) + print("Child trunk port is " + str(child2_trunk_p2)) + child1_ip_vm1 = child1_p1['port']['fixed_ips'][0]['ip_address'] + child2_ip_vm1 = child2_p1['port']['fixed_ips'][0]['ip_address'] + child1_ip_vm2 = child1_p2['port']['fixed_ips'][0]['ip_address'] + child2_ip_vm2 = child2_p2['port']['fixed_ips'][0]['ip_address'] + server_name1_default = data_utils.rand_name('server1-default') + server_name2_default = data_utils.rand_name('server2-default') + image_id = self.get_glance_image_id([CONF.trunk.image_name]) + flavor_name = self.get_flavor_id([CONF.trunk.flavor_id]) + keypair = self.create_keypair(self.cmgr_adm.keypairs_client) + server1 = self.create_topology_instance(server_name1_default, + create_floating_ip=True, + image_id=image_id, + port=parent1_port['port'], + security_groups=[sg_name_dict], + clients=self.cmgr_adm, + keypair=keypair, + flavor=flavor_name) + server2 = self.create_topology_instance(server_name2_default, + create_floating_ip=True, + image_id=image_id, + port=parent2_port['port'], + security_groups=[sg_name_dict], + clients=self.cmgr_adm, + keypair=keypair, + flavor=flavor_name) + ip_address = server1['floating_ips'][0]['floating_ip_address'] + ssh_src1 = self._get_remote_client(ip_address, username='ubuntu', + use_password=False, + private_key=keypair['private_key']) + remote_ip = parent2_port['port']['dns_assignment'][0]['ip_address'] + # Verify connectivity between vms + self._assign_ip_address(ssh_src1, 'eth0.101', child1_ip_vm1) + self._assign_ip_address(ssh_src1, 'eth0.102', child2_ip_vm1) + ip_address = server2['floating_ips'][0]['floating_ip_address'] + ssh_src2 = self._get_remote_client(ip_address, username='ubuntu', + use_password=False, + private_key=keypair['private_key']) + # Verify connectivity between vms + self._assign_ip_address(ssh_src2, 'eth0.101', child1_ip_vm2) + self._assign_ip_address(ssh_src2, 'eth0.102', child2_ip_vm2) + self.check_remote_connectivity(ssh_src1, remote_ip, + should_succeed=True) + self.check_remote_connectivity(ssh_src1, child2_ip_vm2, + should_succeed=True) + def _test_trunk_child_subport_add_delete(self, topology): project_id = topology['project_id'] parent1_port = topology['parent1_port'] @@ -527,11 +625,116 @@ class TestTrunkService(feature_manager.FeatureManager): self.check_remote_connectivity(ssh_src1, child2_ip_vm2, should_succeed=True) + def _test_trunk_instance_vm_vlan_diff_subnet(self, topology): + project_id = topology['project_id'] + parent1_port = topology['parent1_port'] + parent2_port = topology['parent2_port'] + child1_p1 = topology['child1_p1'] + child2_p1 = topology['child2_p1'] + child1_p2 = topology['child1_p2'] + child2_p2 = topology['child2_p2'] + sg_name_dict = dict(name=topology['sg']['name']) + parent1_id = parent1_port['port']['id'] + parent2_id = parent2_port['port']['id'] + trunk_parent1 = self.create_trunk_parent_port(provider=True, + project_id=project_id, + parent_port=parent1_id, + trunkportname='p11') + print("parent1 Trunk port id:::::" + str(trunk_parent1)) + child1_id = child1_p1['port']['id'] + child2_id = child2_p1['port']['id'] + child1_trunk_p1 = self.add_subport_to_parent(provider=True, + vlan_id=101, + project_id=project_id, + child_port=child1_id, + childportname='child11', + trunkportid=trunk_parent1) + print("Child trunk port is " + str(child1_trunk_p1)) + child2_trunk_p1 = self.add_subport_to_parent(provider=True, + vlan_id=102, + project_id=project_id, + child_port=child2_id, + childportname='child22', + trunkportid=trunk_parent1) + print("Child trunk port is " + str(child2_trunk_p1)) + trunk_parent2 = self.create_trunk_parent_port(provider=True, + project_id=project_id, + parent_port=parent2_id, + trunkportname='p22') + print("parent2 Trunk port id:::::" + str(trunk_parent2)) + child1_id = child1_p2['port']['id'] + child2_id = child2_p2['port']['id'] + child1_trunk_p2 = self.add_subport_to_parent(provider=True, + vlan_id=101, + project_id=project_id, + child_port=child1_id, + childportname='ch11_p2', + trunkportid=trunk_parent2) + print("Child trunk port is " + str(child1_trunk_p2)) + child2_trunk_p2 = self.add_subport_to_parent(provider=True, + vlan_id=102, + project_id=project_id, + child_port=child2_id, + childportname='ch22_p2', + trunkportid=trunk_parent2) + print("Child trunk port is " + str(child2_trunk_p2)) + child1_ip_vm1 = child1_p1['port']['fixed_ips'][0]['ip_address'] + child2_ip_vm1 = child2_p1['port']['fixed_ips'][0]['ip_address'] + server_name1_default = data_utils.rand_name('server1-default') + server_name2_default = data_utils.rand_name('server2-default') + image_id = self.get_glance_image_id([CONF.trunk.image_name]) + flavor_name = self.get_flavor_id([CONF.trunk.flavor_id]) + keypair = self.create_keypair(self.cmgr_adm.keypairs_client) + server1 = self.create_topology_instance(server_name1_default, + create_floating_ip=True, + image_id=image_id, + port=parent1_port['port'], + security_groups=[sg_name_dict], + clients=self.cmgr_adm, + keypair=keypair, + flavor=flavor_name) + server2 = self.create_topology_instance(server_name2_default, + create_floating_ip=True, + image_id=image_id, + port=parent2_port['port'], + security_groups=[sg_name_dict], + clients=self.cmgr_adm, + keypair=keypair, + flavor=flavor_name) + ip_address = server1['floating_ips'][0]['floating_ip_address'] + ssh_src1 = self._get_remote_client(ip_address, username='ubuntu', + use_password=False, + private_key=keypair['private_key']) + remote_ip = parent2_port['port']['dns_assignment'][0]['ip_address'] + # Verify connectivity between vms + self._assign_ip_address(ssh_src1, 'eth0.201', child1_ip_vm1) + self._assign_ip_address(ssh_src1, 'eth0.202', child2_ip_vm1) + ip_address = server2['floating_ips'][0]['floating_ip_address'] + ssh_src2 = self._get_remote_client(ip_address, username='ubuntu', + use_password=False, + private_key=keypair['private_key']) + # Verify connectivity between vms + child1_ip_vm2 = child1_p2['port']['fixed_ips'][0]['ip_address'] + child2_ip_vm2 = child2_p2['port']['fixed_ips'][0]['ip_address'] + self._assign_ip_address(ssh_src2, 'eth0.101', child1_ip_vm2) + self._assign_ip_address(ssh_src2, 'eth0.102', child2_ip_vm2) + self.check_remote_connectivity(ssh_src1, remote_ip, + should_succeed=True) + self.check_remote_connectivity(ssh_src1, child1_ip_vm2, + should_succeed=False) + self.check_remote_connectivity(ssh_src1, child2_ip_vm2, + should_succeed=False) + @decorators.idempotent_id('9d4192e9-b1b7-48c9-af04-67a82637c359') def test_trunk_between_two_vms(self): self.network_topo = self.create_trunk_network_topo(False, True) self._test_trunk_between_two_vms(self.network_topo) + @decorators.idempotent_id('8d4192e9-b1b7-48c9-af04-68a82637c359') + def test_trunk_child_subport_add(self): + self.network_topo = self.create_trunk_network_topo(False, True) + self._test_trunk_child_subport_add(self.network_topo) + @decorators.idempotent_id('8d4192e9-b1b7-48c9-af04-68a82637c359') def test_trunk_child_subport_add_delete(self): self.network_topo = self.create_trunk_network_topo(False, True) @@ -541,3 +744,8 @@ class TestTrunkService(feature_manager.FeatureManager): def test_trunk_destroy_deploy_with_existing_parent_port(self): self.network_topo = self.create_trunk_network_topo(False, True) self._test_trunk_instance_destroy_deploy(self.network_topo) + + @decorators.idempotent_id('7e4192e9-b1b7-48c9-af04-79a82637c359') + def test_trunk_and_vm_sub_interface_vlan_diff(self): + self.network_topo = self.create_trunk_network_topo(False, True) + self._test_trunk_instance_vm_vlan_diff_subnet(self.network_topo)