xref: /openbmc/qemu/tests/rocker/bridge-vlan-stp (revision 6016b7b4)
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 sw1p1 master br0"
14simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p2 master br0"
15
16# turn off vlan default_pvid on br0
17# turn on vlan filtering on br0
18
19simp ssh tut sw1 --cmd "echo 0 | sudo dd of=/sys/class/net/br0/bridge/default_pvid 2> /dev/null"
20simp ssh tut sw1 --cmd "echo 1 | sudo dd of=/sys/class/net/br0/bridge/vlan_filtering 2> /dev/null"
21
22# add both ports to VLAN 57
23
24simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p1"
25simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p2"
26
27# turn off learning and flooding in SW
28
29simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 learning off"
30simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 learning off"
31
32simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 flood off"
33simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 flood off"
34
35# config IP on host VLANs
36
37simp ssh tut h1 --cmd "sudo vconfig add sw1p1 57 >/dev/null 2>&1"
38simp ssh tut h1 --cmd "sudo ifconfig sw1p1 up"
39simp ssh tut h1 --cmd "sudo ifconfig sw1p1.57 11.0.0.1/24"
40
41simp ssh tut h2 --cmd "sudo vconfig add sw1p1 57 >/dev/null 2>&1"
42simp ssh tut h2 --cmd "sudo ifconfig sw1p1 up"
43simp ssh tut h2 --cmd "sudo ifconfig sw1p1.57 11.0.0.2/24"
44
45# bring up bridge and ports
46
47simp ssh tut sw1 --cmd "sudo ifconfig br0 up"
48simp ssh tut sw1 --cmd "sudo ifconfig sw1p1 up"
49simp ssh tut sw1 --cmd "sudo ifconfig sw1p2 up"
50
51# test...
52
53simp ssh tut h1 --cmd "ping -w 1 -c1 11.0.0.2 >/dev/null"
54if [ $? -eq 0 ]; then exit 1; fi
55sleep 10
56simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
57sleep 10
58simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
59sleep 10
60simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
61sleep 10
62simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
63sleep 10
64simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
65