update vfc createvl.py
[vfc/nfvo/lcm.git] / lcm / ns / ns_create.py
index ade9762..40d8d50 100644 (file)
@@ -22,6 +22,7 @@ from lcm.pub.msapi.aai import create_ns_aai
 from lcm.pub.msapi.sdc_run_catalog import query_nspackage_by_id
 from lcm.pub.utils.timeutil import now_time
 from lcm.pub.utils.values import ignore_case_get
+from lcm.ns.const import SERVICE_ROLE, SERVICE_TYPE
 
 logger = logging.getLogger(__name__)
 
@@ -31,8 +32,8 @@ class CreateNSService(object):
         self.csar_id = csar_id
         self.ns_name = ns_name
         self.description = description
-        self.global_customer_id = ignore_case_get(context, 'global-customer-id')
-        self.service_type = ignore_case_get(context, 'service-type')
+        self.global_customer_id = ignore_case_get(context, 'globalCustomerId')
+        self.service_type = ignore_case_get(context, 'serviceType')
         self.ns_inst_id = ''
         self.ns_package_id = ''
 
@@ -104,14 +105,11 @@ class CreateNSService(object):
             data = {
                 "service-instance-id": self.ns_inst_id,
                 "service-instance-name": self.ns_name,
-                "service-type": "Network",
-                "service-role": "service-role-" + self.ns_inst_id
+                "service-type": SERVICE_TYPE,
+                "service-role": SERVICE_ROLE
             }
             resp_data, resp_status = create_ns_aai(self.global_customer_id, self.service_type, self.ns_inst_id, data)
-            if resp_data:
-                logger.debug("Fail to create ns[%s] to aai: [%s].", self.ns_inst_id, resp_status)
-            else:
-                logger.debug("Success to create ns[%s] to aai: [%s].", self.ns_inst_id, resp_status)
+            logger.debug("Success to create ns[%s] to aai:[%s],[%s].", self.ns_inst_id, resp_data, resp_status)
         except NSLCMException as e:
             logger.debug("Fail to createns[%s] to aai, detail message: %s" % (self.ns_inst_id, e.message))
         except: