use of org.opennms.test.system.api.utils.SshClient in project opennms by OpenNMS.
the class NxosTelemetryIT method verifyNxosTelemetryOnMinion.
@Test
public void verifyNxosTelemetryOnMinion() throws Exception {
Date startOfTest = new Date();
final InetSocketAddress sshAddr = m_testEnvironment.getServiceAddress(ContainerAlias.MINION, 8201);
try (final SshClient sshClient = new SshClient(sshAddr, "admin", "admin")) {
// Modify minion configuration for telemetry
PrintStream pipe = sshClient.openShell();
pipe.println("config:edit org.opennms.features.telemetry.listeners-udp-50000");
pipe.println("config:property-set name NXOS");
pipe.println("config:property-set class-name org.opennms.netmgt.telemetry.listeners.udp.UdpListener");
pipe.println("config:property-set listener.port 50000");
pipe.println("config:update");
pipe.println("logout");
await().atMost(1, MINUTES).until(sshClient.isShellClosedCallable());
}
OnmsNode onmsNode = addRequisition(opennmsHttp, true, startOfTest);
final InetSocketAddress minionUdp = m_testEnvironment.getServiceAddress(ContainerAlias.MINION, 50000, "udp");
sendNxosTelemetryMessage(minionUdp);
await().atMost(2, MINUTES).pollDelay(0, SECONDS).pollInterval(15, SECONDS).until(matchRrdFileFromNodeResource(onmsNode.getId()));
}
use of org.opennms.test.system.api.utils.SshClient in project opennms by OpenNMS.
the class AbstractSyslogTestCase method resetRouteStatistics.
protected static void resetRouteStatistics(InetSocketAddress opennmsSshAddr, InetSocketAddress minionSshAddr) throws Exception {
// Reset route statistics on Minion
try (final SshClient sshClient = new SshClient(minionSshAddr, "admin", "admin")) {
PrintStream pipe = sshClient.openShell();
// Syslog listener
pipe.println("camel:route-reset-stats syslogListen");
pipe.println("logout");
try {
await().atMost(2, MINUTES).until(sshClient.isShellClosedCallable());
} finally {
LOG.info("Karaf output:\n{}", sshClient.getStdout());
}
}
// Reset route statistics on OpenNMS
try (final SshClient sshClient = new SshClient(opennmsSshAddr, "admin", "admin")) {
PrintStream pipe = sshClient.openShell();
// Elasticsearch forwarder
pipe.println("camel:route-reset-stats alarmsFromOpennms");
pipe.println("camel:route-reset-stats enrichAlarmsAndEvents");
pipe.println("camel:route-reset-stats eventsFromOpennms");
pipe.println("camel:route-reset-stats toElasticsearch");
pipe.println("camel:route-reset-stats updateElastisearchTemplateMappingRunOnlyOnce");
pipe.println("logout");
try {
await().atMost(2, MINUTES).until(sshClient.isShellClosedCallable());
} finally {
LOG.info("Karaf output:\n{}", sshClient.getStdout());
}
}
}
Aggregations