From 458d1d64e6e57eca9714927a70aefadace7ed18f Mon Sep 17 00:00:00 2001 From: tgoff0 Date: Wed, 21 Jan 2015 21:38:15 +0000 Subject: [PATCH] added olsr.org service template --- daemon/core/services/nrl.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/daemon/core/services/nrl.py b/daemon/core/services/nrl.py index e643381f..d57e025b 100644 --- a/daemon/core/services/nrl.py +++ b/daemon/core/services/nrl.py @@ -222,6 +222,31 @@ class NrlOlsrv2(NrlService): addservice(NrlOlsrv2) +class OlsrOrg(NrlService): + ''' Optimized Link State Routing protocol from olsr.org for MANET networks. + ''' + _name = "OLSRORG" + _startup = ("olsrd", ) + _shutdown = ("killall olsrd", ) + _validate = ("pidof olsrd", ) + + @classmethod + def getstartup(cls, node, services): + ''' Generate the appropriate command-line based on node interfaces. + ''' + cmd = cls._startup[0] + netifs = filter(lambda x: not getattr(x, 'control', False), \ + node.netifs()) + if len(netifs) > 0: + interfacenames = map(lambda x: x.name, netifs) + cmd += " -i " + cmd += " -i ".join(interfacenames) + + return (cmd, ) + +addservice(OlsrOrg) + + class Arouted(NrlService): ''' Adaptive Routing '''