|
| 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