Last active
May 26, 2016 23:36
-
-
Save fredhsu/502852d901666aa05c3031c6a64ee7d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| ########################################### | |
| ### Swarm Global Macvlan Driver Tests ### | |
| ### ./global-vlan-test.sh <Swarm_IP> ### | |
| ########################################## | |
| # runswarm takes the swarm host:port and network and runs four containers on that network, then removes them | |
| function runswarm { | |
| echo "Creating four containers on network {$2}" | |
| for i in {0..3} | |
| do | |
| XS[$i]="$(docker -H tcp://$1 run --net=$2 --label mcvnet=\"$2\" -td alpine /bin/sh)" | |
| done | |
| echo ${XS[*]} | |
| echo "Sleeping here for 5 sec before removal" | |
| sleep 5 | |
| for i in "${XS[@]}" | |
| do | |
| docker -H tcp://$1 rm -f $i | |
| done | |
| echo "Removed all containers" | |
| } | |
| # | |
| if [[ "$1" == "" ]]; then | |
| echo "----> Defaulting to a Swarm local host and port 0.0.0.0:2376" | |
| SW_HOST="0.0.0.0" | |
| fi | |
| if [[ "$1" != "" ]]; then | |
| SW_HOST=${1} | |
| echo "----> Using specified Swarm target ${1}:2376" | |
| fi | |
| SWARM=${SWHOST}:2376 | |
| ########################################################## | |
| echo "parent-file bond0.30 802.1q" | |
| docker -H tcp://${SWARM} network create -d macvlan --subnet=192.168.30.0/24 --gateway=192.168.30.1 -o parent-file=/home/fredlhsu/net.30.toml mcv30 | |
| sleep 1 | |
| runswarm ${SWARM} mcv30 | |
| docker -H ${SWARM} network rm mcv30 | |
| ########################################################## | |
| echo "parent list bond0.10 802.1q" | |
| docker -H tcp://${SWARM} network create -d macvlan --subnet=192.168.10.0/24 --gateway=192.168.10.1 -o parent=bond0.10,eth2.10,eth0.10 mcv10 | |
| sleep 1 | |
| runswarm ${SWARM} mcv10 | |
| docker -H tcp://${SW_HOST}:2376 network rm mcv10 | |
| ########################################################## | |
| echo "parent list bond0.20 802.1q" | |
| docker -H tcp://${SWARM} network create -d macvlan --subnet=192.168.20.0/24 --gateway=192.168.20.1 -o parent="bond0.20, eth2.20" mcv20 | |
| sleep 1 | |
| runswarm ${SWARM} mcv20 | |
| docker -H tcp://${SWARM} network rm mcv20 | |
| ########################################################## | |
| echo "parent-file bond0" | |
| docker -H tcp://${SW_HOST}:2376 network create -d macvlan --subnet=192.168.30.0/24 --gateway=192.168.30.1 -o parent-file=/home/fredlhsu/net30.toml mcv30 | |
| sleep 1 | |
| runswarm ${SWARM} mcv30 | |
| docker -H tcp://${SW_HOST}:2376 network rm mcv30 | |
| ########################################################## | |
| echo "parent list bond0" | |
| docker -H tcp://${SW_HOST}:2376 network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent="bond0, eth2" mcv0 | |
| sleep 1 | |
| runswarm ${SWARM} mcv0 | |
| docker -H tcp://${SW_HOST}:2376 network rm mcv0 | |
| ########################################################## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment