GSOC2010OpenFlow

From Nsnam
Revision as of 05:50, 8 July 2010 by Bhurd (Talk | contribs) (Progress)

Jump to: navigation, search

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.

Progress

5/31 -- 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 wrapper code 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.

6/7 -- 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.

6/14 -- Week 3

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

6/21 -- 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{.cc} to make sure core functionality, such as flow-table manipulation and packet processing, works.
  • Starting work on making the Datapath class 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, just with ties to hardware ethernet devices instead of ns-3 ones].
  • Starting to work on functions for converting OpenFlow messages (of structs such as ofpbuf) into ns-3 messages (of classes such as Packet) and vice versa.

6/28 -- Week 5

  • Finished making the Datapath class mergeable.
  • Started merging the Datapath class with SwitchNetDevice.

7/5 -- Week 6

  • Finished merging the Datapath class with SwitchNetDevice. The of-datapath.h{.cc}, now renamed openflow-interface.h{.cc}, contains the miscellaneous OpenFlow classes the SwitchNetDevice uses.
  • Started working on the csma-switch demo for SwitchNetDevice, testing the conversion functions for converting ns3 Packets into OpenFlow buffers (ofpbuf) and testing the flow table.

---This is midpoint of the project---

Future

  • Once the csma-switch demo for showing OpenFlow functionality is done, create a second test for showing OpenFlow MPLS functionality.
  • Incorporate ns-3 simulation clock.
  • Incorporate ns-3-configurable parameters into the switch code.
  • Explore ways of allowing controllers to access the ns-3 OpenFlow switches. Presently it is theoretically possible (assuming the OFSI code works; I haven't analyzed and demoed this part yet) to create an rconn on a port and run a separate controller program (a sample is in the OFSI code) to push IP packets with an OpenFlow message over the rconn
  • Explore the OFSI STP (spanning tree protocol) implementation for possible use.

Approach

  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;
of.SetAttribute("EnableMPLS",BooleanValue(true));
// set other attributes
of.Install(switch);

Deliverables

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 Several modifications made to the main ns-3 building script, marked by #BHURD above and below: 1) In order to link the OFSID C static library, "lib.uselib_local.append('openflow');" must be called in the build method. 2) To link the OFSID library, the include path needs to be updated. Furthermore, the OFSID library requires the libxml2 (for MPLS FIB xml file parsing) and libdl (for address fault checking) libraries to be linked as well [Note: The code that uses these libraries are unused by SwitchNetDevice and the openflow-interface code, so when the project is finalized this may no longer be a requirement]. These are added to the configure method.
src/devices/switch/ The Switch Module Directory, contains all the code.
src/devices/switch/openflow-interface.cc{.h} Includes OFSI files from the static library and presents an OOP C++ interface. SwitchNetDevice includes this to interface OpenFlow capabilities.
src/devices/switch/switch-channel.cc{.h} class SwitchChannel; Currently a superfluous copy of BridgeChannel. If it still isn't needed when the project concludes, it will be removed before the official release.
src/devices/switch/switch-helper.cc{.h} class SwitchHelper; Installs the SwitchNetDevice on a provided ns3::Node to give it OpenFlow switch capability. Like the BridgeNetDevice, it takes a NetDeviceContainer that contains NetDevices to install as the switch's ports.
src/devices/switch/switch-net-device.cc{.h} WIP The OpenFlow-compatible SwitchNetDevice. The flow table is fully implemented, but expects OpenFlow structs to manipulate it (a layer of simplification may be added in the future so the user can easily create a flow that matches a certain ns3::Packet). Currently when a packet is received over the port, it matches against the flow table, and creates a new flow that matches the packet if no flow exists. Currently, this new flow always drops a packet matched to it. Controller connectivity is blocked off as well.
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 all files from specific directories within the OFSID and compiles them 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 .cc and .h files within the Switch 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 openflow-interface .h and .cc contain the code that utilizes this library. Consider this a black box of OpenFlow functionality.

Plan

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.

References

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.

Research

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.