Search code examples
sdnopenflowopendaylightietf-restconf

Adding Flows to push MPLS via RESTCONF API of ODL controller


I'm a beginner in SDN and ODL and I am trying to add OpenFlow flows to OVS switches in mininet but the flows are not being reflected when I check the packets in Wireshark. Here's my scenario.

  • 3 switches with a linear topology and 3 hosts connected: sudo mn --topo linear --controller remote --switch ovsk,protocols=OpenFlow13
  • ODL controller running on the same VM as mininet

What I would like to do is to configure MPLS manually. For example, as a starting point I'm trying to add MPLS labels for packet going from Host1 to Host3. and I'm trying to accomplish this using RESTCONF API and I'm getting status code 200 (OK) for the requests I send. Below are the XML body of the RESTCONF requests.

For IP packets incoming on port 1 of Switch1, to push MPLS label with a value of 12 and forward it out of port 2: 0 0 0x8847 1 12 2 2 0 100 0x800 1 0 10 true 0 flow-action-push-mpls 220

URL = "http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table0/flow/100"

Headers = {'content-type': 'application/xml','accept': 'application/json'}

Request type = PUT

Authentication = Basic Auth

Then when I inspect packets with wireshark on port 2 of switch 1, I can't see the MPLS header.

OpenFlow and RestConf plugins are installed in ODL. What is the possible reason that the added flow is not acting on packets?

PS. I installed mininet using package manager and not using the prebuilt VM.


Solution

  • I found out that the OpenvSwitch was not running on my host! I had to restart the service in /etc/init.d/openvswitch-switch. I checked the status using $sudo /etc/init.d/openvswitch-switch status, normally it should say that openvswitch is running but it wasn't the case. To restart the service I did sudo /etc/init.d/openvswitch-switch restart

    After this, I was able to connect between the switches and the controller. But my flows were not pushed from the controller to the switches for a reason that I am still not sure what is it, but I guess that I had some missing xml tags, and it was fixed when I referred to the ODL end-to-end flows example https://wiki.opendaylight.org/view/Editing_OpenDaylight_OpenFlow_Plugin:End_to_End_Flows:Example_Flows, took the example i'm interested in, and customized it to my needs.