Setting up a Mininet Test Network

Version 19.1 by Kevin Austin on 2018/10/23 04:40

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, datacenterConfigurable.py  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"

ports:
  - "6653:6653"
  - "8180:8080"
  - "6655:6655"
  - "6642:6642"
  - "8081:8080"
depends_on:
  kafka:

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 datacenterConfigurable.py Script

Now that mininet is installed, download the mininet script datacenterConfigurable.py.zip 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./datacenterConfigurable.py.zip -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 http://127.0.0.1:8010/openkilda . 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.

topology_empty.jpg

Toggle Controller Features - Set to True

In a browser window, open the Swagger interface: http://127.0.0.1:8080

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.

feature-toggles-controller.jpeg

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.

post_features.jpeg

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 datacenterConfigurable.py 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 datacenterConfigurable.py --topo dcconfig,2,1 --switch ovs --controller remote,ip=127.0.0.1,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
c0
*** Starting 3 switches
s1 s1r1 s1r2
*** Starting CLI:
mininet>

 

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