You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2016/03/30 20:04:38 UTC
qpid-dispatch git commit: DISPATCH-242 - Added -R option for
displaying link routes via qdstat. Also added tests to test output of qdstat
-R
Repository: qpid-dispatch
Updated Branches:
refs/heads/master 14b5a9bca -> da4130b51
DISPATCH-242 - Added -R option for displaying link routes via qdstat. Also added tests to test output of qdstat -R
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/da4130b5
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/da4130b5
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/da4130b5
Branch: refs/heads/master
Commit: da4130b51396c3094371684041fe3b48a115bfa7
Parents: 14b5a9b
Author: Ganesh Murthy <gm...@redhat.com>
Authored: Wed Mar 30 14:04:11 2016 -0400
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Wed Mar 30 14:04:11 2016 -0400
----------------------------------------------------------------------
tests/system_tests_link_routes.py | 42 +++++++++++++++++++++++++++++++---
tools/qdstat | 29 ++++++++++++++++++++++-
2 files changed, 67 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/da4130b5/tests/system_tests_link_routes.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_link_routes.py b/tests/system_tests_link_routes.py
index 3946ab4..89a3fa7 100644
--- a/tests/system_tests_link_routes.py
+++ b/tests/system_tests_link_routes.py
@@ -19,14 +19,15 @@
import unittest
from time import sleep
-from system_test import TestCase, Qdrouterd, main_module
+from subprocess import PIPE
+
+from system_test import TestCase, Qdrouterd, main_module, TIMEOUT
from proton import Message
from proton.reactor import AtMostOnce
from proton.utils import BlockingConnection, LinkDetached
from qpid_dispatch.management.client import Node
-from system_test import TIMEOUT
class LinkRoutePatternTest(TestCase):
"""
@@ -109,7 +110,42 @@ class LinkRoutePatternTest(TestCase):
# bit more time for the routers to stabilize.
sleep(2)
- def test_aaa_partial_link_route_match(self):
+ def run_qdstat_linkRoute(self, address):
+ p = self.popen(
+ ['qdstat', '--bus', str(address), '--timeout', str(TIMEOUT) ] + ['--linkroute'],
+ name='qdstat-'+self.id(), stdout=PIPE, expect=None)
+
+ out = p.communicate()[0]
+ assert p.returncode == 0, "qdstat exit status %s, output:\n%s" % (p.returncode, out)
+ return out
+
+ def test_bbb_qdstat_link_routes_routerB(self):
+ """
+ Runs qdstat on router B to make sure that router B has two link routes, one 'in' and one 'out'
+
+ """
+ out = self.run_qdstat_linkRoute(self.routers[1].addresses[0])
+ out_list = out.split()
+ self.assertEqual(out_list.count('org.apache.qpid.dispatch.config.linkRoute'), 2)
+ self.assertEqual(out_list.count('org.apache.qpid.dispatch.config.linkRoute'), 2)
+ self.assertEqual(out_list.count('in'), 1)
+ self.assertEqual(out_list.count('out'), 1)
+ self.assertEqual(out_list.count('broker'), 2)
+
+ def test_ccc_qdstat_link_routes_routerC(self):
+ """
+ Runs qdstat on router C to make sure that router C has two link routes, one 'in' and one 'out'
+
+ """
+ out = self.run_qdstat_linkRoute(self.routers[2].addresses[1])
+ out_list = out.split()
+
+ self.assertEqual(out_list.count('org.apache.qpid.dispatch.config.linkRoute'), 2)
+ self.assertEqual(out_list.count('org.apache.qpid.dispatch.config.linkRoute'), 2)
+ self.assertEqual(out_list.count('in'), 1)
+ self.assertEqual(out_list.count('out'), 1)
+
+ def test_ddd_partial_link_route_match(self):
"""
The linkRoutePattern on Routers C and B is set to org.apache.
Creates a receiver listening on the address 'org.apache.dev' and a sender that sends to address 'org.apache.dev'.
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/da4130b5/tools/qdstat
----------------------------------------------------------------------
diff --git a/tools/qdstat b/tools/qdstat
index bbd1973..e203f5d 100755
--- a/tools/qdstat
+++ b/tools/qdstat
@@ -48,6 +48,7 @@ def parse_args(argv):
parser.add_option("-a", "--address", help="Show Router Addresses", action="store_const", const="a", dest="show")
parser.add_option("-m", "--memory", help="Show Router Memory Stats", action="store_const", const="m", dest="show")
parser.add_option("-L", "--autolink", help="Show Auto Links", action="store_const", const="L", dest="show")
+ parser.add_option("-R", "--linkroute", help="Show Link Routes", action="store_const", const="R", dest="show")
parser.add_option("-v", "--verbose", help="Show maximum detail", action="store_true", dest="verbose")
parser.add_option("--log", help="Show recent log entries", action="store_const", const="log", dest="show")
parser.add_option("--limit", help="Limit number of log entries", type="int")
@@ -55,7 +56,7 @@ def parse_args(argv):
opts, args = parser.parse_args(args=argv)
if not opts.show:
- parser.error("You must specify one of these options: -g, -c, -l, -n, -a, -m, -h or --log.")
+ parser.error("You must specify one of these options: -g, -c, -l, -n, -a, -m, -h, -L, -LR or --log.")
return opts, args
@@ -348,6 +349,31 @@ class BusManager(Node):
dispRows = sorter.getSorted()
disp.formattedTable(title, heads, dispRows)
+ def displayLinkRoutes(self):
+ disp = Display(prefix=" ")
+ heads = []
+ heads.append(Header("type"))
+ heads.append(Header("prefix"))
+ heads.append(Header("distribution"))
+ heads.append(Header("connection"))
+ heads.append(Header("dir"))
+ rows = []
+
+ link_routes = self.query('org.apache.qpid.dispatch.router.config.linkRoute')
+
+ for link_route in link_routes:
+ row = []
+ row.append(link_route.type)
+ row.append(link_route.prefix)
+ row.append(link_route.distribution)
+ row.append(link_route.connection)
+ row.append(link_route.dir)
+ rows.append(row)
+ title = "Link Routes"
+ sorter = Sorter(heads, rows, 'dir', 0, True)
+ dispRows = sorter.getSorted()
+ disp.formattedTable(title, heads, dispRows)
+
def displayMemory(self):
disp = Display(prefix=" ")
heads = []
@@ -396,6 +422,7 @@ class BusManager(Node):
elif main == 'g': self.displayGeneral()
elif main == 'c': self.displayConnections()
elif main == 'L': self.displayAutolinks()
+ elif main == 'R': self.displayLinkRoutes()
elif main == 'log': self.displayLog()
def display(self, identitys):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org