blob: fb8d2a0e4372ff3f79304f7f7f63b70f13d2ecbc [file] [log] [blame]
Masayoshi Kobayashi79ac5052013-02-27 19:16:14 +00001#! /bin/bash
2controller=""
Masayoshi Kobayashi640ad692014-01-22 23:37:59 -08003switches=`sudo ovs-vsctl list-br`
Masayoshi Kobayashi79ac5052013-02-27 19:16:14 +00004function host2ip (){
Masayoshi Kobayashi640ad692014-01-22 23:37:59 -08005 ip=`getent hosts $1 | awk '{print $1}' | tail -n 1`
Masayoshi Kobayashi79ac5052013-02-27 19:16:14 +00006 echo $ip
7}
8
9url=""
10for c in $controller; do
11 url="$url tcp:`host2ip $c`:6633"
12done
13echo $url
14for s in $switches; do
15 echo "set switch $s controller $url"
16 sudo ovs-vsctl set-controller $s $url
17done