daemon/core/emane/emane.py
def loadmodels(self):
        ''' dynamically load EMANE models that were specified in the config file
        '''
        self._modelclsmap.clear()
        self._modelclsmap[self.emane_config._name] = self.emane_config
        emane_models = self.session.getcfgitem('emane_models')
        if emane_models is None:
            return
        emane_models = emane_models.split(',')
        for model in emane_models:
            model = model.strip()
            try:
                modelfile = "%s" % model.lower()
                clsname = "Emane%sModel" % model
                importcmd = "from %s import %s" % (modelfile, clsname)
                exec(importcmd)
            except Exception, e:
                warntxt = "unable to load the EMANE model '%s'" % modelfile
                warntxt += " specified in the config file (%s)" % e
                self.session.exception(coreapi.CORE_EXCP_LEVEL_WARNING, "emane",
                                       None, warntxt)
                self.warn(warntxt)
                continue
            # record the model name to class name mapping
            # this should match clsname._name
            confname = "emane_%s" % model.lower()
            self._modelclsmap[confname] = eval(clsname)
            # each EmaneModel must have ModelName.configure() defined
            confmethod = eval("%s.configure_emane" % clsname)
            self.session.addconfobj(confname, coreapi.CORE_TLV_REG_WIRELESS,
                                    confmethod)
 dynamically load EMANE models that were specified in the config file
        
dynamically load EMANE models that were specified in the config file
dynamically load EMANE models that were specified in the config file
def loadmodels(self):
        self._modelclsmap.clear()
        self._modelclsmap[self.emane_config._name] = self.emane_config
        emane_models = self.session.getcfgitem('emane_models')
        if emane_models is None:
            return
        emane_models = emane_models.split(',')
        for model in emane_models:
            model = model.strip()
            try:
                modelfile = "%s" % model.lower()
                clsname = "Emane%sModel" % model
                importcmd = "from %s import %s" % (modelfile, clsname)
                exec(importcmd)
            except Exception, e:
                warntxt = "unable to load the EMANE model '%s'" % modelfile
                warntxt += " specified in the config file (%s)" % e
                self.session.exception(coreapi.CORE_EXCP_LEVEL_WARNING, "emane",
                                       None, warntxt)
                self.warn(warntxt)
                continue
            confname = "emane_%s" % model.lower()
            self._modelclsmap[confname] = eval(clsname)
            confmethod = eval("%s.configure_emane" % clsname)
            self.session.addconfobj(confname, coreapi.CORE_TLV_REG_WIRELESS,
                                    confmethod)
def loadmodels ( self ) : self . _modelclsmap . clear ( ) self . _modelclsmap [ self . emane_config . _name ] = self . emane_config emane_models = self . session . getcfgitem ( 'emane_models' ) if emane_models is None : return emane_models = emane_models . split ( ',' ) for model in emane_models : model = model . strip ( ) try : modelfile = "%s" % model . lower ( ) clsname = "Emane%sModel" % model importcmd = "from %s import %s" % ( modelfile , clsname ) exec ( importcmd ) except Exception , e : warntxt = "unable to load the EMANE model '%s'" % modelfile warntxt += " specified in the config file (%s)" % e self . session . exception ( coreapi . CORE_EXCP_LEVEL_WARNING , "emane" , None , warntxt ) self . warn ( warntxt ) continue confname = "emane_%s" % model . lower ( ) self . _modelclsmap [ confname ] = eval ( clsname ) confmethod = eval ( "%s.configure_emane" % clsname ) self . session . addconfobj ( confname , coreapi . CORE_TLV_REG_WIRELESS , confmethod )
dynamically load EMANE models that were specified in the config file
dynamically load EMANE models that were specified in the config file
''' dynamically load EMANE models that were specified in the config file
        ''' # record the model name to class name mapping # this should match clsname._name # each EmaneModel must have ModelName.configure() defined
self