[OPNFLWPLUG-375] When deleting flowEntries that use Mac Address masks, FlowRemovedTranslaton.java throws an exception Created: 02/Mar/15  Updated: 27/Sep/21  Resolved: 03/Jun/15

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

Type: Bug
Reporter: Jim West Assignee: Jim West
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: Text File ByteUtil.patch     Text File ByteUtilTest.patch    
External issue ID: 2776

 Description   

Using stable/helium.

I've been creating flows that make use of Mac Address masks in the matching logic. When I delete these flow entries, I receive the following exceptions:

2015-03-02 08:56:06.293 EST [OFmsgFinisher-0] WARN o.o.o.o.md.queue.TicketFinisherImpl - processing (translate, publish) of ticket failed
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Supplied value "ff:ff:ff:ff:ff:00:" does not match any of the permitted patterns [^[0-9a-fA-F]

{2}(:[0-9a-fA-F]{2}

)

{5}$]
at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:306) ~[na:na]
at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:293) ~[na:na]
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116) ~[na:na]
at org.opendaylight.openflowplugin.openflow.md.queue.TicketFinisherImpl.run(TicketFinisherImpl.java:49) ~[na:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_71]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
Caused by: java.lang.IllegalArgumentException: Supplied value "ff:ff:ff:ff:ff:00:" does not match any of the permitted patterns [^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}

$]
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:119) ~[na:na]
at org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress.<init>(MacAddress.java:47) ~[na:na]
at org.opendaylight.openflowplugin.openflow.md.core.translator.FlowRemovedTranslator.fromMatch(FlowRemovedTranslator.java:241) ~[na:na]
at org.opendaylight.openflowplugin.openflow.md.core.translator.FlowRemovedTranslator.translate(FlowRemovedTranslator.java:186) ~[na:na]
at org.opendaylight.openflowplugin.openflow.md.core.translator.FlowRemovedTranslator.translate(FlowRemovedTranslator.java:143) ~[na:na]
at org.opendaylight.openflowplugin.openflow.md.queue.TicketProcessorFactoryImpl.translate(TicketProcessorFactoryImpl.java:166) ~[na:na]
at org.opendaylight.openflowplugin.openflow.md.queue.TicketProcessorFactoryImpl$1.run(TicketProcessorFactoryImpl.java:78) ~[na:na]
... 3 common frames omitted

I've chase this to openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/FlowRemovedTranslator.java line 241:

if (entry.isHasMask())

{ ethDst.setMask(new MacAddress(ByteUtil.bytesToHexstring(entry.getAugmentation(MaskMatchEntry.class).getMask(), ":"))); }

Here's what I believe is happening
1- The code is ATTEMPTING to create a new MacAddress (the CTOR requires a String)
2- To create the string, the code attempts to parse an array of bytes into a string of the form: [0-9a-fA-F]

{2}(:[0-9a-fA-F]{2}

)

{5}

3- HOWEVER, the method 'bytesToHexstring is leaving a trailing ':' character which is causing the conversion to fail.

It looks like this code was added in Nov of 2014.



 Comments   
Comment by Jim West [ 02/Mar/15 ]

Attachment ByteUtil.patch has been added with description: Patch to fix problem

Comment by Jim West [ 02/Mar/15 ]

Attachment ByteUtilTest.patch has been added with description: Patch to unit tests so they pass after fix patch is applied

Comment by Michal Rehak [ 02/Mar/15 ]

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

Comment by Michal Rehak [ 02/Mar/15 ]

merged, please retest

Comment by Abhijit Kumbhare [ 06/May/15 ]

Any update Jim?

Comment by Jim West [ 06/May/15 ]

My ODL deployment has my original patch (which doesn't match the code submitted). In reviewing the code it looks fine to me. I recommend marking as fixed.

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