Committed by
Gerrit Code Review
[ONOS-5171] FlowRuleStore: add purgeFlowEntries
The FlowRuleStore exposes purgeFlowEntry(DeviceId), which purges from the store by a specific device. Add purgeFlowEntries, to purge entries from all devices. Change-Id: I0ec50d2bbb8b39097189f9e332dc3efd281bc811
Showing
3 changed files
with
20 additions
and
1 deletions
... | @@ -111,7 +111,12 @@ public interface FlowRuleStore extends Store<FlowRuleBatchEvent, FlowRuleStoreDe | ... | @@ -111,7 +111,12 @@ public interface FlowRuleStore extends Store<FlowRuleBatchEvent, FlowRuleStoreDe |
111 | * | 111 | * |
112 | * @param deviceId device id | 112 | * @param deviceId device id |
113 | */ | 113 | */ |
114 | - void purgeFlowRule(DeviceId deviceId); | 114 | + default void purgeFlowRule(DeviceId deviceId) {} |
115 | + | ||
116 | + /** | ||
117 | + * Removes all flow entries from store. | ||
118 | + */ | ||
119 | + void purgeFlowRules(); | ||
115 | 120 | ||
116 | /** | 121 | /** |
117 | * Updates the flow table statistics of the specified device using | 122 | * Updates the flow table statistics of the specified device using | ... | ... |
... | @@ -316,6 +316,11 @@ public class SimpleFlowRuleStore | ... | @@ -316,6 +316,11 @@ public class SimpleFlowRuleStore |
316 | } | 316 | } |
317 | 317 | ||
318 | @Override | 318 | @Override |
319 | + public void purgeFlowRules() { | ||
320 | + flowEntries.clear(); | ||
321 | + } | ||
322 | + | ||
323 | + @Override | ||
319 | public void storeBatch( | 324 | public void storeBatch( |
320 | FlowRuleBatchOperation operation) { | 325 | FlowRuleBatchOperation operation) { |
321 | List<FlowRuleBatchEntry> toAdd = new ArrayList<>(); | 326 | List<FlowRuleBatchEntry> toAdd = new ArrayList<>(); | ... | ... |
... | @@ -624,6 +624,11 @@ public class DistributedFlowRuleStore | ... | @@ -624,6 +624,11 @@ public class DistributedFlowRuleStore |
624 | } | 624 | } |
625 | 625 | ||
626 | @Override | 626 | @Override |
627 | + public void purgeFlowRules() { | ||
628 | + flowTable.purgeFlowRules(); | ||
629 | + } | ||
630 | + | ||
631 | + @Override | ||
627 | public void batchOperationComplete(FlowRuleBatchEvent event) { | 632 | public void batchOperationComplete(FlowRuleBatchEvent event) { |
628 | //FIXME: need a per device pending response | 633 | //FIXME: need a per device pending response |
629 | NodeId nodeId = pendingResponses.remove(event.subject().batchId()); | 634 | NodeId nodeId = pendingResponses.remove(event.subject().batchId()); |
... | @@ -872,6 +877,10 @@ public class DistributedFlowRuleStore | ... | @@ -872,6 +877,10 @@ public class DistributedFlowRuleStore |
872 | flowEntries.remove(deviceId); | 877 | flowEntries.remove(deviceId); |
873 | } | 878 | } |
874 | 879 | ||
880 | + public void purgeFlowRules() { | ||
881 | + flowEntries.clear(); | ||
882 | + } | ||
883 | + | ||
875 | private List<NodeId> getBackupNodes(DeviceId deviceId) { | 884 | private List<NodeId> getBackupNodes(DeviceId deviceId) { |
876 | // The returned backup node list is in the order of preference i.e. next likely master first. | 885 | // The returned backup node list is in the order of preference i.e. next likely master first. |
877 | List<NodeId> allPossibleBackupNodes = replicaInfoManager.getReplicaInfoFor(deviceId).backups(); | 886 | List<NodeId> allPossibleBackupNodes = replicaInfoManager.getReplicaInfoFor(deviceId).backups(); | ... | ... |
-
Please register or login to post a comment