alshabib
Committed by Gerrit Code Review

fix removal of rules in a distributed setting

Change-Id: I44cb49990b8051f5f1542c11cbda6846049906e3
...@@ -104,6 +104,9 @@ public interface DatabaseState<K, V> { ...@@ -104,6 +104,9 @@ public interface DatabaseState<K, V> {
104 Long counterGet(String counterName); 104 Long counterGet(String counterName);
105 105
106 @Command 106 @Command
107 + void counterSet(String counterName, long value);
108 +
109 + @Command
107 CommitResponse prepareAndCommit(Transaction transaction); 110 CommitResponse prepareAndCommit(Transaction transaction);
108 111
109 @Command 112 @Command
......
...@@ -207,6 +207,11 @@ public class DefaultDatabaseState implements DatabaseState<String, byte[]> { ...@@ -207,6 +207,11 @@ public class DefaultDatabaseState implements DatabaseState<String, byte[]> {
207 } 207 }
208 208
209 @Override 209 @Override
210 + public void counterSet(String counterName, long value) {
211 + getCounter(counterName).set(value);
212 + }
213 +
214 + @Override
210 public Long queueSize(String queueName) { 215 public Long queueSize(String queueName) {
211 return Long.valueOf(getQueue(queueName).size()); 216 return Long.valueOf(getQueue(queueName).size());
212 } 217 }
......
...@@ -38,6 +38,7 @@ import org.onosproject.net.driver.AbstractHandlerBehaviour; ...@@ -38,6 +38,7 @@ import org.onosproject.net.driver.AbstractHandlerBehaviour;
38 import org.onosproject.net.flow.DefaultFlowRule; 38 import org.onosproject.net.flow.DefaultFlowRule;
39 import org.onosproject.net.flow.DefaultTrafficSelector; 39 import org.onosproject.net.flow.DefaultTrafficSelector;
40 import org.onosproject.net.flow.DefaultTrafficTreatment; 40 import org.onosproject.net.flow.DefaultTrafficTreatment;
41 +import org.onosproject.net.flow.FlowEntry;
41 import org.onosproject.net.flow.FlowRule; 42 import org.onosproject.net.flow.FlowRule;
42 import org.onosproject.net.flow.FlowRuleOperations; 43 import org.onosproject.net.flow.FlowRuleOperations;
43 import org.onosproject.net.flow.FlowRuleOperationsContext; 44 import org.onosproject.net.flow.FlowRuleOperationsContext;
...@@ -592,7 +593,12 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -592,7 +593,12 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
592 builder.add(inner.build()).add(outer.build()); 593 builder.add(inner.build()).add(outer.build());
593 break; 594 break;
594 case REMOVE: 595 case REMOVE:
595 - builder.remove(inner.build()).remove(outer.build()); 596 + Iterable<FlowEntry> flows = flowRuleService.getFlowEntries(deviceId);
597 + for (FlowEntry fe : flows) {
598 + if (fe.equals(inner.build()) || fe.equals(outer.build())) {
599 + builder.remove(fe);
600 + }
601 + }
596 break; 602 break;
597 case ADD_TO_EXISTING: 603 case ADD_TO_EXISTING:
598 break; 604 break;
......