daemon/core/emane/emane.py
def startdaemons2(self):
        ''' Start one EMANE daemon per node having a radio.
            Add a control network even if the user has not configured one.
        '''
        if self.verbose:
            self.info("Emane.startdaemons()")
        loglevel = str(self.DEFAULT_LOG_LEVEL)
        cfgloglevel = self.session.getcfgitemint("emane_log_level")
        realtime = self.session.getcfgitembool("emane_realtime", True)
        if cfgloglevel:
            self.info("setting user-defined EMANE log level: %d" % cfgloglevel)
            loglevel = str(cfgloglevel)
        emanecmd = ["emane", "-d", "--logl", loglevel]
        if realtime:
            emanecmd += "-r",

        values = self.getconfig(None, "emane",
                                self.emane_config.getdefaultvalues())[1]
        otagroup, otaport = self.emane_config.valueof('otamanagergroup',
                                                      values).split(':')
        otadev = self.emane_config.valueof('otamanagerdevice', values)
        otanetidx = self.session.getctrlnetidx(otadev)

        eventgroup, eventport = self.emane_config.valueof('eventservicegroup',
                                                      values).split(':')
        eventdev = self.emane_config.valueof('eventservicedevice', values)
        eventservicenetidx = self.session.getctrlnetidx(eventdev)

        run_emane_on_host = False
        for node in self.getnodes():
            if hasattr(node, 'transport_type') and \
              node.transport_type == "raw":
                run_emane_on_host = True
                continue
            path = self.session.sessiondir
            n = node.objid
            
            # control network not yet started here
            self.session.addremovectrlif(node, 0, remove=False, conf_reqd=False)

            if otanetidx > 0:
                self.info("adding ota device ctrl%d" % otanetidx)
                self.session.addremovectrlif(node, otanetidx, remove=False, conf_reqd=False)
            
            if eventservicenetidx >= 0:
                self.info("adding event service device ctrl%d" % eventservicenetidx)
                self.session.addremovectrlif(node, eventservicenetidx, remove=False, conf_reqd=False)
            
            # multicast route is needed for OTA data 
            cmd = [IP_BIN, "route", "add", otagroup, "dev", otadev]
            #rc = node.cmd(cmd, wait=True)
            node.cmd(cmd, wait=True)
            # multicast route is also needed for event data if on control network
            if eventservicenetidx >= 0 and eventgroup != otagroup:
                cmd = [IP_BIN, "route", "add", eventgroup, "dev", eventdev]
                node.cmd(cmd, wait=True)

            try:
                cmd = emanecmd + ["-f", os.path.join(path, "emane%d.log" % n),
                                  os.path.join(path, "platform%d.xml" % n)]
                if self.verbose:
                    self.info("Emane.startdaemons2() running %s" % str(cmd))
                status = node.cmd(cmd, wait=True)
                if self.verbose:
                    self.info("Emane.startdaemons2() return code %d" % status)
            except Exception, e:
                errmsg = "error starting emane: %s" % e
                self.session.exception(coreapi.CORE_EXCP_LEVEL_FATAL, "emane",
                                       n, errmsg)
                self.info(errmsg)
        if not run_emane_on_host:
            return
        path = self.session.sessiondir
        try:
            emanecmd += ["-f", os.path.join(path, "emane.log")]
            cmd = emanecmd + [os.path.join(path, "platform.xml")]
            if self.verbose:
                self.info("Emane.startdaemons2() running %s" % str(cmd))
            subprocess.check_call(cmd, cwd=path)
        except Exception, e:
            errmsg = "error starting emane: %s" % e
            self.session.exception(coreapi.CORE_EXCP_LEVEL_FATAL, "emane",
                                   None, errmsg)
            self.info(errmsg)
 Start one EMANE daemon per node having a radio.
            Add a control network even if the user has not configured one.
        
Start one EMANE daemon per node having a radio.
Add a control network even if the user has not configured one.
Start one EMANE daemon per node having a radio . Add a control network even if the user has not configured one .
def startdaemons2(self):
        if self.verbose:
            self.info("Emane.startdaemons()")
        loglevel = str(self.DEFAULT_LOG_LEVEL)
        cfgloglevel = self.session.getcfgitemint("emane_log_level")
        realtime = self.session.getcfgitembool("emane_realtime", True)
        if cfgloglevel:
            self.info("setting user-defined EMANE log level: %d" % cfgloglevel)
            loglevel = str(cfgloglevel)
        emanecmd = ["emane", "-d", "--logl", loglevel]
        if realtime:
            emanecmd += "-r",
        values = self.getconfig(None, "emane",
                                self.emane_config.getdefaultvalues())[1]
        otagroup, otaport = self.emane_config.valueof('otamanagergroup',
                                                      values).split(':')
        otadev = self.emane_config.valueof('otamanagerdevice', values)
        otanetidx = self.session.getctrlnetidx(otadev)
        eventgroup, eventport = self.emane_config.valueof('eventservicegroup',
                                                      values).split(':')
        eventdev = self.emane_config.valueof('eventservicedevice', values)
        eventservicenetidx = self.session.getctrlnetidx(eventdev)
        run_emane_on_host = False
        for node in self.getnodes():
            if hasattr(node, 'transport_type') and \
              node.transport_type == "raw":
                run_emane_on_host = True
                continue
            path = self.session.sessiondir
            n = node.objid
            self.session.addremovectrlif(node, 0, remove=False, conf_reqd=False)
            if otanetidx > 0:
                self.info("adding ota device ctrl%d" % otanetidx)
                self.session.addremovectrlif(node, otanetidx, remove=False, conf_reqd=False)
            if eventservicenetidx >= 0:
                self.info("adding event service device ctrl%d" % eventservicenetidx)
                self.session.addremovectrlif(node, eventservicenetidx, remove=False, conf_reqd=False)
            cmd = [IP_BIN, "route", "add", otagroup, "dev", otadev]
            node.cmd(cmd, wait=True)
            if eventservicenetidx >= 0 and eventgroup != otagroup:
                cmd = [IP_BIN, "route", "add", eventgroup, "dev", eventdev]
                node.cmd(cmd, wait=True)
            try:
                cmd = emanecmd + ["-f", os.path.join(path, "emane%d.log" % n),
                                  os.path.join(path, "platform%d.xml" % n)]
                if self.verbose:
                    self.info("Emane.startdaemons2() running %s" % str(cmd))
                status = node.cmd(cmd, wait=True)
                if self.verbose:
                    self.info("Emane.startdaemons2() return code %d" % status)
            except Exception, e:
                errmsg = "error starting emane: %s" % e
                self.session.exception(coreapi.CORE_EXCP_LEVEL_FATAL, "emane",
                                       n, errmsg)
                self.info(errmsg)
        if not run_emane_on_host:
            return
        path = self.session.sessiondir
        try:
            emanecmd += ["-f", os.path.join(path, "emane.log")]
            cmd = emanecmd + [os.path.join(path, "platform.xml")]
            if self.verbose:
                self.info("Emane.startdaemons2() running %s" % str(cmd))
            subprocess.check_call(cmd, cwd=path)
        except Exception, e:
            errmsg = "error starting emane: %s" % e
            self.session.exception(coreapi.CORE_EXCP_LEVEL_FATAL, "emane",
                                   None, errmsg)
            self.info(errmsg)
def startdaemons2 ( self ) : if self . verbose : self . info ( "Emane.startdaemons()" ) loglevel = str ( self . DEFAULT_LOG_LEVEL ) cfgloglevel = self . session . getcfgitemint ( "emane_log_level" ) realtime = self . session . getcfgitembool ( "emane_realtime" , True ) if cfgloglevel : self . info ( "setting user-defined EMANE log level: %d" % cfgloglevel ) loglevel = str ( cfgloglevel ) emanecmd = [ "emane" , "-d" , "--logl" , loglevel ] if realtime : emanecmd += "-r" , values = self . getconfig ( None , "emane" , self . emane_config . getdefaultvalues ( ) ) [ 1 ] otagroup , otaport = self . emane_config . valueof ( 'otamanagergroup' , values ) . split ( ':' ) otadev = self . emane_config . valueof ( 'otamanagerdevice' , values ) otanetidx = self . session . getctrlnetidx ( otadev ) eventgroup , eventport = self . emane_config . valueof ( 'eventservicegroup' , values ) . split ( ':' ) eventdev = self . emane_config . valueof ( 'eventservicedevice' , values ) eventservicenetidx = self . session . getctrlnetidx ( eventdev ) run_emane_on_host = False for node in self . getnodes ( ) : if hasattr ( node , 'transport_type' ) and node . transport_type == "raw" : run_emane_on_host = True continue path = self . session . sessiondir n = node . objid self . session . addremovectrlif ( node , 0 , remove = False , conf_reqd = False ) if otanetidx > 0 : self . info ( "adding ota device ctrl%d" % otanetidx ) self . session . addremovectrlif ( node , otanetidx , remove = False , conf_reqd = False ) if eventservicenetidx >= 0 : self . info ( "adding event service device ctrl%d" % eventservicenetidx ) self . session . addremovectrlif ( node , eventservicenetidx , remove = False , conf_reqd = False ) cmd = [ IP_BIN , "route" , "add" , otagroup , "dev" , otadev ] node . cmd ( cmd , wait = True ) if eventservicenetidx >= 0 and eventgroup != otagroup : cmd = [ IP_BIN , "route" , "add" , eventgroup , "dev" , eventdev ] node . cmd ( cmd , wait = True ) try : cmd = emanecmd + [ "-f" , os . path . join ( path , "emane%d.log" % n ) , os . path . join ( path , "platform%d.xml" % n ) ] if self . verbose : self . info ( "Emane.startdaemons2() running %s" % str ( cmd ) ) status = node . cmd ( cmd , wait = True ) if self . verbose : self . info ( "Emane.startdaemons2() return code %d" % status ) except Exception , e : errmsg = "error starting emane: %s" % e self . session . exception ( coreapi . CORE_EXCP_LEVEL_FATAL , "emane" , n , errmsg ) self . info ( errmsg ) if not run_emane_on_host : return path = self . session . sessiondir try : emanecmd += [ "-f" , os . path . join ( path , "emane.log" ) ] cmd = emanecmd + [ os . path . join ( path , "platform.xml" ) ] if self . verbose : self . info ( "Emane.startdaemons2() running %s" % str ( cmd ) ) subprocess . check_call ( cmd , cwd = path ) except Exception , e : errmsg = "error starting emane: %s" % e self . session . exception ( coreapi . CORE_EXCP_LEVEL_FATAL , "emane" , None , errmsg ) self . info ( errmsg )
Start one EMANE daemon per node having a radio.
Start one EMANE daemon per node having a radio .
''' Start one EMANE daemon per node having a radio.
            Add a control network even if the user has not configured one.
        ''' # control network not yet started here # multicast route is needed for OTA data  #rc = node.cmd(cmd, wait=True) # multicast route is also needed for event data if on control network
self