summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-03-20 16:17:28 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-03-20 16:27:01 +0800
commit57e9f3a2db08802b8c62c012e2d1513943d4e83c (patch)
treec15eea9e97aa478436501fec5959d361420d21e6
parent1666778165fcf65c8a7820553c31f60a2433c5fd (diff)
Add api adaptor for instantiate vnf
Change-Id: I4de85292ce0a69a81bc912a956ad01f73b3d2613 Issue-ID: VFC-1307 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--zte/vmanager/driver/interfaces/views.py26
1 files changed, 5 insertions, 21 deletions
diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py
index 7376d4d2..11dd6a09 100644
--- a/zte/vmanager/driver/interfaces/views.py
+++ b/zte/vmanager/driver/interfaces/views.py
@@ -135,36 +135,20 @@ class InstantiateVnf(APIView):
vnf_package_info = json.JSONDecoder().decode(ret[1])
packageInfo = ignorcase_get(vnf_package_info, "packageInfo")
logger.debug("[%s] packageInfo=%s", fun_name(), packageInfo)
+ logger.debug("VNF_FTP=%s", VNF_FTP)
data = {
"NFVOID": 1,
"VNFMID": vnfmid,
+ "vnfd_id": packageInfo.get("vnfdId"),
+ "deployflavorid": "TODO",
"extension": {},
+ "inputs": []
}
- vnfdModel = json.loads(ignorcase_get(packageInfo, "vnfdModel"))
- metadata = ignorcase_get(vnfdModel, "metadata")
- vnfd_name = ignorcase_get(metadata, "name")
- # TODO convert sdc vnf package to vnf vender package
- inputs = []
- if "SPGW" in vnfd_name.upper():
- data["VNFD"] = VNF_FTP + "SPGW"
- inputs = load_json_file("SPGW" + "_inputs.json")
- elif "MME" in vnfd_name.upper():
- data["VNFD"] = VNF_FTP + "MME"
- inputs = load_json_file("MME" + "_inputs.json")
- else:
- data["VNFD"] = ignorcase_get(packageInfo, "downloadUri")
-
- data["VNFURL"] = data["VNFD"]
additionalParam = ignorcase_get(instantiateVnfRequestSerializer.data, "additionalParam")
for name, value in ignorcase_get(additionalParam, "inputs").items():
- inputs.append({"name": name, "value": value})
+ data["inputs"].append({"key_name": name, "value": value, "type": "TODO"})
- data["extension"]["inputs"] = json.dumps(inputs)
- data["extension"]["extVirtualLinks"] = ignorcase_get(additionalParam, "extVirtualLinks")
- data["extension"]["vnfinstancename"] = ignorcase_get(instantiateVnfRequestSerializer.data, "vnfInstanceName")
- data["extension"]["vnfid"] = data["VNFD"]
- data["extension"]["multivim"] = 0
logger.debug("[%s] call_req data=%s", fun_name(), data)
ret = restcall.call_req(