alshabib
Committed by Gerrit Code Review

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

Change-Id: Icf4c7ed009a5938d28b58128cfc226067a0d4c9e
...@@ -388,20 +388,31 @@ public class FlowRuleManager ...@@ -388,20 +388,31 @@ 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 - for (FlowEntry rule : flowEntries) { 391 +
392 - if (storedRules.remove(rule)) { 392 + for (FlowEntry rule : flowEntries) {
393 - // we both have the rule, let's update some info then. 393 + try {
394 - flowAdded(rule); 394 + if (storedRules.remove(rule)) {
395 - } else { 395 + // we both have the rule, let's update some info then.
396 - // the device has a rule the store does not have 396 + flowAdded(rule);
397 - extraneousFlow(rule); 397 + } else {
398 + // the device has a rule the store does not have
399 + extraneousFlow(rule);
400 + }
401 + } catch (Throwable e) {
402 + log.debug("Can't add missing flow rule {}", e.getMessage());
403 + continue;
404 + }
405 + }
406 + for (FlowEntry rule : storedRules) {
407 + try {
408 + // there are rules in the store that aren't on the switch
409 + flowMissing(rule);
410 + } catch (Throwable e) {
411 + log.debug("Can't add missing flow rule {}", e.getMessage());
412 + continue;
413 + }
398 } 414 }
399 - }
400 - for (FlowEntry rule : storedRules) {
401 - // there are rules in the store that aren't on the switch
402 - flowMissing(rule);
403 415
404 - }
405 } 416 }
406 417
407 @Override 418 @Override
......
...@@ -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;
......