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