Debian Codegraph @

neutron_lib/api/definitions/network.py

raw
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.api.definitions import subnet
15 from neutron_lib import constants
16 from neutron_lib.db import constants as db_const
17
18
19 NAME = 'Neutron L2 Network'
20 ALIAS = 'network'
21 DESCRIPTION = "Layer 2 network abstraction"
22
23 UPDATED_TIMESTAMP = "2012-01-01T10:00:00-00:00"
24
25 RESOURCE_NAME = 'network'
26 COLLECTION_NAME = 'networks'
27
28 # Identify the attribute used by a resource to reference another resource
29
30 RESOURCE_FOREIGN_KEYS = {
31 COLLECTION_NAME: 'network_id'
32 }
33
34 RESOURCE_ATTRIBUTE_MAP = {
35 COLLECTION_NAME: {
36 'id': {'allow_post': False, 'allow_put': False,
37 'validate': {'type:uuid': None},
38 'is_visible': True,
39 'is_filter': True,
40 'is_sort_key': True,
41 'primary_key': True},
42 'name': {'allow_post': True, 'allow_put': True,
43 'validate': {
44 'type:string': db_const.NAME_FIELD_SIZE},
45 'default': '', 'is_visible': True, 'is_filter': True,
46 'is_sort_key': True},
47 subnet.COLLECTION_NAME: {'allow_post': False, 'allow_put': False,
48 'default': [],
49 'is_visible': True},
50 'admin_state_up': {'allow_post': True, 'allow_put': True,
51 'default': True,
52 'convert_to': converters.convert_to_boolean,
53 'is_filter': True,
54 'is_sort_key': True,
55 'is_visible': True},
56 'status': {'allow_post': False, 'allow_put': False,
57 'is_visible': True, 'is_filter': True, 'is_sort_key': True},
58 'tenant_id': {'allow_post': True, 'allow_put': False,
59 'validate': {
60 'type:string': db_const.PROJECT_ID_FIELD_SIZE},
61 'required_by_policy': True,
62 'is_filter': True,
63 'is_sort_key': True,
64 'is_visible': True},
65 constants.SHARED: {
66 'allow_post': True,
67 'allow_put': True,
68 'default': False,
69 'convert_to': converters.convert_to_boolean,
70 'is_visible': True,
71 'is_filter': True,
72 'required_by_policy': True,
73 'enforce_policy': True
74 }
75 }
76 }
77
78 # This is a core resource so the following are not applicable.
79 IS_SHIM_EXTENSION = False
80 IS_STANDARD_ATTR_EXTENSION = False
81 SUB_RESOURCE_ATTRIBUTE_MAP = {}
82 ACTION_MAP = {}
83 REQUIRED_EXTENSIONS = []
84 OPTIONAL_EXTENSIONS = []
85 ACTION_STATUS = {}