aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2018-11-02 09:02:47 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-02 09:02:47 +0000
commitbf313724f3c4ff44353ab31e569286f777f7f3cd (patch)
tree7b362f5e1862a2a4f08b6d523ad62f4be27b707b
parent7a6fcd55d8f0a451d5fc2462fd26c9f463959913 (diff)
parent82a47bd746d352c06125b9064b87f98782addc66 (diff)
Merge "change the additionalParamForNs to be option"
-rw-r--r--lcm/ns/biz/ns_instant.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/lcm/ns/biz/ns_instant.py b/lcm/ns/biz/ns_instant.py
index 52f686be..d648ed26 100644
--- a/lcm/ns/biz/ns_instant.py
+++ b/lcm/ns/biz/ns_instant.py
@@ -58,14 +58,18 @@ class InstantNSService(object):
logger.debug('ns-instant(%s) workflow starting...' % self.ns_inst_id)
logger.debug('req_data=%s' % self.req_data)
ns_inst = NSInstModel.objects.get(id=self.ns_inst_id)
+ vim_id = ''
input_parameters = []
- for key, val in self.req_data['additionalParamForNs'].items():
- input_parameters.append({"key": key, "value": val})
+ if 'additionalParamForNs' in self.req_data:
+ for key, val in self.req_data['additionalParamForNs'].items():
+ input_parameters.append({"key": key, "value": val})
+ if 'location' in self.req_data['additionalParamForNs']:
+ vim_id = self.req_data['additionalParamForNs']['location']
+ params_json = json.JSONEncoder().encode(self.req_data["additionalParamForNs"])
+ else:
+ params_json = {}
- vim_id = ''
- if 'location' in self.req_data['additionalParamForNs']:
- vim_id = self.req_data['additionalParamForNs']['location']
location_constraints = []
if 'locationConstraints' in self.req_data:
location_constraints = self.req_data['locationConstraints']
@@ -76,7 +80,6 @@ class InstantNSService(object):
logger.debug('Start query nsd(%s)' % ns_inst.nspackage_id)
NSInstModel.objects.filter(id=self.ns_inst_id).update(nsd_model=dst_plan)
- params_json = json.JSONEncoder().encode(self.req_data["additionalParamForNs"])
params_vnf = []
plan_dict = json.JSONDecoder().decode(dst_plan)
for vnf in ignore_case_get(plan_dict, "vnfs"):
@@ -113,8 +116,10 @@ class InstantNSService(object):
'object_additionalParamForPnf': pnf_params_json
}
plan_input.update(**self.get_model_count(dst_plan))
- plan_input["sdnControllerId"] = ignore_case_get(
- self.req_data['additionalParamForNs'], "sdncontroller")
+
+ if 'additionalParamForNs' in self.req_data:
+ plan_input["sdnControllerId"] = ignore_case_get(
+ self.req_data['additionalParamForNs'], "sdncontroller")
ServiceBaseInfoModel(service_id=self.ns_inst_id,
service_name=ns_inst.name,