From 30f974a996efbb4b7f7b4fc3a47a1454c3fe80e5 Mon Sep 17 00:00:00 2001 From: MofassirArif Date: Thu, 21 Jan 2016 06:42:23 -0800 Subject: bug fix: result collection bug fix for docker images Change-Id: Ia4ea09b90c7a4f4e3699af456c6d66e85661cc0b Signed-off-by: MofassirArif (cherry picked from commit 971a7c98515a9d83661f5e423f7e8390f35dca59) --- func/cli.py | 16 ++++++++-------- func/driver.py | 4 +++- func/env_setup.py | 4 ++-- func/fetchimg.py | 2 +- func/spawn_vm.py | 16 +++++++++------- 5 files changed, 23 insertions(+), 19 deletions(-) (limited to 'func') diff --git a/func/cli.py b/func/cli.py index b8718407..9b140874 100644 --- a/func/cli.py +++ b/func/cli.py @@ -16,21 +16,21 @@ import argparse class cli(): - + def _getfile(self, filepath): - + with open('test_list/'+filepath,'r') as finput: _benchmarks=finput.readlines() for items in range( len(_benchmarks)): _benchmarks[items]=_benchmarks[items].rstrip() return _benchmarks - + def _getsuite(self, filepath): return filepath - + def _checkTestList(self, filename): - + if os.path.isfile('test_list/'+filename): return True else: @@ -44,7 +44,7 @@ class cli(): return False def __init__(self): - + suite=[] parser = argparse.ArgumentParser() parser.add_argument('-l ', '--lab', help='Name of Lab on which being tested, These can' \ @@ -60,7 +60,7 @@ class cli(): 'They contain all the tests that will be run. They are listed by suite.' \ 'Please ensure there are no empty lines') args = parser.parse_args() - + if not self._checkTestList(args.file): print '\n\n ERROR: Test File Does not exist in test_list/ please enter correct file \n\n' sys.exit(0) @@ -85,7 +85,7 @@ class cli(): if os.path.isfile('./test_cases/'+args.lab.lower()+'/'+suite[0]+'/' +benchmarks[items]): [benchmark, roles, vm_info, benchmark_details, pip] = obj.parse('./test_cases/' +args.lab.lower()+'/'+suite[0]+'/'+benchmarks[items]) - + if len(vm_info) != 0: vmObj ='' vmObj = SpawnVM(vm_info) diff --git a/func/driver.py b/func/driver.py index 7ccbb0c0..d20c0e9f 100644 --- a/func/driver.py +++ b/func/driver.py @@ -18,6 +18,7 @@ class Driver: def __init__(self): print "Class driver initialized\n" + print os.environ['PWD'] self.dic_json = defaultdict() def drive_bench(self, benchmark, roles, benchmark_detail= None, pip_dict = None): @@ -30,6 +31,7 @@ class Driver: self.dic_json['ip1']='' self.dic_json['ip2']='' self.dic_json['installer']=str(os.environ['INSTALLER_TYPE']) + self.dic_json['workingdir']=str(os.environ['PWD']) for k,v in benchmark_detail: self.dic_json[k]=v for k, v in roles: @@ -40,7 +42,7 @@ class Driver: if k == '1-server': print values, 'saving IP' self.dic_json['ip'+str(index)]= str(values) - if pip_dict[0][1][0]: + if pip_dict[0][1][0]: self.dic_json['privateip'+str(index)] = pip_dict[0][1] if not pip_dict[0][1][0]: self.dic_json['privateip'+str(index)] = 'NONE' diff --git a/func/env_setup.py b/func/env_setup.py index 5676d05b..9fd7c106 100644 --- a/func/env_setup.py +++ b/func/env_setup.py @@ -59,7 +59,7 @@ class Env_setup(): os.system(ssh_c) ssh_cmd = './data/qtip_creds.sh {0}'.format(ipvar) print ssh_cmd - res = os.system(ssh_cmd) + res = os.system(ssh_cmd) for infinity in range(100): try : ssh = paramiko.SSHClient() @@ -70,7 +70,7 @@ class Env_setup(): break except: print 'Retrying aSSH' - time.sleep(1) + time.sleep(1) if v == '': print ('SSH->>>>>', k) ssh_c = 'ssh-keyscan {0} >> ~/.ssh/known_hosts'.format(k) diff --git a/func/fetchimg.py b/func/fetchimg.py index 106dc7e8..1c621a3b 100644 --- a/func/fetchimg.py +++ b/func/fetchimg.py @@ -22,7 +22,7 @@ class FetchImg: def download(self): time.sleep(2) os.system( - 'cd ./Temp_Img && wget http://artifacts.opnfv.org/qtip/QTIP_CentOS.qcow2') + 'mkdir -p Temp_Img && wget http://artifacts.opnfv.org/qtip/QTIP_CentOS.qcow2 -P Temp_Img') filepath = './Temp_Img/QTIP_CentOS.qcow2' while not os.path.isfile(filepath): diff --git a/func/spawn_vm.py b/func/spawn_vm.py index 4723e999..9d1d0bad 100644 --- a/func/spawn_vm.py +++ b/func/spawn_vm.py @@ -43,20 +43,22 @@ class SpawnVM(Env_setup): def get_installer_type(self): print 'Getting Installer Name' return os.environ['INSTALLER_TYPE'] - + def get_public_network(self,installer_detected): - + ''' TODO: GET THE NAMES OF THE PUBLIC NETWORKS for OTHER PROJECTS - ''' + ''' print 'Getting Public Network' if installer_detected.lower() == 'fuel': return 'net04_ext' if installer_detected.lower() == 'apex': - return 'net04_ext' + return 'external' if installer_detected.lower() == 'compass': - return 'net04_ext' - + return 'ext-net' + if installer_detected.lower() == 'joid': + return 'ext-net' + def HeatTemplate_vm(self, vm_params, installer): try: Heat_Dic='' @@ -73,7 +75,7 @@ class SpawnVM(Env_setup): fopenstr = fopenstr.rstrip() scriptcmd = '#!/bin/bash \n echo {0} >> foo.txt \n echo {1} >> /root/.ssh/authorized_keys'.format( fopenstr, fopenstr) - + netName = self.get_public_network(installer) print netName Heat_Dic['heat_template_version'] = '2014-10-16' -- cgit 1.2.3-korg