validation.py: added nsi slice subnet and slice vld params 11/7011/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 30 Nov 2018 13:17:20 +0000 (14:17 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 30 Nov 2018 13:17:20 +0000 (14:17 +0100)
Change-Id: Iae405ca0c86bd48c79eaefef6ec8a3246611dc89
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_nbi/validation.py

index f0b8054..98fd511 100644 (file)
@@ -15,6 +15,7 @@
 
 from jsonschema import validate as js_v, exceptions as js_e
 from http import HTTPStatus
+from copy import deepcopy
 
 __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
 __version__ = "0.1"
@@ -575,6 +576,24 @@ nbi_edit_input_schemas = {
 }
 
 # NETSLICE SCHEMAS
+nsi_slice_instantiate = deepcopy(ns_instantiate)
+nsi_slice_instantiate["title"] = "netslice subnet instantiation params input schema"
+nsi_slice_instantiate["properties"]["id"] = name_schema
+nsi_slice_instantiate["required"].append("id")
+
+nsi_vld_instantiate = {
+    "title": "netslice vld instantiation params input schema",
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "type": "object",
+    "properties": {
+        "name": string_schema,
+        "vim-network-name": {"OneOf": [string_schema, object_schema]},
+        "ip-profile": object_schema,
+    },
+    "required": ["name"], 
+    "additionalProperties": False
+}
+
 nsi_instantiate = {
     "title": "netslice action instantiate input schema",
     "$schema": "http://json-schema.org/draft-04/schema#",
@@ -588,10 +607,15 @@ nsi_instantiate = {
         "vimAccountId": id_schema,
         "ssh_keys": {"type": "string"},
         "nsi_id": id_schema,
-        "ns": {
+        "netslice-subnet": {
+            "type": "array",
+            "minItems": 1,
+            "items": nsi_slice_instantiate
+        },
+        "netslice-vld": {
             "type": "array",
             "minItems": 1,
-            "items": ns_instantiate
+            "items": nsi_vld_instantiate
         },
     },
     "required": ["nsiName", "nstId", "vimAccountId"],