From 1dd916e557d60a05dcedc0e741ab7cbb94f85c64 Mon Sep 17 00:00:00 2001 From: "zhifeng.jiang" Date: Fri, 20 May 2016 15:56:13 +0800 Subject: Read the proxy info from testcase, and set it to hosts when dhrystone benchmarks test. modification: Write the git_proxy_pbook.yaml to set git proxy info in hosts or vms. Write the sys_proxy_pbook.yaml to set yum apt wget env proxy info in hosts or vms. Change the dhrystone.yaml to include proxy and add the zte-pod1 /compute/dhrystone_bm.yaml.Tested and passed.Other playbooks did not include the proxy yet. I will test and push lately. QTIP-74 Change-Id: Ia820bc32798b9f1f6f4165a111524e04c129a5df Signed-off-by: zhifeng.jiang --- func/cli.py | 5 +++-- func/driver.py | 20 +++++++++++--------- func/env_setup.py | 9 ++++++++- 3 files changed, 22 insertions(+), 12 deletions(-) (limited to 'func') diff --git a/func/cli.py b/func/cli.py index a99e9d0f..1f3e96f2 100644 --- a/func/cli.py +++ b/func/cli.py @@ -87,7 +87,7 @@ class cli(): obj='' obj = Env_setup() if os.path.isfile('./test_cases/'+args.lab.lower()+'/'+suite[0]+'/' +benchmarks[items]): - [benchmark, roles, vm_info, benchmark_details, pip] = obj.parse('./test_cases/' + [benchmark, roles, vm_info, benchmark_details, pip, proxy_info] = obj.parse('./test_cases/' +args.lab.lower()+'/'+suite[0]+'/'+benchmarks[items]) if len(vm_info) != 0: @@ -101,7 +101,8 @@ class cli(): obj.roles_dict.items(), self._get_fname(benchmarks[items]), benchmark_details, - obj.ip_pw_dict.items()) + obj.ip_pw_dict.items(), + proxy_info) else: print (args.benchmark, ' is not a Template in the Directory - \ Enter a Valid file name. or use qtip.py -h for list') diff --git a/func/driver.py b/func/driver.py index 94fc1432..48c09c5d 100644 --- a/func/driver.py +++ b/func/driver.py @@ -21,20 +21,22 @@ class Driver: print os.environ['PWD'] self.dic_json = defaultdict() - def drive_bench(self, benchmark, roles, benchmark_fname, benchmark_detail = None, pip_dict = None): - + def drive_bench(self, benchmark, roles, benchmark_fname, benchmark_detail = None, pip_dict = None, proxy_info = None): roles= sorted(roles) pip_dict = sorted(pip_dict) result_dir = 'results' benchmark_name = benchmark + '.yaml' self.dic_json['Dest_dir'] = str(result_dir) - 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']) - self.dic_json['fname']=str(benchmark_fname) - self.dic_json['username']= str('root') - + 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']) + self.dic_json['fname'] = str(benchmark_fname) + self.dic_json['username'] = str('root') + + for key in proxy_info.keys(): + self.dic_json[key] = proxy_info[key] + if os.environ['INSTALLER_TYPE'] == str('joid'): self.dic_json['username']=str('ubuntu') if os.environ['INSTALLER_TYPE'] == str('apex'): diff --git a/func/env_setup.py b/func/env_setup.py index 9fd7c106..487d7af3 100644 --- a/func/env_setup.py +++ b/func/env_setup.py @@ -31,6 +31,7 @@ class Env_setup(): self.roles_dict.clear() self.ip_pw_dict.clear() self.ip_pip_list[:] = [] + self.proxy_info = {} self.vm_parameters.clear() self.benchmark_details.clear() self.benchmark = '' @@ -141,6 +142,10 @@ class Env_setup(): self.GetHostMachineinfo(doc['Context']['Host_Machines']) if doc.get('Scenario',{}).get('benchmark_details',{}): self.GetBenchmarkDetails(doc.get('Scenario',{}).get('benchmark_details',{})) + if 'Proxy_Environment' in doc['Context'].keys(): + self.proxy_info['http_proxy'] = doc['Context']['Proxy_Environment']['http_proxy'] + self.proxy_info['https_proxy'] = doc['Context']['Proxy_Environment']['https_proxy'] + self.proxy_info['no_proxy'] = doc['Context']['Proxy_Environment']['no_proxy'] for k, v in self.roles_ip_list: self.roles_dict[k].append(v) for k, v in self.ip_pw_list: @@ -150,7 +155,9 @@ class Env_setup(): self.roles_dict.items(), self.vm_parameters, self.benchmark_details.items(), - self.ip_pw_dict.items()) + self.ip_pw_dict.items(), + self.proxy_info) + except KeyboardInterrupt: fname.close() print 'ConfigFile Closed: exiting!' -- cgit 1.2.3-korg