Skip to content

Commit 59d16e7

Browse files
committed
topotato: convert tests to role-based setup
The basic MLD & OSPF6 PtMP tests benefit from this. Signed-off-by: David Lamparter <[email protected]>
1 parent b065ebc commit 59d16e7

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

test_mld_basic.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def topology(topo):
2929
"""
3030

3131

32-
class Configs(FRRConfigs):
32+
class FRRConfigured(RouterFRR):
3333
routers = ["dut"]
3434

3535
zebra = """
@@ -57,14 +57,24 @@ class Configs(FRRConfigs):
5757
#% endblock
5858
"""
5959

60+
def requirements(self):
61+
self.require_defun("interface_ipv6_mld_cmd")
62+
63+
64+
class Setup(TopotatoNetwork, topo=topology):
65+
dut: FRRConfigured
66+
h1: Host
67+
h2: Host
68+
src: Host
69+
6070

6171
def iter_mld_records(report):
6272
for record in report.records:
6373
while isinstance(record, ICMPv6MLDMultAddrRec):
6474
yield record
6575
record = record.payload
6676

67-
class MLDBasic(TestBase, AutoFixture, topo=topology, configs=Configs):
77+
class MLDBasic(TestBase, AutoFixture, setup=Setup):
6878
@topotatofunc(include_startup=True)
6979
def prepare(self, topo, dut, h1, h2, src):
7080
self.receiver = MulticastReceiver(h1, h1.iface_to('dut'))

test_ospf6_p2xp.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def topology(topo):
1919
"""
2020

2121

22-
class Configs(FRRConfigs):
22+
class Configs(RouterFRR):
2323
zebra = """
2424
#% extends "boilerplate.conf"
2525
#% block main
@@ -58,8 +58,18 @@ class Configs(FRRConfigs):
5858
#% endblock
5959
"""
6060

61+
def requirements(self):
62+
self.require_defun("ipv6_ospf6_network_cmd", "point-to-multipoint")
6163

62-
class PtMPBasic(TestBase, AutoFixture, topo=topology, configs=Configs):
64+
65+
class Setup(TopotatoNetwork, topo=topology):
66+
r1: Configs
67+
r2: Configs
68+
r3: Configs
69+
lsdb: Configs
70+
71+
72+
class PtMPBasic(TestBase, AutoFixture, setup=Setup):
6373
# intra_64 = connected-prefix include/exclude
6474
def lsdb_reference(self, routers, intra_64=set()):
6575
lsas = [

0 commit comments

Comments
 (0)