Fix a bug where default rules were not pushed after restarting mininet.
Change-Id: Icf4c7ed009a5938d28b58128cfc226067a0d4c9e
diff --git a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
index 158764f..3641895 100644
--- a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
@@ -388,20 +388,31 @@
public void pushFlowMetrics(DeviceId deviceId, Iterable<FlowEntry> flowEntries) {
Set<FlowEntry> storedRules = Sets.newHashSet(store.getFlowEntries(deviceId));
- for (FlowEntry rule : flowEntries) {
- if (storedRules.remove(rule)) {
- // we both have the rule, let's update some info then.
- flowAdded(rule);
- } else {
- // the device has a rule the store does not have
- extraneousFlow(rule);
- }
- }
- for (FlowEntry rule : storedRules) {
- // there are rules in the store that aren't on the switch
- flowMissing(rule);
- }
+ for (FlowEntry rule : flowEntries) {
+ try {
+ if (storedRules.remove(rule)) {
+ // we both have the rule, let's update some info then.
+ flowAdded(rule);
+ } else {
+ // the device has a rule the store does not have
+ extraneousFlow(rule);
+ }
+ } catch (Throwable e) {
+ log.debug("Can't add missing flow rule {}", e.getMessage());
+ continue;
+ }
+ }
+ for (FlowEntry rule : storedRules) {
+ try {
+ // there are rules in the store that aren't on the switch
+ flowMissing(rule);
+ } catch (Throwable e) {
+ log.debug("Can't add missing flow rule {}", e.getMessage());
+ continue;
+ }
+ }
+
}
@Override