-
Notifications
You must be signed in to change notification settings - Fork 6
/
clab-validate.sh
executable file
·124 lines (108 loc) · 4 KB
/
clab-validate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
SECONDS=0
echo "checking for installed cRPD licenses ..."
for r in clab-vxlan-r1 clab-vxlan-r2; do
license=$(docker exec $r cli show system license | grep SKU || true)
echo $r $license
if [ -z "$license" ]; then
echo "loading crpd licenses to r1 and r2 ..."
docker exec clab-vxlan-r1 cli request system license add /config/license.conf
docker exec clab-vxlan-r2 cli request system license add /config/license.conf
fi
done
echo ""
while true; do
docker exec clab-vxlan-r1 cli show isis adj | grep Up | wc -l | grep ^2$ >/dev/null && break
echo "$SECONDS: waiting for all isis neighbors to be Up ..."
sleep 5
done
echo "clab-vxlan-r1> cli show isis adj ..."
docker exec clab-vxlan-r1 cli show isis adj
echo ""
while true; do
docker exec clab-vxlan-r1 cli show bgp summary | grep Establ | wc -l | grep ^1$ >/dev/null && break
echo "$SECONDS: waiting for established BGP session ..."
sleep 5
done
echo "clab-vxlan-r1> cli show bgp summary..."
docker exec clab-vxlan-r1 cli show bgp summary
echo ""
for r in clab-vxlan-r1 clab-vxlan-r2; do
while true; do
docker exec $r cli show evpn l3-context | grep VXLAN | wc -l | grep ^2$ >/dev/null && break
echo "$SECONDS: waiting for evpn vxlan l3-context ..."
sleep 5
done
echo "$r> cli show evpn l3-context ..."
docker exec $r cli show evpn l3-context
echo ""
done
echo "clab-vxlan-r1> cli show evpn ip-prefix-database"
docker exec clab-vxlan-r1 cli show evpn ip-prefix-database
echo ""
for r in clab-vxlan-r1 clab-vxlan-r2; do
for vrf in vrf1 vrf2; do
while true; do
docker exec $r ip route show vrf __crpd-$vrf | grep encap | wc -l | grep ^1$ >/dev/null && break
echo "$SECONDS: waiting for ip route show vrf __crpd-$vrf (looking for encap route entry) ..."
echo "execute 'restart routing immediately' on $r if encap route is missing"
sleep 5
done
echo "$r:/# ip route show vrf __crpd-$vrf ..."
docker exec $r ip route show vrf __crpd-$vrf
echo ""
done
done
echo ""
for r in clab-vxlan-r1 clab-vxlan-r2; do
for vrf in vrf1 vrf2; do
while true; do
docker exec $r ip -6 route show vrf __crpd-$vrf | grep encap | wc -l | grep ^1$ >/dev/null && break
echo "$SECONDS: waiting for ip -6 route show vrf __crpd-$vrf (looking for encap route entry) ..."
echo "execute 'restart routing immediately' on $r if encap route is missing"
sleep 5
done
echo "$r:/# ip -6 route show vrf __crpd-$vrf ..."
docker exec $r ip -6 route show vrf __crpd-$vrf
echo ""
done
done
docker exec clab-vxlan-r1 tcpdump -i net1 -e -c 4 -s 1500 -w r1net1.pcap udp port 4789 &
docker exec clab-vxlan-r1 tcpdump -i net2 -e -c 4 -s 1500 -w r1net2.pcap udp port 4789 &
echo "ipv4 connectivity test between clab-vxlan-c1 and clab-vxlan-c2 ..."
while true; do
docker exec clab-vxlan-c1 ping -fc 10000 1.1.2.2 && break
echo "$SECONDS: waiting to reach 1.1.2.2 ..."
sleep 1
done
echo ""
echo "ipv4 connectivity test between clab-vxlan-c2 and c3 ..."
while true; do
docker exec clab-vxlan-c3 ping -fc 10000 1.1.2.2 && break
echo "$SECONDS: waiting to reach 1.1.2.2 ..."
sleep 1
done
sleep 1
echo "tcpdump of vxlan traffic between clab-vxlan-r1 and clab-vxlan-r2 ..."
docker exec clab-vxlan-r1 tcpdump -n -r r1net1.pcap -e || true
docker exec clab-vxlan-r1 tcpdump -n -r r1net2.pcap -e || true
# TODO ipv6 connectivity not yet working ...
#echo "ipv6 connectivity test between clab-vxlan-c1 and clab-vxlan-c2 ..."
#while true; do
# docker exec clab-vxlan-c1 ping -fc 3 abcd::1.1.2.2 && break
# echo "$SECONDS: waiting to reach abcd::1.1.2.2 ..."
# sleep 1
#done
#echo "ipv6 connectivity test between c3 and c4 ..."
#while true; do
# docker exec c3 ping -fc 3 abcd::1.1.2.2 && break
# echo "$SECONDS: waiting to reach abcd::1.1.2.2 ..."
# sleep 1
#done
echo ""
echo "running iperf3 test between clab-vxlan-c1 and clab-vxlan-c2 for 10 seconds ..."
docker exec clab-vxlan-c2 iperf3 -s &
sleep 2
docker exec clab-vxlan-c1 iperf3 -c 1.1.2.2
echo ""
echo "success in $SECONDS seconds"