diff --git a/bin/multiweave b/bin/multiweave index b6e3c100..1dd5dfd8 100755 --- a/bin/multiweave +++ b/bin/multiweave @@ -14,14 +14,23 @@ set -e START=${FIRST_WEAVE:-1} COUNT=${NUM_WEAVES:-28} FINISH=$((START+COUNT-1)) +PORT=6783 weavedir=$(dirname $0)/.. +# Generate a random MAC value - copied from 'weave' script +random_mac() { + # In the first byte of the MAC, the 'multicast' bit should be + # clear and 'locally administered' bit should be set. All other + # bits should be random. + od -txC -An -N6 /dev/urandom | sed 's|^ ||;s| |:|;s|[0-3]:|2:|;s|[4-7]:|6:|;s|[89ab]:|a:|;s|[c-f]:|e:|;s| |:|g' +} + case "$1" in launch) shift 1 for i in $(seq $START $FINISH); do - WEAVE_CONTAINER_NAME=weave$i $weavedir/weave test-launch "$@" + WEAVE_CONTAINER_NAME=weave$i WEAVE_PORT=$((5000+i)) $weavedir/weave launch -iface '' -name $(random_mac) -nickname weave$i -port $PORT "$@" done if [ $START -ne 1 ] ; then status=$(docker inspect --format='{{.State.Running}} {{.NetworkSettings.IPAddress}}' weave$((START-1))) diff --git a/weave b/weave index b15dfb38..5d4af7f3 100755 --- a/weave +++ b/weave @@ -390,10 +390,6 @@ launch() { netnsenter ip link set $CONTAINER_IFNAME up } -test_launch() { - netnsenter ethtool -K eth0 tx off >/dev/null -} - attach() { if netnsenter ip link show $CONTAINER_IFNAME >/dev/null 2>&1 ; then for ADDR; do @@ -713,23 +709,6 @@ case "$COMMAND" in wait_for_status $CONTAINER_NAME $HTTP_PORT echo $CONTAINER ;; - test-launch) - # For testing purposes. Allows launching of several weave - # routers on the same machine, by invoking this multiple times - # with different WEAVE_CONTAINER_NAMEs - # - # Note that the routers are not connected to the $BRIDGE and - # do not perform any capture/injection. So this is mainly - # intended for testing of administrative and control plane - # functionality, rather than routing. - check_not_running $CONTAINER_NAME $BASE_IMAGE - MACADDR=$(random_mac) - CONTAINER=$(docker run --privileged -d --name=$CONTAINER_NAME -e WEAVE_PASSWORD \ - $WEAVE_DOCKER_ARGS $IMAGE -name $MACADDR -nickname "$CONTAINER_NAME" "$@") - with_container_netns $CONTAINER test_launch >/dev/null - wait_for_status $CONTAINER $HTTP_PORT - echo $CONTAINER - ;; launch-dns) [ $# -gt 0 ] || usage CIDR=$1