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 {
case DROP:
drop = true;
break;
case TABLE:
case OUTPUT:
outputs.add(instruction);
break;
......
......@@ -17,7 +17,6 @@ package org.onosproject.openflow.drivers;
import com.google.common.collect.Lists;
import org.onosproject.openflow.controller.Dpid;
import org.onosproject.openflow.controller.RoleState;
import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch;
import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
import org.projectfloodlight.openflow.protocol.OFFlowMod;
......@@ -43,8 +42,6 @@ public class OFCorsaSwitchDriver extends AbstractOpenFlowSwitch {
private static final int FIB_TABLE = 6;
private static final int LOCAL_TABLE = 9;
OFCorsaSwitchDriver(Dpid dpid, OFDescStatsReply desc) {
super(dpid);
......@@ -58,10 +55,7 @@ public class OFCorsaSwitchDriver extends AbstractOpenFlowSwitch {
@Override
public void write(List<OFMessage> msgs) {
if (role == RoleState.MASTER) {
channel.write(msgs);
}
}
@Override
......@@ -152,7 +146,9 @@ public class OFCorsaSwitchDriver extends AbstractOpenFlowSwitch {
default:
log.warn("Unknown table type: {}", type);
}
builder.setInstructions(newInstructions);
this.write(builder.build());
log.info("Installed {}", builder.build());
} else {
this.write(msg);
}
......
......@@ -55,7 +55,7 @@ import java.util.Optional;
*/
public class FlowModBuilderVer10 extends FlowModBuilder {
private static final Logger log = LoggerFactory.getLogger(FlowModBuilderVer10.class);
private final Logger log = LoggerFactory.getLogger(getClass());
private static final int OFPCML_NO_BUFFER = 0xffff;
private final TrafficTreatment treatment;
......
......@@ -74,7 +74,7 @@ import java.util.Optional;
*/
public class FlowModBuilderVer13 extends FlowModBuilder {
private static final Logger log = LoggerFactory.getLogger(FlowModBuilderVer10.class);
private final Logger log = LoggerFactory.getLogger(getClass());
private static final int OFPCML_NO_BUFFER = 0xffff;
private final TrafficTreatment treatment;
......@@ -118,6 +118,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
.setMatch(match)
.setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM))
.setPriority(flowRule().priority())
.setTableId(TableId.of(flowRule().type().ordinal()))
.build();
return fm;
......@@ -144,6 +145,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
.setMatch(match)
.setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM))
.setPriority(flowRule().priority())
.setTableId(TableId.of(flowRule().type().ordinal()))
.build();
return fm;
......@@ -219,6 +221,9 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
.setGroup(OFGroup.of(group.groupId().id()));
actions.add(groupBuilder.build());
break;
case TABLE:
//FIXME: should not occur here.
break;
default:
log.warn("Instruction type {} not yet implemented.", i.type());
}
......
......@@ -36,6 +36,7 @@ public class Ethernet extends BasePacket {
public static final short TYPE_IPV4 = (short) 0x0800;
public static final short TYPE_IPV6 = (short) 0x86dd;
public static final short TYPE_LLDP = (short) 0x88cc;
public static final short TYPE_VLAN = (short) 0x8100;
public static final short TYPE_BSN = (short) 0x8942;
public static final short VLAN_UNTAGGED = (short) 0xffff;
public static final short MPLS_UNICAST = (short) 0x8847;
......@@ -284,7 +285,7 @@ public class Ethernet extends BasePacket {
bb.put(this.destinationMACAddress.toBytes());
bb.put(this.sourceMACAddress.toBytes());
if (this.vlanID != Ethernet.VLAN_UNTAGGED) {
bb.putShort((short) 0x8100);
bb.putShort(TYPE_VLAN);
bb.putShort((short) (this.priorityCode << 13 | this.vlanID & 0x0fff));
}
bb.putShort(this.etherType);
......@@ -319,7 +320,7 @@ public class Ethernet extends BasePacket {
this.sourceMACAddress = MacAddress.valueOf(srcAddr);
short ethType = bb.getShort();
if (ethType == (short) 0x8100) {
if (ethType == TYPE_VLAN) {
final short tci = bb.getShort();
this.priorityCode = (byte) (tci >> 13 & 0x07);
this.vlanID = (short) (tci & 0x0fff);
......