diff --git a/vmware_nsxlib/tests/unit/v3/policy/test_resources.py b/vmware_nsxlib/tests/unit/v3/policy/test_resources.py index 5f52ccf0..9704b067 100644 --- a/vmware_nsxlib/tests/unit/v3/policy/test_resources.py +++ b/vmware_nsxlib/tests/unit/v3/policy/test_resources.py @@ -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): diff --git a/vmware_nsxlib/v3/policy/core_resources.py b/vmware_nsxlib/v3/policy/core_resources.py index 43b9ebf7..a2a461c0 100644 --- a/vmware_nsxlib/v3/policy/core_resources.py +++ b/vmware_nsxlib/v3/policy/core_resources.py @@ -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.