summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2017-08-24 08:02:28 +0000
committerGerrit Code Review <gerrit@onap.org>2017-08-24 08:02:28 +0000
commit3df446bfae1f2761de08dd6adf99623149f74cc2 (patch)
treead4deec05a5edc2968cce9900bc11081165c908c
parent8fea5548c6085c028fb4c7b8f63fea0ada602ce7 (diff)
parent00a13f9abb62a6257d577a876363bf78cb5bfec0 (diff)
Merge "Add post deal of build-in workflow"
-rw-r--r--lcm/workflows/build_in.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/lcm/workflows/build_in.py b/lcm/workflows/build_in.py
index 03a84d00..88ddbc93 100644
--- a/lcm/workflows/build_in.py
+++ b/lcm/workflows/build_in.py
@@ -68,20 +68,21 @@ def run_ns_instantiate(input_data):
wait_until_jobs_done(job_id, jobs)
update_job(job_id, 90, "0", "Start to post deal")
- post_deal()
+ post_deal(ns_inst_id, "true")
update_job(job_id, 100, "0", "Create NS successfully.")
except NSLCMException as e:
logger.error("Failded to Create NS: %s", e.message)
update_job(job_id, JOB_ERROR, "255", "Failded to Create NS.")
+ post_deal(ns_inst_id, "false")
except:
logger.error(traceback.format_exc())
update_job(job_id, JOB_ERROR, "255", "Failded to Create NS.")
+ post_deal(ns_inst_id, "false")
finally:
g_jobs_status.pop(job_id)
-
def create_vl(ns_inst_id, vl_index, nsd, ns_param):
uri = "api/nslcm/v1/ns/vls"
data = json.JSONEncoder().encode({
@@ -142,9 +143,16 @@ def create_sfc(ns_inst_id, fp_index, nsd_json, sdnc_id):
logger.debug("Create SFC(%s) started.", sfc_inst_id)
return sfc_inst_id, job_id, fp_index - 1
-def post_deal():
- # TODO:
- pass
+def post_deal(ns_inst_id, status):
+ uri = "/ns/{nsInstanceId}/postdeal".format(nsInstanceId=ns_inst_id)
+ data = json.JSONEncoder().encode({
+ "status": status
+ })
+
+ ret = restcall.req_by_msb(uri, "POST", data)
+ if ret[0] != 0:
+ logger.error("Failed to call post_deal(%s): %s", ns_inst_id, ret[1])
+ logger.debug("Call post_deal(%s) successfully.", ns_inst_id)
def update_job(job_id, progress, errcode, desc):
uri = "api/nslcm/v1/jobs/{jobId}".format(jobId=job_id)