Skip to content

Commit f39c287

Browse files
committed
tests: add OSPFv3 module tests for multi-area IPv6 routing
OSPFv3 previously had no module-test coverage (only fingerprint and example tests). Add two end-to-end tests, modelled on the existing ospf_* OSPFv2 module tests, that verify OSPFv3 converges and installs correct IPv6 routes by exchanging UDP traffic between routers in different areas: - ospfv3_2_areas: Router1--Router2--Router3 in backbone area 0.0.0.0, Router3 is the ABR into area 0.0.0.1 (Router4, Router5). UDP between Router1 and Router4 succeeds only once the inter-area-prefix LSAs let each side install a route to the other area's prefixes. - ospfv3_broadcast_multiarea: five routers share one broadcast Ethernet segment in the backbone (DR election among five, each running the Database Exchange against the DR and BDR concurrently), and each is the ABR into its own stub area holding a leaf router. UDP between two leaf routers in different areas exercises multi-neighbor Loading-state convergence plus inter-area routing -- the multi-router, multi-area broadcast shape addressed by the OSPFv3 Database Exchange fixes. Both send 40 packets each way and assert all 40 are delivered and echoed back in both directions. They pass in release and debug builds.
1 parent 2601c76 commit f39c287

2 files changed

Lines changed: 441 additions & 0 deletions

File tree

tests/module/ospfv3_2_areas.test

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
%description:
2+
Testing OSPFv3 (IPv6) routing across a shared broadcast segment and two areas.
3+
4+
Router1, Router2 and Router3 share one broadcast Ethernet segment in backbone area
5+
0.0.0.0 (so a designated router is elected among three routers, and each router
6+
runs the full Database Exchange against two neighbors at once). Router3 is the area
7+
border router into area 0.0.0.1, where Router4 lives. UDP traffic is exchanged
8+
between Router1 (backbone) and Router4 (area 0.0.0.1); it only gets through once the
9+
adjacencies on the shared segment converge through the Loading state AND the ABR's
10+
inter-area-prefix LSAs let Router1 install a route to the area 0.0.0.1 prefixes (and
11+
vice versa). This exercises DR election, multi-neighbor Database Exchange
12+
convergence, intra-area SPF and inter-area route computation.
13+
14+
%#--------------------------------------------------------------------------------------------------------------
15+
%file: test.ned
16+
17+
import inet.common.misc.ThruputMeteringChannel;
18+
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
19+
import inet.node.ethernet.EthernetSwitch;
20+
import inet.node.ospfv3.Ospfv3Router;
21+
22+
network Test1
23+
{
24+
types:
25+
channel C extends ThruputMeteringChannel
26+
{
27+
delay = 0.1us;
28+
datarate = 100Mbps;
29+
}
30+
submodules:
31+
configurator: Ipv4NetworkConfigurator {
32+
parameters:
33+
config = xml("<config>"+
34+
"<interface among='Router1 Router2 Router3' address='10.10.10.x' netmask='255.255.255.0' />"+
35+
"<interface among='Router3 Router4' address='10.10.20.x' netmask='255.255.255.0' />"+
36+
"</config>");
37+
addStaticRoutes = false;
38+
addDefaultRoutes = false;
39+
addSubnetRoutes = false;
40+
@display("p=50,50");
41+
}
42+
N1: EthernetSwitch {
43+
parameters:
44+
@display("p=200,180");
45+
gates:
46+
ethg[3];
47+
}
48+
Router1: Ospfv3Router {
49+
parameters:
50+
@display("p=90,90");
51+
gates:
52+
ethg[1];
53+
}
54+
Router2: Ospfv3Router {
55+
parameters:
56+
@display("p=200,90");
57+
gates:
58+
ethg[1];
59+
}
60+
Router3: Ospfv3Router {
61+
parameters:
62+
@display("p=320,180");
63+
gates:
64+
ethg[2];
65+
}
66+
Router4: Ospfv3Router {
67+
parameters:
68+
@display("p=440,180");
69+
gates:
70+
ethg[1];
71+
}
72+
connections:
73+
Router1.ethg[0] <--> C <--> N1.ethg[0];
74+
Router2.ethg[0] <--> C <--> N1.ethg[1];
75+
Router3.ethg[0] <--> C <--> N1.ethg[2];
76+
Router3.ethg[1] <--> C <--> Router4.ethg[0];
77+
}
78+
79+
%#--------------------------------------------------------------------------------------------------------------
80+
%inifile: omnetpp.ini
81+
82+
[General]
83+
description = "OSPFv3 broadcast segment and two areas"
84+
network = Test1
85+
ned-path = .;../../../../src;../../lib
86+
sim-time-limit = 120s
87+
cmdenv-express-mode = true
88+
output-scalar-file = "${resultdir}/${configname}-#${runnumber}.sca"
89+
record-vector-results = false
90+
**.cmdenv-log-level = "info"
91+
92+
**.Router1.ospf.ospfv3Splitter.ospfv3RoutingConfig = xmldoc("config.xml", "Devices/Router[@id='Router1']/Routing6/OSPFv3")
93+
**.Router2.ospf.ospfv3Splitter.ospfv3RoutingConfig = xmldoc("config.xml", "Devices/Router[@id='Router2']/Routing6/OSPFv3")
94+
**.Router3.ospf.ospfv3Splitter.ospfv3RoutingConfig = xmldoc("config.xml", "Devices/Router[@id='Router3']/Routing6/OSPFv3")
95+
**.Router4.ospf.ospfv3Splitter.ospfv3RoutingConfig = xmldoc("config.xml", "Devices/Router[@id='Router4']/Routing6/OSPFv3")
96+
97+
**.Router1.ospf.ospfv3Splitter.ospfv3IntConfig = xmldoc("config.xml", "Devices/Router[@id='Router1']/Interfaces")
98+
**.Router2.ospf.ospfv3Splitter.ospfv3IntConfig = xmldoc("config.xml", "Devices/Router[@id='Router2']/Interfaces")
99+
**.Router3.ospf.ospfv3Splitter.ospfv3IntConfig = xmldoc("config.xml", "Devices/Router[@id='Router3']/Interfaces")
100+
**.Router4.ospf.ospfv3Splitter.ospfv3IntConfig = xmldoc("config.xml", "Devices/Router[@id='Router4']/Interfaces")
101+
102+
# UDP traffic between Router1 (backbone) and Router4 (area 0.0.0.1)
103+
**.Router1.hasUdp = true
104+
**.Router4.hasUdp = true
105+
**.Router1.numApps = 2
106+
**.Router4.numApps = 2
107+
**.app[0].typename = "UdpBasicApp"
108+
**.app[0].destPort = 1234
109+
**.app[0].messageLength = 32 bytes
110+
**.app[0].sendInterval = 1s
111+
**.app[0].startTime = 60s
112+
**.app[0].stopTime = this.startTime + 40s
113+
**.Router1.app[0].destAddresses = "2001:db8:c::2"
114+
**.Router4.app[0].destAddresses = "2001:db8:a::1"
115+
**.app[1].typename = "UdpEchoApp"
116+
**.app[1].localPort = 1234
117+
118+
%#--------------------------------------------------------------------------------------------------------------
119+
%file: config.xml
120+
<Devices>
121+
<Router id="Router1">
122+
<Routing6><OSPFv3><Process id="100"><RouterID>10.10.10.1</RouterID></Process></OSPFv3></Routing6>
123+
<Interfaces>
124+
<Interface name="eth0">
125+
<Process id="100"><Instance AF="IPv6"><InterfaceType>Broadcast</InterfaceType><Area>0.0.0.0</Area></Instance></Process>
126+
<IPv6Address>fe80::a8bb:ccff:fe00:100/64</IPv6Address>
127+
<IPv6Address>2001:db8:a::1/64</IPv6Address>
128+
</Interface>
129+
</Interfaces>
130+
</Router>
131+
<Router id="Router2">
132+
<Routing6><OSPFv3><Process id="100"><RouterID>10.10.10.2</RouterID></Process></OSPFv3></Routing6>
133+
<Interfaces>
134+
<Interface name="eth0">
135+
<Process id="100"><Instance AF="IPv6"><InterfaceType>Broadcast</InterfaceType><Area>0.0.0.0</Area></Instance></Process>
136+
<IPv6Address>fe80::a8bb:ccff:fe00:200/64</IPv6Address>
137+
<IPv6Address>2001:db8:a::2/64</IPv6Address>
138+
</Interface>
139+
</Interfaces>
140+
</Router>
141+
<Router id="Router3">
142+
<Routing6><OSPFv3><Process id="100"><RouterID>10.10.10.3</RouterID></Process></OSPFv3></Routing6>
143+
<Interfaces>
144+
<Interface name="eth0">
145+
<Process id="100"><Instance AF="IPv6"><InterfaceType>Broadcast</InterfaceType><Area>0.0.0.0</Area></Instance></Process>
146+
<IPv6Address>fe80::a8bb:ccff:fe00:300/64</IPv6Address>
147+
<IPv6Address>2001:db8:a::3/64</IPv6Address>
148+
</Interface>
149+
<Interface name="eth1">
150+
<Process id="100"><Instance AF="IPv6"><InterfaceType>Broadcast</InterfaceType><Area>0.0.0.1</Area></Instance></Process>
151+
<IPv6Address>fe80::a8bb:ccff:fe00:310/64</IPv6Address>
152+
<IPv6Address>2001:db8:c::1/64</IPv6Address>
153+
</Interface>
154+
</Interfaces>
155+
</Router>
156+
<Router id="Router4">
157+
<Routing6><OSPFv3><Process id="100"><RouterID>10.10.10.4</RouterID></Process></OSPFv3></Routing6>
158+
<Interfaces>
159+
<Interface name="eth0">
160+
<Process id="100"><Instance AF="IPv6"><InterfaceType>Broadcast</InterfaceType><Area>0.0.0.1</Area></Instance></Process>
161+
<IPv6Address>fe80::a8bb:ccff:fe00:400/64</IPv6Address>
162+
<IPv6Address>2001:db8:c::2/64</IPv6Address>
163+
</Interface>
164+
</Interfaces>
165+
</Router>
166+
</Devices>
167+
168+
%#--------------------------------------------------------------------------------------------------------------
169+
%contains: results/General-#0.sca
170+
scalar Test1.Router1.app[0] packetSent:count 40
171+
%contains: results/General-#0.sca
172+
scalar Test1.Router1.app[0] packetReceived:count 40
173+
%contains: results/General-#0.sca
174+
scalar Test1.Router4.app[0] packetSent:count 40
175+
%contains: results/General-#0.sca
176+
scalar Test1.Router4.app[0] packetReceived:count 40
177+
%#--------------------------------------------------------------------------------------------------------------
178+
%postrun-command: grep "undisposed object:" test.out > test_undisposed.out || true
179+
%not-contains: test_undisposed.out
180+
undisposed object: (

0 commit comments

Comments
 (0)