From f6e18747b91340b27efbf83026e052c2e361818d Mon Sep 17 00:00:00 2001 From: garciaale Date: Tue, 24 Nov 2020 12:44:21 -0300 Subject: [PATCH] Saves and restores VNFD storage and compute data to workaround Pyangbind issue with lost uint data Change-Id: Ie8db8354fd016c9a43bfc011149485747a67f186 Signed-off-by: garciaale --- osm_nbi/descriptor_topics.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osm_nbi/descriptor_topics.py b/osm_nbi/descriptor_topics.py index c752c6c..4e056f5 100644 --- a/osm_nbi/descriptor_topics.py +++ b/osm_nbi/descriptor_topics.py @@ -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)), -- 2.25.1