Allow VIO extended PCI address for the port_mapping
[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 "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139"]},
524 "type": {"type":"string", "enum":["virtual","PF","VF","VFnotShared"]}
525 },
526 "additionalProperties": False,
527 "required": ["uuid"]
528 }
529 }
530
531 server_new_schema = {
532 "title":"server creation information schema",
533 "$schema": "http://json-schema.org/draft-04/schema#",
534 "type":"object",
535 "properties":{
536 "server":{
537 "type":"object",
538 "properties":{
539 "id":id_schema,
540 "name":name_schema,
541 "description":description_schema,
542 "start":{"type":"string", "enum":["yes","no","paused"]},
543 "hostId":id_schema,
544 "flavorRef":id_schema,
545 "imageRef":id_schema,
546 "extended": extended_schema,
547 "networks":networks_schema
548 },
549 "required": ["name","flavorRef","imageRef"]
550 }
551 },
552 "required": ["server"],
553 "additionalProperties": False
554 }
555
556 server_action_schema = {
557 "title":"server action information schema",
558 "$schema": "http://json-schema.org/draft-04/schema#",
559 "type":"object",
560 "properties":{
561 "start":{"oneOf":[{"type": "null"}, {"type":"string", "enum":["rebuild","null"] }]},
562 "pause":{"type": "null"},
563 "resume":{"type": "null"},
564 "shutoff":{"type": "null"},
565 "shutdown":{"type": "null"},
566 "forceOff":{"type": "null"},
567 "terminate":{"type": "null"},
568 "createImage":{
569 "type":"object",
570 "properties":{
571 "path":path_schema,
572 "description":description_schema,
573 "name":name_schema,
574 "metadata":metadata_schema,
575 "imageRef": id_schema,
576 "disk": {"oneOf":[{"type": "null"}, {"type":"string"}] },
577 },
578 "required": ["name"]
579 },
580 "rebuild":{"type": ["object","null"]},
581 "reboot":{
582 "type": ["object","null"],
583 # "properties": {
584 # "type":{"type":"string", "enum":["SOFT"] }
585 # },
586 # "minProperties": 1,
587 # "maxProperties": 1,
588 # "additionalProperties": False
589 }
590 },
591 "minProperties": 1,
592 "maxProperties": 1,
593 "additionalProperties": False
594 }
595
596 network_new_schema = {
597 "title": "network creation information schema",
598 "$schema": "http://json-schema.org/draft-04/schema#",
599 "type": "object",
600 "properties": {
601 "network": {
602 "type": "object",
603 "properties":{
604 "id": id_schema,
605 "name": name_schema,
606 "type": {"type":"string", "enum": ["bridge_man", "bridge_data", "data", "ptp"]},
607 "shared": {"type": "boolean"},
608 "tenant_id": id_schema,
609 "admin_state_up": {"type": "boolean"},
610 "provider:vlan": vlan_schema,
611 "provider:physical": net_bind_schema,
612 "region": nameshort_schema,
613 "cidr": cidr_schema,
614 "enable_dhcp": {"type": "boolean"},
615 "dhcp_first_ip": ip_schema,
616 "dhcp_last_ip": ip_schema,
617 "dns": {"type": "array", "items": [ip_schema]},
618 "links": {"type": "array", "items": {"type": "object", "properties": {
619 "nat": cidr_schema,
620 "iface": name_schema,
621 "vlan": vlan_schema},
622 "required": ["iface"],
623 "additionalProperties": False
624 },
625
626 },
627 "routes": {"type": "object", "properties": {"default": ip_schema}, "patternProperties": {
628 "^([0-9]{1,3}.){3}[0-9]{1,3}/[0-9]{1,2}$": ip_schema,
629 },
630 "additionalProperties": False
631 },
632
633 "bind_net": name_schema, # can be name, or uuid
634 "bind_type": {"oneOf": [{"type": "null"}, {"type": "string", "pattern": "^vlan:[0-9]{1,4}$"}]}
635 },
636 "required": ["name"]
637 }
638 },
639 "required": ["network"],
640 "additionalProperties": False
641 }
642
643 network_update_schema = {
644 "title":"network update information schema",
645 "$schema": "http://json-schema.org/draft-04/schema#",
646 "type":"object",
647 "properties":{
648 "network":{
649 "type":"object",
650 "properties":{
651 "name":name_schema,
652 "type":{"type":"string", "enum":["bridge_man","bridge_data","data", "ptp"]},
653 "shared":{"type":"boolean"},
654 "tenant_id":id_schema,
655 "admin_state_up":{"type":"boolean"},
656 "provider:vlan":vlan_schema,
657 "provider:physical":net_bind_schema,
658 "cidr":cidr_schema,
659 "enable_dhcp": {"type":"boolean"},
660 # "dhcp_first_ip": ip_schema,
661 # "dhcp_last_ip": ip_schema,
662 "bind_net":name_schema, #can be name, or uuid
663 "bind_type":{"oneOf":[{"type":"null"},{"type":"string", "pattern":"^vlan:[0-9]{1,4}$"}]}
664 },
665 "minProperties": 1,
666 "additionalProperties": False
667 }
668 },
669 "required": ["network"],
670 "additionalProperties": False
671 }
672
673
674 port_new_schema = {
675 "title":"port creation information schema",
676 "$schema": "http://json-schema.org/draft-04/schema#",
677 "type":"object",
678 "properties":{
679 "port":{
680 "type":"object",
681 "properties":{
682 "id":id_schema,
683 "name":nameshort_schema,
684 "network_id":{"oneOf":[{"type": "null"}, id_schema ]},
685 "tenant_id":id_schema,
686 "mac_address": {"oneOf":[{"type": "null"}, mac_schema] },
687 "admin_state_up":{"type":"boolean"},
688 "bandwidth":bandwidth_schema,
689 "binding:switch_port":nameshort_schema,
690 "binding:vlan": {"oneOf":[{"type": "null"}, vlan_schema ]}
691 },
692 "required": ["name"]
693 }
694 },
695 "required": ["port"],
696 "additionalProperties": False
697 }
698
699 port_update_schema = {
700 "title":"port update information schema",
701 "$schema": "http://json-schema.org/draft-04/schema#",
702 "type":"object",
703 "properties":{
704 "port":{
705 "type":"object",
706 "properties":{
707 "name":nameshort_schema,
708 "network_id":{"anyOf":[{"type":"null"}, id_schema ] }
709 },
710 "minProperties": 1,
711 "additionalProperties": False
712 }
713 },
714 "required": ["port"],
715 "additionalProperties": False
716 }
717
718 localinfo_schema = {
719 "title":"localinfo information schema",
720 "$schema": "http://json-schema.org/draft-04/schema#",
721 "type":"object",
722 "properties":{
723 "files":{ "type": "object"},
724 "inc_files":{ "type": "object"},
725 "server_files":{ "type": "object"}
726 },
727 "required": ["files"]
728 }
729
730 hostinfo_schema = {
731 "title":"host information schema",
732 "$schema": "http://json-schema.org/draft-04/schema#",
733 "type":"object",
734 "properties":{
735 "iface_names":{
736 "type":"object",
737 "patternProperties":{
738 ".":{ "type": "string"}
739 },
740 "minProperties": 1
741 }
742 },
743 "required": ["iface_names"]
744 }
745
746 openflow_controller_schema = {
747 "title": "network creation information schema",
748 "$schema": "http://json-schema.org/draft-04/schema#",
749 "type": "object",
750 "properties": {
751 "ofc": {
752 "type": "object",
753 "properties": {
754 "name": name_schema,
755 "dpid": nameshort_schema,
756 "ip": nameshort_schema,
757 "port": port_schema,
758 "type": nameshort_schema,
759 "version": nametiny_schema,
760 "user": nameshort_schema,
761 "password": nameshort_schema
762 },
763 "required": ["dpid", "type", "ip", "port", "name"]
764 }
765 },
766 "required": ["ofc"],
767 "additionalProperties": False
768 }
769
770 of_port_new_schema = {
771 "title": "OF port mapping",
772 "type": "object",
773 "properties": {
774 "ofc_id": id_schema,
775 "region": nameshort_schema,
776 "compute_node": nameshort_schema,
777 "pci": pci_extended_schema,
778 "switch_dpid": nameshort_schema,
779 "switch_port": nameshort_schema,
780 "switch_mac": mac_schema
781 },
782 "required": ["region", "compute_node", "pci", "switch_dpid"]
783 }
784
785 of_port_map_new_schema = {
786 "title": "OF port mapping",
787 "$schema": "http://json-schema.org/draft-04/schema#",
788 "type": "object",
789 "properties": {
790 "of_port_mapings": {"type": "array", "items": of_port_new_schema, "minLenght":1},
791 },
792 "required": ["of_port_mapings"],
793 "additionalProperties": False
794
795 }