Various bmv2 changes to reflect onos-bmv2 v1.0.0 (onos1.6 cherry-pick)
Most notably:
- Updated repo URL and commit ID to official onos-bmv2 fork
- Removed ugly string-based table dump parser, now there's
a proper API to retrieve table entries (added support in
Bmv2DeviceAgent)
- Removed unused arguments in packet-in API
Change-Id: I5ff0948eb8fec5283a085913496c187e7b278d8d
diff --git a/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2FlowRuleProgrammable.java b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2FlowRuleProgrammable.java
index 01d812f..27c3fc2 100644
--- a/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2FlowRuleProgrammable.java
+++ b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2FlowRuleProgrammable.java
@@ -118,10 +118,14 @@
return;
}
- // Bmv2 doesn't support proper polling for table entries, but only a string based table dump.
- // The trick here is to first dump the entries currently installed in the device for a given table,
- // and then query a service for the corresponding, previously applied, flow rule.
- List<Bmv2ParsedTableEntry> installedEntries = tableEntryService.getTableEntries(deviceId, table.name());
+ List<Bmv2ParsedTableEntry> installedEntries;
+ try {
+ installedEntries = deviceAgent.getTableEntries(table.name());
+ } catch (Bmv2RuntimeException e) {
+ log.warn("Failed to get table entries of table {} of {}: {}", table.name(), deviceId, e.explain());
+ return;
+ }
+
installedEntries.forEach(parsedEntry -> {
Bmv2TableEntryReference entryRef = new Bmv2TableEntryReference(deviceId,
table.name(),
@@ -309,7 +313,7 @@
private void forceRemove(Bmv2DeviceAgent agent, String tableName, Bmv2MatchKey matchKey)
throws Bmv2RuntimeException {
// Find the entryID (expensive call!)
- for (Bmv2ParsedTableEntry pEntry : tableEntryService.getTableEntries(agent.deviceId(), tableName)) {
+ for (Bmv2ParsedTableEntry pEntry : agent.getTableEntries(tableName)) {
if (pEntry.matchKey().equals(matchKey)) {
// Remove entry and drop exceptions.
silentlyRemove(agent, tableName, pEntry.entryId());