Thomas Vachuska
Committed by Gerrit Code Review

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

Change-Id: I7aae6a96cb55935a0acd5ac99c2526e1dab1896b
...@@ -37,6 +37,7 @@ public final class PortNumber { ...@@ -37,6 +37,7 @@ public final class PortNumber {
37 public static final PortNumber FLOOD = new PortNumber(-5); 37 public static final PortNumber FLOOD = new PortNumber(-5);
38 public static final PortNumber ALL = new PortNumber(-4); 38 public static final PortNumber ALL = new PortNumber(-4);
39 public static final PortNumber LOCAL = new PortNumber(-2); 39 public static final PortNumber LOCAL = new PortNumber(-2);
40 + public static final PortNumber CONTROLLER = new PortNumber(-3);
40 41
41 private final long number; 42 private final long number;
42 43
......
...@@ -15,11 +15,8 @@ ...@@ -15,11 +15,8 @@
15 */ 15 */
16 package org.onosproject.provider.of.flow.impl; 16 package org.onosproject.provider.of.flow.impl;
17 17
18 -import java.util.Collections; 18 +import org.onlab.packet.Ip4Address;
19 -import java.util.LinkedList; 19 +import org.onosproject.net.PortNumber;
20 -import java.util.List;
21 -import java.util.Optional;
22 -
23 import org.onosproject.net.flow.FlowRule; 20 import org.onosproject.net.flow.FlowRule;
24 import org.onosproject.net.flow.TrafficTreatment; 21 import org.onosproject.net.flow.TrafficTreatment;
25 import org.onosproject.net.flow.instructions.Instruction; 22 import org.onosproject.net.flow.instructions.Instruction;
...@@ -30,13 +27,13 @@ import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanId ...@@ -30,13 +27,13 @@ import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanId
30 import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction; 27 import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction;
31 import org.onosproject.net.flow.instructions.L3ModificationInstruction; 28 import org.onosproject.net.flow.instructions.L3ModificationInstruction;
32 import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction; 29 import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
33 -import org.onlab.packet.Ip4Address;
34 import org.projectfloodlight.openflow.protocol.OFFactory; 30 import org.projectfloodlight.openflow.protocol.OFFactory;
35 import org.projectfloodlight.openflow.protocol.OFFlowAdd; 31 import org.projectfloodlight.openflow.protocol.OFFlowAdd;
36 import org.projectfloodlight.openflow.protocol.OFFlowDelete; 32 import org.projectfloodlight.openflow.protocol.OFFlowDelete;
37 import org.projectfloodlight.openflow.protocol.OFFlowMod; 33 import org.projectfloodlight.openflow.protocol.OFFlowMod;
38 import org.projectfloodlight.openflow.protocol.OFFlowModFlags; 34 import org.projectfloodlight.openflow.protocol.OFFlowModFlags;
39 import org.projectfloodlight.openflow.protocol.action.OFAction; 35 import org.projectfloodlight.openflow.protocol.action.OFAction;
36 +import org.projectfloodlight.openflow.protocol.action.OFActionOutput;
40 import org.projectfloodlight.openflow.protocol.match.Match; 37 import org.projectfloodlight.openflow.protocol.match.Match;
41 import org.projectfloodlight.openflow.types.IPv4Address; 38 import org.projectfloodlight.openflow.types.IPv4Address;
42 import org.projectfloodlight.openflow.types.MacAddress; 39 import org.projectfloodlight.openflow.types.MacAddress;
...@@ -48,12 +45,18 @@ import org.projectfloodlight.openflow.types.VlanVid; ...@@ -48,12 +45,18 @@ import org.projectfloodlight.openflow.types.VlanVid;
48 import org.slf4j.Logger; 45 import org.slf4j.Logger;
49 import org.slf4j.LoggerFactory; 46 import org.slf4j.LoggerFactory;
50 47
48 +import java.util.Collections;
49 +import java.util.LinkedList;
50 +import java.util.List;
51 +import java.util.Optional;
52 +
51 /** 53 /**
52 * Flow mod builder for OpenFlow 1.0. 54 * Flow mod builder for OpenFlow 1.0.
53 */ 55 */
54 public class FlowModBuilderVer10 extends FlowModBuilder { 56 public class FlowModBuilderVer10 extends FlowModBuilder {
55 57
56 private static final Logger log = LoggerFactory.getLogger(FlowModBuilderVer10.class); 58 private static final Logger log = LoggerFactory.getLogger(FlowModBuilderVer10.class);
59 + private static final int OFPCML_NO_BUFFER = 0xffff;
57 60
58 private final TrafficTreatment treatment; 61 private final TrafficTreatment treatment;
59 62
...@@ -151,8 +154,12 @@ public class FlowModBuilderVer10 extends FlowModBuilder { ...@@ -151,8 +154,12 @@ public class FlowModBuilderVer10 extends FlowModBuilder {
151 break; 154 break;
152 case OUTPUT: 155 case OUTPUT:
153 OutputInstruction out = (OutputInstruction) i; 156 OutputInstruction out = (OutputInstruction) i;
154 - acts.add(factory().actions().buildOutput().setPort( 157 + OFActionOutput.Builder action = factory().actions().buildOutput()
155 - OFPort.of((int) out.port().toLong())).build()); 158 + .setPort(OFPort.of((int) out.port().toLong()));
159 + if (out.port().equals(PortNumber.CONTROLLER)) {
160 + action.setMaxLen(OFPCML_NO_BUFFER);
161 + }
162 + acts.add(action.build());
156 break; 163 break;
157 case L0MODIFICATION: 164 case L0MODIFICATION:
158 case GROUP: 165 case GROUP:
......