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
Showing
2 changed files
with
5 additions
and
2 deletions
| ... | @@ -260,9 +260,12 @@ public class Bmv2DefaultFlowRuleTranslator implements Bmv2FlowRuleTranslator { | ... | @@ -260,9 +260,12 @@ public class Bmv2DefaultFlowRuleTranslator implements Bmv2FlowRuleTranslator { |
| 260 | 260 | ||
| 261 | Bmv2TableEntry.Builder tableEntryBuilder = Bmv2TableEntry.builder(); | 261 | Bmv2TableEntry.Builder tableEntryBuilder = Bmv2TableEntry.builder(); |
| 262 | 262 | ||
| 263 | + // In BMv2 0 is the highest priority, i.e. the opposite than ONOS. | ||
| 264 | + int newPriority = Integer.MAX_VALUE - rule.priority(); | ||
| 265 | + | ||
| 263 | tableEntryBuilder | 266 | tableEntryBuilder |
| 264 | .withTableName(table.name()) | 267 | .withTableName(table.name()) |
| 265 | - .withPriority(rule.priority()) | 268 | + .withPriority(newPriority) |
| 266 | .withMatchKey(bmv2MatchKey) | 269 | .withMatchKey(bmv2MatchKey) |
| 267 | .withAction(bmv2Action); | 270 | .withAction(bmv2Action); |
| 268 | 271 | ... | ... |
| ... | @@ -158,7 +158,7 @@ public class Bmv2DefaultFlowRuleTranslatorTest { | ... | @@ -158,7 +158,7 @@ public class Bmv2DefaultFlowRuleTranslatorTest { |
| 158 | assertThat("Incorrect ethType match param value", | 158 | assertThat("Incorrect ethType match param value", |
| 159 | ethTypeParam.value().asReadOnlyBuffer().getShort(), is(equalTo(ethType))); | 159 | ethTypeParam.value().asReadOnlyBuffer().getShort(), is(equalTo(ethType))); |
| 160 | assertThat("Incorrect priority value", | 160 | assertThat("Incorrect priority value", |
| 161 | - entry1.priority(), is(equalTo(rule1.priority()))); | 161 | + entry1.priority(), is(equalTo(Integer.MAX_VALUE - rule1.priority()))); |
| 162 | assertThat("Incorrect timeout value", | 162 | assertThat("Incorrect timeout value", |
| 163 | entry1.timeout(), is(equalTo(expectedTimeout))); | 163 | entry1.timeout(), is(equalTo(expectedTimeout))); |
| 164 | 164 | ... | ... |
-
Please register or login to post a comment