diff options
author | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-10-10 19:08:19 +0800 |
---|---|---|
committer | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-10-10 19:08:19 +0800 |
commit | 283f7764a0099a106229a444ff85a7a865314e07 (patch) | |
tree | 8d9cd188a87a3ff9cabb67077e811d93d813d3ae | |
parent | 65473759b53e4a8fb775181a0530a4115925b6f1 (diff) |
Update create ns according to new api
Change-Id: I21c9c949de1bba2776edb821fb9491b789226439
Issue-ID: VFC-518
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r-- | lcm/ns/ns_create.py | 13 | ||||
-rw-r--r-- | lcm/ns/views.py | 5 |
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) |