mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +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
|
2.5-746 | 2018-07-17 17:51:13 -0500
|
||||||
|
|
||||||
* Improve an input framework unit test (Jon Siwek, Corelight)
|
* 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
|
@load base/frameworks/netcontrol
|
||||||
|
|
||||||
redef exit_only_after_terminate = T;
|
redef exit_only_after_terminate = T;
|
||||||
|
global have_peer = F;
|
||||||
|
global did_init = F;
|
||||||
|
|
||||||
|
event bro_init()
|
||||||
|
{
|
||||||
|
suspend_processing();
|
||||||
|
}
|
||||||
|
|
||||||
event NetControl::init()
|
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"));
|
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);
|
NetControl::activate(netcontrol_acld, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
event NetControl::init_done()
|
event NetControl::init_done()
|
||||||
{
|
{
|
||||||
continue_processing();
|
did_init = T;
|
||||||
|
|
||||||
|
if ( did_init && have_peer )
|
||||||
|
continue_processing();
|
||||||
}
|
}
|
||||||
|
|
||||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
{
|
{
|
||||||
print "Broker peer added", endpoint$network;
|
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)
|
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
|
|
|
@ -12,10 +12,16 @@
|
||||||
@load base/frameworks/netcontrol
|
@load base/frameworks/netcontrol
|
||||||
|
|
||||||
redef exit_only_after_terminate = T;
|
redef exit_only_after_terminate = T;
|
||||||
|
global have_peer = F;
|
||||||
|
global did_init = F;
|
||||||
|
|
||||||
|
event bro_init()
|
||||||
|
{
|
||||||
|
suspend_processing();
|
||||||
|
}
|
||||||
|
|
||||||
event NetControl::init()
|
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"));
|
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);
|
NetControl::activate(netcontrol_acld, 0);
|
||||||
}
|
}
|
||||||
|
@ -23,11 +29,18 @@ event NetControl::init()
|
||||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
{
|
{
|
||||||
print "Broker peer added", endpoint$network;
|
print "Broker peer added", endpoint$network;
|
||||||
|
have_peer = T;
|
||||||
|
|
||||||
|
if ( did_init && have_peer )
|
||||||
|
continue_processing();
|
||||||
}
|
}
|
||||||
|
|
||||||
event NetControl::init_done()
|
event NetControl::init_done()
|
||||||
{
|
{
|
||||||
continue_processing();
|
did_init = T;
|
||||||
|
|
||||||
|
if ( did_init && have_peer )
|
||||||
|
continue_processing();
|
||||||
}
|
}
|
||||||
|
|
||||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
|
|
|
@ -12,22 +12,35 @@
|
||||||
@load base/frameworks/netcontrol
|
@load base/frameworks/netcontrol
|
||||||
|
|
||||||
redef exit_only_after_terminate = T;
|
redef exit_only_after_terminate = T;
|
||||||
|
global have_peer = F;
|
||||||
|
global did_init = F;
|
||||||
|
|
||||||
|
event bro_init()
|
||||||
|
{
|
||||||
|
suspend_processing();
|
||||||
|
}
|
||||||
|
|
||||||
event NetControl::init()
|
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);
|
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);
|
NetControl::activate(netcontrol_broker, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
event NetControl::init_done()
|
event NetControl::init_done()
|
||||||
{
|
{
|
||||||
continue_processing();
|
did_init = T;
|
||||||
|
|
||||||
|
if ( did_init && have_peer )
|
||||||
|
continue_processing();
|
||||||
}
|
}
|
||||||
|
|
||||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
{
|
{
|
||||||
print "Broker peer added", endpoint$network;
|
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)
|
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue