summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/ns/ns_create.py13
-rw-r--r--lcm/ns/views.py5
2 files changed, 10 insertions, 8 deletions
diff --git a/lcm/ns/ns_create.py b/lcm/ns/ns_create.py
index f7cf3ca6..26d0a7d8 100644
--- a/lcm/ns/ns_create.py
+++ b/lcm/ns/ns_create.py
@@ -26,8 +26,8 @@ logger = logging.getLogger(__name__)
class CreateNSService(object):
- def __init__(self, nsd_id, ns_name, description):
- self.nsd_id = nsd_id
+ def __init__(self, csar_id, ns_name, description):
+ self.csar_id = csar_id
self.ns_name = ns_name
self.description = description
self.ns_inst_id = ''
@@ -43,13 +43,14 @@ class CreateNSService(object):
return self.ns_inst_id
def check_nsd_valid(self):
- logger.debug("CreateNSService::check_nsd_valid::nsd_id=%s" % self.nsd_id)
- ns_package_info = query_nspackage_by_id(self.nsd_id)
+ logger.debug("CreateNSService::check_nsd_valid::csar_id=%s" % self.csar_id)
+ ns_package_info = query_nspackage_by_id(self.csar_id)
if not ns_package_info:
- raise NSLCMException("nsd(%s) not exists." % self.nsd_id)
+ raise NSLCMException("nsd(%s) not exists." % self.csar_id)
packageInfo = ns_package_info["packageInfo"]
self.ns_package_id = ignore_case_get(packageInfo, "nsPackageId")
- logger.debug("CreateNSService::check_nsd_valid::ns_package_id=%s" % self.ns_package_id)
+ self.nsd_id = ignore_case_get(packageInfo, "nsdId")
+ logger.debug("CreateNSService::check_nsd_valid::ns_package_id=%s,nsd_id=%s", self.ns_package_id, self.nsd_id)
def check_ns_inst_name_exist(self):
is_exist = NSInstModel.objects.filter(name=self.ns_name).exists()
diff --git a/lcm/ns/views.py b/lcm/ns/views.py
index f7bb97a5..6d19263d 100644
--- a/lcm/ns/views.py
+++ b/lcm/ns/views.py
@@ -53,11 +53,12 @@ class CreateNSView(APIView):
logger.debug("Enter CreateNS: %s", request.data)
if ignore_case_get(request.data, 'test') == "test":
return Response(data={'nsInstanceId': "test"}, status=status.HTTP_201_CREATED)
- nsd_id = ignore_case_get(request.data, 'nsdId')
+ # nsd_id = ignore_case_get(request.data, 'nsdId')
+ csar_id = ignore_case_get(request.data, 'csarId')
ns_name = ignore_case_get(request.data, 'nsName')
description = ignore_case_get(request.data, 'description')
try:
- ns_inst_id = CreateNSService(nsd_id, ns_name, description).do_biz()
+ ns_inst_id = CreateNSService(csar_id, ns_name, description).do_biz()
except Exception as e:
logger.error("Exception in CreateNS: %s", e.message)
return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)