Cosmetic fixes and logging around Juniper driver
Change-Id: Ief0dba3a1c4cc567cf9fe6fa16b4aeae9488c51e
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 fc53137..0c2823f 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
@@ -19,7 +19,6 @@
import com.google.common.annotations.Beta;
import com.google.common.collect.ImmutableList;
-import org.onosproject.drivers.utilities.XmlConfigParser;
import org.onosproject.net.DeviceId;
import org.onosproject.net.device.DeviceDescription;
import org.onosproject.net.device.DeviceDescriptionDiscovery;
@@ -27,8 +26,8 @@
import org.onosproject.net.driver.AbstractHandlerBehaviour;
import org.onosproject.netconf.NetconfController;
import org.onosproject.netconf.NetconfSession;
+import org.slf4j.Logger;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.List;
@@ -37,6 +36,7 @@
import static org.onosproject.drivers.juniper.JuniperUtils.REQ_MAC_ADD_INFO;
import static org.onosproject.drivers.juniper.JuniperUtils.REQ_SYS_INFO;
import static org.onosproject.drivers.juniper.JuniperUtils.requestBuilder;
+import static org.onosproject.drivers.utilities.XmlConfigParser.loadXmlString;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -47,7 +47,7 @@
public class DeviceDiscoveryJuniperImpl extends AbstractHandlerBehaviour
implements DeviceDescriptionDiscovery {
- public final org.slf4j.Logger log = getLogger(getClass());
+ private final Logger log = getLogger(getClass());
@Override
public DeviceDescription discoverDeviceDetails() {
@@ -63,10 +63,12 @@
log.warn("Failed to retrieve device details for {}", devId);
return null;
}
+ log.trace("Device {} system-information {}", devId, sysInfo);
DeviceDescription description =
- JuniperUtils.parseJuniperDescription(devId, XmlConfigParser.
- loadXml(new ByteArrayInputStream(sysInfo.getBytes())), chassis);
- log.debug("Device description {}", description);
+ JuniperUtils.parseJuniperDescription(devId,
+ loadXmlString(sysInfo),
+ chassis);
+ log.debug("Device {} description {}", devId, description);
return description;
}
@@ -82,10 +84,10 @@
log.warn("Failed to retrieve ports for device {}", devId);
return ImmutableList.of();
}
+ log.trace("Device {} interface-information {}", devId, reply);
List<PortDescription> descriptions =
- JuniperUtils.parseJuniperPorts(XmlConfigParser.
- loadXml(new ByteArrayInputStream(reply.getBytes())));
- log.debug("Discovered ports {}", descriptions);
+ JuniperUtils.parseJuniperPorts(loadXmlString(reply));
+ log.debug("Device {} Discovered ports {}", devId, descriptions);
return descriptions;
}
}