QoS using OpenDaylight

Introduction
OpenFlow provides limited support for QoS using queues and meters. Most of the software switches support queues. Queues are created and configured outside the OpenFlow protocol. OpenFlow provides the implementation to the controller to use these queues in the flows. In this blog post, we explain how to use queues in OpenFlow 1.3 and implement QoS in a network topology created using mininet and OpenDaylight(ODL) controller.

Configuring queues in Open vSwitch (OVS)
To implement quality of service (QoS) in an OVS switch, we need to create a QoS policy and queues with different bandwidths. Next, we need to add these queues in the QoS policy and connect the policy to a port on the switch where we want to implement the QoS. Finally we have to map the required queue Id with the flow. Below are OVS commands to list all qos and queues

sudo ovs-vsctl list qos
sudo ovs-vsctl list queue

Below are OVS commands to bulk destroy all qos and queues

sudo ovs-vsctl --all destroy qos
sudo ovs-vsctl --all destroy queue

Implementing Queues in OpenDaylight using REST API
1. Create a single switch, 2 hosts mininet topology using command below:

sudo mn --topo single,2 --controller=remote,ip=127.0.0.1

This will create a topology with a single switch connected with two hosts h1(10.0.0.1) and h2(10.0.0.2). Next, Start the ODL controller and test a ping from h1 to h2.  If ping is successful you are good to go to next steps. We are using beryllium version of ODL.

2. Create a QoS policy and attach it with the desired switch port using commands below:

sudo ovs-vsctl set port s1-eth1 qos=@newqos -- --id=@newqos create qos
 type=linux-htb other-config:max-rate=5000000 queues=1=@q1,2=@q2
 -- --id=@q1 create queue other-config:min-rate=5000000
 other-config:max-rate=5000000 -- --id=@q2 create queue
 other-config:min-rate=3000000 other-config:max-rate=3000000

In the command above, we are creating a QoS policy of type linux-htb having maximum data transfer rate of 5 Mbps and attaching it to port s1-eth1. We are also creating 2 queues q1 with queue id = 1 and q2 with queue id = 2 and adding these queues in the QoS policy. q1 has a maximum transfer rate of 5 Mbps and a minimum transfer rate of 5 Mbps. q2 has a maximum transfer rate of 3 Mbps and a minimum transfer rate of 3 Mbps.  One thing to note down is that the QoS method is egress only which means these rates will be applicable when the packets are being forwarded out from the port.

3. Map the queue with the flow from h1 to h2 using REST API as below:
Submit a HTTP PUT request using Postman to the ODL controller using headers:

Set body of the request as shown in code block below. The <set-queue-action> in the flow mentioned below is mapping the queue with queue id = 1 with the flow.

<flow xmlns="urn:opendaylight:flow:inventory">
<id>iperf</id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>1</order>
<output-action>
    <output-node-connector>NORMAL</output-node-connector>
    <max-length>65535</max-length>
</output-action>
</action>
<action>
<order>0</order>
<set-queue-action>
    <queue-id>1</queue-id>
</set-queue-action>
</action>
</apply-actions>
</instruction>
</instructions>
<barrier>true</barrier>
<flow-name>iperf</flow-name>
<match>
<ethernet-match>
            <ethernet-type>
                <type>2048</type>
            </ethernet-type>
        </ethernet-match>
        <ipv4-source>10.0.0.2/32</ipv4-source>
        <ipv4-destination>10.0.0.1/32</ipv4-destination>
        <ip-match>
            <ip-protocol>6</ip-protocol>         
        </ip-match>
        <tcp-destination-port>12345</tcp-destination-port>
</match>
<hard-timeout>0</hard-timeout>
<priority>32768</priority>
<table_id>0</table_id>
<idle-timeout>0</idle-timeout>
</flow>

Iperf Testing
Test it using iperf data transfer. Start iperf server on h1 on port 12345 and send data from h2 on that port. Below we are attaching some screen shots for reference:
Before implementing QoS:

selection_002

After implementing the QoS:

selection_003

Conclusion
OpenFlow provides limited support for QoS on cost of its complexity. In this post we explained how to use queues and implement QoS using ODL controller. Meters are supported in OpenFlow 1.3 which unlike queues are created and configured using OpenFlow protocol itself. We will be discussing meters in our next blog post.


 

One thought on “QoS using OpenDaylight

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s