public final class StressClient {
private static final Logger LOG = LoggerFactory.getLogger(StressClient.class);
+ static final RemoteDevice<NetconfDeviceCommunicator> LOGGING_REMOTE_DEVICE = new RemoteDevice<>() {
+ @Override
+ public void onRemoteSessionUp(final NetconfSessionPreferences remoteSessionCapabilities,
+ final NetconfDeviceCommunicator netconfDeviceCommunicator) {
+ LOG.info("Session established");
+ }
+
+ @Override
+ public void onRemoteSessionDown() {
+ LOG.info("Session down");
+ }
+
+ @Override
+ public void onNotification(final NetconfMessage notification) {
+ LOG.info("Notification received: {}", notification);
+ }
+ };
+
static final QName COMMIT_QNAME = QName.create(CommitInput.QNAME, "commit");
public static final NetconfMessage COMMIT_MSG = new NetconfMessage(readString("""
<rpc message-id="commit-batch" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
return params.legacyFraming ? ConfigurableClientDispatcher.createLegacy(nioGroup, nioGroup, timer)
: ConfigurableClientDispatcher.createChunked(nioGroup, nioGroup, timer);
}
-
- static class LoggingRemoteDevice implements RemoteDevice<NetconfDeviceCommunicator> {
- @Override
- public void onRemoteSessionUp(final NetconfSessionPreferences remoteSessionCapabilities,
- final NetconfDeviceCommunicator netconfDeviceCommunicator) {
- LOG.info("Session established");
- }
-
- @Override
- public void onRemoteSessionDown() {
- LOG.info("Session down");
- }
-
- @Override
- public void onNotification(final NetconfMessage notification) {
- LOG.info("Notification received: {}", notification);
- }
- }
}
import org.opendaylight.netconf.client.conf.NetconfClientConfiguration;
import org.opendaylight.netconf.client.conf.NetconfClientConfigurationBuilder;
import org.opendaylight.netconf.client.mdsal.NetconfDeviceCommunicator;
-import org.opendaylight.netconf.client.mdsal.api.RemoteDevice;
import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceId;
import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.LoginPasswordHandler;
import org.slf4j.Logger;
}
}
- private static NetconfDeviceCommunicator getSessionListener(
- final InetSocketAddress inetAddress, final int messageLimit) {
- final RemoteDevice<NetconfDeviceCommunicator> loggingRemoteDevice = new StressClient.LoggingRemoteDevice();
- return new NetconfDeviceCommunicator(
- new RemoteDeviceId("secure-test", inetAddress), loggingRemoteDevice, messageLimit);
+ private static NetconfDeviceCommunicator getSessionListener(final InetSocketAddress inetAddress,
+ final int messageLimit) {
+ return new NetconfDeviceCommunicator(new RemoteDeviceId("secure-test", inetAddress),
+ StressClient.LOGGING_REMOTE_DEVICE, messageLimit);
}
private static NetconfClientConfiguration getNetconfClientConfiguration(final Parameters params,