ONOS-2041: Flows don't stay in PENDING_ADD forever on LINC-OE
Change-Id: I2f4aa8a9a714f0f2a1d8da5987467d5c3282a503
diff --git a/core/api/src/main/java/org/onosproject/net/OchSignal.java b/core/api/src/main/java/org/onosproject/net/OchSignal.java
index e775521..5a5af34 100644
--- a/core/api/src/main/java/org/onosproject/net/OchSignal.java
+++ b/core/api/src/main/java/org/onosproject/net/OchSignal.java
@@ -17,7 +17,6 @@
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 @@
}
/**
- * 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));
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index 58c5907..70a0957 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -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.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 @@
}
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
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
index 6086d12..de8ca3b 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
@@ -672,7 +672,7 @@
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: