[OPNFLWPLUG-17] Attempt to use the 'metadata-mask' match in Flow Programming does not work Created: 09/Jan/14  Updated: 27/Sep/21  Due: 24/Jan/14  Resolved: 19/Feb/16

Status: Resolved
Project: OpenFlowPlugin
Component/s: General
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Jan Medved Assignee: Vaclav Demcak
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Mac OS
Platform: Macintosh


External issue ID: 277
Priority: High

 Description   

When attempting to use both metadata and metadata-mask matches from restconf, the flow is not programmed on the switch. Using just the metadata match works well.

The flow programming XML with the the defective metadata-mask match is as follows:

PUT http://192.168.4.1:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/2/flow/134

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<strict>false</strict>
<flow-name>FooXf20</flow-name>
<id>134</id>
<cookie_mask>255</cookie_mask>
<cookie>20</cookie>
<table_id>2</table_id>
<priority>2</priority>
<hard-timeout>1200</hard-timeout>
<idle-timeout>3400</idle-timeout>
<installHw>false</installHw>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<dec-nw-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
<match>
<metadata>
<metadata>12345</metadata>
<metadata-mask>//FF</metadata-mask>
</metadata>
</match>
</flow>

When reading the flow back from the controller's config space, i get the following (2 flows were programmed, so I got 2 flows back):

GET http://192.168.4.1:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/2/

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<table
xmlns="urn:opendaylight:flow:inventory">
<flow>
<strict>false</strict>
<flow-name>FooXf20</flow-name>
<id>144</id>
<cookie_mask>255</cookie_mask>
<cookie>20</cookie>
<table_id>2</table_id>
<priority>2</priority>
<hard-timeout>1200</hard-timeout>
<idle-timeout>3400</idle-timeout>
<installHw>false</installHw>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<dec-nw-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
<match>
<metadata>
<metadata>12345</metadata>
<metadata-mask>//FF</metadata-mask>
</metadata>
</match>
</flow>
<flow>
<strict>false</strict>
<flow-name>FooXf20</flow-name>
<id>134</id>
<cookie_mask>255</cookie_mask>
<cookie>20</cookie>
<table_id>2</table_id>
<priority>2</priority>
<hard-timeout>1200</hard-timeout>
<idle-timeout>3400</idle-timeout>
<installHw>false</installHw>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<dec-nw-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
<match>
<metadata>
<metadata>12345</metadata>
<metadata-mask>//FF</metadata-mask>
</metadata>
</match>
</flow>
</table>



 Comments   
Comment by Martin Sunal [ 10/Jan/14 ]

All values are put into a transaction correctly including both metadata and metadata-mask matches.
Two flows are received because restconf reads data directly from datastore.
It seems that bug is in another component - moved to md-sal

Comment by Tony Tkacik [ 21/Jan/14 ]

Metadata mask was not lost in MD-SAL as per output: [_metadata=12345, _metadataMask=[-1, -15, 69],

Run against foo:node:1 (Which prints out RPCs from MD-SAL and NSF).

2014-01-21 12:06:01.768 CET [md-sal-binding-commit-3] INFO o.o.o.t.OpenflowpluginTestServiceProvider - addFlow - AddFlowInput [_flowRef=FlowRef [_value=InstanceIdentifier [path=[org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes, org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node[key=NodeKey [_id=Uri [_value=foo:node:1]]], org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table[key=TableKey [_id=0]], org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow[key=FlowKey [_id=Uri [_value=134]]]]]], _flowTable=FlowTableRef [_value=InstanceIdentifier [path=[org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes, org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node[key=NodeKey [_id=Uri [_value=foo:node:1]]], org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table[key=TableKey [_id=0]]]]], _barrier=null, _bufferId=null, _containerName=null, _cookieMask=255, _flags=null, _flowName=FooXf20, _installHw=false, _instructions=Instructions [_instruction=[Instruction [_order=0, _key=InstructionKey [_order=0], _instruction=ApplyActionsCase [_applyActions=ApplyActions [_action=[Action [_order=0, _key=ActionKey [_order=0], _action=DecNwTtlCase [_decNwTtl=org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder$DecNwTtlImpl@1f, augmentation=[]], augmentation=[]]], augmentation=[]], augmentation=[]], augmentation=[]]], augmentation=[]], _match=Match [_ethernetMatch=null, _icmpv4Match=null, _icmpv6Match=null, _inPhyPort=null, _inPort=null, _ipMatch=null, _layer3Match=null, _layer4Match=null, _metadata=Metadata [_metadata=12345, _metadataMask=[-1, -15, 69], augmentation=[]], _protocolMatchFields=null, _tunnel=null, _vlanMatch=null, augmentation=[]], _outGroup=null, _outPort=null, _strict=false, _cookie=20, _hardTimeout=1200, _idleTimeout=3400, _priority=2, _tableId=2, _node=NodeRef [_value=InstanceIdentifier [path=[org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes, org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node[key=NodeKey [_id=Uri [_value=foo:node:1]]]]]], _transactionUri=Uri [_value=BA-12], augmentation=[]]

Comment by Michal Polkorab [ 22/Jan/14 ]

After debugging:

2014-01-22 16:45:53.446 CET [nioEventLoopGroup-9-1] WARN o.o.o.p.impl.util.MatchSerializer - WRONG MASK LENGTH - expected: 8 actual: 3
2014-01-22 16:45:53.446 CET [nioEventLoopGroup-9-1] ERROR o.o.o.protocol.impl.core.OFEncoder - Message serialization failed
2014-01-22 16:45:53.451 CET [nioEventLoopGroup-9-1] ERROR o.o.o.protocol.impl.core.OFEncoder - incorrect length of mask: 3, expected: 8
java.lang.IllegalArgumentException: incorrect length of mask: 3, expected: 8
at org.opendaylight.openflowjava.protocol.impl.util.MatchSerializer.writeMask(MatchSerializer.java:368) ~[bundlefile:na]

OF Plugin:
private static void addMaskAugmentation(MatchEntriesBuilder builder, byte[] mask)

{ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder(); maskBuilder.setMask(mask); builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build()); }

Byte array (mask) passed to the library is of incorrect length. It should be wrapped into correct length mask.

Michal

Comment by Vaclav Demcak [ 25/Jan/14 ]

2014-01-25 16:22:17 CET [com.sun.jersey.spi.container.ContainerResponse] SEVERE com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
java.lang.NumberFormatException: For input string: "//FF"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:430)
at java.lang.Long.valueOf(Long.java:540)
at org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec$Uint64CodecStringImpl.deserialize(TypeDefinitionAwareCodec.java:266)
at org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec$Uint64CodecStringImpl.deserialize(TypeDefinitionAwareCodec.java:256)
at org.opendaylight.controller.sal.restconf.impl.RestCodec$ObjectCodec.deserialize(RestCodec.java:59)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:885)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:835)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:835)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:835)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:728)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.updateConfigurationData(RestconfImpl.java:249)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.filters.CorsFilter.handleSimpleCORS(CorsFilter.java:303)
at org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:171)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:309)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

2014-01-25 16:22:17 CET [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/restconf].[JAXRSRestconf]] SEVERE org.apache.catalina.core.StandardWrapperValve invoke Servlet.service() for servlet [JAXRSRestconf] in context with path [/restconf] threw exception
java.lang.NumberFormatException: For input string: "//FF"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:430)
at java.lang.Long.valueOf(Long.java:540)
at org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec$Uint64CodecStringImpl.deserialize(TypeDefinitionAwareCodec.java:266)
at org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec$Uint64CodecStringImpl.deserialize(TypeDefinitionAwareCodec.java:256)
at org.opendaylight.controller.sal.restconf.impl.RestCodec$ObjectCodec.deserialize(RestCodec.java:59)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:885)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:835)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:835)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:835)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:728)
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.updateConfigurationData(RestconfImpl.java:249)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.filters.CorsFilter.handleSimpleCORS(CorsFilter.java:303)
at org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:171)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:309)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

Comment by Deepthi V V [ 25/Jan/14 ]

Datatype for metadata mask was changed from binary to uint64. The data "//FF" is incorrect and hence exception is thrown.

Comment by Vaclav Demcak [ 26/Jan/14 ]

tested and it seems like ok.

Generated at Wed Feb 07 20:31:21 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.