Masayoshi Kobayashi | ce24971 | 2013-03-15 02:29:38 +0000 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | controller="" |
Masayoshi Kobayashi | b738b21 | 2013-04-03 02:26:51 +0000 | [diff] [blame] | 3 | switches=`sudo ovs-vsctl list-br` |
Masayoshi Kobayashi | ce24971 | 2013-03-15 02:29:38 +0000 | [diff] [blame] | 4 | |
| 5 | function host2ip (){ |
| 6 | ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'` |
| 7 | echo $ip |
| 8 | } |
| 9 | |
Masayoshi Kobayashi | 8afa882 | 2013-04-02 22:20:33 +0000 | [diff] [blame] | 10 | dpids=() |
Masayoshi Kobayashi | ce24971 | 2013-03-15 02:29:38 +0000 | [diff] [blame] | 11 | for s in $switches; do |
Masayoshi Kobayashi | 8afa882 | 2013-04-02 22:20:33 +0000 | [diff] [blame] | 12 | i=`sudo ovs-ofctl show $s |grep dpid | awk -F ":" '{print $4}'` |
| 13 | dpids+=($i) |
| 14 | done |
| 15 | ((j=0)) |
| 16 | for s in $switches; do |
Masayoshi Kobayashi | b738b21 | 2013-04-03 02:26:51 +0000 | [diff] [blame] | 17 | sudo ovs-ofctl dump-flows $s |grep cookie| awk -vsw=$s -vdpid=${dpids[$j]} '{printf("%s dpid=%s %s\n",sw,dpid,$0)}' |
Masayoshi Kobayashi | 8afa882 | 2013-04-02 22:20:33 +0000 | [diff] [blame] | 18 | ((j ++ )) |
Masayoshi Kobayashi | ce24971 | 2013-03-15 02:29:38 +0000 | [diff] [blame] | 19 | done |