daemon/core/emane/emane.py
def initeventservice(self, filename=None, shutdown=False):
        ''' (Re-)initialize the EMANE Event service.
            The multicast group and/or port may be configured.
            - For versions < 0.9.1 this can be changed via XML config file
              and an environment variable pointing to that file.
            - For version >= 0.9.1 this is passed into the EventService
              constructor.
        '''
        if hasattr(self, 'service'):
            del self.service
        self.service = None

        # EMANE 0.9.1+ does not require event service XML config
        if self.version >= self.EMANE091:
            if shutdown:
                return
            #Get the control network to be used for events
            values = self.getconfig(None, "emane",
                                    self.emane_config.getdefaultvalues())[1]
            group, port = self.emane_config.valueof('eventservicegroup', values).split(':')
            eventdev = self.emane_config.valueof('eventservicedevice', values)
            eventnetidx = self.session.getctrlnetidx(eventdev)
            if self.version > self.EMANE091:
                if eventnetidx < 0:
                    msg = "Invalid Event Service device provided: %s" % eventdev
                    self.session.exception(coreapi.CORE_EXCP_LEVEL_ERROR,
                                           "Emane.initeventservice()", None, msg)
                    self.info(msg)
                    return False
            
               # Make sure the event control network is in place
                eventnet = self.session.addremovectrlnet(netidx=eventnetidx,
                                                         remove=False,
                                                         conf_reqd=False)
                if eventnet is not None:
                    # direct EMANE events towards control net bridge
                    eventdev = eventnet.brname
            eventchannel = (group, int(port), eventdev) 


            # disabled otachannel for event service
            # only needed for e.g. antennaprofile events xmit by models
            self.info("Using %s for event service traffic" % eventdev)
            try:
                self.service = EventService(eventchannel=eventchannel,
                                            otachannel=None)
            except Exception, e:
                msg = "Error instantiating EMANE event service: %s" % e
                self.session.exception(coreapi.CORE_EXCP_LEVEL_ERROR,
                               "Emane.initeventservice()", None, msg)
            return True
        if filename is not None:
            tmp = os.getenv(self.EVENTCFGVAR)
            os.environ.update( {self.EVENTCFGVAR: filename} )
        rc = True
        try:
            self.service = emaneeventservice.EventService()
        except:
            self.service = None
            rc = False
        if filename is not None:
            os.environ.pop(self.EVENTCFGVAR)
            if tmp is not None:
                os.environ.update( {self.EVENTCFGVAR: tmp} )
        return rc
 (Re-)initialize the EMANE Event service.
            The multicast group and/or port may be configured.
            - For versions < 0.9.1 this can be changed via XML config file
              and an environment variable pointing to that file.
            - For version >= 0.9.1 this is passed into the EventService
              constructor.
        
(Re-)initialize the EMANE Event service.
The multicast group and/or port may be configured.
For versions < 0.9.1 this can be changed via XML config file
and an environment variable pointing to that file.
For version >= 0.9.1 this is passed into the EventService
constructor.
( Re - ) initialize the EMANE Event service . The multicast group and / or port may be configured . For versions < 0 . 9 . 1 this can be changed via XML config file and an environment variable pointing to that file . For version > = 0 . 9 . 1 this is passed into the EventService constructor .
def initeventservice(self, filename=None, shutdown=False):
        if hasattr(self, 'service'):
            del self.service
        self.service = None
        if self.version >= self.EMANE091:
            if shutdown:
                return
            values = self.getconfig(None, "emane",
                                    self.emane_config.getdefaultvalues())[1]
            group, port = self.emane_config.valueof('eventservicegroup', values).split(':')
            eventdev = self.emane_config.valueof('eventservicedevice', values)
            eventnetidx = self.session.getctrlnetidx(eventdev)
            if self.version > self.EMANE091:
                if eventnetidx < 0:
                    msg = "Invalid Event Service device provided: %s" % eventdev
                    self.session.exception(coreapi.CORE_EXCP_LEVEL_ERROR,
                                           "Emane.initeventservice()", None, msg)
                    self.info(msg)
                    return False
                eventnet = self.session.addremovectrlnet(netidx=eventnetidx,
                                                         remove=False,
                                                         conf_reqd=False)
                if eventnet is not None:
                    eventdev = eventnet.brname
            eventchannel = (group, int(port), eventdev) 
            self.info("Using %s for event service traffic" % eventdev)
            try:
                self.service = EventService(eventchannel=eventchannel,
                                            otachannel=None)
            except Exception, e:
                msg = "Error instantiating EMANE event service: %s" % e
                self.session.exception(coreapi.CORE_EXCP_LEVEL_ERROR,
                               "Emane.initeventservice()", None, msg)
            return True
        if filename is not None:
            tmp = os.getenv(self.EVENTCFGVAR)
            os.environ.update( {self.EVENTCFGVAR: filename} )
        rc = True
        try:
            self.service = emaneeventservice.EventService()
        except:
            self.service = None
            rc = False
        if filename is not None:
            os.environ.pop(self.EVENTCFGVAR)
            if tmp is not None:
                os.environ.update( {self.EVENTCFGVAR: tmp} )
        return rc
def initeventservice ( self , filename = None , shutdown = False ) : if hasattr ( self , 'service' ) : del self . service self . service = None if self . version >= self . EMANE091 : if shutdown : return values = self . getconfig ( None , "emane" , self . emane_config . getdefaultvalues ( ) ) [ 1 ] group , port = self . emane_config . valueof ( 'eventservicegroup' , values ) . split ( ':' ) eventdev = self . emane_config . valueof ( 'eventservicedevice' , values ) eventnetidx = self . session . getctrlnetidx ( eventdev ) if self . version > self . EMANE091 : if eventnetidx < 0 : msg = "Invalid Event Service device provided: %s" % eventdev self . session . exception ( coreapi . CORE_EXCP_LEVEL_ERROR , "Emane.initeventservice()" , None , msg ) self . info ( msg ) return False eventnet = self . session . addremovectrlnet ( netidx = eventnetidx , remove = False , conf_reqd = False ) if eventnet is not None : eventdev = eventnet . brname eventchannel = ( group , int ( port ) , eventdev ) self . info ( "Using %s for event service traffic" % eventdev ) try : self . service = EventService ( eventchannel = eventchannel , otachannel = None ) except Exception , e : msg = "Error instantiating EMANE event service: %s" % e self . session . exception ( coreapi . CORE_EXCP_LEVEL_ERROR , "Emane.initeventservice()" , None , msg ) return True if filename is not None : tmp = os . getenv ( self . EVENTCFGVAR ) os . environ . update ( { self . EVENTCFGVAR : filename } ) rc = True try : self . service = emaneeventservice . EventService ( ) except : self . service = None rc = False if filename is not None : os . environ . pop ( self . EVENTCFGVAR ) if tmp is not None : os . environ . update ( { self . EVENTCFGVAR : tmp } ) return rc
(Re-)initialize the EMANE Event service.
( Re - ) initialize the EMANE Event service .
''' (Re-)initialize the EMANE Event service.
            The multicast group and/or port may be configured.
            - For versions < 0.9.1 this can be changed via XML config file
              and an environment variable pointing to that file.
            - For version >= 0.9.1 this is passed into the EventService
              constructor.
        ''' # EMANE 0.9.1+ does not require event service XML config #Get the control network to be used for events # Make sure the event control network is in place # direct EMANE events towards control net bridge # disabled otachannel for event service # only needed for e.g. antennaprofile events xmit by models
self
filename
shutdown