Merge "Remove MP search API in policy resources"
This commit is contained in:
commit
395f3b4c59
@ -3257,10 +3257,7 @@ class TestPolicyTier1(NsxPolicyLibTestCase):
|
|||||||
'realization_specific_identifier': logical_router_id}
|
'realization_specific_identifier': logical_router_id}
|
||||||
passthrough_mock = self.resourceApi.nsx_api.logical_router.update
|
passthrough_mock = self.resourceApi.nsx_api.logical_router.update
|
||||||
with mock.patch.object(self.resourceApi, "_get_realization_info",
|
with mock.patch.object(self.resourceApi, "_get_realization_info",
|
||||||
return_value=info) as realization,\
|
return_value=info) as realization:
|
||||||
mock.patch.object(self.resourceApi,
|
|
||||||
"_get_realized_id_using_search",
|
|
||||||
return_value=logical_router_id):
|
|
||||||
self.resourceApi.update_transport_zone(tier1_id, tz_uuid,
|
self.resourceApi.update_transport_zone(tier1_id, tz_uuid,
|
||||||
tenant=TEST_TENANT)
|
tenant=TEST_TENANT)
|
||||||
realization.assert_called_once()
|
realization.assert_called_once()
|
||||||
@ -3283,26 +3280,14 @@ class TestPolicyTier1(NsxPolicyLibTestCase):
|
|||||||
# Get realized ID using search
|
# Get realized ID using search
|
||||||
tier1_id = '111'
|
tier1_id = '111'
|
||||||
logical_router_id = 'realized_111'
|
logical_router_id = 'realized_111'
|
||||||
info = {'results': [{'status': {'state': 'success'},
|
info = {'state': constants.STATE_REALIZED,
|
||||||
'id': logical_router_id}]}
|
'realization_specific_identifier': logical_router_id,
|
||||||
with mock.patch.object(self.resourceApi.nsx_api, "search_by_tags",
|
'entity_type': 'RealizedLogicalRouter'}
|
||||||
|
with mock.patch.object(self.resourceApi, "_get_realization_info",
|
||||||
return_value=info):
|
return_value=info):
|
||||||
realized_id = self.resourceApi.get_realized_id(tier1_id)
|
realized_id = self.resourceApi.get_realized_id(tier1_id)
|
||||||
self.assertEqual(logical_router_id, realized_id)
|
self.assertEqual(logical_router_id, realized_id)
|
||||||
|
|
||||||
def test_get_realized_id_failed(self):
|
|
||||||
# Get realized ID using search
|
|
||||||
tier1_id = '111'
|
|
||||||
logical_router_id = 'realized_111'
|
|
||||||
info = {'results': [{'status': {'state': 'in_progress'},
|
|
||||||
'id': logical_router_id}]}
|
|
||||||
with mock.patch.object(self.resourceApi.nsx_api, "search_by_tags",
|
|
||||||
return_value=info),\
|
|
||||||
mock.patch.object(self.resourceApi.policy_api,
|
|
||||||
"get_realized_entities"):
|
|
||||||
self.assertRaises(nsxlib_exc.RealizationTimeoutError,
|
|
||||||
self.resourceApi.get_realized_id, tier1_id)
|
|
||||||
|
|
||||||
def test_get_realized_downlink_port(self):
|
def test_get_realized_downlink_port(self):
|
||||||
tier1_id = '111'
|
tier1_id = '111'
|
||||||
segment_id = '222'
|
segment_id = '222'
|
||||||
|
@ -1448,12 +1448,6 @@ class NsxPolicyTier1Api(NsxPolicyResourceBase):
|
|||||||
tenant=constants.POLICY_INFRA_TENANT,
|
tenant=constants.POLICY_INFRA_TENANT,
|
||||||
realization_info=None):
|
realization_info=None):
|
||||||
tier1_def = self.entry_def(tier1_id=tier1_id, tenant=tenant)
|
tier1_def = self.entry_def(tier1_id=tier1_id, tenant=tenant)
|
||||||
if self.nsx_api:
|
|
||||||
# Use MP search api to find the LR ID as it is faster
|
|
||||||
return self._get_realized_id_using_search(
|
|
||||||
self.get_path(tier1_id, tenant=tenant),
|
|
||||||
self.nsx_api.logical_router.resource_type,
|
|
||||||
resource_def=tier1_def, entity_type=entity_type)
|
|
||||||
return self._get_realized_id(tier1_def, entity_type=entity_type,
|
return self._get_realized_id(tier1_def, entity_type=entity_type,
|
||||||
realization_info=realization_info)
|
realization_info=realization_info)
|
||||||
|
|
||||||
@ -2460,13 +2454,6 @@ class NsxPolicySegmentApi(NsxPolicyResourceBase):
|
|||||||
tenant=constants.POLICY_INFRA_TENANT):
|
tenant=constants.POLICY_INFRA_TENANT):
|
||||||
segment_def = self.entry_def(segment_id=segment_id, tenant=tenant)
|
segment_def = self.entry_def(segment_id=segment_id, tenant=tenant)
|
||||||
entity_type = 'RealizedLogicalSwitch'
|
entity_type = 'RealizedLogicalSwitch'
|
||||||
if self.nsx_api:
|
|
||||||
# Use MP search api to find the LS ID as it is faster
|
|
||||||
return self._get_realized_id_using_search(
|
|
||||||
self.get_path(segment_id, tenant=tenant),
|
|
||||||
self.nsx_api.logical_switch.resource_type,
|
|
||||||
resource_def=segment_def, entity_type=entity_type)
|
|
||||||
|
|
||||||
realization_info = self._wait_until_realized(
|
realization_info = self._wait_until_realized(
|
||||||
segment_def, entity_type=entity_type)
|
segment_def, entity_type=entity_type)
|
||||||
return self._get_realized_id(segment_def,
|
return self._get_realized_id(segment_def,
|
||||||
|
Loading…
Reference in New Issue
Block a user