Browse Source

[2136] Updated the "show_processes" to provide address of each module

This information is used for other module e.g. stats to count running instances
of same module. The address information is seen in the third index of the
array.
Naoki Kambe 12 years ago
parent
commit
b9a77c84d6

+ 1 - 1
src/bin/bind10/bind10.8

@@ -236,7 +236,7 @@ daemon immediately\&.
 
 \fBshow_processes\fR
 lists the current processes managed by
-\fBbind10\fR\&. The output is an array in JSON format containing the process ID and the name for each\&.
+\fBbind10\fR\&. The output is an array in JSON format containing the process ID, the name for each and the address name used on each message bus\&.
 
 
 .PP

+ 1 - 1
src/bin/bind10/bind10.xml

@@ -425,7 +425,7 @@ xfrin
       <command>show_processes</command> lists the current processes
       managed by <command>bind10</command>.
       The output is an array in JSON format containing the process
-      ID and the name for each.
+      ID, the name for each and the address name used on each message bus.
 <!-- TODO: what is name? -->
 <!-- TODO: change to JSON object format? -->
 <!-- TODO: ticket #1406 -->

+ 2 - 1
src/bin/bind10/bind10_src.py.in

@@ -282,7 +282,8 @@ class BoB:
         pids.sort()
         process_list = [ ]
         for pid in pids:
-            process_list.append([pid, self.components[pid].name()])
+            process_list.append([pid, self.components[pid].name(),
+                                 self.components[pid].address()])
         return process_list
 
     def _get_stats_data(self):

+ 5 - 4
src/bin/bind10/tests/bind10_test.py.in

@@ -940,9 +940,10 @@ class TestStartStopProcessesBob(unittest.TestCase):
         #self.check_started_dhcp(bob, True, True)
 
 class MockComponent:
-    def __init__(self, name, pid):
+    def __init__(self, name, pid, address=None):
         self.name = lambda: name
         self.pid = lambda: pid
+        self.address = lambda: address
 
 
 class TestBossCmd(unittest.TestCase):
@@ -968,10 +969,10 @@ class TestBossCmd(unittest.TestCase):
         """
         bob = MockBob()
         bob.register_process(1, MockComponent('first', 1))
-        bob.register_process(2, MockComponent('second', 2))
+        bob.register_process(2, MockComponent('second', 2, 'Second'))
         answer = bob.command_handler("show_processes", None)
-        processes = [[1, 'first'],
-                     [2, 'second']]
+        processes = [[1, 'first', None],
+                     [2, 'second', 'Second']]
         self.assertEqual(answer, {'result': [0, processes]})
 
 class TestParseArgs(unittest.TestCase):