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