Coverage for src/birdplan/bird_config/sections/protocols/base.py: 100%

26 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 protocol base class.""" 

20 

21from ...globals import BirdConfigGlobals 

22from ..base import SectionBase 

23from ..bird_attributes import SectionBirdAttributes 

24from ..constants import SectionConstants 

25from ..functions import SectionFunctions 

26from ..tables import SectionTables 

27 

28__all__ = ["SectionProtocolBase"] 

29 

30 

31class SectionProtocolBase(SectionBase): 

32 """BIRD protocol base class.""" 

33 

34 # Global objects to inject configuration 

35 _birdattributes: SectionBirdAttributes 

36 _constants: SectionConstants 

37 _functions: SectionFunctions 

38 _tables: SectionTables 

39 

40 def __init__( # pylint: disable=too-many-arguments,too-many-positional-arguments 

41 self, 

42 birdconfig_globals: BirdConfigGlobals, 

43 birdattributes: SectionBirdAttributes, 

44 constants: SectionConstants, 

45 functions: SectionFunctions, 

46 tables: SectionTables, 

47 ) -> None: 

48 """Initialize the object.""" 

49 super().__init__(birdconfig_globals) 

50 

51 self._birdattributes = birdattributes 

52 self._constants = constants 

53 self._functions = functions 

54 self._tables = tables 

55 

56 @property 

57 def birdattributes(self) -> SectionBirdAttributes: 

58 """Return the global attributes section.""" 

59 return self._birdattributes 

60 

61 @property 

62 def constants(self) -> SectionConstants: 

63 """Return the global constants section.""" 

64 return self._constants 

65 

66 @property 

67 def functions(self) -> SectionFunctions: 

68 """Return the global functions section.""" 

69 return self._functions 

70 

71 @property 

72 def tables(self) -> SectionTables: 

73 """Return the global tables section.""" 

74 return self._tables