aboutsummaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'testcases')
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/onosfunctest.py41
-rwxr-xr-xtestcases/VIM/OpenStack/CI/libraries/run_rally-cert.py47
-rw-r--r--testcases/features/promise.py10
3 files changed, 70 insertions, 28 deletions
diff --git a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
index 2d22baec..4b377941 100644
--- a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
+++ b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
@@ -98,11 +98,11 @@ def GetResult():
# 'status': Result}
cmd = "grep -rnh 'Execution Time' " + LOGPATH
Resultbuffer = os.popen(cmd).read()
- time1 = Resultbuffer[114:128]
- time2 = Resultbuffer[28:42]
+ time1 = Resultbuffer[114:128]
+ time2 = Resultbuffer[28:42]
cmd = "grep -rnh 'Success Percentage' " + LOGPATH + "/FUNCvirNetNB_*"
Resultbuffer = os.popen(cmd).read()
- if Resultbuffer.find('100%') >= 0:
+ if Resultbuffer.find('100%') >= 0:
result1='Success'
else:
result1='Failed'
@@ -112,10 +112,33 @@ def GetResult():
result2='Success'
else:
result2='Failed'
- payload={'FUNCvirNet':{'duration': time1,
- 'result': result1},
+ status1 = []
+ status2 = []
+ cmd = "grep -rnh 'h3' " + LOGPATH + "/FUNCvirNetNB_*"
+ Resultbuffer = os.popen(cmd).read()
+ pattern = re.compile("<h3>([^-]+) - ([^-]+) - (\S*)</h3>")
+ #res = pattern.search(Resultbuffer).groups()
+ res = pattern.findall(Resultbuffer)
+ i = 0
+ for index in range(len(res)):
+ status1.append({'Case name:':res[i][0] + res[i][1],'Case result':res[i][2]})
+ i=i+1
+ cmd = "grep -rnh 'h3' " + LOGPATH + "/FUNCvirNetNBL3*"
+ Resultbuffer = os.popen(cmd).read()
+ pattern = re.compile("<h3>([^-]+) - ([^-]+) - (\S*)</h3>")
+ #res = pattern.search(Resultbuffer).groups()
+ res = pattern.findall(Resultbuffer)
+ i = 0
+ for index in range(len(res)):
+ status2.append({'Case name:':res[i][0] + res[i][1],'Case result':res[i][2]})
+ i=i+1
+ payload={'timestart': str(starttime),
+ 'FUNCvirNet':{'duration': time1,
+ 'result': result1,
+ 'status': status1},
'FUNCvirNetL3':{'duration': time2,
- 'result': result2}}
+ 'result': result2,
+ 'status': status2}}
return payload
def SetOnosIp():
@@ -155,12 +178,12 @@ def main():
try:
logger.debug("Push result into DB")
# TODO check path result for the file
- git_version = functest_utils.get_git_branch(REPO_PATH)
+ scenario = functest_utils.get_scenario(logger)
pod_name = functest_utils.get_pod_name(logger)
result = GetResult()
functest_utils.push_results_to_db(TEST_DB,
"ONOS",
- logger, pod_name, git_version,
+ logger, pod_name, scenario,
payload=result)
except:
logger.error("Error pushing results into Database")
@@ -169,4 +192,4 @@ def main():
if __name__ == '__main__':
- main() \ No newline at end of file
+ main()
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
index efdde671..71bf743f 100755
--- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
@@ -192,6 +192,32 @@ def build_task_args(test_file_name):
return task_args
+def get_output(proc):
+ result = ""
+ if args.verbose:
+ while proc.poll() is None:
+ line = proc.stdout.readline()
+ print line.replace('\n', '')
+ result += line
+ else:
+ while proc.poll() is None:
+ line = proc.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)
+
+ return result
+
+
def run_task(test_name):
#
# the "main" function of the script who launch rally for a task
@@ -219,25 +245,8 @@ def run_task(test_name):
logger.debug('running command line : {}'.format(cmd_line))
p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=RALLY_STDERR, shell=True)
- result = ""
- while p.poll() is None:
- #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)
+ output = get_output(p)
+ task_id = get_task_id(output)
logger.debug('task_id : {}'.format(task_id))
if task_id is None:
diff --git a/testcases/features/promise.py b/testcases/features/promise.py
index 0dc755b5..22d28fb9 100644
--- a/testcases/features/promise.py
+++ b/testcases/features/promise.py
@@ -20,6 +20,7 @@ import yaml
import keystoneclient.v2_0.client as ksclient
import glanceclient.client as glclient
import novaclient.client as nvclient
+from neutronclient.v2_0 import client as ntclient
parser = argparse.ArgumentParser()
@@ -172,6 +173,13 @@ def main():
exit(-1)
logger.debug("Flavor '%s' with ID '%s' created successfully." % (FLAVOR_NAME,
flavor_id))
+ neutron = ntclient.Client(**nt_creds)
+ private_net=functest_utils.get_private_net(neutron)
+ if private_net == None:
+ logger.error("There is no private network in the deployment. Aborting...")
+ exit(-1)
+ logger.debug("Using private network '%s' (%s)." % (private_net['name'],
+ private_net['id']))
logger.info("Exporting environment variables...")
os.environ["NODE_ENV"] = "functest"
@@ -180,6 +188,8 @@ def main():
os.environ["OS_PASSWORD"] = USER_PWD
os.environ["OS_TEST_IMAGE"] = image_id
os.environ["OS_TEST_FLAVOR"] = flavor_id
+ os.environ["OS_TEST_NETWORK"] = private_net['id']
+
os.chdir(PROMISE_REPO)
results_file=open('promise-results.json','w+')