Coverage for src/birdplan/bird_config/sections/protocols/rip/rip_attributes.py: 100%
17 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-25 07:38 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-25 07:38 +0000
1#
2# SPDX-License-Identifier: GPL-3.0-or-later
3#
4# Copyright (c) 2019-2025, AllWorldIT
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
19"""BIRD RIP protocol attributes."""
21__all__ = ["RIPAttributes", "RIPRoutePolicyAccept", "RIPRoutePolicyRedistribute"]
24class RIPRoutePolicyAccept: # pylint: disable=too-few-public-methods
25 """
26 RIP route policy for acceptance of routes from RIP peers into the main RIP table.
28 Attributes
29 ----------
30 default : bool
31 Accept default route. Defaults to `False`.
33 """
35 default: bool
37 def __init__(self) -> None:
38 """Initialize object."""
39 self.default = False
42class RIPRoutePolicyRedistribute: # pylint: disable=too-few-public-methods
43 r"""
44 RIP route policy for redistributing of routes.
46 Attributes
47 ----------
48 connected : Union[bool, List[str]]
49 Redistribute connected routes to the main RIP table. This attribute is indexed by interface name with a boolean option.
50 The interface name can be an exact interface match, or a wildcard with a \*.
51 kernel : bool
52 Redistribute kernel routes to the main RIP table. Defaults to `False`.
53 kernel_default : bool
54 Redistribute kernel default routes to the main RIP table. Defaults to `False`.
55 rip : bool
56 Redistribute RIP routes. Defaults to `True`.
57 rip_default : bool
58 Redistribute RIP default routes. Defaults to `False`.
59 static : bool
60 Redistribute static routes to the main RIP table. Defaults to `False`.
61 static_default : bool
62 Redistribute static default routes to the main RIP table. Defaults to `False`.
64 """
66 connected: bool | list[str]
67 kernel: bool
68 kernel_default: bool
69 rip: bool
70 rip_default: bool
71 static: bool
72 static_default: bool
74 def __init__(self) -> None:
75 """Initialize object."""
76 self.connected = False
77 self.kernel = False
78 self.kernel_default = False
79 self.rip = True
80 self.rip_default = False
81 self.static = False
82 self.static_default = False
85class RIPAttributes: # pylint: disable=too-few-public-methods
86 """
87 RIP attributes.
89 Attributes
90 ----------
91 route_policy_accept : RIPRoutePolicyAccept
92 Route policy for acceptance of routes from RIP peers into our main RIP table.
93 route_policy_redistribute : RIPRoutePolicyRedistribute
94 Route policy for importing of routes from internal tables into our main RIP table.
96 """
98 route_policy_accept: RIPRoutePolicyAccept
99 route_policy_redistribute: RIPRoutePolicyRedistribute
101 def __init__(self) -> None:
102 """Initialize object."""
104 self.route_policy_accept = RIPRoutePolicyAccept()
105 self.route_policy_redistribute = RIPRoutePolicyRedistribute()