Library scope: | GLOBAL |
---|
Resource enhancing SSHLibrary with Keywords used in multiple suites.
Copyright (c) 2015 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
Some suites evolved utility Keywords re-usable with other suites. When the Keywords assume a SSH session is active, and if the Keywords do not fit into a more specific Resource, you can place them here.
Tests whether Counter is present in collections on ssh-connected machine, Puts Counter.py to workspace if not.
Tests whether ipaddr module is present on ssh-connected machine, Puts ipaddr.py to target_dir if not.
Check if netstat is installed and install it if not.
Wrapper keyword to make it easier to copy a file to an ODL specific system
Copy the ${source} file to the ${destination} file on the remote ${system}. Any pre-existing active ssh connection will be retained.
Wrapper keyword to make it easier to copy a file to an Tools specific system
Run 'netstat' on the remote machine and count occurences of given port in the given state connected to process with the given name.
Run Execute_Command_At_Path_Should_Pass with previously set CWD as path.
A keyword similar to Execute_Command_Should_Pass which performs "cd" to ${path} before executing the ${command}. This is useful when rewriting bash scripts, as series of SSHLibrary.Execute_Command do not share current working directory. TODO: Perhaps a Keyword which sets up environment variables would be useful as well.
Execute command via the active SSH connection. For success, rc has to be zero and optionally stderr has to be empty. Log everything, depending on arguments and success. Return either success string or stdout. TODO: Do we want to support customizing return values the same way as SSHLibrary.Execute_Command does?
A wrapper for Execute_Command_Passes with return_success_only=False Also, log_on_success defaults to True (but is customizable, unlike return_success_only)..
Call Flexible SSH Login, but with default values suitable for Controller machine.
Call Flexible SSH Login, but with default values suitable for Mininet machine.
On active SSH session: if given non-empty password, do Login, else do Login With Public Key.
Install netstat if it is not already installed.
Log everything returned by SSHLibrary.Execute_Command
Moves the ${source} file to the ${destination} file on the remote ${system}. Any pre-existing active ssh connection will be retained.
Open a connection to the ODL system at ${ip_address} and return its identifier.
Open a connection to the tools system at ${ip_address} and return its identifier.
Verify current SSH connection leads to machine with python working. Fatal fail otherwise.
Restore active SSH connection in SSHLibrary to given index.
Restore the currently active connection state in SSHLibrary to match the state returned by "Switch Connection" or "Get Connection". More specifically makes sure that there will be no active connection when the ${connection_index} reported by these means is None.
There is a misfeature in SSHLibrary: Invoking "SSHLibrary.Switch_Connection" and passing None as the "index_or_alias" argument to it has exactly the same effect as invoking "Close Connection". https://github.com/robotframework/SSHLibrary/blob/master/src/SSHLibrary/library.py#L560
We want to have Keyword which will "switch out" to previous "no connection active" state without killing the background one.
As some suites may hypothetically rely on non-writability of active connection, workaround is applied by opening and closing temporary connection. Unfortunately this will fail if run on Jython and there is no SSH server running on localhost, port 22 but there is nothing easy that can be done about it.
Store current connection index, run keyword returning its result, restore connection in teardown. Note that in order to avoid "got positional argument after named arguments", it is safer to use positional (not named) arguments on call.
Open temporary connection to given IP address, run keyword, close connection, restore previously active connection, return result.
Open connection to given IP address, run keyword, close connection, return result. This is unsafe in the sense that previously active session will be switched out off, but safe in the sense only the temporary connection is closed.
Set ${SSHKeywords__current_remote_working_directory} variable to ${path}. If SSH default is desired, use dot.
Copy the ${source} file to the ${destination} file on the remote ${system}. The keyword opens and closes a single ssh connection and does not rely on any existing ssh connection that may be open.
Moves the ${source} file to the ${destination} file on the remote ${system}. The keyword opens and closes a single ssh connection and does not rely on any existing ssh connection that may be open.
Activates virtual environment. To run anything in the env activated this way you should use SSHLibrary.Write and Read commands.
Creates virtual env. If not to use the default name, use Virtual_Env_Set_Path kw. Returns stdout.
Creates virtual env. If not to use the default name, use Virtual_Env_Set_Path kw. Returns stdout.
Deactivates virtual environment.
Deletes a directory with virtual env.
Shows installed packages within the returned stdout.
Installs python package into virtual env. Use with version if needed (e.g. exabgp==3.4.16). Returns stdout.
Runs given command within activated virtual env and returns stdout.
Set ${SSHKeywords__current_venv_path} variable to ${venv_path}. Path should be absolute.
Uninstalls python package from virtual env and returns stdout.