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_file_db": path_schema
,
125 "log_file_vim": path_schema
,
126 "log_file_wim": path_schema
,
127 "log_file_nfvo": path_schema
,
128 "log_file_http": path_schema
,
129 "log_file_console": path_schema
,
130 "log_file_ovim": path_schema
,
131 "log_file_sdn": path_schema
,
132 "log_socket_host": nameshort_schema
,
133 "log_socket_port": port_schema
,
134 "log_file": path_schema
,
136 "required": ['db_user', 'db_passwd', 'db_name'],
137 "additionalProperties": False
141 "title":"tenant information schema",
142 "$schema": "http://json-schema.org/draft-04/schema#",
148 "name": nameshort_schema
,
149 "description": description_schema
,
151 "required": ["name"],
152 "additionalProperties": True
155 "required": ["tenant"],
156 "additionalProperties": False
159 tenant_edit_schema
= {
160 "title":"tenant edit information schema",
161 "$schema": "http://json-schema.org/draft-04/schema#",
168 "description": description_schema
,
170 "additionalProperties": False
173 "required": ["tenant"],
174 "additionalProperties": False
177 datacenter_schema_properties
={
179 "description": description_schema
,
180 "type": nameshort_schema
, #currently "openvim" or "openstack", can be enlarged with plugins
181 "vim_url": description_schema
,
182 "vim_url_admin": description_schema
,
183 "config": { "type":"object" }
186 datacenter_schema
= {
187 "title":"datacenter information schema",
188 "$schema": "http://json-schema.org/draft-04/schema#",
193 "properties":datacenter_schema_properties
,
194 "required": ["name", "vim_url"],
195 "additionalProperties": True
198 "required": ["datacenter"],
199 "additionalProperties": False
203 datacenter_edit_schema
= {
204 "title":"datacenter edit nformation schema",
205 "$schema": "http://json-schema.org/draft-04/schema#",
210 "properties":datacenter_schema_properties
,
211 "additionalProperties": False
214 "required": ["datacenter"],
215 "additionalProperties": False
219 netmap_new_schema
= {
220 "title":"netmap new information schema",
221 "$schema": "http://json-schema.org/draft-04/schema#",
224 "netmap":{ #delete from datacenter
227 "name": name_schema
, #name or uuid of net to change
229 "vim_name": name_schema
232 "additionalProperties": False
235 "required": ["netmap"],
236 "additionalProperties": False
239 netmap_edit_schema
= {
240 "title":"netmap edit information schema",
241 "$schema": "http://json-schema.org/draft-04/schema#",
244 "netmap":{ #delete from datacenter
247 "name": name_schema
, #name or uuid of net to change
250 "additionalProperties": False
253 "required": ["netmap"],
254 "additionalProperties": False
257 datacenter_action_schema
= {
258 "title":"datacenter action information schema",
259 "$schema": "http://json-schema.org/draft-04/schema#",
262 "check-connectivity": {"type": "null"},
263 "net-update": {"type": "null"},
267 "net": name_schema
, #name or uuid of net to change
269 "description": description_schema
,
270 "shared": boolean_schema
273 "additionalProperties": False
278 "net": name_schema
, #name or uuid of net to change
281 "additionalProperties": False
286 "additionalProperties": False
290 datacenter_associate_schema
={
291 "title":"datacenter associate information schema",
292 "$schema": "http://json-schema.org/draft-04/schema#",
300 "vim_tenant": name_schema
,
301 "vim_tenant_name": name_schema
,
302 "vim_username": nameshort_schema
,
303 "vim_password": nameshort_schema
,
304 "config": {"type": "object"}
306 # "required": ["vim_tenant"],
307 "additionalProperties": True
310 "required": ["datacenter"],
311 "additionalProperties": False
315 "title": "DHCP schema",
316 "$schema": "http://json-schema.org/draft-04/schema#",
319 "enabled": boolean_schema
,
320 "start-address": {"OneOf": [null_schema
, ip_schema
]},
321 "count": integer0_schema
323 # "required": ["start-address", "count"],
326 ip_profile_schema
= {
327 "title": "IP profile schema",
328 "$schema": "http://json-schema.org/draft-04/schema#",
331 "ip-version": {"type": "string", "enum": ["IPv4", "IPv6"]},
332 "subnet-address": ip_prefix_schema
,
333 "gateway-address": ip_schema
,
334 "dns-address": {"oneOf": [ip_schema
, # for backward compatibility
335 {"type": "array", "items": ip_schema
}]},
341 "title": "Key-pair schema for cloud-init configuration schema",
342 "$schema": "http://json-schema.org/draft-04/schema#",
346 "key": {"type":"string"}
349 "additionalProperties": False
352 cloud_config_user_schema
= {
353 "title": "User schema for cloud-init configuration schema",
354 "$schema": "http://json-schema.org/draft-04/schema#",
357 "name": nameshort_schema
,
358 "user-info": {"type":"string"},
359 #"key-pairs": {"type" : "array", "items": key_pair_schema}
360 "key-pairs": {"type" : "array", "items": {"type":"string"}}
362 "required": ["name"],
363 "additionalProperties": False
366 cloud_config_schema
= {
367 "title": "Cloud-init configuration schema",
368 "$schema": "http://json-schema.org/draft-04/schema#",
371 #"key-pairs": {"type" : "array", "items": key_pair_schema},
372 "key-pairs": {"type" : "array", "items": {"type":"string"}},
373 "users": {"type" : "array", "items": cloud_config_user_schema
}
375 "additionalProperties": False
378 internal_connection_element_schema
= {
382 "local_iface_name": name_schema
386 internal_connection_element_schema_v02
= {
390 "local_iface_name": name_schema
,
391 "ip_address": ip_schema
395 internal_connection_schema
= {
399 "description":description_schema
,
400 "type":{"type":"string", "enum":["bridge","data","ptp"]},
401 "elements": {"type" : "array", "items": internal_connection_element_schema
, "minItems":1}
403 "required": ["name", "type", "elements"],
404 "additionalProperties": False
407 internal_connection_schema_v02
= {
411 "description":description_schema
,
412 "type": {"type": "string", "enum":["e-line", "e-lan"]},
413 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
414 "ip-profile": ip_profile_schema
,
415 "elements": {"type" : "array", "items": internal_connection_element_schema_v02
, "minItems":1}
417 "required": ["name", "type", "implementation", "elements"],
418 "additionalProperties": False
421 external_connection_schema
= {
425 "type":{"type":"string", "enum":["mgmt","bridge","data"]},
427 "local_iface_name": name_schema
,
428 "description":description_schema
430 "required": ["name", "type", "VNFC", "local_iface_name"],
431 "additionalProperties": False
435 external_connection_schema_v02
= {
439 "mgmt": boolean_schema
,
440 "type": {"type": "string", "enum":["e-line", "e-lan"]},
441 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
443 "local_iface_name": name_schema
,
444 "description":description_schema
446 "required": ["name", "type", "VNFC", "local_iface_name"],
447 "additionalProperties": False
456 "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]},
457 "bandwidth":bandwidth_schema
,
459 "mac_address": mac_schema
461 "additionalProperties": False,
462 "required": ["name","dedicated", "bandwidth"]
466 bridge_interfaces_schema
={
472 "bandwidth":bandwidth_schema
,
474 "mac_address": mac_schema
,
475 "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139", "paravirt"]},
476 "port-security": boolean_schema
,
477 "floating-ip": boolean_schema
,
479 "additionalProperties": False,
489 "type":{"type":"string", "enum":["disk","cdrom","xml"] },
490 "image": path_schema
,
491 "image name": name_schema
,
492 "image checksum": checksum_schema
,
493 "image metadata": metadata_schema
,
496 "xml":xml_text_schema
,
499 "additionalProperties": False,
508 "memory":integer1_schema
,
509 "cores":integer1_schema
,
510 "paired-threads":integer1_schema
,
511 "threads":integer1_schema
,
512 "cores-id":{"type":"array","items":integer0_schema
},
513 "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema
}},
514 "threads-id":{"type":"array","items":integer0_schema
},
515 "interfaces":interfaces_schema
517 "additionalProperties": False,
518 #"required": ["memory"]
521 config_files_schema
= {
522 "title": "Config files for cloud init schema",
523 "$schema": "http://json-schema.org/draft-04/schema#",
527 "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]}, #by default text
528 "content": {"type": "string"},
529 "permissions": {"type": "string"}, # tiypically octal notation '0644'
530 "owner": {"type": "string"}, # format: owner:group
533 "additionalProperties": False,
534 "required": ["dest", "content"],
537 boot_data_vdu_schema
= {
538 "title": "Boot data (Cloud-init) configuration schema",
539 "$schema": "http://json-schema.org/draft-04/schema#",
542 "key-pairs": {"type" : "array", "items": {"type":"string"}},
543 "users": {"type" : "array", "items": cloud_config_user_schema
},
544 "user-data": {"type" : "string"}, # scrip to run
545 "config-files": {"type": "array", "items": config_files_schema
},
546 # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data
547 "boot-data-drive": boolean_schema
,
549 "additionalProperties": False,
556 "description": description_schema
,
557 "count": integer1_schema
,
558 "image name": name_schema
,
559 "availability_zone": name_schema
,
560 "VNFC image": {"oneOf": [path_schema
, http_schema
]},
561 "image checksum": checksum_schema
,
562 "image metadata": metadata_schema
,
563 #"cloud-config": cloud_config_schema, #common for all vnfs in the scenario
567 "model":description_schema
,
568 "features":{"type":"array","items":nameshort_schema
}
570 "required": ["model"],
571 "additionalProperties": False
576 "type":nameshort_schema
,
577 "version":description_schema
580 "ram":integer0_schema
,
581 "vcpus":integer0_schema
,
582 "disk": integer1_schema
,
587 "bridge-ifaces": bridge_interfaces_schema
,
588 "devices": devices_schema
,
589 "boot-data" : boot_data_vdu_schema
592 "required": ["name"],
594 {"required": ["VNFC image"]},
595 {"required": ["image name"]}
597 "additionalProperties": False
601 "title":"vnfd information schema v0.1",
602 "$schema": "http://json-schema.org/draft-04/schema#",
609 "description": description_schema
,
611 "class": nameshort_schema
,
612 "public": boolean_schema
,
613 "physical": boolean_schema
,
614 "default_user": name_schema
,
615 "tenant_id": id_schema
, #only valid for admin
616 "external-connections": {"type" : "array", "items": external_connection_schema
, "minItems":1},
617 "internal-connections": {"type" : "array", "items": internal_connection_schema
, "minItems":1},
618 "VNFC":{"type" : "array", "items": vnfc_schema
, "minItems":1}
620 "required": ["name","external-connections"],
621 "additionalProperties": True
625 "additionalProperties": False
628 #VNFD schema for OSM R1
630 "title":"vnfd information schema v0.2",
631 "$schema": "http://json-schema.org/draft-04/schema#",
634 "schema_version": {"type": "string", "enum": ["0.2"]},
639 "description": description_schema
,
640 "class": nameshort_schema
,
641 "public": boolean_schema
,
642 "physical": boolean_schema
,
643 "tenant_id": id_schema
, #only valid for admin
644 "external-connections": {"type" : "array", "items": external_connection_schema
, "minItems":1},
645 "internal-connections": {"type" : "array", "items": internal_connection_schema_v02
, "minItems":1},
646 # "cloud-config": cloud_config_schema, #common for all vnfcs
647 "VNFC":{"type" : "array", "items": vnfc_schema
, "minItems":1}
649 "required": ["name"],
650 "additionalProperties": True
653 "required": ["vnf", "schema_version"],
654 "additionalProperties": False
657 #vnfd_schema = vnfd_schema_v01
659 # "title":"vnfd information schema v0.2",
660 # "$schema": "http://json-schema.org/draft-04/schema#",
661 # "oneOf": [vnfd_schema_v01, vnfd_schema_v02]
665 "title":"graphical scenario descriptor information schema",
666 "$schema": "http://json-schema.org/draft-04/schema#",
669 "x": integer0_schema
,
670 "y": integer0_schema
,
674 "left": {"type":"array"},
675 "right": {"type":"array"},
676 "bottom": {"type":"array"},
680 "required": ["x","y"]
684 "title":"network scenario descriptor information schema v0.1",
685 "$schema": "http://json-schema.org/draft-04/schema#",
689 "description": description_schema
,
690 "tenant_id": id_schema
, #only valid for admin
691 "public": boolean_schema
,
697 "patternProperties":{
701 "type":{"type":"string", "enum":["VNF", "other_network", "network", "external_network"]},
703 "graph": graph_schema
,
705 "patternProperties":{
706 "^(VNF )?model$": {"type": "string"}
714 "patternProperties":{
718 "nodes":{"oneOf":[{"type":"object", "minProperties":2}, {"type":"array", "minLength":1}]},
719 "type": {"type": "string", "enum":["link", "external_network", "dataplane_net", "bridge_net"]},
720 "graph": graph_schema
722 "required": ["nodes"]
727 "required": ["nodes"],
728 "additionalProperties": False
731 "required": ["name","topology"],
732 "additionalProperties": False
736 "title":"network scenario descriptor information schema v0.2",
737 "$schema": "http://json-schema.org/draft-04/schema#",
740 "schema_version": schema_version_2
,
745 "description": description_schema
,
746 "tenant_id": id_schema
, #only valid for admin
747 "public": boolean_schema
,
750 "patternProperties":{
755 "graph": graph_schema
,
756 "vnf_name": name_schema
,
764 "patternProperties":{
768 "interfaces":{"type":"array", "minLength":1},
769 "type": {"type": "string", "enum":["dataplane", "bridge"]},
770 "external" : boolean_schema
,
771 "graph": graph_schema
773 "required": ["interfaces"]
779 "required": ["vnfs", "name"],
780 "additionalProperties": False
783 "required": ["scenario","schema_version"],
784 "additionalProperties": False
787 #NSD schema for OSM R1
789 "title":"network scenario descriptor information schema v0.3",
790 "$schema": "http://json-schema.org/draft-04/schema#",
793 "schema_version": {"type": "string", "enum": ["0.3"]},
798 "description": description_schema
,
799 "tenant_id": id_schema
, #only valid for admin
800 "public": boolean_schema
,
801 "cloud-config": cloud_config_schema
, #common for all vnfs in the scenario
802 #"datacenter": name_schema,
805 "patternProperties":{
810 "graph": graph_schema
,
811 "vnf_name": name_schema
,
812 #"cloud-config": cloud_config_schema, #particular for a vnf
813 #"datacenter": name_schema,
814 "internal-connections": {
816 "patternProperties": {
820 "ip-profile": ip_profile_schema
,
827 "local_iface_name": name_schema
,
828 "ip_address": ip_schema
,
830 "required": ["VNFC", "local_iface_name"],
844 "patternProperties":{
855 "vnf_interface": name_schema
,
856 "ip_address": ip_schema
858 "required": ["vnf", "vnf_interface"],
861 "type": {"type": "string", "enum":["e-line", "e-lan"]},
862 "implementation": {"type": "string", "enum":["overlay", "underlay"]},
863 "external" : boolean_schema
,
864 "graph": graph_schema
,
865 "ip-profile": ip_profile_schema
867 "required": ["interfaces"]
873 "required": ["vnfs", "networks","name"],
874 "additionalProperties": False
877 "required": ["scenario","schema_version"],
878 "additionalProperties": False
881 #scenario_new_schema = {
882 # "title":"new scenario information schema",
883 # "$schema": "http://json-schema.org/draft-04/schema#",
884 # #"oneOf": [nsd_schema_v01, nsd_schema_v02]
885 # "oneOf": [nsd_schema_v01]
888 scenario_edit_schema
= {
889 "title":"edit scenario information schema",
890 "$schema": "http://json-schema.org/draft-04/schema#",
894 "description": description_schema
,
900 "patternProperties":{
901 "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$": {
907 "x": integer0_schema
,
908 "y": integer0_schema
,
909 "ifaces":{ "type": "object"}
912 "description": description_schema
,
919 "required": ["nodes"],
920 "additionalProperties": False
923 "additionalProperties": False
926 scenario_action_schema
= {
927 "title":"scenario action information schema",
928 "$schema": "http://json-schema.org/draft-04/schema#",
934 "instance_name":name_schema
,
935 "description":description_schema
,
936 "datacenter": {"type": "string"}
938 "required": ["instance_name"]
943 "instance_name":name_schema
,
944 "description":description_schema
,
945 "datacenter": {"type": "string"}
947 "required": ["instance_name"]
952 "instance_name":name_schema
,
953 "description":description_schema
,
954 "datacenter": {"type": "string"}
956 "required": ["instance_name"]
961 "instance_name":name_schema
,
962 "description":description_schema
,
963 "datacenter": {"type": "string"}
965 "required": ["instance_name"]
970 "additionalProperties": False
973 instance_scenario_object
= {
974 "title": "scenario object used to create an instance not based on any nsd",
975 "$schema": "http://json-schema.org/draft-04/schema#",
985 "external": boolean_schema
,
986 "type": {"enum": ["bridge", "ptp", "data"]}, # for overlay, underlay E-LINE, underlay E-LAN
988 "additionalProperties": False,
989 "required": ["name", "external", "type"]
993 "additionalProperties": False,
997 instance_scenario_create_schema_v01
= {
998 "title": "instance scenario create information schema v0.1",
999 "$schema": "http://json-schema.org/draft-04/schema#",
1002 "schema_version": {"type": "string", "enum": ["0.1"]},
1006 "mgmt_keys": {"type": "array", "items": {"type":"string"}},
1007 "vduImage": name_schema
,
1008 "name": name_schema
,
1009 "description":description_schema
,
1010 "datacenter": name_schema
,
1011 "wim_account": {"oneOf": [boolean_schema
, id_schema
, null_schema
]},
1012 "scenario" : {"oneOff": [name_schema
, instance_scenario_object
]}, # can be an UUID or name or a dict
1013 "action":{"enum": ["deploy","reserve","verify" ]},
1014 "connect_mgmt_interfaces": {"oneOf": [boolean_schema
, {"type":"object"}]},# can be true or a dict with datacenter: net_name
1015 "cloud-config": cloud_config_schema
, #common to all vnfs in the instance scenario
1016 "vnfs":{ #mapping from scenario to datacenter
1018 "patternProperties":{
1022 "name": name_schema
, #override vnf name
1023 "datacenter": name_schema
,
1024 #"metadata": {"type": "object"},
1025 #"user_data": {"type": "string"}
1026 #"cloud-config": cloud_config_schema, #particular for a vnf
1029 "patternProperties": {
1033 "name": name_schema
, # overrides vdu name schema
1034 "mgmt_keys": {"type": "array", "items": {"type": "string"}},
1035 "vduImage": name_schema
,
1038 "patternProperties": {
1040 "vim_id": name_schema
,
1046 "patternProperties": {
1048 "ip_address": ip_schema
,
1049 "mac_address": mac_schema
,
1050 "floating-ip": boolean_schema
,
1060 "patternProperties": {
1064 "vim-network-name": name_schema
,
1065 "vim-network-id": name_schema
,
1066 "ip-profile": ip_profile_schema
,
1067 "name": name_schema
,
1076 "networks":{ #mapping from scenario to datacenter
1078 "patternProperties":{
1088 "ip_address": ip_schema
,
1089 "datacenter": name_schema
,
1090 "vim-network-name": name_schema
,
1091 "vim-network-id": name_schema
1093 "patternProperties":{
1094 ".": {"type": "string"}
1098 "wim_account": {"oneOf": [boolean_schema
, id_schema
, null_schema
]},
1099 "ip-profile": ip_profile_schema
,
1103 "instance_scenario_id": id_schema
,
1104 # "member_vnf_index": name_schema, # if not null, network inside VNF
1105 "osm_id": name_schema
, # sce_network osm_id or name
1107 "additionalProperties": False,
1108 "required": ["instance_scenario_id", "osm_id"]
1110 #if the network connects VNFs deployed at different sites, you must specify one entry per site that this network connect to
1117 # By default for an scenario 'external' network openmano looks for an existing VIM network to map this external scenario network,
1118 # for other networks openamno creates at VIM
1119 # Use netmap-create to force to create an external scenario network
1120 "netmap-create": {"oneOf":[name_schema
,null_schema
]}, #datacenter network to use. Null if must be created as an internal net
1121 #netmap-use: Indicates an existing VIM network that must be used for this scenario network.
1122 #Can use both the VIM network name (if it is not ambiguous) or the VIM net UUID
1123 #If both 'netmap-create' and 'netmap-use'are supplied, netmap-use precedes, but if fails openmano follows the netmap-create
1124 #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)
1125 "netmap-use": name_schema
, #
1126 "vim-network-name": name_schema
, #override network name
1127 "vim-network-id": name_schema
,
1128 #"ip-profile": ip_profile_schema,
1129 "datacenter": name_schema
,
1138 "additionalProperties": False,
1139 "required": ["name"]
1142 "required": ["instance"],
1143 "additionalProperties": False
1146 instance_scenario_action_schema
= {
1147 "title": "instance scenario action information schema",
1148 "$schema": "http://json-schema.org/draft-04/schema#",
1151 "start": null_schema
,
1152 "pause": null_schema
,
1153 "resume": null_schema
,
1154 "shutoff": null_schema
,
1155 "shutdown": null_schema
,
1156 "forceOff": null_schema
,
1157 "rebuild": null_schema
,
1159 "type": ["object", "null"],
1161 "add_public_key": {"type" : "string"},
1162 "user": nameshort_schema
,
1163 "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]},
1169 "vdu-id": id_schema
,
1170 "osm_vdu_id": name_schema
,
1171 "member-vnf-index": name_schema
,
1172 "count": integer1_schema
,
1173 "type": {"enum": ["create", "delete"]}
1175 "additionalProperties": False,
1177 "required": ["type"]
1180 "vnfs": {"type": "array", "items": {"type": "string"}},
1181 "vms": {"type": "array", "items": {"type": "string"}}
1184 #"maxProperties": 1,
1185 "additionalProperties": False
1188 sdn_controller_properties
={
1189 "name": name_schema
,
1190 "dpid": {"type": "string", "pattern": "^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"},
1191 "description": name_schema
,
1193 "port": port_schema
,
1194 "type": nameshort_schema
,
1196 "version": {"type": "string", "minLength": 1, "maxLength": 12},
1197 "user": nameshort_schema
,
1198 "password": passwd_schema
,
1199 "config": object_schema
,
1201 sdn_controller_schema
= {
1202 "title": "sdn controller information schema",
1203 "$schema": "http://json-schema.org/draft-04/schema#",
1208 "properties": sdn_controller_properties
,
1209 "required": ["name", 'type'],
1210 "additionalProperties": False
1213 "required": ["sdn_controller"],
1214 "additionalProperties": False
1217 sdn_controller_edit_schema
= {
1218 "title": "sdn controller update information schema",
1219 "$schema": "http://json-schema.org/draft-04/schema#",
1224 "properties": sdn_controller_properties
,
1225 "additionalProperties": False
1228 "required": ["sdn_controller"],
1229 "additionalProperties": False
1232 sdn_port_mapping_schema
= {
1233 "$schema": "http://json-schema.org/draft-04/schema#",
1234 "title":"sdn port mapping information schema",
1237 "sdn_port_mapping": {
1242 "compute_node": nameshort_schema
,
1248 "pci": {"OneOf": [null_schema
, pci_extended_schema
]}, # pci_schema,
1249 "switch_port": nameshort_schema
,
1250 "switch_mac": mac_schema
1256 "required": ["compute_node", "ports"]
1260 "required": ["sdn_port_mapping"]
1263 sdn_external_port_schema
= {
1264 "$schema": "http://json-schema.org/draft-04/schema#",
1265 "title":"External port ingformation",
1268 "port": {"type" : "string", "minLength":1, "maxLength":60},
1269 "vlan": vlan_schema
,
1272 "required": ["port"]