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
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java
index d6e5d40..5da8657 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java
@@ -672,13 +672,14 @@
                         // This node is the new master, populate local structure
                         // from backup
                         loadFromBackup(did);
-                    } else {
+                    }
+                    //else {
                         // This node is no longer the master holder,
                         // clean local structure
-                        removeFromPrimary(did);
+                        //removeFromPrimary(did);
                         // TODO: probably should stop pending backup activities in
                         // executors to avoid overwriting with old value
-                    }
+                    //}
                     break;
                 default:
                     break;