Uberflow: open-source implementation of a SDN controller


Project Download Instructions News Contact

uberflow

A small and efficient SDN controller.

License

Copyright (C) 2014 Viagénie Inc. http://www.viagenie.ca

Uberflow is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Uberflow is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Uberflow. If not, see http://www.gnu.org/licenses/.

This program includes code taken from the following projects:

  • klib, distributed under MIT/X11 license.
  • linenoise, distributed under BSD license.

Conventions

In this document, commands executed as a user are prefixed with $, whereas commands executed as root are prefixed with #.

Compile

  • Tested on the following distributions:

    • Debian 7.7 "Wheezy": 32/64 bits
    • Fedora 21: 32/64 bits
    • Archlinux (2014-12-20): 64 bits
  • Dependencies:

    • Debian: cmake make gcc pkg-config libevent-2.0-5 libevent-dev
    • Fedora: cmake make gcc pkg-config libevent libevent-devel
  • Process:

    $ mkdir build
    $ cd build/
    $ cmake ..
    $ make
    

Execution

$ cd build
$ mkdir -p /run/user/$UID/uberflow
$ ./uberflow

or, if you run uberflow as root:

# cd build
# mkdir -p /run/uberflow
# ./uberflow

It is also possible to specify an other location for the control socket:

$ cd build
$ ./uberflow -c /tmp/uberflow/socket

The -c option takes a full path to the socket location. Every directory in the specified path must exist.

How-To Mininet

  • Download the latest release of Mininet VM images.
  • Extract and import image in the virtualization software following the setup notes

  • Log in to the VM:

    mininet-vm login: mininet
    Password: mininet
    
  • To launch mininet using uberflow as a controller:

    $ sudo mn --controller=remote,ip=127.0.0.1
    

Replace 127.0.0.1 by the IP of the machine uberflow is running on.

cberflow

cberflow is a small CLI for managing an uberflow instance. It is very simple, stupid, and not robust. It is mainly used to manage flows on datapaths, for testing purposes, and to get a view of uberflow internal state.

Compilation

cberflow is automatically compiled when uberflow is.

Execution

A running instance of uberflow is needed.

$ cd build
$ ./cberflow

Use

cberflow CLI is based on "mode". When the application is launched, the current mode is the "general mode", represented by the following prompt.

cberflow >

To change mode, commands need to be entered. To exit the current mode, simply enter quit.

List datapaths

In general mode, enter list. The list of connected datapath is displayed:

cberflow> list
DPIDs:
DPID #1
cberflow>

Dapatath mode

Enter dpid XX, where XX is the DPID of the datapath you want to manage or inspect:

cberflow> dpid 1
DPID 1>

Datapath description

To see a datapath description , enter stats in datapath mode:

DPID 1> stats
DP 1 has following description:
    -manufacturer: 'Nicira, Inc.'
    -hardware: 'Open vSwitch'
    -software: '2.0.1'
    -serial: 'None'
    -description: 'None'

Flow mode

In datapath mode, enter flow:

DPID 1> flow
DPID 1> Flow>

List flows

In flow mode, enter list. A list of flow cookies for the flows defined in uberflow is displayed:

DPID 1> Flow> list
Flows:
Flow #8861770792587199551
Flow #3612468477143607486

Create a flow

In flow mode, enter add to enter the flow edition mode:

DPID 1> Flow> add
DPID 1> Flow> Add>

In the current flow edition mode, it is possible to set the main properties of the flow:

DPID 1> Flow> Add> idle_timeout 1234

To see the current flow properties, enter print:

DPID 1> Flow> Add> print
Flow:
    idle_timeout = 1234
    hard_timeout = 0
    priority = 0
    buffer_id = 4294967295
    out_port = 65535
    flags = 3

To edit match parameters, enter match:

DPID 1> Flow> Add> match
DPID 1> Flow> Match>

Edition of match parameters is done the same way as for flow properties:

DPID 1> Flow> Match> dl_type 2048

To display current match properties, enter print:

DPID 1> Flow> Match> print
Match structure:
    wildcards = 0
    in_port = 0
    dl_src = 00:00:00:00:00:00
    dl_dst = 00:00:00:00:00:00
    dl_vlan = 0
    dl_vlan_pcp = 0
    dl_type = 2048
    nw_tos = 0
    nw_proto = 0
    nw_src = 0.0.0.0
    nw_dst = 0.0.0.0
    tp_src = 0
    tp_dst = 0

Once match parameters are set, enter quit to return to the flow edition mode:

DPID 1> Flow> Match> quit
DPID 1> Flow> Add>

Actions definition is done by entering actions:

DPID 1> Flow> Add> actions
DPID 1> Flow> Action>

To add an action, simply enter the action name and its parameters:

DPID 1> Flow> Action> output 1 100
DPID 1> Flow> Action>

Once action edition is done, enter quit to return to the flow edition mode:

DPID 1> Flow> Action> quit
DPID 1> Flow> Add>

To save the flow and apply it on the datapath, enter save. It will exist the flow edition mode:

DPID 1> Flow> Add> save
DPID 1> Flow>

Flow removal

To remove a flow, in flow mode, enter del XX, where XX is the flow's cookie:

DPID 1> Flow> del 8861770792587199551
DPID 1> Flow>

Packet Out

To create a packet out request, enter packet from the datapath mode:

DPID 1> packet
DPID 1> Packet>

To set packet out message properties:

DPID 1> Packet> buffer_id 5432
DPID 1> Packet>

To display current properties:

DPID 1> Packet> print
Packet:
    buffer_id = 5432
    in_port = 65535

Actions definition is done by entering actions:

DPID 1> Packet> actions
DPID 1> Packet> Action>

To add an action, simply enter the action name and its parameters:

DPID 1> Packet> Action> output 1 100
DPID 1> Packet> Action>

Once action edition is done, enter quit to return to the packet edition mode:

DPID 1> Packet> Action> quit
DPID 1> Packet>

To send the packet out message to the datapath, enter save. It will exist the packet out edition mode:

DPID 1> Packet> save
DPID 1>

Openflow conformance

Openflow 1.0.0

The specification is available on the Open Networking Foundation website.

Implemented

  • HELLO
  • ECHO_REQUEST/ECHO_REPLY (no payload)
  • FEATURES_REQUEST/FEATURES_REPLY
  • GET_CONFIG_REQUEST/GET_CONFIG_REPLY
  • PACKET_IN
  • FLOW_REMOVED
  • PORT_STATUS
  • PACKET_OUT
  • FLOW_MOD
  • STATS_REQUEST/STATS_REPLY:
    • DESC
    • FLOW
  • BARRIER_REQUEST/BARRIER_REPLY
  • ERROR (no transaction reference)

TODO

  • ECHO_REPLY (with payload)
  • VENDOR
  • SET_CONFIG
  • PORT_MOD
  • STATS_REQUEST/STATS_REPLY:
    • AGGREGATE
    • TABLE
    • PORT
    • QUEUE
    • VENDOR
  • QUEUE_GET_CONFIG_REQUEST/QUEUE_GET_CONFIG_REPLY
  • ERROR (with transaction reference)

Code conventions

General

No trailing whitespaces! For this, you can enable the built-in Git hook .git/hooks/pre-commit of your local clone.

Naming Convention

ofp_xxx objects are imported from the Openflow header. Data is encoded using network byte order.

uf_xxx objects are Uberflow implementation of Openflow concepts (they may be abstraction of SDN's components such as switches, or simple redefinitions of Openflow messages). Data is encoded using host byte order. Sometimes, an uf_xxx object will have a member of type ofp_yyy. Only in such cases will this member be using host byte order.

Entities

The following naming scheme is used for entities:

void uf_entity_sub-entity_function_verb(...)

For example, to add a port to a switch:

void uf_switch_port_add(...)

Validation using wireshark

Wireshark 1.12.1 has a bug in the openflow v1 dissector: it misses some padding in the OFPT_FEATURES_REPLY (see Bug #10493).

Fixed in revision 4c3655edce38d1b22c67caf4ee0b8f9eeb6404cc

OFTP_PORT_STATUS

  • Launch mininet in default configuration.
  • Wait for system to be in stable state.
  • On mininet console, enter:

    $ link h1 s1 down
    
  • This will administratively switch off the ports on the switch.

  • There should be 2 OFTP_PORT_STATUS messages:
    • The first one modifying the config flag.
    • The second one for the state flag.

TODO

  • Define NBI-like interface.
  • Zero-copy.

  • Associate ERROR message with previous xid (especially for FLOW_MOD messages).

  • Associate OFPT_STATS_REPLY with a control application connection.
  • Add helpers to create actions.
  • Clean-up src/msg_processor.[ch]