blob: 988b6ca0469f04666b319edded7c1bdcd071528b [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}
tiernofc7cfbf2019-03-20 17:23:45 +000062boolean_schema = {"type": "boolean"}
63null_schema = {"type": "null"}
tierno7edb6752016-03-21 17:37:52 +010064
65metadata_schema={
66 "type":"object",
67 "properties":{
68 "architecture": {"type":"string"},
69 "use_incremental": {"type":"string","enum":["yes","no"]},
70 "vpci": pci_schema,
71 "os_distro": {"type":"string"},
72 "os_type": {"type":"string"},
73 "os_version": {"type":"string"},
74 "bus": {"type":"string"},
75 "topology": {"type":"string", "enum": ["oneSocket"]}
76 }
77}
78
79#Schema for the configuration file
80config_schema = {
81 "title":"configuration response information schema",
82 "$schema": "http://json-schema.org/draft-04/schema#",
83 "type":"object",
84 "properties":{
85 "http_port": port_schema,
86 "http_admin_port": port_schema,
87 "http_host": nameshort_schema,
tiernofc7cfbf2019-03-20 17:23:45 +000088 "auto_push_VNF_to_VIMs": boolean_schema,
tierno7edb6752016-03-21 17:37:52 +010089 "vnf_repository": path_schema,
90 "db_host": nameshort_schema,
91 "db_user": nameshort_schema,
92 "db_passwd": {"type":"string"},
93 "db_name": nameshort_schema,
tierno639520f2017-04-05 19:55:36 +020094 "db_ovim_host": nameshort_schema,
95 "db_ovim_user": nameshort_schema,
96 "db_ovim_passwd": {"type":"string"},
97 "db_ovim_name": nameshort_schema,
tierno7edb6752016-03-21 17:37:52 +010098 # Next fields will disappear once the MANO API includes appropriate primitives
99 "vim_url": http_schema,
100 "vim_url_admin": http_schema,
101 "vim_name": nameshort_schema,
102 "vim_tenant_name": nameshort_schema,
103 "mano_tenant_name": nameshort_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100104 "mano_tenant_id": id_schema,
tiernofc7cfbf2019-03-20 17:23:45 +0000105 "http_console_proxy": boolean_schema,
tierno20fc2a22016-08-19 17:02:35 +0200106 "http_console_host": nameshort_schema,
tierno7edb6752016-03-21 17:37:52 +0100107 "http_console_ports": {
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100108 "type": "array",
tierno41a69812018-02-16 14:34:33 +0100109 "items": {"OneOf": [
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100110 port_schema,
tierno41a69812018-02-16 14:34:33 +0100111 {"type": "object", "properties": {"from": port_schema, "to": port_schema}, "required": ["from", "to"]}
tierno7edb6752016-03-21 17:37:52 +0100112 ]}
113 },
tiernoae4a8d12016-07-08 12:30:39 +0200114 "log_level": log_level_schema,
tierno72f35a52016-07-15 13:18:30 +0200115 "log_socket_level": log_level_schema,
tiernoae4a8d12016-07-08 12:30:39 +0200116 "log_level_db": log_level_schema,
tierno73ad9e42016-09-12 18:11:11 +0200117 "log_level_vim": log_level_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100118 "log_level_wim": log_level_schema,
tiernof97fd272016-07-11 14:32:37 +0200119 "log_level_nfvo": log_level_schema,
tierno73ad9e42016-09-12 18:11:11 +0200120 "log_level_http": log_level_schema,
tierno1ae51342017-01-16 12:48:30 +0000121 "log_level_console": log_level_schema,
tierno639520f2017-04-05 19:55:36 +0200122 "log_level_ovim": log_level_schema,
tierno73ad9e42016-09-12 18:11:11 +0200123 "log_file_db": path_schema,
124 "log_file_vim": path_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100125 "log_file_wim": path_schema,
tierno73ad9e42016-09-12 18:11:11 +0200126 "log_file_nfvo": path_schema,
127 "log_file_http": path_schema,
tierno1ae51342017-01-16 12:48:30 +0000128 "log_file_console": path_schema,
tierno639520f2017-04-05 19:55:36 +0200129 "log_file_ovim": path_schema,
tierno72f35a52016-07-15 13:18:30 +0200130 "log_socket_host": nameshort_schema,
131 "log_socket_port": port_schema,
tiernof97fd272016-07-11 14:32:37 +0200132 "log_file": path_schema,
tierno7edb6752016-03-21 17:37:52 +0100133 },
tierno639520f2017-04-05 19:55:36 +0200134 "required": ['db_user', 'db_passwd', 'db_name'],
tierno7edb6752016-03-21 17:37:52 +0100135 "additionalProperties": False
136}
137
138tenant_schema = {
139 "title":"tenant information schema",
140 "$schema": "http://json-schema.org/draft-04/schema#",
141 "type":"object",
142 "properties":{
143 "tenant":{
144 "type":"object",
145 "properties":{
146 "name": nameshort_schema,
147 "description": description_schema,
148 },
149 "required": ["name"],
150 "additionalProperties": True
151 }
152 },
153 "required": ["tenant"],
154 "additionalProperties": False
155}
garciadeblasfec35df2016-08-25 11:33:57 +0200156
tierno7edb6752016-03-21 17:37:52 +0100157tenant_edit_schema = {
158 "title":"tenant edit information schema",
159 "$schema": "http://json-schema.org/draft-04/schema#",
160 "type":"object",
161 "properties":{
162 "tenant":{
163 "type":"object",
164 "properties":{
165 "name": name_schema,
166 "description": description_schema,
167 },
168 "additionalProperties": False
169 }
170 },
171 "required": ["tenant"],
172 "additionalProperties": False
173}
174
175datacenter_schema_properties={
garciadeblasfec35df2016-08-25 11:33:57 +0200176 "name": name_schema,
177 "description": description_schema,
178 "type": nameshort_schema, #currently "openvim" or "openstack", can be enlarged with plugins
179 "vim_url": description_schema,
180 "vim_url_admin": description_schema,
181 "config": { "type":"object" }
182}
tierno7edb6752016-03-21 17:37:52 +0100183
184datacenter_schema = {
185 "title":"datacenter information schema",
186 "$schema": "http://json-schema.org/draft-04/schema#",
187 "type":"object",
188 "properties":{
189 "datacenter":{
190 "type":"object",
191 "properties":datacenter_schema_properties,
192 "required": ["name", "vim_url"],
193 "additionalProperties": True
194 }
195 },
196 "required": ["datacenter"],
197 "additionalProperties": False
198}
199
200
201datacenter_edit_schema = {
202 "title":"datacenter edit nformation schema",
203 "$schema": "http://json-schema.org/draft-04/schema#",
204 "type":"object",
205 "properties":{
206 "datacenter":{
207 "type":"object",
208 "properties":datacenter_schema_properties,
209 "additionalProperties": False
210 }
211 },
212 "required": ["datacenter"],
213 "additionalProperties": False
214}
215
216
217netmap_new_schema = {
218 "title":"netmap new information schema",
219 "$schema": "http://json-schema.org/draft-04/schema#",
220 "type":"object",
221 "properties":{
222 "netmap":{ #delete from datacenter
223 "type":"object",
224 "properties":{
225 "name": name_schema, #name or uuid of net to change
226 "vim_id": id_schema,
227 "vim_name": name_schema
228 },
229 "minProperties": 1,
230 "additionalProperties": False
231 },
232 },
233 "required": ["netmap"],
234 "additionalProperties": False
235}
236
237netmap_edit_schema = {
238 "title":"netmap edit information schema",
239 "$schema": "http://json-schema.org/draft-04/schema#",
240 "type":"object",
241 "properties":{
242 "netmap":{ #delete from datacenter
243 "type":"object",
244 "properties":{
245 "name": name_schema, #name or uuid of net to change
246 },
247 "minProperties": 1,
248 "additionalProperties": False
249 },
250 },
251 "required": ["netmap"],
252 "additionalProperties": False
253}
254
255datacenter_action_schema = {
256 "title":"datacenter action information schema",
257 "$schema": "http://json-schema.org/draft-04/schema#",
258 "type":"object",
259 "properties":{
260 "net-update":{"type":"null",},
261 "net-edit":{
262 "type":"object",
263 "properties":{
264 "net": name_schema, #name or uuid of net to change
265 "name": name_schema,
266 "description": description_schema,
tiernofc7cfbf2019-03-20 17:23:45 +0000267 "shared": boolean_schema
tierno7edb6752016-03-21 17:37:52 +0100268 },
269 "minProperties": 1,
270 "additionalProperties": False
271 },
272 "net-delete":{
273 "type":"object",
274 "properties":{
275 "net": name_schema, #name or uuid of net to change
276 },
277 "required": ["net"],
278 "additionalProperties": False
279 },
280 },
281 "minProperties": 1,
282 "maxProperties": 1,
283 "additionalProperties": False
284}
285
286
287datacenter_associate_schema={
288 "title":"datacenter associate information schema",
289 "$schema": "http://json-schema.org/draft-04/schema#",
290 "type":"object",
291 "properties":{
292 "datacenter":{
tiernod3750b32018-07-20 15:33:08 +0200293 "type": "object",
294 "properties": {
295 "name": name_schema,
296 "vim_id": id_schema,
tierno8008c3a2016-10-13 15:34:28 +0000297 "vim_tenant": name_schema,
298 "vim_tenant_name": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100299 "vim_username": nameshort_schema,
300 "vim_password": nameshort_schema,
tierno8008c3a2016-10-13 15:34:28 +0000301 "config": {"type": "object"}
tierno7edb6752016-03-21 17:37:52 +0100302 },
tiernod3750b32018-07-20 15:33:08 +0200303 # "required": ["vim_tenant"],
tierno7edb6752016-03-21 17:37:52 +0100304 "additionalProperties": True
305 }
306 },
307 "required": ["datacenter"],
308 "additionalProperties": False
309}
310
garciadeblasfec35df2016-08-25 11:33:57 +0200311dhcp_schema = {
tierno41a69812018-02-16 14:34:33 +0100312 "title": "DHCP schema",
garciadeblasfec35df2016-08-25 11:33:57 +0200313 "$schema": "http://json-schema.org/draft-04/schema#",
tierno41a69812018-02-16 14:34:33 +0100314 "type": "object",
garciadeblasfec35df2016-08-25 11:33:57 +0200315 "properties":{
tiernofc7cfbf2019-03-20 17:23:45 +0000316 "enabled": boolean_schema,
317 "start-address": {"OneOf": [null_schema, ip_schema]},
tierno41a69812018-02-16 14:34:33 +0100318 "count": integer0_schema
garciadeblas9f8456e2016-09-05 05:02:59 +0200319 },
tierno1df468d2018-07-06 14:25:16 +0200320 # "required": ["start-address", "count"],
garciadeblasfec35df2016-08-25 11:33:57 +0200321}
322
323ip_profile_schema = {
tierno41a69812018-02-16 14:34:33 +0100324 "title": "IP profile schema",
garciadeblasfec35df2016-08-25 11:33:57 +0200325 "$schema": "http://json-schema.org/draft-04/schema#",
tierno41a69812018-02-16 14:34:33 +0100326 "type": "object",
327 "properties": {
tierno1df468d2018-07-06 14:25:16 +0200328 "ip-version": {"type": "string", "enum": ["IPv4", "IPv6"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200329 "subnet-address": ip_prefix_schema,
330 "gateway-address": ip_schema,
tierno455612d2017-05-30 16:40:10 +0200331 "dns-address": {"oneOf": [ip_schema, # for backward compatibility
332 {"type": "array", "items": ip_schema}]},
garciadeblasfec35df2016-08-25 11:33:57 +0200333 "dhcp": dhcp_schema
334 },
335}
336
337key_pair_schema = {
338 "title": "Key-pair schema for cloud-init configuration schema",
339 "$schema": "http://json-schema.org/draft-04/schema#",
340 "type":"object",
341 "properties":{
342 "name": name_schema,
343 "key": {"type":"string"}
344 },
345 "required": ["key"],
346 "additionalProperties": False
347}
348
349cloud_config_user_schema = {
350 "title": "User schema for cloud-init configuration schema",
351 "$schema": "http://json-schema.org/draft-04/schema#",
352 "type":"object",
353 "properties":{
354 "name": nameshort_schema,
355 "user-info": {"type":"string"},
356 #"key-pairs": {"type" : "array", "items": key_pair_schema}
357 "key-pairs": {"type" : "array", "items": {"type":"string"}}
358 },
359 "required": ["name"],
360 "additionalProperties": False
361}
362
363cloud_config_schema = {
364 "title": "Cloud-init configuration schema",
365 "$schema": "http://json-schema.org/draft-04/schema#",
366 "type":"object",
367 "properties":{
368 #"key-pairs": {"type" : "array", "items": key_pair_schema},
369 "key-pairs": {"type" : "array", "items": {"type":"string"}},
370 "users": {"type" : "array", "items": cloud_config_user_schema}
371 },
372 "additionalProperties": False
373}
374
tierno7edb6752016-03-21 17:37:52 +0100375internal_connection_element_schema = {
376 "type":"object",
377 "properties":{
378 "VNFC": name_schema,
379 "local_iface_name": name_schema
380 }
381}
382
garciadeblasfec35df2016-08-25 11:33:57 +0200383internal_connection_element_schema_v02 = {
384 "type":"object",
385 "properties":{
386 "VNFC": name_schema,
387 "local_iface_name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200388 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200389 }
390}
391
tierno7edb6752016-03-21 17:37:52 +0100392internal_connection_schema = {
393 "type":"object",
394 "properties":{
395 "name": name_schema,
396 "description":description_schema,
397 "type":{"type":"string", "enum":["bridge","data","ptp"]},
tierno8e690322017-08-10 15:58:50 +0200398 "elements": {"type" : "array", "items": internal_connection_element_schema, "minItems":1}
tierno7edb6752016-03-21 17:37:52 +0100399 },
400 "required": ["name", "type", "elements"],
401 "additionalProperties": False
402}
403
garciadeblasfec35df2016-08-25 11:33:57 +0200404internal_connection_schema_v02 = {
405 "type":"object",
406 "properties":{
407 "name": name_schema,
408 "description":description_schema,
409 "type": {"type": "string", "enum":["e-line", "e-lan"]},
garciadeblas9f8456e2016-09-05 05:02:59 +0200410 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200411 "ip-profile": ip_profile_schema,
tierno8e690322017-08-10 15:58:50 +0200412 "elements": {"type" : "array", "items": internal_connection_element_schema_v02, "minItems":1}
garciadeblasfec35df2016-08-25 11:33:57 +0200413 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200414 "required": ["name", "type", "implementation", "elements"],
garciadeblasfec35df2016-08-25 11:33:57 +0200415 "additionalProperties": False
416}
417
tierno7edb6752016-03-21 17:37:52 +0100418external_connection_schema = {
419 "type":"object",
420 "properties":{
421 "name": name_schema,
422 "type":{"type":"string", "enum":["mgmt","bridge","data"]},
423 "VNFC": name_schema,
424 "local_iface_name": name_schema ,
425 "description":description_schema
426 },
427 "required": ["name", "type", "VNFC", "local_iface_name"],
428 "additionalProperties": False
429}
430
garciadeblas9f8456e2016-09-05 05:02:59 +0200431#Not yet used
garciadeblasfec35df2016-08-25 11:33:57 +0200432external_connection_schema_v02 = {
433 "type":"object",
434 "properties":{
435 "name": name_schema,
tiernofc7cfbf2019-03-20 17:23:45 +0000436 "mgmt": boolean_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100437 "type": {"type": "string", "enum":["e-line", "e-lan"]},
garciadeblas9f8456e2016-09-05 05:02:59 +0200438 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
garciadeblasfec35df2016-08-25 11:33:57 +0200439 "VNFC": name_schema,
440 "local_iface_name": name_schema ,
441 "description":description_schema
442 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200443 "required": ["name", "type", "VNFC", "local_iface_name"],
garciadeblasfec35df2016-08-25 11:33:57 +0200444 "additionalProperties": False
445}
446
tierno7edb6752016-03-21 17:37:52 +0100447interfaces_schema={
448 "type":"array",
449 "items":{
450 "type":"object",
451 "properties":{
452 "name":name_schema,
453 "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]},
454 "bandwidth":bandwidth_schema,
455 "vpci":pci_schema,
456 "mac_address": mac_schema
457 },
458 "additionalProperties": False,
459 "required": ["name","dedicated", "bandwidth"]
460 }
461}
462
463bridge_interfaces_schema={
464 "type":"array",
465 "items":{
466 "type":"object",
467 "properties":{
468 "name": name_schema,
469 "bandwidth":bandwidth_schema,
470 "vpci":pci_schema,
471 "mac_address": mac_schema,
garciadeblas31e141b2018-10-25 18:33:19 +0200472 "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139", "paravirt"]},
tiernofc7cfbf2019-03-20 17:23:45 +0000473 "port-security": boolean_schema,
474 "floating-ip": boolean_schema,
tierno7edb6752016-03-21 17:37:52 +0100475 },
476 "additionalProperties": False,
477 "required": ["name"]
478 }
479}
480
481devices_schema={
482 "type":"array",
483 "items":{
484 "type":"object",
485 "properties":{
486 "type":{"type":"string", "enum":["disk","cdrom","xml"] },
487 "image": path_schema,
garciadeblasb69fa9f2016-09-28 12:04:10 +0200488 "image name": name_schema,
489 "image checksum": checksum_schema,
montesmoreno0c8def02016-12-22 12:16:23 +0000490 "image metadata": metadata_schema,
491 "size": size_schema,
tierno7edb6752016-03-21 17:37:52 +0100492 "vpci":pci_schema,
493 "xml":xml_text_schema,
tierno1df468d2018-07-06 14:25:16 +0200494 "name": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100495 },
496 "additionalProperties": False,
497 "required": ["type"]
498 }
499}
500
501
502numa_schema = {
503 "type": "object",
504 "properties": {
505 "memory":integer1_schema,
506 "cores":integer1_schema,
507 "paired-threads":integer1_schema,
508 "threads":integer1_schema,
509 "cores-id":{"type":"array","items":integer0_schema},
510 "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema}},
511 "threads-id":{"type":"array","items":integer0_schema},
512 "interfaces":interfaces_schema
513 },
514 "additionalProperties": False,
515 #"required": ["memory"]
516}
517
tierno36c0b172017-01-12 18:32:28 +0100518config_files_schema = {
519 "title": "Config files for cloud init schema",
520 "$schema": "http://json-schema.org/draft-04/schema#",
521 "type": "object",
522 "properties": {
523 "dest": path_schema,
524 "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]}, #by default text
525 "content": {"type": "string"},
526 "permissions": {"type": "string"}, # tiypically octal notation '0644'
527 "owner": {"type": "string"}, # format: owner:group
528
529 },
530 "additionalProperties": False,
531 "required": ["dest", "content"],
532}
533
534boot_data_vdu_schema = {
535 "title": "Boot data (Cloud-init) configuration schema",
536 "$schema": "http://json-schema.org/draft-04/schema#",
537 "type": "object",
538 "properties":{
539 "key-pairs": {"type" : "array", "items": {"type":"string"}},
540 "users": {"type" : "array", "items": cloud_config_user_schema},
541 "user-data": {"type" : "string"}, # scrip to run
542 "config-files": {"type": "array", "items": config_files_schema},
543 # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data
tiernofc7cfbf2019-03-20 17:23:45 +0000544 "boot-data-drive": boolean_schema,
tierno36c0b172017-01-12 18:32:28 +0100545 },
546 "additionalProperties": False,
547}
548
tierno7edb6752016-03-21 17:37:52 +0100549vnfc_schema = {
550 "type":"object",
551 "properties":{
552 "name": name_schema,
553 "description": description_schema,
tierno8e690322017-08-10 15:58:50 +0200554 "count": integer1_schema,
garciadeblasb69fa9f2016-09-28 12:04:10 +0200555 "image name": name_schema,
mirabal29356312017-07-27 12:21:22 +0200556 "availability_zone": name_schema,
557 "VNFC image": {"oneOf": [path_schema, http_schema]},
garciadeblasb69fa9f2016-09-28 12:04:10 +0200558 "image checksum": checksum_schema,
gcalvinoe580c7d2017-09-22 14:09:51 +0200559 "image metadata": metadata_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200560 #"cloud-config": cloud_config_schema, #common for all vnfs in the scenario
tierno7edb6752016-03-21 17:37:52 +0100561 "processor": {
562 "type":"object",
563 "properties":{
564 "model":description_schema,
565 "features":{"type":"array","items":nameshort_schema}
566 },
567 "required": ["model"],
568 "additionalProperties": False
569 },
570 "hypervisor": {
571 "type":"object",
572 "properties":{
573 "type":nameshort_schema,
574 "version":description_schema
575 },
576 },
577 "ram":integer0_schema,
578 "vcpus":integer0_schema,
579 "disk": integer1_schema,
580 "numas": {
581 "type": "array",
garciadeblasfec35df2016-08-25 11:33:57 +0200582 "items": numa_schema
tierno7edb6752016-03-21 17:37:52 +0100583 },
584 "bridge-ifaces": bridge_interfaces_schema,
tierno36c0b172017-01-12 18:32:28 +0100585 "devices": devices_schema,
586 "boot-data" : boot_data_vdu_schema
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100587
tierno7edb6752016-03-21 17:37:52 +0100588 },
garciadeblasb69fa9f2016-09-28 12:04:10 +0200589 "required": ["name"],
590 "oneOf": [
591 {"required": ["VNFC image"]},
592 {"required": ["image name"]}
593 ],
tierno7edb6752016-03-21 17:37:52 +0100594 "additionalProperties": False
595}
596
597vnfd_schema_v01 = {
598 "title":"vnfd information schema v0.1",
599 "$schema": "http://json-schema.org/draft-04/schema#",
600 "type":"object",
601 "properties":{
602 "vnf":{
603 "type":"object",
604 "properties":{
605 "name": name_schema,
606 "description": description_schema,
mirabal29356312017-07-27 12:21:22 +0200607
tierno7edb6752016-03-21 17:37:52 +0100608 "class": nameshort_schema,
tiernofc7cfbf2019-03-20 17:23:45 +0000609 "public": boolean_schema,
610 "physical": boolean_schema,
gcalvinoe580c7d2017-09-22 14:09:51 +0200611 "default_user": name_schema,
tierno7edb6752016-03-21 17:37:52 +0100612 "tenant_id": id_schema, #only valid for admin
613 "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1},
614 "internal-connections": {"type" : "array", "items": internal_connection_schema, "minItems":1},
615 "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1}
616 },
617 "required": ["name","external-connections"],
618 "additionalProperties": True
619 }
620 },
621 "required": ["vnf"],
622 "additionalProperties": False
623}
624
gcalvinoe580c7d2017-09-22 14:09:51 +0200625#VNFD schema for OSM R1
tierno7edb6752016-03-21 17:37:52 +0100626vnfd_schema_v02 = {
627 "title":"vnfd information schema v0.2",
628 "$schema": "http://json-schema.org/draft-04/schema#",
629 "type":"object",
630 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +0200631 "schema_version": {"type": "string", "enum": ["0.2"]},
tierno7edb6752016-03-21 17:37:52 +0100632 "vnf":{
633 "type":"object",
634 "properties":{
635 "name": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200636 "description": description_schema,
637 "class": nameshort_schema,
tiernofc7cfbf2019-03-20 17:23:45 +0000638 "public": boolean_schema,
639 "physical": boolean_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200640 "tenant_id": id_schema, #only valid for admin
garciadeblas9f8456e2016-09-05 05:02:59 +0200641 "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1},
garciadeblasfec35df2016-08-25 11:33:57 +0200642 "internal-connections": {"type" : "array", "items": internal_connection_schema_v02, "minItems":1},
643 # "cloud-config": cloud_config_schema, #common for all vnfcs
644 "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1}
tierno7edb6752016-03-21 17:37:52 +0100645 },
646 "required": ["name"],
647 "additionalProperties": True
648 }
649 },
tierno392f2852016-05-13 12:28:55 +0200650 "required": ["vnf", "schema_version"],
tierno7edb6752016-03-21 17:37:52 +0100651 "additionalProperties": False
652}
653
654#vnfd_schema = vnfd_schema_v01
655#{
656# "title":"vnfd information schema v0.2",
657# "$schema": "http://json-schema.org/draft-04/schema#",
658# "oneOf": [vnfd_schema_v01, vnfd_schema_v02]
659#}
660
661graph_schema = {
662 "title":"graphical scenario descriptor information schema",
663 "$schema": "http://json-schema.org/draft-04/schema#",
664 "type":"object",
665 "properties":{
666 "x": integer0_schema,
667 "y": integer0_schema,
668 "ifaces": {
669 "type":"object",
670 "properties":{
671 "left": {"type":"array"},
672 "right": {"type":"array"},
673 "bottom": {"type":"array"},
674 }
675 }
676 },
677 "required": ["x","y"]
678}
679
680nsd_schema_v01 = {
681 "title":"network scenario descriptor information schema v0.1",
682 "$schema": "http://json-schema.org/draft-04/schema#",
683 "type":"object",
684 "properties":{
685 "name":name_schema,
686 "description": description_schema,
687 "tenant_id": id_schema, #only valid for admin
tiernofc7cfbf2019-03-20 17:23:45 +0000688 "public": boolean_schema,
tierno7edb6752016-03-21 17:37:52 +0100689 "topology":{
690 "type":"object",
691 "properties":{
692 "nodes": {
693 "type":"object",
694 "patternProperties":{
695 ".": {
696 "type": "object",
697 "properties":{
698 "type":{"type":"string", "enum":["VNF", "other_network", "network", "external_network"]},
699 "vnf_id": id_schema,
700 "graph": graph_schema,
701 },
702 "patternProperties":{
703 "^(VNF )?model$": {"type": "string"}
704 },
705 "required": ["type"]
706 }
707 }
708 },
709 "connections": {
710 "type":"object",
711 "patternProperties":{
712 ".": {
713 "type": "object",
714 "properties":{
715 "nodes":{"oneOf":[{"type":"object", "minProperties":2}, {"type":"array", "minLength":1}]},
716 "type": {"type": "string", "enum":["link", "external_network", "dataplane_net", "bridge_net"]},
717 "graph": graph_schema
718 },
719 "required": ["nodes"]
720 },
721 }
722 }
723 },
724 "required": ["nodes"],
725 "additionalProperties": False
726 }
727 },
728 "required": ["name","topology"],
729 "additionalProperties": False
730}
731
tierno7edb6752016-03-21 17:37:52 +0100732nsd_schema_v02 = {
733 "title":"network scenario descriptor information schema v0.2",
734 "$schema": "http://json-schema.org/draft-04/schema#",
735 "type":"object",
736 "properties":{
garciadeblas0c317ee2016-08-29 12:33:06 +0200737 "schema_version": schema_version_2,
tierno392f2852016-05-13 12:28:55 +0200738 "scenario":{
tierno7edb6752016-03-21 17:37:52 +0100739 "type":"object",
tierno392f2852016-05-13 12:28:55 +0200740 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +0200741 "name": name_schema,
tierno392f2852016-05-13 12:28:55 +0200742 "description": description_schema,
743 "tenant_id": id_schema, #only valid for admin
tiernofc7cfbf2019-03-20 17:23:45 +0000744 "public": boolean_schema,
tierno392f2852016-05-13 12:28:55 +0200745 "vnfs": {
746 "type":"object",
747 "patternProperties":{
748 ".": {
749 "type": "object",
750 "properties":{
751 "vnf_id": id_schema,
752 "graph": graph_schema,
753 "vnf_name": name_schema,
754 },
755 }
tierno7edb6752016-03-21 17:37:52 +0100756 },
tierno392f2852016-05-13 12:28:55 +0200757 "minProperties": 1
tierno7edb6752016-03-21 17:37:52 +0100758 },
tierno392f2852016-05-13 12:28:55 +0200759 "networks": {
760 "type":"object",
761 "patternProperties":{
762 ".": {
763 "type": "object",
764 "properties":{
765 "interfaces":{"type":"array", "minLength":1},
766 "type": {"type": "string", "enum":["dataplane", "bridge"]},
tiernofc7cfbf2019-03-20 17:23:45 +0000767 "external" : boolean_schema,
tierno392f2852016-05-13 12:28:55 +0200768 "graph": graph_schema
769 },
770 "required": ["interfaces"]
771 },
772 }
773 },
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100774
tierno392f2852016-05-13 12:28:55 +0200775 },
garciadeblasfec35df2016-08-25 11:33:57 +0200776 "required": ["vnfs", "name"],
777 "additionalProperties": False
778 }
779 },
780 "required": ["scenario","schema_version"],
781 "additionalProperties": False
782}
783
784#NSD schema for OSM R1
785nsd_schema_v03 = {
786 "title":"network scenario descriptor information schema v0.3",
787 "$schema": "http://json-schema.org/draft-04/schema#",
788 "type":"object",
789 "properties":{
790 "schema_version": {"type": "string", "enum": ["0.3"]},
791 "scenario":{
792 "type":"object",
793 "properties":{
794 "name": name_schema,
795 "description": description_schema,
796 "tenant_id": id_schema, #only valid for admin
tiernofc7cfbf2019-03-20 17:23:45 +0000797 "public": boolean_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200798 "cloud-config": cloud_config_schema, #common for all vnfs in the scenario
garciadeblas0c317ee2016-08-29 12:33:06 +0200799 #"datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200800 "vnfs": {
801 "type":"object",
802 "patternProperties":{
803 ".": {
804 "type": "object",
805 "properties":{
806 "vnf_id": id_schema,
807 "graph": graph_schema,
808 "vnf_name": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200809 #"cloud-config": cloud_config_schema, #particular for a vnf
810 #"datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200811 "internal-connections": {
812 "type": "object",
813 "patternProperties": {
814 ".": {
815 "type": "object",
816 "properties": {
817 "ip-profile": ip_profile_schema,
818 "elements": {
819 "type" : "array",
820 "items":{
821 "type":"object",
822 "properties":{
823 "VNFC": name_schema,
824 "local_iface_name": name_schema,
tierno1df468d2018-07-06 14:25:16 +0200825 "ip_address": ip_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200826 },
827 "required": ["VNFC", "local_iface_name"],
828 }
829 }
830 }
831 }
832 }
833 }
834 },
835 }
836 },
837 "minProperties": 1
838 },
839 "networks": {
840 "type":"object",
841 "patternProperties":{
842 ".": {
843 "type": "object",
844 "properties":{
845 "interfaces":{
846 "type":"array",
847 "minLength":1,
848 "items":{
849 "type":"object",
850 "properties":{
garciadeblas9f8456e2016-09-05 05:02:59 +0200851 "vnf": name_schema,
852 "vnf_interface": name_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +0200853 "ip_address": ip_schema
garciadeblasfec35df2016-08-25 11:33:57 +0200854 },
garciadeblas9f8456e2016-09-05 05:02:59 +0200855 "required": ["vnf", "vnf_interface"],
garciadeblasfec35df2016-08-25 11:33:57 +0200856 }
857 },
858 "type": {"type": "string", "enum":["e-line", "e-lan"]},
garciadeblas9f8456e2016-09-05 05:02:59 +0200859 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
tiernofc7cfbf2019-03-20 17:23:45 +0000860 "external" : boolean_schema,
garciadeblasfec35df2016-08-25 11:33:57 +0200861 "graph": graph_schema,
862 "ip-profile": ip_profile_schema
863 },
864 "required": ["interfaces"]
865 },
866 }
867 },
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100868
garciadeblasfec35df2016-08-25 11:33:57 +0200869 },
tierno392f2852016-05-13 12:28:55 +0200870 "required": ["vnfs", "networks","name"],
871 "additionalProperties": False
872 }
tierno7edb6752016-03-21 17:37:52 +0100873 },
tierno392f2852016-05-13 12:28:55 +0200874 "required": ["scenario","schema_version"],
tierno7edb6752016-03-21 17:37:52 +0100875 "additionalProperties": False
876}
877
878#scenario_new_schema = {
879# "title":"new scenario information schema",
880# "$schema": "http://json-schema.org/draft-04/schema#",
881# #"oneOf": [nsd_schema_v01, nsd_schema_v02]
882# "oneOf": [nsd_schema_v01]
883#}
884
885scenario_edit_schema = {
886 "title":"edit scenario information schema",
887 "$schema": "http://json-schema.org/draft-04/schema#",
888 "type":"object",
889 "properties":{
890 "name":name_schema,
891 "description": description_schema,
892 "topology":{
893 "type":"object",
894 "properties":{
895 "nodes": {
896 "type":"object",
897 "patternProperties":{
898 "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$": {
899 "type":"object",
900 "properties":{
901 "graph":{
902 "type": "object",
903 "properties":{
904 "x": integer0_schema,
905 "y": integer0_schema,
906 "ifaces":{ "type": "object"}
907 }
908 },
909 "description": description_schema,
910 "name": name_schema
911 }
912 }
913 }
914 }
915 },
916 "required": ["nodes"],
917 "additionalProperties": False
918 }
919 },
920 "additionalProperties": False
921}
922
923scenario_action_schema = {
924 "title":"scenario action information schema",
925 "$schema": "http://json-schema.org/draft-04/schema#",
926 "type":"object",
927 "properties":{
928 "start":{
929 "type": "object",
930 "properties": {
931 "instance_name":name_schema,
932 "description":description_schema,
933 "datacenter": {"type": "string"}
934 },
935 "required": ["instance_name"]
936 },
937 "deploy":{
938 "type": "object",
939 "properties": {
940 "instance_name":name_schema,
941 "description":description_schema,
942 "datacenter": {"type": "string"}
943 },
944 "required": ["instance_name"]
945 },
946 "reserve":{
947 "type": "object",
948 "properties": {
949 "instance_name":name_schema,
950 "description":description_schema,
951 "datacenter": {"type": "string"}
952 },
953 "required": ["instance_name"]
954 },
955 "verify":{
956 "type": "object",
957 "properties": {
958 "instance_name":name_schema,
959 "description":description_schema,
960 "datacenter": {"type": "string"}
961 },
962 "required": ["instance_name"]
963 }
964 },
965 "minProperties": 1,
966 "maxProperties": 1,
967 "additionalProperties": False
968}
969
tierno7fe82642018-11-26 14:14:51 +0000970instance_scenario_object = {
971 "title": "scenario object used to create an instance not based on any nsd",
tierno7edb6752016-03-21 17:37:52 +0100972 "$schema": "http://json-schema.org/draft-04/schema#",
tierno7fe82642018-11-26 14:14:51 +0000973 "type": "object",
974 "properties": {
975 "nets": {
976 "type": "array",
977 "minLength": 1,
978 "items": {
979 "type": "object",
980 "properties": {
981 "name": name_schema,
tiernofc7cfbf2019-03-20 17:23:45 +0000982 "external": boolean_schema,
tierno7fe82642018-11-26 14:14:51 +0000983 "type": {"enum": ["bridge", "ptp", "data"]}, # for overlay, underlay E-LINE, underlay E-LAN
984 },
985 "additionalProperties": False,
986 "required": ["name", "external", "type"]
987 }
988 }
989 },
990 "additionalProperties": False,
991 "required": ["nets"]
992}
993
tierno7edb6752016-03-21 17:37:52 +0100994instance_scenario_create_schema_v01 = {
tierno67881db2018-10-24 18:46:03 +0200995 "title": "instance scenario create information schema v0.1",
tierno7edb6752016-03-21 17:37:52 +0100996 "$schema": "http://json-schema.org/draft-04/schema#",
tierno67881db2018-10-24 18:46:03 +0200997 "type": "object",
998 "properties": {
tierno7edb6752016-03-21 17:37:52 +0100999 "schema_version": {"type": "string", "enum": ["0.1"]},
tierno67881db2018-10-24 18:46:03 +02001000 "instance": {
1001 "type": "object",
1002 "properties": {
1003 "mgmt_keys": {"type": "array", "items": {"type":"string"}},
1004 "vduImage": name_schema,
1005 "name": name_schema,
tierno7edb6752016-03-21 17:37:52 +01001006 "description":description_schema,
garciadeblas0c317ee2016-08-29 12:33:06 +02001007 "datacenter": name_schema,
tiernofc7cfbf2019-03-20 17:23:45 +00001008 "wim_account": {"oneOf": [boolean_schema, id_schema, null_schema]},
tierno7fe82642018-11-26 14:14:51 +00001009 "scenario" : {"oneOff": [name_schema, instance_scenario_object]}, # can be an UUID or name or a dict
tierno7edb6752016-03-21 17:37:52 +01001010 "action":{"enum": ["deploy","reserve","verify" ]},
tiernofc7cfbf2019-03-20 17:23:45 +00001011 "connect_mgmt_interfaces": {"oneOf": [boolean_schema, {"type":"object"}]},# can be true or a dict with datacenter: net_name
garciadeblasfec35df2016-08-25 11:33:57 +02001012 "cloud-config": cloud_config_schema, #common to all vnfs in the instance scenario
tierno7edb6752016-03-21 17:37:52 +01001013 "vnfs":{ #mapping from scenario to datacenter
1014 "type": "object",
1015 "patternProperties":{
1016 ".": {
1017 "type": "object",
1018 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +02001019 "name": name_schema, #override vnf name
garciadeblas0c317ee2016-08-29 12:33:06 +02001020 "datacenter": name_schema,
garciadeblasfec35df2016-08-25 11:33:57 +02001021 #"metadata": {"type": "object"},
1022 #"user_data": {"type": "string"}
garciadeblas0c317ee2016-08-29 12:33:06 +02001023 #"cloud-config": cloud_config_schema, #particular for a vnf
tierno1df468d2018-07-06 14:25:16 +02001024 "vdus": {
1025 "type": "object",
1026 "patternProperties": {
1027 ".": {
1028 "type": "object",
1029 "properties": {
tierno67881db2018-10-24 18:46:03 +02001030 "name": name_schema, # overrides vdu name schema
1031 "mgmt_keys": {"type": "array", "items": {"type": "string"}},
1032 "vduImage": name_schema,
tierno1df468d2018-07-06 14:25:16 +02001033 "devices": {
1034 "type": "object",
1035 "patternProperties": {
1036 ".": {
1037 "vim_id": name_schema,
1038 }
1039 }
1040 },
1041 "interfaces": {
1042 "type": "object",
1043 "patternProperties": {
1044 ".": {
1045 "ip_address": ip_schema,
1046 "mac_address": mac_schema,
tiernofc7cfbf2019-03-20 17:23:45 +00001047 "floating-ip": boolean_schema,
tierno1df468d2018-07-06 14:25:16 +02001048 }
1049 }
1050 }
1051 }
1052 }
1053 }
1054 },
1055 "networks": {
garciadeblasfec35df2016-08-25 11:33:57 +02001056 "type": "object",
1057 "patternProperties": {
1058 ".": {
1059 "type": "object",
1060 "properties": {
1061 "vim-network-name": name_schema,
gcalvino0a480542018-12-17 16:19:33 +01001062 "vim-network-id": name_schema,
tierno1df468d2018-07-06 14:25:16 +02001063 "ip-profile": ip_profile_schema,
1064 "name": name_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001065 }
garciadeblasfec35df2016-08-25 11:33:57 +02001066 }
1067 }
1068 },
tierno7edb6752016-03-21 17:37:52 +01001069 }
1070 }
1071 },
1072 },
1073 "networks":{ #mapping from scenario to datacenter
1074 "type": "object",
1075 "patternProperties":{
1076 ".": {
1077 "type": "object",
1078 "properties":{
garciadeblasfec35df2016-08-25 11:33:57 +02001079 "interfaces":{
1080 "type":"array",
1081 "minLength":1,
1082 "items":{
1083 "type":"object",
1084 "properties":{
garciadeblas9f8456e2016-09-05 05:02:59 +02001085 "ip_address": ip_schema,
1086 "datacenter": name_schema,
gcalvino0a480542018-12-17 16:19:33 +01001087 "vim-network-name": name_schema,
1088 "vim-network-id": name_schema
garciadeblasfec35df2016-08-25 11:33:57 +02001089 },
1090 "patternProperties":{
1091 ".": {"type": "string"}
1092 }
1093 }
1094 },
tiernofc7cfbf2019-03-20 17:23:45 +00001095 "wim_account": {"oneOf": [boolean_schema, id_schema, null_schema]},
garciadeblasfec35df2016-08-25 11:33:57 +02001096 "ip-profile": ip_profile_schema,
tierno3c44e7b2019-03-04 17:32:01 +00001097 "use-network": {
1098 "type": "object",
1099 "properties": {
1100 "instance_scenario_id": id_schema,
1101 # "member_vnf_index": name_schema, # if not null, network inside VNF
1102 "osm_id": name_schema, # sce_network osm_id or name
1103 },
1104 "additionalProperties": False,
1105 "required": ["instance_scenario_id", "osm_id"]
1106 },
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001107 #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 +02001108 "sites": {
1109 "type":"array",
1110 "minLength":1,
1111 "items":{
1112 "type":"object",
1113 "properties":{
1114 # By default for an scenario 'external' network openmano looks for an existing VIM network to map this external scenario network,
1115 # for other networks openamno creates at VIM
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001116 # Use netmap-create to force to create an external scenario network
tiernofc7cfbf2019-03-20 17:23:45 +00001117 "netmap-create": {"oneOf":[name_schema,null_schema]}, #datacenter network to use. Null if must be created as an internal net
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001118 #netmap-use: Indicates an existing VIM network that must be used for this scenario network.
tiernobe41e222016-09-02 15:16:13 +02001119 #Can use both the VIM network name (if it is not ambiguous) or the VIM net UUID
1120 #If both 'netmap-create' and 'netmap-use'are supplied, netmap-use precedes, but if fails openmano follows the netmap-create
1121 #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 +01001122 "netmap-use": name_schema, #
tiernobe41e222016-09-02 15:16:13 +02001123 "vim-network-name": name_schema, #override network name
gcalvino0a480542018-12-17 16:19:33 +01001124 "vim-network-id": name_schema,
tiernobe41e222016-09-02 15:16:13 +02001125 #"ip-profile": ip_profile_schema,
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001126 "datacenter": name_schema,
tiernobe41e222016-09-02 15:16:13 +02001127 }
1128 }
1129 },
tierno7edb6752016-03-21 17:37:52 +01001130 }
1131 }
1132 },
1133 },
1134 },
1135 "additionalProperties": False,
garciadeblasfec35df2016-08-25 11:33:57 +02001136 "required": ["name"]
tierno7edb6752016-03-21 17:37:52 +01001137 },
1138 },
1139 "required": ["instance"],
1140 "additionalProperties": False
tierno7edb6752016-03-21 17:37:52 +01001141}
1142
1143instance_scenario_action_schema = {
tierno16e3dd42018-04-24 12:52:40 +02001144 "title": "instance scenario action information schema",
tierno7edb6752016-03-21 17:37:52 +01001145 "$schema": "http://json-schema.org/draft-04/schema#",
tierno16e3dd42018-04-24 12:52:40 +02001146 "type": "object",
1147 "properties": {
tiernofc7cfbf2019-03-20 17:23:45 +00001148 "start": null_schema,
1149 "pause": null_schema,
1150 "resume": null_schema,
1151 "shutoff": null_schema,
1152 "shutdown": null_schema,
1153 "forceOff": null_schema,
1154 "rebuild": null_schema,
tierno16e3dd42018-04-24 12:52:40 +02001155 "reboot": {
1156 "type": ["object", "null"],
tierno7edb6752016-03-21 17:37:52 +01001157 },
gcalvinoe580c7d2017-09-22 14:09:51 +02001158 "add_public_key": description_schema,
tierno7edb6752016-03-21 17:37:52 +01001159 "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]},
tiernofc5f80b2018-05-29 16:00:43 +02001160 "vdu-scaling": {
gcalvinoe580c7d2017-09-22 14:09:51 +02001161 "type": "array",
tierno16e3dd42018-04-24 12:52:40 +02001162 "items": {
tierno868220c2017-09-26 00:11:05 +02001163 "type": "object",
tierno16e3dd42018-04-24 12:52:40 +02001164 "properties": {
tierno868220c2017-09-26 00:11:05 +02001165 "vdu-id": id_schema,
tiernofc5f80b2018-05-29 16:00:43 +02001166 "osm_vdu_id": name_schema,
1167 "member-vnf-index": name_schema,
tierno868220c2017-09-26 00:11:05 +02001168 "count": integer1_schema,
tiernofc5f80b2018-05-29 16:00:43 +02001169 "type": {"enum": ["create", "delete"]}
tierno868220c2017-09-26 00:11:05 +02001170 },
1171 "additionalProperties": False,
1172 "minProperties": 1,
tiernofc5f80b2018-05-29 16:00:43 +02001173 "required": ["type"]
tierno868220c2017-09-26 00:11:05 +02001174 }
1175 },
tierno16e3dd42018-04-24 12:52:40 +02001176 "vnfs": {"type": "array", "items": {"type": "string"}},
1177 "vms": {"type": "array", "items": {"type": "string"}}
tierno7edb6752016-03-21 17:37:52 +01001178 },
1179 "minProperties": 1,
1180 #"maxProperties": 1,
1181 "additionalProperties": False
1182}
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001183
1184sdn_controller_properties={
1185 "name": name_schema,
Pablo Montes Moreno6aa0b2b2017-05-23 18:33:12 +02001186 "dpid": {"type":"string", "pattern":"^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"},
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001187 "ip": ip_schema,
1188 "port": port_schema,
1189 "type": {"type": "string", "enum": ["opendaylight","floodlight","onos"]},
1190 "version": {"type" : "string", "minLength":1, "maxLength":12},
1191 "user": nameshort_schema,
1192 "password": passwd_schema
1193}
1194sdn_controller_schema = {
1195 "title":"sdn controller information schema",
1196 "$schema": "http://json-schema.org/draft-04/schema#",
1197 "type":"object",
1198 "properties":{
1199 "sdn_controller":{
1200 "type":"object",
1201 "properties":sdn_controller_properties,
1202 "required": ["name", "port", 'ip', 'dpid', 'type'],
1203 "additionalProperties": False
1204 }
1205 },
1206 "required": ["sdn_controller"],
1207 "additionalProperties": False
1208}
1209
1210sdn_controller_edit_schema = {
1211 "title":"sdn controller update information schema",
1212 "$schema": "http://json-schema.org/draft-04/schema#",
1213 "type":"object",
1214 "properties":{
1215 "sdn_controller":{
1216 "type":"object",
1217 "properties":sdn_controller_properties,
1218 "additionalProperties": False
1219 }
1220 },
1221 "required": ["sdn_controller"],
1222 "additionalProperties": False
1223}
1224
1225sdn_port_mapping_schema = {
1226 "$schema": "http://json-schema.org/draft-04/schema#",
1227 "title":"sdn port mapping information schema",
1228 "type": "object",
1229 "properties": {
1230 "sdn_port_mapping": {
1231 "type": "array",
1232 "items": {
1233 "type": "object",
1234 "properties": {
1235 "compute_node": nameshort_schema,
1236 "ports": {
1237 "type": "array",
1238 "items": {
1239 "type": "object",
1240 "properties": {
tiernofc7cfbf2019-03-20 17:23:45 +00001241 "pci": {"OneOf": [null_schema, pci_extended_schema]}, # pci_schema,
Pablo Montes Moreno3fbff9b2017-03-08 11:28:15 +01001242 "switch_port": nameshort_schema,
1243 "switch_mac": mac_schema
1244 },
1245 "required": ["pci"]
1246 }
1247 }
1248 },
1249 "required": ["compute_node", "ports"]
1250 }
1251 }
1252 },
1253 "required": ["sdn_port_mapping"]
Pablo Montes Moreno6aa0b2b2017-05-23 18:33:12 +02001254}
1255
1256sdn_external_port_schema = {
1257 "$schema": "http://json-schema.org/draft-04/schema#",
1258 "title":"External port ingformation",
1259 "type": "object",
1260 "properties": {
1261 "port": {"type" : "string", "minLength":1, "maxLength":60},
1262 "vlan": vlan_schema,
1263 "mac": mac_schema
1264 },
1265 "required": ["port"]
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001266}