Carmelo Cascone
Committed by Jonathan Hart

Fixed bug due to wrong priority in BMv2.

In BMv2 0 is the highest priority, while it is the lowest for ONOS.

Change-Id: Iedb66598f293bf456cf4d206e19c0ff632edfd2c
......@@ -260,9 +260,12 @@ public class Bmv2DefaultFlowRuleTranslator implements Bmv2FlowRuleTranslator {
Bmv2TableEntry.Builder tableEntryBuilder = Bmv2TableEntry.builder();
// In BMv2 0 is the highest priority, i.e. the opposite than ONOS.
int newPriority = Integer.MAX_VALUE - rule.priority();
tableEntryBuilder
.withTableName(table.name())
.withPriority(rule.priority())
.withPriority(newPriority)
.withMatchKey(bmv2MatchKey)
.withAction(bmv2Action);
......
......@@ -158,7 +158,7 @@ public class Bmv2DefaultFlowRuleTranslatorTest {
assertThat("Incorrect ethType match param value",
ethTypeParam.value().asReadOnlyBuffer().getShort(), is(equalTo(ethType)));
assertThat("Incorrect priority value",
entry1.priority(), is(equalTo(rule1.priority())));
entry1.priority(), is(equalTo(Integer.MAX_VALUE - rule1.priority())));
assertThat("Incorrect timeout value",
entry1.timeout(), is(equalTo(expectedTimeout)));
......