Ask Your Question
1

RESTCONF Troubleshooting

asked 2015-06-30 08:59:40 -0700

runamuck gravatar image

I connected my switch to a controller. The switch appears when I call.

http://127.0.0.1:8181/restconf/operational/opendaylight-inventory:nodes/

I pushed a flow to the config database and it returns Status 200.

When I do a GET to the same address, the API returns the flow.

But, if I go to my switch:

$ sudo ovs-ofctl -O OpenFlow13 dump-flows br0

The flow does not appear.

I repeated and set "strict" and "installHW" to true and that did not do anything.

===================================================================

Here is the XML I used for the PUT:

PUT http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:49213347348856/flow-node-inventory:table/0/flow/256

Request Headers:

Accept: application/xml
Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36
CSP: active
Authorization: Basic YWRtaW46YWRtaW4=
Content-Type: application/xml 
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: _sm_au_c=iVVMPFsMt00NJv6P0d

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
    <strict>false</strict>
    <instructions>
        <instruction>
            <order>0</order>
            <go-to-table>
                <table_id>1</table_id>
            </go-to-table>
        </instruction>
    </instructions>
    <table_id>0</table_id>
    <id>256</id>
    <cookie_mask>10</cookie_mask>
    <installHw>false</installHw>
        <match>
            <ipv4-source>192.168.11.0/24</ipv4-source>
            <ipv4-destination>192.168.11.0/24</ipv4-destination>
            <ip-match>
                <ip-protocol>4</ip-protocol>         
            </ip-match>
            <in-port>0</in-port>
        </match>   
    <hard-timeout>1800</hard-timeout>
    <cookie>10</cookie>
    <idle-timeout>1800</idle-timeout>
    <flow-name>flow-instruction-go-to-table</flow-name>
    <priority>2</priority>
    <barrier>false</barrier>
</flow>

Result of GET:

GET http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:49213347348856/flow-node-inventory:table/0/flow/256

<flow xmlns="urn:opendaylight:flow:inventory">
    <id>256</id>
    <priority>2</priority>
    <hard-timeout>1800</hard-timeout>
<instructions>
    <instruction>
        <order>0</order>
            <go-to-table>
            <table_id>1</table_id>
            </go-to-table>
    </instruction>
</instructions>
<match>
    <in-port>0</in-port>
    <ipv4-source>192.168.11.0/24</ipv4-source>
    <ipv4-destination>192.168.11.0/24</ipv4-destination>
    <ip-match>
        <ip-protocol>4</ip-protocol>
    </ip-match>
</match>
<flow-name>flow-instruction-go-to-table</flow-name>
<installHw>false</installHw>
<cookie_mask>10</cookie_mask>
<table_id>0</table_id>
<idle-timeout>1800</idle-timeout>
<barrier>false</barrier>
<strict>false</strict>
<cookie>10</cookie>
</flow>
edit retag flag offensive close merge delete

6 answers

Sort by ยป oldest newest most voted
3

answered 2015-07-09 07:42:31 -0700

runamuck gravatar image

updated 2015-07-09 07:53:42 -0700

Solved it! I read the OVS-OFCTL man page and read:

The following shorthand notations are also available:
tcp    Same as dl_type=0x0800,nw_proto=6

I then created a flow using ovs-ofctl with the tcp shorthand. The controller picked it up, and when I used the RESTCONF API to plumb the operational store, I noticed that the controller added:

<match>
 <ethernet-match>
    <ethernet-type>
      <type>2048</type>
    </ethernet-type>
 </ethernet-match>

 ...

 <ip-match>
  <ip-protocol>6</ip-protocol>
 </ip-match>
</match>

So, I modified my RESCONF Call above with the following:

  1. I added a section that matches on Ethertype
  2. I change the IP Proto from 4 (ip) to 6 (tcp)
  3. I deleted a bunch of garbage: strict, cookie_mask, installHW and barrier
  4. I set the timeouts to zero.

Here is the new flow that works:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
    <instructions>
        <instruction>
            <order>0</order>
            <go-to-table>
                <table_id>1</table_id>
            </go-to-table>
        </instruction>
    </instructions>
    <table_id>0</table_id>
    <id>256</id>
    <match>
        <ethernet-match>
            <ethernet-type>
                <type>2048</type>
            </ethernet-type>
        </ethernet-match>
        <ipv4-source>192.168.11.0/24</ipv4-source>
        <ipv4-destination>192.168.11.0/24</ipv4-destination>
        <ip-match>
            <ip-protocol>6</ip-protocol>         
        </ip-match>
        <in-port>0</in-port>
    </match>   
    <hard-timeout>0</hard-timeout>
    <cookie>10</cookie>
    <idle-timeout>0</idle-timeout>
    <flow-name>flow-instruction-go-to-table</flow-name>
    <priority>200</priority>
</flow>

My theorey is that by leaving out Ethertype I "wildcarded" Layer 2. As OVS-OFCTL writes:

When dltype is wildcarded or set to a value other than 0x0800, 0x0806, or 0x8035, the values of nwsrc and nw_dst are ignored (see Flow Syntax above).

edit flag offensive delete publish link more

Comments

It worked for me! Thanks a lot!

Wayko ( 2015-07-10 06:15:15 -0700 )edit

Very good runamuck! Very useful your method of installing the flows by ovs commands and then GET them to know the sintax!

Edu ( 2015-07-14 00:30:55 -0700 )edit
1

Feel free to up-vote :-) (Click the up arrow on my answer)

runamuck ( 2015-07-15 15:11:59 -0700 )edit

for sure I had already done it ;)

Edu ( 2015-07-15 22:59:54 -0700 )edit

I am also facing the same issue. But in my case I am using json instead of xml. I am getting 200 response code but no flow in switch.

NareshA ( 2015-12-24 05:38:58 -0700 )edit
0

answered 2015-07-01 06:45:36 -0700

Wayko gravatar image

I'm having almost the same kind of problem and I noticed that the flows that are appearing on the switch with

$ sudo ovs-ofctl -O OpenFlow13 dump-flows br0

Are the ones that you can find getting info form the API:

curl -XGET -u admin:admin -H "Accept: application/json" http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:49213347348856/flow-node-inventory:table/0/flow/256

Doing the PUT request to /restconf/config/.../table/0/flow/256... the flows are put in /restconf/config/.../table/0/flow/256 not in restconf/operational/.

I'm still working into this issue :/

edit flag offensive delete publish link more

Comments

Thanks Wayko, I look forward to any help!

runamuck ( 2015-07-01 07:06:10 -0700 )edit

when u add flow that will 1st added into config data store and then it will added into operational data store.so it is not necessory that every flow which is present on config data store should present on operational data store.

Ashwini_Mhatre ( 2015-07-23 23:06:58 -0700 )edit
0

answered 2015-07-01 07:11:02 -0700

Edu gravatar image

I also have the same exact problem. Wayko, as far I have read what you say is true: we have to put the flows in the restconf/config and if OpenFlow accept the values that we are sending, it automatically send the flow to the restconf/operational which is the API used by the switch to get the flows. Anyway, I am sending the flow that comes as an example in the wiki "end to end flows" and it doesn't work :(

If anyone can help please! Thaanks

edit flag offensive delete publish link more

Comments

Here's the weird thing. I switched to the Brocade Vyatta Controller (A re-packaging of helium) and tried this example: http://www.brocade.com/content/html/en/user-guide/bvc-14-user-guide/GUID-499EE6B1-13F5-47CF-8C26-37917BA291EF.html and it worked! It went right to my switch!

runamuck ( 2015-07-03 10:15:43 -0700 )edit
0

answered 2015-07-08 14:02:15 -0700

jamoluhrsen gravatar image

runamuck,

I wonder if you are using certain flows that are just not working with the controller and should be investigated as bugs? Could you start an email thread with me so we can discuss more clearly? (jluhrsen 'at' gmail)

Thanks, JamO

edit flag offensive delete publish link more
0

answered 2015-07-23 23:14:05 -0700

Ashwini_Mhatre gravatar image

updated 2015-12-27 22:31:32 -0700

when u add flow that will 1st added into config data store and then it will added into operational data store.so it is not necessory that every flow which is present on config data store should present on operational data store.if it does not getting added in operational data store: there may be following issues 1.may be format of flow body is wrong 2.dl_type is always necessory if u are specifing ipv4 source and destination in match 3.if u are using ovs switches check the version of ovs. some times ovs with 2.0.2 supports some flow format but above version will not 4.if u are using openvswitch .u can check logs with/var/log/openvswitch

For Refrence U can go through following application: https://github.com/ashvini/pythonapp

Thanks . Regards, Ashwini mhatre

edit flag offensive delete publish link more
0

answered 2015-12-24 05:50:22 -0700

NareshA gravatar image

Hi all, I am also facing the same issue. I am using json instead of xml.

Following is my url and request body (json)

http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/10

{"flow": {"instructions": {"instruction": {"order": "0","apply-actions": {"action": { "order": "0" }}}},"table_id": "2","id": "10","cookie_mask": "255","match": { "ethernet-match": {"ethernet-type": { "type": "2048" }},"ipv4-source": "10.0.0.1/24"},"hard-timeout": "12","cookie": "3","idle-timeout": "34","flow-name": "Blocking flow1","priority": "2"}}

I want to add 'drop' as an action. Not sure how to do that.

For this request I get 200 as response code, but the flow is not installed in the switch when i check dump-flows. Please anyone help me in this issue.

edit flag offensive delete publish link more

Comments

You want to also add the JSON equivalent of <ip-match> <ip-protocol>6</ip-protocol> </ip-match>

runamuck ( 2015-12-25 18:33:59 -0700 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
2 followers

Stats

Asked: 2015-06-30 08:59:40 -0700

Seen: 2,199 times

Last updated: Dec 27 '15