few minor fixes around netconf subsystem
Change-Id: I16ccd383dbaba9049e9b4a21ef1910cd12e5542d
diff --git a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceOutputEvent.java b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceOutputEvent.java
index 2c4b4c5..66a3889 100644
--- a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceOutputEvent.java
+++ b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceOutputEvent.java
@@ -18,6 +18,8 @@
import org.onosproject.event.AbstractEvent;
+import com.google.common.base.MoreObjects;
+
import java.util.Optional;
/**
@@ -118,4 +120,13 @@
public Optional<Integer> getMessageID() {
return messageID;
}
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("messageID", messageID)
+ .add("deviceInfo", deviceInfo)
+ .add("messagePayload", messagePayload)
+ .toString();
+ }
}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/DefaultNetconfDevice.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/DefaultNetconfDevice.java
index a36f8d2..27c2654 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/DefaultNetconfDevice.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/DefaultNetconfDevice.java
@@ -41,7 +41,7 @@
/**
* Creates a new default NETCONF device with the information provided.
- * The device gets created only if no exception is thrwn while connecting to
+ * The device gets created only if no exception is thrown while connecting to
* it and establishing the NETCONF session.
* @param deviceInfo information about the device to be created.
* @throws NetconfException if there are problems in creating or establishing
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
index 4d713f6..81c6f6e 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
@@ -173,6 +173,7 @@
abstract NetconfMessageState evaluateChar(char c);
}
+ @Override
public void run() {
BufferedReader bufferReader = new BufferedReader(new InputStreamReader(in));
try {
@@ -224,6 +225,7 @@
netconfDeviceInfo, enableNotifications,
getMsgId(deviceReply), deviceReply);
if (enableNotifications) {
+ log.debug("dispatching to {} listeners", netconfDeviceEventListeners.size());
final String finalDeviceReply = deviceReply;
netconfDeviceEventListeners.forEach(
listener -> listener.event(new NetconfDeviceOutputEvent(
@@ -259,16 +261,19 @@
return Optional.empty();
}
+ @Override
public void addDeviceEventListener(NetconfDeviceOutputEventListener listener) {
if (!netconfDeviceEventListeners.contains(listener)) {
netconfDeviceEventListeners.add(listener);
}
}
+ @Override
public void removeDeviceEventListener(NetconfDeviceOutputEventListener listener) {
netconfDeviceEventListeners.remove(listener);
}
+ @Override
public void setEnableNotifications(boolean enableNotifications) {
this.enableNotifications = enableNotifications;
}
diff --git a/providers/netconf/alarm/src/main/java/org/onosproject/provider/netconf/alarm/NetconfAlarmProvider.java b/providers/netconf/alarm/src/main/java/org/onosproject/provider/netconf/alarm/NetconfAlarmProvider.java
index eb0ccb6..241eb8d 100644
--- a/providers/netconf/alarm/src/main/java/org/onosproject/provider/netconf/alarm/NetconfAlarmProvider.java
+++ b/providers/netconf/alarm/src/main/java/org/onosproject/provider/netconf/alarm/NetconfAlarmProvider.java
@@ -103,7 +103,7 @@
@Override
public void triggerProbe(DeviceId deviceId) {
- log.debug("Alarm probe triggered with " + deviceId);
+ log.debug("Alarm probe triggered with {}", deviceId);
}
private void triggerProbe(DeviceId deviceId, Collection<Alarm> alarms) {
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 898273c..da988dc 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
@@ -264,7 +264,7 @@
//test connection to device opening a socket to it.
try {
socket = new Socket(ip, port);
- log.debug("rechability of {}, {}, {}", deviceId, socket.isConnected() && !socket.isClosed());
+ log.debug("rechability of {}, {}, {}", deviceId, socket.isConnected(), !socket.isClosed());
return socket.isConnected() && !socket.isClosed();
} catch (IOException e) {
log.info("Device {} is not reachable", deviceId);