Visualizing software defined network topologies using POX and Gephi

When a researcher uses the Mininet network simulator to create a network of hosts and switches connected to an SDN controller, he or she may wish to be able to see what the simulated network topology looks like.

Gephi-0003

The POX SDN controller includes a component that will send network topology data to the Gephi data visualization platform, which can the show a graph of nodes and links representing the network topology. In this post, I will show how to set up POX and Gephi so we can see the network topologies created using the topology options in the Mininet command.

While we work through this tutorial we will also see how the POX SDN controller, which does not offer a native Northbound API, can use POX components to provide northbound interfaces.

Prerequisite skills and activities

This tutorial assumes you already have the following. I include links to relevant posts if you need to review any of these requirements.

Overview

This is a long post. Here is an overview of the main steps we will follow in the tutorial, with links to each section:

  1. How to log into the Mininet VM
  2. Important: you must upgrade the POX controller to the dart branch
  3. A detailed description of the stock POX components used in this tutorial
  4. How to set up Gephi by installing the Graph Streaming plugin and adding a streaming client
  5. Run Mininet and set up a standard network topology
  6. Modify Gephi settings so you can view the network graph.
  7. Observing real-time network topology changes in Gephi
  8. Examples of more network topologies

Log into the Mininet VM

The Mininet VM should be running on your computer (see the links in section above if it is not) and should be accessible at the IP address assigned by the VirtualBox host-only interface. In our example, this is IP address 192.168.56.101. Check the interface on the Mininet VM to see which IP address is assigned in your case.

From a terminal window on your host computer, access the Mininet VM with the command:

t400:~$ ssh -X [email protected]

Enter the password, which is mininet. The prompt will show you are now logged into the Mininet VM:

mininet@mininet-vm:~$ 

If your host computer is a Windows computer, use the PuTTY program and ensure X Forwarding is enabled. Also, ensure you are running an X Server like Xming.

Open three terminal sessions

I recommend you open three terminal windows and log into the Mininet VM from each one. Each terminal window will be your console for each of the following programs:

  1. POX
  2. Gephi
  3. Mininet

Upgrade the POX controller

The version of POX running on the Mininet 2.2.1 VM is the carp branch. This version has a bug in it that prevents it from connecting the the Gephi graph streaming plugin. See the comments below the POX-Gephi graph streaming announcement for more information.

The bug is fixed in the dart branch. To upgrade, execute the following commands on the Mininet VM:

$ cd ~/pox
$ git checkout dart

Start POX

In the first terminal window (or tab), we will run the POX SDN controller.

When we start POX, we will select standard POX components, one of which is the misc.gephi_topo component, to create an SDN application. The misc.gephi_topo component is the component that provides a data stream to the Gephi graph visualization platform.

The command we use to start POX is:

$ sudo ~/pox/pox.py forwarding.l2_learning \
  openflow.discovery misc.gephi_topo \
  openflow.spanning_tree --no-flood --hold-down \
  host_tracker info.packet_dump \
  samples.pretty_log log.level --DEBUG

Monitor the POX console

Now we see that POX is running. On the terminal session we used to start POX, we see the POX log messages showing actions detected or performed by each POX component that is running.

POX SDN controller console
POX SDN controller console

The stock POX components

You may skip this section if you are not interested in the functions provided by each of the POX components we chose to run.

The command we used to start the POX controller also specified the POX components that will run along with the controller. The sections below describe the function of each component we use in this example:

forwarding.l2_learning

The L2 Learning component makes OpenFlow switches act like Ethernet learning switches. It learns Ethernet MAC addresses, and matches all fields in the packet header so it may install multiple flows in the network for each pair of MAC addresses. For example, different TCP connections will result in different flows being installed.

This L2 Learning component creates flows with idle timeout values so switches will automatically delete flows that have not services packets during the timeout period (which is ten seconds). This helps keep flow tables manageable.

openflow.discovery

The OpenFlow Discovery component uses LLDP messages sent to and received from OpenFlow switches to discover the network topology. It also detects when network links go up or down. This information may be used by other components.

misc.gephi_topo

The Gephi Topo component streams updates from POX to the Gephi graph visualization platform when POX detects changes to the network topology.

The Gephi Topo component effectively creates a northbound interface to the Gephi graph visualization platform. It streams real-time data to an IP address and port to which Gephi will be listening, in a format Gephi can interpret.

openflow.spanning_tree ‐‐no-flood ‐‐hold-down

The Spanning Tree component is required in cases where the topology of the network contains loops. It works with the OpenFlow Discovery component to build a view of the network topology and constructs a spanning tree by disabling flooding on switch ports that aren’t on the tree. The options no-flood and hold-down are used to ensure no packets are flooded in the network before the component creates the spanning tree.

The Spanning Tree component will respond to changes in the network topology. If a link is broken, and if an alternate link exists, it can maintain connectivity in a network by creating a new tree that enables flooding on the ports connected to the alternate link.

When using the Spanning Tree component, also use a forwarding component that creates flows that have a timeout value set. In this example, we used the L2 Learning component.

host_tracker

The Host Tracker component attempts to keep track of hosts in the network. Host Tracker examines messages received by POX and learns MAC and IP of hosts in the network. Host Tracker will work in our example but it relies on packets coming to the controller. Packet forwarding in the network must be done reactively so we need to use a forwarding component like forwarding.l2_learning.

info.packet_dump

The Packet Dump component will display on the log console information about data packets received by POX from switches. This will help us see how the switches interact with the POX controller without running tcpdump.

log.level ‐‐DEBUG

The Log Level component allows the POX user to specify the amount of detail they will see in the log information produced by POX. The most detailed level is DEGUG, so we will use that in our example. By default, logs appear on the POX console so you will see them on the same terminal session used to start POX.

samples.pretty_log

The Pretty Log component formats log messages into a custom log format to provide attractive and readable log output on the POX console.

Gephi

To use the Gephi graph visualization platform as a network visualization tool, we need to install the Graph Streaming plugin so Gephi can receive information streamed from the POX SDN controller’s Gephi Topo component and we need to set up the graph display so that the graph is deployed in an readable manner.

In this tutorial, we will run Gephi on the Mininet virtual machine. If you have not already installed it, please see my post about installing Gephi on the Mininet VM.

Install the Gephi Graph Streaming plugin

Gephi provides a plugin for streaming graph data back and forth between it and another process, such as the POX SDN controller. We need to install the plugin and add a streaming client.

First, start Gephi (use a new terminal window).

$ cd ~/gephi/bin
$ sudo ./gephi

To install the Graph Streaming Plugin, do the following:

In the Gephi user interface, go to Tools –> Plugins

Select plugins tool
Select plugins tool

Click on the Available Plugins tab on the plugins window and search for the Graph Streaming plugin. Select it and then click the Install button on the lower left of the window.

Select the Graph Streaming plugin and install it
Select the Graph Streaming plugin

Gephi will ask to restart. Allow it to restart.

Add a streaming client

First, click on the Overview button at the top of the Gephi user interface. This will show you the Graph window and this is where the streaming window will appear after the Graph Streaming plugin is installed.

Configure the streaming server settings. The Gephi.Topo component uses TCP port 8282. Click the Settings button and set Port to 8282 and clear the SSL check box.

Configure the streaming server settings
Configure the streaming server settings

In the Gephi user interface, go to the Streaming tab and click the green “ADD” sign. A Connect to Stream configuration window will appear. Enter the URL to which Gephi will connect. In our case, both Gephi and the POC=X controller are running on the same machine so the IP address of the URL is the loopback address, which can be entered as either 127.0.0.1 or as localhost. The port number, as used by the Gephi_Topo component, is 8282. So enter the URL: http://localhost:8282.

Enter URL of stream
Enter URL of stream

We see that a client and server is created in the Streaming tab. In the POX console, we should see a log message from the Gephi Topo component indicating it is connected to a client.

Gephi streaming client is ready and listening
Gephi streaming client is ready and listening

Mininet

We are using the Mininet network emulator to create the network of switches and hosts. In this case, we are using the Mininet virtual machine, which is available from the Mininet web site.

In a new terminal session, run the command:

$ sudo mn --topo torus,3,3 --controller remote

This will set up a network topology in a torus configuration, which is a complex topology that contains loops. The network also connects to a remote controller using the default IP address and TCP port.

Mininet network is now running

At this point, you have the Mininet network running and you see the Mininet command prompt in the terminal session from which you started either MiniEdit or Mininet.

We can look at the POX SDN controller console and see the openflow events being handled by the POX controller, which are displayed in the POX log messages because we set the log level to DEBUG. We see the POX SDN controller connecting to switches and setting up the spanning tree.

Viewing network topologies

In the Gephi graph window, we will immediately see some nodes and links appear.

At this point in the tutorial, we have shown how to send data from the POX SDN controller to an external application, such as Gephi, using POX components.

First version of graph places nodes in random places
First version of graph places nodes in random places

However, the nodes and links in the graph appear at random locations and are so small we can barely see them. We need to modify some settings so we can get a better view of the nodes and links being displayed in Gephi.

First we will use one of Gephi’s Layout algorithms to automatically arrange the nodes and links for us. Open the Layout window with the menu command: Window –> Layout.

Open Layout tab
Open Layout tab

The layout panel will appear. In Layout panel, choose the Force Atlas layout. The Force Atlas layout arranges nodes and links around a “center of gravity”. It uses parameters specified by the user to determine how far apart nodes will be from each other and how much each node is attracted to the center of the graph.

Choose Force Atlas layout
Choose Force Atlas layout

The default settings will space the nodes too far apart so we change them to the values shown in the screen capture below, then click Run.

Run the layout algorithm
Run the layout algorithm

We see that the nodes move much closer to the centyer. In fact they may appear to completely disappear because they now occupy such a small section of the graph window.

Nodes are attracted to each other by algorithm but now disappear to a dot
Nodes are attracted to each other by algorithm but now disappear to a dot

Now we zoom in to view the nodes and links. Press middle mouse button and move the mouse up, or use the scroll wheel on mouse. Use the right mouse button to move the canvas around (after clicking on the drag tool, the hand icon on the left of the graph window). If you get lost, click the looking glass icon to center the view and return to default magnification, and try agaon.

Use center mouse button to zoom in to see the graph
Use center mouse button to zoom in to see the graph

We see only the switches in this view. The POX SDN controller has not yet detected any hosts because the Host Tracker component looks for ARP requests and responses sent by hosts and, since no traffic is running in our network yet, it has not seen any.

So we need to generate some traffic so that the POX SDN controller can detect the hosts and send the data describing them to gephi. A convenient way to generate traffic to every host is to use the pingall command in Mininet. In the Mininet console, type:

mininet> pingall

We see Gephi placing the new hosts on the graph. Initially, they are placed at random locations on the graph but the Force Atlas laypit algorithim is running and pulls them into view. Note that the algorith will change the positions of all nodes in the network so the switches move, too. In the end, the graph changes to look like below:

Gephi receives data about hosts and adds them to graph. Layout changes automatically
Gephi receives data about hosts and adds them to graph. Layout changes automatically

You may need to change some of the layout Force Atlas parameters to get all the switches and hosts to appear in the graph window. In my case, I increased the Gravity and Attraction Strength parameters.

Now, stop the Force Atlas layout algorithm. The nodes stay where they are. But with the algorithm no longer constantly updating node locations on the graph, nodes will stay where we move them to instead of snapping back into place. Also, if we remove links, the nodes will not all move around into a new alignment, which can be distracting.

Adjust layout settings so nodes are closer together. Then stop the algorithm so they do not move any more if changes occur.
Adjust layout settings so nodes are closer together. Then stop the algorithm so they do not move any more if changes occur.

Show labels

We do not know which switch is which. We need to add some labels to the nodes in the graph. Click the Show Labels button below the graph window.

Click on the show node labels button
Click on the show node labels button

By default, the labels will be too large and will obscure the graph. We can fix the label size by choosing a smaller font and using the label size slider.

Labels are too large. Select smaller font and user slider on right
Labels are too large. Select smaller font and user slider on right

Experiment until you find a label size that is easy to read.

Now, we can see the MAC address of each node. This is the MAC address of the interface on each node that is connected to the POX SDN controller.

Find right size for labels
Find right size for labels

Observing real-time network topology changes

Gephi is receiving a constantly-updated stream of data from the POX SDN controller. Gephi will display changes to the SDN network topology as they occur in real time. Let’s test this.

First, let’s view which nodes are connect to each other. In this particular case, and in more complex networks, it may not be obvious just by looking at the graph. You can see which nodes are connected to any node on the graph by hovering the mouse pointer over the node. This highlights connected links and nodes.

Highlight nodes to see what is connected to what in complex graphs. can also drag
Highlight nodes to see what is connected to what in complex graphs. can also drag

In this case, we see that the node with the MAC address 00:00:00:00:03:03 is connected to nodes with Mac addresses 00:00:00:00:03:01, 00:00:00:00:02:03, and 00:00:00:00:03:02.

On the mininet console, run the Mininet net command to view the links in the Mininet simulation.

mininet> net

We know that the MAC addresses are set up by Mininet to easily identify each switch. Switch s3x3, for example, has the label 00:00:00:00:03:03.

So we can disconnect three of the links going to switch s3x3 with the following Mininet commands:

mininet> link s3x3 s3x1 down
mininet> link s3x3 s2x3 down
mininet> link s3x3 s3x2 down

We see that the links disappear in the Gephi graph window each time we take down a link.

After deleting links in Mininet
After deleting links in Mininet

More Mininet topologies

We can view what other mininet topologies look like in Gephi.

First, exit the current simulation in Mininet.

mininet> exit
$ sudo mn -c

Then, create a new network using the Mininet command. Run pingall each time to include the hosts in the graph.

Tree topology

The following Mininet command create a tree topology that is three levels deep than fans out with two links at each level.

$ sudo mn --topo tree,3,2 --controller remote 
mininet> pingall

Follow the same steps as shown in the sections above to create a readable topology. Then, drag the nodes around to align them into a layered tree model.

Tree topology
Tree topology

Linear topology

The following commands stop the running simulation and create a new linear topology made up of three switches with two hosts connected at each switch.

mininet> exit
$ sudo mn -c
$ sudo mn --topo linear,3,2 --controller remote
mininet> pingall
Linear topology
Linear topology

Conclusion

We’ve seen how to set up a scenario that integrates the POX SDN controller with the Gephi graph visualization platform a via “northbound” interface provided by the Gephi Topo POX component.

We could explore further the functions provided by Gephi to make the graph more usable and to output the graph in an attractive format similar to the image at the top of this post. We will cover how to manipulate

17 thoughts on “Visualizing software defined network topologies using POX and Gephi”

  1. Hi, I have installed and used gephi. first of all thank you very much for your software. I have a problem. I have 7 switches, 6 links and 2 hosts. but when I print switches, links and hosts it print switches and links correctly but it prints 14 hosts!!! can you help me please.

    this is the out put that first print switches, then links and then hosts:
    switch
    set([’00-00-00-00-00-01′, ’00-00-00-00-00-02′, ’00-00-00-00-00-03′, ’00-00-00-00-00-04′, ’00-00-00-00-00-05′, ’00-00-00-00-00-06′, ’00-00-00-00-00-07′])
    link
    set([(’00-00-00-00-00-02′, ’00-00-00-00-00-03′), (’00-00-00-00-00-01′, ’00-00-00-00-00-07′), (’00-00-00-00-00-05′, ’00-00-00-00-00-06′), (’00-00-00-00-00-01′, ’00-00-00-00-00-02′), (’00-00-00-00-00-03′, ’00-00-00-00-00-06′), (’00-00-00-00-00-01′, ’00-00-00-00-00-04′)])
    host
    {‘ba:cc:13:d7:e2:61′: ’00-00-00-00-00-01’, ‘4a:51:43:d2:4d:40′: ’00-00-00-00-00-03’, ‘ba:68:a1:e4:fa:9e’: ’00-00-00-00-00-03′, ‘7a:88:f0:b6:cb:65′: ’00-00-00-00-00-07′, ’76:de:c0:8f:50:e8′: ’00-00-00-00-00-03′, ’06:54:5f:ae:06:00′: ’00-00-00-00-00-01’, ‘6e:3f:b4:08:eb:f9′: ’00-00-00-00-00-01’, ‘a6:62:ed:7f:08:ae’: ’00-00-00-00-00-05′, ‘6a:24:a6:fa:2e:0c’: ’00-00-00-00-00-04′, ‘ea:ec:ff:0d:7c:b2′: ’00-00-00-00-00-03’, ‘3e:91:95:b4:7e:9a’: ’00-00-00-00-00-05′, ‘8a:e2:c3:b9:f7:b6′: ’00-00-00-00-00-01’, ‘c6:13:ec:3d:50:43′: ’00-00-00-00-00-01’, ‘4a:75:95:7c:a6:6c’: ’00-00-00-00-00-03′}

  2. Hi,

    Really these materials are useful for beginners.

    I have installed gephi 9.0 as 8.2 is having some issue (means in available plugins, we could not see the Graph streaming. Also not able to get update, as redirecting URL is not live).

    As per “https://brianlinkletter.com/install-gephi-on-the-mininet-vm”, same way I installed gephi 9.0. Gephi window also appear on my host computer’s desktop. Streaming and settings configured as advised. But when am initiating MININET TOPO, I could not see any graph on Gephi. But I could see the event logs in gephi.

    Help to get Visualizing SDN Topo using POX and Gephi-9.0 please…

    Thanks,
    Veera

    1. Hi Veerakimar,
      Thanks for your comment. Try zooming in. When I used Gephi, the nodes appears so small I could not see them until I increased the magnification of the view. Also try changing the layout options.
      I will try Gephi 9.0 in the future, to see if it operates differently. I have a number of other topics I need to write about first, though.
      Thanks,
      Brian

  3. Hi, I want to use only the host_tracker module, so when I run host_tracker in pox controller and a tree topology in mininet, and when I try to ping h1 to h2, it says destination network not reachable.

  4. Thanks a lot , great job. i am new to SDN and i have a few questions. Q!: Can Mininet be used to make an SDN experiment for a research paper ?. Q2: I read in some research papers that Pox is a controller and Openflow is a controller , how they can be used at the same time if they both are controllers ? the last Q which the most important : How can i modify and extend OpenFlow in Mininet, do know any resource to read as a beginner ? . Again thanks a lot for the great job you have done.

    1. Hi Aiman,
      Thanks for your interest. Here are some answers to your questions:
      1) Can Mininet be used to make an SDN experiment for a research paper ?
      Yes. See the following web site: https://reproducingnetworkresearch.wordpress.com/
      2) POX and Openflow?
      POX is an SDN controller. It is popular in education because it is simple. But it is not used in production networks (outside of Universities). OpenFlow is a messaging protocol used by Controllers and switches. It is one of several protocols that may be used in SDN networks. Most controllers and switches support more than one protocol.
      To experiment with the OpenFlow protocol, try using http://flowgrammable.org/getting-started/flowsim/
      3) OpenFlow is an open-source project so you could modify it if you wish. Also, Mininet is written in Python and offers a Python API so it is also extendable. See the Mininet-WiFi project for an example of an extension to Mininet at: https://github.com/intrig-unicamp/mininet-wifi
      Regards,
      Brian

  5. Richa Khandelwal

    Hi, I am trying to stream OrientDB data in gephi for visualization.
    I provide OrientDB url to get data from but it doesnt connect. It gives the following error:

    [SEVERE] null
    java.lang.NoSuchMethodError: org.gephi.graph.api.GraphController.getModel()Lorg/gephi/graph/api/GraphModel;
    at org.gephi.desktop.streaming.StreamingUIController.connectToStream(StreamingUIController.java:379)
    at org.gephi.desktop.streaming.StreamingUIController.connectToStream(StreamingUIController.java:175)
    at org.gephi.desktop.streaming.StreamingModel$ClientNode$1$1.run(StreamingModel.java:215)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

    Please help. I am stuck in this for long.

  6. Hey Brian, do we have any POX’s performance related document or web pages so that we can understand the throughput or peak load performance. Any statistics for the same?
    Thanks.

  7. Hi Brian,

    Firstly, I would like to say thank you for the informative material you explained here.

    Secondly, I faced an issue with “Plugins” as I can’t find any available plugin, nor Graph streaming nor any other one. I also tried to check for updates but unfortunately I have got an error message “Unable to connect to the Gephi Thirdparties Plugins because of server returned HTTP response code: 403 for URL http://gephi.org/updates/thirdparty/0.8.2/catalog.xml

    Could you please advise me in how to resolve this issue.

    Many thanks,

  8. Thanks,

    I have downloaded the new stable version of gephi for linux machine by using the following command:

    mininet@mininet-vm:~$ wget “https://github.com/gephi/gephi/releases/download/v0.9.1/gephi-0.9.1-linux.tar.gz”

    So, it’s working with me perfectly right now 🙂

    Best regards,

  9. Gaurang Lakhani

    Hello Brian
    Can u please send me help for how to implement multiple SDN controllers in mininet?

Comments are closed.

Scroll to Top