Browse Source

Merge "fix for https://review.opendev.org/#/c/71462"

changes/95/716995/1
Zuul 3 months ago
committed by Gerrit Code Review
parent
commit
7c2684ef03
2 changed files with 19 additions and 4 deletions
  1. +15
    -1
      vmware_nsx_tempest_plugin/services/nsxv_client.py
  2. +4
    -3
      vmware_nsx_tempest_plugin/tests/scenario/test_new_case_coverage.py

+ 15
- 1
vmware_nsx_tempest_plugin/services/nsxv_client.py View File

@@ -351,7 +351,7 @@ class VSMClient(object):
json_ver['patchVersion'], json_ver['buildNumber']])

def verify_default_snat_rule(self, name, routerip, cidr):
edge_id = self.get_edge(name)['id']
edge_id = self.get_edge_name_substring(name)['id']
self.__set_api_version('4.0')
self.__set_endpoint('/edges/%s/nat/config' % edge_id)
response = self.get()
@@ -362,6 +362,20 @@ class VSMClient(object):
else:
return False

def get_edge_name_substring(self, name):
"""Get edge based on the name, which is OpenStack router.
Return edge if found, else return None.
"""
edges = self.get_all_edges()
edge = [e for e in edges if name[:-4] in e['name']]
if len(edge) == 0:
LOG.debug('Edge %s NOT found!' % name)
edge = None
else:
edge = edge[0]
LOG.debug('Found edge: %s' % edge)
return edge

def verify_spoofgaurd_policy_nw(self, network_id):
"""Retrieve existing scppfguard policy"""
self.__set_api_version('4.0')


+ 4
- 3
vmware_nsx_tempest_plugin/tests/scenario/test_new_case_coverage.py View File

@@ -78,7 +78,7 @@ class TestNewCase(feature_manager.FeatureManager):
cls.web_service_start_delay = 2.5

def _verify_router_gateway(self, router_id, exp_ext_gw_info=None):
show_body = self.admin_routers_client.show_router(router_id)
show_body = self.routers_client.show_router(router_id)
actual_ext_gw_info = show_body['router']['external_gateway_info']
if exp_ext_gw_info is None:
self.assertIsNone(actual_ext_gw_info)
@@ -1763,7 +1763,8 @@ class TestNewCase(feature_manager.FeatureManager):
self._verify_router_gateway(
router['id'], {'network_id': CONF.network.public_network_id,
'enable_snat': True})
rtr_ext = router['external_gateway_info']
routerIP = rtr_ext['external_fixed_ips'][0]['ip_address']
router_body = self.routers_client.show_router(router['id'])
router_ext = router_body['router']['external_gateway_info']
routerIP = router_ext['external_fixed_ips'][0]['ip_address']
self.assertTrue(self.vsm.verify_default_snat_rule(name, routerIP,
cidr_value))

Loading…
Cancel
Save