1 # -*- coding: utf-8 -*-
4 # Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U.
5 # This file is part of openmano
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
12 # http://www.apache.org/licenses/LICENSE-2.0
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
20 # For those usages not covered by the Apache License, Version 2.0 please
21 # contact with: nfvlabs@tid.es
25 JSON schemas used by openmano httpserver.py module to parse the different files and messages sent through the API
27 __author__
="Alfonso Tierno, Gerardo Garcia, Pablo Montes"
28 __date__
="$09-oct-2014 09:09:48$"
31 patern_name
="^[ -~]+$"
32 passwd_schema
={"type" : "string", "minLength":1, "maxLength":60}
33 nameshort_schema
={"type" : "string", "minLength":1, "maxLength":60, "pattern" : "^[^,;()'\"]+$"}
34 name_schema
={"type" : "string", "minLength":1, "maxLength":255, "pattern" : "^[^,;()'\"]+$"}
35 xml_text_schema
={"type" : "string", "minLength":1, "maxLength":1000, "pattern" : "^[^']+$"}
36 description_schema
={"type" : ["string","null"], "maxLength":255, "pattern" : "^[^'\"]+$"}
37 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}$"
38 id_schema
= {"type" : "string", "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"}
39 pci_schema
={"type":"string", "pattern":"^[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}\.[0-9a-fA-F]$"}
40 # allows [] for wildcards. For that reason huge length limit is set
41 pci_extended_schema
= {"type": "string", "pattern": "^[0-9a-fA-F.:-\[\]]{12,40}$"}
43 http_schema
={"type":"string", "pattern":"^https?://[^'\"=]+$"}
44 bandwidth_schema
={"type":"string", "pattern" : "^[0-9]+ *([MG]bps)?$"}
45 memory_schema
={"type":"string", "pattern" : "^[0-9]+ *([MG]i?[Bb])?$"}
46 integer0_schema
={"type":"integer","minimum":0}
47 integer1_schema
={"type":"integer","minimum":1}
48 path_schema
={"type":"string", "pattern":"^(\.){0,2}(/[^/\"':{}\(\)]+)+$"}
49 vlan_schema
={"type":"integer","minimum":1,"maximum":4095}
50 vlan1000_schema
={"type":"integer","minimum":1000,"maximum":4095}
51 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
52 #mac_schema={"type":"string", "pattern":"^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$"}
53 ip_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]?)$"}
54 ip_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])$"}
55 port_schema
={"type":"integer","minimum":1,"maximum":65534}
56 object_schema
={"type":"object"}
57 schema_version_2
={"type":"integer","minimum":2,"maximum":2}
58 #schema_version_string={"type":"string","enum": ["0.1", "2", "0.2", "3", "0.3"]}
59 log_level_schema
={"type":"string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]}
60 checksum_schema
={"type":"string", "pattern":"^[0-9a-fA-F]{32}$"}
61 size_schema
={"type":"integer","minimum":1,"maximum":100}
62 boolean_schema
= {"type": "boolean"}
63 null_schema
= {"type": "null"}
68 "architecture": {"type":"string"},
69 "use_incremental": {"type":"string","enum":["yes","no"]},
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"]}
79 #Schema for the configuration file
81 "title":"configuration response information schema",
82 "$schema": "http://json-schema.org/draft-04/schema#",
85 "http_port": port_schema
,
86 "http_admin_port": port_schema
,
87 "http_host": nameshort_schema
,
88 "auto_push_VNF_to_VIMs": boolean_schema
,
89 "vnf_repository": path_schema
,
90 "db_host": nameshort_schema
,
91 "db_user": nameshort_schema
,
92 "db_passwd": {"type":"string"},
93 "db_name": nameshort_schema
,
94 "db_ovim_host": nameshort_schema
,
95 "db_ovim_user": nameshort_schema
,
96 "db_ovim_passwd": {"type":"string"},
97 "db_ovim_name": nameshort_schema
,
98 # 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
,
104 "mano_tenant_id": id_schema
,
105 "http_console_proxy": boolean_schema
,
106 "http_console_host": nameshort_schema
,
107 "http_console_ports": {
111 {"type": "object", "properties": {"from": port_schema
, "to": port_schema
}, "required": ["from", "to"]}
114 "log_level": log_level_schema
,
115 "log_socket_level": log_level_schema
,
116 "log_level_db": log_level_schema
,
117 "log_level_vim": log_level_schema
,
118 "log_level_wim": log_level_schema
,
119 "log_level_nfvo": log_level_schema
,
120 "log_level_http": log_level_schema
,
121 "log_level_console": log_level_schema
,
122 "log_level_ovim": log_level_schema
,
123 "log_level_sdn": log_level_schema
,
124 "log_level_sdnconn": log_level_schema
,
125 "log_file_db": path_schema
,
126 "log_file_vim": path_schema
,
127 "log_file_wim": path_schema
,
128 "log_file_nfvo": path_schema
,
129 "log_file_http": path_schema
,
130 "log_file_console": path_schema
,
131 "log_file_ovim": path_schema
,
132 "log_file_sdn": path_schema
,
133 "log_file_sdnconn": path_schema
,
134 "log_socket_host": nameshort_schema
,
135 "log_socket_port": port_schema
,
136 "log_file": path_schema
,
138 "required": ['db_user', 'db_passwd', 'db_name'],
139 "additionalProperties": False
143 "title":"tenant information schema",
144 "$schema": "http://json-schema.org/draft-04/schema#",
150 "name": nameshort_schema
,
151 "description": description_schema
,
153 "required": ["name"],
154 "additionalProperties": True
157 "required": ["tenant"],
158 "additionalProperties": False
161 tenant_edit_schema
= {
162 "title":"tenant edit information schema",
163 "$schema": "http://json-schema.org/draft-04/schema#",
170 "description": description_schema
,
172 "additionalProperties": False
175 "required": ["tenant"],
176 "additionalProperties": False
179 datacenter_schema_properties
={
181 "description": description_schema
,
182 "type": nameshort_schema
, #currently "openvim" or "openstack", can be enlarged with plugins
183 "vim_url": description_schema
,
184 "vim_url_admin": description_schema
,
185 "config": { "type":"object" }
188 datacenter_schema
= {
189 "title":"datacenter information schema",
190 "$schema": "http://json-schema.org/draft-04/schema#",
195 "properties":datacenter_schema_properties
,
196 "required": ["name", "vim_url"],
197 "additionalProperties": True
200 "required": ["datacenter"],
201 "additionalProperties": False
205 datacenter_edit_schema
= {
206 "title":"datacenter edit nformation schema",
207 "$schema": "http://json-schema.org/draft-04/schema#",
212 "properties":datacenter_schema_properties
,
213 "additionalProperties": False
216 "required": ["datacenter"],
217 "additionalProperties": False
221 netmap_new_schema
= {
222 "title":"netmap new information schema",
223 "$schema": "http://json-schema.org/draft-04/schema#",
226 "netmap":{ #delete from datacenter
229 "name": name_schema
, #name or uuid of net to change
231 "vim_name": name_schema
234 "additionalProperties": False
237 "required": ["netmap"],
238 "additionalProperties": False
241 netmap_edit_schema
= {
242 "title":"netmap edit information schema",
243 "$schema": "http://json-schema.org/draft-04/schema#",
246 "netmap":{ #delete from datacenter
249 "name": name_schema
, #name or uuid of net to change
252 "additionalProperties": False
255 "required": ["netmap"],
256 "additionalProperties": False
259 datacenter_action_schema
= {
260 "title":"datacenter action information schema",
261 "$schema": "http://json-schema.org/draft-04/schema#",
264 "check-connectivity": {"type": "null"},
265 "net-update": {"type": "null"},
269 "net": name_schema
, #name or uuid of net to change
271 "description": description_schema
,
272 "shared": boolean_schema
275 "additionalProperties": False
280 "net": name_schema
, #name or uuid of net to change
283 "additionalProperties": False
288 "additionalProperties": False
292 datacenter_associate_schema
={
293 "title":"datacenter associate information schema",
294 "$schema": "http://json-schema.org/draft-04/schema#",
302 "vim_tenant": name_schema
,
303 "vim_tenant_name": name_schema
,
304 "vim_username": nameshort_schema
,
305 "vim_password": nameshort_schema
,
306 "config": {"type": "object"}
308 # "required": ["vim_tenant"],
309 "additionalProperties": True
312 "required": ["datacenter"],
313 "additionalProperties": False
317 "title": "DHCP schema",
318 "$schema": "http://json-schema.org/draft-04/schema#",
321 "enabled": boolean_schema
,
322 "start-address": {"OneOf": [null_schema
, ip_schema
]},
323 "count": integer0_schema
325 # "required": ["start-address", "count"],
328 ip_profile_schema
= {
329 "title": "IP profile schema",
330 "$schema": "http://json-schema.org/draft-04/schema#",
333 "ip-version": {"type": "string", "enum": ["IPv4", "IPv6"]},
334 "subnet-address": ip_prefix_schema
,
335 "gateway-address": ip_schema
,
336 "dns-address": {"oneOf": [ip_schema
, # for backward compatibility
337 {"type": "array", "items": ip_schema
}]},
343 "title": "Key-pair schema for cloud-init configuration schema",
344 "$schema": "http://json-schema.org/draft-04/schema#",
348 "key": {"type":"string"}
351 "additionalProperties": False
354 cloud_config_user_schema
= {
355 "title": "User schema for cloud-init configuration schema",
356 "$schema": "http://json-schema.org/draft-04/schema#",
359 "name": nameshort_schema
,
360 "user-info": {"type":"string"},
361 #"key-pairs": {"type" : "array", "items": key_pair_schema}
362 "key-pairs": {"type" : "array", "items": {"type":"string"}}
364 "required": ["name"],
365 "additionalProperties": False
368 cloud_config_schema
= {
369 "title": "Cloud-init configuration schema",
370 "$schema": "http://json-schema.org/draft-04/schema#",
373 #"key-pairs": {"type" : "array", "items": key_pair_schema},
374 "key-pairs": {"type" : "array", "items": {"type":"string"}},
375 "users": {"type" : "array", "items": cloud_config_user_schema
}
377 "additionalProperties": False
380 internal_connection_element_schema
= {
384 "local_iface_name": name_schema
388 internal_connection_element_schema_v02
= {
392 "local_iface_name": name_schema
,
393 "ip_address": ip_schema
397 internal_connection_schema
= {
401 "description":description_schema
,
402 "type":{"type":"string", "enum":["bridge","data","ptp"]},
403 "elements": {"type" : "array", "items": internal_connection_element_schema
, "minItems":1}
405 "required": ["name", "type", "elements"],
406 "additionalProperties": False
409 internal_connection_schema_v02
= {
413 "description":description_schema
,
414 "type": {"type": "string", "enum":["e-line", "e-lan"]},
415 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
416 "ip-profile": ip_profile_schema
,
417 "elements": {"type" : "array", "items": internal_connection_element_schema_v02
, "minItems":1}
419 "required": ["name", "type", "implementation", "elements"],
420 "additionalProperties": False
423 external_connection_schema
= {
427 "type":{"type":"string", "enum":["mgmt","bridge","data"]},
429 "local_iface_name": name_schema
,
430 "description":description_schema
432 "required": ["name", "type", "VNFC", "local_iface_name"],
433 "additionalProperties": False
437 external_connection_schema_v02
= {
441 "mgmt": boolean_schema
,
442 "type": {"type": "string", "enum":["e-line", "e-lan"]},
443 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
445 "local_iface_name": name_schema
,
446 "description":description_schema
448 "required": ["name", "type", "VNFC", "local_iface_name"],
449 "additionalProperties": False
458 "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]},
459 "bandwidth":bandwidth_schema
,
461 "mac_address": mac_schema
463 "additionalProperties": False,
464 "required": ["name","dedicated", "bandwidth"]
468 bridge_interfaces_schema
={
474 "bandwidth":bandwidth_schema
,
476 "mac_address": mac_schema
,
477 "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139", "paravirt"]},
478 "port-security": boolean_schema
,
479 "floating-ip": boolean_schema
,
481 "additionalProperties": False,
491 "type":{"type":"string", "enum":["disk","cdrom","xml"] },
492 "image": path_schema
,
493 "image name": name_schema
,
494 "image checksum": checksum_schema
,
495 "image metadata": metadata_schema
,
498 "xml":xml_text_schema
,
501 "additionalProperties": False,
510 "memory":integer1_schema
,
511 "cores":integer1_schema
,
512 "paired-threads":integer1_schema
,
513 "threads":integer1_schema
,
514 "cores-id":{"type":"array","items":integer0_schema
},
515 "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema
}},
516 "threads-id":{"type":"array","items":integer0_schema
},
517 "interfaces":interfaces_schema
519 "additionalProperties": False,
520 #"required": ["memory"]
523 config_files_schema
= {
524 "title": "Config files for cloud init schema",
525 "$schema": "http://json-schema.org/draft-04/schema#",
529 "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]}, #by default text
530 "content": {"type": "string"},
531 "permissions": {"type": "string"}, # tiypically octal notation '0644'
532 "owner": {"type": "string"}, # format: owner:group
535 "additionalProperties": False,
536 "required": ["dest", "content"],
539 boot_data_vdu_schema
= {
540 "title": "Boot data (Cloud-init) configuration schema",
541 "$schema": "http://json-schema.org/draft-04/schema#",
544 "key-pairs": {"type" : "array", "items": {"type":"string"}},
545 "users": {"type" : "array", "items": cloud_config_user_schema
},
546 "user-data": {"type" : "string"}, # scrip to run
547 "config-files": {"type": "array", "items": config_files_schema
},
548 # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data
549 "boot-data-drive": boolean_schema
,
551 "additionalProperties": False,
558 "description": description_schema
,
559 "count": integer1_schema
,
560 "image name": name_schema
,
561 "availability_zone": name_schema
,
562 "VNFC image": {"oneOf": [path_schema
, http_schema
]},
563 "image checksum": checksum_schema
,
564 "image metadata": metadata_schema
,
565 #"cloud-config": cloud_config_schema, #common for all vnfs in the scenario
569 "model":description_schema
,
570 "features":{"type":"array","items":nameshort_schema
}
572 "required": ["model"],
573 "additionalProperties": False
578 "type":nameshort_schema
,
579 "version":description_schema
582 "ram":integer0_schema
,
583 "vcpus":integer0_schema
,
584 "disk": integer1_schema
,
589 "bridge-ifaces": bridge_interfaces_schema
,
590 "devices": devices_schema
,
591 "boot-data" : boot_data_vdu_schema
594 "required": ["name"],
596 {"required": ["VNFC image"]},
597 {"required": ["image name"]}
599 "additionalProperties": False
603 "title":"vnfd information schema v0.1",
604 "$schema": "http://json-schema.org/draft-04/schema#",
611 "description": description_schema
,
613 "class": nameshort_schema
,
614 "public": boolean_schema
,
615 "physical": boolean_schema
,
616 "default_user": name_schema
,
617 "tenant_id": id_schema
, #only valid for admin
618 "external-connections": {"type" : "array", "items": external_connection_schema
, "minItems":1},
619 "internal-connections": {"type" : "array", "items": internal_connection_schema
, "minItems":1},
620 "VNFC":{"type" : "array", "items": vnfc_schema
, "minItems":1}
622 "required": ["name","external-connections"],
623 "additionalProperties": True
627 "additionalProperties": False
630 #VNFD schema for OSM R1
632 "title":"vnfd information schema v0.2",
633 "$schema": "http://json-schema.org/draft-04/schema#",
636 "schema_version": {"type": "string", "enum": ["0.2"]},
641 "description": description_schema
,
642 "class": nameshort_schema
,
643 "public": boolean_schema
,
644 "physical": boolean_schema
,
645 "tenant_id": id_schema
, #only valid for admin
646 "external-connections": {"type" : "array", "items": external_connection_schema
, "minItems":1},
647 "internal-connections": {"type" : "array", "items": internal_connection_schema_v02
, "minItems":1},
648 # "cloud-config": cloud_config_schema, #common for all vnfcs
649 "VNFC":{"type" : "array", "items": vnfc_schema
, "minItems":1}
651 "required": ["name"],
652 "additionalProperties": True
655 "required": ["vnf", "schema_version"],
656 "additionalProperties": False
659 #vnfd_schema = vnfd_schema_v01
661 # "title":"vnfd information schema v0.2",
662 # "$schema": "http://json-schema.org/draft-04/schema#",
663 # "oneOf": [vnfd_schema_v01, vnfd_schema_v02]
667 "title":"graphical scenario descriptor information schema",
668 "$schema": "http://json-schema.org/draft-04/schema#",
671 "x": integer0_schema
,
672 "y": integer0_schema
,
676 "left": {"type":"array"},
677 "right": {"type":"array"},
678 "bottom": {"type":"array"},
682 "required": ["x","y"]
686 "title":"network scenario descriptor information schema v0.1",
687 "$schema": "http://json-schema.org/draft-04/schema#",
691 "description": description_schema
,
692 "tenant_id": id_schema
, #only valid for admin
693 "public": boolean_schema
,
699 "patternProperties":{
703 "type":{"type":"string", "enum":["VNF", "other_network", "network", "external_network"]},
705 "graph": graph_schema
,
707 "patternProperties":{
708 "^(VNF )?model$": {"type": "string"}
716 "patternProperties":{
720 "nodes":{"oneOf":[{"type":"object", "minProperties":2}, {"type":"array", "minLength":1}]},
721 "type": {"type": "string", "enum":["link", "external_network", "dataplane_net", "bridge_net"]},
722 "graph": graph_schema
724 "required": ["nodes"]
729 "required": ["nodes"],
730 "additionalProperties": False
733 "required": ["name","topology"],
734 "additionalProperties": False
738 "title":"network scenario descriptor information schema v0.2",
739 "$schema": "http://json-schema.org/draft-04/schema#",
742 "schema_version": schema_version_2
,
747 "description": description_schema
,
748 "tenant_id": id_schema
, #only valid for admin
749 "public": boolean_schema
,
752 "patternProperties":{
757 "graph": graph_schema
,
758 "vnf_name": name_schema
,
766 "patternProperties":{
770 "interfaces":{"type":"array", "minLength":1},
771 "type": {"type": "string", "enum":["dataplane", "bridge"]},
772 "external" : boolean_schema
,
773 "graph": graph_schema
775 "required": ["interfaces"]
781 "required": ["vnfs", "name"],
782 "additionalProperties": False
785 "required": ["scenario","schema_version"],
786 "additionalProperties": False
789 #NSD schema for OSM R1
791 "title":"network scenario descriptor information schema v0.3",
792 "$schema": "http://json-schema.org/draft-04/schema#",
795 "schema_version": {"type": "string", "enum": ["0.3"]},
800 "description": description_schema
,
801 "tenant_id": id_schema
, #only valid for admin
802 "public": boolean_schema
,
803 "cloud-config": cloud_config_schema
, #common for all vnfs in the scenario
804 #"datacenter": name_schema,
807 "patternProperties":{
812 "graph": graph_schema
,
813 "vnf_name": name_schema
,
814 #"cloud-config": cloud_config_schema, #particular for a vnf
815 #"datacenter": name_schema,
816 "internal-connections": {
818 "patternProperties": {
822 "ip-profile": ip_profile_schema
,
829 "local_iface_name": name_schema
,
830 "ip_address": ip_schema
,
832 "required": ["VNFC", "local_iface_name"],
846 "patternProperties":{
857 "vnf_interface": name_schema
,
858 "ip_address": ip_schema
860 "required": ["vnf", "vnf_interface"],
863 "type": {"type": "string", "enum":["e-line", "e-lan"]},
864 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
865 "external" : boolean_schema
,
866 "graph": graph_schema
,
867 "ip-profile": ip_profile_schema
869 "required": ["interfaces"]
875 "required": ["vnfs", "networks","name"],
876 "additionalProperties": False
879 "required": ["scenario","schema_version"],
880 "additionalProperties": False
883 #scenario_new_schema = {
884 # "title":"new scenario information schema",
885 # "$schema": "http://json-schema.org/draft-04/schema#",
886 # #"oneOf": [nsd_schema_v01, nsd_schema_v02]
887 # "oneOf": [nsd_schema_v01]
890 scenario_edit_schema
= {
891 "title":"edit scenario information schema",
892 "$schema": "http://json-schema.org/draft-04/schema#",
896 "description": description_schema
,
902 "patternProperties":{
903 "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$": {
909 "x": integer0_schema
,
910 "y": integer0_schema
,
911 "ifaces":{ "type": "object"}
914 "description": description_schema
,
921 "required": ["nodes"],
922 "additionalProperties": False
925 "additionalProperties": False
928 scenario_action_schema
= {
929 "title":"scenario action information schema",
930 "$schema": "http://json-schema.org/draft-04/schema#",
936 "instance_name":name_schema
,
937 "description":description_schema
,
938 "datacenter": {"type": "string"}
940 "required": ["instance_name"]
945 "instance_name":name_schema
,
946 "description":description_schema
,
947 "datacenter": {"type": "string"}
949 "required": ["instance_name"]
954 "instance_name":name_schema
,
955 "description":description_schema
,
956 "datacenter": {"type": "string"}
958 "required": ["instance_name"]
963 "instance_name":name_schema
,
964 "description":description_schema
,
965 "datacenter": {"type": "string"}
967 "required": ["instance_name"]
972 "additionalProperties": False
975 instance_scenario_object
= {
976 "title": "scenario object used to create an instance not based on any nsd",
977 "$schema": "http://json-schema.org/draft-04/schema#",
987 "external": boolean_schema
,
988 "type": {"enum": ["bridge", "ptp", "data"]}, # for overlay, underlay E-LINE, underlay E-LAN
990 "additionalProperties": False,
991 "required": ["name", "external", "type"]
995 "additionalProperties": False,
999 instance_scenario_create_schema_v01
= {
1000 "title": "instance scenario create information schema v0.1",
1001 "$schema": "http://json-schema.org/draft-04/schema#",
1004 "schema_version": {"type": "string", "enum": ["0.1"]},
1008 "mgmt_keys": {"type": "array", "items": {"type":"string"}},
1009 "vduImage": name_schema
,
1010 "name": name_schema
,
1011 "description":description_schema
,
1012 "datacenter": name_schema
,
1013 "wim_account": {"oneOf": [boolean_schema
, id_schema
, null_schema
]},
1014 "scenario" : {"oneOff": [name_schema
, instance_scenario_object
]}, # can be an UUID or name or a dict
1015 "action":{"enum": ["deploy","reserve","verify" ]},
1016 "connect_mgmt_interfaces": {"oneOf": [boolean_schema
, {"type":"object"}]},# can be true or a dict with datacenter: net_name
1017 "cloud-config": cloud_config_schema
, #common to all vnfs in the instance scenario
1018 "vnfs":{ #mapping from scenario to datacenter
1020 "patternProperties":{
1024 "name": name_schema
, #override vnf name
1025 "datacenter": name_schema
,
1026 #"metadata": {"type": "object"},
1027 #"user_data": {"type": "string"}
1028 #"cloud-config": cloud_config_schema, #particular for a vnf
1031 "patternProperties": {
1035 "name": name_schema
, # overrides vdu name schema
1036 "mgmt_keys": {"type": "array", "items": {"type": "string"}},
1037 "vduImage": name_schema
,
1040 "patternProperties": {
1042 "vim_id": name_schema
,
1048 "patternProperties": {
1050 "ip_address": ip_schema
,
1051 "mac_address": mac_schema
,
1052 "floating-ip": boolean_schema
,
1062 "patternProperties": {
1066 "vim-network-name": name_schema
,
1067 "vim-network-id": name_schema
,
1068 "ip-profile": ip_profile_schema
,
1069 "name": name_schema
,
1078 "networks":{ #mapping from scenario to datacenter
1080 "patternProperties":{
1090 "ip_address": ip_schema
,
1091 "datacenter": name_schema
,
1092 "vim-network-name": name_schema
,
1093 "vim-network-id": name_schema
1095 "patternProperties":{
1096 ".": {"type": "string"}
1100 "wim_account": {"oneOf": [boolean_schema
, id_schema
, null_schema
]},
1101 "ip-profile": ip_profile_schema
,
1105 "instance_scenario_id": id_schema
,
1106 # "member_vnf_index": name_schema, # if not null, network inside VNF
1107 "osm_id": name_schema
, # sce_network osm_id or name
1109 "additionalProperties": False,
1110 "required": ["instance_scenario_id", "osm_id"]
1112 #if the network connects VNFs deployed at different sites, you must specify one entry per site that this network connect to
1119 # By default for an scenario 'external' network openmano looks for an existing VIM network to map this external scenario network,
1120 # for other networks openamno creates at VIM
1121 # Use netmap-create to force to create an external scenario network
1122 "netmap-create": {"oneOf":[name_schema
,null_schema
]}, #datacenter network to use. Null if must be created as an internal net
1123 #netmap-use: Indicates an existing VIM network that must be used for this scenario network.
1124 #Can use both the VIM network name (if it is not ambiguous) or the VIM net UUID
1125 #If both 'netmap-create' and 'netmap-use'are supplied, netmap-use precedes, but if fails openmano follows the netmap-create
1126 #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)
1127 "netmap-use": name_schema
, #
1128 "vim-network-name": name_schema
, #override network name
1129 "vim-network-id": name_schema
,
1130 #"ip-profile": ip_profile_schema,
1131 "datacenter": name_schema
,
1140 "additionalProperties": False,
1141 "required": ["name"]
1144 "required": ["instance"],
1145 "additionalProperties": False
1148 instance_scenario_action_schema
= {
1149 "title": "instance scenario action information schema",
1150 "$schema": "http://json-schema.org/draft-04/schema#",
1153 "start": null_schema
,
1154 "pause": null_schema
,
1155 "resume": null_schema
,
1156 "shutoff": null_schema
,
1157 "shutdown": null_schema
,
1158 "forceOff": null_schema
,
1159 "rebuild": null_schema
,
1161 "type": ["object", "null"],
1163 "add_public_key": {"type" : "string"},
1164 "user": nameshort_schema
,
1165 "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]},
1171 "vdu-id": id_schema
,
1172 "osm_vdu_id": name_schema
,
1173 "member-vnf-index": name_schema
,
1174 "count": integer1_schema
,
1175 "type": {"enum": ["create", "delete"]}
1177 "additionalProperties": False,
1179 "required": ["type"]
1182 "vnfs": {"type": "array", "items": {"type": "string"}},
1183 "vms": {"type": "array", "items": {"type": "string"}}
1186 #"maxProperties": 1,
1187 "additionalProperties": False
1190 sdn_controller_properties
={
1191 "name": name_schema
,
1192 "dpid": {"type": "string", "pattern": "^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"},
1193 "description": name_schema
,
1195 "port": port_schema
,
1196 "type": nameshort_schema
,
1198 "version": {"type": "string", "minLength": 1, "maxLength": 12},
1199 "user": nameshort_schema
,
1200 "password": passwd_schema
,
1201 "config": object_schema
,
1203 sdn_controller_schema
= {
1204 "title": "sdn controller information schema",
1205 "$schema": "http://json-schema.org/draft-04/schema#",
1210 "properties": sdn_controller_properties
,
1211 "required": ["name", 'type'],
1212 "additionalProperties": False
1215 "required": ["sdn_controller"],
1216 "additionalProperties": False
1219 sdn_controller_edit_schema
= {
1220 "title": "sdn controller update information schema",
1221 "$schema": "http://json-schema.org/draft-04/schema#",
1226 "properties": sdn_controller_properties
,
1227 "additionalProperties": False
1230 "required": ["sdn_controller"],
1231 "additionalProperties": False
1234 sdn_port_mapping_schema
= {
1235 "$schema": "http://json-schema.org/draft-04/schema#",
1236 "title":"sdn port mapping information schema",
1239 "sdn_port_mapping": {
1244 "compute_node": nameshort_schema
,
1250 "pci": {"OneOf": [null_schema
, pci_extended_schema
]}, # pci_schema,
1251 "switch_port": nameshort_schema
,
1252 "switch_id": nameshort_schema
,
1253 "switch_dpid": nameshort_schema
,
1254 "switch_mac": mac_schema
1260 "required": ["compute_node", "ports"]
1264 "required": ["sdn_port_mapping"]
1267 sdn_external_port_schema
= {
1268 "$schema": "http://json-schema.org/draft-04/schema#",
1269 "title":"External port ingformation",
1272 "port": {"type" : "string", "minLength":1, "maxLength":60},
1273 "vlan": vlan_schema
,
1276 "required": ["port"]