daemon: Make generation of EMANE location events explicitly configurable.

This commit is contained in:
Tom Goff 2015-09-23 16:22:43 -04:00
parent 04e934c93c
commit 1c8c9ce6ea
3 changed files with 14 additions and 4 deletions

View file

@ -347,7 +347,7 @@ class Emane(ConfigurableManager):
def poststartup(self):
''' Retransmit location events now that all NEMs are active.
'''
if self.doeventmonitor():
if not self.genlocationevents():
return
with self._objslock:
for n in sorted(self._objs.keys()):
@ -999,6 +999,16 @@ class Emane(ConfigurableManager):
# generate the EMANE events when nodes are moved
return self.session.getcfgitembool('emane_event_monitor', False)
def genlocationevents(self):
''' Returns boolean whether or not EMANE events will be generated.
'''
# By default, CORE generates EMANE location events when nodes
# are moved; this can be explicitly disabled in core.conf
tmp = self.session.getcfgitembool('emane_event_generate')
if tmp is None:
tmp = not self.doeventmonitor()
return tmp
def starteventmonitor(self):
''' Start monitoring EMANE location events if configured to do so.
'''

View file

@ -207,7 +207,7 @@ class EmaneNode(EmaneNet):
EMANE daemons have been started, because that is their only chance
to bind to the TAPs.
'''
if not self.session.emane.doeventmonitor() and \
if self.session.emane.genlocationevents() and \
self.session.emane.service is None:
warntxt = "unable to publish EMANE events because the eventservice "
warntxt += "Python bindings failed to load"
@ -218,8 +218,7 @@ class EmaneNode(EmaneNet):
if do_netns and "virtual" in netif.transport_type.lower():
netif.install()
netif.setaddrs()
# if we are listening for EMANE events, don't generate them
if self.session.emane.doeventmonitor():
if not self.session.emane.genlocationevents():
netif.poshook = None
continue
# at this point we register location handlers for generating

View file

@ -55,6 +55,7 @@ quagga_sbin_search = "/usr/local/sbin /usr/sbin /usr/lib/quagga"
# EMANE configuration
emane_platform_port = 8101
emane_transform_port = 8201
emane_event_generate = True
emane_event_monitor = False
emane_models = RfPipe, Ieee80211abg, CommEffect, Bypass
# EMANE log level range [0,4] default: 2