ONOS-7066 ONOS-7067 PI abstractions refactoring and P4Info model parser
Includes changes previously reviewed in #15607, #15877, and #15955.
Change-Id: Ie2ff62e415f2099832ebfe05961a879b7b188fc3
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 c9fe49d83..81626fe 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
@@ -24,16 +24,15 @@
import org.onosproject.net.flow.FlowEntry;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleProgrammable;
+import org.onosproject.net.pi.model.PiCounterId;
import org.onosproject.net.pi.model.PiPipelineInterpreter;
import org.onosproject.net.pi.model.PiPipelineModel;
+import org.onosproject.net.pi.model.PiTableId;
import org.onosproject.net.pi.model.PiTableModel;
import org.onosproject.net.pi.runtime.PiCounterCellData;
import org.onosproject.net.pi.runtime.PiCounterCellId;
-import org.onosproject.net.pi.runtime.PiCounterId;
-import org.onosproject.net.pi.runtime.PiDirectCounterCellId;
-import org.onosproject.net.pi.runtime.PiTranslationService;
import org.onosproject.net.pi.runtime.PiTableEntry;
-import org.onosproject.net.pi.runtime.PiTableId;
+import org.onosproject.net.pi.runtime.PiTranslationService;
import org.onosproject.p4runtime.api.P4RuntimeClient.WriteOperationType;
import org.onosproject.p4runtime.api.P4RuntimeFlowRuleWrapper;
import org.onosproject.p4runtime.api.P4RuntimeTableEntryReference;
@@ -53,7 +52,9 @@
import static org.onosproject.drivers.p4runtime.P4RuntimeFlowRuleProgrammable.Operation.APPLY;
import static org.onosproject.drivers.p4runtime.P4RuntimeFlowRuleProgrammable.Operation.REMOVE;
import static org.onosproject.net.flow.FlowEntry.FlowEntryState.ADDED;
-import static org.onosproject.p4runtime.api.P4RuntimeClient.WriteOperationType.*;
+import static org.onosproject.p4runtime.api.P4RuntimeClient.WriteOperationType.DELETE;
+import static org.onosproject.p4runtime.api.P4RuntimeClient.WriteOperationType.INSERT;
+import static org.onosproject.p4runtime.api.P4RuntimeClient.WriteOperationType.MODIFY;
/**
* Implementation of the flow rule programmable behaviour for P4Runtime.
@@ -132,7 +133,7 @@
for (PiTableModel tableModel : pipelineModel.tables()) {
- PiTableId piTableId = PiTableId.of(tableModel.name());
+ PiTableId piTableId = tableModel.id();
// Only dump tables that are exposed by the interpreter.
// The reason is that some P4 targets (e.g. BMv2's simple_switch) use more table than those defined in the
@@ -162,12 +163,12 @@
cellDatas = client.readAllCounterCells(Collections.singleton(piCounterId), pipeconf).get();
} else {
Set<PiCounterCellId> cellIds = installedEntries.stream()
- .map(entry -> PiDirectCounterCellId.of(piCounterId, entry))
+ .map(entry -> PiCounterCellId.ofDirect(piCounterId, entry))
.collect(Collectors.toSet());
cellDatas = client.readCounterCells(cellIds, pipeconf).get();
}
counterCellMap = cellDatas.stream()
- .collect(Collectors.toMap(c -> ((PiDirectCounterCellId) c.cellId()).tableEntry(), c -> c));
+ .collect(Collectors.toMap(c -> (c.cellId()).tableEntry(), c -> c));
} else {
counterCellMap = Collections.emptyMap();
}
@@ -339,4 +340,4 @@
enum Operation {
APPLY, REMOVE
}
-}
\ No newline at end of file
+}