alshabib
Committed by Jonathan Hart

WIP: Started implementing static flows for corsa vanderweken pipeline.

Modified to not use Corsa driver by default.

Change-Id: If8df5769cf084346121d34bf4490f578e6b6f2d0
...@@ -134,6 +134,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { ...@@ -134,6 +134,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
134 case DROP: 134 case DROP:
135 drop = true; 135 drop = true;
136 break; 136 break;
137 + case TABLE:
137 case OUTPUT: 138 case OUTPUT:
138 outputs.add(instruction); 139 outputs.add(instruction);
139 break; 140 break;
......
...@@ -17,7 +17,6 @@ package org.onosproject.openflow.drivers; ...@@ -17,7 +17,6 @@ package org.onosproject.openflow.drivers;
17 17
18 import com.google.common.collect.Lists; 18 import com.google.common.collect.Lists;
19 import org.onosproject.openflow.controller.Dpid; 19 import org.onosproject.openflow.controller.Dpid;
20 -import org.onosproject.openflow.controller.RoleState;
21 import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; 20 import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch;
22 import org.projectfloodlight.openflow.protocol.OFDescStatsReply; 21 import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
23 import org.projectfloodlight.openflow.protocol.OFFlowMod; 22 import org.projectfloodlight.openflow.protocol.OFFlowMod;
...@@ -43,8 +42,6 @@ public class OFCorsaSwitchDriver extends AbstractOpenFlowSwitch { ...@@ -43,8 +42,6 @@ public class OFCorsaSwitchDriver extends AbstractOpenFlowSwitch {
43 private static final int FIB_TABLE = 6; 42 private static final int FIB_TABLE = 6;
44 private static final int LOCAL_TABLE = 9; 43 private static final int LOCAL_TABLE = 9;
45 44
46 -
47 -
48 OFCorsaSwitchDriver(Dpid dpid, OFDescStatsReply desc) { 45 OFCorsaSwitchDriver(Dpid dpid, OFDescStatsReply desc) {
49 super(dpid); 46 super(dpid);
50 47
...@@ -58,10 +55,7 @@ public class OFCorsaSwitchDriver extends AbstractOpenFlowSwitch { ...@@ -58,10 +55,7 @@ public class OFCorsaSwitchDriver extends AbstractOpenFlowSwitch {
58 55
59 @Override 56 @Override
60 public void write(List<OFMessage> msgs) { 57 public void write(List<OFMessage> msgs) {
61 - if (role == RoleState.MASTER) {
62 channel.write(msgs); 58 channel.write(msgs);
63 - }
64 -
65 } 59 }
66 60
67 @Override 61 @Override
...@@ -152,7 +146,9 @@ public class OFCorsaSwitchDriver extends AbstractOpenFlowSwitch { ...@@ -152,7 +146,9 @@ public class OFCorsaSwitchDriver extends AbstractOpenFlowSwitch {
152 default: 146 default:
153 log.warn("Unknown table type: {}", type); 147 log.warn("Unknown table type: {}", type);
154 } 148 }
149 + builder.setInstructions(newInstructions);
155 this.write(builder.build()); 150 this.write(builder.build());
151 + log.info("Installed {}", builder.build());
156 } else { 152 } else {
157 this.write(msg); 153 this.write(msg);
158 } 154 }
......
...@@ -55,7 +55,7 @@ import java.util.Optional; ...@@ -55,7 +55,7 @@ import java.util.Optional;
55 */ 55 */
56 public class FlowModBuilderVer10 extends FlowModBuilder { 56 public class FlowModBuilderVer10 extends FlowModBuilder {
57 57
58 - private static final Logger log = LoggerFactory.getLogger(FlowModBuilderVer10.class); 58 + private final Logger log = LoggerFactory.getLogger(getClass());
59 private static final int OFPCML_NO_BUFFER = 0xffff; 59 private static final int OFPCML_NO_BUFFER = 0xffff;
60 60
61 private final TrafficTreatment treatment; 61 private final TrafficTreatment treatment;
......
...@@ -74,7 +74,7 @@ import java.util.Optional; ...@@ -74,7 +74,7 @@ import java.util.Optional;
74 */ 74 */
75 public class FlowModBuilderVer13 extends FlowModBuilder { 75 public class FlowModBuilderVer13 extends FlowModBuilder {
76 76
77 - private static final Logger log = LoggerFactory.getLogger(FlowModBuilderVer10.class); 77 + private final Logger log = LoggerFactory.getLogger(getClass());
78 private static final int OFPCML_NO_BUFFER = 0xffff; 78 private static final int OFPCML_NO_BUFFER = 0xffff;
79 79
80 private final TrafficTreatment treatment; 80 private final TrafficTreatment treatment;
...@@ -118,6 +118,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder { ...@@ -118,6 +118,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
118 .setMatch(match) 118 .setMatch(match)
119 .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) 119 .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM))
120 .setPriority(flowRule().priority()) 120 .setPriority(flowRule().priority())
121 + .setTableId(TableId.of(flowRule().type().ordinal()))
121 .build(); 122 .build();
122 123
123 return fm; 124 return fm;
...@@ -144,6 +145,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder { ...@@ -144,6 +145,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
144 .setMatch(match) 145 .setMatch(match)
145 .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) 146 .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM))
146 .setPriority(flowRule().priority()) 147 .setPriority(flowRule().priority())
148 + .setTableId(TableId.of(flowRule().type().ordinal()))
147 .build(); 149 .build();
148 150
149 return fm; 151 return fm;
...@@ -219,6 +221,9 @@ public class FlowModBuilderVer13 extends FlowModBuilder { ...@@ -219,6 +221,9 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
219 .setGroup(OFGroup.of(group.groupId().id())); 221 .setGroup(OFGroup.of(group.groupId().id()));
220 actions.add(groupBuilder.build()); 222 actions.add(groupBuilder.build());
221 break; 223 break;
224 + case TABLE:
225 + //FIXME: should not occur here.
226 + break;
222 default: 227 default:
223 log.warn("Instruction type {} not yet implemented.", i.type()); 228 log.warn("Instruction type {} not yet implemented.", i.type());
224 } 229 }
......
...@@ -36,6 +36,7 @@ public class Ethernet extends BasePacket { ...@@ -36,6 +36,7 @@ public class Ethernet extends BasePacket {
36 public static final short TYPE_IPV4 = (short) 0x0800; 36 public static final short TYPE_IPV4 = (short) 0x0800;
37 public static final short TYPE_IPV6 = (short) 0x86dd; 37 public static final short TYPE_IPV6 = (short) 0x86dd;
38 public static final short TYPE_LLDP = (short) 0x88cc; 38 public static final short TYPE_LLDP = (short) 0x88cc;
39 + public static final short TYPE_VLAN = (short) 0x8100;
39 public static final short TYPE_BSN = (short) 0x8942; 40 public static final short TYPE_BSN = (short) 0x8942;
40 public static final short VLAN_UNTAGGED = (short) 0xffff; 41 public static final short VLAN_UNTAGGED = (short) 0xffff;
41 public static final short MPLS_UNICAST = (short) 0x8847; 42 public static final short MPLS_UNICAST = (short) 0x8847;
...@@ -284,7 +285,7 @@ public class Ethernet extends BasePacket { ...@@ -284,7 +285,7 @@ public class Ethernet extends BasePacket {
284 bb.put(this.destinationMACAddress.toBytes()); 285 bb.put(this.destinationMACAddress.toBytes());
285 bb.put(this.sourceMACAddress.toBytes()); 286 bb.put(this.sourceMACAddress.toBytes());
286 if (this.vlanID != Ethernet.VLAN_UNTAGGED) { 287 if (this.vlanID != Ethernet.VLAN_UNTAGGED) {
287 - bb.putShort((short) 0x8100); 288 + bb.putShort(TYPE_VLAN);
288 bb.putShort((short) (this.priorityCode << 13 | this.vlanID & 0x0fff)); 289 bb.putShort((short) (this.priorityCode << 13 | this.vlanID & 0x0fff));
289 } 290 }
290 bb.putShort(this.etherType); 291 bb.putShort(this.etherType);
...@@ -319,7 +320,7 @@ public class Ethernet extends BasePacket { ...@@ -319,7 +320,7 @@ public class Ethernet extends BasePacket {
319 this.sourceMACAddress = MacAddress.valueOf(srcAddr); 320 this.sourceMACAddress = MacAddress.valueOf(srcAddr);
320 321
321 short ethType = bb.getShort(); 322 short ethType = bb.getShort();
322 - if (ethType == (short) 0x8100) { 323 + if (ethType == TYPE_VLAN) {
323 final short tci = bb.getShort(); 324 final short tci = bb.getShort();
324 this.priorityCode = (byte) (tci >> 13 & 0x07); 325 this.priorityCode = (byte) (tci >> 13 & 0x07);
325 this.vlanID = (short) (tci & 0x0fff); 326 this.vlanID = (short) (tci & 0x0fff);
......