Commit 5759a240 authored by Robert Schmidt's avatar Robert Schmidt

Improve code for retx checkers

parent 0d66711f
...@@ -748,6 +748,25 @@ class RANManagement(): ...@@ -748,6 +748,25 @@ class RANManagement():
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log *monitor.pickle *monitor*.png ping*.log* iperf*.log log/*/*.log log/*/*.pcap', '\$', 15) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log *monitor.pickle *monitor*.png ping*.log* iperf*.log log/*/*.log log/*/*.pcap', '\$', 15)
mySSH.close() mySSH.close()
def _analyzeUeRetx(self, rounds, checkers, regex):
if len(rounds) == 0 or len(checkers) == 0:
logging.warning(f'warning: rounds={rounds} checkers={checkers}')
return []
perc = list(0 for i in checkers) # results in %
stats = list(False for i in checkers) # status if succeeded
tmp = re.match(regex, rounds)
if tmp is None:
logging.error('_analyzeUeRetx: did not match regex for DL retx analysis')
return stats
retx_data = [float(x) for x in tmp.groups()]
for i in range(0, len(perc)):
#case where numerator > denumerator with denum ==0 is disregarded, cannot hapen in principle, will lead to 0%
perc[i] = 0 if (retx_data[i] == 0) else 100 * retx_data[i + 1] / retx_data[i]
#treating % > 100 , % > requirement
stats[i] = perc[i] < 100 and perc[i] <= checkers[i]
return stats
def AnalyzeLogFile_eNB(self, eNBlogFile, HTML, checkers={}): def AnalyzeLogFile_eNB(self, eNBlogFile, HTML, checkers={}):
if (not os.path.isfile('./' + eNBlogFile)): if (not os.path.isfile('./' + eNBlogFile)):
return -1 return -1
...@@ -809,8 +828,7 @@ class RANManagement(): ...@@ -809,8 +828,7 @@ class RANManagement():
gnb_markers ={'SgNBReleaseRequestAcknowledge': [],'FAILURE': [], 'scgFailureInformationNR-r15': [], 'SgNBReleaseRequest': [], 'Detected UL Failure on PUSCH':[]} gnb_markers ={'SgNBReleaseRequestAcknowledge': [],'FAILURE': [], 'scgFailureInformationNR-r15': [], 'SgNBReleaseRequest': [], 'Detected UL Failure on PUSCH':[]}
nodeB_prefix_found = False nodeB_prefix_found = False
RealTimeProcessingIssue = False RealTimeProcessingIssue = False
DLRetxIssue = False retx_status = {}
ULRetxIssue = False
nrRrcRcfgComplete = 0 nrRrcRcfgComplete = 0
harqFeedbackPast = 0 harqFeedbackPast = 0
showedByeMsg = False # last line is Bye. -> stopped properly showedByeMsg = False # last line is Bye. -> stopped properly
...@@ -993,7 +1011,8 @@ class RANManagement(): ...@@ -993,7 +1011,8 @@ class RANManagement():
rnti = result.group(1) rnti = result.group(1)
#remove 1- all useless char before relevant info (ulsch or dlsch) 2- trailing char #remove 1- all useless char before relevant info (ulsch or dlsch) 2- trailing char
dlsch_ulsch_stats[rnti+k]=re.sub(r'^.*\]\s+', r'' , line.rstrip()) if not rnti in dlsch_ulsch_stats: dlsch_ulsch_stats[rnti] = {}
dlsch_ulsch_stats[rnti][k]=re.sub(r'^.*\]\s+', r'' , line.rstrip())
result = re.search('Received NR_RRCReconfigurationComplete from UE', str(line)) result = re.search('Received NR_RRCReconfigurationComplete from UE', str(line))
if result is not None: if result is not None:
...@@ -1139,51 +1158,20 @@ class RANManagement(): ...@@ -1139,51 +1158,20 @@ class RANManagement():
htmleNBFailureMsg += htmlMsg htmleNBFailureMsg += htmlMsg
#ulsch and dlsch statistics and checkers #ulsch and dlsch statistics and checkers
for ue in dlsch_ulsch_stats:
dlulstat = dlsch_ulsch_stats[ue]
#print statistics into html #print statistics into html
if len(dlsch_ulsch_stats)!=0: #check if dictionary is not empty
#for each dictionary key, generate the msg for html as information
statMsg='' statMsg=''
for key in dlsch_ulsch_stats: for key in dlulstat:
statMsg += dlsch_ulsch_stats[key] + '\n' statMsg += dlulstat[key] + '\n'
logging.debug(dlsch_ulsch_stats[key]) logging.debug(dlulstat[key])
htmleNBFailureMsg += statMsg htmleNBFailureMsg += statMsg
#checker retx_status[ue] = {}
if (len(dlsch_ulsch_stats)!=0) and (len(checkers)!=0): dlcheckers = [] if 'd_retx_th' not in checkers else checkers['d_retx_th']
if 'd_retx_th' in checkers: retx_status[ue]['dl'] = self._analyzeUeRetx(dlulstat['dlsch_rounds'], dlcheckers, r'^.*dlsch_rounds\s+(\d+)\/(\d+)\/(\d+)\/(\d+),\s+dlsch_errors\s+(\d+)')
dlsch_checker_status = list(0 for i in checkers['d_retx_th'])#status 0 / -1 ulcheckers = [] if 'u_retx_th' not in checkers else checkers['u_retx_th']
d_perc_retx = list(0 for i in checkers['d_retx_th'])#results in % retx_status[ue]['ul'] = self._analyzeUeRetx(dlulstat['ulsch_rounds'], ulcheckers, r'^.*ulsch_rounds\s+(\d+)\/(\d+)\/(\d+)\/(\d+),\s+.*,\s+ulsch_errors\s+(\d+)')
if 'u_retx_th' in checkers:
ulsch_checker_status = list(0 for i in checkers['u_retx_th'])
u_perc_retx = list(0 for i in checkers['u_retx_th'])
#ul and dl retransmissions checkers
#NOTICE: DL and UL regex are different
if ('dlsch_rounds' in dlsch_ulsch_stats) and ('d_retx_th' in checkers):
tmp=re.match(r'^.*dlsch_rounds\s+(\d+)\/(\d+)\/(\d+)\/(\d+),\s+dlsch_errors\s+(\d+)',dlsch_ulsch_stats['dlsch_rounds'])
if tmp is not None :
#captures the different groups from the regex
retx_data=[float(x) for x in tmp.groups()]
for i in range(0,len(d_perc_retx)):
#case where numerator > denumerator with denum ==0 is disregarded, cannot hapen in principle, will lead to 0%
d_perc_retx[i] = 0 if (retx_data[i] == 0) else 100*retx_data[i+1]/retx_data[i]
#treating % > 100 , % > requirement
if (d_perc_retx[i] > 100) or (d_perc_retx[i] > checkers['d_retx_th'][i]): dlsch_checker_status[i] = -1
if -1 in dlsch_checker_status:
DLRetxIssue = True
if ('ulsch_rounds' in dlsch_ulsch_stats) and ('u_retx_th' in checkers):
tmp=re.match(r'^.*ulsch_rounds\s+(\d+)\/(\d+)\/(\d+)\/(\d+),\s+.*,\s+ulsch_errors\s+(\d+)',dlsch_ulsch_stats['ulsch_rounds'])
if tmp is not None :
retx_data=[float(x) for x in tmp.groups()]
for i in range(0,len(d_perc_retx)):
u_perc_retx[i] = 0 if (retx_data[i] == 0) else 100*retx_data[i+1]/retx_data[i]
if (u_perc_retx[i] > 100) or (u_perc_retx[i] > checkers['u_retx_th'][i]): ulsch_checker_status[i] = -1
if -1 in ulsch_checker_status:
ULRetxIssue = True
#real time statistics #real time statistics
...@@ -1244,21 +1232,15 @@ class RANManagement(): ...@@ -1244,21 +1232,15 @@ class RANManagement():
logging.debug(statMsg) logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg htmleNBFailureMsg += htmlMsg
if DLRetxIssue: for ue in retx_status:
retx_checker_status_str = '' msg = f"retransmissions for UE {ue}: DL {retx_status[ue]['dl']} UL {retx_status[ue]['ul']}"
for status in dlsch_checker_status : retx_checker_status_str+=str(status)+ ' ' if False in retx_status[ue]['dl'] or False in retx_status[ue]['ul']:
logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB ended with too many retransmissions / errors issue in DL ! \u001B[0m') msg = 'Failure: ' + msg
logging.debug('\u001B[1;37;41m Status : ' + retx_checker_status_str + ' \u001B[0m') logging.error(f'\u001B[1;37;41m {msg}\u001B[0m')
htmleNBFailureMsg += 'Fail due to retransmissions / errors issue in DL, status : ' + retx_checker_status_str + '\n' htmleNBFailureMsg += f'{msg}\n'
global_status = CONST.ENB_RETX_ISSUE
if ULRetxIssue:
retx_checker_status_str = ''
for status in ulsch_checker_status : retx_checker_status_str+=str(status)+ ' '
logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB ended with too many retransmissions / errors issue in UL ! \u001B[0m')
logging.debug('\u001B[1;37;41m Status : ' + retx_checker_status_str + ' \u001B[0m')
htmleNBFailureMsg += 'Fail due to retransmissions / errors issue in UL, status : ' + retx_checker_status_str + '\n'
global_status = CONST.ENB_RETX_ISSUE global_status = CONST.ENB_RETX_ISSUE
else:
logging.debug(msg)
if RealTimeProcessingIssue: if RealTimeProcessingIssue:
logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB ended with real time processing issue! \u001B[0m') logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB ended with real time processing issue! \u001B[0m')
......
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