Add wait_until_realized for Tier1 Static Route

Change-Id: I26cff5ee6e7942c92d1670440aa7c039c39a2425
(cherry picked from commit 378e4eac70)
This commit is contained in:
Danting Liu 2021-04-22 03:13:34 -07:00 committed by Salvatore Orlando
parent 3c8fee6a47
commit 1bf074cab8
2 changed files with 22 additions and 0 deletions

View File

@ -4117,6 +4117,16 @@ class TestPolicyTier1StaticRoute(NsxPolicyLibTestCase):
self.assert_called_with_def(api_call, expected_def) self.assert_called_with_def(api_call, expected_def)
self.assertEqual(mock_get, result) self.assertEqual(mock_get, result)
def test_wait_until_realized_failed(self):
tier1_id = 'tier1'
route_id = 'route1'
with mock.patch.object(self.resourceApi, "_get_realization_info",
return_value=[]):
self.assertRaises(nsxlib_exc.RealizationTimeoutError,
self.resourceApi.wait_until_realized,
tier1_id, route_id, tenant=TEST_TENANT,
max_attempts=3, sleep=0.1)
class TestPolicyTier0(NsxPolicyLibTestCase): class TestPolicyTier0(NsxPolicyLibTestCase):

View File

@ -2045,6 +2045,18 @@ class NsxPolicyTier1StaticRouteApi(NsxPolicyResourceBase):
tags=tags, tags=tags,
tenant=tenant) tenant=tenant)
def wait_until_realized(self, tier1_id, static_route_id,
entity_type=None,
tenant=constants.POLICY_INFRA_TENANT,
sleep=None, max_attempts=None):
static_route_def = self.entry_def(tier1_id=tier1_id,
static_route_id=static_route_id,
tenant=tenant)
return self._wait_until_realized(static_route_def,
entity_type=entity_type,
sleep=sleep,
max_attempts=max_attempts)
class NsxPolicyTier1SegmentApi(NsxPolicyResourceBase): class NsxPolicyTier1SegmentApi(NsxPolicyResourceBase):
"""NSX Tier1 Segment API """ """NSX Tier1 Segment API """