@@ -562,6 +562,23 @@ def telnet(host, port, username, password, prompt, timeout=10):
return remote_login(command, password, prompt, "\r\n", timeout)
+def netcat(host, port, username, password, prompt, timeout=10):
+ """
+ Log into a remote host (guest) using Netcat.
+
+ @param host: Hostname or IP address
+ @param username: Username (if required)
+ @param password: Password (if required)
+ @param prompt: Shell prompt (regular expression)
+ @timeout: Time in seconds that we will wait before giving up on logging
+ into the host.
+
+ @return: kvm_spawn object on success and None on failure.
+ """
+ command = "nc %s %s" % (host, port)
+ return remote_login(command, password, prompt, "\n", timeout)
+
+
# The following are utility functions related to ports.
def is_sshd_running(host, port, timeout=10.0):
@@ -727,6 +727,9 @@ class VM:
elif client == "telnet":
session = kvm_utils.telnet(address, port, username, password,
prompt, timeout)
+ elif client == "nc":
+ session = kvm_utils.netcat(address, port, username, password,
+ prompt, timeout)
if session:
session.set_status_test_command(self.params.get("status_test_"
This is useful for Windows guests that will use the homemade remote shell server. Signed-off-by: Michael Goldish <mgoldish@redhat.com> --- client/tests/kvm/kvm_utils.py | 17 +++++++++++++++++ client/tests/kvm/kvm_vm.py | 3 +++ 2 files changed, 20 insertions(+), 0 deletions(-)