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> {
Long counterGet(String counterName);
@Command
void counterSet(String counterName, long value);
@Command
CommitResponse prepareAndCommit(Transaction transaction);
@Command
......
......@@ -207,6 +207,11 @@ public class DefaultDatabaseState implements DatabaseState<String, byte[]> {
}
@Override
public void counterSet(String counterName, long value) {
getCounter(counterName).set(value);
}
@Override
public Long queueSize(String queueName) {
return Long.valueOf(getQueue(queueName).size());
}
......
......@@ -38,6 +38,7 @@ import org.onosproject.net.driver.AbstractHandlerBehaviour;
import org.onosproject.net.flow.DefaultFlowRule;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.FlowEntry;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleOperations;
import org.onosproject.net.flow.FlowRuleOperationsContext;
......@@ -592,7 +593,12 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
builder.add(inner.build()).add(outer.build());
break;
case REMOVE:
builder.remove(inner.build()).remove(outer.build());
Iterable<FlowEntry> flows = flowRuleService.getFlowEntries(deviceId);
for (FlowEntry fe : flows) {
if (fe.equals(inner.build()) || fe.equals(outer.build())) {
builder.remove(fe);
}
}
break;
case ADD_TO_EXISTING:
break;
......