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_file_db": path_schema
,
124 "log_file_vim": path_schema
,
125 "log_file_wim": path_schema
,
126 "log_file_nfvo": path_schema
,
127 "log_file_http": path_schema
,
128 "log_file_console": path_schema
,
129 "log_file_ovim": path_schema
,
130 "log_socket_host": nameshort_schema
,
131 "log_socket_port": port_schema
,
132 "log_file": path_schema
,
134 "required": ['db_user', 'db_passwd', 'db_name'],
135 "additionalProperties": False
139 "title":"tenant information schema",
140 "$schema": "http://json-schema.org/draft-04/schema#",
146 "name": nameshort_schema
,
147 "description": description_schema
,
149 "required": ["name"],
150 "additionalProperties": True
153 "required": ["tenant"],
154 "additionalProperties": False
157 tenant_edit_schema
= {
158 "title":"tenant edit information schema",
159 "$schema": "http://json-schema.org/draft-04/schema#",
166 "description": description_schema
,
168 "additionalProperties": False
171 "required": ["tenant"],
172 "additionalProperties": False
175 datacenter_schema_properties
={
177 "description": description_schema
,
178 "type": nameshort_schema
, #currently "openvim" or "openstack", can be enlarged with plugins
179 "vim_url": description_schema
,
180 "vim_url_admin": description_schema
,
181 "config": { "type":"object" }
184 datacenter_schema
= {
185 "title":"datacenter information schema",
186 "$schema": "http://json-schema.org/draft-04/schema#",
191 "properties":datacenter_schema_properties
,
192 "required": ["name", "vim_url"],
193 "additionalProperties": True
196 "required": ["datacenter"],
197 "additionalProperties": False
201 datacenter_edit_schema
= {
202 "title":"datacenter edit nformation schema",
203 "$schema": "http://json-schema.org/draft-04/schema#",
208 "properties":datacenter_schema_properties
,
209 "additionalProperties": False
212 "required": ["datacenter"],
213 "additionalProperties": False
217 netmap_new_schema
= {
218 "title":"netmap new information schema",
219 "$schema": "http://json-schema.org/draft-04/schema#",
222 "netmap":{ #delete from datacenter
225 "name": name_schema
, #name or uuid of net to change
227 "vim_name": name_schema
230 "additionalProperties": False
233 "required": ["netmap"],
234 "additionalProperties": False
237 netmap_edit_schema
= {
238 "title":"netmap edit information schema",
239 "$schema": "http://json-schema.org/draft-04/schema#",
242 "netmap":{ #delete from datacenter
245 "name": name_schema
, #name or uuid of net to change
248 "additionalProperties": False
251 "required": ["netmap"],
252 "additionalProperties": False
255 datacenter_action_schema
= {
256 "title":"datacenter action information schema",
257 "$schema": "http://json-schema.org/draft-04/schema#",
260 "net-update":{"type":"null",},
264 "net": name_schema
, #name or uuid of net to change
266 "description": description_schema
,
267 "shared": boolean_schema
270 "additionalProperties": False
275 "net": name_schema
, #name or uuid of net to change
278 "additionalProperties": False
283 "additionalProperties": False
287 datacenter_associate_schema
={
288 "title":"datacenter associate information schema",
289 "$schema": "http://json-schema.org/draft-04/schema#",
297 "vim_tenant": name_schema
,
298 "vim_tenant_name": name_schema
,
299 "vim_username": nameshort_schema
,
300 "vim_password": nameshort_schema
,
301 "config": {"type": "object"}
303 # "required": ["vim_tenant"],
304 "additionalProperties": True
307 "required": ["datacenter"],
308 "additionalProperties": False
312 "title": "DHCP schema",
313 "$schema": "http://json-schema.org/draft-04/schema#",
316 "enabled": boolean_schema
,
317 "start-address": {"OneOf": [null_schema
, ip_schema
]},
318 "count": integer0_schema
320 # "required": ["start-address", "count"],
323 ip_profile_schema
= {
324 "title": "IP profile schema",
325 "$schema": "http://json-schema.org/draft-04/schema#",
328 "ip-version": {"type": "string", "enum": ["IPv4", "IPv6"]},
329 "subnet-address": ip_prefix_schema
,
330 "gateway-address": ip_schema
,
331 "dns-address": {"oneOf": [ip_schema
, # for backward compatibility
332 {"type": "array", "items": ip_schema
}]},
338 "title": "Key-pair schema for cloud-init configuration schema",
339 "$schema": "http://json-schema.org/draft-04/schema#",
343 "key": {"type":"string"}
346 "additionalProperties": False
349 cloud_config_user_schema
= {
350 "title": "User schema for cloud-init configuration schema",
351 "$schema": "http://json-schema.org/draft-04/schema#",
354 "name": nameshort_schema
,
355 "user-info": {"type":"string"},
356 #"key-pairs": {"type" : "array", "items": key_pair_schema}
357 "key-pairs": {"type" : "array", "items": {"type":"string"}}
359 "required": ["name"],
360 "additionalProperties": False
363 cloud_config_schema
= {
364 "title": "Cloud-init configuration schema",
365 "$schema": "http://json-schema.org/draft-04/schema#",
368 #"key-pairs": {"type" : "array", "items": key_pair_schema},
369 "key-pairs": {"type" : "array", "items": {"type":"string"}},
370 "users": {"type" : "array", "items": cloud_config_user_schema
}
372 "additionalProperties": False
375 internal_connection_element_schema
= {
379 "local_iface_name": name_schema
383 internal_connection_element_schema_v02
= {
387 "local_iface_name": name_schema
,
388 "ip_address": ip_schema
392 internal_connection_schema
= {
396 "description":description_schema
,
397 "type":{"type":"string", "enum":["bridge","data","ptp"]},
398 "elements": {"type" : "array", "items": internal_connection_element_schema
, "minItems":1}
400 "required": ["name", "type", "elements"],
401 "additionalProperties": False
404 internal_connection_schema_v02
= {
408 "description":description_schema
,
409 "type": {"type": "string", "enum":["e-line", "e-lan"]},
410 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
411 "ip-profile": ip_profile_schema
,
412 "elements": {"type" : "array", "items": internal_connection_element_schema_v02
, "minItems":1}
414 "required": ["name", "type", "implementation", "elements"],
415 "additionalProperties": False
418 external_connection_schema
= {
422 "type":{"type":"string", "enum":["mgmt","bridge","data"]},
424 "local_iface_name": name_schema
,
425 "description":description_schema
427 "required": ["name", "type", "VNFC", "local_iface_name"],
428 "additionalProperties": False
432 external_connection_schema_v02
= {
436 "mgmt": boolean_schema
,
437 "type": {"type": "string", "enum":["e-line", "e-lan"]},
438 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
440 "local_iface_name": name_schema
,
441 "description":description_schema
443 "required": ["name", "type", "VNFC", "local_iface_name"],
444 "additionalProperties": False
453 "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]},
454 "bandwidth":bandwidth_schema
,
456 "mac_address": mac_schema
458 "additionalProperties": False,
459 "required": ["name","dedicated", "bandwidth"]
463 bridge_interfaces_schema
={
469 "bandwidth":bandwidth_schema
,
471 "mac_address": mac_schema
,
472 "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139", "paravirt"]},
473 "port-security": boolean_schema
,
474 "floating-ip": boolean_schema
,
476 "additionalProperties": False,
486 "type":{"type":"string", "enum":["disk","cdrom","xml"] },
487 "image": path_schema
,
488 "image name": name_schema
,
489 "image checksum": checksum_schema
,
490 "image metadata": metadata_schema
,
493 "xml":xml_text_schema
,
496 "additionalProperties": False,
505 "memory":integer1_schema
,
506 "cores":integer1_schema
,
507 "paired-threads":integer1_schema
,
508 "threads":integer1_schema
,
509 "cores-id":{"type":"array","items":integer0_schema
},
510 "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema
}},
511 "threads-id":{"type":"array","items":integer0_schema
},
512 "interfaces":interfaces_schema
514 "additionalProperties": False,
515 #"required": ["memory"]
518 config_files_schema
= {
519 "title": "Config files for cloud init schema",
520 "$schema": "http://json-schema.org/draft-04/schema#",
524 "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]}, #by default text
525 "content": {"type": "string"},
526 "permissions": {"type": "string"}, # tiypically octal notation '0644'
527 "owner": {"type": "string"}, # format: owner:group
530 "additionalProperties": False,
531 "required": ["dest", "content"],
534 boot_data_vdu_schema
= {
535 "title": "Boot data (Cloud-init) configuration schema",
536 "$schema": "http://json-schema.org/draft-04/schema#",
539 "key-pairs": {"type" : "array", "items": {"type":"string"}},
540 "users": {"type" : "array", "items": cloud_config_user_schema
},
541 "user-data": {"type" : "string"}, # scrip to run
542 "config-files": {"type": "array", "items": config_files_schema
},
543 # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data
544 "boot-data-drive": boolean_schema
,
546 "additionalProperties": False,
553 "description": description_schema
,
554 "count": integer1_schema
,
555 "image name": name_schema
,
556 "availability_zone": name_schema
,
557 "VNFC image": {"oneOf": [path_schema
, http_schema
]},
558 "image checksum": checksum_schema
,
559 "image metadata": metadata_schema
,
560 #"cloud-config": cloud_config_schema, #common for all vnfs in the scenario
564 "model":description_schema
,
565 "features":{"type":"array","items":nameshort_schema
}
567 "required": ["model"],
568 "additionalProperties": False
573 "type":nameshort_schema
,
574 "version":description_schema
577 "ram":integer0_schema
,
578 "vcpus":integer0_schema
,
579 "disk": integer1_schema
,
584 "bridge-ifaces": bridge_interfaces_schema
,
585 "devices": devices_schema
,
586 "boot-data" : boot_data_vdu_schema
589 "required": ["name"],
591 {"required": ["VNFC image"]},
592 {"required": ["image name"]}
594 "additionalProperties": False
598 "title":"vnfd information schema v0.1",
599 "$schema": "http://json-schema.org/draft-04/schema#",
606 "description": description_schema
,
608 "class": nameshort_schema
,
609 "public": boolean_schema
,
610 "physical": boolean_schema
,
611 "default_user": name_schema
,
612 "tenant_id": id_schema
, #only valid for admin
613 "external-connections": {"type" : "array", "items": external_connection_schema
, "minItems":1},
614 "internal-connections": {"type" : "array", "items": internal_connection_schema
, "minItems":1},
615 "VNFC":{"type" : "array", "items": vnfc_schema
, "minItems":1}
617 "required": ["name","external-connections"],
618 "additionalProperties": True
622 "additionalProperties": False
625 #VNFD schema for OSM R1
627 "title":"vnfd information schema v0.2",
628 "$schema": "http://json-schema.org/draft-04/schema#",
631 "schema_version": {"type": "string", "enum": ["0.2"]},
636 "description": description_schema
,
637 "class": nameshort_schema
,
638 "public": boolean_schema
,
639 "physical": boolean_schema
,
640 "tenant_id": id_schema
, #only valid for admin
641 "external-connections": {"type" : "array", "items": external_connection_schema
, "minItems":1},
642 "internal-connections": {"type" : "array", "items": internal_connection_schema_v02
, "minItems":1},
643 # "cloud-config": cloud_config_schema, #common for all vnfcs
644 "VNFC":{"type" : "array", "items": vnfc_schema
, "minItems":1}
646 "required": ["name"],
647 "additionalProperties": True
650 "required": ["vnf", "schema_version"],
651 "additionalProperties": False
654 #vnfd_schema = vnfd_schema_v01
656 # "title":"vnfd information schema v0.2",
657 # "$schema": "http://json-schema.org/draft-04/schema#",
658 # "oneOf": [vnfd_schema_v01, vnfd_schema_v02]
662 "title":"graphical scenario descriptor information schema",
663 "$schema": "http://json-schema.org/draft-04/schema#",
666 "x": integer0_schema
,
667 "y": integer0_schema
,
671 "left": {"type":"array"},
672 "right": {"type":"array"},
673 "bottom": {"type":"array"},
677 "required": ["x","y"]
681 "title":"network scenario descriptor information schema v0.1",
682 "$schema": "http://json-schema.org/draft-04/schema#",
686 "description": description_schema
,
687 "tenant_id": id_schema
, #only valid for admin
688 "public": boolean_schema
,
694 "patternProperties":{
698 "type":{"type":"string", "enum":["VNF", "other_network", "network", "external_network"]},
700 "graph": graph_schema
,
702 "patternProperties":{
703 "^(VNF )?model$": {"type": "string"}
711 "patternProperties":{
715 "nodes":{"oneOf":[{"type":"object", "minProperties":2}, {"type":"array", "minLength":1}]},
716 "type": {"type": "string", "enum":["link", "external_network", "dataplane_net", "bridge_net"]},
717 "graph": graph_schema
719 "required": ["nodes"]
724 "required": ["nodes"],
725 "additionalProperties": False
728 "required": ["name","topology"],
729 "additionalProperties": False
733 "title":"network scenario descriptor information schema v0.2",
734 "$schema": "http://json-schema.org/draft-04/schema#",
737 "schema_version": schema_version_2
,
742 "description": description_schema
,
743 "tenant_id": id_schema
, #only valid for admin
744 "public": boolean_schema
,
747 "patternProperties":{
752 "graph": graph_schema
,
753 "vnf_name": name_schema
,
761 "patternProperties":{
765 "interfaces":{"type":"array", "minLength":1},
766 "type": {"type": "string", "enum":["dataplane", "bridge"]},
767 "external" : boolean_schema
,
768 "graph": graph_schema
770 "required": ["interfaces"]
776 "required": ["vnfs", "name"],
777 "additionalProperties": False
780 "required": ["scenario","schema_version"],
781 "additionalProperties": False
784 #NSD schema for OSM R1
786 "title":"network scenario descriptor information schema v0.3",
787 "$schema": "http://json-schema.org/draft-04/schema#",
790 "schema_version": {"type": "string", "enum": ["0.3"]},
795 "description": description_schema
,
796 "tenant_id": id_schema
, #only valid for admin
797 "public": boolean_schema
,
798 "cloud-config": cloud_config_schema
, #common for all vnfs in the scenario
799 #"datacenter": name_schema,
802 "patternProperties":{
807 "graph": graph_schema
,
808 "vnf_name": name_schema
,
809 #"cloud-config": cloud_config_schema, #particular for a vnf
810 #"datacenter": name_schema,
811 "internal-connections": {
813 "patternProperties": {
817 "ip-profile": ip_profile_schema
,
824 "local_iface_name": name_schema
,
825 "ip_address": ip_schema
,
827 "required": ["VNFC", "local_iface_name"],
841 "patternProperties":{
852 "vnf_interface": name_schema
,
853 "ip_address": ip_schema
855 "required": ["vnf", "vnf_interface"],
858 "type": {"type": "string", "enum":["e-line", "e-lan"]},
859 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
860 "external" : boolean_schema
,
861 "graph": graph_schema
,
862 "ip-profile": ip_profile_schema
864 "required": ["interfaces"]
870 "required": ["vnfs", "networks","name"],
871 "additionalProperties": False
874 "required": ["scenario","schema_version"],
875 "additionalProperties": False
878 #scenario_new_schema = {
879 # "title":"new scenario information schema",
880 # "$schema": "http://json-schema.org/draft-04/schema#",
881 # #"oneOf": [nsd_schema_v01, nsd_schema_v02]
882 # "oneOf": [nsd_schema_v01]
885 scenario_edit_schema
= {
886 "title":"edit scenario information schema",
887 "$schema": "http://json-schema.org/draft-04/schema#",
891 "description": description_schema
,
897 "patternProperties":{
898 "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$": {
904 "x": integer0_schema
,
905 "y": integer0_schema
,
906 "ifaces":{ "type": "object"}
909 "description": description_schema
,
916 "required": ["nodes"],
917 "additionalProperties": False
920 "additionalProperties": False
923 scenario_action_schema
= {
924 "title":"scenario action information schema",
925 "$schema": "http://json-schema.org/draft-04/schema#",
931 "instance_name":name_schema
,
932 "description":description_schema
,
933 "datacenter": {"type": "string"}
935 "required": ["instance_name"]
940 "instance_name":name_schema
,
941 "description":description_schema
,
942 "datacenter": {"type": "string"}
944 "required": ["instance_name"]
949 "instance_name":name_schema
,
950 "description":description_schema
,
951 "datacenter": {"type": "string"}
953 "required": ["instance_name"]
958 "instance_name":name_schema
,
959 "description":description_schema
,
960 "datacenter": {"type": "string"}
962 "required": ["instance_name"]
967 "additionalProperties": False
970 instance_scenario_object
= {
971 "title": "scenario object used to create an instance not based on any nsd",
972 "$schema": "http://json-schema.org/draft-04/schema#",
982 "external": boolean_schema
,
983 "type": {"enum": ["bridge", "ptp", "data"]}, # for overlay, underlay E-LINE, underlay E-LAN
985 "additionalProperties": False,
986 "required": ["name", "external", "type"]
990 "additionalProperties": False,
994 instance_scenario_create_schema_v01
= {
995 "title": "instance scenario create information schema v0.1",
996 "$schema": "http://json-schema.org/draft-04/schema#",
999 "schema_version": {"type": "string", "enum": ["0.1"]},
1003 "mgmt_keys": {"type": "array", "items": {"type":"string"}},
1004 "vduImage": name_schema
,
1005 "name": name_schema
,
1006 "description":description_schema
,
1007 "datacenter": name_schema
,
1008 "wim_account": {"oneOf": [boolean_schema
, id_schema
, null_schema
]},
1009 "scenario" : {"oneOff": [name_schema
, instance_scenario_object
]}, # can be an UUID or name or a dict
1010 "action":{"enum": ["deploy","reserve","verify" ]},
1011 "connect_mgmt_interfaces": {"oneOf": [boolean_schema
, {"type":"object"}]},# can be true or a dict with datacenter: net_name
1012 "cloud-config": cloud_config_schema
, #common to all vnfs in the instance scenario
1013 "vnfs":{ #mapping from scenario to datacenter
1015 "patternProperties":{
1019 "name": name_schema
, #override vnf name
1020 "datacenter": name_schema
,
1021 #"metadata": {"type": "object"},
1022 #"user_data": {"type": "string"}
1023 #"cloud-config": cloud_config_schema, #particular for a vnf
1026 "patternProperties": {
1030 "name": name_schema
, # overrides vdu name schema
1031 "mgmt_keys": {"type": "array", "items": {"type": "string"}},
1032 "vduImage": name_schema
,
1035 "patternProperties": {
1037 "vim_id": name_schema
,
1043 "patternProperties": {
1045 "ip_address": ip_schema
,
1046 "mac_address": mac_schema
,
1047 "floating-ip": boolean_schema
,
1057 "patternProperties": {
1061 "vim-network-name": name_schema
,
1062 "vim-network-id": name_schema
,
1063 "ip-profile": ip_profile_schema
,
1064 "name": name_schema
,
1073 "networks":{ #mapping from scenario to datacenter
1075 "patternProperties":{
1085 "ip_address": ip_schema
,
1086 "datacenter": name_schema
,
1087 "vim-network-name": name_schema
,
1088 "vim-network-id": name_schema
1090 "patternProperties":{
1091 ".": {"type": "string"}
1095 "wim_account": {"oneOf": [boolean_schema
, id_schema
, null_schema
]},
1096 "ip-profile": ip_profile_schema
,
1100 "instance_scenario_id": id_schema
,
1101 # "member_vnf_index": name_schema, # if not null, network inside VNF
1102 "osm_id": name_schema
, # sce_network osm_id or name
1104 "additionalProperties": False,
1105 "required": ["instance_scenario_id", "osm_id"]
1107 #if the network connects VNFs deployed at different sites, you must specify one entry per site that this network connect to
1114 # By default for an scenario 'external' network openmano looks for an existing VIM network to map this external scenario network,
1115 # for other networks openamno creates at VIM
1116 # Use netmap-create to force to create an external scenario network
1117 "netmap-create": {"oneOf":[name_schema
,null_schema
]}, #datacenter network to use. Null if must be created as an internal net
1118 #netmap-use: Indicates an existing VIM network that must be used for this scenario network.
1119 #Can use both the VIM network name (if it is not ambiguous) or the VIM net UUID
1120 #If both 'netmap-create' and 'netmap-use'are supplied, netmap-use precedes, but if fails openmano follows the netmap-create
1121 #In oder words, it is the same as 'try to map to the VIM network (netmap-use) if exist, and if not create the network (netmap-create)
1122 "netmap-use": name_schema
, #
1123 "vim-network-name": name_schema
, #override network name
1124 "vim-network-id": name_schema
,
1125 #"ip-profile": ip_profile_schema,
1126 "datacenter": name_schema
,
1135 "additionalProperties": False,
1136 "required": ["name"]
1139 "required": ["instance"],
1140 "additionalProperties": False
1143 instance_scenario_action_schema
= {
1144 "title": "instance scenario action information schema",
1145 "$schema": "http://json-schema.org/draft-04/schema#",
1148 "start": null_schema
,
1149 "pause": null_schema
,
1150 "resume": null_schema
,
1151 "shutoff": null_schema
,
1152 "shutdown": null_schema
,
1153 "forceOff": null_schema
,
1154 "rebuild": null_schema
,
1156 "type": ["object", "null"],
1158 "add_public_key": description_schema
,
1159 "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]},
1165 "vdu-id": id_schema
,
1166 "osm_vdu_id": name_schema
,
1167 "member-vnf-index": name_schema
,
1168 "count": integer1_schema
,
1169 "type": {"enum": ["create", "delete"]}
1171 "additionalProperties": False,
1173 "required": ["type"]
1176 "vnfs": {"type": "array", "items": {"type": "string"}},
1177 "vms": {"type": "array", "items": {"type": "string"}}
1180 #"maxProperties": 1,
1181 "additionalProperties": False
1184 sdn_controller_properties
={
1185 "name": name_schema
,
1186 "dpid": {"type":"string", "pattern":"^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"},
1188 "port": port_schema
,
1189 "type": {"type": "string", "enum": ["opendaylight","floodlight","onos"]},
1190 "version": {"type" : "string", "minLength":1, "maxLength":12},
1191 "user": nameshort_schema
,
1192 "password": passwd_schema
1194 sdn_controller_schema
= {
1195 "title":"sdn controller information schema",
1196 "$schema": "http://json-schema.org/draft-04/schema#",
1201 "properties":sdn_controller_properties
,
1202 "required": ["name", "port", 'ip', 'dpid', 'type'],
1203 "additionalProperties": False
1206 "required": ["sdn_controller"],
1207 "additionalProperties": False
1210 sdn_controller_edit_schema
= {
1211 "title":"sdn controller update information schema",
1212 "$schema": "http://json-schema.org/draft-04/schema#",
1217 "properties":sdn_controller_properties
,
1218 "additionalProperties": False
1221 "required": ["sdn_controller"],
1222 "additionalProperties": False
1225 sdn_port_mapping_schema
= {
1226 "$schema": "http://json-schema.org/draft-04/schema#",
1227 "title":"sdn port mapping information schema",
1230 "sdn_port_mapping": {
1235 "compute_node": nameshort_schema
,
1241 "pci": {"OneOf": [null_schema
, pci_extended_schema
]}, # pci_schema,
1242 "switch_port": nameshort_schema
,
1243 "switch_mac": mac_schema
1249 "required": ["compute_node", "ports"]
1253 "required": ["sdn_port_mapping"]
1256 sdn_external_port_schema
= {
1257 "$schema": "http://json-schema.org/draft-04/schema#",
1258 "title":"External port ingformation",
1261 "port": {"type" : "string", "minLength":1, "maxLength":60},
1262 "vlan": vlan_schema
,
1265 "required": ["port"]