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): def poststartup(self):
''' Retransmit location events now that all NEMs are active. ''' Retransmit location events now that all NEMs are active.
''' '''
if self.doeventmonitor(): if not self.genlocationevents():
return return
with self._objslock: with self._objslock:
for n in sorted(self._objs.keys()): for n in sorted(self._objs.keys()):
@ -999,6 +999,16 @@ class Emane(ConfigurableManager):
# generate the EMANE events when nodes are moved # generate the EMANE events when nodes are moved
return self.session.getcfgitembool('emane_event_monitor', False) 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): def starteventmonitor(self):
''' Start monitoring EMANE location events if configured to do so. ''' 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 EMANE daemons have been started, because that is their only chance
to bind to the TAPs. to bind to the TAPs.
''' '''
if not self.session.emane.doeventmonitor() and \ if self.session.emane.genlocationevents() and \
self.session.emane.service is None: self.session.emane.service is None:
warntxt = "unable to publish EMANE events because the eventservice " warntxt = "unable to publish EMANE events because the eventservice "
warntxt += "Python bindings failed to load" warntxt += "Python bindings failed to load"
@ -218,8 +218,7 @@ class EmaneNode(EmaneNet):
if do_netns and "virtual" in netif.transport_type.lower(): if do_netns and "virtual" in netif.transport_type.lower():
netif.install() netif.install()
netif.setaddrs() netif.setaddrs()
# if we are listening for EMANE events, don't generate them if not self.session.emane.genlocationevents():
if self.session.emane.doeventmonitor():
netif.poshook = None netif.poshook = None
continue continue
# at this point we register location handlers for generating # 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 configuration
emane_platform_port = 8101 emane_platform_port = 8101
emane_transform_port = 8201 emane_transform_port = 8201
emane_event_generate = True
emane_event_monitor = False emane_event_monitor = False
emane_models = RfPipe, Ieee80211abg, CommEffect, Bypass emane_models = RfPipe, Ieee80211abg, CommEffect, Bypass
# EMANE log level range [0,4] default: 2 # EMANE log level range [0,4] default: 2