Debian Codegraph @

neutron_lib/api/definitions/local_ip.py

raw
1 # Copyright 2021 Huawei, Inc.
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 import constants
17 from neutron_lib.db import constants as db_const
18
19 RESOURCE_NAME = 'local_ip'
20 COLLECTION_NAME = RESOURCE_NAME + 's'
21
22 LOCAL_IP_ASSOCIATION = 'port_association'
23 LOCAL_IP_ASSOCIATIONS = LOCAL_IP_ASSOCIATION + 's'
24
25 ALIAS = RESOURCE_NAME
26 IS_SHIM_EXTENSION = False
27 IS_STANDARD_ATTR_EXTENSION = False
28 NAME = 'Local IP'
29 DESCRIPTION = 'Support Node Local Virtual IP'
30 UPDATED_TIMESTAMP = '2021-07-26T10:00:00-00:00'
31
32 IP_MODE_TRANSLATE = 'translate'
33 IP_MODE_PASSTHROUGH = 'passthrough'
34 VALID_IP_MODES = [IP_MODE_TRANSLATE, IP_MODE_PASSTHROUGH]
35
36 RESOURCE_ATTRIBUTE_MAP = {
37 COLLECTION_NAME: {
38 'id': {
39 'allow_post': False,
40 'allow_put': False,
41 'validate': {'type:uuid': None},
42 'is_visible': True,
43 'is_filter': True,
44 'is_sort_key': True,
45 'primary_key': True},
46 'name': {
47 'allow_post': True,
48 'allow_put': True,
49 'default': '',
50 'validate': {'type:string': db_const.NAME_FIELD_SIZE},
51 'is_filter': True,
52 'is_sort_key': True,
53 'is_visible': True},
54 'description': {
55 'allow_post': True,
56 'allow_put': True,
57 'default': '',
58 'validate': {'type:string': db_const.LONG_DESCRIPTION_FIELD_SIZE},
59 'is_filter': True,
60 'is_sort_key': True,
61 'is_visible': True},
62 'project_id': {
63 'allow_post': True,
64 'allow_put': False,
65 'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE},
66 'required_by_policy': True,
67 'is_filter': True,
68 'is_sort_key': True,
69 'is_visible': True},
70 'local_port_id': {
71 'allow_post': True,
72 'allow_put': False,
73 'validate': {'type:uuid': None},
74 'default': constants.ATTR_NOT_SPECIFIED,
75 'is_filter': True,
76 'is_sort_key': True,
77 'is_visible': True},
78 'network_id': {
79 'allow_post': True,
80 'allow_put': False,
81 'validate': {'type:uuid': None},
82 'default': constants.ATTR_NOT_SPECIFIED,
83 'is_filter': True,
84 'is_sort_key': True,
85 'is_visible': True},
86 'local_ip_address': {
87 'allow_post': True,
88 'allow_put': False,
89 'default': constants.ATTR_NOT_SPECIFIED,
90 'validate': {'type:ip_address_or_none': None},
91 'is_filter': True,
92 'is_sort_key': True,
93 'is_visible': True,
94 'enforce_policy': True},
95 'ip_mode': {
96 'allow_post': True,
97 'allow_put': False,
98 'default': IP_MODE_TRANSLATE,
99 'validate': {'type:values': VALID_IP_MODES},
100 'is_filter': True,
101 'is_sort_key': True,
102 'is_visible': True},
103 }
104 }
105
106 SUB_RESOURCE_ATTRIBUTE_MAP = {
107 LOCAL_IP_ASSOCIATIONS: {
108 'parent': {'collection_name': COLLECTION_NAME,
109 'member_name': RESOURCE_NAME},
110 'parameters': {
111 'local_ip_id': {
112 'allow_post': False,
113 'allow_put': False,
114 'is_visible': True},
115 'local_ip_address': {
116 'allow_post': False,
117 'allow_put': False,
118 'is_filter': True,
119 'is_sort_key': True,
120 'is_visible': True},
121 'fixed_port_id': {
122 'allow_post': True,
123 'allow_put': False,
124 'validate': {'type:uuid': None},
125 'is_filter': True,
126 'is_sort_key': True,
127 'is_visible': True},
128 'fixed_ip': {
129 'allow_post': True,
130 'allow_put': False,
131 'validate': {'type:ip_address_or_none': None},
132 'is_filter': True,
133 'is_sort_key': True,
134 'is_visible': True,
135 'default': None},
136 'host': {
137 'allow_post': False,
138 'allow_put': False,
139 'is_filter': True,
140 'is_sort_key': True,
141 'is_visible': True},
142 'project_id': {
143 'allow_post': True,
144 'allow_put': False,
145 'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE},
146 'required_by_policy': True,
147 'is_visible': False},
148 }
149 }
150 }
151
152 ACTION_MAP = {}
153
154 ACTION_STATUS = {}
155
156 REQUIRED_EXTENSIONS = []
157
158 OPTIONAL_EXTENSIONS = []