yardstick package

Subpackages

Submodules

yardstick.main module

yardstick - command line tool for managing benchmarks

Example invocation: $ yardstick task start samples/ping.yaml

Servers are the same as VMs (Nova calls them servers in the API)

Many tests use a client/server architecture. A test client is configured to use a specific test server e.g. using an IP address. This is true for example iperf. In some cases the test server is included in the kernel (ping, pktgen) and no additional software is needed on the server. In other cases (iperf) a server process needs to be installed and started.

One server is required to host the test client program (such as ping or iperf). In the task file this server is called host.

A server can be the _target_ of a test client (think ping destination argument). A target server is optional but needed in most test scenarios. In the task file this server is called target. This is probably the same as DUT in existing terminology.

Existing terminology: https://www.ietf.org/rfc/rfc1242.txt (throughput/latency) https://www.ietf.org/rfc/rfc2285.txt (DUT/SUT)

New terminology: NFV TST

yardstick.main.main()[source]

yardstick main

yardstick.ssh module

High level ssh library.

Usage examples:

Execute command and get output:

ssh = sshclient.SSH(“root”, “example.com”, port=33) status, stdout, stderr = ssh.execute(“ps ax”) if status:

raise Exception(“Command failed with non-zero status.”)

print stdout.splitlines()

Execute command with huge output:

class PseudoFile(object):
def write(chunk):
if “error” in chunk:
email_admin(chunk)

ssh = sshclient.SSH(“root”, “example.com”) ssh.run(“tail -f /var/log/syslog”, stdout=PseudoFile(), timeout=False)

Execute local script on remote side:

ssh = sshclient.SSH(“user”, “example.com”) status, out, err = ssh.execute(“/bin/sh -s arg1 arg2”,

stdin=open(“~/myscript.sh”, “r”))

Upload file:

ssh = sshclient.SSH(“user”, “example.com”) ssh.run(“cat > ~/upload/file.gz”, stdin=open(“/store/file.gz”, “rb”))

Eventlet:

eventlet.monkey_patch(select=True, time=True) or eventlet.monkey_patch() or sshclient = eventlet.import_patched(“opentstack.common.sshclient”)
class yardstick.ssh.SSH(user, host, port=22, pkey=None, key_filename=None, password=None)[source]

Bases: object

Represent ssh connection.

close()[source]
execute(cmd, stdin=None, timeout=3600)[source]

Execute the specified command on the server.

Parameters:
  • cmd – Command to be executed.
  • stdin – Open file to be sent on process stdin.
  • timeout – Timeout for execution of the command.
Returns:

tuple (exit_status, stdout, stderr)

put(files, remote_path='.', recursive=False)[source]
run(cmd, stdin=None, stdout=None, stderr=None, raise_on_error=True, timeout=3600)[source]

Execute specified command on the server.

Parameters:
  • cmd – Command to be executed.
  • stdin – Open file or string to pass to stdin.
  • stdout – Open file to connect to stdout.
  • stderr – Open file to connect to stderr.
  • raise_on_error – If False then exit code will be return. If True then exception will be raized if non-zero code.
  • timeout – Timeout in seconds for command execution. Default 1 hour. No timeout if set to 0.
wait(timeout=120, interval=1)[source]

Wait for the host will be available via ssh.

exception yardstick.ssh.SSHError[source]

Bases: exceptions.Exception

exception yardstick.ssh.SSHTimeout[source]

Bases: yardstick.ssh.SSHError

Module contents