Charles M.C. Chan
Committed by Pavlin Radoslavov

ONOS-537 Provided maxLen setting to make sure packet data is sent with packet-in message. (OF1.3)

Apply Thomas Vachuska's solution of ONOS-537 (#2177) to FlowModBuilderVer13.
This solves the exception mentioned in the comment of ONOS-540.
Tested with OpenvSwitch 2.3.0 in Mininet 2.2.0.

Change-Id: Ia6680c0403577053948c4ede3b3e8b5b846495be
...@@ -20,6 +20,7 @@ import java.util.LinkedList; ...@@ -20,6 +20,7 @@ import java.util.LinkedList;
20 import java.util.List; 20 import java.util.List;
21 import java.util.Optional; 21 import java.util.Optional;
22 22
23 +import org.onosproject.net.PortNumber;
23 import org.onosproject.net.flow.FlowRule; 24 import org.onosproject.net.flow.FlowRule;
24 import org.onosproject.net.flow.TrafficTreatment; 25 import org.onosproject.net.flow.TrafficTreatment;
25 import org.onosproject.net.flow.instructions.Instruction; 26 import org.onosproject.net.flow.instructions.Instruction;
...@@ -41,6 +42,7 @@ import org.projectfloodlight.openflow.protocol.OFFlowDelete; ...@@ -41,6 +42,7 @@ import org.projectfloodlight.openflow.protocol.OFFlowDelete;
41 import org.projectfloodlight.openflow.protocol.OFFlowMod; 42 import org.projectfloodlight.openflow.protocol.OFFlowMod;
42 import org.projectfloodlight.openflow.protocol.OFFlowModFlags; 43 import org.projectfloodlight.openflow.protocol.OFFlowModFlags;
43 import org.projectfloodlight.openflow.protocol.action.OFAction; 44 import org.projectfloodlight.openflow.protocol.action.OFAction;
45 +import org.projectfloodlight.openflow.protocol.action.OFActionOutput;
44 import org.projectfloodlight.openflow.protocol.match.Match; 46 import org.projectfloodlight.openflow.protocol.match.Match;
45 import org.projectfloodlight.openflow.protocol.oxm.OFOxm; 47 import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
46 import org.projectfloodlight.openflow.types.CircuitSignalID; 48 import org.projectfloodlight.openflow.types.CircuitSignalID;
...@@ -62,6 +64,7 @@ import org.slf4j.LoggerFactory; ...@@ -62,6 +64,7 @@ import org.slf4j.LoggerFactory;
62 public class FlowModBuilderVer13 extends FlowModBuilder { 64 public class FlowModBuilderVer13 extends FlowModBuilder {
63 65
64 private static final Logger log = LoggerFactory.getLogger(FlowModBuilderVer10.class); 66 private static final Logger log = LoggerFactory.getLogger(FlowModBuilderVer10.class);
67 + private static final int OFPCML_NO_BUFFER = 0xffff;
65 68
66 private final TrafficTreatment treatment; 69 private final TrafficTreatment treatment;
67 70
...@@ -174,8 +177,12 @@ public class FlowModBuilderVer13 extends FlowModBuilder { ...@@ -174,8 +177,12 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
174 break; 177 break;
175 case OUTPUT: 178 case OUTPUT:
176 OutputInstruction out = (OutputInstruction) i; 179 OutputInstruction out = (OutputInstruction) i;
177 - actions.add(factory().actions().buildOutput().setPort( 180 + OFActionOutput.Builder action = factory().actions().buildOutput()
178 - OFPort.of((int) out.port().toLong())).build()); 181 + .setPort(OFPort.of((int) out.port().toLong()));
182 + if (out.port().equals(PortNumber.CONTROLLER)) {
183 + action.setMaxLen(OFPCML_NO_BUFFER);
184 + }
185 + actions.add(action.build());
179 break; 186 break;
180 case GROUP: 187 case GROUP:
181 default: 188 default:
......