| 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 | 6d83f8f | 2023-06-19 22:34:49 +0200 | [diff] [blame] | 38 | user_passwd_schema = { |
| 39 | "type": "string", |
| 40 | "pattern": "^.*(?=.{8,})((?=.*[!@#$%^&*()\\-_=+{};:,<.>]){1})(?=.*\\d)((?=.*[a-z]){1})((?=.*[A-Z]){1}).*$", |
| 41 | } |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 42 | name_schema = { |
| 43 | "type": "string", |
| 44 | "minLength": 1, |
| 45 | "maxLength": 255, |
| 46 | "pattern": "^[^,;()'\"]+$", |
| 47 | } |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 48 | string_schema = {"type": "string", "minLength": 1, "maxLength": 255} |
| jegan | be1a3df | 2024-06-04 12:05:19 +0000 | [diff] [blame] | 49 | email_schema = { |
| 50 | "type": "string", |
| 51 | "minLength": 1, |
| 52 | "maxLength": 320, |
| 53 | "pattern": "^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+$", |
| 54 | } |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 55 | xml_text_schema = { |
| 56 | "type": "string", |
| 57 | "minLength": 1, |
| 58 | "maxLength": 1000, |
| 59 | "pattern": "^[^']+$", |
| 60 | } |
| 61 | description_schema = { |
| 62 | "type": ["string", "null"], |
| 63 | "maxLength": 255, |
| 64 | "pattern": "^[^'\"]+$", |
| 65 | } |
| 66 | long_description_schema = { |
| 67 | "type": ["string", "null"], |
| 68 | "maxLength": 3000, |
| 69 | "pattern": "^[^'\"]+$", |
| 70 | } |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 71 | id_schema_fake = {"type": "string", "minLength": 2, "maxLength": 36} |
| 72 | bool_schema = {"type": "boolean"} |
| 73 | null_schema = {"type": "null"} |
| tierno | 2236d20 | 2018-05-16 19:05:16 +0200 | [diff] [blame] | 74 | # "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] | 75 | id_schema = { |
| 76 | "type": "string", |
| 77 | "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$", |
| 78 | } |
| 79 | time_schema = { |
| 80 | "type": "string", |
| 81 | "pattern": "^[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]([0-5]:){2}", |
| 82 | } |
| 83 | pci_schema = { |
| 84 | "type": "string", |
| 85 | "pattern": "^[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}\\.[0-9a-fA-F]$", |
| 86 | } |
| tierno | 42fce59 | 2018-11-02 09:23:43 +0100 | [diff] [blame] | 87 | # allows [] for wildcards. For that reason huge length limit is set |
| 88 | 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] | 89 | http_schema = {"type": "string", "pattern": "^(https?|http)://[^'\"=]+$"} |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 90 | bandwidth_schema = {"type": "string", "pattern": "^[0-9]+ *([MG]bps)?$"} |
| 91 | memory_schema = {"type": "string", "pattern": "^[0-9]+ *([MG]i?[Bb])?$"} |
| 92 | integer0_schema = {"type": "integer", "minimum": 0} |
| 93 | integer1_schema = {"type": "integer", "minimum": 1} |
| tierno | 8700604 | 2018-10-24 12:50:20 +0200 | [diff] [blame] | 94 | path_schema = {"type": "string", "pattern": "^(\\.){0,2}(/[^/\"':{}\\(\\)]+)+$"} |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 95 | vlan_schema = {"type": "integer", "minimum": 1, "maximum": 4095} |
| 96 | vlan1000_schema = {"type": "integer", "minimum": 1000, "maximum": 4095} |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 97 | mac_schema = { |
| 98 | "type": "string", |
| 99 | "pattern": "^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){5}$", |
| 100 | } # must be unicast: LSB bit of MSB byte ==0 |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 101 | 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] | 102 | # 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] | 103 | ip_schema = { |
| 104 | "type": "string", |
| 105 | "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]?)$", |
| 106 | } |
| garciadeblas | 1a01e1f | 2021-10-26 17:27:35 +0200 | [diff] [blame] | 107 | ipv6_schema = { |
| 108 | "type": "string", |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 109 | "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] | 110 | } |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 111 | ip_prefix_schema = { |
| 112 | "type": "string", |
| 113 | "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}" |
| 114 | "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/(30|[12]?[0-9])$", |
| 115 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 116 | port_schema = {"type": "integer", "minimum": 1, "maximum": 65534} |
| 117 | object_schema = {"type": "object"} |
| 118 | schema_version_2 = {"type": "integer", "minimum": 2, "maximum": 2} |
| 119 | # 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] | 120 | log_level_schema = { |
| 121 | "type": "string", |
| 122 | "enum": ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], |
| 123 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 124 | checksum_schema = {"type": "string", "pattern": "^[0-9a-fA-F]{32}$"} |
| 125 | size_schema = {"type": "integer", "minimum": 1, "maximum": 100} |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 126 | array_edition_schema = { |
| 127 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 128 | "patternProperties": {"^\\$": {}}, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 129 | "additionalProperties": False, |
| 130 | "minProperties": 1, |
| 131 | } |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 132 | nameshort_list_schema = { |
| 133 | "type": "array", |
| 134 | "minItems": 1, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 135 | "items": shortname_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 136 | } |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 137 | |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 138 | description_list_schema = { |
| 139 | "type": "array", |
| 140 | "minItems": 1, |
| 141 | "items": description_schema, |
| 142 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 143 | |
| garciadeblas | 3fb820d | 2024-12-05 13:11:11 +0100 | [diff] [blame] | 144 | profile_type_schema = { |
| 145 | "type": "string", |
| 146 | "enum": [ |
| 147 | "infra_controller_profiles", |
| 148 | "infra_config_profiles", |
| 149 | "app_profiles", |
| 150 | "resource_profiles", |
| 151 | ], |
| 152 | } |
| 153 | |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 154 | ns_instantiate_vdu = { |
| 155 | "title": "ns action instantiate input schema for vdu", |
| 156 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 157 | "type": "object", |
| 158 | "properties": { |
| 159 | "id": name_schema, |
| Gabriel Cuba | e88401b | 2023-04-05 15:24:52 -0500 | [diff] [blame] | 160 | "vim-flavor-id": name_schema, |
| kayal2001 | 6a3bce7 | 2024-06-27 11:14:59 +0530 | [diff] [blame] | 161 | "instance_name": name_schema, |
| kayal2001 | b16cf25 | 2024-11-28 10:47:32 +0530 | [diff] [blame] | 162 | "vim-flavor-name": name_schema, |
| kayal2001 | 70615ab | 2024-11-28 11:29:36 +0530 | [diff] [blame] | 163 | "security-group-name": name_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 164 | "volume": { |
| 165 | "type": "array", |
| 166 | "minItems": 1, |
| 167 | "items": { |
| 168 | "type": "object", |
| 169 | "properties": { |
| 170 | "name": name_schema, |
| 171 | "vim-volume-id": name_schema, |
| 172 | }, |
| 173 | "required": ["name", "vim-volume-id"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 174 | "additionalProperties": False, |
| 175 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 176 | }, |
| 177 | "interface": { |
| 178 | "type": "array", |
| 179 | "minItems": 1, |
| 180 | "items": { |
| 181 | "type": "object", |
| 182 | "properties": { |
| 183 | "name": name_schema, |
| garciadeblas | 9fb3271 | 2022-04-04 16:33:59 +0200 | [diff] [blame] | 184 | "ip-address": {"oneOf": [ip_schema, ipv6_schema]}, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 185 | "mac-address": mac_schema, |
| 186 | "floating-ip-required": bool_schema, |
| 187 | }, |
| 188 | "required": ["name"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 189 | "additionalProperties": False, |
| 190 | }, |
| 191 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 192 | }, |
| 193 | "required": ["id"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 194 | "additionalProperties": False, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | ip_profile_dns_schema = { |
| 198 | "type": "array", |
| 199 | "minItems": 1, |
| 200 | "items": { |
| 201 | "type": "object", |
| 202 | "properties": { |
| garciadeblas | 9fb3271 | 2022-04-04 16:33:59 +0200 | [diff] [blame] | 203 | "address": {"oneOf": [ip_schema, ipv6_schema]}, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 204 | }, |
| 205 | "required": ["address"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 206 | "additionalProperties": False, |
| 207 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | ip_profile_dhcp_schema = { |
| 211 | "type": "object", |
| 212 | "properties": { |
| 213 | "enabled": {"type": "boolean"}, |
| 214 | "count": integer1_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 215 | "start-address": ip_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 216 | }, |
| 217 | "additionalProperties": False, |
| 218 | } |
| 219 | |
| 220 | ip_profile_schema = { |
| tierno | 2a92904 | 2020-03-10 16:34:25 +0000 | [diff] [blame] | 221 | "title": "ip profile validation schema", |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 222 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 223 | "type": "object", |
| 224 | "properties": { |
| 225 | "ip-version": {"enum": ["ipv4", "ipv6"]}, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 226 | "subnet-address": {"oneOf": [null_schema, ip_prefix_schema]}, |
| 227 | "gateway-address": {"oneOf": [null_schema, ip_schema]}, |
| 228 | "dns-server": {"oneOf": [null_schema, ip_profile_dns_schema]}, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 229 | "dhcp-params": {"oneOf": [null_schema, ip_profile_dhcp_schema]}, |
| 230 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 231 | "additionalProperties": False, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 232 | } |
| 233 | |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 234 | provider_network_schema = { |
| tierno | 2a92904 | 2020-03-10 16:34:25 +0000 | [diff] [blame] | 235 | "title": "provider network validation schema", |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 236 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 237 | "type": "object", |
| 238 | "properties": { |
| 239 | "physical-network": name_schema, |
| 240 | "segmentation-id": name_schema, |
| tierno | 2a92904 | 2020-03-10 16:34:25 +0000 | [diff] [blame] | 241 | "sdn-ports": { # external ports to append to the SDN-assist network |
| 242 | "type": "array", |
| 243 | "items": { |
| 244 | "type": "object", |
| 245 | "properties": { |
| 246 | "switch_id": shortname_schema, |
| 247 | "switch_port": shortname_schema, |
| 248 | "mac_address": mac_schema, |
| 249 | "vlan": vlan_schema, |
| 250 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 251 | "additionalProperties": True, |
| 252 | }, |
| tierno | 2a92904 | 2020-03-10 16:34:25 +0000 | [diff] [blame] | 253 | }, |
| 254 | "network-type": shortname_schema, |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 255 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 256 | "additionalProperties": True, |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 257 | } |
| 258 | |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 259 | ns_instantiate_internal_vld = { |
| garciadeblas | 9fb3271 | 2022-04-04 16:33:59 +0200 | [diff] [blame] | 260 | "title": "ns action instantiate input schema for vld", |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 261 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 262 | "type": "object", |
| 263 | "properties": { |
| 264 | "name": name_schema, |
| 265 | "vim-network-name": name_schema, |
| gcalvino | 17d5b73 | 2018-12-17 16:26:21 +0100 | [diff] [blame] | 266 | "vim-network-id": name_schema, |
| garciadeblas | 120105b | 2023-02-22 16:52:24 +0100 | [diff] [blame] | 267 | "ip-profile": ip_profile_schema, |
| kbsub | 21f03f5 | 2019-10-17 16:26:56 +0000 | [diff] [blame] | 268 | "provider-network": provider_network_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 269 | "internal-connection-point": { |
| 270 | "type": "array", |
| 271 | "minItems": 1, |
| 272 | "items": { |
| 273 | "type": "object", |
| 274 | "properties": { |
| 275 | "id-ref": name_schema, |
| 276 | "ip-address": ip_schema, |
| tierno | b7c6f2a | 2018-09-03 14:32:10 +0200 | [diff] [blame] | 277 | # "mac-address": mac_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 278 | }, |
| tierno | b7c6f2a | 2018-09-03 14:32:10 +0200 | [diff] [blame] | 279 | "required": ["id-ref"], |
| 280 | "minProperties": 2, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 281 | "additionalProperties": False, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 282 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 283 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 284 | }, |
| 285 | "required": ["name"], |
| 286 | "minProperties": 2, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 287 | "additionalProperties": False, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 288 | } |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 289 | |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 290 | additional_params_for_vnf = { |
| 291 | "type": "array", |
| 292 | "items": { |
| 293 | "type": "object", |
| 294 | "properties": { |
| 295 | "member-vnf-index": name_schema, |
| 296 | "additionalParams": object_schema, |
| tierno | 54db2e4 | 2020-04-06 15:29:42 +0000 | [diff] [blame] | 297 | "k8s-namespace": name_schema, |
| tierno | f62ac6a | 2020-04-29 13:46:13 +0000 | [diff] [blame] | 298 | "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] | 299 | "additionalParamsForVdu": { |
| 300 | "type": "array", |
| 301 | "items": { |
| 302 | "type": "object", |
| 303 | "properties": { |
| 304 | "vdu_id": name_schema, |
| 305 | "additionalParams": object_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 306 | "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] | 307 | }, |
| tierno | f62ac6a | 2020-04-29 13:46:13 +0000 | [diff] [blame] | 308 | "required": ["vdu_id"], |
| 309 | "minProperties": 2, |
| tierno | 714954e | 2019-11-29 13:43:26 +0000 | [diff] [blame] | 310 | "additionalProperties": False, |
| 311 | }, |
| 312 | }, |
| 313 | "additionalParamsForKdu": { |
| 314 | "type": "array", |
| 315 | "items": { |
| 316 | "type": "object", |
| 317 | "properties": { |
| 318 | "kdu_name": name_schema, |
| 319 | "additionalParams": object_schema, |
| tierno | 54db2e4 | 2020-04-06 15:29:42 +0000 | [diff] [blame] | 320 | "kdu_model": name_schema, |
| 321 | "k8s-namespace": name_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 322 | "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] | 323 | "kdu-deployment-name": name_schema, |
| tierno | 714954e | 2019-11-29 13:43:26 +0000 | [diff] [blame] | 324 | }, |
| tierno | 54db2e4 | 2020-04-06 15:29:42 +0000 | [diff] [blame] | 325 | "required": ["kdu_name"], |
| 326 | "minProperties": 2, |
| tierno | 714954e | 2019-11-29 13:43:26 +0000 | [diff] [blame] | 327 | "additionalProperties": False, |
| 328 | }, |
| 329 | }, |
| Alexis Romero | ee31f53 | 2022-04-26 19:10:21 +0200 | [diff] [blame] | 330 | "affinity-or-anti-affinity-group": { |
| 331 | "type": "array", |
| 332 | "items": { |
| 333 | "type": "object", |
| 334 | "properties": { |
| 335 | "id": name_schema, |
| 336 | "vim-affinity-group-id": name_schema, |
| 337 | }, |
| 338 | "required": ["id"], |
| 339 | "minProperties": 2, |
| 340 | "additionalProperties": False, |
| 341 | }, |
| 342 | }, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 343 | }, |
| tierno | 714954e | 2019-11-29 13:43:26 +0000 | [diff] [blame] | 344 | "required": ["member-vnf-index"], |
| 345 | "minProperties": 2, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 346 | "additionalProperties": False, |
| 347 | }, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 348 | } |
| 349 | |
| kayal2001 | f71c2e8 | 2024-06-25 15:26:24 +0530 | [diff] [blame] | 350 | vnf_schema = { |
| 351 | "type": "array", |
| 352 | "minItems": 1, |
| 353 | "items": { |
| 354 | "type": "object", |
| 355 | "properties": { |
| 356 | "member-vnf-index": name_schema, |
| 357 | "vimAccountId": id_schema, |
| 358 | "vdu": { |
| 359 | "type": "array", |
| 360 | "minItems": 1, |
| 361 | "items": ns_instantiate_vdu, |
| 362 | }, |
| 363 | "internal-vld": { |
| 364 | "type": "array", |
| 365 | "minItems": 1, |
| 366 | "items": ns_instantiate_internal_vld, |
| 367 | }, |
| 368 | }, |
| 369 | "required": ["member-vnf-index"], |
| 370 | "minProperties": 2, |
| 371 | "additionalProperties": False, |
| 372 | }, |
| 373 | } |
| 374 | |
| 375 | vld_schema = { |
| 376 | "type": "array", |
| 377 | "minItems": 1, |
| 378 | "items": { |
| 379 | "type": "object", |
| 380 | "properties": { |
| 381 | "name": string_schema, |
| 382 | "vim-network-name": {"oneOf": [string_schema, object_schema]}, |
| 383 | "vim-network-id": {"oneOf": [string_schema, object_schema]}, |
| 384 | "ns-net": object_schema, |
| 385 | "wimAccountId": {"oneOf": [id_schema, bool_schema, null_schema]}, |
| 386 | "ip-profile": ip_profile_schema, |
| 387 | "provider-network": provider_network_schema, |
| 388 | "vnfd-connection-point-ref": { |
| 389 | "type": "array", |
| 390 | "minItems": 1, |
| 391 | "items": { |
| 392 | "type": "object", |
| 393 | "properties": { |
| 394 | "member-vnf-index-ref": name_schema, |
| 395 | "vnfd-connection-point-ref": name_schema, |
| 396 | "ip-address": {"oneOf": [ip_schema, ipv6_schema]}, |
| 397 | # "mac-address": mac_schema, |
| 398 | }, |
| 399 | "required": [ |
| 400 | "member-vnf-index-ref", |
| 401 | "vnfd-connection-point-ref", |
| 402 | ], |
| 403 | "minProperties": 3, |
| 404 | "additionalProperties": False, |
| 405 | }, |
| 406 | }, |
| 407 | }, |
| 408 | "required": ["name"], |
| 409 | "additionalProperties": False, |
| 410 | }, |
| 411 | } |
| 412 | |
| 413 | ns_config_template = { |
| 414 | "title": " ns config template input schema", |
| 415 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 416 | "type": "object", |
| 417 | "properties": { |
| 418 | "name": string_schema, |
| 419 | "nsdId": id_schema, |
| 420 | "config": object_schema, |
| 421 | }, |
| 422 | "required": ["name", "nsdId", "config"], |
| 423 | "additionalProperties": False, |
| 424 | } |
| 425 | |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 426 | ns_instantiate = { |
| 427 | "title": "ns action instantiate input schema", |
| 428 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 429 | "type": "object", |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 430 | "properties": { |
| tierno | b24258a | 2018-10-04 18:39:49 +0200 | [diff] [blame] | 431 | "lcmOperationType": string_schema, |
| 432 | "nsInstanceId": id_schema, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 433 | "netsliceInstanceId": id_schema, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 434 | "nsName": name_schema, |
| tierno | 4f9d4ae | 2019-03-20 17:24:11 +0000 | [diff] [blame] | 435 | "nsDescription": {"oneOf": [description_schema, null_schema]}, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 436 | "nsdId": id_schema, |
| 437 | "vimAccountId": id_schema, |
| kayal2001 | f71c2e8 | 2024-06-25 15:26:24 +0530 | [diff] [blame] | 438 | "nsConfigTemplateId": id_schema, |
| tierno | 195a36c | 2020-09-18 14:18:55 +0000 | [diff] [blame] | 439 | "wimAccountId": {"oneOf": [id_schema, bool_schema, null_schema]}, |
| magnussonl | f318b30 | 2020-01-20 18:38:18 +0100 | [diff] [blame] | 440 | "placement-engine": string_schema, |
| 441 | "placement-constraints": object_schema, |
| tierno | bee085c | 2018-12-12 17:03:04 +0000 | [diff] [blame] | 442 | "additionalParamsForNs": object_schema, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 443 | "additionalParamsForVnf": additional_params_for_vnf, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 444 | "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] | 445 | "k8s-namespace": name_schema, |
| tierno | fc5089c | 2018-10-31 09:28:11 +0100 | [diff] [blame] | 446 | "ssh_keys": {"type": "array", "items": {"type": "string"}}, |
| tierno | a8186a5 | 2020-01-14 15:54:48 +0000 | [diff] [blame] | 447 | "timeout_ns_deploy": integer1_schema, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 448 | "nsr_id": id_schema, |
| tierno | cc10343 | 2018-10-19 14:10:35 +0200 | [diff] [blame] | 449 | "vduImage": name_schema, |
| kayal2001 | f71c2e8 | 2024-06-25 15:26:24 +0530 | [diff] [blame] | 450 | "vnf": vnf_schema, |
| 451 | "vld": vld_schema, |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 452 | }, |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 453 | "required": ["nsName", "nsdId", "vimAccountId"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 454 | "additionalProperties": False, |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 455 | } |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 456 | |
| tierno | 1c38f2f | 2020-03-24 11:51:39 +0000 | [diff] [blame] | 457 | ns_terminate = { |
| 458 | "title": "ns terminate input schema", |
| 459 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 460 | "type": "object", |
| 461 | "properties": { |
| 462 | "lcmOperationType": string_schema, |
| 463 | "nsInstanceId": id_schema, |
| 464 | "autoremove": bool_schema, |
| 465 | "timeout_ns_terminate": integer1_schema, |
| 466 | "skip_terminate_primitives": bool_schema, |
| tierno | 0b8752f | 2020-05-12 09:42:02 +0000 | [diff] [blame] | 467 | "netsliceInstanceId": id_schema, |
| tierno | 1c38f2f | 2020-03-24 11:51:39 +0000 | [diff] [blame] | 468 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 469 | "additionalProperties": False, |
| tierno | 1c38f2f | 2020-03-24 11:51:39 +0000 | [diff] [blame] | 470 | } |
| 471 | |
| aticig | 544a2ae | 2022-04-05 09:00:17 +0300 | [diff] [blame] | 472 | ns_update = { |
| 473 | "title": "ns update input schema", |
| 474 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 475 | "type": "object", |
| 476 | "properties": { |
| 477 | "lcmOperationType": string_schema, |
| 478 | "nsInstanceId": id_schema, |
| garciadeblas | eab1507 | 2022-05-19 10:31:52 +0200 | [diff] [blame] | 479 | "timeout_ns_update": integer1_schema, |
| aticig | 544a2ae | 2022-04-05 09:00:17 +0300 | [diff] [blame] | 480 | "updateType": { |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 481 | "enum": [ |
| 482 | "CHANGE_VNFPKG", |
| 483 | "REMOVE_VNF", |
| 484 | "MODIFY_VNF_INFORMATION", |
| 485 | "OPERATE_VNF", |
| Rahul Kumar | a30391b | 2024-05-24 14:40:23 +0530 | [diff] [blame] | 486 | "VERTICAL_SCALE", |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 487 | ] |
| aticig | 544a2ae | 2022-04-05 09:00:17 +0300 | [diff] [blame] | 488 | }, |
| 489 | "modifyVnfInfoData": { |
| 490 | "type": "object", |
| 491 | "properties": { |
| 492 | "vnfInstanceId": id_schema, |
| 493 | "vnfdId": id_schema, |
| 494 | }, |
| 495 | "required": ["vnfInstanceId", "vnfdId"], |
| 496 | }, |
| 497 | "removeVnfInstanceId": id_schema, |
| 498 | "changeVnfPackageData": { |
| 499 | "type": "object", |
| 500 | "properties": { |
| 501 | "vnfInstanceId": id_schema, |
| 502 | "vnfdId": id_schema, |
| 503 | }, |
| 504 | "required": ["vnfInstanceId", "vnfdId"], |
| 505 | }, |
| k4.rahul | e3dca38 | 2022-04-29 12:30:36 +0000 | [diff] [blame] | 506 | "operateVnfData": { |
| 507 | "type": "object", |
| 508 | "properties": { |
| 509 | "vnfInstanceId": id_schema, |
| 510 | "changeStateTo": name_schema, |
| 511 | "additionalParam": { |
| 512 | "type": "object", |
| 513 | "properties": { |
| 514 | "run-day1": bool_schema, |
| 515 | "vdu_id": name_schema, |
| 516 | "count-index": integer0_schema, |
| 517 | }, |
| 518 | "required": ["vdu_id", "count-index"], |
| 519 | "additionalProperties": False, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 520 | }, |
| k4.rahul | e3dca38 | 2022-04-29 12:30:36 +0000 | [diff] [blame] | 521 | }, |
| 522 | "required": ["vnfInstanceId", "changeStateTo"], |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 523 | }, |
| Rahul Kumar | a30391b | 2024-05-24 14:40:23 +0530 | [diff] [blame] | 524 | "verticalScaleVnf": { |
| 525 | "type": "object", |
| 526 | "properties": { |
| 527 | "vnfInstanceId": id_schema, |
| 528 | "vnfdId": id_schema, |
| 529 | "vduId": name_schema, |
| 530 | "countIndex": integer0_schema, |
| 531 | }, |
| 532 | "required": ["vnfInstanceId", "vnfdId", "vduId"], |
| 533 | }, |
| aticig | 544a2ae | 2022-04-05 09:00:17 +0300 | [diff] [blame] | 534 | }, |
| 535 | "required": ["updateType"], |
| 536 | "additionalProperties": False, |
| 537 | } |
| 538 | |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 539 | 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] | 540 | "title": "ns action input schema", |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 541 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 542 | "type": "object", |
| 543 | "properties": { |
| tierno | b24258a | 2018-10-04 18:39:49 +0200 | [diff] [blame] | 544 | "lcmOperationType": string_schema, |
| 545 | "nsInstanceId": id_schema, |
| tierno | f5298be | 2018-05-16 14:43:57 +0200 | [diff] [blame] | 546 | "member_vnf_index": name_schema, |
| 547 | "vnf_member_index": name_schema, # TODO for backward compatibility. To remove in future |
| tierno | 7ce1db9 | 2018-07-25 12:50:52 +0200 | [diff] [blame] | 548 | "vdu_id": name_schema, |
| tierno | f063705 | 2019-03-07 16:26:47 +0000 | [diff] [blame] | 549 | "vdu_count_index": integer0_schema, |
| tierno | 9cb7d67 | 2019-10-30 12:13:48 +0000 | [diff] [blame] | 550 | "kdu_name": name_schema, |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 551 | "primitive": name_schema, |
| tierno | 50c8e6e | 2020-04-02 15:40:12 +0000 | [diff] [blame] | 552 | "timeout_ns_action": integer1_schema, |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 553 | "primitive_params": {"type": "object"}, |
| 554 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 555 | "required": ["primitive", "primitive_params"], # TODO add member_vnf_index |
| 556 | "additionalProperties": False, |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 557 | } |
| garciadeblas | 0964edf | 2022-02-11 00:43:44 +0100 | [diff] [blame] | 558 | |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 559 | ns_scale = { # TODO for the moment it is only VDU-scaling |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 560 | "title": "ns scale input schema", |
| 561 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 562 | "type": "object", |
| 563 | "properties": { |
| tierno | b24258a | 2018-10-04 18:39:49 +0200 | [diff] [blame] | 564 | "lcmOperationType": string_schema, |
| 565 | "nsInstanceId": id_schema, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 566 | "scaleType": {"enum": ["SCALE_VNF"]}, |
| tierno | 50c8e6e | 2020-04-02 15:40:12 +0000 | [diff] [blame] | 567 | "timeout_ns_scale": integer1_schema, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 568 | "scaleVnfData": { |
| 569 | "type": "object", |
| 570 | "properties": { |
| 571 | "vnfInstanceId": name_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 572 | "scaleVnfType": {"enum": ["SCALE_OUT", "SCALE_IN"]}, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 573 | "scaleByStepData": { |
| 574 | "type": "object", |
| 575 | "properties": { |
| 576 | "scaling-group-descriptor": name_schema, |
| 577 | "member-vnf-index": name_schema, |
| 578 | "scaling-policy": name_schema, |
| 579 | }, |
| 580 | "required": ["scaling-group-descriptor", "member-vnf-index"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 581 | "additionalProperties": False, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 582 | }, |
| 583 | }, |
| 584 | "required": ["scaleVnfType", "scaleByStepData"], # vnfInstanceId |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 585 | "additionalProperties": False, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 586 | }, |
| 587 | "scaleTime": time_schema, |
| 588 | }, |
| 589 | "required": ["scaleType", "scaleVnfData"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 590 | "additionalProperties": False, |
| tierno | f759d82 | 2018-06-11 18:54:54 +0200 | [diff] [blame] | 591 | } |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 592 | |
| elumalai | 8e3806c | 2022-04-28 17:26:24 +0530 | [diff] [blame] | 593 | ns_migrate = { |
| 594 | "title": "ns migrate input schema", |
| 595 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 596 | "type": "object", |
| 597 | "properties": { |
| 598 | "lcmOperationType": string_schema, |
| 599 | "nsInstanceId": id_schema, |
| 600 | "vnfInstanceId": id_schema, |
| 601 | "migrateToHost": string_schema, |
| Pedro Pereira | 5f4809d | 2024-08-23 10:40:28 +0100 | [diff] [blame] | 602 | "targetHostK8sLabels": object_schema, |
| elumalai | 8e3806c | 2022-04-28 17:26:24 +0530 | [diff] [blame] | 603 | "vdu": { |
| 604 | "type": "object", |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 605 | "properties": { |
| 606 | "vduId": name_schema, |
| 607 | "vduCountIndex": integer0_schema, |
| 608 | }, |
| 609 | "required": ["vduId"], |
| 610 | "additionalProperties": False, |
| elumalai | 8e3806c | 2022-04-28 17:26:24 +0530 | [diff] [blame] | 611 | }, |
| 612 | }, |
| 613 | "required": ["vnfInstanceId"], |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 614 | "additionalProperties": False, |
| elumalai | 8e3806c | 2022-04-28 17:26:24 +0530 | [diff] [blame] | 615 | } |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 616 | |
| garciadeblas | 0964edf | 2022-02-11 00:43:44 +0100 | [diff] [blame] | 617 | ns_heal = { |
| 618 | "title": "ns heal input schema", |
| 619 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 620 | "type": "object", |
| 621 | "properties": { |
| 622 | "lcmOperationType": string_schema, |
| 623 | "nsInstanceId": id_schema, |
| 624 | "timeout_ns_heal": integer1_schema, |
| 625 | "healVnfData": { |
| 626 | "type": "array", |
| 627 | "items": { |
| 628 | "type": "object", |
| 629 | "properties": { |
| 630 | "vnfInstanceId": id_schema, |
| 631 | "cause": description_schema, |
| 632 | "additionalParams": { |
| 633 | "type": "object", |
| 634 | "properties": { |
| 635 | "run-day1": bool_schema, |
| 636 | "vdu": { |
| 637 | "type": "array", |
| 638 | "items": { |
| 639 | "type": "object", |
| 640 | "properties": { |
| 641 | "run-day1": bool_schema, |
| 642 | "vdu-id": name_schema, |
| 643 | "count-index": integer0_schema, |
| 644 | }, |
| 645 | "required": ["vdu-id"], |
| 646 | "additionalProperties": False, |
| 647 | }, |
| 648 | }, |
| 649 | }, |
| 650 | "additionalProperties": False, |
| 651 | }, |
| 652 | }, |
| 653 | "required": ["vnfInstanceId"], |
| 654 | "additionalProperties": False, |
| 655 | }, |
| 656 | }, |
| 657 | }, |
| 658 | "required": ["healVnfData"], |
| 659 | "additionalProperties": False, |
| 660 | } |
| 661 | |
| Gabriel Cuba | 84a60df | 2023-10-30 14:01:54 -0500 | [diff] [blame] | 662 | nslcmop_cancel = { |
| 663 | "title": "Cancel nslcmop input schema", |
| 664 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 665 | "type": "object", |
| 666 | "properties": { |
| 667 | "nsLcmOpOccId": id_schema, |
| 668 | "cancelMode": { |
| 669 | "enum": [ |
| 670 | "GRACEFUL", |
| 671 | "FORCEFUL", |
| 672 | ] |
| 673 | }, |
| 674 | }, |
| 675 | "required": ["cancelMode"], |
| 676 | "additionalProperties": False, |
| 677 | } |
| 678 | |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 679 | schema_version = {"type": "string", "enum": ["1.0"]} |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 680 | schema_type = {"type": "string"} |
| tierno | b3d0a0e | 2019-11-13 15:57:51 +0000 | [diff] [blame] | 681 | vim_type = shortname_schema # {"enum": ["openstack", "openvim", "vmware", "opennebula", "aws", "azure", "fos"]} |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 682 | |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 683 | vim_account_edit_schema = { |
| 684 | "title": "vim_account edit input schema", |
| 685 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 686 | "type": "object", |
| 687 | "properties": { |
| 688 | "name": name_schema, |
| 689 | "description": description_schema, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 690 | "vim": name_schema, |
| 691 | "datacenter": name_schema, |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 692 | "vim_type": vim_type, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 693 | "vim_url": description_schema, |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 694 | # "vim_url_admin": description_schema, |
| 695 | # "vim_tenant": name_schema, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 696 | "vim_tenant_name": name_schema, |
| sousaedu | f2feafd | 2021-07-12 10:21:06 +0200 | [diff] [blame] | 697 | "vim_user": string_schema, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 698 | "vim_password": passwd_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 699 | "vca": id_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 700 | "config": {"type": "object"}, |
| vegall | 5c59aab | 2022-04-27 15:31:49 +0000 | [diff] [blame] | 701 | "prometheus-config": {"type": "object"}, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 702 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 703 | "additionalProperties": False, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 704 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 705 | |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 706 | vim_account_new_schema = { |
| 707 | "title": "vim_account creation input schema", |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 708 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 709 | "type": "object", |
| 710 | "properties": { |
| 711 | "schema_version": schema_version, |
| 712 | "schema_type": schema_type, |
| 713 | "name": name_schema, |
| 714 | "description": description_schema, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 715 | "vim": name_schema, |
| 716 | "datacenter": name_schema, |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 717 | "vim_type": vim_type, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 718 | "vim_url": description_schema, |
| 719 | # "vim_url_admin": description_schema, |
| 720 | # "vim_tenant": name_schema, |
| 721 | "vim_tenant_name": name_schema, |
| sousaedu | f2feafd | 2021-07-12 10:21:06 +0200 | [diff] [blame] | 722 | "vim_user": string_schema, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 723 | "vim_password": passwd_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 724 | "vca": id_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 725 | "config": {"type": "object"}, |
| vegall | 5c59aab | 2022-04-27 15:31:49 +0000 | [diff] [blame] | 726 | "prometheus-config": {"type": "object"}, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 727 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 728 | "required": [ |
| 729 | "name", |
| 730 | "vim_url", |
| 731 | "vim_type", |
| 732 | "vim_user", |
| 733 | "vim_password", |
| 734 | "vim_tenant_name", |
| 735 | ], |
| 736 | "additionalProperties": False, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 737 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 738 | |
| tierno | 8580772 | 2019-12-20 14:11:35 +0000 | [diff] [blame] | 739 | wim_type = shortname_schema # {"enum": ["ietfl2vpn", "onos", "odl", "dynpac", "fake"]} |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 740 | |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 741 | wim_account_edit_schema = { |
| 742 | "title": "wim_account edit input schema", |
| 743 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 744 | "type": "object", |
| 745 | "properties": { |
| 746 | "name": name_schema, |
| 747 | "description": description_schema, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 748 | "wim": name_schema, |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 749 | "wim_type": wim_type, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 750 | "wim_url": description_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 751 | "user": string_schema, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 752 | "password": passwd_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 753 | "config": {"type": "object"}, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 754 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 755 | "additionalProperties": False, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 756 | } |
| 757 | |
| 758 | wim_account_new_schema = { |
| 759 | "title": "wim_account creation input schema", |
| 760 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 761 | "type": "object", |
| 762 | "properties": { |
| 763 | "schema_version": schema_version, |
| 764 | "schema_type": schema_type, |
| 765 | "name": name_schema, |
| 766 | "description": description_schema, |
| 767 | "wim": name_schema, |
| delacruzramo | 3a144c9 | 2019-10-25 09:46:33 +0200 | [diff] [blame] | 768 | "wim_type": wim_type, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 769 | "wim_url": description_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 770 | "user": string_schema, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 771 | "password": passwd_schema, |
| tierno | f063705 | 2019-03-07 16:26:47 +0000 | [diff] [blame] | 772 | "config": { |
| 773 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 774 | "patternProperties": {".": {"not": {"type": "null"}}}, |
| 775 | }, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 776 | }, |
| 777 | "required": ["name", "wim_url", "wim_type"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 778 | "additionalProperties": False, |
| tierno | 55ba2e6 | 2018-12-11 17:22:22 +0000 | [diff] [blame] | 779 | } |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 780 | |
| 781 | sdn_properties = { |
| 782 | "name": name_schema, |
| tierno | 7adaeb0 | 2019-12-17 16:46:12 +0000 | [diff] [blame] | 783 | "type": {"type": "string"}, |
| 784 | "url": {"type": "string"}, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 785 | "user": string_schema, |
| tierno | 7adaeb0 | 2019-12-17 16:46:12 +0000 | [diff] [blame] | 786 | "password": passwd_schema, |
| 787 | "config": {"type": "object"}, |
| tierno | cfb07c6 | 2018-05-10 18:30:51 +0200 | [diff] [blame] | 788 | "description": description_schema, |
| tierno | 7adaeb0 | 2019-12-17 16:46:12 +0000 | [diff] [blame] | 789 | # The folowing are deprecated. Maintanied for backward compatibility |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 790 | "dpid": dpid_Schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 791 | "ip": ip_schema, |
| 792 | "port": port_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 793 | "version": {"type": "string", "minLength": 1, "maxLength": 12}, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 794 | } |
| 795 | sdn_new_schema = { |
| 796 | "title": "sdn controller information schema", |
| 797 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 798 | "type": "object", |
| 799 | "properties": sdn_properties, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 800 | "required": ["name", "type"], |
| 801 | "additionalProperties": False, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 802 | } |
| 803 | sdn_edit_schema = { |
| 804 | "title": "sdn controller update information schema", |
| 805 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 806 | "type": "object", |
| 807 | "properties": sdn_properties, |
| tierno | cfb07c6 | 2018-05-10 18:30:51 +0200 | [diff] [blame] | 808 | # "required": ["name", "port", 'ip', 'dpid', 'type'], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 809 | "additionalProperties": False, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 810 | } |
| 811 | sdn_port_mapping_schema = { |
| 812 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 813 | "title": "sdn port mapping information schema", |
| 814 | "type": "array", |
| 815 | "items": { |
| 816 | "type": "object", |
| 817 | "properties": { |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 818 | "compute_node": shortname_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 819 | "ports": { |
| 820 | "type": "array", |
| 821 | "items": { |
| 822 | "type": "object", |
| 823 | "properties": { |
| tierno | 42fce59 | 2018-11-02 09:23:43 +0100 | [diff] [blame] | 824 | "pci": pci_extended_schema, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 825 | "switch_port": shortname_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 826 | "switch_mac": mac_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 827 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 828 | "required": ["pci"], |
| 829 | }, |
| 830 | }, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 831 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 832 | "required": ["compute_node", "ports"], |
| 833 | }, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 834 | } |
| 835 | sdn_external_port_schema = { |
| 836 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 837 | "title": "External port information", |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 838 | "type": "object", |
| 839 | "properties": { |
| 840 | "port": {"type": "string", "minLength": 1, "maxLength": 60}, |
| 841 | "vlan": vlan_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 842 | "mac": mac_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 843 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 844 | "required": ["port"], |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 845 | } |
| 846 | |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 847 | # K8s Clusters |
| Gabriel Cuba | 50e815b | 2022-03-22 14:01:26 -0500 | [diff] [blame] | 848 | k8scluster_deploy_method_schema = { |
| 849 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 850 | "title": "Deployment methods for K8s cluster", |
| 851 | "type": "object", |
| 852 | "properties": { |
| Gabriel Cuba | 50e815b | 2022-03-22 14:01:26 -0500 | [diff] [blame] | 853 | "juju-bundle": {"type": "boolean"}, |
| 854 | "helm-chart-v3": {"type": "boolean"}, |
| 855 | }, |
| 856 | "additionalProperties": False, |
| Luis Vega | 0a1efed | 2023-11-28 16:44:30 +0000 | [diff] [blame] | 857 | "minProperties": 2, |
| Gabriel Cuba | 50e815b | 2022-03-22 14:01:26 -0500 | [diff] [blame] | 858 | } |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 859 | k8scluster_nets_schema = { |
| 860 | "title": "k8scluster nets input schema", |
| 861 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 862 | "type": "object", |
| tierno | 8c81ab0 | 2020-02-07 10:18:30 +0000 | [diff] [blame] | 863 | "patternProperties": {".": {"oneOf": [name_schema, null_schema]}}, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 864 | "minProperties": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 865 | "additionalProperties": False, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 866 | } |
| 867 | k8scluster_new_schema = { |
| 868 | "title": "k8scluster creation input schema", |
| 869 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 870 | "type": "object", |
| 871 | "properties": { |
| 872 | "schema_version": schema_version, |
| 873 | "schema_type": schema_type, |
| 874 | "name": name_schema, |
| 875 | "description": description_schema, |
| 876 | "credentials": object_schema, |
| 877 | "vim_account": id_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 878 | "vca_id": id_schema, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 879 | "k8s_version": string_schema, |
| 880 | "nets": k8scluster_nets_schema, |
| Gabriel Cuba | 50e815b | 2022-03-22 14:01:26 -0500 | [diff] [blame] | 881 | "deployment_methods": k8scluster_deploy_method_schema, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 882 | "namespace": name_schema, |
| 883 | "cni": nameshort_list_schema, |
| 884 | }, |
| 885 | "required": ["name", "credentials", "vim_account", "k8s_version", "nets"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 886 | "additionalProperties": False, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 887 | } |
| 888 | k8scluster_edit_schema = { |
| 889 | "title": "vim_account edit input schema", |
| 890 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 891 | "type": "object", |
| 892 | "properties": { |
| 893 | "name": name_schema, |
| 894 | "description": description_schema, |
| 895 | "credentials": object_schema, |
| 896 | "vim_account": id_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 897 | "vca_id": id_schema, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 898 | "k8s_version": string_schema, |
| 899 | "nets": k8scluster_nets_schema, |
| 900 | "namespace": name_schema, |
| 901 | "cni": nameshort_list_schema, |
| 902 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 903 | "additionalProperties": False, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 904 | } |
| 905 | |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 906 | # VCA |
| 907 | vca_new_schema = { |
| 908 | "title": "vca creation input schema", |
| 909 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 910 | "type": "object", |
| 911 | "properties": { |
| 912 | "schema_version": schema_version, |
| 913 | "schema_type": schema_type, |
| 914 | "name": name_schema, |
| 915 | "description": description_schema, |
| 916 | "endpoints": description_list_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 917 | "user": string_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 918 | "secret": passwd_schema, |
| 919 | "cacert": long_description_schema, |
| 920 | "lxd-cloud": shortname_schema, |
| 921 | "lxd-credentials": shortname_schema, |
| 922 | "k8s-cloud": shortname_schema, |
| 923 | "k8s-credentials": shortname_schema, |
| 924 | "model-config": object_schema, |
| 925 | }, |
| 926 | "required": [ |
| 927 | "name", |
| 928 | "endpoints", |
| 929 | "user", |
| 930 | "secret", |
| 931 | "cacert", |
| 932 | "lxd-cloud", |
| 933 | "lxd-credentials", |
| 934 | "k8s-cloud", |
| 935 | "k8s-credentials", |
| 936 | ], |
| 937 | "additionalProperties": False, |
| 938 | } |
| 939 | vca_edit_schema = { |
| 940 | "title": "vca creation input schema", |
| 941 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 942 | "type": "object", |
| 943 | "properties": { |
| 944 | "name": name_schema, |
| 945 | "description": description_schema, |
| 946 | "endpoints": description_list_schema, |
| 947 | "port": integer1_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 948 | "user": string_schema, |
| David Garcia | ecb4132 | 2021-03-31 19:10:46 +0200 | [diff] [blame] | 949 | "secret": passwd_schema, |
| 950 | "cacert": long_description_schema, |
| 951 | "lxd-cloud": shortname_schema, |
| 952 | "lxd-credentials": shortname_schema, |
| 953 | "k8s-cloud": shortname_schema, |
| 954 | "k8s-credentials": shortname_schema, |
| 955 | "model-config": object_schema, |
| 956 | }, |
| 957 | "additionalProperties": False, |
| 958 | } |
| 959 | |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 960 | # K8s Repos |
| tierno | 332e080 | 2019-12-03 23:50:49 +0000 | [diff] [blame] | 961 | k8srepo_types = {"enum": ["helm-chart", "juju-bundle"]} |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 962 | k8srepo_properties = { |
| 963 | "name": name_schema, |
| 964 | "description": description_schema, |
| 965 | "type": k8srepo_types, |
| 966 | "url": description_schema, |
| Luis Vega | f6574e3 | 2023-07-11 18:47:22 +0000 | [diff] [blame] | 967 | "cacert": long_description_schema, |
| 968 | "user": string_schema, |
| 969 | "password": passwd_schema, |
| garciadeblas | f354389 | 2023-10-20 11:53:51 +0200 | [diff] [blame] | 970 | "oci": bool_schema, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 971 | } |
| 972 | k8srepo_new_schema = { |
| 973 | "title": "k8scluster creation input schema", |
| 974 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 975 | "type": "object", |
| 976 | "properties": k8srepo_properties, |
| 977 | "required": ["name", "type", "url"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 978 | "additionalProperties": False, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 979 | } |
| 980 | k8srepo_edit_schema = { |
| 981 | "title": "vim_account edit input schema", |
| 982 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 983 | "type": "object", |
| 984 | "properties": k8srepo_properties, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 985 | "additionalProperties": False, |
| delacruzramo | fe598fe | 2019-10-23 18:25:11 +0200 | [diff] [blame] | 986 | } |
| 987 | |
| Felipe Vicens | b66b041 | 2020-05-06 10:11:00 +0200 | [diff] [blame] | 988 | # OSM Repos |
| 989 | osmrepo_types = {"enum": ["osm"]} |
| 990 | osmrepo_properties = { |
| 991 | "name": name_schema, |
| 992 | "description": description_schema, |
| 993 | "type": osmrepo_types, |
| rshri | 2d386cb | 2024-07-05 14:35:51 +0000 | [diff] [blame] | 994 | "url": description_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 995 | # "user": string_schema, |
| Felipe Vicens | b66b041 | 2020-05-06 10:11:00 +0200 | [diff] [blame] | 996 | # "password": passwd_schema |
| 997 | } |
| 998 | osmrepo_new_schema = { |
| 999 | "title": "osm repo creation input schema", |
| 1000 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1001 | "type": "object", |
| 1002 | "properties": osmrepo_properties, |
| 1003 | "required": ["name", "type", "url"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1004 | "additionalProperties": False, |
| Felipe Vicens | b66b041 | 2020-05-06 10:11:00 +0200 | [diff] [blame] | 1005 | } |
| 1006 | osmrepo_edit_schema = { |
| 1007 | "title": "osm repo edit input schema", |
| 1008 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1009 | "type": "object", |
| 1010 | "properties": osmrepo_properties, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1011 | "additionalProperties": False, |
| Felipe Vicens | b66b041 | 2020-05-06 10:11:00 +0200 | [diff] [blame] | 1012 | } |
| 1013 | |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1014 | # PDUs |
| 1015 | pdu_interface = { |
| 1016 | "type": "object", |
| 1017 | "properties": { |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 1018 | "name": shortname_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1019 | "mgmt": bool_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1020 | "type": {"enum": ["overlay", "underlay"]}, |
| garciadeblas | 1a01e1f | 2021-10-26 17:27:35 +0200 | [diff] [blame] | 1021 | "ip-address": {"oneOf": [ip_schema, ipv6_schema]}, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1022 | # TODO, add user, password, ssh-key |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 1023 | "mac-address": mac_schema, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 1024 | "vim-network-name": shortname_schema, # interface is connected to one vim network, or switch port |
| 1025 | "vim-network-id": shortname_schema, |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 1026 | # # provide this in case SDN assist must deal with this interface |
| 1027 | # "switch-dpid": dpid_Schema, |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 1028 | # "switch-port": shortname_schema, |
| 1029 | # "switch-mac": shortname_schema, |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 1030 | # "switch-vlan": vlan_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1031 | }, |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 1032 | "required": ["name", "mgmt", "ip-address"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1033 | "additionalProperties": False, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1034 | } |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1035 | pdu_new_schema = { |
| 1036 | "title": "pdu creation input schema", |
| 1037 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1038 | "type": "object", |
| 1039 | "properties": { |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 1040 | "name": shortname_schema, |
| 1041 | "type": shortname_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1042 | "description": description_schema, |
| 1043 | "shared": bool_schema, |
| 1044 | "vims": nameshort_list_schema, |
| 1045 | "vim_accounts": nameshort_list_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1046 | "interfaces": {"type": "array", "items": pdu_interface, "minItems": 1}, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1047 | }, |
| 1048 | "required": ["name", "type", "interfaces"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1049 | "additionalProperties": False, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1050 | } |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1051 | pdu_edit_schema = { |
| 1052 | "title": "pdu edit input schema", |
| 1053 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1054 | "type": "object", |
| 1055 | "properties": { |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 1056 | "name": shortname_schema, |
| 1057 | "type": shortname_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1058 | "description": description_schema, |
| 1059 | "shared": bool_schema, |
| garciadeblas | 84bdd55 | 2018-11-30 22:59:45 +0100 | [diff] [blame] | 1060 | "vims": {"oneOf": [array_edition_schema, nameshort_list_schema]}, |
| 1061 | "vim_accounts": {"oneOf": [array_edition_schema, nameshort_list_schema]}, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1062 | "interfaces": { |
| 1063 | "oneOf": [ |
| 1064 | array_edition_schema, |
| 1065 | {"type": "array", "items": pdu_interface, "minItems": 1}, |
| 1066 | ] |
| 1067 | }, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1068 | }, |
| 1069 | "additionalProperties": False, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1070 | "minProperties": 1, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1071 | } |
| 1072 | |
| delacruzramo | 271d200 | 2019-12-02 21:00:37 +0100 | [diff] [blame] | 1073 | # VNF PKG OPERATIONS |
| 1074 | vnfpkgop_new_schema = { |
| 1075 | "title": "VNF PKG operation creation input schema", |
| 1076 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1077 | "type": "object", |
| 1078 | "properties": { |
| 1079 | "lcmOperationType": string_schema, |
| 1080 | "vnfPkgId": id_schema, |
| 1081 | "kdu_name": name_schema, |
| 1082 | "primitive": name_schema, |
| 1083 | "primitive_params": {"type": "object"}, |
| 1084 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1085 | "required": [ |
| 1086 | "lcmOperationType", |
| 1087 | "vnfPkgId", |
| 1088 | "kdu_name", |
| 1089 | "primitive", |
| 1090 | "primitive_params", |
| 1091 | ], |
| 1092 | "additionalProperties": False, |
| delacruzramo | 271d200 | 2019-12-02 21:00:37 +0100 | [diff] [blame] | 1093 | } |
| 1094 | |
| garciadeblas | f30e33d | 2025-09-15 15:42:15 +0200 | [diff] [blame] | 1095 | cluster_creation_new_schema = { |
| rshri | 41b2db9 | 2025-06-11 11:17:42 +0000 | [diff] [blame] | 1096 | "$schema": "http://json-schema.org/draft-07/schema#", |
| rshri | 2d386cb | 2024-07-05 14:35:51 +0000 | [diff] [blame] | 1097 | "title": "cluster creation operation input schema", |
| rshri | 2d386cb | 2024-07-05 14:35:51 +0000 | [diff] [blame] | 1098 | "type": "object", |
| 1099 | "properties": { |
| 1100 | "name": name_schema, |
| 1101 | "vim_account": string_schema, |
| 1102 | "k8s_version": string_schema, |
| 1103 | "node_size": string_schema, |
| 1104 | "node_count": integer0_schema, |
| rshri | 17b09ec | 2024-11-07 05:48:12 +0000 | [diff] [blame] | 1105 | "description": description_schema, |
| rshri | 2d386cb | 2024-07-05 14:35:51 +0000 | [diff] [blame] | 1106 | "region_name": string_schema, |
| 1107 | "resource_group": string_schema, |
| rshri | 17b09ec | 2024-11-07 05:48:12 +0000 | [diff] [blame] | 1108 | "bootstrap": bool_schema, |
| rshri | 41b2db9 | 2025-06-11 11:17:42 +0000 | [diff] [blame] | 1109 | # "vim_type": string_schema, |
| 1110 | "private_subnet": { # Subnets validation |
| 1111 | "type": "array", |
| 1112 | "items": { # Each item in the array must be a string (subnet ID) |
| 1113 | "type": "string", |
| 1114 | "pattern": "^subnet-[a-f0-9]+$", # Optional: Add a regex pattern for basic subnet ID format |
| 1115 | }, |
| 1116 | # "minItems": 2, # Minimum 2 subnets |
| 1117 | "uniqueItems": True, # Subnet IDs must be unique |
| 1118 | }, |
| 1119 | "public_subnet": { # Subnets validation |
| 1120 | "type": "array", |
| 1121 | "items": { # Each item in the array must be a string (subnet ID) |
| 1122 | "type": "string", |
| 1123 | "pattern": "^subnet-[a-f0-9]+$", # Optional: Add a regex pattern for basic subnet ID format |
| 1124 | }, |
| 1125 | # "minItems": 2, # Minimum 2 subnets |
| 1126 | "uniqueItems": True, # Subnet IDs must be unique |
| 1127 | }, |
| yshah | d23c6a5 | 2025-06-13 05:49:31 +0000 | [diff] [blame] | 1128 | "iam_role": { |
| 1129 | "type": "string", |
| 1130 | "pattern": "^arn:aws:iam::\\d{12}:role\\/[A-Za-z0-9]+$", |
| 1131 | }, |
| garciadeblas | 9012c54 | 2026-01-13 12:15:24 +0100 | [diff] [blame] | 1132 | # additional cluster configuration parameters |
| 1133 | "config": object_schema, |
| rshri | 2d386cb | 2024-07-05 14:35:51 +0000 | [diff] [blame] | 1134 | }, |
| rshri | 41b2db9 | 2025-06-11 11:17:42 +0000 | [diff] [blame] | 1135 | "required": ["vim_account", "name", "k8s_version"], |
| rshri | 2d386cb | 2024-07-05 14:35:51 +0000 | [diff] [blame] | 1136 | "additionalProperties": False, |
| 1137 | } |
| rshri | 41b2db9 | 2025-06-11 11:17:42 +0000 | [diff] [blame] | 1138 | |
| garciadeblas | f30e33d | 2025-09-15 15:42:15 +0200 | [diff] [blame] | 1139 | cluster_registration_new_schema = { |
| rshri | 17b09ec | 2024-11-07 05:48:12 +0000 | [diff] [blame] | 1140 | "title": "cluster registration input schema", |
| 1141 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1142 | "type": "object", |
| 1143 | "properties": { |
| 1144 | "schema_version": schema_version, |
| 1145 | "schema_type": schema_type, |
| 1146 | "name": name_schema, |
| 1147 | "description": description_schema, |
| 1148 | "credentials": object_schema, |
| 1149 | "vim_account": string_schema, |
| 1150 | "bootstrap": bool_schema, |
| garciadeblas | f30e33d | 2025-09-15 15:42:15 +0200 | [diff] [blame] | 1151 | "openshift": bool_schema, |
| rshri | 17b09ec | 2024-11-07 05:48:12 +0000 | [diff] [blame] | 1152 | }, |
| 1153 | "required": ["name", "credentials", "vim_account"], |
| 1154 | "additionalProperties": False, |
| 1155 | } |
| rshri | 2d386cb | 2024-07-05 14:35:51 +0000 | [diff] [blame] | 1156 | |
| yshah | 99122b8 | 2024-11-18 07:05:29 +0000 | [diff] [blame] | 1157 | cluster_edit_schema = { |
| 1158 | "title": "cluster edit schema", |
| 1159 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1160 | "type": "object", |
| 1161 | "properties": { |
| 1162 | "name": name_schema, |
| 1163 | "description": string_schema, |
| 1164 | }, |
| 1165 | "additionalProperties": False, |
| 1166 | } |
| 1167 | |
| 1168 | cluster_update_schema = { |
| 1169 | "title": "cluster update schema", |
| 1170 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1171 | "type": "object", |
| 1172 | "properties": { |
| 1173 | "k8s_version": string_schema, |
| 1174 | "node_size": string_schema, |
| 1175 | "node_count": integer0_schema, |
| 1176 | }, |
| 1177 | "additionalProperties": True, |
| 1178 | } |
| 1179 | |
| rshri | 2d386cb | 2024-07-05 14:35:51 +0000 | [diff] [blame] | 1180 | infra_controller_profile_create_new_schema = { |
| 1181 | "title": "infra profile creation operation input schema", |
| 1182 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1183 | "type": "object", |
| 1184 | "properties": { |
| 1185 | "name": name_schema, |
| 1186 | "description": string_schema, |
| 1187 | }, |
| 1188 | "additionalProperties": False, |
| 1189 | } |
| 1190 | |
| 1191 | infra_controller_profile_create_edit_schema = { |
| 1192 | "title": "infra profile creation operation input schema", |
| 1193 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1194 | "type": "object", |
| 1195 | "properties": { |
| 1196 | "name": name_schema, |
| 1197 | "description": string_schema, |
| 1198 | }, |
| 1199 | "additionalProperties": False, |
| 1200 | } |
| 1201 | |
| 1202 | infra_config_profile_create_new_schema = { |
| 1203 | "title": "infra profile creation operation input schema", |
| 1204 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1205 | "type": "object", |
| 1206 | "properties": { |
| 1207 | "name": name_schema, |
| 1208 | "description": string_schema, |
| 1209 | }, |
| 1210 | "additionalProperties": False, |
| 1211 | } |
| 1212 | |
| 1213 | infra_config_profile_create_edit_schema = { |
| 1214 | "title": "infra profile creation operation input schema", |
| 1215 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1216 | "type": "object", |
| 1217 | "properties": { |
| 1218 | "name": name_schema, |
| 1219 | "description": string_schema, |
| 1220 | }, |
| 1221 | "additionalProperties": False, |
| 1222 | } |
| 1223 | |
| 1224 | app_profile_create_new_schema = { |
| 1225 | "title": "app profile creation operation input schema", |
| 1226 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1227 | "type": "object", |
| 1228 | "properties": { |
| 1229 | "name": name_schema, |
| 1230 | "description": string_schema, |
| 1231 | }, |
| 1232 | "additionalProperties": False, |
| 1233 | } |
| 1234 | app_profile_create_edit_schema = { |
| 1235 | "title": "app profile creation operation input schema", |
| 1236 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1237 | "type": "object", |
| 1238 | "properties": { |
| 1239 | "name": name_schema, |
| 1240 | "description": string_schema, |
| 1241 | }, |
| 1242 | "additionalProperties": False, |
| 1243 | } |
| 1244 | |
| 1245 | resource_profile_create_new_schema = { |
| 1246 | "title": "resource profile creation operation input schema", |
| 1247 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1248 | "type": "object", |
| 1249 | "properties": { |
| 1250 | "name": name_schema, |
| 1251 | "description": string_schema, |
| 1252 | }, |
| 1253 | "additionalProperties": False, |
| 1254 | } |
| 1255 | resource_profile_create_edit_schema = { |
| 1256 | "title": "resource profile creation operation input schema", |
| 1257 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1258 | "type": "object", |
| 1259 | "properties": { |
| 1260 | "name": name_schema, |
| 1261 | "description": string_schema, |
| 1262 | }, |
| 1263 | "additionalProperties": False, |
| 1264 | } |
| 1265 | |
| 1266 | attach_profile = { |
| 1267 | "type": "array", |
| 1268 | "items": { |
| 1269 | "type": "object", |
| 1270 | "properties": {"id": id_schema}, |
| 1271 | "additionalProperties": False, |
| 1272 | }, |
| 1273 | } |
| 1274 | remove_profile = { |
| 1275 | "type": "array", |
| 1276 | "items": { |
| 1277 | "type": "object", |
| 1278 | "properties": {"id": id_schema}, |
| 1279 | "additionalProperties": False, |
| 1280 | }, |
| 1281 | } |
| 1282 | attach_dettach_profile_schema = { |
| 1283 | "title": "attach/dettach profiles", |
| 1284 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1285 | "type": "object", |
| 1286 | "properties": { |
| 1287 | "add_profile": attach_profile, |
| 1288 | "remove_profile": remove_profile, |
| 1289 | }, |
| 1290 | "additionalProperties": False, |
| 1291 | } |
| yshah | d23c6a5 | 2025-06-13 05:49:31 +0000 | [diff] [blame] | 1292 | |
| 1293 | node_create_new_schema = { |
| 1294 | "title": "node creation operation input schema", |
| 1295 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1296 | "type": "object", |
| 1297 | "properties": { |
| 1298 | "name": name_schema, |
| 1299 | "cluster_id": id_schema, |
| 1300 | "description": string_schema, |
| 1301 | "node_count": integer0_schema, |
| 1302 | "node_size": string_schema, |
| 1303 | "private_subnet": { |
| 1304 | "type": "array", |
| 1305 | "items": { |
| 1306 | "type": "string", |
| 1307 | "pattern": "^subnet-[a-f0-9]+$", |
| 1308 | }, |
| 1309 | "uniqueItems": True, |
| 1310 | }, |
| 1311 | "public_subnet": { |
| 1312 | "type": "array", |
| 1313 | "items": { |
| 1314 | "type": "string", |
| 1315 | "pattern": "^subnet-[a-f0-9]+$", |
| 1316 | }, |
| 1317 | "uniqueItems": True, |
| 1318 | }, |
| 1319 | "iam_role": { |
| 1320 | "type": "string", |
| 1321 | "pattern": "^arn:aws:iam::\\d{12}:role\\/[A-Za-z0-9]+$", |
| 1322 | }, |
| 1323 | }, |
| 1324 | "required": [ |
| 1325 | "name", |
| 1326 | "cluster_id", |
| 1327 | "node_size", |
| 1328 | "node_count", |
| 1329 | ], |
| 1330 | "anyOf": [{"required": ["private_subnet"]}, {"required": ["public_subnet"]}], |
| 1331 | "additionalProperties": False, |
| 1332 | } |
| 1333 | |
| 1334 | node_edit_schema = { |
| 1335 | "title": "node update operation input schema", |
| 1336 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1337 | "type": "object", |
| 1338 | "properties": { |
| 1339 | "name": name_schema, |
| 1340 | "cluster_id": id_schema, |
| 1341 | "description": string_schema, |
| 1342 | "node_count": integer0_schema, |
| 1343 | }, |
| 1344 | "additionalProperties": False, |
| 1345 | } |
| 1346 | |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1347 | # USERS |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1348 | project_role_mappings = { |
| 1349 | "title": "list pf projects/roles", |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1350 | "$schema": "http://json-schema.org/draft-04/schema#", |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1351 | "type": "array", |
| 1352 | "items": { |
| 1353 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1354 | "properties": {"project": shortname_schema, "role": shortname_schema}, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1355 | "required": ["project", "role"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1356 | "additionalProperties": False, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1357 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1358 | "minItems": 1, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1359 | } |
| rshri | 2d386cb | 2024-07-05 14:35:51 +0000 | [diff] [blame] | 1360 | |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1361 | project_role_mappings_optional = { |
| 1362 | "title": "list of projects/roles or projects only", |
| 1363 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1364 | "type": "array", |
| 1365 | "items": { |
| 1366 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1367 | "properties": {"project": shortname_schema, "role": shortname_schema}, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1368 | "required": ["project"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1369 | "additionalProperties": False, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1370 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1371 | "minItems": 1, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1372 | } |
| rshri | 2d386cb | 2024-07-05 14:35:51 +0000 | [diff] [blame] | 1373 | |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1374 | user_new_schema = { |
| 1375 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1376 | "title": "New user schema", |
| 1377 | "type": "object", |
| 1378 | "properties": { |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 1379 | "username": string_schema, |
| jegan | be1a3df | 2024-06-04 12:05:19 +0000 | [diff] [blame] | 1380 | "email_id": email_schema, |
| tierno | ad6d533 | 2020-02-19 14:29:49 +0000 | [diff] [blame] | 1381 | "domain_name": shortname_schema, |
| garciadeblas | 6d83f8f | 2023-06-19 22:34:49 +0200 | [diff] [blame] | 1382 | "password": user_passwd_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1383 | "projects": nameshort_list_schema, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1384 | "project_role_mappings": project_role_mappings, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1385 | }, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1386 | "required": ["username", "password"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1387 | "additionalProperties": False, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1388 | } |
| 1389 | user_edit_schema = { |
| 1390 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1391 | "title": "User edit schema for administrators", |
| 1392 | "type": "object", |
| 1393 | "properties": { |
| garciadeblas | 6d83f8f | 2023-06-19 22:34:49 +0200 | [diff] [blame] | 1394 | "password": user_passwd_schema, |
| jegan | be1a3df | 2024-06-04 12:05:19 +0000 | [diff] [blame] | 1395 | "email_id": email_schema, |
| selvi.j | a9a1fc8 | 2022-04-04 06:54:30 +0000 | [diff] [blame] | 1396 | "old_password": passwd_schema, |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 1397 | "username": string_schema, # To allow User Name modification |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1398 | "projects": {"oneOf": [nameshort_list_schema, array_edition_schema]}, |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 1399 | "project_role_mappings": project_role_mappings, |
| 1400 | "add_project_role_mappings": project_role_mappings, |
| 1401 | "remove_project_role_mappings": project_role_mappings_optional, |
| garciadeblas | 6d83f8f | 2023-06-19 22:34:49 +0200 | [diff] [blame] | 1402 | "system_admin_id": id_schema, |
| 1403 | "unlock": bool_schema, |
| 1404 | "renew": bool_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1405 | }, |
| 1406 | "minProperties": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1407 | "additionalProperties": False, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1408 | } |
| 1409 | |
| 1410 | # PROJECTS |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1411 | topics_with_quota = [ |
| 1412 | "vnfds", |
| 1413 | "nsds", |
| 1414 | "slice_templates", |
| 1415 | "pduds", |
| 1416 | "ns_instances", |
| 1417 | "slice_instances", |
| 1418 | "vim_accounts", |
| 1419 | "wim_accounts", |
| 1420 | "sdn_controllers", |
| 1421 | "k8sclusters", |
| 1422 | "vca", |
| 1423 | "k8srepos", |
| 1424 | "osmrepos", |
| 1425 | "ns_subscriptions", |
| 1426 | ] |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1427 | project_new_schema = { |
| 1428 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1429 | "title": "New project schema for administrators", |
| 1430 | "type": "object", |
| 1431 | "properties": { |
| tierno | fd16057 | 2019-01-21 10:41:37 +0000 | [diff] [blame] | 1432 | "name": shortname_schema, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1433 | "admin": bool_schema, |
| tierno | ad6d533 | 2020-02-19 14:29:49 +0000 | [diff] [blame] | 1434 | "domain_name": shortname_schema, |
| delacruzramo | 32bab47 | 2019-09-13 12:24:22 +0200 | [diff] [blame] | 1435 | "quotas": { |
| 1436 | "type": "object", |
| 1437 | "properties": {topic: integer0_schema for topic in topics_with_quota}, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1438 | "additionalProperties": False, |
| delacruzramo | 32bab47 | 2019-09-13 12:24:22 +0200 | [diff] [blame] | 1439 | }, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1440 | }, |
| 1441 | "required": ["name"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1442 | "additionalProperties": False, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1443 | } |
| 1444 | project_edit_schema = { |
| 1445 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1446 | "title": "Project edit schema for administrators", |
| 1447 | "type": "object", |
| 1448 | "properties": { |
| 1449 | "admin": bool_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1450 | "name": shortname_schema, # To allow Project Name modification |
| delacruzramo | 32bab47 | 2019-09-13 12:24:22 +0200 | [diff] [blame] | 1451 | "quotas": { |
| 1452 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1453 | "properties": { |
| 1454 | topic: {"oneOf": [integer0_schema, null_schema]} |
| 1455 | for topic in topics_with_quota |
| 1456 | }, |
| 1457 | "additionalProperties": False, |
| delacruzramo | 32bab47 | 2019-09-13 12:24:22 +0200 | [diff] [blame] | 1458 | }, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1459 | }, |
| 1460 | "additionalProperties": False, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1461 | "minProperties": 1, |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1462 | } |
| 1463 | |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1464 | # ROLES |
| 1465 | roles_new_schema = { |
| 1466 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1467 | "title": "New role schema for administrators", |
| 1468 | "type": "object", |
| 1469 | "properties": { |
| 1470 | "name": shortname_schema, |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 1471 | "permissions": { |
| 1472 | "type": "object", |
| 1473 | "patternProperties": { |
| 1474 | ".": bool_schema, |
| 1475 | }, |
| 1476 | # "minProperties": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1477 | }, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1478 | }, |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 1479 | "required": ["name"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1480 | "additionalProperties": False, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1481 | } |
| 1482 | roles_edit_schema = { |
| 1483 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1484 | "title": "Roles edit schema for administrators", |
| 1485 | "type": "object", |
| 1486 | "properties": { |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 1487 | "name": shortname_schema, |
| 1488 | "permissions": { |
| 1489 | "type": "object", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1490 | "patternProperties": {".": {"oneOf": [bool_schema, null_schema]}}, |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 1491 | # "minProperties": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1492 | }, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1493 | }, |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 1494 | "additionalProperties": False, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1495 | "minProperties": 1, |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 1496 | } |
| 1497 | |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1498 | # GLOBAL SCHEMAS |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1499 | |
| 1500 | nbi_new_input_schemas = { |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1501 | "users": user_new_schema, |
| 1502 | "projects": project_new_schema, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 1503 | "vim_accounts": vim_account_new_schema, |
| tierno | 65acb4d | 2018-04-06 16:42:40 +0200 | [diff] [blame] | 1504 | "sdns": sdn_new_schema, |
| 1505 | "ns_instantiate": ns_instantiate, |
| 1506 | "ns_action": ns_action, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1507 | "ns_scale": ns_scale, |
| aticig | 544a2ae | 2022-04-05 09:00:17 +0300 | [diff] [blame] | 1508 | "ns_update": ns_update, |
| garciadeblas | 0964edf | 2022-02-11 00:43:44 +0100 | [diff] [blame] | 1509 | "ns_heal": ns_heal, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1510 | "pdus": pdu_new_schema, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1511 | } |
| 1512 | |
| 1513 | nbi_edit_input_schemas = { |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1514 | "users": user_edit_schema, |
| 1515 | "projects": project_edit_schema, |
| tierno | 09c073e | 2018-04-26 13:36:48 +0200 | [diff] [blame] | 1516 | "vim_accounts": vim_account_edit_schema, |
| tierno | cb83c94 | 2018-09-24 17:28:13 +0200 | [diff] [blame] | 1517 | "sdns": sdn_edit_schema, |
| 1518 | "pdus": pdu_edit_schema, |
| kayal2001 | f71c2e8 | 2024-06-25 15:26:24 +0530 | [diff] [blame] | 1519 | "vnf": vnf_schema, |
| 1520 | "vld": vld_schema, |
| 1521 | "additionalParamsForVnf": additional_params_for_vnf, |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1522 | } |
| 1523 | |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1524 | # NETSLICE SCHEMAS |
| tierno | 032916c | 2019-03-22 13:27:12 +0000 | [diff] [blame] | 1525 | nsi_subnet_instantiate = deepcopy(ns_instantiate) |
| 1526 | nsi_subnet_instantiate["title"] = "netslice subnet instantiation params input schema" |
| 1527 | nsi_subnet_instantiate["properties"]["id"] = name_schema |
| 1528 | del nsi_subnet_instantiate["required"] |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 1529 | |
| 1530 | nsi_vld_instantiate = { |
| 1531 | "title": "netslice vld instantiation params input schema", |
| 1532 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1533 | "type": "object", |
| 1534 | "properties": { |
| 1535 | "name": string_schema, |
| tierno | 195a36c | 2020-09-18 14:18:55 +0000 | [diff] [blame] | 1536 | "vim-network-name": {"oneOf": [string_schema, object_schema]}, |
| 1537 | "vim-network-id": {"oneOf": [string_schema, object_schema]}, |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 1538 | "ip-profile": object_schema, |
| 1539 | }, |
| delacruzramo | c061f56 | 2019-04-05 11:00:02 +0200 | [diff] [blame] | 1540 | "required": ["name"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1541 | "additionalProperties": False, |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 1542 | } |
| 1543 | |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1544 | nsi_instantiate = { |
| 1545 | "title": "netslice action instantiate input schema", |
| 1546 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1547 | "type": "object", |
| 1548 | "properties": { |
| 1549 | "lcmOperationType": string_schema, |
| Felipe Vicens | 126af57 | 2019-06-05 19:13:04 +0200 | [diff] [blame] | 1550 | "netsliceInstanceId": id_schema, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1551 | "nsiName": name_schema, |
| tierno | 4f9d4ae | 2019-03-20 17:24:11 +0000 | [diff] [blame] | 1552 | "nsiDescription": {"oneOf": [description_schema, null_schema]}, |
| tierno | 9e5eea3 | 2018-11-29 09:42:09 +0000 | [diff] [blame] | 1553 | "nstId": string_schema, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1554 | "vimAccountId": id_schema, |
| tierno | a8186a5 | 2020-01-14 15:54:48 +0000 | [diff] [blame] | 1555 | "timeout_nsi_deploy": integer1_schema, |
| Felipe Vicens | 26202bb | 2020-05-24 18:57:33 +0200 | [diff] [blame] | 1556 | "ssh_keys": {"type": "array", "items": {"type": "string"}}, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1557 | "nsi_id": id_schema, |
| tierno | 032916c | 2019-03-22 13:27:12 +0000 | [diff] [blame] | 1558 | "additionalParamsForNsi": object_schema, |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 1559 | "netslice-subnet": { |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1560 | "type": "array", |
| 1561 | "minItems": 1, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1562 | "items": nsi_subnet_instantiate, |
| garciadeblas | daf8cc5 | 2018-11-30 14:17:20 +0100 | [diff] [blame] | 1563 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1564 | "netslice-vld": {"type": "array", "minItems": 1, "items": nsi_vld_instantiate}, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1565 | }, |
| Felipe Vicens | c8bbaaa | 2018-12-01 04:42:40 +0100 | [diff] [blame] | 1566 | "required": ["nsiName", "nstId", "vimAccountId"], |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1567 | "additionalProperties": False, |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1568 | } |
| 1569 | |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1570 | nsi_action = {} |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1571 | |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1572 | nsi_terminate = {} |
| Felipe Vicens | 07f3172 | 2018-10-29 15:16:44 +0100 | [diff] [blame] | 1573 | |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1574 | nsinstancesubscriptionfilter_schema = { |
| 1575 | "title": "instance identifier schema", |
| 1576 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1577 | "type": "object", |
| 1578 | "properties": { |
| 1579 | "nsdIds": {"type": "array"}, |
| 1580 | "vnfdIds": {"type": "array"}, |
| 1581 | "pnfdIds": {"type": "array"}, |
| 1582 | "nsInstanceIds": {"type": "array"}, |
| 1583 | "nsInstanceNames": {"type": "array"}, |
| 1584 | }, |
| 1585 | } |
| 1586 | |
| 1587 | nslcmsub_schema = { |
| 1588 | "title": "nslcmsubscription input schema", |
| 1589 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1590 | "type": "object", |
| 1591 | "properties": { |
| 1592 | "nsInstanceSubscriptionFilter": nsinstancesubscriptionfilter_schema, |
| 1593 | "notificationTypes": { |
| 1594 | "type": "array", |
| 1595 | "items": { |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1596 | "enum": [ |
| 1597 | "NsLcmOperationOccurrenceNotification", |
| 1598 | "NsChangeNotification", |
| 1599 | "NsIdentifierCreationNotification", |
| 1600 | "NsIdentifierDeletionNotification", |
| 1601 | ] |
| 1602 | }, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1603 | }, |
| 1604 | "operationTypes": { |
| 1605 | "type": "array", |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1606 | "items": {"enum": ["INSTANTIATE", "SCALE", "TERMINATE", "UPDATE", "HEAL"]}, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1607 | }, |
| 1608 | "operationStates": { |
| 1609 | "type": "array", |
| 1610 | "items": { |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1611 | "enum": [ |
| 1612 | "PROCESSING", |
| 1613 | "COMPLETED", |
| 1614 | "PARTIALLY_COMPLETED", |
| 1615 | "FAILED", |
| 1616 | "FAILED_TEMP", |
| 1617 | "ROLLING_BACK", |
| 1618 | "ROLLED_BACK", |
| 1619 | ] |
| 1620 | }, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1621 | }, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1622 | "nsComponentTypes": {"type": "array", "items": {"enum": ["VNF", "NS", "PNF"]}}, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1623 | "lcmOpNameImpactingNsComponent": { |
| 1624 | "type": "array", |
| 1625 | "items": { |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1626 | "enum": [ |
| 1627 | "VNF_INSTANTIATE", |
| 1628 | "VNF_SCALE", |
| 1629 | "VNF_SCALE_TO_LEVEL", |
| 1630 | "VNF_CHANGE_FLAVOUR", |
| 1631 | "VNF_TERMINATE", |
| 1632 | "VNF_HEAL", |
| 1633 | "VNF_OPERATE", |
| 1634 | "VNF_CHANGE_EXT_CONN", |
| 1635 | "VNF_MODIFY_INFO", |
| 1636 | "NS_INSTANTIATE", |
| 1637 | "NS_SCALE", |
| 1638 | "NS_UPDATE", |
| 1639 | "NS_TERMINATE", |
| 1640 | "NS_HEAL", |
| 1641 | ] |
| 1642 | }, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1643 | }, |
| 1644 | "lcmOpOccStatusImpactingNsComponent": { |
| 1645 | "type": "array", |
| 1646 | "items": { |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1647 | "enum": [ |
| 1648 | "START", |
| 1649 | "COMPLETED", |
| 1650 | "PARTIALLY_COMPLETED", |
| 1651 | "FAILED", |
| 1652 | "ROLLED_BACK", |
| 1653 | ] |
| 1654 | }, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1655 | }, |
| 1656 | }, |
| 1657 | "allOf": [ |
| 1658 | { |
| 1659 | "if": { |
| 1660 | "properties": { |
| 1661 | "notificationTypes": { |
| 1662 | "contains": {"const": "NsLcmOperationOccurrenceNotification"} |
| 1663 | } |
| 1664 | }, |
| 1665 | }, |
| 1666 | "then": { |
| 1667 | "anyOf": [ |
| 1668 | {"required": ["operationTypes"]}, |
| 1669 | {"required": ["operationStates"]}, |
| 1670 | ] |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1671 | }, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1672 | }, |
| 1673 | { |
| 1674 | "if": { |
| 1675 | "properties": { |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1676 | "notificationTypes": {"contains": {"const": "NsChangeNotification"}} |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1677 | }, |
| 1678 | }, |
| 1679 | "then": { |
| 1680 | "anyOf": [ |
| 1681 | {"required": ["nsComponentTypes"]}, |
| 1682 | {"required": ["lcmOpNameImpactingNsComponent"]}, |
| 1683 | {"required": ["lcmOpOccStatusImpactingNsComponent"]}, |
| 1684 | ] |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1685 | }, |
| 1686 | }, |
| 1687 | ], |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1688 | } |
| 1689 | |
| 1690 | authentication_schema = { |
| 1691 | "title": "authentication schema for subscription", |
| 1692 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1693 | "type": "object", |
| 1694 | "properties": { |
| 1695 | "authType": {"enum": ["basic"]}, |
| 1696 | "paramsBasic": { |
| 1697 | "type": "object", |
| 1698 | "properties": { |
| sousaedu | 80b6fed | 2021-10-07 15:17:32 +0100 | [diff] [blame] | 1699 | "userName": string_schema, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1700 | "password": passwd_schema, |
| 1701 | }, |
| 1702 | }, |
| 1703 | }, |
| 1704 | } |
| 1705 | |
| 1706 | subscription = { |
| 1707 | "title": "subscription input schema", |
| 1708 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1709 | "type": "object", |
| 1710 | "properties": { |
| 1711 | "filter": nslcmsub_schema, |
| 1712 | "CallbackUri": description_schema, |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1713 | "authentication": authentication_schema, |
| preethika.p | 329b818 | 2020-04-22 12:25:39 +0530 | [diff] [blame] | 1714 | }, |
| 1715 | "required": ["CallbackUri"], |
| 1716 | } |
| 1717 | |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1718 | vnflcmsub_schema = { |
| 1719 | "title": "vnflcmsubscription input schema", |
| 1720 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1721 | "type": "object", |
| 1722 | "properties": { |
| 1723 | "VnfInstanceSubscriptionFilter": { |
| 1724 | "type": "object", |
| 1725 | "properties": { |
| 1726 | "vnfdIds": {"type": "array"}, |
| 1727 | "vnfInstanceIds": {"type": "array"}, |
| 1728 | }, |
| 1729 | }, |
| 1730 | "notificationTypes": { |
| 1731 | "type": "array", |
| 1732 | "items": { |
| 1733 | "enum": [ |
| 1734 | "VnfIdentifierCreationNotification", |
| 1735 | "VnfLcmOperationOccurrenceNotification", |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1736 | "VnfIdentifierDeletionNotification", |
| 1737 | ] |
| 1738 | }, |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1739 | }, |
| 1740 | "operationTypes": { |
| 1741 | "type": "array", |
| 1742 | "items": { |
| 1743 | "enum": [ |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1744 | "INSTANTIATE", |
| 1745 | "SCALE", |
| 1746 | "SCALE_TO_LEVEL", |
| 1747 | "CHANGE_FLAVOUR", |
| 1748 | "TERMINATE", |
| 1749 | "HEAL", |
| 1750 | "OPERATE", |
| 1751 | "CHANGE_EXT_CONN", |
| 1752 | "MODIFY_INFO", |
| 1753 | "CREATE_SNAPSHOT", |
| 1754 | "REVERT_TO_SNAPSHOT", |
| 1755 | "CHANGE_VNFPKG", |
| 1756 | ] |
| 1757 | }, |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1758 | }, |
| 1759 | "operationStates": { |
| 1760 | "type": "array", |
| 1761 | "items": { |
| 1762 | "enum": [ |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1763 | "STARTING", |
| 1764 | "PROCESSING", |
| 1765 | "COMPLETED", |
| 1766 | "FAILED_TEMP", |
| 1767 | "FAILED", |
| 1768 | "ROLLING_BACK", |
| 1769 | "ROLLED_BACK", |
| 1770 | ] |
| 1771 | }, |
| 1772 | }, |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1773 | }, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1774 | "required": ["VnfInstanceSubscriptionFilter", "notificationTypes"], |
| 1775 | } |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1776 | |
| 1777 | vnf_subscription = { |
| 1778 | "title": "vnf subscription input schema", |
| 1779 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1780 | "type": "object", |
| 1781 | "properties": { |
| 1782 | "filter": vnflcmsub_schema, |
| 1783 | "CallbackUri": description_schema, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1784 | "authentication": authentication_schema, |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1785 | }, |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 1786 | "required": ["filter", "CallbackUri"], |
| selvi.j | f100459 | 2022-04-29 05:42:35 +0000 | [diff] [blame] | 1787 | } |
| 1788 | |
| yshah | 53cc9eb | 2024-07-05 13:06:31 +0000 | [diff] [blame] | 1789 | oka_schema = { |
| 1790 | "title": "Create OKA package input schema", |
| 1791 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1792 | "type": "object", |
| 1793 | "properties": { |
| 1794 | "name": name_schema, |
| 1795 | "description": description_schema, |
| garciadeblas | 3fb820d | 2024-12-05 13:11:11 +0100 | [diff] [blame] | 1796 | "profile_type": profile_type_schema, |
| yshah | 53cc9eb | 2024-07-05 13:06:31 +0000 | [diff] [blame] | 1797 | }, |
| 1798 | "additionalProperties": False, |
| 1799 | } |
| 1800 | |
| 1801 | ksu_schema = { |
| 1802 | "title": "ksu schema", |
| 1803 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1804 | "type": "object", |
| 1805 | "properties": { |
| 1806 | "name": name_schema, |
| 1807 | "description": description_schema, |
| 1808 | "profile": { |
| 1809 | "type": "object", |
| 1810 | "properties": { |
| garciadeblas | 3fb820d | 2024-12-05 13:11:11 +0100 | [diff] [blame] | 1811 | "profile_type": profile_type_schema, |
| yshah | 53cc9eb | 2024-07-05 13:06:31 +0000 | [diff] [blame] | 1812 | "_id": id_schema, |
| 1813 | }, |
| 1814 | "additionalProperties": False, |
| 1815 | }, |
| 1816 | "oka": { |
| 1817 | "type": "array", |
| 1818 | "items": { |
| 1819 | "type": "object", |
| 1820 | "properties": { |
| 1821 | "_id": id_schema, |
| 1822 | "sw_catalog_path": string_schema, |
| 1823 | "transformation": object_schema, |
| 1824 | }, |
| 1825 | "additionalProperties": False, |
| 1826 | }, |
| 1827 | }, |
| 1828 | }, |
| 1829 | "additionalProperties": False, |
| 1830 | } |
| 1831 | |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1832 | |
| garciadeblas | b798f45 | 2025-08-05 18:21:26 +0200 | [diff] [blame] | 1833 | app_instance_schema = { |
| 1834 | "title": "app instance schema", |
| 1835 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 1836 | "type": "object", |
| 1837 | "properties": { |
| 1838 | "name": name_schema, |
| 1839 | "description": description_schema, |
| 1840 | "profile": id_schema, |
| 1841 | "profile_type": profile_type_schema, |
| 1842 | "oka": id_schema, |
| 1843 | "sw_catalog_path": string_schema, |
| 1844 | "model": object_schema, |
| 1845 | "params": object_schema, |
| 1846 | "secret_params": object_schema, |
| 1847 | }, |
| 1848 | "additionalProperties": False, |
| 1849 | "required": ["name", "profile", "profile_type"], |
| 1850 | } |
| 1851 | |
| garciadeblas | ed40146 | 2026-01-16 02:51:15 +0100 | [diff] [blame] | 1852 | app_instance_edit_schema = { |
| 1853 | "title": "app instance edit schema", |
| 1854 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1855 | "type": "object", |
| 1856 | "properties": { |
| 1857 | "name": name_schema, |
| 1858 | "description": string_schema, |
| 1859 | }, |
| 1860 | "additionalProperties": False, |
| 1861 | } |
| 1862 | |
| 1863 | app_instance_update_schema = { |
| 1864 | "title": "app instance update schema", |
| 1865 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 1866 | "type": "object", |
| 1867 | "properties": { |
| 1868 | "model": object_schema, |
| 1869 | "params": object_schema, |
| 1870 | "secret_params": object_schema, |
| 1871 | }, |
| 1872 | "additionalProperties": True, |
| 1873 | } |
| 1874 | |
| garciadeblas | b798f45 | 2025-08-05 18:21:26 +0200 | [diff] [blame] | 1875 | |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1876 | class ValidationError(Exception): |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 1877 | def __init__(self, message, http_code=HTTPStatus.UNPROCESSABLE_ENTITY): |
| 1878 | self.http_code = http_code |
| 1879 | Exception.__init__(self, message) |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1880 | |
| 1881 | |
| tierno | b24258a | 2018-10-04 18:39:49 +0200 | [diff] [blame] | 1882 | def validate_input(indata, schema_to_use): |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1883 | """ |
| tierno | cd54a4a | 2018-09-12 16:40:35 +0200 | [diff] [blame] | 1884 | Validates input data against json schema |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1885 | :param indata: user input data. Should be a dictionary |
| tierno | b24258a | 2018-10-04 18:39:49 +0200 | [diff] [blame] | 1886 | :param schema_to_use: jsonschema to test |
| 1887 | :return: None if ok, raises ValidationError exception on error |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1888 | """ |
| 1889 | try: |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1890 | if schema_to_use: |
| 1891 | js_v(indata, schema_to_use) |
| 1892 | return None |
| 1893 | except js_e.ValidationError as e: |
| 1894 | if e.path: |
| tierno | 0da5225 | 2018-06-27 15:47:22 +0200 | [diff] [blame] | 1895 | error_pos = "at '" + ":".join(map(str, e.path)) + "'" |
| tierno | 0f98af5 | 2018-03-19 10:28:22 +0100 | [diff] [blame] | 1896 | else: |
| 1897 | error_pos = "" |
| tierno | 441dbbf | 2018-07-10 12:52:48 +0200 | [diff] [blame] | 1898 | raise ValidationError("Format error {} '{}' ".format(error_pos, e.message)) |
| tierno | 36ec860 | 2018-11-02 17:27:11 +0100 | [diff] [blame] | 1899 | except js_e.SchemaError: |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 1900 | raise ValidationError( |
| 1901 | "Bad json schema {}".format(schema_to_use), |
| 1902 | http_code=HTTPStatus.INTERNAL_SERVER_ERROR, |
| 1903 | ) |
| delacruzramo | c061f56 | 2019-04-05 11:00:02 +0200 | [diff] [blame] | 1904 | |
| 1905 | |
| 1906 | def is_valid_uuid(x): |
| 1907 | """ |
| 1908 | Test for a valid UUID |
| 1909 | :param x: string to test |
| 1910 | :return: True if x is a valid uuid, False otherwise |
| 1911 | """ |
| 1912 | try: |
| 1913 | if UUID(x): |
| 1914 | return True |
| tierno | bdebce9 | 2019-07-01 15:36:49 +0000 | [diff] [blame] | 1915 | except (TypeError, ValueError, AttributeError): |
| delacruzramo | c061f56 | 2019-04-05 11:00:02 +0200 | [diff] [blame] | 1916 | return False |