[ONOS-6534]Device Null Point Error is Expected in PacketManager

Change-Id: Ibc21f78e6f269d902d4d2dfaf3071d804c2c4f72
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 5393aab..4e5c20d 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
@@ -411,7 +411,11 @@
             DeviceId deviceid = request.deviceId().orElse(null);
 
             if (deviceid != null) {
-                pushRule(deviceService.getDevice(deviceid), request);
+                Device device = deviceService.getDevice(deviceid);
+
+                if (device != null) {
+                    pushRule(deviceService.getDevice(deviceid), request);
+                }
             } else {
                 pushToAllDevices(request);
             }
@@ -422,7 +426,11 @@
             DeviceId deviceid = request.deviceId().orElse(null);
 
             if (deviceid != null) {
-                removeRule(deviceService.getDevice(deviceid), request);
+                Device device = deviceService.getDevice(deviceid);
+
+                if (device != null) {
+                    removeRule(deviceService.getDevice(deviceid), request);
+                }
             } else {
                 removeFromAllDevices(request);
             }