Fixes 1367 by preventing pyang discard repeated constituent-base-element-id 04/10104/1
authorgarciaale <agarcia@whitestack.com>
Fri, 11 Dec 2020 23:04:11 +0000 (20:04 -0300)
committergarciaale <agarcia@whitestack.com>
Fri, 11 Dec 2020 23:04:11 +0000 (20:04 -0300)
Change-Id: I5b692498b04494a2182ebc5e1ef28fbcd3ba66be
Signed-off-by: garciaale <agarcia@whitestack.com>
osm_nbi/descriptor_topics.py

index 26aea63..ed958b1 100644 (file)
@@ -808,12 +808,15 @@ class NsdTopic(DescriptorTopic):
             raise EngineException("ERROR: Unsupported descriptor format. Please, use an ETSI SOL006 descriptor.",
                                   http_code=HTTPStatus.UNPROCESSABLE_ENTITY)
         try:
+            nsd_vnf_profiles = data.get('df', [{}])[0].get('vnf-profile', [])
             mynsd = etsi_nfv_nsd.etsi_nfv_nsd()
             pybindJSONDecoder.load_ietf_json({'nsd': {'nsd': [data]}}, None, None, obj=mynsd,
                                              path_helper=True, skip_unknown=force)
             out = pybindJSON.dumps(mynsd, mode="ietf")
             desc_out = self._remove_envelop(yaml.safe_load(out))
             desc_out = self._remove_yang_prefixes_from_descriptor(desc_out)
+            if nsd_vnf_profiles:
+                desc_out['df'][0]['vnf-profile'] = nsd_vnf_profiles
             return desc_out
         except Exception as e:
             raise EngineException("Error in pyangbind validation: {}".format(str(e)),