diff --git a/vmware_nsxlib/tests/unit/v3/policy/test_resources.py b/vmware_nsxlib/tests/unit/v3/policy/test_resources.py index 43e7dc5a..acbada0d 100644 --- a/vmware_nsxlib/tests/unit/v3/policy/test_resources.py +++ b/vmware_nsxlib/tests/unit/v3/policy/test_resources.py @@ -4117,6 +4117,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): diff --git a/vmware_nsxlib/v3/policy/core_resources.py b/vmware_nsxlib/v3/policy/core_resources.py index 37f44672..3d35bc74 100644 --- a/vmware_nsxlib/v3/policy/core_resources.py +++ b/vmware_nsxlib/v3/policy/core_resources.py @@ -2045,6 +2045,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 """