diff options
author | Mofassir Arif <mofassir@gmail.com> | 2015-12-09 04:50:55 -0800 |
---|---|---|
committer | Mofassir Arif <Mofassir_arif@dellteam.com> | 2015-12-16 01:45:38 -0800 |
commit | e51df601fe4a1bd22274e3da62659b1ed7b2c49b (patch) | |
tree | 66abbe6ea11fec7e027fab4481ae1cd9e44f054f /func/driver.py | |
parent | ae9f53f8f00342627f6d0124e53a285438c1ca4e (diff) |
Networking Testcase: Iperf Implemented
The ansible playbooks as well as the config files
for the iperf throughput testing have been implemented.
Some changes have been made to the driver function for
the benchmarks. ansible now gets passed a json file.
Change-Id: Ibf4c0210ab9f6cbf9896ca69bf2fb6bda8a9925d
Signed-off-by: Mofassir Arif <mofassir@gmail.com>
Diffstat (limited to 'func/driver.py')
-rw-r--r-- | func/driver.py | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/func/driver.py b/func/driver.py index 45ec3fa2..83e64a80 100644 --- a/func/driver.py +++ b/func/driver.py @@ -10,20 +10,41 @@ import os - +import json +from collections import defaultdict class Driver: def __init__(self): + print "Class driver initialized\n" + self.dic_json = defaultdict() - def drive_bench(self, benchmark, roles): - result_dir = '$PWD/results' + def drive_bench(self, benchmark, roles, benchmark_detail= None, pip_dict = None): + roles= sorted(roles) + pip_dict = sorted(pip_dict) + result_dir = 'results' benchmark_name = benchmark + '.yaml' - print roles + self.dic_json['Dest_dir'] = str(result_dir) + self.dic_json['ip1']='' + self.dic_json['ip2']='' + + for k,v in benchmark_detail: + self.dic_json[k]=v for k, v in roles: - print k - run_play = 'ansible-playbook -s $PWD/benchmarks/playbooks/{0} --extra-vars "Dest_dir={1} role={2}" -vvv'.format( - benchmark_name, result_dir, k) - + self.dic_json['role']=k + index=1 + if benchmark_detail != None: + for values in v: + if k == '1-server': + print values, 'saving IP' + self.dic_json['ip'+str(index)]= str(values) + self.dic_json['privateip'+str(index)] = pip_dict[0][1] + index= index+1 + dic_json = json.dumps(dict(self.dic_json.items())) + print dic_json + run_play = 'ansible-playbook -s ./benchmarks/playbooks/{0} --extra-vars \'{1}\' -vvv'.format(benchmark_name, dic_json) +# run_play = 'ansible-playbook -s $PWD/benchmarks/playbooks/{0} --extra-vars "Dest_dir={1} role={2}" -vvv'.format( +# benchmark_name, result_dir, k) status = os.system(run_play) + |