From deb4bc200ad478fe1178a0cd386ecbc8ae3a069f Mon Sep 17 00:00:00 2001 From: Frank Bryden Date: Tue, 28 Jul 2020 12:50:23 +0000 Subject: [PATCH] Before creating a Network Slice, check underlying NST is not in DISABLED state Change-Id: If58bd7fb17e807293b79141f18653fd3350531c5 Signed-off-by: Frank Bryden --- osm_nbi/instance_topics.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index b4fae6a..f4d4c73 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -1271,6 +1271,12 @@ class NsiTopic(BaseTopic): nstd = self.db.get_one("nsts", _filter) del _filter["_id"] + # check NSD is not disabled + step = "checking operationalState" + if nstd["_admin"]["operationalState"] == "DISABLED": + raise EngineException("nst with id '{}' is DISABLED, and thus cannot be used to create " + "a network slice".format(slice_request["nstId"]), http_code=HTTPStatus.CONFLICT) + nstd.pop("_admin", None) nstd_id = nstd.pop("_id", None) nsi_id = str(uuid4()) -- 2.25.1