aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaili <lai.li@zte.com.cn>2018-08-22 17:33:52 +0800
committerlaili <lai.li@zte.com.cn>2018-08-22 17:33:52 +0800
commit889eb70fc326913061fc00c99f6cbc0f4a3fd6a2 (patch)
tree68324403592e335e7a583cf018a74c56484c49f2
parent1de6ed4cb85b1c6c189098f55c5101449491bb8d (diff)
Ns descriptor related stuffs.
Add the biz for deletion of an individual nsd. Change-Id: I023a4f17cd9e28f18e3875966a14edf2f1bc2fc6 Issue-ID: VFC-1037 Signed-off-by: laili <lai.li@zte.com.cn>
-rw-r--r--catalog/packages/biz/ns_descriptor.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/catalog/packages/biz/ns_descriptor.py b/catalog/packages/biz/ns_descriptor.py
index ef76c9cc..b9ebdf40 100644
--- a/catalog/packages/biz/ns_descriptor.py
+++ b/catalog/packages/biz/ns_descriptor.py
@@ -142,6 +142,19 @@ def query_single(nsd_info_id):
return data
+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)
+ if ns_pkgs[0].operationalState != 'DISABLED':
+ raise CatalogException('The NS descriptor (%s) is not 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)
+ ns_pkgs.delete()
+
+
def upload(files, nsd_info_id):
remote_files = files
for remote_file in remote_files: