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; ...@@ -46,6 +46,7 @@ import org.onosproject.net.intent.OpticalCircuitIntent;
46 import org.onosproject.net.intent.OpticalConnectivityIntent; 46 import org.onosproject.net.intent.OpticalConnectivityIntent;
47 import org.onosproject.net.intent.PointToPointIntent; 47 import org.onosproject.net.intent.PointToPointIntent;
48 import org.onosproject.net.resource.device.DeviceResourceService; 48 import org.onosproject.net.resource.device.DeviceResourceService;
49 +import org.onosproject.net.resource.link.LinkResourceAllocations;
49 import org.onosproject.net.resource.link.LinkResourceService; 50 import org.onosproject.net.resource.link.LinkResourceService;
50 import org.onosproject.net.topology.LinkWeight; 51 import org.onosproject.net.topology.LinkWeight;
51 import org.onosproject.net.topology.PathService; 52 import org.onosproject.net.topology.PathService;
...@@ -62,7 +63,6 @@ import java.util.Set; ...@@ -62,7 +63,6 @@ import java.util.Set;
62 import java.util.concurrent.ConcurrentHashMap; 63 import java.util.concurrent.ConcurrentHashMap;
63 64
64 import static com.google.common.base.Preconditions.checkArgument; 65 import static com.google.common.base.Preconditions.checkArgument;
65 -
66 import static com.google.common.base.Preconditions.checkNotNull; 66 import static com.google.common.base.Preconditions.checkNotNull;
67 67
68 /** 68 /**
...@@ -402,12 +402,16 @@ public class OpticalPathProvisioner { ...@@ -402,12 +402,16 @@ public class OpticalPathProvisioner {
402 * @param intent the withdrawn intent 402 * @param intent the withdrawn intent
403 */ 403 */
404 private void withdrawIntent(Intent intent) { 404 private void withdrawIntent(Intent intent) {
405 + LinkResourceAllocations lra = linkResourceService.getAllocations(intent.id());
405 if (intent instanceof OpticalConnectivityIntent) { 406 if (intent instanceof OpticalConnectivityIntent) {
406 deviceResourceService.releasePorts(intent.id()); 407 deviceResourceService.releasePorts(intent.id());
407 - linkResourceService.releaseResources(linkResourceService.getAllocations(intent.id())); 408 + linkResourceService.releaseResources(lra);
408 } else if (intent instanceof OpticalCircuitIntent) { 409 } else if (intent instanceof OpticalCircuitIntent) {
409 deviceResourceService.releasePorts(intent.id()); 410 deviceResourceService.releasePorts(intent.id());
410 deviceResourceService.releaseMapping(intent.id()); 411 deviceResourceService.releaseMapping(intent.id());
412 + if (lra != null) {
413 + linkResourceService.releaseResources(lra);
414 + }
411 } 415 }
412 } 416 }
413 } 417 }
......
...@@ -17,6 +17,7 @@ package org.onosproject.net.intent.impl; ...@@ -17,6 +17,7 @@ package org.onosproject.net.intent.impl;
17 17
18 import com.google.common.collect.ImmutableList; 18 import com.google.common.collect.ImmutableList;
19 import com.google.common.collect.ImmutableMap; 19 import com.google.common.collect.ImmutableMap;
20 +
20 import org.onosproject.net.intent.Intent; 21 import org.onosproject.net.intent.Intent;
21 import org.onosproject.net.intent.IntentCompiler; 22 import org.onosproject.net.intent.IntentCompiler;
22 import org.onosproject.net.intent.IntentException; 23 import org.onosproject.net.intent.IntentException;
......
...@@ -52,8 +52,8 @@ public class ConsistentDeviceResourceStore implements DeviceResourceStore { ...@@ -52,8 +52,8 @@ public class ConsistentDeviceResourceStore implements DeviceResourceStore {
52 private final Logger log = getLogger(getClass()); 52 private final Logger log = getLogger(getClass());
53 53
54 private static final String PORT_ALLOCATIONS = "PortAllocations"; 54 private static final String PORT_ALLOCATIONS = "PortAllocations";
55 - private static final String INTENT_ALLOCATIONS = "IntentAllocations";
56 private static final String INTENT_MAPPING = "IntentMapping"; 55 private static final String INTENT_MAPPING = "IntentMapping";
56 + private static final String INTENT_ALLOCATIONS = "PortIntentAllocations";
57 57
58 private static final Serializer SERIALIZER = Serializer.using( 58 private static final Serializer SERIALIZER = Serializer.using(
59 new KryoNamespace.Builder().register(KryoNamespaces.API).build()); 59 new KryoNamespace.Builder().register(KryoNamespaces.API).build());
......
...@@ -79,10 +79,10 @@ public class ConsistentLinkResourceStore extends ...@@ -79,10 +79,10 @@ public class ConsistentLinkResourceStore extends
79 79
80 // table to store current allocations 80 // table to store current allocations
81 /** LinkKey -> List<LinkResourceAllocations>. */ 81 /** LinkKey -> List<LinkResourceAllocations>. */
82 - private static final String LINK_RESOURCE_ALLOCATIONS = "o"; 82 + private static final String LINK_RESOURCE_ALLOCATIONS = "LinkAllocations";
83 83
84 /** IntentId -> LinkResourceAllocations. */ 84 /** IntentId -> LinkResourceAllocations. */
85 - private static final String INTENT_ALLOCATIONS = "IntentAllocations"; 85 + private static final String INTENT_ALLOCATIONS = "LinkIntentAllocations";
86 86
87 private static final Serializer SERIALIZER = Serializer.using( 87 private static final Serializer SERIALIZER = Serializer.using(
88 new KryoNamespace.Builder().register(KryoNamespaces.API).build()); 88 new KryoNamespace.Builder().register(KryoNamespaces.API).build());
......
...@@ -64,6 +64,7 @@ import org.onosproject.net.Link; ...@@ -64,6 +64,7 @@ import org.onosproject.net.Link;
64 import org.onosproject.net.LinkKey; 64 import org.onosproject.net.LinkKey;
65 import org.onosproject.net.OchPort; 65 import org.onosproject.net.OchPort;
66 import org.onosproject.net.OchSignal; 66 import org.onosproject.net.OchSignal;
67 +import org.onosproject.net.OchSignalType;
67 import org.onosproject.net.OduCltPort; 68 import org.onosproject.net.OduCltPort;
68 import org.onosproject.net.OduSignalType; 69 import org.onosproject.net.OduSignalType;
69 import org.onosproject.net.OmsPort; 70 import org.onosproject.net.OmsPort;
...@@ -408,6 +409,7 @@ public final class KryoNamespaces { ...@@ -408,6 +409,7 @@ public final class KryoNamespaces {
408 .register(OmsPort.class) 409 .register(OmsPort.class)
409 .register(OchPort.class) 410 .register(OchPort.class)
410 .register(OduSignalType.class) 411 .register(OduSignalType.class)
412 + .register(OchSignalType.class)
411 .register(GridType.class) 413 .register(GridType.class)
412 .register(ChannelSpacing.class) 414 .register(ChannelSpacing.class)
413 .register(OduCltPort.class) 415 .register(OduCltPort.class)
......