BUG 402 : Rejecting a Descriptor without Management Network 32/5632/1
authorAnurag Dwivedi <anurag.dwivedi@riftio.com>
Mon, 30 Oct 2017 14:27:11 +0000 (10:27 -0400)
committerAnurag Dwivedi <anurag.dwivedi@riftio.com>
Mon, 30 Oct 2017 14:27:11 +0000 (10:27 -0400)
Signed-off-by: Anurag Dwivedi <anurag.dwivedi@riftio.com>
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/uploader.py

index 7aafcb9..38e2ae9 100644 (file)
@@ -457,8 +457,11 @@ class OnboardPackage(downloader.DownloaderProtocol):
             with pkg as temp_package:
                 package_checksums = self.validate_package(temp_package)
                 stored_package = self.store_package(temp_package)
-                self.validate_descriptor_fields(temp_package)
-
+                try:
+                    self.validate_descriptor_fields(temp_package)
+                except Exception as e:
+                    self.log.exception("Descriptor validation Failed")
+                    raise
                 try:
                     self.extract_icons(temp_package)
                     self.onboard_descriptors(temp_package)
@@ -588,8 +591,11 @@ class OnboardPackage(downloader.DownloaderProtocol):
     def validate_descriptor_fields(self, package):
         # We can add more VNFD/NSD validations here. 
         if package.descriptor_msg is not None:
-            self.validate_cloud_init_file(package)
-            self.validate_vld_mgmt_network(package)
+            try:
+                self.validate_cloud_init_file(package)
+                self.validate_vld_mgmt_network(package)
+            except Exception as e:
+                raise
 
     def validate_vld_mgmt_network(self, package):
         """ This is validation at onboarding of NSD for atleast one of the VL's to have mgmt network true
@@ -602,6 +608,7 @@ class OnboardPackage(downloader.DownloaderProtocol):
             else:
                 self.log.error(("AtLeast One of the VL's should have Management Network as True "
                                  "and have minimum one connection point"))
+                raise Exception("Management Network not defined.")
 
     def validate_cloud_init_file(self, package):
         """ This validation is for VNFDs with associated VDUs. """