Merge "Reload enforcement-point api"

This commit is contained in:
Zuul 2019-09-01 04:37:38 +00:00 committed by Gerrit Code Review
commit 54393a235c
2 changed files with 18 additions and 2 deletions

View File

@ -2227,6 +2227,16 @@ class TestPolicyEnforcementPoint(NsxPolicyLibTestCase):
TEST_TENANT, ep_id)
api_get.assert_called_once_with(path, silent=False)
def test_reload(self):
ef_id = '111'
with mock.patch.object(self.policy_api.client, "url_post") as api_post:
self.resourceApi.reload(ef_id, tenant=TEST_TENANT)
expected_def = core_defs.EnforcementPointDef(ep_id=ef_id,
tenant=TEST_TENANT)
api_post.assert_called_once_with(
expected_def.get_resource_path() + '?action=reload',
None, expected_results=None, headers=None)
class TestPolicyDeploymentMap(NsxPolicyLibTestCase):

View File

@ -91,9 +91,9 @@ class NsxPolicyResourceBase(object):
"""Create new or overwrite existing resource
Create would list keys and attributes, set defaults and
perform nesessary validations.
perform necessary validations.
If object with same IDs exists on backend, it will
be overriden.
be overridden.
"""
pass
@ -3372,6 +3372,12 @@ class NsxPolicyEnforcementPointApi(NsxPolicyResourceBase):
silent=silent,
realization_info=realization_info)
def reload(self, ep_id, tenant=constants.POLICY_INFRA_TENANT):
# Use post command to reload the enforcement point
ep_def = core_defs.EnforcementPointDef(ep_id=ep_id, tenant=tenant)
path = "%s?action=reload" % ep_def.get_resource_path()
self.policy_api.client.create(path)
class NsxPolicyTransportZoneApi(NsxPolicyResourceBase):