Add policy group get_path api

Change-Id: I492e0f9b7bfae8507ee11634f405a8f0f6669d04
This commit is contained in:
Adit Sarfaty
2019-02-27 15:07:45 +02:00
parent 0daa8e5734
commit aca6c0a86d
2 changed files with 16 additions and 0 deletions

View File

@@ -540,6 +540,15 @@ class TestPolicyGroup(NsxPolicyLibTestCase):
TEST_TENANT, domain_id, group_id)
api_get.assert_called_once_with(path)
def test_get_path(self):
domain_id = 'd1'
group_id = 'g1'
result = self.resourceApi.get_path(domain_id, group_id,
tenant=TEST_TENANT)
expected_path = '/%s/domains/%s/groups/%s' % (
TEST_TENANT, domain_id, group_id)
self.assertEqual(expected_path, result)
class TestPolicyL4Service(NsxPolicyLibTestCase):

View File

@@ -467,6 +467,13 @@ class NsxPolicyGroupApi(NsxPolicyResourceBase):
tenant=tenant)
return self._get_realization_info(group_def, entity_type=entity_type)
def get_path(self, domain_id, group_id,
tenant=constants.POLICY_INFRA_TENANT):
group_def = self.entry_def(domain_id=domain_id,
group_id=group_id,
tenant=tenant)
return group_def.get_resource_full_path()
class NsxPolicyServiceBase(NsxPolicyResourceBase):
"""Base class for NSX Policy Service with a single entry.