Fix for Bug 1111 Reordering of format_out
[osm/NBI.git] / osm_nbi / instance_topics.py
index b4fae6a..f4d4c73 100644 (file)
@@ -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())