The simple performance test of setting bandwidth in mininet experiment

Source: Internet
Author: User
Tags python script

Write in front

The experimental reference

    • The experiment is written to Opendaylight, but it doesn't seem to have anything to do with ODL, or the local controller pox.
    • Noteworthy: after the experiment must be used, mn-c command cleanup process . Otherwise, it causes the ping between the hosts, port occupancy and so on.
    • Although it is a simple experiment, but I in the process by asking seniors, but also to the virtual controller understanding more in-depth, but also can be more in-depth experience in the software of SDN in the two words.
Experimental ideas
    • Python script implements a custom topology
    • Set the bandwidth, latency, and packet loss rate for the link
    • Iperf testing the bandwidth performance between hosts

In short, a script solves all problems. The core of this experiment is to read scripts.

Experimental topology

Experiment Step 1: Build the environment
    • Installing a mininet virtual machine
2. Create a script
    • Enter the Mininet/custom directory, create the script mymininet.py and add the content:
#!/usr/bin/pythonfrom Mininet.topo Import topofrom mininet.net import mininetfrom mininet.node Import Cpulimitedhostfrom mininet.link Import tclinkfrom mininet.util import dumpnodeconnectionsfrom mininet.log Import    Setloglevelclass Singleswitchtopo (Topo): "Single switch connected to n hosts." def __init__ (self, n=2, **opts): topo.__init__ (self, **opts) switch = Self.addswitch (' s1 ') for H in R            Ange (n): #Each host gets 50%/n of system CPU host = Self.addhost (' h%s '% (H + 1), cpu=.5/n) #10 Mbps, 5ms delay, 0% Loss, packet queue Self.addlink (host, switch, bw=10, delay= ' 5ms ', loss=0, max_q ueue_size=1000, Use_htb=true) def perftest (): "Create Network and run simple performance test" topo = Singleswitchtop    O (n=4) net = mininet (Topo=topo,host=cpulimitedhost, Link=tclink) Net.start () print "Dumping host connections"   Dumpnodeconnections (net.hosts) print "Testing network Connectivity" Net.pingall () Print "Testing bandwidth between H1 and H4" H1, H4 = Net.get (' H1 ', ' H4 ') Net.iperf ((H1, H4)) Net.stop () if __name __== ' __main__ ': setloglevel (' info ') perftest ()
    • This script has already written everything, including the link bandwidth settings, pingall instructions, and iperf instructions. Just run the observation process.
    • Understanding scripts is the key!
Run the script
python mymininet.py或者chmod +x mymininet.py #添加文件执行属性./mymininet.py
Effect

Summary of the experiment and the matters needing attention
    • Create a mininet script from a Python script to set the bandwidth, latency, packet loss rate, etc. (bw=10,delay= ' 5ms ', loss=0,max_queue_size=1000,use_htb=true) between device links, There is a throttling effect on the device, and the performance of the test host is performed through Iperf.
    • Caveats:mn-c cleanup Process .

The simple performance test of setting bandwidth in mininet experiment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.