Jonathan Hart
Committed by Gerrit Code Review

Use DELETE_STRICT when deleting flows to avoid collateral damage

Change-Id: Ibb35023b14296752073de44f1953013f0ca8a73a
......@@ -22,11 +22,11 @@ import org.onlab.packet.Ip6Prefix;
import org.onlab.packet.VlanId;
import org.onosproject.net.DeviceId;
import org.onosproject.net.OchSignal;
import org.onosproject.net.OduSignalId;
import org.onosproject.net.driver.DefaultDriverData;
import org.onosproject.net.driver.DefaultDriverHandler;
import org.onosproject.net.driver.Driver;
import org.onosproject.net.driver.DriverService;
import org.onosproject.net.OduSignalId;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.criteria.ArpHaCriterion;
......@@ -65,8 +65,6 @@ import org.onosproject.net.flow.criteria.VlanIdCriterion;
import org.onosproject.net.flow.criteria.VlanPcpCriterion;
import org.onosproject.openflow.controller.ExtensionSelectorInterpreter;
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.OFFlowAdd;
import org.projectfloodlight.openflow.protocol.OFFlowDelete;
import org.projectfloodlight.openflow.protocol.OFFlowMod;
import org.projectfloodlight.openflow.protocol.match.Match;
import org.projectfloodlight.openflow.protocol.match.MatchField;
......@@ -88,6 +86,7 @@ import org.projectfloodlight.openflow.types.OFBooleanValue;
import org.projectfloodlight.openflow.types.OFMetadata;
import org.projectfloodlight.openflow.types.OFPort;
import org.projectfloodlight.openflow.types.OFVlanVidMatch;
import org.projectfloodlight.openflow.types.OduSignalID;
import org.projectfloodlight.openflow.types.TransportPort;
import org.projectfloodlight.openflow.types.U16;
import org.projectfloodlight.openflow.types.U32;
......@@ -95,7 +94,6 @@ import org.projectfloodlight.openflow.types.U64;
import org.projectfloodlight.openflow.types.U8;
import org.projectfloodlight.openflow.types.VlanPcp;
import org.projectfloodlight.openflow.types.VlanVid;
import org.projectfloodlight.openflow.types.OduSignalID;
import org.slf4j.Logger;
import java.util.Optional;
......@@ -163,7 +161,7 @@ public abstract class FlowModBuilder {
*
* @return the flow mod
*/
public abstract OFFlowAdd buildFlowAdd();
public abstract OFFlowMod buildFlowAdd();
/**
* Builds a MODIFY flow mod.
......@@ -177,7 +175,7 @@ public abstract class FlowModBuilder {
*
* @return the flow mod
*/
public abstract OFFlowDelete buildFlowDel();
public abstract OFFlowMod buildFlowDel();
/**
* Builds the match for the flow mod.
......
......@@ -47,17 +47,17 @@ import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanId
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.PushHeaderInstructions;
import org.onosproject.net.flow.instructions.L3ModificationInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpIPInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpEthInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpIPInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpOpInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction;
import org.onosproject.net.flow.instructions.L4ModificationInstruction;
import org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction;
import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter;
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.OFFlowAdd;
import org.projectfloodlight.openflow.protocol.OFFlowDelete;
import org.projectfloodlight.openflow.protocol.OFFlowDeleteStrict;
import org.projectfloodlight.openflow.protocol.OFFlowMod;
import org.projectfloodlight.openflow.protocol.OFFlowModFlags;
import org.projectfloodlight.openflow.protocol.action.OFAction;
......@@ -119,7 +119,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
}
@Override
public OFFlowAdd buildFlowAdd() {
public OFFlowMod buildFlowAdd() {
Match match = buildMatch();
List<OFAction> deferredActions = buildActions(treatment.deferred());
List<OFAction> immediateActions = buildActions(treatment.immediate());
......@@ -205,12 +205,12 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
}
@Override
public OFFlowDelete buildFlowDel() {
public OFFlowMod buildFlowDel() {
Match match = buildMatch();
long cookie = flowRule().id().value();
OFFlowDelete fm = factory().buildFlowDelete()
OFFlowDeleteStrict fm = factory().buildFlowDeleteStrict()
.setXid(xid)
.setCookie(U64.of(cookie))
.setBufferId(OFBufferId.NO_BUFFER)
......