diff options
author | dyh <dengyuanhong@chinamobile.com> | 2020-10-28 17:50:26 +0800 |
---|---|---|
committer | dyh <dengyuanhong@chinamobile.com> | 2020-10-28 17:51:09 +0800 |
commit | 1aa13bd5ac2948b77889bbfc6fd262ac3c717bbe (patch) | |
tree | ae56e820db141a063c1b38676b8fa937513d6aee | |
parent | 2c57fdc3462fb59fd2643faade6355e278bfc014 (diff) |
update grant vnf
Change-Id: I5574ad2d8e2c14f061859ca6b3f70a75d04bb2b7
Issue-ID: VFC-1762
Signed-off-by: dyh <dengyuanhong@chinamobile.com>
-rw-r--r-- | lcm/ns_vnfs/biz/grant_vnf.py | 23 | ||||
-rw-r--r-- | lcm/ns_vnfs/tests/tests.py | 18 |
2 files changed, 28 insertions, 13 deletions
diff --git a/lcm/ns_vnfs/biz/grant_vnf.py b/lcm/ns_vnfs/biz/grant_vnf.py index 40442e92..882edd52 100644 --- a/lcm/ns_vnfs/biz/grant_vnf.py +++ b/lcm/ns_vnfs/biz/grant_vnf.py @@ -18,6 +18,7 @@ import uuid import time from lcm.pub.database.models import NfInstModel, OOFDataModel from lcm.pub.exceptions import NSLCMException +from lcm.pub.msapi import resmgr from lcm.pub.msapi.sdc_run_catalog import query_vnfpackage_by_id from lcm.pub.utils.values import ignore_case_get from lcm.ns_vnfs.const import SCALAR_UNIT_DICT @@ -89,17 +90,17 @@ class GrantVnf(object): break req_param[grant_type].append(grant_res) self.data = req_param - # tmp = resmgr.grant_vnf(self.data) - # vimConnections.append( - # { - # "id": tmp["vim"]["vimId"], - # "vimId": tmp["vim"]["vimId"], - # "vimType": None, - # "interfaceInfo": None, - # "accessInfo": tmp["vim"]["accessInfo"], - # "extra": None - # } - # ) + tmp = resmgr.grant_vnf(self.data) + vimConnections.append( + { + "id": tmp["vim"]["vimId"], + "vimId": tmp["vim"]["vimId"], + "vimType": None, + "interfaceInfo": None, + "accessInfo": tmp["vim"]["accessInfo"], + "extra": None + } + ) grant_resp = { "id": str(uuid.uuid4()), diff --git a/lcm/ns_vnfs/tests/tests.py b/lcm/ns_vnfs/tests/tests.py index 25997490..e67c0d5e 100644 --- a/lcm/ns_vnfs/tests/tests.py +++ b/lcm/ns_vnfs/tests/tests.py @@ -1013,7 +1013,14 @@ class TestGrantVnfViews(TestCase): resp = GrantVnf(json.dumps(self.data)).exec_grant() self.assertEqual(resp["vnfInstanceId"], "add_resources_but_no_off") self.assertEqual(resp["vnfLcmOpOccId"], "vnf_lcm_op_occ_id") - vimConnections = [] + vimConnections = [{ + "id": "cloudOwner_casa", + "vimId": "cloudOwner_casa", + "vimType": None, + "interfaceInfo": None, + "accessInfo": {"tenant": "tenantA"}, + "extra": None + }] self.assertEqual(resp["vimConnections"], vimConnections) @mock.patch.object(resmgr, "grant_vnf") @@ -1106,7 +1113,14 @@ class TestGrantVnfViews(TestCase): resp = GrantVnf(json.dumps(self.data)).exec_grant() self.assertEqual(resp["vnfInstanceId"], "remove_resources_but_no_off") self.assertEqual(resp["vnfLcmOpOccId"], "vnf_lcm_op_occ_id") - vimConnections = [] + vimConnections = [{ + "id": "cloudOwner_casa", + "vimId": "cloudOwner_casa", + "vimType": None, + "interfaceInfo": None, + "accessInfo": {"tenant": "tenantA"}, + "extra": None + }] self.assertEqual(resp["vimConnections"], vimConnections) @mock.patch.object(resmgr, "grant_vnf") |