Praseed Balakrishnan

Optical Treatment to include SigType

......@@ -188,7 +188,7 @@ public final class DefaultTrafficSelector implements TrafficSelector {
}
@Override
public Builder matchOpticalSignalType(Byte signalType) {
public Builder matchOpticalSignalType(Short signalType) {
return add(Criteria.matchOpticalSignalType(signalType));
}
......
......@@ -147,7 +147,7 @@ public interface TrafficSelector {
* @param signalType
* @return a selection builder
*/
public Builder matchOpticalSignalType(Byte signalType);
public Builder matchOpticalSignalType(Short signalType);
/**
* Builds an immutable traffic selector.
......
......@@ -161,11 +161,11 @@ public final class Criteria {
/**
* Creates a match on lambda field using the specified value.
*
* @param lambda
* @param sigType
* @return match criterion
*/
public static Criterion matchOpticalSignalType(Byte lambda) {
return new OpticalSignalTypeCriterion(lambda, Type.OCH_SIGTYPE);
public static Criterion matchOpticalSignalType(Short sigType) {
return new OpticalSignalTypeCriterion(sigType, Type.OCH_SIGTYPE);
}
......@@ -587,10 +587,10 @@ public final class Criteria {
public static final class OpticalSignalTypeCriterion implements Criterion {
private final byte signalType;
private final Short signalType;
private final Type type;
public OpticalSignalTypeCriterion(byte signalType, Type type) {
public OpticalSignalTypeCriterion(Short signalType, Type type) {
this.signalType = signalType;
this.type = type;
}
......@@ -600,7 +600,7 @@ public final class Criteria {
return this.type;
}
public Byte signalType() {
public Short signalType() {
return this.signalType;
}
......
......@@ -79,6 +79,7 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
private ApplicationId appId;
//final short WAVELENGTH = 80;
static final short SIGNAL_TYPE = (short) 1;
@Activate
public void activate() {
......@@ -151,7 +152,9 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
prev = link.dst();
selectorBuilder.matchInport(link.dst().port());
selectorBuilder.matchOpticalSignalType(SIGNAL_TYPE); //todo
selectorBuilder.matchLambda((short) la.toInt());
}
// build the last T port rule
......
......@@ -289,7 +289,10 @@ public class FlowEntryBuilder {
case OCH_SIGID:
builder.matchLambda(match.get(MatchField.OCH_SIGID).getChannelNumber());
break;
case OCH_SIGTYPE_BASIC:
case OCH_SIGTYPE:
builder.matchOpticalSignalType(match.get(MatchField
.OCH_SIGTYPE).getValue());
break;
case ARP_OP:
case ARP_SHA:
case ARP_SPA:
......
......@@ -19,6 +19,7 @@ import static org.slf4j.LoggerFactory.getLogger;
import org.onlab.onos.net.flow.FlowRule;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.criteria.Criteria;
import org.onlab.onos.net.flow.criteria.Criteria.EthCriterion;
import org.onlab.onos.net.flow.criteria.Criteria.EthTypeCriterion;
import org.onlab.onos.net.flow.criteria.Criteria.IPCriterion;
......@@ -46,6 +47,7 @@ import org.projectfloodlight.openflow.types.Masked;
import org.projectfloodlight.openflow.types.OFPort;
import org.projectfloodlight.openflow.types.OFVlanVidMatch;
import org.projectfloodlight.openflow.types.TransportPort;
import org.projectfloodlight.openflow.types.U8;
import org.projectfloodlight.openflow.types.VlanPcp;
import org.projectfloodlight.openflow.types.VlanVid;
import org.slf4j.Logger;
......@@ -195,6 +197,12 @@ public abstract class FlowModBuilder {
mBuilder.setExact(MatchField.OCH_SIGID,
new CircuitSignalID((byte) 1, (byte) 2, lc.lambda(), (short) 1));
break;
case OCH_SIGTYPE:
Criteria.OpticalSignalTypeCriterion sc =
(Criteria.OpticalSignalTypeCriterion) c;
mBuilder.setExact(MatchField.OCH_SIGTYPE,
U8.of(sc.signalType()));
break;
case ARP_OP:
case ARP_SHA:
case ARP_SPA:
......