+++ /dev/null
-#!/bin/bash
-
-function error
-{
- echo $1 >&2
- killall pltap-ovs 2>/dev/null || true
- exit 1
-}
-
-function is_switch_running
-{
- ovs-appctl version >/dev/null 2>&1
-}
-
-if [ -z "$1" ]; then
- error "Usage: ${0##*/} <IP/PREFIX>"
-fi
-
-# TODO: check paramether validity
-
-IP=${1%/*}
-PREFIX=${1#*/}
-
-set -e
-
-# ensure ovs-vswitchd is running
-if ! is_switch_running; then
- echo "ovs-vswitchd not running" >&2
- exit 1
-fi
-
-
-# check whether the address is already assigned
-set -e
-TAPNAME=$(ip addr show to "$IP/32" | perl -ne '/^\s*\d+:\s*([\w-]+):/ && print $1')
-if [ ! -z "$TAPNAME" ]; then
- if ovs-vsctl br-exists "$TAPNAME"; then
- echo $TAPNAME
- exit 0
- fi
- error "$IP already assigned to $TAPNAME"
-fi
-
-TAPNAME=$(pltap-ovs)
-vsysc vif_up << EOF
- $TAPNAME
- $IP
- $PREFIX
-EOF
-while ! ip link show up | egrep -q "^[0-9]+: +$TAPNAME:"; do
- echo "Waiting for $TAPNAME to come UP..." >&2
- sleep 1
-done
-ovs-vsctl add-br $TAPNAME -- set bridge $TAPNAME datapath_type=planetlab
-echo $TAPNAME
+++ /dev/null
-#!/bin/bash
-
-function error
-{
- echo $1 >&2
- exit 1
-}
-
-if [ -z "$2" ]; then
- error "Usage ${0##*/} <bridge> <port>"
-fi
-
-set -e
-if ! ovs-vsctl list-ports "$1" | grep -q "^$2\$"; then
- ovs-vsctl add-port "$1" "$2" -- set interface "$2" type=tunnel
-fi
-ovs-appctl netdev-tunnel/get-port "$2"
+++ /dev/null
-#!/bin/bash
-
-function error
-{
- echo $1 >&2
- exit 1
-}
-
-function is_switch_running
-{
- ovs-appctl version >/dev/null 2>&1
-}
-
-if [ -z "$1" ]; then
- error "Usage: ${0##*/} <bridge name>"
-fi
-
-W=
-if ! is_switch_running; then
- W="--no-wait"
-fi
-
-if ovs-vsctl br-exists "$1"; then
- ovs-vsctl $W del-br $1
-fi
+++ /dev/null
-#!/bin/bash
-
-function error
-{
- echo $1 >&2
- exit 1
-}
-
-if [ -z "$1" ]; then
- error "Usage ${0##*/} <port>"
-fi
-
-set -e
-if ovs-vsctl port-to-br "$1" >/dev/null 2>&1; then
- ovs-vsctl del-port "$1"
-fi
+++ /dev/null
-#!/bin/bash
-
-PIDF=/usr/local/var/run/openvswitch/ovsdb-server.pid
-
-if [ ! -f "$PIDF" ]; then
- sudo ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
- --remote=db:Open_vSwitch,manager_options \
- --private-key=db:SSL,private_key \
- --certificate=db:SSL,certificate \
- --bootstrap-ca-cert=db:SSL,ca_cert \
- --pidfile --detach
-fi
-while [ ! -f "$PIDF" ]; do
- echo "Waiting for ovsdb-server to start..." >&2
- sleep 1;
-done
-cat "$PIDF"
+++ /dev/null
-#!/bin/bash
-
-PIDF=/usr/local/var/run/openvswitch/ovs-vswitchd.pid
-
-if [ ! -f "$PIDF" ]; then
- sudo ovs-vswitchd --pidfile --detach --log-file >/dev/null
-fi
-while [ ! -f "$PIDF" ]; do
- echo "Waiting for ovs-vswitchd to start..." >&2
- sleep 1;
-done
-cat "$PIDF"