Coverage for birdplan/bird_config/sections/tables/__init__.py: 100%

24 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 routing tables section.""" 

20 

21from ...globals import BirdConfigGlobals 

22from ..base import SectionBase 

23from .kernel import TableKernel 

24from .master import TableMaster 

25 

26__all__ = ["SectionTables"] 

27 

28 

29class SectionTables(SectionBase): 

30 """BIRD routing tables section.""" 

31 

32 _kernel: TableKernel 

33 _master: TableMaster 

34 

35 def __init__(self, birdconfig_globals: BirdConfigGlobals) -> None: 

36 """Initialize object.""" 

37 super().__init__(birdconfig_globals) 

38 

39 # Set section header 

40 self._section = "Routing Tables" 

41 

42 self._kernel = TableKernel(birdconfig_globals) 

43 self._master = TableMaster(birdconfig_globals) 

44 

45 def configure(self) -> None: 

46 """Configure all protocols.""" 

47 super().configure() 

48 

49 self.conf.add(self.kernel) 

50 # Re-order the master stuff right at the end 

51 self.conf.append(self.master, deferred=True) 

52 

53 @property 

54 def master(self) -> TableMaster: 

55 """Return the master table section.""" 

56 return self._master 

57 

58 @property 

59 def kernel(self) -> TableKernel: 

60 """Return the kernel table section.""" 

61 return self._kernel