-
Notifications
You must be signed in to change notification settings - Fork 3
/
brent_showport.sh
executable file
·61 lines (53 loc) · 1.9 KB
/
brent_showport.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
#!/bin/bash
mgr="192.168.100.86"
./lf_portmod.pl --manager $mgr --load port-regression > /dev/null
sleep 10s
for x in vap0 sta0 eth1#0 eth1 eth1.1 rddVR0 br0
do
#Test MAC
port_output=`./lf_portmod.pl --quiet 1 --manager $mgr --card 2 --port_name $x --show_port MAC`
answer=${port_output:5}
# echo "MAC exists: $x $answer
if [ -z "$answer" ]; then
echo "Failed to find MAC address for $x."
exit 1
fi
#Test port UP
port_output=`./lf_portmod.pl --quiet 1 --manager $mgr --card 2 --port_name $x --show_port Current`
answer=${port_output:9:2}
# echo "DB UP: $x $answer"
if [ $answer != "UP" ]; then
echo "Failed, port $x is down after loading DB."
exit 1
fi
#Test port UP after reset
./lf_portmod.pl --quiet 1 --manager $mgr --card 2 --port_name $x --cmd reset > /dev/null
sleep 2s
port_output=`./lf_portmod.pl --quiet 1 --manager $mgr --card 2 --port_name $x --show_port Current`
answer=${port_output:9:2}
# echo "UP after reset: $x $answer"
if [ $answer != "UP" ]; then
echo "Failed, port $x is down after resetting."
exit 1
fi
#Test DOWN after ifdown
./lf_portmod.pl --quiet 1 --manager $mgr --card 2 --port_name $x --set_ifstate down
port_output=`./lf_portmod.pl --quiet 1 --manager $mgr --card 2 --port_name $x --show_port Current`
answer=${port_output:9:4}
# echo "DOWN after ifdown: $x $answer"
if [ $answer != "DOWN" ]; then
echo "Failed, port $x is still up after ifdown."
exit 1
fi
#Test UP after ifup
./lf_portmod.pl --quiet 1 --manager $mgr --card 2 --port_name $x --set_ifstate up
sleep 5s
port_output=`./lf_portmod.pl --quiet 1 --manager $mgr --card 2 --port_name $x --show_port Current`
answer=${port_output:9:2}
# echo "UP after ifup: $x $answer"
if [ $answer != "UP" ]; then
echo "Failed, port $x is still down after ifup."
exit 1
fi
done
echo "Test passed."