Fix: simplify the logic of purging flow rules from kubevirt
Change-Id: I6d56b082e77ce9adc935f8f00a8fd911a3e068d4
(cherry picked from commit 0bf73471c50ad4444027b201fdbb2f9007b42d80)
diff --git a/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/impl/KubevirtFlowRuleManager.java b/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/impl/KubevirtFlowRuleManager.java
index 6fe457a..a79eeb0 100644
--- a/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/impl/KubevirtFlowRuleManager.java
+++ b/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/impl/KubevirtFlowRuleManager.java
@@ -35,7 +35,6 @@
import org.onosproject.net.flow.DefaultFlowRule;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.FlowEntry;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleOperations;
import org.onosproject.net.flow.FlowRuleOperationsContext;
@@ -56,7 +55,6 @@
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.stream.StreamSupport;
import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.kubevirtnetworking.api.Constants.ACL_EGRESS_TABLE;
@@ -217,9 +215,7 @@
@Override
public void purgeRules(DeviceId deviceId) {
- Iterable<FlowEntry> fes = flowRuleService.getFlowEntries(deviceId);
- flowRuleService.removeFlowRules(StreamSupport.stream(
- fes.spliterator(), false).toArray(FlowEntry[]::new));
+ flowRuleService.purgeFlowRules(deviceId);
}
private void applyRule(FlowRule flowRule, boolean install) {