[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging …
kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging … URL: https://github.com/apache/qpid-dispatch/pull/676#discussion_r377676750 ## File path: src/router_core/agent_connection.c ## @@ -563,47 +568,103 @@ void qdra_connection_update_CT(qdr_core_t *core, // Find the connection that the user connected on. This connection must have the correct policy rights which // will allow the user on this connection to terminate some other connection. qdr_connection_t *user_conn = _find_conn_CT(core, query->in_conn); +qd_parsed_field_t *trace_field = qd_parse_value_by_key(in_body, qdr_connection_columns[QDR_CONNECTION_ENABLE_PROTOCOL_TRACE]); +bool enable_protocol_trace = !!trace_field ? qd_parse_as_bool(trace_field) : false; + +qdr_connection_t *conn = 0; + +bool admin_status_bad_or_forbidden = false; + +if (admin_state) { + +if (!user_conn) { +// This is bad. The user connection (that was requesting that some +// other connection be dropped) is gone +query->status.description = "Parent connection no longer exists"; +qdra_connection_set_bad_request(query); +admin_status_bad_or_forbidden = true; +} +else { +if (!user_conn->policy_allow_admin_status_update) { +// +// Policy on the connection that is requesting that some other connection be deleted does not allow +// for the other connection to be deleted.Set the status to QD_AMQP_FORBIDDEN and just quit. +// +query->status = QD_AMQP_FORBIDDEN; +query->status.description = "You are not allowed to perform this operation."; +qd_compose_start_map(query->body); +qd_compose_end_map(query->body); +admin_status_bad_or_forbidden = true; + } +else if (admin_state) { //admin state and trace are the only fields that can be updated via the update management request for type connection. +if (identity) { +conn = qdr_connection_find_by_identity_CT(core, identity); Review comment: Same here - identity was checked above in line 562 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging …
kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging … URL: https://github.com/apache/qpid-dispatch/pull/676#discussion_r377676138 ## File path: src/router_core/agent_connection.c ## @@ -563,47 +568,103 @@ void qdra_connection_update_CT(qdr_core_t *core, // Find the connection that the user connected on. This connection must have the correct policy rights which // will allow the user on this connection to terminate some other connection. qdr_connection_t *user_conn = _find_conn_CT(core, query->in_conn); +qd_parsed_field_t *trace_field = qd_parse_value_by_key(in_body, qdr_connection_columns[QDR_CONNECTION_ENABLE_PROTOCOL_TRACE]); +bool enable_protocol_trace = !!trace_field ? qd_parse_as_bool(trace_field) : false; + +qdr_connection_t *conn = 0; + +bool admin_status_bad_or_forbidden = false; + +if (admin_state) { + +if (!user_conn) { +// This is bad. The user connection (that was requesting that some +// other connection be dropped) is gone +query->status.description = "Parent connection no longer exists"; +qdra_connection_set_bad_request(query); +admin_status_bad_or_forbidden = true; +} +else { +if (!user_conn->policy_allow_admin_status_update) { +// +// Policy on the connection that is requesting that some other connection be deleted does not allow +// for the other connection to be deleted.Set the status to QD_AMQP_FORBIDDEN and just quit. +// +query->status = QD_AMQP_FORBIDDEN; +query->status.description = "You are not allowed to perform this operation."; +qd_compose_start_map(query->body); +qd_compose_end_map(query->body); +admin_status_bad_or_forbidden = true; + } +else if (admin_state) { //admin state and trace are the only fields that can be updated via the update management request for type connection. Review comment: Isn't this always true since if (admin_state) is checked above on line 578? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging …
kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging … URL: https://github.com/apache/qpid-dispatch/pull/676#discussion_r377677295 ## File path: src/router_core/agent_connection.c ## @@ -563,47 +568,103 @@ void qdra_connection_update_CT(qdr_core_t *core, // Find the connection that the user connected on. This connection must have the correct policy rights which // will allow the user on this connection to terminate some other connection. qdr_connection_t *user_conn = _find_conn_CT(core, query->in_conn); +qd_parsed_field_t *trace_field = qd_parse_value_by_key(in_body, qdr_connection_columns[QDR_CONNECTION_ENABLE_PROTOCOL_TRACE]); +bool enable_protocol_trace = !!trace_field ? qd_parse_as_bool(trace_field) : false; + +qdr_connection_t *conn = 0; + +bool admin_status_bad_or_forbidden = false; + +if (admin_state) { + +if (!user_conn) { +// This is bad. The user connection (that was requesting that some +// other connection be dropped) is gone +query->status.description = "Parent connection no longer exists"; +qdra_connection_set_bad_request(query); +admin_status_bad_or_forbidden = true; +} +else { +if (!user_conn->policy_allow_admin_status_update) { +// +// Policy on the connection that is requesting that some other connection be deleted does not allow +// for the other connection to be deleted.Set the status to QD_AMQP_FORBIDDEN and just quit. +// +query->status = QD_AMQP_FORBIDDEN; +query->status.description = "You are not allowed to perform this operation."; +qd_compose_start_map(query->body); +qd_compose_end_map(query->body); +admin_status_bad_or_forbidden = true; + } +else if (admin_state) { //admin state and trace are the only fields that can be updated via the update management request for type connection. +if (identity) { +conn = qdr_connection_find_by_identity_CT(core, identity); +qdra_connection_update_set_status(core, query, conn, admin_state); +} +else { +qdra_connection_set_bad_request(query); +admin_status_bad_or_forbidden = true; +} +} +else { +qdra_connection_set_bad_request(query); +admin_status_bad_or_forbidden = true; +} +} +} + +if (admin_status_bad_or_forbidden) { +// +// Enqueue the response and return +// +qdr_agent_enqueue_response_CT(core, query); +return; +} -if (!user_conn) { -// This is bad. The user connection (that was requesting that some -// other connection be dropped) is gone -query->status.description = "Parent connection no longer exists"; +// +// The only two fields that can be updated on a connection is the enableProtocolTrace flag and the admin state. +// If both these fields are not there, this is a bad request +// For example, this qdmanage is a bad request - qdmanage update --type=connection identity=1 +// +if (!trace_field && !admin_state) { Review comment: why not check this first? You've already checked admin_state above so this really is confusing. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging …
kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging … URL: https://github.com/apache/qpid-dispatch/pull/676#discussion_r377667238 ## File path: tests/system_tests_log_level_update.py ## @@ -120,6 +123,189 @@ def test_turn_on_protocol_trace(self): self.assertTrue(num_attaches == 0) +class EnableConnectionLevelInterRouterTraceTest(TestCase): + +inter_router_port = None + +@classmethod +def setUpClass(cls): +"""Start a router and a messenger""" Review comment: Stale comment? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging …
kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging … URL: https://github.com/apache/qpid-dispatch/pull/676#discussion_r377662447 ## File path: src/router_core/router_core_private.h ## @@ -681,6 +684,7 @@ struct qdr_connection_t { boolclosed; // This bit is used in the case where a client is trying to force close this connection. uint32_tconn_uptime; // Timestamp which can be used to calculate the number of seconds this connection has been up and running. uint32_tlast_delivery_time; // Timestamp which can be used to calculate the number of seconds since the last delivery arrived on this connection. +boolenable_protocol_trace; // Has trace level logging been turned on for this connecvtion. Review comment: "connecvtion"? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging …
kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging … URL: https://github.com/apache/qpid-dispatch/pull/676#discussion_r377654544 ## File path: python/qpid_dispatch/management/client.py ## @@ -76,6 +76,16 @@ def delete(self): class Node(object): """Client proxy for an AMQP management node""" +def clean_attrs(self, attrs): +BOOL_VALUES = {"yes": 1, "true": 1, "on": 1, "no": 0, "false": 0, + "off": 0} +if isinstance(attrs, dict): +for key in attrs.keys(): +if attrs[key] in BOOL_VALUES.keys(): +attrs[key] = bool(BOOL_VALUES[attrs[key]]) Review comment: Instead of putting 1 or 0 as the values for BOOL_VALUES, why not use the python bools True and False? Then you don't need to cast to bool() This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging …
kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging … URL: https://github.com/apache/qpid-dispatch/pull/676#discussion_r377677601 ## File path: src/router_core/agent_connection.c ## @@ -563,47 +568,103 @@ void qdra_connection_update_CT(qdr_core_t *core, // Find the connection that the user connected on. This connection must have the correct policy rights which // will allow the user on this connection to terminate some other connection. qdr_connection_t *user_conn = _find_conn_CT(core, query->in_conn); +qd_parsed_field_t *trace_field = qd_parse_value_by_key(in_body, qdr_connection_columns[QDR_CONNECTION_ENABLE_PROTOCOL_TRACE]); +bool enable_protocol_trace = !!trace_field ? qd_parse_as_bool(trace_field) : false; + +qdr_connection_t *conn = 0; + +bool admin_status_bad_or_forbidden = false; + +if (admin_state) { + +if (!user_conn) { +// This is bad. The user connection (that was requesting that some +// other connection be dropped) is gone +query->status.description = "Parent connection no longer exists"; +qdra_connection_set_bad_request(query); +admin_status_bad_or_forbidden = true; +} +else { +if (!user_conn->policy_allow_admin_status_update) { +// +// Policy on the connection that is requesting that some other connection be deleted does not allow +// for the other connection to be deleted.Set the status to QD_AMQP_FORBIDDEN and just quit. +// +query->status = QD_AMQP_FORBIDDEN; +query->status.description = "You are not allowed to perform this operation."; +qd_compose_start_map(query->body); +qd_compose_end_map(query->body); +admin_status_bad_or_forbidden = true; + } +else if (admin_state) { //admin state and trace are the only fields that can be updated via the update management request for type connection. +if (identity) { +conn = qdr_connection_find_by_identity_CT(core, identity); +qdra_connection_update_set_status(core, query, conn, admin_state); +} +else { +qdra_connection_set_bad_request(query); +admin_status_bad_or_forbidden = true; +} +} +else { +qdra_connection_set_bad_request(query); +admin_status_bad_or_forbidden = true; +} +} +} + +if (admin_status_bad_or_forbidden) { +// +// Enqueue the response and return +// +qdr_agent_enqueue_response_CT(core, query); +return; +} -if (!user_conn) { -// This is bad. The user connection (that was requesting that some -// other connection be dropped) is gone -query->status.description = "Parent connection no longer exists"; +// +// The only two fields that can be updated on a connection is the enableProtocolTrace flag and the admin state. +// If both these fields are not there, this is a bad request +// For example, this qdmanage is a bad request - qdmanage update --type=connection identity=1 +// +if (!trace_field && !admin_state) { qdra_connection_set_bad_request(query); +qdr_agent_enqueue_response_CT(core, query); +return; } -else { -if (!user_conn->policy_allow_admin_status_update) { +if (!conn) { +if (identity) { Review comment: again, already checked above. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging …
kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging … URL: https://github.com/apache/qpid-dispatch/pull/676#discussion_r377663839 ## File path: tests/system_tests_log_level_update.py ## @@ -120,6 +123,189 @@ def test_turn_on_protocol_trace(self): self.assertTrue(num_attaches == 0) +class EnableConnectionLevelInterRouterTraceTest(TestCase): + +inter_router_port = None + +@classmethod +def setUpClass(cls): +"""Start a router and a messenger""" +super(EnableConnectionLevelInterRouterTraceTest, cls).setUpClass() + +def router(name, connection): + +config = [ +# Use the deprecated attributes helloInterval, raInterval, raIntervalFlux, remoteLsMaxAge Review comment: Huh? This comment seems like a cut&paste artifact. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging …
kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging … URL: https://github.com/apache/qpid-dispatch/pull/676#discussion_r377660322 ## File path: python/qpid_dispatch/management/qdrouter.json ## @@ -1750,6 +1750,12 @@ "description": "Indicates whether the connection content is encrypted.", "type": "boolean" }, +"enableProtocolTrace": { +"description": "Indicates whether protocol level amqp frame trace logging is turned on or off for this connection.", +"type": "boolean", +"create": false, +"default": false +}, Review comment: Should this include "update": true? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging …
kgiusti commented on a change in pull request #676: DISPATCH-1518: Added ability to turn on protocol frame trace logging … URL: https://github.com/apache/qpid-dispatch/pull/676#discussion_r377655039 ## File path: python/qpid_dispatch/management/client.py ## @@ -76,6 +76,16 @@ def delete(self): class Node(object): """Client proxy for an AMQP management node""" +def clean_attrs(self, attrs): +BOOL_VALUES = {"yes": 1, "true": 1, "on": 1, "no": 0, "false": 0, Review comment: What about case? Is 'Yes' true or only 'yes'? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org