OpenFlow version 1.3 is the latest version of OpenFlow that has support from switch vendors. It is significantly different from OpenFlow version 1.0 (which was the previous version several vendors supported). Among others, the main features added since then are:

  • 1.1: Support for MPLS, Q-in-Q, VLANs, multipath, multiple tables, logical ports
  • 1.2: Support for extensible headers (in match, packet_in, set_field), IPv6
  • 1.3: Support for tunneling, per-flow traffic meters, Provider Backbone Bridging

In this tutorial you will learn more about OpenFlow version 1.3 under the covers.

1. Setup

To get started, download and set up the SDNHub VM in Virtualbox or VMware.

The VM has wireshark and OFDissector installed for OpenFlow version 1.3. The dissector is based on CPqD’s release. This enables us to inspect the exact syntax of the OpenFlow messages.

2. Quickstart

  • Run Mininet on a terminal window using the following command. This starts a network emulation environment to emulate 1 switch with 3 hosts.
sudo mn --topo single,3 --mac --controller remote --switch ovsk,protocols=OpenFlow13
  • Note that the above command will only work in our patched mininet. For other mininet installations, you can run the following command to make a switch supports OF 1.3:
ovs-vsctl set bridge s1 protocols=OpenFlow13
  • The Wireshark 1.11.3 that is part of the VM can parse OpenFlow 1.0, 1.1., 1.2, 1.3 and 1.4 messages. To start wireshark and view OpenFlow messages:
sudo wireshark &
  • Next, start the RYU Controller. Assume that the main folder where ryu is installed is in /home/ubuntu/ryu, The below command starts the controller by initiating the OpenFlow Protocol Handler and Simple Switch 1.3 application.
cd /home/ubuntu/ryu && ./bin/ryu-manager --verbose ryu/app/simple_switch_13.py
  • Next, check if the hosts in the mininet topology can reach each other
mininet> h1 ping h3
PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
64 bytes from 10.0.0.3: icmp_req=1 ttl=64 time=2.76 ms
64 bytes from 10.0.0.3: icmp_req=2 ttl=64 time=0.052 ms
64 bytes from 10.0.0.3: icmp_req=3 ttl=64 time=0.051 ms
  • You can now list the ongoing flows using the following command that is specific to OpenFlow 1.3:
sudo ovs-ofctl dump-flows s1 -O OpenFlow13

3. Understanding OpenFlow Messages

Assuming you built the learning switch application from the previous section, we now take a deep dive into understanding the set of OpenFlow messages exchanged between controller and switch, as shown in the following figure.

OF_MESSAGES

Connection Setup

The switch initiates a standard TCP (or TLS) connection to the controller. When an OpenFlow connection is established, each entity must send an OFPT_HELLO message with the protocol version set to the highest OpenFlow protocol version supported by the sender. In the below figure, we can see that OpenFlow version 1.3 has been negotiated.

OF_Hello

Feature Request – Reply

After successfully establishing a session, the controller sends an OFPT_FEATURES_REQUEST message. This message only contains an OpenFlow header and does not contain a body.

OF_Feature_Request

The switch responds with an OFPT_FEATURES_REPLY message. Notice the Datapath ID and the switch capabilities sent as part of the Feature reply message.

OF_Feature_Reply

Set Configuration

Next, the controller sends the OFPT_SET_CONFIG message to the switch. This includes the set of flags and Max bytes of packet that datapath should send to the controller.

OF_Set_Config

Multipart Request – Reply

The controller may request state from the datapath using the OFPT_MULTIPART_REQUEST message. The message types handled by this message include various statistics (FLOW/TABLE/PORT/QUEUE/METER etc) or description features (METER_CONFIG/TABLE_FEATURES/PORT_DESC etc). In our simple_switch_13.py, RYU internally sends a MULTIPART_REQUEST to request port description.

OF_Multipart_Request

 

The switch replies with the PORT_DESCRIPTION of all active ports in the switch. Note: in OF 1.0, the port descriptions was returned as part of the FEATURE_REPLY message. Now this is handled separately as MULTIPART_* in OF 1.3.

OF_Multipart_Reply

Flow Mod

Flows can be proactively (e.g., pre-install flows like TableMissFlow) or reactively (e.g., react for packet_in messages) sent from the controller. Flow table modi cation messages can have the following types: OFPFC_ADD, OFPFC_DELETE, OFPFC_DELETE_STRICT,  OFPFC_MODIFY, OFPFC_MODIFY_STRICT.

In the following case, the controller installs a new flow, which shows that apart from the set of OF 1.0 parameters like priority, idle_timeout etc, the match and instruction structure reflect the new parameters specified in 1.3.

OF_Flow_Mod
It is important to note that the switch does not positively acknowledge for FLOW_MOD messages. However, any error in the FLOW_MOD request will be replied with OFPET_FLOW_MOD_FAILED.

Set Async Configuration Message

Asynchronous messages are sent from a switch to the controller. The set of messages supported by the OpenFlow protocol include “Packet-Ins, Flow-Removed, Port-Status or Error” messages. When the switch connects to the controller, the controller can set the type of messages that it wants to receive on its OpenFlow channel.

OF_SetAsync

Above picture shows an async config message sent by the controller. Depending on the type of flags set, various async messages can be received from the switch.
 

Contributor:

Sriram Natarajan, RYU Code Contributor
Any questions, email: natarajan(dot)sriram(at)gmail(dot)com

2 comments on “OpenFlow version 1.3 tutorial

  1. on January 24, 2015
    hanu hanu says:

    Hi sriram,
    Great tutorial for know abt OF and SDN.
    In OF1.0, the feature_req has the switch supported actions and capabilities. below is the snoop of the ovs switch
    OFPT_FEATURES_REQUEST (xid=0x5238bd04):
    OFPT_FEATURES_REPLY (xid=0x5238bd04): dpid:00000090fa16c298
    n_tables:255, n_buffers:256
    capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP <<<<<<<<<<
    actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE <<<<<

    For OF1.3, the supported actions are not seen in the feature_req, can you post a screen shot of pcap for OF13 action supported by ovs switch ? I could not see in which msgs its seen.

    thanks
    hanu

  2. on October 9, 2015

    Excuse me. I faced this problems while i using miniedit to run a Topo
    MiniEdit running against Mininet 2.2.1
    topo=none
    Build network based on our topology.
    Getting Hosts and Switches.
    Getting controller selection:ref

    Getting Links.
    *** Configuring hosts
    h2 h1
    **** Starting 1 controllers
    c0 Cannot find required executable controller.
    Please make sure that it is installed and available in your $PATH:
    (/opt/local/bin:/sbin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/google_appengine/:/home/ubuntu/.rvm/bin:/home/ubuntu/bin:/home/ubuntu/apache-maven-3.3.3/bin)
    .
    COULD YOU HELP ME TO SLOVE IT.
    Thanks

Leave a Reply