daemon/services: Update NRL services.
This commit is contained in:
parent
5bb00646d7
commit
bc3ba68b28
1 changed files with 45 additions and 2 deletions
|
@ -19,8 +19,8 @@ class NrlService(CoreService):
|
|||
''' Parent class for NRL services. Defines properties and methods
|
||||
common to NRL's routing daemons.
|
||||
'''
|
||||
_name = "NRLDaemon"
|
||||
_group = "Routing"
|
||||
_name = "Protean"
|
||||
_group = "ProtoSvc"
|
||||
_depends = ()
|
||||
_dirs = ()
|
||||
_configs = ()
|
||||
|
@ -246,6 +246,49 @@ class OlsrOrg(NrlService):
|
|||
|
||||
addservice(OlsrOrg)
|
||||
|
||||
class MgenActor(NrlService):
|
||||
''' ZpcMgenActor.
|
||||
'''
|
||||
|
||||
# a unique name is required, without spaces
|
||||
_name = "MgenActor"
|
||||
# you can create your own group here
|
||||
_group = "ProtoSvc"
|
||||
# list of other services this service depends on
|
||||
_depends = ()
|
||||
# per-node directories
|
||||
_dirs = ()
|
||||
# generated files (without a full path this file goes in the node's dir,
|
||||
# e.g. /tmp/pycore.12345/n1.conf/)
|
||||
_configs = ('start_mgen_actor.sh', )
|
||||
# this controls the starting order vs other enabled services
|
||||
_startindex = 50
|
||||
# list of startup commands, also may be generated during startup
|
||||
_startup = ("sh start_mgen_actor.sh", )
|
||||
# list of shutdown commands
|
||||
_shutdown = ()
|
||||
@classmethod
|
||||
def generateconfig(cls, node, filename, services):
|
||||
''' Generate a startup script for MgenActor. Because mgenActor does not
|
||||
daemonize, it can cause problems in some situations when launched
|
||||
directly using vcmd.
|
||||
'''
|
||||
cfg = "#!/bin/sh\n"
|
||||
cfg += "# auto-generated by nrl.py:MgenActor.generateconfig()\n"
|
||||
comments = ""
|
||||
cmd = "python /usr/local/bin/mgenBasicActor.py -n %s -a 0.0.0.0 -p 5555" % (node.name)
|
||||
|
||||
servicenames = map(lambda x: x._name, services)
|
||||
netifs = filter(lambda x: not getattr(x, 'control', False), \
|
||||
node.netifs())
|
||||
if len(netifs) == 0:
|
||||
return ()
|
||||
|
||||
cfg += comments + cmd + " < /dev/null > /dev/null 2>&1 &\n\n"
|
||||
return cfg
|
||||
|
||||
# this line is required to add the above class to the list of available services
|
||||
addservice(MgenActor)
|
||||
|
||||
class Arouted(NrlService):
|
||||
''' Adaptive Routing
|
||||
|
|
Loading…
Reference in a new issue