#!/bin/sh

# creates dprc.1/dpni.7 (interface: eth0)
ls-addni -n --mac-addr=00:11:22:33:44:01

# creates dprc.1/dpni.8 (interface: eth1)
ls-addni -n --mac-addr=00:11:22:33:44:02

restool dprc sync

# Creates ETHSW object dpsw.0 with the following 2 ports: eth2,eth3
ls-addsw -i=2 -o=DPSW_OPT_CTRL_IF_DIS dpni.7 dpni.8

# setup linux configuration
ip link add name br0 type bridge stp_state 0
ip link set br0 up

ip link set dev eth2 down
ip link set dev eth2 address 00:00:00:00:00:01
ip link set dev eth2 up

ip link set dev eth3 down
ip link set dev eth3 address 00:00:00:00:00:02
ip link set dev eth3 up

# add port to bridge
ip link set eth2 master br0
ip link set eth3 master br0

ip addr add  192.168.45.1/24 dev eth0
ip addr add  fdc2:10:20::1/64 dev eth0
ip link set eth0 up

ip netns add ns
ip link set eth1 netns ns
ip netns exec ns ip addr add  192.168.45.2/24 dev eth1
ip netns exec ns ip addr add  fdc2:10:20::2/64 dev eth1
ip netns exec ns ip link set eth1 up
