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

25 statements  

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

18 

19"""BIRD protocol base class.""" 

20 

21from ...globals import BirdConfigGlobals 

22from ..base import SectionBase 

23from ..constants import SectionConstants 

24from ..functions import SectionFunctions 

25from ..tables import SectionTables 

26 

27__all__ = ["SectionProtocolBase"] 

28 

29 

30class SectionProtocolBase(SectionBase): 

31 """BIRD protocol base class.""" 

32 

33 # Global objects to inject configuration 

34 _constants: SectionConstants 

35 _functions: SectionFunctions 

36 _tables: SectionTables 

37 

38 def __init__( 

39 self, 

40 birdconfig_globals: BirdConfigGlobals, 

41 constants: SectionConstants, 

42 functions: SectionFunctions, 

43 tables: SectionTables, 

44 ): 

45 """Initialize the object.""" 

46 super().__init__(birdconfig_globals) 

47 

48 self._constants = constants 

49 self._functions = functions 

50 self._tables = tables 

51 

52 @property 

53 def constants(self) -> SectionConstants: 

54 """Return the global constants section.""" 

55 return self._constants 

56 

57 @property 

58 def functions(self) -> SectionFunctions: 

59 """Return the global functions section.""" 

60 return self._functions 

61 

62 @property 

63 def tables(self) -> SectionTables: 

64 """Return the global tables section.""" 

65 return self._tables