From 312acb7a466dd7d21b5d253d84c83e5860543391 Mon Sep 17 00:00:00 2001 From: Shubham Naik Date: Mon, 11 Oct 2021 07:49:25 +0000 Subject: [PATCH] RCCA PRs automation - 2574949, 2575408, 2677902, 2653133, 2571692, 2587659 {0} vmware_nsx_tempest_plugin.tests.nsxv3.scenario.test_ipv6_network_ops.NetworkOpsTest.test_ipv4_v6_connectivity_same_network [163.323193s] ... ok {0} vmware_nsx_tempest_plugin.tests.nsxv3.scenario.test_octavia_loadbalancers.OctaviaRoundRobin.test_create_verify_octavia_lb_stats_with_http_proto [872.585736s] ... ok {0} vmware_nsx_tempest_plugin.tests.nsxv3.scenario.test_octavia_loadbalancers.OctaviaRoundRobin.test_create_verify_octavia_lb_stats_with_https_proto [824.993671s] ... ok {0} vmware_nsx_tempest_plugin.tests.nsxv3.scenario.test_octavia_loadbalancers.OctaviaRoundRobin.test_create_verify_octavia_lb_stats_with_https_terminated [894.519207s] ... ok {0} vmware_nsx_tempest_plugin.tests.nsxv3.scenario.test_allowed_address_pair.TestAllowedAddressPair.test_allowed_address_pair_same_cidr_and_same_standalone_ipv6 [163.593051s] ... ok {0} vmware_nsx_tempest_plugin.tests.nsxv3.scenario.test_allowed_address_pair.TestAllowedAddressPair.test_ipv4_v6_allowed_address_pair_with_different_mac_format [516.709262s] ... ok {0} vmware_nsx_tempest_plugin.tests.nsxv3.scenario.test_allowed_address_pair.TestAllowedAddressPair.test_ipv6_allowed_address_pair_on_vms_with_dual_network [521.299304s] ... ok {0} vmware_nsx_tempest_plugin.tests.nsxv3.scenario.test_ipv6_router.IPv6RoutersTest.test_dual_ipv4_ipv6_interface_with_invalid_gateway_update [292.048568s] ... ok {0} vmware_nsx_tempest_plugin.tests.nsxv3.scenario.test_allowed_address_pair.TestAllowedAddressPair.test_allowed_address_pair_change_ipv4 [490.848797s] ... ok Change-Id: I7e11db93b781024c8f115f602c2e1928c4573aa7 --- .../scenario/test_allowed_address_pair.py | 305 ++++++++++++++++++ .../tests/nsxv3/scenario/test_ipv6_router.py | 84 +++++ .../scenario/test_octavia_loadbalancers.py | 68 ++++ 3 files changed, 457 insertions(+) diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_allowed_address_pair.py b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_allowed_address_pair.py index be0155f..c524de0 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_allowed_address_pair.py +++ b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_allowed_address_pair.py @@ -14,6 +14,7 @@ # under the License. import collections +import random import time from oslo_log import log as logging @@ -21,6 +22,7 @@ from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators +from tempest.lib import exceptions from vmware_nsx_tempest_plugin.common import constants from vmware_nsx_tempest_plugin.services import nsxv3_client @@ -922,6 +924,275 @@ class TestAllowedAddressPair(manager.NetworkScenarioTest): (ssh_source1, ip_address_vm1_2, 'True'), 'Destination is reachable') + def _test_ipv6_allowed_address_pair_on_vms_with_dual_net( + self, network_topo): + server_name_default = data_utils.rand_name('server-default') + network = network_topo['network'] + server_default = self._create_server(server_name_default, network) + server_name_default1 = data_utils.rand_name('server-default1-sec-grp') + server_default1 = self._create_server(server_name_default1, network) + floating_ip_default = self.create_floating_ip(server_default) + floating_ip_default1 = self.create_floating_ip(server_default1) + ip_address_default_vm = floating_ip_default['floating_ip_address'] + ip_address_default1_vm = floating_ip_default1['floating_ip_address'] + private_key_default_vm = self._get_server_key(server_default) + private_key_default1_vm = self._get_server_key(server_default1) + port_client = self.ports_client + # Allowed Address pair with ipv6 cidr + random_ipv6 = (str(random.randint(1000, 9000)) + ":" + + str(random.randint(20, 80)) + ":" + + str(random.randint(31, 80)) + "::0/64") + ip_address_vm1_1 = random_ipv6.split('/')[0].replace(":0", ":2") + ip_address_vm2_1 = random_ipv6.split('/')[0].replace(":0", ":3") + ip_address_vm2_sub = random_ipv6 + port_id = self.get_port_ipv4v6_id(network['id'], + network_topo['subnet']['id'], + server_default, + network_name=network['name']) + # Update allowed address pair attribute of port with ipv6 cidr + allowed_address_pairs = [{'ip_address': ip_address_vm2_sub}] + port_client.update_port( + port_id, allowed_address_pairs=allowed_address_pairs) + port1_id = self.get_port_ipv4v6_id(network['id'], + network_topo['subnet']['id'], + server_default1, + network_name=network['name']) + port_client.update_port( + port1_id, allowed_address_pairs=allowed_address_pairs) + ssh_source = self.get_remote_client(ip_address_default_vm, + private_key=private_key_default_vm) + ssh_source1 = self.get_remote_client( + ip_address_default1_vm, private_key=private_key_default1_vm) + # Attach allowed pair ipv6 cidr range IP's to vm's + self._assign_ipv6_address(ssh_source, 'eth0', ip_address_vm1_1) + self._assign_ipv6_address(ssh_source1, 'eth0', ip_address_vm2_1) + self.assertTrue(self._check_remote_connectivity + (ssh_source, ip_address_vm2_1, 'True'), + 'Destination is reachable') + self.assertTrue(self._check_remote_connectivity + (ssh_source1, ip_address_vm1_1, 'True'), + 'Destination is reachable') + + def _test_portv6_update_between_allowed_address_pair_and_mac( + self, network_topo): + server_name_default = data_utils.rand_name('server-default2') + network = network_topo['network'] + server_default = self._create_server(server_name_default, network) + server_name_default1 = \ + data_utils.rand_name('server-default1-sec-group2') + server_default1 = self._create_server(server_name_default1, network) + floating_ip_default = self.create_floating_ip(server_default) + floating_ip_default1 = self.create_floating_ip(server_default1) + ip_address_default_vm = floating_ip_default['floating_ip_address'] + ip_address_default1_vm = floating_ip_default1['floating_ip_address'] + private_key_default_vm = self._get_server_key(server_default) + private_key_default1_vm = self._get_server_key(server_default1) + port_client = self.ports_client + # Allowed Address pair with ipv6 + random_ipv6 = (str(random.randint(1000, 9000)) + ":" + + str(random.randint(10, 80)) + ":" + + str(random.randint(11, 20)) + "::0/128") + ip_address_vm1 = random_ipv6.split('/')[0].replace(":0", ":5") + ip_address_vm2 = random_ipv6.split('/')[0].replace(":0", ":6") + vm1_mac_address = 'fa16.3e3e.3dc4' + vm2_mac_address = 'fa16.3e3e.3ec5' + body = {"network_id": network['id'], + "admin_state_up": 'true'} + port_id = self._create_port(**body) + # Update allowed address pair attribute of port + allowed_address_pairs = [{'ip_address': ip_address_vm1, + 'mac_address': vm1_mac_address}] + port_client.update_port(port_id['port']['id'], + security_groups=[self.security_group['id']]) + body = port_client.update_port( + port_id['port']['id'], allowed_address_pairs=allowed_address_pairs) + # Update allowed address pair attribute of port + body = {"network_id": network['id'], + "admin_state_up": 'true'} + port1_id = self._create_port(**body) + allowed_address_pairs = [{'ip_address': ip_address_vm2, + 'mac_address': vm2_mac_address}] + port_client.update_port(port1_id['port']['id'], + security_groups=[self.security_group['id']]) + body = port_client.update_port( + port1_id['port']['id'], + allowed_address_pairs=allowed_address_pairs) + kwargs = {'port_id': port_id['port']['id']} + # Add some sleep. Without sleep it is failing + time.sleep(constants.TIME["SEC"]["SIXTY"]) + # Attach interface to vm + self.interface_client.create_interface(server_default['id'], **kwargs) + time.sleep(constants.NSX_BACKEND_VERY_SMALL_TIME_INTERVAL) + self.addCleanup(test_utils.call_and_ignore_notfound_exc, + self.interface_client.delete_interface, + server_default['id'], port_id['port']['id']) + kwargs = {'port_id': port1_id['port']['id']} + # Attach interface to vm + self.interface_client.create_interface(server_default1['id'], **kwargs) + time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL) + self.addCleanup(test_utils.call_and_ignore_notfound_exc, + self.interface_client.delete_interface, + server_default1['id'], port1_id['port']['id']) + time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL) + self.get_remote_client( + ip_address_default_vm, private_key=private_key_default_vm) + self.get_remote_client( + ip_address_default1_vm, private_key=private_key_default1_vm) + + def _test_ipv4_allowed_address_pair_with_same_cidr_and_standalone_ip( + self, network_topo): + server_name_default = data_utils.rand_name('server-default') + network = network_topo['network'] + server_default = self._create_server(server_name_default, network) + server_name_default1 = \ + data_utils.rand_name('server-default1-sec-group') + server_default1 = self._create_server(server_name_default1, network) + floating_ip_default = self.create_floating_ip(server_default) + floating_ip_default1 = self.create_floating_ip(server_default1) + ip_address_default_vm = floating_ip_default['floating_ip_address'] + ip_address_default1_vm = floating_ip_default1['floating_ip_address'] + private_key_default_vm = self._get_server_key(server_default) + private_key_default1_vm = self._get_server_key(server_default1) + port_client = self.ports_client + # Allowed Address pair + random_ipv4 = (str(random.randint(1, 254)) + ".1.1.0/24") + ip_address_vm1 = random_ipv4.split('/')[0].replace(".0", ".3") + ip_address_vm2 = random_ipv4.split('/')[0].replace(".0", ".4") + ip_subnet_vm1 = random_ipv4 + ip_subnet_vm2 = random_ipv4 + port_id = self.get_port_id(network['id'], + network_topo['subnet']['id'], + server_default, + network_name=network['name']) + # Update allowed address pair cidr attribute of port + allowed_address_pairs = [{'ip_address': ip_address_vm1}, + {'ip_address': ip_subnet_vm1}] + port_client.update_port( + port_id, allowed_address_pairs=allowed_address_pairs) + port1_id = self.get_port_id(network['id'], + network_topo['subnet']['id'], + server_default1, + network_name=network['name']) + # Update allowed address pair cidr attribute of port + allowed_address_pairs = [{'ip_address': ip_address_vm2}, + {'ip_address': ip_subnet_vm2}] + port_client.update_port( + port1_id, allowed_address_pairs=allowed_address_pairs) + # Add some sleep. Without sleep it is failing + time.sleep(constants.TIME["SEC"]["SIXTY"]) + ssh_source = self.get_remote_client( + ip_address_default_vm, private_key=private_key_default_vm) + ssh_source1 = self.get_remote_client( + ip_address_default1_vm, private_key=private_key_default1_vm) + # Assign Allowed pair ip to vm's + self._assign_ip_address(ssh_source, 'eth0:1', ip_address_vm1) + self._assign_ip_address(ssh_source1, 'eth0:1', ip_address_vm2) + time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL) + self.assertTrue(self._check_remote_connectivity + (ssh_source1, ip_address_vm1, 'True'), + 'Destination is reachable') + self.assertTrue(self._check_remote_connectivity + (ssh_source, ip_address_vm2, 'True'), + 'Destination is reachable') + + def _test_ipv6_allowed_address_pair_with_same_cidr_and_standalone_ip( + self, network_topo): + server_name_default = data_utils.rand_name('server-default') + network = network_topo['network'] + server_default = self._create_server(server_name_default, network) + server_name_default1 = \ + data_utils.rand_name('server-default1-sec-group') + server_default1 = self._create_server(server_name_default1, network) + port_client = self.ports_client + # Allowed Address pair + random_ipv6 = (str(random.randint(1000, 9000)) + ":" + + str(random.randint(10, 80)) + ":" + + str(random.randint(11, 20)) + "::0/128") + ip_address_vm1 = random_ipv6.split('/')[0].replace(":0", ":32") + ip_address_vm2 = random_ipv6.split('/')[0].replace(":0", ":42") + ip_subnet_vm1 = random_ipv6.split('/')[0].replace(":0", ":32") + "/128" + ip_subnet_vm2 = random_ipv6.split('/')[0].replace(":0", ":42") + "/128" + port_id = self.get_port_ipv4v6_id(network['id'], + network_topo['subnet']['id'], + server_default, + network_name=network['name']) + # Update allowed address pair attribute of port + allowed_address_pairs = [{'ip_address': ip_address_vm1}, + {'ip_address': ip_subnet_vm1}] + self.assertRaises(exceptions.BadRequest, + port_client.update_port, + port_id, + allowed_address_pairs=allowed_address_pairs) + port1_id = self.get_port_ipv4v6_id(network['id'], + network_topo['subnet']['id'], + server_default1, + network_name=network['name']) + # Update allowed address pair attribute of port + allowed_address_pairs = [{'ip_address': ip_address_vm2}, + {'ip_address': ip_subnet_vm2}] + self.assertRaises(exceptions.BadRequest, + port_client.update_port, + port1_id, + allowed_address_pairs=allowed_address_pairs) + + def _test_ipv4_allowed_address_pair_change_ip(self, network_topo): + server_name_default = data_utils.rand_name('server-default') + network = network_topo['network'] + server_default = self._create_server(server_name_default, network) + server_name_default1 = \ + data_utils.rand_name('server-default1-sec-group') + server_default1 = self._create_server(server_name_default1, network) + floating_ip_default = self.create_floating_ip(server_default) + floating_ip_default1 = self.create_floating_ip(server_default1) + ip_address_default_vm = floating_ip_default['floating_ip_address'] + ip_address_default1_vm = floating_ip_default1['floating_ip_address'] + private_key_default_vm = self._get_server_key(server_default) + private_key_default1_vm = self._get_server_key(server_default1) + port_client = self.ports_client + # Allowed Address pair + random_ipv4 = (str(random.randint(1, 254)) + ".1.1.0/24") + ip_address_vm1 = random_ipv4.split('/')[0].replace(".0", ".3") + ip_address_vm2 = random_ipv4.split('/')[0].replace(".0", ".4") + port_id = self.get_port_id(network['id'], + network_topo['subnet']['id'], + server_default, + network_name=network['name']) + # Update allowed address pair cidr attribute of port + allowed_address_pairs = [{'ip_address': ip_address_vm1}] + port_client.update_port( + port_id, allowed_address_pairs=allowed_address_pairs) + port1_id = self.get_port_id(network['id'], + network_topo['subnet']['id'], + server_default1, + network_name=network['name']) + # Update allowed address pair cidr attribute of port + allowed_address_pairs = [{'ip_address': ip_address_vm2}] + port_client.update_port( + port1_id, allowed_address_pairs=allowed_address_pairs) + ssh_source = self.get_remote_client( + ip_address_default_vm, private_key=private_key_default_vm) + ssh_source1 = self.get_remote_client( + ip_address_default1_vm, private_key=private_key_default1_vm) + # Assign Allowed pair ip to vm's + self._assign_ip_address(ssh_source, 'eth0:1', ip_address_vm1) + self._assign_ip_address(ssh_source1, 'eth0:1', ip_address_vm2) + time.sleep(constants.NSX_BACKEND_VERY_SMALL_TIME_INTERVAL) + self.assertTrue(self._check_remote_connectivity + (ssh_source1, ip_address_vm1, 'True'), + 'Destination is reachable') + self.assertTrue(self._check_remote_connectivity + (ssh_source, ip_address_vm2, 'True'), + 'Destination is reachable') + ip_address_vm1 = random_ipv4.split('/')[0].replace(".0", ".5") + self._assign_ip_address(ssh_source, 'eth0:1', ip_address_vm1) + time.sleep(constants.NSX_BACKEND_VERY_SMALL_TIME_INTERVAL) + self.assertFalse(self._check_remote_connectivity + (ssh_source1, ip_address_vm1, 'True'), + 'Destination is unreachable') + self.assertFalse(self._check_remote_connectivity + (ssh_source, ip_address_vm2, 'True'), + 'Destination is unreachable') + def _test_v4v6_allowed_address_pair_on_vms_with_multiple_ips( self, network_topo): server_name_default = data_utils.rand_name('server-default') @@ -1146,3 +1417,37 @@ class TestAllowedAddressPair(manager.NetworkScenarioTest): self.network_topo = self.create_network_topo() self._test_connectivity_between_allowed_address_pair_update_ports_cidr( self.network_topo) + + @decorators.attr(type='nsxv3') + @decorators.idempotent_id('c0f0f446-65f5-40fa-8b05-b5798e8dd676') + def test_ipv6_allowed_address_pair_on_vms_with_dual_network(self): + self.network_topo = self.create_ipv6_network_topo() + self._test_ipv6_allowed_address_pair_on_vms_with_dual_net( + self.network_topo) + + @decorators.attr(type='nsxv3') + @decorators.idempotent_id('c0f0f446-65f5-40fa-8b05-b5798e8dd676') + def test_ipv4_v6_allowed_address_pair_with_different_mac_format(self): + self.network_topo = self.create_ipv6_network_topo() + self._test_portv6_update_between_allowed_address_pair_and_mac( + self.network_topo) + + @decorators.attr(type='nsxv3') + @decorators.idempotent_id('c0f0f446-65f5-40fa-8b05-b5798e8dd675') + def test_allowed_address_pair_same_cidr_and_same_standalone_ipv4(self): + self.network_topo = self.create_network_topo() + self._test_ipv4_allowed_address_pair_with_same_cidr_and_standalone_ip( + self.network_topo) + + @decorators.attr(type='nsxv3') + @decorators.idempotent_id('c0f0f446-65f5-40fa-8b05-b5798e8dd675') + def test_allowed_address_pair_same_cidr_and_same_standalone_ipv6(self): + self.network_topo = self.create_ipv6_network_topo() + self._test_ipv6_allowed_address_pair_with_same_cidr_and_standalone_ip( + self.network_topo) + + @decorators.attr(type='nsxv3') + @decorators.idempotent_id('c0f0f446-65f5-40fa-8b05-b5798e8dd675') + def test_allowed_address_pair_change_ipv4(self): + self.network_topo = self.create_network_topo() + self._test_ipv4_allowed_address_pair_change_ip(self.network_topo) diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_router.py b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_router.py index a83c803..f75cd0a 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_router.py +++ b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_router.py @@ -929,3 +929,87 @@ class IPv6RoutersTest(feature_manager.FeatureManager): router_client=self.cmgr_adm.routers_client, router_id=router['id'], subnet_id=subnet_1['id']) self.assertEqual(subnet_1['id'], interface['subnet_id']) + + @decorators.attr(type=['nsxv3', 'negative']) + @decorators.idempotent_id('3564b971-6033-43cc-a13a-93b467bca803') + def test_dual_ipv4_ipv6_interface_with_invalid_gateway_update(self): + """ + Create ipv6 subnet under network1 & also create ipv4 subnet + & update gateway of network with invalid value, then test traffic + """ + name = data_utils.rand_name("dual-ipv6-ipv4-net1") + networks_client = self.cmgr_adm.networks_client + network = self.create_topology_network( + name, networks_client=networks_client) + sec_rule_client = self.cmgr_adm.security_group_rules_client + sec_client = self.cmgr_adm.security_groups_client + sg = self.create_topology_security_group( + tenant_id=network['tenant_id'], + security_groups_client=sec_client, + security_group_rules_client=sec_rule_client) + subnet_ipv6 = self._create_ipv6_subnet( + network, ipv6_ra_mode="dhcpv6-stateful", + ipv6_address_mode="dhcpv6-stateful", + slaac=False) + time.sleep(constants.NSX_NETWORK_REALISE_TIMEOUT) + + subnet_client = self.cmgr_adm.subnets_client + subnet_ipv4_name = network['name'] + 'dual-ipv4-sub' + subnet_ipv4 = self.create_topology_subnet( + subnet_ipv4_name, network, subnets_client=subnet_client) + rtr_name = data_utils.rand_name("dula-ipv4-ipv6-rtr") + router = self.create_topology_router( + rtr_name, routers_client=self.cmgr_adm.routers_client) + interface = self.add_router_interface( + router_client=self.cmgr_adm.routers_client, + router_id=router['id'], subnet_id=subnet_ipv6['id']) + self.assertEqual(subnet_ipv6['id'], interface['subnet_id']) + interface = self.add_router_interface( + router_client=self.cmgr_adm.routers_client, + router_id=router['id'], subnet_id=subnet_ipv4['id']) + self.assertEqual(subnet_ipv4['id'], interface['subnet_id']) + + # Update invalid gateway of ipv6 subnet within same range + self.assertRaises(exceptions.BadRequest, + self.cmgr_adm.subnets_client.update_subnet, + subnet_ipv6['id'], gateway_ip="27::0") + + # Update invalid gateway of ipv6 subnet within different range + self.assertRaises(exceptions.BadRequest, + self.cmgr_adm.subnets_client.update_subnet, + subnet_ipv6['id'], gateway_ip="27.0.0.1") + + # Update invalid gateway of ipv4 subnet within same range + self.assertRaises(exceptions.BadRequest, + self.cmgr_adm.subnets_client.update_subnet, + subnet_ipv4['id'], gateway_ip="21::0") + + # Update invalid gateway of ipv4 subnet within different range + self.assertRaises(exceptions.BadRequest, + self.cmgr_adm.subnets_client.update_subnet, + subnet_ipv4['id'], gateway_ip="27.0.0.1") + time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL) + # Boot two VMs with the same network + image_id = self.get_glance_image_id(['cirros', 'esx']) + self.create_topology_instance( + "vm_1", [network], + security_groups=[{'name': sg['name']}], + create_floating_ip=True, image_id=image_id, + clients=self.cmgr_adm) + vm1_server_floatingip = self.topology_servers["vm_1"][ + "floating_ips"][0] + self.create_topology_instance( + "vm_2", [network], + security_groups=[{'name': sg['name']}], + create_floating_ip=True, image_id=image_id, + clients=self.cmgr_adm) + vm2_server_floatingip = self.topology_servers["vm_2"][ + "floating_ips"][0] + time.sleep(constants.NSX_NETWORK_REALISE_TIMEOUT) + # Check IPv4 connectivity across the same network + vm1_server = self.topology_servers["vm_1"] + vm2_server = self.topology_servers["vm_2"] + self.check_vm_internal_connectivity( + network, vm1_server_floatingip, vm1_server) + self.check_vm_internal_connectivity( + network, vm2_server_floatingip, vm2_server) diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_octavia_loadbalancers.py b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_octavia_loadbalancers.py index 2102fba..a0fb291 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_octavia_loadbalancers.py +++ b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_octavia_loadbalancers.py @@ -1434,3 +1434,71 @@ class OctaviaRoundRobin(feature_manager.FeatureManager): self.check_project_lbaas() fw_group_id = fw_group['firewall_group']['id'] self.fwaas_v2_client.update_firewall_v2_group(fw_group_id, ports=[]) + + @decorators.attr(type='nsxv3') + @decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a44') + def test_create_verify_octavia_lb_stats_with_https_proto(self): + """ + Creates an octavia Loadbalancer with https proto, + and verifies the stats on the loadbalancer vip + """ + diction = self.deploy_octavia_topology() + self.start_web_servers(constants.HTTP_PORT) + net_id = diction['network']['id'] + port_id = self.cmgr_adm.ports_client.create_port( + network_id=net_id)['port']['id'] + self.addCleanup(test_utils.call_and_ignore_notfound_exc, + self.cmgr_adm.ports_client.delete_port, port_id) + lb_created = self.create_project_octavia( + protocol_type="HTTPS", protocol_port="80", + lb_algorithm="SOURCE_IP", vip_port_id=port_id, + hm_type='PING', timeout=self.hm_timeout, + max_retries=self.hm_max_retries, delay=self.hm_delay, + default_pool=True) + time.sleep(constants.NSX_BACKEND_SMALL_TIME_INTERVAL) + lb_id = lb_created['lb_id'] + stat = self.octavia_admin_client.\ + show_octavia_load_balancer_stats(lb_id) + assert (stat['stats']['bytes_in'] == 0 and + stat['stats']['bytes_out'] == 0) + self.check_project_lbaas(source_ip=True) + time.sleep(constants.NSX_BACKEND_SMALL_TIME_INTERVAL) + stat = self.octavia_admin_client.\ + show_octavia_load_balancer_stats(lb_id) + assert (stat['stats']['bytes_in'] >= 0 and + stat['stats']['bytes_out'] >= 0) + + @decorators.attr(type='nsxv3') + @decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a44') + def test_create_verify_octavia_lb_stats_with_https_terminated(self): + """ + Creates an octavia Loadbalancer with https_terminated, + and verifies the stats on the loadbalancer vip + """ + diction = self.deploy_octavia_topology() + if not CONF.nsxv3.ens: + self.start_web_servers(constants.HTTP_PORT) + subnet_id = diction['subnet']['subnet']['id'] + barbican_secrets = self.create_barbican_secret_conatainer( + constants.CERT_FILE, constants.KEY_FILE) + barbican_container = barbican_secrets['secret_container'] + lb_created = self.create_project_octavia( + protocol_type="TERMINATED_HTTPS", protocol_port="443", + lb_algorithm="ROUND_ROBIN", vip_subnet_id=subnet_id, + hm_type='HTTP', member_count=2, weight=5, + pool_protocol='HTTP', pool_port='80', + barbican_container=barbican_container, count=0, + barbican=True, delay=self.hm_delay, + max_retries=self.hm_max_retries, timeout=self.hm_timeout) + time.sleep(constants.NSX_BACKEND_SMALL_TIME_INTERVAL) + lb_id = lb_created['lb_id'] + stat = self.octavia_admin_client.\ + show_octavia_load_balancer_stats(lb_id) + assert (stat['stats']['bytes_in'] == 0 and + stat['stats']['bytes_out'] == 0) + self.check_lbaas_project_weight_values(HTTPS=True) + time.sleep(constants.NSX_BACKEND_SMALL_TIME_INTERVAL) + stat = self.octavia_admin_client.\ + show_octavia_load_balancer_stats(lb_id) + assert (stat['stats']['bytes_in'] >= 0 and + stat['stats']['bytes_out'] >= 0)