xref: /openbmc/qemu/tests/rocker/bridge (revision c36dd41b)
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 sw1p1 master br0"
13simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p2 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 sw1p1 learning off"
22simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 learning off"
23
24simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 flood off"
25simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 flood off"
26
27# bring up bridge and ports
28
29simp ssh tut sw1 --cmd "sudo ifconfig br0 up"
30simp ssh tut sw1 --cmd "sudo ifconfig sw1p1 up"
31simp ssh tut sw1 --cmd "sudo ifconfig sw1p2 up"
32simp ssh tut sw1 --cmd "sudo ifconfig br0 11.0.0.3/24"
33
34# config IP on hosts
35
36simp ssh tut h1 --cmd "sudo ifconfig sw1p1 11.0.0.1/24"
37simp ssh tut h2 --cmd "sudo ifconfig sw1p1 11.0.0.2/24"
38
39# test...
40
41simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
42if [ $? -ne 0 ]; then exit 1; fi
43simp ssh tut h1 --cmd "ping -c10 11.0.0.3 >/dev/null"
44