summaryrefslogtreecommitdiffstats
path: root/lcm/workflows
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2017-08-24 12:01:30 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2017-08-24 12:01:30 +0800
commitae1876868cdf7cd1cb524f5db9d3dacb17c963f0 (patch)
treeda10f6ea4a6453f42bbcda274a37e6879ec34dc3 /lcm/workflows
parent3bcc36001a1faa4775a5bf99cf1c46a4c6213199 (diff)
Add create sfc of build-in workflow
Change-Id: I7eacc97e3c0c157ba9e524825c7ebd54fe939417 Issue-Id: VFC-132 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'lcm/workflows')
-rw-r--r--lcm/workflows/build_in.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/lcm/workflows/build_in.py b/lcm/workflows/build_in.py
index 1e4b292f..03a84d00 100644
--- a/lcm/workflows/build_in.py
+++ b/lcm/workflows/build_in.py
@@ -64,8 +64,8 @@ def run_ns_instantiate(input_data):
wait_until_jobs_done(job_id, jobs)
update_job(job_id, 70, "0", "Start to create SFC")
- for i in range(sfc_count):
- 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)
update_job(job_id, 90, "0", "Start to post deal")
post_deal()
@@ -123,9 +123,24 @@ def create_vnf(ns_inst_id, vnf_index, nf_param):
logger.debug("Create VNF(%s) started.", vnf_inst_id)
return vnf_inst_id, job_id, vnf_index - 1
-def create_sfc():
- # TODO:
- pass
+def create_sfc(ns_inst_id, fp_index, nsd_json, sdnc_id):
+ uri = "/ns/sfcs"
+ data = json.JSONEncoder().encode({
+ "nsInstanceId": ns_inst_id,
+ "context": nsd_json,
+ "fpindex": fp_index,
+ "sdnControllerId": sdnc_id
+ })
+
+ ret = restcall.req_by_msb(uri, "POST", data)
+ if ret[0] != 0:
+ logger.error("Failed to call create_sfc(%s): %s", fp_index, ret[1])
+ raise NSLCMException("Failed to call create_sfc(index is %s)" % fp_index)
+
+ sfc_inst_id = ret[1]["sfcInstId"]
+ job_id = ret[1]["jobId"]
+ logger.debug("Create SFC(%s) started.", sfc_inst_id)
+ return sfc_inst_id, job_id, fp_index - 1
def post_deal():
# TODO: