X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fadmin_topics.py;h=5b37bf0204ba9476d0d886208d75efa7867a2cd8;hp=ada9c7b11502fc5ce67dc78cf9a663f40d8f467b;hb=35c998bd4ba1218c67b7c89f709b63f5268ed83c;hpb=cea9591384b32a78fd44bf26ea7129498be034d6 diff --git a/osm_nbi/admin_topics.py b/osm_nbi/admin_topics.py index ada9c7b..5b37bf0 100644 --- a/osm_nbi/admin_topics.py +++ b/osm_nbi/admin_topics.py @@ -368,6 +368,21 @@ class VimAccountTopic(CommonVimWimSdn): config_to_encrypt = {"1.1": ("admin_password", "nsx_password", "vcenter_password"), "default": ("admin_password", "nsx_password", "vcenter_password", "vrops_password")} + def check_conflict_on_del(self, session, _id, db_content): + """ + Check if deletion can be done because of dependencies if it is not force. To override + :param session: contains "username", "admin", "force", "public", "project_id", "set_project" + :param _id: internal _id + :param db_content: The database content of this item _id + :return: None if ok or raises EngineException with the conflict + """ + if session["force"]: + return + # check if used by VNF + if self.db.get_list("vnfrs", {"vim-account-id": _id}): + raise EngineException("There is at least one VNF using this VIM account", http_code=HTTPStatus.CONFLICT) + super().check_conflict_on_del(session, _id, db_content) + class WimAccountTopic(CommonVimWimSdn): topic = "wim_accounts"