From 341ac1bac7b115d64a50ec166aa5e6d186b39443 Mon Sep 17 00:00:00 2001 From: garciaale Date: Fri, 11 Dec 2020 20:04:11 -0300 Subject: [PATCH] Fixes 1367 by preventing pyang discard repeated constituent-base-element-id Change-Id: I5b692498b04494a2182ebc5e1ef28fbcd3ba66be Signed-off-by: garciaale --- osm_nbi/descriptor_topics.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osm_nbi/descriptor_topics.py b/osm_nbi/descriptor_topics.py index 26aea63..ed958b1 100644 --- a/osm_nbi/descriptor_topics.py +++ b/osm_nbi/descriptor_topics.py @@ -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)), -- 2.25.1