Debian Codegraph @

neutron_lib/api/definitions/bgp.py

raw
1 # Copyright 2016 Hewlett Packard Development Coompany LP
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain 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,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 # implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 from neutron_lib.api import converters as n_conv
18 from neutron_lib import constants
19 from neutron_lib.db import constants as db_const
20
21
22 ALIAS = 'bgp'
23 IS_SHIM_EXTENSION = False
24 IS_STANDARD_ATTR_EXTENSION = False
25 NAME = "Neutron BGP Dynamic Routing Extension"
26 DESCRIPTION = ("Discover and advertise routes for Neutron prefixes "
27 "dynamically via BGP")
28 UPDATED_TIMESTAMP = '2016-05-10T15:37:00-00:00'
29 BGP_SPEAKER_RESOURCE_NAME = 'bgp-speaker'
30 BGP_SPEAKER_BODY_KEY_NAME = 'bgp_speaker'
31 BGP_SPEAKERS = f'{BGP_SPEAKER_BODY_KEY_NAME}s'
32 BGP_PEER_BODY_KEY_NAME = 'bgp_peer'
33
34
35 RESOURCE_ATTRIBUTE_MAP = {
36 BGP_SPEAKER_RESOURCE_NAME + 's': {
37 'id': {'allow_post': False, 'allow_put': False,
38 'validate': {'type:uuid': None},
39 'is_visible': True, 'primary_key': True},
40 'name': {'allow_post': True, 'allow_put': True,
41 'validate': {'type:string': db_const.NAME_FIELD_SIZE},
42 'is_visible': True, 'default': ''},
43 'local_as': {'allow_post': True, 'allow_put': False,
44 'validate': {'type:range': (constants.MIN_ASNUM,
45 constants.MAX_ASNUM)},
46 'is_visible': True, 'default': None,
47 'required_by_policy': False,
48 'enforce_policy': False},
49 'ip_version': {'allow_post': True, 'allow_put': False,
50 'validate': {'type:values': [4, 6]},
51 'is_visible': True, 'default': None,
52 'required_by_policy': False,
53 'enforce_policy': False},
54 'tenant_id': {'allow_post': True, 'allow_put': False,
55 'required_by_policy': False,
56 'validate': {
57 'type:string': db_const.PROJECT_ID_FIELD_SIZE},
58 'is_visible': True},
59 'peers': {'allow_post': False, 'allow_put': False,
60 'validate': {'type:uuid_list': None},
61 'is_visible': True, 'default': [],
62 'required_by_policy': False,
63 'enforce_policy': True},
64 'networks': {'allow_post': False, 'allow_put': False,
65 'validate': {'type:uuid_list': None},
66 'is_visible': True, 'default': [],
67 'required_by_policy': False,
68 'enforce_policy': True},
69 'advertise_floating_ip_host_routes': {
70 'allow_post': True,
71 'allow_put': True,
72 'convert_to': n_conv.convert_to_boolean,
73 'validate': {'type:boolean': None},
74 'is_visible': True, 'default': True,
75 'required_by_policy': False,
76 'enforce_policy': True},
77 'advertise_tenant_networks': {
78 'allow_post': True,
79 'allow_put': True,
80 'convert_to': n_conv.convert_to_boolean,
81 'validate': {'type:boolean': None},
82 'is_visible': True, 'default': True,
83 'required_by_policy': False,
84 'enforce_policy': True},
85 },
86 'bgp-peers': {
87 'id': {'allow_post': False, 'allow_put': False,
88 'validate': {'type:uuid': None},
89 'is_visible': True, 'primary_key': True},
90 'name': {'allow_post': True, 'allow_put': True,
91 'validate': {'type:string': db_const.NAME_FIELD_SIZE},
92 'is_visible': True, 'default': ''},
93 'peer_ip': {'allow_post': True, 'allow_put': False,
94 'required_by_policy': True,
95 'validate': {'type:ip_address': None},
96 'is_visible': True},
97 'remote_as': {'allow_post': True, 'allow_put': False,
98 'validate': {'type:range': (constants.MIN_ASNUM,
99 constants.MAX_ASNUM)},
100 'is_visible': True, 'default': None,
101 'required_by_policy': False,
102 'enforce_policy': False},
103 'auth_type': {'allow_post': True, 'allow_put': False,
104 'required_by_policy': True,
105 'validate': {'type:values':
106 constants.SUPPORTED_AUTH_TYPES},
107 'is_visible': True},
108 'password': {'allow_post': True, 'allow_put': True,
109 'required_by_policy': True,
110 'validate': {'type:string_or_none': None},
111 'is_visible': False,
112 'default': None},
113 'tenant_id': {'allow_post': True, 'allow_put': False,
114 'required_by_policy': False,
115 'validate': {
116 'type:string': db_const.PROJECT_ID_FIELD_SIZE},
117 'is_visible': True}
118 }
119 }
120 SUB_RESOURCE_ATTRIBUTE_MAP = None
121 ACTION_MAP = {
122 BGP_SPEAKER_RESOURCE_NAME: {
123 'add_bgp_peer': 'PUT',
124 'remove_bgp_peer': 'PUT',
125 'add_gateway_network': 'PUT',
126 'remove_gateway_network': 'PUT',
127 'get_advertised_routes': 'GET'
128 }
129 }
130 ACTION_STATUS = {}
131 REQUIRED_EXTENSIONS = []
132 OPTIONAL_EXTENSIONS = []