-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_demo.py
147 lines (131 loc) Β· 4.01 KB
/
test_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-2022 David Lamparter for NetDEF, Inc.
"""
Simple demo test for topotato.
TBD: check that the other protocols are up & running, to make it fully
equivalent to topotests "all_startup"
"""
from topotato.v1 import *
@topology_fixture()
def allproto_topo(topo):
"""
[ r1 ]---[ noprot ]
[ ]
[ ]---[ rip ]
[ ]
[ ]---[ ripng ]
[ ]
[ ]---[ ospfv2 ]
[ ]
[ ]---[ ospfv3 ]
[ ]
[ ]---[ isisv4 ]
[ ]
[ ]---[ isisv6 ]
"""
topo.router("r1").iface_to("ripng").ip6.append("fc00:0:0:1::1/64")
class Configs(FRRConfigs):
routers = ["r1"]
zebra = """
#% extends "boilerplate.conf"
#% block main
#% for iface in router.ifaces
interface {{ iface.ifname }}
description {{ iface.other.endpoint.name }}
no link-detect
!
#% endfor
!
ip forwarding
ipv6 forwarding
!
#% endblock
"""
ripd = """
#% extends "boilerplate.conf"
#% block main
debug rip events
debug rip zebra
!
router rip
version 2
network {{ router.iface_to('rip').ip4[0].network }}
#% endblock
"""
ripngd = """
#% extends "boilerplate.conf"
#% block main
debug ripng events
debug ripng zebra
!
router ripng
network {{ router.iface_to('ripng').ip6[0].network }}
#% endblock
"""
class AllStartupTest(TestBase, AutoFixture, topo=allproto_topo, configs=Configs):
"""
docstring here
"""
@topotatofunc
def test_running(self, topo, r1):
"""
just check that all daemons are running
"""
for daemon in Configs.templates.keys():
if not hasattr(Configs, daemon):
continue
yield from AssertVtysh.make(r1, daemon, command="show version")
@topotatofunc
def test_ripd(self, topo, r1):
compare = r"""
Routing Protocol is "rip"
Sending updates every 30 seconds with +/-50%, next due in $$\d+$$ seconds
Timeout after 180 seconds, garbage collect after 120 seconds
Outgoing update filter list for all interface is not set
Incoming update filter list for all interface is not set
Default redistribution metric is 1
Redistributing:
Default version control: send version 2, receive version 2
Interface Send Recv Key-chain
$$=router.iface_to('rip').ifname $$ 2 2
Routing for Networks:
$$=router.iface_to('rip').ip4[0].network$$
Routing Information Sources:
Gateway BadPackets BadRoutes Distance Last Update
Distance: (default is 120)
"""
yield from AssertVtysh.make(
r1, "ripd", "show ip rip status", maxwait=5.0, compare=compare
)
@topotatofunc
def test_ripngd(self, topo, r1):
compare = r"""
Routing Protocol is "RIPng"
Sending updates every 30 seconds with +/-50%, next due in $$\d+$$ seconds
Timeout after 180 seconds, garbage collect after 120 seconds
Outgoing update filter list for all interface is not set
Incoming update filter list for all interface is not set
Default redistribution metric is 1
Redistributing:
Default version control: send version 1, receive version 1
Interface Send Recv
$$=router.iface_to('ripng').ifname $$ 1 1
Routing for Networks:
$$=router.iface_to('ripng').ip6[0].network$$
Routing Information Sources:
Gateway BadPackets BadRoutes Distance Last Update
"""
yield from AssertVtysh.make(
r1, "ripngd", "show ip ripng status", maxwait=5.0, compare=compare
)
if __name__ == "__main__":
pass
# cfgs = Configs()
# cfgs.generate()
#
# from pprint import pprint
# pprint(cfgs)
#
# import code
# code.interact(local = locals())