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