From: delacruzramo Date: Thu, 6 Feb 2020 13:37:01 +0000 (+0000) Subject: Fix Bug 1011: Multiple interface referenced to a single connection point X-Git-Tag: v7.1.0rc1~27 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F69%2F8569%2F2;p=osm%2FNBI.git Fix Bug 1011: Multiple interface referenced to a single connection point Change-Id: Idaff83f5f7cae88adb73896662ea61bdb1823407 Signed-off-by: delacruzramo --- diff --git a/osm_nbi/descriptor_topics.py b/osm_nbi/descriptor_topics.py index 2b42d06..bcd6a03 100644 --- a/osm_nbi/descriptor_topics.py +++ b/osm_nbi/descriptor_topics.py @@ -509,8 +509,17 @@ class VnfdTopic(DescriptorTopic): http_code=HTTPStatus.UNPROCESSABLE_ENTITY) for vdu in get_iterable(indata.get("vdu")): + icp_refs = [] + ecp_refs = [] for interface in get_iterable(vdu.get("interface")): if interface.get("external-connection-point-ref"): + if interface.get("external-connection-point-ref") in ecp_refs: + raise EngineException("vdu[id='{}']:interface[name='{}']:external-connection-point-ref='{}' " + "is referenced by other interface" + .format(vdu["id"], interface["name"], + interface["external-connection-point-ref"]), + http_code=HTTPStatus.UNPROCESSABLE_ENTITY) + ecp_refs.append(interface.get("external-connection-point-ref")) for cp in get_iterable(indata.get("connection-point")): if cp["name"] == interface["external-connection-point-ref"]: break @@ -520,8 +529,14 @@ class VnfdTopic(DescriptorTopic): .format(vdu["id"], interface["name"], interface["external-connection-point-ref"]), http_code=HTTPStatus.UNPROCESSABLE_ENTITY) - elif interface.get("internal-connection-point-ref"): + if interface.get("internal-connection-point-ref") in icp_refs: + raise EngineException("vdu[id='{}']:interface[name='{}']:internal-connection-point-ref='{}' " + "is referenced by other interface" + .format(vdu["id"], interface["name"], + interface["internal-connection-point-ref"]), + http_code=HTTPStatus.UNPROCESSABLE_ENTITY) + icp_refs.append(interface.get("internal-connection-point-ref")) for internal_cp in get_iterable(vdu.get("internal-connection-point")): if interface["internal-connection-point-ref"] == internal_cp.get("id"): break