aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/VIM
diff options
context:
space:
mode:
Diffstat (limited to 'testcases/VIM')
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/clean_openstack.py27
-rwxr-xr-xtestcases/VIM/OpenStack/CI/libraries/run_rally-cert.py54
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py20
3 files changed, 80 insertions, 21 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
index 8a49843d5..464defcc9 100644
--- a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
+++ b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
@@ -91,7 +91,7 @@ def remove_instances(nova_client):
if functest_utils.delete_instance(nova_client, instance_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the "
+ logger.error("There has been a problem removing the "
"instance %s..." % instance_id)
timeout = 50
@@ -121,7 +121,7 @@ def remove_images(nova_client):
if functest_utils.delete_glance_image(nova_client, image_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the"
+ logger.error("There has been a problem removing the"
"image %s..." % image_id)
else:
logger.debug(" > this is a default image and will NOT be deleted.")
@@ -146,7 +146,7 @@ def remove_volumes(cinder_client):
forced=True):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the "
+ logger.error("There has been a problem removing the "
"volume %s..." % volume_id)
@@ -163,7 +163,7 @@ def remove_floatingips(nova_client):
if functest_utils.delete_floating_ip(nova_client, fip_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the "
+ logger.error("There has been a problem removing the "
"floating IP %s..." % fip_id)
timeout = 50
@@ -218,7 +218,7 @@ def remove_networks(neutron_client):
if functest_utils.delete_neutron_net(neutron_client, net_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the "
+ logger.error("There has been a problem removing the "
"network %s..." % net_id)
@@ -237,7 +237,7 @@ def remove_ports(neutron_client, ports, network_ids):
if functest_utils.delete_neutron_port(neutron_client, port_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the "
+ logger.error("There has been a problem removing the "
"port %s ..." %port_id)
force_remove_port(neutron_client, port_id)
@@ -249,7 +249,7 @@ def remove_ports(neutron_client, ports, network_ids):
time.sleep(5) # leave 5 seconds to detach before doing anything else
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the "
+ logger.error("There has been a problem removing the "
"interface %s from router %s..." %(subnet_id,router_id))
force_remove_port(neutron_client, port_id)
else:
@@ -265,7 +265,8 @@ def force_remove_port(neutron_client, port_id):
if functest_utils.delete_neutron_port(neutron_client, port_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: Deleting port %s failed" % port_id)
+ logger.error("There has been a problem removing "
+ "the port %s..." % port_id)
def remove_routers(neutron_client, routers):
@@ -279,7 +280,7 @@ def remove_routers(neutron_client, routers):
if functest_utils.remove_gateway_router(neutron_client, router_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing "
+ logger.error("There has been a problem removing "
"the gateway...")
else:
logger.debug("Router is not connected to anything. Ready to remove...")
@@ -287,7 +288,7 @@ def remove_routers(neutron_client, routers):
if functest_utils.delete_neutron_router(neutron_client, router_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the "
+ logger.error("There has been a problem removing the "
"router '%s'(%s)..." % (router_name, router_id))
@@ -307,7 +308,7 @@ def remove_security_groups(neutron_client):
if functest_utils.delete_security_group(neutron_client, secgroup_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the "
+ logger.error("There has been a problem removing the "
"security group %s..." % secgroup_id)
else:
logger.debug(" > this is a default security group and will NOT "
@@ -330,7 +331,7 @@ def remove_users(keystone_client):
if functest_utils.delete_user(keystone_client,user_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the "
+ logger.error("There has been a problem removing the "
"user '%s'(%s)..." % (user_name,user_id))
else:
logger.debug(" > this is a default user and will NOT be deleted.")
@@ -352,7 +353,7 @@ def remove_tenants(keystone_client):
if functest_utils.delete_tenant(keystone_client,tenant_id):
logger.debug(" > Done!")
else:
- logger.info(" > ERROR: There has been a problem removing the "
+ logger.error("There has been a problem removing the "
"tenant '%s'(%s)..." % (tenant_name,tenant_id))
else:
logger.debug(" > this is a default tenant and will NOT be deleted.")
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
index d2128d9ac..d2ac62ac1 100755
--- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
@@ -27,6 +27,7 @@ from novaclient import client as novaclient
from glanceclient import client as glanceclient
from keystoneclient.v2_0 import client as keystoneclient
from neutronclient.v2_0 import client as neutronclient
+from cinderclient import client as cinderclient
""" tests configuration """
tests = ['authenticate', 'glance', 'cinder', 'heat', 'keystone',
@@ -119,6 +120,8 @@ GLANCE_IMAGE_FORMAT = functest_yaml.get("general"). \
GLANCE_IMAGE_PATH = functest_yaml.get("general"). \
get("directories").get("dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME
+CINDER_VOLUME_TYPE_NAME = "volume_test"
+
def push_results_to_db(payload):
@@ -218,10 +221,22 @@ def run_task(test_name):
p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=RALLY_STDERR, shell=True)
result = ""
while p.poll() is None:
- l = p.stdout.readline()
- print l.replace('\n', '')
- result += l
-
+ #l = p.stdout.readline()
+ #line = l.replace('\n', '')
+ line = p.stdout.readline()
+ if "Load duration" in line or \
+ "started" in line or \
+ "finished" in line or \
+ " Preparing" in line or \
+ "+-" in line or \
+ "|" in line:
+ result += line
+ elif "test scenario" in line:
+ result += "\n" + line
+ elif "Full duration" in line:
+ result += line + "\n\n"
+
+ logger.info("\n" + result)
task_id = get_task_id(result)
logger.debug('task_id : {}'.format(task_id))
@@ -262,9 +277,9 @@ def run_task(test_name):
""" parse JSON operation result """
if task_succeed(json_results):
- print 'Test OK'
+ logger.info("Test OK.")
else:
- print 'Test KO'
+ logger.info("Test Failed.")
def main():
@@ -283,9 +298,28 @@ def main():
endpoint_type='publicURL')
glance_client = glanceclient.Client(1, glance_endpoint,
token=keystone_client.auth_token)
+ creds_cinder = functest_utils.get_credentials("cinder")
+ cinder_client = cinderclient.Client('2',creds_cinder['username'],
+ creds_cinder['api_key'],
+ creds_cinder['project_id'],
+ creds_cinder['auth_url'],
+ service_type="volume")
client_dict['neutron'] = neutron_client
+ volume_types = functest_utils.list_volume_types(cinder_client, private=False)
+ if not volume_types:
+ volume_type = functest_utils.create_volume_type(cinder_client, \
+ CINDER_VOLUME_TYPE_NAME)
+ if not volume_type:
+ logger.error("Failed to create volume type...")
+ exit(-1)
+ else:
+ logger.debug("Volume type '%s' created succesfully..." \
+ % CINDER_VOLUME_TYPE_NAME)
+ else:
+ logger.debug("Using existing volume type(s)...")
+
image_id = functest_utils.get_image_id(glance_client, GLANCE_IMAGE_NAME)
if image_id == '':
@@ -307,7 +341,6 @@ def main():
for test_name in tests:
if not (test_name == 'all' or
test_name == 'vm'):
- print(test_name)
run_task(test_name)
else:
print(args.test_name)
@@ -318,5 +351,12 @@ def main():
if not functest_utils.delete_glance_image(nova_client, image_id):
logger.error("Error deleting the glance image")
+ if not volume_types:
+ logger.debug("Deleting volume type '%s'..." \
+ % CINDER_VOLUME_TYPE_NAME)
+ if not functest_utils.delete_volume_type(cinder_client, volume_type):
+ logger.error("Error in deleting volume type...")
+
+
if __name__ == '__main__':
main()
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
index ee0a4bea8..0097a567b 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
@@ -73,6 +73,8 @@ USER_NAME = functest_yaml.get("tempest").get("identity").get("user_name")
USER_PASSWORD = functest_yaml.get("tempest").get("identity").get("user_password")
DEPLOYMENT_MAME = functest_yaml.get("rally").get("deployment_name")
RALLY_INSTALLATION_DIR = functest_yaml.get("general").get("directories").get("dir_rally_inst")
+RESULTS_DIR = functest_yaml.get("general").get("directories").get("dir_results")
+TEMPEST_RESULTS_DIR = RESULTS_DIR + '/tempest'
def get_info(file_result):
@@ -211,7 +213,23 @@ def run_tempest(OPTION):
logger.info("Starting Tempest test suite: '%s'." % OPTION)
cmd_line = "rally verify start "+OPTION
logger.debug('Executing command : {}'.format(cmd_line))
- subprocess.call(cmd_line, shell=True, stderr=subprocess.STDOUT)
+
+ CI_DEBUG = os.environ.get("CI_DEBUG")
+ if CI_DEBUG == "true" or CI_DEBUG == "True":
+ subprocess.call(cmd_line, shell=True, stderr=subprocess.STDOUT)
+ else:
+ if not os.path.exists(TEMPEST_RESULTS_DIR):
+ os.makedirs(TEMPEST_RESULTS_DIR)
+
+ f = open(TEMPEST_RESULTS_DIR+"/tempest.log", 'w+')
+ FNULL = open(os.devnull, 'w')
+
+ subprocess.call(cmd_line, shell=True, stdout=FNULL, stderr=f)
+ f.close()
+ FNULL.close()
+
+ cmd_line = "rally verify show"
+ subprocess.call(cmd_line, shell=True)
cmd_line = "rally verify list"
logger.debug('Executing command : {}'.format(cmd_line))