Introduction

Resource for managing bash execution when SSHLibrary.Execute_Command is not enough.

Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.

This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html

There are many test tools that need to be started from bash, and then either waited upon or aborted. Typical hurdles are usage of virtualenv or preventing idle SSH sessions from closing down. This Resource contains keywords specifically for these situations, in order to avoid SSHKeywords growing too big.

Each keyword assumes There is a SSH session already esteablished and active, with properties such as timeout already configured. No keyword should close or switch away from that session, but the configured timeout may be changed if requested.

TODO: Backport improvements from project-specific Resources, for example logging to generated filename from NetconfKeywords and NexusKeywords.

Keywords

Documentation

Send ctrl+c, read until prompt, Log and return the read text.

Arguments

expected_rc
= 0

Documentation

Get return code of the previous command, fail if it does not match the expectation..

Arguments

delay
= 1

Documentation

Attempt to read excess data (probably just multiple prompts), ignoring failure. Log the data or error message. Return None. ${delay} parameter tunes how long a period of inactivity has to be to consider all excess data to be read.

Arguments

command timeout

Documentation

Enter ${command}, wait until it finishes and return the output. If it does not finish within timeout, abort it and fail. In either case, flush read.

Documentation

Log text gathered by SSHLibrary.Read_Until_Prompt. This needs to be a separate keyword just because how Verify_Tool_Has_Not_Finished_Yet is implemented.

Documentation

Send a newline and wait for prompt. On success, return the text before the prompt. The newline is there to avoid disconnection due to idling.

Documentation

Try to read SSH to see prompt, but expect to see no prompt within SSHLibrary's timeout. Log any text seen, to help debug what happened when the tool exited early.

Arguments

timeout refresh
= 1s

Documentation

Wait until prompt, while sending newlines to avoid idling. Flush read and return the text before prompt.

Documentation

Construct ctrl+c character and SSH-write it (without endline) to the current SSH connection. Do not read anything yet.

Documentation

Construct ctrl+d character and SSH-write it (without endline) to the current SSH connection. Do not read anything yet.

RemoteBash

image/svg+xml