Setting up a Mininet Test Network

Last modified by Kevin Austin on 2018/11/29 05:19

In this guide, we'll be setting up a simple mininet test network and adding a flow to allow two hosts to ping each other. There is a mininet container in OpenKilda that is used to perform automated testing of controller builds, but for this guide, we'll instead install mininet on the host operating system.  These instructions were written using the October 2018 OpenKilda build v1.1.10.4

This guide uses a python script,  to create different network topologies and can be downloaded here. The script creates a typical datacenter leaf/spine topology where you can specify the number of racks and hosts per rack when you start mininet. For this walkthrough, our network will consist of a simple 2 rack configuration with 2 ToR switches with one host per rack and a single spine switch.

Modify the docker-compose.yml File

To avoid a conflict between mininet and floodlight which both use port 6655, we are going to modify the docker-compose.yml file in the base open-kilda folder. We'll make a copy of the original file to preserve it.

user@host:~/open-kilda$ sudo cp docker-compose.yml docker-compose.yml.original

Now, open up the docker-compose.yml file in nano

user@host:~/open-kilda$ sudo nano docker-compose.yml

Scroll down to the floodlight configuration and delete delete the line  - "6655:6655"

  - "6653:6653"
  - "8180:8080"
  - "6655:6655"
  - "6642:6642"
  - "8081:8080"

After deleting this line, hit control+x , hit Y to save and press Enter to exit.

Install Mininet

Install mininet using apt install

user@host:~/open-kilda$ sudo apt install mininet

Install the Script

Now that mininet is installed, download the mininet script to the host machine.

If you've downloaded the file from a browser on the host ubuntu machine, we'll unzip it and copy it into the home directory:

user@host:~/open-kilda$ unzip ~/Downloads/ -d ~

Start OpenKilda

If you already have OpenKilda running it, stop and restart it so that the changes we made earlier to the docker-compose.yml file take affect.

If OpenKilda is already running in the foreground of the terminal window, hit control+c, this will stop OpenKilda.

If OpenKilda is running in the background, in the ~/open-kilda folder type:

user@host:~/open-kilda$ docker-compose down

Now start OpenKilda from the base ~/open-kilda folder:

user@host:~/open-kilda$ docker-compose up

Once OpenKilda has started, open a browser and go to . It may take 30-45 seconds after Kilda has fully started for the page to be active.  Login using the credentials -  Username: admin Password: admin and click on the Topology link on the left hand navigation bar. The Topology window will be empty.


Toggle Controller Features - Set to True

In a browser window, open the Swagger interface:

Username: kilda
Password: kilda

Swagger allows us to access the northbound interface of OpenKilda through a web browser. By default, many of the controller features are turned off. In a normal production environment you may want to control what features are available to configure the network. Click on the feature-toggles-controller tab to expand it. Then click on the "GET /features" tab to expand the tab.  In the top-right corner of the tab select "try it out" and then click the blue "Execute" button.


The following will be returned in the Response body field:

   "sync_rules": false,
   "reflow_on_switch_activation": true,
   "create_flow": false,
   "update_flow": false,
   "delete_flow": false,
   "push_flow": false,
   "unpush_flow": false

Most of the features are turned off by default. To enable these features, scroll down to the "POST /features" tab and click on it to expand it. Click on the "try it out" button and then click on the big blue "Execute" button.


By default you should have the following example values:

   "create_flow": true,
   "delete_flow": true,
   "push_flow": true,
   "reflow_on_switch_activation": true,
   "sync_rules": true,
   "unpush_flow": true,
   "update_flow": true

Verify that the features were enabled by going back to the "GET /features" tab and clicking on the big blue "Execute" button. Verify that the Response body now lists "true" as the value for all of the features.

Start Mininet

In a new terminal window navigate to the home folder where the script it located:

user@host:~/open-kilda$ cd ~

Use the following command to start a 2 host | 2 ToR | 1 Spine | switch topology

user@host:~/$ sudo mn --custom --topo dcconfig,2,1 --switch ovs --controller remote,ip=,port=6653

The following topology will be created:

*** Creating network
*** Adding controller
*** Adding hosts:
h1r1 h1r2
*** Adding switches:
s1 s1r1 s1r2
*** Adding links:
(s1, s1r1) (s1, s1r2) (s1r1, h1r1) (s1r2, h1r2)
*** Configuring hosts
h1r1 h1r2
*** Staring controller
*** Starting 3 switches
s1 s1r1 s1r2
*** Starting CLI:

Verify Topology in GUI

Verify in the OpenKilda GUI that the topology was created, in a browser go to: or refresh the window that you had open previously.  You should now see that 3 switches and 2 links are present. You can rollover the switches or the links connecting them to get their information. For reference, OpenKilda considers any port connected to another switch an "ISL". OpenKilda does not display "hosts" or computers in the topology, ports that are connected to hosts are termed "ports" in OpenKilda. We have built the following topology with mininet:

s1 (spine switch) switch ID: 00:00:00:00:00:00:00:01
ISL Link: Port 1 is connected to Destination port 2 of 00:00:00:00:00:00:00:11
ISL Link:  Port 2 is connected to Destination port 2 of 00:00:00:00:00:00:00:21

s1r1 switch ID: 00:00:00:00:00:00:00:11
ISL Link: Port 2 is connected to s1 Switch ID: 00:00:00:00:00:00:00:01
Port Link: Port 1 is connected to h1r1

s1r2 switch ID: 00:00:00:00:00:00:00:21
ISL Link: Port 2 is connected to s1 switch ID: 00:00:00:00:00:00:00:01
Port Link: Port 1 is connected to h1r2


Creating a Flow Between Two Hosts

Now that we have the network setup, we are going to create a flow between the host in r1 and the host in r2 across the network. In OpenKilda we only need to specify the source port and the destination port, the Path Computation Engine will create the rest of the flows through the network and create a return path to make the flow bi-directional. This will allow us to ping between our hosts.

To create our flow we will use the Swagger interface to push a flow through the northbound API of OpenKilda. Go to . Click on the flow-controller tab to expand it. Click on the orange "Put /flows" tab to expand it. Click on the "try it out" button on the top right corner fo the tab. In the example value window, the flow we want to enter is:

   "description": "mininet test flow",
   "destination": {
     "port-id": 1,
     "switch-id": "00:00:00:00:00:00:00:21",
     "vlan-id": 0
   "flowid": "flow1",
   "ignore_bandwidth": true,
   "last-updated": "string",
   "maximum-bandwidth": 0,
   "periodic-pings": true,
   "source": {
     "port-id": 1,
     "switch-id": "00:00:00:00:00:00:00:11",
     "vlan-id": 0
   "status": "sting"

Click the blue "Execute" button and make sure there are no error messages in the response body. If the flow was entered correctly you should see the following in the response body:


Ping Between Mininet Hosts

Return to your mininet terminal window and ping between the two hosts:

mininet> h1r1 ping h1r2

You should now be able to ping between your two hosts.

Check Flow Status

In the OpenKilda GUI at you can check the status of the flow. If you select Flows in the left hand navigation menu it will list the flows installed in the network. Double-click on our test flow we entered and it will display the parameters of the flow and a graph of the number of packets per second for the flow. You can select different parameters to metrics and time periods to graph.


If you click the "path" tab it will show you the path the flow is taking through the network including the "switches" and the "ISL" links.



Created by Kevin Austin on 2018/10/19 02:45
©2018 OpenKilda