daemon/services: Update NRL services.

This commit is contained in:
tgoff0 2015-02-05 00:15:54 +00:00
parent 5bb00646d7
commit bc3ba68b28

View file

@ -19,8 +19,8 @@ class NrlService(CoreService):
''' Parent class for NRL services. Defines properties and methods ''' Parent class for NRL services. Defines properties and methods
common to NRL's routing daemons. common to NRL's routing daemons.
''' '''
_name = "NRLDaemon" _name = "Protean"
_group = "Routing" _group = "ProtoSvc"
_depends = () _depends = ()
_dirs = () _dirs = ()
_configs = () _configs = ()
@ -246,6 +246,49 @@ class OlsrOrg(NrlService):
addservice(OlsrOrg) 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): class Arouted(NrlService):
''' Adaptive Routing ''' Adaptive Routing