Merge "fix for https://review.opendev.org/#/c/71462"
This commit is contained in:
commit
7c2684ef03
@ -351,7 +351,7 @@ class VSMClient(object):
|
|||||||
json_ver['patchVersion'], json_ver['buildNumber']])
|
json_ver['patchVersion'], json_ver['buildNumber']])
|
||||||
|
|
||||||
def verify_default_snat_rule(self, name, routerip, cidr):
|
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_api_version('4.0')
|
||||||
self.__set_endpoint('/edges/%s/nat/config' % edge_id)
|
self.__set_endpoint('/edges/%s/nat/config' % edge_id)
|
||||||
response = self.get()
|
response = self.get()
|
||||||
@ -362,6 +362,20 @@ class VSMClient(object):
|
|||||||
else:
|
else:
|
||||||
return False
|
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):
|
def verify_spoofgaurd_policy_nw(self, network_id):
|
||||||
"""Retrieve existing scppfguard policy"""
|
"""Retrieve existing scppfguard policy"""
|
||||||
self.__set_api_version('4.0')
|
self.__set_api_version('4.0')
|
||||||
|
@ -78,7 +78,7 @@ class TestNewCase(feature_manager.FeatureManager):
|
|||||||
cls.web_service_start_delay = 2.5
|
cls.web_service_start_delay = 2.5
|
||||||
|
|
||||||
def _verify_router_gateway(self, router_id, exp_ext_gw_info=None):
|
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']
|
actual_ext_gw_info = show_body['router']['external_gateway_info']
|
||||||
if exp_ext_gw_info is None:
|
if exp_ext_gw_info is None:
|
||||||
self.assertIsNone(actual_ext_gw_info)
|
self.assertIsNone(actual_ext_gw_info)
|
||||||
@ -1763,7 +1763,8 @@ class TestNewCase(feature_manager.FeatureManager):
|
|||||||
self._verify_router_gateway(
|
self._verify_router_gateway(
|
||||||
router['id'], {'network_id': CONF.network.public_network_id,
|
router['id'], {'network_id': CONF.network.public_network_id,
|
||||||
'enable_snat': True})
|
'enable_snat': True})
|
||||||
rtr_ext = router['external_gateway_info']
|
router_body = self.routers_client.show_router(router['id'])
|
||||||
routerIP = rtr_ext['external_fixed_ips'][0]['ip_address']
|
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,
|
self.assertTrue(self.vsm.verify_default_snat_rule(name, routerIP,
|
||||||
cidr_value))
|
cidr_value))
|
||||||
|
Loading…
Reference in New Issue
Block a user