whitespace only changes made by Ninja-IDE

(Boeing r1879)
This commit is contained in:
ahrenholz 2014-09-17 22:00:11 +00:00
parent c3a8fe1799
commit 3ca4cecd0b
5 changed files with 51 additions and 51 deletions

View file

@ -24,7 +24,7 @@ try:
import emaneeventservice import emaneeventservice
import emaneeventcommeffect import emaneeventcommeffect
except Exception, e: except Exception, e:
pass pass
class EmaneCommEffectModel(EmaneModel): class EmaneCommEffectModel(EmaneModel):
def __init__(self, session, objid = None, verbose = False): def __init__(self, session, objid = None, verbose = False):
@ -88,7 +88,7 @@ class EmaneCommEffectModel(EmaneModel):
# empty filterfile is not allowed # empty filterfile is not allowed
ff = self.valueof("filterfile", values) ff = self.valueof("filterfile", values)
if ff.strip() != '': if ff.strip() != '':
shim.appendChild(e.xmlparam(shimdoc, "filterfile", ff)) shim.appendChild(e.xmlparam(shimdoc, "filterfile", ff))
e.xmlwrite(shimdoc, self.shimxmlname(ifc)) e.xmlwrite(shimdoc, self.shimxmlname(ifc))
nemdoc = e.xmldoc("nem") nemdoc = e.xmldoc("nem")
@ -114,7 +114,7 @@ class EmaneCommEffectModel(EmaneModel):
return 0 return 0
else: else:
return int(x) return int(x)
service = self.session.emane.service service = self.session.emane.service
if service is None: if service is None:
self.session.warn("%s: EMANE event service unavailable" % \ self.session.warn("%s: EMANE event service unavailable" % \

View file

@ -166,7 +166,7 @@ class Emane(ConfigurableManager):
(obj.objid, obj) (obj.objid, obj)
self._objs[obj.objid] = obj self._objs[obj.objid] = obj
self._objslock.release() self._objslock.release()
def getmodels(self, n): def getmodels(self, n):
''' Used with XML export; see ConfigurableManager.getmodels() ''' Used with XML export; see ConfigurableManager.getmodels()
''' '''
@ -274,7 +274,7 @@ class Emane(ConfigurableManager):
self._objslock.release() self._objslock.release()
def handledistributed(self, msg): def handledistributed(self, msg):
''' Broker handler for processing CORE API messages as they are ''' Broker handler for processing CORE API messages as they are
received. This is used to snoop the Link add messages to get NEM received. This is used to snoop the Link add messages to get NEM
counts of NEMs that exist on other servers. counts of NEMs that exist on other servers.
''' '''
@ -410,7 +410,7 @@ class Emane(ConfigurableManager):
''' '''
for n in self._objs: for n in self._objs:
self.setnodemodel(n) self.setnodemodel(n)
def setnodemodel(self, n): def setnodemodel(self, n):
emanenode = self._objs[n] emanenode = self._objs[n]
if n not in self.configs: if n not in self.configs:
@ -443,7 +443,7 @@ class Emane(ConfigurableManager):
else: else:
emanenode = None emanenode = None
return (emanenode, netif) return (emanenode, netif)
def numnems(self): def numnems(self):
''' Return the number of NEMs emulated locally. ''' Return the number of NEMs emulated locally.
''' '''
@ -523,7 +523,7 @@ class Emane(ConfigurableManager):
cwd=self.session.sessiondir) cwd=self.session.sessiondir)
except Exception, e: except Exception, e:
self.info("error running emanegentransportxml: %s" % e) self.info("error running emanegentransportxml: %s" % e)
def buildeventservicexml(self): def buildeventservicexml(self):
''' Build the libemaneeventservice.xml file if event service options ''' Build the libemaneeventservice.xml file if event service options
were changed in the global config. were changed in the global config.
@ -535,7 +535,7 @@ class Emane(ConfigurableManager):
keys = ('eventservicegroup', 'eventservicedevice') keys = ('eventservicegroup', 'eventservicedevice')
for k in keys: for k in keys:
a = self.emane_config.valueof(k, defaults) a = self.emane_config.valueof(k, defaults)
b = self.emane_config.valueof(k, values) b = self.emane_config.valueof(k, values)
if a != b: if a != b:
need_xml = True need_xml = True
@ -594,7 +594,7 @@ class Emane(ConfigurableManager):
transcmd = ["emanetransportd", "-d", "--logl", loglevel, "-f", \ transcmd = ["emanetransportd", "-d", "--logl", loglevel, "-f", \
os.path.join(path, "emanetransportd.log")] os.path.join(path, "emanetransportd.log")]
if realtime: if realtime:
transcmd += "-r", transcmd += "-r",
files = os.listdir(path) files = os.listdir(path)
for file in files: for file in files:
if file[-3:] == "xml" and file[:15] == "transportdaemon": if file[-3:] == "xml" and file[:15] == "transportdaemon":
@ -626,7 +626,7 @@ class Emane(ConfigurableManager):
if self.verbose: if self.verbose:
self.info("Emane.installnetifs() for node %d" % n) self.info("Emane.installnetifs() for node %d" % n)
emanenode.installnetifs() emanenode.installnetifs()
def deinstallnetifs(self): def deinstallnetifs(self):
''' Uninstall TUN/TAP virtual interfaces. ''' Uninstall TUN/TAP virtual interfaces.
''' '''
@ -639,7 +639,7 @@ class Emane(ConfigurableManager):
''' '''
r = self.emane_config.configure_emane(session, msg) r = self.emane_config.configure_emane(session, msg)
# extra logic to start slave Emane object after nemid has been # extra logic to start slave Emane object after nemid has been
# configured from the master # configured from the master
conftype = msg.gettlv(coreapi.CORE_TLV_CONF_TYPE) conftype = msg.gettlv(coreapi.CORE_TLV_CONF_TYPE)
if conftype == coreapi.CONF_TYPE_FLAGS_UPDATE and \ if conftype == coreapi.CONF_TYPE_FLAGS_UPDATE and \
@ -660,7 +660,7 @@ class Emane(ConfigurableManager):
# this support must be explicitly turned on; by default, CORE will # this support must be explicitly turned on; by default, CORE will
# generate the EMANE events when nodes are moved # generate the EMANE events when nodes are moved
return self.session.getcfgitembool('emane_event_monitor', False) return self.session.getcfgitembool('emane_event_monitor', False)
def starteventmonitor(self): def starteventmonitor(self):
''' Start monitoring EMANE location events if configured to do so. ''' Start monitoring EMANE location events if configured to do so.
''' '''
@ -831,8 +831,8 @@ class EmaneModel(WirelessModel):
@classmethod @classmethod
def emane074_fixup(cls, value, div=1.0): def emane074_fixup(cls, value, div=1.0):
''' Helper for converting 0.8.1 and newer values to EMANE 0.7.4 ''' Helper for converting 0.8.1 and newer values to EMANE 0.7.4
compatible values. compatible values.
NOTE: This should be removed when support for 0.7.4 has been NOTE: This should be removed when support for 0.7.4 has been
deprecated. deprecated.
''' '''
@ -849,7 +849,7 @@ class EmaneModel(WirelessModel):
''' Build the necessary nem, mac, and phy XMLs in the given path. ''' Build the necessary nem, mac, and phy XMLs in the given path.
''' '''
raise NotImplementedError raise NotImplementedError
def buildplatformxmlnementry(self, doc, n, ifc): def buildplatformxmlnementry(self, doc, n, ifc):
''' Build the NEM definition that goes into the platform.xml file. ''' Build the NEM definition that goes into the platform.xml file.
This returns an XML element that will be added to the <platform/> element. This returns an XML element that will be added to the <platform/> element.
@ -922,10 +922,10 @@ class EmaneModel(WirelessModel):
''' Return the string name for the PHY XML file, e.g. 'n3rfpipephy.xml' ''' Return the string name for the PHY XML file, e.g. 'n3rfpipephy.xml'
''' '''
return "%sphy.xml" % self.basename(ifc) return "%sphy.xml" % self.basename(ifc)
def update(self, moved, moved_netifs): def update(self, moved, moved_netifs):
''' invoked from MobilityModel when nodes are moved; this causes ''' invoked from MobilityModel when nodes are moved; this causes
EMANE location events to be generated for the nodes in the moved EMANE location events to be generated for the nodes in the moved
list, making EmaneModels compatible with Ns2ScriptedMobility list, making EmaneModels compatible with Ns2ScriptedMobility
''' '''
try: try:
@ -933,7 +933,7 @@ class EmaneModel(WirelessModel):
except KeyError: except KeyError:
return return
wlan.setnempositions(moved_netifs) wlan.setnempositions(moved_netifs)
def linkconfig(self, netif, bw = None, delay = None, def linkconfig(self, netif, bw = None, delay = None,
loss = None, duplicate = None, jitter = None, netif2 = None): loss = None, duplicate = None, jitter = None, netif2 = None):
''' Invoked when a Link Message is received. Default is unimplemented. ''' Invoked when a Link Message is received. Default is unimplemented.
@ -941,7 +941,7 @@ class EmaneModel(WirelessModel):
warntxt = "EMANE model %s does not support link " % self._name warntxt = "EMANE model %s does not support link " % self._name
warntxt += "configuration, dropping Link Message" warntxt += "configuration, dropping Link Message"
self.session.warn(warntxt) self.session.warn(warntxt)
@staticmethod @staticmethod
def valuestrtoparamlist(dom, name, value): def valuestrtoparamlist(dom, name, value):
''' Helper to convert a parameter to a paramlist. ''' Helper to convert a parameter to a paramlist.
@ -966,24 +966,24 @@ class EmaneGlobalModel(EmaneModel):
_name = "emane" _name = "emane"
_confmatrix_platform_base = [ _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',
'', 'OTA Manager group'), '', 'OTA Manager group'),
("otamanagerdevice", coreapi.CONF_DATA_TYPE_STRING, 'lo', ("otamanagerdevice", coreapi.CONF_DATA_TYPE_STRING, 'lo',
'', 'OTA Manager device'), '', 'OTA Manager device'),
("eventservicegroup", coreapi.CONF_DATA_TYPE_STRING, '224.1.2.8:45703', ("eventservicegroup", coreapi.CONF_DATA_TYPE_STRING, '224.1.2.8:45703',
'', 'Event Service group'), '', 'Event Service group'),
("eventservicedevice", coreapi.CONF_DATA_TYPE_STRING, 'lo', ("eventservicedevice", coreapi.CONF_DATA_TYPE_STRING, 'lo',
'', '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 = [ _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 = [ _confmatrix_platform_091 = [
("controlportendpoint", coreapi.CONF_DATA_TYPE_STRING, '0.0.0.0:47000', ("controlportendpoint", coreapi.CONF_DATA_TYPE_STRING, '0.0.0.0:47000',
'', 'Control port address'), '', 'Control port address'),
@ -992,11 +992,11 @@ class EmaneGlobalModel(EmaneModel):
] ]
_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)'),
("platformendpoint", coreapi.CONF_DATA_TYPE_STRING, 'localhost', ("platformendpoint", coreapi.CONF_DATA_TYPE_STRING, 'localhost',
'', 'Platform endpoint address (port is automatic)'), '', 'Platform endpoint address (port is automatic)'),
("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(): if 'EventService' in globals():
_confmatrix_platform = _confmatrix_platform_base + \ _confmatrix_platform = _confmatrix_platform_base + \

View file

@ -6,7 +6,7 @@
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com> # author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
# #
''' '''
nodes.py: definition of an EmaneNode class for implementing configuration nodes.py: definition of an EmaneNode class for implementing configuration
control of an EMANE emulation. An EmaneNode has several attached NEMs that control of an EMANE emulation. An EmaneNode has several attached NEMs that
share the same MAC+PHY model. share the same MAC+PHY model.
''' '''
@ -27,7 +27,7 @@ try:
except Exception, e: except Exception, e:
''' Don't require all CORE users to have EMANE libeventservice and its ''' Don't require all CORE users to have EMANE libeventservice and its
Python bindings installed. Python bindings installed.
''' '''
pass pass
class EmaneNet(PyCoreNet): class EmaneNet(PyCoreNet):
@ -89,7 +89,7 @@ class EmaneNode(EmaneNet):
verbose=self.verbose, values=config) verbose=self.verbose, values=config)
def setnemid(self, netif, nemid): def setnemid(self, netif, nemid):
''' Record an interface to numerical ID mapping. The Emane controller ''' Record an interface to numerical ID mapping. The Emane controller
object manages and assigns these IDs for all NEMs. object manages and assigns these IDs for all NEMs.
''' '''
self.nemidmap[netif] = nemid self.nemidmap[netif] = nemid
@ -110,7 +110,7 @@ class EmaneNode(EmaneNet):
if self.nemidmap[netif] == nemid: if self.nemidmap[netif] == nemid:
return netif return netif
return None return None
def netifs(self, sort=True): def netifs(self, sort=True):
''' Retrieve list of linked interfaces sorted by node number. ''' Retrieve list of linked interfaces sorted by node number.
''' '''
@ -163,7 +163,7 @@ class EmaneNode(EmaneNet):
self.buildtransportxml(emane, vtype) self.buildtransportxml(emane, vtype)
if need_raw: if need_raw:
self.buildtransportxml(emane, rtype) self.buildtransportxml(emane, rtype)
def buildtransportxml(self, emane, type): def buildtransportxml(self, emane, type):
''' Write a transport XML file for the Virtual or Raw Transport. ''' Write a transport XML file for the Virtual or Raw Transport.
''' '''
@ -172,7 +172,7 @@ class EmaneNode(EmaneNet):
trans.setAttribute("name", "%s Transport" % type.capitalize()) trans.setAttribute("name", "%s Transport" % type.capitalize())
trans.setAttribute("library", "trans%s" % type.lower()) trans.setAttribute("library", "trans%s" % type.lower())
trans.appendChild(emane.xmlparam(transdoc, "bitrate", "0")) trans.appendChild(emane.xmlparam(transdoc, "bitrate", "0"))
flowcontrol = False flowcontrol = False
names = self.model.getnames() names = self.model.getnames()
values = emane.getconfig(self.objid, self.model._name, values = emane.getconfig(self.objid, self.model._name,
@ -181,7 +181,7 @@ class EmaneNode(EmaneNet):
i = names.index("flowcontrolenable") i = names.index("flowcontrolenable")
if self.model.booltooffon(values[i]) == "on": if self.model.booltooffon(values[i]) == "on":
flowcontrol = True flowcontrol = True
if "virtual" in type.lower(): if "virtual" in type.lower():
trans.appendChild(emane.xmlparam(transdoc, "devicepath", trans.appendChild(emane.xmlparam(transdoc, "devicepath",
"/dev/net/tun")) "/dev/net/tun"))
@ -189,9 +189,9 @@ class EmaneNode(EmaneNet):
trans.appendChild(emane.xmlparam(transdoc, "flowcontrolenable", trans.appendChild(emane.xmlparam(transdoc, "flowcontrolenable",
"on")) "on"))
emane.xmlwrite(transdoc, self.transportxmlname(type.lower())) emane.xmlwrite(transdoc, self.transportxmlname(type.lower()))
def transportxmlname(self, type): def transportxmlname(self, type):
''' Return the string name for the Transport XML file, ''' Return the string name for the Transport XML file,
e.g. 'n3transvirtual.xml' e.g. 'n3transvirtual.xml'
''' '''
return "n%strans%s.xml" % (self.objid, type) return "n%strans%s.xml" % (self.objid, type)
@ -221,9 +221,9 @@ class EmaneNode(EmaneNet):
netif.poshook = self.setnemposition netif.poshook = self.setnemposition
(x,y,z) = netif.node.position.get() (x,y,z) = netif.node.position.get()
self.setnemposition(netif, x, y, z) self.setnemposition(netif, x, y, z)
def deinstallnetifs(self): def deinstallnetifs(self):
''' Uninstall TAP devices. This invokes their shutdown method for ''' Uninstall TAP devices. This invokes their shutdown method for
any required cleanup; the device may be actually removed when any required cleanup; the device may be actually removed when
emanetransportd terminates. emanetransportd terminates.
''' '''
@ -266,7 +266,7 @@ class EmaneNode(EmaneNet):
emaneeventservice.NEMID_ANY, emaneeventservice.NEMID_ANY,
emaneeventservice.COMPONENTID_ANY, emaneeventservice.COMPONENTID_ANY,
event.export()) event.export())
def setnempositions(self, moved_netifs): def setnempositions(self, moved_netifs):
''' Several NEMs have moved, from e.g. a WaypointMobilityModel ''' Several NEMs have moved, from e.g. a WaypointMobilityModel
calculation. Generate an EMANE Location Event having several calculation. Generate an EMANE Location Event having several
@ -312,5 +312,5 @@ class EmaneNode(EmaneNet):
emaneeventservice.NEMID_ANY, emaneeventservice.NEMID_ANY,
emaneeventservice.COMPONENTID_ANY, emaneeventservice.COMPONENTID_ANY,
event.export()) event.export())

View file

@ -38,15 +38,15 @@ class EmaneRfPipeModel(EmaneModel):
_confmatrix_mac_base = [ _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',
'', 'data rate (bps)'), '', 'data rate (bps)'),
("jitter", coreapi.CONF_DATA_TYPE_FLOAT, '0.0', ("jitter", coreapi.CONF_DATA_TYPE_FLOAT, '0.0',
'', 'transmission jitter (usec)'), '', 'transmission jitter (usec)'),
("delay", coreapi.CONF_DATA_TYPE_FLOAT, '0.0', ("delay", coreapi.CONF_DATA_TYPE_FLOAT, '0.0',
'', 'transmission delay (usec)'), '', 'transmission delay (usec)'),
("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'),
("pcrcurveuri", coreapi.CONF_DATA_TYPE_STRING, ("pcrcurveuri", coreapi.CONF_DATA_TYPE_STRING,
'%s/rfpipepcr.xml' % xml_path, '%s/rfpipepcr.xml' % xml_path,
@ -63,9 +63,9 @@ class EmaneRfPipeModel(EmaneModel):
_confmatrix_mac = _confmatrix_mac_base + _confmatrix_mac_091 _confmatrix_mac = _confmatrix_mac_base + _confmatrix_mac_091
else: else:
_confmatrix_mac = _confmatrix_mac_base + _confmatrix_mac_081 _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
_confmatrix = _confmatrix_mac + _confmatrix_phy _confmatrix = _confmatrix_mac + _confmatrix_phy

View file

@ -94,7 +94,7 @@ class EmaneUniversalModel(EmaneModel):
("antennatype", coreapi.CONF_DATA_TYPE_STRING, 'omnidirectional', ("antennatype", coreapi.CONF_DATA_TYPE_STRING, 'omnidirectional',
'omnidirectional,unidirectional','antenna type'), 'omnidirectional,unidirectional','antenna type'),
] ]
# parameters that require unit conversion for 0.7.4 # parameters that require unit conversion for 0.7.4
_update_ver074 = ("bandwidth", "frequency", "frequencyofinterest") _update_ver074 = ("bandwidth", "frequency", "frequencyofinterest")
# parameters that should be removed for 0.7.4 # parameters that should be removed for 0.7.4