Coverage for src/birdplan/bird_config/sections/protocols/ospf/area/area_attributes.py: 92%

13 statements  

« 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/>. 

18 

19"""BIRD OSPF area attributes.""" 

20 

21from ......exceptions import BirdPlanError 

22 

23__all__ = ["OSPFAreaAttributes"] 

24 

25 

26class OSPFAreaAttributes: # pylint: disable=too-few-public-methods 

27 """ 

28 OSPF area attributes. 

29 

30 Attributes 

31 ---------- 

32 name : Optional[str] 

33 Area name. 

34 

35 """ 

36 

37 _name: str | None 

38 

39 def __init__(self) -> None: 

40 """Initialize object.""" 

41 

42 self._name = None 

43 

44 @property 

45 def name(self) -> str: 

46 """Area name.""" 

47 if self._name is None: 

48 raise BirdPlanError("OSPF area name must be set") 

49 return self._name 

50 

51 @name.setter 

52 def name(self, name: str) -> None: 

53 """Area name.""" 

54 self._name = name