Skip to content

Commit 45f05e9

Browse files
smoke: add ospf6 test
Add ospf6 test, similar to the previous ospf test. Signed-off-by: Christophe Fontaine <[email protected]>
1 parent 17ce983 commit 45f05e9

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

smoke/_init.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,13 @@ if [ "$test_frr" = true ] && [ "$run_frr" = true ]; then
225225
bgpd=yes
226226
isisd=yes
227227
ospfd=yes
228+
ospf6d=yes
228229
vtysh_enable=yes
229230
zebra_options="-A 127.0.0.1 -s 90000000 --log file:$flog -M dplane_grout"
230231
bgpd_options="-A 127.0.0.1 --log file:$flog"
231232
isisd_options="--daemon -A 127.0.0.1 --log file:$flog"
232233
ospfd_options="--daemon -A 127.0.0.1 --log file:$flog"
234+
ospf6d_options="--daemon -A 127.0.0.1 --log file:$flog"
233235
EOF
234236
cat >$builddir/frr_install/etc/frr/frr.conf <<EOF
235237
hostname grout

smoke/_init_frr.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,13 @@ start_frr_on_namespace() {
248248
bgpd=yes
249249
isisd=yes
250250
ospfd=yes
251+
ospf6d=yes
251252
vtysh_enable=yes
252253
zebra_options="--daemon -A 127.0.0.1 -s 90000000 --log file:$flog"
253254
bgpd_options="--daemon -A 127.0.0.1 --log file:$flog"
254255
isisd_options="--daemon -A 127.0.0.1 --log file:$flog"
255256
ospfd_options="--daemon -A 127.0.0.1 --log file:$flog"
257+
ospf6d_options="--daemon -A 127.0.0.1 --log file:$flog"
256258
watchfrr_options="--netns=$namespace"
257259
EOF
258260
cat >$frr_namespace_folder/frr.conf <<EOF
@@ -303,4 +305,12 @@ EOF
303305
fi
304306
sleep 0.1
305307
done
308+
309+
SECONDS=0
310+
while ! pgrep -f "ospf6d -N $namespace"; do
311+
if [ "$SECONDS" -ge "5" ]; then
312+
fail "OSPF6 daemon not started for namespace $namespace"
313+
fi
314+
sleep 0.1
315+
done
306316
}

smoke/ospf6_frr_test.sh

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
# Copyright (c) 2025 Christophe Fontaine
4+
5+
# .--------------------.
6+
# | netns "ospf6-peer" |
7+
# .--------..------------. | .--------. |
8+
# | zebra || grout | | | ospf6d | |
9+
# '--------'| | | '--------' |
10+
# .--------.| .-----------. .------------. .-------. |
11+
# | ospf6d || | p0 | net_tap | x-p0 | | zebra | |
12+
# '--------'| | +---------------+ | '-------' |
13+
# .----------. | fe80::/64 | | fe80::/64 |.----------. |
14+
# | gr-loop0 | '-----------' '------------'| lo | |
15+
# '----------' | | | | |
16+
# | ping <-----------------------------------> |2001:db8: | |
17+
# | | | | 1000::1 | |
18+
# '-------------' | '----------' |
19+
# '--------------------'
20+
21+
. $(dirname $0)/_init_frr.sh
22+
23+
create_interface p0
24+
set_ip_address p0 2001:db8::1/64
25+
26+
start_frr_on_namespace ospf6-peer
27+
ip link set x-p0 netns ospf6-peer
28+
29+
ip -n grout l set p0 up
30+
ip -n ospf6-peer l set x-p0 up
31+
32+
# Configure Grout FRR instance
33+
vtysh <<-EOF
34+
configure terminal
35+
ipv6 forwarding
36+
!
37+
#debug ospf6 event
38+
#debug ospf6 message all
39+
!
40+
interface p0
41+
ipv6 ospf6 area 0.0.0.1
42+
ipv6 ospf6 hello-interval 1
43+
exit
44+
!
45+
router ospf6
46+
ospf6 router-id 1.1.1.1
47+
area 0.0.0.1 range 2001:db8::/48
48+
exit
49+
!
50+
EOF
51+
52+
vtysh -N ospf6-peer <<-EOF
53+
configure terminal
54+
ipv6 forwarding
55+
!
56+
#debug ospf6 event
57+
#debug ospf6 message all
58+
!
59+
interface lo
60+
ipv6 address 2001:db8:1000::1/64
61+
exit
62+
!
63+
interface x-p0
64+
ipv6 ospf6 area 0.0.0.1
65+
ipv6 ospf6 hello-interval 1
66+
exit
67+
!
68+
router ospf6
69+
ospf6 router-id 2.2.2.2
70+
area 0.0.0.1 range 2001:db8::/48
71+
redistribute connected
72+
exit
73+
end
74+
!
75+
EOF
76+
77+
# Convergence takes ~40s, be patient.
78+
attempts=60
79+
while ! $(vtysh -c 'show ipv6 ospf6 neighbor json' | jq '.neighbors[] | select(.neighborId=="2.2.2.2") | .state == "Full"' -e > /dev/null) ; do
80+
sleep 1
81+
if [ "$attempts" -le 0 ]; then
82+
fail "OSPF6 failed to connect to neighbor."
83+
fi
84+
attempts=$((attempts - 1))
85+
done
86+
87+
attempts=10
88+
while ! $(vtysh -c 'show ipv6 route ospf6 json' | jq '."2001:db8:1000::/64"[0].protocol == "ospf6"' -e > /dev/null) ; do
89+
sleep 1
90+
if [ "$attempts" -le 0 ]; then
91+
fail "OSPF6 failed to get routes."
92+
fi
93+
attempts=$((attempts - 1))
94+
done
95+
96+
grcli ping6 2001:db8:1000::1 count 3 delay 10

0 commit comments

Comments
 (0)