blob: 41b65be3574c632cd8ded3a0ad67e2152f3c6fcc [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":{
tiernod3750b32018-07-20 15:33:08 +0200288 "type": "object",
289 "properties": {
290 "name": name_schema,
291 "vim_id": id_schema,
tierno8008c3a2016-10-13 15:34:28 +0000292 "vim_tenant": name_schema,
293 "vim_tenant_name": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100294 "vim_username": nameshort_schema,
295 "vim_password": nameshort_schema,
tierno8008c3a2016-10-13 15:34:28 +0000296 "config": {"type": "object"}
tierno7edb6752016-03-21 17:37:52 +0100297 },
tiernod3750b32018-07-20 15:33:08 +0200298 # "required": ["vim_tenant"],
tierno7edb6752016-03-21 17:37:52 +0100299 "additionalProperties": True
300 }
301 },
302 "required": ["datacenter"],
303 "additionalProperties": False
304}
305
garciadeblasfec35df2016-08-25 11:33:57 +0200306dhcp_schema = {
tierno41a69812018-02-16 14:34:33 +0100307 "title": "DHCP schema",
garciadeblasfec35df2016-08-25 11:33:57 +0200308 "$schema": "http://json-schema.org/draft-04/schema#",
tierno41a69812018-02-16 14:34:33 +0100309 "type": "object",
garciadeblasfec35df2016-08-25 11:33:57 +0200310 "properties":{
311 "enabled": {"type": "boolean"},
tierno41a69812018-02-16 14:34:33 +0100312 "start-address": {"OneOf": [{"type": "null"}, ip_schema]},
313 "count": integer0_schema
garciadeblas9f8456e2016-09-05 05:02:59 +0200314 },
tierno1df468d2018-07-06 14:25:16 +0200315 # "required": ["start-address", "count"],
garciadeblasfec35df2016-08-25 11:33:57 +0200316}
317
318ip_profile_schema = {
tierno41a69812018-02-16 14:34:33 +0100319 "title": "IP profile schema",
garciadeblasfec35df2016-08-25 11:33:57 +0200320 "$schema": "http://json-schema.org/draft-04/schema#",
tierno41a69812018-02-16 14:34:33 +0100321 "type": "object",
322 "properties": {
tierno1df468d2018-07-06 14:25:16 +0200323 "ip-version": {"type": "string", "enum": ["IPv4", "IPv6"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200324 "subnet-address": ip_prefix_schema,
325 "gateway-address": ip_schema,
tierno455612d2017-05-30 16:40:10 +0200326 "dns-address": {"oneOf": [ip_schema, # for backward compatibility
327 {"type": "array", "items": ip_schema}]},
garciadeblasfec35df2016-08-25 11:33:57 +0200328 "dhcp": dhcp_schema
329 },
330}
331
332key_pair_schema = {
333 "title": "Key-pair schema for cloud-init configuration schema",
334 "$schema": "http://json-schema.org/draft-04/schema#",
335 "type":"object",
336 "properties":{
337 "name": name_schema,
338 "key": {"type":"string"}
339 },
340 "required": ["key"],
341 "additionalProperties": False
342}
343
344cloud_config_user_schema = {
345 "title": "User schema for cloud-init configuration schema",
346 "$schema": "http://json-schema.org/draft-04/schema#",
347 "type":"object",
348 "properties":{
349 "name": nameshort_schema,
350 "user-info": {"type":"string"},
351 #"key-pairs": {"type" : "array", "items": key_pair_schema}
352 "key-pairs": {"type" : "array", "items": {"type":"string"}}
353 },
354 "required": ["name"],
355 "additionalProperties": False
356}
357
358cloud_config_schema = {
359 "title": "Cloud-init configuration schema",
360 "$schema": "http://json-schema.org/draft-04/schema#",
361 "type":"object",
362 "properties":{
363 #"key-pairs": {"type" : "array", "items": key_pair_schema},
364 "key-pairs": {"type" : "array", "items": {"type":"string"}},
365 "users": {"type" : "array", "items": cloud_config_user_schema}
366 },
367 "additionalProperties": False
368}
369
tierno7edb6752016-03-21 17:37:52 +0100370internal_connection_element_schema = {
371 "type":"object",
372 "properties":{
373 "VNFC": name_schema,
374 "local_iface_name": name_schema
375 }
376}
377
garciadeblasfec35df2016-08-25 11:33:57 +0200378internal_connection_element_schema_v02 = {
379 "type":"object",
380 "properties":{
381 "VNFC": name_schema,
382 "local_iface_name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200383 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200384 }
385}
386
tierno7edb6752016-03-21 17:37:52 +0100387internal_connection_schema = {
388 "type":"object",
389 "properties":{
390 "name": name_schema,
391 "description":description_schema,
392 "type":{"type":"string", "enum":["bridge","data","ptp"]},
tierno8e690322017-08-10 15:58:50 +0200393 "elements": {"type" : "array", "items": internal_connection_element_schema, "minItems":1}
tierno7edb6752016-03-21 17:37:52 +0100394 },
395 "required": ["name", "type", "elements"],
396 "additionalProperties": False
397}
398
garciadeblasfec35df2016-08-25 11:33:57 +0200399internal_connection_schema_v02 = {
400 "type":"object",
401 "properties":{
402 "name": name_schema,
403 "description":description_schema,
404 "type": {"type": "string", "enum":["e-line", "e-lan"]},
garciadeblas9f8456e2016-09-05 05:02:59 +0200405 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200406 "ip-profile": ip_profile_schema,
tierno8e690322017-08-10 15:58:50 +0200407 "elements": {"type" : "array", "items": internal_connection_element_schema_v02, "minItems":1}
garciadeblasfec35df2016-08-25 11:33:57 +0200408 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200409 "required": ["name", "type", "implementation", "elements"],
garciadeblasfec35df2016-08-25 11:33:57 +0200410 "additionalProperties": False
411}
412
tierno7edb6752016-03-21 17:37:52 +0100413external_connection_schema = {
414 "type":"object",
415 "properties":{
416 "name": name_schema,
417 "type":{"type":"string", "enum":["mgmt","bridge","data"]},
418 "VNFC": name_schema,
419 "local_iface_name": name_schema ,
420 "description":description_schema
421 },
422 "required": ["name", "type", "VNFC", "local_iface_name"],
423 "additionalProperties": False
424}
425
garciadeblas9f8456e2016-09-05 05:02:59 +0200426#Not yet used
garciadeblasfec35df2016-08-25 11:33:57 +0200427external_connection_schema_v02 = {
428 "type":"object",
429 "properties":{
430 "name": name_schema,
garciadeblas9f8456e2016-09-05 05:02:59 +0200431 "mgmt": {"type":"boolean"},
432 "type": {"type": "string", "enum":["e-line", "e-lan"]},
433 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200434 "VNFC": name_schema,
435 "local_iface_name": name_schema ,
436 "description":description_schema
437 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200438 "required": ["name", "type", "VNFC", "local_iface_name"],
garciadeblasfec35df2016-08-25 11:33:57 +0200439 "additionalProperties": False
440}
441
tierno7edb6752016-03-21 17:37:52 +0100442interfaces_schema={
443 "type":"array",
444 "items":{
445 "type":"object",
446 "properties":{
447 "name":name_schema,
448 "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]},
449 "bandwidth":bandwidth_schema,
450 "vpci":pci_schema,
451 "mac_address": mac_schema
452 },
453 "additionalProperties": False,
454 "required": ["name","dedicated", "bandwidth"]
455 }
456}
457
458bridge_interfaces_schema={
459 "type":"array",
460 "items":{
461 "type":"object",
462 "properties":{
463 "name": name_schema,
464 "bandwidth":bandwidth_schema,
465 "vpci":pci_schema,
466 "mac_address": mac_schema,
montesmoreno2a1fc4e2017-01-09 16:46:04 +0000467 "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139"]},
468 "port-security": {"type" : "boolean"},
469 "floating-ip": {"type" : "boolean"}
tierno7edb6752016-03-21 17:37:52 +0100470 },
471 "additionalProperties": False,
472 "required": ["name"]
473 }
474}
475
476devices_schema={
477 "type":"array",
478 "items":{
479 "type":"object",
480 "properties":{
481 "type":{"type":"string", "enum":["disk","cdrom","xml"] },
482 "image": path_schema,
garciadeblasb69fa9f2016-09-28 12:04:10 +0200483 "image name": name_schema,
484 "image checksum": checksum_schema,
montesmoreno0c8def02016-12-22 12:16:23 +0000485 "image metadata": metadata_schema,
486 "size": size_schema,
tierno7edb6752016-03-21 17:37:52 +0100487 "vpci":pci_schema,
488 "xml":xml_text_schema,
tierno1df468d2018-07-06 14:25:16 +0200489 "name": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100490 },
491 "additionalProperties": False,
492 "required": ["type"]
493 }
494}
495
496
497numa_schema = {
498 "type": "object",
499 "properties": {
500 "memory":integer1_schema,
501 "cores":integer1_schema,
502 "paired-threads":integer1_schema,
503 "threads":integer1_schema,
504 "cores-id":{"type":"array","items":integer0_schema},
505 "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema}},
506 "threads-id":{"type":"array","items":integer0_schema},
507 "interfaces":interfaces_schema
508 },
509 "additionalProperties": False,
510 #"required": ["memory"]
511}
512
tierno36c0b172017-01-12 18:32:28 +0100513config_files_schema = {
514 "title": "Config files for cloud init schema",
515 "$schema": "http://json-schema.org/draft-04/schema#",
516 "type": "object",
517 "properties": {
518 "dest": path_schema,
519 "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]}, #by default text
520 "content": {"type": "string"},
521 "permissions": {"type": "string"}, # tiypically octal notation '0644'
522 "owner": {"type": "string"}, # format: owner:group
523
524 },
525 "additionalProperties": False,
526 "required": ["dest", "content"],
527}
528
529boot_data_vdu_schema = {
530 "title": "Boot data (Cloud-init) configuration schema",
531 "$schema": "http://json-schema.org/draft-04/schema#",
532 "type": "object",
533 "properties":{
534 "key-pairs": {"type" : "array", "items": {"type":"string"}},
535 "users": {"type" : "array", "items": cloud_config_user_schema},
536 "user-data": {"type" : "string"}, # scrip to run
537 "config-files": {"type": "array", "items": config_files_schema},
538 # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data
539 "boot-data-drive": {"type": "boolean"},
540 },
541 "additionalProperties": False,
542}
543
tierno7edb6752016-03-21 17:37:52 +0100544vnfc_schema = {
545 "type":"object",
546 "properties":{
547 "name": name_schema,
548 "description": description_schema,
tierno8e690322017-08-10 15:58:50 +0200549 "count": integer1_schema,
garciadeblasb69fa9f2016-09-28 12:04:10 +0200550 "image name": name_schema,
mirabal29356312017-07-27 12:21:22 +0200551 "availability_zone": name_schema,
552 "VNFC image": {"oneOf": [path_schema, http_schema]},
garciadeblasb69fa9f2016-09-28 12:04:10 +0200553 "image checksum": checksum_schema,
gcalvinoe580c7d2017-09-22 14:09:51 +0200554 "image metadata": metadata_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200555 #"cloud-config": cloud_config_schema, #common for all vnfs in the scenario
tierno7edb6752016-03-21 17:37:52 +0100556 "processor": {
557 "type":"object",
558 "properties":{
559 "model":description_schema,
560 "features":{"type":"array","items":nameshort_schema}
561 },
562 "required": ["model"],
563 "additionalProperties": False
564 },
565 "hypervisor": {
566 "type":"object",
567 "properties":{
568 "type":nameshort_schema,
569 "version":description_schema
570 },
571 },
572 "ram":integer0_schema,
573 "vcpus":integer0_schema,
574 "disk": integer1_schema,
575 "numas": {
576 "type": "array",
garciadeblasfec35df2016-08-25 11:33:57 +0200577 "items": numa_schema
tierno7edb6752016-03-21 17:37:52 +0100578 },
579 "bridge-ifaces": bridge_interfaces_schema,
tierno36c0b172017-01-12 18:32:28 +0100580 "devices": devices_schema,
581 "boot-data" : boot_data_vdu_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200582
tierno7edb6752016-03-21 17:37:52 +0100583 },
garciadeblasb69fa9f2016-09-28 12:04:10 +0200584 "required": ["name"],
585 "oneOf": [
586 {"required": ["VNFC image"]},
587 {"required": ["image name"]}
588 ],
tierno7edb6752016-03-21 17:37:52 +0100589 "additionalProperties": False
590}
591
592vnfd_schema_v01 = {
593 "title":"vnfd information schema v0.1",
594 "$schema": "http://json-schema.org/draft-04/schema#",
595 "type":"object",
596 "properties":{
597 "vnf":{
598 "type":"object",
599 "properties":{
600 "name": name_schema,
601 "description": description_schema,
mirabal29356312017-07-27 12:21:22 +0200602
tierno7edb6752016-03-21 17:37:52 +0100603 "class": nameshort_schema,
604 "public": {"type" : "boolean"},
605 "physical": {"type" : "boolean"},
gcalvinoe580c7d2017-09-22 14:09:51 +0200606 "default_user": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100607 "tenant_id": id_schema, #only valid for admin
608 "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1},
609 "internal-connections": {"type" : "array", "items": internal_connection_schema, "minItems":1},
610 "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1}
611 },
612 "required": ["name","external-connections"],
613 "additionalProperties": True
614 }
615 },
616 "required": ["vnf"],
617 "additionalProperties": False
618}
619
gcalvinoe580c7d2017-09-22 14:09:51 +0200620#VNFD schema for OSM R1
tierno7edb6752016-03-21 17:37:52 +0100621vnfd_schema_v02 = {
622 "title":"vnfd information schema v0.2",
623 "$schema": "http://json-schema.org/draft-04/schema#",
624 "type":"object",
625 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +0200626 "schema_version": {"type": "string", "enum": ["0.2"]},
tierno7edb6752016-03-21 17:37:52 +0100627 "vnf":{
628 "type":"object",
629 "properties":{
630 "name": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200631 "description": description_schema,
632 "class": nameshort_schema,
633 "public": {"type" : "boolean"},
634 "physical": {"type" : "boolean"},
635 "tenant_id": id_schema, #only valid for admin
garciadeblas9f8456e2016-09-05 05:02:59 +0200636 "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1},
garciadeblasfec35df2016-08-25 11:33:57 +0200637 "internal-connections": {"type" : "array", "items": internal_connection_schema_v02, "minItems":1},
638 # "cloud-config": cloud_config_schema, #common for all vnfcs
639 "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1}
tierno7edb6752016-03-21 17:37:52 +0100640 },
641 "required": ["name"],
642 "additionalProperties": True
643 }
644 },
tierno392f2852016-05-13 12:28:55 +0200645 "required": ["vnf", "schema_version"],
tierno7edb6752016-03-21 17:37:52 +0100646 "additionalProperties": False
647}
648
649#vnfd_schema = vnfd_schema_v01
650#{
651# "title":"vnfd information schema v0.2",
652# "$schema": "http://json-schema.org/draft-04/schema#",
653# "oneOf": [vnfd_schema_v01, vnfd_schema_v02]
654#}
655
656graph_schema = {
657 "title":"graphical scenario descriptor information schema",
658 "$schema": "http://json-schema.org/draft-04/schema#",
659 "type":"object",
660 "properties":{
661 "x": integer0_schema,
662 "y": integer0_schema,
663 "ifaces": {
664 "type":"object",
665 "properties":{
666 "left": {"type":"array"},
667 "right": {"type":"array"},
668 "bottom": {"type":"array"},
669 }
670 }
671 },
672 "required": ["x","y"]
673}
674
675nsd_schema_v01 = {
676 "title":"network scenario descriptor information schema v0.1",
677 "$schema": "http://json-schema.org/draft-04/schema#",
678 "type":"object",
679 "properties":{
680 "name":name_schema,
681 "description": description_schema,
682 "tenant_id": id_schema, #only valid for admin
tierno392f2852016-05-13 12:28:55 +0200683 "public": {"type": "boolean"},
tierno7edb6752016-03-21 17:37:52 +0100684 "topology":{
685 "type":"object",
686 "properties":{
687 "nodes": {
688 "type":"object",
689 "patternProperties":{
690 ".": {
691 "type": "object",
692 "properties":{
693 "type":{"type":"string", "enum":["VNF", "other_network", "network", "external_network"]},
694 "vnf_id": id_schema,
695 "graph": graph_schema,
696 },
697 "patternProperties":{
698 "^(VNF )?model$": {"type": "string"}
699 },
700 "required": ["type"]
701 }
702 }
703 },
704 "connections": {
705 "type":"object",
706 "patternProperties":{
707 ".": {
708 "type": "object",
709 "properties":{
710 "nodes":{"oneOf":[{"type":"object", "minProperties":2}, {"type":"array", "minLength":1}]},
711 "type": {"type": "string", "enum":["link", "external_network", "dataplane_net", "bridge_net"]},
712 "graph": graph_schema
713 },
714 "required": ["nodes"]
715 },
716 }
717 }
718 },
719 "required": ["nodes"],
720 "additionalProperties": False
721 }
722 },
723 "required": ["name","topology"],
724 "additionalProperties": False
725}
726
tierno7edb6752016-03-21 17:37:52 +0100727nsd_schema_v02 = {
728 "title":"network scenario descriptor information schema v0.2",
729 "$schema": "http://json-schema.org/draft-04/schema#",
730 "type":"object",
731 "properties":{
garciadeblas0c317ee2016-08-29 12:33:06 +0200732 "schema_version": schema_version_2,
tierno392f2852016-05-13 12:28:55 +0200733 "scenario":{
tierno7edb6752016-03-21 17:37:52 +0100734 "type":"object",
tierno392f2852016-05-13 12:28:55 +0200735 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +0200736 "name": name_schema,
tierno392f2852016-05-13 12:28:55 +0200737 "description": description_schema,
738 "tenant_id": id_schema, #only valid for admin
739 "public": {"type": "boolean"},
740 "vnfs": {
741 "type":"object",
742 "patternProperties":{
743 ".": {
744 "type": "object",
745 "properties":{
746 "vnf_id": id_schema,
747 "graph": graph_schema,
748 "vnf_name": name_schema,
749 },
750 }
tierno7edb6752016-03-21 17:37:52 +0100751 },
tierno392f2852016-05-13 12:28:55 +0200752 "minProperties": 1
tierno7edb6752016-03-21 17:37:52 +0100753 },
tierno392f2852016-05-13 12:28:55 +0200754 "networks": {
755 "type":"object",
756 "patternProperties":{
757 ".": {
758 "type": "object",
759 "properties":{
760 "interfaces":{"type":"array", "minLength":1},
761 "type": {"type": "string", "enum":["dataplane", "bridge"]},
762 "external" : {"type": "boolean"},
763 "graph": graph_schema
764 },
765 "required": ["interfaces"]
766 },
767 }
768 },
769
770 },
garciadeblasfec35df2016-08-25 11:33:57 +0200771 "required": ["vnfs", "name"],
772 "additionalProperties": False
773 }
774 },
775 "required": ["scenario","schema_version"],
776 "additionalProperties": False
777}
778
779#NSD schema for OSM R1
780nsd_schema_v03 = {
781 "title":"network scenario descriptor information schema v0.3",
782 "$schema": "http://json-schema.org/draft-04/schema#",
783 "type":"object",
784 "properties":{
785 "schema_version": {"type": "string", "enum": ["0.3"]},
786 "scenario":{
787 "type":"object",
788 "properties":{
789 "name": name_schema,
790 "description": description_schema,
791 "tenant_id": id_schema, #only valid for admin
792 "public": {"type": "boolean"},
793 "cloud-config": cloud_config_schema, #common for all vnfs in the scenario
garciadeblas0c317ee2016-08-29 12:33:06 +0200794 #"datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200795 "vnfs": {
796 "type":"object",
797 "patternProperties":{
798 ".": {
799 "type": "object",
800 "properties":{
801 "vnf_id": id_schema,
802 "graph": graph_schema,
803 "vnf_name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200804 #"cloud-config": cloud_config_schema, #particular for a vnf
805 #"datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200806 "internal-connections": {
807 "type": "object",
808 "patternProperties": {
809 ".": {
810 "type": "object",
811 "properties": {
812 "ip-profile": ip_profile_schema,
813 "elements": {
814 "type" : "array",
815 "items":{
816 "type":"object",
817 "properties":{
818 "VNFC": name_schema,
819 "local_iface_name": name_schema,
tierno1df468d2018-07-06 14:25:16 +0200820 "ip_address": ip_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200821 },
822 "required": ["VNFC", "local_iface_name"],
823 }
824 }
825 }
826 }
827 }
828 }
829 },
830 }
831 },
832 "minProperties": 1
833 },
834 "networks": {
835 "type":"object",
836 "patternProperties":{
837 ".": {
838 "type": "object",
839 "properties":{
840 "interfaces":{
841 "type":"array",
842 "minLength":1,
843 "items":{
844 "type":"object",
845 "properties":{
garciadeblas9f8456e2016-09-05 05:02:59 +0200846 "vnf": name_schema,
847 "vnf_interface": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200848 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200849 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200850 "required": ["vnf", "vnf_interface"],
garciadeblasfec35df2016-08-25 11:33:57 +0200851 }
852 },
853 "type": {"type": "string", "enum":["e-line", "e-lan"]},
garciadeblas9f8456e2016-09-05 05:02:59 +0200854 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200855 "external" : {"type": "boolean"},
856 "graph": graph_schema,
857 "ip-profile": ip_profile_schema
858 },
859 "required": ["interfaces"]
860 },
861 }
862 },
863
864 },
tierno392f2852016-05-13 12:28:55 +0200865 "required": ["vnfs", "networks","name"],
866 "additionalProperties": False
867 }
tierno7edb6752016-03-21 17:37:52 +0100868 },
tierno392f2852016-05-13 12:28:55 +0200869 "required": ["scenario","schema_version"],
tierno7edb6752016-03-21 17:37:52 +0100870 "additionalProperties": False
871}
872
873#scenario_new_schema = {
874# "title":"new scenario information schema",
875# "$schema": "http://json-schema.org/draft-04/schema#",
876# #"oneOf": [nsd_schema_v01, nsd_schema_v02]
877# "oneOf": [nsd_schema_v01]
878#}
879
880scenario_edit_schema = {
881 "title":"edit scenario information schema",
882 "$schema": "http://json-schema.org/draft-04/schema#",
883 "type":"object",
884 "properties":{
885 "name":name_schema,
886 "description": description_schema,
887 "topology":{
888 "type":"object",
889 "properties":{
890 "nodes": {
891 "type":"object",
892 "patternProperties":{
893 "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$": {
894 "type":"object",
895 "properties":{
896 "graph":{
897 "type": "object",
898 "properties":{
899 "x": integer0_schema,
900 "y": integer0_schema,
901 "ifaces":{ "type": "object"}
902 }
903 },
904 "description": description_schema,
905 "name": name_schema
906 }
907 }
908 }
909 }
910 },
911 "required": ["nodes"],
912 "additionalProperties": False
913 }
914 },
915 "additionalProperties": False
916}
917
918scenario_action_schema = {
919 "title":"scenario action information schema",
920 "$schema": "http://json-schema.org/draft-04/schema#",
921 "type":"object",
922 "properties":{
923 "start":{
924 "type": "object",
925 "properties": {
926 "instance_name":name_schema,
927 "description":description_schema,
928 "datacenter": {"type": "string"}
929 },
930 "required": ["instance_name"]
931 },
932 "deploy":{
933 "type": "object",
934 "properties": {
935 "instance_name":name_schema,
936 "description":description_schema,
937 "datacenter": {"type": "string"}
938 },
939 "required": ["instance_name"]
940 },
941 "reserve":{
942 "type": "object",
943 "properties": {
944 "instance_name":name_schema,
945 "description":description_schema,
946 "datacenter": {"type": "string"}
947 },
948 "required": ["instance_name"]
949 },
950 "verify":{
951 "type": "object",
952 "properties": {
953 "instance_name":name_schema,
954 "description":description_schema,
955 "datacenter": {"type": "string"}
956 },
957 "required": ["instance_name"]
958 }
959 },
960 "minProperties": 1,
961 "maxProperties": 1,
962 "additionalProperties": False
963}
964
garciadeblasfec35df2016-08-25 11:33:57 +0200965instance_scenario_create_schema_v01 = {
tierno7edb6752016-03-21 17:37:52 +0100966 "title":"instance scenario create information schema v0.1",
967 "$schema": "http://json-schema.org/draft-04/schema#",
968 "type":"object",
969 "properties":{
970 "schema_version": {"type": "string", "enum": ["0.1"]},
971 "instance":{
972 "type":"object",
973 "properties":{
974 "name":name_schema,
975 "description":description_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200976 "datacenter": name_schema,
977 "scenario" : name_schema, #can be an UUID or name
tierno7edb6752016-03-21 17:37:52 +0100978 "action":{"enum": ["deploy","reserve","verify" ]},
garciadeblasfec35df2016-08-25 11:33:57 +0200979 "connect_mgmt_interfaces": {"oneOf": [{"type":"boolean"}, {"type":"object"}]},# can be true or a dict with datacenter: net_name
980 "cloud-config": cloud_config_schema, #common to all vnfs in the instance scenario
tierno7edb6752016-03-21 17:37:52 +0100981 "vnfs":{ #mapping from scenario to datacenter
982 "type": "object",
983 "patternProperties":{
984 ".": {
985 "type": "object",
986 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +0200987 "name": name_schema, #override vnf name
garciadeblas0c317ee2016-08-29 12:33:06 +0200988 "datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200989 #"metadata": {"type": "object"},
990 #"user_data": {"type": "string"}
garciadeblas0c317ee2016-08-29 12:33:06 +0200991 #"cloud-config": cloud_config_schema, #particular for a vnf
tierno1df468d2018-07-06 14:25:16 +0200992 "vdus": {
993 "type": "object",
994 "patternProperties": {
995 ".": {
996 "type": "object",
997 "properties": {
998 "name": name_schema, # overrides vdu name schema
999 "devices": {
1000 "type": "object",
1001 "patternProperties": {
1002 ".": {
1003 "vim_id": name_schema,
1004 }
1005 }
1006 },
1007 "interfaces": {
1008 "type": "object",
1009 "patternProperties": {
1010 ".": {
1011 "ip_address": ip_schema,
1012 "mac_address": mac_schema,
1013 "floating-ip": {"type": "boolean"},
1014 }
1015 }
1016 }
1017 }
1018 }
1019 }
1020 },
1021 "networks": {
garciadeblasfec35df2016-08-25 11:33:57 +02001022 "type": "object",
1023 "patternProperties": {
1024 ".": {
1025 "type": "object",
1026 "properties": {
1027 "vim-network-name": name_schema,
tierno1df468d2018-07-06 14:25:16 +02001028 "ip-profile": ip_profile_schema,
1029 "name": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +02001030 }
1031 }
1032 }
1033 },
tierno7edb6752016-03-21 17:37:52 +01001034 }
1035 }
1036 },
1037 },
1038 "networks":{ #mapping from scenario to datacenter
1039 "type": "object",
1040 "patternProperties":{
1041 ".": {
1042 "type": "object",
1043 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +02001044 "interfaces":{
1045 "type":"array",
1046 "minLength":1,
1047 "items":{
1048 "type":"object",
1049 "properties":{
garciadeblas9f8456e2016-09-05 05:02:59 +02001050 "ip_address": ip_schema,
1051 "datacenter": name_schema,
1052 "vim-network-name": name_schema
garciadeblasfec35df2016-08-25 11:33:57 +02001053 },
1054 "patternProperties":{
1055 ".": {"type": "string"}
1056 }
1057 }
1058 },
garciadeblasfec35df2016-08-25 11:33:57 +02001059 "ip-profile": ip_profile_schema,
tiernobe41e222016-09-02 15:16:13 +02001060 #if the network connects VNFs deployed at different sites, you must specify one entry per site that this network connect to
1061 "sites": {
1062 "type":"array",
1063 "minLength":1,
1064 "items":{
1065 "type":"object",
1066 "properties":{
1067 # By default for an scenario 'external' network openmano looks for an existing VIM network to map this external scenario network,
1068 # for other networks openamno creates at VIM
1069 # Use netmap-create to force to create an external scenario network
1070 "netmap-create": {"oneOf":[name_schema,{"type": "null"}]}, #datacenter network to use. Null if must be created as an internal net
1071 #netmap-use: Indicates an existing VIM network that must be used for this scenario network.
1072 #Can use both the VIM network name (if it is not ambiguous) or the VIM net UUID
1073 #If both 'netmap-create' and 'netmap-use'are supplied, netmap-use precedes, but if fails openmano follows the netmap-create
1074 #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)
1075 "netmap-use": name_schema, #
1076 "vim-network-name": name_schema, #override network name
1077 #"ip-profile": ip_profile_schema,
1078 "datacenter": name_schema,
1079 }
1080 }
1081 },
tierno7edb6752016-03-21 17:37:52 +01001082 }
1083 }
1084 },
1085 },
1086 },
1087 "additionalProperties": False,
garciadeblasfec35df2016-08-25 11:33:57 +02001088 "required": ["name"]
tierno7edb6752016-03-21 17:37:52 +01001089 },
1090 },
1091 "required": ["instance"],
1092 "additionalProperties": False
tierno7edb6752016-03-21 17:37:52 +01001093}
1094
1095instance_scenario_action_schema = {
tierno16e3dd42018-04-24 12:52:40 +02001096 "title": "instance scenario action information schema",
tierno7edb6752016-03-21 17:37:52 +01001097 "$schema": "http://json-schema.org/draft-04/schema#",
tierno16e3dd42018-04-24 12:52:40 +02001098 "type": "object",
1099 "properties": {
1100 "start": {"type": "null"},
1101 "pause": {"type": "null"},
1102 "resume": {"type": "null"},
1103 "shutoff": {"type": "null"},
1104 "shutdown": {"type": "null"},
1105 "forceOff": {"type": "null"},
1106 "rebuild": {"type": "null"},
1107 "reboot": {
1108 "type": ["object", "null"],
tierno7edb6752016-03-21 17:37:52 +01001109 },
gcalvinoe580c7d2017-09-22 14:09:51 +02001110 "add_public_key": description_schema,
tierno7edb6752016-03-21 17:37:52 +01001111 "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]},
tiernofc5f80b2018-05-29 16:00:43 +02001112 "vdu-scaling": {
gcalvinoe580c7d2017-09-22 14:09:51 +02001113 "type": "array",
tierno16e3dd42018-04-24 12:52:40 +02001114 "items": {
tierno868220c2017-09-26 00:11:05 +02001115 "type": "object",
tierno16e3dd42018-04-24 12:52:40 +02001116 "properties": {
tierno868220c2017-09-26 00:11:05 +02001117 "vdu-id": id_schema,
tiernofc5f80b2018-05-29 16:00:43 +02001118 "osm_vdu_id": name_schema,
1119 "member-vnf-index": name_schema,
tierno868220c2017-09-26 00:11:05 +02001120 "count": integer1_schema,
tiernofc5f80b2018-05-29 16:00:43 +02001121 "type": {"enum": ["create", "delete"]}
tierno868220c2017-09-26 00:11:05 +02001122 },
1123 "additionalProperties": False,
1124 "minProperties": 1,
tiernofc5f80b2018-05-29 16:00:43 +02001125 "required": ["type"]
tierno868220c2017-09-26 00:11:05 +02001126 }
1127 },
tierno16e3dd42018-04-24 12:52:40 +02001128 "vnfs": {"type": "array", "items": {"type": "string"}},
1129 "vms": {"type": "array", "items": {"type": "string"}}
tierno7edb6752016-03-21 17:37:52 +01001130 },
1131 "minProperties": 1,
1132 #"maxProperties": 1,
1133 "additionalProperties": False
1134}
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001135
1136sdn_controller_properties={
1137 "name": name_schema,
Pablo Montes Moreno6aa0b2b2017-05-23 18:33:12 +02001138 "dpid": {"type":"string", "pattern":"^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"},
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001139 "ip": ip_schema,
1140 "port": port_schema,
1141 "type": {"type": "string", "enum": ["opendaylight","floodlight","onos"]},
1142 "version": {"type" : "string", "minLength":1, "maxLength":12},
1143 "user": nameshort_schema,
1144 "password": passwd_schema
1145}
1146sdn_controller_schema = {
1147 "title":"sdn controller information schema",
1148 "$schema": "http://json-schema.org/draft-04/schema#",
1149 "type":"object",
1150 "properties":{
1151 "sdn_controller":{
1152 "type":"object",
1153 "properties":sdn_controller_properties,
1154 "required": ["name", "port", 'ip', 'dpid', 'type'],
1155 "additionalProperties": False
1156 }
1157 },
1158 "required": ["sdn_controller"],
1159 "additionalProperties": False
1160}
1161
1162sdn_controller_edit_schema = {
1163 "title":"sdn controller update information schema",
1164 "$schema": "http://json-schema.org/draft-04/schema#",
1165 "type":"object",
1166 "properties":{
1167 "sdn_controller":{
1168 "type":"object",
1169 "properties":sdn_controller_properties,
1170 "additionalProperties": False
1171 }
1172 },
1173 "required": ["sdn_controller"],
1174 "additionalProperties": False
1175}
1176
1177sdn_port_mapping_schema = {
1178 "$schema": "http://json-schema.org/draft-04/schema#",
1179 "title":"sdn port mapping information schema",
1180 "type": "object",
1181 "properties": {
1182 "sdn_port_mapping": {
1183 "type": "array",
1184 "items": {
1185 "type": "object",
1186 "properties": {
1187 "compute_node": nameshort_schema,
1188 "ports": {
1189 "type": "array",
1190 "items": {
1191 "type": "object",
1192 "properties": {
tierno7f426e92018-06-28 15:21:32 +02001193 "pci": pci_extended_schema, # pci_schema,
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001194 "switch_port": nameshort_schema,
1195 "switch_mac": mac_schema
1196 },
1197 "required": ["pci"]
1198 }
1199 }
1200 },
1201 "required": ["compute_node", "ports"]
1202 }
1203 }
1204 },
1205 "required": ["sdn_port_mapping"]
Pablo Montes Moreno6aa0b2b2017-05-23 18:33:12 +02001206}
1207
1208sdn_external_port_schema = {
1209 "$schema": "http://json-schema.org/draft-04/schema#",
1210 "title":"External port ingformation",
1211 "type": "object",
1212 "properties": {
1213 "port": {"type" : "string", "minLength":1, "maxLength":60},
1214 "vlan": vlan_schema,
1215 "mac": mac_schema
1216 },
1217 "required": ["port"]
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001218}