Coverage for birdplan/bird_config/sections/protocols/ospf/area/interface/interface_attributes.py: 96%
26 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 area interface attributes."""
21from typing import Optional
23from .......exceptions import BirdPlanError
25__all__ = ["OSPFAreaInterfaceAttributes"]
28class OSPFAreaInterfaceAttributes: # pylint: disable=too-few-public-methods
29 """
30 OSPF area interface attributes.
32 Attributes
33 ----------
34 name : Optional[str]
35 Interface name.
37 cost : int
38 Interface output cost, defaults to 10.
40 ecmp_weight : int
41 ECMP weight, defaults to 1.
43 hello : Optional[int]
44 Helo message interface, defaults to 10 in BIRD.
46 wait : Optional[int]
47 Wait time between election and building adjacency. Defaults to 4*hello in BIRD.
49 stub : bool
50 Indicats that this interface is a stub or not, defaults to False.
52 """
54 _name: Optional[str]
56 cost: int
57 ecmp_weight: int
59 hello: Optional[int]
60 wait: Optional[int]
62 stub: bool
64 def __init__(self) -> None:
65 """Initialize object."""
67 self._name = None
69 self.cost = 10
70 self.ecmp_weight = 1
72 self.hello = None
73 self.wait = None
75 self.stub = False
77 @property
78 def name(self) -> str:
79 """Area interface name."""
80 if self._name is None:
81 raise BirdPlanError("OSPF area interface name must be set")
82 return self._name
84 @name.setter
85 def name(self, name: str) -> None:
86 """Area interface name."""
87 self._name = name