From c1b7cb11171a55ba21ab4597977dea0ba6bc7b2d Mon Sep 17 00:00:00 2001
From: Ihar Hrachyshka <ihrachys@redhat.com>
Date: Thu, 11 Feb 2016 13:50:46 +0100
Subject: [PATCH] worlddump: include Open vSwitch info

This may be useful when debugging neutron gate failures.

Change-Id: Iea3589456d2b05d233ba88523a5bd4ac114a0c86
---
 tools/worlddump.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/worlddump.py b/tools/worlddump.py
index 9d2b082f18..83080110e2 100755
--- a/tools/worlddump.py
+++ b/tools/worlddump.py
@@ -110,6 +110,20 @@ def network_dump():
     _dump_cmd("ip route")
 
 
+def ovs_dump():
+    _header("Open vSwitch Dump")
+
+    # NOTE(ihrachys): worlddump is used outside of devstack context (f.e. in
+    # grenade), so there is no single place to determine the bridge names from.
+    # Hardcode for now.
+    bridges = ('br-int', 'br-tun', 'br-ex')
+    _dump_cmd("sudo ovs-vsctl show")
+    for bridge in bridges:
+        _dump_cmd("sudo ovs-ofctl show %s" % bridge)
+    for bridge in bridges:
+        _dump_cmd("sudo ovs-ofctl dump-flows %s" % bridge)
+
+
 def process_list():
     _header("Process Listing")
     _dump_cmd("ps axo "
@@ -147,6 +161,7 @@ def main():
         disk_space()
         process_list()
         network_dump()
+        ovs_dump()
         iptables_dump()
         ebtables_dump()
         compute_consoles()