From: delacruzramo Date: Fri, 22 Nov 2019 14:06:43 +0000 (+0100) Subject: Fix bug 682: NSD cross references between vnffgd classifier and rsp not validated X-Git-Tag: v7.0.0rc1~13 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=6a92a53b64336df0d93eaf79eb0d53a9d5f9ba33;p=osm%2FNBI.git Fix bug 682: NSD cross references between vnffgd classifier and rsp not validated Change-Id: I759844b02afe870403ce317a7f3ec8826128bbbb Signed-off-by: delacruzramo --- diff --git a/osm_nbi/descriptor_topics.py b/osm_nbi/descriptor_topics.py index 58efa55..0939000 100644 --- a/osm_nbi/descriptor_topics.py +++ b/osm_nbi/descriptor_topics.py @@ -704,6 +704,19 @@ class NsdTopic(DescriptorTopic): "does not match any constituent-vnfd:member-vnf-index" .format(vld["id"], vnfd_cp["member-vnf-index-ref"]), http_code=HTTPStatus.UNPROCESSABLE_ENTITY) + # Check VNFFGD + for fgd in get_iterable(indata.get("vnffgd")): + for cls in get_iterable(fgd.get("classifier")): + rspref = cls.get("rsp-id-ref") + for rsp in get_iterable(fgd.get("rsp")): + rspid = rsp.get("id") + if rspid and rspref and rspid == rspref: + break + else: + raise EngineException( + "Error at vnffgd[id='{}']:classifier[id='{}']:rsp-id-ref '{}' does not match any rsp:id" + .format(fgd["id"], cls["id"], rspref), + http_code=HTTPStatus.UNPROCESSABLE_ENTITY) return indata def _validate_input_edit(self, indata, force=False):