neutron_tempest_plugin.common package

Submodules

neutron_tempest_plugin.common.constants module

neutron_tempest_plugin.common.ip module

class neutron_tempest_plugin.common.ip.ARPregister(ip_address, hw_type, flags, mac_address, mask, device)

Bases: ARPregister

class neutron_tempest_plugin.common.ip.Address(family, address, device, properties)

Bases: HasProperties, Address

class neutron_tempest_plugin.common.ip.Device(name, parent, flags, properties)

Bases: HasProperties, Device

class neutron_tempest_plugin.common.ip.HasProperties

Bases: object

class neutron_tempest_plugin.common.ip.IPCommand(ssh_client=None, timeout=None, namespace=None)

Bases: object

class neutron_tempest_plugin.common.ip.InetAddress(family, address, device, properties)

Bases: Address

class neutron_tempest_plugin.common.ip.Route(dest, properties)

Bases: HasProperties, Route

neutron_tempest_plugin.common.ip.arp_table(namespace=None)
neutron_tempest_plugin.common.ip.find_valid_cidr(valid_cidr='10.0.0.0/8', used_cidr=None)
neutron_tempest_plugin.common.ip.get_port_device_name(addresses, port)
neutron_tempest_plugin.common.ip.get_vlan_device_name(addresses, ip_addresses)
neutron_tempest_plugin.common.ip.list_ip_addresses(addresses, ip_addresses=None, port=None, subnets=None)
neutron_tempest_plugin.common.ip.list_iptables(version=4, namespace=None)
neutron_tempest_plugin.common.ip.list_listening_sockets(namespace=None)
neutron_tempest_plugin.common.ip.list_port_ip_addresses(port, subnets=None)
neutron_tempest_plugin.common.ip.parse_addresses(command_output)
neutron_tempest_plugin.common.ip.parse_properties(fields)
neutron_tempest_plugin.common.ip.parse_routes(command_output)
neutron_tempest_plugin.common.ip.register_address_subclass(families)
neutron_tempest_plugin.common.ip.wait_for_interface_status(client, server_id, port_id, status, ssh_client=None, mac_address=None)

Waits for an interface to reach a given status and checks VM NIC

This method enhances the tempest one. Apart from checking the interface status returned by Nova, this methods access the VM to check if the NIC interface is already detected by the kernel.

neutron_tempest_plugin.common.shell module

class neutron_tempest_plugin.common.shell.ShellExecuteResult(command, timeout, exit_status, stdout, stderr)

Bases: ShellExecuteResult

neutron_tempest_plugin.common.shell.execute(command, ssh_client=None, timeout=None, check=True)

Execute command inside a remote or local shell

Parameters:
  • command – command string to be executed

  • ssh_client – SSH client instance used for remote shell execution

  • timeout – command execution timeout in seconds

  • check – when False it doesn’t raises ShellCommandFailed when exit status is not zero. True by default

Returns:

STDOUT text when command execution terminates with zero exit status.

Raises:
  • ShellTimeoutExpired – when timeout expires before command execution terminates. In such case it kills the process, then it eventually would try to read STDOUT and STDERR buffers (not fully implemented) before raising the exception.

  • ShellCommandFailed – when command execution terminates with non-zero exit status.

neutron_tempest_plugin.common.shell.execute_local_command(command, timeout=None)

Execute command on local host using local shell

neutron_tempest_plugin.common.shell.execute_remote_command(command, ssh_client, timeout=None)

Execute command on a remote host using SSH client

neutron_tempest_plugin.common.ssh module

class neutron_tempest_plugin.common.ssh.Client(host, username, password=None, timeout=None, pkey=None, channel_timeout=10, look_for_keys=False, key_filename=None, port=22, proxy_client=None, create_proxy_client=True)

Bases: Client

test_connection_auth(*args, **kwargs)

Creates paramiko.SSHClient and connect it to remote SSH server

Returns:

paramiko.Client connected to remote server.

Raises:

tempest.lib.exceptions.SSHTimeout – in case it fails to connect to remote server.

neutron_tempest_plugin.common.tempest_fixtures module

class neutron_tempest_plugin.common.tempest_fixtures.LockFixture(name)

Bases: LockFixture

neutron_tempest_plugin.common.utils module

Utilities and helper functions.

class neutron_tempest_plugin.common.utils.LockWithTimer(threshold)

Bases: object

class neutron_tempest_plugin.common.utils.StatefulConnection(client_ssh, server_ssh, target_ip, target_port)

Bases: object

Class to test connection that should remain opened

Can be used to perform some actions while the initiated connection remain opened

test_connection(should_pass=True, timeout=10, sleep_timer=1)
property test_str
exception neutron_tempest_plugin.common.utils.WaitTimeout

Bases: Exception

Default exception coming from wait_until_true() function.

class neutron_tempest_plugin.common.utils.classproperty(f)

Bases: object

neutron_tempest_plugin.common.utils.kill_nc_process(ssh_client)
neutron_tempest_plugin.common.utils.normalize_url(url)

Normalize url without port with schema default port

neutron_tempest_plugin.common.utils.override_class(overriden_class, overrider_class)

Override class definition with a MixIn class

If overriden_class is not a subclass of overrider_class then it creates a new class that has as bases overrider_class and overriden_class.

neutron_tempest_plugin.common.utils.process_is_running(ssh_client, process_name)
neutron_tempest_plugin.common.utils.wait_until_true(predicate, timeout=60, sleep=1, exception=None)

Wait until callable predicate is evaluated as True

Parameters:
  • predicate – Callable deciding whether waiting should continue. Best practice is to instantiate predicate with functools.partial()

  • timeout – Timeout in seconds how long should function wait.

  • sleep – Polling interval for results in seconds.

  • exception – Exception instance to raise on timeout. If None is passed (default) then WaitTimeout exception is raised.

Module contents