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

29 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 RIP protocol attributes.""" 

20 

21from typing import List, Union 

22 

23__all__ = ["RIPRoutePolicyAccept", "RIPRoutePolicyRedistribute", "RIPAttributes"] 

24 

25 

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

27 """ 

28 RIP route policy for acceptance of routes from RIP peers into the main RIP table. 

29 

30 Attributes 

31 ---------- 

32 default : bool 

33 Accept default route. Defaults to `False`. 

34 

35 """ 

36 

37 default: bool 

38 

39 def __init__(self) -> None: 

40 """Initialize object.""" 

41 self.default = False 

42 

43 

44class RIPRoutePolicyRedistribute: # pylint: disable=too-few-public-methods 

45 r""" 

46 RIP route policy for redistributing of routes. 

47 

48 Attributes 

49 ---------- 

50 connected : Union[bool, List[str]] 

51 Redistribute connected routes to the main RIP table. This attribute is indexed by interface name with a boolean option. 

52 The interface name can be an exact interface match, or a wildcard with a \*. 

53 kernel : bool 

54 Redistribute kernel routes to the main RIP table. Defaults to `False`. 

55 kernel_default : bool 

56 Redistribute kernel default routes to the main RIP table. Defaults to `False`. 

57 rip : bool 

58 Redistribute RIP routes. Defaults to `True`. 

59 rip_default : bool 

60 Redistribute RIP default routes. Defaults to `False`. 

61 static : bool 

62 Redistribute static routes to the main RIP table. Defaults to `False`. 

63 static_default : bool 

64 Redistribute static default routes to the main RIP table. Defaults to `False`. 

65 

66 """ 

67 

68 connected: Union[bool, List[str]] 

69 kernel: bool 

70 kernel_default: bool 

71 rip: bool 

72 rip_default: bool 

73 static: bool 

74 static_default: bool 

75 

76 def __init__(self) -> None: 

77 """Initialize object.""" 

78 self.connected = False 

79 self.kernel = False 

80 self.kernel_default = False 

81 self.rip = True 

82 self.rip_default = False 

83 self.static = False 

84 self.static_default = False 

85 

86 

87class RIPAttributes: # pylint: disable=too-few-public-methods 

88 """ 

89 RIP attributes. 

90 

91 Attributes 

92 ---------- 

93 route_policy_accept : RIPRoutePolicyAccept 

94 Route policy for acceptance of routes from RIP peers into our main RIP table. 

95 route_policy_redistribute : RIPRoutePolicyRedistribute 

96 Route policy for importing of routes from internal tables into our main RIP table. 

97 

98 """ 

99 

100 route_policy_accept: RIPRoutePolicyAccept 

101 route_policy_redistribute: RIPRoutePolicyRedistribute 

102 

103 def __init__(self) -> None: 

104 """Initialize object.""" 

105 

106 self.route_policy_accept = RIPRoutePolicyAccept() 

107 self.route_policy_redistribute = RIPRoutePolicyRedistribute()