| 1 |
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P. |
| 2 |
# All Rights Reserved. |
| 3 |
# |
| 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 |
# not use this file except in compliance with the License. You may obtain |
| 6 |
# a copy of the License at |
| 7 |
# |
| 8 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 |
# License for the specific language governing permissions and limitations |
| 14 |
# under the License. |
| 15 |
|
| 16 |
from neutron_lib.api import converters |
| 17 |
from neutron_lib.api.definitions import l3 |
| 18 |
from neutron_lib.api import validators |
| 19 |
from neutron_lib.db import constants as db_const |
| 20 |
|
| 21 |
# Resource constants |
| 22 |
VPNSERVICE = 'vpnservice' |
| 23 |
VPNSERVICES = 'vpnservices' |
| 24 |
IPSEC_SITE_CONNECTION = 'ipsec_site_connection' |
| 25 |
IPSEC_SITE_CONNECTIONS = 'ipsec_site_connections' |
| 26 |
IPSEC_POLICY = 'ipsecpolicy' |
| 27 |
IPSEC_POLICIES = 'ipsecpolicies' |
| 28 |
IKE_POLICY = 'ikepolicy' |
| 29 |
IKE_POLICIES = 'ikepolicies' |
| 30 |
|
| 31 |
# Parameter constants |
| 32 |
ENCRYPTION_ALGORITHM = 'encryption_algorithm' |
| 33 |
|
| 34 |
# VPN initiator constants |
| 35 |
VPN_INITIATOR_BI_DIRECTIONAL = 'bi-directional' |
| 36 |
VPN_INITIATOR_RESPONSE_ONLY = 'response-only' |
| 37 |
|
| 38 |
VPN_SUPPORTED_INITIATORS = [ |
| 39 |
VPN_INITIATOR_BI_DIRECTIONAL, VPN_INITIATOR_RESPONSE_ONLY, |
| 40 |
] |
| 41 |
|
| 42 |
# VPN encryption algorithm constants |
| 43 |
VPN_ENCRYPTION_ALGORITHM_3DES = '3des' |
| 44 |
VPN_ENCRYPTION_ALGORITHM_AES_128 = 'aes-128' |
| 45 |
VPN_ENCRYPTION_ALGORITHM_AES_192 = 'aes-192' |
| 46 |
VPN_ENCRYPTION_ALGORITHM_AES_256 = 'aes-256' |
| 47 |
VPN_ENCRYPTION_ALGORITHM_AES_128_CCM_8 = 'aes-128-ccm-8' |
| 48 |
VPN_ENCRYPTION_ALGORITHM_AES_192_CCM_8 = 'aes-192-ccm-8' |
| 49 |
VPN_ENCRYPTION_ALGORITHM_AES_256_CCM_8 = 'aes-256-ccm-8' |
| 50 |
VPN_ENCRYPTION_ALGORITHM_AES_128_CCM_12 = 'aes-128-ccm-12' |
| 51 |
VPN_ENCRYPTION_ALGORITHM_AES_192_CCM_12 = 'aes-192-ccm-12' |
| 52 |
VPN_ENCRYPTION_ALGORITHM_AES_256_CCM_12 = 'aes-256-ccm-12' |
| 53 |
VPN_ENCRYPTION_ALGORITHM_AES_128_CCM_16 = 'aes-128-ccm-16' |
| 54 |
VPN_ENCRYPTION_ALGORITHM_AES_192_CCM_16 = 'aes-192-ccm-16' |
| 55 |
VPN_ENCRYPTION_ALGORITHM_AES_256_CCM_16 = 'aes-256-ccm-16' |
| 56 |
VPN_ENCRYPTION_ALGORITHM_AES_128_GCM_8 = 'aes-128-gcm-8' |
| 57 |
VPN_ENCRYPTION_ALGORITHM_AES_192_GCM_8 = 'aes-192-gcm-8' |
| 58 |
VPN_ENCRYPTION_ALGORITHM_AES_256_GCM_8 = 'aes-256-gcm-8' |
| 59 |
VPN_ENCRYPTION_ALGORITHM_AES_128_GCM_12 = 'aes-128-gcm-12' |
| 60 |
VPN_ENCRYPTION_ALGORITHM_AES_192_GCM_12 = 'aes-192-gcm-12' |
| 61 |
VPN_ENCRYPTION_ALGORITHM_AES_256_GCM_12 = 'aes-256-gcm-12' |
| 62 |
VPN_ENCRYPTION_ALGORITHM_AES_128_GCM_16 = 'aes-128-gcm-16' |
| 63 |
VPN_ENCRYPTION_ALGORITHM_AES_192_GCM_16 = 'aes-192-gcm-16' |
| 64 |
VPN_ENCRYPTION_ALGORITHM_AES_256_GCM_16 = 'aes-256-gcm-16' |
| 65 |
|
| 66 |
VPN_SUPPORTED_ENCRYPTION_ALGORITHMS = [ |
| 67 |
VPN_ENCRYPTION_ALGORITHM_3DES, |
| 68 |
VPN_ENCRYPTION_ALGORITHM_AES_128, |
| 69 |
VPN_ENCRYPTION_ALGORITHM_AES_192, |
| 70 |
VPN_ENCRYPTION_ALGORITHM_AES_256, |
| 71 |
VPN_ENCRYPTION_ALGORITHM_AES_128_CCM_8, |
| 72 |
VPN_ENCRYPTION_ALGORITHM_AES_192_CCM_8, |
| 73 |
VPN_ENCRYPTION_ALGORITHM_AES_256_CCM_8, |
| 74 |
VPN_ENCRYPTION_ALGORITHM_AES_128_CCM_12, |
| 75 |
VPN_ENCRYPTION_ALGORITHM_AES_192_CCM_12, |
| 76 |
VPN_ENCRYPTION_ALGORITHM_AES_256_CCM_12, |
| 77 |
VPN_ENCRYPTION_ALGORITHM_AES_128_CCM_16, |
| 78 |
VPN_ENCRYPTION_ALGORITHM_AES_192_CCM_16, |
| 79 |
VPN_ENCRYPTION_ALGORITHM_AES_256_CCM_16, |
| 80 |
VPN_ENCRYPTION_ALGORITHM_AES_128_GCM_8, |
| 81 |
VPN_ENCRYPTION_ALGORITHM_AES_192_GCM_8, |
| 82 |
VPN_ENCRYPTION_ALGORITHM_AES_256_GCM_8, |
| 83 |
VPN_ENCRYPTION_ALGORITHM_AES_128_GCM_12, |
| 84 |
VPN_ENCRYPTION_ALGORITHM_AES_192_GCM_12, |
| 85 |
VPN_ENCRYPTION_ALGORITHM_AES_256_GCM_12, |
| 86 |
VPN_ENCRYPTION_ALGORITHM_AES_128_GCM_16, |
| 87 |
VPN_ENCRYPTION_ALGORITHM_AES_192_GCM_16, |
| 88 |
VPN_ENCRYPTION_ALGORITHM_AES_256_GCM_16, |
| 89 |
] |
| 90 |
|
| 91 |
# VPN DPD action constants |
| 92 |
VPN_DPD_ACTION_CLEAR = 'clear' |
| 93 |
VPN_DPD_ACTION_DISABLED = 'disabled' |
| 94 |
VPN_DPD_ACTION_HOLD = 'hold' |
| 95 |
VPN_DPD_ACTION_RESTART = 'restart' |
| 96 |
VPN_DPD_ACTION_RESTART_BY_PEER = 'restart-by-peer' |
| 97 |
|
| 98 |
VPN_SUPPORTED_DPD_ACTIONS = [ |
| 99 |
VPN_DPD_ACTION_CLEAR, VPN_DPD_ACTION_DISABLED, VPN_DPD_ACTION_HOLD, |
| 100 |
VPN_DPD_ACTION_RESTART, VPN_DPD_ACTION_RESTART_BY_PEER, |
| 101 |
] |
| 102 |
|
| 103 |
# VPN transform protocol constants |
| 104 |
VPN_TRANSFORM_PROTOCOL_AH = 'ah' |
| 105 |
VPN_TRANSFORM_PROTOCOL_AH_ESP = 'ah-esp' |
| 106 |
VPN_TRANSFORM_PROTOCOL_ESP = 'esp' |
| 107 |
|
| 108 |
VPN_SUPPORTED_TRANSFORM_PROTOCOLS = [ |
| 109 |
VPN_TRANSFORM_PROTOCOL_AH, VPN_TRANSFORM_PROTOCOL_AH_ESP, |
| 110 |
VPN_TRANSFORM_PROTOCOL_ESP, |
| 111 |
] |
| 112 |
|
| 113 |
# VPN encapsulation mode constants |
| 114 |
VPN_ENCAPSULATION_MODE_TRANSPORT = 'transport' |
| 115 |
VPN_ENCAPSULATION_MODE_TUNNEL = 'tunnel' |
| 116 |
|
| 117 |
VPN_SUPPORTED_ENCAPSULATION_MODES = [ |
| 118 |
VPN_ENCAPSULATION_MODE_TRANSPORT, VPN_ENCAPSULATION_MODE_TUNNEL, |
| 119 |
] |
| 120 |
|
| 121 |
# VPN lifetime unit constants |
| 122 |
VPN_LIFETIME_UNIT_SECONDS = 'seconds' |
| 123 |
|
| 124 |
VPN_SUPPORTED_LIFETIME_UNITS = [ |
| 125 |
VPN_LIFETIME_UNIT_SECONDS, |
| 126 |
] |
| 127 |
|
| 128 |
# VPN PFS group constants |
| 129 |
VPN_PFS_GROUP2 = 'group2' |
| 130 |
VPN_PFS_GROUP5 = 'group5' |
| 131 |
VPN_PFS_GROUP14 = 'group14' |
| 132 |
VPN_PFS_GROUP15 = 'group15' |
| 133 |
VPN_PFS_GROUP16 = 'group16' |
| 134 |
VPN_PFS_GROUP17 = 'group17' |
| 135 |
VPN_PFS_GROUP18 = 'group18' |
| 136 |
VPN_PFS_GROUP19 = 'group19' |
| 137 |
VPN_PFS_GROUP20 = 'group20' |
| 138 |
VPN_PFS_GROUP21 = 'group21' |
| 139 |
VPN_PFS_GROUP22 = 'group22' |
| 140 |
VPN_PFS_GROUP23 = 'group23' |
| 141 |
VPN_PFS_GROUP24 = 'group24' |
| 142 |
VPN_PFS_GROUP25 = 'group25' |
| 143 |
VPN_PFS_GROUP26 = 'group26' |
| 144 |
VPN_PFS_GROUP27 = 'group27' |
| 145 |
VPN_PFS_GROUP28 = 'group28' |
| 146 |
VPN_PFS_GROUP29 = 'group29' |
| 147 |
VPN_PFS_GROUP30 = 'group30' |
| 148 |
VPN_PFS_GROUP31 = 'group31' |
| 149 |
|
| 150 |
VPN_SUPPORTED_PFSES = [ |
| 151 |
VPN_PFS_GROUP2, VPN_PFS_GROUP5, VPN_PFS_GROUP14, VPN_PFS_GROUP15, |
| 152 |
VPN_PFS_GROUP16, VPN_PFS_GROUP17, VPN_PFS_GROUP18, VPN_PFS_GROUP19, |
| 153 |
VPN_PFS_GROUP20, VPN_PFS_GROUP21, VPN_PFS_GROUP22, VPN_PFS_GROUP23, |
| 154 |
VPN_PFS_GROUP24, VPN_PFS_GROUP25, VPN_PFS_GROUP26, VPN_PFS_GROUP27, |
| 155 |
VPN_PFS_GROUP28, VPN_PFS_GROUP29, VPN_PFS_GROUP30, VPN_PFS_GROUP31, |
| 156 |
] |
| 157 |
|
| 158 |
# VPN IKE version constants |
| 159 |
VPN_IKE_VERSION_V1 = 'v1' |
| 160 |
VPN_IKE_VERSION_V2 = 'v2' |
| 161 |
|
| 162 |
VPN_SUPPORTED_IKE_VERSIONS = [ |
| 163 |
VPN_IKE_VERSION_V1, VPN_IKE_VERSION_V2, |
| 164 |
] |
| 165 |
|
| 166 |
# VPN auth mode constants |
| 167 |
VPN_AUTH_MODE_PSK = 'psk' |
| 168 |
|
| 169 |
VPN_SUPPORTED_AUTH_MODES = [ |
| 170 |
VPN_AUTH_MODE_PSK, |
| 171 |
] |
| 172 |
|
| 173 |
# VPN auth algorithm constants |
| 174 |
VPN_AUTH_ALGORITHM_SHA1 = 'sha1' |
| 175 |
VPN_AUTH_ALGORITHM_SHA256 = 'sha256' |
| 176 |
VPN_AUTH_ALGORITHM_SHA384 = 'sha384' |
| 177 |
VPN_AUTH_ALGORITHM_SHA512 = 'sha512' |
| 178 |
VPN_AUTH_ALGORITHM_AES_XCBC = 'aes-xcbc' |
| 179 |
VPN_AUTH_ALGORITHM_AES_CMAC = 'aes-cmac' |
| 180 |
|
| 181 |
VPN_SUPPORTED_AUTH_ALGORITHMS = [ |
| 182 |
VPN_AUTH_ALGORITHM_SHA1, VPN_AUTH_ALGORITHM_SHA256, |
| 183 |
VPN_AUTH_ALGORITHM_SHA384, VPN_AUTH_ALGORITHM_SHA512, |
| 184 |
VPN_AUTH_ALGORITHM_AES_XCBC, VPN_AUTH_ALGORITHM_AES_CMAC, |
| 185 |
] |
| 186 |
|
| 187 |
# VPN phase1 negotiation mode constants |
| 188 |
VPN_PHASE1_NEGOTIATION_MODE_MAIN = 'main' |
| 189 |
VPN_PHASE1_NEGOTIATION_MODE_AGGRESSIVE = 'aggressive' |
| 190 |
|
| 191 |
VPN_SUPPORTED_PHASE1_NEGOTIATION_MODES = [ |
| 192 |
VPN_PHASE1_NEGOTIATION_MODE_MAIN, |
| 193 |
VPN_PHASE1_NEGOTIATION_MODE_AGGRESSIVE, |
| 194 |
] |
| 195 |
|
| 196 |
# The alias of the extension. |
| 197 |
ALIAS = 'vpnaas' |
| 198 |
|
| 199 |
# Whether or not this extension is simply signaling behavior to the user |
| 200 |
# or it actively modifies the attribute map. |
| 201 |
IS_SHIM_EXTENSION = False |
| 202 |
|
| 203 |
# Whether the extension is marking the adoption of standardattr model for |
| 204 |
# legacy resources, or introducing new standardattr attributes. False or |
| 205 |
# None if the standardattr model is adopted since the introduction of |
| 206 |
# resource extension. |
| 207 |
# If this is True, the alias for the extension should be prefixed with |
| 208 |
# 'standard-attr-'. |
| 209 |
IS_STANDARD_ATTR_EXTENSION = False |
| 210 |
|
| 211 |
# The name of the extension. |
| 212 |
NAME = 'VPN service' |
| 213 |
|
| 214 |
# The description of the extension. |
| 215 |
DESCRIPTION = "Extension for VPN service" |
| 216 |
|
| 217 |
# A timestamp of when the extension was introduced. |
| 218 |
UPDATED_TIMESTAMP = "2013-05-29T10:00:00-00:00" |
| 219 |
|
| 220 |
# Base for the API calls |
| 221 |
API_PREFIX = '/vpn' |
| 222 |
|
| 223 |
_vpn_lifetime_limits = (60, validators.UNLIMITED) |
| 224 |
|
| 225 |
RESOURCE_ATTRIBUTE_MAP = { |
| 226 |
|
| 227 |
VPNSERVICES: { |
| 228 |
'id': {'allow_post': False, 'allow_put': False, |
| 229 |
'validate': {'type:uuid': None}, |
| 230 |
'is_visible': True, |
| 231 |
'is_sort_key': True, |
| 232 |
'primary_key': True}, |
| 233 |
'tenant_id': {'allow_post': True, 'allow_put': False, |
| 234 |
'validate': { |
| 235 |
'type:string': db_const.PROJECT_ID_FIELD_SIZE}, |
| 236 |
'required_by_policy': True, |
| 237 |
'is_sort_key': True, |
| 238 |
'is_visible': True}, |
| 239 |
'name': {'allow_post': True, 'allow_put': True, |
| 240 |
'validate': {'type:string': db_const.NAME_FIELD_SIZE}, |
| 241 |
'is_visible': True, 'is_sort_key': True, 'default': ''}, |
| 242 |
'description': {'allow_post': True, 'allow_put': True, |
| 243 |
'validate': { |
| 244 |
'type:string': db_const.DESCRIPTION_FIELD_SIZE}, |
| 245 |
'is_visible': True, 'default': ''}, |
| 246 |
'subnet_id': {'allow_post': True, 'allow_put': False, |
| 247 |
'validate': {'type:uuid_or_none': None}, |
| 248 |
'is_visible': True, 'default': None}, |
| 249 |
'router_id': {'allow_post': True, 'allow_put': False, |
| 250 |
'validate': {'type:uuid': None}, |
| 251 |
'is_sort_key': True, |
| 252 |
'is_visible': True}, |
| 253 |
'admin_state_up': {'allow_post': True, 'allow_put': True, |
| 254 |
'default': True, |
| 255 |
'convert_to': converters.convert_to_boolean, |
| 256 |
'is_visible': True}, |
| 257 |
'external_v4_ip': {'allow_post': False, 'allow_put': False, |
| 258 |
'is_visible': True}, |
| 259 |
'external_v6_ip': {'allow_post': False, 'allow_put': False, |
| 260 |
'is_visible': True}, |
| 261 |
'status': {'allow_post': False, 'allow_put': False, |
| 262 |
'is_visible': True}, |
| 263 |
}, |
| 264 |
|
| 265 |
IPSEC_SITE_CONNECTIONS: { |
| 266 |
'id': {'allow_post': False, 'allow_put': False, |
| 267 |
'validate': {'type:uuid': None}, |
| 268 |
'is_visible': True, |
| 269 |
'is_sort_key': True, |
| 270 |
'primary_key': True}, |
| 271 |
'tenant_id': {'allow_post': True, 'allow_put': False, |
| 272 |
'validate': { |
| 273 |
'type:string': db_const.PROJECT_ID_FIELD_SIZE}, |
| 274 |
'required_by_policy': True, |
| 275 |
'is_sort_key': True, |
| 276 |
'is_visible': True}, |
| 277 |
'name': {'allow_post': True, 'allow_put': True, |
| 278 |
'validate': {'type:string': db_const.NAME_FIELD_SIZE}, |
| 279 |
'is_visible': True, 'is_sort_key': True, 'default': ''}, |
| 280 |
'description': {'allow_post': True, 'allow_put': True, |
| 281 |
'validate': { |
| 282 |
'type:string': db_const.DESCRIPTION_FIELD_SIZE}, |
| 283 |
'is_visible': True, 'default': ''}, |
| 284 |
'local_id': {'allow_post': True, 'allow_put': True, |
| 285 |
'validate': {'type:string': None}, |
| 286 |
'is_visible': True, 'default': ''}, |
| 287 |
'peer_address': {'allow_post': True, 'allow_put': True, |
| 288 |
'validate': {'type:string': None}, |
| 289 |
'is_visible': True}, |
| 290 |
'peer_id': {'allow_post': True, 'allow_put': True, |
| 291 |
'validate': {'type:string': None}, |
| 292 |
'is_visible': True}, |
| 293 |
'peer_cidrs': {'allow_post': True, 'allow_put': True, |
| 294 |
'convert_to': converters.convert_to_list, |
| 295 |
'validate': {'type:list_of_subnets_or_none': None}, |
| 296 |
'is_visible': True, |
| 297 |
'default': None}, |
| 298 |
'local_ep_group_id': {'allow_post': True, 'allow_put': True, |
| 299 |
'validate': {'type:uuid_or_none': None}, |
| 300 |
'is_visible': True, 'default': None}, |
| 301 |
'peer_ep_group_id': {'allow_post': True, 'allow_put': True, |
| 302 |
'validate': {'type:uuid_or_none': None}, |
| 303 |
'is_visible': True, 'default': None}, |
| 304 |
'route_mode': {'allow_post': False, 'allow_put': False, |
| 305 |
'is_visible': True}, |
| 306 |
'mtu': {'allow_post': True, 'allow_put': True, |
| 307 |
'default': 1500, |
| 308 |
'validate': {'type:non_negative': None}, |
| 309 |
'convert_to': converters.convert_to_int, |
| 310 |
'is_visible': True}, |
| 311 |
'initiator': {'allow_post': True, 'allow_put': True, |
| 312 |
'default': VPN_INITIATOR_BI_DIRECTIONAL, |
| 313 |
'validate': {'type:values': VPN_SUPPORTED_INITIATORS}, |
| 314 |
'is_visible': True}, |
| 315 |
'auth_mode': {'allow_post': False, 'allow_put': False, |
| 316 |
'default': VPN_AUTH_MODE_PSK, |
| 317 |
'validate': {'type:values': VPN_SUPPORTED_AUTH_MODES}, |
| 318 |
'is_visible': True}, |
| 319 |
'psk': {'allow_post': True, 'allow_put': True, |
| 320 |
'validate': {'type:string': None}, |
| 321 |
'is_visible': True}, |
| 322 |
'dpd': { |
| 323 |
'allow_post': True, 'allow_put': True, |
| 324 |
'convert_to': converters.convert_none_to_empty_dict, |
| 325 |
'is_visible': True, |
| 326 |
'default': {}, |
| 327 |
'validate': { |
| 328 |
'type:dict_or_empty': { |
| 329 |
'action': {'type:values': VPN_SUPPORTED_DPD_ACTIONS}, |
| 330 |
'interval': {'type:non_negative': None}, |
| 331 |
'timeout': {'type:non_negative': None}}}}, |
| 332 |
'admin_state_up': {'allow_post': True, 'allow_put': True, |
| 333 |
'default': True, |
| 334 |
'convert_to': converters.convert_to_boolean, |
| 335 |
'is_visible': True}, |
| 336 |
'status': {'allow_post': False, 'allow_put': False, |
| 337 |
'is_visible': True}, |
| 338 |
'vpnservice_id': {'allow_post': True, 'allow_put': False, |
| 339 |
'validate': {'type:uuid': None}, |
| 340 |
'is_visible': True}, |
| 341 |
'ikepolicy_id': {'allow_post': True, 'allow_put': False, |
| 342 |
'validate': {'type:uuid': None}, |
| 343 |
'is_visible': True}, |
| 344 |
'ipsecpolicy_id': {'allow_post': True, 'allow_put': False, |
| 345 |
'validate': {'type:uuid': None}, |
| 346 |
'is_visible': True}, |
| 347 |
}, |
| 348 |
|
| 349 |
IPSEC_POLICIES: { |
| 350 |
'id': {'allow_post': False, 'allow_put': False, |
| 351 |
'validate': {'type:uuid': None}, |
| 352 |
'is_visible': True, |
| 353 |
'is_sort_key': True, |
| 354 |
'primary_key': True}, |
| 355 |
'tenant_id': {'allow_post': True, 'allow_put': False, |
| 356 |
'validate': { |
| 357 |
'type:string': db_const.PROJECT_ID_FIELD_SIZE}, |
| 358 |
'required_by_policy': True, |
| 359 |
'is_sort_key': True, |
| 360 |
'is_visible': True}, |
| 361 |
'name': {'allow_post': True, 'allow_put': True, |
| 362 |
'validate': {'type:string': db_const.NAME_FIELD_SIZE}, |
| 363 |
'is_visible': True, 'is_sort_key': True, 'default': ''}, |
| 364 |
'description': {'allow_post': True, 'allow_put': True, |
| 365 |
'validate': { |
| 366 |
'type:string': db_const.DESCRIPTION_FIELD_SIZE}, |
| 367 |
'is_visible': True, 'default': ''}, |
| 368 |
'transform_protocol': { |
| 369 |
'allow_post': True, |
| 370 |
'allow_put': True, |
| 371 |
'default': VPN_TRANSFORM_PROTOCOL_ESP, |
| 372 |
'validate': {'type:values': VPN_SUPPORTED_TRANSFORM_PROTOCOLS}, |
| 373 |
'is_visible': True}, |
| 374 |
'auth_algorithm': { |
| 375 |
'allow_post': True, |
| 376 |
'allow_put': True, |
| 377 |
'default': VPN_AUTH_ALGORITHM_SHA1, |
| 378 |
'validate': {'type:values': VPN_SUPPORTED_AUTH_ALGORITHMS}, |
| 379 |
'is_visible': True}, |
| 380 |
ENCRYPTION_ALGORITHM: { |
| 381 |
'allow_post': True, |
| 382 |
'allow_put': True, |
| 383 |
'default': VPN_ENCRYPTION_ALGORITHM_AES_128, |
| 384 |
'validate': { |
| 385 |
'type:values': VPN_SUPPORTED_ENCRYPTION_ALGORITHMS}, |
| 386 |
'is_visible': True}, |
| 387 |
'encapsulation_mode': { |
| 388 |
'allow_post': True, |
| 389 |
'allow_put': True, |
| 390 |
'default': VPN_ENCAPSULATION_MODE_TUNNEL, |
| 391 |
'validate': {'type:values': VPN_SUPPORTED_ENCAPSULATION_MODES}, |
| 392 |
'is_visible': True}, |
| 393 |
'lifetime': { |
| 394 |
'allow_post': True, 'allow_put': True, |
| 395 |
'convert_to': converters.convert_none_to_empty_dict, |
| 396 |
'default': {}, |
| 397 |
'validate': { |
| 398 |
'type:dict_or_empty': { |
| 399 |
'units': {'type:values': VPN_SUPPORTED_LIFETIME_UNITS}, |
| 400 |
'value': {'type:range': _vpn_lifetime_limits}}}, |
| 401 |
'is_visible': True}, |
| 402 |
'pfs': {'allow_post': True, 'allow_put': True, |
| 403 |
'default': VPN_PFS_GROUP5, |
| 404 |
'validate': {'type:values': VPN_SUPPORTED_PFSES}, |
| 405 |
'is_visible': True}, |
| 406 |
}, |
| 407 |
|
| 408 |
IKE_POLICIES: { |
| 409 |
'id': {'allow_post': False, 'allow_put': False, |
| 410 |
'validate': {'type:uuid': None}, |
| 411 |
'is_visible': True, |
| 412 |
'is_sort_key': True, |
| 413 |
'primary_key': True}, |
| 414 |
'tenant_id': {'allow_post': True, 'allow_put': False, |
| 415 |
'validate': { |
| 416 |
'type:string': db_const.PROJECT_ID_FIELD_SIZE}, |
| 417 |
'required_by_policy': True, |
| 418 |
'is_sort_key': True, |
| 419 |
'is_visible': True}, |
| 420 |
'name': {'allow_post': True, 'allow_put': True, |
| 421 |
'validate': {'type:string': db_const.NAME_FIELD_SIZE}, |
| 422 |
'is_visible': True, 'is_sort_key': True, 'default': ''}, |
| 423 |
'description': {'allow_post': True, 'allow_put': True, |
| 424 |
'validate': { |
| 425 |
'type:string': db_const.DESCRIPTION_FIELD_SIZE}, |
| 426 |
'is_visible': True, 'default': ''}, |
| 427 |
'auth_algorithm': { |
| 428 |
'allow_post': True, 'allow_put': True, |
| 429 |
'default': VPN_AUTH_ALGORITHM_SHA1, |
| 430 |
'validate': {'type:values': VPN_SUPPORTED_AUTH_ALGORITHMS}, |
| 431 |
'is_visible': True}, |
| 432 |
ENCRYPTION_ALGORITHM: { |
| 433 |
'allow_post': True, 'allow_put': True, |
| 434 |
'default': VPN_ENCRYPTION_ALGORITHM_AES_128, |
| 435 |
'validate': { |
| 436 |
'type:values': VPN_SUPPORTED_ENCRYPTION_ALGORITHMS}, |
| 437 |
'is_visible': True}, |
| 438 |
'phase1_negotiation_mode': { |
| 439 |
'allow_post': True, 'allow_put': True, |
| 440 |
'default': VPN_PHASE1_NEGOTIATION_MODE_MAIN, |
| 441 |
'validate': { |
| 442 |
'type:values': VPN_SUPPORTED_PHASE1_NEGOTIATION_MODES}, |
| 443 |
'is_visible': True}, |
| 444 |
'lifetime': { |
| 445 |
'allow_post': True, 'allow_put': True, |
| 446 |
'convert_to': converters.convert_none_to_empty_dict, |
| 447 |
'default': {}, |
| 448 |
'validate': { |
| 449 |
'type:dict_or_empty': { |
| 450 |
'units': {'type:values': VPN_SUPPORTED_LIFETIME_UNITS}, |
| 451 |
'value': {'type:range': _vpn_lifetime_limits}}}, |
| 452 |
'is_visible': True}, |
| 453 |
'ike_version': { |
| 454 |
'allow_post': True, 'allow_put': True, |
| 455 |
'default': VPN_IKE_VERSION_V1, |
| 456 |
'validate': {'type:values': VPN_SUPPORTED_IKE_VERSIONS}, |
| 457 |
'is_visible': True}, |
| 458 |
'pfs': {'allow_post': True, 'allow_put': True, |
| 459 |
'default': VPN_PFS_GROUP5, |
| 460 |
'validate': {'type:values': VPN_SUPPORTED_PFSES}, |
| 461 |
'is_visible': True}, |
| 462 |
}, |
| 463 |
} |
| 464 |
|
| 465 |
# The subresource attribute map for the extension. This extension has only |
| 466 |
# top level resources, not child resources, so this is set to an empty dict. |
| 467 |
SUB_RESOURCE_ATTRIBUTE_MAP = { |
| 468 |
} |
| 469 |
|
| 470 |
# The action map. |
| 471 |
ACTION_MAP = { |
| 472 |
} |
| 473 |
|
| 474 |
# The action status. |
| 475 |
ACTION_STATUS = { |
| 476 |
} |
| 477 |
|
| 478 |
# The list of required extensions. |
| 479 |
REQUIRED_EXTENSIONS = [ |
| 480 |
l3.ALIAS, |
| 481 |
] |
| 482 |
|
| 483 |
# The list of optional extensions. |
| 484 |
OPTIONAL_EXTENSIONS = [ |
| 485 |
] |