diff options
-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 |