X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fscripts%2Fsliver-ovs.in;h=9b7495013600a53152a1c1ca9824f4d43f4c28c1;hb=621ffea966bf3aedaa8ceadbb43f3cd642854ad6;hp=01089ee8c74b0a0a3a5955c5dd790fe6cfb3a202;hpb=d0a72100346ee2695cbb23134d7bc7f5ba4865a7;p=sliver-openvswitch.git diff --git a/planetlab/scripts/sliver-ovs.in b/planetlab/scripts/sliver-ovs.in index 01089ee8c..9b7495013 100755 --- a/planetlab/scripts/sliver-ovs.in +++ b/planetlab/scripts/sliver-ovs.in @@ -157,38 +157,19 @@ function stop () { #################### create functions function create_bridge () { - get_params "IP/PREFIX" "$@" + get_params "bridge IP/PREFIX" "$@" IP=${IP_PREFIX%/*} PREFIX=${IP_PREFIX#*/} - set -e # ensure ovs-vswitchd is running is_switch_running || { echo "ovs-vswitchd not running" >&2 ; exit 1 ; } - # check whether the address is already assigned - TAPNAME=$(tapname $IP) - if [ ! -z "$TAPNAME" ]; then - if ovs-vsctl --db=unix:$DB_SOCKET br-exists "$TAPNAME"; then - echo $TAPNAME - exit 0 - fi - kill_pltap_ovs - error "$IP already assigned to $TAPNAME" - fi - - # we're clear - TAPNAME=$(pltap-ovs) - trap kill_pltap_ovs EXIT - # xxx wouldn't that be safer if left-aligned ? - vsysc vif_up << EOF - $TAPNAME - $IP - $PREFIX -EOF - wait_device $TAPNAME 60 && \ - ovs-vsctl --db=unix:$DB_SOCKET add-br $TAPNAME -- set bridge $TAPNAME datapath_type=planetlab - echo $TAPNAME + set -e + ovs-vsctl --db=unix:$DB_SOCKET -- --may-exist add-br "$bridge" \ + -- set bridge "$bridge" datapath_type=planetlab \ + -- set interface "$bridge" options:local_ip="$IP" option:local_netmask="$PREFIX" + ovs-appctl netdev-pltap/get-tapname "$bridge" } function create_port () { @@ -216,6 +197,17 @@ function set_remote_endpoint () { options:remote_port=$remote_UDP_port } +function set_controller () { + + get_params "bridge_name controller" "$@" + + # ensure ovs-vswitchd is running + is_switch_running || { echo "ovs-vswitchd not running" >&2 ; exit 1 ; } + + set -e + ovs-vsctl --db=unix:$DB_SOCKET set-controller "$bridge_name" "$controller" +} + #################### del functions function del_bridge () {