diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2017-08-25 10:15:02 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2017-08-25 10:15:02 +0800 |
commit | 483b7350b340d50d73b3d7925e4b7f317d41d361 (patch) | |
tree | f233ad70223f1d694b0e991435ab012908f1566a | |
parent | 4ade9ad1887d2ccdfa81596e9f22108cd90bf774 (diff) |
Add vnf,sfc stauts confirm logic
Change-Id: I904625f07e60341ccdd4777064fdbb4ea93db81d
Issue-Id: VFC-132
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/workflows/build_in.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lcm/workflows/build_in.py b/lcm/workflows/build_in.py index 88ddbc93..3d06984d 100644 --- a/lcm/workflows/build_in.py +++ b/lcm/workflows/build_in.py @@ -63,10 +63,14 @@ def run_ns_instantiate(input_data): jobs = [create_vnf(ns_inst_id, i + 1, vnf_param_json) for i in range(vnf_count)] wait_until_jobs_done(job_id, jobs) + [confirm_vnf_status(inst_id) for inst_id, _, _ in jobs] + update_job(job_id, 70, "0", "Start to create SFC") jobs = [create_sfc(ns_inst_id, i + 1, nsd_json, sdnc_id) for i in range(sfc_count)] wait_until_jobs_done(job_id, jobs) + [confirm_sfc_status(inst_id) for inst_id, _, _ in jobs] + update_job(job_id, 90, "0", "Start to post deal") post_deal(ns_inst_id, "true") @@ -224,5 +228,28 @@ def wait_until_jobs_done(g_job_id, jobs): if g_job_id in g_jobs_status: if sum(g_jobs_status[g_job_id]) > 0: raise NSLCMException("Some jobs failed!") + +def confirm_vnf_status(vnf_inst_id): + uri = "api/nslcm/v1/ns/vnfs/{vnfInstId}".format(vnfInstId=vnf_inst_id) + ret = restcall.req_by_msb(uri, "GET") + if ret[0] != 0: + raise NSLCMException("Failed to call get_vnf(%s)" % vnf_inst_id) + vnf_status = ret[1]["vnfStatus"] + if vnf_status != "active": + raise NSLCMException("Status of VNF(%s) is not active" % vnf_inst_id) + +def confirm_sfc_status(sfc_inst_id): + uri = "api/nslcm/v1/ns/sfcs/{sfcInstId}".format(sfcInstId=sfc_inst_id) + ret = restcall.req_by_msb(uri, "GET") + if ret[0] != 0: + raise NSLCMException("Failed to call get_sfc(%s)" % sfc_inst_id) + sfc_status = ret[1]["sfcStatus"] + if sfc_status != "active": + raise NSLCMException("Status of SFC(%s) is not active" % sfc_inst_id) + + + + + |