blob: 207d3f2c09c8b75cfd381544dc5ebcf70e68d9bd [file] [log] [blame]
Jonathan Hart1790a092013-03-28 14:11:45 -07001#! /bin/bash
2
3if [ "x$1" == "x" ];
4then
5 echo "No controller specified"
6 exit 1
7fi
8
9#controller=`hostname`
10controller=$1
11switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
12
13function host2ip (){
14 ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'`
15 echo $ip
16}
17
18url=""
19for c in $controller; do
20 url="$url tcp:`host2ip $c`:6633"
21done
22echo $url
23for s in $switches; do
24 echo "set switch $s controller $url"
25 sudo ovs-vsctl set-controller $s $url
26done