Saves and restores VNFD storage and compute data to workaround Pyangbind issue with... 24/10024/1
authorgarciaale <agarcia@whitestack.com>
Tue, 24 Nov 2020 15:44:21 +0000 (12:44 -0300)
committergarciaale <agarcia@whitestack.com>
Tue, 24 Nov 2020 15:44:21 +0000 (12:44 -0300)
Change-Id: Ie8db8354fd016c9a43bfc011149485747a67f186
Signed-off-by: garciaale <agarcia@whitestack.com>
osm_nbi/descriptor_topics.py

index c752c6c..4e056f5 100644 (file)
@@ -457,12 +457,18 @@ class VnfdTopic(DescriptorTopic):
 
     def pyangbind_validation(self, item, data, force=False):
         try:
+            virtual_compute_descriptors = data.get('virtual-compute-desc')
+            virtual_storage_descriptors = data.get('virtual-storage-desc')
             myvnfd = etsi_nfv_vnfd.etsi_nfv_vnfd()
             pybindJSONDecoder.load_ietf_json({'etsi-nfv-vnfd:vnfd': data}, None, None, obj=myvnfd,
                                              path_helper=True, skip_unknown=force)
             out = pybindJSON.dumps(myvnfd, mode="ietf")
             desc_out = self._remove_envelop(yaml.safe_load(out))
             desc_out = self._remove_yang_prefixes_from_descriptor(desc_out)
+            if virtual_compute_descriptors:
+                desc_out['virtual-compute-desc'] = virtual_compute_descriptors
+            if virtual_storage_descriptors:
+                desc_out['virtual-storage-desc'] = virtual_storage_descriptors
             return desc_out
         except Exception as e:
             raise EngineException("Error in pyangbind validation: {}".format(str(e)),