Skip to content

Commit 5a3f915

Browse files
frr: add smoke test for isisd
Using the l2 redirect capability, we're able to peer with a remote FRR instance router, using the following conf: ip router-id 10.0.0.1 ! interface p0 ip address 10.0.0.1/24 ip router isis test isis network point-to-point exit ! router isis test net 49.0000.0000.0001.00 exit fedora-linux-42# show isis neighbor Area test: System Id Interface L State Holdtime SNPA fedora-linux-42 p0 3 Up 28 2020.2020.2020 fedora-linux-42# show ip route isis Codes: K - kernel route, C - connected, L - local, S - static, O - OSPF, I - IS-IS, B - BGP, T - Table, v - VNC, V - VNC-Direct, t - Table-Direct, > - selected route, * - FIB route, q - queued, r - rejected, b - backup t - trapped, o - offload failure IPv4 unicast VRF default: I 10.0.0.0/24 [115/20] via 10.0.0.2, p0 inactive, weight 1, 00:05:51 I 192.0.0.0/24 [115/10] via 10.0.0.2, p0, weight 1, 00:05:51 Signed-off-by: Christophe Fontaine <[email protected]>
1 parent 5f449ce commit 5a3f915

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed

frr/frr_plugin_install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ install -D -m 755 "$1" "$2"
99
sed -i -e '/^zebra_options=/ {
1010
/-M[[:space:]]*dplane_grout/! s/"$/ -M dplane_grout"/
1111
}' "$3"
12+
sed -i -e '/isisd=no/isisd=yes/' "$3"
1213
touch "$4"

smoke/_init.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,11 @@ if [ "$test_frr" = true ] && [ "$run_frr" = true ]; then
223223
flog="$builddir/frr_install/var/log/frr/frr.log"
224224
cat >$builddir/frr_install/etc/frr/daemons <<EOF
225225
bgpd=yes
226+
isisd=yes
226227
vtysh_enable=yes
227228
zebra_options="-A 127.0.0.1 -s 90000000 --log file:$flog -M dplane_grout"
228229
bgpd_options="-A 127.0.0.1 --log file:$flog"
230+
isisd_options="--daemon -A 127.0.0.1 --log file:$flog"
229231
EOF
230232
cat >$builddir/frr_install/etc/frr/frr.conf <<EOF
231233
hostname grout

smoke/_init_frr.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,11 @@ start_frr_on_namespace() {
246246
touch ${frr_namespace_folder}/vtysh.conf
247247
cat >${frr_namespace_folder}/daemons <<EOF
248248
bgpd=yes
249+
isisd=yes
249250
vtysh_enable=yes
250251
zebra_options="--daemon -A 127.0.0.1 -s 90000000 --log file:$flog"
251252
bgpd_options="--daemon -A 127.0.0.1 --log file:$flog"
253+
isisd_options="--daemon -A 127.0.0.1 --log file:$flog"
252254
watchfrr_options="--netns=$namespace"
253255
EOF
254256
cat >$frr_namespace_folder/frr.conf <<EOF
@@ -283,4 +285,12 @@ EOF
283285
fi
284286
sleep 0.1
285287
done
288+
289+
SECONDS=0
290+
while ! pgrep -f "isisd -N $namespace"; do
291+
if [ "$SECONDS" -ge "5" ]; then
292+
fail "ISIS daemon not started for namespace $namespace"
293+
fi
294+
sleep 0.1
295+
done
286296
}

smoke/isis_frr_test.sh

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
# Copyright (c) 2025 Christophe Fontaine
4+
5+
#
6+
# .--------------------.
7+
# | netns "isis-peer" |
8+
# .--------..------------. | .-------. |
9+
# | zebra || grout | | | isisd | |
10+
# '--------'| | | '-------' |
11+
# .-------. | .------------. .------------. .-------. |
12+
# | isisd | | | p0 | net_tap | x-p0 | | zebra | |
13+
# '-------' | | +---------------+ | '-------' |
14+
# .----------. | 172.16.0.1 | | 172.16.0.2 |.----------. |
15+
# | gr-loop0 | '------------' '------------'| lo | |
16+
# '----------' | | | | |
17+
# | ping <------------------------------------> | 16.0.0.1 | |
18+
# | | | '----------' |
19+
# '-------------' '--------------------'
20+
21+
22+
. $(dirname $0)/_init_frr.sh
23+
24+
create_interface p0
25+
set_ip_address p0 172.16.0.1/24
26+
27+
# Configure Grout FRR instance
28+
vtysh <<-EOF
29+
configure terminal
30+
!
31+
ip router-id 172.16.0.1
32+
!
33+
interface p0
34+
ip router isis smoke
35+
isis network point-to-point
36+
exit
37+
!
38+
router isis smoke
39+
net 49.0000.0000.0001.00
40+
redistribute ipv4 static level-1
41+
redistribute ipv4 static level-2
42+
exit
43+
!
44+
EOF
45+
46+
start_frr_on_namespace isis-peer
47+
ip link set x-p0 netns isis-peer
48+
49+
# Configure FRR ISIS peer router
50+
vtysh -N isis-peer <<-EOF
51+
configure terminal
52+
ip router-id 172.16.0.2
53+
!
54+
interface lo
55+
ip address 16.0.0.1/32
56+
exit
57+
!
58+
interface x-p0
59+
ip address 172.16.0.2/24
60+
ip router isis smoke
61+
isis network point-to-point
62+
exit
63+
!
64+
router isis smoke
65+
net 49.0000.0000.0002.00
66+
redistribute ipv4 connected level-1
67+
exit
68+
!
69+
EOF
70+
71+
# Wait for ISIS peer neighbor
72+
attempts=20
73+
while ! $(vtysh -c 'show isis neighbor json' | jq '.areas[0].circuits[0].state == "Up"' -e) ; do
74+
sleep 1
75+
if [ "$attempts" -le 0 ]; then
76+
fail "ISIS failed to connect to neighbor."
77+
fi
78+
attempts=$((attempts - 1))
79+
done
80+
81+
# Wait for ISIS route exchange
82+
attempts=90
83+
while ! $(vtysh -c 'show ip route isis json' | jq '."16.0.0.1/32"' -e > /dev/null) ; do
84+
sleep 1
85+
if [ "$attempts" -le 0 ]; then
86+
fail "ISIS failed to get routes."
87+
fi
88+
attempts=$((attempts - 1))
89+
done
90+
91+
grcli ping 16.0.0.1 count 3 delay 10

0 commit comments

Comments
 (0)