Handle IllegalArgumentException from packet parsing
Change-Id: Ie6fe3cffde28b2d848b36021ffb47d66fa6ed25c
diff --git a/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java b/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
index f2cfdcd..b0fad68 100644
--- a/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
+++ b/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
@@ -221,18 +221,18 @@
String idString = onoslldp.getDeviceString();
if (!isNullOrEmpty(idString)) {
- DeviceId srcDeviceId = DeviceId.deviceId(idString);
- DeviceId dstDeviceId = packetContext.inPacket().receivedFrom().deviceId();
-
- ConnectPoint src = new ConnectPoint(srcDeviceId, srcPort);
- ConnectPoint dst = new ConnectPoint(dstDeviceId, dstPort);
-
- LinkDescription ld = new DefaultLinkDescription(src, dst, lt);
try {
+ DeviceId srcDeviceId = DeviceId.deviceId(idString);
+ DeviceId dstDeviceId = packetContext.inPacket().receivedFrom().deviceId();
+
+ ConnectPoint src = new ConnectPoint(srcDeviceId, srcPort);
+ ConnectPoint dst = new ConnectPoint(dstDeviceId, dstPort);
+
+ LinkDescription ld = new DefaultLinkDescription(src, dst, lt);
context.providerService().linkDetected(ld);
context.touchLink(LinkKey.linkKey(src, dst));
- } catch (IllegalStateException e) {
- log.debug("There is a exception during link creation: {}", e);
+ } catch (IllegalStateException | IllegalArgumentException e) {
+ log.warn("There is a exception during link creation: {}", e.getMessage());
return true;
}
return true;