Tempest fix below cases

- test_create_vpnservice_with_router_enable_snat
- test_check_security_group_precedence_at_beckend
- test_certificate_backend
- test_mac_learning_with_provider_sec_group_enabled_on_port
- test_port_security_disabled_port_in_exclude_list
- test_router_admin_state_when_vms_hosted

Change-Id: Iacfc30dbc3d398361d047f588c131ea20afa5bc3
This commit is contained in:
shubhamk 2020-04-02 13:15:12 +00:00
parent 7c2684ef03
commit f095452c0c
4 changed files with 64 additions and 29 deletions

View File

@ -22,6 +22,7 @@ import six.moves.urllib.parse as urlparse
from oslo_log import log as logging
from oslo_serialization import jsonutils
from tempest import config
from vmware_nsx_tempest_plugin.common import constants
@ -29,6 +30,8 @@ requests.packages.urllib3.disable_warnings()
LOG = logging.getLogger(__name__)
CONF = config.CONF
class NSXV3Client(object):
"""Base NSXv3 REST client"""
@ -650,9 +653,19 @@ class NSXV3Client(object):
except Exception:
LOG.exception(k_err)
raise
if CONF.network.backend == 'nsxp':
if (cert['used_by'][0]['service_types'][0] ==
'CLIENT_AUTH' and cert["_create_user"] ==
"admin" and "'com.vmware.nsx.openstack'"
in cert['used_by'][
0]['node_id']):
LOG.info('Client certificate created')
return cert
else:
if (cert['used_by'][0]['service_types'][0] ==
'Client Authentication' and cert["_create_user"] ==
"admin" and "'com.vmware.nsx.openstack'" in cert['used_by'][
"admin" and "'com.vmware.nsx.openstack'"
in cert['used_by'][
0]['node_id']):
LOG.info('Client certificate created')
return cert

View File

@ -198,9 +198,9 @@ class TestVpnOps(feature_manager.FeatureManager):
router["id"])
vpn_service = self.nsxp_client.get_vpn_service(router["name"],
router["id"])
self.assertEqual(vpn_service[0].get('tags')[0].get("tag").encode(),
self.assertEqual(vpn_service[0].get('tags')[0].get("tag"),
nsx_router["id"])
self.assertEqual(vpn_service[0].get('resource_type').encode(),
self.assertEqual(vpn_service[0].get('resource_type'),
'IPSecVpnService')
else:
routers = self.nsx_client.get_logical_routers()

View File

@ -580,7 +580,6 @@ class ProviderSecurityGroupTest(base.BaseAdminNetworkTest):
provider_sg_name not in section['display_name']:
pass
else:
# check the sec name
break
msg = "Provider group does not have highest priority " \
"over default security group"

View File

@ -376,9 +376,37 @@ class TestNewCase(feature_manager.FeatureManager):
which is attached to router
"""
# Create single network attached to router topo
topology_dict = self.create_topo_single_network("admin_state")
router_state = topology_dict['router_state']
network_state = topology_dict['network_state']
rtr_name = data_utils.rand_name(name='tempest-router')
network_name = data_utils.rand_name(name='tempest-net')
subnet_name = data_utils.rand_name(name='tempest-subnet')
kwargs = {}
router_state = self.create_topology_router(rtr_name,
set_gateway=True,
routers_client=self.
cmgr_adm.routers_client,
**kwargs)
network_state = self.create_topology_network(
network_name, networks_client=self.cmgr_adm.networks_client)
self.create_topology_subnet(
subnet_name, network_state, router_id=router_state["id"],
routers_client=self.cmgr_adm.routers_client,
subnets_client=self.cmgr_adm.subnets_client)
sec_rule_client = self.sec_rule_client
sec_client = self.sec_client
kwargs = dict(tenant_id=network_state['tenant_id'],
security_group_rules_client=sec_rule_client,
security_groups_client=sec_client)
self.sg = self.create_topology_security_group(**kwargs)
image_id = self.get_glance_image_id(['cirros', "esx"])
security_groups = [{'name': self.sg['name']}]
self.create_topology_instance(
"state_vm_1", [network_state],
create_floating_ip=True, image_id=image_id,
security_groups=security_groups, clients=self.cmgr_adm)
self.create_topology_instance(
"state_vm_2", [network_state],
create_floating_ip=True, image_id=image_id,
security_groups=security_groups, clients=self.cmgr_adm)
# Update router admin state to False
kwargs = {"admin_state_up": "False"}
self.assertRaises(exceptions.BadRequest,
@ -394,14 +422,8 @@ class TestNewCase(feature_manager.FeatureManager):
self.servers_details.get("state_vm_2").floating_ips[0],
self.servers_details.get("state_vm_2").server, should_connect=True)
# Verify fip ping N-S traffic
for server, details in self.servers_details.items():
self.verify_ping_to_fip_from_ext_vm(details)
self.verify_ping_own_fip(self.topology_servers["state_vm_1"])
self.verify_ping_own_fip(self.topology_servers["state_vm_2"])
# Update router admin state to False
self.assertRaises(exceptions.BadRequest,
self.routers_client.update_router,
router_state['id'], **kwargs)
@decorators.idempotent_id('9006016a-91cc-8905-b217-98844caa2212')
def test_dhcp_port_update_with_device_owner_field(self):
@ -518,8 +540,9 @@ class TestNewCase(feature_manager.FeatureManager):
for tag in port['tags']:
if tag['tag'] == port_id:
port_tags = {'tags': port['tags']}
result = (item for item in port_tags['tags'] if
item["tag"] == "Exclude-Port").next()
for item in port_tags['tags']:
if item["tag"] == "Exclude-Port":
result = item["tag"]
if result is None:
raise Exception("Port is not in exclude list")
@ -562,7 +585,7 @@ class TestNewCase(feature_manager.FeatureManager):
vm_state = self.create_topology_instance(
"state_vm_1", create_floating_ip=False,
image_id=image_id, port=port['port'],
clients=self.cmgr_adm)
clients=self.cmgr_adm, security_groups="undef")
self.assertEqual("ACTIVE", vm_state['status'])
@decorators.idempotent_id('1207561e-91cc-8905-b217-98844caa79f6')