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.

65 lines
1.5 KiB
Python

5 months ago
import sys
import os
5 months ago
from time import sleep
from mininet.cli import CLI
from mininet.net import Mininet
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel, info
from mininet.link import TCLink
5 months ago
sys.path.insert(0, os.getcwd() + '/project')
from project.node import BATMANDRouter, LinuxRouter, OLSRRouter
from project.topo import GraphmlTopoUniqueSubnet, GraphmlTopoDifferentSubnet
5 months ago
def monitor_test(net):
for host in net.hosts:
host.cmd('./routing-table-monitor.sh')
enable_olsrd(net)
sleep(60)
for host in net.hosts:
host.cmd('kill %bash')
def do_enable_olsrd(self, line):
net = self.mn
enable_olsrd(net)
def enable_olsrd(net):
for host in net.hosts:
host.cmd('olsrd -i ' + ' '.join(host.intfNames()))
5 months ago
hosts = {'linuxrouter': LinuxRouter, 'olsrrouter': OLSRRouter, 'batmanrouter': BATMANDRouter}
topos = {'gmltopo1': GraphmlTopoUniqueSubnet, 'gmltopo2': GraphmlTopoDifferentSubnet}
5 months ago
CLI.do_enable_olsrd = do_enable_olsrd
def perfTest():
5 months ago
topo = GraphmlTopoDifferentSubnet(filename='rural-gephi.graphml')
5 months ago
net = Mininet(topo=topo, link=TCLink, host=LinuxRouter)
net.start()
info("Dumping host connections\n")
dumpNodeConnections(net.hosts)
info("monitoring routing tables")
monitor_test(net)
info("Dumping host connections\n")
dumpNodeConnections(net.hosts)
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel('info')
# Prevent test_simpleperf from failing due to packet loss
perfTest()