Repository: qpid-dispatch Updated Branches: refs/heads/master 5cae5b93d -> 122648a7e
DISPATCH-1130 Expose link priority Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/122648a7 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/122648a7 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/122648a7 Branch: refs/heads/master Commit: 122648a7e83b44247fefd733909e970fbb99cc66 Parents: 5cae5b9 Author: Ernest Allen <eal...@redhat.com> Authored: Thu Oct 11 07:53:49 2018 -0400 Committer: Ernest Allen <eal...@redhat.com> Committed: Thu Oct 11 07:53:49 2018 -0400 ---------------------------------------------------------------------- python/qpid_dispatch/management/qdrouter.json | 4 ++ src/router_core/agent_link.c | 6 ++ src/router_core/agent_link.h | 2 +- tests/system_tests_qdstat.py | 65 +++++++++++++++++++++- tools/qdstat.in | 4 +- 5 files changed, 78 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/122648a7/python/qpid_dispatch/management/qdrouter.json ---------------------------------------------------------------------- diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json index 4b38092..e31f54c 100644 --- a/python/qpid_dispatch/management/qdrouter.json +++ b/python/qpid_dispatch/management/qdrouter.json @@ -1423,6 +1423,10 @@ "ingressHistogram": { "type": "list", "description": "For outgoing links on connections with 'normal' role. This histogram shows the number of settled deliveries on the link that ingressed the network at each interior router node." + }, + "priority": { + "type": "integer", + "description": "For inter-router links, this is the message priority being handled." } } }, http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/122648a7/src/router_core/agent_link.c ---------------------------------------------------------------------- diff --git a/src/router_core/agent_link.c b/src/router_core/agent_link.c index b2d7dbf..5ca0f25 100644 --- a/src/router_core/agent_link.c +++ b/src/router_core/agent_link.c @@ -43,6 +43,7 @@ #define QDR_LINK_RELEASED_COUNT 19 #define QDR_LINK_MODIFIED_COUNT 20 #define QDR_LINK_INGRESS_HISTOGRAM 21 +#define QDR_LINK_PRIORITY 22 const char *qdr_link_columns[] = {"name", @@ -67,6 +68,7 @@ const char *qdr_link_columns[] = "releasedCount", "modifiedCount", "ingressHistogram", + "priority", 0}; static const char *qd_link_type_name(qd_link_type_t lt) @@ -220,6 +222,10 @@ static void qdr_agent_write_column_CT(qd_composed_field_t *body, int col, qdr_li qd_compose_insert_null(body); break; + case QDR_LINK_PRIORITY: + qd_compose_insert_uint(body, link->priority); + break; + default: qd_compose_insert_null(body); break; http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/122648a7/src/router_core/agent_link.h ---------------------------------------------------------------------- diff --git a/src/router_core/agent_link.h b/src/router_core/agent_link.h index 6402949..cd92c1b 100644 --- a/src/router_core/agent_link.h +++ b/src/router_core/agent_link.h @@ -29,7 +29,7 @@ void qdra_link_update_CT(qdr_core_t *core, qdr_query_t *query, qd_parsed_field_t *in_body); -#define QDR_LINK_COLUMN_COUNT 22 +#define QDR_LINK_COLUMN_COUNT 23 const char *qdr_link_columns[QDR_LINK_COLUMN_COUNT + 1]; http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/122648a7/tests/system_tests_qdstat.py ---------------------------------------------------------------------- diff --git a/tests/system_tests_qdstat.py b/tests/system_tests_qdstat.py index 45040f0..2bd89d7 100644 --- a/tests/system_tests_qdstat.py +++ b/tests/system_tests_qdstat.py @@ -30,7 +30,6 @@ from subprocess import PIPE from proton import Url, SSLDomain, SSLUnavailable, SASL from system_test import main_module, SkipIfNeeded - class QdstatTest(system_test.TestCase): """Test qdstat tool output""" @classmethod @@ -104,6 +103,70 @@ class QdstatTest(system_test.TestCase): def test_log(self): self.run_qdstat(['--log', '--limit=5'], r'AGENT \(debug\).*GET-LOG') +class QdstatLinkPriorityTest(system_test.TestCase): + """Need 2 routers to get inter-router links for the link priority test""" + @classmethod + def setUpClass(cls): + super(QdstatLinkPriorityTest, cls).setUpClass() + cls.inter_router_port = cls.tester.get_port() + config_1 = system_test.Qdrouterd.Config([ + ('router', {'mode': 'interior', 'id': 'R1'}), + ('listener', {'port': cls.tester.get_port()}), + ('connector', {'role': 'inter-router', 'port': cls.inter_router_port}) + ]) + + config_2 = system_test.Qdrouterd.Config([ + ('router', {'mode': 'interior', 'id': 'R2'}), + ('listener', {'role': 'inter-router', 'port': cls.inter_router_port}), + ]) + cls.router_2 = cls.tester.qdrouterd('test_router_2', config_2, wait=True) + cls.router_1 = cls.tester.qdrouterd('test_router_1', config_1, wait=True) + cls.router_1.wait_router_connected('R2') + + def address(self): + return self.router_1.addresses[0] + + def run_qdstat(self, args): + p = self.popen( + ['qdstat', '--bus', str(self.address()), '--timeout', str(system_test.TIMEOUT) ] + args, + name='qdstat-'+self.id(), stdout=PIPE, expect=None, + universal_newlines=True) + + out = p.communicate()[0] + assert p.returncode == 0, \ + "qdstat exit status %s, output:\n%s" % (p.returncode, out) + return out + + def test_link_priority(self): + out = self.run_qdstat(['--links']) + lines = out.split("\n") + + # make sure the output contains a header line + self.assertGreaterEqual(len(lines), 2) + + # see if the header line has the word priority in it + priorityregexp = r'priority' + priority_column = re.search(priorityregexp, lines[1]).start() + self.assertGreater(priority_column, -1) + + # extract the number in the priority column of every inter-router link + priorities = {} + for i in range(3, len(lines) - 1): + if re.search(r'inter-router', lines[i]): + pri = re.findall('\d+', lines[i][priority_column:]) + # make sure the priority found is a number + self.assertGreater(len(pri), 0, "Can not find numeric priority in '%s'" % lines[i]) + priority = int(pri[0]) + # make sure the priority is from 0 to 9 + self.assertGreaterEqual(priority, 0, "Priority was less than 0") + self.assertLessEqual(priority, 9, "Priority was greater than 9") + + # mark this priority as present + priorities[priority] = True + + # make sure that all priorities are present in the list (currently 0-9) + self.assertEqual(len(priorities.keys()), 10, "Not all priorities are present") + try: SSLDomain(SSLDomain.MODE_CLIENT) class QdstatSslTest(system_test.TestCase): http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/122648a7/tools/qdstat.in ---------------------------------------------------------------------- diff --git a/tools/qdstat.in b/tools/qdstat.in index 2086310..471b3c1 100755 --- a/tools/qdstat.in +++ b/tools/qdstat.in @@ -293,7 +293,7 @@ class BusManager(Node): cols = ('linkType', 'linkDir', 'connectionId', 'identity', 'peer', 'owningAddr', 'capacity', 'undeliveredCount', 'unsettledCount', 'deliveryCount', 'presettledCount', 'droppedPresettledCount', 'acceptedCount', 'rejectedCount', 'releasedCount', - 'modifiedCount', 'adminStatus', 'operStatus', 'linkName') + 'modifiedCount', 'adminStatus', 'operStatus', 'linkName', 'priority') objects = self.query('org.apache.qpid.dispatch.router.link', cols, limit=self.opts.limit) @@ -314,6 +314,7 @@ class BusManager(Node): heads.append(Header("mod")) heads.append(Header("admin")) heads.append(Header("oper")) + heads.append(Header("priority")) if self.opts.verbose: heads.append(Header("name")) @@ -340,6 +341,7 @@ class BusManager(Node): row.append(link.modifiedCount) row.append(link.adminStatus) row.append(link.operStatus) + row.append(link.priority) if self.opts.verbose: row.append(link.linkName) rows.append(row) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org