+ def check_if_nsr_is_not_slice_member(session, nsr_id):
+ nsis = None
+ db_filter = self._get_project_filter(session)
+ db_filter["_admin.nsrs-detailed-list.ANYINDEX.nsrId"] = nsr_id
+ nsis = self.db.get_one("nsis", db_filter, fail_on_empty=False, fail_on_more=False)
+ if nsis:
+ raise EngineException("The NS instance {} cannot be terminate because is used by the slice {}".format(
+ nsr_id, nsis["_id"]), http_code=HTTPStatus.CONFLICT)
+