mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Improve some netcontrol unit tests
This commit is contained in:
parent
bf67076cdc
commit
d245513e0a
5 changed files with 50 additions and 7 deletions
4
CHANGES
4
CHANGES
|
@ -1,4 +1,8 @@
|
|||
|
||||
2.5-747 | 2018-07-18 09:51:13 -0500
|
||||
|
||||
* Improve some netcontrol unit tests (Jon Siwek, Corelight)
|
||||
|
||||
2.5-746 | 2018-07-17 17:51:13 -0500
|
||||
|
||||
* Improve an input framework unit test (Jon Siwek, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.5-746
|
||||
2.5-747
|
||||
|
|
|
@ -11,22 +11,35 @@
|
|||
@load base/frameworks/netcontrol
|
||||
|
||||
redef exit_only_after_terminate = T;
|
||||
global have_peer = F;
|
||||
global did_init = F;
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
suspend_processing();
|
||||
}
|
||||
|
||||
event NetControl::init()
|
||||
{
|
||||
suspend_processing();
|
||||
local netcontrol_acld = NetControl::create_acld(NetControl::AcldConfig($acld_host=127.0.0.1, $acld_port=Broker::default_port, $acld_topic="bro/event/netcontroltest"));
|
||||
NetControl::activate(netcontrol_acld, 0);
|
||||
}
|
||||
|
||||
event NetControl::init_done()
|
||||
{
|
||||
did_init = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
print "Broker peer added", endpoint$network;
|
||||
have_peer = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
|
|
|
@ -12,10 +12,16 @@
|
|||
@load base/frameworks/netcontrol
|
||||
|
||||
redef exit_only_after_terminate = T;
|
||||
global have_peer = F;
|
||||
global did_init = F;
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
suspend_processing();
|
||||
}
|
||||
|
||||
event NetControl::init()
|
||||
{
|
||||
suspend_processing();
|
||||
local netcontrol_acld = NetControl::create_acld(NetControl::AcldConfig($acld_host=127.0.0.1, $acld_port=Broker::default_port, $acld_topic="bro/event/netcontroltest"));
|
||||
NetControl::activate(netcontrol_acld, 0);
|
||||
}
|
||||
|
@ -23,10 +29,17 @@ event NetControl::init()
|
|||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
print "Broker peer added", endpoint$network;
|
||||
have_peer = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event NetControl::init_done()
|
||||
{
|
||||
did_init = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,22 +12,35 @@
|
|||
@load base/frameworks/netcontrol
|
||||
|
||||
redef exit_only_after_terminate = T;
|
||||
global have_peer = F;
|
||||
global did_init = F;
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
suspend_processing();
|
||||
}
|
||||
|
||||
event NetControl::init()
|
||||
{
|
||||
suspend_processing();
|
||||
local netcontrol_broker = NetControl::create_broker(NetControl::BrokerConfig($host=127.0.0.1, $bport=Broker::default_port, $topic="bro/event/netcontroltest"), T);
|
||||
NetControl::activate(netcontrol_broker, 0);
|
||||
}
|
||||
|
||||
event NetControl::init_done()
|
||||
{
|
||||
did_init = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
print "Broker peer added", endpoint$network;
|
||||
have_peer = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue