jaugust>./multicastSubscriberLookup.sh
Connecting to database...
FAILURE - hudson3router - net.sf.expectit.ExpectIOException: Expect operation fails (timeout: 30000 ms) for matcher: contains('#')
Execution finished.
JSch jSch = new JSch();
try {
Session session = jSch.getSession(username, h.hostname);
session.setPassword(password);
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();
Channel channel = session.openChannel("shell");
StringBuilder wholeBuffer = new StringBuilder();
Expect expect = new ExpectBuilder()
.withOutput(channel.getOutputStream())
.withInputs(channel.getInputStream(), channel.getExtInputStream())
.withEchoOutput(wholeBuffer)
.withEchoInput(wholeBuffer)
.withExceptionOnFailure()
.build();
channel.connect();
MultiResult multiResult = expect.expect(anyOf(contains(">"), contains("#")));
if (multiResult.getResults().get(0).isSuccessful()) {
expect.sendLine("enable");
expect.expect(contains("assword:"));
expect.sendLine(password);
expect.expect(contains("#"));
}
//APPLY
expect.sendLine("show ip igmp snooping groups");
expect.expect(contains("#"));
expect.sendLine("show ip igmp snooping explicit-tracking");
expect.expect(contains("#"));
expect.sendLine("exit");
String response = wholeBuffer.toString();
this.setResponse(h.runSetId, response);
channel.disconnect();
session.disconnect();
expect.close();
} catch (Exception e) {
System.out.println("FAILURE - " + h.hostname + " - " + e);
}
jaugust> ssh admin@hudson3router+-----------------------------------------------------------------------+| WARNING || ------- || || The confidential programs and data on this system are either licensed || to or owned by the company (the "Company") operating this system, or || its affiliates. This is a private system, intended to be accessed and || used only by the Company's authorized users. Any other access to or || use of this system is unlawful and strictly prohibited. This system || may be monitored at any time for operational reasons. If you are not || an user authorized by the Company to access this system, you must || DISCONNECT IMMEDIATELY. DO NOT ATTEMPT TO LOG IN. || |+-----------------------------------------------------------------------+Password: Last login: Tue Feb 23 11:09:24 2016 from 10.1.1.120hudson3router#
jaugust> ssh admin@hudson8router+-----------------------------------------------------------------------+| WARNING || ------- || || The confidential programs and data on this system are either licensed || to or owned by the company (the "Company") operating this system, or || its affiliates. This is a private system, intended to be accessed and || used only by the Company's authorized users. Any other access to or || use of this system is unlawful and strictly prohibited. This system || may be monitored at any time for operational reasons. If you are not || an user authorized by the Company to access this system, you must || DISCONNECT IMMEDIATELY. DO NOT ATTEMPT TO LOG IN. || |+-----------------------------------------------------------------------+Password: Last login: Tue Feb 23 11:04:27 2016 from 10.1.1.120hudson8router#
--
You received this message because you are subscribed to the Google Groups "Yet another Expect for Java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-expecti...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
expect.sendLine("terminal length 0"); expect.expect(contains("#"));
You received this message because you are subscribed to a topic in the Google Groups "Yet another Expect for Java" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/java-expectit/m66qjx03Uik/unsubscribe.
To unsubscribe from this group and all its topics, send an email to java-expecti...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/java-expectit/7cf5b0a5-8fd1-4c92-ba3c-5b1398431da2n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/java-expectit/ac1bfde1-4c17-42ff-af3b-d42cb82fe574n%40googlegroups.com.