Masayoshi Kobayashi | 79ac505 | 2013-02-27 19:16:14 +0000 | [diff] [blame] | 1 | #! /bin/bash |
Masayoshi Kobayashi | 6a12e6b | 2013-03-12 18:30:35 +0000 | [diff] [blame] | 2 | controller="onos9vpc onos10vpc onos11vpc" |
Masayoshi Kobayashi | 79ac505 | 2013-02-27 19:16:14 +0000 | [diff] [blame] | 3 | me=`hostname` |
| 4 | controller=`echo $controller | sed "s/$me//g"` |
| 5 | switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'` |
| 6 | |
| 7 | function host2ip (){ |
| 8 | ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'` |
| 9 | echo $ip |
| 10 | } |
| 11 | |
| 12 | url="" |
| 13 | for c in $controller; do |
| 14 | url="$url tcp:`host2ip $c`:6633" |
| 15 | done |
| 16 | echo $url |
| 17 | for s in $switches; do |
| 18 | echo "set switch $s controller $url" |
| 19 | sudo ovs-vsctl set-controller $s $url |
| 20 | done |