Coverage for src/birdplan/bird_config/sections/protocols/ospf/area/interface/interface_attributes.py: 94%
18 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) 2015-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 area interface attributes."""
21from .......exceptions import BirdPlanError
23__all__ = ["OSPFAreaInterfaceAttributes"]
26class OSPFAreaInterfaceAttributes: # pylint: disable=too-few-public-methods
27 """
28 OSPF area interface attributes.
30 Attributes
31 ----------
32 name : Optional[str]
33 Interface name.
35 cost : int
36 Interface output cost, defaults to 10.
38 ecmp_weight : int
39 ECMP weight, defaults to 1.
41 hello : Optional[int]
42 Helo message interface, defaults to 10 in BIRD.
44 wait : Optional[int]
45 Wait time between election and building adjacency. Defaults to 4*hello in BIRD.
47 stub : bool
48 Indicats that this interface is a stub or not, defaults to False.
50 """
52 _name: str | None
54 cost: int
55 ecmp_weight: int
57 hello: int | None
58 wait: int | None
60 stub: bool
62 def __init__(self) -> None:
63 """Initialize object."""
65 self._name = None
67 self.cost = 10
68 self.ecmp_weight = 1
70 self.hello = None
71 self.wait = None
73 self.stub = False
75 @property
76 def name(self) -> str:
77 """Area interface name."""
78 if self._name is None:
79 raise BirdPlanError("OSPF area interface name must be set")
80 return self._name
82 @name.setter
83 def name(self, name: str) -> None:
84 """Area interface name."""
85 self._name = name