qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1674358 - in /qpid/dispatch/trunk: python/qpid_dispatch_internal/router/node.py tests/system_tests_management.py tests/system_tests_qdstat.py tools/qdstat
Date Fri, 17 Apr 2015 17:28:49 GMT
Author: tross
Date: Fri Apr 17 17:28:49 2015
New Revision: 1674358

URL: http://svn.apache.org/r1674358
Log:
DISPATCH-136 - Added 'local' router to list of routers in qdstat -n
    Also provided a --verbose option to qdstat to print more details.

Modified:
    qpid/dispatch/trunk/python/qpid_dispatch_internal/router/node.py
    qpid/dispatch/trunk/tests/system_tests_management.py
    qpid/dispatch/trunk/tests/system_tests_qdstat.py
    qpid/dispatch/trunk/tools/qdstat

Modified: qpid/dispatch/trunk/python/qpid_dispatch_internal/router/node.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch_internal/router/node.py?rev=1674358&r1=1674357&r2=1674358&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch_internal/router/node.py (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch_internal/router/node.py Fri Apr 17 17:28:49 2015
@@ -48,6 +48,19 @@ class NodeTracker(object):
         self.neighbor_max_age = self.container.config.helloMaxAge
         self.ls_max_age       = self.container.config.remoteLsMaxAge
         self.flux_interval    = self.container.config.raIntervalFlux * 2
+        self.container.router_adapter.get_agent().add_implementation(self, "router.node")
+
+
+    def refresh_entity(self, attributes):
+        """Refresh management attributes"""
+        attributes.update({
+            "routerId": self.my_id,
+            "instance": self.container.instance, # Boot number, integer
+            "linkState": [ls for ls in self.link_state.peers], # List of neighbour nodes
+            "nextHop":  "(self)",
+            "validOrigins": [],
+            "address": Address.topological(self.my_id, area=self.container.area)
+        })
 
 
     def _do_expirations(self, now):

Modified: qpid/dispatch/trunk/tests/system_tests_management.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/system_tests_management.py?rev=1674358&r1=1674357&r2=1674358&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/system_tests_management.py (original)
+++ qpid/dispatch/trunk/tests/system_tests_management.py Fri Apr 17 17:28:49 2015
@@ -399,9 +399,9 @@ class ManagementTest(system_test.TestCas
             self.assertEqual(attrs['address'], 'amqp:/_topo/0/%s' % name)
             return name
 
-        self.assertEqual(set(["router1", "router2"]), set([check(n) for n in rnode_lists[0]]))
-        self.assertEqual(set(["router0", "router2"]), set([check(n) for n in rnode_lists[1]]))
-        self.assertEqual(set(["router1", "router0"]), set([check(n) for n in rnode_lists[2]]))
+        self.assertEqual(set(["router0", "router1", "router2"]), set([check(n) for n in rnode_lists[0]]))
+        self.assertEqual(set(["router0", "router1", "router2"]), set([check(n) for n in rnode_lists[1]]))
+        self.assertEqual(set(["router0", "router1", "router2"]), set([check(n) for n in rnode_lists[2]]))
 
     def test_entity_names(self):
         nodes = [self.cleanup(Node.connect(Url(r.addresses[0]))) for r in self.routers]
@@ -430,12 +430,12 @@ class ManagementTest(system_test.TestCas
         remotes = sum([n.get_mgmt_nodes() for n in nodes], [])
         self.assertEqual(set([u'amqp:/_topo/0/router%s/$management' % i for i in [0, 1, 2]]),
                          set(remotes))
-        self.assertEqual(6, len(remotes))
+        self.assertEqual(9, len(remotes))
         # Query router2 indirectly via router1
         remote_url = Url(self.routers[0].addresses[0], path=Url(remotes[0]).path)
         remote = self.cleanup(Node.connect(remote_url))
         router_id = remotes[0].split("/")[3]
-        assert router_id in ['router1', 'router2']
+        assert router_id in ['router0', 'router1', 'router2']
         self.assertEqual([router_id], [r.routerId for r in remote.query(type=ROUTER).get_entities()])
 
     def test_get_types(self):

Modified: qpid/dispatch/trunk/tests/system_tests_qdstat.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/system_tests_qdstat.py?rev=1674358&r1=1674357&r2=1674358&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/system_tests_qdstat.py (original)
+++ qpid/dispatch/trunk/tests/system_tests_qdstat.py Fri Apr 17 17:28:49 2015
@@ -57,7 +57,7 @@ class QdstatTest(system_test.TestCase):
         self.run_qdstat(['--links'], r'endpoint.*out.*local.*temp.')
 
     def test_nodes(self):
-        self.run_qdstat(['--nodes'], r'Router Nodes')
+        self.run_qdstat(['--nodes'], r'No Router List')
 
     def test_address(self):
         self.run_qdstat(['--address'], r'\$management')

Modified: qpid/dispatch/trunk/tools/qdstat
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tools/qdstat?rev=1674358&r1=1674357&r2=1674358&view=diff
==============================================================================
--- qpid/dispatch/trunk/tools/qdstat (original)
+++ qpid/dispatch/trunk/tools/qdstat Fri Apr 17 17:28:49 2015
@@ -48,6 +48,7 @@ def parse_args(argv):
     parser.add_option("-n", "--nodes", help="Show Router Nodes",            action="store_const",
const="n",   dest="show")
     parser.add_option("-a", "--address", help="Show Router Addresses",      action="store_const",
const="a",   dest="show")
     parser.add_option("-m", "--memory", help="Show Broker Memory Stats",    action="store_const",
const="m",   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")
 
@@ -132,6 +133,12 @@ class BusManager(Node):
             return identity[pos + 1:]
         return identity
 
+    def _list_clean(self, inlist):
+        outlist = []
+        for i in inlist:
+            outlist.append(str(i))
+        return outlist
+
     def displayGeneral(self):
         disp = Display(prefix="  ")
         heads = []
@@ -195,8 +202,9 @@ class BusManager(Node):
         heads.append(Header("router-id"))
         heads.append(Header("next-hop"))
         heads.append(Header("link"))
-        #heads.append(Header("neighbors"))
-        #heads.append(Header("valid-origins"))
+        if self.opts.verbose:
+            heads.append(Header("neighbors"))
+            heads.append(Header("valid-origins"))
         rows = []
 
         objects  = self.query('org.apache.qpid.dispatch.router.node')
@@ -211,13 +219,17 @@ class BusManager(Node):
                 row.append('-')
                 row.append(node.routerLink)
 
-            #row.append('%r' % node.linkState)
-            #row.append('%r' % node.validOrigins)
+            if self.opts.verbose:
+                row.append('%r' % self._list_clean(node.linkState))
+                row.append('%r' % self._list_clean(node.validOrigins))
             rows.append(row)
-        title = "Router Nodes"
-        sort = Sorter(heads, rows, 'router-id')
-        dispRows = sort.getSorted()
-        disp.formattedTable(title, heads, dispRows)
+        if len(rows) > 0:
+            title = "Routers in the Network"
+            sort = Sorter(heads, rows, 'router-id')
+            dispRows = sort.getSorted()
+            disp.formattedTable(title, heads, dispRows)
+        else:
+            print "Router is Standalone - No Router List"
 
     def displayAddresses(self):
         disp = Display(prefix="  ")



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message