From 4efd6bd2d6afea99431e9d699c77ea2226b13583 Mon Sep 17 00:00:00 2001 From: Ryan Izard <ryan.izard@bigswitch.com> Date: Mon, 18 Jul 2016 17:19:52 -0400 Subject: [PATCH] Forwarding should use OFMessageUtils.getInPort(packet-in) instead of getting the in-port itself. --- .../net/floodlightcontroller/forwarding/Forwarding.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java b/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java index afb1dfc65..034bea54a 100644 --- a/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java +++ b/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java @@ -245,7 +245,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF protected void doDropFlow(IOFSwitch sw, OFPacketIn pi, IRoutingDecision decision, FloodlightContext cntx) { - OFPort inPort = (pi.getVersion().compareTo(OFVersion.OF_12) < 0 ? pi.getInPort() : pi.getMatch().get(MatchField.IN_PORT)); + OFPort inPort = OFMessageUtils.getInPort(pi); Match m = createMatchFromPacket(sw, inPort, cntx); OFFlowMod.Builder fmb = sw.getOFFactory().buildFlowAdd(); // this will be a drop-flow; a flow that will not output to any ports List<OFAction> actions = new ArrayList<OFAction>(); // set no action to drop @@ -274,7 +274,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF } protected void doForwardFlow(IOFSwitch sw, OFPacketIn pi, IRoutingDecision decision, FloodlightContext cntx, boolean requestFlowRemovedNotifn) { - OFPort inPort = (pi.getVersion().compareTo(OFVersion.OF_12) < 0 ? pi.getInPort() : pi.getMatch().get(MatchField.IN_PORT)); + OFPort inPort = OFMessageUtils.getInPort(pi); IDevice dstDevice = IDeviceService.fcStore.get(cntx, IDeviceService.CONTEXT_DST_DEVICE); DatapathId source = sw.getId(); @@ -503,8 +503,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF * @param cntx The FloodlightContext associated with this OFPacketIn */ protected void doFlood(IOFSwitch sw, OFPacketIn pi, IRoutingDecision decision, FloodlightContext cntx) { - OFPort inPort = (pi.getVersion().compareTo(OFVersion.OF_12) < 0 ? pi.getInPort() : pi.getMatch().get(MatchField.IN_PORT)); - // Set Action to flood + OFPort inPort = OFMessageUtils.getInPort(pi); OFPacketOut.Builder pob = sw.getOFFactory().buildPacketOut(); List<OFAction> actions = new ArrayList<OFAction>(); Set<OFPort> broadcastPorts = this.topologyService.getSwitchBroadcastPorts(sw.getId()); -- GitLab