-
Notifications
You must be signed in to change notification settings - Fork 2
Example 1 mininet
This example examines the same scenario as that of Example 1 mininet wifi but using mininet instead of mininet-wifi. Hosts are used instead of ad-hoc WiFi stations and are connected together through a network switch. Loss is controlled using TC instead of Wmediumd.
Here is the network configuration:
Here is the network setup script example1_mod.py modified from example1.py to work with the mininet testbed. The line wifi_qos = {'bw':50,'delay':'2ms','loss':1,'max_queue_size':10,'jitter':'1'}
attempts to suggest WiFi QoS by setting link delay to 2 ms, packet loss to 1%, maximum queue size to 10, and jitter to 1 ms.
#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.node import IVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink, Intf
from subprocess import call
def myNetwork():
net = Mininet( topo=None,
build=False,
ipBase='10.0.0.0/8')
info( '*** Adding controller\n' )
info( '*** Add switches\n')
s1 = net.addSwitch('s1', cls=OVSKernelSwitch, failMode='standalone')
info( '*** Add hosts\n')
h1 = net.addHost('R1', cls=Host, ip='10.0.0.1', defaultRoute=None)
h2 = net.addHost('R2', cls=Host, ip='10.0.0.2', defaultRoute=None)
h3 = net.addHost('R3', cls=Host, ip='10.0.0.3', defaultRoute=None)
h4 = net.addHost('R4', cls=Host, ip='10.0.0.4', defaultRoute=None)
h5 = net.addHost('R5', cls=Host, ip='10.0.0.5', defaultRoute=None)
info( '*** Add links\n')
wifi_qos = {'bw':50,'delay':'2ms','loss':1,'max_queue_size':10,'jitter':'1'}
net.addLink(s1, h1, cls=TCLink , **wifi_qos)
net.addLink(s1, h2, cls=TCLink , **wifi_qos)
net.addLink(s1, h3, cls=TCLink , **wifi_qos)
net.addLink(s1, h4, cls=TCLink , **wifi_qos)
net.addLink(s1, h5, cls=TCLink , **wifi_qos)
info( '*** Starting network\n')
net.build()
info( '*** Starting controllers\n')
for controller in net.controllers:
controller.start()
info( '*** Starting switches\n')
net.get('s1').start([])
info( '*** Post configure switches and hosts\n')
# CLI(net)
# net.stop()
return net
if __name__ == '__main__':
setLogLevel( 'info' )
myNetwork()
Here is scenario file example1.csv, which is the same as example1.csv in the mininet-wifi example:
# Publisher, Role, Topic, Frequency, Size, History, Depth, Reliability, Durability
Publisher, GS, odometry, 10, 500, keep_last, 0, reliable, volatile
# Subscribers, Role, Topic, History, Depth, Reliability, Durability
Subscriber, red_team, odometry, keep_last, 0, reliable, volatile
# Robot, Name, Role
Robot, R1, GS
Robot, R2, red_team
Robot, R3, red_team
Robot, R4, red_team
Robot, R5, red_team
Here are the plots, showing that latency and loss are effectively being applied using TC, but WiFi properties such as traffic contention, transmission power, mobility, and WiFi protocols are not modeled: