for (int j=0; j<ipList.getLength(); j++) {
Element itemVariableElement = (Element) ipList.item(j);
s_logger.info("Attempting to SSH into agent " + itemVariableElement.getTextContent());
try {
Connection conn = new Connection(itemVariableElement.getTextContent());
conn.connect(null, 60000, 60000);
s_logger.info("SSHed successfully into agent " + itemVariableElement.getTextContent());
boolean isAuthenticated = conn.authenticateWithPassword("root",
"password");
if (isAuthenticated == false) {
s_logger.info("Authentication failed for root with password");
return false;
}
Session sess = conn.openSession();
s_logger.info("Executing : " + commandElement.getTextContent());
sess.execCommand(commandElement.getTextContent());
Thread.sleep(60000);
sess.close();
conn.close();
} catch (Exception ex) {
s_logger.error(ex);
return false;
}