| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
| 3 | ## |
| tierno | 9202102 | 2018-09-12 16:29:23 +0200 | [diff] [blame] | 4 | # Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U. |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 5 | # This file is part of openmano |
| 6 | # All Rights Reserved. |
| 7 | # |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 9 | # not use this file except in compliance with the License. You may obtain |
| 10 | # a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 16 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 17 | # License for the specific language governing permissions and limitations |
| 18 | # under the License. |
| 19 | # |
| 20 | # For those usages not covered by the Apache License, Version 2.0 please |
| 21 | # contact with: nfvlabs@tid.es |
| 22 | ## |
| 23 | |
| 24 | ''' |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 25 | JSON schemas used by openmano httpserver.py module to parse the different files and messages sent through the API |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 26 | ''' |
| montesmoreno | 0c8def0 | 2016-12-22 12:16:23 +0000 | [diff] [blame] | 27 | __author__="Alfonso Tierno, Gerardo Garcia, Pablo Montes" |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 28 | __date__ ="$09-oct-2014 09:09:48$" |
| 29 | |
| 30 | #Basis schemas |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 31 | patern_name="^[ -~]+$" |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 32 | passwd_schema={"type" : "string", "minLength":1, "maxLength":60} |
| 33 | nameshort_schema={"type" : "string", "minLength":1, "maxLength":60, "pattern" : "^[^,;()'\"]+$"} |
| 34 | name_schema={"type" : "string", "minLength":1, "maxLength":255, "pattern" : "^[^,;()'\"]+$"} |
| 35 | xml_text_schema={"type" : "string", "minLength":1, "maxLength":1000, "pattern" : "^[^']+$"} |
| 36 | description_schema={"type" : ["string","null"], "maxLength":255, "pattern" : "^[^'\"]+$"} |
| 37 | id_schema_fake = {"type" : "string", "minLength":2, "maxLength":36 } #"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" |
| 38 | id_schema = {"type" : "string", "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"} |
| 39 | pci_schema={"type":"string", "pattern":"^[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}\.[0-9a-fA-F]$"} |
| tierno | 20a608c | 2018-10-02 13:43:47 +0200 | [diff] [blame] | 40 | # allows [] for wildcards. For that reason huge length limit is set |
| 41 | pci_extended_schema = {"type": "string", "pattern": "^[0-9a-fA-F.:-\[\]]{12,40}$"} |
| tierno | 7f426e9 | 2018-06-28 15:21:32 +0200 | [diff] [blame] | 42 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 43 | http_schema={"type":"string", "pattern":"^https?://[^'\"=]+$"} |
| 44 | bandwidth_schema={"type":"string", "pattern" : "^[0-9]+ *([MG]bps)?$"} |
| 45 | memory_schema={"type":"string", "pattern" : "^[0-9]+ *([MG]i?[Bb])?$"} |
| 46 | integer0_schema={"type":"integer","minimum":0} |
| 47 | integer1_schema={"type":"integer","minimum":1} |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 48 | path_schema={"type":"string", "pattern":"^(\.){0,2}(/[^/\"':{}\(\)]+)+$"} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 49 | vlan_schema={"type":"integer","minimum":1,"maximum":4095} |
| 50 | vlan1000_schema={"type":"integer","minimum":1000,"maximum":4095} |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 51 | mac_schema={"type":"string", "pattern":"^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){5}$"} #must be unicast LSB bit of MSB byte ==0 |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 52 | #mac_schema={"type":"string", "pattern":"^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$"} |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 53 | ip_schema={"type":"string","pattern":"^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"} |
| 54 | ip_prefix_schema={"type":"string","pattern":"^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/(30|[12]?[0-9])$"} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 55 | port_schema={"type":"integer","minimum":1,"maximum":65534} |
| 56 | object_schema={"type":"object"} |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 57 | schema_version_2={"type":"integer","minimum":2,"maximum":2} |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 58 | #schema_version_string={"type":"string","enum": ["0.1", "2", "0.2", "3", "0.3"]} |
| tierno | ae4a8d1 | 2016-07-08 12:30:39 +0200 | [diff] [blame] | 59 | log_level_schema={"type":"string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]} |
| garciadeblas | b69fa9f | 2016-09-28 12:04:10 +0200 | [diff] [blame] | 60 | checksum_schema={"type":"string", "pattern":"^[0-9a-fA-F]{32}$"} |
| montesmoreno | 0c8def0 | 2016-12-22 12:16:23 +0000 | [diff] [blame] | 61 | size_schema={"type":"integer","minimum":1,"maximum":100} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 62 | |
| 63 | metadata_schema={ |
| 64 | "type":"object", |
| 65 | "properties":{ |
| 66 | "architecture": {"type":"string"}, |
| 67 | "use_incremental": {"type":"string","enum":["yes","no"]}, |
| 68 | "vpci": pci_schema, |
| 69 | "os_distro": {"type":"string"}, |
| 70 | "os_type": {"type":"string"}, |
| 71 | "os_version": {"type":"string"}, |
| 72 | "bus": {"type":"string"}, |
| 73 | "topology": {"type":"string", "enum": ["oneSocket"]} |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | #Schema for the configuration file |
| 78 | config_schema = { |
| 79 | "title":"configuration response information schema", |
| 80 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 81 | "type":"object", |
| 82 | "properties":{ |
| 83 | "http_port": port_schema, |
| 84 | "http_admin_port": port_schema, |
| 85 | "http_host": nameshort_schema, |
| tierno | d29b1d3 | 2017-01-25 11:02:52 +0100 | [diff] [blame] | 86 | "auto_push_VNF_to_VIMs": {"type":"boolean"}, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 87 | "vnf_repository": path_schema, |
| 88 | "db_host": nameshort_schema, |
| 89 | "db_user": nameshort_schema, |
| 90 | "db_passwd": {"type":"string"}, |
| 91 | "db_name": nameshort_schema, |
| tierno | 639520f | 2017-04-05 19:55:36 +0200 | [diff] [blame] | 92 | "db_ovim_host": nameshort_schema, |
| 93 | "db_ovim_user": nameshort_schema, |
| 94 | "db_ovim_passwd": {"type":"string"}, |
| 95 | "db_ovim_name": nameshort_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 96 | # Next fields will disappear once the MANO API includes appropriate primitives |
| 97 | "vim_url": http_schema, |
| 98 | "vim_url_admin": http_schema, |
| 99 | "vim_name": nameshort_schema, |
| 100 | "vim_tenant_name": nameshort_schema, |
| 101 | "mano_tenant_name": nameshort_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 102 | "mano_tenant_id": id_schema, |
| tierno | 20fc2a2 | 2016-08-19 17:02:35 +0200 | [diff] [blame] | 103 | "http_console_proxy": {"type":"boolean"}, |
| 104 | "http_console_host": nameshort_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 105 | "http_console_ports": { |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 106 | "type": "array", |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 107 | "items": {"OneOf": [ |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 108 | port_schema, |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 109 | {"type": "object", "properties": {"from": port_schema, "to": port_schema}, "required": ["from", "to"]} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 110 | ]} |
| 111 | }, |
| tierno | ae4a8d1 | 2016-07-08 12:30:39 +0200 | [diff] [blame] | 112 | "log_level": log_level_schema, |
| tierno | 72f35a5 | 2016-07-15 13:18:30 +0200 | [diff] [blame] | 113 | "log_socket_level": log_level_schema, |
| tierno | ae4a8d1 | 2016-07-08 12:30:39 +0200 | [diff] [blame] | 114 | "log_level_db": log_level_schema, |
| tierno | 73ad9e4 | 2016-09-12 18:11:11 +0200 | [diff] [blame] | 115 | "log_level_vim": log_level_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 116 | "log_level_wim": log_level_schema, |
| tierno | f97fd27 | 2016-07-11 14:32:37 +0200 | [diff] [blame] | 117 | "log_level_nfvo": log_level_schema, |
| tierno | 73ad9e4 | 2016-09-12 18:11:11 +0200 | [diff] [blame] | 118 | "log_level_http": log_level_schema, |
| tierno | 1ae5134 | 2017-01-16 12:48:30 +0000 | [diff] [blame] | 119 | "log_level_console": log_level_schema, |
| tierno | 639520f | 2017-04-05 19:55:36 +0200 | [diff] [blame] | 120 | "log_level_ovim": log_level_schema, |
| tierno | 73ad9e4 | 2016-09-12 18:11:11 +0200 | [diff] [blame] | 121 | "log_file_db": path_schema, |
| 122 | "log_file_vim": path_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 123 | "log_file_wim": path_schema, |
| tierno | 73ad9e4 | 2016-09-12 18:11:11 +0200 | [diff] [blame] | 124 | "log_file_nfvo": path_schema, |
| 125 | "log_file_http": path_schema, |
| tierno | 1ae5134 | 2017-01-16 12:48:30 +0000 | [diff] [blame] | 126 | "log_file_console": path_schema, |
| tierno | 639520f | 2017-04-05 19:55:36 +0200 | [diff] [blame] | 127 | "log_file_ovim": path_schema, |
| tierno | 72f35a5 | 2016-07-15 13:18:30 +0200 | [diff] [blame] | 128 | "log_socket_host": nameshort_schema, |
| 129 | "log_socket_port": port_schema, |
| tierno | f97fd27 | 2016-07-11 14:32:37 +0200 | [diff] [blame] | 130 | "log_file": path_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 131 | }, |
| tierno | 639520f | 2017-04-05 19:55:36 +0200 | [diff] [blame] | 132 | "required": ['db_user', 'db_passwd', 'db_name'], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 133 | "additionalProperties": False |
| 134 | } |
| 135 | |
| 136 | tenant_schema = { |
| 137 | "title":"tenant information schema", |
| 138 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 139 | "type":"object", |
| 140 | "properties":{ |
| 141 | "tenant":{ |
| 142 | "type":"object", |
| 143 | "properties":{ |
| 144 | "name": nameshort_schema, |
| 145 | "description": description_schema, |
| 146 | }, |
| 147 | "required": ["name"], |
| 148 | "additionalProperties": True |
| 149 | } |
| 150 | }, |
| 151 | "required": ["tenant"], |
| 152 | "additionalProperties": False |
| 153 | } |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 154 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 155 | tenant_edit_schema = { |
| 156 | "title":"tenant edit information schema", |
| 157 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 158 | "type":"object", |
| 159 | "properties":{ |
| 160 | "tenant":{ |
| 161 | "type":"object", |
| 162 | "properties":{ |
| 163 | "name": name_schema, |
| 164 | "description": description_schema, |
| 165 | }, |
| 166 | "additionalProperties": False |
| 167 | } |
| 168 | }, |
| 169 | "required": ["tenant"], |
| 170 | "additionalProperties": False |
| 171 | } |
| 172 | |
| 173 | datacenter_schema_properties={ |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 174 | "name": name_schema, |
| 175 | "description": description_schema, |
| 176 | "type": nameshort_schema, #currently "openvim" or "openstack", can be enlarged with plugins |
| 177 | "vim_url": description_schema, |
| 178 | "vim_url_admin": description_schema, |
| 179 | "config": { "type":"object" } |
| 180 | } |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 181 | |
| 182 | datacenter_schema = { |
| 183 | "title":"datacenter information schema", |
| 184 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 185 | "type":"object", |
| 186 | "properties":{ |
| 187 | "datacenter":{ |
| 188 | "type":"object", |
| 189 | "properties":datacenter_schema_properties, |
| 190 | "required": ["name", "vim_url"], |
| 191 | "additionalProperties": True |
| 192 | } |
| 193 | }, |
| 194 | "required": ["datacenter"], |
| 195 | "additionalProperties": False |
| 196 | } |
| 197 | |
| 198 | |
| 199 | datacenter_edit_schema = { |
| 200 | "title":"datacenter edit nformation schema", |
| 201 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 202 | "type":"object", |
| 203 | "properties":{ |
| 204 | "datacenter":{ |
| 205 | "type":"object", |
| 206 | "properties":datacenter_schema_properties, |
| 207 | "additionalProperties": False |
| 208 | } |
| 209 | }, |
| 210 | "required": ["datacenter"], |
| 211 | "additionalProperties": False |
| 212 | } |
| 213 | |
| 214 | |
| 215 | netmap_new_schema = { |
| 216 | "title":"netmap new information schema", |
| 217 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 218 | "type":"object", |
| 219 | "properties":{ |
| 220 | "netmap":{ #delete from datacenter |
| 221 | "type":"object", |
| 222 | "properties":{ |
| 223 | "name": name_schema, #name or uuid of net to change |
| 224 | "vim_id": id_schema, |
| 225 | "vim_name": name_schema |
| 226 | }, |
| 227 | "minProperties": 1, |
| 228 | "additionalProperties": False |
| 229 | }, |
| 230 | }, |
| 231 | "required": ["netmap"], |
| 232 | "additionalProperties": False |
| 233 | } |
| 234 | |
| 235 | netmap_edit_schema = { |
| 236 | "title":"netmap edit information schema", |
| 237 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 238 | "type":"object", |
| 239 | "properties":{ |
| 240 | "netmap":{ #delete from datacenter |
| 241 | "type":"object", |
| 242 | "properties":{ |
| 243 | "name": name_schema, #name or uuid of net to change |
| 244 | }, |
| 245 | "minProperties": 1, |
| 246 | "additionalProperties": False |
| 247 | }, |
| 248 | }, |
| 249 | "required": ["netmap"], |
| 250 | "additionalProperties": False |
| 251 | } |
| 252 | |
| 253 | datacenter_action_schema = { |
| 254 | "title":"datacenter action information schema", |
| 255 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 256 | "type":"object", |
| 257 | "properties":{ |
| 258 | "net-update":{"type":"null",}, |
| 259 | "net-edit":{ |
| 260 | "type":"object", |
| 261 | "properties":{ |
| 262 | "net": name_schema, #name or uuid of net to change |
| 263 | "name": name_schema, |
| 264 | "description": description_schema, |
| 265 | "shared": {"type": "boolean"} |
| 266 | }, |
| 267 | "minProperties": 1, |
| 268 | "additionalProperties": False |
| 269 | }, |
| 270 | "net-delete":{ |
| 271 | "type":"object", |
| 272 | "properties":{ |
| 273 | "net": name_schema, #name or uuid of net to change |
| 274 | }, |
| 275 | "required": ["net"], |
| 276 | "additionalProperties": False |
| 277 | }, |
| 278 | }, |
| 279 | "minProperties": 1, |
| 280 | "maxProperties": 1, |
| 281 | "additionalProperties": False |
| 282 | } |
| 283 | |
| 284 | |
| 285 | datacenter_associate_schema={ |
| 286 | "title":"datacenter associate information schema", |
| 287 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 288 | "type":"object", |
| 289 | "properties":{ |
| 290 | "datacenter":{ |
| tierno | d3750b3 | 2018-07-20 15:33:08 +0200 | [diff] [blame] | 291 | "type": "object", |
| 292 | "properties": { |
| 293 | "name": name_schema, |
| 294 | "vim_id": id_schema, |
| tierno | 8008c3a | 2016-10-13 15:34:28 +0000 | [diff] [blame] | 295 | "vim_tenant": name_schema, |
| 296 | "vim_tenant_name": name_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 297 | "vim_username": nameshort_schema, |
| 298 | "vim_password": nameshort_schema, |
| tierno | 8008c3a | 2016-10-13 15:34:28 +0000 | [diff] [blame] | 299 | "config": {"type": "object"} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 300 | }, |
| tierno | d3750b3 | 2018-07-20 15:33:08 +0200 | [diff] [blame] | 301 | # "required": ["vim_tenant"], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 302 | "additionalProperties": True |
| 303 | } |
| 304 | }, |
| 305 | "required": ["datacenter"], |
| 306 | "additionalProperties": False |
| 307 | } |
| 308 | |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 309 | dhcp_schema = { |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 310 | "title": "DHCP schema", |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 311 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 312 | "type": "object", |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 313 | "properties":{ |
| 314 | "enabled": {"type": "boolean"}, |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 315 | "start-address": {"OneOf": [{"type": "null"}, ip_schema]}, |
| 316 | "count": integer0_schema |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 317 | }, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 318 | # "required": ["start-address", "count"], |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | ip_profile_schema = { |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 322 | "title": "IP profile schema", |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 323 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 324 | "type": "object", |
| 325 | "properties": { |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 326 | "ip-version": {"type": "string", "enum": ["IPv4", "IPv6"]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 327 | "subnet-address": ip_prefix_schema, |
| 328 | "gateway-address": ip_schema, |
| tierno | 455612d | 2017-05-30 16:40:10 +0200 | [diff] [blame] | 329 | "dns-address": {"oneOf": [ip_schema, # for backward compatibility |
| 330 | {"type": "array", "items": ip_schema}]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 331 | "dhcp": dhcp_schema |
| 332 | }, |
| 333 | } |
| 334 | |
| 335 | key_pair_schema = { |
| 336 | "title": "Key-pair schema for cloud-init configuration schema", |
| 337 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 338 | "type":"object", |
| 339 | "properties":{ |
| 340 | "name": name_schema, |
| 341 | "key": {"type":"string"} |
| 342 | }, |
| 343 | "required": ["key"], |
| 344 | "additionalProperties": False |
| 345 | } |
| 346 | |
| 347 | cloud_config_user_schema = { |
| 348 | "title": "User schema for cloud-init configuration schema", |
| 349 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 350 | "type":"object", |
| 351 | "properties":{ |
| 352 | "name": nameshort_schema, |
| 353 | "user-info": {"type":"string"}, |
| 354 | #"key-pairs": {"type" : "array", "items": key_pair_schema} |
| 355 | "key-pairs": {"type" : "array", "items": {"type":"string"}} |
| 356 | }, |
| 357 | "required": ["name"], |
| 358 | "additionalProperties": False |
| 359 | } |
| 360 | |
| 361 | cloud_config_schema = { |
| 362 | "title": "Cloud-init configuration schema", |
| 363 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 364 | "type":"object", |
| 365 | "properties":{ |
| 366 | #"key-pairs": {"type" : "array", "items": key_pair_schema}, |
| 367 | "key-pairs": {"type" : "array", "items": {"type":"string"}}, |
| 368 | "users": {"type" : "array", "items": cloud_config_user_schema} |
| 369 | }, |
| 370 | "additionalProperties": False |
| 371 | } |
| 372 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 373 | internal_connection_element_schema = { |
| 374 | "type":"object", |
| 375 | "properties":{ |
| 376 | "VNFC": name_schema, |
| 377 | "local_iface_name": name_schema |
| 378 | } |
| 379 | } |
| 380 | |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 381 | internal_connection_element_schema_v02 = { |
| 382 | "type":"object", |
| 383 | "properties":{ |
| 384 | "VNFC": name_schema, |
| 385 | "local_iface_name": name_schema, |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 386 | "ip_address": ip_schema |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 387 | } |
| 388 | } |
| 389 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 390 | internal_connection_schema = { |
| 391 | "type":"object", |
| 392 | "properties":{ |
| 393 | "name": name_schema, |
| 394 | "description":description_schema, |
| 395 | "type":{"type":"string", "enum":["bridge","data","ptp"]}, |
| tierno | 8e69032 | 2017-08-10 15:58:50 +0200 | [diff] [blame] | 396 | "elements": {"type" : "array", "items": internal_connection_element_schema, "minItems":1} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 397 | }, |
| 398 | "required": ["name", "type", "elements"], |
| 399 | "additionalProperties": False |
| 400 | } |
| 401 | |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 402 | internal_connection_schema_v02 = { |
| 403 | "type":"object", |
| 404 | "properties":{ |
| 405 | "name": name_schema, |
| 406 | "description":description_schema, |
| 407 | "type": {"type": "string", "enum":["e-line", "e-lan"]}, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 408 | "implementation": {"type": "string", "enum":["overlay", "underlay"]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 409 | "ip-profile": ip_profile_schema, |
| tierno | 8e69032 | 2017-08-10 15:58:50 +0200 | [diff] [blame] | 410 | "elements": {"type" : "array", "items": internal_connection_element_schema_v02, "minItems":1} |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 411 | }, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 412 | "required": ["name", "type", "implementation", "elements"], |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 413 | "additionalProperties": False |
| 414 | } |
| 415 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 416 | external_connection_schema = { |
| 417 | "type":"object", |
| 418 | "properties":{ |
| 419 | "name": name_schema, |
| 420 | "type":{"type":"string", "enum":["mgmt","bridge","data"]}, |
| 421 | "VNFC": name_schema, |
| 422 | "local_iface_name": name_schema , |
| 423 | "description":description_schema |
| 424 | }, |
| 425 | "required": ["name", "type", "VNFC", "local_iface_name"], |
| 426 | "additionalProperties": False |
| 427 | } |
| 428 | |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 429 | #Not yet used |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 430 | external_connection_schema_v02 = { |
| 431 | "type":"object", |
| 432 | "properties":{ |
| 433 | "name": name_schema, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 434 | "mgmt": {"type":"boolean"}, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 435 | "type": {"type": "string", "enum":["e-line", "e-lan"]}, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 436 | "implementation": {"type": "string", "enum":["overlay", "underlay"]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 437 | "VNFC": name_schema, |
| 438 | "local_iface_name": name_schema , |
| 439 | "description":description_schema |
| 440 | }, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 441 | "required": ["name", "type", "VNFC", "local_iface_name"], |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 442 | "additionalProperties": False |
| 443 | } |
| 444 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 445 | interfaces_schema={ |
| 446 | "type":"array", |
| 447 | "items":{ |
| 448 | "type":"object", |
| 449 | "properties":{ |
| 450 | "name":name_schema, |
| 451 | "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]}, |
| 452 | "bandwidth":bandwidth_schema, |
| 453 | "vpci":pci_schema, |
| 454 | "mac_address": mac_schema |
| 455 | }, |
| 456 | "additionalProperties": False, |
| 457 | "required": ["name","dedicated", "bandwidth"] |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | bridge_interfaces_schema={ |
| 462 | "type":"array", |
| 463 | "items":{ |
| 464 | "type":"object", |
| 465 | "properties":{ |
| 466 | "name": name_schema, |
| 467 | "bandwidth":bandwidth_schema, |
| 468 | "vpci":pci_schema, |
| 469 | "mac_address": mac_schema, |
| garciadeblas | 31e141b | 2018-10-25 18:33:19 +0200 | [diff] [blame] | 470 | "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139", "paravirt"]}, |
| montesmoreno | 2a1fc4e | 2017-01-09 16:46:04 +0000 | [diff] [blame] | 471 | "port-security": {"type" : "boolean"}, |
| 472 | "floating-ip": {"type" : "boolean"} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 473 | }, |
| 474 | "additionalProperties": False, |
| 475 | "required": ["name"] |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | devices_schema={ |
| 480 | "type":"array", |
| 481 | "items":{ |
| 482 | "type":"object", |
| 483 | "properties":{ |
| 484 | "type":{"type":"string", "enum":["disk","cdrom","xml"] }, |
| 485 | "image": path_schema, |
| garciadeblas | b69fa9f | 2016-09-28 12:04:10 +0200 | [diff] [blame] | 486 | "image name": name_schema, |
| 487 | "image checksum": checksum_schema, |
| montesmoreno | 0c8def0 | 2016-12-22 12:16:23 +0000 | [diff] [blame] | 488 | "image metadata": metadata_schema, |
| 489 | "size": size_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 490 | "vpci":pci_schema, |
| 491 | "xml":xml_text_schema, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 492 | "name": name_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 493 | }, |
| 494 | "additionalProperties": False, |
| 495 | "required": ["type"] |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | |
| 500 | numa_schema = { |
| 501 | "type": "object", |
| 502 | "properties": { |
| 503 | "memory":integer1_schema, |
| 504 | "cores":integer1_schema, |
| 505 | "paired-threads":integer1_schema, |
| 506 | "threads":integer1_schema, |
| 507 | "cores-id":{"type":"array","items":integer0_schema}, |
| 508 | "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema}}, |
| 509 | "threads-id":{"type":"array","items":integer0_schema}, |
| 510 | "interfaces":interfaces_schema |
| 511 | }, |
| 512 | "additionalProperties": False, |
| 513 | #"required": ["memory"] |
| 514 | } |
| 515 | |
| tierno | 36c0b17 | 2017-01-12 18:32:28 +0100 | [diff] [blame] | 516 | config_files_schema = { |
| 517 | "title": "Config files for cloud init schema", |
| 518 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 519 | "type": "object", |
| 520 | "properties": { |
| 521 | "dest": path_schema, |
| 522 | "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]}, #by default text |
| 523 | "content": {"type": "string"}, |
| 524 | "permissions": {"type": "string"}, # tiypically octal notation '0644' |
| 525 | "owner": {"type": "string"}, # format: owner:group |
| 526 | |
| 527 | }, |
| 528 | "additionalProperties": False, |
| 529 | "required": ["dest", "content"], |
| 530 | } |
| 531 | |
| 532 | boot_data_vdu_schema = { |
| 533 | "title": "Boot data (Cloud-init) configuration schema", |
| 534 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 535 | "type": "object", |
| 536 | "properties":{ |
| 537 | "key-pairs": {"type" : "array", "items": {"type":"string"}}, |
| 538 | "users": {"type" : "array", "items": cloud_config_user_schema}, |
| 539 | "user-data": {"type" : "string"}, # scrip to run |
| 540 | "config-files": {"type": "array", "items": config_files_schema}, |
| 541 | # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data |
| 542 | "boot-data-drive": {"type": "boolean"}, |
| 543 | }, |
| 544 | "additionalProperties": False, |
| 545 | } |
| 546 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 547 | vnfc_schema = { |
| 548 | "type":"object", |
| 549 | "properties":{ |
| 550 | "name": name_schema, |
| 551 | "description": description_schema, |
| tierno | 8e69032 | 2017-08-10 15:58:50 +0200 | [diff] [blame] | 552 | "count": integer1_schema, |
| garciadeblas | b69fa9f | 2016-09-28 12:04:10 +0200 | [diff] [blame] | 553 | "image name": name_schema, |
| mirabal | 2935631 | 2017-07-27 12:21:22 +0200 | [diff] [blame] | 554 | "availability_zone": name_schema, |
| 555 | "VNFC image": {"oneOf": [path_schema, http_schema]}, |
| garciadeblas | b69fa9f | 2016-09-28 12:04:10 +0200 | [diff] [blame] | 556 | "image checksum": checksum_schema, |
| gcalvino | e580c7d | 2017-09-22 14:09:51 +0200 | [diff] [blame] | 557 | "image metadata": metadata_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 558 | #"cloud-config": cloud_config_schema, #common for all vnfs in the scenario |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 559 | "processor": { |
| 560 | "type":"object", |
| 561 | "properties":{ |
| 562 | "model":description_schema, |
| 563 | "features":{"type":"array","items":nameshort_schema} |
| 564 | }, |
| 565 | "required": ["model"], |
| 566 | "additionalProperties": False |
| 567 | }, |
| 568 | "hypervisor": { |
| 569 | "type":"object", |
| 570 | "properties":{ |
| 571 | "type":nameshort_schema, |
| 572 | "version":description_schema |
| 573 | }, |
| 574 | }, |
| 575 | "ram":integer0_schema, |
| 576 | "vcpus":integer0_schema, |
| 577 | "disk": integer1_schema, |
| 578 | "numas": { |
| 579 | "type": "array", |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 580 | "items": numa_schema |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 581 | }, |
| 582 | "bridge-ifaces": bridge_interfaces_schema, |
| tierno | 36c0b17 | 2017-01-12 18:32:28 +0100 | [diff] [blame] | 583 | "devices": devices_schema, |
| 584 | "boot-data" : boot_data_vdu_schema |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 585 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 586 | }, |
| garciadeblas | b69fa9f | 2016-09-28 12:04:10 +0200 | [diff] [blame] | 587 | "required": ["name"], |
| 588 | "oneOf": [ |
| 589 | {"required": ["VNFC image"]}, |
| 590 | {"required": ["image name"]} |
| 591 | ], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 592 | "additionalProperties": False |
| 593 | } |
| 594 | |
| 595 | vnfd_schema_v01 = { |
| 596 | "title":"vnfd information schema v0.1", |
| 597 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 598 | "type":"object", |
| 599 | "properties":{ |
| 600 | "vnf":{ |
| 601 | "type":"object", |
| 602 | "properties":{ |
| 603 | "name": name_schema, |
| 604 | "description": description_schema, |
| mirabal | 2935631 | 2017-07-27 12:21:22 +0200 | [diff] [blame] | 605 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 606 | "class": nameshort_schema, |
| 607 | "public": {"type" : "boolean"}, |
| 608 | "physical": {"type" : "boolean"}, |
| gcalvino | e580c7d | 2017-09-22 14:09:51 +0200 | [diff] [blame] | 609 | "default_user": name_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 610 | "tenant_id": id_schema, #only valid for admin |
| 611 | "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1}, |
| 612 | "internal-connections": {"type" : "array", "items": internal_connection_schema, "minItems":1}, |
| 613 | "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1} |
| 614 | }, |
| 615 | "required": ["name","external-connections"], |
| 616 | "additionalProperties": True |
| 617 | } |
| 618 | }, |
| 619 | "required": ["vnf"], |
| 620 | "additionalProperties": False |
| 621 | } |
| 622 | |
| gcalvino | e580c7d | 2017-09-22 14:09:51 +0200 | [diff] [blame] | 623 | #VNFD schema for OSM R1 |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 624 | vnfd_schema_v02 = { |
| 625 | "title":"vnfd information schema v0.2", |
| 626 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 627 | "type":"object", |
| 628 | "properties":{ |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 629 | "schema_version": {"type": "string", "enum": ["0.2"]}, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 630 | "vnf":{ |
| 631 | "type":"object", |
| 632 | "properties":{ |
| 633 | "name": name_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 634 | "description": description_schema, |
| 635 | "class": nameshort_schema, |
| 636 | "public": {"type" : "boolean"}, |
| 637 | "physical": {"type" : "boolean"}, |
| 638 | "tenant_id": id_schema, #only valid for admin |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 639 | "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 640 | "internal-connections": {"type" : "array", "items": internal_connection_schema_v02, "minItems":1}, |
| 641 | # "cloud-config": cloud_config_schema, #common for all vnfcs |
| 642 | "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 643 | }, |
| 644 | "required": ["name"], |
| 645 | "additionalProperties": True |
| 646 | } |
| 647 | }, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 648 | "required": ["vnf", "schema_version"], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 649 | "additionalProperties": False |
| 650 | } |
| 651 | |
| 652 | #vnfd_schema = vnfd_schema_v01 |
| 653 | #{ |
| 654 | # "title":"vnfd information schema v0.2", |
| 655 | # "$schema": "http://json-schema.org/draft-04/schema#", |
| 656 | # "oneOf": [vnfd_schema_v01, vnfd_schema_v02] |
| 657 | #} |
| 658 | |
| 659 | graph_schema = { |
| 660 | "title":"graphical scenario descriptor information schema", |
| 661 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 662 | "type":"object", |
| 663 | "properties":{ |
| 664 | "x": integer0_schema, |
| 665 | "y": integer0_schema, |
| 666 | "ifaces": { |
| 667 | "type":"object", |
| 668 | "properties":{ |
| 669 | "left": {"type":"array"}, |
| 670 | "right": {"type":"array"}, |
| 671 | "bottom": {"type":"array"}, |
| 672 | } |
| 673 | } |
| 674 | }, |
| 675 | "required": ["x","y"] |
| 676 | } |
| 677 | |
| 678 | nsd_schema_v01 = { |
| 679 | "title":"network scenario descriptor information schema v0.1", |
| 680 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 681 | "type":"object", |
| 682 | "properties":{ |
| 683 | "name":name_schema, |
| 684 | "description": description_schema, |
| 685 | "tenant_id": id_schema, #only valid for admin |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 686 | "public": {"type": "boolean"}, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 687 | "topology":{ |
| 688 | "type":"object", |
| 689 | "properties":{ |
| 690 | "nodes": { |
| 691 | "type":"object", |
| 692 | "patternProperties":{ |
| 693 | ".": { |
| 694 | "type": "object", |
| 695 | "properties":{ |
| 696 | "type":{"type":"string", "enum":["VNF", "other_network", "network", "external_network"]}, |
| 697 | "vnf_id": id_schema, |
| 698 | "graph": graph_schema, |
| 699 | }, |
| 700 | "patternProperties":{ |
| 701 | "^(VNF )?model$": {"type": "string"} |
| 702 | }, |
| 703 | "required": ["type"] |
| 704 | } |
| 705 | } |
| 706 | }, |
| 707 | "connections": { |
| 708 | "type":"object", |
| 709 | "patternProperties":{ |
| 710 | ".": { |
| 711 | "type": "object", |
| 712 | "properties":{ |
| 713 | "nodes":{"oneOf":[{"type":"object", "minProperties":2}, {"type":"array", "minLength":1}]}, |
| 714 | "type": {"type": "string", "enum":["link", "external_network", "dataplane_net", "bridge_net"]}, |
| 715 | "graph": graph_schema |
| 716 | }, |
| 717 | "required": ["nodes"] |
| 718 | }, |
| 719 | } |
| 720 | } |
| 721 | }, |
| 722 | "required": ["nodes"], |
| 723 | "additionalProperties": False |
| 724 | } |
| 725 | }, |
| 726 | "required": ["name","topology"], |
| 727 | "additionalProperties": False |
| 728 | } |
| 729 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 730 | nsd_schema_v02 = { |
| 731 | "title":"network scenario descriptor information schema v0.2", |
| 732 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 733 | "type":"object", |
| 734 | "properties":{ |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 735 | "schema_version": schema_version_2, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 736 | "scenario":{ |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 737 | "type":"object", |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 738 | "properties":{ |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 739 | "name": name_schema, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 740 | "description": description_schema, |
| 741 | "tenant_id": id_schema, #only valid for admin |
| 742 | "public": {"type": "boolean"}, |
| 743 | "vnfs": { |
| 744 | "type":"object", |
| 745 | "patternProperties":{ |
| 746 | ".": { |
| 747 | "type": "object", |
| 748 | "properties":{ |
| 749 | "vnf_id": id_schema, |
| 750 | "graph": graph_schema, |
| 751 | "vnf_name": name_schema, |
| 752 | }, |
| 753 | } |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 754 | }, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 755 | "minProperties": 1 |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 756 | }, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 757 | "networks": { |
| 758 | "type":"object", |
| 759 | "patternProperties":{ |
| 760 | ".": { |
| 761 | "type": "object", |
| 762 | "properties":{ |
| 763 | "interfaces":{"type":"array", "minLength":1}, |
| 764 | "type": {"type": "string", "enum":["dataplane", "bridge"]}, |
| 765 | "external" : {"type": "boolean"}, |
| 766 | "graph": graph_schema |
| 767 | }, |
| 768 | "required": ["interfaces"] |
| 769 | }, |
| 770 | } |
| 771 | }, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 772 | |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 773 | }, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 774 | "required": ["vnfs", "name"], |
| 775 | "additionalProperties": False |
| 776 | } |
| 777 | }, |
| 778 | "required": ["scenario","schema_version"], |
| 779 | "additionalProperties": False |
| 780 | } |
| 781 | |
| 782 | #NSD schema for OSM R1 |
| 783 | nsd_schema_v03 = { |
| 784 | "title":"network scenario descriptor information schema v0.3", |
| 785 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 786 | "type":"object", |
| 787 | "properties":{ |
| 788 | "schema_version": {"type": "string", "enum": ["0.3"]}, |
| 789 | "scenario":{ |
| 790 | "type":"object", |
| 791 | "properties":{ |
| 792 | "name": name_schema, |
| 793 | "description": description_schema, |
| 794 | "tenant_id": id_schema, #only valid for admin |
| 795 | "public": {"type": "boolean"}, |
| 796 | "cloud-config": cloud_config_schema, #common for all vnfs in the scenario |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 797 | #"datacenter": name_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 798 | "vnfs": { |
| 799 | "type":"object", |
| 800 | "patternProperties":{ |
| 801 | ".": { |
| 802 | "type": "object", |
| 803 | "properties":{ |
| 804 | "vnf_id": id_schema, |
| 805 | "graph": graph_schema, |
| 806 | "vnf_name": name_schema, |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 807 | #"cloud-config": cloud_config_schema, #particular for a vnf |
| 808 | #"datacenter": name_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 809 | "internal-connections": { |
| 810 | "type": "object", |
| 811 | "patternProperties": { |
| 812 | ".": { |
| 813 | "type": "object", |
| 814 | "properties": { |
| 815 | "ip-profile": ip_profile_schema, |
| 816 | "elements": { |
| 817 | "type" : "array", |
| 818 | "items":{ |
| 819 | "type":"object", |
| 820 | "properties":{ |
| 821 | "VNFC": name_schema, |
| 822 | "local_iface_name": name_schema, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 823 | "ip_address": ip_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 824 | }, |
| 825 | "required": ["VNFC", "local_iface_name"], |
| 826 | } |
| 827 | } |
| 828 | } |
| 829 | } |
| 830 | } |
| 831 | } |
| 832 | }, |
| 833 | } |
| 834 | }, |
| 835 | "minProperties": 1 |
| 836 | }, |
| 837 | "networks": { |
| 838 | "type":"object", |
| 839 | "patternProperties":{ |
| 840 | ".": { |
| 841 | "type": "object", |
| 842 | "properties":{ |
| 843 | "interfaces":{ |
| 844 | "type":"array", |
| 845 | "minLength":1, |
| 846 | "items":{ |
| 847 | "type":"object", |
| 848 | "properties":{ |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 849 | "vnf": name_schema, |
| 850 | "vnf_interface": name_schema, |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 851 | "ip_address": ip_schema |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 852 | }, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 853 | "required": ["vnf", "vnf_interface"], |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 854 | } |
| 855 | }, |
| 856 | "type": {"type": "string", "enum":["e-line", "e-lan"]}, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 857 | "implementation": {"type": "string", "enum":["overlay", "underlay"]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 858 | "external" : {"type": "boolean"}, |
| 859 | "graph": graph_schema, |
| 860 | "ip-profile": ip_profile_schema |
| 861 | }, |
| 862 | "required": ["interfaces"] |
| 863 | }, |
| 864 | } |
| 865 | }, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 866 | |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 867 | }, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 868 | "required": ["vnfs", "networks","name"], |
| 869 | "additionalProperties": False |
| 870 | } |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 871 | }, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 872 | "required": ["scenario","schema_version"], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 873 | "additionalProperties": False |
| 874 | } |
| 875 | |
| 876 | #scenario_new_schema = { |
| 877 | # "title":"new scenario information schema", |
| 878 | # "$schema": "http://json-schema.org/draft-04/schema#", |
| 879 | # #"oneOf": [nsd_schema_v01, nsd_schema_v02] |
| 880 | # "oneOf": [nsd_schema_v01] |
| 881 | #} |
| 882 | |
| 883 | scenario_edit_schema = { |
| 884 | "title":"edit scenario information schema", |
| 885 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 886 | "type":"object", |
| 887 | "properties":{ |
| 888 | "name":name_schema, |
| 889 | "description": description_schema, |
| 890 | "topology":{ |
| 891 | "type":"object", |
| 892 | "properties":{ |
| 893 | "nodes": { |
| 894 | "type":"object", |
| 895 | "patternProperties":{ |
| 896 | "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$": { |
| 897 | "type":"object", |
| 898 | "properties":{ |
| 899 | "graph":{ |
| 900 | "type": "object", |
| 901 | "properties":{ |
| 902 | "x": integer0_schema, |
| 903 | "y": integer0_schema, |
| 904 | "ifaces":{ "type": "object"} |
| 905 | } |
| 906 | }, |
| 907 | "description": description_schema, |
| 908 | "name": name_schema |
| 909 | } |
| 910 | } |
| 911 | } |
| 912 | } |
| 913 | }, |
| 914 | "required": ["nodes"], |
| 915 | "additionalProperties": False |
| 916 | } |
| 917 | }, |
| 918 | "additionalProperties": False |
| 919 | } |
| 920 | |
| 921 | scenario_action_schema = { |
| 922 | "title":"scenario action information schema", |
| 923 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 924 | "type":"object", |
| 925 | "properties":{ |
| 926 | "start":{ |
| 927 | "type": "object", |
| 928 | "properties": { |
| 929 | "instance_name":name_schema, |
| 930 | "description":description_schema, |
| 931 | "datacenter": {"type": "string"} |
| 932 | }, |
| 933 | "required": ["instance_name"] |
| 934 | }, |
| 935 | "deploy":{ |
| 936 | "type": "object", |
| 937 | "properties": { |
| 938 | "instance_name":name_schema, |
| 939 | "description":description_schema, |
| 940 | "datacenter": {"type": "string"} |
| 941 | }, |
| 942 | "required": ["instance_name"] |
| 943 | }, |
| 944 | "reserve":{ |
| 945 | "type": "object", |
| 946 | "properties": { |
| 947 | "instance_name":name_schema, |
| 948 | "description":description_schema, |
| 949 | "datacenter": {"type": "string"} |
| 950 | }, |
| 951 | "required": ["instance_name"] |
| 952 | }, |
| 953 | "verify":{ |
| 954 | "type": "object", |
| 955 | "properties": { |
| 956 | "instance_name":name_schema, |
| 957 | "description":description_schema, |
| 958 | "datacenter": {"type": "string"} |
| 959 | }, |
| 960 | "required": ["instance_name"] |
| 961 | } |
| 962 | }, |
| 963 | "minProperties": 1, |
| 964 | "maxProperties": 1, |
| 965 | "additionalProperties": False |
| 966 | } |
| 967 | |
| tierno | 7fe8264 | 2018-11-26 14:14:51 +0000 | [diff] [blame] | 968 | instance_scenario_object = { |
| 969 | "title": "scenario object used to create an instance not based on any nsd", |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 970 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | 7fe8264 | 2018-11-26 14:14:51 +0000 | [diff] [blame] | 971 | "type": "object", |
| 972 | "properties": { |
| 973 | "nets": { |
| 974 | "type": "array", |
| 975 | "minLength": 1, |
| 976 | "items": { |
| 977 | "type": "object", |
| 978 | "properties": { |
| 979 | "name": name_schema, |
| 980 | "external": {"type": "boolean"}, |
| 981 | "type": {"enum": ["bridge", "ptp", "data"]}, # for overlay, underlay E-LINE, underlay E-LAN |
| 982 | }, |
| 983 | "additionalProperties": False, |
| 984 | "required": ["name", "external", "type"] |
| 985 | } |
| 986 | } |
| 987 | }, |
| 988 | "additionalProperties": False, |
| 989 | "required": ["nets"] |
| 990 | } |
| 991 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 992 | instance_scenario_create_schema_v01 = { |
| tierno | 67881db | 2018-10-24 18:46:03 +0200 | [diff] [blame] | 993 | "title": "instance scenario create information schema v0.1", |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 994 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | 67881db | 2018-10-24 18:46:03 +0200 | [diff] [blame] | 995 | "type": "object", |
| 996 | "properties": { |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 997 | "schema_version": {"type": "string", "enum": ["0.1"]}, |
| tierno | 67881db | 2018-10-24 18:46:03 +0200 | [diff] [blame] | 998 | "instance": { |
| 999 | "type": "object", |
| 1000 | "properties": { |
| 1001 | "mgmt_keys": {"type": "array", "items": {"type":"string"}}, |
| 1002 | "vduImage": name_schema, |
| 1003 | "name": name_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1004 | "description":description_schema, |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 1005 | "datacenter": name_schema, |
| tierno | 7fe8264 | 2018-11-26 14:14:51 +0000 | [diff] [blame] | 1006 | "scenario" : {"oneOff": [name_schema, instance_scenario_object]}, # can be an UUID or name or a dict |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1007 | "action":{"enum": ["deploy","reserve","verify" ]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1008 | "connect_mgmt_interfaces": {"oneOf": [{"type":"boolean"}, {"type":"object"}]},# can be true or a dict with datacenter: net_name |
| 1009 | "cloud-config": cloud_config_schema, #common to all vnfs in the instance scenario |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1010 | "vnfs":{ #mapping from scenario to datacenter |
| 1011 | "type": "object", |
| 1012 | "patternProperties":{ |
| 1013 | ".": { |
| 1014 | "type": "object", |
| 1015 | "properties":{ |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1016 | "name": name_schema, #override vnf name |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 1017 | "datacenter": name_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1018 | #"metadata": {"type": "object"}, |
| 1019 | #"user_data": {"type": "string"} |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 1020 | #"cloud-config": cloud_config_schema, #particular for a vnf |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 1021 | "vdus": { |
| 1022 | "type": "object", |
| 1023 | "patternProperties": { |
| 1024 | ".": { |
| 1025 | "type": "object", |
| 1026 | "properties": { |
| tierno | 67881db | 2018-10-24 18:46:03 +0200 | [diff] [blame] | 1027 | "name": name_schema, # overrides vdu name schema |
| 1028 | "mgmt_keys": {"type": "array", "items": {"type": "string"}}, |
| 1029 | "vduImage": name_schema, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 1030 | "devices": { |
| 1031 | "type": "object", |
| 1032 | "patternProperties": { |
| 1033 | ".": { |
| 1034 | "vim_id": name_schema, |
| 1035 | } |
| 1036 | } |
| 1037 | }, |
| 1038 | "interfaces": { |
| 1039 | "type": "object", |
| 1040 | "patternProperties": { |
| 1041 | ".": { |
| 1042 | "ip_address": ip_schema, |
| 1043 | "mac_address": mac_schema, |
| 1044 | "floating-ip": {"type": "boolean"}, |
| 1045 | } |
| 1046 | } |
| 1047 | } |
| 1048 | } |
| 1049 | } |
| 1050 | } |
| 1051 | }, |
| 1052 | "networks": { |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1053 | "type": "object", |
| 1054 | "patternProperties": { |
| 1055 | ".": { |
| 1056 | "type": "object", |
| 1057 | "properties": { |
| 1058 | "vim-network-name": name_schema, |
| gcalvino | 0a48054 | 2018-12-17 16:19:33 +0100 | [diff] [blame] | 1059 | "vim-network-id": name_schema, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 1060 | "ip-profile": ip_profile_schema, |
| 1061 | "name": name_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1062 | } |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1063 | } |
| 1064 | } |
| 1065 | }, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1066 | } |
| 1067 | } |
| 1068 | }, |
| 1069 | }, |
| 1070 | "networks":{ #mapping from scenario to datacenter |
| 1071 | "type": "object", |
| 1072 | "patternProperties":{ |
| 1073 | ".": { |
| 1074 | "type": "object", |
| 1075 | "properties":{ |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1076 | "interfaces":{ |
| 1077 | "type":"array", |
| 1078 | "minLength":1, |
| 1079 | "items":{ |
| 1080 | "type":"object", |
| 1081 | "properties":{ |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 1082 | "ip_address": ip_schema, |
| 1083 | "datacenter": name_schema, |
| gcalvino | 0a48054 | 2018-12-17 16:19:33 +0100 | [diff] [blame] | 1084 | "vim-network-name": name_schema, |
| 1085 | "vim-network-id": name_schema |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1086 | }, |
| 1087 | "patternProperties":{ |
| 1088 | ".": {"type": "string"} |
| 1089 | } |
| 1090 | } |
| 1091 | }, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1092 | "ip-profile": ip_profile_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1093 | #if the network connects VNFs deployed at different sites, you must specify one entry per site that this network connect to |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1094 | "sites": { |
| 1095 | "type":"array", |
| 1096 | "minLength":1, |
| 1097 | "items":{ |
| 1098 | "type":"object", |
| 1099 | "properties":{ |
| 1100 | # By default for an scenario 'external' network openmano looks for an existing VIM network to map this external scenario network, |
| 1101 | # for other networks openamno creates at VIM |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1102 | # Use netmap-create to force to create an external scenario network |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1103 | "netmap-create": {"oneOf":[name_schema,{"type": "null"}]}, #datacenter network to use. Null if must be created as an internal net |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1104 | #netmap-use: Indicates an existing VIM network that must be used for this scenario network. |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1105 | #Can use both the VIM network name (if it is not ambiguous) or the VIM net UUID |
| 1106 | #If both 'netmap-create' and 'netmap-use'are supplied, netmap-use precedes, but if fails openmano follows the netmap-create |
| 1107 | #In oder words, it is the same as 'try to map to the VIM network (netmap-use) if exist, and if not create the network (netmap-create) |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1108 | "netmap-use": name_schema, # |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1109 | "vim-network-name": name_schema, #override network name |
| gcalvino | 0a48054 | 2018-12-17 16:19:33 +0100 | [diff] [blame] | 1110 | "vim-network-id": name_schema, |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1111 | #"ip-profile": ip_profile_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1112 | "datacenter": name_schema, |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1113 | } |
| 1114 | } |
| 1115 | }, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1116 | } |
| 1117 | } |
| 1118 | }, |
| 1119 | }, |
| 1120 | }, |
| 1121 | "additionalProperties": False, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1122 | "required": ["name"] |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1123 | }, |
| 1124 | }, |
| 1125 | "required": ["instance"], |
| 1126 | "additionalProperties": False |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1127 | } |
| 1128 | |
| 1129 | instance_scenario_action_schema = { |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1130 | "title": "instance scenario action information schema", |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1131 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1132 | "type": "object", |
| 1133 | "properties": { |
| 1134 | "start": {"type": "null"}, |
| 1135 | "pause": {"type": "null"}, |
| 1136 | "resume": {"type": "null"}, |
| 1137 | "shutoff": {"type": "null"}, |
| 1138 | "shutdown": {"type": "null"}, |
| 1139 | "forceOff": {"type": "null"}, |
| 1140 | "rebuild": {"type": "null"}, |
| 1141 | "reboot": { |
| 1142 | "type": ["object", "null"], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1143 | }, |
| gcalvino | e580c7d | 2017-09-22 14:09:51 +0200 | [diff] [blame] | 1144 | "add_public_key": description_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1145 | "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]}, |
| tierno | fc5f80b | 2018-05-29 16:00:43 +0200 | [diff] [blame] | 1146 | "vdu-scaling": { |
| gcalvino | e580c7d | 2017-09-22 14:09:51 +0200 | [diff] [blame] | 1147 | "type": "array", |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1148 | "items": { |
| tierno | 868220c | 2017-09-26 00:11:05 +0200 | [diff] [blame] | 1149 | "type": "object", |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1150 | "properties": { |
| tierno | 868220c | 2017-09-26 00:11:05 +0200 | [diff] [blame] | 1151 | "vdu-id": id_schema, |
| tierno | fc5f80b | 2018-05-29 16:00:43 +0200 | [diff] [blame] | 1152 | "osm_vdu_id": name_schema, |
| 1153 | "member-vnf-index": name_schema, |
| tierno | 868220c | 2017-09-26 00:11:05 +0200 | [diff] [blame] | 1154 | "count": integer1_schema, |
| tierno | fc5f80b | 2018-05-29 16:00:43 +0200 | [diff] [blame] | 1155 | "type": {"enum": ["create", "delete"]} |
| tierno | 868220c | 2017-09-26 00:11:05 +0200 | [diff] [blame] | 1156 | }, |
| 1157 | "additionalProperties": False, |
| 1158 | "minProperties": 1, |
| tierno | fc5f80b | 2018-05-29 16:00:43 +0200 | [diff] [blame] | 1159 | "required": ["type"] |
| tierno | 868220c | 2017-09-26 00:11:05 +0200 | [diff] [blame] | 1160 | } |
| 1161 | }, |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1162 | "vnfs": {"type": "array", "items": {"type": "string"}}, |
| 1163 | "vms": {"type": "array", "items": {"type": "string"}} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1164 | }, |
| 1165 | "minProperties": 1, |
| 1166 | #"maxProperties": 1, |
| 1167 | "additionalProperties": False |
| 1168 | } |
| Pablo Montes Moreno | 3fbff9b | 2017-03-08 11:28:15 +0100 | [diff] [blame] | 1169 | |
| 1170 | sdn_controller_properties={ |
| 1171 | "name": name_schema, |
| Pablo Montes Moreno | 6aa0b2b | 2017-05-23 18:33:12 +0200 | [diff] [blame] | 1172 | "dpid": {"type":"string", "pattern":"^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"}, |
| Pablo Montes Moreno | 3fbff9b | 2017-03-08 11:28:15 +0100 | [diff] [blame] | 1173 | "ip": ip_schema, |
| 1174 | "port": port_schema, |
| 1175 | "type": {"type": "string", "enum": ["opendaylight","floodlight","onos"]}, |
| 1176 | "version": {"type" : "string", "minLength":1, "maxLength":12}, |
| 1177 | "user": nameshort_schema, |
| 1178 | "password": passwd_schema |
| 1179 | } |
| 1180 | sdn_controller_schema = { |
| 1181 | "title":"sdn controller information schema", |
| 1182 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1183 | "type":"object", |
| 1184 | "properties":{ |
| 1185 | "sdn_controller":{ |
| 1186 | "type":"object", |
| 1187 | "properties":sdn_controller_properties, |
| 1188 | "required": ["name", "port", 'ip', 'dpid', 'type'], |
| 1189 | "additionalProperties": False |
| 1190 | } |
| 1191 | }, |
| 1192 | "required": ["sdn_controller"], |
| 1193 | "additionalProperties": False |
| 1194 | } |
| 1195 | |
| 1196 | sdn_controller_edit_schema = { |
| 1197 | "title":"sdn controller update information schema", |
| 1198 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1199 | "type":"object", |
| 1200 | "properties":{ |
| 1201 | "sdn_controller":{ |
| 1202 | "type":"object", |
| 1203 | "properties":sdn_controller_properties, |
| 1204 | "additionalProperties": False |
| 1205 | } |
| 1206 | }, |
| 1207 | "required": ["sdn_controller"], |
| 1208 | "additionalProperties": False |
| 1209 | } |
| 1210 | |
| 1211 | sdn_port_mapping_schema = { |
| 1212 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1213 | "title":"sdn port mapping information schema", |
| 1214 | "type": "object", |
| 1215 | "properties": { |
| 1216 | "sdn_port_mapping": { |
| 1217 | "type": "array", |
| 1218 | "items": { |
| 1219 | "type": "object", |
| 1220 | "properties": { |
| 1221 | "compute_node": nameshort_schema, |
| 1222 | "ports": { |
| 1223 | "type": "array", |
| 1224 | "items": { |
| 1225 | "type": "object", |
| 1226 | "properties": { |
| tierno | 4070e44 | 2019-01-23 10:19:23 +0000 | [diff] [blame] | 1227 | "pci": {"OneOf": [{"type": "null"}, pci_extended_schema]}, # pci_schema, |
| Pablo Montes Moreno | 3fbff9b | 2017-03-08 11:28:15 +0100 | [diff] [blame] | 1228 | "switch_port": nameshort_schema, |
| 1229 | "switch_mac": mac_schema |
| 1230 | }, |
| 1231 | "required": ["pci"] |
| 1232 | } |
| 1233 | } |
| 1234 | }, |
| 1235 | "required": ["compute_node", "ports"] |
| 1236 | } |
| 1237 | } |
| 1238 | }, |
| 1239 | "required": ["sdn_port_mapping"] |
| Pablo Montes Moreno | 6aa0b2b | 2017-05-23 18:33:12 +0200 | [diff] [blame] | 1240 | } |
| 1241 | |
| 1242 | sdn_external_port_schema = { |
| 1243 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1244 | "title":"External port ingformation", |
| 1245 | "type": "object", |
| 1246 | "properties": { |
| 1247 | "port": {"type" : "string", "minLength":1, "maxLength":60}, |
| 1248 | "vlan": vlan_schema, |
| 1249 | "mac": mac_schema |
| 1250 | }, |
| 1251 | "required": ["port"] |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1252 | } |