fw_v2 cases for nsxv & vrf realted cases for nsxt

Change-Id: Ifd1e363cf8c1f396ef971e846349126f449c5f3e
This commit is contained in:
dkumbhar 2020-04-23 10:32:57 +00:00
parent 30d21c198b
commit 7b0a2a30c4
5 changed files with 1539 additions and 30 deletions

View File

@ -160,14 +160,12 @@ class L2GatewayTest(base.BaseAdminNetworkTest):
self.do_csuld_single_device_interface_vlan(_name, _devices) self.do_csuld_single_device_interface_vlan(_name, _devices)
@decorators.idempotent_id('cb59145e-3d2b-46b7-8f7b-f30f794a4d51') @decorators.idempotent_id('cb59145e-3d2b-46b7-8f7b-f30f794a4d51')
@decorators.skip_because(bug="1559913")
def test_csuld_single_device_interface_mvlan(self): def test_csuld_single_device_interface_mvlan(self):
dev_profile = self.getattr_or_skip_test("device_multiple_vlans") dev_profile = self.getattr_or_skip_test("device_multiple_vlans")
_name = data_utils.rand_name('l2gw-2v1') _name = data_utils.rand_name('l2gw-2v1')
_devices = base_l2gw.get_l2gw_body(dev_profile) _devices = base_l2gw.get_l2gw_body(dev_profile)
self.do_csuld_single_device_interface_vlan(_name, _devices) self.do_csuld_single_device_interface_vlan(_name, _devices)
@decorators.skip_because(bug="1559913")
@decorators.idempotent_id('5522bdfe-ebe8-4eea-81b4-f4075bb608cf') @decorators.idempotent_id('5522bdfe-ebe8-4eea-81b4-f4075bb608cf')
def test_csuld_single_device_minterface_mvlan_type1(self): def test_csuld_single_device_minterface_mvlan_type1(self):
# NSX-v does not support multiple interfaces # NSX-v does not support multiple interfaces
@ -177,7 +175,6 @@ class L2GatewayTest(base.BaseAdminNetworkTest):
_devices = base_l2gw.get_l2gw_body(dev_profile) _devices = base_l2gw.get_l2gw_body(dev_profile)
self.do_csuld_single_device_interface_vlan(_name, _devices) self.do_csuld_single_device_interface_vlan(_name, _devices)
@decorators.skip_because(bug="1559913")
@decorators.idempotent_id('5bec26e0-855f-4537-b31b-31663a820ddb') @decorators.idempotent_id('5bec26e0-855f-4537-b31b-31663a820ddb')
def test_csuld_single_device_minterface_mvlan_type2(self): def test_csuld_single_device_minterface_mvlan_type2(self):
# NSX-v does not support multiple interfaces # NSX-v does not support multiple interfaces

View File

@ -231,7 +231,6 @@ class L2GatewayConnectionTest(base.BaseAdminNetworkTest):
self.do_suld_l2gw_connection(_res_new) self.do_suld_l2gw_connection(_res_new)
self.addCleanup(self.l2gw_cleanup) self.addCleanup(self.l2gw_cleanup)
@decorators.skip_because(bug="1559913")
@decorators.idempotent_id('1875eca7-fde9-49ba-be21-47a8cc41f2e5') @decorators.idempotent_id('1875eca7-fde9-49ba-be21-47a8cc41f2e5')
def test_csuld_single_device_interface_mvlan_type2(self): def test_csuld_single_device_interface_mvlan_type2(self):
dev_profile = self.getattr_or_skip_test("device_multiple_vlans") dev_profile = self.getattr_or_skip_test("device_multiple_vlans")
@ -246,7 +245,6 @@ class L2GatewayConnectionTest(base.BaseAdminNetworkTest):
self.do_suld_l2gw_connection(_res_new) self.do_suld_l2gw_connection(_res_new)
self.addCleanup(self.l2gw_cleanup) self.addCleanup(self.l2gw_cleanup)
@decorators.skip_because(bug="1559913")
@decorators.idempotent_id('53755cb0-fdca-4ee7-8e43-a9b8a9d6d90a') @decorators.idempotent_id('53755cb0-fdca-4ee7-8e43-a9b8a9d6d90a')
def test_csuld_single_device_minterface_mvlan_type1(self): def test_csuld_single_device_minterface_mvlan_type1(self):
# NSX-v does not support multiple interfaces # NSX-v does not support multiple interfaces
@ -259,7 +257,6 @@ class L2GatewayConnectionTest(base.BaseAdminNetworkTest):
self.do_suld_l2gw_connection(_res_new) self.do_suld_l2gw_connection(_res_new)
self.addCleanup(self.l2gw_cleanup) self.addCleanup(self.l2gw_cleanup)
@decorators.skip_because(bug="1559913")
@decorators.idempotent_id('723b0b78-35d7-4774-89c1-ec73797a1fe3') @decorators.idempotent_id('723b0b78-35d7-4774-89c1-ec73797a1fe3')
def test_csuld_single_device_minterface_mvlan_type2(self): def test_csuld_single_device_minterface_mvlan_type2(self):
dev_profile = self.getattr_or_skip_test( dev_profile = self.getattr_or_skip_test(

View File

@ -171,7 +171,6 @@ class TestZonesScenario(TestZonesV2Ops):
Boot a VM Boot a VM
Verify recordset only has SOA and NS record types Verify recordset only has SOA and NS record types
""" """
image_id = self.get_glance_image_id(['cirros', 'esx'])
zone = self.create_zone() zone = self.create_zone()
network_designate = self.create_zone_topology(zone['name']) network_designate = self.create_zone_topology(zone['name'])
self.assertEqual(network_designate['dns_domain'], zone['name']) self.assertEqual(network_designate['dns_domain'], zone['name'])
@ -182,7 +181,7 @@ class TestZonesScenario(TestZonesV2Ops):
"dns_vm", [network_designate], "dns_vm", [network_designate],
security_groups=[{'name': self.designate_sg['name']}], security_groups=[{'name': self.designate_sg['name']}],
clients=self.os_adm, clients=self.os_adm,
create_floating_ip=False, image_id=image_id) create_floating_ip=False)
LOG.info('Show recordset of the zone') LOG.info('Show recordset of the zone')
recordset = self.list_record_set_zone(zone['id']) recordset = self.list_record_set_zone(zone['id'])
self.verify_recordset(recordset, 2) self.verify_recordset(recordset, 2)
@ -196,7 +195,6 @@ class TestZonesScenario(TestZonesV2Ops):
Boot a VM Boot a VM
Verify recordset only has SOA and NS record types Verify recordset only has SOA and NS record types
""" """
image_id = self.get_glance_image_id(['cirros', 'esx'])
zone = self.create_zone() zone = self.create_zone()
network_designate = self.create_zone_provider_vlan_vxlan_topology( network_designate = self.create_zone_provider_vlan_vxlan_topology(
'vxlan', zone['name']) 'vxlan', zone['name'])
@ -208,7 +206,7 @@ class TestZonesScenario(TestZonesV2Ops):
"dns_vm", [network_designate], "dns_vm", [network_designate],
security_groups=[{'name': self.designate_sg['name']}], security_groups=[{'name': self.designate_sg['name']}],
clients=self.os_adm, clients=self.os_adm,
create_floating_ip=False, image_id=image_id) create_floating_ip=False)
LOG.info('Show recordset of the zone') LOG.info('Show recordset of the zone')
recordset = self.list_record_set_zone(zone['id']) recordset = self.list_record_set_zone(zone['id'])
self.verify_recordset(recordset, 3) self.verify_recordset(recordset, 3)
@ -222,7 +220,6 @@ class TestZonesScenario(TestZonesV2Ops):
Boot a VM Boot a VM
Verify recordset only has SOA and NS record types Verify recordset only has SOA and NS record types
""" """
image_id = self.get_glance_image_id(['cirros', 'esx'])
zone = self.create_zone() zone = self.create_zone()
network_designate = self.create_zone_provider_vlan_vxlan_topology( network_designate = self.create_zone_provider_vlan_vxlan_topology(
'vxlan', zone['name']) 'vxlan', zone['name'])
@ -234,7 +231,7 @@ class TestZonesScenario(TestZonesV2Ops):
"dns_vm", [network_designate], "dns_vm", [network_designate],
security_groups=[{'name': self.designate_sg['name']}], security_groups=[{'name': self.designate_sg['name']}],
clients=self.os_adm, clients=self.os_adm,
create_floating_ip=False, image_id=image_id) create_floating_ip=False, )
LOG.info('Show recordset of the zone') LOG.info('Show recordset of the zone')
recordset = self.list_record_set_zone(zone['id']) recordset = self.list_record_set_zone(zone['id'])
self.verify_recordset(recordset, 3) self.verify_recordset(recordset, 3)
@ -248,7 +245,6 @@ class TestZonesScenario(TestZonesV2Ops):
Boot a VM and associate fip Boot a VM and associate fip
Verify recordset contains entry for fip Verify recordset contains entry for fip
""" """
image_id = self.get_glance_image_id(['cirros', 'esx'])
zone = self.create_zone() zone = self.create_zone()
network_designate = self.create_zone_topology(zone['name']) network_designate = self.create_zone_topology(zone['name'])
self.assertEqual(network_designate['dns_domain'], zone['name']) self.assertEqual(network_designate['dns_domain'], zone['name'])
@ -259,7 +255,7 @@ class TestZonesScenario(TestZonesV2Ops):
"dns_vm", [network_designate], "dns_vm", [network_designate],
security_groups=[{'name': self.designate_sg['name']}], security_groups=[{'name': self.designate_sg['name']}],
clients=self.os_adm, clients=self.os_adm,
create_floating_ip=True, image_id=image_id) create_floating_ip=True)
fip = dns_vm['floating_ips'][0]['floating_ip_address'] fip = dns_vm['floating_ips'][0]['floating_ip_address']
LOG.info('Show recordset of the zone') LOG.info('Show recordset of the zone')
recordset = self.list_record_set_zone(zone['id']) recordset = self.list_record_set_zone(zone['id'])
@ -279,7 +275,6 @@ class TestZonesScenario(TestZonesV2Ops):
Delete VM Delete VM
Verify recordset does not have entry for fip Verify recordset does not have entry for fip
""" """
image_id = self.get_glance_image_id(['cirros', 'esx'])
zone = self.create_zone() zone = self.create_zone()
network_designate = self.create_zone_topology(zone['name']) network_designate = self.create_zone_topology(zone['name'])
self.assertEqual(network_designate['dns_domain'], zone['name']) self.assertEqual(network_designate['dns_domain'], zone['name'])
@ -290,7 +285,7 @@ class TestZonesScenario(TestZonesV2Ops):
"dns_vm", [network_designate], "dns_vm", [network_designate],
security_groups=[{'name': self.designate_sg['name']}], security_groups=[{'name': self.designate_sg['name']}],
clients=self.os_adm, clients=self.os_adm,
create_floating_ip=True, image_id=image_id) create_floating_ip=True)
LOG.info('Show recordset of the zone') LOG.info('Show recordset of the zone')
recordset = self.list_record_set_zone(zone['id']) recordset = self.list_record_set_zone(zone['id'])
fip = dns_vm['floating_ips'][0]['floating_ip_address'] fip = dns_vm['floating_ips'][0]['floating_ip_address']
@ -362,7 +357,6 @@ class TestZonesScenario(TestZonesV2Ops):
Boot an instance and associate fip Boot an instance and associate fip
Perform nslookup for the dns name from ext vm Perform nslookup for the dns name from ext vm
""" """
image_id = self.get_glance_image_id(['cirros', 'esx'])
zone = self.create_zone() zone = self.create_zone()
network_designate = self.create_zone_topology(zone['name']) network_designate = self.create_zone_topology(zone['name'])
self.assertEqual(network_designate['dns_domain'], zone['name']) self.assertEqual(network_designate['dns_domain'], zone['name'])
@ -370,7 +364,7 @@ class TestZonesScenario(TestZonesV2Ops):
"dns_vm", [network_designate], "dns_vm", [network_designate],
security_groups=[{'name': self.designate_sg['name']}], security_groups=[{'name': self.designate_sg['name']}],
clients=self.os_adm, clients=self.os_adm,
create_floating_ip=True, image_id=image_id) create_floating_ip=True)
fip = dns_vm['floating_ips'][0]['floating_ip_address'] fip = dns_vm['floating_ips'][0]['floating_ip_address']
LOG.info('Show recordset of the zone') LOG.info('Show recordset of the zone')
recordset = self.list_record_set_zone(zone['id']) recordset = self.list_record_set_zone(zone['id'])
@ -438,10 +432,6 @@ class TestZonesScenario(TestZonesV2Ops):
Boot an instance and associate fip Boot an instance and associate fip
Delete zone successfully Delete zone successfully
""" """
try:
image_id = self.get_glance_image_id(['cirros', 'esx'])
except Exception:
LOG.error('cirros image is absent for esx HV')
zone = self.create_zone() zone = self.create_zone()
network_designate = self.create_zone_topology(zone['name']) network_designate = self.create_zone_topology(zone['name'])
self.assertEqual(network_designate['dns_domain'], zone['name']) self.assertEqual(network_designate['dns_domain'], zone['name'])
@ -449,7 +439,7 @@ class TestZonesScenario(TestZonesV2Ops):
"dns_vm", [network_designate], "dns_vm", [network_designate],
security_groups=[{'name': self.designate_sg['name']}], security_groups=[{'name': self.designate_sg['name']}],
clients=self.os_adm, clients=self.os_adm,
create_floating_ip=True, image_id=image_id) create_floating_ip=True)
fip = dns_vm['floating_ips'][0]['floating_ip_address'] fip = dns_vm['floating_ips'][0]['floating_ip_address']
LOG.info('Show recordset of the zone') LOG.info('Show recordset of the zone')
recordset = self.list_record_set_zone(zone['id']) recordset = self.list_record_set_zone(zone['id'])
@ -476,7 +466,6 @@ class TestZonesScenario(TestZonesV2Ops):
Verify the recordset of the guestVM does not contain Verify the recordset of the guestVM does not contain
'A' record type 'A' record type
""" """
image_id = self.get_glance_image_id(['cirros', 'esx'])
zone = self.create_zone() zone = self.create_zone()
network_designate = self.create_zone_topology( network_designate = self.create_zone_topology(
const.ZONE_NAME) const.ZONE_NAME)
@ -485,7 +474,7 @@ class TestZonesScenario(TestZonesV2Ops):
"dns_vm", [network_designate], "dns_vm", [network_designate],
security_groups=[{'name': self.designate_sg['name']}], security_groups=[{'name': self.designate_sg['name']}],
clients=self.os_adm, clients=self.os_adm,
create_floating_ip=True, image_id=image_id) create_floating_ip=True)
LOG.info('Show recordset of the zone') LOG.info('Show recordset of the zone')
recordset = self.list_record_set_zone(zone['id']) recordset = self.list_record_set_zone(zone['id'])
self.verify_recordset(recordset, 2) self.verify_recordset(recordset, 2)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,159 @@
# Copyright 2018 VMware Inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import subprocess
from oslo_log import log as logging
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 vmware_nsx_tempest_plugin.lib import feature_manager
from vmware_nsx_tempest_plugin.services import nsxp_client
from vmware_nsx_tempest_plugin.services import nsxv3_client
CONF = config.CONF
CONF.validation.auth_method = 'None'
LOG = logging.getLogger(__name__)
class TestVRFBasic(feature_manager.FeatureManager):
@classmethod
def setup_clients(cls):
super(TestVRFBasic, cls).setup_clients()
cls.cmgr_adm = cls.get_client_manager('admin')
cls.rtr_client = cls.cmgr_adm.routers_client
cls.nw_client = cls.cmgr_adm.networks_client
cls.subnets_client = cls.cmgr_adm.subnets_client
cls.ports_client = cls.cmgr_adm.ports_client
cls.sec_rule_client = cls.cmgr_adm.security_group_rules_client
cls.sec_client = cls.cmgr_adm.security_groups_client
def setUp(self):
super(TestVRFBasic, self).setUp()
self.nsx = nsxv3_client.NSXV3Client(CONF.nsxv3.nsx_manager,
CONF.nsxv3.nsx_user,
CONF.nsxv3.nsx_password)
self.nsxp = nsxp_client.NSXPClient(CONF.nsxv3.nsx_manager,
CONF.nsxv3.nsx_user,
CONF.nsxv3.nsx_password)
def _create_router(self, router_name=None, admin_state_up=True,
external_network_id=None, enable_snat=None,
set_gateway=True, **kwargs):
ext_gw_info = {}
if external_network_id:
ext_gw_info['network_id'] = external_network_id
if enable_snat is not None:
ext_gw_info['enable_snat'] = enable_snat
if set_gateway:
body = self.routers_client.create_router(
name=router_name, external_gateway_info=ext_gw_info,
admin_state_up=admin_state_up, **kwargs)
else:
body = self.routers_client.create_router(
name=router_name,
admin_state_up=admin_state_up,
**kwargs)
router = body.get('router', body)
self.addCleanup(self._delete_router, router)
return router
def _delete_router(self, router):
body = self.ports_client.list_ports(device_id=router['id'])
interfaces = body['ports']
for i in interfaces:
test_utils.call_and_ignore_notfound_exc(
self.routers_client.remove_router_interface, router['id'],
subnet_id=i['fixed_ips'][0]['subnet_id'])
self.routers_client.delete_router(router['id'])
def _test_ping_from_external_network(self, fip_ip):
out = os.popen('ping -c 2 %s' % fip_ip).read().strip()
return out
def _add_static_route(self, vm1_real_ip, router):
r_ips = router['external_gateway_info']['external_fixed_ips']
r_ip = r_ips[0]['ip_address']
os.popen('route add -host %s gw %s' % (vm1_real_ip, r_ip))
def _test_tcp_port_from_external_network(self, fip_ip):
nc_cmd = subprocess.Popen(['nc -zvw01 192.166.1.2 22'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
output1, output2 = nc_cmd.communicate()
return output2
def create_network_topo(self, create_instance=False, enable_snat=True,
set_gateway=True):
network = \
self.create_topology_network(network_name="fw-network",
networks_client=self.networks_client)
# Create router topo
kwargs = {"router:external": "True"}
ext_nw = \
self.create_topology_network(network_name="ext_new",
networks_client=self.nw_client,
**kwargs)
subnet_name = 'ext_subnet'
subnet_args = {'enable_dhcp': False}
self.create_topology_subnet(subnet_name, ext_nw,
cidr='172.24.5.0/24',
**subnet_args)
router = self._create_router(
router_name=data_utils.rand_name('router-default1'),
external_network_id=ext_nw['id'],
enable_snat=enable_snat, set_gateway=set_gateway)
subnet_name = 'fw-subnet'
self.create_topology_subnet(subnet_name, network,
router_id=router['id'])
if create_instance:
if set_gateway and enable_snat:
floating_ip = True
else:
floating_ip = False
vm1 = self.create_topology_instance(
"state_vm_1", [network],
create_floating_ip=floating_ip)
if set_gateway and enable_snat:
ips = self.topology_servers['state_vm_1']['floating_ips']
real_ip = ips[0]['fixed_ip_address']
float_ip = ips[0]['floating_ip_address']
else:
ips = self.topology_servers['state_vm_1']['addresses']
real_ip = ips[network['name']][0]['addr']
float_ip = None
else:
real_ip = None
float_ip = None
vm1 = None
net_topo = dict(project=network['project_id'], router=router,
vm1_real_ip=real_ip,
vm1_float_ip=float_ip, server=vm1)
return net_topo
@decorators.attr(type='nsxp')
@decorators.idempotent_id('131288d7-9513-4b1e-a11d-15840c8e3f13')
def test_vrf_basic_traffic_test_and_backend_verification(self):
"""
"""
net_topo = self.create_network_topo(create_instance=True)
# verify ext-VM to intVM floating IP ping
out = self._test_ping_from_external_network(net_topo['vm1_float_ip'])
self.assertIn("2 received", str(out))