Bugzilla - Bug 2101 : Vertical Scaling Json schema issue
[osm/NBI.git] / osm_nbi / validation.py
index 3fec364..a17e241 100644 (file)
@@ -449,7 +449,7 @@ ns_update = {
         "nsInstanceId": id_schema,
         "timeout_ns_update": integer1_schema,
         "updateType": {
-            "enum": ["CHANGE_VNFPKG", "REMOVE_VNF", "MODIFY_VNF_INFORMATION"]
+            "enum": ["CHANGE_VNFPKG", "REMOVE_VNF", "MODIFY_VNF_INFORMATION", "OPERATE_VNF"]
         },
         "modifyVnfInfoData": {
             "type": "object",
@@ -468,6 +468,24 @@ ns_update = {
             },
             "required": ["vnfInstanceId", "vnfdId"],
         },
+        "operateVnfData": {
+            "type": "object",
+            "properties": {
+                "vnfInstanceId": id_schema,
+                "changeStateTo": name_schema,
+                "additionalParam": {
+                    "type": "object",
+                    "properties": {
+                        "run-day1": bool_schema,
+                        "vdu_id": name_schema,
+                        "count-index": integer0_schema,
+                    },
+                    "required": ["vdu_id", "count-index"],
+                    "additionalProperties": False,
+                }
+            },
+            "required": ["vnfInstanceId", "changeStateTo"],
+        }
     },
     "required": ["updateType"],
     "additionalProperties": False,
@@ -492,6 +510,7 @@ ns_action = {  # TODO for the moment it is only contemplated the vnfd primitive
     "required": ["primitive", "primitive_params"],  # TODO add member_vnf_index
     "additionalProperties": False,
 }
+
 ns_scale = {  # TODO for the moment it is only VDU-scaling
     "title": "ns scale input schema",
     "$schema": "http://json-schema.org/draft-04/schema#",
@@ -549,6 +568,82 @@ ns_migrate = {
     "additionalProperties": False
 }
 
+ns_heal = {
+    "title": "ns heal input schema",
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "type": "object",
+    "properties": {
+        "lcmOperationType": string_schema,
+        "nsInstanceId": id_schema,
+        "timeout_ns_heal": integer1_schema,
+        "healVnfData": {
+            "type": "array",
+            "items": {
+                "type": "object",
+                "properties": {
+                    "vnfInstanceId": id_schema,
+                    "cause": description_schema,
+                    "additionalParams": {
+                        "type": "object",
+                        "properties": {
+                            "run-day1": bool_schema,
+                            "vdu": {
+                                "type": "array",
+                                "items": {
+                                    "type": "object",
+                                    "properties": {
+                                        "run-day1": bool_schema,
+                                        "vdu-id": name_schema,
+                                        "count-index": integer0_schema,
+                                    },
+                                    "required": ["vdu-id"],
+                                    "additionalProperties": False,
+                                },
+                            },
+                        },
+                        "additionalProperties": False,
+                    },
+                },
+                "required": ["vnfInstanceId"],
+                "additionalProperties": False,
+            },
+        },
+    },
+    "required": ["healVnfData"],
+    "additionalProperties": False,
+}
+
+ns_verticalscale = {
+    "title": "vertial scale input schema",
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "type": "object",
+    "properties": {
+        "lcmOperationType": string_schema,
+        "verticalScale": string_schema,
+        "nsInstanceId": id_schema,
+        "changeVnfFlavorData": {
+            "type": "object",
+            "properties": {
+                "vnfInstanceId": id_schema,
+                "additionalParams": {
+                    "type": "object",
+                    "properties": {
+                        "vduid": string_schema,
+                        "vduCountIndex": integer0_schema,
+                        "virtualMemory": integer1_schema,
+                        "sizeOfStorage": integer0_schema,
+                        "numVirtualCpu": integer1_schema,
+                        },
+                    }
+                },
+            "required": ["vnfInstanceId", "additionalParams"],
+            "additionalProperties": False,
+            }
+        },
+    "required": ["lcmOperationType", "verticalScale", "nsInstanceId"],
+    "additionalProperties": False,
+}
+
 schema_version = {"type": "string", "enum": ["1.0"]}
 schema_type = {"type": "string"}
 vim_type = shortname_schema  # {"enum": ["openstack", "openvim", "vmware", "opennebula", "aws", "azure", "fos"]}
@@ -718,6 +813,18 @@ sdn_external_port_schema = {
 }
 
 # K8s Clusters
+k8scluster_deploy_method_schema = {
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "title": "Deployment methods for K8s cluster",
+    "type": "object",
+    "properties": {
+        "helm-chart": {"type": "boolean"},
+        "juju-bundle": {"type": "boolean"},
+        "helm-chart-v3": {"type": "boolean"},
+    },
+    "additionalProperties": False,
+    "minProperties": 3,
+}
 k8scluster_nets_schema = {
     "title": "k8scluster nets input schema",
     "$schema": "http://json-schema.org/draft-04/schema#",
@@ -740,6 +847,7 @@ k8scluster_new_schema = {
         "vca_id": id_schema,
         "k8s_version": string_schema,
         "nets": k8scluster_nets_schema,
+        "deployment_methods": k8scluster_deploy_method_schema,
         "namespace": name_schema,
         "cni": nameshort_list_schema,
     },
@@ -1104,6 +1212,7 @@ nbi_new_input_schemas = {
     "ns_action": ns_action,
     "ns_scale": ns_scale,
     "ns_update": ns_update,
+    "ns_heal": ns_heal,
     "pdus": pdu_new_schema,
 }