Fixed wrong LPM mask in PI flow rule translator
Change-Id: I5c8c67ae4b989ed326c6e17c0fe1e5745defd900
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java b/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java
index f22fdde..46238c4e 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java
@@ -430,11 +430,11 @@
"Invalid prefix length for LPM field '%s', found %d but field has bit-width %d",
fieldMatch.fieldId(), lpmfield.prefixLength(), modelBitWidth));
}
- ImmutableByteSequence lpmMask = prefixOnes(modelBitWidth * Byte.SIZE,
- lpmfield.prefixLength());
ImmutableByteSequence lpmValue = lpmfield.value()
- .fit(modelBitWidth)
- .bitwiseAnd(lpmMask);
+ .fit(modelBitWidth);
+ ImmutableByteSequence lpmMask = prefixOnes(lpmValue.size(),
+ lpmfield.prefixLength());
+ lpmValue = lpmValue.bitwiseAnd(lpmMask);
return new PiLpmFieldMatch(fieldMatch.fieldId(),
lpmValue, lpmfield.prefixLength());
case RANGE: