| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
| 3 | ## |
| tierno | 9202102 | 2018-09-12 16:29:23 +0200 | [diff] [blame] | 4 | # Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U. |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 5 | # This file is part of openmano |
| 6 | # All Rights Reserved. |
| 7 | # |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 9 | # not use this file except in compliance with the License. You may obtain |
| 10 | # a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 16 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 17 | # License for the specific language governing permissions and limitations |
| 18 | # under the License. |
| 19 | # |
| 20 | # For those usages not covered by the Apache License, Version 2.0 please |
| 21 | # contact with: nfvlabs@tid.es |
| 22 | ## |
| 23 | |
| 24 | ''' |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 25 | JSON schemas used by openmano httpserver.py module to parse the different files and messages sent through the API |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 26 | ''' |
| montesmoreno | 0c8def0 | 2016-12-22 12:16:23 +0000 | [diff] [blame] | 27 | __author__="Alfonso Tierno, Gerardo Garcia, Pablo Montes" |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 28 | __date__ ="$09-oct-2014 09:09:48$" |
| 29 | |
| 30 | #Basis schemas |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 31 | patern_name="^[ -~]+$" |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 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]$"} |
| tierno | 20a608c | 2018-10-02 13:43:47 +0200 | [diff] [blame] | 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}$"} |
| tierno | 7f426e9 | 2018-06-28 15:21:32 +0200 | [diff] [blame] | 42 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 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} |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 48 | path_schema={"type":"string", "pattern":"^(\.){0,2}(/[^/\"':{}\(\)]+)+$"} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 49 | vlan_schema={"type":"integer","minimum":1,"maximum":4095} |
| 50 | vlan1000_schema={"type":"integer","minimum":1000,"maximum":4095} |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 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 |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 52 | #mac_schema={"type":"string", "pattern":"^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$"} |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 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])$"} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 55 | port_schema={"type":"integer","minimum":1,"maximum":65534} |
| 56 | object_schema={"type":"object"} |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 57 | schema_version_2={"type":"integer","minimum":2,"maximum":2} |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 58 | #schema_version_string={"type":"string","enum": ["0.1", "2", "0.2", "3", "0.3"]} |
| tierno | ae4a8d1 | 2016-07-08 12:30:39 +0200 | [diff] [blame] | 59 | log_level_schema={"type":"string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]} |
| garciadeblas | b69fa9f | 2016-09-28 12:04:10 +0200 | [diff] [blame] | 60 | checksum_schema={"type":"string", "pattern":"^[0-9a-fA-F]{32}$"} |
| montesmoreno | 0c8def0 | 2016-12-22 12:16:23 +0000 | [diff] [blame] | 61 | size_schema={"type":"integer","minimum":1,"maximum":100} |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 62 | boolean_schema = {"type": "boolean"} |
| 63 | null_schema = {"type": "null"} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 64 | |
| 65 | metadata_schema={ |
| 66 | "type":"object", |
| 67 | "properties":{ |
| 68 | "architecture": {"type":"string"}, |
| 69 | "use_incremental": {"type":"string","enum":["yes","no"]}, |
| 70 | "vpci": pci_schema, |
| 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"]} |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | #Schema for the configuration file |
| 80 | config_schema = { |
| 81 | "title":"configuration response information schema", |
| 82 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 83 | "type":"object", |
| 84 | "properties":{ |
| 85 | "http_port": port_schema, |
| 86 | "http_admin_port": port_schema, |
| 87 | "http_host": nameshort_schema, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 88 | "auto_push_VNF_to_VIMs": boolean_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 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, |
| tierno | 639520f | 2017-04-05 19:55:36 +0200 | [diff] [blame] | 94 | "db_ovim_host": nameshort_schema, |
| 95 | "db_ovim_user": nameshort_schema, |
| 96 | "db_ovim_passwd": {"type":"string"}, |
| 97 | "db_ovim_name": nameshort_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 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, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 104 | "mano_tenant_id": id_schema, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 105 | "http_console_proxy": boolean_schema, |
| tierno | 20fc2a2 | 2016-08-19 17:02:35 +0200 | [diff] [blame] | 106 | "http_console_host": nameshort_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 107 | "http_console_ports": { |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 108 | "type": "array", |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 109 | "items": {"OneOf": [ |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 110 | port_schema, |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 111 | {"type": "object", "properties": {"from": port_schema, "to": port_schema}, "required": ["from", "to"]} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 112 | ]} |
| 113 | }, |
| tierno | ae4a8d1 | 2016-07-08 12:30:39 +0200 | [diff] [blame] | 114 | "log_level": log_level_schema, |
| tierno | 72f35a5 | 2016-07-15 13:18:30 +0200 | [diff] [blame] | 115 | "log_socket_level": log_level_schema, |
| tierno | ae4a8d1 | 2016-07-08 12:30:39 +0200 | [diff] [blame] | 116 | "log_level_db": log_level_schema, |
| tierno | 73ad9e4 | 2016-09-12 18:11:11 +0200 | [diff] [blame] | 117 | "log_level_vim": log_level_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 118 | "log_level_wim": log_level_schema, |
| tierno | f97fd27 | 2016-07-11 14:32:37 +0200 | [diff] [blame] | 119 | "log_level_nfvo": log_level_schema, |
| tierno | 73ad9e4 | 2016-09-12 18:11:11 +0200 | [diff] [blame] | 120 | "log_level_http": log_level_schema, |
| tierno | 1ae5134 | 2017-01-16 12:48:30 +0000 | [diff] [blame] | 121 | "log_level_console": log_level_schema, |
| tierno | 639520f | 2017-04-05 19:55:36 +0200 | [diff] [blame] | 122 | "log_level_ovim": log_level_schema, |
| tierno | 73ad9e4 | 2016-09-12 18:11:11 +0200 | [diff] [blame] | 123 | "log_file_db": path_schema, |
| 124 | "log_file_vim": path_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 125 | "log_file_wim": path_schema, |
| tierno | 73ad9e4 | 2016-09-12 18:11:11 +0200 | [diff] [blame] | 126 | "log_file_nfvo": path_schema, |
| 127 | "log_file_http": path_schema, |
| tierno | 1ae5134 | 2017-01-16 12:48:30 +0000 | [diff] [blame] | 128 | "log_file_console": path_schema, |
| tierno | 639520f | 2017-04-05 19:55:36 +0200 | [diff] [blame] | 129 | "log_file_ovim": path_schema, |
| tierno | 72f35a5 | 2016-07-15 13:18:30 +0200 | [diff] [blame] | 130 | "log_socket_host": nameshort_schema, |
| 131 | "log_socket_port": port_schema, |
| tierno | f97fd27 | 2016-07-11 14:32:37 +0200 | [diff] [blame] | 132 | "log_file": path_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 133 | }, |
| tierno | 639520f | 2017-04-05 19:55:36 +0200 | [diff] [blame] | 134 | "required": ['db_user', 'db_passwd', 'db_name'], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 135 | "additionalProperties": False |
| 136 | } |
| 137 | |
| 138 | tenant_schema = { |
| 139 | "title":"tenant information schema", |
| 140 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 141 | "type":"object", |
| 142 | "properties":{ |
| 143 | "tenant":{ |
| 144 | "type":"object", |
| 145 | "properties":{ |
| 146 | "name": nameshort_schema, |
| 147 | "description": description_schema, |
| 148 | }, |
| 149 | "required": ["name"], |
| 150 | "additionalProperties": True |
| 151 | } |
| 152 | }, |
| 153 | "required": ["tenant"], |
| 154 | "additionalProperties": False |
| 155 | } |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 156 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 157 | tenant_edit_schema = { |
| 158 | "title":"tenant edit information schema", |
| 159 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 160 | "type":"object", |
| 161 | "properties":{ |
| 162 | "tenant":{ |
| 163 | "type":"object", |
| 164 | "properties":{ |
| 165 | "name": name_schema, |
| 166 | "description": description_schema, |
| 167 | }, |
| 168 | "additionalProperties": False |
| 169 | } |
| 170 | }, |
| 171 | "required": ["tenant"], |
| 172 | "additionalProperties": False |
| 173 | } |
| 174 | |
| 175 | datacenter_schema_properties={ |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 176 | "name": name_schema, |
| 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" } |
| 182 | } |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 183 | |
| 184 | datacenter_schema = { |
| 185 | "title":"datacenter information schema", |
| 186 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 187 | "type":"object", |
| 188 | "properties":{ |
| 189 | "datacenter":{ |
| 190 | "type":"object", |
| 191 | "properties":datacenter_schema_properties, |
| 192 | "required": ["name", "vim_url"], |
| 193 | "additionalProperties": True |
| 194 | } |
| 195 | }, |
| 196 | "required": ["datacenter"], |
| 197 | "additionalProperties": False |
| 198 | } |
| 199 | |
| 200 | |
| 201 | datacenter_edit_schema = { |
| 202 | "title":"datacenter edit nformation schema", |
| 203 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 204 | "type":"object", |
| 205 | "properties":{ |
| 206 | "datacenter":{ |
| 207 | "type":"object", |
| 208 | "properties":datacenter_schema_properties, |
| 209 | "additionalProperties": False |
| 210 | } |
| 211 | }, |
| 212 | "required": ["datacenter"], |
| 213 | "additionalProperties": False |
| 214 | } |
| 215 | |
| 216 | |
| 217 | netmap_new_schema = { |
| 218 | "title":"netmap new information schema", |
| 219 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 220 | "type":"object", |
| 221 | "properties":{ |
| 222 | "netmap":{ #delete from datacenter |
| 223 | "type":"object", |
| 224 | "properties":{ |
| 225 | "name": name_schema, #name or uuid of net to change |
| 226 | "vim_id": id_schema, |
| 227 | "vim_name": name_schema |
| 228 | }, |
| 229 | "minProperties": 1, |
| 230 | "additionalProperties": False |
| 231 | }, |
| 232 | }, |
| 233 | "required": ["netmap"], |
| 234 | "additionalProperties": False |
| 235 | } |
| 236 | |
| 237 | netmap_edit_schema = { |
| 238 | "title":"netmap edit information schema", |
| 239 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 240 | "type":"object", |
| 241 | "properties":{ |
| 242 | "netmap":{ #delete from datacenter |
| 243 | "type":"object", |
| 244 | "properties":{ |
| 245 | "name": name_schema, #name or uuid of net to change |
| 246 | }, |
| 247 | "minProperties": 1, |
| 248 | "additionalProperties": False |
| 249 | }, |
| 250 | }, |
| 251 | "required": ["netmap"], |
| 252 | "additionalProperties": False |
| 253 | } |
| 254 | |
| 255 | datacenter_action_schema = { |
| 256 | "title":"datacenter action information schema", |
| 257 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 258 | "type":"object", |
| 259 | "properties":{ |
| tierno | 5509c2e | 2019-07-04 16:23:20 +0000 | [diff] [blame] | 260 | "check-connectivity": {"type": "null"}, |
| 261 | "net-update": {"type": "null"}, |
| 262 | "net-edit": { |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 263 | "type":"object", |
| 264 | "properties":{ |
| 265 | "net": name_schema, #name or uuid of net to change |
| 266 | "name": name_schema, |
| 267 | "description": description_schema, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 268 | "shared": boolean_schema |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 269 | }, |
| 270 | "minProperties": 1, |
| 271 | "additionalProperties": False |
| 272 | }, |
| 273 | "net-delete":{ |
| 274 | "type":"object", |
| 275 | "properties":{ |
| 276 | "net": name_schema, #name or uuid of net to change |
| 277 | }, |
| 278 | "required": ["net"], |
| 279 | "additionalProperties": False |
| 280 | }, |
| 281 | }, |
| 282 | "minProperties": 1, |
| 283 | "maxProperties": 1, |
| 284 | "additionalProperties": False |
| 285 | } |
| 286 | |
| 287 | |
| 288 | datacenter_associate_schema={ |
| 289 | "title":"datacenter associate information schema", |
| 290 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 291 | "type":"object", |
| 292 | "properties":{ |
| 293 | "datacenter":{ |
| tierno | d3750b3 | 2018-07-20 15:33:08 +0200 | [diff] [blame] | 294 | "type": "object", |
| 295 | "properties": { |
| 296 | "name": name_schema, |
| 297 | "vim_id": id_schema, |
| tierno | 8008c3a | 2016-10-13 15:34:28 +0000 | [diff] [blame] | 298 | "vim_tenant": name_schema, |
| 299 | "vim_tenant_name": name_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 300 | "vim_username": nameshort_schema, |
| 301 | "vim_password": nameshort_schema, |
| tierno | 8008c3a | 2016-10-13 15:34:28 +0000 | [diff] [blame] | 302 | "config": {"type": "object"} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 303 | }, |
| tierno | d3750b3 | 2018-07-20 15:33:08 +0200 | [diff] [blame] | 304 | # "required": ["vim_tenant"], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 305 | "additionalProperties": True |
| 306 | } |
| 307 | }, |
| 308 | "required": ["datacenter"], |
| 309 | "additionalProperties": False |
| 310 | } |
| 311 | |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 312 | dhcp_schema = { |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 313 | "title": "DHCP schema", |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 314 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 315 | "type": "object", |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 316 | "properties":{ |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 317 | "enabled": boolean_schema, |
| 318 | "start-address": {"OneOf": [null_schema, ip_schema]}, |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 319 | "count": integer0_schema |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 320 | }, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 321 | # "required": ["start-address", "count"], |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | ip_profile_schema = { |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 325 | "title": "IP profile schema", |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 326 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | 41a6981 | 2018-02-16 14:34:33 +0100 | [diff] [blame] | 327 | "type": "object", |
| 328 | "properties": { |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 329 | "ip-version": {"type": "string", "enum": ["IPv4", "IPv6"]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 330 | "subnet-address": ip_prefix_schema, |
| 331 | "gateway-address": ip_schema, |
| tierno | 455612d | 2017-05-30 16:40:10 +0200 | [diff] [blame] | 332 | "dns-address": {"oneOf": [ip_schema, # for backward compatibility |
| 333 | {"type": "array", "items": ip_schema}]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 334 | "dhcp": dhcp_schema |
| 335 | }, |
| 336 | } |
| 337 | |
| 338 | key_pair_schema = { |
| 339 | "title": "Key-pair schema for cloud-init configuration schema", |
| 340 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 341 | "type":"object", |
| 342 | "properties":{ |
| 343 | "name": name_schema, |
| 344 | "key": {"type":"string"} |
| 345 | }, |
| 346 | "required": ["key"], |
| 347 | "additionalProperties": False |
| 348 | } |
| 349 | |
| 350 | cloud_config_user_schema = { |
| 351 | "title": "User schema for cloud-init configuration schema", |
| 352 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 353 | "type":"object", |
| 354 | "properties":{ |
| 355 | "name": nameshort_schema, |
| 356 | "user-info": {"type":"string"}, |
| 357 | #"key-pairs": {"type" : "array", "items": key_pair_schema} |
| 358 | "key-pairs": {"type" : "array", "items": {"type":"string"}} |
| 359 | }, |
| 360 | "required": ["name"], |
| 361 | "additionalProperties": False |
| 362 | } |
| 363 | |
| 364 | cloud_config_schema = { |
| 365 | "title": "Cloud-init configuration schema", |
| 366 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 367 | "type":"object", |
| 368 | "properties":{ |
| 369 | #"key-pairs": {"type" : "array", "items": key_pair_schema}, |
| 370 | "key-pairs": {"type" : "array", "items": {"type":"string"}}, |
| 371 | "users": {"type" : "array", "items": cloud_config_user_schema} |
| 372 | }, |
| 373 | "additionalProperties": False |
| 374 | } |
| 375 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 376 | internal_connection_element_schema = { |
| 377 | "type":"object", |
| 378 | "properties":{ |
| 379 | "VNFC": name_schema, |
| 380 | "local_iface_name": name_schema |
| 381 | } |
| 382 | } |
| 383 | |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 384 | internal_connection_element_schema_v02 = { |
| 385 | "type":"object", |
| 386 | "properties":{ |
| 387 | "VNFC": name_schema, |
| 388 | "local_iface_name": name_schema, |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 389 | "ip_address": ip_schema |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 390 | } |
| 391 | } |
| 392 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 393 | internal_connection_schema = { |
| 394 | "type":"object", |
| 395 | "properties":{ |
| 396 | "name": name_schema, |
| 397 | "description":description_schema, |
| 398 | "type":{"type":"string", "enum":["bridge","data","ptp"]}, |
| tierno | 8e69032 | 2017-08-10 15:58:50 +0200 | [diff] [blame] | 399 | "elements": {"type" : "array", "items": internal_connection_element_schema, "minItems":1} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 400 | }, |
| 401 | "required": ["name", "type", "elements"], |
| 402 | "additionalProperties": False |
| 403 | } |
| 404 | |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 405 | internal_connection_schema_v02 = { |
| 406 | "type":"object", |
| 407 | "properties":{ |
| 408 | "name": name_schema, |
| 409 | "description":description_schema, |
| 410 | "type": {"type": "string", "enum":["e-line", "e-lan"]}, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 411 | "implementation": {"type": "string", "enum":["overlay", "underlay"]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 412 | "ip-profile": ip_profile_schema, |
| tierno | 8e69032 | 2017-08-10 15:58:50 +0200 | [diff] [blame] | 413 | "elements": {"type" : "array", "items": internal_connection_element_schema_v02, "minItems":1} |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 414 | }, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 415 | "required": ["name", "type", "implementation", "elements"], |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 416 | "additionalProperties": False |
| 417 | } |
| 418 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 419 | external_connection_schema = { |
| 420 | "type":"object", |
| 421 | "properties":{ |
| 422 | "name": name_schema, |
| 423 | "type":{"type":"string", "enum":["mgmt","bridge","data"]}, |
| 424 | "VNFC": name_schema, |
| 425 | "local_iface_name": name_schema , |
| 426 | "description":description_schema |
| 427 | }, |
| 428 | "required": ["name", "type", "VNFC", "local_iface_name"], |
| 429 | "additionalProperties": False |
| 430 | } |
| 431 | |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 432 | #Not yet used |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 433 | external_connection_schema_v02 = { |
| 434 | "type":"object", |
| 435 | "properties":{ |
| 436 | "name": name_schema, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 437 | "mgmt": boolean_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 438 | "type": {"type": "string", "enum":["e-line", "e-lan"]}, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 439 | "implementation": {"type": "string", "enum":["overlay", "underlay"]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 440 | "VNFC": name_schema, |
| 441 | "local_iface_name": name_schema , |
| 442 | "description":description_schema |
| 443 | }, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 444 | "required": ["name", "type", "VNFC", "local_iface_name"], |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 445 | "additionalProperties": False |
| 446 | } |
| 447 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 448 | interfaces_schema={ |
| 449 | "type":"array", |
| 450 | "items":{ |
| 451 | "type":"object", |
| 452 | "properties":{ |
| 453 | "name":name_schema, |
| 454 | "dedicated":{"type":"string","enum":["yes","no","yes:sriov"]}, |
| 455 | "bandwidth":bandwidth_schema, |
| 456 | "vpci":pci_schema, |
| 457 | "mac_address": mac_schema |
| 458 | }, |
| 459 | "additionalProperties": False, |
| 460 | "required": ["name","dedicated", "bandwidth"] |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | bridge_interfaces_schema={ |
| 465 | "type":"array", |
| 466 | "items":{ |
| 467 | "type":"object", |
| 468 | "properties":{ |
| 469 | "name": name_schema, |
| 470 | "bandwidth":bandwidth_schema, |
| 471 | "vpci":pci_schema, |
| 472 | "mac_address": mac_schema, |
| garciadeblas | 31e141b | 2018-10-25 18:33:19 +0200 | [diff] [blame] | 473 | "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139", "paravirt"]}, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 474 | "port-security": boolean_schema, |
| 475 | "floating-ip": boolean_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 476 | }, |
| 477 | "additionalProperties": False, |
| 478 | "required": ["name"] |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | devices_schema={ |
| 483 | "type":"array", |
| 484 | "items":{ |
| 485 | "type":"object", |
| 486 | "properties":{ |
| 487 | "type":{"type":"string", "enum":["disk","cdrom","xml"] }, |
| 488 | "image": path_schema, |
| garciadeblas | b69fa9f | 2016-09-28 12:04:10 +0200 | [diff] [blame] | 489 | "image name": name_schema, |
| 490 | "image checksum": checksum_schema, |
| montesmoreno | 0c8def0 | 2016-12-22 12:16:23 +0000 | [diff] [blame] | 491 | "image metadata": metadata_schema, |
| 492 | "size": size_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 493 | "vpci":pci_schema, |
| 494 | "xml":xml_text_schema, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 495 | "name": name_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 496 | }, |
| 497 | "additionalProperties": False, |
| 498 | "required": ["type"] |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | |
| 503 | numa_schema = { |
| 504 | "type": "object", |
| 505 | "properties": { |
| 506 | "memory":integer1_schema, |
| 507 | "cores":integer1_schema, |
| 508 | "paired-threads":integer1_schema, |
| 509 | "threads":integer1_schema, |
| 510 | "cores-id":{"type":"array","items":integer0_schema}, |
| 511 | "paired-threads-id":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":integer0_schema}}, |
| 512 | "threads-id":{"type":"array","items":integer0_schema}, |
| 513 | "interfaces":interfaces_schema |
| 514 | }, |
| 515 | "additionalProperties": False, |
| 516 | #"required": ["memory"] |
| 517 | } |
| 518 | |
| tierno | 36c0b17 | 2017-01-12 18:32:28 +0100 | [diff] [blame] | 519 | config_files_schema = { |
| 520 | "title": "Config files for cloud init schema", |
| 521 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 522 | "type": "object", |
| 523 | "properties": { |
| 524 | "dest": path_schema, |
| 525 | "encoding": {"type": "string", "enum": ["b64", "base64", "gz", "gz+b64", "gz+base64", "gzip+b64", "gzip+base64"]}, #by default text |
| 526 | "content": {"type": "string"}, |
| 527 | "permissions": {"type": "string"}, # tiypically octal notation '0644' |
| 528 | "owner": {"type": "string"}, # format: owner:group |
| 529 | |
| 530 | }, |
| 531 | "additionalProperties": False, |
| 532 | "required": ["dest", "content"], |
| 533 | } |
| 534 | |
| 535 | boot_data_vdu_schema = { |
| 536 | "title": "Boot data (Cloud-init) configuration schema", |
| 537 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 538 | "type": "object", |
| 539 | "properties":{ |
| 540 | "key-pairs": {"type" : "array", "items": {"type":"string"}}, |
| 541 | "users": {"type" : "array", "items": cloud_config_user_schema}, |
| 542 | "user-data": {"type" : "string"}, # scrip to run |
| 543 | "config-files": {"type": "array", "items": config_files_schema}, |
| 544 | # NOTE: “user-data” are mutually exclusive with users and config-files because user/files are injected using user-data |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 545 | "boot-data-drive": boolean_schema, |
| tierno | 36c0b17 | 2017-01-12 18:32:28 +0100 | [diff] [blame] | 546 | }, |
| 547 | "additionalProperties": False, |
| 548 | } |
| 549 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 550 | vnfc_schema = { |
| 551 | "type":"object", |
| 552 | "properties":{ |
| 553 | "name": name_schema, |
| 554 | "description": description_schema, |
| tierno | 8e69032 | 2017-08-10 15:58:50 +0200 | [diff] [blame] | 555 | "count": integer1_schema, |
| garciadeblas | b69fa9f | 2016-09-28 12:04:10 +0200 | [diff] [blame] | 556 | "image name": name_schema, |
| mirabal | 2935631 | 2017-07-27 12:21:22 +0200 | [diff] [blame] | 557 | "availability_zone": name_schema, |
| 558 | "VNFC image": {"oneOf": [path_schema, http_schema]}, |
| garciadeblas | b69fa9f | 2016-09-28 12:04:10 +0200 | [diff] [blame] | 559 | "image checksum": checksum_schema, |
| gcalvino | e580c7d | 2017-09-22 14:09:51 +0200 | [diff] [blame] | 560 | "image metadata": metadata_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 561 | #"cloud-config": cloud_config_schema, #common for all vnfs in the scenario |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 562 | "processor": { |
| 563 | "type":"object", |
| 564 | "properties":{ |
| 565 | "model":description_schema, |
| 566 | "features":{"type":"array","items":nameshort_schema} |
| 567 | }, |
| 568 | "required": ["model"], |
| 569 | "additionalProperties": False |
| 570 | }, |
| 571 | "hypervisor": { |
| 572 | "type":"object", |
| 573 | "properties":{ |
| 574 | "type":nameshort_schema, |
| 575 | "version":description_schema |
| 576 | }, |
| 577 | }, |
| 578 | "ram":integer0_schema, |
| 579 | "vcpus":integer0_schema, |
| 580 | "disk": integer1_schema, |
| 581 | "numas": { |
| 582 | "type": "array", |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 583 | "items": numa_schema |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 584 | }, |
| 585 | "bridge-ifaces": bridge_interfaces_schema, |
| tierno | 36c0b17 | 2017-01-12 18:32:28 +0100 | [diff] [blame] | 586 | "devices": devices_schema, |
| 587 | "boot-data" : boot_data_vdu_schema |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 588 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 589 | }, |
| garciadeblas | b69fa9f | 2016-09-28 12:04:10 +0200 | [diff] [blame] | 590 | "required": ["name"], |
| 591 | "oneOf": [ |
| 592 | {"required": ["VNFC image"]}, |
| 593 | {"required": ["image name"]} |
| 594 | ], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 595 | "additionalProperties": False |
| 596 | } |
| 597 | |
| 598 | vnfd_schema_v01 = { |
| 599 | "title":"vnfd information schema v0.1", |
| 600 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 601 | "type":"object", |
| 602 | "properties":{ |
| 603 | "vnf":{ |
| 604 | "type":"object", |
| 605 | "properties":{ |
| 606 | "name": name_schema, |
| 607 | "description": description_schema, |
| mirabal | 2935631 | 2017-07-27 12:21:22 +0200 | [diff] [blame] | 608 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 609 | "class": nameshort_schema, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 610 | "public": boolean_schema, |
| 611 | "physical": boolean_schema, |
| gcalvino | e580c7d | 2017-09-22 14:09:51 +0200 | [diff] [blame] | 612 | "default_user": name_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 613 | "tenant_id": id_schema, #only valid for admin |
| 614 | "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1}, |
| 615 | "internal-connections": {"type" : "array", "items": internal_connection_schema, "minItems":1}, |
| 616 | "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1} |
| 617 | }, |
| 618 | "required": ["name","external-connections"], |
| 619 | "additionalProperties": True |
| 620 | } |
| 621 | }, |
| 622 | "required": ["vnf"], |
| 623 | "additionalProperties": False |
| 624 | } |
| 625 | |
| gcalvino | e580c7d | 2017-09-22 14:09:51 +0200 | [diff] [blame] | 626 | #VNFD schema for OSM R1 |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 627 | vnfd_schema_v02 = { |
| 628 | "title":"vnfd information schema v0.2", |
| 629 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 630 | "type":"object", |
| 631 | "properties":{ |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 632 | "schema_version": {"type": "string", "enum": ["0.2"]}, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 633 | "vnf":{ |
| 634 | "type":"object", |
| 635 | "properties":{ |
| 636 | "name": name_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 637 | "description": description_schema, |
| 638 | "class": nameshort_schema, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 639 | "public": boolean_schema, |
| 640 | "physical": boolean_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 641 | "tenant_id": id_schema, #only valid for admin |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 642 | "external-connections": {"type" : "array", "items": external_connection_schema, "minItems":1}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 643 | "internal-connections": {"type" : "array", "items": internal_connection_schema_v02, "minItems":1}, |
| 644 | # "cloud-config": cloud_config_schema, #common for all vnfcs |
| 645 | "VNFC":{"type" : "array", "items": vnfc_schema, "minItems":1} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 646 | }, |
| 647 | "required": ["name"], |
| 648 | "additionalProperties": True |
| 649 | } |
| 650 | }, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 651 | "required": ["vnf", "schema_version"], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 652 | "additionalProperties": False |
| 653 | } |
| 654 | |
| 655 | #vnfd_schema = vnfd_schema_v01 |
| 656 | #{ |
| 657 | # "title":"vnfd information schema v0.2", |
| 658 | # "$schema": "http://json-schema.org/draft-04/schema#", |
| 659 | # "oneOf": [vnfd_schema_v01, vnfd_schema_v02] |
| 660 | #} |
| 661 | |
| 662 | graph_schema = { |
| 663 | "title":"graphical scenario descriptor information schema", |
| 664 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 665 | "type":"object", |
| 666 | "properties":{ |
| 667 | "x": integer0_schema, |
| 668 | "y": integer0_schema, |
| 669 | "ifaces": { |
| 670 | "type":"object", |
| 671 | "properties":{ |
| 672 | "left": {"type":"array"}, |
| 673 | "right": {"type":"array"}, |
| 674 | "bottom": {"type":"array"}, |
| 675 | } |
| 676 | } |
| 677 | }, |
| 678 | "required": ["x","y"] |
| 679 | } |
| 680 | |
| 681 | nsd_schema_v01 = { |
| 682 | "title":"network scenario descriptor information schema v0.1", |
| 683 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 684 | "type":"object", |
| 685 | "properties":{ |
| 686 | "name":name_schema, |
| 687 | "description": description_schema, |
| 688 | "tenant_id": id_schema, #only valid for admin |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 689 | "public": boolean_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 690 | "topology":{ |
| 691 | "type":"object", |
| 692 | "properties":{ |
| 693 | "nodes": { |
| 694 | "type":"object", |
| 695 | "patternProperties":{ |
| 696 | ".": { |
| 697 | "type": "object", |
| 698 | "properties":{ |
| 699 | "type":{"type":"string", "enum":["VNF", "other_network", "network", "external_network"]}, |
| 700 | "vnf_id": id_schema, |
| 701 | "graph": graph_schema, |
| 702 | }, |
| 703 | "patternProperties":{ |
| 704 | "^(VNF )?model$": {"type": "string"} |
| 705 | }, |
| 706 | "required": ["type"] |
| 707 | } |
| 708 | } |
| 709 | }, |
| 710 | "connections": { |
| 711 | "type":"object", |
| 712 | "patternProperties":{ |
| 713 | ".": { |
| 714 | "type": "object", |
| 715 | "properties":{ |
| 716 | "nodes":{"oneOf":[{"type":"object", "minProperties":2}, {"type":"array", "minLength":1}]}, |
| 717 | "type": {"type": "string", "enum":["link", "external_network", "dataplane_net", "bridge_net"]}, |
| 718 | "graph": graph_schema |
| 719 | }, |
| 720 | "required": ["nodes"] |
| 721 | }, |
| 722 | } |
| 723 | } |
| 724 | }, |
| 725 | "required": ["nodes"], |
| 726 | "additionalProperties": False |
| 727 | } |
| 728 | }, |
| 729 | "required": ["name","topology"], |
| 730 | "additionalProperties": False |
| 731 | } |
| 732 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 733 | nsd_schema_v02 = { |
| 734 | "title":"network scenario descriptor information schema v0.2", |
| 735 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 736 | "type":"object", |
| 737 | "properties":{ |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 738 | "schema_version": schema_version_2, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 739 | "scenario":{ |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 740 | "type":"object", |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 741 | "properties":{ |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 742 | "name": name_schema, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 743 | "description": description_schema, |
| 744 | "tenant_id": id_schema, #only valid for admin |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 745 | "public": boolean_schema, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 746 | "vnfs": { |
| 747 | "type":"object", |
| 748 | "patternProperties":{ |
| 749 | ".": { |
| 750 | "type": "object", |
| 751 | "properties":{ |
| 752 | "vnf_id": id_schema, |
| 753 | "graph": graph_schema, |
| 754 | "vnf_name": name_schema, |
| 755 | }, |
| 756 | } |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 757 | }, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 758 | "minProperties": 1 |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 759 | }, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 760 | "networks": { |
| 761 | "type":"object", |
| 762 | "patternProperties":{ |
| 763 | ".": { |
| 764 | "type": "object", |
| 765 | "properties":{ |
| 766 | "interfaces":{"type":"array", "minLength":1}, |
| 767 | "type": {"type": "string", "enum":["dataplane", "bridge"]}, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 768 | "external" : boolean_schema, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 769 | "graph": graph_schema |
| 770 | }, |
| 771 | "required": ["interfaces"] |
| 772 | }, |
| 773 | } |
| 774 | }, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 775 | |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 776 | }, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 777 | "required": ["vnfs", "name"], |
| 778 | "additionalProperties": False |
| 779 | } |
| 780 | }, |
| 781 | "required": ["scenario","schema_version"], |
| 782 | "additionalProperties": False |
| 783 | } |
| 784 | |
| 785 | #NSD schema for OSM R1 |
| 786 | nsd_schema_v03 = { |
| 787 | "title":"network scenario descriptor information schema v0.3", |
| 788 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 789 | "type":"object", |
| 790 | "properties":{ |
| 791 | "schema_version": {"type": "string", "enum": ["0.3"]}, |
| 792 | "scenario":{ |
| 793 | "type":"object", |
| 794 | "properties":{ |
| 795 | "name": name_schema, |
| 796 | "description": description_schema, |
| 797 | "tenant_id": id_schema, #only valid for admin |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 798 | "public": boolean_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 799 | "cloud-config": cloud_config_schema, #common for all vnfs in the scenario |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 800 | #"datacenter": name_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 801 | "vnfs": { |
| 802 | "type":"object", |
| 803 | "patternProperties":{ |
| 804 | ".": { |
| 805 | "type": "object", |
| 806 | "properties":{ |
| 807 | "vnf_id": id_schema, |
| 808 | "graph": graph_schema, |
| 809 | "vnf_name": name_schema, |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 810 | #"cloud-config": cloud_config_schema, #particular for a vnf |
| 811 | #"datacenter": name_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 812 | "internal-connections": { |
| 813 | "type": "object", |
| 814 | "patternProperties": { |
| 815 | ".": { |
| 816 | "type": "object", |
| 817 | "properties": { |
| 818 | "ip-profile": ip_profile_schema, |
| 819 | "elements": { |
| 820 | "type" : "array", |
| 821 | "items":{ |
| 822 | "type":"object", |
| 823 | "properties":{ |
| 824 | "VNFC": name_schema, |
| 825 | "local_iface_name": name_schema, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 826 | "ip_address": ip_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 827 | }, |
| 828 | "required": ["VNFC", "local_iface_name"], |
| 829 | } |
| 830 | } |
| 831 | } |
| 832 | } |
| 833 | } |
| 834 | } |
| 835 | }, |
| 836 | } |
| 837 | }, |
| 838 | "minProperties": 1 |
| 839 | }, |
| 840 | "networks": { |
| 841 | "type":"object", |
| 842 | "patternProperties":{ |
| 843 | ".": { |
| 844 | "type": "object", |
| 845 | "properties":{ |
| 846 | "interfaces":{ |
| 847 | "type":"array", |
| 848 | "minLength":1, |
| 849 | "items":{ |
| 850 | "type":"object", |
| 851 | "properties":{ |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 852 | "vnf": name_schema, |
| 853 | "vnf_interface": name_schema, |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 854 | "ip_address": ip_schema |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 855 | }, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 856 | "required": ["vnf", "vnf_interface"], |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 857 | } |
| 858 | }, |
| 859 | "type": {"type": "string", "enum":["e-line", "e-lan"]}, |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 860 | "implementation": {"type": "string", "enum":["overlay", "underlay"]}, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 861 | "external" : boolean_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 862 | "graph": graph_schema, |
| 863 | "ip-profile": ip_profile_schema |
| 864 | }, |
| 865 | "required": ["interfaces"] |
| 866 | }, |
| 867 | } |
| 868 | }, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 869 | |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 870 | }, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 871 | "required": ["vnfs", "networks","name"], |
| 872 | "additionalProperties": False |
| 873 | } |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 874 | }, |
| tierno | 392f285 | 2016-05-13 12:28:55 +0200 | [diff] [blame] | 875 | "required": ["scenario","schema_version"], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 876 | "additionalProperties": False |
| 877 | } |
| 878 | |
| 879 | #scenario_new_schema = { |
| 880 | # "title":"new scenario information schema", |
| 881 | # "$schema": "http://json-schema.org/draft-04/schema#", |
| 882 | # #"oneOf": [nsd_schema_v01, nsd_schema_v02] |
| 883 | # "oneOf": [nsd_schema_v01] |
| 884 | #} |
| 885 | |
| 886 | scenario_edit_schema = { |
| 887 | "title":"edit scenario information schema", |
| 888 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 889 | "type":"object", |
| 890 | "properties":{ |
| 891 | "name":name_schema, |
| 892 | "description": description_schema, |
| 893 | "topology":{ |
| 894 | "type":"object", |
| 895 | "properties":{ |
| 896 | "nodes": { |
| 897 | "type":"object", |
| 898 | "patternProperties":{ |
| 899 | "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$": { |
| 900 | "type":"object", |
| 901 | "properties":{ |
| 902 | "graph":{ |
| 903 | "type": "object", |
| 904 | "properties":{ |
| 905 | "x": integer0_schema, |
| 906 | "y": integer0_schema, |
| 907 | "ifaces":{ "type": "object"} |
| 908 | } |
| 909 | }, |
| 910 | "description": description_schema, |
| 911 | "name": name_schema |
| 912 | } |
| 913 | } |
| 914 | } |
| 915 | } |
| 916 | }, |
| 917 | "required": ["nodes"], |
| 918 | "additionalProperties": False |
| 919 | } |
| 920 | }, |
| 921 | "additionalProperties": False |
| 922 | } |
| 923 | |
| 924 | scenario_action_schema = { |
| 925 | "title":"scenario action information schema", |
| 926 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 927 | "type":"object", |
| 928 | "properties":{ |
| 929 | "start":{ |
| 930 | "type": "object", |
| 931 | "properties": { |
| 932 | "instance_name":name_schema, |
| 933 | "description":description_schema, |
| 934 | "datacenter": {"type": "string"} |
| 935 | }, |
| 936 | "required": ["instance_name"] |
| 937 | }, |
| 938 | "deploy":{ |
| 939 | "type": "object", |
| 940 | "properties": { |
| 941 | "instance_name":name_schema, |
| 942 | "description":description_schema, |
| 943 | "datacenter": {"type": "string"} |
| 944 | }, |
| 945 | "required": ["instance_name"] |
| 946 | }, |
| 947 | "reserve":{ |
| 948 | "type": "object", |
| 949 | "properties": { |
| 950 | "instance_name":name_schema, |
| 951 | "description":description_schema, |
| 952 | "datacenter": {"type": "string"} |
| 953 | }, |
| 954 | "required": ["instance_name"] |
| 955 | }, |
| 956 | "verify":{ |
| 957 | "type": "object", |
| 958 | "properties": { |
| 959 | "instance_name":name_schema, |
| 960 | "description":description_schema, |
| 961 | "datacenter": {"type": "string"} |
| 962 | }, |
| 963 | "required": ["instance_name"] |
| 964 | } |
| 965 | }, |
| 966 | "minProperties": 1, |
| 967 | "maxProperties": 1, |
| 968 | "additionalProperties": False |
| 969 | } |
| 970 | |
| tierno | 7fe8264 | 2018-11-26 14:14:51 +0000 | [diff] [blame] | 971 | instance_scenario_object = { |
| 972 | "title": "scenario object used to create an instance not based on any nsd", |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 973 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | 7fe8264 | 2018-11-26 14:14:51 +0000 | [diff] [blame] | 974 | "type": "object", |
| 975 | "properties": { |
| 976 | "nets": { |
| 977 | "type": "array", |
| 978 | "minLength": 1, |
| 979 | "items": { |
| 980 | "type": "object", |
| 981 | "properties": { |
| 982 | "name": name_schema, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 983 | "external": boolean_schema, |
| tierno | 7fe8264 | 2018-11-26 14:14:51 +0000 | [diff] [blame] | 984 | "type": {"enum": ["bridge", "ptp", "data"]}, # for overlay, underlay E-LINE, underlay E-LAN |
| 985 | }, |
| 986 | "additionalProperties": False, |
| 987 | "required": ["name", "external", "type"] |
| 988 | } |
| 989 | } |
| 990 | }, |
| 991 | "additionalProperties": False, |
| 992 | "required": ["nets"] |
| 993 | } |
| 994 | |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 995 | instance_scenario_create_schema_v01 = { |
| tierno | 67881db | 2018-10-24 18:46:03 +0200 | [diff] [blame] | 996 | "title": "instance scenario create information schema v0.1", |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 997 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | 67881db | 2018-10-24 18:46:03 +0200 | [diff] [blame] | 998 | "type": "object", |
| 999 | "properties": { |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1000 | "schema_version": {"type": "string", "enum": ["0.1"]}, |
| tierno | 67881db | 2018-10-24 18:46:03 +0200 | [diff] [blame] | 1001 | "instance": { |
| 1002 | "type": "object", |
| 1003 | "properties": { |
| 1004 | "mgmt_keys": {"type": "array", "items": {"type":"string"}}, |
| 1005 | "vduImage": name_schema, |
| 1006 | "name": name_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1007 | "description":description_schema, |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 1008 | "datacenter": name_schema, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 1009 | "wim_account": {"oneOf": [boolean_schema, id_schema, null_schema]}, |
| tierno | 7fe8264 | 2018-11-26 14:14:51 +0000 | [diff] [blame] | 1010 | "scenario" : {"oneOff": [name_schema, instance_scenario_object]}, # can be an UUID or name or a dict |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1011 | "action":{"enum": ["deploy","reserve","verify" ]}, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 1012 | "connect_mgmt_interfaces": {"oneOf": [boolean_schema, {"type":"object"}]},# can be true or a dict with datacenter: net_name |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1013 | "cloud-config": cloud_config_schema, #common to all vnfs in the instance scenario |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1014 | "vnfs":{ #mapping from scenario to datacenter |
| 1015 | "type": "object", |
| 1016 | "patternProperties":{ |
| 1017 | ".": { |
| 1018 | "type": "object", |
| 1019 | "properties":{ |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1020 | "name": name_schema, #override vnf name |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 1021 | "datacenter": name_schema, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1022 | #"metadata": {"type": "object"}, |
| 1023 | #"user_data": {"type": "string"} |
| garciadeblas | 0c317ee | 2016-08-29 12:33:06 +0200 | [diff] [blame] | 1024 | #"cloud-config": cloud_config_schema, #particular for a vnf |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 1025 | "vdus": { |
| 1026 | "type": "object", |
| 1027 | "patternProperties": { |
| 1028 | ".": { |
| 1029 | "type": "object", |
| 1030 | "properties": { |
| tierno | 67881db | 2018-10-24 18:46:03 +0200 | [diff] [blame] | 1031 | "name": name_schema, # overrides vdu name schema |
| 1032 | "mgmt_keys": {"type": "array", "items": {"type": "string"}}, |
| 1033 | "vduImage": name_schema, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 1034 | "devices": { |
| 1035 | "type": "object", |
| 1036 | "patternProperties": { |
| 1037 | ".": { |
| 1038 | "vim_id": name_schema, |
| 1039 | } |
| 1040 | } |
| 1041 | }, |
| 1042 | "interfaces": { |
| 1043 | "type": "object", |
| 1044 | "patternProperties": { |
| 1045 | ".": { |
| 1046 | "ip_address": ip_schema, |
| 1047 | "mac_address": mac_schema, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 1048 | "floating-ip": boolean_schema, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 1049 | } |
| 1050 | } |
| 1051 | } |
| 1052 | } |
| 1053 | } |
| 1054 | } |
| 1055 | }, |
| 1056 | "networks": { |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1057 | "type": "object", |
| 1058 | "patternProperties": { |
| 1059 | ".": { |
| 1060 | "type": "object", |
| 1061 | "properties": { |
| 1062 | "vim-network-name": name_schema, |
| gcalvino | 0a48054 | 2018-12-17 16:19:33 +0100 | [diff] [blame] | 1063 | "vim-network-id": name_schema, |
| tierno | 1df468d | 2018-07-06 14:25:16 +0200 | [diff] [blame] | 1064 | "ip-profile": ip_profile_schema, |
| 1065 | "name": name_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1066 | } |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1067 | } |
| 1068 | } |
| 1069 | }, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1070 | } |
| 1071 | } |
| 1072 | }, |
| 1073 | }, |
| 1074 | "networks":{ #mapping from scenario to datacenter |
| 1075 | "type": "object", |
| 1076 | "patternProperties":{ |
| 1077 | ".": { |
| 1078 | "type": "object", |
| 1079 | "properties":{ |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1080 | "interfaces":{ |
| 1081 | "type":"array", |
| 1082 | "minLength":1, |
| 1083 | "items":{ |
| 1084 | "type":"object", |
| 1085 | "properties":{ |
| garciadeblas | 9f8456e | 2016-09-05 05:02:59 +0200 | [diff] [blame] | 1086 | "ip_address": ip_schema, |
| 1087 | "datacenter": name_schema, |
| gcalvino | 0a48054 | 2018-12-17 16:19:33 +0100 | [diff] [blame] | 1088 | "vim-network-name": name_schema, |
| 1089 | "vim-network-id": name_schema |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1090 | }, |
| 1091 | "patternProperties":{ |
| 1092 | ".": {"type": "string"} |
| 1093 | } |
| 1094 | } |
| 1095 | }, |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 1096 | "wim_account": {"oneOf": [boolean_schema, id_schema, null_schema]}, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1097 | "ip-profile": ip_profile_schema, |
| tierno | 3c44e7b | 2019-03-04 17:32:01 +0000 | [diff] [blame] | 1098 | "use-network": { |
| 1099 | "type": "object", |
| 1100 | "properties": { |
| 1101 | "instance_scenario_id": id_schema, |
| 1102 | # "member_vnf_index": name_schema, # if not null, network inside VNF |
| 1103 | "osm_id": name_schema, # sce_network osm_id or name |
| 1104 | }, |
| 1105 | "additionalProperties": False, |
| 1106 | "required": ["instance_scenario_id", "osm_id"] |
| 1107 | }, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1108 | #if the network connects VNFs deployed at different sites, you must specify one entry per site that this network connect to |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1109 | "sites": { |
| 1110 | "type":"array", |
| 1111 | "minLength":1, |
| 1112 | "items":{ |
| 1113 | "type":"object", |
| 1114 | "properties":{ |
| 1115 | # By default for an scenario 'external' network openmano looks for an existing VIM network to map this external scenario network, |
| 1116 | # for other networks openamno creates at VIM |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1117 | # Use netmap-create to force to create an external scenario network |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 1118 | "netmap-create": {"oneOf":[name_schema,null_schema]}, #datacenter network to use. Null if must be created as an internal net |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1119 | #netmap-use: Indicates an existing VIM network that must be used for this scenario network. |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1120 | #Can use both the VIM network name (if it is not ambiguous) or the VIM net UUID |
| 1121 | #If both 'netmap-create' and 'netmap-use'are supplied, netmap-use precedes, but if fails openmano follows the netmap-create |
| 1122 | #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) |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1123 | "netmap-use": name_schema, # |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1124 | "vim-network-name": name_schema, #override network name |
| gcalvino | 0a48054 | 2018-12-17 16:19:33 +0100 | [diff] [blame] | 1125 | "vim-network-id": name_schema, |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1126 | #"ip-profile": ip_profile_schema, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1127 | "datacenter": name_schema, |
| tierno | be41e22 | 2016-09-02 15:16:13 +0200 | [diff] [blame] | 1128 | } |
| 1129 | } |
| 1130 | }, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1131 | } |
| 1132 | } |
| 1133 | }, |
| 1134 | }, |
| 1135 | }, |
| 1136 | "additionalProperties": False, |
| garciadeblas | fec35df | 2016-08-25 11:33:57 +0200 | [diff] [blame] | 1137 | "required": ["name"] |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1138 | }, |
| 1139 | }, |
| 1140 | "required": ["instance"], |
| 1141 | "additionalProperties": False |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1142 | } |
| 1143 | |
| 1144 | instance_scenario_action_schema = { |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1145 | "title": "instance scenario action information schema", |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1146 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1147 | "type": "object", |
| 1148 | "properties": { |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 1149 | "start": null_schema, |
| 1150 | "pause": null_schema, |
| 1151 | "resume": null_schema, |
| 1152 | "shutoff": null_schema, |
| 1153 | "shutdown": null_schema, |
| 1154 | "forceOff": null_schema, |
| 1155 | "rebuild": null_schema, |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1156 | "reboot": { |
| 1157 | "type": ["object", "null"], |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1158 | }, |
| calvinosanch | 5db670b | 2019-10-13 15:52:33 +0200 | [diff] [blame^] | 1159 | "add_public_key": {"type" : "string"}, |
| tierno | 7e51005 | 2019-09-10 16:16:13 +0000 | [diff] [blame] | 1160 | "user": nameshort_schema, |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1161 | "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]}, |
| tierno | fc5f80b | 2018-05-29 16:00:43 +0200 | [diff] [blame] | 1162 | "vdu-scaling": { |
| gcalvino | e580c7d | 2017-09-22 14:09:51 +0200 | [diff] [blame] | 1163 | "type": "array", |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1164 | "items": { |
| tierno | 868220c | 2017-09-26 00:11:05 +0200 | [diff] [blame] | 1165 | "type": "object", |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1166 | "properties": { |
| tierno | 868220c | 2017-09-26 00:11:05 +0200 | [diff] [blame] | 1167 | "vdu-id": id_schema, |
| tierno | fc5f80b | 2018-05-29 16:00:43 +0200 | [diff] [blame] | 1168 | "osm_vdu_id": name_schema, |
| 1169 | "member-vnf-index": name_schema, |
| tierno | 868220c | 2017-09-26 00:11:05 +0200 | [diff] [blame] | 1170 | "count": integer1_schema, |
| tierno | fc5f80b | 2018-05-29 16:00:43 +0200 | [diff] [blame] | 1171 | "type": {"enum": ["create", "delete"]} |
| tierno | 868220c | 2017-09-26 00:11:05 +0200 | [diff] [blame] | 1172 | }, |
| 1173 | "additionalProperties": False, |
| 1174 | "minProperties": 1, |
| tierno | fc5f80b | 2018-05-29 16:00:43 +0200 | [diff] [blame] | 1175 | "required": ["type"] |
| tierno | 868220c | 2017-09-26 00:11:05 +0200 | [diff] [blame] | 1176 | } |
| 1177 | }, |
| tierno | 16e3dd4 | 2018-04-24 12:52:40 +0200 | [diff] [blame] | 1178 | "vnfs": {"type": "array", "items": {"type": "string"}}, |
| 1179 | "vms": {"type": "array", "items": {"type": "string"}} |
| tierno | 7edb675 | 2016-03-21 17:37:52 +0100 | [diff] [blame] | 1180 | }, |
| 1181 | "minProperties": 1, |
| 1182 | #"maxProperties": 1, |
| 1183 | "additionalProperties": False |
| 1184 | } |
| Pablo Montes Moreno | 3fbff9b | 2017-03-08 11:28:15 +0100 | [diff] [blame] | 1185 | |
| 1186 | sdn_controller_properties={ |
| 1187 | "name": name_schema, |
| Pablo Montes Moreno | 6aa0b2b | 2017-05-23 18:33:12 +0200 | [diff] [blame] | 1188 | "dpid": {"type":"string", "pattern":"^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"}, |
| Pablo Montes Moreno | 3fbff9b | 2017-03-08 11:28:15 +0100 | [diff] [blame] | 1189 | "ip": ip_schema, |
| 1190 | "port": port_schema, |
| 1191 | "type": {"type": "string", "enum": ["opendaylight","floodlight","onos"]}, |
| 1192 | "version": {"type" : "string", "minLength":1, "maxLength":12}, |
| 1193 | "user": nameshort_schema, |
| 1194 | "password": passwd_schema |
| 1195 | } |
| 1196 | sdn_controller_schema = { |
| 1197 | "title":"sdn controller information schema", |
| 1198 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1199 | "type":"object", |
| 1200 | "properties":{ |
| 1201 | "sdn_controller":{ |
| 1202 | "type":"object", |
| 1203 | "properties":sdn_controller_properties, |
| 1204 | "required": ["name", "port", 'ip', 'dpid', 'type'], |
| 1205 | "additionalProperties": False |
| 1206 | } |
| 1207 | }, |
| 1208 | "required": ["sdn_controller"], |
| 1209 | "additionalProperties": False |
| 1210 | } |
| 1211 | |
| 1212 | sdn_controller_edit_schema = { |
| 1213 | "title":"sdn controller update information schema", |
| 1214 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1215 | "type":"object", |
| 1216 | "properties":{ |
| 1217 | "sdn_controller":{ |
| 1218 | "type":"object", |
| 1219 | "properties":sdn_controller_properties, |
| 1220 | "additionalProperties": False |
| 1221 | } |
| 1222 | }, |
| 1223 | "required": ["sdn_controller"], |
| 1224 | "additionalProperties": False |
| 1225 | } |
| 1226 | |
| 1227 | sdn_port_mapping_schema = { |
| 1228 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1229 | "title":"sdn port mapping information schema", |
| 1230 | "type": "object", |
| 1231 | "properties": { |
| 1232 | "sdn_port_mapping": { |
| 1233 | "type": "array", |
| 1234 | "items": { |
| 1235 | "type": "object", |
| 1236 | "properties": { |
| 1237 | "compute_node": nameshort_schema, |
| 1238 | "ports": { |
| 1239 | "type": "array", |
| 1240 | "items": { |
| 1241 | "type": "object", |
| 1242 | "properties": { |
| tierno | fc7cfbf | 2019-03-20 17:23:45 +0000 | [diff] [blame] | 1243 | "pci": {"OneOf": [null_schema, pci_extended_schema]}, # pci_schema, |
| Pablo Montes Moreno | 3fbff9b | 2017-03-08 11:28:15 +0100 | [diff] [blame] | 1244 | "switch_port": nameshort_schema, |
| 1245 | "switch_mac": mac_schema |
| 1246 | }, |
| 1247 | "required": ["pci"] |
| 1248 | } |
| 1249 | } |
| 1250 | }, |
| 1251 | "required": ["compute_node", "ports"] |
| 1252 | } |
| 1253 | } |
| 1254 | }, |
| 1255 | "required": ["sdn_port_mapping"] |
| Pablo Montes Moreno | 6aa0b2b | 2017-05-23 18:33:12 +0200 | [diff] [blame] | 1256 | } |
| 1257 | |
| 1258 | sdn_external_port_schema = { |
| 1259 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1260 | "title":"External port ingformation", |
| 1261 | "type": "object", |
| 1262 | "properties": { |
| 1263 | "port": {"type" : "string", "minLength":1, "maxLength":60}, |
| 1264 | "vlan": vlan_schema, |
| 1265 | "mac": mac_schema |
| 1266 | }, |
| 1267 | "required": ["port"] |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1268 | } |