| 1 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 |
# not use this file except in compliance with the License. You may obtain |
| 3 |
# a copy of the License at |
| 4 |
# |
| 5 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 |
# |
| 7 |
# Unless required by applicable law or agreed to in writing, software |
| 8 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 |
# License for the specific language governing permissions and limitations |
| 11 |
# under the License. |
| 12 |
|
| 13 |
from neutron_lib.api import converters |
| 14 |
from neutron_lib import constants |
| 15 |
from neutron_lib.db import constants as db_const |
| 16 |
|
| 17 |
|
| 18 |
NAME = 'Neutron L3 Subnet Pool' |
| 19 |
ALIAS = 'subnetpool' |
| 20 |
DESCRIPTION = "Layer 3 subnet pool abstraction" |
| 21 |
|
| 22 |
UPDATED_TIMESTAMP = "2012-01-01T10:00:00-00:00" |
| 23 |
|
| 24 |
RESOURCE_NAME = 'subnetpool' |
| 25 |
COLLECTION_NAME = 'subnetpools' |
| 26 |
|
| 27 |
RESOURCE_ATTRIBUTE_MAP = { |
| 28 |
COLLECTION_NAME: { |
| 29 |
'id': {'allow_post': False, |
| 30 |
'allow_put': False, |
| 31 |
'validate': {'type:uuid': None}, |
| 32 |
'is_visible': True, |
| 33 |
'is_filter': True, |
| 34 |
'is_sort_key': True, |
| 35 |
'primary_key': True}, |
| 36 |
'name': {'allow_post': True, |
| 37 |
'allow_put': True, |
| 38 |
'validate': {'type:not_empty_string': None}, |
| 39 |
'is_filter': True, |
| 40 |
'is_sort_key': True, |
| 41 |
'is_visible': True}, |
| 42 |
'tenant_id': {'allow_post': True, |
| 43 |
'allow_put': False, |
| 44 |
'validate': { |
| 45 |
'type:string': db_const.PROJECT_ID_FIELD_SIZE}, |
| 46 |
'required_by_policy': True, |
| 47 |
'is_filter': True, |
| 48 |
'is_sort_key': True, |
| 49 |
'is_visible': True}, |
| 50 |
'prefixes': {'allow_post': True, |
| 51 |
'allow_put': True, |
| 52 |
'validate': {'type:subnet_list': None}, |
| 53 |
'is_visible': True}, |
| 54 |
'default_quota': {'allow_post': True, |
| 55 |
'allow_put': True, |
| 56 |
'validate': {'type:non_negative': None}, |
| 57 |
'convert_to': converters.convert_to_int, |
| 58 |
'default': constants.ATTR_NOT_SPECIFIED, |
| 59 |
'is_filter': True, |
| 60 |
'is_sort_key': True, |
| 61 |
'is_visible': True}, |
| 62 |
'ip_version': {'allow_post': False, |
| 63 |
'allow_put': False, |
| 64 |
'is_filter': True, |
| 65 |
'is_sort_key': True, |
| 66 |
'is_visible': True}, |
| 67 |
'default_prefixlen': {'allow_post': True, |
| 68 |
'allow_put': True, |
| 69 |
'validate': {'type:non_negative': None}, |
| 70 |
'convert_to': converters.convert_to_int, |
| 71 |
'default': constants.ATTR_NOT_SPECIFIED, |
| 72 |
'is_filter': True, |
| 73 |
'is_sort_key': True, |
| 74 |
'is_visible': True}, |
| 75 |
'min_prefixlen': {'allow_post': True, |
| 76 |
'allow_put': True, |
| 77 |
'default': constants.ATTR_NOT_SPECIFIED, |
| 78 |
'validate': {'type:non_negative': None}, |
| 79 |
'convert_to': converters.convert_to_int, |
| 80 |
'is_filter': True, |
| 81 |
'is_sort_key': True, |
| 82 |
'is_visible': True}, |
| 83 |
'max_prefixlen': {'allow_post': True, |
| 84 |
'allow_put': True, |
| 85 |
'default': constants.ATTR_NOT_SPECIFIED, |
| 86 |
'validate': {'type:non_negative': None}, |
| 87 |
'convert_to': converters.convert_to_int, |
| 88 |
'is_filter': True, |
| 89 |
'is_sort_key': True, |
| 90 |
'is_visible': True}, |
| 91 |
'is_default': {'allow_post': True, |
| 92 |
'allow_put': True, |
| 93 |
'default': False, |
| 94 |
'convert_to': converters.convert_to_boolean, |
| 95 |
'is_visible': True, |
| 96 |
'is_filter': True, |
| 97 |
'is_sort_key': True, |
| 98 |
'required_by_policy': True, |
| 99 |
'enforce_policy': True}, |
| 100 |
constants.SHARED: { |
| 101 |
'allow_post': True, |
| 102 |
'allow_put': False, |
| 103 |
'default': False, |
| 104 |
'convert_to': converters.convert_to_boolean, |
| 105 |
'is_visible': True, |
| 106 |
'is_filter': True, |
| 107 |
'is_sort_key': True, |
| 108 |
'required_by_policy': True, |
| 109 |
'enforce_policy': True |
| 110 |
} |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
# This is a core resource so the following are not applicable. |
| 115 |
IS_SHIM_EXTENSION = False |
| 116 |
IS_STANDARD_ATTR_EXTENSION = False |
| 117 |
SUB_RESOURCE_ATTRIBUTE_MAP = {} |
| 118 |
ACTION_MAP = {} |
| 119 |
REQUIRED_EXTENSIONS = [] |
| 120 |
OPTIONAL_EXTENSIONS = [] |
| 121 |
ACTION_STATUS = {} |