Debian Codegraph @

neutron_dynamic_routing/policies/bgp_speaker.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.conf.policies import base as neutron_base
14 from neutron_lib import policy as base
15 from oslo_policy import policy
16
17 DEPRECATED_REASON = """
18 The neutron-dynamic-routing BGP API now supports Secure RBAC default roles.
19 """
20
21 rules = [
22 policy.DocumentedRuleDefault(
23 name='create_bgp_speaker',
24 check_str=neutron_base.ADMIN,
25 scope_types=['project'],
26 description='Create a BGP speaker',
27 operations=[
28 {
29 'method': 'POST',
30 'path': '/bgp-speakers',
31 },
32 ],
33 deprecated_rule=policy.DeprecatedRule(
34 name='create_bgp_speaker',
35 check_str=base.RULE_ADMIN_ONLY,
36 deprecated_reason=DEPRECATED_REASON,
37 deprecated_since='2026.1')
38 ),
39 policy.DocumentedRuleDefault(
40 name='update_bgp_speaker',
41 check_str=neutron_base.ADMIN,
42 scope_types=['project'],
43 description='Update a BGP speaker',
44 operations=[
45 {
46 'method': 'PUT',
47 'path': '/bgp-speakers/{id}',
48 },
49 ],
50 deprecated_rule=policy.DeprecatedRule(
51 name='update_bgp_speaker',
52 check_str=base.RULE_ADMIN_ONLY,
53 deprecated_reason=DEPRECATED_REASON,
54 deprecated_since='2026.1')
55 ),
56 policy.DocumentedRuleDefault(
57 name='delete_bgp_speaker',
58 check_str=neutron_base.ADMIN,
59 scope_types=['project'],
60 description='Delete a BGP speaker',
61 operations=[
62 {
63 'method': 'DELETE',
64 'path': '/bgp-speakers/{id}',
65 },
66 ],
67 deprecated_rule=policy.DeprecatedRule(
68 name='delete_bgp_speaker',
69 check_str=base.RULE_ADMIN_ONLY,
70 deprecated_reason=DEPRECATED_REASON,
71 deprecated_since='2026.1')
72 ),
73 policy.DocumentedRuleDefault(
74 name='get_bgp_speaker',
75 check_str=neutron_base.ADMIN,
76 scope_types=['project'],
77 description='Get BGP speakers',
78 operations=[
79 {
80 'method': 'GET',
81 'path': '/bgp-speakers',
82 },
83 {
84 'method': 'GET',
85 'path': '/bgp-speakers/{id}',
86 },
87 ],
88 deprecated_rule=policy.DeprecatedRule(
89 name='get_bgp_speaker',
90 check_str=base.RULE_ADMIN_ONLY,
91 deprecated_reason=DEPRECATED_REASON,
92 deprecated_since='2026.1')
93 ),
94
95 policy.DocumentedRuleDefault(
96 name='add_bgp_peer',
97 check_str=neutron_base.ADMIN,
98 scope_types=['project'],
99 description='Add a BGP peer to a BGP speaker',
100 operations=[
101 {
102 'method': 'PUT',
103 'path': '/bgp-speakers/{id}/add_bgp_peer',
104 },
105 ],
106 deprecated_rule=policy.DeprecatedRule(
107 name='add_bgp_peer',
108 check_str=base.RULE_ADMIN_ONLY,
109 deprecated_reason=DEPRECATED_REASON,
110 deprecated_since='2026.1')
111 ),
112 policy.DocumentedRuleDefault(
113 name='remove_bgp_peer',
114 check_str=neutron_base.ADMIN,
115 scope_types=['project'],
116 description='Remove a BGP peer from a BGP speaker',
117 operations=[
118 {
119 'method': 'PUT',
120 'path': '/bgp-speakers/{id}/remove_bgp_peer',
121 },
122 ],
123 deprecated_rule=policy.DeprecatedRule(
124 name='remove_bgp_peer',
125 check_str=base.RULE_ADMIN_ONLY,
126 deprecated_reason=DEPRECATED_REASON,
127 deprecated_since='2026.1')
128 ),
129 policy.DocumentedRuleDefault(
130 name='add_gateway_network',
131 check_str=neutron_base.ADMIN,
132 scope_types=['project'],
133 description='Add a gateway network to a BGP speaker',
134 operations=[
135 {
136 'method': 'PUT',
137 'path': '/bgp-speakers/{id}/add_gateway_network',
138 },
139 ],
140 deprecated_rule=policy.DeprecatedRule(
141 name='add_gateway_network',
142 check_str=base.RULE_ADMIN_ONLY,
143 deprecated_reason=DEPRECATED_REASON,
144 deprecated_since='2026.1')
145 ),
146 policy.DocumentedRuleDefault(
147 name='remove_gateway_network',
148 check_str=neutron_base.ADMIN,
149 scope_types=['project'],
150 description='Remove a gateway network from a BGP speaker',
151 operations=[
152 {
153 'method': 'PUT',
154 'path': '/bgp-speakers/{id}/remove_gateway_network',
155 },
156 ],
157 deprecated_rule=policy.DeprecatedRule(
158 name='remove_gateway_network',
159 check_str=base.RULE_ADMIN_ONLY,
160 deprecated_reason=DEPRECATED_REASON,
161 deprecated_since='2026.1')
162 ),
163 policy.DocumentedRuleDefault(
164 name='get_advertised_routes',
165 check_str=neutron_base.ADMIN,
166 scope_types=['project'],
167 description='Get advertised routes of a BGP speaker',
168 operations=[
169 {
170 'method': 'GET',
171 'path': '/bgp-speakers/{id}/get_advertised_routes',
172 },
173 ],
174 deprecated_rule=policy.DeprecatedRule(
175 name='get_advertised_routes',
176 check_str=base.RULE_ADMIN_ONLY,
177 deprecated_reason=DEPRECATED_REASON,
178 deprecated_since='2026.1')
179 ),
180 ]
181
182
183 def list_rules():
184 return rules