+ def _check_dependencies_on_descriptor(self, session, item, descriptor_id):
+ """
+ Check that the descriptor to be deleded is not a dependency of others
+ :param session: client session information
+ :param item: can be vnfds, nsds
+ :param descriptor_id: id of descriptor to be deleted
+ :return: None or raises exception
+ """
+ if item == "vnfds":
+ _filter = {"constituent-vnfd.ANYINDEX.vnfd-id-ref": descriptor_id}
+ if self.get_item_list(session, "nsds", _filter):
+ raise EngineException("There are nsd that depends on this VNFD", http_code=HTTPStatus.CONFLICT)
+ elif item == "nsds":
+ _filter = {"nsdId": descriptor_id}
+ if self.get_item_list(session, "nsrs", _filter):
+ raise EngineException("There are nsr that depends on this NSD", http_code=HTTPStatus.CONFLICT)
+
+ def _check_descriptor_dependencies(self, session, item, descriptor):
+ """
+ Check that the dependent descriptors exist on a new descriptor or edition
+ :param session: client session information
+ :param item: can be nsds, nsrs
+ :param descriptor: descriptor to be inserted or edit
+ :return: None or raises exception
+ """
+ if item == "nsds":
+ if not descriptor.get("constituent-vnfd"):
+ return
+ for vnf in descriptor["constituent-vnfd"]:
+ vnfd_id = vnf["vnfd-id-ref"]
+ if not self.get_item_list(session, "vnfds", {"id": vnfd_id}):
+ raise EngineException("Descriptor error at 'constituent-vnfd':'vnfd-id-ref'='{}' references a non "
+ "existing vnfd".format(vnfd_id), http_code=HTTPStatus.CONFLICT)
+ elif item == "nsrs":
+ if not descriptor.get("nsdId"):
+ return
+ nsd_id = descriptor["nsdId"]
+ if not self.get_item_list(session, "nsds", {"id": nsd_id}):
+ raise EngineException("Descriptor error at nsdId='{}' references a non exist nsd".format(nsd_id),
+ http_code=HTTPStatus.CONFLICT)
+
+ def _validate_new_data(self, session, item, indata, id=None, force=False):