diff options
-rw-r--r-- | benchmarks/playbooks/dhrystone.yaml | 3 | ||||
-rw-r--r-- | benchmarks/playbooks/git_proxy_pbook.yaml | 12 | ||||
-rw-r--r-- | benchmarks/playbooks/sys_proxy_pbook.yaml | 53 | ||||
-rw-r--r-- | func/cli.py | 5 | ||||
-rw-r--r-- | func/driver.py | 20 | ||||
-rw-r--r-- | func/env_setup.py | 9 | ||||
-rw-r--r-- | test_cases/zte-pod1/compute/dhrystone_bm.yaml | 38 |
7 files changed, 128 insertions, 12 deletions
diff --git a/benchmarks/playbooks/dhrystone.yaml b/benchmarks/playbooks/dhrystone.yaml index 3ea04382..eb46ad08 100644 --- a/benchmarks/playbooks/dhrystone.yaml +++ b/benchmarks/playbooks/dhrystone.yaml @@ -26,6 +26,7 @@ - include: ./sys_info_pbook.yaml vars: network: false + - include: ./sys_proxy_pbook.yaml - name: Installing UnixBench dependencies if CentOS shell: sudo yum install git gcc patch perl-Time-HiRes -y @@ -35,6 +36,8 @@ shell: sudo apt-get install git gcc patch perl -y when: ansible_os_family == "Debian" + - include: ./git_proxy_pbook.yaml + - name: Clone unixbench shell: git clone https://github.com/kdlucas/byte-unixbench.git $HOME/tempT diff --git a/benchmarks/playbooks/git_proxy_pbook.yaml b/benchmarks/playbooks/git_proxy_pbook.yaml new file mode 100644 index 00000000..6d155a76 --- /dev/null +++ b/benchmarks/playbooks/git_proxy_pbook.yaml @@ -0,0 +1,12 @@ + +#git +- name: set git proxy(http) + shell: "git config --global http.proxy {{ http_proxy }}" + when: http_proxy is defined + ignore_errors: yes + +- name: set git proxy(https) + shell: "git config --global https.proxy {{https_proxy}}" + when: https_proxy is defined + ignore_errors: yes + diff --git a/benchmarks/playbooks/sys_proxy_pbook.yaml b/benchmarks/playbooks/sys_proxy_pbook.yaml new file mode 100644 index 00000000..bf4a8ccb --- /dev/null +++ b/benchmarks/playbooks/sys_proxy_pbook.yaml @@ -0,0 +1,53 @@ +#env +- name: insert shell proxy http + lineinfile: dest=/etc/profile.d/proxy.sh state=present create=yes owner=root group=root mode=0644 regexp="export http_proxy={{ http_proxy }}" + insertafter=EOF line="export http_proxy={{ http_proxy }}" + when: http_proxy is defined + ignore_errors: yes + +- name: insert shell proxy https + lineinfile: dest=/etc/profile.d/proxy.sh state=present create=yes owner=root group=root mode=0644 regexp="export https_proxy={{ https_proxy }}" + insertafter=EOF line="export https_proxy={{ https_proxy }}" + when: https_proxy is defined + ignore_errors: yes + +- name: insert no proxy + lineinfile: dest=/etc/profile.d/proxy.sh state=present create=yes owner=root group=root mode=0644 regexp="{{ no_proxy }}" + insertafter=EOF line="export no_proxy={{ no_proxy }}" + when: no_proxy is defined + ignore_errors: yes + +#wget +- name: insert wget proxy(http) + lineinfile: dest=/etc/wgetrc state=present regexp="http_proxy={{ http_proxy }}" + insertafter="^#http_proxy" line="http_proxy={{ http_proxy }}" + when: http_proxy is defined + ignore_errors: yes + +- name: insert wget proxy(https) + lineinfile: dest=/etc/wgetrc state=present regexp="https_proxy={{ https_proxy }}" + insertafter="^#https_proxy" line="https_proxy={{ https_proxy }}" + when: https_proxy is defined + ignore_errors: yes + +#yum +- name: insert yum proxy(http) + lineinfile: dest=/etc/yum.conf state=present regexp="proxy={{ http_proxy }}" + insertafter=EOF line="proxy={{ http_proxy }}" + when: ansible_os_family == "RedHat" and http_proxy is defined + ignore_errors: yes + +#apt + +- name: insert apt proxy(http) + lineinfile: dest=/etc/apt/apt.conf state=present create=yes regexp="Acquire::http::Proxy \"{{ http_proxy }}\";" + insertafter=EOF line="Acquire::http::Proxy \"{{ http_proxy }}\";" + when: ansible_os_family == "Debian" and http_proxy is defined + ignore_errors: yes + +- name: insert apt proxy(https) + lineinfile: dest=/etc/apt/apt.conf state=present create=yes regexp="Acquire::https::Proxy \"{{ https_proxy }}\";" + insertafter=EOF line="Acquire::https::Proxy \"{{ https_proxy }}\";" + when: ansible_os_family == "Debian" and https_proxy is defined + ignore_errors: yes + diff --git a/func/cli.py b/func/cli.py index 03a5cc69..76e0e19a 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 (benchmarks[items], ' 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!' diff --git a/test_cases/zte-pod1/compute/dhrystone_bm.yaml b/test_cases/zte-pod1/compute/dhrystone_bm.yaml new file mode 100644 index 00000000..2835ba8c --- /dev/null +++ b/test_cases/zte-pod1/compute/dhrystone_bm.yaml @@ -0,0 +1,38 @@ + +Scenario: + benchmark: dhrystone + host: machine_1, machine_2 + server: + +Context: + Host_Machines: + machine_1: + ip: 10.20.0.24 + pw: + role: host + machine_2: + ip: 10.20.0.25 + pw: + role: host + + Virtual_Machines: + + Proxy_Environment: + http_proxy: http://10.20.0.1:8118 + https_proxy: http://10.20.0.1:8118 + no_proxy: localhost,127.0.0.1,10.20.*,192.168.* + + +Test_Description: + Test_category: "Compute" + Benchmark: "dhrystone" + Overview: > + ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n + if you wish to add a virtual machine add the following information under the Virtual_Machine tag + + virtualmachine_1: + availability_zone: + public_network: + OS_image: + flavor: + role: ''' |