alshabib
Committed by Gerrit Code Review

Fix a bug where default rules were not pushed after restarting mininet.

Change-Id: Icf4c7ed009a5938d28b58128cfc226067a0d4c9e
...@@ -388,7 +388,9 @@ public class FlowRuleManager ...@@ -388,7 +388,9 @@ public class FlowRuleManager
388 public void pushFlowMetrics(DeviceId deviceId, Iterable<FlowEntry> flowEntries) { 388 public void pushFlowMetrics(DeviceId deviceId, Iterable<FlowEntry> flowEntries) {
389 Set<FlowEntry> storedRules = Sets.newHashSet(store.getFlowEntries(deviceId)); 389 Set<FlowEntry> storedRules = Sets.newHashSet(store.getFlowEntries(deviceId));
390 390
391 +
391 for (FlowEntry rule : flowEntries) { 392 for (FlowEntry rule : flowEntries) {
393 + try {
392 if (storedRules.remove(rule)) { 394 if (storedRules.remove(rule)) {
393 // we both have the rule, let's update some info then. 395 // we both have the rule, let's update some info then.
394 flowAdded(rule); 396 flowAdded(rule);
...@@ -396,14 +398,23 @@ public class FlowRuleManager ...@@ -396,14 +398,23 @@ public class FlowRuleManager
396 // the device has a rule the store does not have 398 // the device has a rule the store does not have
397 extraneousFlow(rule); 399 extraneousFlow(rule);
398 } 400 }
401 + } catch (Throwable e) {
402 + log.debug("Can't add missing flow rule {}", e.getMessage());
403 + continue;
404 + }
399 } 405 }
400 for (FlowEntry rule : storedRules) { 406 for (FlowEntry rule : storedRules) {
407 + try {
401 // there are rules in the store that aren't on the switch 408 // there are rules in the store that aren't on the switch
402 flowMissing(rule); 409 flowMissing(rule);
403 - 410 + } catch (Throwable e) {
411 + log.debug("Can't add missing flow rule {}", e.getMessage());
412 + continue;
404 } 413 }
405 } 414 }
406 415
416 + }
417 +
407 @Override 418 @Override
408 public void batchOperationCompleted(long batchId, CompletedBatchOperation operation) { 419 public void batchOperationCompleted(long batchId, CompletedBatchOperation operation) {
409 store.batchOperationComplete(FlowRuleBatchEvent.completed( 420 store.batchOperationComplete(FlowRuleBatchEvent.completed(
......
...@@ -672,13 +672,14 @@ public class DistributedFlowRuleStore ...@@ -672,13 +672,14 @@ public class DistributedFlowRuleStore
672 // This node is the new master, populate local structure 672 // This node is the new master, populate local structure
673 // from backup 673 // from backup
674 loadFromBackup(did); 674 loadFromBackup(did);
675 - } else { 675 + }
676 + //else {
676 // This node is no longer the master holder, 677 // This node is no longer the master holder,
677 // clean local structure 678 // clean local structure
678 - removeFromPrimary(did); 679 + //removeFromPrimary(did);
679 // TODO: probably should stop pending backup activities in 680 // TODO: probably should stop pending backup activities in
680 // executors to avoid overwriting with old value 681 // executors to avoid overwriting with old value
681 - } 682 + //}
682 break; 683 break;
683 default: 684 default:
684 break; 685 break;
......