Masayoshi Kobayashi | 79ac505 | 2013-02-27 19:16:14 +0000 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | controller="" |
Masayoshi Kobayashi | 640ad69 | 2014-01-22 23:37:59 -0800 | [diff] [blame] | 3 | switches=`sudo ovs-vsctl list-br` |
Masayoshi Kobayashi | 79ac505 | 2013-02-27 19:16:14 +0000 | [diff] [blame] | 4 | function host2ip (){ |
Masayoshi Kobayashi | 640ad69 | 2014-01-22 23:37:59 -0800 | [diff] [blame] | 5 | ip=`getent hosts $1 | awk '{print $1}' | tail -n 1` |
Masayoshi Kobayashi | 79ac505 | 2013-02-27 19:16:14 +0000 | [diff] [blame] | 6 | echo $ip |
| 7 | } |
| 8 | |
| 9 | url="" |
| 10 | for c in $controller; do |
| 11 | url="$url tcp:`host2ip $c`:6633" |
| 12 | done |
| 13 | echo $url |
| 14 | for s in $switches; do |
| 15 | echo "set switch $s controller $url" |
| 16 | sudo ovs-vsctl set-controller $s $url |
| 17 | done |