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; ...@@ -17,7 +17,6 @@ package org.onosproject.net;
17 17
18 import com.google.common.base.MoreObjects; 18 import com.google.common.base.MoreObjects;
19 import org.onlab.util.Frequency; 19 import org.onlab.util.Frequency;
20 -import org.onosproject.net.resource.link.LambdaResourceAllocation;
21 20
22 import java.util.Objects; 21 import java.util.Objects;
23 22
...@@ -67,15 +66,13 @@ public class OchSignal implements Lambda { ...@@ -67,15 +66,13 @@ public class OchSignal implements Lambda {
67 } 66 }
68 67
69 /** 68 /**
70 - * Create OCh signal from lambda resource allocation. 69 + * Create OCh signal from channel number.
71 * 70 *
72 - * @param alloc lambda resource allocation 71 + * @param channel channel number
73 * @param maxFrequency maximum frequency 72 * @param maxFrequency maximum frequency
74 * @param grid grid spacing frequency 73 * @param grid grid spacing frequency
75 */ 74 */
76 - public OchSignal(LambdaResourceAllocation alloc, Frequency maxFrequency, Frequency grid) { 75 + public OchSignal(int channel, Frequency maxFrequency, Frequency grid) {
77 - int channel = alloc.lambda().toInt();
78 -
79 // Calculate center frequency 76 // Calculate center frequency
80 Frequency centerFrequency = maxFrequency.subtract(grid.multiply(channel - 1)); 77 Frequency centerFrequency = maxFrequency.subtract(grid.multiply(channel - 1));
81 78
......
...@@ -15,9 +15,7 @@ ...@@ -15,9 +15,7 @@
15 */ 15 */
16 package org.onosproject.net.intent.impl.compiler; 16 package org.onosproject.net.intent.impl.compiler;
17 17
18 -import java.util.List; 18 +import com.google.common.collect.ImmutableList;
19 -import java.util.Set;
20 -
21 import com.google.common.collect.ImmutableSet; 19 import com.google.common.collect.ImmutableSet;
22 import org.apache.felix.scr.annotations.Activate; 20 import org.apache.felix.scr.annotations.Activate;
23 import org.apache.felix.scr.annotations.Component; 21 import org.apache.felix.scr.annotations.Component;
...@@ -42,24 +40,25 @@ import org.onosproject.net.intent.IntentExtensionService; ...@@ -42,24 +40,25 @@ import org.onosproject.net.intent.IntentExtensionService;
42 import org.onosproject.net.intent.OpticalConnectivityIntent; 40 import org.onosproject.net.intent.OpticalConnectivityIntent;
43 import org.onosproject.net.intent.OpticalPathIntent; 41 import org.onosproject.net.intent.OpticalPathIntent;
44 import org.onosproject.net.intent.impl.IntentCompilationException; 42 import org.onosproject.net.intent.impl.IntentCompilationException;
45 -import org.onosproject.net.resource.link.DefaultLinkResourceRequest; 43 +import org.onosproject.net.resource.ResourceAllocation;
44 +import org.onosproject.net.resource.ResourceType;
46 import org.onosproject.net.resource.device.DeviceResourceService; 45 import org.onosproject.net.resource.device.DeviceResourceService;
46 +import org.onosproject.net.resource.link.DefaultLinkResourceRequest;
47 import org.onosproject.net.resource.link.LambdaResource; 47 import org.onosproject.net.resource.link.LambdaResource;
48 import org.onosproject.net.resource.link.LambdaResourceAllocation; 48 import org.onosproject.net.resource.link.LambdaResourceAllocation;
49 import org.onosproject.net.resource.link.LinkResourceAllocations; 49 import org.onosproject.net.resource.link.LinkResourceAllocations;
50 import org.onosproject.net.resource.link.LinkResourceRequest; 50 import org.onosproject.net.resource.link.LinkResourceRequest;
51 import org.onosproject.net.resource.link.LinkResourceService; 51 import org.onosproject.net.resource.link.LinkResourceService;
52 -import org.onosproject.net.resource.ResourceAllocation;
53 -import org.onosproject.net.resource.ResourceType;
54 import org.onosproject.net.topology.LinkWeight; 52 import org.onosproject.net.topology.LinkWeight;
55 import org.onosproject.net.topology.Topology; 53 import org.onosproject.net.topology.Topology;
56 import org.onosproject.net.topology.TopologyEdge; 54 import org.onosproject.net.topology.TopologyEdge;
57 import org.onosproject.net.topology.TopologyService; 55 import org.onosproject.net.topology.TopologyService;
58 -
59 -import com.google.common.collect.ImmutableList;
60 import org.slf4j.Logger; 56 import org.slf4j.Logger;
61 import org.slf4j.LoggerFactory; 57 import org.slf4j.LoggerFactory;
62 58
59 +import java.util.List;
60 +import java.util.Set;
61 +
63 import static com.google.common.base.Preconditions.checkArgument; 62 import static com.google.common.base.Preconditions.checkArgument;
64 63
65 /** 64 /**
...@@ -142,7 +141,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical ...@@ -142,7 +141,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical
142 } 141 }
143 LambdaResourceAllocation lambdaAlloc = getWavelength(path, linkAllocs); 142 LambdaResourceAllocation lambdaAlloc = getWavelength(path, linkAllocs);
144 OmsPort omsPort = (OmsPort) deviceService.getPort(path.src().deviceId(), path.src().port()); 143 OmsPort omsPort = (OmsPort) deviceService.getPort(path.src().deviceId(), path.src().port());
145 - ochSignal = new OchSignal(lambdaAlloc, omsPort.maxFrequency(), omsPort.grid()); 144 + ochSignal = new OchSignal(lambdaAlloc.lambda().toInt(), omsPort.maxFrequency(), omsPort.grid());
146 } 145 }
147 146
148 // Create installable optical path intent 147 // Create installable optical path intent
......
...@@ -672,7 +672,7 @@ public class FlowEntryBuilder { ...@@ -672,7 +672,7 @@ public class FlowEntryBuilder {
672 CircuitSignalID sigId = match.get(MatchField.OCH_SIGID); 672 CircuitSignalID sigId = match.get(MatchField.OCH_SIGID);
673 builder.add(matchLambda(Lambda.ochSignal( 673 builder.add(matchLambda(Lambda.ochSignal(
674 lookupGridType(sigId.getGridType()), lookupChannelSpacing(sigId.getChannelSpacing()), 674 lookupGridType(sigId.getGridType()), lookupChannelSpacing(sigId.getChannelSpacing()),
675 - sigId.getChannelNumber(), sigId.getChannelSpacing()) 675 + sigId.getChannelNumber(), sigId.getSpectralWidth())
676 )); 676 ));
677 break; 677 break;
678 case OCH_SIGTYPE: 678 case OCH_SIGTYPE:
......