From: fujinhua Date: Thu, 24 Aug 2017 08:04:31 +0000 (+0800) Subject: Add post deal of build-in workflow X-Git-Tag: v1.0.0~141^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=00a13f9abb62a6257d577a876363bf78cb5bfec0;p=vfc%2Fnfvo%2Flcm.git Add post deal of build-in workflow Change-Id: I79f11ba1977b4a01b9414e9422948bf16d60be4f Issue-Id: VFC-132 Signed-off-by: fujinhua --- 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)