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
diff --git a/apps/optical/src/main/java/org/onosproject/optical/OpticalPathProvisioner.java b/apps/optical/src/main/java/org/onosproject/optical/OpticalPathProvisioner.java
index efe64b1..e2e54d8 100644
--- a/apps/optical/src/main/java/org/onosproject/optical/OpticalPathProvisioner.java
+++ b/apps/optical/src/main/java/org/onosproject/optical/OpticalPathProvisioner.java
@@ -46,6 +46,7 @@
 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.concurrent.ConcurrentHashMap;
 
 import static com.google.common.base.Preconditions.checkArgument;
-
 import static com.google.common.base.Preconditions.checkNotNull;
 
 /**
@@ -402,12 +402,16 @@
          * @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);
+                }
             }
         }
     }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/CompilerRegistry.java b/core/net/src/main/java/org/onosproject/net/intent/impl/CompilerRegistry.java
index 0ee149a..1b70bc6 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/CompilerRegistry.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/CompilerRegistry.java
@@ -17,6 +17,7 @@
 
 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;
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentDeviceResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentDeviceResourceStore.java
index 09c2269..b519652 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentDeviceResourceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentDeviceResourceStore.java
@@ -52,8 +52,8 @@
     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());
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java
index 84f7bb2..74ec8f7 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java
@@ -79,10 +79,10 @@
 
     // 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());
diff --git a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
index 4eb8c7a..d8274ff 100644
--- a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
+++ b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
@@ -64,6 +64,7 @@
 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 @@
             .register(OmsPort.class)
             .register(OchPort.class)
             .register(OduSignalType.class)
+            .register(OchSignalType.class)
             .register(GridType.class)
             .register(ChannelSpacing.class)
             .register(OduCltPort.class)