functest.core.singlevm module¶
Ease deploying a single VM reachable via ssh
It offers a simple way to create all tenant network resources + a VM for advanced testcases (e.g. deploying an orchestrator).
-
class
functest.core.singlevm.
SingleVm1
(**kwargs)¶ Bases:
functest.core.singlevm.VmReady1
Deploy a single VM reachable via ssh (scenario1)
It inherits from TenantNetwork1 which creates all network resources and completes it by booting a VM attached to that network.
It ensures that all testcases inheriting from SingleVm1 could work without specific configurations (or at least read the same config data).
-
clean
()¶ Clean the resources.
It can be overriden if resources must be deleted after running the test case.
-
connect
(vm1)¶ Connect to a virtual machine via ssh
It first adds a floating ip to the virtual machine and then establishes the ssh connection.
Returns: - (fip, ssh) - None on error
-
create_floating_ip_timeout
= 120¶
-
execute
()¶ Say hello world via ssh
It can be overriden to execute any command.
Returns: echo exit codes
-
prepare
()¶ Create the security group and the keypair
It can be overriden to set other rules according to the services running in the VM
Raises: Exception on error
-
run
(**kwargs)¶ Boot the new VM
Here are the main actions: - add a new ssh key - boot the VM - create the security group - execute the right command over ssh
Returns: - TestCase.EX_OK - TestCase.EX_RUN_ERROR on error
-
ssh_connect_loops
= 6¶
-
ssh_connect_timeout
= 1¶
-
username
= 'cirros'¶
-
-
class
functest.core.singlevm.
SingleVm2
(**kwargs)¶ Bases:
functest.core.singlevm.SingleVm1
Deploy a single VM reachable via ssh (scenario2)
It creates new user/project before creating and configuring all tenant network resources and vms required by advanced testcases.
It ensures that all testcases inheriting from SingleVm2 could work without specific configurations (or at least read the same config data).
-
clean
()¶ Clean the resources.
It can be overriden if resources must be deleted after running the test case.
-
-
class
functest.core.singlevm.
VmReady1
(**kwargs)¶ Bases:
functest.core.tenantnetwork.TenantNetwork1
Prepare a single VM (scenario1)
It inherits from TenantNetwork1 which creates all network resources and prepares a future VM attached to that network.
It ensures that all testcases inheriting from SingleVm1 could work without specific configurations (or at least read the same config data).
-
boot_vm
(name=None, **kwargs)¶ Boot the virtual machine
It allows booting multiple machines for the child testcases. It forces the same configuration for all subtestcases.
Returns: vm
Raises: expection on error
-
check_regex_in_console
(name, regex=' login: ', loop=1)¶ Wait for specific message in console
Returns: True or False on errors
-
clean
()¶ Clean the resources.
It can be overriden if resources must be deleted after running the test case.
-
create_flavor
(name=None)¶ Create flavor
It allows creating multiple flavors for the child testcases. It forces the same configuration for all subtestcases.
Returns: flavor
Raises: expection on error
-
create_flavor_alt
(name=None)¶ Create flavor
It allows creating multiple alt flavors for the child testcases. It forces the same configuration for all subtestcases.
Returns: flavor
Raises: expection on error
-
create_server_timeout
= 180¶
-
extra_alt_properties
= {}¶
-
extra_properties
= {}¶
-
filename
= '/home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.img'¶
-
filename_alt
= '/home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.img'¶
-
flavor_alt_disk
= 1¶
-
flavor_alt_extra_specs
= {}¶
-
flavor_alt_ram
= 1024¶
-
flavor_alt_vcpus
= 1¶
-
flavor_disk
= 1¶
-
flavor_extra_specs
= {}¶
-
flavor_ram
= 512¶
-
flavor_vcpus
= 1¶
-
image_alt_format
= 'qcow2'¶
-
image_format
= 'qcow2'¶
-
publish_image
(name=None)¶ Publish image
It allows publishing multiple images for the child testcases. It forces the same configuration for all subtestcases.
Returns: image
Raises: expection on error
-
publish_image_alt
(name=None)¶ Publish alternative image
It allows publishing multiple images for the child testcases. It forces the same configuration for all subtestcases.
Returns: image
Raises: expection on error
-
run
(**kwargs)¶ Boot the new VM
Here are the main actions: - publish the image - create the flavor
Returns: - TestCase.EX_OK - TestCase.EX_RUN_ERROR on error
-
visibility
= 'private'¶
-
-
class
functest.core.singlevm.
VmReady2
(**kwargs)¶ Bases:
functest.core.singlevm.VmReady1
Deploy a single VM reachable via ssh (scenario2)
It creates new user/project before creating and configuring all tenant network resources, flavors, images, etc. required by advanced testcases.
It ensures that all testcases inheriting from SingleVm2 could work without specific configurations (or at least read the same config data).
-
clean
()¶ Clean the resources.
It can be overriden if resources must be deleted after running the test case.
-