diff options
author | Nauman Ahad <Nauman_Ahad@dell.com> | 2015-12-16 10:14:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-12-16 10:14:01 +0000 |
commit | ae3870b6863604d39bd15b0212bcf2694076a034 (patch) | |
tree | 66abbe6ea11fec7e027fab4481ae1cd9e44f054f /func/env_setup.py | |
parent | 9f1f266140b86d3e42f2c217b4f0ce263c3e3b07 (diff) | |
parent | e51df601fe4a1bd22274e3da62659b1ed7b2c49b (diff) |
Merge "Networking Testcase: Iperf Implemented"
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!' |