From: tierno Date: Thu, 4 Apr 2019 14:07:55 +0000 (+0200) Subject: Merge "Bug 637 NSD-level IP Profiles not working in mgmt-network fix single for loop... X-Git-Tag: v6.0.0~53 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=commitdiff_plain;h=1f1f6e03c7f6d6c1edd708e8d0b980827c7768ab;hp=-c Merge "Bug 637 NSD-level IP Profiles not working in mgmt-network fix single for loop to check for mgmt-network and ip-profiles" --- 1f1f6e03c7f6d6c1edd708e8d0b980827c7768ab diff --combined osm_nbi/descriptor_topics.py index 9f022f4,eef2ca4..a1c3c15 --- a/osm_nbi/descriptor_topics.py +++ b/osm_nbi/descriptor_topics.py @@@ -527,17 -527,7 +527,17 @@@ class VnfdTopic(DescriptorTopic) if not self._validate_package_folders(storage_params, 'charms'): raise EngineException("Charm defined in vnf[id={}] but not present in " "package".format(indata["id"])) + 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) + # END Detection of duplicated VLD names for icp in get_iterable(ivld.get("internal-connection-point")): icp_mark = False for vdu in get_iterable(indata.get("vdu")): @@@ -687,6 -677,10 +687,10 @@@ class NsdTopic(DescriptorTopic) # Cross references validation in the descriptor # TODO validata that if contains cloud-init-file or charms, have artifacts _admin.storage."pkg-dir" is not none for vld in get_iterable(indata.get("vld")): + if vld.get("mgmt-network") and vld.get("ip-profile-ref"): + raise EngineException("Error at vld[id='{}']:ip-profile-ref" + " You cannot set an ip-profile when mgmt-network is True" + .format(vld["id"]), http_code=HTTPStatus.UNPROCESSABLE_ENTITY) for vnfd_cp in get_iterable(vld.get("vnfd-connection-point-ref")): for constituent_vnfd in get_iterable(indata.get("constituent-vnfd")): if vnfd_cp["member-vnf-index-ref"] == constituent_vnfd["member-vnf-index"]: