Commit 28e37684 authored by hardy's avatar hardy

adding runtime stats to console and HTML when Terminate_UE

parent eddf218d
...@@ -43,6 +43,7 @@ class CotsUe: ...@@ -43,6 +43,7 @@ class CotsUe:
self.ADBUserName = ADBUserName self.ADBUserName = ADBUserName
self.ADBPassWord = ADBPassWord self.ADBPassWord = ADBPassWord
self.cots_run_mode = '' #on of off to toggle airplane mode on/off self.cots_run_mode = '' #on of off to toggle airplane mode on/off
self.__cots_cde_dict_file = 'cots_ue_ctl.yaml'
self.__SetAirplaneRetry = 3 self.__SetAirplaneRetry = 3
#-----------------$ #-----------------$
...@@ -59,7 +60,7 @@ class CotsUe: ...@@ -59,7 +60,7 @@ class CotsUe:
def Set_Airplane(self, target_id, target_state_str): def Set_Airplane(self, target_id, target_state_str):
#load cots commands dictionary #load cots commands dictionary
with open('cots_ue_ctl.yaml','r') as file: with open(self.__cots_cde_dict_file,'r') as file:
cots_ue_ctl = yaml.load(file,Loader=yaml.FullLoader) cots_ue_ctl = yaml.load(file,Loader=yaml.FullLoader)
if target_id in cots_ue_ctl: if target_id in cots_ue_ctl:
mySSH = sshconnection.SSHConnection() mySSH = sshconnection.SSHConnection()
...@@ -89,7 +90,8 @@ class CotsUe: ...@@ -89,7 +90,8 @@ class CotsUe:
mySSH.command('sudo adb kill-server','$',5) mySSH.command('sudo adb kill-server','$',5)
mySSH.close() mySSH.close()
else: else:
logging.error("COTS UE Id from XML could not be found in UE YAML dictionary cots_ue_ctl.yaml) logging.error("COTS UE Id from XML could not be found in UE YAML dictionary " + self.__cots_cde_dict_file)
sys.exit("COTS UE Id from XML could not be found in UE YAML dictionary " + self.__cots_cde_dict_file)
......
...@@ -90,6 +90,7 @@ class RANManagement(): ...@@ -90,6 +90,7 @@ class RANManagement():
self.epcPcapFile = '' self.epcPcapFile = ''
self.htmlObj = None self.htmlObj = None
self.epcObj = None self.epcObj = None
self.runtime_stats= ''
...@@ -614,7 +615,7 @@ class RANManagement(): ...@@ -614,7 +615,7 @@ class RANManagement():
logging.debug('\u001B[1m Analyzing eNB replay logfile \u001B[0m') logging.debug('\u001B[1m Analyzing eNB replay logfile \u001B[0m')
logStatus = self.AnalyzeLogFile_eNB(extracted_log_file) logStatus = self.AnalyzeLogFile_eNB(extracted_log_file)
if self.htmlObj is not None: if self.htmlObj is not None:
self.htmlObj.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) self.htmlObj.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
self.eNBLogFiles[int(self.eNB_instance)] = '' self.eNBLogFiles[int(self.eNB_instance)] = ''
else: else:
analyzeFile = False analyzeFile = False
...@@ -643,10 +644,10 @@ class RANManagement(): ...@@ -643,10 +644,10 @@ class RANManagement():
return return
else: else:
if self.htmlObj is not None: if self.htmlObj is not None:
self.htmlObj.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) self.htmlObj.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
else: else:
if self.htmlObj is not None: if self.htmlObj is not None:
self.htmlObj.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) self.htmlObj.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
self.eNBmbmsEnables[int(self.eNB_instance)] = False self.eNBmbmsEnables[int(self.eNB_instance)] = False
self.eNBstatuses[int(self.eNB_instance)] = -1 self.eNBstatuses[int(self.eNB_instance)] = -1
...@@ -712,16 +713,20 @@ class RANManagement(): ...@@ -712,16 +713,20 @@ class RANManagement():
if runTime != '': if runTime != '':
result = re.search('Time executing user inst', str(line)) result = re.search('Time executing user inst', str(line))
if result is not None: if result is not None:
userTime = 'to be decoded - 1' fields=line.split(':')
userTime = 'userTime : ' + fields[1].replace('\n','')
result = re.search('Time executing system inst', str(line)) result = re.search('Time executing system inst', str(line))
if result is not None: if result is not None:
systemTime = 'to be decoded - 2' fields=line.split(':')
systemTime = 'systemTime : ' + fields[1].replace('\n','')
result = re.search('Max. Phy. memory usage:', str(line)) result = re.search('Max. Phy. memory usage:', str(line))
if result is not None: if result is not None:
maxPhyMemUsage = 'to be decoded - 3' fields=line.split(':')
maxPhyMemUsage = 'maxPhyMemUsage : ' + fields[1].replace('\n','')
result = re.search('Number of context switch.*process origin', str(line)) result = re.search('Number of context switch.*process origin', str(line))
if result is not None: if result is not None:
nbContextSwitches = 'to be decoded - 4' fields=line.split(':')
nbContextSwitches = 'nbContextSwitches : ' + fields[1].replace('\n','')
if X2HO_state == CONST.X2_HO_REQ_STATE__IDLE: if X2HO_state == CONST.X2_HO_REQ_STATE__IDLE:
result = re.search('target eNB Receives X2 HO Req X2AP_HANDOVER_REQ', str(line)) result = re.search('target eNB Receives X2 HO Req X2AP_HANDOVER_REQ', str(line))
if result is not None: if result is not None:
...@@ -978,11 +983,12 @@ class RANManagement(): ...@@ -978,11 +983,12 @@ class RANManagement():
global_status = CONST.ENB_PROCESS_REALTIME_ISSUE global_status = CONST.ENB_PROCESS_REALTIME_ISSUE
if self.htmlObj is not None: if self.htmlObj is not None:
self.htmlObj.htmleNBFailureMsg=htmleNBFailureMsg self.htmlObj.htmleNBFailureMsg=htmleNBFailureMsg
# Runtime statistics # Runtime statistics for console output and HTML
if runTime != '': if runTime != '':
logging.debug(runTime) logging.debug(runTime)
logging.debug('Time executing user inst : ' + userTime) logging.debug(userTime)
logging.debug('Time executing system inst : ' + systemTime) logging.debug(systemTime)
logging.debug('Max Physical Memory Usage : ' + maxPhyMemUsage) logging.debug(maxPhyMemUsage)
logging.debug('Nb Context Switches : ' + nbContextSwitches) logging.debug(nbContextSwitches)
self.runtime_stats=runTime + '\n' + userTime + '\n' + systemTime + '\n' + maxPhyMemUsage + '\n' + nbContextSwitches
return global_status return global_status
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment