xref: /openbmc/qemu/tests/rocker/bridge (revision 0a2df857a7038c75379cc575de5d4be4c0ac629e)
163d2ada2SScott Feldmansimp destroy ".*"
263d2ada2SScott Feldmansimp create -o sw1:rocker:sw1 tut tut.dot
363d2ada2SScott Feldmansimp start tut
463d2ada2SScott Feldmansleep 10
563d2ada2SScott Feldmanwhile ! simp ssh tut sw1 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done
663d2ada2SScott Feldmanwhile ! simp ssh tut h1 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done
763d2ada2SScott Feldmanwhile ! simp ssh tut h2 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done
863d2ada2SScott Feldman
963d2ada2SScott Feldman# configure a 2-port bridge
1063d2ada2SScott Feldman
1163d2ada2SScott Feldmansimp ssh tut sw1 --cmd "sudo /sbin/ip link add name br0 type bridge"
12*73da0232SScott Feldmansimp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p1 master br0"
13*73da0232SScott Feldmansimp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p2 master br0"
1463d2ada2SScott Feldman
1563d2ada2SScott Feldman# turn off vlan default_pvid on br0
1663d2ada2SScott Feldman
1763d2ada2SScott Feldmansimp ssh tut sw1 --cmd "echo 0 | sudo dd of=/sys/class/net/br0/bridge/default_pvid 2> /dev/null"
1863d2ada2SScott Feldman
1963d2ada2SScott Feldman# turn off learning and flooding in SW
2063d2ada2SScott Feldman
21*73da0232SScott Feldmansimp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 learning off"
22*73da0232SScott Feldmansimp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 learning off"
2363d2ada2SScott Feldman
24*73da0232SScott Feldmansimp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 flood off"
25*73da0232SScott Feldmansimp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 flood off"
2663d2ada2SScott Feldman
2763d2ada2SScott Feldman# bring up bridge and ports
2863d2ada2SScott Feldman
2963d2ada2SScott Feldmansimp ssh tut sw1 --cmd "sudo ifconfig br0 up"
30*73da0232SScott Feldmansimp ssh tut sw1 --cmd "sudo ifconfig sw1p1 up"
31*73da0232SScott Feldmansimp ssh tut sw1 --cmd "sudo ifconfig sw1p2 up"
3263d2ada2SScott Feldmansimp ssh tut sw1 --cmd "sudo ifconfig br0 11.0.0.3/24"
3363d2ada2SScott Feldman
3463d2ada2SScott Feldman# config IP on hosts
3563d2ada2SScott Feldman
36*73da0232SScott Feldmansimp ssh tut h1 --cmd "sudo ifconfig sw1p1 11.0.0.1/24"
37*73da0232SScott Feldmansimp ssh tut h2 --cmd "sudo ifconfig sw1p1 11.0.0.2/24"
3863d2ada2SScott Feldman
3963d2ada2SScott Feldman# test...
4063d2ada2SScott Feldman
4163d2ada2SScott Feldmansimp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
4263d2ada2SScott Feldmanif [ $? -ne 0 ]; then exit 1; fi
4363d2ada2SScott Feldmansimp ssh tut h1 --cmd "ping -c10 11.0.0.3 >/dev/null"
44