ValidationResourcesFixture
(clients, keypair=False, floating_ip=False, security_group=False, security_group_rules=False, ethertype=’IPv4’, use_neutron=True, floating_network_id=None, floating_network_name=None)[source]¶Fixture to provision and cleanup validation resources
clear_validation_resources
(clients, keypair=None, floating_ip=None, security_group=None, use_neutron=True)[source]¶Cleanup resources for VM ping/ssh testing
Cleanup a set of resources provisioned via create_validation_resources. In case of errors during cleanup, the exception is logged and the cleanup process is continued. The first exception that was raised is re-raised after the cleanup is complete.
Parameters: |
|
---|
Examples:
from tempest.common import validation_resources as vr
from tempest.lib import auth
from tempest.lib.services import clients
creds = auth.get_credentials('http://mycloud/identity/v3',
username='me', project_name='me',
password='secret', domain_name='Default')
osclients = clients.ServiceClients(creds, 'http://mycloud/identity/v3')
# Request keypair and floating IP
resources = dict(keypair=True, security_group=False,
security_group_rules=False, floating_ip=True)
resources = vr.create_validation_resources(
osclients, validation_resources=resources, use_neutron=True,
floating_network_id='4240E68E-23DA-4C82-AC34-9FEFAA24521C')
# Now cleanup the resources
try:
vr.clear_validation_resources(osclients, use_neutron=True,
**resources)
except Exception as e:
LOG.exception('Something went wrong during cleanup, ignoring')
create_ssh_security_group
(clients, add_rule=False, ethertype=’IPv4’, use_neutron=True)[source]¶Create a security group for ping/ssh testing
Create a security group to be attached to a VM using the nova or neutron clients. If rules are added, the group can be attached to a VM to enable connectivity validation over ICMP and further testing over SSH.
Parameters: |
|
---|---|
Returns: | A dictionary with the security group as returned by the API. |
Examples:
from tempest.common import validation_resources as vr
from tempest.lib import auth
from tempest.lib.services import clients
creds = auth.get_credentials('http://mycloud/identity/v3',
username='me', project_name='me',
password='secret', domain_name='Default')
osclients = clients.ServiceClients(creds, 'http://mycloud/identity/v3')
# Security group for IPv4 tests
sg4 = vr.create_ssh_security_group(osclients, add_rule=True)
# Security group for IPv6 tests
sg6 = vr.create_ssh_security_group(osclients, ethertype='IPv6',
add_rule=True)
create_validation_resources
(clients, keypair=False, floating_ip=False, security_group=False, security_group_rules=False, ethertype=’IPv4’, use_neutron=True, floating_network_id=None, floating_network_name=None)[source]¶Provision resources for VM ping/ssh testing
Create resources required to be able to ping / ssh a virtual machine: keypair, security group, security group rules and a floating IP. Which of those resources are required may depend on the cloud setup and on the specific test and it can be controlled via the corresponding arguments.
Provisioned resources are returned in a dictionary.
Parameters: |
|
---|---|
Returns: | A dictionary with the resources in the format they are returned by the API. Valid keys are ‘keypair’, ‘floating_ip’ and ‘security_group’. |
Examples:
from tempest.common import validation_resources as vr
from tempest.lib import auth
from tempest.lib.services import clients
creds = auth.get_credentials('http://mycloud/identity/v3',
username='me', project_name='me',
password='secret', domain_name='Default')
osclients = clients.ServiceClients(creds, 'http://mycloud/identity/v3')
# Request keypair and floating IP
resources = dict(keypair=True, security_group=False,
security_group_rules=False, floating_ip=True)
resources = vr.create_validation_resources(
osclients, use_neutron=True,
floating_network_id='4240E68E-23DA-4C82-AC34-9FEFAA24521C',
**resources)
# The floating IP to be attached to the VM
floating_ip = resources['floating_ip']['ip']
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.