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