SONAR suggestions - uneccesary instanceof operators

Change-Id: I11b23df5814c23e2a825f8844e6c13f2d99196d2
diff --git a/apps/config/src/main/java/org/onosproject/config/ResourceIdParser.java b/apps/config/src/main/java/org/onosproject/config/ResourceIdParser.java
index 50e807a..0e32fe5 100644
--- a/apps/config/src/main/java/org/onosproject/config/ResourceIdParser.java
+++ b/apps/config/src/main/java/org/onosproject/config/ResourceIdParser.java
@@ -80,12 +80,7 @@
 
     public static NodeKey getInstanceKey(ResourceId path) {
         int last = path.nodeKeys().size();
-        NodeKey ret = path.nodeKeys().get(last - 1);
-        if (ret instanceof NodeKey) {
-            return ret;
-        } else {
-            return null;
-        }
+        return path.nodeKeys().get(last - 1);
     }
 
     public static NodeKey getMultiInstanceKey(ResourceId path) {
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java
index 562171b..7a87fd5 100644
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java
+++ b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java
@@ -807,15 +807,16 @@
 
         @Override
         public void event(EvpnRouteEvent event) {
-            if (!(event.subject() instanceof EvpnRoute)) {
+            if (event.subject() != null) {
+                EvpnRoute route = (EvpnRoute) event.subject();
+                if (EvpnRouteEvent.Type.ROUTE_ADDED == event.type()) {
+                    onBgpEvpnRouteUpdate(route);
+                } else if (EvpnRouteEvent.Type.ROUTE_REMOVED == event.type()) {
+                    onBgpEvpnRouteDelete(route);
+                }
+            } else {
                 return;
             }
-            EvpnRoute route = (EvpnRoute) event.subject();
-            if (EvpnRouteEvent.Type.ROUTE_ADDED == event.type()) {
-                onBgpEvpnRouteUpdate(route);
-            } else if (EvpnRouteEvent.Type.ROUTE_REMOVED == event.type()) {
-                onBgpEvpnRouteDelete(route);
-            }
         }
     }
 
diff --git a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java
index 6620096..fd149b1 100644
--- a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java
+++ b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java
@@ -75,7 +75,7 @@
             return ConnectPointProto.newBuilder().setHostId(connectPoint.hostId().toString())
                     .setPortNumber(connectPoint.port().toString())
                     .build();
-        } else if (connectPoint.ipElementId() instanceof IpElementId) {
+        } else if (connectPoint.ipElementId() != null) {
             return ConnectPointProto.newBuilder().setIpElementId(connectPoint.ipElementId().toString())
                     .setPortNumber(connectPoint.port().toString())
                     .build();
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityInteger.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityInteger.java
index 745a831..cabe74d 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityInteger.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityInteger.java
@@ -104,9 +104,7 @@
 
         while (listIterator.hasNext()) {
             Integer integer = listIterator.next();
-            if (integer instanceof Integer) {
-                c.writeInt(integer);
-            }
+            c.writeInt(integer);
         }
 
         int length = c.writerIndex() - iLengthIndex;
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityIpV4Neighbour.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityIpV4Neighbour.java
index 96f4540..fa4ad67 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityIpV4Neighbour.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/WideCommunityIpV4Neighbour.java
@@ -96,10 +96,8 @@
 
         while (listIterator.hasNext()) {
             IpV4Neighbour speaker = listIterator.next();
-            if (speaker instanceof IpV4Neighbour) {
-                c.writeBytes(speaker.localSpeaker().toOctets());
-                c.writeBytes(speaker.remoteSpeaker().toOctets());
-            }
+            c.writeBytes(speaker.localSpeaker().toOctets());
+            c.writeBytes(speaker.remoteSpeaker().toOctets());
         }
 
         int length = c.writerIndex() - iLengthIndex;
diff --git a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
index d1afdc6..9b936e8 100644
--- a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
+++ b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
@@ -295,7 +295,7 @@
         // Get the pcc client
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpTunnelEndPoint) tunnel.src()).ip()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with ip addresss {}"
                               + ((IpTunnelEndPoint) tunnel.src()).ip().toString());
             return;
@@ -352,7 +352,7 @@
 
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpTunnelEndPoint) tunnel.src()).ip()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with this device {}"
                     + srcElement.toString());
             return;
@@ -382,7 +382,7 @@
 
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpTunnelEndPoint) tunnel.src()).ip()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with ip addresss {}"
                     + ((IpTunnelEndPoint) tunnel.src()).ip().toString());
             return;
@@ -415,7 +415,7 @@
 
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpElementId) srcElement).ipAddress()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with ip addresss {}"
                     + ((IpElementId) srcElement).ipAddress().toString());
             return;
@@ -459,7 +459,7 @@
 
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpTunnelEndPoint) tunnel.src()).ip()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with ip addresss {}"
                     + ((IpTunnelEndPoint) tunnel.src()).ip().toString());
             return;
@@ -514,7 +514,7 @@
 
         PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpElementId) srcElement).ipAddress()));
 
-        if (!(pc instanceof PcepClient)) {
+        if (pc == null) {
             log.error("There is no PCC connected with ip addresss {}"
                     + ((IpElementId) srcElement).ipAddress().toString());
             return;
@@ -1316,7 +1316,7 @@
                         srpObj = stateRpt.getSrpObject();
                         lspObj = stateRpt.getLspObject();
 
-                        if (srpObj instanceof PcepSrpObject) {
+                        if (srpObj != null) {
                             srpId = srpObj.getSrpID();
                         }