Filter out meters default config
There is no need to further process meters default
config in ONOS, there will not be any trace in the
ONOS stores. Filtering out in advance allows to save
memory and time.
Change-Id: I57f598aba3f2ba32923e8170f6c47f9efe27edd4
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeMeterProgrammable.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeMeterProgrammable.java
index 2230893..8bb4fc7 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeMeterProgrammable.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeMeterProgrammable.java
@@ -50,6 +50,7 @@
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.locks.Lock;
+import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.p4runtime.api.P4RuntimeWriteClient.UpdateType;
@@ -148,7 +149,10 @@
}
piMeterCellConfigs = client.read(p4DeviceId, pipeconf)
- .meterCells(meterIds).submitSync().all(PiMeterCellConfig.class);
+ .meterCells(meterIds).submitSync().all(PiMeterCellConfig.class)
+ .stream()
+ .filter(piMeterCellConfig -> !piMeterCellConfig.isDefaultConfig())
+ .collect(Collectors.toList());
meterMirror.sync(deviceId, piMeterCellConfigs);