Mininet Experiment Three

Source: Internet
Author: User
Tags python script

Mininet experiment three-connect the Floodlight Controller reference blog A reference blog two in advance to prepare for the-floodlight installation

Execute the ifconfig command to get the IP address of the server where floodlight resides.

1. Start Floodlight
java -jar target/floodlight.jar

In the browser, enter the Floodlight UI interface address: http://localhost:8080/ui/index.html

2. Create a topology from Mininet with a Python script

To switch to the/home/mininet directory, check to see if there is a test script fattree.py, if there is a script, skip this step, and if not, execute the following command to create the script and add the content.

cd /home/mininettouch fattree.pyvim fattree.py

Add the following script

"" "Custom topology exampleadding the ' topos ' dict with a key/value pair to generate our newly definedtopology enables one "" "from Mininet.topo import topofrom mininet.net import Mininetfrom mini--topo=mytopo. Net.node Import remotecontroller,cpulimitedhostfrom mininet.link import tclinkfrom mininet.util Import     Dumpnodeconnections class Mytopo (Topo): "Simple topology example."         def __init__ (self): "Create custom topo."  # Initialize topology topo.__init__ (self) L1 = 2 L2 = L1 * 2 L3 = L2 c = [] A = [] e = [] # Add core OvS for I in Range (L1): SW = Self.addswitch (' c{                } '. Format (i + 1)) C.append (SW) # Add aggregation OvS for I in Range (L2):  SW = Self.addswitch (' a{} '. Format (L1 + i + 1)) A.append (SW) # Add Edge OvS for            I in range (L3):    SW = Self.addswitch (' e{} '. Format (L1 + L2 + i + 1)) E.append (SW) # Add links between core                and aggregation OvS for I in Range (L1): SW1 = C[i] for SW2 in A[I/2::L1/2]: # Self.addlink (SW2, SW1, bw=10, delay= ' 5ms ', loss=10, max_queue_size=1000, use_htb=true) se                Lf.addlink (SW2, SW1) # Add links between aggregation and edge OvS for I in range (0, L2, 2): For SW1 in a[i:i+2]: for SW2 in e[i:i+2]: Self.addlink (SW2, SW1) #                    Add hosts and their links with edge OvS count = 1 for SW1 in E:for I in range (2): Host = Self.addhost (' h{} '. Format (count)) Self.addlink (SW1, host) count + = 1topos = {' Mytopo ': (Lambda:mytopo ())}

Start mininet and generate a test topology. Do not forget to modify the fattree.py as an executable file. Do not include Chinese in the script.

Run the Python script using the following command:

sudo mn --custom /home/liuhy/mininet/fattree.py --topo mytopo --controller=remote,ip=127.0.0.1,port=6653 --switch ovsk,protocols=OpenFlow10
This command is important, which involves connecting the mininet switch to the floodlight controller and needing to adjust the parameters.
    • First fattree.py address to find the right.
    • IP is the floodlight server IP, which can be found by ifconfig.
    • Then the port is set to 6653.

Connection succeeded:

If the connection fails, the following actions will not be made, and the first time your own error is here. Thank Chenxiang Seniors for their guidance!

When you use Vim to edit a Python script, you can refer to: Vim command Daquan

After running the script:

Topology diagram:

In the figure C1 and C2 are core switches, A1-A4 are aggregation switches, e1-e4 are edge switches, and H1-H8 are hosts. The above code
Topology creates 2 core switches, 4 converged switches, 4 edge switches, each of which hangs 2 virtual
Host, and adds a logical link to all the switches. In order to improve bandwidth utilization and adjust traffic demand, the above code
To a balanced effect, each core switch is connected to 4 converged switches, each of which hangs two edge
Each edge switch connects to the parent switch to which it belongs.

Mininet Experiment Three

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.