summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/clean_openstack.py49
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/generate_defaults.py25
-rw-r--r--testcases/features/promise.py63
-rw-r--r--testcases/vIMS/CI/vIMS.py1
4 files changed, 102 insertions, 36 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
index 100342304..e47750052 100644
--- a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
+++ b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
@@ -72,9 +72,11 @@ except Exception, e:
default_images = defaults_yaml.get('images')
default_instances = defaults_yaml.get('instances')
+default_volumes = defaults_yaml.get('volumes')
default_networks = defaults_yaml.get('networks')
default_routers = defaults_yaml.get('routers')
default_security_groups = defaults_yaml.get('secgroups')
+default_floatingips = defaults_yaml.get('floatingips')
default_users = defaults_yaml.get('users')
default_tenants = defaults_yaml.get('tenants')
@@ -140,19 +142,23 @@ def remove_volumes(cinder_client):
for volume in volumes:
volume_id = getattr(volume, 'id')
- logger.debug("Removing cinder volume %s ..." % volume_id)
- if functest_utils.delete_volume(cinder_client, volume_id):
- logger.debug(" > Done!")
- else:
- logger.debug("Trying forced removal...")
- if functest_utils.delete_volume(cinder_client,
- volume_id,
- forced=True):
+ volume_name = getattr(volume, 'display_name')
+ logger.debug("'%s', ID=%s " %(volume_name,volume_id))
+ if volume_id not in default_volumes:
+ logger.debug("Removing cinder volume %s ..." % volume_id)
+ if functest_utils.delete_volume(cinder_client, volume_id):
logger.debug(" > Done!")
else:
- logger.error("There has been a problem removing the "
- "volume %s..." % volume_id)
-
+ logger.debug("Trying forced removal...")
+ if functest_utils.delete_volume(cinder_client,
+ volume_id,
+ forced=True):
+ logger.debug(" > Done!")
+ else:
+ logger.error("There has been a problem removing the "
+ "volume %s..." % volume_id)
+ else:
+ logger.debug(" > this is a default volume and will NOT be deleted.")
def remove_floatingips(nova_client):
logger.info("Removing floating IPs...")
@@ -161,19 +167,28 @@ def remove_floatingips(nova_client):
logger.debug("No floating IPs found.")
return
+ init_len = len(floatingips)
+ deleted = 0
for fip in floatingips:
fip_id = getattr(fip, 'id')
- logger.debug("Removing floating IP %s ..." % fip_id)
- if functest_utils.delete_floating_ip(nova_client, fip_id):
- logger.debug(" > Done!")
+ fip_ip = getattr(fip, 'ip')
+ logger.debug("'%s', ID=%s " %(fip_ip,fip_id))
+ if fip_id not in default_floatingips:
+ logger.debug("Removing floating IP %s ..." % fip_id)
+ if functest_utils.delete_floating_ip(nova_client, fip_id):
+ logger.debug(" > Done!")
+ deleted += 1
+ else:
+ logger.error("There has been a problem removing the "
+ "floating IP %s..." % fip_id)
else:
- logger.error("There has been a problem removing the "
- "floating IP %s..." % fip_id)
+ logger.debug(" > this is a default floating IP and will NOT be deleted.")
+
timeout = 50
while timeout > 0:
floatingips = functest_utils.get_floating_ips(nova_client)
- if floatingips is None or len(floatingips) == 0:
+ if floatingips is None or len(floatingips) == (init_len - deleted):
break
else:
logger.debug("Waiting for floating ips to be released...")
diff --git a/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py b/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
index 0e34d6c7b..72987ddda 100644
--- a/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
+++ b/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
@@ -39,7 +39,7 @@ args = parser.parse_args()
""" logging configuration """
-logger = logging.getLogger('clean_openstack')
+logger = logging.getLogger('generate_defaults')
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
@@ -85,6 +85,16 @@ def get_images(nova_client):
return {'images': dic_images}
+def get_volumes(cinder_client):
+ logger.debug("Getting volumes...")
+ dic_volumes = {}
+ volumes = functest_utils.get_volumes(cinder_client)
+ if volumes != None:
+ for volume in volumes:
+ dic_volumes.update({volume.id:volume.display_name})
+ return {'volumes': dic_volumes}
+
+
def get_networks(neutron_client):
logger.debug("Getting networks")
dic_networks = {}
@@ -94,6 +104,7 @@ def get_networks(neutron_client):
dic_networks.update({network['id']:network['name']})
return {'networks': dic_networks}
+
def get_routers(neutron_client):
logger.debug("Getting routers")
dic_routers = {}
@@ -114,6 +125,16 @@ def get_security_groups(neutron_client):
return {'secgroups': dic_secgroups}
+def get_floatinips(nova_client):
+ logger.debug("Getting Floating IPs...")
+ dic_floatingips = {}
+ floatingips = functest_utils.get_floating_ips(nova_client)
+ if not (floatingips is None or len(floatingips) == 0):
+ for floatingip in floatingips:
+ dic_floatingips.update({floatingip.id:floatingip.ip})
+ return {'floatingips': dic_floatingips}
+
+
def get_users(keystone_client):
logger.debug("Getting users...")
dic_users = {}
@@ -158,9 +179,11 @@ def main():
defaults = {}
defaults.update(get_instances(nova_client))
defaults.update(get_images(nova_client))
+ defaults.update(get_volumes(cinder_client))
defaults.update(get_networks(neutron_client))
defaults.update(get_routers(neutron_client))
defaults.update(get_security_groups(neutron_client))
+ defaults.update(get_floatinips(nova_client))
defaults.update(get_users(keystone_client))
defaults.update(get_tenants(keystone_client))
diff --git a/testcases/features/promise.py b/testcases/features/promise.py
index b0fadf708..f4da956d1 100644
--- a/testcases/features/promise.py
+++ b/testcases/features/promise.py
@@ -202,12 +202,15 @@ def main():
results_file=open('promise-results.json','w+')
cmd = 'DEBUG=1 npm run -s test -- --reporter json'
start_time_ts = time.time()
+ start_time = time.strftime("%a %b %d %H:%M:%S %Z %Y")
+ #'Tue Feb 02 20:37:19 CET 2016'
logger.info("Running command: %s" % cmd)
ret = subprocess.call(cmd, shell=True, stdout=results_file, \
stderr=subprocess.STDOUT)
results_file.close()
end_time_ts = time.time()
+ end_time = time.strftime("%a %b %d %H:%M:%S %Z %Y")
duration = round(end_time_ts - start_time_ts, 1)
if ret == 0:
@@ -218,25 +221,49 @@ def main():
test_status = "Failed"
# Print output of file
- results_file=open('promise-results.json','r')
- print results_file.read()
- results_file.close()
-
+ test_count = 0
+ errors = 0
+ with open('promise-results.json','r') as results_file:
+ for line in results_file:
+ print line.replace('\n', '')
+ if "title" in line:
+ test_count += 1
+ if 'err": {' in line and not 'err": {}' in line:
+ errors += 1
+
+ logger.info("\n" \
+ "**********************************\n"\
+ " Promise test summary\n\n"\
+ "**********************************\n\n"\
+ " Test start:\t\t%s\n"\
+ " Test end:\t\t%s\n"\
+ " Execution time:\t%s\n"\
+ " Total tests executed:\t%s\n"\
+ " Total tests failed:\t%s\n\n"\
+ "**********************************\n\n"\
+ % (start_time, end_time, duration, test_count, errors))
+
+
+ if args.report:
+ pod_name = functest_utils.get_pod_name(logger)
+ installer = get_installer_type(logger)
+ scenario = functest_utils.get_scenario(logger)
+ git_version = functest_utils.get_git_branch(PROMISE_REPO)
+ url = TEST_DB + "/results"
+
+ json_results = {"timestart": start_time, "duration": duration,
+ "tests": int(test_count), "failures": int(errors)}
+ logger.debug("Results json: "+str(json_results))
+
+ params = {"project_name": "promise", "case_name": "promise",
+ "pod_name": str(pod_name), 'installer': installer,
+ "version": scenario, 'details': json_results}
+ headers = {'Content-Type': 'application/json'}
+
+ logger.info("Pushing results to DB...")
+ r = requests.post(url, data=json.dumps(params), headers=headers)
+ logger.debug(r)
- details = {
- 'timestart': start_time_ts,
- 'duration': duration,
- 'status': test_status,
- }
- pod_name = functest_utils.get_pod_name()
- git_version = functest_utils.get_git_branch(PROMISE_REPO)
- #functest_utils.push_results_to_db(TEST_DB_URL,
- # 'promise',
- # None,
- # pod_name,
- # git_version,
- # details)
- #
if __name__ == '__main__':
main()
diff --git a/testcases/vIMS/CI/vIMS.py b/testcases/vIMS/CI/vIMS.py
index ae2ad9d21..a8ac97f5c 100644
--- a/testcases/vIMS/CI/vIMS.py
+++ b/testcases/vIMS/CI/vIMS.py
@@ -364,6 +364,7 @@ def main():
logger.info("Prepare virtualenv for cloudify-cli")
cmd = "chmod +x " + VIMS_DIR + "create_venv.sh"
functest_utils.execute_command(cmd, logger)
+ time.sleep(3)
cmd = VIMS_DIR + "create_venv.sh " + VIMS_DATA_DIR
functest_utils.execute_command(cmd, logger)