camayoc.tests.utils module

Utility functions.

camayoc.tests.utils.get_vcenter_vms(vcenter_client)[source]

Return a list of available vCenter vms.

Parameters:vcenter_client – A connected vCenter client which will be used to retrieve the list of all available vms.
camayoc.tests.utils.is_live(cmd, server, num_pings=10)[source]

Test if server responds to ping.

Returns true if server is reachable, false otherwise.

camayoc.tests.utils.is_vm_powered_on(vm)[source]

Check if a vCenter vm is powered on.

A vm is considered powered on when the VMWare Tools are installed, its power state is powered on and its IP address can be fetched.

camayoc.tests.utils.power_off_vms(vms, timeout=300)[source]

Gracefully shutdown the vCenter vms.

camayoc.tests.utils.power_on_vms(vms, timeout=300)[source]

Power on the vCenter vms.

For each virtual machine: ensure that the VMWare Tools are installed, they are powered on and its IP address can be fetched.

camayoc.tests.utils.vcenter_vms(vms)[source]

Ensure vCenter machines are on and will be properly off.

Given a list of vCenter VM managed objects ensure all of them are on then yeild the vms list. Ensure they will be turned off before closing the context.

camayoc.tests.utils.wait_until_live(servers, timeout=360)[source]

Wait for servers to be live.

For each server in the “servers” list, verify if it is reachable. Keep trying until a connection is made for all servers or the timeout limit is reached.

If the timeout limit is reached, we exit even if there are unreached hosts. This means tests could fail with “No auths valid for this profile” if every host in the profile is unreachable. Otherwise, if there is at least one valid host, the scan will go on and only facts about reached hosts will be tested.