From: garciaale Date: Fri, 11 Dec 2020 23:04:11 +0000 (-0300) Subject: Fixes 1367 by preventing pyang discard repeated constituent-base-element-id X-Git-Tag: release-v9.0-start~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=341ac1bac7b115d64a50ec166aa5e6d186b39443;p=osm%2FNBI.git Fixes 1367 by preventing pyang discard repeated constituent-base-element-id Change-Id: I5b692498b04494a2182ebc5e1ef28fbcd3ba66be Signed-off-by: garciaale --- 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)),