Improve control framework id-update/test output

This commit is contained in:
Jon Siwek 2018-07-20 11:59:40 -05:00
parent d245513e0a
commit 6215d45f10
2 changed files with 19 additions and 4 deletions

View file

@ -126,14 +126,17 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string) &priority=
{ {
# Send all &redef'able consts to the peer. # Send all &redef'able consts to the peer.
local ids = configurable_ids(); local ids = configurable_ids();
local publish_count = 0;
for ( id in ids ) for ( id in ids )
{ {
local topic = fmt("%s/id/%s", Control::topic_prefix, id); local topic = fmt("%s/id/%s", Control::topic_prefix, id);
Broker::publish_id(topic, id);
if ( Broker::publish_id(topic, id) )
++publish_count;
} }
Reporter::info(fmt("Control framework sent %d IDs", |ids|)); Reporter::info(fmt("Control framework sent %d IDs", publish_count));
} }
send_control_request(); send_control_request();

View file

@ -1,7 +1,7 @@
# @TEST-SERIALIZE: comm # @TEST-SERIALIZE: comm
# #
# @TEST-EXEC: btest-bg-run controllee BROPATH=$BROPATH:.. bro %INPUT frameworks/control/controllee Broker::default_port=65531/tcp # @TEST-EXEC: btest-bg-run controllee BROPATH=$BROPATH:.. bro -Bbroker %INPUT frameworks/control/controllee Broker::default_port=65531/tcp
# @TEST-EXEC: btest-bg-run controller BROPATH=$BROPATH:.. bro %INPUT test-redef frameworks/control/controller Control::host=127.0.0.1 Control::host_port=65531/tcp Control::cmd=configuration_update # @TEST-EXEC: btest-bg-run controller BROPATH=$BROPATH:.. bro -Bbroker %INPUT test-redef frameworks/control/controller Control::host=127.0.0.1 Control::host_port=65531/tcp Control::cmd=configuration_update
# @TEST-EXEC: btest-bg-wait 10 # @TEST-EXEC: btest-bg-wait 10
# @TEST-EXEC: btest-diff controllee/.stdout # @TEST-EXEC: btest-diff controllee/.stdout
@ -18,14 +18,26 @@ redef test_var = "NEW VALUE (this should be printed out second)";
event bro_init() event bro_init()
{ {
print test_var; print test_var;
Reporter::info("handle bro_init");
} }
event bro_done() event bro_done()
{ {
print test_var; print test_var;
Reporter::info("handle bro_done");
} }
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string) event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
{ {
terminate(); terminate();
} }
event Control::configuration_update_request()
{
Reporter::info("handle Control::configuration_update_request");
}
event Control::configuration_update_response()
{
Reporter::info("handle Control::configuration_update_response");
}