| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
| tierno | d125caf | 2018-11-22 16:05:54 +0000 | [diff] [blame] | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 12 | # implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 16 | from jsonschema import validate as js_v, exceptions as js_e |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 17 | from http import HTTPStatus |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 18 | from copy import deepcopy |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 19 | from uuid import UUID # To test for valid UUID |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 20 | |
| 21 | __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>" |
| 22 | __version__ = "0.1" |
| 23 | version_date = "Mar 2018" |
| 24 | |
| 25 | """ |
| 26 | Validator of input data using JSON schemas for those items that not contains an OSM yang information model |
| 27 | """ |
| 28 | |
| 29 | # Basis schemas |
| 30 | patern_name = "^[ -~]+$" |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 31 | shortname_schema = { |
| 32 | "type": "string", |
| 33 | "minLength": 1, |
| 34 | "maxLength": 60, |
| 35 | "pattern": "^[^,;()\\.\\$'\"]+$", |
| 36 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 37 | passwd_schema = {"type": "string", "minLength": 1, "maxLength": 60} |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 38 | name_schema = { |
| 39 | "type": "string", |
| 40 | "minLength": 1, |
| 41 | "maxLength": 255, |
| 42 | "pattern": "^[^,;()'\"]+$", |
| 43 | } |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 44 | string_schema = {"type": "string", "minLength": 1, "maxLength": 255} |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 45 | xml_text_schema = { |
| 46 | "type": "string", |
| 47 | "minLength": 1, |
| 48 | "maxLength": 1000, |
| 49 | "pattern": "^[^']+$", |
| 50 | } |
| 51 | description_schema = { |
| 52 | "type": ["string", "null"], |
| 53 | "maxLength": 255, |
| 54 | "pattern": "^[^'\"]+$", |
| 55 | } |
| 56 | long_description_schema = { |
| 57 | "type": ["string", "null"], |
| 58 | "maxLength": 3000, |
| 59 | "pattern": "^[^'\"]+$", |
| 60 | } |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 61 | id_schema_fake = {"type": "string", "minLength": 2, "maxLength": 36} |
| 62 | bool_schema = {"type": "boolean"} |
| 63 | null_schema = {"type": "null"} |
| tierno | 2236d20 | 2018-05-16 19:05:16 +0200 | [diff] [blame] | 64 | # "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}$" |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 65 | id_schema = { |
| 66 | "type": "string", |
| 67 | "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$", |
| 68 | } |
| 69 | time_schema = { |
| 70 | "type": "string", |
| 71 | "pattern": "^[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]([0-5]:){2}", |
| 72 | } |
| 73 | pci_schema = { |
| 74 | "type": "string", |
| 75 | "pattern": "^[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}\\.[0-9a-fA-F]$", |
| 76 | } |
| tierno | 42fce59 | 2018-11-02 09:23:43 +0100 | [diff] [blame] | 77 | # allows [] for wildcards. For that reason huge length limit is set |
| 78 | pci_extended_schema = {"type": "string", "pattern": "^[0-9a-fA-F.:-\\[\\]]{12,40}$"} |
| K Sai Kiran | 990ac46 | 2020-05-20 12:25:12 +0530 | [diff] [blame] | 79 | http_schema = {"type": "string", "pattern": "^(https?|http)://[^'\"=]+$"} |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 80 | bandwidth_schema = {"type": "string", "pattern": "^[0-9]+ *([MG]bps)?$"} |
| 81 | memory_schema = {"type": "string", "pattern": "^[0-9]+ *([MG]i?[Bb])?$"} |
| 82 | integer0_schema = {"type": "integer", "minimum": 0} |
| 83 | integer1_schema = {"type": "integer", "minimum": 1} |
| tierno | 8700604 | 2018-10-24 12:50:20 +0200 | [diff] [blame] | 84 | path_schema = {"type": "string", "pattern": "^(\\.){0,2}(/[^/\"':{}\\(\\)]+)+$"} |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 85 | vlan_schema = {"type": "integer", "minimum": 1, "maximum": 4095} |
| 86 | vlan1000_schema = {"type": "integer", "minimum": 1000, "maximum": 4095} |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 87 | mac_schema = { |
| 88 | "type": "string", |
| 89 | "pattern": "^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){5}$", |
| 90 | } # must be unicast: LSB bit of MSB byte ==0 |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 91 | dpid_Schema = {"type": "string", "pattern": "^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}$"} |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 92 | # mac_schema={"type":"string", "pattern":"^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$"} |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 93 | ip_schema = { |
| 94 | "type": "string", |
| 95 | "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]?)$", |
| 96 | } |
| garciadeblas | 1a01e1f | 2021-10-26 17:27:35 +0200 | [diff] [blame] | 97 | ipv6_schema = { |
| 98 | "type": "string", |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 99 | "pattern": "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))", # noqa: W605 |
| garciadeblas | 1a01e1f | 2021-10-26 17:27:35 +0200 | [diff] [blame] | 100 | } |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 101 | ip_prefix_schema = { |
| 102 | "type": "string", |
| 103 | "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}" |
| 104 | "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/(30|[12]?[0-9])$", |
| 105 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 106 | port_schema = {"type": "integer", "minimum": 1, "maximum": 65534} |
| 107 | object_schema = {"type": "object"} |
| 108 | schema_version_2 = {"type": "integer", "minimum": 2, "maximum": 2} |
| 109 | # schema_version_string={"type":"string","enum": ["0.1", "2", "0.2", "3", "0.3"]} |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 110 | log_level_schema = { |
| 111 | "type": "string", |
| 112 | "enum": ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], |
| 113 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 114 | checksum_schema = {"type": "string", "pattern": "^[0-9a-fA-F]{32}$"} |
| 115 | size_schema = {"type": "integer", "minimum": 1, "maximum": 100} |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 116 | array_edition_schema = { |
| 117 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 118 | "patternProperties": {"^\\$": {}}, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 119 | "additionalProperties": False, |
| 120 | "minProperties": 1, |
| 121 | } |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 122 | nameshort_list_schema = { |
| 123 | "type": "array", |
| 124 | "minItems": 1, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 125 | "items": shortname_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 126 | } |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 127 | |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 128 | description_list_schema = { |
| 129 | "type": "array", |
| 130 | "minItems": 1, |
| 131 | "items": description_schema, |
| 132 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 133 | |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 134 | ns_instantiate_vdu = { |
| 135 | "title": "ns action instantiate input schema for vdu", |
| 136 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 137 | "type": "object", |
| 138 | "properties": { |
| 139 | "id": name_schema, |
| Gulsum Atici | a744b75 | 2023-04-28 10:47:36 +0300 | [diff] [blame] | 140 | "configurable-properties": { |
| 141 | "type": "object", |
| 142 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 143 | "volume": { |
| 144 | "type": "array", |
| 145 | "minItems": 1, |
| 146 | "items": { |
| 147 | "type": "object", |
| 148 | "properties": { |
| 149 | "name": name_schema, |
| 150 | "vim-volume-id": name_schema, |
| 151 | }, |
| 152 | "required": ["name", "vim-volume-id"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 153 | "additionalProperties": False, |
| 154 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 155 | }, |
| 156 | "interface": { |
| 157 | "type": "array", |
| 158 | "minItems": 1, |
| 159 | "items": { |
| 160 | "type": "object", |
| 161 | "properties": { |
| 162 | "name": name_schema, |
| garciadeblas | 9fb3271 | 2022-04-04 16:33:59 +0200 | [diff] [blame] | 163 | "ip-address": {"oneOf": [ip_schema, ipv6_schema]}, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 164 | "mac-address": mac_schema, |
| 165 | "floating-ip-required": bool_schema, |
| 166 | }, |
| 167 | "required": ["name"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 168 | "additionalProperties": False, |
| 169 | }, |
| 170 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 171 | }, |
| 172 | "required": ["id"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 173 | "additionalProperties": False, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | ip_profile_dns_schema = { |
| 177 | "type": "array", |
| 178 | "minItems": 1, |
| 179 | "items": { |
| 180 | "type": "object", |
| 181 | "properties": { |
| garciadeblas | 9fb3271 | 2022-04-04 16:33:59 +0200 | [diff] [blame] | 182 | "address": {"oneOf": [ip_schema, ipv6_schema]}, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 183 | }, |
| 184 | "required": ["address"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 185 | "additionalProperties": False, |
| 186 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | ip_profile_dhcp_schema = { |
| 190 | "type": "object", |
| 191 | "properties": { |
| 192 | "enabled": {"type": "boolean"}, |
| 193 | "count": integer1_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 194 | "start-address": ip_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 195 | }, |
| 196 | "additionalProperties": False, |
| 197 | } |
| 198 | |
| 199 | ip_profile_schema = { |
| tierno | 2a92904 | 2020-03-10 16:34:25 +0000 | [diff] [blame] | 200 | "title": "ip profile validation schema", |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 201 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 202 | "type": "object", |
| 203 | "properties": { |
| 204 | "ip-version": {"enum": ["ipv4", "ipv6"]}, |
| 205 | "subnet-address": ip_prefix_schema, |
| 206 | "gateway-address": ip_schema, |
| 207 | "dns-server": ip_profile_dns_schema, |
| 208 | "dhcp-params": ip_profile_dhcp_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 209 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | ip_profile_update_schema = { |
| tierno | 2a92904 | 2020-03-10 16:34:25 +0000 | [diff] [blame] | 213 | "title": "ip profile validation schema", |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 214 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 215 | "type": "object", |
| 216 | "properties": { |
| 217 | "ip-version": {"enum": ["ipv4", "ipv6"]}, |
| 218 | "subnet-address": {"oneOf": [null_schema, ip_prefix_schema]}, |
| 219 | "gateway-address": {"oneOf": [null_schema, ip_schema]}, |
| 220 | "dns-server": {"oneOf": [null_schema, ip_profile_dns_schema]}, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 221 | "dhcp-params": {"oneOf": [null_schema, ip_profile_dhcp_schema]}, |
| 222 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 223 | "additionalProperties": False, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 224 | } |
| 225 | |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 226 | provider_network_schema = { |
| tierno | 2a92904 | 2020-03-10 16:34:25 +0000 | [diff] [blame] | 227 | "title": "provider network validation schema", |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 228 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 229 | "type": "object", |
| 230 | "properties": { |
| 231 | "physical-network": name_schema, |
| 232 | "segmentation-id": name_schema, |
| tierno | 2a92904 | 2020-03-10 16:34:25 +0000 | [diff] [blame] | 233 | "sdn-ports": { # external ports to append to the SDN-assist network |
| 234 | "type": "array", |
| 235 | "items": { |
| 236 | "type": "object", |
| 237 | "properties": { |
| 238 | "switch_id": shortname_schema, |
| 239 | "switch_port": shortname_schema, |
| 240 | "mac_address": mac_schema, |
| 241 | "vlan": vlan_schema, |
| 242 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 243 | "additionalProperties": True, |
| 244 | }, |
| tierno | 2a92904 | 2020-03-10 16:34:25 +0000 | [diff] [blame] | 245 | }, |
| 246 | "network-type": shortname_schema, |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 247 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 248 | "additionalProperties": True, |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 249 | } |
| 250 | |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 251 | ns_instantiate_internal_vld = { |
| garciadeblas | 9fb3271 | 2022-04-04 16:33:59 +0200 | [diff] [blame] | 252 | "title": "ns action instantiate input schema for vld", |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 253 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 254 | "type": "object", |
| 255 | "properties": { |
| 256 | "name": name_schema, |
| 257 | "vim-network-name": name_schema, |
| gcalvino | 17d5b73 | 2018-12-17 16:26:21 +0100 | [diff] [blame] | 258 | "vim-network-id": name_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 259 | "ip-profile": ip_profile_update_schema, |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 260 | "provider-network": provider_network_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 261 | "internal-connection-point": { |
| 262 | "type": "array", |
| 263 | "minItems": 1, |
| 264 | "items": { |
| 265 | "type": "object", |
| 266 | "properties": { |
| 267 | "id-ref": name_schema, |
| 268 | "ip-address": ip_schema, |
| tierno | b7c6f2a | 2018-09-03 14:32:10 +0200 | [diff] [blame] | 269 | # "mac-address": mac_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 270 | }, |
| tierno | b7c6f2a | 2018-09-03 14:32:10 +0200 | [diff] [blame] | 271 | "required": ["id-ref"], |
| 272 | "minProperties": 2, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 273 | "additionalProperties": False, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 274 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 275 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 276 | }, |
| 277 | "required": ["name"], |
| 278 | "minProperties": 2, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 279 | "additionalProperties": False, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 280 | } |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 281 | |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 282 | additional_params_for_vnf = { |
| 283 | "type": "array", |
| 284 | "items": { |
| 285 | "type": "object", |
| 286 | "properties": { |
| 287 | "member-vnf-index": name_schema, |
| 288 | "additionalParams": object_schema, |
| tierno | 54db2e4 | 2020-04-06 15:29:42 +0000 | [diff] [blame] | 289 | "k8s-namespace": name_schema, |
| tierno | f62ac6a | 2020-04-29 13:46:13 +0000 | [diff] [blame] | 290 | "config-units": integer1_schema, # number of configuration units of this vnf, by default 1 |
| tierno | 714954e | 2019-11-29 13:43:26 +0000 | [diff] [blame] | 291 | "additionalParamsForVdu": { |
| 292 | "type": "array", |
| 293 | "items": { |
| 294 | "type": "object", |
| 295 | "properties": { |
| 296 | "vdu_id": name_schema, |
| 297 | "additionalParams": object_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 298 | "config-units": integer1_schema, # number of configuration units of this vdu, by default 1 |
| tierno | 714954e | 2019-11-29 13:43:26 +0000 | [diff] [blame] | 299 | }, |
| tierno | f62ac6a | 2020-04-29 13:46:13 +0000 | [diff] [blame] | 300 | "required": ["vdu_id"], |
| 301 | "minProperties": 2, |
| tierno | 714954e | 2019-11-29 13:43:26 +0000 | [diff] [blame] | 302 | "additionalProperties": False, |
| 303 | }, |
| 304 | }, |
| 305 | "additionalParamsForKdu": { |
| 306 | "type": "array", |
| 307 | "items": { |
| 308 | "type": "object", |
| 309 | "properties": { |
| 310 | "kdu_name": name_schema, |
| 311 | "additionalParams": object_schema, |
| tierno | 54db2e4 | 2020-04-06 15:29:42 +0000 | [diff] [blame] | 312 | "kdu_model": name_schema, |
| 313 | "k8s-namespace": name_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 314 | "config-units": integer1_schema, # number of configuration units of this knf, by default 1 |
| romeromonser | bfebfc0 | 2021-05-28 10:51:35 +0200 | [diff] [blame] | 315 | "kdu-deployment-name": name_schema, |
| tierno | 714954e | 2019-11-29 13:43:26 +0000 | [diff] [blame] | 316 | }, |
| tierno | 54db2e4 | 2020-04-06 15:29:42 +0000 | [diff] [blame] | 317 | "required": ["kdu_name"], |
| 318 | "minProperties": 2, |
| tierno | 714954e | 2019-11-29 13:43:26 +0000 | [diff] [blame] | 319 | "additionalProperties": False, |
| 320 | }, |
| 321 | }, |
| Alexis Romero | ee31f53 | 2022-04-26 19:10:21 +0200 | [diff] [blame] | 322 | "affinity-or-anti-affinity-group": { |
| 323 | "type": "array", |
| 324 | "items": { |
| 325 | "type": "object", |
| 326 | "properties": { |
| 327 | "id": name_schema, |
| 328 | "vim-affinity-group-id": name_schema, |
| 329 | }, |
| 330 | "required": ["id"], |
| 331 | "minProperties": 2, |
| 332 | "additionalProperties": False, |
| 333 | }, |
| 334 | }, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 335 | }, |
| tierno | 714954e | 2019-11-29 13:43:26 +0000 | [diff] [blame] | 336 | "required": ["member-vnf-index"], |
| 337 | "minProperties": 2, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 338 | "additionalProperties": False, |
| 339 | }, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 340 | } |
| 341 | |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 342 | ns_instantiate = { |
| 343 | "title": "ns action instantiate input schema", |
| 344 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 345 | "type": "object", |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 346 | "properties": { |
| tierno | b24258a | 2018-10-04 18:39:49 +0200 | [diff] [blame] | 347 | "lcmOperationType": string_schema, |
| 348 | "nsInstanceId": id_schema, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 349 | "netsliceInstanceId": id_schema, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 350 | "nsName": name_schema, |
| tierno | 4f9d4ae | 2019-03-20 17:24:11 +0000 | [diff] [blame] | 351 | "nsDescription": {"oneOf": [description_schema, null_schema]}, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 352 | "nsdId": id_schema, |
| 353 | "vimAccountId": id_schema, |
| tierno | 195a36c | 2020-09-18 14:18:55 +0000 | [diff] [blame] | 354 | "wimAccountId": {"oneOf": [id_schema, bool_schema, null_schema]}, |
| magnussonl | f318b30 | 2020-01-20 18:38:18 +0100 | [diff] [blame] | 355 | "placement-engine": string_schema, |
| 356 | "placement-constraints": object_schema, |
| tierno | bee085c | 2018-12-12 17:03:04 +0000 | [diff] [blame] | 357 | "additionalParamsForNs": object_schema, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 358 | "additionalParamsForVnf": additional_params_for_vnf, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 359 | "config-units": integer1_schema, # number of configuration units of this ns, by default 1 |
| tierno | 54db2e4 | 2020-04-06 15:29:42 +0000 | [diff] [blame] | 360 | "k8s-namespace": name_schema, |
| tierno | fc5089c | 2018-10-31 09:28:11 +0100 | [diff] [blame] | 361 | "ssh_keys": {"type": "array", "items": {"type": "string"}}, |
| tierno | a8186a5 | 2020-01-14 15:54:48 +0000 | [diff] [blame] | 362 | "timeout_ns_deploy": integer1_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 363 | "nsr_id": id_schema, |
| tierno | cc10343 | 2018-10-19 14:10:35 +0200 | [diff] [blame] | 364 | "vduImage": name_schema, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 365 | "vnf": { |
| 366 | "type": "array", |
| 367 | "minItems": 1, |
| 368 | "items": { |
| 369 | "type": "object", |
| 370 | "properties": { |
| 371 | "member-vnf-index": name_schema, |
| 372 | "vimAccountId": id_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 373 | "vdu": { |
| 374 | "type": "array", |
| 375 | "minItems": 1, |
| 376 | "items": ns_instantiate_vdu, |
| 377 | }, |
| 378 | "internal-vld": { |
| 379 | "type": "array", |
| 380 | "minItems": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 381 | "items": ns_instantiate_internal_vld, |
| 382 | }, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 383 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 384 | "required": ["member-vnf-index"], |
| 385 | "minProperties": 2, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 386 | "additionalProperties": False, |
| 387 | }, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 388 | }, |
| 389 | "vld": { |
| 390 | "type": "array", |
| 391 | "minItems": 1, |
| 392 | "items": { |
| 393 | "type": "object", |
| 394 | "properties": { |
| 395 | "name": string_schema, |
| tierno | 195a36c | 2020-09-18 14:18:55 +0000 | [diff] [blame] | 396 | "vim-network-name": {"oneOf": [string_schema, object_schema]}, |
| 397 | "vim-network-id": {"oneOf": [string_schema, object_schema]}, |
| Felipe Vicens | 09e6542 | 2019-01-22 15:06:46 +0100 | [diff] [blame] | 398 | "ns-net": object_schema, |
| tierno | 195a36c | 2020-09-18 14:18:55 +0000 | [diff] [blame] | 399 | "wimAccountId": {"oneOf": [id_schema, bool_schema, null_schema]}, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 400 | "ip-profile": object_schema, |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 401 | "provider-network": provider_network_schema, |
| tierno | b7c6f2a | 2018-09-03 14:32:10 +0200 | [diff] [blame] | 402 | "vnfd-connection-point-ref": { |
| 403 | "type": "array", |
| 404 | "minItems": 1, |
| 405 | "items": { |
| 406 | "type": "object", |
| 407 | "properties": { |
| 408 | "member-vnf-index-ref": name_schema, |
| 409 | "vnfd-connection-point-ref": name_schema, |
| garciadeblas | 9fb3271 | 2022-04-04 16:33:59 +0200 | [diff] [blame] | 410 | "ip-address": {"oneOf": [ip_schema, ipv6_schema]}, |
| tierno | b7c6f2a | 2018-09-03 14:32:10 +0200 | [diff] [blame] | 411 | # "mac-address": mac_schema, |
| 412 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 413 | "required": [ |
| 414 | "member-vnf-index-ref", |
| 415 | "vnfd-connection-point-ref", |
| 416 | ], |
| tierno | b7c6f2a | 2018-09-03 14:32:10 +0200 | [diff] [blame] | 417 | "minProperties": 3, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 418 | "additionalProperties": False, |
| tierno | b7c6f2a | 2018-09-03 14:32:10 +0200 | [diff] [blame] | 419 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 420 | }, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 421 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 422 | "required": ["name"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 423 | "additionalProperties": False, |
| 424 | }, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 425 | }, |
| 426 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 427 | "required": ["nsName", "nsdId", "vimAccountId"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 428 | "additionalProperties": False, |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 429 | } |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 430 | |
| tierno | 1c38f2f | 2020-03-24 11:51:39 +0000 | [diff] [blame] | 431 | ns_terminate = { |
| 432 | "title": "ns terminate input schema", |
| 433 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 434 | "type": "object", |
| 435 | "properties": { |
| 436 | "lcmOperationType": string_schema, |
| 437 | "nsInstanceId": id_schema, |
| 438 | "autoremove": bool_schema, |
| 439 | "timeout_ns_terminate": integer1_schema, |
| 440 | "skip_terminate_primitives": bool_schema, |
| tierno | 0b8752f | 2020-05-12 09:42:02 +0000 | [diff] [blame] | 441 | "netsliceInstanceId": id_schema, |
| tierno | 1c38f2f | 2020-03-24 11:51:39 +0000 | [diff] [blame] | 442 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 443 | "additionalProperties": False, |
| tierno | 1c38f2f | 2020-03-24 11:51:39 +0000 | [diff] [blame] | 444 | } |
| 445 | |
| aticig | 544a2ae | 2022-04-05 09:00:17 +0300 | [diff] [blame] | 446 | ns_update = { |
| 447 | "title": "ns update input schema", |
| 448 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 449 | "type": "object", |
| 450 | "properties": { |
| 451 | "lcmOperationType": string_schema, |
| 452 | "nsInstanceId": id_schema, |
| garciadeblas | eab1507 | 2022-05-19 10:31:52 +0200 | [diff] [blame] | 453 | "timeout_ns_update": integer1_schema, |
| aticig | 544a2ae | 2022-04-05 09:00:17 +0300 | [diff] [blame] | 454 | "updateType": { |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 455 | "enum": [ |
| 456 | "CHANGE_VNFPKG", |
| 457 | "REMOVE_VNF", |
| 458 | "MODIFY_VNF_INFORMATION", |
| 459 | "OPERATE_VNF", |
| 460 | ] |
| aticig | 544a2ae | 2022-04-05 09:00:17 +0300 | [diff] [blame] | 461 | }, |
| 462 | "modifyVnfInfoData": { |
| 463 | "type": "object", |
| 464 | "properties": { |
| 465 | "vnfInstanceId": id_schema, |
| 466 | "vnfdId": id_schema, |
| 467 | }, |
| 468 | "required": ["vnfInstanceId", "vnfdId"], |
| 469 | }, |
| 470 | "removeVnfInstanceId": id_schema, |
| 471 | "changeVnfPackageData": { |
| 472 | "type": "object", |
| 473 | "properties": { |
| 474 | "vnfInstanceId": id_schema, |
| 475 | "vnfdId": id_schema, |
| 476 | }, |
| 477 | "required": ["vnfInstanceId", "vnfdId"], |
| 478 | }, |
| k4.rahul | e3dca38 | 2022-04-29 12:30:36 +0000 | [diff] [blame] | 479 | "operateVnfData": { |
| 480 | "type": "object", |
| 481 | "properties": { |
| 482 | "vnfInstanceId": id_schema, |
| 483 | "changeStateTo": name_schema, |
| 484 | "additionalParam": { |
| 485 | "type": "object", |
| 486 | "properties": { |
| 487 | "run-day1": bool_schema, |
| 488 | "vdu_id": name_schema, |
| 489 | "count-index": integer0_schema, |
| 490 | }, |
| 491 | "required": ["vdu_id", "count-index"], |
| 492 | "additionalProperties": False, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 493 | }, |
| k4.rahul | e3dca38 | 2022-04-29 12:30:36 +0000 | [diff] [blame] | 494 | }, |
| 495 | "required": ["vnfInstanceId", "changeStateTo"], |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 496 | }, |
| aticig | 544a2ae | 2022-04-05 09:00:17 +0300 | [diff] [blame] | 497 | }, |
| 498 | "required": ["updateType"], |
| 499 | "additionalProperties": False, |
| 500 | } |
| 501 | |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 502 | ns_action = { # TODO for the moment it is only contemplated the vnfd primitive execution |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 503 | "title": "ns action input schema", |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 504 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 505 | "type": "object", |
| 506 | "properties": { |
| tierno | b24258a | 2018-10-04 18:39:49 +0200 | [diff] [blame] | 507 | "lcmOperationType": string_schema, |
| 508 | "nsInstanceId": id_schema, |
| tierno | f5298be | 2018-05-16 14:43:57 +0200 | [diff] [blame] | 509 | "member_vnf_index": name_schema, |
| 510 | "vnf_member_index": name_schema, # TODO for backward compatibility. To remove in future |
| tierno | 7ce1db9 | 2018-07-25 12:50:52 +0200 | [diff] [blame] | 511 | "vdu_id": name_schema, |
| tierno | f063705 | 2019-03-07 16:26:47 +0000 | [diff] [blame] | 512 | "vdu_count_index": integer0_schema, |
| tierno | 9cb7d67 | 2019-10-30 12:13:48 +0000 | [diff] [blame] | 513 | "kdu_name": name_schema, |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 514 | "primitive": name_schema, |
| tierno | 50c8e6e | 2020-04-02 15:40:12 +0000 | [diff] [blame] | 515 | "timeout_ns_action": integer1_schema, |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 516 | "primitive_params": {"type": "object"}, |
| 517 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 518 | "required": ["primitive", "primitive_params"], # TODO add member_vnf_index |
| 519 | "additionalProperties": False, |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 520 | } |
| garciadeblas | 0964edf | 2022-02-11 00:43:44 +0100 | [diff] [blame] | 521 | |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 522 | ns_scale = { # TODO for the moment it is only VDU-scaling |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 523 | "title": "ns scale input schema", |
| 524 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 525 | "type": "object", |
| 526 | "properties": { |
| tierno | b24258a | 2018-10-04 18:39:49 +0200 | [diff] [blame] | 527 | "lcmOperationType": string_schema, |
| 528 | "nsInstanceId": id_schema, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 529 | "scaleType": {"enum": ["SCALE_VNF"]}, |
| tierno | 50c8e6e | 2020-04-02 15:40:12 +0000 | [diff] [blame] | 530 | "timeout_ns_scale": integer1_schema, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 531 | "scaleVnfData": { |
| 532 | "type": "object", |
| 533 | "properties": { |
| 534 | "vnfInstanceId": name_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 535 | "scaleVnfType": {"enum": ["SCALE_OUT", "SCALE_IN"]}, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 536 | "scaleByStepData": { |
| 537 | "type": "object", |
| 538 | "properties": { |
| 539 | "scaling-group-descriptor": name_schema, |
| 540 | "member-vnf-index": name_schema, |
| 541 | "scaling-policy": name_schema, |
| 542 | }, |
| 543 | "required": ["scaling-group-descriptor", "member-vnf-index"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 544 | "additionalProperties": False, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 545 | }, |
| 546 | }, |
| 547 | "required": ["scaleVnfType", "scaleByStepData"], # vnfInstanceId |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 548 | "additionalProperties": False, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 549 | }, |
| 550 | "scaleTime": time_schema, |
| 551 | }, |
| 552 | "required": ["scaleType", "scaleVnfData"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 553 | "additionalProperties": False, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 554 | } |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 555 | |
| elumalai | 8e3806c | 2022-04-28 17:26:24 +0530 | [diff] [blame] | 556 | ns_migrate = { |
| 557 | "title": "ns migrate input schema", |
| 558 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 559 | "type": "object", |
| 560 | "properties": { |
| 561 | "lcmOperationType": string_schema, |
| 562 | "nsInstanceId": id_schema, |
| 563 | "vnfInstanceId": id_schema, |
| 564 | "migrateToHost": string_schema, |
| 565 | "vdu": { |
| 566 | "type": "object", |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 567 | "properties": { |
| 568 | "vduId": name_schema, |
| 569 | "vduCountIndex": integer0_schema, |
| 570 | }, |
| 571 | "required": ["vduId"], |
| 572 | "additionalProperties": False, |
| elumalai | 8e3806c | 2022-04-28 17:26:24 +0530 | [diff] [blame] | 573 | }, |
| 574 | }, |
| 575 | "required": ["vnfInstanceId"], |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 576 | "additionalProperties": False, |
| elumalai | 8e3806c | 2022-04-28 17:26:24 +0530 | [diff] [blame] | 577 | } |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 578 | |
| garciadeblas | 0964edf | 2022-02-11 00:43:44 +0100 | [diff] [blame] | 579 | ns_heal = { |
| 580 | "title": "ns heal input schema", |
| 581 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 582 | "type": "object", |
| 583 | "properties": { |
| 584 | "lcmOperationType": string_schema, |
| 585 | "nsInstanceId": id_schema, |
| 586 | "timeout_ns_heal": integer1_schema, |
| 587 | "healVnfData": { |
| 588 | "type": "array", |
| 589 | "items": { |
| 590 | "type": "object", |
| 591 | "properties": { |
| 592 | "vnfInstanceId": id_schema, |
| 593 | "cause": description_schema, |
| 594 | "additionalParams": { |
| 595 | "type": "object", |
| 596 | "properties": { |
| 597 | "run-day1": bool_schema, |
| 598 | "vdu": { |
| 599 | "type": "array", |
| 600 | "items": { |
| 601 | "type": "object", |
| 602 | "properties": { |
| 603 | "run-day1": bool_schema, |
| 604 | "vdu-id": name_schema, |
| 605 | "count-index": integer0_schema, |
| 606 | }, |
| 607 | "required": ["vdu-id"], |
| 608 | "additionalProperties": False, |
| 609 | }, |
| 610 | }, |
| 611 | }, |
| 612 | "additionalProperties": False, |
| 613 | }, |
| 614 | }, |
| 615 | "required": ["vnfInstanceId"], |
| 616 | "additionalProperties": False, |
| 617 | }, |
| 618 | }, |
| 619 | }, |
| 620 | "required": ["healVnfData"], |
| 621 | "additionalProperties": False, |
| 622 | } |
| 623 | |
| govindarajul | 519da48 | 2022-04-29 19:05:22 +0530 | [diff] [blame] | 624 | ns_verticalscale = { |
| 625 | "title": "vertial scale input schema", |
| 626 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 627 | "type": "object", |
| 628 | "properties": { |
| 629 | "lcmOperationType": string_schema, |
| govindarajul | 69964ec | 2022-07-06 10:24:38 +0000 | [diff] [blame] | 630 | "verticalScale": string_schema, |
| govindarajul | 519da48 | 2022-04-29 19:05:22 +0530 | [diff] [blame] | 631 | "nsInstanceId": id_schema, |
| govindarajul | 69964ec | 2022-07-06 10:24:38 +0000 | [diff] [blame] | 632 | "changeVnfFlavorData": { |
| govindarajul | 519da48 | 2022-04-29 19:05:22 +0530 | [diff] [blame] | 633 | "type": "object", |
| govindarajul | 69964ec | 2022-07-06 10:24:38 +0000 | [diff] [blame] | 634 | "properties": { |
| 635 | "vnfInstanceId": id_schema, |
| 636 | "additionalParams": { |
| 637 | "type": "object", |
| 638 | "properties": { |
| 639 | "vduid": string_schema, |
| 640 | "vduCountIndex": integer0_schema, |
| 641 | "virtualMemory": integer1_schema, |
| 642 | "sizeOfStorage": integer0_schema, |
| 643 | "numVirtualCpu": integer1_schema, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 644 | }, |
| govindarajul | 519da48 | 2022-04-29 19:05:22 +0530 | [diff] [blame] | 645 | }, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 646 | }, |
| govindarajul | 69964ec | 2022-07-06 10:24:38 +0000 | [diff] [blame] | 647 | "required": ["vnfInstanceId", "additionalParams"], |
| 648 | "additionalProperties": False, |
| govindarajul | 519da48 | 2022-04-29 19:05:22 +0530 | [diff] [blame] | 649 | }, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 650 | }, |
| govindarajul | 69964ec | 2022-07-06 10:24:38 +0000 | [diff] [blame] | 651 | "required": ["lcmOperationType", "verticalScale", "nsInstanceId"], |
| 652 | "additionalProperties": False, |
| govindarajul | 519da48 | 2022-04-29 19:05:22 +0530 | [diff] [blame] | 653 | } |
| 654 | |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 655 | schema_version = {"type": "string", "enum": ["1.0"]} |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 656 | schema_type = {"type": "string"} |
| tierno | b3d0a0e | 2019-11-13 15:57:51 +0000 | [diff] [blame] | 657 | vim_type = shortname_schema # {"enum": ["openstack", "openvim", "vmware", "opennebula", "aws", "azure", "fos"]} |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 658 | |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 659 | vim_account_edit_schema = { |
| 660 | "title": "vim_account edit input schema", |
| 661 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 662 | "type": "object", |
| 663 | "properties": { |
| 664 | "name": name_schema, |
| 665 | "description": description_schema, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 666 | "vim": name_schema, |
| 667 | "datacenter": name_schema, |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 668 | "vim_type": vim_type, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 669 | "vim_url": description_schema, |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 670 | # "vim_url_admin": description_schema, |
| 671 | # "vim_tenant": name_schema, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 672 | "vim_tenant_name": name_schema, |
| sousaedu | f2feafd | 2021-07-12 10:21:06 +0200 | [diff] [blame] | 673 | "vim_user": string_schema, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 674 | "vim_password": passwd_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 675 | "vca": id_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 676 | "config": {"type": "object"}, |
| vegall | 5c59aab | 2022-04-27 15:31:49 +0000 | [diff] [blame] | 677 | "prometheus-config": {"type": "object"}, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 678 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 679 | "additionalProperties": False, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 680 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 681 | |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 682 | vim_account_new_schema = { |
| 683 | "title": "vim_account creation input schema", |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 684 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 685 | "type": "object", |
| 686 | "properties": { |
| 687 | "schema_version": schema_version, |
| 688 | "schema_type": schema_type, |
| 689 | "name": name_schema, |
| 690 | "description": description_schema, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 691 | "vim": name_schema, |
| 692 | "datacenter": name_schema, |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 693 | "vim_type": vim_type, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 694 | "vim_url": description_schema, |
| 695 | # "vim_url_admin": description_schema, |
| 696 | # "vim_tenant": name_schema, |
| 697 | "vim_tenant_name": name_schema, |
| sousaedu | f2feafd | 2021-07-12 10:21:06 +0200 | [diff] [blame] | 698 | "vim_user": string_schema, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 699 | "vim_password": passwd_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 700 | "vca": id_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 701 | "config": {"type": "object"}, |
| vegall | 5c59aab | 2022-04-27 15:31:49 +0000 | [diff] [blame] | 702 | "prometheus-config": {"type": "object"}, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 703 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 704 | "required": [ |
| 705 | "name", |
| 706 | "vim_url", |
| 707 | "vim_type", |
| 708 | "vim_user", |
| 709 | "vim_password", |
| 710 | "vim_tenant_name", |
| 711 | ], |
| 712 | "additionalProperties": False, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 713 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 714 | |
| tierno | 8580772 | 2019-12-20 14:11:35 +0000 | [diff] [blame] | 715 | wim_type = shortname_schema # {"enum": ["ietfl2vpn", "onos", "odl", "dynpac", "fake"]} |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 716 | |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 717 | wim_account_edit_schema = { |
| 718 | "title": "wim_account edit input schema", |
| 719 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 720 | "type": "object", |
| 721 | "properties": { |
| 722 | "name": name_schema, |
| 723 | "description": description_schema, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 724 | "wim": name_schema, |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 725 | "wim_type": wim_type, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 726 | "wim_url": description_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 727 | "user": string_schema, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 728 | "password": passwd_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 729 | "config": {"type": "object"}, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 730 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 731 | "additionalProperties": False, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 732 | } |
| 733 | |
| 734 | wim_account_new_schema = { |
| 735 | "title": "wim_account creation input schema", |
| 736 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 737 | "type": "object", |
| 738 | "properties": { |
| 739 | "schema_version": schema_version, |
| 740 | "schema_type": schema_type, |
| 741 | "name": name_schema, |
| 742 | "description": description_schema, |
| 743 | "wim": name_schema, |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 744 | "wim_type": wim_type, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 745 | "wim_url": description_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 746 | "user": string_schema, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 747 | "password": passwd_schema, |
| tierno | f063705 | 2019-03-07 16:26:47 +0000 | [diff] [blame] | 748 | "config": { |
| 749 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 750 | "patternProperties": {".": {"not": {"type": "null"}}}, |
| 751 | }, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 752 | }, |
| 753 | "required": ["name", "wim_url", "wim_type"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 754 | "additionalProperties": False, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 755 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 756 | |
| 757 | sdn_properties = { |
| 758 | "name": name_schema, |
| tierno | 7adaeb0 | 2019-12-17 16:46:12 +0000 | [diff] [blame] | 759 | "type": {"type": "string"}, |
| 760 | "url": {"type": "string"}, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 761 | "user": string_schema, |
| tierno | 7adaeb0 | 2019-12-17 16:46:12 +0000 | [diff] [blame] | 762 | "password": passwd_schema, |
| 763 | "config": {"type": "object"}, |
| tierno | cfb07c6 | 2018-05-10 18:30:51 +0200 | [diff] [blame] | 764 | "description": description_schema, |
| tierno | 7adaeb0 | 2019-12-17 16:46:12 +0000 | [diff] [blame] | 765 | # The folowing are deprecated. Maintanied for backward compatibility |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 766 | "dpid": dpid_Schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 767 | "ip": ip_schema, |
| 768 | "port": port_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 769 | "version": {"type": "string", "minLength": 1, "maxLength": 12}, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 770 | } |
| 771 | sdn_new_schema = { |
| 772 | "title": "sdn controller information schema", |
| 773 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 774 | "type": "object", |
| 775 | "properties": sdn_properties, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 776 | "required": ["name", "type"], |
| 777 | "additionalProperties": False, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 778 | } |
| 779 | sdn_edit_schema = { |
| 780 | "title": "sdn controller update information schema", |
| 781 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 782 | "type": "object", |
| 783 | "properties": sdn_properties, |
| tierno | cfb07c6 | 2018-05-10 18:30:51 +0200 | [diff] [blame] | 784 | # "required": ["name", "port", 'ip', 'dpid', 'type'], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 785 | "additionalProperties": False, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 786 | } |
| 787 | sdn_port_mapping_schema = { |
| 788 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 789 | "title": "sdn port mapping information schema", |
| 790 | "type": "array", |
| 791 | "items": { |
| 792 | "type": "object", |
| 793 | "properties": { |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 794 | "compute_node": shortname_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 795 | "ports": { |
| 796 | "type": "array", |
| 797 | "items": { |
| 798 | "type": "object", |
| 799 | "properties": { |
| tierno | 42fce59 | 2018-11-02 09:23:43 +0100 | [diff] [blame] | 800 | "pci": pci_extended_schema, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 801 | "switch_port": shortname_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 802 | "switch_mac": mac_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 803 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 804 | "required": ["pci"], |
| 805 | }, |
| 806 | }, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 807 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 808 | "required": ["compute_node", "ports"], |
| 809 | }, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 810 | } |
| 811 | sdn_external_port_schema = { |
| 812 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 813 | "title": "External port information", |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 814 | "type": "object", |
| 815 | "properties": { |
| 816 | "port": {"type": "string", "minLength": 1, "maxLength": 60}, |
| 817 | "vlan": vlan_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 818 | "mac": mac_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 819 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 820 | "required": ["port"], |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 821 | } |
| 822 | |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 823 | # K8s Clusters |
| Gabriel Cuba | 50e815b | 2022-03-22 14:01:26 -0500 | [diff] [blame] | 824 | k8scluster_deploy_method_schema = { |
| 825 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 826 | "title": "Deployment methods for K8s cluster", |
| 827 | "type": "object", |
| 828 | "properties": { |
| 829 | "helm-chart": {"type": "boolean"}, |
| 830 | "juju-bundle": {"type": "boolean"}, |
| 831 | "helm-chart-v3": {"type": "boolean"}, |
| 832 | }, |
| 833 | "additionalProperties": False, |
| 834 | "minProperties": 3, |
| 835 | } |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 836 | k8scluster_nets_schema = { |
| 837 | "title": "k8scluster nets input schema", |
| 838 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 839 | "type": "object", |
| tierno | 8c81ab0 | 2020-02-07 10:18:30 +0000 | [diff] [blame] | 840 | "patternProperties": {".": {"oneOf": [name_schema, null_schema]}}, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 841 | "minProperties": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 842 | "additionalProperties": False, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 843 | } |
| 844 | k8scluster_new_schema = { |
| 845 | "title": "k8scluster creation input schema", |
| 846 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 847 | "type": "object", |
| 848 | "properties": { |
| 849 | "schema_version": schema_version, |
| 850 | "schema_type": schema_type, |
| 851 | "name": name_schema, |
| 852 | "description": description_schema, |
| 853 | "credentials": object_schema, |
| 854 | "vim_account": id_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 855 | "vca_id": id_schema, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 856 | "k8s_version": string_schema, |
| 857 | "nets": k8scluster_nets_schema, |
| Gabriel Cuba | 50e815b | 2022-03-22 14:01:26 -0500 | [diff] [blame] | 858 | "deployment_methods": k8scluster_deploy_method_schema, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 859 | "namespace": name_schema, |
| 860 | "cni": nameshort_list_schema, |
| 861 | }, |
| 862 | "required": ["name", "credentials", "vim_account", "k8s_version", "nets"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 863 | "additionalProperties": False, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 864 | } |
| 865 | k8scluster_edit_schema = { |
| 866 | "title": "vim_account edit input schema", |
| 867 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 868 | "type": "object", |
| 869 | "properties": { |
| 870 | "name": name_schema, |
| 871 | "description": description_schema, |
| 872 | "credentials": object_schema, |
| 873 | "vim_account": id_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 874 | "vca_id": id_schema, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 875 | "k8s_version": string_schema, |
| 876 | "nets": k8scluster_nets_schema, |
| 877 | "namespace": name_schema, |
| 878 | "cni": nameshort_list_schema, |
| 879 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 880 | "additionalProperties": False, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 881 | } |
| 882 | |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 883 | # VCA |
| 884 | vca_new_schema = { |
| 885 | "title": "vca creation input schema", |
| 886 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 887 | "type": "object", |
| 888 | "properties": { |
| 889 | "schema_version": schema_version, |
| 890 | "schema_type": schema_type, |
| 891 | "name": name_schema, |
| 892 | "description": description_schema, |
| 893 | "endpoints": description_list_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 894 | "user": string_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 895 | "secret": passwd_schema, |
| 896 | "cacert": long_description_schema, |
| 897 | "lxd-cloud": shortname_schema, |
| 898 | "lxd-credentials": shortname_schema, |
| 899 | "k8s-cloud": shortname_schema, |
| 900 | "k8s-credentials": shortname_schema, |
| 901 | "model-config": object_schema, |
| 902 | }, |
| 903 | "required": [ |
| 904 | "name", |
| 905 | "endpoints", |
| 906 | "user", |
| 907 | "secret", |
| 908 | "cacert", |
| 909 | "lxd-cloud", |
| 910 | "lxd-credentials", |
| 911 | "k8s-cloud", |
| 912 | "k8s-credentials", |
| 913 | ], |
| 914 | "additionalProperties": False, |
| 915 | } |
| 916 | vca_edit_schema = { |
| 917 | "title": "vca creation input schema", |
| 918 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 919 | "type": "object", |
| 920 | "properties": { |
| 921 | "name": name_schema, |
| 922 | "description": description_schema, |
| 923 | "endpoints": description_list_schema, |
| 924 | "port": integer1_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 925 | "user": string_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 926 | "secret": passwd_schema, |
| 927 | "cacert": long_description_schema, |
| 928 | "lxd-cloud": shortname_schema, |
| 929 | "lxd-credentials": shortname_schema, |
| 930 | "k8s-cloud": shortname_schema, |
| 931 | "k8s-credentials": shortname_schema, |
| 932 | "model-config": object_schema, |
| 933 | }, |
| 934 | "additionalProperties": False, |
| 935 | } |
| 936 | |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 937 | # K8s Repos |
| tierno | 332e080 | 2019-12-03 23:50:49 +0000 | [diff] [blame] | 938 | k8srepo_types = {"enum": ["helm-chart", "juju-bundle"]} |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 939 | k8srepo_properties = { |
| 940 | "name": name_schema, |
| 941 | "description": description_schema, |
| 942 | "type": k8srepo_types, |
| 943 | "url": description_schema, |
| 944 | } |
| 945 | k8srepo_new_schema = { |
| 946 | "title": "k8scluster creation input schema", |
| 947 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 948 | "type": "object", |
| 949 | "properties": k8srepo_properties, |
| 950 | "required": ["name", "type", "url"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 951 | "additionalProperties": False, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 952 | } |
| 953 | k8srepo_edit_schema = { |
| 954 | "title": "vim_account edit input schema", |
| 955 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 956 | "type": "object", |
| 957 | "properties": k8srepo_properties, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 958 | "additionalProperties": False, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 959 | } |
| 960 | |
| Felipe Vicens | b66b041 | 2020-05-06 10:11:00 +0200 | [diff] [blame] | 961 | # OSM Repos |
| 962 | osmrepo_types = {"enum": ["osm"]} |
| 963 | osmrepo_properties = { |
| 964 | "name": name_schema, |
| 965 | "description": description_schema, |
| 966 | "type": osmrepo_types, |
| 967 | "url": description_schema |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 968 | # "user": string_schema, |
| Felipe Vicens | b66b041 | 2020-05-06 10:11:00 +0200 | [diff] [blame] | 969 | # "password": passwd_schema |
| 970 | } |
| 971 | osmrepo_new_schema = { |
| 972 | "title": "osm repo creation input schema", |
| 973 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 974 | "type": "object", |
| 975 | "properties": osmrepo_properties, |
| 976 | "required": ["name", "type", "url"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 977 | "additionalProperties": False, |
| Felipe Vicens | b66b041 | 2020-05-06 10:11:00 +0200 | [diff] [blame] | 978 | } |
| 979 | osmrepo_edit_schema = { |
| 980 | "title": "osm repo edit input schema", |
| 981 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 982 | "type": "object", |
| 983 | "properties": osmrepo_properties, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 984 | "additionalProperties": False, |
| Felipe Vicens | b66b041 | 2020-05-06 10:11:00 +0200 | [diff] [blame] | 985 | } |
| 986 | |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 987 | # PDUs |
| 988 | pdu_interface = { |
| 989 | "type": "object", |
| 990 | "properties": { |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 991 | "name": shortname_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 992 | "mgmt": bool_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 993 | "type": {"enum": ["overlay", "underlay"]}, |
| garciadeblas | 1a01e1f | 2021-10-26 17:27:35 +0200 | [diff] [blame] | 994 | "ip-address": {"oneOf": [ip_schema, ipv6_schema]}, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 995 | # TODO, add user, password, ssh-key |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 996 | "mac-address": mac_schema, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 997 | "vim-network-name": shortname_schema, # interface is connected to one vim network, or switch port |
| 998 | "vim-network-id": shortname_schema, |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 999 | # # provide this in case SDN assist must deal with this interface |
| 1000 | # "switch-dpid": dpid_Schema, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 1001 | # "switch-port": shortname_schema, |
| 1002 | # "switch-mac": shortname_schema, |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 1003 | # "switch-vlan": vlan_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1004 | }, |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 1005 | "required": ["name", "mgmt", "ip-address"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1006 | "additionalProperties": False, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1007 | } |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1008 | pdu_new_schema = { |
| 1009 | "title": "pdu creation input schema", |
| 1010 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1011 | "type": "object", |
| 1012 | "properties": { |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 1013 | "name": shortname_schema, |
| 1014 | "type": shortname_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1015 | "description": description_schema, |
| 1016 | "shared": bool_schema, |
| 1017 | "vims": nameshort_list_schema, |
| 1018 | "vim_accounts": nameshort_list_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1019 | "interfaces": {"type": "array", "items": pdu_interface, "minItems": 1}, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1020 | }, |
| 1021 | "required": ["name", "type", "interfaces"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1022 | "additionalProperties": False, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1023 | } |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1024 | pdu_edit_schema = { |
| 1025 | "title": "pdu edit input schema", |
| 1026 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1027 | "type": "object", |
| 1028 | "properties": { |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 1029 | "name": shortname_schema, |
| 1030 | "type": shortname_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1031 | "description": description_schema, |
| 1032 | "shared": bool_schema, |
| garciadeblas | 84bdd55 | 2018-11-30 22:59:45 +0100 | [diff] [blame] | 1033 | "vims": {"oneOf": [array_edition_schema, nameshort_list_schema]}, |
| 1034 | "vim_accounts": {"oneOf": [array_edition_schema, nameshort_list_schema]}, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1035 | "interfaces": { |
| 1036 | "oneOf": [ |
| 1037 | array_edition_schema, |
| 1038 | {"type": "array", "items": pdu_interface, "minItems": 1}, |
| 1039 | ] |
| 1040 | }, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1041 | }, |
| 1042 | "additionalProperties": False, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1043 | "minProperties": 1, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1044 | } |
| 1045 | |
| delacruzramo | 271d200 | 2019-12-02 21:00:37 +0100 | [diff] [blame] | 1046 | # VNF PKG OPERATIONS |
| 1047 | vnfpkgop_new_schema = { |
| 1048 | "title": "VNF PKG operation creation input schema", |
| 1049 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1050 | "type": "object", |
| 1051 | "properties": { |
| 1052 | "lcmOperationType": string_schema, |
| 1053 | "vnfPkgId": id_schema, |
| 1054 | "kdu_name": name_schema, |
| 1055 | "primitive": name_schema, |
| 1056 | "primitive_params": {"type": "object"}, |
| 1057 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1058 | "required": [ |
| 1059 | "lcmOperationType", |
| 1060 | "vnfPkgId", |
| 1061 | "kdu_name", |
| 1062 | "primitive", |
| 1063 | "primitive_params", |
| 1064 | ], |
| 1065 | "additionalProperties": False, |
| delacruzramo | 271d200 | 2019-12-02 21:00:37 +0100 | [diff] [blame] | 1066 | } |
| 1067 | |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1068 | # USERS |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1069 | project_role_mappings = { |
| 1070 | "title": "list pf projects/roles", |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1071 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1072 | "type": "array", |
| 1073 | "items": { |
| 1074 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1075 | "properties": {"project": shortname_schema, "role": shortname_schema}, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1076 | "required": ["project", "role"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1077 | "additionalProperties": False, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1078 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1079 | "minItems": 1, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1080 | } |
| 1081 | project_role_mappings_optional = { |
| 1082 | "title": "list of projects/roles or projects only", |
| 1083 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1084 | "type": "array", |
| 1085 | "items": { |
| 1086 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1087 | "properties": {"project": shortname_schema, "role": shortname_schema}, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1088 | "required": ["project"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1089 | "additionalProperties": False, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1090 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1091 | "minItems": 1, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1092 | } |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1093 | user_new_schema = { |
| 1094 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1095 | "title": "New user schema", |
| 1096 | "type": "object", |
| 1097 | "properties": { |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 1098 | "username": string_schema, |
| tierno | ad6d533 | 2020-02-19 14:29:49 +0000 | [diff] [blame] | 1099 | "domain_name": shortname_schema, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1100 | "password": passwd_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1101 | "projects": nameshort_list_schema, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1102 | "project_role_mappings": project_role_mappings, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1103 | }, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1104 | "required": ["username", "password"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1105 | "additionalProperties": False, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1106 | } |
| 1107 | user_edit_schema = { |
| 1108 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1109 | "title": "User edit schema for administrators", |
| 1110 | "type": "object", |
| 1111 | "properties": { |
| 1112 | "password": passwd_schema, |
| selvi.j | a9a1fc8 | 2022-04-04 06:54:30 +0000 | [diff] [blame] | 1113 | "old_password": passwd_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 1114 | "username": string_schema, # To allow User Name modification |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1115 | "projects": {"oneOf": [nameshort_list_schema, array_edition_schema]}, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1116 | "project_role_mappings": project_role_mappings, |
| 1117 | "add_project_role_mappings": project_role_mappings, |
| 1118 | "remove_project_role_mappings": project_role_mappings_optional, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1119 | }, |
| 1120 | "minProperties": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1121 | "additionalProperties": False, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1122 | } |
| 1123 | |
| 1124 | # PROJECTS |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1125 | topics_with_quota = [ |
| 1126 | "vnfds", |
| 1127 | "nsds", |
| 1128 | "slice_templates", |
| 1129 | "pduds", |
| 1130 | "ns_instances", |
| 1131 | "slice_instances", |
| 1132 | "vim_accounts", |
| 1133 | "wim_accounts", |
| 1134 | "sdn_controllers", |
| 1135 | "k8sclusters", |
| 1136 | "vca", |
| 1137 | "k8srepos", |
| 1138 | "osmrepos", |
| 1139 | "ns_subscriptions", |
| 1140 | ] |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1141 | project_new_schema = { |
| 1142 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1143 | "title": "New project schema for administrators", |
| 1144 | "type": "object", |
| 1145 | "properties": { |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 1146 | "name": shortname_schema, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1147 | "admin": bool_schema, |
| tierno | ad6d533 | 2020-02-19 14:29:49 +0000 | [diff] [blame] | 1148 | "domain_name": shortname_schema, |
| delacruzramo | 32bab47 | 2019-09-13 12:24:22 +0200 | [diff] [blame] | 1149 | "quotas": { |
| 1150 | "type": "object", |
| 1151 | "properties": {topic: integer0_schema for topic in topics_with_quota}, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1152 | "additionalProperties": False, |
| delacruzramo | 32bab47 | 2019-09-13 12:24:22 +0200 | [diff] [blame] | 1153 | }, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1154 | }, |
| 1155 | "required": ["name"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1156 | "additionalProperties": False, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1157 | } |
| 1158 | project_edit_schema = { |
| 1159 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1160 | "title": "Project edit schema for administrators", |
| 1161 | "type": "object", |
| 1162 | "properties": { |
| 1163 | "admin": bool_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1164 | "name": shortname_schema, # To allow Project Name modification |
| delacruzramo | 32bab47 | 2019-09-13 12:24:22 +0200 | [diff] [blame] | 1165 | "quotas": { |
| 1166 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1167 | "properties": { |
| 1168 | topic: {"oneOf": [integer0_schema, null_schema]} |
| 1169 | for topic in topics_with_quota |
| 1170 | }, |
| 1171 | "additionalProperties": False, |
| delacruzramo | 32bab47 | 2019-09-13 12:24:22 +0200 | [diff] [blame] | 1172 | }, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1173 | }, |
| 1174 | "additionalProperties": False, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1175 | "minProperties": 1, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1176 | } |
| 1177 | |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1178 | # ROLES |
| 1179 | roles_new_schema = { |
| 1180 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1181 | "title": "New role schema for administrators", |
| 1182 | "type": "object", |
| 1183 | "properties": { |
| 1184 | "name": shortname_schema, |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 1185 | "permissions": { |
| 1186 | "type": "object", |
| 1187 | "patternProperties": { |
| 1188 | ".": bool_schema, |
| 1189 | }, |
| 1190 | # "minProperties": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1191 | }, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1192 | }, |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 1193 | "required": ["name"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1194 | "additionalProperties": False, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1195 | } |
| 1196 | roles_edit_schema = { |
| 1197 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1198 | "title": "Roles edit schema for administrators", |
| 1199 | "type": "object", |
| 1200 | "properties": { |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 1201 | "name": shortname_schema, |
| 1202 | "permissions": { |
| 1203 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1204 | "patternProperties": {".": {"oneOf": [bool_schema, null_schema]}}, |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 1205 | # "minProperties": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1206 | }, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1207 | }, |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 1208 | "additionalProperties": False, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1209 | "minProperties": 1, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1210 | } |
| 1211 | |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1212 | # GLOBAL SCHEMAS |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1213 | |
| 1214 | nbi_new_input_schemas = { |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1215 | "users": user_new_schema, |
| 1216 | "projects": project_new_schema, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 1217 | "vim_accounts": vim_account_new_schema, |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 1218 | "sdns": sdn_new_schema, |
| 1219 | "ns_instantiate": ns_instantiate, |
| 1220 | "ns_action": ns_action, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1221 | "ns_scale": ns_scale, |
| aticig | 544a2ae | 2022-04-05 09:00:17 +0300 | [diff] [blame] | 1222 | "ns_update": ns_update, |
| garciadeblas | 0964edf | 2022-02-11 00:43:44 +0100 | [diff] [blame] | 1223 | "ns_heal": ns_heal, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1224 | "pdus": pdu_new_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1225 | } |
| 1226 | |
| 1227 | nbi_edit_input_schemas = { |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1228 | "users": user_edit_schema, |
| 1229 | "projects": project_edit_schema, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 1230 | "vim_accounts": vim_account_edit_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1231 | "sdns": sdn_edit_schema, |
| 1232 | "pdus": pdu_edit_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1233 | } |
| 1234 | |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1235 | # NETSLICE SCHEMAS |
| tierno | 032916c | 2019-03-22 13:27:12 +0000 | [diff] [blame] | 1236 | nsi_subnet_instantiate = deepcopy(ns_instantiate) |
| 1237 | nsi_subnet_instantiate["title"] = "netslice subnet instantiation params input schema" |
| 1238 | nsi_subnet_instantiate["properties"]["id"] = name_schema |
| 1239 | del nsi_subnet_instantiate["required"] |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 1240 | |
| 1241 | nsi_vld_instantiate = { |
| 1242 | "title": "netslice vld instantiation params input schema", |
| 1243 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1244 | "type": "object", |
| 1245 | "properties": { |
| 1246 | "name": string_schema, |
| tierno | 195a36c | 2020-09-18 14:18:55 +0000 | [diff] [blame] | 1247 | "vim-network-name": {"oneOf": [string_schema, object_schema]}, |
| 1248 | "vim-network-id": {"oneOf": [string_schema, object_schema]}, |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 1249 | "ip-profile": object_schema, |
| 1250 | }, |
| delacruzramo | c061f56 | 2019-04-05 11:00:02 +0200 | [diff] [blame] | 1251 | "required": ["name"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1252 | "additionalProperties": False, |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 1253 | } |
| 1254 | |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1255 | nsi_instantiate = { |
| 1256 | "title": "netslice action instantiate input schema", |
| 1257 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1258 | "type": "object", |
| 1259 | "properties": { |
| 1260 | "lcmOperationType": string_schema, |
| Felipe Vicens | 126af57 | 2019-06-05 19:13:04 +0200 | [diff] [blame] | 1261 | "netsliceInstanceId": id_schema, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1262 | "nsiName": name_schema, |
| tierno | 4f9d4ae | 2019-03-20 17:24:11 +0000 | [diff] [blame] | 1263 | "nsiDescription": {"oneOf": [description_schema, null_schema]}, |
| tierno | 9e5eea3 | 2018-11-29 09:42:09 +0000 | [diff] [blame] | 1264 | "nstId": string_schema, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1265 | "vimAccountId": id_schema, |
| tierno | a8186a5 | 2020-01-14 15:54:48 +0000 | [diff] [blame] | 1266 | "timeout_nsi_deploy": integer1_schema, |
| Felipe Vicens | 26202bb | 2020-05-24 18:57:33 +0200 | [diff] [blame] | 1267 | "ssh_keys": {"type": "array", "items": {"type": "string"}}, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1268 | "nsi_id": id_schema, |
| tierno | 032916c | 2019-03-22 13:27:12 +0000 | [diff] [blame] | 1269 | "additionalParamsForNsi": object_schema, |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 1270 | "netslice-subnet": { |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1271 | "type": "array", |
| 1272 | "minItems": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1273 | "items": nsi_subnet_instantiate, |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 1274 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1275 | "netslice-vld": {"type": "array", "minItems": 1, "items": nsi_vld_instantiate}, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1276 | }, |
| Felipe Vicens | c8bbaaa | 2018-12-01 04:42:40 +0100 | [diff] [blame] | 1277 | "required": ["nsiName", "nstId", "vimAccountId"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1278 | "additionalProperties": False, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1279 | } |
| 1280 | |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1281 | nsi_action = {} |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1282 | |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1283 | nsi_terminate = {} |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1284 | |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1285 | nsinstancesubscriptionfilter_schema = { |
| 1286 | "title": "instance identifier schema", |
| 1287 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1288 | "type": "object", |
| 1289 | "properties": { |
| 1290 | "nsdIds": {"type": "array"}, |
| 1291 | "vnfdIds": {"type": "array"}, |
| 1292 | "pnfdIds": {"type": "array"}, |
| 1293 | "nsInstanceIds": {"type": "array"}, |
| 1294 | "nsInstanceNames": {"type": "array"}, |
| 1295 | }, |
| 1296 | } |
| 1297 | |
| 1298 | nslcmsub_schema = { |
| 1299 | "title": "nslcmsubscription input schema", |
| 1300 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1301 | "type": "object", |
| 1302 | "properties": { |
| 1303 | "nsInstanceSubscriptionFilter": nsinstancesubscriptionfilter_schema, |
| 1304 | "notificationTypes": { |
| 1305 | "type": "array", |
| 1306 | "items": { |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1307 | "enum": [ |
| 1308 | "NsLcmOperationOccurrenceNotification", |
| 1309 | "NsChangeNotification", |
| 1310 | "NsIdentifierCreationNotification", |
| 1311 | "NsIdentifierDeletionNotification", |
| 1312 | ] |
| 1313 | }, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1314 | }, |
| 1315 | "operationTypes": { |
| 1316 | "type": "array", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1317 | "items": {"enum": ["INSTANTIATE", "SCALE", "TERMINATE", "UPDATE", "HEAL"]}, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1318 | }, |
| 1319 | "operationStates": { |
| 1320 | "type": "array", |
| 1321 | "items": { |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1322 | "enum": [ |
| 1323 | "PROCESSING", |
| 1324 | "COMPLETED", |
| 1325 | "PARTIALLY_COMPLETED", |
| 1326 | "FAILED", |
| 1327 | "FAILED_TEMP", |
| 1328 | "ROLLING_BACK", |
| 1329 | "ROLLED_BACK", |
| 1330 | ] |
| 1331 | }, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1332 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1333 | "nsComponentTypes": {"type": "array", "items": {"enum": ["VNF", "NS", "PNF"]}}, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1334 | "lcmOpNameImpactingNsComponent": { |
| 1335 | "type": "array", |
| 1336 | "items": { |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1337 | "enum": [ |
| 1338 | "VNF_INSTANTIATE", |
| 1339 | "VNF_SCALE", |
| 1340 | "VNF_SCALE_TO_LEVEL", |
| 1341 | "VNF_CHANGE_FLAVOUR", |
| 1342 | "VNF_TERMINATE", |
| 1343 | "VNF_HEAL", |
| 1344 | "VNF_OPERATE", |
| 1345 | "VNF_CHANGE_EXT_CONN", |
| 1346 | "VNF_MODIFY_INFO", |
| 1347 | "NS_INSTANTIATE", |
| 1348 | "NS_SCALE", |
| 1349 | "NS_UPDATE", |
| 1350 | "NS_TERMINATE", |
| 1351 | "NS_HEAL", |
| 1352 | ] |
| 1353 | }, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1354 | }, |
| 1355 | "lcmOpOccStatusImpactingNsComponent": { |
| 1356 | "type": "array", |
| 1357 | "items": { |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1358 | "enum": [ |
| 1359 | "START", |
| 1360 | "COMPLETED", |
| 1361 | "PARTIALLY_COMPLETED", |
| 1362 | "FAILED", |
| 1363 | "ROLLED_BACK", |
| 1364 | ] |
| 1365 | }, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1366 | }, |
| 1367 | }, |
| 1368 | "allOf": [ |
| 1369 | { |
| 1370 | "if": { |
| 1371 | "properties": { |
| 1372 | "notificationTypes": { |
| 1373 | "contains": {"const": "NsLcmOperationOccurrenceNotification"} |
| 1374 | } |
| 1375 | }, |
| 1376 | }, |
| 1377 | "then": { |
| 1378 | "anyOf": [ |
| 1379 | {"required": ["operationTypes"]}, |
| 1380 | {"required": ["operationStates"]}, |
| 1381 | ] |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1382 | }, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1383 | }, |
| 1384 | { |
| 1385 | "if": { |
| 1386 | "properties": { |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1387 | "notificationTypes": {"contains": {"const": "NsChangeNotification"}} |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1388 | }, |
| 1389 | }, |
| 1390 | "then": { |
| 1391 | "anyOf": [ |
| 1392 | {"required": ["nsComponentTypes"]}, |
| 1393 | {"required": ["lcmOpNameImpactingNsComponent"]}, |
| 1394 | {"required": ["lcmOpOccStatusImpactingNsComponent"]}, |
| 1395 | ] |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1396 | }, |
| 1397 | }, |
| 1398 | ], |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1399 | } |
| 1400 | |
| 1401 | authentication_schema = { |
| 1402 | "title": "authentication schema for subscription", |
| 1403 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1404 | "type": "object", |
| 1405 | "properties": { |
| 1406 | "authType": {"enum": ["basic"]}, |
| 1407 | "paramsBasic": { |
| 1408 | "type": "object", |
| 1409 | "properties": { |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 1410 | "userName": string_schema, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1411 | "password": passwd_schema, |
| 1412 | }, |
| 1413 | }, |
| 1414 | }, |
| 1415 | } |
| 1416 | |
| 1417 | subscription = { |
| 1418 | "title": "subscription input schema", |
| 1419 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1420 | "type": "object", |
| 1421 | "properties": { |
| 1422 | "filter": nslcmsub_schema, |
| 1423 | "CallbackUri": description_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1424 | "authentication": authentication_schema, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1425 | }, |
| 1426 | "required": ["CallbackUri"], |
| 1427 | } |
| 1428 | |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1429 | vnflcmsub_schema = { |
| 1430 | "title": "vnflcmsubscription input schema", |
| 1431 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1432 | "type": "object", |
| 1433 | "properties": { |
| 1434 | "VnfInstanceSubscriptionFilter": { |
| 1435 | "type": "object", |
| 1436 | "properties": { |
| 1437 | "vnfdIds": {"type": "array"}, |
| 1438 | "vnfInstanceIds": {"type": "array"}, |
| 1439 | }, |
| 1440 | }, |
| 1441 | "notificationTypes": { |
| 1442 | "type": "array", |
| 1443 | "items": { |
| 1444 | "enum": [ |
| 1445 | "VnfIdentifierCreationNotification", |
| 1446 | "VnfLcmOperationOccurrenceNotification", |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1447 | "VnfIdentifierDeletionNotification", |
| 1448 | ] |
| 1449 | }, |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1450 | }, |
| 1451 | "operationTypes": { |
| 1452 | "type": "array", |
| 1453 | "items": { |
| 1454 | "enum": [ |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1455 | "INSTANTIATE", |
| 1456 | "SCALE", |
| 1457 | "SCALE_TO_LEVEL", |
| 1458 | "CHANGE_FLAVOUR", |
| 1459 | "TERMINATE", |
| 1460 | "HEAL", |
| 1461 | "OPERATE", |
| 1462 | "CHANGE_EXT_CONN", |
| 1463 | "MODIFY_INFO", |
| 1464 | "CREATE_SNAPSHOT", |
| 1465 | "REVERT_TO_SNAPSHOT", |
| 1466 | "CHANGE_VNFPKG", |
| 1467 | ] |
| 1468 | }, |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1469 | }, |
| 1470 | "operationStates": { |
| 1471 | "type": "array", |
| 1472 | "items": { |
| 1473 | "enum": [ |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1474 | "STARTING", |
| 1475 | "PROCESSING", |
| 1476 | "COMPLETED", |
| 1477 | "FAILED_TEMP", |
| 1478 | "FAILED", |
| 1479 | "ROLLING_BACK", |
| 1480 | "ROLLED_BACK", |
| 1481 | ] |
| 1482 | }, |
| 1483 | }, |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1484 | }, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1485 | "required": ["VnfInstanceSubscriptionFilter", "notificationTypes"], |
| 1486 | } |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1487 | |
| 1488 | vnf_subscription = { |
| 1489 | "title": "vnf subscription input schema", |
| 1490 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1491 | "type": "object", |
| 1492 | "properties": { |
| 1493 | "filter": vnflcmsub_schema, |
| 1494 | "CallbackUri": description_schema, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1495 | "authentication": authentication_schema, |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1496 | }, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1497 | "required": ["filter", "CallbackUri"], |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1498 | } |
| 1499 | |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1500 | |
| 1501 | class ValidationError(Exception): |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 1502 | def __init__(self, message, http_code=HTTPStatus.UNPROCESSABLE_ENTITY): |
| 1503 | self.http_code = http_code |
| 1504 | Exception.__init__(self, message) |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1505 | |
| 1506 | |
| tierno | b24258a | 2018-10-04 18:39:49 +0200 | [diff] [blame] | 1507 | def validate_input(indata, schema_to_use): |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1508 | """ |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1509 | Validates input data against json schema |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1510 | :param indata: user input data. Should be a dictionary |
| tierno | b24258a | 2018-10-04 18:39:49 +0200 | [diff] [blame] | 1511 | :param schema_to_use: jsonschema to test |
| 1512 | :return: None if ok, raises ValidationError exception on error |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1513 | """ |
| 1514 | try: |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1515 | if schema_to_use: |
| 1516 | js_v(indata, schema_to_use) |
| 1517 | return None |
| 1518 | except js_e.ValidationError as e: |
| 1519 | if e.path: |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 1520 | error_pos = "at '" + ":".join(map(str, e.path)) + "'" |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1521 | else: |
| 1522 | error_pos = "" |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 1523 | raise ValidationError("Format error {} '{}' ".format(error_pos, e.message)) |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 1524 | except js_e.SchemaError: |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1525 | raise ValidationError( |
| 1526 | "Bad json schema {}".format(schema_to_use), |
| 1527 | http_code=HTTPStatus.INTERNAL_SERVER_ERROR, |
| 1528 | ) |
| delacruzramo | c061f56 | 2019-04-05 11:00:02 +0200 | [diff] [blame] | 1529 | |
| 1530 | |
| 1531 | def is_valid_uuid(x): |
| 1532 | """ |
| 1533 | Test for a valid UUID |
| 1534 | :param x: string to test |
| 1535 | :return: True if x is a valid uuid, False otherwise |
| 1536 | """ |
| 1537 | try: |
| 1538 | if UUID(x): |
| 1539 | return True |
| tierno | bdebce9 | 2019-07-01 15:36:49 +0000 | [diff] [blame] | 1540 | except (TypeError, ValueError, AttributeError): |
| delacruzramo | c061f56 | 2019-04-05 11:00:02 +0200 | [diff] [blame] | 1541 | return False |