X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Flib%2Fopenstack_lib.robot;fp=robot-systest%2Flib%2Fopenstack_lib.robot;h=d544bb5c1be79c3b7ab5c1ff3ce523354735178d;hb=7f349d5e56dc3e1899fd1f765caca20aaf62691c;hp=c72892e41c55136688d264040d683a9f40f1fcd8;hpb=56e5d13508a4d0988fee261dedbd35381270239a;p=osm%2Ftests.git diff --git a/robot-systest/lib/openstack_lib.robot b/robot-systest/lib/openstack_lib.robot index c72892e..d544bb5 100644 --- a/robot-systest/lib/openstack_lib.robot +++ b/robot-systest/lib/openstack_lib.robot @@ -58,3 +58,48 @@ Get Project Quota Should Be Equal As Integers ${rc} ${success_return_code} [Return] ${stdout} + +Get Server Property + [Documentation] Get a field (flavor, image, volumes_attached, etc.) from a server. + [Arguments] ${server_id} ${field} + + Should Not Be Empty ${server_id} + Should Not Be Empty ${field} + ${rc} ${stdout}= Run and Return RC and Output openstack server show ${server_id} -c ${field} -f value + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + +Check VM In Server Group + [Documentation] Check if a given server is included in an Openstack server group + [Arguments] ${server_id} ${server_group_name} + + Should Not Be Empty ${server_group_name} + Should Not Be Empty ${server_id} + ${rc} ${stdout}= Run and Return RC and Output openstack server group show ${server_group_name} -c members -f value + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Contain ${stdout} ${server_id} + + +Check If Volume Exists + [Documentation] Checks if a volume id exists + [Arguments] ${volume_id} + + Should Not Be Empty ${volume_id} + ${rc} ${stdout}= Run and Return RC and Output openstack volume list | grep ${volume_id} | wc -l + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + +Delete Volume + [Documentation] Delete a volume by its identifier + [Arguments] ${volume_id} + + Should Not Be Empty ${volume_id} + ${rc} ${stdout}= Run and Return RC and Output openstack volume delete ${volume_id} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout}