aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/ns_vnfs/biz/grant_vnf.py23
-rw-r--r--lcm/ns_vnfs/tests/tests.py18
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")