From 676b0bff2299d9902c29937283c7c12fd684af12 Mon Sep 17 00:00:00 2001 From: Itsuro Oda Date: Thu, 10 Mar 2022 04:53:48 +0000 Subject: [PATCH] Fix links of v2 API resources This patch fixes URL in _links attribute of v2 API resources such as VnfInstance. It was '{endpoint}/v2/vnflcm/...' wrongly. It is '{endpoint}/vnflcm/v2/...' correctly. Closes-bug: #1963683 Change-Id: I57295d89322b94c00472abc374b8a0aefc14374d --- tacker/sol_refactored/common/lcm_op_occ_utils.py | 4 ++-- tacker/sol_refactored/common/subscription_utils.py | 2 +- tacker/sol_refactored/common/vnf_instance_utils.py | 2 +- .../unit/sol_refactored/conductor/test_vnflcm_driver_v2.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tacker/sol_refactored/common/lcm_op_occ_utils.py b/tacker/sol_refactored/common/lcm_op_occ_utils.py index 37486241c..2e62c9477 100644 --- a/tacker/sol_refactored/common/lcm_op_occ_utils.py +++ b/tacker/sol_refactored/common/lcm_op_occ_utils.py @@ -41,11 +41,11 @@ def get_lcmocc_all(context): def lcmocc_href(lcmocc_id, endpoint): - return "{}/v2/vnflcm/vnf_lcm_op_occs/{}".format(endpoint, lcmocc_id) + return "{}/vnflcm/v2/vnf_lcm_op_occs/{}".format(endpoint, lcmocc_id) def lcmocc_task_href(lcmocc_id, task, endpoint): - return "{}/v2/vnflcm/vnf_lcm_op_occs/{}/{}".format(endpoint, lcmocc_id, + return "{}/vnflcm/v2/vnf_lcm_op_occs/{}/{}".format(endpoint, lcmocc_id, task) diff --git a/tacker/sol_refactored/common/subscription_utils.py b/tacker/sol_refactored/common/subscription_utils.py index 35ff975cb..805b02453 100644 --- a/tacker/sol_refactored/common/subscription_utils.py +++ b/tacker/sol_refactored/common/subscription_utils.py @@ -47,7 +47,7 @@ def get_subsc_all(context): def subsc_href(subsc_id, endpoint): - return "{}/v2/vnflcm/subscriptions/{}".format(endpoint, subsc_id) + return "{}/vnflcm/v2/subscriptions/{}".format(endpoint, subsc_id) def _get_notification_auth_handle(subsc): diff --git a/tacker/sol_refactored/common/vnf_instance_utils.py b/tacker/sol_refactored/common/vnf_instance_utils.py index 01d156305..5839f99cd 100644 --- a/tacker/sol_refactored/common/vnf_instance_utils.py +++ b/tacker/sol_refactored/common/vnf_instance_utils.py @@ -35,7 +35,7 @@ def get_inst_all(context): def inst_href(inst_id, endpoint): - return "{}/v2/vnflcm/vnf_instances/{}".format(endpoint, inst_id) + return "{}/vnflcm/v2/vnf_instances/{}".format(endpoint, inst_id) def make_inst_links(inst, endpoint): diff --git a/tacker/tests/unit/sol_refactored/conductor/test_vnflcm_driver_v2.py b/tacker/tests/unit/sol_refactored/conductor/test_vnflcm_driver_v2.py index ca7aa4da6..8fb1316cd 100644 --- a/tacker/tests/unit/sol_refactored/conductor/test_vnflcm_driver_v2.py +++ b/tacker/tests/unit/sol_refactored/conductor/test_vnflcm_driver_v2.py @@ -645,11 +645,11 @@ class TestVnfLcmDriverV2(base.BaseTestCase): def _grant_req_links(self, lcmocc_id, inst_id): return { 'vnfLcmOpOcc': { - 'href': '{}/v2/vnflcm/vnf_lcm_op_occs/{}'.format( + 'href': '{}/vnflcm/v2/vnf_lcm_op_occs/{}'.format( self.driver.endpoint, lcmocc_id) }, 'vnfInstance': { - 'href': '{}/v2/vnflcm/vnf_instances/{}'.format( + 'href': '{}/vnflcm/v2/vnf_instances/{}'.format( self.driver.endpoint, inst_id) } }