Clean up logging in (or relevant to) Juniper NETCONF provider
Also fix missing chassisId in DefaultDeviceDescription.toString()
Change-Id: I944baf0b3a4eb9960c0cbcec2ad585701d9a2989
diff --git a/core/api/src/main/java/org/onosproject/net/device/DefaultDeviceDescription.java b/core/api/src/main/java/org/onosproject/net/device/DefaultDeviceDescription.java
index a331f69..eb5f16a 100644
--- a/core/api/src/main/java/org/onosproject/net/device/DefaultDeviceDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/device/DefaultDeviceDescription.java
@@ -212,6 +212,7 @@
.add("uri", uri).add("type", type).add("mfr", manufacturer)
.add("hw", hwVersion).add("sw", swVersion)
.add("serial", serialNumber)
+ .add("chassisId", chassisId)
.add("annotations", annotations())
.toString();
}
diff --git a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/DeviceDiscoveryJuniperImpl.java b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/DeviceDiscoveryJuniperImpl.java
index c60c448..3c254c5 100644
--- a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/DeviceDiscoveryJuniperImpl.java
+++ b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/DeviceDiscoveryJuniperImpl.java
@@ -55,10 +55,10 @@
NetconfController controller = checkNotNull(handler().get(NetconfController.class));
NetconfSession session = controller.getDevicesMap().get(devId).getSession();
String sysInfo;
- String chassis;
+ String chassisMacAddresses;
try {
sysInfo = session.get(requestBuilder(REQ_SYS_INFO));
- chassis = session.get(requestBuilder(REQ_MAC_ADD_INFO));
+ chassisMacAddresses = session.get(requestBuilder(REQ_MAC_ADD_INFO));
} catch (NetconfException e) {
log.warn("Failed to retrieve device details for {}", devId);
return null;
@@ -66,8 +66,8 @@
log.trace("Device {} system-information {}", devId, sysInfo);
DeviceDescription description =
JuniperUtils.parseJuniperDescription(devId,
- loadXmlString(sysInfo),
- chassis);
+ loadXmlString(sysInfo),
+ chassisMacAddresses);
log.debug("Device {} description {}", devId, description);
return description;
}
@@ -81,7 +81,7 @@
try {
reply = session.get(requestBuilder(REQ_IF_INFO));
} catch (NetconfException e) {
- log.warn("Failed to retrieve ports for device {}", devId);
+ log.warn("Failed to retrieve interface-information for device {}", devId);
return ImmutableList.of();
}
log.trace("Device {} interface-information {}", devId, reply);
diff --git a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
index ebb683c..bdb8883 100644
--- a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
+++ b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
@@ -68,7 +68,7 @@
try {
reply = session.get(requestBuilder(REQ_LLDP_NBR_INFO));
} catch (NetconfException e) {
- log.warn("Failed to retrieve ports for device {}", localDeviceId);
+ log.warn("Failed to retrieve lldp-neighbors-information for device {}", localDeviceId);
return ImmutableSet.of();
}
log.debug("Reply from device {} : {}", localDeviceId, reply);
@@ -101,8 +101,8 @@
input -> input.chassisId().equals(linkAbs.remoteChassisId));
if (!dev.isPresent()) {
- log.warn("Device with chassis ID {} does not exist",
- linkAbs.remoteChassisId);
+ log.warn("Device with chassis ID {} does not exist. Referenced by {}/{}",
+ linkAbs.remoteChassisId, localDeviceId, linkAbs);
continue;
}
Device remoteDevice = dev.get();
@@ -132,7 +132,8 @@
return false;
}).findAny();
if (!remotePort.isPresent()) {
- log.warn("Port Index and Port Id and Port description do not exist in device {}", remoteDevice.id());
+ log.warn("Port does not exist in remote device {}. Referenced by {}/{}",
+ remoteDevice.id(), localDeviceId, linkAbs);
continue;
}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
index 2d082e0..0a9f1aa 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
@@ -475,7 +475,7 @@
cleanUp();
startConnection();
} else if (session.isClosed() || session.isClosing()) {
- log.debug("Trying to restart the session with {}", session, deviceInfo.getDeviceId());
+ log.debug("Trying to restart the session {} with {}", session, deviceInfo.getDeviceId());
cleanUp();
startSession();
} else if (channel.isClosed() || channel.isClosing()) {
diff --git a/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java b/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
index d09a352..0d94c87 100644
--- a/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
+++ b/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
@@ -478,7 +478,7 @@
//getting the device description
DeviceDescription deviceDescription = getDeviceDescription(deviceId, config);
//connecting device to ONOS
- log.debug("Connected NETCONF device {}, on {}:{} with username {}",
+ log.debug("Connected NETCONF device {}, on {}:{} {} with username {}",
deviceId, config.ip(), config.port(),
(config.path().isPresent() ? "/" + config.path().get() : ""),
config.username());