Allow ovim parameters at config file. Fix an issue at network deletion
[osm/RO.git] / openmano_schemas.py
index a8c92a0..1dfcffe 100644 (file)
@@ -80,11 +80,16 @@ config_schema = {
         "http_port": port_schema,
         "http_admin_port": port_schema,
         "http_host": nameshort_schema,
+        "auto_push_VNF_to_VIMs": {"type":"boolean"},
         "vnf_repository": path_schema,
         "db_host": nameshort_schema,
         "db_user": nameshort_schema,
         "db_passwd": {"type":"string"},
         "db_name": nameshort_schema,
+        "db_ovim_host": nameshort_schema,
+        "db_ovim_user": nameshort_schema,
+        "db_ovim_passwd": {"type":"string"},
+        "db_ovim_name": nameshort_schema,
         # Next fields will disappear once the MANO API includes appropriate primitives
         "vim_url": http_schema,
         "vim_url_admin": http_schema,
@@ -107,15 +112,19 @@ config_schema = {
         "log_level_vim": log_level_schema,
         "log_level_nfvo": log_level_schema,
         "log_level_http": log_level_schema,
+        "log_level_console": log_level_schema,
+        "log_level_ovim": log_level_schema,
         "log_file_db": path_schema,
         "log_file_vim": path_schema,
         "log_file_nfvo": path_schema,
         "log_file_http": path_schema,
+        "log_file_console": path_schema,
+        "log_file_ovim": path_schema,
         "log_socket_host": nameshort_schema,
         "log_socket_port": port_schema,
         "log_file": path_schema,
     },
-    "required": ['db_host', 'db_user', 'db_passwd', 'db_name'],
+    "required": ['db_user', 'db_passwd', 'db_name'],
     "additionalProperties": False
 }
 
@@ -495,6 +504,37 @@ numa_schema = {
     #"required": ["memory"]
 }
 
+config_files_schema = {
+    "title": "Config files for cloud init schema",
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "type": "object",
+    "properties": {
+        "dest": path_schema,
+        "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]},  #by default text
+        "content": {"type": "string"},
+        "permissions": {"type": "string"}, # tiypically octal notation '0644'
+        "owner": {"type": "string"},  # format:   owner:group
+
+    },
+    "additionalProperties": False,
+    "required": ["dest", "content"],
+}
+
+boot_data_vdu_schema  = {
+    "title": "Boot data (Cloud-init) configuration schema",
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "type": "object",
+    "properties":{
+        "key-pairs": {"type" : "array", "items": {"type":"string"}},
+        "users": {"type" : "array", "items": cloud_config_user_schema},
+        "user-data": {"type" : "string"},  # scrip to run
+        "config-files": {"type": "array", "items": config_files_schema},
+        # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data
+        "boot-data-drive": {"type": "boolean"},
+    },
+    "additionalProperties": False,
+}
+
 vnfc_schema = {
     "type":"object",
     "properties":{
@@ -529,7 +569,8 @@ vnfc_schema = {
             "items": numa_schema
         },
         "bridge-ifaces": bridge_interfaces_schema,
-        "devices": devices_schema
+        "devices": devices_schema,
+        "boot-data" : boot_data_vdu_schema
         
     },
     "required": ["name"],
@@ -1060,3 +1101,75 @@ instance_scenario_action_schema = {
     #"maxProperties": 1,
     "additionalProperties": False
 }
+
+sdn_controller_properties={
+    "name": name_schema,
+    "dpid": {"type":"string", "pattern":"^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){7}$"},
+    "ip": ip_schema,
+    "port": port_schema,
+    "type": {"type": "string", "enum": ["opendaylight","floodlight","onos"]},
+    "version": {"type" : "string", "minLength":1, "maxLength":12},
+    "user": nameshort_schema,
+    "password": passwd_schema
+}
+sdn_controller_schema = {
+    "title":"sdn controller information schema",
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "type":"object",
+    "properties":{
+        "sdn_controller":{
+            "type":"object",
+            "properties":sdn_controller_properties,
+            "required": ["name", "port", 'ip', 'dpid', 'type'],
+            "additionalProperties": False
+        }
+    },
+    "required": ["sdn_controller"],
+    "additionalProperties": False
+}
+
+sdn_controller_edit_schema = {
+    "title":"sdn controller update information schema",
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "type":"object",
+    "properties":{
+        "sdn_controller":{
+            "type":"object",
+            "properties":sdn_controller_properties,
+            "additionalProperties": False
+        }
+    },
+    "required": ["sdn_controller"],
+    "additionalProperties": False
+}
+
+sdn_port_mapping_schema  = {
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "title":"sdn port mapping information schema",
+    "type": "object",
+    "properties": {
+        "sdn_port_mapping": {
+            "type": "array",
+            "items": {
+                "type": "object",
+                "properties": {
+                    "compute_node": nameshort_schema,
+                    "ports": {
+                        "type": "array",
+                        "items": {
+                            "type": "object",
+                            "properties": {
+                                "pci": pci_schema,
+                                "switch_port": nameshort_schema,
+                                "switch_mac": mac_schema
+                            },
+                            "required": ["pci"]
+                        }
+                    }
+                },
+                "required": ["compute_node", "ports"]
+            }
+        }
+    },
+    "required": ["sdn_port_mapping"]
+}
\ No newline at end of file