This is an automated email from the ASF dual-hosted git repository. tross pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push: new eae4575 DISPATCH-1442 - Added metadata field to the router entity. This closes #581 eae4575 is described below commit eae457593a3f06db0cb0acb8fca8bd3f68cd504e Author: Ted Ross <tr...@redhat.com> AuthorDate: Fri Oct 4 16:18:11 2019 -0400 DISPATCH-1442 - Added metadata field to the router entity. This closes #581 --- python/qpid_dispatch/management/qdrouter.json | 6 ++++ src/dispatch.c | 1 + src/dispatch_private.h | 3 +- src/router_core/agent_router.c | 49 ++++++++++++++++----------- src/router_core/agent_router.h | 2 +- tests/system_tests_management.py | 9 ++++- 6 files changed, 47 insertions(+), 23 deletions(-) diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json index 707ae46..0b8262c 100644 --- a/python/qpid_dispatch/management/qdrouter.json +++ b/python/qpid_dispatch/management/qdrouter.json @@ -494,6 +494,12 @@ "required": false, "default": "balanced" }, + "metadata": { + "type": "string", + "description": "Optional metadata text to describe or label this router. This text does not affect the function of the router, but it can be used by external tools (such as the console or orchestration software) to control how the router is displayed.", + "create": true, + "required": false + }, "addrCount": { "type": "integer", "description":"Number of addresses known to the router.", diff --git a/src/dispatch.c b/src/dispatch.c index eb2d195..505db4c 100644 --- a/src/dispatch.c +++ b/src/dispatch.c @@ -204,6 +204,7 @@ qd_error_t qd_dispatch_configure_router(qd_dispatch_t *qd, qd_entity_t *entity) qd->allow_resumable_link_route = qd_entity_opt_bool(entity, "allowResumableLinkRoute", true); QD_ERROR_RET(); qd->timestamps_in_utc = qd_entity_opt_bool(entity, "timestampsInUTC", false); QD_ERROR_RET(); qd->timestamp_format = qd_entity_opt_string(entity, "timestampFormat", 0); QD_ERROR_RET(); + qd->metadata = qd_entity_opt_string(entity, "metadata", 0); QD_ERROR_RET(); if (! qd->sasl_config_path) { qd->sasl_config_path = qd_entity_opt_string(entity, "saslConfigDir", 0); QD_ERROR_RET(); diff --git a/src/dispatch_private.h b/src/dispatch_private.h index f658fb2..741d34d 100644 --- a/src/dispatch_private.h +++ b/src/dispatch_private.h @@ -59,7 +59,8 @@ struct qd_dispatch_t { bool allow_resumable_link_route; bool test_hooks; bool timestamps_in_utc; - char* timestamp_format; + char *timestamp_format; + char *metadata; }; /** diff --git a/src/router_core/agent_router.c b/src/router_core/agent_router.c index 2c4f89a..74f5b8d 100644 --- a/src/router_core/agent_router.c +++ b/src/router_core/agent_router.c @@ -31,26 +31,27 @@ #define QDR_ROUTER_MODE 4 #define QDR_ROUTER_AREA 5 #define QDR_ROUTER_VERSION 6 -#define QDR_ROUTER_ADDR_COUNT 7 -#define QDR_ROUTER_LINK_COUNT 8 -#define QDR_ROUTER_NODE_COUNT 9 -#define QDR_ROUTER_LINK_ROUTE_COUNT 10 -#define QDR_ROUTER_AUTO_LINK_COUNT 11 -#define QDR_ROUTER_CONNECTION_COUNT 12 -#define QDR_ROUTER_PRESETTLED_DELIVERIES 13 -#define QDR_ROUTER_DROPPED_PRESETTLED_DELIVERIES 14 -#define QDR_ROUTER_ACCEPTED_DELIVERIES 15 -#define QDR_ROUTER_REJECTED_DELIVERIES 16 -#define QDR_ROUTER_RELEASED_DELIVERIES 17 -#define QDR_ROUTER_MODIFIED_DELIVERIES 18 -#define QDR_ROUTER_DELAYED_1SEC 19 -#define QDR_ROUTER_DELAYED_10SEC 20 -#define QDR_ROUTER_DELIVERIES_INGRESS 21 -#define QDR_ROUTER_DELIVERIES_EGRESS 22 -#define QDR_ROUTER_DELIVERIES_TRANSIT 23 -#define QDR_ROUTER_DELIVERIES_INGRESS_ROUTE_CONTAINER 24 -#define QDR_ROUTER_DELIVERIES_EGRESS_ROUTE_CONTAINER 25 -#define QDR_ROUTER_DELIVERIES_REDIRECTED 26 +#define QDR_ROUTER_METADATA 7 +#define QDR_ROUTER_ADDR_COUNT 8 +#define QDR_ROUTER_LINK_COUNT 9 +#define QDR_ROUTER_NODE_COUNT 10 +#define QDR_ROUTER_LINK_ROUTE_COUNT 11 +#define QDR_ROUTER_AUTO_LINK_COUNT 12 +#define QDR_ROUTER_CONNECTION_COUNT 13 +#define QDR_ROUTER_PRESETTLED_DELIVERIES 14 +#define QDR_ROUTER_DROPPED_PRESETTLED_DELIVERIES 15 +#define QDR_ROUTER_ACCEPTED_DELIVERIES 16 +#define QDR_ROUTER_REJECTED_DELIVERIES 17 +#define QDR_ROUTER_RELEASED_DELIVERIES 18 +#define QDR_ROUTER_MODIFIED_DELIVERIES 19 +#define QDR_ROUTER_DELAYED_1SEC 20 +#define QDR_ROUTER_DELAYED_10SEC 21 +#define QDR_ROUTER_DELIVERIES_INGRESS 22 +#define QDR_ROUTER_DELIVERIES_EGRESS 23 +#define QDR_ROUTER_DELIVERIES_TRANSIT 24 +#define QDR_ROUTER_DELIVERIES_INGRESS_ROUTE_CONTAINER 25 +#define QDR_ROUTER_DELIVERIES_EGRESS_ROUTE_CONTAINER 26 +#define QDR_ROUTER_DELIVERIES_REDIRECTED 27 const char *qdr_router_columns[] = @@ -61,6 +62,7 @@ const char *qdr_router_columns[] = "mode", "area", "version", + "metadata", "addrCount", "linkCount", "nodeCount", @@ -124,6 +126,13 @@ static void qdr_agent_write_column_CT(qd_composed_field_t *body, int col, qdr_co qd_compose_insert_string(body, QPID_DISPATCH_VERSION); break; + case QDR_ROUTER_METADATA: + if (core->qd->metadata) + qd_compose_insert_string(body, core->qd->metadata); + else + qd_compose_insert_null(body); + break; + case QDR_ROUTER_ADDR_COUNT: qd_compose_insert_ulong(body, DEQ_SIZE(core->addrs)); break; diff --git a/src/router_core/agent_router.h b/src/router_core/agent_router.h index dc9c7ce..860bf7a 100644 --- a/src/router_core/agent_router.h +++ b/src/router_core/agent_router.h @@ -21,7 +21,7 @@ #include "router_core_private.h" -#define QDR_ROUTER_COLUMN_COUNT 27 +#define QDR_ROUTER_COLUMN_COUNT 28 const char *qdr_router_columns[QDR_ROUTER_COLUMN_COUNT + 1]; diff --git a/tests/system_tests_management.py b/tests/system_tests_management.py index f0a12b5..e554462 100644 --- a/tests/system_tests_management.py +++ b/tests/system_tests_management.py @@ -62,7 +62,7 @@ class ManagementTest(system_test.TestCase): super(ManagementTest, cls).setUpClass() # Stand-alone router conf0=Qdrouterd.Config([ - ('router', { 'mode': 'standalone', 'id': 'solo'}), + ('router', { 'mode': 'standalone', 'id': 'solo', 'metadata': 'selftest;solo'}), ('listener', {'name': 'l0', 'port':cls.get_port(), 'role':'normal'}), # Extra listeners to exercise managment query ('listener', {'name': 'l1', 'port':cls.get_port(), 'role':'normal'}), @@ -128,6 +128,13 @@ class ManagementTest(system_test.TestCase): self.assertRaises(NotImplementedStatus, self.node.call, self.node.request(operation="nosuch", type="org.amqp.management")) + def test_metadata(self): + """Query with type only""" + response = self.node.query(type=ROUTER) + for attr in ['type', 'metadata']: + self.assertTrue(attr in response.attribute_names) + self.assertEqual(response.get_entities()[0]['metadata'], 'selftest;solo') + def test_query_type(self): """Query with type only""" response = self.node.query(type=LISTENER) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org