Debian Codegraph @

neutron_dynamic_routing/policies/bgp_dragent.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='add_bgp_speaker_to_dragent',
24 check_str=neutron_base.ADMIN,
25 scope_types=['project'],
26 description='Add a BGP speaker to a dynamic routing agent',
27 operations=[
28 {
29 'method': 'POST',
30 'path': '/agents/{agent_id}/bgp-drinstances',
31 },
32 ],
33 deprecated_rule=policy.DeprecatedRule(
34 name='add_bgp_speaker_to_dragent',
35 check_str=base.RULE_ADMIN_ONLY,
36 deprecated_reason=DEPRECATED_REASON,
37 deprecated_since='2026.1')
38 ),
39 policy.DocumentedRuleDefault(
40 name='remove_bgp_speaker_from_dragent',
41 check_str=neutron_base.ADMIN,
42 scope_types=['project'],
43 description='Remove a BGP speaker from a dynamic routing agent',
44 operations=[
45 {
46 'method': 'DELETE',
47 'path': '/agents/{agent_id}/bgp-drinstances/{bgp_speaker_id}',
48 },
49 ],
50 deprecated_rule=policy.DeprecatedRule(
51 name='remove_bgp_speaker_from_dragent',
52 check_str=base.RULE_ADMIN_ONLY,
53 deprecated_reason=DEPRECATED_REASON,
54 deprecated_since='2026.1')
55 ),
56 policy.DocumentedRuleDefault(
57 name='list_bgp_speaker_on_dragent',
58 check_str=neutron_base.ADMIN,
59 scope_types=['project'],
60 description='List BGP speakers hosted by a dynamic routing agent',
61 operations=[
62 {
63 'method': 'GET',
64 'path': '/agents/{agent_id}/bgp-drinstances',
65 },
66 ],
67 deprecated_rule=policy.DeprecatedRule(
68 name='list_bgp_speaker_on_dragent',
69 check_str=base.RULE_ADMIN_ONLY,
70 deprecated_reason=DEPRECATED_REASON,
71 deprecated_since='2026.1')
72
73 ),
74 policy.DocumentedRuleDefault(
75 name='list_dragent_hosting_bgp_speaker',
76 check_str=neutron_base.ADMIN,
77 scope_types=['project'],
78 description='List dynamic routing agents hosting a BGP speaker',
79 operations=[
80 {
81 'method': 'GET',
82 'path': '/bgp-speakers/{bgp_speaker_id}/bgp-dragents',
83 },
84 ],
85 deprecated_rule=policy.DeprecatedRule(
86 name='list_dragent_hosting_bgp_speaker',
87 check_str=base.RULE_ADMIN_ONLY,
88 deprecated_reason=DEPRECATED_REASON,
89 deprecated_since='2026.1')
90 ),
91 ]
92
93
94 def list_rules():
95 return rules