Difference between revisions of "GSOC2010OpenFlow"

From Nsnam
Jump to: navigation, search
m (Progress)
Line 26: Line 26:
*Merge of-datapath into switch-net-device
*Merge of-datapath into switch-net-device
*Write converting functions for converting OpenFlow messages (of structs such as ofpbuf) into ns-3 messages (of classes such as Packet) and vice versa.
*Write functions for converting OpenFlow messages (of structs such as ofpbuf) into ns-3 messages (of classes such as Packet) and vice versa.
*Design the csma-switch test for testing OpenFlow functionality. [Once this is done, a second test can be done to test OpenFlow MPLS functionality].
*Design the csma-switch test for testing OpenFlow functionality. [Once this is done, a second test can be done to test OpenFlow MPLS functionality].
*Explore ways of allowing controllers to access the ns-3 OpenFlow switches.
*Explore ways of allowing controllers to access the ns-3 OpenFlow switches.

Revision as of 22:35, 22 June 2010

This project will enable ns-3 simulations to use OpenFlow switches (McKeown et al.), widely used in research. OpenFlow switches are configurable via the OpenFlow API, and also have an MPLS extension for quality-of-service and service-level-agreement support. By extending these capabilities to ns-3 for a simulated OpenFlow switch that is both configurable and can use the MPLS extension, ns-3 simulations can accurately simulate many different switches.


Week 1

  • Created the Switch module, initially as a copy of the Bridge module in ns-3.
  • Unpacked the OFSI code from the OpenFlowMPLS project (http://www.openflowswitch.org/wk/index.php/OpenFlowMPLS).
  • Studied OFSI code and drafted a plan to use it as a static C library, with wrappers for each OFSI struct, combining the struct and its related functions into an OOP class.
  • Created waf script to build the OFSI code as a static C library.

Week 2

  • Created the ns-3-openflow repository for checking in updates.
  • Discovered the wrapper plan would fail--it wouldn't be able to fix the fact that the OFSI code expected certain structs at certain levels of the code and those structs needed to be rewritten to properly integrate ns-3.
  • Drafted a new plan: start with the datapath.h{.c} code, translate it to C++, and integrate it into the Switch module.
  • Started the new plan.

Week 3

  • Finished translating the datapath.h{.c} code and datapath-struct-dependent code into C++ in an of-datapath.h{.c} file.
  • Started integrating ns-3 in the form of replacing dependencies on OFSI code where there exists an ns-3 equivalent.

Week 4

  • Finished integrating ns-3 in the form of replacing dependencies on OFSI code.
  • Starting work on demo code for testing of-datapath.h{.c} to make sure core functionality, such as flow-table manipulation and packet processing, works.
  • Starting work on making the of-datapath code more and more like the SwitchNetDevice class in the Switch module [the code will eventually be merged because the Datapath class in of-datapath is an OpenFlow-compatible Switch itself].


  • Merge of-datapath into switch-net-device
  • Write functions for converting OpenFlow messages (of structs such as ofpbuf) into ns-3 messages (of classes such as Packet) and vice versa.
  • Design the csma-switch test for testing OpenFlow functionality. [Once this is done, a second test can be done to test OpenFlow MPLS functionality].
  • Explore ways of allowing controllers to access the ns-3 OpenFlow switches.
  • Explore the OFSI STP (spanning tree protocol) implementation for possible use.


  1. Develop an OpenFlowSwitchHelper class that can take an ns3::Node and install an OpenFlowSwitch NetDevice. Develop an OpenFlowSwitch NetDevice and Channel.
    1. Draw inspiration from the OpenFlowMPLS model. There exists a software switch reference implementation for running MPLS-enabled OpenFlow, created by the OpenFlowMPLS Project (http://www.openflowswitch.org/wk/index.php/OpenFlowMPLS). This implementation, written in C code, melds an MPLS-functional OpenFlow build (openflow-mpls.tgz) with switch-running code (openflow-mpls.tgz/switch/) that runs in the user-space.
    2. Copy the MPLS-functional OpenFlow build. It will be a hard copy, not a linked dependency. Due to the MPLS functionality, the switch-running code depends on internal functionality that isn't yet present on the most recent non-MPLS OpenFlow build. It is configured to be built by make presently, so it will also be reconfigured to be built by waf.
    3. Translate the switch-running code into the ns-3 architecture. The software switch reference implementation has several fundamental issues that must be addressed.
      1. It's written in C that isn't compatible with C++ unless its compiled and built as a C static library. The majority of the code that doesn't need to be edited will be built as a C static library, the edited code will be translated into C++ with all of the following issues addressed.
      2. It runs on the command line. The code that sets up the switch using the OpenFlow API is in the 'main' function of openflow-mpls.tgz/switch/switch.c. It mostly focuses on the datapath struct, so the configuration of the datapath will become ns3::Attributes of the OpenFlowSwitch.
      3. It runs on physical ethernet devices. These will be abstracted to ns3::NetDevices, so that different NetDevices can be installed to simulate a PointToPoint, Wifi, et cetera receiving/sending adapters for the OpenFlowSwitch.
      4. It runs without maintaining a simulation clock. The ns3 simulation clock API will be used to synchronize the OpenFlowSwitch.
      5. It runs without ns-3 configurable parameters. These will be parameterized, variables will be added to the OpenFlowMPLS classes and structs, each linked to a specific ns3::Attribute.
      6. It runs, as expected, with different packet structs that aren't immediately compatible with ns3::Packets. Wrappers for converting between these classes will be developed for the OpenFlowSwitch class.
  2. To demonstrate this project's results are in working condition, I will endeavor to create an ns-3 simulation that demonstrates MPLS being used in a small topology. It should use code similar to:
Ptr<Node> switch = CreateObject<Node>();
OpenFlowSwitchHelper of;
// set other attributes


I have set up a repository on the ns-3 code server (at http://code.nsnam.org/bhurd/ns-3-openflow/). This repository will receive at least one update per week.

The OpenFlow software implementation distribution is hereby referred to as the OFSID. This is a demonstration of running OpenFlow in software that the OpenFlow research group has made available. There is also an OFSID that Ericsson researchers created to add MPLS capabilities; this is the OFSID currently included with the patch. The design of the patch will allow the users to, with minimal effort, switch in a different OFSID that may include more efficient code than a previous OFSID.

File/Directory Details
wscript Modification made to the main ns-3 building script. In order to link the OFSID C static library, "lib.uselib_local.append('openflow');" must be called in the build method. This is marked by #BHURD above and below the one line change.
src/helper/openflow-switch-helper.cc{.h} class OpenFlowSwitchHelper; Installs the OpenFlowSwitch NetDevice on a provided ns3::Node to give it OpenFlow switch capability.
src/devices/switch/ Directory containing the rest of the code: OpenFlowSwitch NetDevice and Channel code, a copy of an OFSID, and wrappers for accessing common structs and functions in the OFSID
src/devices/switch/of-datapath.cc{.h} The OFSID code is in C and styled in a way that cannot be quickly compiled into C++. As such, the code is compiled into a C static library and linked to the ns-3 project. This code bridges the gap by including the files from the static library and interfacing them in OOP-style C++ that mirrors the ns-3 programming style, based on openflow/switch/datapath.c{.h}.
src/devices/switch/switch-channel.cc{.h} The OpenFlowSwitch Channel. Currently it's just a copy of a BridgeChannel; it might stay superfluous as the project progresses in which case it will be removed before the project is officially finished.
src/devices/switch/switch-net-device.cc{.h} The OpenFlowSwitch NetDevice. of-datapath will be merged into this to provide OpenFlow functionality. Currently it's a copy of BridgeNetDevice.
src/devices/switch/waf Save some keystrokes to initiate a waf build from within the switch directory.
src/devices/switch/wscript Waf building script for the OpenFlowSwitch module. It has two parts to it: build the OpenFlow C static library from the OFSID, and build the OpenFlowSwitch module itself. The first part adds files from specifically named directories within the OFSID that are compiled into the library. The second part is similar to the building process of other modules/devices in ns-3, with create_ns3_module and ns3header for the three .cc and .h files within the OpenFlowSwitch module.
src/devices/switch/openflow A copy of an OFSID. This one has the MPLS extension built in, a distribution that Ericsson researchers developed to propose an OpenFlow standard that includes MPLS capability. There are many files within, and documenting them would take a long time. The grand majority aren't even used, the current abstraction uses wscript to build the necessary files into a C static library, and the of-datapath file contains the code that utilizes this library. Consider this a black box of OpenFlow functionality.


The code is forked into a separate "ns-3-openflow" repository, located at http://code.nsnam.org/bhurd/ns-3-openflow. I will push changes to this repository on at least a weekly basis.

The last three days of each time estimate will be spent testing and verifying the code. Time estimates based on the Approach chart:

  1. One week to complete the SwitchHelper class. SwitchHelper's functionality is relatively simple, and will probably be similar to other routers' Helper classes.
  2. One to two weeks to complete the shell of the Switch class. At this point, testing and verifying will be implemented. It will include making a small demo to make sure it can be used when ns-3 is built.
  3. Two to four weeks to complete the OpenFlow integration.
    1. One to two weeks to integrate the OpenFlowMPLS code into the switch without yet parameterizing it. At this point testing and verifying will be on a fully capable OpenFlow switch, so a network topology demonstration will be created with analysis on the results. There probably won't be too much output in the results because of the lack of parameters.
    2. One to two weeks to parameterize the OpenFlowMPLS code. The same demonstration developed for stage 2 should return more detailed results in the testing and verifying process, and should predictably change as different parameters are modified.
  4. One week to finalize the demonstration (it will already be partially constructed as of stage 2).
  5. Remaining time spent on testing, verifying, and polishing the code and adding documentation.


Kohler, E., Morris, R., Chen, B., Jannotti, J., and Kaashoek, M. F. 2000. The click modular router. ACM Trans. Comput. Syst. 18, 3 (Aug. 2000), 263-297. DOI= http://doi.acm.org/10.1145/354871.354874

Kurkowski, S., Camp, T., and Colagrosso, M. 2005. MANET simulation studies: the incredibles. SIGMOBILE Mob. Comput. Commun. Rev. 9, 4 (Oct. 2005), 50-61. DOI= http://doi.acm.org/10.1145/1096166.1096174

McKeown, N., Anderson, T., Balakrishnan, H., Parulkar, G., Peterson, L., Rexford, J., Shenker, S., and Turner, J. 2008. OpenFlow: enabling innovation in campus networks. SIGCOMM Comput. Commun. Rev. 38, 2 (Mar. 2008), 69-74. DOI= http://doi.acm.org/10.1145/1355734.1355746

Neufeld, M., Jain, A., and Grunwald, D. 2002. Nsclick:: bridging network simulation and deployment. In Proceedings of the 5th ACM international Workshop on Modeling Analysis and Simulation of Wireless and Mobile Systems (Atlanta, Georgia, USA, September 28 - 28, 2002). MSWiM '02. ACM, New York, NY, 74-81. DOI= http://doi.acm.org/10.1145/570758.570772

About Me

I've been a programmer for the past six years, and I received my B.S. in Computer Science from West Chester University in Spring 2009. I've always been interested in research, and now as a newly accepted Temple University PhD student (starting Fall 2010), I want to pursue the Networking field within research. An ns-3 project in GSoC 2010 presents this perfect opportunity: I can enter my PhD career as someone who is already furthering academia.

I have been programming in C++ and Python for the past six years. As for ns-3 experience, I've been working with ns-3 for the past two months, since I first saw the opportunity for Networking research through GSoC by working with ns-3.

This is my first attempt at adding to an open source project.


I did a Natural Language Processing (NLP) research project in my senior year at West Chester University. I programmed in Python, and experimented with using the Natural Language Toolkit (NLTK) to parse text into flash cards, an automatic SparkNotes for studying purposes.

Personal Interests

I have a variety of interests within Computer Science research. I'm interested in AI, specifically as it applies to Natural Language Processing (NLP), and how NLP could be used to automatically generate supplementary studying and testing material for students. I'm also interested in cloud computing as a method for dividing-and-conquering all sorts of research problems. But most importantly, I am interested in Networking research, which I will able to fully pursue at Temple University. Because I am focusing my research on Networking, I want to pursue a GSoC 2010 project that will teach me more about Networking and make me better known to the Networking academic community.