Ns descriptor related stuffs. 97/62097/1
authorlaili <lai.li@zte.com.cn>
Thu, 23 Aug 2018 12:19:13 +0000 (20:19 +0800)
committerlaili <lai.li@zte.com.cn>
Thu, 23 Aug 2018 12:19:13 +0000 (20:19 +0800)
Implement the biz for fetching a nsd content.

Change-Id: I8b5b377e43747ca30caf853fcdcb7930d587b97c
Issue-ID: VFC-1037
Signed-off-by: laili <lai.li@zte.com.cn>
catalog/packages/biz/ns_descriptor.py

index 7983c7d..97244ad 100644 (file)
@@ -155,5 +155,15 @@ def upload(remote_file, nsd_info_id):
             local_file.write(data)
 
 
+def download(nsd_info_id):
+    ns_pkgs = NSPackageModel.objects.filter(nsPackageId=nsd_info_id)
+    if not ns_pkgs.exists():
+        raise CatalogException('The PNF Descriptor (%s) does not exist.' % nsd_info_id)
+    if ns_pkgs[0].onboardingState != 'ONBOARDED':
+        raise CatalogException('The PNF Descriptor (%s) is not ONBOARDED.' % nsd_info_id)
+    local_file_path = ns_pkgs[0].localFilePath
+    return local_file_path
+
+
 def fill_resp_data(ns_pkg):
     pass