Coverage for src/birdplan/bird_config/sections/protocols/ospf/ospf_attributes.py: 100%
15 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 OSPF protocol attributes."""
21__all__ = ["OSPFAttributes", "OSPFRoutePolicyAccept", "OSPFRoutePolicyRedistribute"]
24class OSPFRoutePolicyAccept: # pylint: disable=too-few-public-methods
25 """
26 OSPF route policy for acceptance of routes from OSPF peers into the main OSPF 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 OSPFRoutePolicyRedistribute: # pylint: disable=too-few-public-methods
43 r"""
44 OSPF route policy for redistributing of routes.
46 Attributes
47 ----------
48 connected : Union[bool, List[str]]
49 Redistribute connected routes to the main OSPF 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 OSPF table. Defaults to `False`.
53 kernel_default : bool
54 Redistribute kernel default routes to the main OSPF table. Defaults to `False`.
55 static : bool
56 Redistribute static routes to the main OSPF table. Defaults to `False`.
57 static_default : bool
58 Redistribute static default routes to the main OSPF table. Defaults to `False`.
60 """
62 connected: bool | list[str]
63 kernel: bool
64 kernel_default: bool
65 static: bool
66 static_default: bool
68 def __init__(self) -> None:
69 """Initialize object."""
70 self.connected = False
71 self.kernel = False
72 self.kernel_default = False
73 self.static = False
74 self.static_default = False
77class OSPFAttributes: # pylint: disable=too-few-public-methods
78 """
79 OSPF attributes.
81 Attributes
82 ----------
83 route_policy_accept : OSPFRoutePolicyAccept
84 Route policy for acceptance of routes from OSPF peers into our main OSPF table.
85 route_policy_redistribute : OSPFRoutePolicyRedistribute
86 Route policy for importing of routes from internal tables into our main OSPF table.
88 """
90 route_policy_accept: OSPFRoutePolicyAccept
91 route_policy_redistribute: OSPFRoutePolicyRedistribute
93 def __init__(self) -> None:
94 """Initialize object."""
96 self.route_policy_accept = OSPFRoutePolicyAccept()
97 self.route_policy_redistribute = OSPFRoutePolicyRedistribute()