autotest_analyser.py 4.62 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
#! /usr/bin/python
#******************************************************************************
#
# \file		autotest_analyser.py
#
# \par     Informations
#            - \b Project  : UED Autotest Framework
#            - \b Software : 
#
# \date		16 september 2016
#
# \version	0.1
#
# \brief	helper to test lib_autotest_analyser.py
#
# \author	Benoit ROBERT (benoit.robert@syrtem.com)
#
# \par		Statement of Ownership
#           COPYRIGHT (c) 2016  BY SYRTEM S.A.R.L
#           This software is furnished under license and may be used and copied 
#			only in accordance with the terms of such license and with the inclusion
#			of the above COPYRIGHT notice. This SOFTWARE or any other copies thereof
#			may not be provided or otherwise made available to any other person. 
#			No title to and ownership of the SOFTWARE is hereby transferred.
#
#			The information in this SOFTWARE is subject to change without notice 
#			and should not be constructed as a commitment by SYRTEM.
#           SYRTEM assumes no responsibility for the use or reliability of its 
#			SOFTWARE on equipment or platform not explicitly validated by SYRTEM.
#
# *******************************************************************************

import os
import getopt
import sys
from subprocess import call



#test_cases = ('030001', '030901', '031001', '031601', '031701', '031801', '031901', '032001', '032101', '032201', '032301', '032501', '032601', '032801')
test_cases = ('030030' , '030030' ) 

nb_run = 3

def error_opt(msg):
    print("Option error: " + msg)


def main(args):
	try:
		analyser = __import__("lib_autotest_analyser")
	except ImportError as err:
		print('Import error: ' + str(err))
		exit(0)


	log_path = 'log_save_2016-08-14/log/'



	metric = {}
	metric['id'] 			= 'UE_DLSCH_BITRATE'
	metric['description'] 	= 'UE downlink physical throughput'	
	metric['regex'] 		= '(UE_DLSCH_BITRATE) =\s+(\d+\.\d+) kbps.+frame = (\d+)\)'
	metric['unit_of_meas']	= 'kbps'
	metric['min_limit']		= 14668.8


#report_path = log_path+'/report/'

#os.system(' mkdir -p ' + report_path)

#analyser.create_report_html(report_path)

#return(0)

	for test_case in test_cases:

#		print test_case
		if test_case == '030001':
			metric['min_limit']		= 500.0
		if test_case == '030901':
			metric['min_limit']		= 640.0
		if test_case == '031001':
			metric['min_limit']		= 3200.0
		if test_case == '031601':
			metric['min_limit']		= 5920.0
		if test_case == '031701':
			metric['min_limit']		= 6000.0
		if test_case == '031801':
			metric['min_limit']		= 6200.0
		if test_case == '031901':
			metric['min_limit']		= 7000.0
		if test_case == '032001':
			metric['min_limit']		= 7800.0
		if test_case == '032101':
			metric['min_limit']		= 8000.0
		if test_case == '032201':
			metric['min_limit']		= 9000.0
		if test_case == '032301':
			metric['min_limit']		= 10000.0
		if test_case == '032501':
			metric['min_limit']		= 11000.0
		if test_case == '032601':
			metric['min_limit']		= 12000.0
		if test_case == '032801':
			metric['min_limit']		= 12500.0

		if test_case == '035201':
			metric['min_limit']		= 14668.8
		if test_case == '036001':
			metric['min_limit']		= 25363.2



		for i in range(0, nb_run):
			fname = 'log//'+test_case+'/run_'+str(i)+'/UE_exec_'+str(i)+'_.log'
			args = {'metric' : metric,
					'file' : fname }

			cell_synch_status = analyser.check_cell_synchro(fname)
			if cell_synch_status == 'CELL_SYNCH':
			  print '!!!!!!!!!!!!!!  Cell synchronized !!!!!!!!!!!'
			  metric_checks_flag = 0
			else :
			  print '!!!!!!!!!!!!!!  Cell NOT  NOT synchronized !!!!!!!!!!!'
	
#			metric_extracted = analyser.do_extract_metrics(args)

#			print "min       = "+ str( metric_extracted['metric_min'] )
#			print "min_index = "+ str( metric_extracted['metric_min_index'] )
#			print "max       = "+ str( metric_extracted['metric_max'] )
#			print "max_index = "+ str( metric_extracted['metric_max_index'] )
#			print "mean      = "+ str( metric_extracted['metric_mean'] )
#			print "median    = "+ str( metric_extracted['metric_median'] )			

#			verdict = analyser.do_check_verdict(metric, metric_extracted)
#			print verdict

#			fname= 'report/2016-9-8_toto/'+test_case+'/UE_metric_UE_DLSCH_BITRATE_'+str(i)+'_.png'
#			fname= 'report/UE_metric_UE_DLSCH_BITRATE_'+test_case+'_'+str(i)+'.png'
			
#			print fname
#			analyser.do_img_metrics(metric, metric_extracted, fname)

#			fname = 'log//'+test_case+'/run_'+str(i)+'/UE_traffic_'+str(i)+'_.log'
			
#			args = {'file' : fname }

#			traffic_metrics = analyser.do_extract_traffic_metrics(args)

#			fname= 'report/iperf_'+test_case+'_'+str(i)+'.png'
			
#			print fname
#			analyser.do_img_traffic(traffic_metrics, fname)



if __name__ == "__main__":
    main(sys.argv)