Browse Source

Add wait_until_realized for Tier1 Static Route

Change-Id: I26cff5ee6e7942c92d1670440aa7c039c39a2425
(cherry picked from commit 378e4eac70)
changes/41/794441/1
Danting Liu 2 months ago
committed by Salvatore Orlando
parent
commit
1bf074cab8
2 changed files with 22 additions and 0 deletions
  1. +10
    -0
      vmware_nsxlib/tests/unit/v3/policy/test_resources.py
  2. +12
    -0
      vmware_nsxlib/v3/policy/core_resources.py

+ 10
- 0
vmware_nsxlib/tests/unit/v3/policy/test_resources.py View File

@ -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):


+ 12
- 0
vmware_nsxlib/v3/policy/core_resources.py View File

@ -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 """


Loading…
Cancel
Save