summaryrefslogtreecommitdiffstats
path: root/testing/robot/lib
diff options
context:
space:
mode:
authorTomas Cechvala <tcechval@cisco.com>2017-03-13 15:18:39 +0100
committerjuraj.linkes <jlinkes@cisco.com>2017-03-14 12:38:14 +0100
commita717a49967f77ede476da582b6d3bb2c6359da1b (patch)
tree277749bb97dfd905163ca22486e83baf62068bee /testing/robot/lib
parente98d863ae414a55b1d306f66f0b54aa659a2c9ae (diff)
Check for a flavor with hugepages
Flavor is not checked by name but by huge_pages extra option. It is created when no flavor has huge_pages setting. Change-Id: I1266a6e58047c24456b12f16fc3061082916558c Signed-off-by: Tomas Cechvala <tcechval@cisco.com> Signed-off-by: juraj.linkes <jlinkes@cisco.com>
Diffstat (limited to 'testing/robot/lib')
-rw-r--r--testing/robot/lib/FDSLibrary.py11
-rw-r--r--testing/robot/lib/Keywords.robot20
2 files changed, 20 insertions, 11 deletions
diff --git a/testing/robot/lib/FDSLibrary.py b/testing/robot/lib/FDSLibrary.py
index 32c18eb..0d0929e 100644
--- a/testing/robot/lib/FDSLibrary.py
+++ b/testing/robot/lib/FDSLibrary.py
@@ -36,12 +36,17 @@ class FDSLibrary():
logger.debug("Initializing nova client.")
self.nova_client = nova.Client('2', session=session.Session(auth=auth_obj))
- def check_flavor_exists(self, flavor):
- flavor_list_names = [x.name for x in self.nova_client.flavors.list()]
- return flavor in flavor_list_names
+ def check_flavor_exists(self):
+ flavor_names = [x for x in self.nova_client.flavors.list(min_ram=760)]
+ for flavor in flavor_names:
+ for key in flavor.get_keys():
+ if "mem_page_size" in key:
+ logger.info("Found flavor with memory-setting: " + flavor.name)
+ return flavor.name
def create_flavor(self, name, ram, vcpus="1", disk="0"):
response = self.nova_client.flavors.create(name, ram, vcpus, disk)
+ response.set_keys({'hw:mem_page_size': 'large'})
return response
def check_image_exists(self, image):
diff --git a/testing/robot/lib/Keywords.robot b/testing/robot/lib/Keywords.robot
index 36136a1..d9d9cb1 100644
--- a/testing/robot/lib/Keywords.robot
+++ b/testing/robot/lib/Keywords.robot
@@ -15,16 +15,20 @@ Variables ../data/test_data.py
*** Keywords ***
Ensure Flavor
- ${result} = Check Flavor Exists ${vm_flavor}
- Return From Keyword If '${result}' == 'True'
+ ${result} = Check Flavor Exists
+ Log ${result}
+ Set Suite Variable ${flavor_to_use} ${result}
+ Return From Keyword If '${result}' is not '${None}'
Create Flavor ${vm_flavor} ram=768
- ${result} = Check Flavor Exists ${vm_flavor}
- Should be True ${result}
+ ${result} = Check Flavor Exists
+ Log ${result}
+ Set Suite Variable ${flavor_to_use} ${result}
+ Should Not Be Empty ${result}
Ensure Image
${result} = Check Image Exists ${vm_image}
Return From Keyword If '${result}' == 'True'
- Create Image ${vm_image} /home/opnfv/functest/data/cirros-0.3.4-x86_64-disk.img
+ Create Image ${vm_image} ${image_path}
${result} = Check Image Exists ${vm_image}
Should be True ${result}
@@ -75,9 +79,9 @@ Create port with ip
[Return] ${response.port['id']}
Create vm
- [Arguments] ${vm_name} ${port_ids} ${security_groups}=${None} ${userdata}=${None}
- Log Many ${vm_name} ${vm_image} ${vm_flavor} ${port_ids} ${userdata}
- ${response} = create server ${vm_name} ${vm_image} ${vm_flavor} ${port_ids} ${security_groups}
+ [Arguments] ${vm_name} ${port_ids} ${flavor}=${flavor_to_use} ${security_groups}=${None} ${userdata}=${None}
+ Log Many ${vm_name} ${vm_image} ${flavor} ${port_ids} ${userdata}
+ ${response} = create server ${vm_name} ${vm_image} ${flavor} ${port_ids} ${security_groups}
... ${userdata}
log many ${response}
log ${response.id}