diff --git a/scripts/policy/frameworks/control/controller.bro b/scripts/policy/frameworks/control/controller.bro index 1cf404ad15..4897005dfb 100644 --- a/scripts/policy/frameworks/control/controller.bro +++ b/scripts/policy/frameworks/control/controller.bro @@ -126,14 +126,17 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string) &priority= { # Send all &redef'able consts to the peer. local ids = configurable_ids(); + local publish_count = 0; for ( id in ids ) { 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(); diff --git a/testing/btest/scripts/base/frameworks/control/configuration_update.bro b/testing/btest/scripts/base/frameworks/control/configuration_update.bro index d3fef8e1b5..77badfcf2e 100644 --- a/testing/btest/scripts/base/frameworks/control/configuration_update.bro +++ b/testing/btest/scripts/base/frameworks/control/configuration_update.bro @@ -1,7 +1,7 @@ # @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 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 controllee BROPATH=$BROPATH:.. bro -Bbroker %INPUT frameworks/control/controllee Broker::default_port=65531/tcp +# @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-diff controllee/.stdout @@ -18,14 +18,26 @@ redef test_var = "NEW VALUE (this should be printed out second)"; event bro_init() { print test_var; + Reporter::info("handle bro_init"); } event bro_done() { print test_var; + Reporter::info("handle bro_done"); } event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string) { 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"); + }