Coverage for birdplan/bird_config/sections/protocols/ospf/ospf_attributes.py: 100%
25 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-23 03:27 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-23 03:27 +0000
1#
2# SPDX-License-Identifier: GPL-3.0-or-later
3#
4# Copyright (c) 2019-2024, 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."""
21from typing import List, Union
23__all__ = ["OSPFRoutePolicyAccept", "OSPFRoutePolicyRedistribute", "OSPFAttributes"]
26class OSPFRoutePolicyAccept: # pylint: disable=too-few-public-methods
27 """
28 OSPF route policy for acceptance of routes from OSPF peers into the main OSPF table.
30 Attributes
31 ----------
32 default : bool
33 Accept default route. Defaults to `False`.
35 """
37 default: bool
39 def __init__(self) -> None:
40 """Initialize object."""
41 self.default = False
44class OSPFRoutePolicyRedistribute: # pylint: disable=too-few-public-methods
45 r"""
46 OSPF route policy for redistributing of routes.
48 Attributes
49 ----------
50 connected : Union[bool, List[str]]
51 Redistribute connected routes to the main OSPF table. This attribute is indexed by interface name with a boolean option.
52 The interface name can be an exact interface match, or a wildcard with a \*.
53 kernel : bool
54 Redistribute kernel routes to the main OSPF table. Defaults to `False`.
55 kernel_default : bool
56 Redistribute kernel default routes to the main OSPF table. Defaults to `False`.
57 static : bool
58 Redistribute static routes to the main OSPF table. Defaults to `False`.
59 static_default : bool
60 Redistribute static default routes to the main OSPF table. Defaults to `False`.
62 """
64 connected: Union[bool, List[str]]
65 kernel: bool
66 kernel_default: bool
67 static: bool
68 static_default: bool
70 def __init__(self) -> None:
71 """Initialize object."""
72 self.connected = False
73 self.kernel = False
74 self.kernel_default = False
75 self.static = False
76 self.static_default = False
79class OSPFAttributes: # pylint: disable=too-few-public-methods
80 """
81 OSPF attributes.
83 Attributes
84 ----------
85 route_policy_accept : OSPFRoutePolicyAccept
86 Route policy for acceptance of routes from OSPF peers into our main OSPF table.
87 route_policy_redistribute : OSPFRoutePolicyRedistribute
88 Route policy for importing of routes from internal tables into our main OSPF table.
90 """
92 route_policy_accept: OSPFRoutePolicyAccept
93 route_policy_redistribute: OSPFRoutePolicyRedistribute
95 def __init__(self) -> None:
96 """Initialize object."""
98 self.route_policy_accept = OSPFRoutePolicyAccept()
99 self.route_policy_redistribute = OSPFRoutePolicyRedistribute()