initial EMANE 0.9.1 support
does not support event monitor or generating CommEffect events
This commit is contained in:
parent
1ab6be9625
commit
9ba3d29768
6 changed files with 205 additions and 67 deletions
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# CORE
|
# CORE
|
||||||
# Copyright (c)2010-2013 the Boeing Company.
|
# Copyright (c)2010-2014 the Boeing Company.
|
||||||
# See the LICENSE file included in this distribution.
|
# See the LICENSE file included in this distribution.
|
||||||
#
|
#
|
||||||
# authors: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
# authors: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
||||||
|
@ -12,8 +12,11 @@ commeffect.py: EMANE CommEffect model for CORE
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
|
try:
|
||||||
|
from emanesh.events import EventService
|
||||||
|
except:
|
||||||
|
pass
|
||||||
from core.api import coreapi
|
from core.api import coreapi
|
||||||
|
|
||||||
from core.constants import *
|
from core.constants import *
|
||||||
from emane import EmaneModel
|
from emane import EmaneModel
|
||||||
|
|
||||||
|
@ -30,20 +33,30 @@ class EmaneCommEffectModel(EmaneModel):
|
||||||
# model name
|
# model name
|
||||||
_name = "emane_commeffect"
|
_name = "emane_commeffect"
|
||||||
# CommEffect parameters
|
# CommEffect parameters
|
||||||
_confmatrix_shim = [
|
_confmatrix_shim_base = [
|
||||||
("defaultconnectivity", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
|
||||||
'On,Off', 'defaultconnectivity'),
|
|
||||||
("filterfile", coreapi.CONF_DATA_TYPE_STRING, '',
|
("filterfile", coreapi.CONF_DATA_TYPE_STRING, '',
|
||||||
'', 'filter file'),
|
'', 'filter file'),
|
||||||
("groupid", coreapi.CONF_DATA_TYPE_UINT32, '0',
|
("groupid", coreapi.CONF_DATA_TYPE_UINT32, '0',
|
||||||
'', 'NEM Group ID'),
|
'', 'NEM Group ID'),
|
||||||
("enablepromiscuousmode", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
("enablepromiscuousmode", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
'On,Off', 'enable promiscuous mode'),
|
'On,Off', 'enable promiscuous mode'),
|
||||||
("enabletighttimingmode", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
|
||||||
'On,Off', 'enable tight timing mode'),
|
|
||||||
("receivebufferperiod", coreapi.CONF_DATA_TYPE_FLOAT, '1.0',
|
("receivebufferperiod", coreapi.CONF_DATA_TYPE_FLOAT, '1.0',
|
||||||
'', 'receivebufferperiod'),
|
'', 'receivebufferperiod'),
|
||||||
]
|
]
|
||||||
|
_confmatrix_shim_081 = [
|
||||||
|
("defaultconnectivity", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
|
'On,Off', 'defaultconnectivity'),
|
||||||
|
("enabletighttimingmode", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
|
'On,Off', 'enable tight timing mode'),
|
||||||
|
]
|
||||||
|
_confmatrix_shim_091 = [
|
||||||
|
("defaultconnectivitymode", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
|
'On,Off', 'defaultconnectivity'),
|
||||||
|
]
|
||||||
|
if 'EventService' in globals():
|
||||||
|
_confmatrix_shim = _confmatrix_shim_base + _confmatrix_shim_091
|
||||||
|
else:
|
||||||
|
_confmatrix_shim = _confmatrix_shim_base + _confmatrix_shim_081
|
||||||
|
|
||||||
_confmatrix = _confmatrix_shim
|
_confmatrix = _confmatrix_shim
|
||||||
# value groupings
|
# value groupings
|
||||||
|
@ -90,6 +103,9 @@ class EmaneCommEffectModel(EmaneModel):
|
||||||
''' Generate CommEffect events when a Link Message is received having
|
''' Generate CommEffect events when a Link Message is received having
|
||||||
link parameters.
|
link parameters.
|
||||||
'''
|
'''
|
||||||
|
if self.session.emane.version == self.session.emane.EMANE091:
|
||||||
|
raise NotImplementedError, \
|
||||||
|
"CommEffect linkconfig() not implemented for EMANE 0.9.1+"
|
||||||
def z(x):
|
def z(x):
|
||||||
''' Helper to use 0 for None values. '''
|
''' Helper to use 0 for None values. '''
|
||||||
if type(x) is str:
|
if type(x) is str:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# CORE
|
# CORE
|
||||||
# Copyright (c)2010-2013 the Boeing Company.
|
# Copyright (c)2010-2014 the Boeing Company.
|
||||||
# See the LICENSE file included in this distribution.
|
# See the LICENSE file included in this distribution.
|
||||||
#
|
#
|
||||||
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
||||||
|
@ -19,11 +19,19 @@ from core.misc.xmlutils import addtextelementsfromtuples
|
||||||
from core.conf import ConfigurableManager, Configurable
|
from core.conf import ConfigurableManager, Configurable
|
||||||
from core.mobility import WirelessModel
|
from core.mobility import WirelessModel
|
||||||
from core.emane.nodes import EmaneNode
|
from core.emane.nodes import EmaneNode
|
||||||
|
# EMANE 0.7.4/0.8.1
|
||||||
try:
|
try:
|
||||||
import emaneeventservice
|
import emaneeventservice
|
||||||
import emaneeventlocation
|
import emaneeventlocation
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
pass
|
pass
|
||||||
|
# EMANE 0.9.1+
|
||||||
|
try:
|
||||||
|
from emanesh.events import EventService
|
||||||
|
from emanesh.events import LocationEvent
|
||||||
|
except Exception, e:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Emane(ConfigurableManager):
|
class Emane(ConfigurableManager):
|
||||||
''' EMANE controller object. Lives in a Session instance and is used for
|
''' EMANE controller object. Lives in a Session instance and is used for
|
||||||
|
@ -35,6 +43,8 @@ class Emane(ConfigurableManager):
|
||||||
_hwaddr_prefix = "02:02"
|
_hwaddr_prefix = "02:02"
|
||||||
(SUCCESS, NOT_NEEDED, NOT_READY) = (0, 1, 2)
|
(SUCCESS, NOT_NEEDED, NOT_READY) = (0, 1, 2)
|
||||||
EVENTCFGVAR = 'LIBEMANEEVENTSERVICECONFIG'
|
EVENTCFGVAR = 'LIBEMANEEVENTSERVICECONFIG'
|
||||||
|
# possible self.version values
|
||||||
|
(EMANE074, EMANE081, EMANE091) = (7, 8, 9)
|
||||||
|
|
||||||
def __init__(self, session):
|
def __init__(self, session):
|
||||||
ConfigurableManager.__init__(self, session)
|
ConfigurableManager.__init__(self, session)
|
||||||
|
@ -49,24 +59,28 @@ class Emane(ConfigurableManager):
|
||||||
8100)
|
8100)
|
||||||
self.transformport = self.session.getcfgitemint('emane_transform_port',
|
self.transformport = self.session.getcfgitemint('emane_transform_port',
|
||||||
8200)
|
8200)
|
||||||
|
self.doeventloop = False
|
||||||
|
self.eventmonthread = None
|
||||||
|
# detect between EMANE versions 0.7.4, 0.8.1, and 0.9.1+
|
||||||
|
# to be removed as support for older EMANEs is deprecated
|
||||||
|
self.version = self.EMANE081
|
||||||
|
try:
|
||||||
|
tmp = emaneeventlocation.EventLocation(1)
|
||||||
|
# check if yaw parameter is supported by Location Events
|
||||||
|
# if so, we have EMANE 0.8.1; if not, we have EMANE 0.7.4/earlier
|
||||||
|
tmp.set(0, 1, 2, 2, 2, 3)
|
||||||
|
except TypeError:
|
||||||
|
self.version = self.EMANE074
|
||||||
|
except Exception:
|
||||||
|
# e.g. no Python bindings installed
|
||||||
|
pass
|
||||||
|
if 'EventService' in globals():
|
||||||
|
self.version = self.EMANE091
|
||||||
# model for global EMANE configuration options
|
# model for global EMANE configuration options
|
||||||
self.emane_config = EmaneGlobalModel(session, None, self.verbose)
|
self.emane_config = EmaneGlobalModel(session, None, self.verbose)
|
||||||
session.broker.handlers += (self.handledistributed, )
|
session.broker.handlers += (self.handledistributed, )
|
||||||
self.loadmodels()
|
self.loadmodels()
|
||||||
self.initeventservice()
|
self.initeventservice()
|
||||||
self.doeventloop = False
|
|
||||||
self.eventmonthread = None
|
|
||||||
# EMANE 0.7.4 support -- to be removed when 0.7.4 support is deprecated
|
|
||||||
self.emane074 = False
|
|
||||||
try:
|
|
||||||
tmp = emaneeventlocation.EventLocation(1)
|
|
||||||
# check if yaw parameter is supported by Location Events
|
|
||||||
# if so, we have EMANE 0.8.1+; if not, we have EMANE 0.7.4/earlier
|
|
||||||
tmp.set(0, 1, 2, 2, 2, 3)
|
|
||||||
except TypeError:
|
|
||||||
self.emane074 = True
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def initeventservice(self, filename=None):
|
def initeventservice(self, filename=None):
|
||||||
''' (Re-)initialize the EMANE Event service. The multicast group and/or
|
''' (Re-)initialize the EMANE Event service. The multicast group and/or
|
||||||
|
@ -76,6 +90,24 @@ class Emane(ConfigurableManager):
|
||||||
if hasattr(self, 'service'):
|
if hasattr(self, 'service'):
|
||||||
del self.service
|
del self.service
|
||||||
self.service = None
|
self.service = None
|
||||||
|
# EMANE 0.9.1+ does not require event service XML config
|
||||||
|
if self.version == self.EMANE091:
|
||||||
|
values = self.getconfig(None, "emane",
|
||||||
|
self.emane_config.getdefaultvalues())[1]
|
||||||
|
group, port = self.emane_config.valueof('eventservicegroup',
|
||||||
|
values).split(':')
|
||||||
|
dev = self.emane_config.valueof('eventservicedevice', values)
|
||||||
|
otachannel = None
|
||||||
|
ota_enable = self.emane_config.valueof('otamanagerchannelenable',
|
||||||
|
values)
|
||||||
|
if self.emane_config.offontobool(ota_enable):
|
||||||
|
ogroup, oport = self.emane_config.valueof('otamanagergroup',
|
||||||
|
values).split(':')
|
||||||
|
odev = self.emane_config.valueof('otamanagerdevice', values)
|
||||||
|
otachannel = (ogroup, int(oport), odev)
|
||||||
|
self.service = EventService(eventchannel=(group, int(port), dev),
|
||||||
|
otachannel=otachannel)
|
||||||
|
return True
|
||||||
if filename is not None:
|
if filename is not None:
|
||||||
tmp = os.getenv(self.EVENTCFGVAR)
|
tmp = os.getenv(self.EVENTCFGVAR)
|
||||||
os.environ.update( {self.EVENTCFGVAR: filename} )
|
os.environ.update( {self.EVENTCFGVAR: filename} )
|
||||||
|
@ -427,6 +459,7 @@ class Emane(ConfigurableManager):
|
||||||
doc = self.xmldoc("platform")
|
doc = self.xmldoc("platform")
|
||||||
plat = doc.getElementsByTagName("platform").pop()
|
plat = doc.getElementsByTagName("platform").pop()
|
||||||
platformid = self.emane_config.valueof("platform_id_start", values)
|
platformid = self.emane_config.valueof("platform_id_start", values)
|
||||||
|
if self.version != self.EMANE091:
|
||||||
plat.setAttribute("name", "Platform %s" % platformid)
|
plat.setAttribute("name", "Platform %s" % platformid)
|
||||||
plat.setAttribute("id", platformid)
|
plat.setAttribute("id", platformid)
|
||||||
|
|
||||||
|
@ -667,6 +700,9 @@ class Emane(ConfigurableManager):
|
||||||
'''
|
'''
|
||||||
if self.service is None:
|
if self.service is None:
|
||||||
return
|
return
|
||||||
|
if self.version == self.EMANE091:
|
||||||
|
raise NotImplementedError, \
|
||||||
|
"EMANE eventmonitorloop() not implemented for EMANE 0.9"
|
||||||
self.info("subscribing to EMANE location events")
|
self.info("subscribing to EMANE location events")
|
||||||
#self.service.subscribe(emaneeventlocation.EVENT_ID,
|
#self.service.subscribe(emaneeventlocation.EVENT_ID,
|
||||||
# self.handlelocationevent)
|
# self.handlelocationevent)
|
||||||
|
@ -884,7 +920,7 @@ class EmaneGlobalModel(EmaneModel):
|
||||||
EmaneModel.__init__(self, session, objid, verbose)
|
EmaneModel.__init__(self, session, objid, verbose)
|
||||||
|
|
||||||
_name = "emane"
|
_name = "emane"
|
||||||
_confmatrix_platform = [
|
_confmatrix_platform_base = [
|
||||||
("otamanagerchannelenable", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
("otamanagerchannelenable", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
'on,off', 'enable OTA Manager channel'),
|
'on,off', 'enable OTA Manager channel'),
|
||||||
("otamanagergroup", coreapi.CONF_DATA_TYPE_STRING, '224.1.2.8:45702',
|
("otamanagergroup", coreapi.CONF_DATA_TYPE_STRING, '224.1.2.8:45702',
|
||||||
|
@ -897,11 +933,17 @@ class EmaneGlobalModel(EmaneModel):
|
||||||
'', 'Event Service device'),
|
'', 'Event Service device'),
|
||||||
("platform_id_start", coreapi.CONF_DATA_TYPE_INT32, '1',
|
("platform_id_start", coreapi.CONF_DATA_TYPE_INT32, '1',
|
||||||
'', 'starting Platform ID'),
|
'', 'starting Platform ID'),
|
||||||
|
]
|
||||||
|
_confmatrix_platform_081 = [
|
||||||
("debugportenable", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
("debugportenable", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
'on,off', 'enable debug port'),
|
'on,off', 'enable debug port'),
|
||||||
("debugport", coreapi.CONF_DATA_TYPE_UINT16, '47000',
|
("debugport", coreapi.CONF_DATA_TYPE_UINT16, '47000',
|
||||||
'', 'debug port number'),
|
'', 'debug port number'),
|
||||||
]
|
]
|
||||||
|
_confmatrix_platform_091 = [
|
||||||
|
("controlportendpoint", coreapi.CONF_DATA_TYPE_STRING, '0.0.0.0:47000',
|
||||||
|
'', 'Control port address'),
|
||||||
|
]
|
||||||
_confmatrix_nem = [
|
_confmatrix_nem = [
|
||||||
("transportendpoint", coreapi.CONF_DATA_TYPE_STRING, 'localhost',
|
("transportendpoint", coreapi.CONF_DATA_TYPE_STRING, 'localhost',
|
||||||
'', 'Transport endpoint address (port is automatic)'),
|
'', 'Transport endpoint address (port is automatic)'),
|
||||||
|
@ -910,6 +952,12 @@ class EmaneGlobalModel(EmaneModel):
|
||||||
("nem_id_start", coreapi.CONF_DATA_TYPE_INT32, '1',
|
("nem_id_start", coreapi.CONF_DATA_TYPE_INT32, '1',
|
||||||
'', 'starting NEM ID'),
|
'', 'starting NEM ID'),
|
||||||
]
|
]
|
||||||
|
if 'EventService' in globals():
|
||||||
|
_confmatrix_platform = _confmatrix_platform_base + \
|
||||||
|
_confmatrix_platform_091
|
||||||
|
else:
|
||||||
|
_confmatrix_platform = _confmatrix_platform_base + \
|
||||||
|
_confmatrix_platform_081
|
||||||
_confmatrix = _confmatrix_platform + _confmatrix_nem
|
_confmatrix = _confmatrix_platform + _confmatrix_nem
|
||||||
_confgroups = "Platform Attributes:1-%d|NEM Parameters:%d-%d" % \
|
_confgroups = "Platform Attributes:1-%d|NEM Parameters:%d-%d" % \
|
||||||
(len(_confmatrix_platform), len(_confmatrix_platform) + 1,
|
(len(_confmatrix_platform), len(_confmatrix_platform) + 1,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# CORE
|
# CORE
|
||||||
# Copyright (c)2010-2013 the Boeing Company.
|
# Copyright (c)2010-2014 the Boeing Company.
|
||||||
# See the LICENSE file included in this distribution.
|
# See the LICENSE file included in this distribution.
|
||||||
#
|
#
|
||||||
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
||||||
|
@ -11,8 +11,11 @@ ieee80211abg.py: EMANE IEEE 802.11abg model for CORE
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
|
try:
|
||||||
|
from emanesh.events import EventService
|
||||||
|
except:
|
||||||
|
pass
|
||||||
from core.api import coreapi
|
from core.api import coreapi
|
||||||
|
|
||||||
from core.constants import *
|
from core.constants import *
|
||||||
from emane import EmaneModel
|
from emane import EmaneModel
|
||||||
from universal import EmaneUniversalModel
|
from universal import EmaneUniversalModel
|
||||||
|
@ -26,8 +29,13 @@ class EmaneIeee80211abgModel(EmaneModel):
|
||||||
_80211rates = '1 1 Mbps,2 2 Mbps,3 5.5 Mbps,4 11 Mbps,5 6 Mbps,' + \
|
_80211rates = '1 1 Mbps,2 2 Mbps,3 5.5 Mbps,4 11 Mbps,5 6 Mbps,' + \
|
||||||
'6 9 Mbps,7 12 Mbps,8 18 Mbps,9 24 Mbps,10 36 Mbps,11 48 Mbps,' + \
|
'6 9 Mbps,7 12 Mbps,8 18 Mbps,9 24 Mbps,10 36 Mbps,11 48 Mbps,' + \
|
||||||
'12 54 Mbps'
|
'12 54 Mbps'
|
||||||
|
if 'EventService' in globals():
|
||||||
|
xml_path = '/usr/share/emane/xml/models/mac/ieee80211abg'
|
||||||
|
else:
|
||||||
|
xml_path = "/usr/share/emane/models/ieee80211abg/xml"
|
||||||
|
|
||||||
# MAC parameters
|
# MAC parameters
|
||||||
_confmatrix_mac = [
|
_confmatrix_mac_base = [
|
||||||
("mode", coreapi.CONF_DATA_TYPE_UINT8, '0',
|
("mode", coreapi.CONF_DATA_TYPE_UINT8, '0',
|
||||||
'0 802.11b (DSSS only),1 802.11b (DSSS only),' + \
|
'0 802.11b (DSSS only),1 802.11b (DSSS only),' + \
|
||||||
'2 802.11a or g (OFDM),3 802.11b/g (DSSS and OFDM)', 'mode'),
|
'2 802.11a or g (OFDM),3 802.11b/g (DSSS and OFDM)', 'mode'),
|
||||||
|
@ -41,15 +49,17 @@ class EmaneIeee80211abgModel(EmaneModel):
|
||||||
'multicast rate (Mbps)'),
|
'multicast rate (Mbps)'),
|
||||||
("rtsthreshold", coreapi.CONF_DATA_TYPE_UINT16, '0',
|
("rtsthreshold", coreapi.CONF_DATA_TYPE_UINT16, '0',
|
||||||
'', 'RTS threshold (bytes)'),
|
'', 'RTS threshold (bytes)'),
|
||||||
("wmmenable", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
|
||||||
'On,Off', 'WiFi Multimedia (WMM)'),
|
|
||||||
("pcrcurveuri", coreapi.CONF_DATA_TYPE_STRING,
|
("pcrcurveuri", coreapi.CONF_DATA_TYPE_STRING,
|
||||||
'/usr/share/emane/models/ieee80211abg/xml/ieee80211pcr.xml',
|
'%s/ieee80211pcr.xml' % xml_path,
|
||||||
'', 'SINR/PCR curve file'),
|
'', 'SINR/PCR curve file'),
|
||||||
("flowcontrolenable", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
("flowcontrolenable", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
'On,Off', 'enable traffic flow control'),
|
'On,Off', 'enable traffic flow control'),
|
||||||
("flowcontroltokens", coreapi.CONF_DATA_TYPE_UINT16, '10',
|
("flowcontroltokens", coreapi.CONF_DATA_TYPE_UINT16, '10',
|
||||||
'', 'number of flow control tokens'),
|
'', 'number of flow control tokens'),
|
||||||
|
]
|
||||||
|
_confmatrix_mac_081 = [
|
||||||
|
("wmmenable", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
|
'On,Off', 'WiFi Multimedia (WMM)'),
|
||||||
("queuesize", coreapi.CONF_DATA_TYPE_STRING, '0:255 1:255 2:255 3:255',
|
("queuesize", coreapi.CONF_DATA_TYPE_STRING, '0:255 1:255 2:255 3:255',
|
||||||
'', 'queue size (0-4:size)'),
|
'', 'queue size (0-4:size)'),
|
||||||
("cwmin", coreapi.CONF_DATA_TYPE_STRING, '0:32 1:32 2:16 3:8',
|
("cwmin", coreapi.CONF_DATA_TYPE_STRING, '0:32 1:32 2:16 3:8',
|
||||||
|
@ -63,6 +73,11 @@ class EmaneIeee80211abgModel(EmaneModel):
|
||||||
("retrylimit", coreapi.CONF_DATA_TYPE_STRING, '0:3 1:3 2:3 3:3',
|
("retrylimit", coreapi.CONF_DATA_TYPE_STRING, '0:3 1:3 2:3 3:3',
|
||||||
'', 'retry limit (0-4:numretries)'),
|
'', 'retry limit (0-4:numretries)'),
|
||||||
]
|
]
|
||||||
|
_confmatrix_mac_091 = []
|
||||||
|
if 'EventService' in globals():
|
||||||
|
_confmatrix_mac = _confmatrix_mac_base + _confmatrix_mac_091
|
||||||
|
else:
|
||||||
|
_confmatrix_mac = _confmatrix_mac_base + _confmatrix_mac_081
|
||||||
# PHY parameters from Universal PHY
|
# PHY parameters from Universal PHY
|
||||||
_confmatrix_phy = EmaneUniversalModel._confmatrix
|
_confmatrix_phy = EmaneUniversalModel._confmatrix
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# CORE
|
# CORE
|
||||||
# Copyright (c)2010-2013 the Boeing Company.
|
# Copyright (c)2010-2014 the Boeing Company.
|
||||||
# See the LICENSE file included in this distribution.
|
# See the LICENSE file included in this distribution.
|
||||||
#
|
#
|
||||||
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
||||||
|
@ -15,6 +15,12 @@ import sys
|
||||||
|
|
||||||
from core.api import coreapi
|
from core.api import coreapi
|
||||||
from core.coreobj import PyCoreNet
|
from core.coreobj import PyCoreNet
|
||||||
|
try:
|
||||||
|
from emanesh.events import EventService
|
||||||
|
from emanesh.events import LocationEvent
|
||||||
|
except Exception, e:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import emaneeventservice
|
import emaneeventservice
|
||||||
import emaneeventlocation
|
import emaneeventlocation
|
||||||
|
@ -243,10 +249,17 @@ class EmaneNode(EmaneNet):
|
||||||
self.info("setnemposition %s (%s) x,y,z=(%d,%d,%s)"
|
self.info("setnemposition %s (%s) x,y,z=(%d,%d,%s)"
|
||||||
"(%.6f,%.6f,%.6f)" % \
|
"(%.6f,%.6f,%.6f)" % \
|
||||||
(ifname, nemid, x, y, z, lat, long, alt))
|
(ifname, nemid, x, y, z, lat, long, alt))
|
||||||
|
if self.session.emane.version == self.session.emane.EMANE091:
|
||||||
|
event = LocationEvent()
|
||||||
|
else:
|
||||||
event = emaneeventlocation.EventLocation(1)
|
event = emaneeventlocation.EventLocation(1)
|
||||||
# altitude must be an integer or warning is printed
|
# altitude must be an integer or warning is printed
|
||||||
# unused: yaw, pitch, roll, azimuth, elevation, velocity
|
# unused: yaw, pitch, roll, azimuth, elevation, velocity
|
||||||
alt = int(round(alt))
|
alt = int(round(alt))
|
||||||
|
if self.session.emane.version == self.session.emane.EMANE091:
|
||||||
|
event.append(nemid, latitude=lat, longitude=long, altitude=alt)
|
||||||
|
self.session.emane.service.publish(0, event)
|
||||||
|
else:
|
||||||
event.set(0, nemid, lat, long, alt)
|
event.set(0, nemid, lat, long, alt)
|
||||||
self.session.emane.service.publish(emaneeventlocation.EVENT_ID,
|
self.session.emane.service.publish(emaneeventlocation.EVENT_ID,
|
||||||
emaneeventservice.PLATFORMID_ANY,
|
emaneeventservice.PLATFORMID_ANY,
|
||||||
|
@ -266,6 +279,9 @@ class EmaneNode(EmaneNet):
|
||||||
self.info("position service not available")
|
self.info("position service not available")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if self.session.emane.version == self.session.emane.EMANE091:
|
||||||
|
event = LocationEvent()
|
||||||
|
else:
|
||||||
event = emaneeventlocation.EventLocation(len(moved_netifs))
|
event = emaneeventlocation.EventLocation(len(moved_netifs))
|
||||||
i = 0
|
i = 0
|
||||||
for netif in moved_netifs:
|
for netif in moved_netifs:
|
||||||
|
@ -282,9 +298,15 @@ class EmaneNode(EmaneNet):
|
||||||
(i, ifname, nemid, x, y, z, lat, long, alt))
|
(i, ifname, nemid, x, y, z, lat, long, alt))
|
||||||
# altitude must be an integer or warning is printed
|
# altitude must be an integer or warning is printed
|
||||||
alt = int(round(alt))
|
alt = int(round(alt))
|
||||||
|
if self.session.emane.version == self.session.emane.EMANE091:
|
||||||
|
event.append(nemid, latitude=lat, longitude=long, altitude=alt)
|
||||||
|
else:
|
||||||
event.set(i, nemid, lat, long, alt)
|
event.set(i, nemid, lat, long, alt)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
if self.session.emane.version == self.session.emane.EMANE091:
|
||||||
|
self.session.emane.service.publish(0, event)
|
||||||
|
else:
|
||||||
self.session.emane.service.publish(emaneeventlocation.EVENT_ID,
|
self.session.emane.service.publish(emaneeventlocation.EVENT_ID,
|
||||||
emaneeventservice.PLATFORMID_ANY,
|
emaneeventservice.PLATFORMID_ANY,
|
||||||
emaneeventservice.NEMID_ANY,
|
emaneeventservice.NEMID_ANY,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#
|
#
|
||||||
# CORE
|
# CORE
|
||||||
# Copyright (c)2010-2013 the Boeing Company.
|
# Copyright (c)2010-2014 the Boeing Company.
|
||||||
# See the LICENSE file included in this distribution.
|
# See the LICENSE file included in this distribution.
|
||||||
#
|
#
|
||||||
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
# authors: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
||||||
# author: Harry Bullen <hbullen@i-a-i.com>
|
# Harry Bullen <hbullen@i-a-i.com>
|
||||||
#
|
#
|
||||||
'''
|
'''
|
||||||
rfpipe.py: EMANE RF-PIPE model for CORE
|
rfpipe.py: EMANE RF-PIPE model for CORE
|
||||||
|
@ -12,8 +12,11 @@ rfpipe.py: EMANE RF-PIPE model for CORE
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
|
try:
|
||||||
|
from emanesh.events import EventService
|
||||||
|
except:
|
||||||
|
pass
|
||||||
from core.api import coreapi
|
from core.api import coreapi
|
||||||
|
|
||||||
from core.constants import *
|
from core.constants import *
|
||||||
from emane import EmaneModel
|
from emane import EmaneModel
|
||||||
from universal import EmaneUniversalModel
|
from universal import EmaneUniversalModel
|
||||||
|
@ -24,11 +27,15 @@ class EmaneRfPipeModel(EmaneModel):
|
||||||
|
|
||||||
# model name
|
# model name
|
||||||
_name = "emane_rfpipe"
|
_name = "emane_rfpipe"
|
||||||
|
if 'EventService' in globals():
|
||||||
|
xml_path = '/usr/share/emane/xml/models/mac/rfpipe'
|
||||||
|
else:
|
||||||
|
xml_path = "/usr/share/emane/models/rfpipe/xml"
|
||||||
|
|
||||||
# configuration parameters are
|
# configuration parameters are
|
||||||
# ( 'name', 'type', 'default', 'possible-value-list', 'caption')
|
# ( 'name', 'type', 'default', 'possible-value-list', 'caption')
|
||||||
# MAC parameters
|
# MAC parameters
|
||||||
_confmatrix_mac = [
|
_confmatrix_mac_base = [
|
||||||
("enablepromiscuousmode", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
("enablepromiscuousmode", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
'True,False', 'enable promiscuous mode'),
|
'True,False', 'enable promiscuous mode'),
|
||||||
("datarate", coreapi.CONF_DATA_TYPE_UINT32, '1M',
|
("datarate", coreapi.CONF_DATA_TYPE_UINT32, '1M',
|
||||||
|
@ -41,14 +48,21 @@ class EmaneRfPipeModel(EmaneModel):
|
||||||
'On,Off', 'enable traffic flow control'),
|
'On,Off', 'enable traffic flow control'),
|
||||||
("flowcontroltokens", coreapi.CONF_DATA_TYPE_UINT16, '10',
|
("flowcontroltokens", coreapi.CONF_DATA_TYPE_UINT16, '10',
|
||||||
'', 'number of flow control tokens'),
|
'', 'number of flow control tokens'),
|
||||||
("enabletighttiming", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
|
||||||
'On,Off', 'enable tight timing for pkt delay'),
|
|
||||||
("pcrcurveuri", coreapi.CONF_DATA_TYPE_STRING,
|
("pcrcurveuri", coreapi.CONF_DATA_TYPE_STRING,
|
||||||
'/usr/share/emane/models/rfpipe/xml/rfpipepcr.xml',
|
'%s/rfpipepcr.xml' % xml_path,
|
||||||
'', 'SINR/PCR curve file'),
|
'', 'SINR/PCR curve file'),
|
||||||
|
]
|
||||||
|
_confmatrix_mac_081 = [
|
||||||
("transmissioncontrolmap", coreapi.CONF_DATA_TYPE_STRING, '',
|
("transmissioncontrolmap", coreapi.CONF_DATA_TYPE_STRING, '',
|
||||||
'', 'tx control map (nem:rate:freq:tx_dBm)'),
|
'', 'tx control map (nem:rate:freq:tx_dBm)'),
|
||||||
|
("enabletighttiming", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
|
'On,Off', 'enable tight timing for pkt delay'),
|
||||||
]
|
]
|
||||||
|
_confmatrix_mac_091 = []
|
||||||
|
if 'EventService' in globals():
|
||||||
|
_confmatrix_mac = _confmatrix_mac_base + _confmatrix_mac_091
|
||||||
|
else:
|
||||||
|
_confmatrix_mac = _confmatrix_mac_base + _confmatrix_mac_081
|
||||||
|
|
||||||
# PHY parameters from Universal PHY
|
# PHY parameters from Universal PHY
|
||||||
_confmatrix_phy = EmaneUniversalModel._confmatrix
|
_confmatrix_phy = EmaneUniversalModel._confmatrix
|
||||||
|
@ -88,10 +102,11 @@ class EmaneRfPipeModel(EmaneModel):
|
||||||
mac = macdoc.getElementsByTagName("mac").pop()
|
mac = macdoc.getElementsByTagName("mac").pop()
|
||||||
mac.setAttribute("name", "RF-PIPE MAC")
|
mac.setAttribute("name", "RF-PIPE MAC")
|
||||||
mac.setAttribute("library", "rfpipemaclayer")
|
mac.setAttribute("library", "rfpipemaclayer")
|
||||||
if self.valueof("transmissioncontrolmap", values) is "":
|
if e.version != e.EMANE091 and \
|
||||||
|
self.valueof("transmissioncontrolmap", values) is "":
|
||||||
macnames.remove("transmissioncontrolmap")
|
macnames.remove("transmissioncontrolmap")
|
||||||
# EMANE 0.7.4 support
|
# EMANE 0.7.4 support
|
||||||
if e.emane074:
|
if e.version == e.EMANE074:
|
||||||
# convert datarate from bps to kbps
|
# convert datarate from bps to kbps
|
||||||
i = names.index('datarate')
|
i = names.index('datarate')
|
||||||
values = list(values)
|
values = list(values)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# CORE
|
# CORE
|
||||||
# Copyright (c)2010-2013 the Boeing Company.
|
# Copyright (c)2010-2014 the Boeing Company.
|
||||||
# See the LICENSE file included in this distribution.
|
# See the LICENSE file included in this distribution.
|
||||||
#
|
#
|
||||||
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
|
||||||
|
@ -12,8 +12,11 @@ used for the Universal PHY.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
|
try:
|
||||||
|
from emanesh.events import EventService
|
||||||
|
except:
|
||||||
|
pass
|
||||||
from core.api import coreapi
|
from core.api import coreapi
|
||||||
|
|
||||||
from core.constants import *
|
from core.constants import *
|
||||||
from emane import EmaneModel
|
from emane import EmaneModel
|
||||||
|
|
||||||
|
@ -29,7 +32,21 @@ class EmaneUniversalModel(EmaneModel):
|
||||||
_xmllibrary = "universalphylayer"
|
_xmllibrary = "universalphylayer"
|
||||||
|
|
||||||
# universal PHY parameters
|
# universal PHY parameters
|
||||||
_confmatrix = [
|
_confmatrix_base = [
|
||||||
|
("bandwidth", coreapi.CONF_DATA_TYPE_UINT64, '1M',
|
||||||
|
'', 'rf bandwidth (hz)'),
|
||||||
|
("frequency", coreapi.CONF_DATA_TYPE_UINT64, '2.347G',
|
||||||
|
'','frequency (Hz)'),
|
||||||
|
("frequencyofinterest", coreapi.CONF_DATA_TYPE_UINT64, '2.347G',
|
||||||
|
'','frequency of interest (Hz)'),
|
||||||
|
("subid", coreapi.CONF_DATA_TYPE_UINT16, '1',
|
||||||
|
'','subid'),
|
||||||
|
("systemnoisefigure", coreapi.CONF_DATA_TYPE_FLOAT, '4.0',
|
||||||
|
'','system noise figure (dB)'),
|
||||||
|
("txpower", coreapi.CONF_DATA_TYPE_FLOAT, '0.0',
|
||||||
|
'','transmit power (dBm)'),
|
||||||
|
]
|
||||||
|
_confmatrix_081 = [
|
||||||
("antennagain", coreapi.CONF_DATA_TYPE_FLOAT, '0.0',
|
("antennagain", coreapi.CONF_DATA_TYPE_FLOAT, '0.0',
|
||||||
'','antenna gain (dBi)'),
|
'','antenna gain (dBi)'),
|
||||||
("antennaazimuth", coreapi.CONF_DATA_TYPE_FLOAT, '0.0',
|
("antennaazimuth", coreapi.CONF_DATA_TYPE_FLOAT, '0.0',
|
||||||
|
@ -42,27 +59,31 @@ class EmaneUniversalModel(EmaneModel):
|
||||||
'','antenna profile manifest URI'),
|
'','antenna profile manifest URI'),
|
||||||
("antennaprofileenable", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
("antennaprofileenable", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
'On,Off','antenna profile mode'),
|
'On,Off','antenna profile mode'),
|
||||||
("bandwidth", coreapi.CONF_DATA_TYPE_UINT64, '1M',
|
|
||||||
'', 'rf bandwidth (hz)'),
|
|
||||||
("defaultconnectivitymode", coreapi.CONF_DATA_TYPE_BOOL, '1',
|
("defaultconnectivitymode", coreapi.CONF_DATA_TYPE_BOOL, '1',
|
||||||
'On,Off','default connectivity'),
|
'On,Off','default connectivity'),
|
||||||
("frequency", coreapi.CONF_DATA_TYPE_UINT64, '2.347G',
|
|
||||||
'','frequency (Hz)'),
|
|
||||||
("frequencyofinterest", coreapi.CONF_DATA_TYPE_UINT64, '2.347G',
|
|
||||||
'','frequency of interest (Hz)'),
|
|
||||||
("frequencyofinterestfilterenable", coreapi.CONF_DATA_TYPE_BOOL, '1',
|
("frequencyofinterestfilterenable", coreapi.CONF_DATA_TYPE_BOOL, '1',
|
||||||
'On,Off','frequency of interest filter enable'),
|
'On,Off','frequency of interest filter enable'),
|
||||||
("noiseprocessingmode", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
("noiseprocessingmode", coreapi.CONF_DATA_TYPE_BOOL, '0',
|
||||||
'On,Off','enable noise processing'),
|
'On,Off','enable noise processing'),
|
||||||
("pathlossmode", coreapi.CONF_DATA_TYPE_STRING, '2ray',
|
("pathlossmode", coreapi.CONF_DATA_TYPE_STRING, '2ray',
|
||||||
'pathloss,2ray,freespace','path loss mode'),
|
'pathloss,2ray,freespace','path loss mode'),
|
||||||
("subid", coreapi.CONF_DATA_TYPE_UINT16, '1',
|
|
||||||
'','subid'),
|
|
||||||
("systemnoisefigure", coreapi.CONF_DATA_TYPE_FLOAT, '4.0',
|
|
||||||
'','system noise figure (dB)'),
|
|
||||||
("txpower", coreapi.CONF_DATA_TYPE_FLOAT, '0.0',
|
|
||||||
'','transmit power (dBm)'),
|
|
||||||
]
|
]
|
||||||
|
_confmatrix_091 = [
|
||||||
|
("fixedantennagain", coreapi.CONF_DATA_TYPE_FLOAT, '0.0',
|
||||||
|
'','antenna gain (dBi)'),
|
||||||
|
("fixedantennagainenable", coreapi.CONF_DATA_TYPE_BOOL, '1',
|
||||||
|
'On,Off','enable fixed antenna gain'),
|
||||||
|
("noisemode", coreapi.CONF_DATA_TYPE_STRING, 'none',
|
||||||
|
'none,all,outofband','noise processing mode'),
|
||||||
|
("noisebinsize", coreapi.CONF_DATA_TYPE_UINT64, '20',
|
||||||
|
'','noise bin size in microseconds'),
|
||||||
|
("propagationmodel", coreapi.CONF_DATA_TYPE_STRING, '2ray',
|
||||||
|
'precomputed,2ray,freespace','path loss mode'),
|
||||||
|
]
|
||||||
|
if 'EventService' in globals():
|
||||||
|
_confmatrix = _confmatrix_base + _confmatrix_091
|
||||||
|
else:
|
||||||
|
_confmatrix = _confmatrix_base + _confmatrix_081
|
||||||
|
|
||||||
# old parameters
|
# old parameters
|
||||||
_confmatrix_ver074 = [
|
_confmatrix_ver074 = [
|
||||||
|
@ -87,9 +108,10 @@ class EmaneUniversalModel(EmaneModel):
|
||||||
phydoc = e.xmldoc("phy")
|
phydoc = e.xmldoc("phy")
|
||||||
phy = phydoc.getElementsByTagName("phy").pop()
|
phy = phydoc.getElementsByTagName("phy").pop()
|
||||||
phy.setAttribute("name", cls._xmlname)
|
phy.setAttribute("name", cls._xmlname)
|
||||||
|
if e.version != e.EMANE091:
|
||||||
phy.setAttribute("library", cls._xmllibrary)
|
phy.setAttribute("library", cls._xmllibrary)
|
||||||
# EMANE 0.7.4 suppport - to be removed when 0.7.4 support is deprecated
|
# EMANE 0.7.4 suppport - to be removed when 0.7.4 support is deprecated
|
||||||
if e.emane074:
|
if e.version == e.EMANE074:
|
||||||
names = mac.getnames()
|
names = mac.getnames()
|
||||||
values = list(values)
|
values = list(values)
|
||||||
phynames = list(phynames)
|
phynames = list(phynames)
|
||||||
|
|
Loading…
Add table
Reference in a new issue