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