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/env_setup.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/env_setup.py')
-rw-r--r-- | func/env_setup.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/func/env_setup.py b/func/env_setup.py index 919df176..1db54564 100644 --- a/func/env_setup.py +++ b/func/env_setup.py @@ -7,10 +7,6 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## - - - - import os import sys from collections import defaultdict @@ -23,12 +19,13 @@ class Env_setup(): ip_pw_list = [] # IP and password, this will be used to ssh roles_dict = defaultdict(list) ip_pw_dict = defaultdict(list) + ip_pip_list = [] vm_parameters = defaultdict(list) + benchmark_details= defaultdict() benchmark = '' def __init__(self): print '\nParsing class initiated\n' -# obj1 = SpawnVM() def writeTofile(self, role): fname2 = open('/etc/ansible/hosts', 'w') @@ -113,12 +110,17 @@ class Env_setup(): def GetVirtualMachineinfo(self, Virtualtag): num = len(Virtualtag) - for x in range(num): hostlabel = 'virtualmachine_' + str(x + 1) for k, v in Virtualtag[hostlabel].iteritems(): self.vm_parameters[k].append(v) + def GetBenchmarkDetails(self, detail_dic): + + print detail_dic + for k,v in detail_dic.items(): + self.benchmark_details[k]= v + def parse(self, configfilepath): try: fname = open(configfilepath, 'r+') @@ -131,12 +133,9 @@ class Env_setup(): self.GetVirtualMachineinfo(doc['Context']['Virtual_Machines']) if doc['Context']['Host_Machines']: self.GetHostMachineinfo(doc['Context']['Host_Machines']) - - # num = len(doc['Context']['Vir_Machines']) - # for x in range(num): - # lab = 'host_machine'+ str(x+1) - # self.roles_ip_list.insert(x,(doc[lab]['role'],doc[lab]['ip'])) - # self.ip_pw_list.insert(x,(doc[lab]['ip'],doc[lab]['pw'])) + if doc.get('Scenario',{}).get('benchmark_details',{}): + self.GetBenchmarkDetails(doc.get('Scenario',{}).get('benchmark_details',{})) + for k, v in self.roles_ip_list: self.roles_dict[k].append(v) for k, v in self.ip_pw_list: @@ -144,7 +143,9 @@ class Env_setup(): return ( self.benchmark, self.roles_dict.items(), - self.vm_parameters) + self.vm_parameters, + self.benchmark_details.items(), + self.ip_pw_dict.items()) except KeyboardInterrupt: fname.close() print 'ConfigFile Closed: exiting!' |