[CONTROLLER-693] Table-id in restconf uri and flow xml is different, yet flow installs successfully and it creates problem for statistics manager Created: 14/Aug/14  Updated: 25/Jul/23  Resolved: 05/May/15

Status: Resolved
Project: controller
Component/s: adsal
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Anil Vishnoi Assignee: Jan Hajnar
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC


External issue ID: 1553

 Description   

I am install flow to table = 0 of the switch using following restconf uri

POST : http://localhost:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1234

but the table number i am using in request flow data is different then the one i am using in the url. I am using table=2 in the flow data.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<barrier>false</barrier>
<cookie>10</cookie>
<cookie_mask>10</cookie_mask>
<flags>SEND_FLOW_REM</flags>
<flow-name>FooXf1</flow-name>
<hard-timeout>0</hard-timeout>
<id>1234</id>
<idle-timeout>0</idle-timeout>
<installHw>false</installHw>
<instructions>
<instruction>
<apply-actions>
<action>
<order>0</order>
<dec-nw-ttl/>
</action>

<action>
<order>1</order>
<nx-reg-load xmlns="urn:opendaylight:openflowplugin:extension:nicira:action">
<dst>
<nx-reg xmlns:nxSB="urn:opendaylight:openflowjava:nx:match">nxSB:nxm-nx-reg0</nx-reg>
<start>0</start>
<end>5</end>
</dst>
<value>55</value>
</nx-reg-load>
</action>

</apply-actions>
<order>0</order>
</instruction>
</instructions>
<match>
<ethernet-match>
<ethernet-type>
<type>2048</type>
</ethernet-type>
</ethernet-match>
<ipv4-destination>10.0.0.1/24</ipv4-destination>

<extension-list xmlns="urn:opendaylight:openflowplugin:extension:general">
<extension-key xmlns:nxNB="urn:opendaylight:openflowplugin:extension:nicira:match">nxNB:nxm-nx-reg0-key</extension-key>
<extension>
<nxm-nx-reg xmlns="urn:opendaylight:openflowplugin:extension:nicira:match">
<reg xmlns:nxSB="urn:opendaylight:openflowjava:nx:match">nxSB:nxm-nx-reg0</reg>
<value>42</value>
</nxm-nx-reg>
</extension>
</extension-list>

</match>
<priority>2</priority>
<strict>false</strict>
<table_id>2</table_id>
</flow>

This flow get installed successfully to the switch. But in config data store this flow is stored under table 0, but when this flow goes to switch it gets install in the table=2 of the switch. It creates problem for the statistics manager, because when it fetches flow data from the switch, flow data contains table=2, but when it look for the respective flow in the table=2 of the config data store, it doesn't find the flow and it augments the flow in table =2 as a alien flow using specific id, but in reality that flow already exist in the system and present under table=0. This is causing various bugs where user installs the flow, but didn't find the statistics in the operational data store at the respective location.

I used mininet with openflow 1.3+ switch for the testing.

Please let me know if you need any more details to recreate the issue.



 Comments   
Comment by Jozef Gloncak [ 15/Aug/14 ]

Problem is in way how you are combining HTTP method POST and data payload.

Suppose following data tree: /el1/el2/el3/.../elN
When you are using POST then:

  • uri: /el1/el2/
  • payload: /el3/el4/..../elN

In your comment there is uri ......./table/0/flow/1234 but data also contains flow element with <id>1234</id>

Such using is possible in PUT where

  • uri: /el1/el2/el3
  • payload: /el3/el4/....
    and here is validating equality (for list element) of all keys in URI with keys in payload.
Comment by Anil Vishnoi [ 15/Aug/14 ]

Hi Jozef,

From restconf perspective this is okay, but it's resulting in incorrect functional behavior. The intent of the bug was to validate the uri data with the body data by the entity that is responsible for installing these flows. I believe its FRM, so it should validate that the flow its going to install in the switch is also stored at the expected location in the data store. If it fails in doing that, network state and data store state is not going to be in sync and that can result in inconsistent behavior of the whole system.

Thanks
Anil

Comment by Vaclav Demcak [ 18/Aug/14 ]

https://git.opendaylight.org/gerrit/#/c/10024/

Comment by Anil Vishnoi [ 04/Sep/14 ]

Above mentioned patch is merged so i tried to test it. So i tested following two scenario (using the example flow i mentioned in bug report)

URI: http://localhost:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1235 (flow id is 1235)

But in body flow id is 1234 and it resulted in following output

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<errors
xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error>
<error-type>protocol</error-type>
<error-tag>invalid-value</error-tag>
<error-message>The value '1235' for key 'id' specified in the URI doesn't match the value '1234' specified in the message body. </error-message>
</error>
</errors>

So this is correct behavior. I tried following second scenario

URI: URI: http://localhost:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/2/flow/1234 (table id is 2)

but in body table-id is 0. When i fire this rest call, postman gives me response status 200 OK, but i do see that controller spit following error

ERROR o.o.c.frm.impl.FlowForwarder - TableID in URI tableId=0 and in palyload tableId=2 is not same.

BUT i can see this flow in config data store under /table/2/flow/1234.

is this expected behavior ?

Comment by Jan Hajnar [ 10/Sep/14 ]

Hi,

I believe this behavior is correct.

In the first case, restconf compared keys from the path with keys defined in the payload and found a difference -> this is clearly a mistake and you will get exception when you will try to store flow like this in data store -> you receive error.

In the second case, table id in the flow is not part of the key so you didn't get exception. From restconf/data store standpoint this payload is valid. (table id is just one of the parameters of the flow and there is no reference to the parent Table id) But, as you can see in second scenario error was thrown by forwarding rules manager -> this flow didn't pass forwarding rules manager validation and was not sent to the device.
There is nothing stopping you from creating invalid flow configuration in config data store. As you said, it is role of plugins that will try to work with this flow (FRM in this case) to validate if flow parameters are sane before sending them to device. You are responsible for removal/modification of this incorrect flow in the config data store.

I think this bug is fixed because your flow will not get to the device unless you correct your table id -> misbehavior that you described when you created this bug is fixed.

Comment by Jan Hajnar [ 11/Sep/14 ]

Marking as fixed.

Related bug for flow config table_id mismatch:
https://bugs.opendaylight.org/show_bug.cgi?id=1810

Comment by Carol Sanders [ 05/May/15 ]

This bug is part of the project to Move all ADSAL associated component bugs to ADSAL.

Generated at Wed Feb 07 19:53:38 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.