xref: /openbmc/qemu/tests/rocker/bridge (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 /sbin/ip link set dev swp1 master br0"
13simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp2 master br0"
14
15# turn off vlan default_pvid on br0
16
17simp ssh tut sw1 --cmd "echo 0 | sudo dd of=/sys/class/net/br0/bridge/default_pvid 2> /dev/null"
18
19# turn off learning and flooding in SW
20
21simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning off"
22simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning off"
23
24simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 flood off"
25simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 flood off"
26
27# turn on learning in HW
28
29simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning on self"
30simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning on self"
31
32# bring up bridge and ports
33
34simp ssh tut sw1 --cmd "sudo ifconfig br0 up"
35simp ssh tut sw1 --cmd "sudo ifconfig swp1 up"
36simp ssh tut sw1 --cmd "sudo ifconfig swp2 up"
37simp ssh tut sw1 --cmd "sudo ifconfig br0 11.0.0.3/24"
38
39# config IP on hosts
40
41simp ssh tut h1 --cmd "sudo ifconfig swp1 11.0.0.1/24"
42simp ssh tut h2 --cmd "sudo ifconfig swp1 11.0.0.2/24"
43
44# test...
45
46simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
47if [ $? -ne 0 ]; then exit 1; fi
48simp ssh tut h1 --cmd "ping -c10 11.0.0.3 >/dev/null"
49