Remove default flow rules for ROADMs. Fix LinkResource NPE. Single instance provisions optical path.

Change-Id: Iacbd41403ecd0c0df240d09026253c4b761a1d6a
diff --git a/core/net/src/main/java/org/onosproject/net/packet/impl/PacketManager.java b/core/net/src/main/java/org/onosproject/net/packet/impl/PacketManager.java
index 18989bb..8908601 100644
--- a/core/net/src/main/java/org/onosproject/net/packet/impl/PacketManager.java
+++ b/core/net/src/main/java/org/onosproject/net/packet/impl/PacketManager.java
@@ -220,6 +220,11 @@
      * @param request the packet request
      */
     private void pushRule(Device device, PacketRequest request) {
+        // Everything is pre-provisioned on ROADMs
+        if (device.type().equals(Device.Type.ROADM)) {
+            return;
+        }
+
         TrafficTreatment treatment = DefaultTrafficTreatment.builder()
                                                             .punt()
                                                             .build();
diff --git a/core/net/src/main/java/org/onosproject/net/resource/impl/LinkResourceManager.java b/core/net/src/main/java/org/onosproject/net/resource/impl/LinkResourceManager.java
index fadb152..61c36d0 100644
--- a/core/net/src/main/java/org/onosproject/net/resource/impl/LinkResourceManager.java
+++ b/core/net/src/main/java/org/onosproject/net/resource/impl/LinkResourceManager.java
@@ -15,17 +15,6 @@
  */
 package org.onosproject.net.resource.impl;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -57,6 +46,17 @@
 import org.onosproject.net.resource.ResourceType;
 import org.slf4j.Logger;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
 /**
  * Provides basic implementation of link resources allocation.
  */
@@ -197,7 +197,10 @@
         Map<Link, Set<ResourceAllocation>> allocations = new HashMap<>();
         for (Link link : req.links()) {
             allocations.put(link, new HashSet<ResourceAllocation>(allocs));
-            allocations.get(link).addAll(allocsPerLink.get(link));
+            Set<ResourceAllocation> linkAllocs = allocsPerLink.get(link);
+            if (linkAllocs != null) {
+                allocations.get(link).addAll(linkAllocs);
+            }
         }
         LinkResourceAllocations result =
                 new DefaultLinkResourceAllocations(req, allocations);