You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
996 B
Python

from mininet.node import Node
class LinuxRouter(Node):
def config(self, **params):
self.cmd('sysctl net.ipv4.ip_forward=1')
def terminate(self):
self.cmd('sysctl net.ipv4.ip_forward=0')
super(LinuxRouter, self).terminate()
class OLSRRouter(LinuxRouter):
def config(self, **params):
super(OLSRRouter, self).config(**params)
self.servicePid = self.cmd('olsrd -nofork -i ' + ' '.join(self.intfNames()) + ' >/dev/null 2>&1 & echo $!')
print(self.servicePid)
def terminate(self):
self.cmd('kill ', self.servicePid)
super(OLSRRouter, self).terminate()
class BATMANRouter(LinuxRouter):
def config(self, **params):
super(BATMANRouter, self).config(**params)
self.servicePid = self.cmd('batmand ' + ' '.join(self.intfNames()) + '& echo $!')
print(self.servicePid)
def terminate(self):
self.cmd('kill ' + self.servicePid)
super(BATMANRouter, self).terminate()