Merge "Add wait_until_realized for Tier1 Static Route"

This commit is contained in:
Zuul 2021-05-10 13:11:39 +00:00 committed by Gerrit Code Review
commit d717cee827
2 changed files with 22 additions and 0 deletions

View File

@ -4145,6 +4145,16 @@ class TestPolicyTier1StaticRoute(NsxPolicyLibTestCase):
self.assert_called_with_def(api_call, expected_def)
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):

View File

@ -2126,6 +2126,18 @@ class NsxPolicyTier1StaticRouteApi(NsxPolicyResourceBase):
tags=tags,
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):
"""NSX Tier1 Segment API """