diff options
author | laili <lai.li@zte.com.cn> | 2018-08-23 13:59:20 +0800 |
---|---|---|
committer | laili <lai.li@zte.com.cn> | 2018-08-23 14:21:19 +0800 |
commit | 08282ff847cb3ed059aa0334b7e69d97bc45476b (patch) | |
tree | 02cf0a45233107340f64963d6e4eae167ccfce02 | |
parent | 0154bfe3242ec3b685c8c6fad2a301a1d54104d4 (diff) |
Ns descriptor related stuffs.
Modify the biz of deletion and query.
Change-Id: I8162130946da2ca2a5d12f4796bba238e9e7c4c7
Issue-ID: VFC-1037
Signed-off-by: laili <lai.li@zte.com.cn>
-rw-r--r-- | catalog/packages/biz/ns_descriptor.py | 20 | ||||
-rw-r--r-- | catalog/packages/serializers/pnfd_infos.py | 0 |
2 files changed, 6 insertions, 14 deletions
diff --git a/catalog/packages/biz/ns_descriptor.py b/catalog/packages/biz/ns_descriptor.py index b69b8e4e..ee0b005b 100644 --- a/catalog/packages/biz/ns_descriptor.py +++ b/catalog/packages/biz/ns_descriptor.py @@ -102,7 +102,7 @@ def query_single(nsd_info_id): 'vnfPkgIds': [], 'pnfdInfoIds': [], # TODO 'nestedNsdInfoIds': [], # TODO - 'nsdOnboardingState': 'CREATED', + 'nsdOnboardingState': ns_pkgs[0].onboardingState, 'onboardingFailureDetails': None, # TODO 'nsdOperationalState': ns_pkgs[0].operationalState, 'nsdUsageState': ns_pkgs[0].usageState, @@ -111,14 +111,6 @@ def query_single(nsd_info_id): } if ns_pkgs[0].nsdModel: - ns_pkgs[0]['nsdOnboardingState'] = 'ONBOARDED' - elif ns_pkgs[0].localFilePath: # TODO: strip() - ns_pkgs[0]['nsdOnboardingState'] = 'PROCESSING' - elif ns_pkgs[0].nsdId: - ns_pkgs[0]['nsdOnboardingState'] = 'UPLOADING' - ns_pkgs[0]['nsdOnboardingState'] = 'CREATED' - - if ns_pkgs[0].nsdModel: nsd_model = json.JSONDecoder().decode(ns_pkgs[0].nsdModel) vnf_pkg_ids = [] for vnf in nsd_model['vnfs']: @@ -138,13 +130,13 @@ def query_single(nsd_info_id): def delete_single(nsd_info_id): ns_pkgs = NSPackageModel.objects.filter(nsPackageId=nsd_info_id) if not ns_pkgs.exists(): - raise CatalogException('The NS descriptor (%s) does not exist.' % nsd_info_id) - if not ns_pkgs[0].nsdModel: - raise CatalogException('The NS descriptor (%s) is not ONBOARDED.' % nsd_info_id) + return + if ns_pkgs[0].onboardingState == 'ONBOARDED': + raise CatalogException('The NS descriptor (%s) shall be non-ONBOARDED.' % nsd_info_id) if ns_pkgs[0].operationalState != 'DISABLED': - raise CatalogException('The NS descriptor (%s) is not DISABLED.' % nsd_info_id) + raise CatalogException('The NS descriptor (%s) shall be DISABLED.' % nsd_info_id) if ns_pkgs[0].usageState != 'NOT_IN_USE': - raise CatalogException('The NS descriptor (%s) is not NOT_IN_USE.' % nsd_info_id) + raise CatalogException('The NS descriptor (%s) shall be NOT_IN_USE.' % nsd_info_id) ns_pkgs.delete() diff --git a/catalog/packages/serializers/pnfd_infos.py b/catalog/packages/serializers/pnfd_infos.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/catalog/packages/serializers/pnfd_infos.py |