summaryrefslogtreecommitdiffstats
path: root/testing/robot
diff options
context:
space:
mode:
Diffstat (limited to 'testing/robot')
-rw-r--r--testing/robot/data/test_data.py5
-rw-r--r--testing/robot/lib/FDSLibrary.py11
-rw-r--r--testing/robot/lib/Keywords.robot20
-rw-r--r--testing/robot/sec_groups_and_l2-smoke.robot2
-rw-r--r--testing/robot/smoke.robot73
5 files changed, 24 insertions, 87 deletions
diff --git a/testing/robot/data/test_data.py b/testing/robot/data/test_data.py
index 97aaf2b..86ca8fc 100644
--- a/testing/robot/data/test_data.py
+++ b/testing/robot/data/test_data.py
@@ -21,8 +21,9 @@ vm2_address = '192.168.10.6'
port1_name = 'fds_smoke_port1_' + run_uuid
port2_name = 'fds_smoke_port2_' + run_uuid
subnet_cidr = '192.168.10.0/24'
-vm_flavor = 'm1.small'
-vm_image = 'cirros-0.3.4'
+vm_flavor = 'nfv-fds'
+vm_image = 'cirros-0.3.5'
+image_path = '/home/opnfv/functest/data/cirros-0.3.5-x86_64-disk.img'
userdata1 = "#!/bin/sh\n\nsudo ip a add {}/24 dev eth0\n while true; do echo curl_passed | nc -l -p 80; done\n".format(vm1_address)
userdata2 = "#!/bin/sh\n\nsudo ip a add {}/24 dev eth0\nwhile true; do\n ping -c 1 {} 2>&1 >/dev/null\n " \
"RES=$?\n if [ \"Z$RES\" = \"Z0\" ] ; then\n echo 'ping PASSED'\n break\n else\n echo " \
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}
diff --git a/testing/robot/sec_groups_and_l2-smoke.robot b/testing/robot/sec_groups_and_l2-smoke.robot
index 17c5a42..347c78c 100644
--- a/testing/robot/sec_groups_and_l2-smoke.robot
+++ b/testing/robot/sec_groups_and_l2-smoke.robot
@@ -56,7 +56,7 @@ Wait for VM1 to be active
Create VM2
${port_ids} = Create List ${port2_id}
- ${result} = Create vm ${vm2_name} ${port_ids} userdata=${userdata2}
+ ${result} = Create vm ${vm2_name} ${port_ids} flavor=${flavor_to_use} userdata=${userdata2}
Set Suite Variable ${vm2_id} ${result}
Wait for VM2 to be active
diff --git a/testing/robot/smoke.robot b/testing/robot/smoke.robot
deleted file mode 100644
index d6f8fe6..0000000
--- a/testing/robot/smoke.robot
+++ /dev/null
@@ -1,73 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 Juraj Linkes (Cisco) and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-*** Settings ***
-Library OperatingSystem
-Library lib/FDSLibrary.py
-Library lib/Keywords.robot
-Variables data/test_data.py
-Suite Setup Setup Suite
-Suite Teardown Teardown Suite
-
-*** Variables ***
-
-*** Test Cases ***
-Create network for VMs
- Create tenant network
-
-Create subnet without dhcp for VMs
- Create subnet without dhcp
-
-Create port for VM1
- ${result} = Create port with ip ${port1_name} ${vm1_address}
- Set Suite Variable ${port1_id} ${result}
-
-Create port for VM2
- ${result} = Create port with ip ${port2_name} ${vm2_address}
- Set Suite Variable ${port2_id} ${result}
-
-Create VM1
- ${port_ids} = Create List ${port1_id}
- ${result} = Create vm ${vm1_name} ${port_ids} userdata=${userdata1}
- Set Suite Variable ${vm1_id} ${result}
-
-Wait for VM1 to be active
- Should Be True $vm1_id is not $None
- Poll vm ${vm1_id} active
-
-Create VM2
- ${port_ids} = Create List ${port2_id}
- ${result} = Create vm ${vm2_name} ${port_ids} userdata=${userdata2}
- Set Suite Variable ${vm2_id} ${result}
-
-Wait for VM2 to be active
- Should Be True $vm2_id is not $None
- Poll vm ${vm2_id} active
-
-Check VM2 userdata
- ${result} = Check vm console ${vm2_id} PASSED
- Should Be True ${result}
-
-*** Keywords ***
-Setup Suite
- Set Suite Variable ${network_id} ${None}
- Set Suite Variable ${subnet_id} ${None}
- Set Suite Variable ${port1_id} ${None}
- Set Suite Variable ${port2_id} ${None}
- Set Suite Variable ${vm1_id} ${None}
- Set Suite Variable ${vm2_id} ${None}
- Ensure Image
- Ensure Flavor
-
-Teardown Suite
- Run Keyword If $vm1_id is not $None Delete vm ${vm1_id}
- Run Keyword If $vm2_id is not $None Delete vm ${vm2_id}
- Run Keyword If $port1_id is not $None Delete ports ${port1_id}
- Run Keyword If $port2_id is not $None Delete ports ${port2_id}
- Run Keyword If $network_id is not $None Delete network ${network_id}