Marc De Leenheer
Committed by Gerrit Code Review

ONOS-2041: Flows don't stay in PENDING_ADD forever on LINC-OE

Change-Id: I2f4aa8a9a714f0f2a1d8da5987467d5c3282a503
......@@ -17,7 +17,6 @@ package org.onosproject.net;
import com.google.common.base.MoreObjects;
import org.onlab.util.Frequency;
import org.onosproject.net.resource.link.LambdaResourceAllocation;
import java.util.Objects;
......@@ -67,15 +66,13 @@ public class OchSignal implements Lambda {
}
/**
* Create OCh signal from lambda resource allocation.
* Create OCh signal from channel number.
*
* @param alloc lambda resource allocation
* @param channel channel number
* @param maxFrequency maximum frequency
* @param grid grid spacing frequency
*/
public OchSignal(LambdaResourceAllocation alloc, Frequency maxFrequency, Frequency grid) {
int channel = alloc.lambda().toInt();
public OchSignal(int channel, Frequency maxFrequency, Frequency grid) {
// Calculate center frequency
Frequency centerFrequency = maxFrequency.subtract(grid.multiply(channel - 1));
......
......@@ -15,9 +15,7 @@
*/
package org.onosproject.net.intent.impl.compiler;
import java.util.List;
import java.util.Set;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
......@@ -42,24 +40,25 @@ import org.onosproject.net.intent.IntentExtensionService;
import org.onosproject.net.intent.OpticalConnectivityIntent;
import org.onosproject.net.intent.OpticalPathIntent;
import org.onosproject.net.intent.impl.IntentCompilationException;
import org.onosproject.net.resource.link.DefaultLinkResourceRequest;
import org.onosproject.net.resource.ResourceAllocation;
import org.onosproject.net.resource.ResourceType;
import org.onosproject.net.resource.device.DeviceResourceService;
import org.onosproject.net.resource.link.DefaultLinkResourceRequest;
import org.onosproject.net.resource.link.LambdaResource;
import org.onosproject.net.resource.link.LambdaResourceAllocation;
import org.onosproject.net.resource.link.LinkResourceAllocations;
import org.onosproject.net.resource.link.LinkResourceRequest;
import org.onosproject.net.resource.link.LinkResourceService;
import org.onosproject.net.resource.ResourceAllocation;
import org.onosproject.net.resource.ResourceType;
import org.onosproject.net.topology.LinkWeight;
import org.onosproject.net.topology.Topology;
import org.onosproject.net.topology.TopologyEdge;
import org.onosproject.net.topology.TopologyService;
import com.google.common.collect.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
/**
......@@ -142,7 +141,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical
}
LambdaResourceAllocation lambdaAlloc = getWavelength(path, linkAllocs);
OmsPort omsPort = (OmsPort) deviceService.getPort(path.src().deviceId(), path.src().port());
ochSignal = new OchSignal(lambdaAlloc, omsPort.maxFrequency(), omsPort.grid());
ochSignal = new OchSignal(lambdaAlloc.lambda().toInt(), omsPort.maxFrequency(), omsPort.grid());
}
// Create installable optical path intent
......
......@@ -672,7 +672,7 @@ public class FlowEntryBuilder {
CircuitSignalID sigId = match.get(MatchField.OCH_SIGID);
builder.add(matchLambda(Lambda.ochSignal(
lookupGridType(sigId.getGridType()), lookupChannelSpacing(sigId.getChannelSpacing()),
sigId.getChannelNumber(), sigId.getChannelSpacing())
sigId.getChannelNumber(), sigId.getSpectralWidth())
));
break;
case OCH_SIGTYPE:
......