Tempest nsxv cases fix
Change-Id: Ic5874a846ea0d549dda0642cab6586844ed227bb
This commit is contained in:
parent
7c2684ef03
commit
24f6fb2566
@ -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,12 +653,22 @@ class NSXV3Client(object):
|
||||
except Exception:
|
||||
LOG.exception(k_err)
|
||||
raise
|
||||
if (cert['used_by'][0]['service_types'][0] ==
|
||||
'Client Authentication' and cert["_create_user"] ==
|
||||
"admin" and "'com.vmware.nsx.openstack'" in cert['used_by'][
|
||||
0]['node_id']):
|
||||
LOG.info('Client certificate created')
|
||||
return cert
|
||||
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'][
|
||||
0]['node_id']):
|
||||
LOG.info('Client certificate created')
|
||||
return cert
|
||||
LOG.error("Client Certificate not created")
|
||||
return None
|
||||
|
||||
|
@ -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()
|
||||
|
@ -576,15 +576,14 @@ class ProviderSecurityGroupTest(base.BaseAdminNetworkTest):
|
||||
if CONF.network.backend != 'nsxp':
|
||||
if section['applied_tos'][0]['target_type'] == "LogicalRouter":
|
||||
continue
|
||||
if PROVIDER_SECURITY_GRP in section['display_name'] and \
|
||||
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"
|
||||
self.assertIn(provider_sg_name, section['display_name'], msg)
|
||||
if PROVIDER_SECURITY_GRP in section['display_name'] and \
|
||||
provider_sg_name not in section['display_name']:
|
||||
pass
|
||||
else:
|
||||
break
|
||||
msg = "Provider group does not have highest priority " \
|
||||
"over default security group"
|
||||
self.assertIn(provider_sg_name, section['display_name'], msg)
|
||||
|
||||
@decorators.attr(type='nsxv3')
|
||||
@decorators.idempotent_id('37d8fbfc-eb3f-40c8-a146-70f5df937a2e')
|
||||
|
@ -62,12 +62,7 @@ class MultipleAllowAddress(feature_manager.FeatureManager):
|
||||
manager_ip, CONF.nsxv.user, CONF.nsxv.password)
|
||||
|
||||
def _assign_ip_address(self, ssh_source, interface_name, ip_address):
|
||||
int_face = interface_name.split('.')[0]
|
||||
vlan_id = interface_name.split('.')[1]
|
||||
ssh_source.exec_command("sudo ip link add link %s name %s type vlan\
|
||||
id %s" % (int_face, interface_name, vlan_id))
|
||||
|
||||
ssh_source.exec_command("sudo ifconfig %s %s/24 \
|
||||
ssh_source.exec_command("sudo /sbin/ifconfig %s %s netmask 255.255.255.0 \
|
||||
up" % (interface_name, ip_address))
|
||||
|
||||
def verify_ping_to_fip_from_ext_vm(self, server_details):
|
||||
@ -657,8 +652,8 @@ class MultipleAllowAddress(feature_manager.FeatureManager):
|
||||
vm2_ip_address = vm2['floating_ips'][0]['floating_ip_address']
|
||||
ssh_source2 = self._get_remote_client(vm2_ip_address,
|
||||
use_password=True)
|
||||
self._assign_ip_address(ssh_source1, 'eth0.1', vm1_ip)
|
||||
self._assign_ip_address(ssh_source2, 'eth0.1', vm2_ip)
|
||||
self._assign_ip_address(ssh_source1, 'eth0:1', vm1_ip)
|
||||
self._assign_ip_address(ssh_source2, 'eth0:1', vm2_ip)
|
||||
# Verify Connectivity between vms
|
||||
self.check_remote_connectivity(ssh_source1, vm2_ip,
|
||||
should_succeed=True)
|
||||
|
@ -139,11 +139,10 @@ class TestNewCase(feature_manager.FeatureManager):
|
||||
network_state2 = self.create_topology_network(network_name2)
|
||||
subnet_state1 = self.create_topology_subnet(
|
||||
subnet_name1, network_state1, router_id=router_state["id"])
|
||||
subnet_state2 = self.create_topology_subnet(subnet_name2,
|
||||
network_state2,
|
||||
router_id=router_state2["\
|
||||
id"],
|
||||
cidr=constants.CIDR)
|
||||
subnet_st2 = self.create_topology_subnet(subnet_name2,
|
||||
network_state2,
|
||||
router_id=router_state2["id"],
|
||||
cidr=constants.CIDR)
|
||||
if create_instance:
|
||||
self.create_topology_instance("server1",
|
||||
[network_state1])
|
||||
@ -154,7 +153,7 @@ class TestNewCase(feature_manager.FeatureManager):
|
||||
network_state1=network_state1,
|
||||
network_state2=network_state2,
|
||||
subnet_state1=subnet_state1,
|
||||
subnet_state2=subnet_state2)
|
||||
subnet_state2=subnet_st2)
|
||||
return topology_dict
|
||||
|
||||
def create_topo_across_networks(self, namestart, create_instance=True):
|
||||
@ -376,9 +375,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 +421,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 +539,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 +584,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')
|
||||
@ -876,7 +898,7 @@ class TestNewCase(feature_manager.FeatureManager):
|
||||
clients=self.cmgr_adm)
|
||||
ip_address = vm1['floating_ips'][0]['floating_ip_address']
|
||||
ssh_source = self._get_remote_client(ip_address, use_password=True)
|
||||
remote_ip = vm2.values()[1].values()[0][0]['addr']
|
||||
remote_ip = sorted(vm2['addresses'].values())[0][0]['addr']
|
||||
# Verify connectivity between vms
|
||||
self.check_remote_connectivity(ssh_source, remote_ip,
|
||||
should_succeed=True)
|
||||
@ -923,7 +945,7 @@ class TestNewCase(feature_manager.FeatureManager):
|
||||
clients=self.cmgr_adm)
|
||||
ip_address = vm1['floating_ips'][0]['floating_ip_address']
|
||||
ssh_source = self._get_remote_client(ip_address, use_password=True)
|
||||
remote_ip = vm2.values()[1].values()[0][0]['addr']
|
||||
remote_ip = sorted(vm2['addresses'].values())[0][0]['addr']
|
||||
# Verify Connectivity between vms
|
||||
self.check_remote_connectivity(ssh_source, remote_ip,
|
||||
should_succeed=True)
|
||||
|
Loading…
Reference in New Issue
Block a user