Ayaka Koshibe
Committed by Gerrit Code Review

Bug fixes for Optical Intent installation and removal

 - Missing serializer for OchSignalTypes
 - Aliasing of transactional maps in *ResourceStores
 - NPE during Intent removal

Conflicts:
	apps/optical/src/main/java/org/onosproject/optical/OpticalPathProvisioner.java

Change-Id: If882c48553a4a594341ddb743e0c3f420656d954
......@@ -46,6 +46,7 @@ import org.onosproject.net.intent.OpticalCircuitIntent;
import org.onosproject.net.intent.OpticalConnectivityIntent;
import org.onosproject.net.intent.PointToPointIntent;
import org.onosproject.net.resource.device.DeviceResourceService;
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;
......@@ -62,7 +63,6 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
......@@ -402,12 +402,16 @@ public class OpticalPathProvisioner {
* @param intent the withdrawn intent
*/
private void withdrawIntent(Intent intent) {
LinkResourceAllocations lra = linkResourceService.getAllocations(intent.id());
if (intent instanceof OpticalConnectivityIntent) {
deviceResourceService.releasePorts(intent.id());
linkResourceService.releaseResources(linkResourceService.getAllocations(intent.id()));
linkResourceService.releaseResources(lra);
} else if (intent instanceof OpticalCircuitIntent) {
deviceResourceService.releasePorts(intent.id());
deviceResourceService.releaseMapping(intent.id());
if (lra != null) {
linkResourceService.releaseResources(lra);
}
}
}
}
......
......@@ -17,6 +17,7 @@ package org.onosproject.net.intent.impl;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentCompiler;
import org.onosproject.net.intent.IntentException;
......
......@@ -52,8 +52,8 @@ public class ConsistentDeviceResourceStore implements DeviceResourceStore {
private final Logger log = getLogger(getClass());
private static final String PORT_ALLOCATIONS = "PortAllocations";
private static final String INTENT_ALLOCATIONS = "IntentAllocations";
private static final String INTENT_MAPPING = "IntentMapping";
private static final String INTENT_ALLOCATIONS = "PortIntentAllocations";
private static final Serializer SERIALIZER = Serializer.using(
new KryoNamespace.Builder().register(KryoNamespaces.API).build());
......
......@@ -79,10 +79,10 @@ public class ConsistentLinkResourceStore extends
// table to store current allocations
/** LinkKey -> List<LinkResourceAllocations>. */
private static final String LINK_RESOURCE_ALLOCATIONS = "o";
private static final String LINK_RESOURCE_ALLOCATIONS = "LinkAllocations";
/** IntentId -> LinkResourceAllocations. */
private static final String INTENT_ALLOCATIONS = "IntentAllocations";
private static final String INTENT_ALLOCATIONS = "LinkIntentAllocations";
private static final Serializer SERIALIZER = Serializer.using(
new KryoNamespace.Builder().register(KryoNamespaces.API).build());
......
......@@ -64,6 +64,7 @@ import org.onosproject.net.Link;
import org.onosproject.net.LinkKey;
import org.onosproject.net.OchPort;
import org.onosproject.net.OchSignal;
import org.onosproject.net.OchSignalType;
import org.onosproject.net.OduCltPort;
import org.onosproject.net.OduSignalType;
import org.onosproject.net.OmsPort;
......@@ -408,6 +409,7 @@ public final class KryoNamespaces {
.register(OmsPort.class)
.register(OchPort.class)
.register(OduSignalType.class)
.register(OchSignalType.class)
.register(GridType.class)
.register(ChannelSpacing.class)
.register(OduCltPort.class)
......