xref: /openbmc/qemu/tests/rocker/bridge-stp (revision 0b2ff2ce)
1simp destroy ".*"
2simp create -o sw1:rocker:sw1 tut tut.dot
3simp start tut
4sleep 10
5while ! simp ssh tut sw1 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done
6while ! simp ssh tut h1 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done
7while ! simp ssh tut h2 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done
8
9# configure a 2-port bridge
10
11simp ssh tut sw1 --cmd "sudo /sbin/ip link add name br0 type bridge"
12simp ssh tut sw1 --cmd "sudo brctl stp br0 on"
13simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp1 master br0"
14simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp2 master br0"
15
16# turn off vlan default_pvid on br0
17
18simp ssh tut sw1 --cmd "echo 0 | sudo dd of=/sys/class/net/br0/bridge/default_pvid 2> /dev/null"
19
20# turn off learning and flooding in SW
21
22simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning off"
23simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning off"
24
25simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 flood off"
26simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 flood off"
27
28# turn on learning in HW
29
30simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning on self"
31simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning on self"
32
33# config IP on hosts
34
35simp ssh tut h1 --cmd "sudo ifconfig swp1 11.0.0.1/24"
36simp ssh tut h2 --cmd "sudo ifconfig swp1 11.0.0.2/24"
37
38# bring up bridge and ports
39
40simp ssh tut sw1 --cmd "sudo ifconfig br0 up"
41simp ssh tut sw1 --cmd "sudo ifconfig swp1 up"
42simp ssh tut sw1 --cmd "sudo ifconfig swp2 up"
43
44# test...
45
46simp ssh tut h1 --cmd "ping -w 1 -c1 11.0.0.2 >/dev/null"
47if [ $? -eq 0 ]; then exit 1; fi
48sleep 10
49simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
50sleep 10
51simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
52sleep 10
53simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
54sleep 10
55simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
56sleep 10
57simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
58