Debian Codegraph @

neutron_lib/api/definitions/l3.py

raw
1 # 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.db import constants
17
18 # The alias of the extension.
19 ALIAS = 'router'
20
21 # Whether or not this extension is simply signaling behavior to the user
22 # or it actively modifies the attribute map.
23 IS_SHIM_EXTENSION = False
24
25 # Whether the extension is marking the adoption of standardattr model for
26 # legacy resources, or introducing new standardattr attributes. False or
27 # None if the standardattr model is adopted since the introduction of
28 # resource extension.
29 # If this is True, the alias for the extension should be prefixed with
30 # 'standard-attr-'.
31 IS_STANDARD_ATTR_EXTENSION = False
32
33 # The name of the extension.
34 NAME = 'Neutron L3 Router'
35
36 # A prefix for API resources. An empty prefix means that the API is going
37 # to be exposed at the v2/ level as any other core resource.
38 API_PREFIX = ''
39
40 # The description of the extension.
41 DESCRIPTION = ("Router abstraction for basic L3 forwarding "
42 "between L2 Neutron networks and access to external "
43 "networks via a NAT gateway.")
44
45 # A timestamp of when the extension was introduced.
46 UPDATED_TIMESTAMP = "2012-07-20T10:00:00-00:00"
47
48
49 FLOATING_IP_ADDRESS = 'floating_ip_address'
50 FLOATING_NETWORK_ID = 'floating_network_id'
51 FLOATINGIP = 'floatingip'
52 FLOATINGIPS = 'floatingips'
53 ROUTERS = 'routers'
54 ROUTER = 'router'
55 SUBNET_ID = 'subnet_id'
56 ROUTER_ID = 'router_id'
57 PORT_ID = 'port_id'
58 FIXED_IP_ADDRESS = 'fixed_ip_address'
59 EXTERNAL_GW_INFO = 'external_gateway_info'
60
61
62 RESOURCE_ATTRIBUTE_MAP = {
63 ROUTERS: {
64 'id': {'allow_post': False, 'allow_put': False,
65 'validate': {'type:uuid': None},
66 'is_visible': True,
67 'is_filter': True,
68 'is_sort_key': True,
69 'primary_key': True},
70 'name': {'allow_post': True, 'allow_put': True,
71 'validate': {'type:string': constants.NAME_FIELD_SIZE},
72 'is_filter': True,
73 'is_sort_key': True,
74 'is_visible': True, 'default': ''},
75 'admin_state_up': {'allow_post': True, 'allow_put': True,
76 'default': True,
77 'convert_to': converters.convert_to_boolean,
78 'is_filter': True,
79 'is_sort_key': True,
80 'is_visible': True},
81 'status': {'allow_post': False, 'allow_put': False,
82 'is_sort_key': True,
83 'is_visible': True},
84 'tenant_id': {'allow_post': True, 'allow_put': False,
85 'required_by_policy': True,
86 'validate': {
87 'type:string': constants.PROJECT_ID_FIELD_SIZE},
88 'is_filter': True,
89 'is_sort_key': True,
90 'is_visible': True},
91 EXTERNAL_GW_INFO: {'allow_post': True, 'allow_put': True,
92 'is_visible': True, 'default': None,
93 'enforce_policy': True,
94 'validate': {
95 'type:dict_or_nodata': {
96 'network_id': {'type:uuid': None,
97 'required': True},
98 'external_fixed_ips': {
99 'type:fixed_ips': None,
100 'required': False,
101 }
102 }
103 }}
104 },
105 FLOATINGIPS: {
106 'id': {'allow_post': False, 'allow_put': False,
107 'validate': {'type:uuid': None},
108 'is_visible': True,
109 'is_filter': True,
110 'is_sort_key': True,
111 'primary_key': True},
112 'floating_ip_address': {'allow_post': True, 'allow_put': False,
113 'validate': {'type:ip_address_or_none': None},
114 'is_sort_key': True, 'is_filter': True,
115 'is_visible': True, 'default': None,
116 'enforce_policy': True},
117 'subnet_id': {'allow_post': True, 'allow_put': False,
118 'validate': {'type:uuid_or_none': None},
119 'is_visible': False, # Use False for input only attr
120 'default': None},
121 'floating_network_id': {'allow_post': True, 'allow_put': False,
122 'validate': {'type:uuid': None},
123 'is_filter': True, 'is_sort_key': True,
124 'is_visible': True},
125 'router_id': {'allow_post': False, 'allow_put': False,
126 'validate': {'type:uuid_or_none': None},
127 'is_filter': True, 'is_sort_key': True,
128 'is_visible': True, 'default': None},
129 'port_id': {'allow_post': True, 'allow_put': True,
130 'validate': {'type:uuid_or_none': None},
131 'is_filter': True,
132 'is_visible': True, 'default': None,
133 'required_by_policy': True},
134 'fixed_ip_address': {'allow_post': True, 'allow_put': True,
135 'validate': {'type:ip_address_or_none': None},
136 'is_filter': True, 'is_sort_key': True,
137 'is_visible': True, 'default': None},
138 'tenant_id': {'allow_post': True, 'allow_put': False,
139 'required_by_policy': True,
140 'validate': {
141 'type:string': constants.PROJECT_ID_FIELD_SIZE},
142 'is_filter': True, 'is_sort_key': True,
143 'is_visible': True},
144 'status': {'allow_post': False, 'allow_put': False,
145 'is_filter': True, 'is_sort_key': True,
146 'is_visible': True},
147 },
148 }
149
150 # The subresource attribute map for the extension. It adds child resources
151 # to main extension's resource. The subresource map must have a parent and
152 # a parameters entry. If an extension does not need such a map, None can
153 # be specified (mandatory).
154 SUB_RESOURCE_ATTRIBUTE_MAP = None
155
156 # The action map: it associates verbs with methods to be performed on
157 # the API resource.
158 ACTION_MAP = {
159 ROUTER: {
160 'add_router_interface': 'PUT',
161 'remove_router_interface': 'PUT'
162 }
163 }
164
165 # The action status.
166 ACTION_STATUS = {
167 }
168
169 # The list of required extensions.
170 REQUIRED_EXTENSIONS = [
171 ]
172
173 # The list of optional extensions.
174 OPTIONAL_EXTENSIONS = [
175 ]