Sho SHIMIZU

Remove dependency on LinkResourceService from OpticalPathProvisioner

Change-Id: I442f781052e0d541acfd1e960bb56e51265edca2
......@@ -15,6 +15,7 @@
*/
package org.onosproject.optical;
import com.google.common.collect.ImmutableList;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
......@@ -45,16 +46,16 @@ import org.onosproject.net.intent.IntentState;
import org.onosproject.net.intent.OpticalCircuitIntent;
import org.onosproject.net.intent.OpticalConnectivityIntent;
import org.onosproject.net.intent.PointToPointIntent;
import org.onosproject.net.newresource.ResourceAllocation;
import org.onosproject.net.newresource.ResourceService;
import org.onosproject.net.resource.device.IntentSetMultimap;
import org.onosproject.net.resource.link.LinkResourceAllocations;
import org.onosproject.net.resource.link.LinkResourceService;
import org.onosproject.net.topology.LinkWeight;
import org.onosproject.net.topology.PathService;
import org.onosproject.net.topology.TopologyEdge;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
......@@ -101,9 +102,6 @@ public class OpticalPathProvisioner {
protected IntentSetMultimap intentSetMultimap;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected LinkResourceService linkResourceService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected ResourceService resourceService;
private ApplicationId appId;
......@@ -377,17 +375,17 @@ public class OpticalPathProvisioner {
* @param intent the intent
*/
private void releaseResources(Intent intent) {
LinkResourceAllocations lra = linkResourceService.getAllocations(intent.id());
Collection<ResourceAllocation> allocations = resourceService.getResourceAllocations(intent.id());
if (intent instanceof OpticalConnectivityIntent) {
resourceService.release(intent.id());
if (lra != null) {
linkResourceService.releaseResources(lra);
if (!allocations.isEmpty()) {
resourceService.release(ImmutableList.copyOf(allocations));
}
} else if (intent instanceof OpticalCircuitIntent) {
resourceService.release(intent.id());
intentSetMultimap.releaseMapping(intent.id());
if (lra != null) {
linkResourceService.releaseResources(lra);
if (!allocations.isEmpty()) {
resourceService.release(ImmutableList.copyOf(allocations));
}
}
}
......