Fix NPE when a port is not configured
Change-Id: Id55cdbb7560bd11734c1923fdd6c9397aec0b071
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ArpHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
index c1a51514..2cde3b9 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ArpHandler.java
@@ -89,7 +89,7 @@
DeviceId deviceId = connectPoint.deviceId();
if (!validateArpSpa(connectPoint, arp)) {
- log.warn("Ignore ARP packet discovered on {} with unexpected src protocol address {}.",
+ log.debug("Ignore ARP packet discovered on {} with unexpected src protocol address {}.",
connectPoint, Ip4Address.valueOf(arp.getSenderProtocolAddress()));
return;
}
@@ -163,7 +163,7 @@
private boolean validateArpSpa(ConnectPoint connectPoint, ARP arpPacket) {
Ip4Address spa = Ip4Address.valueOf(arpPacket.getSenderProtocolAddress());
Ip4Prefix subnet = config.getPortSubnet(connectPoint.deviceId(), connectPoint.port());
- return subnet.contains(spa);
+ return subnet != null && subnet.contains(spa);
}