updates to remove restriction for emane in general and emane 1.2.1, should support at leat 1.0.1 possibly further back and can run without emane again, updated gui to ask users to install emane when not preset on the emane models panel
This commit is contained in:
parent
8ed7f7c0ef
commit
ac2b64aaaf
5 changed files with 49 additions and 26 deletions
|
@ -9,7 +9,10 @@ from core.emane import emanemodel
|
||||||
try:
|
try:
|
||||||
from emane.events.commeffectevent import CommEffectEvent
|
from emane.events.commeffectevent import CommEffectEvent
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.info("emane 1.2.1 not found")
|
try:
|
||||||
|
from emanesh.events.commeffectevent import CommEffectEvent
|
||||||
|
except ImportError:
|
||||||
|
logger.warn("compatible emane python bindings not installed")
|
||||||
|
|
||||||
|
|
||||||
def convert_none(x):
|
def convert_none(x):
|
||||||
|
|
|
@ -34,7 +34,12 @@ try:
|
||||||
from emane.events import LocationEvent
|
from emane.events import LocationEvent
|
||||||
from emane.events.eventserviceexception import EventServiceException
|
from emane.events.eventserviceexception import EventServiceException
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.info("emane 1.2.1 not found")
|
try:
|
||||||
|
from emanesh.events import EventService
|
||||||
|
from emanesh.events import LocationEvent
|
||||||
|
from emanesh.events.eventserviceexception import EventServiceException
|
||||||
|
except ImportError:
|
||||||
|
logger.warn("compatible emane python bindings not installed")
|
||||||
|
|
||||||
EMANE_MODELS = [
|
EMANE_MODELS = [
|
||||||
EmaneRfPipeModel,
|
EmaneRfPipeModel,
|
||||||
|
@ -76,7 +81,7 @@ class EmaneManager(ConfigurableManager):
|
||||||
self.transformport = self.session.get_config_item_int("emane_transform_port", 8200)
|
self.transformport = self.session.get_config_item_int("emane_transform_port", 8200)
|
||||||
self.doeventloop = False
|
self.doeventloop = False
|
||||||
self.eventmonthread = None
|
self.eventmonthread = None
|
||||||
self.logversion()
|
|
||||||
# model for global EMANE configuration options
|
# model for global EMANE configuration options
|
||||||
self.emane_config = EmaneGlobalModel(session, None)
|
self.emane_config = EmaneGlobalModel(session, None)
|
||||||
session.broker.handlers.add(self.handledistributed)
|
session.broker.handlers.add(self.handledistributed)
|
||||||
|
@ -86,24 +91,28 @@ class EmaneManager(ConfigurableManager):
|
||||||
self.emane_config.name: self.emane_config
|
self.emane_config.name: self.emane_config
|
||||||
}
|
}
|
||||||
|
|
||||||
# load provided models
|
|
||||||
self.load_models(EMANE_MODELS)
|
|
||||||
|
|
||||||
# load custom models
|
|
||||||
custom_models_path = session.config.get("emane_models_dir")
|
|
||||||
if custom_models_path:
|
|
||||||
emane_models = utils.load_classes(custom_models_path, EmaneModel)
|
|
||||||
self.load_models(emane_models)
|
|
||||||
|
|
||||||
self.service = None
|
self.service = None
|
||||||
|
self.emane_check()
|
||||||
|
|
||||||
def logversion(self):
|
def emane_check(self):
|
||||||
"""
|
"""
|
||||||
Log the installed EMANE version.
|
Check if emane is installed and load models.
|
||||||
|
|
||||||
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
# check for emane
|
||||||
emane_version = utils.check_cmd(["emane", "--version"])
|
emane_version = utils.check_cmd(["emane", "--version"])
|
||||||
logger.info("using EMANE: %s", emane_version)
|
logger.info("using EMANE: %s", emane_version)
|
||||||
|
|
||||||
|
# load default emane models
|
||||||
|
self.load_models(EMANE_MODELS)
|
||||||
|
|
||||||
|
# load custom models
|
||||||
|
custom_models_path = self.session.config.get("emane_models_dir")
|
||||||
|
if custom_models_path:
|
||||||
|
emane_models = utils.load_classes(custom_models_path, EmaneModel)
|
||||||
|
self.load_models(emane_models)
|
||||||
except CoreCommandError:
|
except CoreCommandError:
|
||||||
logger.info("emane is not installed")
|
logger.info("emane is not installed")
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
from core import logger
|
from core import logger
|
||||||
from core.enumerations import ConfigDataTypes
|
from core.enumerations import ConfigDataTypes
|
||||||
|
|
||||||
|
manifest = None
|
||||||
try:
|
try:
|
||||||
from emane.shell import manifest
|
from emane.shell import manifest
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.info("emane 1.2.1 not found")
|
try:
|
||||||
|
from emanesh import manifest
|
||||||
|
except ImportError:
|
||||||
|
logger.warn("compatible emane python bindings not installed")
|
||||||
|
|
||||||
|
|
||||||
def _type_value(config_type):
|
def _type_value(config_type):
|
||||||
|
@ -77,6 +81,10 @@ def parse(manifest_path, defaults):
|
||||||
:rtype: list
|
:rtype: list
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# no results when emane bindings are not present
|
||||||
|
if not manifest:
|
||||||
|
return []
|
||||||
|
|
||||||
# load configuration file
|
# load configuration file
|
||||||
manifest_file = manifest.Manifest(manifest_path)
|
manifest_file = manifest.Manifest(manifest_path)
|
||||||
manifest_configurations = manifest_file.getAllConfiguration()
|
manifest_configurations = manifest_file.getAllConfiguration()
|
||||||
|
|
|
@ -15,7 +15,10 @@ from core.enumerations import RegisterTlvs
|
||||||
try:
|
try:
|
||||||
from emane.events import LocationEvent
|
from emane.events import LocationEvent
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.info("emane 1.2.1 not found")
|
try:
|
||||||
|
from emanesh.events import LocationEvent
|
||||||
|
except ImportError:
|
||||||
|
logger.warn("compatible emane python bindings not installed")
|
||||||
|
|
||||||
|
|
||||||
class EmaneNet(PyCoreNet):
|
class EmaneNet(PyCoreNet):
|
||||||
|
|
|
@ -528,7 +528,7 @@ proc wlanConfigDialogHelper { wi target apply } {
|
||||||
}
|
}
|
||||||
if { ! $have_emane_models } {
|
if { ! $have_emane_models } {
|
||||||
# show connection dialog box to indicate why there are no EMANE models
|
# show connection dialog box to indicate why there are no EMANE models
|
||||||
$mod.none configure -text "none - connection to CORE daemon required!" \
|
$mod.none configure -text "Please install EMANE" \
|
||||||
-width "45"
|
-width "45"
|
||||||
after 500 {
|
after 500 {
|
||||||
update ;# allow dialog layout, otherwise strange results
|
update ;# allow dialog layout, otherwise strange results
|
||||||
|
|
Loading…
Add table
Reference in a new issue