summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2017-08-24 16:04:31 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2017-08-24 16:04:31 +0800
commit00a13f9abb62a6257d577a876363bf78cb5bfec0 (patch)
tree74619f984a3e1572c6afa25e4ddf799146acd2b9
parentae1876868cdf7cd1cb524f5db9d3dacb17c963f0 (diff)
Add post deal of build-in workflow
Change-Id: I79f11ba1977b4a01b9414e9422948bf16d60be4f Issue-Id: VFC-132 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-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)