Workaround to BMv2 pipeline model bug
Some metadata fields have non-standard names in the BMv2 JSON that
cannot be found in the P4Info. Example, in the punt table, the
icmp_code field takes different names in the BMv2 JSON and P4Info
BMv2 JSON: scalars.local_metadata_t.icmp_code
P4Info: local_metadata.icmp_code
This workaround disables generating empty ternary fields when
translating flow rules, including the icmp_code field mentioned above.
Change-Id: Icce4992a7da8a41cb13b7ef06c277c576296544b
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslator.java b/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslator.java
index dc6d1c5..25465e9 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslator.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslator.java
@@ -306,10 +306,11 @@
switch (fieldModel.matchType()) {
case TERNARY:
// Wildcard the whole field.
- fieldMatches.put(fieldId, new PiTernaryFieldMatch(
- fieldId,
- ImmutableByteSequence.ofZeros(fieldByteWidth),
- ImmutableByteSequence.ofZeros(fieldByteWidth)));
+ // FIXME: uncomment as soon as we fix the bmv2 pipeline model bug
+ // fieldMatches.put(fieldId, new PiTernaryFieldMatch(
+ // fieldId,
+ // ImmutableByteSequence.ofZeros(fieldByteWidth),
+ // ImmutableByteSequence.ofZeros(fieldByteWidth)));
break;
case LPM:
// LPM with prefix 0
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java
index c2cc0b5..09f5aa9 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java
@@ -213,11 +213,12 @@
}
if (inconsistentEntries.size() > 0) {
- log.warn("Found {} entries in {} that are not known by table entry service," +
- " removing them", inconsistentEntries.size(), deviceId);
- inconsistentEntries.forEach(entry -> log.debug(entry.toString()));
+ // FIXME: uncomment as soon as we fix the bmv2 pipeline model bug
+ // log.warn("Found {} entries in {} that are not known by table entry service," +
+ // " removing them", inconsistentEntries.size(), deviceId);
+ // inconsistentEntries.forEach(entry -> log.debug(entry.toString()));
// Async remove them.
- client.writeTableEntries(inconsistentEntries, DELETE, pipeconf);
+ // client.writeTableEntries(inconsistentEntries, DELETE, pipeconf);
}
return resultBuilder.build();