protected void doConnectViaSsh(Server server, LoginCredentials creds) throws IOException { SshClient ssh = Guice.createInjector(new SshjSshClientModule()) .getInstance(SshClient.Factory.class) .create(HostAndPort.fromParts(server.getVnc().getIp(), 22), creds); try { ssh.connect(); ExecResponse hello = ssh.exec("echo hello"); assertEquals(hello.getOutput().trim(), "hello"); System.err.println(ssh.exec("df -k").getOutput()); System.err.println(ssh.exec("mount").getOutput()); System.err.println(ssh.exec("uname -a").getOutput()); } finally { if (ssh != null) ssh.disconnect(); } }
protected LoginCredentials getSshCredentials(Server server) { return LoginCredentials.builder().user("toor").password(server.getVnc().getPassword()).build(); }
protected void checkServerMatchesGet(Server newInfo) { assertEquals(newInfo.getUuid(), server.getUuid()); }