b7629f566eb73d95e429ad2195854fd1fba1b0c9
[osm/openvim.git] / osm_openvim / vim_schema.py
1 # -*- coding: utf-8 -*-
2
3 ##
4 # Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
5 # This file is part of openvim
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 ''' Definition of dictionaries schemas used by validating input
25 These dictionaries are validated using jsonschema library
26 '''
27 __author__="Alfonso Tierno"
28 __date__ ="$10-jul-2014 12:07:15$"
29
30 #
31 # SCHEMAS to validate input data
32 #
33
34 path_schema = {"type": "string", "maxLength": 255, "pattern": "^(\.){0,2}(/[^/\"':{}\(\)]+)+$"}
35 http_schema = {"type": "string", "pattern": "^https?://[^'\"=]+$"}
36 port_schema = {"type": "integer","minimum": 1, "maximun": 65534}
37 ip_schema = {"type": "string", "pattern": "^([0-9]{1,3}.){3}[0-9]{1,3}$"}
38 cidr_schema = {"type": "string", "pattern": "^([0-9]{1,3}.){3}[0-9]{1,3}/[0-9]{1,2}$"}
39 name_schema = {"type": "string", "minLength": 1, "maxLength": 255, "pattern": "^[^,;()'\"]+$"}
40 nameshort_schema = {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[^,;()'\"]+$"}
41 nametiny_schema = {"type": "string", "minLength": 1, "maxLength": 12, "pattern": "^[^,;()'\"]+$"}
42 xml_text_schema = {"type": "string", "minLength": 1, "maxLength": 1000, "pattern": "^[^']+$"}
43 description_schema = {"type": ["string", "null"], "maxLength": 255, "pattern": "^[^'\"]+$"}
44 id_schema_fake = {"type": "string", "minLength": 2, "maxLength": 36}
45 # "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}$"
46 id_schema = {"type": "string", "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"}
47 pci_schema = {"type": "string", "pattern": "^[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}\.[0-9a-fA-F]$"}
48 # used by VIO neutron-port-show <host_moid>-<domain>:<bus>:<device>.<function>-<VF-id>
49 pci_extended_schema = {"type": "string", "pattern": "^([0-9a-fA-F]{4}-)?[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}"
50 "\.[0-9a-fA-F](-[0-9a-fA-F]{3})?$"}
51 bandwidth_schema = {"type": "string", "pattern": "^[0-9]+ *([MG]bps)?$"}
52 integer0_schema = {"type": "integer", "minimum": 0}
53 integer1_schema = {"type": "integer", "minimum": 1}
54 vlan_schema = {"type": "integer", "minimum": 1, "maximun": 4095}
55 vlan1000_schema = {"type": "integer", "minimum": 1000, "maximun": 4095}
56 mac_schema = {"type": "string", "pattern": "^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){5}$"}
57 # must be unicast LSB bit of MSB byte ==0
58 net_bind_schema = {"oneOf": [
59 {"type": "null"},
60 {"type": "string", "pattern":
61 "^(default|((bridge|macvtap):[0-9a-zA-Z\.\-]{1,50})|openflow:[/0-9a-zA-Z\.\-]{1,50}(:vlan)?)$"}
62 ]}
63 yes_no_schema = {"type": "string", "enum": ["yes", "no"]}
64 log_level_schema = {"type": "string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]}
65
66 config_schema = {
67 "title": "main configuration information schema",
68 "$schema": "http://json-schema.org/draft-04/schema#",
69 "type": "object",
70 "properties":{
71 "http_port": port_schema,
72 "http_admin_port": port_schema,
73 "http_host": nameshort_schema,
74 "http_url_prefix": path_schema, # it does not work yet; it's supposed to be the base path to be used by bottle, but it must be explicitly declared
75 "db_host": nameshort_schema,
76 "db_user": nameshort_schema,
77 "db_passwd": {"type": "string"},
78 "db_name": nameshort_schema,
79 "of_controller_ip": ip_schema,
80 "of_controller_port": port_schema,
81 "of_controller_dpid": nameshort_schema,
82 "of_controller_nets_with_same_vlan": {"type" : "boolean"},
83 "of_controller": nameshort_schema, #{"type":"string", "enum":["floodlight", "opendaylight"]},
84 "of_controller_module": {"type":"string"},
85 "of_user": nameshort_schema,
86 "of_password": nameshort_schema,
87 "test_mode": {"type": "boolean"}, # leave for backward compatibility
88 "mode": {"type":"string", "enum":["normal", "host only", "OF only", "development", "test"] },
89 "development_bridge": {"type":"string"},
90 "tenant_id": {"type" : "string"},
91 "image_path": path_schema, # leave for backward compatibility
92 "host_image_path": path_schema,
93 "host_ssh_keyfile": path_schema,
94 "network_vlan_range_start": vlan_schema,
95 "network_vlan_range_end": vlan_schema,
96 "bridge_ifaces": {
97 "type": "object",
98 "patternProperties": {
99 "." : {
100 "type": "array",
101 "items": integer0_schema,
102 "minItems":2,
103 "maxItems":2,
104 },
105 },
106 "minProperties": 2
107 },
108 "dhcp_server": {
109 "type": "object",
110 "properties": {
111 "host": name_schema,
112 "port": port_schema,
113 "provider": {"type": "string", "enum": ["isc-dhcp-server"]},
114 "user": nameshort_schema,
115 "password": {"type": "string"},
116 "key": path_schema, # for backward compatibility, use keyfile instead
117 "keyfile": path_schema,
118 "bridge_ifaces": {
119 "type": "array",
120 "items": nameshort_schema,
121 },
122 "nets": {
123 "type": "array",
124 "items": name_schema,
125 },
126 },
127 "required": ['host', 'provider', 'user']
128 },
129 "log_level": log_level_schema,
130 "log_level_db": log_level_schema,
131 "log_level_of": log_level_schema,
132 "network_type": {"type": "string", "enum": ["ovs", "bridge"]},
133 "ovs_controller_file_path": path_schema,
134 "ovs_controller_ip": nameshort_schema,
135 "ovs_controller_user": nameshort_schema,
136 "ovs_controller_password": {"type": "string"},
137 "ovs_controller_keyfile": path_schema,
138 },
139 "patternProperties": {
140 "of_*" : {"type": ["string", "integer", "boolean"]}
141 },
142 "required": ['db_host', 'db_user', 'db_passwd', 'db_name'],
143 "additionalProperties": False
144 }
145
146
147
148 metadata_schema={
149 "type":"object",
150 "properties":{
151 "architecture": {"type":"string"},
152 "use_incremental": yes_no_schema,
153 "vpci": pci_schema,
154 "os_distro": {"type":"string"},
155 "os_type": {"type":"string"},
156 "os_version": {"type":"string"},
157 "bus": {"type":"string"},
158 "topology": {"type":"string", "enum": ["oneSocket", "oneSocket:hyperthreading"]}
159 }
160 }
161
162 tenant_new_schema = {
163 "title":"tenant creation information schema",
164 "$schema": "http://json-schema.org/draft-04/schema#",
165 "type":"object",
166 "properties":{
167 "tenant":{
168 "type":"object",
169 "properties":{
170 "id":id_schema,
171 "name": nameshort_schema,
172 "description":description_schema,
173 "enabled":{"type" : "boolean"}
174 },
175 "required": ["name"]
176 }
177 },
178 "required": ["tenant"],
179 "additionalProperties": False
180 }
181
182 tenant_edit_schema = {
183 "title":"tenant edition information schema",
184 "$schema": "http://json-schema.org/draft-04/schema#",
185 "type":"object",
186 "properties":{
187 "tenant":{
188 "type":"object",
189 "minProperties":1,
190 "properties":{
191 "name":nameshort_schema,
192 "description":description_schema,
193 "enabled":{"type" : "boolean"}
194 },
195 "additionalProperties": False,
196 }
197 },
198 "required": ["tenant"],
199 "additionalProperties": False
200 }
201 interfaces_schema={
202 "type":"array",
203 "minItems":0,
204 "items":{
205 "type":"object",
206 "properties":{
207 "name":name_schema,
208 "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]},
209 "bandwidth":bandwidth_schema,
210 "vpci":pci_schema,
211 "uuid":id_schema,
212 "mac_address":mac_schema
213 },
214 "additionalProperties": False,
215 "required": ["dedicated", "bandwidth"]
216 }
217 }
218
219 extended_schema={
220 "type":"object",
221 "properties":{
222 "processor_ranking":integer0_schema,
223 "devices":{
224 "type": "array",
225 "items":{
226 "type": "object",
227 "properties":{
228 "type":{"type":"string", "enum":["usb","disk","cdrom","xml"]},
229 "vpci":pci_schema,
230 "imageRef":id_schema,
231 "xml":xml_text_schema,
232 "dev":nameshort_schema,
233 "size":integer1_schema,
234 },
235 "additionalProperties": False,
236 "required": ["type"]
237 }
238 },
239 "numas":{
240 "type": "array",
241 "items":{
242 "type": "object",
243 "properties":{
244 "memory":integer1_schema,
245 "cores":integer1_schema,
246 "paired-threads":integer1_schema,
247 "threads":integer1_schema,
248 "cores-id":{"type":"array","items":integer0_schema},
249 "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema}},
250 "threads-id":{"type":"array","items":integer0_schema},
251 "interfaces":interfaces_schema
252 },
253 "additionalProperties": False,
254 "minProperties": 1,
255 #"required": ["memory"]
256 }
257 }
258 },
259 #"additionalProperties": False,
260 #"required": ["processor_ranking"]
261 }
262
263 host_data_schema={
264 "title":"hosts manual insertion information schema",
265 "type":"object",
266 "properties":{
267 "id": id_schema,
268 "admin_state_up": {"type": "boolean"},
269 "created_at": {"type": "string"}, # ignored, just for compatibility with host-list
270 "ip_name": nameshort_schema,
271 "name": name_schema,
272 "description": description_schema,
273 "user": nameshort_schema,
274 "password": nameshort_schema,
275 "keyfile": path_schema,
276 "features": description_schema,
277 "ranking": integer0_schema,
278 "autodiscover": {"type": "boolean"}, # try to discover host parameters instead of providing in this schema
279 "devices": {
280 "type": "array",
281 "items": {
282 "type": "object",
283 "properties": {
284 "type": {"type": "string", "enum": ["usb", "disk"]},
285 "vpci": pci_schema
286 },
287 "additionalProperties": False,
288 "required": ["type"]
289 }
290 },
291 "numas": {
292 "type": "array",
293 "minItems": 1,
294 "items": {
295 "type": "object",
296 "properties": {
297 "admin_state_up": {"type": "boolean"},
298 "hugepages": integer0_schema,
299 "hugepages_consumed": integer0_schema, # ignored, just for compatibility with host-list
300 "numa_socket": integer0_schema,
301 "memory": integer1_schema,
302 "cores":{
303 "type": "array",
304 "minItems": 2,
305 "items": {
306 "type": "object",
307 "properties": {
308 "core_id": integer0_schema,
309 "thread_id": integer0_schema,
310 "status": {"type": "string", "enum": ["noteligible"]},
311 "instance_id": {"type": "string"}, # ignored, just for compatibility with host-list
312 "v_thread_id": {"type": "integer"} # ignored, just for compatibility with host-list
313 },
314 "additionalProperties": False,
315 "required": ["core_id", "thread_id"]
316 }
317 },
318 "interfaces": {
319 "type": "array",
320 "minItems": 1,
321 "items": {
322 "type": "object",
323 "properties": {
324 "source_name": nameshort_schema,
325 "mac": mac_schema,
326 "Mbps": integer0_schema,
327 "pci": pci_schema,
328 "sriovs": {
329 "type": "array",
330 "minItems":1,
331 "items": {
332 "type": "object",
333 "properties": {
334 "source_name": {"oneOf": [integer0_schema, nameshort_schema]},
335 "mac": mac_schema,
336 "vlan": integer0_schema, # ignored, just for backward compatibility
337 "pci": pci_schema,
338 },
339 "additionalProperties": False,
340 "required": ["source_name", "mac", "pci"]
341 }
342 },
343 "switch_port": nameshort_schema,
344 "switch_dpid": nameshort_schema,
345 "switch_mac": mac_schema,
346 },
347 "additionalProperties": False,
348 "required": ["source_name", "mac", "Mbps", "pci"]
349 }
350 },
351 },
352 "additionalProperties": False,
353 "required": ["cores", "numa_socket"]
354 }
355 }
356 },
357 "additionalProperties": False,
358 "required": ["name", "user", "ip_name"]
359 }
360
361 host_edit_schema={
362 "title":"hosts creation information schema",
363 "$schema": "http://json-schema.org/draft-04/schema#",
364 "type":"object",
365 "properties":{
366 "host":{
367 "type":"object",
368 "properties":{
369 "ip_name":nameshort_schema,
370 "name": name_schema,
371 "description":description_schema,
372 "user":nameshort_schema,
373 "password":nameshort_schema,
374 "admin_state_up":{"type":"boolean"},
375 "numas":{
376 "type":"array",
377 "items":{
378 "type": "object",
379 "properties":{
380 "numa_socket": integer0_schema,
381 "admin_state_up":{"type":"boolean"},
382 "interfaces":{
383 "type":"array",
384 "items":{
385 "type": "object",
386 "properties":{
387 "source_name": nameshort_schema,
388 "switch_dpid": nameshort_schema,
389 "switch_port": nameshort_schema,
390 },
391 "required": ["source_name"],
392 }
393 }
394 },
395 "required": ["numa_socket"],
396 "additionalProperties": False,
397 }
398 }
399 },
400 "minProperties": 1,
401 "additionalProperties": False
402 },
403 },
404 "required": ["host"],
405 "minProperties": 1,
406 "additionalProperties": False
407 }
408
409 host_new_schema = {
410 "title":"hosts creation information schema",
411 "$schema": "http://json-schema.org/draft-04/schema#",
412 "type":"object",
413 "properties":{
414 "host": host_data_schema,
415 "host-data":host_data_schema
416 },
417 "required": ["host"],
418 "minProperties": 1,
419 "maxProperties": 2,
420 "additionalProperties": False
421 }
422
423
424 flavor_new_schema = {
425 "title":"flavor creation information schema",
426 "$schema": "http://json-schema.org/draft-04/schema#",
427 "type":"object",
428 "properties":{
429 "flavor":{
430 "type":"object",
431 "properties":{
432 "id":id_schema,
433 "name":name_schema,
434 "description":description_schema,
435 "ram":integer0_schema,
436 "vcpus":integer0_schema,
437 "extended": extended_schema,
438 "public": yes_no_schema
439 },
440 "required": ["name"]
441 }
442 },
443 "required": ["flavor"],
444 "additionalProperties": False
445 }
446 flavor_update_schema = {
447 "title":"flavor update information schema",
448 "$schema": "http://json-schema.org/draft-04/schema#",
449 "type":"object",
450 "properties":{
451 "flavor":{
452 "type":"object",
453 "properties":{
454 "name":name_schema,
455 "description":description_schema,
456 "ram":integer0_schema,
457 "vcpus":integer0_schema,
458 "extended": extended_schema,
459 "public": yes_no_schema
460 },
461 "minProperties": 1,
462 "additionalProperties": False
463 }
464 },
465 "required": ["flavor"],
466 "additionalProperties": False
467 }
468
469 image_new_schema = {
470 "title":"image creation information schema",
471 "$schema": "http://json-schema.org/draft-04/schema#",
472 "type":"object",
473 "properties":{
474 "image":{
475 "type":"object",
476 "properties":{
477 "id":id_schema,
478 "path": {"oneOf": [path_schema, http_schema]},
479 "description":description_schema,
480 "name":name_schema,
481 "metadata":metadata_schema,
482 "public": yes_no_schema
483 },
484 "required": ["name","path"]
485 }
486 },
487 "required": ["image"],
488 "additionalProperties": False
489 }
490
491 image_update_schema = {
492 "title":"image update information schema",
493 "$schema": "http://json-schema.org/draft-04/schema#",
494 "type":"object",
495 "properties":{
496 "image":{
497 "type":"object",
498 "properties":{
499 "path":{"oneOf": [path_schema, http_schema]},
500 "description":description_schema,
501 "name":name_schema,
502 "metadata":metadata_schema,
503 "public": yes_no_schema
504 },
505 "minProperties": 1,
506 "additionalProperties": False
507 }
508 },
509 "required": ["image"],
510 "additionalProperties": False
511 }
512
513 networks_schema={
514 "type":"array",
515 "items":{
516 "type":"object",
517 "properties":{
518 "name":name_schema,
519 "bandwidth":bandwidth_schema,
520 "vpci":pci_schema,
521 "uuid":id_schema,
522 "mac_address": mac_schema,
523 "ip_address": ip_schema,
524 "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139"]},
525 "type": {"type":"string", "enum":["virtual","PF","VF","VFnotShared"]}
526 },
527 "additionalProperties": False,
528 "required": ["uuid"]
529 }
530 }
531
532 server_new_schema = {
533 "title":"server creation information schema",
534 "$schema": "http://json-schema.org/draft-04/schema#",
535 "type":"object",
536 "properties":{
537 "server":{
538 "type":"object",
539 "properties":{
540 "id":id_schema,
541 "name":name_schema,
542 "description":description_schema,
543 "start":{"type":"string", "enum":["yes","no","paused"]},
544 "hostId":id_schema,
545 "flavorRef":id_schema,
546 "imageRef":id_schema,
547 "extended": extended_schema,
548 "networks":networks_schema
549 },
550 "required": ["name","flavorRef","imageRef"]
551 }
552 },
553 "required": ["server"],
554 "additionalProperties": False
555 }
556
557 server_action_schema = {
558 "title":"server action information schema",
559 "$schema": "http://json-schema.org/draft-04/schema#",
560 "type":"object",
561 "properties":{
562 "start":{"oneOf":[{"type": "null"}, {"type":"string", "enum":["rebuild","null"] }]},
563 "pause":{"type": "null"},
564 "resume":{"type": "null"},
565 "shutoff":{"type": "null"},
566 "shutdown":{"type": "null"},
567 "forceOff":{"type": "null"},
568 "terminate":{"type": "null"},
569 "createImage":{
570 "type":"object",
571 "properties":{
572 "path":path_schema,
573 "description":description_schema,
574 "name":name_schema,
575 "metadata":metadata_schema,
576 "imageRef": id_schema,
577 "disk": {"oneOf":[{"type": "null"}, {"type":"string"}] },
578 },
579 "required": ["name"]
580 },
581 "rebuild":{"type": ["object","null"]},
582 "reboot":{
583 "type": ["object","null"],
584 # "properties": {
585 # "type":{"type":"string", "enum":["SOFT"] }
586 # },
587 # "minProperties": 1,
588 # "maxProperties": 1,
589 # "additionalProperties": False
590 }
591 },
592 "minProperties": 1,
593 "maxProperties": 1,
594 "additionalProperties": False
595 }
596
597 network_new_schema = {
598 "title": "network creation information schema",
599 "$schema": "http://json-schema.org/draft-04/schema#",
600 "type": "object",
601 "properties": {
602 "network": {
603 "type": "object",
604 "properties":{
605 "id": id_schema,
606 "name": name_schema,
607 "type": {"type":"string", "enum": ["bridge_man", "bridge_data", "data", "ptp"]},
608 "shared": {"type": "boolean"},
609 "tenant_id": id_schema,
610 "admin_state_up": {"type": "boolean"},
611 "provider:vlan": vlan_schema,
612 "provider:physical": net_bind_schema,
613 "region": nameshort_schema,
614 "cidr": cidr_schema,
615 "enable_dhcp": {"type": "boolean"},
616 "dhcp_first_ip": ip_schema,
617 "dhcp_last_ip": ip_schema,
618 "dns": {"type": "array", "items": [ip_schema]},
619 "links": {"type": "array", "items": {"type": "object", "properties": {
620 "nat": cidr_schema,
621 "iface": name_schema,
622 "vlan": vlan_schema},
623 "required": ["iface"],
624 "additionalProperties": False
625 },
626
627 },
628 "routes": {"type": "object", "properties": {"default": ip_schema}, "patternProperties": {
629 "^([0-9]{1,3}.){3}[0-9]{1,3}/[0-9]{1,2}$": ip_schema,
630 },
631 "additionalProperties": False
632 },
633
634 "bind_net": name_schema, # can be name, or uuid
635 "bind_type": {"oneOf": [{"type": "null"}, {"type": "string", "pattern": "^vlan:[0-9]{1,4}$"}]}
636 },
637 "required": ["name"]
638 }
639 },
640 "required": ["network"],
641 "additionalProperties": False
642 }
643
644 network_update_schema = {
645 "title":"network update information schema",
646 "$schema": "http://json-schema.org/draft-04/schema#",
647 "type":"object",
648 "properties":{
649 "network":{
650 "type":"object",
651 "properties":{
652 "name":name_schema,
653 "type":{"type":"string", "enum":["bridge_man","bridge_data","data", "ptp"]},
654 "shared":{"type":"boolean"},
655 "tenant_id":id_schema,
656 "admin_state_up":{"type":"boolean"},
657 "provider:vlan":vlan_schema,
658 "provider:physical":net_bind_schema,
659 "cidr":cidr_schema,
660 "enable_dhcp": {"type":"boolean"},
661 # "dhcp_first_ip": ip_schema,
662 # "dhcp_last_ip": ip_schema,
663 "bind_net":name_schema, #can be name, or uuid
664 "bind_type":{"oneOf":[{"type":"null"},{"type":"string", "pattern":"^vlan:[0-9]{1,4}$"}]}
665 },
666 "minProperties": 1,
667 "additionalProperties": False
668 }
669 },
670 "required": ["network"],
671 "additionalProperties": False
672 }
673
674
675 port_new_schema = {
676 "title":"port creation information schema",
677 "$schema": "http://json-schema.org/draft-04/schema#",
678 "type":"object",
679 "properties":{
680 "port":{
681 "type":"object",
682 "properties":{
683 "id":id_schema,
684 "name":nameshort_schema,
685 "network_id":{"oneOf":[{"type": "null"}, id_schema ]},
686 "tenant_id":id_schema,
687 "mac_address": {"oneOf":[{"type": "null"}, mac_schema] },
688 "admin_state_up":{"type":"boolean"},
689 "bandwidth":bandwidth_schema,
690 "binding:switch_port":nameshort_schema,
691 "binding:vlan": {"oneOf":[{"type": "null"}, vlan_schema ]}
692 },
693 "required": ["name"]
694 }
695 },
696 "required": ["port"],
697 "additionalProperties": False
698 }
699
700 port_update_schema = {
701 "title":"port update information schema",
702 "$schema": "http://json-schema.org/draft-04/schema#",
703 "type":"object",
704 "properties":{
705 "port":{
706 "type":"object",
707 "properties":{
708 "name":nameshort_schema,
709 "network_id":{"anyOf":[{"type":"null"}, id_schema ] }
710 },
711 "minProperties": 1,
712 "additionalProperties": False
713 }
714 },
715 "required": ["port"],
716 "additionalProperties": False
717 }
718
719 localinfo_schema = {
720 "title":"localinfo information schema",
721 "$schema": "http://json-schema.org/draft-04/schema#",
722 "type":"object",
723 "properties":{
724 "files":{ "type": "object"},
725 "inc_files":{ "type": "object"},
726 "server_files":{ "type": "object"}
727 },
728 "required": ["files"]
729 }
730
731 hostinfo_schema = {
732 "title":"host information schema",
733 "$schema": "http://json-schema.org/draft-04/schema#",
734 "type":"object",
735 "properties":{
736 "iface_names":{
737 "type":"object",
738 "patternProperties":{
739 ".":{ "type": "string"}
740 },
741 "minProperties": 1
742 }
743 },
744 "required": ["iface_names"]
745 }
746
747 openflow_controller_schema = {
748 "title": "network creation information schema",
749 "$schema": "http://json-schema.org/draft-04/schema#",
750 "type": "object",
751 "properties": {
752 "ofc": {
753 "type": "object",
754 "properties": {
755 "name": name_schema,
756 "dpid": nameshort_schema,
757 "ip": nameshort_schema,
758 "port": port_schema,
759 "type": nameshort_schema,
760 "version": nametiny_schema,
761 "user": nameshort_schema,
762 "password": nameshort_schema
763 },
764 "required": ["dpid", "type", "ip", "port", "name"]
765 }
766 },
767 "required": ["ofc"],
768 "additionalProperties": False
769 }
770
771 of_port_new_schema = {
772 "title": "OF port mapping",
773 "type": "object",
774 "properties": {
775 "ofc_id": id_schema,
776 "region": nameshort_schema,
777 "compute_node": nameshort_schema,
778 "pci": pci_extended_schema,
779 "switch_dpid": nameshort_schema,
780 "switch_port": nameshort_schema,
781 "switch_mac": mac_schema
782 },
783 "required": ["region", "compute_node", "pci", "switch_dpid"]
784 }
785
786 of_port_map_new_schema = {
787 "title": "OF port mapping",
788 "$schema": "http://json-schema.org/draft-04/schema#",
789 "type": "object",
790 "properties": {
791 "of_port_mapings": {"type": "array", "items": of_port_new_schema, "minLenght":1},
792 },
793 "required": ["of_port_mapings"],
794 "additionalProperties": False
795
796 }