Added fix

- to fetch ports and add
- delay in update_port

Change-Id: I5015a809c33eb42e47fc3563b9338a1badd4aea1
This commit is contained in:
Puneet Arora 2020-10-14 11:52:38 +00:00
parent 4422ae2bda
commit 1435005d56
4 changed files with 14 additions and 10 deletions

View File

@ -41,10 +41,10 @@ MAX_NO_OF_TIMES_EXECUTION_OVER_SSH = 30
MD_BASE_URL = "http://169.254.169.254/" MD_BASE_URL = "http://169.254.169.254/"
# NSXV3 Port Security constants. # NSXV3 Port Security constants.
NSX_BACKEND_TIME_INTERVAL = 30 NSX_BACKEND_TIME_INTERVAL = 40
NSX_BACKEND_SMALL_TIME_INTERVAL = 10 NSX_BACKEND_SMALL_TIME_INTERVAL = 15
NSX_BACKEND_VERY_SMALL_TIME_INTERVAL = 5 NSX_BACKEND_VERY_SMALL_TIME_INTERVAL = 10
NSXP_BACKEND_SMALL_TIME_INTERVAL = 20 NSXP_BACKEND_SMALL_TIME_INTERVAL = 25
# DFW # DFW
NSX_FIREWALL_REALIZED_TIMEOUT = 120 NSX_FIREWALL_REALIZED_TIMEOUT = 120

View File

@ -456,6 +456,7 @@ class TestNSXv3PortSecurityScenario(manager.NetworkScenarioTest):
server_default_2 = self._create_server(server_name_1, server_default_2 = self._create_server(server_name_1,
network, network,
port_id['port']['id']) port_id['port']['id'])
time.sleep(constants.NSX_BACKEND_TIME_INTERVAL)
floating_ip_server_1 = self.create_floating_ip(server_default_1) floating_ip_server_1 = self.create_floating_ip(server_default_1)
floating_ip_server_2 = self.create_floating_ip(server_default_2) floating_ip_server_2 = self.create_floating_ip(server_default_2)
private_ip_address_server_2 = floating_ip_server_2['fixed_ip_address'] private_ip_address_server_2 = floating_ip_server_2['fixed_ip_address']

View File

@ -416,6 +416,7 @@ class TestProviderSecurityGroup(manager.NetworkScenarioTest):
should_connect=False) should_connect=False)
kwargs = {"provider_security_groups": []} kwargs = {"provider_security_groups": []}
p_client.update_port(port_id_psg, **kwargs) p_client.update_port(port_id_psg, **kwargs)
time.sleep(constants.NSX_BACKEND_TIME_INTERVAL)
p_client.update_port(port_id_default, **kwargs) p_client.update_port(port_id_default, **kwargs)
def _test_connectivity_between_default_psg_server(self, network_topo): def _test_connectivity_between_default_psg_server(self, network_topo):
@ -542,6 +543,7 @@ class TestProviderSecurityGroup(manager.NetworkScenarioTest):
floating_ip_psg_2['fixed_ip_address'] floating_ip_psg_2['fixed_ip_address']
private_ip_address_default_vm_2 =\ private_ip_address_default_vm_2 =\
floating_ip_default_2['fixed_ip_address'] floating_ip_default_2['fixed_ip_address']
time.sleep(constants.NSX_BACKEND_TIME_INTERVAL)
self._check_server_connectivity(ip_address_default_vm_1, self._check_server_connectivity(ip_address_default_vm_1,
private_ip_address_psg_vm_1, private_ip_address_psg_vm_1,
private_key_default_vm_1) private_key_default_vm_1)
@ -605,6 +607,7 @@ class TestProviderSecurityGroup(manager.NetworkScenarioTest):
for ip in server_default_2['addresses'][addr]: for ip in server_default_2['addresses'][addr]:
if ip['version'] == 6: if ip['version'] == 6:
private_ip_address_default_vm_2 = ip['addr'] private_ip_address_default_vm_2 = ip['addr']
time.sleep(constants.NSX_BACKEND_TIME_INTERVAL)
self._check_server_connectivity(ip_address_default_vm_1, self._check_server_connectivity(ip_address_default_vm_1,
private_ip_address_psg_vm_1, private_ip_address_psg_vm_1,
private_key_default_vm_1) private_key_default_vm_1)

View File

@ -45,7 +45,6 @@ class TestNewCase(feature_manager.FeatureManager):
super(TestNewCase, cls).setup_clients() super(TestNewCase, cls).setup_clients()
cls.cmgr_adm = cls.get_client_manager('admin') cls.cmgr_adm = cls.get_client_manager('admin')
cls.cmgr_alt = cls.get_client_manager('alt') cls.cmgr_alt = cls.get_client_manager('alt')
cls.cmgr_adm = cls.get_client_manager('admin')
cls.routers_client = cls.cmgr_adm.routers_client cls.routers_client = cls.cmgr_adm.routers_client
cls.networks_client = cls.cmgr_adm.networks_client cls.networks_client = cls.cmgr_adm.networks_client
cls.subnets_client = cls.cmgr_adm.subnets_client cls.subnets_client = cls.cmgr_adm.subnets_client
@ -279,7 +278,7 @@ class TestNewCase(feature_manager.FeatureManager):
""" """
self.create_topo_single_network( self.create_topo_single_network(
"route-port", create_instance=False) "route-port", create_instance=False)
p_client = self.ports_client p_client = self.cmgr_adm.ports_client
port = self.get_router_port(p_client) port = self.get_router_port(p_client)
kwargs = {'port_security_enabled': True} kwargs = {'port_security_enabled': True}
self.assertRaises(exceptions.BadRequest, self.assertRaises(exceptions.BadRequest,
@ -452,7 +451,7 @@ class TestNewCase(feature_manager.FeatureManager):
topology_dict = self.create_topo_single_network( topology_dict = self.create_topo_single_network(
"dhcp_port", create_instance=False) "dhcp_port", create_instance=False)
network_state = topology_dict['network_state'] network_state = topology_dict['network_state']
ports = self.ports_client.list_ports() ports = self.cmgr_adm.ports_client.list_ports()
for port in ports['ports']: for port in ports['ports']:
if 'device_owner' in port: if 'device_owner' in port:
if port['device_owner'] == "network:dhcp" \ if port['device_owner'] == "network:dhcp" \
@ -462,7 +461,8 @@ class TestNewCase(feature_manager.FeatureManager):
image_id = self.get_glance_image_id(['cirros', "esx"]) image_id = self.get_glance_image_id(['cirros', "esx"])
self.assertRaises(exceptions.Conflict, self.create_topology_instance, self.assertRaises(exceptions.Conflict, self.create_topology_instance,
"state_vm_1", create_floating_ip=False, "state_vm_1", create_floating_ip=False,
image_id=image_id, port=port) image_id=image_id, port=port,
clients=self.cmgr_adm, security_groups="undef")
@decorators.idempotent_id('1206016a-91cc-8905-b217-98844caa2212') @decorators.idempotent_id('1206016a-91cc-8905-b217-98844caa2212')
@testtools.skipUnless( @testtools.skipUnless(
@ -505,7 +505,7 @@ class TestNewCase(feature_manager.FeatureManager):
kwargs = {"port_security_enabled": "false"} kwargs = {"port_security_enabled": "false"}
self.networks_client.update_network(network_state['id'], **kwargs) self.networks_client.update_network(network_state['id'], **kwargs)
self.create_topology_subnet("test-sub", network_state) self.create_topology_subnet("test-sub", network_state)
ports = self.ports_client.list_ports() ports = self.cmgr_adm.ports_client.list_ports()
for port in ports['ports']: for port in ports['ports']:
if 'device_owner' in port: if 'device_owner' in port:
if port['device_owner'] == "network:dhcp" and \ if port['device_owner'] == "network:dhcp" and \
@ -598,7 +598,7 @@ class TestNewCase(feature_manager.FeatureManager):
1) 1)
fix_ip = [ fix_ip = [
{'subnet_id': subnet_state.get('id'), {'subnet_id': subnet_state.get('id'),
'ip_address': network_cidr[0] + '.2'}] 'ip_address': network_cidr[0] + '.222'}]
args = {'fixed_ips': fix_ip, 'network_id': network_state['id']} args = {'fixed_ips': fix_ip, 'network_id': network_state['id']}
self.assertRaises(exceptions.BadRequest, self.assertRaises(exceptions.BadRequest,
self.cmgr_adm.ports_client.create_port, self.cmgr_adm.ports_client.create_port,