| 1 |
# (c) Copyright 2015 NEC Corporation, All Rights Reserved. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 |
# not use this file except in compliance with the License. You may obtain |
| 5 |
# 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, WITHOUT |
| 11 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 |
# License for the specific language governing permissions and limitations |
| 13 |
# under the License. |
| 14 |
|
| 15 |
from neutron_lib.api import converters |
| 16 |
from neutron_lib.api.definitions import vpn |
| 17 |
from neutron_lib.db import constants as db_const |
| 18 |
|
| 19 |
# VPN Endpoint type constants |
| 20 |
VPN_ENDPOINT_TYPE_CIDR = 'cidr' |
| 21 |
VPN_ENDPOINT_TYPE_NETWORK = 'network' |
| 22 |
VPN_ENDPOINT_TYPE_ROUTER = 'router' |
| 23 |
VPN_ENDPOINT_TYPE_SUBNET = 'subnet' |
| 24 |
VPN_ENDPOINT_TYPE_VLAN = 'vlan' |
| 25 |
|
| 26 |
VPN_SUPPORTED_ENDPOINT_TYPES = [ |
| 27 |
VPN_ENDPOINT_TYPE_CIDR, VPN_ENDPOINT_TYPE_NETWORK, |
| 28 |
VPN_ENDPOINT_TYPE_ROUTER, VPN_ENDPOINT_TYPE_SUBNET, VPN_ENDPOINT_TYPE_VLAN, |
| 29 |
] |
| 30 |
|
| 31 |
ALIAS = 'vpn-endpoint-groups' |
| 32 |
IS_SHIM_EXTENSION = False |
| 33 |
IS_STANDARD_ATTR_EXTENSION = False |
| 34 |
NAME = 'VPN Endpoint Groups' |
| 35 |
DESCRIPTION = 'VPN endpoint groups support' |
| 36 |
UPDATED_TIMESTAMP = '2015-08-04T10:00:00-00:00' |
| 37 |
API_PREFIX = '/vpn' |
| 38 |
RESOURCE_ATTRIBUTE_MAP = { |
| 39 |
'endpoint_groups': { |
| 40 |
'id': {'allow_post': False, 'allow_put': False, |
| 41 |
'validate': {'type:uuid': None}, |
| 42 |
'is_visible': True, |
| 43 |
'primary_key': True}, |
| 44 |
'tenant_id': {'allow_post': True, 'allow_put': False, |
| 45 |
'validate': { |
| 46 |
'type:string': db_const.PROJECT_ID_FIELD_SIZE}, |
| 47 |
'required_by_policy': True, |
| 48 |
'is_visible': True}, |
| 49 |
'name': {'allow_post': True, 'allow_put': True, |
| 50 |
'validate': {'type:string': db_const.NAME_FIELD_SIZE}, |
| 51 |
'is_visible': True, 'default': ''}, |
| 52 |
'description': {'allow_post': True, 'allow_put': True, |
| 53 |
'validate': { |
| 54 |
'type:string': db_const.DESCRIPTION_FIELD_SIZE}, |
| 55 |
'is_visible': True, 'default': ''}, |
| 56 |
'type': {'allow_post': True, 'allow_put': False, |
| 57 |
'validate': {'type:values': VPN_SUPPORTED_ENDPOINT_TYPES}, |
| 58 |
'is_visible': True}, |
| 59 |
'endpoints': {'allow_post': True, 'allow_put': False, |
| 60 |
'convert_to': converters.convert_to_list, |
| 61 |
'is_visible': True, |
| 62 |
'default': []}, |
| 63 |
}, |
| 64 |
} |
| 65 |
SUB_RESOURCE_ATTRIBUTE_MAP = {} |
| 66 |
ACTION_MAP = {} |
| 67 |
REQUIRED_EXTENSIONS = [vpn.ALIAS] |
| 68 |
OPTIONAL_EXTENSIONS = [] |
| 69 |
ACTION_STATUS = {} |