blob: dc3c9bf1aff94829b372552090385e9cadcca546 [file] [log] [blame]
tierno7edb6752016-03-21 17:37:52 +01001# -*- 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'''
25JSON schemas used by openmano httpserver.py module to parse the different files and messages sent through the API
26'''
montesmoreno0c8def02016-12-22 12:16:23 +000027__author__="Alfonso Tierno, Gerardo Garcia, Pablo Montes"
tierno7edb6752016-03-21 17:37:52 +010028__date__ ="$09-oct-2014 09:09:48$"
29
30#Basis schemas
tierno392f2852016-05-13 12:28:55 +020031patern_name="^[ -~]+$"
tierno7edb6752016-03-21 17:37:52 +010032passwd_schema={"type" : "string", "minLength":1, "maxLength":60}
33nameshort_schema={"type" : "string", "minLength":1, "maxLength":60, "pattern" : "^[^,;()'\"]+$"}
34name_schema={"type" : "string", "minLength":1, "maxLength":255, "pattern" : "^[^,;()'\"]+$"}
35xml_text_schema={"type" : "string", "minLength":1, "maxLength":1000, "pattern" : "^[^']+$"}
36description_schema={"type" : ["string","null"], "maxLength":255, "pattern" : "^[^'\"]+$"}
37id_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}$"
38id_schema = {"type" : "string", "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"}
39pci_schema={"type":"string", "pattern":"^[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}\.[0-9a-fA-F]$"}
tierno7f426e92018-06-28 15:21:32 +020040pci_extended_schema = {"type": "string", "pattern": "^[0-9a-fA-F.:-\[\]]$"}
41
tierno7edb6752016-03-21 17:37:52 +010042http_schema={"type":"string", "pattern":"^https?://[^'\"=]+$"}
43bandwidth_schema={"type":"string", "pattern" : "^[0-9]+ *([MG]bps)?$"}
44memory_schema={"type":"string", "pattern" : "^[0-9]+ *([MG]i?[Bb])?$"}
45integer0_schema={"type":"integer","minimum":0}
46integer1_schema={"type":"integer","minimum":1}
tierno392f2852016-05-13 12:28:55 +020047path_schema={"type":"string", "pattern":"^(\.){0,2}(/[^/\"':{}\(\)]+)+$"}
tierno7edb6752016-03-21 17:37:52 +010048vlan_schema={"type":"integer","minimum":1,"maximum":4095}
49vlan1000_schema={"type":"integer","minimum":1000,"maximum":4095}
50mac_schema={"type":"string", "pattern":"^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){5}$"} #must be unicast LSB bit of MSB byte ==0
51#mac_schema={"type":"string", "pattern":"^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$"}
garciadeblasfec35df2016-08-25 11:33:57 +020052ip_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]?)$"}
53ip_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])$"}
tierno7edb6752016-03-21 17:37:52 +010054port_schema={"type":"integer","minimum":1,"maximum":65534}
55object_schema={"type":"object"}
tierno392f2852016-05-13 12:28:55 +020056schema_version_2={"type":"integer","minimum":2,"maximum":2}
garciadeblasfec35df2016-08-25 11:33:57 +020057#schema_version_string={"type":"string","enum": ["0.1", "2", "0.2", "3", "0.3"]}
tiernoae4a8d12016-07-08 12:30:39 +020058log_level_schema={"type":"string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]}
garciadeblasb69fa9f2016-09-28 12:04:10 +020059checksum_schema={"type":"string", "pattern":"^[0-9a-fA-F]{32}$"}
montesmoreno0c8def02016-12-22 12:16:23 +000060size_schema={"type":"integer","minimum":1,"maximum":100}
tierno7edb6752016-03-21 17:37:52 +010061
62metadata_schema={
63 "type":"object",
64 "properties":{
65 "architecture": {"type":"string"},
66 "use_incremental": {"type":"string","enum":["yes","no"]},
67 "vpci": pci_schema,
68 "os_distro": {"type":"string"},
69 "os_type": {"type":"string"},
70 "os_version": {"type":"string"},
71 "bus": {"type":"string"},
72 "topology": {"type":"string", "enum": ["oneSocket"]}
73 }
74}
75
76#Schema for the configuration file
77config_schema = {
78 "title":"configuration response information schema",
79 "$schema": "http://json-schema.org/draft-04/schema#",
80 "type":"object",
81 "properties":{
82 "http_port": port_schema,
83 "http_admin_port": port_schema,
84 "http_host": nameshort_schema,
tiernod29b1d32017-01-25 11:02:52 +010085 "auto_push_VNF_to_VIMs": {"type":"boolean"},
tierno7edb6752016-03-21 17:37:52 +010086 "vnf_repository": path_schema,
87 "db_host": nameshort_schema,
88 "db_user": nameshort_schema,
89 "db_passwd": {"type":"string"},
90 "db_name": nameshort_schema,
tierno639520f2017-04-05 19:55:36 +020091 "db_ovim_host": nameshort_schema,
92 "db_ovim_user": nameshort_schema,
93 "db_ovim_passwd": {"type":"string"},
94 "db_ovim_name": nameshort_schema,
tierno7edb6752016-03-21 17:37:52 +010095 # Next fields will disappear once the MANO API includes appropriate primitives
96 "vim_url": http_schema,
97 "vim_url_admin": http_schema,
98 "vim_name": nameshort_schema,
99 "vim_tenant_name": nameshort_schema,
100 "mano_tenant_name": nameshort_schema,
101 "mano_tenant_id": id_schema,
tierno20fc2a22016-08-19 17:02:35 +0200102 "http_console_proxy": {"type":"boolean"},
103 "http_console_host": nameshort_schema,
tierno7edb6752016-03-21 17:37:52 +0100104 "http_console_ports": {
105 "type": "array",
tierno41a69812018-02-16 14:34:33 +0100106 "items": {"OneOf": [
tierno7edb6752016-03-21 17:37:52 +0100107 port_schema,
tierno41a69812018-02-16 14:34:33 +0100108 {"type": "object", "properties": {"from": port_schema, "to": port_schema}, "required": ["from", "to"]}
tierno7edb6752016-03-21 17:37:52 +0100109 ]}
110 },
tiernoae4a8d12016-07-08 12:30:39 +0200111 "log_level": log_level_schema,
tierno72f35a52016-07-15 13:18:30 +0200112 "log_socket_level": log_level_schema,
tiernoae4a8d12016-07-08 12:30:39 +0200113 "log_level_db": log_level_schema,
tierno73ad9e42016-09-12 18:11:11 +0200114 "log_level_vim": log_level_schema,
tiernof97fd272016-07-11 14:32:37 +0200115 "log_level_nfvo": log_level_schema,
tierno73ad9e42016-09-12 18:11:11 +0200116 "log_level_http": log_level_schema,
tierno1ae51342017-01-16 12:48:30 +0000117 "log_level_console": log_level_schema,
tierno639520f2017-04-05 19:55:36 +0200118 "log_level_ovim": log_level_schema,
tierno73ad9e42016-09-12 18:11:11 +0200119 "log_file_db": path_schema,
120 "log_file_vim": path_schema,
121 "log_file_nfvo": path_schema,
122 "log_file_http": path_schema,
tierno1ae51342017-01-16 12:48:30 +0000123 "log_file_console": path_schema,
tierno639520f2017-04-05 19:55:36 +0200124 "log_file_ovim": path_schema,
tierno72f35a52016-07-15 13:18:30 +0200125 "log_socket_host": nameshort_schema,
126 "log_socket_port": port_schema,
tiernof97fd272016-07-11 14:32:37 +0200127 "log_file": path_schema,
tierno7edb6752016-03-21 17:37:52 +0100128 },
tierno639520f2017-04-05 19:55:36 +0200129 "required": ['db_user', 'db_passwd', 'db_name'],
tierno7edb6752016-03-21 17:37:52 +0100130 "additionalProperties": False
131}
132
133tenant_schema = {
134 "title":"tenant information schema",
135 "$schema": "http://json-schema.org/draft-04/schema#",
136 "type":"object",
137 "properties":{
138 "tenant":{
139 "type":"object",
140 "properties":{
141 "name": nameshort_schema,
142 "description": description_schema,
143 },
144 "required": ["name"],
145 "additionalProperties": True
146 }
147 },
148 "required": ["tenant"],
149 "additionalProperties": False
150}
garciadeblasfec35df2016-08-25 11:33:57 +0200151
tierno7edb6752016-03-21 17:37:52 +0100152tenant_edit_schema = {
153 "title":"tenant edit information schema",
154 "$schema": "http://json-schema.org/draft-04/schema#",
155 "type":"object",
156 "properties":{
157 "tenant":{
158 "type":"object",
159 "properties":{
160 "name": name_schema,
161 "description": description_schema,
162 },
163 "additionalProperties": False
164 }
165 },
166 "required": ["tenant"],
167 "additionalProperties": False
168}
169
170datacenter_schema_properties={
garciadeblasfec35df2016-08-25 11:33:57 +0200171 "name": name_schema,
172 "description": description_schema,
173 "type": nameshort_schema, #currently "openvim" or "openstack", can be enlarged with plugins
174 "vim_url": description_schema,
175 "vim_url_admin": description_schema,
176 "config": { "type":"object" }
177}
tierno7edb6752016-03-21 17:37:52 +0100178
179datacenter_schema = {
180 "title":"datacenter information schema",
181 "$schema": "http://json-schema.org/draft-04/schema#",
182 "type":"object",
183 "properties":{
184 "datacenter":{
185 "type":"object",
186 "properties":datacenter_schema_properties,
187 "required": ["name", "vim_url"],
188 "additionalProperties": True
189 }
190 },
191 "required": ["datacenter"],
192 "additionalProperties": False
193}
194
195
196datacenter_edit_schema = {
197 "title":"datacenter edit nformation schema",
198 "$schema": "http://json-schema.org/draft-04/schema#",
199 "type":"object",
200 "properties":{
201 "datacenter":{
202 "type":"object",
203 "properties":datacenter_schema_properties,
204 "additionalProperties": False
205 }
206 },
207 "required": ["datacenter"],
208 "additionalProperties": False
209}
210
211
212netmap_new_schema = {
213 "title":"netmap new information schema",
214 "$schema": "http://json-schema.org/draft-04/schema#",
215 "type":"object",
216 "properties":{
217 "netmap":{ #delete from datacenter
218 "type":"object",
219 "properties":{
220 "name": name_schema, #name or uuid of net to change
221 "vim_id": id_schema,
222 "vim_name": name_schema
223 },
224 "minProperties": 1,
225 "additionalProperties": False
226 },
227 },
228 "required": ["netmap"],
229 "additionalProperties": False
230}
231
232netmap_edit_schema = {
233 "title":"netmap edit information schema",
234 "$schema": "http://json-schema.org/draft-04/schema#",
235 "type":"object",
236 "properties":{
237 "netmap":{ #delete from datacenter
238 "type":"object",
239 "properties":{
240 "name": name_schema, #name or uuid of net to change
241 },
242 "minProperties": 1,
243 "additionalProperties": False
244 },
245 },
246 "required": ["netmap"],
247 "additionalProperties": False
248}
249
250datacenter_action_schema = {
251 "title":"datacenter action information schema",
252 "$schema": "http://json-schema.org/draft-04/schema#",
253 "type":"object",
254 "properties":{
255 "net-update":{"type":"null",},
256 "net-edit":{
257 "type":"object",
258 "properties":{
259 "net": name_schema, #name or uuid of net to change
260 "name": name_schema,
261 "description": description_schema,
262 "shared": {"type": "boolean"}
263 },
264 "minProperties": 1,
265 "additionalProperties": False
266 },
267 "net-delete":{
268 "type":"object",
269 "properties":{
270 "net": name_schema, #name or uuid of net to change
271 },
272 "required": ["net"],
273 "additionalProperties": False
274 },
275 },
276 "minProperties": 1,
277 "maxProperties": 1,
278 "additionalProperties": False
279}
280
281
282datacenter_associate_schema={
283 "title":"datacenter associate information schema",
284 "$schema": "http://json-schema.org/draft-04/schema#",
285 "type":"object",
286 "properties":{
287 "datacenter":{
288 "type":"object",
289 "properties":{
tierno8008c3a2016-10-13 15:34:28 +0000290 "vim_tenant": name_schema,
291 "vim_tenant_name": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100292 "vim_username": nameshort_schema,
293 "vim_password": nameshort_schema,
tierno8008c3a2016-10-13 15:34:28 +0000294 "config": {"type": "object"}
tierno7edb6752016-03-21 17:37:52 +0100295 },
296# "required": ["vim_tenant"],
297 "additionalProperties": True
298 }
299 },
300 "required": ["datacenter"],
301 "additionalProperties": False
302}
303
garciadeblasfec35df2016-08-25 11:33:57 +0200304dhcp_schema = {
tierno41a69812018-02-16 14:34:33 +0100305 "title": "DHCP schema",
garciadeblasfec35df2016-08-25 11:33:57 +0200306 "$schema": "http://json-schema.org/draft-04/schema#",
tierno41a69812018-02-16 14:34:33 +0100307 "type": "object",
garciadeblasfec35df2016-08-25 11:33:57 +0200308 "properties":{
309 "enabled": {"type": "boolean"},
tierno41a69812018-02-16 14:34:33 +0100310 "start-address": {"OneOf": [{"type": "null"}, ip_schema]},
311 "count": integer0_schema
garciadeblas9f8456e2016-09-05 05:02:59 +0200312 },
313 "required": ["enabled", "start-address", "count"],
garciadeblasfec35df2016-08-25 11:33:57 +0200314}
315
316ip_profile_schema = {
tierno41a69812018-02-16 14:34:33 +0100317 "title": "IP profile schema",
garciadeblasfec35df2016-08-25 11:33:57 +0200318 "$schema": "http://json-schema.org/draft-04/schema#",
tierno41a69812018-02-16 14:34:33 +0100319 "type": "object",
320 "properties": {
tierno455612d2017-05-30 16:40:10 +0200321 "ip-version": {"type": "string", "enum": ["IPv4","IPv6"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200322 "subnet-address": ip_prefix_schema,
323 "gateway-address": ip_schema,
tierno455612d2017-05-30 16:40:10 +0200324 "dns-address": {"oneOf": [ip_schema, # for backward compatibility
325 {"type": "array", "items": ip_schema}]},
garciadeblasfec35df2016-08-25 11:33:57 +0200326 "dhcp": dhcp_schema
327 },
328}
329
330key_pair_schema = {
331 "title": "Key-pair schema for cloud-init configuration schema",
332 "$schema": "http://json-schema.org/draft-04/schema#",
333 "type":"object",
334 "properties":{
335 "name": name_schema,
336 "key": {"type":"string"}
337 },
338 "required": ["key"],
339 "additionalProperties": False
340}
341
342cloud_config_user_schema = {
343 "title": "User schema for cloud-init configuration schema",
344 "$schema": "http://json-schema.org/draft-04/schema#",
345 "type":"object",
346 "properties":{
347 "name": nameshort_schema,
348 "user-info": {"type":"string"},
349 #"key-pairs": {"type" : "array", "items": key_pair_schema}
350 "key-pairs": {"type" : "array", "items": {"type":"string"}}
351 },
352 "required": ["name"],
353 "additionalProperties": False
354}
355
356cloud_config_schema = {
357 "title": "Cloud-init configuration schema",
358 "$schema": "http://json-schema.org/draft-04/schema#",
359 "type":"object",
360 "properties":{
361 #"key-pairs": {"type" : "array", "items": key_pair_schema},
362 "key-pairs": {"type" : "array", "items": {"type":"string"}},
363 "users": {"type" : "array", "items": cloud_config_user_schema}
364 },
365 "additionalProperties": False
366}
367
tierno7edb6752016-03-21 17:37:52 +0100368internal_connection_element_schema = {
369 "type":"object",
370 "properties":{
371 "VNFC": name_schema,
372 "local_iface_name": name_schema
373 }
374}
375
garciadeblasfec35df2016-08-25 11:33:57 +0200376internal_connection_element_schema_v02 = {
377 "type":"object",
378 "properties":{
379 "VNFC": name_schema,
380 "local_iface_name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200381 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200382 }
383}
384
tierno7edb6752016-03-21 17:37:52 +0100385internal_connection_schema = {
386 "type":"object",
387 "properties":{
388 "name": name_schema,
389 "description":description_schema,
390 "type":{"type":"string", "enum":["bridge","data","ptp"]},
tierno8e690322017-08-10 15:58:50 +0200391 "elements": {"type" : "array", "items": internal_connection_element_schema, "minItems":1}
tierno7edb6752016-03-21 17:37:52 +0100392 },
393 "required": ["name", "type", "elements"],
394 "additionalProperties": False
395}
396
garciadeblasfec35df2016-08-25 11:33:57 +0200397internal_connection_schema_v02 = {
398 "type":"object",
399 "properties":{
400 "name": name_schema,
401 "description":description_schema,
402 "type": {"type": "string", "enum":["e-line", "e-lan"]},
garciadeblas9f8456e2016-09-05 05:02:59 +0200403 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200404 "ip-profile": ip_profile_schema,
tierno8e690322017-08-10 15:58:50 +0200405 "elements": {"type" : "array", "items": internal_connection_element_schema_v02, "minItems":1}
garciadeblasfec35df2016-08-25 11:33:57 +0200406 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200407 "required": ["name", "type", "implementation", "elements"],
garciadeblasfec35df2016-08-25 11:33:57 +0200408 "additionalProperties": False
409}
410
tierno7edb6752016-03-21 17:37:52 +0100411external_connection_schema = {
412 "type":"object",
413 "properties":{
414 "name": name_schema,
415 "type":{"type":"string", "enum":["mgmt","bridge","data"]},
416 "VNFC": name_schema,
417 "local_iface_name": name_schema ,
418 "description":description_schema
419 },
420 "required": ["name", "type", "VNFC", "local_iface_name"],
421 "additionalProperties": False
422}
423
garciadeblas9f8456e2016-09-05 05:02:59 +0200424#Not yet used
garciadeblasfec35df2016-08-25 11:33:57 +0200425external_connection_schema_v02 = {
426 "type":"object",
427 "properties":{
428 "name": name_schema,
garciadeblas9f8456e2016-09-05 05:02:59 +0200429 "mgmt": {"type":"boolean"},
430 "type": {"type": "string", "enum":["e-line", "e-lan"]},
431 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200432 "VNFC": name_schema,
433 "local_iface_name": name_schema ,
434 "description":description_schema
435 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200436 "required": ["name", "type", "VNFC", "local_iface_name"],
garciadeblasfec35df2016-08-25 11:33:57 +0200437 "additionalProperties": False
438}
439
tierno7edb6752016-03-21 17:37:52 +0100440interfaces_schema={
441 "type":"array",
442 "items":{
443 "type":"object",
444 "properties":{
445 "name":name_schema,
446 "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]},
447 "bandwidth":bandwidth_schema,
448 "vpci":pci_schema,
449 "mac_address": mac_schema
450 },
451 "additionalProperties": False,
452 "required": ["name","dedicated", "bandwidth"]
453 }
454}
455
456bridge_interfaces_schema={
457 "type":"array",
458 "items":{
459 "type":"object",
460 "properties":{
461 "name": name_schema,
462 "bandwidth":bandwidth_schema,
463 "vpci":pci_schema,
464 "mac_address": mac_schema,
montesmoreno2a1fc4e2017-01-09 16:46:04 +0000465 "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139"]},
466 "port-security": {"type" : "boolean"},
467 "floating-ip": {"type" : "boolean"}
tierno7edb6752016-03-21 17:37:52 +0100468 },
469 "additionalProperties": False,
470 "required": ["name"]
471 }
472}
473
474devices_schema={
475 "type":"array",
476 "items":{
477 "type":"object",
478 "properties":{
479 "type":{"type":"string", "enum":["disk","cdrom","xml"] },
480 "image": path_schema,
garciadeblasb69fa9f2016-09-28 12:04:10 +0200481 "image name": name_schema,
482 "image checksum": checksum_schema,
montesmoreno0c8def02016-12-22 12:16:23 +0000483 "image metadata": metadata_schema,
484 "size": size_schema,
tierno7edb6752016-03-21 17:37:52 +0100485 "vpci":pci_schema,
486 "xml":xml_text_schema,
487 },
488 "additionalProperties": False,
489 "required": ["type"]
490 }
491}
492
493
494numa_schema = {
495 "type": "object",
496 "properties": {
497 "memory":integer1_schema,
498 "cores":integer1_schema,
499 "paired-threads":integer1_schema,
500 "threads":integer1_schema,
501 "cores-id":{"type":"array","items":integer0_schema},
502 "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema}},
503 "threads-id":{"type":"array","items":integer0_schema},
504 "interfaces":interfaces_schema
505 },
506 "additionalProperties": False,
507 #"required": ["memory"]
508}
509
tierno36c0b172017-01-12 18:32:28 +0100510config_files_schema = {
511 "title": "Config files for cloud init schema",
512 "$schema": "http://json-schema.org/draft-04/schema#",
513 "type": "object",
514 "properties": {
515 "dest": path_schema,
516 "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]}, #by default text
517 "content": {"type": "string"},
518 "permissions": {"type": "string"}, # tiypically octal notation '0644'
519 "owner": {"type": "string"}, # format: owner:group
520
521 },
522 "additionalProperties": False,
523 "required": ["dest", "content"],
524}
525
526boot_data_vdu_schema = {
527 "title": "Boot data (Cloud-init) configuration schema",
528 "$schema": "http://json-schema.org/draft-04/schema#",
529 "type": "object",
530 "properties":{
531 "key-pairs": {"type" : "array", "items": {"type":"string"}},
532 "users": {"type" : "array", "items": cloud_config_user_schema},
533 "user-data": {"type" : "string"}, # scrip to run
534 "config-files": {"type": "array", "items": config_files_schema},
535 # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data
536 "boot-data-drive": {"type": "boolean"},
537 },
538 "additionalProperties": False,
539}
540
tierno7edb6752016-03-21 17:37:52 +0100541vnfc_schema = {
542 "type":"object",
543 "properties":{
544 "name": name_schema,
545 "description": description_schema,
tierno8e690322017-08-10 15:58:50 +0200546 "count": integer1_schema,
garciadeblasb69fa9f2016-09-28 12:04:10 +0200547 "image name": name_schema,
mirabal29356312017-07-27 12:21:22 +0200548 "availability_zone": name_schema,
549 "VNFC image": {"oneOf": [path_schema, http_schema]},
garciadeblasb69fa9f2016-09-28 12:04:10 +0200550 "image checksum": checksum_schema,
gcalvinoe580c7d2017-09-22 14:09:51 +0200551 "image metadata": metadata_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200552 #"cloud-config": cloud_config_schema, #common for all vnfs in the scenario
tierno7edb6752016-03-21 17:37:52 +0100553 "processor": {
554 "type":"object",
555 "properties":{
556 "model":description_schema,
557 "features":{"type":"array","items":nameshort_schema}
558 },
559 "required": ["model"],
560 "additionalProperties": False
561 },
562 "hypervisor": {
563 "type":"object",
564 "properties":{
565 "type":nameshort_schema,
566 "version":description_schema
567 },
568 },
569 "ram":integer0_schema,
570 "vcpus":integer0_schema,
571 "disk": integer1_schema,
572 "numas": {
573 "type": "array",
garciadeblasfec35df2016-08-25 11:33:57 +0200574 "items": numa_schema
tierno7edb6752016-03-21 17:37:52 +0100575 },
576 "bridge-ifaces": bridge_interfaces_schema,
tierno36c0b172017-01-12 18:32:28 +0100577 "devices": devices_schema,
578 "boot-data" : boot_data_vdu_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200579
tierno7edb6752016-03-21 17:37:52 +0100580 },
garciadeblasb69fa9f2016-09-28 12:04:10 +0200581 "required": ["name"],
582 "oneOf": [
583 {"required": ["VNFC image"]},
584 {"required": ["image name"]}
585 ],
tierno7edb6752016-03-21 17:37:52 +0100586 "additionalProperties": False
587}
588
589vnfd_schema_v01 = {
590 "title":"vnfd information schema v0.1",
591 "$schema": "http://json-schema.org/draft-04/schema#",
592 "type":"object",
593 "properties":{
594 "vnf":{
595 "type":"object",
596 "properties":{
597 "name": name_schema,
598 "description": description_schema,
mirabal29356312017-07-27 12:21:22 +0200599
tierno7edb6752016-03-21 17:37:52 +0100600 "class": nameshort_schema,
601 "public": {"type" : "boolean"},
602 "physical": {"type" : "boolean"},
gcalvinoe580c7d2017-09-22 14:09:51 +0200603 "default_user": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100604 "tenant_id": id_schema, #only valid for admin
605 "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1},
606 "internal-connections": {"type" : "array", "items": internal_connection_schema, "minItems":1},
607 "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1}
608 },
609 "required": ["name","external-connections"],
610 "additionalProperties": True
611 }
612 },
613 "required": ["vnf"],
614 "additionalProperties": False
615}
616
gcalvinoe580c7d2017-09-22 14:09:51 +0200617#VNFD schema for OSM R1
tierno7edb6752016-03-21 17:37:52 +0100618vnfd_schema_v02 = {
619 "title":"vnfd information schema v0.2",
620 "$schema": "http://json-schema.org/draft-04/schema#",
621 "type":"object",
622 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +0200623 "schema_version": {"type": "string", "enum": ["0.2"]},
tierno7edb6752016-03-21 17:37:52 +0100624 "vnf":{
625 "type":"object",
626 "properties":{
627 "name": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200628 "description": description_schema,
629 "class": nameshort_schema,
630 "public": {"type" : "boolean"},
631 "physical": {"type" : "boolean"},
632 "tenant_id": id_schema, #only valid for admin
garciadeblas9f8456e2016-09-05 05:02:59 +0200633 "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1},
garciadeblasfec35df2016-08-25 11:33:57 +0200634 "internal-connections": {"type" : "array", "items": internal_connection_schema_v02, "minItems":1},
635 # "cloud-config": cloud_config_schema, #common for all vnfcs
636 "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1}
tierno7edb6752016-03-21 17:37:52 +0100637 },
638 "required": ["name"],
639 "additionalProperties": True
640 }
641 },
tierno392f2852016-05-13 12:28:55 +0200642 "required": ["vnf", "schema_version"],
tierno7edb6752016-03-21 17:37:52 +0100643 "additionalProperties": False
644}
645
646#vnfd_schema = vnfd_schema_v01
647#{
648# "title":"vnfd information schema v0.2",
649# "$schema": "http://json-schema.org/draft-04/schema#",
650# "oneOf": [vnfd_schema_v01, vnfd_schema_v02]
651#}
652
653graph_schema = {
654 "title":"graphical scenario descriptor information schema",
655 "$schema": "http://json-schema.org/draft-04/schema#",
656 "type":"object",
657 "properties":{
658 "x": integer0_schema,
659 "y": integer0_schema,
660 "ifaces": {
661 "type":"object",
662 "properties":{
663 "left": {"type":"array"},
664 "right": {"type":"array"},
665 "bottom": {"type":"array"},
666 }
667 }
668 },
669 "required": ["x","y"]
670}
671
672nsd_schema_v01 = {
673 "title":"network scenario descriptor information schema v0.1",
674 "$schema": "http://json-schema.org/draft-04/schema#",
675 "type":"object",
676 "properties":{
677 "name":name_schema,
678 "description": description_schema,
679 "tenant_id": id_schema, #only valid for admin
tierno392f2852016-05-13 12:28:55 +0200680 "public": {"type": "boolean"},
tierno7edb6752016-03-21 17:37:52 +0100681 "topology":{
682 "type":"object",
683 "properties":{
684 "nodes": {
685 "type":"object",
686 "patternProperties":{
687 ".": {
688 "type": "object",
689 "properties":{
690 "type":{"type":"string", "enum":["VNF", "other_network", "network", "external_network"]},
691 "vnf_id": id_schema,
692 "graph": graph_schema,
693 },
694 "patternProperties":{
695 "^(VNF )?model$": {"type": "string"}
696 },
697 "required": ["type"]
698 }
699 }
700 },
701 "connections": {
702 "type":"object",
703 "patternProperties":{
704 ".": {
705 "type": "object",
706 "properties":{
707 "nodes":{"oneOf":[{"type":"object", "minProperties":2}, {"type":"array", "minLength":1}]},
708 "type": {"type": "string", "enum":["link", "external_network", "dataplane_net", "bridge_net"]},
709 "graph": graph_schema
710 },
711 "required": ["nodes"]
712 },
713 }
714 }
715 },
716 "required": ["nodes"],
717 "additionalProperties": False
718 }
719 },
720 "required": ["name","topology"],
721 "additionalProperties": False
722}
723
tierno7edb6752016-03-21 17:37:52 +0100724nsd_schema_v02 = {
725 "title":"network scenario descriptor information schema v0.2",
726 "$schema": "http://json-schema.org/draft-04/schema#",
727 "type":"object",
728 "properties":{
garciadeblas0c317ee2016-08-29 12:33:06 +0200729 "schema_version": schema_version_2,
tierno392f2852016-05-13 12:28:55 +0200730 "scenario":{
tierno7edb6752016-03-21 17:37:52 +0100731 "type":"object",
tierno392f2852016-05-13 12:28:55 +0200732 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +0200733 "name": name_schema,
tierno392f2852016-05-13 12:28:55 +0200734 "description": description_schema,
735 "tenant_id": id_schema, #only valid for admin
736 "public": {"type": "boolean"},
737 "vnfs": {
738 "type":"object",
739 "patternProperties":{
740 ".": {
741 "type": "object",
742 "properties":{
743 "vnf_id": id_schema,
744 "graph": graph_schema,
745 "vnf_name": name_schema,
746 },
747 }
tierno7edb6752016-03-21 17:37:52 +0100748 },
tierno392f2852016-05-13 12:28:55 +0200749 "minProperties": 1
tierno7edb6752016-03-21 17:37:52 +0100750 },
tierno392f2852016-05-13 12:28:55 +0200751 "networks": {
752 "type":"object",
753 "patternProperties":{
754 ".": {
755 "type": "object",
756 "properties":{
757 "interfaces":{"type":"array", "minLength":1},
758 "type": {"type": "string", "enum":["dataplane", "bridge"]},
759 "external" : {"type": "boolean"},
760 "graph": graph_schema
761 },
762 "required": ["interfaces"]
763 },
764 }
765 },
766
767 },
garciadeblasfec35df2016-08-25 11:33:57 +0200768 "required": ["vnfs", "name"],
769 "additionalProperties": False
770 }
771 },
772 "required": ["scenario","schema_version"],
773 "additionalProperties": False
774}
775
776#NSD schema for OSM R1
777nsd_schema_v03 = {
778 "title":"network scenario descriptor information schema v0.3",
779 "$schema": "http://json-schema.org/draft-04/schema#",
780 "type":"object",
781 "properties":{
782 "schema_version": {"type": "string", "enum": ["0.3"]},
783 "scenario":{
784 "type":"object",
785 "properties":{
786 "name": name_schema,
787 "description": description_schema,
788 "tenant_id": id_schema, #only valid for admin
789 "public": {"type": "boolean"},
790 "cloud-config": cloud_config_schema, #common for all vnfs in the scenario
garciadeblas0c317ee2016-08-29 12:33:06 +0200791 #"datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200792 "vnfs": {
793 "type":"object",
794 "patternProperties":{
795 ".": {
796 "type": "object",
797 "properties":{
798 "vnf_id": id_schema,
799 "graph": graph_schema,
800 "vnf_name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200801 #"cloud-config": cloud_config_schema, #particular for a vnf
802 #"datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200803 "internal-connections": {
804 "type": "object",
805 "patternProperties": {
806 ".": {
807 "type": "object",
808 "properties": {
809 "ip-profile": ip_profile_schema,
810 "elements": {
811 "type" : "array",
812 "items":{
813 "type":"object",
814 "properties":{
815 "VNFC": name_schema,
816 "local_iface_name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200817 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200818 },
819 "required": ["VNFC", "local_iface_name"],
820 }
821 }
822 }
823 }
824 }
825 }
826 },
827 }
828 },
829 "minProperties": 1
830 },
831 "networks": {
832 "type":"object",
833 "patternProperties":{
834 ".": {
835 "type": "object",
836 "properties":{
837 "interfaces":{
838 "type":"array",
839 "minLength":1,
840 "items":{
841 "type":"object",
842 "properties":{
garciadeblas9f8456e2016-09-05 05:02:59 +0200843 "vnf": name_schema,
844 "vnf_interface": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200845 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200846 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200847 "required": ["vnf", "vnf_interface"],
garciadeblasfec35df2016-08-25 11:33:57 +0200848 }
849 },
850 "type": {"type": "string", "enum":["e-line", "e-lan"]},
garciadeblas9f8456e2016-09-05 05:02:59 +0200851 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200852 "external" : {"type": "boolean"},
853 "graph": graph_schema,
854 "ip-profile": ip_profile_schema
855 },
856 "required": ["interfaces"]
857 },
858 }
859 },
860
861 },
tierno392f2852016-05-13 12:28:55 +0200862 "required": ["vnfs", "networks","name"],
863 "additionalProperties": False
864 }
tierno7edb6752016-03-21 17:37:52 +0100865 },
tierno392f2852016-05-13 12:28:55 +0200866 "required": ["scenario","schema_version"],
tierno7edb6752016-03-21 17:37:52 +0100867 "additionalProperties": False
868}
869
870#scenario_new_schema = {
871# "title":"new scenario information schema",
872# "$schema": "http://json-schema.org/draft-04/schema#",
873# #"oneOf": [nsd_schema_v01, nsd_schema_v02]
874# "oneOf": [nsd_schema_v01]
875#}
876
877scenario_edit_schema = {
878 "title":"edit scenario information schema",
879 "$schema": "http://json-schema.org/draft-04/schema#",
880 "type":"object",
881 "properties":{
882 "name":name_schema,
883 "description": description_schema,
884 "topology":{
885 "type":"object",
886 "properties":{
887 "nodes": {
888 "type":"object",
889 "patternProperties":{
890 "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$": {
891 "type":"object",
892 "properties":{
893 "graph":{
894 "type": "object",
895 "properties":{
896 "x": integer0_schema,
897 "y": integer0_schema,
898 "ifaces":{ "type": "object"}
899 }
900 },
901 "description": description_schema,
902 "name": name_schema
903 }
904 }
905 }
906 }
907 },
908 "required": ["nodes"],
909 "additionalProperties": False
910 }
911 },
912 "additionalProperties": False
913}
914
915scenario_action_schema = {
916 "title":"scenario action information schema",
917 "$schema": "http://json-schema.org/draft-04/schema#",
918 "type":"object",
919 "properties":{
920 "start":{
921 "type": "object",
922 "properties": {
923 "instance_name":name_schema,
924 "description":description_schema,
925 "datacenter": {"type": "string"}
926 },
927 "required": ["instance_name"]
928 },
929 "deploy":{
930 "type": "object",
931 "properties": {
932 "instance_name":name_schema,
933 "description":description_schema,
934 "datacenter": {"type": "string"}
935 },
936 "required": ["instance_name"]
937 },
938 "reserve":{
939 "type": "object",
940 "properties": {
941 "instance_name":name_schema,
942 "description":description_schema,
943 "datacenter": {"type": "string"}
944 },
945 "required": ["instance_name"]
946 },
947 "verify":{
948 "type": "object",
949 "properties": {
950 "instance_name":name_schema,
951 "description":description_schema,
952 "datacenter": {"type": "string"}
953 },
954 "required": ["instance_name"]
955 }
956 },
957 "minProperties": 1,
958 "maxProperties": 1,
959 "additionalProperties": False
960}
961
garciadeblasfec35df2016-08-25 11:33:57 +0200962instance_scenario_create_schema_v01 = {
tierno7edb6752016-03-21 17:37:52 +0100963 "title":"instance scenario create information schema v0.1",
964 "$schema": "http://json-schema.org/draft-04/schema#",
965 "type":"object",
966 "properties":{
967 "schema_version": {"type": "string", "enum": ["0.1"]},
968 "instance":{
969 "type":"object",
970 "properties":{
971 "name":name_schema,
972 "description":description_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200973 "datacenter": name_schema,
974 "scenario" : name_schema, #can be an UUID or name
tierno7edb6752016-03-21 17:37:52 +0100975 "action":{"enum": ["deploy","reserve","verify" ]},
garciadeblasfec35df2016-08-25 11:33:57 +0200976 "connect_mgmt_interfaces": {"oneOf": [{"type":"boolean"}, {"type":"object"}]},# can be true or a dict with datacenter: net_name
977 "cloud-config": cloud_config_schema, #common to all vnfs in the instance scenario
tierno7edb6752016-03-21 17:37:52 +0100978 "vnfs":{ #mapping from scenario to datacenter
979 "type": "object",
980 "patternProperties":{
981 ".": {
982 "type": "object",
983 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +0200984 "name": name_schema, #override vnf name
garciadeblas0c317ee2016-08-29 12:33:06 +0200985 "datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200986 #"metadata": {"type": "object"},
987 #"user_data": {"type": "string"}
garciadeblas0c317ee2016-08-29 12:33:06 +0200988 #"cloud-config": cloud_config_schema, #particular for a vnf
garciadeblasfec35df2016-08-25 11:33:57 +0200989 "external-connections": {
990 "type": "object",
991 "patternProperties": {
992 ".": {
993 "type": "object",
994 "properties": {
995 "vim-network-name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200996 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200997 }
998 }
999 }
1000 },
1001 "internal-connections": {
1002 "type": "object",
1003 "patternProperties": {
1004 ".": {
1005 "type": "object",
1006 "properties": {
1007 "ip-profile": ip_profile_schema,
1008 "elements": {
1009 "type" : "array",
1010 "items":{
1011 "type":"object",
1012 "properties":{
1013 "VNFC": name_schema,
1014 "local_iface_name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +02001015 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +02001016 },
1017 "required": ["VNFC", "local_iface_name"],
1018 }
1019 }
1020 }
1021 }
1022 }
1023 }
tierno7edb6752016-03-21 17:37:52 +01001024 }
1025 }
1026 },
1027 },
1028 "networks":{ #mapping from scenario to datacenter
1029 "type": "object",
1030 "patternProperties":{
1031 ".": {
1032 "type": "object",
1033 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +02001034 "interfaces":{
1035 "type":"array",
1036 "minLength":1,
1037 "items":{
1038 "type":"object",
1039 "properties":{
garciadeblas9f8456e2016-09-05 05:02:59 +02001040 "ip_address": ip_schema,
1041 "datacenter": name_schema,
1042 "vim-network-name": name_schema
garciadeblasfec35df2016-08-25 11:33:57 +02001043 },
1044 "patternProperties":{
1045 ".": {"type": "string"}
1046 }
1047 }
1048 },
garciadeblasfec35df2016-08-25 11:33:57 +02001049 "ip-profile": ip_profile_schema,
tiernobe41e222016-09-02 15:16:13 +02001050 #if the network connects VNFs deployed at different sites, you must specify one entry per site that this network connect to
1051 "sites": {
1052 "type":"array",
1053 "minLength":1,
1054 "items":{
1055 "type":"object",
1056 "properties":{
1057 # By default for an scenario 'external' network openmano looks for an existing VIM network to map this external scenario network,
1058 # for other networks openamno creates at VIM
1059 # Use netmap-create to force to create an external scenario network
1060 "netmap-create": {"oneOf":[name_schema,{"type": "null"}]}, #datacenter network to use. Null if must be created as an internal net
1061 #netmap-use: Indicates an existing VIM network that must be used for this scenario network.
1062 #Can use both the VIM network name (if it is not ambiguous) or the VIM net UUID
1063 #If both 'netmap-create' and 'netmap-use'are supplied, netmap-use precedes, but if fails openmano follows the netmap-create
1064 #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)
1065 "netmap-use": name_schema, #
1066 "vim-network-name": name_schema, #override network name
1067 #"ip-profile": ip_profile_schema,
1068 "datacenter": name_schema,
1069 }
1070 }
1071 },
1072
1073
1074
tierno7edb6752016-03-21 17:37:52 +01001075 }
1076 }
1077 },
1078 },
1079 },
1080 "additionalProperties": False,
garciadeblasfec35df2016-08-25 11:33:57 +02001081 "required": ["name"]
tierno7edb6752016-03-21 17:37:52 +01001082 },
1083 },
1084 "required": ["instance"],
1085 "additionalProperties": False
tierno7edb6752016-03-21 17:37:52 +01001086}
1087
1088instance_scenario_action_schema = {
tierno16e3dd42018-04-24 12:52:40 +02001089 "title": "instance scenario action information schema",
tierno7edb6752016-03-21 17:37:52 +01001090 "$schema": "http://json-schema.org/draft-04/schema#",
tierno16e3dd42018-04-24 12:52:40 +02001091 "type": "object",
1092 "properties": {
1093 "start": {"type": "null"},
1094 "pause": {"type": "null"},
1095 "resume": {"type": "null"},
1096 "shutoff": {"type": "null"},
1097 "shutdown": {"type": "null"},
1098 "forceOff": {"type": "null"},
1099 "rebuild": {"type": "null"},
1100 "reboot": {
1101 "type": ["object", "null"],
tierno7edb6752016-03-21 17:37:52 +01001102 },
gcalvinoe580c7d2017-09-22 14:09:51 +02001103 "add_public_key": description_schema,
tierno7edb6752016-03-21 17:37:52 +01001104 "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]},
tierno868220c2017-09-26 00:11:05 +02001105 "create-vdu": {
gcalvinoe580c7d2017-09-22 14:09:51 +02001106 "type": "array",
tierno16e3dd42018-04-24 12:52:40 +02001107 "items": {
tierno868220c2017-09-26 00:11:05 +02001108 "type": "object",
tierno16e3dd42018-04-24 12:52:40 +02001109 "properties": {
tierno868220c2017-09-26 00:11:05 +02001110 "vdu-id": id_schema,
1111 "count": integer1_schema,
1112 },
1113 "additionalProperties": False,
1114 "required": ["vdu-id"]
1115 }
1116 },
1117 "delete-vdu": {
gcalvinoe580c7d2017-09-22 14:09:51 +02001118 "type": "array",
tierno16e3dd42018-04-24 12:52:40 +02001119 "items": {
tierno868220c2017-09-26 00:11:05 +02001120 "type": "object",
tierno16e3dd42018-04-24 12:52:40 +02001121 "properties": {
tierno868220c2017-09-26 00:11:05 +02001122 "vdu-id": id_schema,
1123 "transaction-id": id_schema,
1124 },
1125 "additionalProperties": False,
1126 "minProperties": 1,
1127 "maxProperties": 1,
1128 }
1129 },
tierno16e3dd42018-04-24 12:52:40 +02001130 "vnfs": {"type": "array", "items": {"type": "string"}},
1131 "vms": {"type": "array", "items": {"type": "string"}}
tierno7edb6752016-03-21 17:37:52 +01001132 },
1133 "minProperties": 1,
1134 #"maxProperties": 1,
1135 "additionalProperties": False
1136}
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001137
1138sdn_controller_properties={
1139 "name": name_schema,
Pablo Montes Moreno6aa0b2b2017-05-23 18:33:12 +02001140 "dpid": {"type":"string", "pattern":"^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"},
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001141 "ip": ip_schema,
1142 "port": port_schema,
1143 "type": {"type": "string", "enum": ["opendaylight","floodlight","onos"]},
1144 "version": {"type" : "string", "minLength":1, "maxLength":12},
1145 "user": nameshort_schema,
1146 "password": passwd_schema
1147}
1148sdn_controller_schema = {
1149 "title":"sdn controller information schema",
1150 "$schema": "http://json-schema.org/draft-04/schema#",
1151 "type":"object",
1152 "properties":{
1153 "sdn_controller":{
1154 "type":"object",
1155 "properties":sdn_controller_properties,
1156 "required": ["name", "port", 'ip', 'dpid', 'type'],
1157 "additionalProperties": False
1158 }
1159 },
1160 "required": ["sdn_controller"],
1161 "additionalProperties": False
1162}
1163
1164sdn_controller_edit_schema = {
1165 "title":"sdn controller update information schema",
1166 "$schema": "http://json-schema.org/draft-04/schema#",
1167 "type":"object",
1168 "properties":{
1169 "sdn_controller":{
1170 "type":"object",
1171 "properties":sdn_controller_properties,
1172 "additionalProperties": False
1173 }
1174 },
1175 "required": ["sdn_controller"],
1176 "additionalProperties": False
1177}
1178
1179sdn_port_mapping_schema = {
1180 "$schema": "http://json-schema.org/draft-04/schema#",
1181 "title":"sdn port mapping information schema",
1182 "type": "object",
1183 "properties": {
1184 "sdn_port_mapping": {
1185 "type": "array",
1186 "items": {
1187 "type": "object",
1188 "properties": {
1189 "compute_node": nameshort_schema,
1190 "ports": {
1191 "type": "array",
1192 "items": {
1193 "type": "object",
1194 "properties": {
tierno7f426e92018-06-28 15:21:32 +02001195 "pci": pci_extended_schema, # pci_schema,
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001196 "switch_port": nameshort_schema,
1197 "switch_mac": mac_schema
1198 },
1199 "required": ["pci"]
1200 }
1201 }
1202 },
1203 "required": ["compute_node", "ports"]
1204 }
1205 }
1206 },
1207 "required": ["sdn_port_mapping"]
Pablo Montes Moreno6aa0b2b2017-05-23 18:33:12 +02001208}
1209
1210sdn_external_port_schema = {
1211 "$schema": "http://json-schema.org/draft-04/schema#",
1212 "title":"External port ingformation",
1213 "type": "object",
1214 "properties": {
1215 "port": {"type" : "string", "minLength":1, "maxLength":60},
1216 "vlan": vlan_schema,
1217 "mac": mac_schema
1218 },
1219 "required": ["port"]
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001220}