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 string_list
= {"type": "array", "items": {"type": "string"}}
60 log_level_schema
={"type":"string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]}
61 checksum_schema
={"type":"string", "pattern":"^[0-9a-fA-F]{32}$"}
62 size_schema
={"type":"integer","minimum":1,"maximum":100}
63 boolean_schema
= {"type": "boolean"}
64 null_schema
= {"type": "null"}
69 "architecture": {"type":"string"},
70 "use_incremental": {"type":"string","enum":["yes","no"]},
72 "os_distro": {"type":"string"},
73 "os_type": {"type":"string"},
74 "os_version": {"type":"string"},
75 "bus": {"type":"string"},
76 "topology": {"type":"string", "enum": ["oneSocket"]}
80 #Schema for the configuration file
82 "title":"configuration response information schema",
83 "$schema": "http://json-schema.org/draft-04/schema#",
86 "http_port": port_schema
,
87 "http_admin_port": port_schema
,
88 "http_host": nameshort_schema
,
89 "auto_push_VNF_to_VIMs": boolean_schema
,
90 "vnf_repository": path_schema
,
91 "db_host": nameshort_schema
,
92 "db_user": nameshort_schema
,
93 "db_passwd": {"type":"string"},
94 "db_name": nameshort_schema
,
95 "db_ovim_host": nameshort_schema
,
96 "db_ovim_user": nameshort_schema
,
97 "db_ovim_passwd": {"type":"string"},
98 "db_ovim_name": nameshort_schema
,
99 # Next fields will disappear once the MANO API includes appropriate primitives
100 "vim_url": http_schema
,
101 "vim_url_admin": http_schema
,
102 "vim_name": nameshort_schema
,
103 "vim_tenant_name": nameshort_schema
,
104 "mano_tenant_name": nameshort_schema
,
105 "mano_tenant_id": id_schema
,
106 "http_console_proxy": boolean_schema
,
107 "http_console_host": nameshort_schema
,
108 "http_console_ports": {
112 {"type": "object", "properties": {"from": port_schema
, "to": port_schema
}, "required": ["from", "to"]}
115 "log_level": log_level_schema
,
116 "log_socket_level": log_level_schema
,
117 "log_level_db": log_level_schema
,
118 "log_level_vim": log_level_schema
,
119 "log_level_wim": log_level_schema
,
120 "log_level_nfvo": log_level_schema
,
121 "log_level_http": log_level_schema
,
122 "log_level_console": log_level_schema
,
123 "log_level_ovim": log_level_schema
,
124 "log_level_sdn": log_level_schema
,
125 "log_level_sdnconn": log_level_schema
,
126 "log_file_db": path_schema
,
127 "log_file_vim": path_schema
,
128 "log_file_wim": path_schema
,
129 "log_file_nfvo": path_schema
,
130 "log_file_http": path_schema
,
131 "log_file_console": path_schema
,
132 "log_file_ovim": path_schema
,
133 "log_file_sdn": path_schema
,
134 "log_file_sdnconn": path_schema
,
135 "log_socket_host": nameshort_schema
,
136 "log_socket_port": port_schema
,
137 "log_file": path_schema
,
139 "required": ['db_user', 'db_passwd', 'db_name'],
140 "additionalProperties": False
144 "title":"tenant information schema",
145 "$schema": "http://json-schema.org/draft-04/schema#",
151 "name": nameshort_schema
,
152 "description": description_schema
,
154 "required": ["name"],
155 "additionalProperties": True
158 "required": ["tenant"],
159 "additionalProperties": False
162 tenant_edit_schema
= {
163 "title":"tenant edit information schema",
164 "$schema": "http://json-schema.org/draft-04/schema#",
171 "description": description_schema
,
173 "additionalProperties": False
176 "required": ["tenant"],
177 "additionalProperties": False
180 datacenter_schema_properties
={
182 "description": description_schema
,
183 "type": nameshort_schema
, #currently "openvim" or "openstack", can be enlarged with plugins
184 "vim_url": description_schema
,
185 "vim_url_admin": description_schema
,
186 "config": { "type":"object" }
189 datacenter_schema
= {
190 "title":"datacenter information schema",
191 "$schema": "http://json-schema.org/draft-04/schema#",
196 "properties":datacenter_schema_properties
,
197 "required": ["name", "vim_url"],
198 "additionalProperties": True
201 "required": ["datacenter"],
202 "additionalProperties": False
206 datacenter_edit_schema
= {
207 "title":"datacenter edit nformation schema",
208 "$schema": "http://json-schema.org/draft-04/schema#",
213 "properties":datacenter_schema_properties
,
214 "additionalProperties": False
217 "required": ["datacenter"],
218 "additionalProperties": False
222 netmap_new_schema
= {
223 "title":"netmap new information schema",
224 "$schema": "http://json-schema.org/draft-04/schema#",
227 "netmap":{ #delete from datacenter
230 "name": name_schema
, #name or uuid of net to change
232 "vim_name": name_schema
235 "additionalProperties": False
238 "required": ["netmap"],
239 "additionalProperties": False
242 netmap_edit_schema
= {
243 "title":"netmap edit information schema",
244 "$schema": "http://json-schema.org/draft-04/schema#",
247 "netmap":{ #delete from datacenter
250 "name": name_schema
, #name or uuid of net to change
253 "additionalProperties": False
256 "required": ["netmap"],
257 "additionalProperties": False
260 datacenter_action_schema
= {
261 "title":"datacenter action information schema",
262 "$schema": "http://json-schema.org/draft-04/schema#",
265 "check-connectivity": {"type": "null"},
266 "net-update": {"type": "null"},
270 "net": name_schema
, #name or uuid of net to change
272 "description": description_schema
,
273 "shared": boolean_schema
276 "additionalProperties": False
281 "net": name_schema
, #name or uuid of net to change
284 "additionalProperties": False
289 "additionalProperties": False
293 datacenter_associate_schema
={
294 "title":"datacenter associate information schema",
295 "$schema": "http://json-schema.org/draft-04/schema#",
303 "vim_tenant": name_schema
,
304 "vim_tenant_name": name_schema
,
305 "vim_username": nameshort_schema
,
306 "vim_password": nameshort_schema
,
307 "config": {"type": "object"}
309 # "required": ["vim_tenant"],
310 "additionalProperties": True
313 "required": ["datacenter"],
314 "additionalProperties": False
318 "title": "DHCP schema",
319 "$schema": "http://json-schema.org/draft-04/schema#",
322 "enabled": boolean_schema
,
323 "start-address": {"oneOf": [null_schema
, ip_schema
]},
324 "count": integer0_schema
326 # "required": ["start-address", "count"],
329 ip_profile_schema
= {
330 "title": "IP profile schema",
331 "$schema": "http://json-schema.org/draft-04/schema#",
334 "ip-version": {"type": "string", "enum": ["IPv4", "IPv6"]},
335 "subnet-address": ip_prefix_schema
,
336 "gateway-address": ip_schema
,
337 "dns-address": {"oneOf": [ip_schema
, # for backward compatibility
338 {"type": "array", "items": ip_schema
}]},
344 "title": "Key-pair schema for cloud-init configuration schema",
345 "$schema": "http://json-schema.org/draft-04/schema#",
349 "key": {"type":"string"}
352 "additionalProperties": False
355 cloud_config_user_schema
= {
356 "title": "User schema for cloud-init configuration schema",
357 "$schema": "http://json-schema.org/draft-04/schema#",
360 "name": nameshort_schema
,
361 "user-info": {"type":"string"},
362 #"key-pairs": {"type" : "array", "items": key_pair_schema}
363 "key-pairs": {"type" : "array", "items": {"type":"string"}}
365 "required": ["name"],
366 "additionalProperties": False
369 cloud_config_schema
= {
370 "title": "Cloud-init configuration schema",
371 "$schema": "http://json-schema.org/draft-04/schema#",
374 #"key-pairs": {"type" : "array", "items": key_pair_schema},
375 "key-pairs": {"type" : "array", "items": {"type":"string"}},
376 "users": {"type" : "array", "items": cloud_config_user_schema
}
378 "additionalProperties": False
381 internal_connection_element_schema
= {
385 "local_iface_name": name_schema
389 internal_connection_element_schema_v02
= {
393 "local_iface_name": name_schema
,
394 "ip_address": ip_schema
398 internal_connection_schema
= {
402 "description":description_schema
,
403 "type":{"type":"string", "enum":["bridge","data","ptp"]},
404 "elements": {"type" : "array", "items": internal_connection_element_schema
, "minItems":1}
406 "required": ["name", "type", "elements"],
407 "additionalProperties": False
410 internal_connection_schema_v02
= {
414 "description":description_schema
,
415 "type": {"type": "string", "enum":["e-line", "e-lan"]},
416 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
417 "ip-profile": ip_profile_schema
,
418 "elements": {"type" : "array", "items": internal_connection_element_schema_v02
, "minItems":1}
420 "required": ["name", "type", "implementation", "elements"],
421 "additionalProperties": False
424 external_connection_schema
= {
428 "type":{"type":"string", "enum":["mgmt","bridge","data"]},
430 "local_iface_name": name_schema
,
431 "description":description_schema
433 "required": ["name", "type", "VNFC", "local_iface_name"],
434 "additionalProperties": False
438 external_connection_schema_v02
= {
442 "mgmt": boolean_schema
,
443 "type": {"type": "string", "enum":["e-line", "e-lan"]},
444 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
446 "local_iface_name": name_schema
,
447 "description":description_schema
449 "required": ["name", "type", "VNFC", "local_iface_name"],
450 "additionalProperties": False
459 "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]},
460 "bandwidth":bandwidth_schema
,
462 "mac_address": mac_schema
464 "additionalProperties": False,
465 "required": ["name","dedicated", "bandwidth"]
469 bridge_interfaces_schema
={
475 "bandwidth":bandwidth_schema
,
477 "mac_address": mac_schema
,
478 "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139", "paravirt"]},
479 "port-security": boolean_schema
,
480 "floating-ip": boolean_schema
,
482 "additionalProperties": False,
492 "type":{"type":"string", "enum":["disk","cdrom","xml"] },
493 "image": path_schema
,
494 "image name": name_schema
,
495 "image checksum": checksum_schema
,
496 "image metadata": metadata_schema
,
499 "xml":xml_text_schema
,
502 "additionalProperties": False,
511 "memory":integer1_schema
,
512 "cores":integer1_schema
,
513 "paired-threads":integer1_schema
,
514 "threads":integer1_schema
,
515 "cores-id":{"type":"array","items":integer0_schema
},
516 "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema
}},
517 "threads-id":{"type":"array","items":integer0_schema
},
518 "interfaces":interfaces_schema
520 "additionalProperties": False,
521 #"required": ["memory"]
524 config_files_schema
= {
525 "title": "Config files for cloud init schema",
526 "$schema": "http://json-schema.org/draft-04/schema#",
530 "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]}, #by default text
531 "content": {"type": "string"},
532 "permissions": {"type": "string"}, # tiypically octal notation '0644'
533 "owner": {"type": "string"}, # format: owner:group
536 "additionalProperties": False,
537 "required": ["dest", "content"],
540 boot_data_vdu_schema
= {
541 "title": "Boot data (Cloud-init) configuration schema",
542 "$schema": "http://json-schema.org/draft-04/schema#",
545 "key-pairs": {"type" : "array", "items": {"type":"string"}},
546 "users": {"type" : "array", "items": cloud_config_user_schema
},
547 "user-data": {"type" : "string"}, # scrip to run
548 "config-files": {"type": "array", "items": config_files_schema
},
549 # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data
550 "boot-data-drive": boolean_schema
,
552 "additionalProperties": False,
559 "description": description_schema
,
560 "count": integer1_schema
,
561 "image name": name_schema
,
562 "availability_zone": name_schema
,
563 "VNFC image": {"oneOf": [path_schema
, http_schema
]},
564 "image checksum": checksum_schema
,
565 "image metadata": metadata_schema
,
566 #"cloud-config": cloud_config_schema, #common for all vnfs in the scenario
570 "model":description_schema
,
571 "features":{"type":"array","items":nameshort_schema
}
573 "required": ["model"],
574 "additionalProperties": False
579 "type":nameshort_schema
,
580 "version":description_schema
583 "ram":integer0_schema
,
584 "vcpus":integer0_schema
,
585 "disk": integer1_schema
,
590 "bridge-ifaces": bridge_interfaces_schema
,
591 "devices": devices_schema
,
592 "boot-data" : boot_data_vdu_schema
595 "required": ["name"],
597 {"required": ["VNFC image"]},
598 {"required": ["image name"]}
600 "additionalProperties": False
604 "title":"vnfd information schema v0.1",
605 "$schema": "http://json-schema.org/draft-04/schema#",
612 "description": description_schema
,
614 "class": nameshort_schema
,
615 "public": boolean_schema
,
616 "physical": boolean_schema
,
617 "default_user": name_schema
,
618 "tenant_id": id_schema
, #only valid for admin
619 "external-connections": {"type" : "array", "items": external_connection_schema
, "minItems":1},
620 "internal-connections": {"type" : "array", "items": internal_connection_schema
, "minItems":1},
621 "VNFC":{"type" : "array", "items": vnfc_schema
, "minItems":1}
623 "required": ["name","external-connections"],
624 "additionalProperties": True
628 "additionalProperties": False
631 #VNFD schema for OSM R1
633 "title":"vnfd information schema v0.2",
634 "$schema": "http://json-schema.org/draft-04/schema#",
637 "schema_version": {"type": "string", "enum": ["0.2"]},
642 "description": description_schema
,
643 "class": nameshort_schema
,
644 "public": boolean_schema
,
645 "physical": boolean_schema
,
646 "tenant_id": id_schema
, #only valid for admin
647 "external-connections": {"type" : "array", "items": external_connection_schema
, "minItems":1},
648 "internal-connections": {"type" : "array", "items": internal_connection_schema_v02
, "minItems":1},
649 # "cloud-config": cloud_config_schema, #common for all vnfcs
650 "VNFC":{"type" : "array", "items": vnfc_schema
, "minItems":1}
652 "required": ["name"],
653 "additionalProperties": True
656 "required": ["vnf", "schema_version"],
657 "additionalProperties": False
660 #vnfd_schema = vnfd_schema_v01
662 # "title":"vnfd information schema v0.2",
663 # "$schema": "http://json-schema.org/draft-04/schema#",
664 # "oneOf": [vnfd_schema_v01, vnfd_schema_v02]
668 "title":"graphical scenario descriptor information schema",
669 "$schema": "http://json-schema.org/draft-04/schema#",
672 "x": integer0_schema
,
673 "y": integer0_schema
,
677 "left": {"type":"array"},
678 "right": {"type":"array"},
679 "bottom": {"type":"array"},
683 "required": ["x","y"]
687 "title":"network scenario descriptor information schema v0.1",
688 "$schema": "http://json-schema.org/draft-04/schema#",
692 "description": description_schema
,
693 "tenant_id": id_schema
, #only valid for admin
694 "public": boolean_schema
,
700 "patternProperties":{
704 "type":{"type":"string", "enum":["VNF", "other_network", "network", "external_network"]},
706 "graph": graph_schema
,
708 "patternProperties":{
709 "^(VNF )?model$": {"type": "string"}
717 "patternProperties":{
721 "nodes":{"oneOf":[{"type":"object", "minProperties":2}, {"type":"array", "minLength":1}]},
722 "type": {"type": "string", "enum":["link", "external_network", "dataplane_net", "bridge_net"]},
723 "graph": graph_schema
725 "required": ["nodes"]
730 "required": ["nodes"],
731 "additionalProperties": False
734 "required": ["name","topology"],
735 "additionalProperties": False
739 "title":"network scenario descriptor information schema v0.2",
740 "$schema": "http://json-schema.org/draft-04/schema#",
743 "schema_version": schema_version_2
,
748 "description": description_schema
,
749 "tenant_id": id_schema
, #only valid for admin
750 "public": boolean_schema
,
753 "patternProperties":{
758 "graph": graph_schema
,
759 "vnf_name": name_schema
,
767 "patternProperties":{
771 "interfaces":{"type":"array", "minLength":1},
772 "type": {"type": "string", "enum":["dataplane", "bridge"]},
773 "external" : boolean_schema
,
774 "graph": graph_schema
776 "required": ["interfaces"]
782 "required": ["vnfs", "name"],
783 "additionalProperties": False
786 "required": ["scenario","schema_version"],
787 "additionalProperties": False
790 #NSD schema for OSM R1
792 "title":"network scenario descriptor information schema v0.3",
793 "$schema": "http://json-schema.org/draft-04/schema#",
796 "schema_version": {"type": "string", "enum": ["0.3"]},
801 "description": description_schema
,
802 "tenant_id": id_schema
, #only valid for admin
803 "public": boolean_schema
,
804 "cloud-config": cloud_config_schema
, #common for all vnfs in the scenario
805 #"datacenter": name_schema,
808 "patternProperties":{
813 "graph": graph_schema
,
814 "vnf_name": name_schema
,
815 #"cloud-config": cloud_config_schema, #particular for a vnf
816 #"datacenter": name_schema,
817 "internal-connections": {
819 "patternProperties": {
823 "ip-profile": ip_profile_schema
,
830 "local_iface_name": name_schema
,
831 "ip_address": ip_schema
,
833 "required": ["VNFC", "local_iface_name"],
847 "patternProperties":{
858 "vnf_interface": name_schema
,
859 "ip_address": ip_schema
861 "required": ["vnf", "vnf_interface"],
864 "type": {"type": "string", "enum":["e-line", "e-lan"]},
865 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
866 "external" : boolean_schema
,
867 "graph": graph_schema
,
868 "ip-profile": ip_profile_schema
870 "required": ["interfaces"]
876 "required": ["vnfs", "networks","name"],
877 "additionalProperties": False
880 "required": ["scenario","schema_version"],
881 "additionalProperties": False
884 #scenario_new_schema = {
885 # "title":"new scenario information schema",
886 # "$schema": "http://json-schema.org/draft-04/schema#",
887 # #"oneOf": [nsd_schema_v01, nsd_schema_v02]
888 # "oneOf": [nsd_schema_v01]
891 scenario_edit_schema
= {
892 "title":"edit scenario information schema",
893 "$schema": "http://json-schema.org/draft-04/schema#",
897 "description": description_schema
,
903 "patternProperties":{
904 "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$": {
910 "x": integer0_schema
,
911 "y": integer0_schema
,
912 "ifaces":{ "type": "object"}
915 "description": description_schema
,
922 "required": ["nodes"],
923 "additionalProperties": False
926 "additionalProperties": False
929 scenario_action_schema
= {
930 "title":"scenario action information schema",
931 "$schema": "http://json-schema.org/draft-04/schema#",
937 "instance_name":name_schema
,
938 "description":description_schema
,
939 "datacenter": {"type": "string"}
941 "required": ["instance_name"]
946 "instance_name":name_schema
,
947 "description":description_schema
,
948 "datacenter": {"type": "string"}
950 "required": ["instance_name"]
955 "instance_name":name_schema
,
956 "description":description_schema
,
957 "datacenter": {"type": "string"}
959 "required": ["instance_name"]
964 "instance_name":name_schema
,
965 "description":description_schema
,
966 "datacenter": {"type": "string"}
968 "required": ["instance_name"]
973 "additionalProperties": False
976 instance_scenario_object
= {
977 "title": "scenario object used to create an instance not based on any nsd",
978 "$schema": "http://json-schema.org/draft-04/schema#",
988 "external": boolean_schema
,
989 "type": {"enum": ["bridge", "ptp", "data"]}, # for overlay, underlay E-LINE, underlay E-LAN
991 "additionalProperties": False,
992 "required": ["name", "external", "type"]
996 "additionalProperties": False,
1000 instance_scenario_create_schema_v01
= {
1001 "title": "instance scenario create information schema v0.1",
1002 "$schema": "http://json-schema.org/draft-04/schema#",
1005 "schema_version": {"type": "string", "enum": ["0.1"]},
1009 "mgmt_keys": {"type": "array", "items": {"type":"string"}},
1010 "vduImage": name_schema
,
1011 "name": name_schema
,
1012 "description":description_schema
,
1013 "datacenter": name_schema
,
1014 "wim_account": {"oneOf": [boolean_schema
, id_schema
, null_schema
]},
1015 "scenario" : {"oneOff": [name_schema
, instance_scenario_object
]}, # can be an UUID or name or a dict
1016 "action":{"enum": ["deploy","reserve","verify" ]},
1017 "connect_mgmt_interfaces": {"oneOf": [boolean_schema
, {"type":"object"}]},# can be true or a dict with datacenter: net_name
1018 "cloud-config": cloud_config_schema
, #common to all vnfs in the instance scenario
1019 "vnfs":{ #mapping from scenario to datacenter
1021 "patternProperties":{
1025 "name": name_schema
, #override vnf name
1026 "datacenter": name_schema
,
1027 #"metadata": {"type": "object"},
1028 #"user_data": {"type": "string"}
1029 #"cloud-config": cloud_config_schema, #particular for a vnf
1032 "patternProperties": {
1036 "name": name_schema
, # overrides vdu name schema
1037 "mgmt_keys": string_list
,
1038 "vduImage": name_schema
,
1039 "cloud_init": string_list
,
1042 "patternProperties": {
1044 "vim_id": name_schema
,
1050 "patternProperties": {
1052 "ip_address": ip_schema
,
1053 "mac_address": mac_schema
,
1054 "floating-ip": boolean_schema
,
1064 "patternProperties": {
1068 "vim-network-name": name_schema
,
1069 "vim-network-id": name_schema
,
1070 "ip-profile": ip_profile_schema
,
1071 "name": name_schema
,
1080 "networks":{ #mapping from scenario to datacenter
1082 "patternProperties":{
1092 "ip_address": ip_schema
,
1093 "datacenter": name_schema
,
1094 "vim-network-name": name_schema
,
1095 "vim-network-id": name_schema
1097 "patternProperties":{
1098 ".": {"type": "string"}
1102 "wim_account": {"oneOf": [boolean_schema
, id_schema
, null_schema
]},
1103 "ip-profile": ip_profile_schema
,
1107 "instance_scenario_id": id_schema
,
1108 # "member_vnf_index": name_schema, # if not null, network inside VNF
1109 "osm_id": name_schema
, # sce_network osm_id or name
1111 "additionalProperties": False,
1112 "required": ["instance_scenario_id", "osm_id"]
1114 #if the network connects VNFs deployed at different sites, you must specify one entry per site that this network connect to
1121 # By default for an scenario 'external' network openmano looks for an existing VIM network to map this external scenario network,
1122 # for other networks openamno creates at VIM
1123 # Use netmap-create to force to create an external scenario network
1124 "netmap-create": {"oneOf":[name_schema
,null_schema
]}, #datacenter network to use. Null if must be created as an internal net
1125 #netmap-use: Indicates an existing VIM network that must be used for this scenario network.
1126 #Can use both the VIM network name (if it is not ambiguous) or the VIM net UUID
1127 #If both 'netmap-create' and 'netmap-use'are supplied, netmap-use precedes, but if fails openmano follows the netmap-create
1128 #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)
1129 "netmap-use": name_schema
, #
1130 "vim-network-name": name_schema
, #override network name
1131 "vim-network-id": name_schema
,
1132 #"ip-profile": ip_profile_schema,
1133 "datacenter": name_schema
,
1142 "additionalProperties": False,
1143 "required": ["name"]
1146 "required": ["instance"],
1147 "additionalProperties": False
1150 instance_scenario_action_schema
= {
1151 "title": "instance scenario action information schema",
1152 "$schema": "http://json-schema.org/draft-04/schema#",
1155 "start": null_schema
,
1156 "pause": null_schema
,
1157 "resume": null_schema
,
1158 "shutoff": null_schema
,
1159 "shutdown": null_schema
,
1160 "forceOff": null_schema
,
1161 "rebuild": null_schema
,
1163 "type": ["object", "null"],
1165 "add_public_key": {"type" : "string"},
1166 "user": nameshort_schema
,
1167 "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]},
1173 "vdu-id": id_schema
,
1174 "osm_vdu_id": name_schema
,
1175 "member-vnf-index": name_schema
,
1176 "count": integer1_schema
,
1177 "type": {"enum": ["create", "delete"]},
1178 "cloud_init": string_list
,
1180 "additionalProperties": False,
1182 "required": ["type"]
1185 "vnfs": {"type": "array", "items": {"type": "string"}},
1186 "vms": {"type": "array", "items": {"type": "string"}}
1189 #"maxProperties": 1,
1190 "additionalProperties": False
1193 sdn_controller_properties
={
1194 "name": name_schema
,
1195 "dpid": {"type": "string", "pattern": "^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"},
1196 "description": name_schema
,
1198 "port": port_schema
,
1199 "type": nameshort_schema
,
1201 "version": {"type": "string", "minLength": 1, "maxLength": 12},
1202 "user": nameshort_schema
,
1203 "password": passwd_schema
,
1204 "config": object_schema
,
1206 sdn_controller_schema
= {
1207 "title": "sdn controller information schema",
1208 "$schema": "http://json-schema.org/draft-04/schema#",
1213 "properties": sdn_controller_properties
,
1214 "required": ["name", 'type'],
1215 "additionalProperties": False
1218 "required": ["sdn_controller"],
1219 "additionalProperties": False
1222 sdn_controller_edit_schema
= {
1223 "title": "sdn controller update information schema",
1224 "$schema": "http://json-schema.org/draft-04/schema#",
1229 "properties": sdn_controller_properties
,
1230 "additionalProperties": False
1233 "required": ["sdn_controller"],
1234 "additionalProperties": False
1237 sdn_port_mapping_schema
= {
1238 "$schema": "http://json-schema.org/draft-04/schema#",
1239 "title":"sdn port mapping information schema",
1242 "sdn_port_mapping": {
1247 "compute_node": nameshort_schema
,
1253 "pci": {"oneOf": [null_schema
, pci_extended_schema
]}, # pci_schema,
1254 "switch_port": nameshort_schema
,
1255 "switch_id": nameshort_schema
,
1256 "switch_dpid": nameshort_schema
,
1257 "switch_mac": mac_schema
1263 "required": ["compute_node", "ports"]
1267 "required": ["sdn_port_mapping"]
1270 sdn_external_port_schema
= {
1271 "$schema": "http://json-schema.org/draft-04/schema#",
1272 "title":"External port ingformation",
1275 "port": {"type" : "string", "minLength":1, "maxLength":60},
1276 "vlan": vlan_schema
,
1279 "required": ["port"]