blob: 80795b5a7dc35052b30876834e1acdb32bc5b578 [file] [log] [blame]
tierno7edb6752016-03-21 17:37:52 +01001# -*- coding: utf-8 -*-
2
3##
tierno92021022018-09-12 16:29:23 +02004# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U.
tierno7edb6752016-03-21 17:37:52 +01005# 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'''
Anderson Bravalheri0446cd52018-08-17 15:26:19 +010025JSON schemas used by openmano httpserver.py module to parse the different files and messages sent through the API
tierno7edb6752016-03-21 17:37:52 +010026'''
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]$"}
tierno20a608c2018-10-02 13:43:47 +020040# allows [] for wildcards. For that reason huge length limit is set
41pci_extended_schema = {"type": "string", "pattern": "^[0-9a-fA-F.:-\[\]]{12,40}$"}
tierno7f426e92018-06-28 15:21:32 +020042
tierno7edb6752016-03-21 17:37:52 +010043http_schema={"type":"string", "pattern":"^https?://[^'\"=]+$"}
44bandwidth_schema={"type":"string", "pattern" : "^[0-9]+ *([MG]bps)?$"}
45memory_schema={"type":"string", "pattern" : "^[0-9]+ *([MG]i?[Bb])?$"}
46integer0_schema={"type":"integer","minimum":0}
47integer1_schema={"type":"integer","minimum":1}
tierno392f2852016-05-13 12:28:55 +020048path_schema={"type":"string", "pattern":"^(\.){0,2}(/[^/\"':{}\(\)]+)+$"}
tierno7edb6752016-03-21 17:37:52 +010049vlan_schema={"type":"integer","minimum":1,"maximum":4095}
50vlan1000_schema={"type":"integer","minimum":1000,"maximum":4095}
Anderson Bravalheri0446cd52018-08-17 15:26:19 +010051mac_schema={"type":"string", "pattern":"^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){5}$"} #must be unicast LSB bit of MSB byte ==0
tierno7edb6752016-03-21 17:37:52 +010052#mac_schema={"type":"string", "pattern":"^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$"}
garciadeblasfec35df2016-08-25 11:33:57 +020053ip_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]?)$"}
54ip_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 +010055port_schema={"type":"integer","minimum":1,"maximum":65534}
56object_schema={"type":"object"}
tierno392f2852016-05-13 12:28:55 +020057schema_version_2={"type":"integer","minimum":2,"maximum":2}
garciadeblasfec35df2016-08-25 11:33:57 +020058#schema_version_string={"type":"string","enum": ["0.1", "2", "0.2", "3", "0.3"]}
tiernoae4a8d12016-07-08 12:30:39 +020059log_level_schema={"type":"string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]}
garciadeblasb69fa9f2016-09-28 12:04:10 +020060checksum_schema={"type":"string", "pattern":"^[0-9a-fA-F]{32}$"}
montesmoreno0c8def02016-12-22 12:16:23 +000061size_schema={"type":"integer","minimum":1,"maximum":100}
tierno7edb6752016-03-21 17:37:52 +010062
63metadata_schema={
64 "type":"object",
65 "properties":{
66 "architecture": {"type":"string"},
67 "use_incremental": {"type":"string","enum":["yes","no"]},
68 "vpci": pci_schema,
69 "os_distro": {"type":"string"},
70 "os_type": {"type":"string"},
71 "os_version": {"type":"string"},
72 "bus": {"type":"string"},
73 "topology": {"type":"string", "enum": ["oneSocket"]}
74 }
75}
76
77#Schema for the configuration file
78config_schema = {
79 "title":"configuration response information schema",
80 "$schema": "http://json-schema.org/draft-04/schema#",
81 "type":"object",
82 "properties":{
83 "http_port": port_schema,
84 "http_admin_port": port_schema,
85 "http_host": nameshort_schema,
tiernod29b1d32017-01-25 11:02:52 +010086 "auto_push_VNF_to_VIMs": {"type":"boolean"},
tierno7edb6752016-03-21 17:37:52 +010087 "vnf_repository": path_schema,
88 "db_host": nameshort_schema,
89 "db_user": nameshort_schema,
90 "db_passwd": {"type":"string"},
91 "db_name": nameshort_schema,
tierno639520f2017-04-05 19:55:36 +020092 "db_ovim_host": nameshort_schema,
93 "db_ovim_user": nameshort_schema,
94 "db_ovim_passwd": {"type":"string"},
95 "db_ovim_name": nameshort_schema,
tierno7edb6752016-03-21 17:37:52 +010096 # Next fields will disappear once the MANO API includes appropriate primitives
97 "vim_url": http_schema,
98 "vim_url_admin": http_schema,
99 "vim_name": nameshort_schema,
100 "vim_tenant_name": nameshort_schema,
101 "mano_tenant_name": nameshort_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100102 "mano_tenant_id": id_schema,
tierno20fc2a22016-08-19 17:02:35 +0200103 "http_console_proxy": {"type":"boolean"},
104 "http_console_host": nameshort_schema,
tierno7edb6752016-03-21 17:37:52 +0100105 "http_console_ports": {
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100106 "type": "array",
tierno41a69812018-02-16 14:34:33 +0100107 "items": {"OneOf": [
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100108 port_schema,
tierno41a69812018-02-16 14:34:33 +0100109 {"type": "object", "properties": {"from": port_schema, "to": port_schema}, "required": ["from", "to"]}
tierno7edb6752016-03-21 17:37:52 +0100110 ]}
111 },
tiernoae4a8d12016-07-08 12:30:39 +0200112 "log_level": log_level_schema,
tierno72f35a52016-07-15 13:18:30 +0200113 "log_socket_level": log_level_schema,
tiernoae4a8d12016-07-08 12:30:39 +0200114 "log_level_db": log_level_schema,
tierno73ad9e42016-09-12 18:11:11 +0200115 "log_level_vim": log_level_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100116 "log_level_wim": log_level_schema,
tiernof97fd272016-07-11 14:32:37 +0200117 "log_level_nfvo": log_level_schema,
tierno73ad9e42016-09-12 18:11:11 +0200118 "log_level_http": log_level_schema,
tierno1ae51342017-01-16 12:48:30 +0000119 "log_level_console": log_level_schema,
tierno639520f2017-04-05 19:55:36 +0200120 "log_level_ovim": log_level_schema,
tierno73ad9e42016-09-12 18:11:11 +0200121 "log_file_db": path_schema,
122 "log_file_vim": path_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100123 "log_file_wim": path_schema,
tierno73ad9e42016-09-12 18:11:11 +0200124 "log_file_nfvo": path_schema,
125 "log_file_http": path_schema,
tierno1ae51342017-01-16 12:48:30 +0000126 "log_file_console": path_schema,
tierno639520f2017-04-05 19:55:36 +0200127 "log_file_ovim": path_schema,
tierno72f35a52016-07-15 13:18:30 +0200128 "log_socket_host": nameshort_schema,
129 "log_socket_port": port_schema,
tiernof97fd272016-07-11 14:32:37 +0200130 "log_file": path_schema,
tierno7edb6752016-03-21 17:37:52 +0100131 },
tierno639520f2017-04-05 19:55:36 +0200132 "required": ['db_user', 'db_passwd', 'db_name'],
tierno7edb6752016-03-21 17:37:52 +0100133 "additionalProperties": False
134}
135
136tenant_schema = {
137 "title":"tenant information schema",
138 "$schema": "http://json-schema.org/draft-04/schema#",
139 "type":"object",
140 "properties":{
141 "tenant":{
142 "type":"object",
143 "properties":{
144 "name": nameshort_schema,
145 "description": description_schema,
146 },
147 "required": ["name"],
148 "additionalProperties": True
149 }
150 },
151 "required": ["tenant"],
152 "additionalProperties": False
153}
garciadeblasfec35df2016-08-25 11:33:57 +0200154
tierno7edb6752016-03-21 17:37:52 +0100155tenant_edit_schema = {
156 "title":"tenant edit information schema",
157 "$schema": "http://json-schema.org/draft-04/schema#",
158 "type":"object",
159 "properties":{
160 "tenant":{
161 "type":"object",
162 "properties":{
163 "name": name_schema,
164 "description": description_schema,
165 },
166 "additionalProperties": False
167 }
168 },
169 "required": ["tenant"],
170 "additionalProperties": False
171}
172
173datacenter_schema_properties={
garciadeblasfec35df2016-08-25 11:33:57 +0200174 "name": name_schema,
175 "description": description_schema,
176 "type": nameshort_schema, #currently "openvim" or "openstack", can be enlarged with plugins
177 "vim_url": description_schema,
178 "vim_url_admin": description_schema,
179 "config": { "type":"object" }
180}
tierno7edb6752016-03-21 17:37:52 +0100181
182datacenter_schema = {
183 "title":"datacenter information schema",
184 "$schema": "http://json-schema.org/draft-04/schema#",
185 "type":"object",
186 "properties":{
187 "datacenter":{
188 "type":"object",
189 "properties":datacenter_schema_properties,
190 "required": ["name", "vim_url"],
191 "additionalProperties": True
192 }
193 },
194 "required": ["datacenter"],
195 "additionalProperties": False
196}
197
198
199datacenter_edit_schema = {
200 "title":"datacenter edit nformation schema",
201 "$schema": "http://json-schema.org/draft-04/schema#",
202 "type":"object",
203 "properties":{
204 "datacenter":{
205 "type":"object",
206 "properties":datacenter_schema_properties,
207 "additionalProperties": False
208 }
209 },
210 "required": ["datacenter"],
211 "additionalProperties": False
212}
213
214
215netmap_new_schema = {
216 "title":"netmap new information schema",
217 "$schema": "http://json-schema.org/draft-04/schema#",
218 "type":"object",
219 "properties":{
220 "netmap":{ #delete from datacenter
221 "type":"object",
222 "properties":{
223 "name": name_schema, #name or uuid of net to change
224 "vim_id": id_schema,
225 "vim_name": name_schema
226 },
227 "minProperties": 1,
228 "additionalProperties": False
229 },
230 },
231 "required": ["netmap"],
232 "additionalProperties": False
233}
234
235netmap_edit_schema = {
236 "title":"netmap edit information schema",
237 "$schema": "http://json-schema.org/draft-04/schema#",
238 "type":"object",
239 "properties":{
240 "netmap":{ #delete from datacenter
241 "type":"object",
242 "properties":{
243 "name": name_schema, #name or uuid of net to change
244 },
245 "minProperties": 1,
246 "additionalProperties": False
247 },
248 },
249 "required": ["netmap"],
250 "additionalProperties": False
251}
252
253datacenter_action_schema = {
254 "title":"datacenter action information schema",
255 "$schema": "http://json-schema.org/draft-04/schema#",
256 "type":"object",
257 "properties":{
258 "net-update":{"type":"null",},
259 "net-edit":{
260 "type":"object",
261 "properties":{
262 "net": name_schema, #name or uuid of net to change
263 "name": name_schema,
264 "description": description_schema,
265 "shared": {"type": "boolean"}
266 },
267 "minProperties": 1,
268 "additionalProperties": False
269 },
270 "net-delete":{
271 "type":"object",
272 "properties":{
273 "net": name_schema, #name or uuid of net to change
274 },
275 "required": ["net"],
276 "additionalProperties": False
277 },
278 },
279 "minProperties": 1,
280 "maxProperties": 1,
281 "additionalProperties": False
282}
283
284
285datacenter_associate_schema={
286 "title":"datacenter associate information schema",
287 "$schema": "http://json-schema.org/draft-04/schema#",
288 "type":"object",
289 "properties":{
290 "datacenter":{
tiernod3750b32018-07-20 15:33:08 +0200291 "type": "object",
292 "properties": {
293 "name": name_schema,
294 "vim_id": id_schema,
tierno8008c3a2016-10-13 15:34:28 +0000295 "vim_tenant": name_schema,
296 "vim_tenant_name": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100297 "vim_username": nameshort_schema,
298 "vim_password": nameshort_schema,
tierno8008c3a2016-10-13 15:34:28 +0000299 "config": {"type": "object"}
tierno7edb6752016-03-21 17:37:52 +0100300 },
tiernod3750b32018-07-20 15:33:08 +0200301 # "required": ["vim_tenant"],
tierno7edb6752016-03-21 17:37:52 +0100302 "additionalProperties": True
303 }
304 },
305 "required": ["datacenter"],
306 "additionalProperties": False
307}
308
garciadeblasfec35df2016-08-25 11:33:57 +0200309dhcp_schema = {
tierno41a69812018-02-16 14:34:33 +0100310 "title": "DHCP schema",
garciadeblasfec35df2016-08-25 11:33:57 +0200311 "$schema": "http://json-schema.org/draft-04/schema#",
tierno41a69812018-02-16 14:34:33 +0100312 "type": "object",
garciadeblasfec35df2016-08-25 11:33:57 +0200313 "properties":{
314 "enabled": {"type": "boolean"},
tierno41a69812018-02-16 14:34:33 +0100315 "start-address": {"OneOf": [{"type": "null"}, ip_schema]},
316 "count": integer0_schema
garciadeblas9f8456e2016-09-05 05:02:59 +0200317 },
tierno1df468d2018-07-06 14:25:16 +0200318 # "required": ["start-address", "count"],
garciadeblasfec35df2016-08-25 11:33:57 +0200319}
320
321ip_profile_schema = {
tierno41a69812018-02-16 14:34:33 +0100322 "title": "IP profile schema",
garciadeblasfec35df2016-08-25 11:33:57 +0200323 "$schema": "http://json-schema.org/draft-04/schema#",
tierno41a69812018-02-16 14:34:33 +0100324 "type": "object",
325 "properties": {
tierno1df468d2018-07-06 14:25:16 +0200326 "ip-version": {"type": "string", "enum": ["IPv4", "IPv6"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200327 "subnet-address": ip_prefix_schema,
328 "gateway-address": ip_schema,
tierno455612d2017-05-30 16:40:10 +0200329 "dns-address": {"oneOf": [ip_schema, # for backward compatibility
330 {"type": "array", "items": ip_schema}]},
garciadeblasfec35df2016-08-25 11:33:57 +0200331 "dhcp": dhcp_schema
332 },
333}
334
335key_pair_schema = {
336 "title": "Key-pair schema for cloud-init configuration schema",
337 "$schema": "http://json-schema.org/draft-04/schema#",
338 "type":"object",
339 "properties":{
340 "name": name_schema,
341 "key": {"type":"string"}
342 },
343 "required": ["key"],
344 "additionalProperties": False
345}
346
347cloud_config_user_schema = {
348 "title": "User schema for cloud-init configuration schema",
349 "$schema": "http://json-schema.org/draft-04/schema#",
350 "type":"object",
351 "properties":{
352 "name": nameshort_schema,
353 "user-info": {"type":"string"},
354 #"key-pairs": {"type" : "array", "items": key_pair_schema}
355 "key-pairs": {"type" : "array", "items": {"type":"string"}}
356 },
357 "required": ["name"],
358 "additionalProperties": False
359}
360
361cloud_config_schema = {
362 "title": "Cloud-init configuration schema",
363 "$schema": "http://json-schema.org/draft-04/schema#",
364 "type":"object",
365 "properties":{
366 #"key-pairs": {"type" : "array", "items": key_pair_schema},
367 "key-pairs": {"type" : "array", "items": {"type":"string"}},
368 "users": {"type" : "array", "items": cloud_config_user_schema}
369 },
370 "additionalProperties": False
371}
372
tierno7edb6752016-03-21 17:37:52 +0100373internal_connection_element_schema = {
374 "type":"object",
375 "properties":{
376 "VNFC": name_schema,
377 "local_iface_name": name_schema
378 }
379}
380
garciadeblasfec35df2016-08-25 11:33:57 +0200381internal_connection_element_schema_v02 = {
382 "type":"object",
383 "properties":{
384 "VNFC": name_schema,
385 "local_iface_name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200386 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200387 }
388}
389
tierno7edb6752016-03-21 17:37:52 +0100390internal_connection_schema = {
391 "type":"object",
392 "properties":{
393 "name": name_schema,
394 "description":description_schema,
395 "type":{"type":"string", "enum":["bridge","data","ptp"]},
tierno8e690322017-08-10 15:58:50 +0200396 "elements": {"type" : "array", "items": internal_connection_element_schema, "minItems":1}
tierno7edb6752016-03-21 17:37:52 +0100397 },
398 "required": ["name", "type", "elements"],
399 "additionalProperties": False
400}
401
garciadeblasfec35df2016-08-25 11:33:57 +0200402internal_connection_schema_v02 = {
403 "type":"object",
404 "properties":{
405 "name": name_schema,
406 "description":description_schema,
407 "type": {"type": "string", "enum":["e-line", "e-lan"]},
garciadeblas9f8456e2016-09-05 05:02:59 +0200408 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200409 "ip-profile": ip_profile_schema,
tierno8e690322017-08-10 15:58:50 +0200410 "elements": {"type" : "array", "items": internal_connection_element_schema_v02, "minItems":1}
garciadeblasfec35df2016-08-25 11:33:57 +0200411 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200412 "required": ["name", "type", "implementation", "elements"],
garciadeblasfec35df2016-08-25 11:33:57 +0200413 "additionalProperties": False
414}
415
tierno7edb6752016-03-21 17:37:52 +0100416external_connection_schema = {
417 "type":"object",
418 "properties":{
419 "name": name_schema,
420 "type":{"type":"string", "enum":["mgmt","bridge","data"]},
421 "VNFC": name_schema,
422 "local_iface_name": name_schema ,
423 "description":description_schema
424 },
425 "required": ["name", "type", "VNFC", "local_iface_name"],
426 "additionalProperties": False
427}
428
garciadeblas9f8456e2016-09-05 05:02:59 +0200429#Not yet used
garciadeblasfec35df2016-08-25 11:33:57 +0200430external_connection_schema_v02 = {
431 "type":"object",
432 "properties":{
433 "name": name_schema,
garciadeblas9f8456e2016-09-05 05:02:59 +0200434 "mgmt": {"type":"boolean"},
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100435 "type": {"type": "string", "enum":["e-line", "e-lan"]},
garciadeblas9f8456e2016-09-05 05:02:59 +0200436 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200437 "VNFC": name_schema,
438 "local_iface_name": name_schema ,
439 "description":description_schema
440 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200441 "required": ["name", "type", "VNFC", "local_iface_name"],
garciadeblasfec35df2016-08-25 11:33:57 +0200442 "additionalProperties": False
443}
444
tierno7edb6752016-03-21 17:37:52 +0100445interfaces_schema={
446 "type":"array",
447 "items":{
448 "type":"object",
449 "properties":{
450 "name":name_schema,
451 "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]},
452 "bandwidth":bandwidth_schema,
453 "vpci":pci_schema,
454 "mac_address": mac_schema
455 },
456 "additionalProperties": False,
457 "required": ["name","dedicated", "bandwidth"]
458 }
459}
460
461bridge_interfaces_schema={
462 "type":"array",
463 "items":{
464 "type":"object",
465 "properties":{
466 "name": name_schema,
467 "bandwidth":bandwidth_schema,
468 "vpci":pci_schema,
469 "mac_address": mac_schema,
garciadeblas31e141b2018-10-25 18:33:19 +0200470 "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139", "paravirt"]},
montesmoreno2a1fc4e2017-01-09 16:46:04 +0000471 "port-security": {"type" : "boolean"},
472 "floating-ip": {"type" : "boolean"}
tierno7edb6752016-03-21 17:37:52 +0100473 },
474 "additionalProperties": False,
475 "required": ["name"]
476 }
477}
478
479devices_schema={
480 "type":"array",
481 "items":{
482 "type":"object",
483 "properties":{
484 "type":{"type":"string", "enum":["disk","cdrom","xml"] },
485 "image": path_schema,
garciadeblasb69fa9f2016-09-28 12:04:10 +0200486 "image name": name_schema,
487 "image checksum": checksum_schema,
montesmoreno0c8def02016-12-22 12:16:23 +0000488 "image metadata": metadata_schema,
489 "size": size_schema,
tierno7edb6752016-03-21 17:37:52 +0100490 "vpci":pci_schema,
491 "xml":xml_text_schema,
tierno1df468d2018-07-06 14:25:16 +0200492 "name": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100493 },
494 "additionalProperties": False,
495 "required": ["type"]
496 }
497}
498
499
500numa_schema = {
501 "type": "object",
502 "properties": {
503 "memory":integer1_schema,
504 "cores":integer1_schema,
505 "paired-threads":integer1_schema,
506 "threads":integer1_schema,
507 "cores-id":{"type":"array","items":integer0_schema},
508 "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema}},
509 "threads-id":{"type":"array","items":integer0_schema},
510 "interfaces":interfaces_schema
511 },
512 "additionalProperties": False,
513 #"required": ["memory"]
514}
515
tierno36c0b172017-01-12 18:32:28 +0100516config_files_schema = {
517 "title": "Config files for cloud init schema",
518 "$schema": "http://json-schema.org/draft-04/schema#",
519 "type": "object",
520 "properties": {
521 "dest": path_schema,
522 "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]}, #by default text
523 "content": {"type": "string"},
524 "permissions": {"type": "string"}, # tiypically octal notation '0644'
525 "owner": {"type": "string"}, # format: owner:group
526
527 },
528 "additionalProperties": False,
529 "required": ["dest", "content"],
530}
531
532boot_data_vdu_schema = {
533 "title": "Boot data (Cloud-init) configuration schema",
534 "$schema": "http://json-schema.org/draft-04/schema#",
535 "type": "object",
536 "properties":{
537 "key-pairs": {"type" : "array", "items": {"type":"string"}},
538 "users": {"type" : "array", "items": cloud_config_user_schema},
539 "user-data": {"type" : "string"}, # scrip to run
540 "config-files": {"type": "array", "items": config_files_schema},
541 # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data
542 "boot-data-drive": {"type": "boolean"},
543 },
544 "additionalProperties": False,
545}
546
tierno7edb6752016-03-21 17:37:52 +0100547vnfc_schema = {
548 "type":"object",
549 "properties":{
550 "name": name_schema,
551 "description": description_schema,
tierno8e690322017-08-10 15:58:50 +0200552 "count": integer1_schema,
garciadeblasb69fa9f2016-09-28 12:04:10 +0200553 "image name": name_schema,
mirabal29356312017-07-27 12:21:22 +0200554 "availability_zone": name_schema,
555 "VNFC image": {"oneOf": [path_schema, http_schema]},
garciadeblasb69fa9f2016-09-28 12:04:10 +0200556 "image checksum": checksum_schema,
gcalvinoe580c7d2017-09-22 14:09:51 +0200557 "image metadata": metadata_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200558 #"cloud-config": cloud_config_schema, #common for all vnfs in the scenario
tierno7edb6752016-03-21 17:37:52 +0100559 "processor": {
560 "type":"object",
561 "properties":{
562 "model":description_schema,
563 "features":{"type":"array","items":nameshort_schema}
564 },
565 "required": ["model"],
566 "additionalProperties": False
567 },
568 "hypervisor": {
569 "type":"object",
570 "properties":{
571 "type":nameshort_schema,
572 "version":description_schema
573 },
574 },
575 "ram":integer0_schema,
576 "vcpus":integer0_schema,
577 "disk": integer1_schema,
578 "numas": {
579 "type": "array",
garciadeblasfec35df2016-08-25 11:33:57 +0200580 "items": numa_schema
tierno7edb6752016-03-21 17:37:52 +0100581 },
582 "bridge-ifaces": bridge_interfaces_schema,
tierno36c0b172017-01-12 18:32:28 +0100583 "devices": devices_schema,
584 "boot-data" : boot_data_vdu_schema
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100585
tierno7edb6752016-03-21 17:37:52 +0100586 },
garciadeblasb69fa9f2016-09-28 12:04:10 +0200587 "required": ["name"],
588 "oneOf": [
589 {"required": ["VNFC image"]},
590 {"required": ["image name"]}
591 ],
tierno7edb6752016-03-21 17:37:52 +0100592 "additionalProperties": False
593}
594
595vnfd_schema_v01 = {
596 "title":"vnfd information schema v0.1",
597 "$schema": "http://json-schema.org/draft-04/schema#",
598 "type":"object",
599 "properties":{
600 "vnf":{
601 "type":"object",
602 "properties":{
603 "name": name_schema,
604 "description": description_schema,
mirabal29356312017-07-27 12:21:22 +0200605
tierno7edb6752016-03-21 17:37:52 +0100606 "class": nameshort_schema,
607 "public": {"type" : "boolean"},
608 "physical": {"type" : "boolean"},
gcalvinoe580c7d2017-09-22 14:09:51 +0200609 "default_user": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100610 "tenant_id": id_schema, #only valid for admin
611 "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1},
612 "internal-connections": {"type" : "array", "items": internal_connection_schema, "minItems":1},
613 "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1}
614 },
615 "required": ["name","external-connections"],
616 "additionalProperties": True
617 }
618 },
619 "required": ["vnf"],
620 "additionalProperties": False
621}
622
gcalvinoe580c7d2017-09-22 14:09:51 +0200623#VNFD schema for OSM R1
tierno7edb6752016-03-21 17:37:52 +0100624vnfd_schema_v02 = {
625 "title":"vnfd information schema v0.2",
626 "$schema": "http://json-schema.org/draft-04/schema#",
627 "type":"object",
628 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +0200629 "schema_version": {"type": "string", "enum": ["0.2"]},
tierno7edb6752016-03-21 17:37:52 +0100630 "vnf":{
631 "type":"object",
632 "properties":{
633 "name": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200634 "description": description_schema,
635 "class": nameshort_schema,
636 "public": {"type" : "boolean"},
637 "physical": {"type" : "boolean"},
638 "tenant_id": id_schema, #only valid for admin
garciadeblas9f8456e2016-09-05 05:02:59 +0200639 "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1},
garciadeblasfec35df2016-08-25 11:33:57 +0200640 "internal-connections": {"type" : "array", "items": internal_connection_schema_v02, "minItems":1},
641 # "cloud-config": cloud_config_schema, #common for all vnfcs
642 "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1}
tierno7edb6752016-03-21 17:37:52 +0100643 },
644 "required": ["name"],
645 "additionalProperties": True
646 }
647 },
tierno392f2852016-05-13 12:28:55 +0200648 "required": ["vnf", "schema_version"],
tierno7edb6752016-03-21 17:37:52 +0100649 "additionalProperties": False
650}
651
652#vnfd_schema = vnfd_schema_v01
653#{
654# "title":"vnfd information schema v0.2",
655# "$schema": "http://json-schema.org/draft-04/schema#",
656# "oneOf": [vnfd_schema_v01, vnfd_schema_v02]
657#}
658
659graph_schema = {
660 "title":"graphical scenario descriptor information schema",
661 "$schema": "http://json-schema.org/draft-04/schema#",
662 "type":"object",
663 "properties":{
664 "x": integer0_schema,
665 "y": integer0_schema,
666 "ifaces": {
667 "type":"object",
668 "properties":{
669 "left": {"type":"array"},
670 "right": {"type":"array"},
671 "bottom": {"type":"array"},
672 }
673 }
674 },
675 "required": ["x","y"]
676}
677
678nsd_schema_v01 = {
679 "title":"network scenario descriptor information schema v0.1",
680 "$schema": "http://json-schema.org/draft-04/schema#",
681 "type":"object",
682 "properties":{
683 "name":name_schema,
684 "description": description_schema,
685 "tenant_id": id_schema, #only valid for admin
tierno392f2852016-05-13 12:28:55 +0200686 "public": {"type": "boolean"},
tierno7edb6752016-03-21 17:37:52 +0100687 "topology":{
688 "type":"object",
689 "properties":{
690 "nodes": {
691 "type":"object",
692 "patternProperties":{
693 ".": {
694 "type": "object",
695 "properties":{
696 "type":{"type":"string", "enum":["VNF", "other_network", "network", "external_network"]},
697 "vnf_id": id_schema,
698 "graph": graph_schema,
699 },
700 "patternProperties":{
701 "^(VNF )?model$": {"type": "string"}
702 },
703 "required": ["type"]
704 }
705 }
706 },
707 "connections": {
708 "type":"object",
709 "patternProperties":{
710 ".": {
711 "type": "object",
712 "properties":{
713 "nodes":{"oneOf":[{"type":"object", "minProperties":2}, {"type":"array", "minLength":1}]},
714 "type": {"type": "string", "enum":["link", "external_network", "dataplane_net", "bridge_net"]},
715 "graph": graph_schema
716 },
717 "required": ["nodes"]
718 },
719 }
720 }
721 },
722 "required": ["nodes"],
723 "additionalProperties": False
724 }
725 },
726 "required": ["name","topology"],
727 "additionalProperties": False
728}
729
tierno7edb6752016-03-21 17:37:52 +0100730nsd_schema_v02 = {
731 "title":"network scenario descriptor information schema v0.2",
732 "$schema": "http://json-schema.org/draft-04/schema#",
733 "type":"object",
734 "properties":{
garciadeblas0c317ee2016-08-29 12:33:06 +0200735 "schema_version": schema_version_2,
tierno392f2852016-05-13 12:28:55 +0200736 "scenario":{
tierno7edb6752016-03-21 17:37:52 +0100737 "type":"object",
tierno392f2852016-05-13 12:28:55 +0200738 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +0200739 "name": name_schema,
tierno392f2852016-05-13 12:28:55 +0200740 "description": description_schema,
741 "tenant_id": id_schema, #only valid for admin
742 "public": {"type": "boolean"},
743 "vnfs": {
744 "type":"object",
745 "patternProperties":{
746 ".": {
747 "type": "object",
748 "properties":{
749 "vnf_id": id_schema,
750 "graph": graph_schema,
751 "vnf_name": name_schema,
752 },
753 }
tierno7edb6752016-03-21 17:37:52 +0100754 },
tierno392f2852016-05-13 12:28:55 +0200755 "minProperties": 1
tierno7edb6752016-03-21 17:37:52 +0100756 },
tierno392f2852016-05-13 12:28:55 +0200757 "networks": {
758 "type":"object",
759 "patternProperties":{
760 ".": {
761 "type": "object",
762 "properties":{
763 "interfaces":{"type":"array", "minLength":1},
764 "type": {"type": "string", "enum":["dataplane", "bridge"]},
765 "external" : {"type": "boolean"},
766 "graph": graph_schema
767 },
768 "required": ["interfaces"]
769 },
770 }
771 },
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100772
tierno392f2852016-05-13 12:28:55 +0200773 },
garciadeblasfec35df2016-08-25 11:33:57 +0200774 "required": ["vnfs", "name"],
775 "additionalProperties": False
776 }
777 },
778 "required": ["scenario","schema_version"],
779 "additionalProperties": False
780}
781
782#NSD schema for OSM R1
783nsd_schema_v03 = {
784 "title":"network scenario descriptor information schema v0.3",
785 "$schema": "http://json-schema.org/draft-04/schema#",
786 "type":"object",
787 "properties":{
788 "schema_version": {"type": "string", "enum": ["0.3"]},
789 "scenario":{
790 "type":"object",
791 "properties":{
792 "name": name_schema,
793 "description": description_schema,
794 "tenant_id": id_schema, #only valid for admin
795 "public": {"type": "boolean"},
796 "cloud-config": cloud_config_schema, #common for all vnfs in the scenario
garciadeblas0c317ee2016-08-29 12:33:06 +0200797 #"datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200798 "vnfs": {
799 "type":"object",
800 "patternProperties":{
801 ".": {
802 "type": "object",
803 "properties":{
804 "vnf_id": id_schema,
805 "graph": graph_schema,
806 "vnf_name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200807 #"cloud-config": cloud_config_schema, #particular for a vnf
808 #"datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200809 "internal-connections": {
810 "type": "object",
811 "patternProperties": {
812 ".": {
813 "type": "object",
814 "properties": {
815 "ip-profile": ip_profile_schema,
816 "elements": {
817 "type" : "array",
818 "items":{
819 "type":"object",
820 "properties":{
821 "VNFC": name_schema,
822 "local_iface_name": name_schema,
tierno1df468d2018-07-06 14:25:16 +0200823 "ip_address": ip_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200824 },
825 "required": ["VNFC", "local_iface_name"],
826 }
827 }
828 }
829 }
830 }
831 }
832 },
833 }
834 },
835 "minProperties": 1
836 },
837 "networks": {
838 "type":"object",
839 "patternProperties":{
840 ".": {
841 "type": "object",
842 "properties":{
843 "interfaces":{
844 "type":"array",
845 "minLength":1,
846 "items":{
847 "type":"object",
848 "properties":{
garciadeblas9f8456e2016-09-05 05:02:59 +0200849 "vnf": name_schema,
850 "vnf_interface": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200851 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200852 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200853 "required": ["vnf", "vnf_interface"],
garciadeblasfec35df2016-08-25 11:33:57 +0200854 }
855 },
856 "type": {"type": "string", "enum":["e-line", "e-lan"]},
garciadeblas9f8456e2016-09-05 05:02:59 +0200857 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200858 "external" : {"type": "boolean"},
859 "graph": graph_schema,
860 "ip-profile": ip_profile_schema
861 },
862 "required": ["interfaces"]
863 },
864 }
865 },
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100866
garciadeblasfec35df2016-08-25 11:33:57 +0200867 },
tierno392f2852016-05-13 12:28:55 +0200868 "required": ["vnfs", "networks","name"],
869 "additionalProperties": False
870 }
tierno7edb6752016-03-21 17:37:52 +0100871 },
tierno392f2852016-05-13 12:28:55 +0200872 "required": ["scenario","schema_version"],
tierno7edb6752016-03-21 17:37:52 +0100873 "additionalProperties": False
874}
875
876#scenario_new_schema = {
877# "title":"new scenario information schema",
878# "$schema": "http://json-schema.org/draft-04/schema#",
879# #"oneOf": [nsd_schema_v01, nsd_schema_v02]
880# "oneOf": [nsd_schema_v01]
881#}
882
883scenario_edit_schema = {
884 "title":"edit scenario information schema",
885 "$schema": "http://json-schema.org/draft-04/schema#",
886 "type":"object",
887 "properties":{
888 "name":name_schema,
889 "description": description_schema,
890 "topology":{
891 "type":"object",
892 "properties":{
893 "nodes": {
894 "type":"object",
895 "patternProperties":{
896 "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$": {
897 "type":"object",
898 "properties":{
899 "graph":{
900 "type": "object",
901 "properties":{
902 "x": integer0_schema,
903 "y": integer0_schema,
904 "ifaces":{ "type": "object"}
905 }
906 },
907 "description": description_schema,
908 "name": name_schema
909 }
910 }
911 }
912 }
913 },
914 "required": ["nodes"],
915 "additionalProperties": False
916 }
917 },
918 "additionalProperties": False
919}
920
921scenario_action_schema = {
922 "title":"scenario action information schema",
923 "$schema": "http://json-schema.org/draft-04/schema#",
924 "type":"object",
925 "properties":{
926 "start":{
927 "type": "object",
928 "properties": {
929 "instance_name":name_schema,
930 "description":description_schema,
931 "datacenter": {"type": "string"}
932 },
933 "required": ["instance_name"]
934 },
935 "deploy":{
936 "type": "object",
937 "properties": {
938 "instance_name":name_schema,
939 "description":description_schema,
940 "datacenter": {"type": "string"}
941 },
942 "required": ["instance_name"]
943 },
944 "reserve":{
945 "type": "object",
946 "properties": {
947 "instance_name":name_schema,
948 "description":description_schema,
949 "datacenter": {"type": "string"}
950 },
951 "required": ["instance_name"]
952 },
953 "verify":{
954 "type": "object",
955 "properties": {
956 "instance_name":name_schema,
957 "description":description_schema,
958 "datacenter": {"type": "string"}
959 },
960 "required": ["instance_name"]
961 }
962 },
963 "minProperties": 1,
964 "maxProperties": 1,
965 "additionalProperties": False
966}
967
tierno7fe82642018-11-26 14:14:51 +0000968instance_scenario_object = {
969 "title": "scenario object used to create an instance not based on any nsd",
tierno7edb6752016-03-21 17:37:52 +0100970 "$schema": "http://json-schema.org/draft-04/schema#",
tierno7fe82642018-11-26 14:14:51 +0000971 "type": "object",
972 "properties": {
973 "nets": {
974 "type": "array",
975 "minLength": 1,
976 "items": {
977 "type": "object",
978 "properties": {
979 "name": name_schema,
980 "external": {"type": "boolean"},
981 "type": {"enum": ["bridge", "ptp", "data"]}, # for overlay, underlay E-LINE, underlay E-LAN
982 },
983 "additionalProperties": False,
984 "required": ["name", "external", "type"]
985 }
986 }
987 },
988 "additionalProperties": False,
989 "required": ["nets"]
990}
991
tierno7edb6752016-03-21 17:37:52 +0100992instance_scenario_create_schema_v01 = {
tierno67881db2018-10-24 18:46:03 +0200993 "title": "instance scenario create information schema v0.1",
tierno7edb6752016-03-21 17:37:52 +0100994 "$schema": "http://json-schema.org/draft-04/schema#",
tierno67881db2018-10-24 18:46:03 +0200995 "type": "object",
996 "properties": {
tierno7edb6752016-03-21 17:37:52 +0100997 "schema_version": {"type": "string", "enum": ["0.1"]},
tierno67881db2018-10-24 18:46:03 +0200998 "instance": {
999 "type": "object",
1000 "properties": {
1001 "mgmt_keys": {"type": "array", "items": {"type":"string"}},
1002 "vduImage": name_schema,
1003 "name": name_schema,
tierno7edb6752016-03-21 17:37:52 +01001004 "description":description_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +02001005 "datacenter": name_schema,
tierno7fe82642018-11-26 14:14:51 +00001006 "scenario" : {"oneOff": [name_schema, instance_scenario_object]}, # can be an UUID or name or a dict
tierno7edb6752016-03-21 17:37:52 +01001007 "action":{"enum": ["deploy","reserve","verify" ]},
garciadeblasfec35df2016-08-25 11:33:57 +02001008 "connect_mgmt_interfaces": {"oneOf": [{"type":"boolean"}, {"type":"object"}]},# can be true or a dict with datacenter: net_name
1009 "cloud-config": cloud_config_schema, #common to all vnfs in the instance scenario
tierno7edb6752016-03-21 17:37:52 +01001010 "vnfs":{ #mapping from scenario to datacenter
1011 "type": "object",
1012 "patternProperties":{
1013 ".": {
1014 "type": "object",
1015 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +02001016 "name": name_schema, #override vnf name
garciadeblas0c317ee2016-08-29 12:33:06 +02001017 "datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +02001018 #"metadata": {"type": "object"},
1019 #"user_data": {"type": "string"}
garciadeblas0c317ee2016-08-29 12:33:06 +02001020 #"cloud-config": cloud_config_schema, #particular for a vnf
tierno1df468d2018-07-06 14:25:16 +02001021 "vdus": {
1022 "type": "object",
1023 "patternProperties": {
1024 ".": {
1025 "type": "object",
1026 "properties": {
tierno67881db2018-10-24 18:46:03 +02001027 "name": name_schema, # overrides vdu name schema
1028 "mgmt_keys": {"type": "array", "items": {"type": "string"}},
1029 "vduImage": name_schema,
tierno1df468d2018-07-06 14:25:16 +02001030 "devices": {
1031 "type": "object",
1032 "patternProperties": {
1033 ".": {
1034 "vim_id": name_schema,
1035 }
1036 }
1037 },
1038 "interfaces": {
1039 "type": "object",
1040 "patternProperties": {
1041 ".": {
1042 "ip_address": ip_schema,
1043 "mac_address": mac_schema,
1044 "floating-ip": {"type": "boolean"},
1045 }
1046 }
1047 }
1048 }
1049 }
1050 }
1051 },
1052 "networks": {
garciadeblasfec35df2016-08-25 11:33:57 +02001053 "type": "object",
1054 "patternProperties": {
1055 ".": {
1056 "type": "object",
1057 "properties": {
1058 "vim-network-name": name_schema,
gcalvino0a480542018-12-17 16:19:33 +01001059 "vim-network-id": name_schema,
tierno1df468d2018-07-06 14:25:16 +02001060 "ip-profile": ip_profile_schema,
1061 "name": name_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001062 }
garciadeblasfec35df2016-08-25 11:33:57 +02001063 }
1064 }
1065 },
tierno7edb6752016-03-21 17:37:52 +01001066 }
1067 }
1068 },
1069 },
1070 "networks":{ #mapping from scenario to datacenter
1071 "type": "object",
1072 "patternProperties":{
1073 ".": {
1074 "type": "object",
1075 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +02001076 "interfaces":{
1077 "type":"array",
1078 "minLength":1,
1079 "items":{
1080 "type":"object",
1081 "properties":{
garciadeblas9f8456e2016-09-05 05:02:59 +02001082 "ip_address": ip_schema,
1083 "datacenter": name_schema,
gcalvino0a480542018-12-17 16:19:33 +01001084 "vim-network-name": name_schema,
1085 "vim-network-id": name_schema
garciadeblasfec35df2016-08-25 11:33:57 +02001086 },
1087 "patternProperties":{
1088 ".": {"type": "string"}
1089 }
1090 }
1091 },
garciadeblasfec35df2016-08-25 11:33:57 +02001092 "ip-profile": ip_profile_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001093 #if the network connects VNFs deployed at different sites, you must specify one entry per site that this network connect to
tiernobe41e222016-09-02 15:16:13 +02001094 "sites": {
1095 "type":"array",
1096 "minLength":1,
1097 "items":{
1098 "type":"object",
1099 "properties":{
1100 # By default for an scenario 'external' network openmano looks for an existing VIM network to map this external scenario network,
1101 # for other networks openamno creates at VIM
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001102 # Use netmap-create to force to create an external scenario network
tiernobe41e222016-09-02 15:16:13 +02001103 "netmap-create": {"oneOf":[name_schema,{"type": "null"}]}, #datacenter network to use. Null if must be created as an internal net
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001104 #netmap-use: Indicates an existing VIM network that must be used for this scenario network.
tiernobe41e222016-09-02 15:16:13 +02001105 #Can use both the VIM network name (if it is not ambiguous) or the VIM net UUID
1106 #If both 'netmap-create' and 'netmap-use'are supplied, netmap-use precedes, but if fails openmano follows the netmap-create
1107 #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)
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001108 "netmap-use": name_schema, #
tiernobe41e222016-09-02 15:16:13 +02001109 "vim-network-name": name_schema, #override network name
gcalvino0a480542018-12-17 16:19:33 +01001110 "vim-network-id": name_schema,
tiernobe41e222016-09-02 15:16:13 +02001111 #"ip-profile": ip_profile_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001112 "datacenter": name_schema,
tiernobe41e222016-09-02 15:16:13 +02001113 }
1114 }
1115 },
tierno7edb6752016-03-21 17:37:52 +01001116 }
1117 }
1118 },
1119 },
1120 },
1121 "additionalProperties": False,
garciadeblasfec35df2016-08-25 11:33:57 +02001122 "required": ["name"]
tierno7edb6752016-03-21 17:37:52 +01001123 },
1124 },
1125 "required": ["instance"],
1126 "additionalProperties": False
tierno7edb6752016-03-21 17:37:52 +01001127}
1128
1129instance_scenario_action_schema = {
tierno16e3dd42018-04-24 12:52:40 +02001130 "title": "instance scenario action information schema",
tierno7edb6752016-03-21 17:37:52 +01001131 "$schema": "http://json-schema.org/draft-04/schema#",
tierno16e3dd42018-04-24 12:52:40 +02001132 "type": "object",
1133 "properties": {
1134 "start": {"type": "null"},
1135 "pause": {"type": "null"},
1136 "resume": {"type": "null"},
1137 "shutoff": {"type": "null"},
1138 "shutdown": {"type": "null"},
1139 "forceOff": {"type": "null"},
1140 "rebuild": {"type": "null"},
1141 "reboot": {
1142 "type": ["object", "null"],
tierno7edb6752016-03-21 17:37:52 +01001143 },
gcalvinoe580c7d2017-09-22 14:09:51 +02001144 "add_public_key": description_schema,
tierno7edb6752016-03-21 17:37:52 +01001145 "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]},
tiernofc5f80b2018-05-29 16:00:43 +02001146 "vdu-scaling": {
gcalvinoe580c7d2017-09-22 14:09:51 +02001147 "type": "array",
tierno16e3dd42018-04-24 12:52:40 +02001148 "items": {
tierno868220c2017-09-26 00:11:05 +02001149 "type": "object",
tierno16e3dd42018-04-24 12:52:40 +02001150 "properties": {
tierno868220c2017-09-26 00:11:05 +02001151 "vdu-id": id_schema,
tiernofc5f80b2018-05-29 16:00:43 +02001152 "osm_vdu_id": name_schema,
1153 "member-vnf-index": name_schema,
tierno868220c2017-09-26 00:11:05 +02001154 "count": integer1_schema,
tiernofc5f80b2018-05-29 16:00:43 +02001155 "type": {"enum": ["create", "delete"]}
tierno868220c2017-09-26 00:11:05 +02001156 },
1157 "additionalProperties": False,
1158 "minProperties": 1,
tiernofc5f80b2018-05-29 16:00:43 +02001159 "required": ["type"]
tierno868220c2017-09-26 00:11:05 +02001160 }
1161 },
tierno16e3dd42018-04-24 12:52:40 +02001162 "vnfs": {"type": "array", "items": {"type": "string"}},
1163 "vms": {"type": "array", "items": {"type": "string"}}
tierno7edb6752016-03-21 17:37:52 +01001164 },
1165 "minProperties": 1,
1166 #"maxProperties": 1,
1167 "additionalProperties": False
1168}
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001169
1170sdn_controller_properties={
1171 "name": name_schema,
Pablo Montes Moreno6aa0b2b2017-05-23 18:33:12 +02001172 "dpid": {"type":"string", "pattern":"^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"},
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001173 "ip": ip_schema,
1174 "port": port_schema,
1175 "type": {"type": "string", "enum": ["opendaylight","floodlight","onos"]},
1176 "version": {"type" : "string", "minLength":1, "maxLength":12},
1177 "user": nameshort_schema,
1178 "password": passwd_schema
1179}
1180sdn_controller_schema = {
1181 "title":"sdn controller information schema",
1182 "$schema": "http://json-schema.org/draft-04/schema#",
1183 "type":"object",
1184 "properties":{
1185 "sdn_controller":{
1186 "type":"object",
1187 "properties":sdn_controller_properties,
1188 "required": ["name", "port", 'ip', 'dpid', 'type'],
1189 "additionalProperties": False
1190 }
1191 },
1192 "required": ["sdn_controller"],
1193 "additionalProperties": False
1194}
1195
1196sdn_controller_edit_schema = {
1197 "title":"sdn controller update information schema",
1198 "$schema": "http://json-schema.org/draft-04/schema#",
1199 "type":"object",
1200 "properties":{
1201 "sdn_controller":{
1202 "type":"object",
1203 "properties":sdn_controller_properties,
1204 "additionalProperties": False
1205 }
1206 },
1207 "required": ["sdn_controller"],
1208 "additionalProperties": False
1209}
1210
1211sdn_port_mapping_schema = {
1212 "$schema": "http://json-schema.org/draft-04/schema#",
1213 "title":"sdn port mapping information schema",
1214 "type": "object",
1215 "properties": {
1216 "sdn_port_mapping": {
1217 "type": "array",
1218 "items": {
1219 "type": "object",
1220 "properties": {
1221 "compute_node": nameshort_schema,
1222 "ports": {
1223 "type": "array",
1224 "items": {
1225 "type": "object",
1226 "properties": {
tierno4070e442019-01-23 10:19:23 +00001227 "pci": {"OneOf": [{"type": "null"}, pci_extended_schema]}, # pci_schema,
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001228 "switch_port": nameshort_schema,
1229 "switch_mac": mac_schema
1230 },
1231 "required": ["pci"]
1232 }
1233 }
1234 },
1235 "required": ["compute_node", "ports"]
1236 }
1237 }
1238 },
1239 "required": ["sdn_port_mapping"]
Pablo Montes Moreno6aa0b2b2017-05-23 18:33:12 +02001240}
1241
1242sdn_external_port_schema = {
1243 "$schema": "http://json-schema.org/draft-04/schema#",
1244 "title":"External port ingformation",
1245 "type": "object",
1246 "properties": {
1247 "port": {"type" : "string", "minLength":1, "maxLength":60},
1248 "vlan": vlan_schema,
1249 "mac": mac_schema
1250 },
1251 "required": ["port"]
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001252}