Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions python/qpid_dispatch/management/qdrouter.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
},
Expand Down
6 changes: 6 additions & 0 deletions src/router_core/agent_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/router_core/agent_link.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
65 changes: 64 additions & 1 deletion tests/system_tests_qdstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from proton import Url, SSLDomain, SSLUnavailable, SASL
from system_test import main_module, SkipIfNeeded


class QdstatTest(system_test.TestCase):
"""Test qdstat tool output"""
@classmethod
Expand Down Expand Up @@ -104,6 +103,70 @@ def test_memory(self):
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):
Expand Down
4 changes: 3 additions & 1 deletion tools/qdstat.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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"))

Expand All @@ -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)
Expand Down