aboutsummaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorMofassir Arif <Mofassir_arif@dellteam.com>2015-12-22 04:17:57 -0800
committerMofassir Arif <Mofassir_arif@dellteam.com>2015-12-22 04:17:57 -0800
commit39342467e5e647ae605f40bed04c5a3b3bc50f5e (patch)
tree9c7b73c5e32a816c83db93bbac6aa3af80e7f9fa /func
parent4b3e9b6cf97296dd591dc2cf95ead96ee60075f5 (diff)
Restructured QTIP directories and CLI
I have changed the arguments for the CLI and now QTIP takes a file along withthe name of the lab to run on Right now only the config files for the dell lab have been added, These will increase when we make QTIP available for other labs. I have also added the provision of changing the public network from the config file and some leftover files from previous verisons have been remove Change-Id: Ifeb01d80099eab06dc77a7b2e07097ebb17a13a2 Signed-off-by: Mofassir Arif <Mofassir_arif@dellteam.com>
Diffstat (limited to 'func')
-rw-r--r--func/cli.py75
-rw-r--r--func/env_setup.py8
-rw-r--r--func/spawn_vm.py18
3 files changed, 59 insertions, 42 deletions
diff --git a/func/cli.py b/func/cli.py
index 83a7c36f..87b205a0 100644
--- a/func/cli.py
+++ b/func/cli.py
@@ -16,41 +16,50 @@ import argparse
class cli():
-
+
+ def _getfile(self, filepath):
+ with open('test_list/'+filepath,'r') as finput:
+ _benchmarks=finput.readlines()
+ for items in range( len(_benchmarks)):
+ _benchmarks[items]=_benchmarks[items].rstrip()
+ return _benchmarks
+ def _getsuite(self, filepath):
+ for suites in range (len(filepath)):
+ xindex= filepath[suites].find('.')
+ filepath[suites]=filepath[suites][0:xindex]
+ return filepath
def __init__(self):
-
+ suite=[]
parser = argparse.ArgumentParser()
-
- parser.add_argument('-s ', '--suite', help='compute network storage ')
- parser.add_argument('-b', '--benchmark',
- help='''COMPUTE:
- dhrystone_serial.yaml \n
- dhrystone_paralle.yaml \n
- whetstone_serial.yaml \n
- whetstone_parllel.yaml \n
- dpi_serial.yaml \n
- dpi_paralle.yaml \n
- ssl_serial.yaml \n
- ssl_parallel.yaml ''')
+ parser.add_argument('-l ', '--lab', help='Name of Lab on which being tested ')
+ parser.add_argument('-f', '--file', help = 'File in test_list with the list ' \
+ 'of tests')
args = parser.parse_args()
- if not (args.suite or args.benchmark):
- parser.error('Not enough arguments, -h, --help ')
- sys.exit(0)
- if (args.suite and args.benchmark):
- obj = Env_setup()
- if os.path.isfile('./test_cases/' + args.suite +
- '/' + args.benchmark):
+ benchmarks = self._getfile(args.file)
+ suite.append(args.file)
+ suite=self._getsuite(suite)
+ for items in range (len(benchmarks)):
+ if (suite and benchmarks):
- [benchmark, roles, vm_info, benchmark_details, pip] = obj.parse('./test_cases/' + args.suite
- + '/' + args.benchmark)
+ roles=''
+ vm_info=''
+ benchmark_details=''
+ pip=''
+ 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/'
+ +args.lab.lower()+'/'+suite[0]+'/'+benchmarks[items])
- if len(vm_info) != 0:
- vmObj = SpawnVM(vm_info)
- obj.callpingtest()
- obj.callsshtest()
- obj.updateAnsible()
- dvr = Driver()
- dvr.drive_bench(benchmark, obj.roles_dict.items(), benchmark_details, obj.ip_pw_dict.items())
- else:
- print (args.benchmark, ' is not a Template in the Directory - \
- Enter a Valid file name. or use qtip.py -h for list')
+ if len(vm_info) != 0:
+ vmObj =''
+ vmObj = SpawnVM(vm_info)
+ obj.callpingtest()
+ obj.callsshtest()
+ obj.updateAnsible()
+ dvr = Driver()
+ dvr.drive_bench(benchmark, obj.roles_dict.items(), benchmark_details, obj.ip_pw_dict.items())
+ else:
+ print (args.benchmark, ' is not a Template in the Directory - \
+ Enter a Valid file name. or use qtip.py -h for list')
+ \ No newline at end of file
diff --git a/func/env_setup.py b/func/env_setup.py
index 8abf9da2..a888046c 100644
--- a/func/env_setup.py
+++ b/func/env_setup.py
@@ -26,6 +26,14 @@ class Env_setup():
def __init__(self):
print '\nParsing class initiated\n'
+ self.roles_ip_list[:]=[]
+ self.ip_pw_list[:] = []
+ self.roles_dict.clear()
+ self.ip_pw_dict.clear()
+ self.ip_pip_list[:] = []
+ self.vm_parameters.clear()
+ self.benchmark_details.clear()
+ self.benchmark = ''
def writeTofile(self, role):
fname2 = open('./data/hosts', 'w')
diff --git a/func/spawn_vm.py b/func/spawn_vm.py
index e7947008..39587b34 100644
--- a/func/spawn_vm.py
+++ b/func/spawn_vm.py
@@ -26,8 +26,6 @@ class SpawnVM(Env_setup):
def __init__(self, vm_info):
print 'SpawnVM Class initiated'
-
- # def setupVM(self,vm_info):
vm_role_ip_dict = vm_info.copy()
print 'Generating Heat Template\n'
self._keystone_client = None
@@ -37,12 +35,12 @@ class SpawnVM(Env_setup):
nova =self. _get_nova_client()
azoneobj = create_zones()
azoneobj.create_agg(vm_info['availability_zone'])
-
self.Heat_template1 = self.HeatTemplate_vm(vm_info)
self.create_stack(vm_role_ip_dict, self.Heat_template1)
def HeatTemplate_vm(self, vm_params):
try:
+ Heat_Dic=''
with open('./heat/SampleHeat.yaml', 'r+') as H_temp:
Heat_Dic = yaml.load(H_temp)
except yaml.YAMLError as exc:
@@ -51,7 +49,6 @@ class SpawnVM(Env_setup):
print 'Error in qtip/heat/SampleHeat.yaml at: (%s,%s)' % (mark.line + 1, mark.column + 1)
print 'EXITING PROGRAM. Correct File and restart'
sys.exit(0)
- #fopen = open('/root/.ssh/id_rsa.pub', 'r')
fopen = open('./data/QtipKey.pub', 'r')
fopenstr = fopen.read()
fopenstr = fopenstr.rstrip()
@@ -66,6 +63,10 @@ class SpawnVM(Env_setup):
'name': 'my_key'
}
}
+ Heat_Dic['parameters']['public_network'] = {
+ 'type': 'string',
+ 'default': vm_params['public_network'][0]
+ }
for x in range(1, len(vm_params['availability_zone']) + 1):
avail_zone = vm_params['availability_zone'][x - 1]
img = vm_params['OS_image'][x - 1]
@@ -215,11 +216,10 @@ class SpawnVM(Env_setup):
print '\nStack Creating Started\n'
- # try:
- heat.stacks.create(stack_name=stackname, template=Heat_template)
-
- #except:
- #print 'Create Failed :( '
+ try:
+ heat.stacks.create(stack_name=stackname, template=Heat_template)
+ except:
+ print 'Create Failed :( '
cluster_detail = heat.stacks.get(stackname)
while(cluster_detail.status != 'COMPLETE'):