From bc3ba68b28c9dbabadb46e3db6c7675dc552aaea Mon Sep 17 00:00:00 2001 From: tgoff0 Date: Thu, 5 Feb 2015 00:15:54 +0000 Subject: [PATCH] daemon/services: Update NRL services. --- daemon/core/services/nrl.py | 47 +++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/daemon/core/services/nrl.py b/daemon/core/services/nrl.py index d57e025b..2e736ec6 100644 --- a/daemon/core/services/nrl.py +++ b/daemon/core/services/nrl.py @@ -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