From: tierno Date: Thu, 21 May 2020 15:09:22 +0000 (+0000) Subject: fix problem vnfpkg internal-vlds without name X-Git-Tag: v7.1.0rc2~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=08c63d9b8b6f9a43c5287fa6e8017c44f76fda60;p=osm%2FNBI.git fix problem vnfpkg internal-vlds without name Change-Id: I06fba0317f13e6691b7d9c41177d1178dbd26d2b Signed-off-by: tierno --- diff --git a/osm_nbi/descriptor_topics.py b/osm_nbi/descriptor_topics.py index c1c1f63..fdf46e5 100644 --- a/osm_nbi/descriptor_topics.py +++ b/osm_nbi/descriptor_topics.py @@ -569,13 +569,14 @@ class VnfdTopic(DescriptorTopic): vld_names = [] # For detection of duplicated VLD names for ivld in get_iterable(indata.get("internal-vld")): # BEGIN Detection of duplicated VLD names - ivld_name = ivld["name"] - if ivld_name in vld_names: - raise EngineException("Duplicated VLD name '{}' in vnfd[id={}]:internal-vld[id={}]" - .format(ivld["name"], indata["id"], ivld["id"]), - http_code=HTTPStatus.UNPROCESSABLE_ENTITY) - else: - vld_names.append(ivld_name) + ivld_name = ivld.get("name") + if ivld_name: + if ivld_name in vld_names: + raise EngineException("Duplicated VLD name '{}' in vnfd[id={}]:internal-vld[id={}]" + .format(ivld["name"], indata["id"], ivld["id"]), + http_code=HTTPStatus.UNPROCESSABLE_ENTITY) + else: + vld_names.append(ivld_name) # END Detection of duplicated VLD names for icp in get_iterable(ivld.get("internal-connection-point")): icp_mark = False diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index b73d85f..6ac3bce 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -596,7 +596,7 @@ class NsLcmOpTopic(BaseTopic): for in_ivld in get_iterable(in_vnfd.get("internal-vld")): for ivld in get_iterable(vnfd.get("internal-vld")): - if in_ivld["name"] == ivld["name"] or in_ivld["name"] == ivld["id"]: + if in_ivld["name"] in (ivld["id"], ivld.get("name")): for in_icp in get_iterable(in_ivld.get("internal-connection-point")): for icp in ivld["internal-connection-point"]: if in_icp["id-ref"] == icp["id-ref"]: