Coverage for src/birdplan/bird_config/sections/__init__.py: 100%
55 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-25 07:38 +0000
« 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/>.
19"""BIRD configuration sections."""
21from ..globals import BirdConfigGlobals
22from .base import SectionBase
23from .bird_attributes import SectionBirdAttributes
24from .constants import SectionConstants
25from .functions import SectionFunctions
26from .log import SectionLogging
27from .main import SectionMain
28from .protocols import SectionProtocols
29from .router_id import SectionRouterID
30from .tables import SectionTables
32__all__ = ["Sections"]
35class Sections(SectionBase): # pylint: disable=too-many-instance-attributes
36 """BIRD configuration sections."""
38 _logging: SectionLogging
39 _main: SectionMain
40 _router_id: SectionRouterID
41 _birdattributes: SectionBirdAttributes
42 _constants: SectionConstants
43 _functions: SectionFunctions
44 _tables: SectionTables
45 _protocols: SectionProtocols
47 def __init__(self, birdconfig_globals: BirdConfigGlobals) -> None:
48 """Initialize object."""
49 super().__init__(birdconfig_globals)
51 self._logging = SectionLogging(birdconfig_globals)
52 self._main = SectionMain(birdconfig_globals)
53 self._router_id = SectionRouterID(birdconfig_globals)
54 self._birdattributes = SectionBirdAttributes(birdconfig_globals)
55 self._constants = SectionConstants(birdconfig_globals)
56 self._functions = SectionFunctions(birdconfig_globals)
57 self._tables = SectionTables(birdconfig_globals)
58 self._protocols = SectionProtocols(birdconfig_globals, self.birdattributes, self.constants, self.functions, self.tables)
60 def configure(self) -> None:
61 """Configure all sections."""
62 self.conf.add(self.logging)
63 self.conf.add(self.main)
64 self.conf.add(self.router_id)
65 self.conf.add(self.birdattributes, deferred=True)
66 self.conf.add(self.constants, deferred=True)
67 self.conf.add(self.tables, deferred=True)
68 self.conf.add(self.functions, deferred=True)
69 self.conf.add(self.protocols)
71 @property
72 def birdattributes(self) -> SectionBirdAttributes:
73 """Return the attributes section."""
74 return self._birdattributes
76 @property
77 def constants(self) -> SectionConstants:
78 """Return the constants section."""
79 return self._constants
81 @property
82 def functions(self) -> SectionFunctions:
83 """Return the functions section."""
84 return self._functions
86 @property
87 def logging(self) -> SectionLogging:
88 """Return the logging section."""
89 return self._logging
91 @property
92 def main(self) -> SectionMain:
93 """Return the main section."""
94 return self._main
96 @property
97 def router_id(self) -> SectionRouterID:
98 """Return the router_id section."""
99 return self._router_id
101 @property
102 def tables(self) -> SectionTables:
103 """Return the tables section."""
104 return self._tables
106 @property
107 def protocols(self) -> SectionProtocols:
108 """Return the protocols section."""
109 return self._protocols