Add openflow-port-mapping CLI command
[osm/openvim.git] / vim_schema.py
index f0aecb7..c2dc1e2 100644 (file)
@@ -2,7 +2,7 @@
 
 ##
 # Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
-# This file is part of openmano
+# This file is part of openvim
 # All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -73,8 +73,8 @@ config_schema = {
         "of_controller_nets_with_same_vlan": {"type" : "boolean"},
         "of_controller": nameshort_schema, #{"type":"string", "enum":["floodlight", "opendaylight"]},
         "of_controller_module": {"type":"string"},
-        #"of_user": nameshort_schema,
-        #"of_password": nameshort_schema,
+        "of_user": nameshort_schema,
+        "of_password": nameshort_schema,
         "test_mode": {"type": "boolean"}, #leave for backward compatibility
         "mode": {"type":"string", "enum":["normal", "host only", "OF only", "development", "test"] },
         "development_bridge": {"type":"string"},
@@ -117,12 +117,16 @@ config_schema = {
         "log_level": log_level_schema,
         "log_level_db": log_level_schema,
         "log_level_of": log_level_schema,
+        "network_type": {"type": "string", "enum": ["ovs", "bridge"]},
+        "ovs_controller_file_path": path_schema,
+        "ovs_controller_user": nameshort_schema,
+
+        "ovs_controller_ip": nameshort_schema
     },
     "patternProperties": {
         "of_*" : {"type": ["string", "integer", "boolean"]}
     },
-    "required": ['db_host', 'db_user', 'db_passwd', 'db_name',
-            'of_controller_ip', 'of_controller_port', 'of_controller_dpid', 'bridge_ifaces', 'of_controller'],
+    "required": ['db_host', 'db_user', 'db_passwd', 'db_name'],
     "additionalProperties": False
 }
 
@@ -142,8 +146,6 @@ metadata_schema={
     }
 }
 
-
-
 tenant_new_schema = {
     "title":"tenant creation information schema",
     "$schema": "http://json-schema.org/draft-04/schema#",
@@ -163,6 +165,7 @@ tenant_new_schema = {
     "required": ["tenant"],
     "additionalProperties": False
 }
+
 tenant_edit_schema = {
     "title":"tenant edition information schema",
     "$schema": "http://json-schema.org/draft-04/schema#",
@@ -273,7 +276,7 @@ host_data_schema={
                 "type": "object",
                 "properties":{
                     "admin_state_up":{"type":"boolean"},
-                    "hugepages":integer1_schema,
+                    "hugepages":integer0_schema,
                     "cores":{
                         "type": "array",
                         "minItems":2,
@@ -324,7 +327,7 @@ host_data_schema={
                     "memory":integer1_schema
                 },
                 "additionalProperties": False,
-                "required": ["hugepages","cores","numa_socket"]
+                "required": ["cores","numa_socket"]
             }
         }
     },
@@ -608,6 +611,7 @@ network_new_schema = {
     "required": ["network"],
     "additionalProperties": False
 }
+
 network_update_schema = {
     "title":"network update information schema",
     "$schema": "http://json-schema.org/draft-04/schema#",
@@ -625,8 +629,8 @@ network_update_schema = {
                 "provider:physical":net_bind_schema,
                 "cidr":cidr_schema,
                 "enable_dhcp": {"type":"boolean"},
-                "dhcp_first_ip": ip_schema,
-                "dhcp_last_ip": ip_schema,
+                "dhcp_first_ip": ip_schema,
+                "dhcp_last_ip": ip_schema,
                 "bind_net":name_schema, #can be name, or uuid
                 "bind_type":{"oneOf":[{"type":"null"},{"type":"string", "pattern":"^vlan:[0-9]{1,4}$"}]}
             },
@@ -710,3 +714,54 @@ hostinfo_schema = {
     },
     "required": ["iface_names"]
 }
+
+openflow_controller_schema = {
+    "title": "network creation information schema",
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "type": "object",
+    "properties": {
+        "ofc": {
+            "type": "object",
+            "properties": {
+                "name": name_schema,
+                "dpid": nameshort_schema,
+                "ip": nameshort_schema,
+                "port": port_schema,
+                "type": nameshort_schema,
+                "version": nametiny_schema,
+                "user": nameshort_schema,
+                "password": nameshort_schema
+            },
+            "required": ["dpid", "type", "ip", "port", "name"]
+        }
+    },
+    "required": ["ofc"],
+    "additionalProperties": False
+}
+
+of_port_new_schema = {
+    "title": "OF port mapping",
+    "type": "object",
+    "properties": {
+        "ofc_id": id_schema,
+        "region": nameshort_schema,
+        "compute_node": nameshort_schema,
+        "pci": pci_schema,
+        "switch_dpid": nameshort_schema,
+        "switch_port": nameshort_schema,
+        "switch_mac": mac_schema
+    },
+    "required": ["region", "compute_node",  "pci", "switch_dpid"]
+}
+
+of_port_map_new_schema = {
+    "title": "OF port mapping",
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "type": "object",
+    "properties": {
+        "of_port_mapings": {"type": "array", "items": of_port_new_schema, "minLenght":1},
+    },
+    "required": ["of_port_mapings"],
+    "additionalProperties": False
+
+}
\ No newline at end of file