Commit e730b678 authored by Lionel Gauthier's avatar Lionel Gauthier

diagnostic missing SN

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7285 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 0a06d51c
......@@ -11,6 +11,16 @@ import socket
import datetime
from datetime import date
import os, errno
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--diag_rlc_um", "-u", type=str,help="Try to find RLC protocol diagnostics", default="no")
parser.add_argument("--dir", "-d", type=str,help="Directory where msc logs can be found", default="/tmp")
args = parser.parse_args()
MSCGEN_OUTPUT_TYPE = "png"
MAX_MESSAGES_PER_PAGE = 36
......@@ -65,6 +75,8 @@ g_display_color = ['\"teal\"', # To check in msc.h: MSC_NAS_UE
'\"black\"']
# helper for diagnostic of RLC
g_diag_rlc_sn = {}
g_sequence_generator = 0
......@@ -83,32 +95,34 @@ def parse_oai_log_files():
global g_final_display_order_list
#open TXT file that contain OAI filtered traces for mscgen
filenames = [
'/tmp/openair.msc.ip_ue.log',
'/tmp/openair.msc.ip_enb.log',
'/tmp/openair.msc.nas_ue.log',
'/tmp/openair.msc.pdcp_ue.log',
'/tmp/openair.msc.rrc_ue.log',
'/tmp/openair.msc.rlc_ue.log',
'/tmp/openair.msc.mac_ue.log',
'/tmp/openair.msc.phy_ue.log',
'/tmp/openair.msc.phy_enb.log',
'/tmp/openair.msc.mac_enb.log',
'/tmp/openair.msc.rlc_enb.log',
'/tmp/openair.msc.pdcp_enb.log',
'/tmp/openair.msc.rrc_enb.log',
'/tmp/openair.msc.s1ap_enb.log',
'/tmp/openair.msc.gtpu_enb.log',
'/tmp/openair.msc.mme_app.log',
'/tmp/openair.msc.nas_mme.log',
'/tmp/openair.msc.nas_emm_mme.log',
'/tmp/openair.msc.nas_esm_mme.log',
'/tmp/openair.msc.spgwapp_mme.log',
'/tmp/openair.msc.s11_mme.log',
'/tmp/openair.msc.s6a_mme.log',
'/tmp/openair.msc.gtpu_sgw.log',
'/tmp/openair.msc.s1ap_mme.log',
'/tmp/openair.msc.hss.log']
args.dir+'/openair.msc.ip_ue.log',
args.dir+'/openair.msc.ip_enb.log',
args.dir+'/openair.msc.nas_ue.log',
args.dir+'/openair.msc.pdcp_ue.log',
args.dir+'/openair.msc.rrc_ue.log',
args.dir+'/openair.msc.rlc_ue.log',
args.dir+'/openair.msc.mac_ue.log',
args.dir+'/openair.msc.phy_ue.log',
args.dir+'/openair.msc.phy_enb.log',
args.dir+'/openair.msc.mac_enb.log',
args.dir+'/openair.msc.rlc_enb.log',
args.dir+'/openair.msc.pdcp_enb.log',
args.dir+'/openair.msc.rrc_enb.log',
args.dir+'/openair.msc.s1ap_enb.log',
args.dir+'/openair.msc.gtpu_enb.log',
args.dir+'/openair.msc.mme_app.log',
args.dir+'/openair.msc.nas_mme.log',
args.dir+'/openair.msc.nas_emm_mme.log',
args.dir+'/openair.msc.nas_esm_mme.log',
args.dir+'/openair.msc.spgwapp_mme.log',
args.dir+'/openair.msc.s11_mme.log',
args.dir+'/openair.msc.s6a_mme.log',
args.dir+'/openair.msc.gtpu_sgw.log',
args.dir+'/openair.msc.s1ap_mme.log',
args.dir+'/openair.msc.hss.log']
# we may insert diagnostic events
event_id_offset = 0
for filename in filenames:
try:
fhandle = open(filename, 'r')
......@@ -118,10 +132,10 @@ def parse_oai_log_files():
# split file content in lines
lines = fcontent.splitlines()
for line in lines:
if line.strip() != "":
print ("INPUT LINE: %s " % line)
if line.strip() != "" and not line.strip().startswith('#'):
#print ("INPUT LINE: %s " % line)
partition = line.split(' ',3)
event_id = int(partition[0])
event_id = int(partition[0]) + event_id_offset
event_type = partition[1]
entity_id = int(partition[2])
if MSC_NEW_STR == event_type:
......@@ -133,7 +147,7 @@ def parse_oai_log_files():
# if line is a trace of a message between 2 protocol entities or layers
elif MSC_MSG_STR == event_type:
print ("partition[3]:%s" % partition[3])
#print ("partition[3]:%s" % partition[3])
sub_partition = partition[3].split(' ',4)
arrow = sub_partition[0]
entity2_id = int(sub_partition[1])
......@@ -147,29 +161,52 @@ def parse_oai_log_files():
Message['line_color'] = g_display_color[entity_id]
Message['text_color'] = g_display_color[entity_id]
if arrow == '<-':
if "yes" == args.diag_rlc_um.strip() and "DATA SN " in message and "RB UM " in message:
rlc_key = re.match(r"[^[]*\[([^]]*)\]", message).groups()[0]
sn_info = message.partition("SN")[2]
if sn_info.strip() != "":
sn_str = sn_info.strip().partition(" ")[0]
sn = int(sn_str)
if rlc_key in g_diag_rlc_sn:
previous_sn = g_diag_rlc_sn[rlc_key]
if (previous_sn + 1) % 1024 != sn:
print ("DIAG missing SN: %s " % line)
MessageDiag = {}
MessageDiag['type'] = "box"
MessageDiag['tx'] = entity_id
MessageDiag['rx'] = entity_id
MessageDiag['discarded'] = False
MessageDiag['time'] = time
MessageDiag['message'] = "Missing SN "+ sn_str + " detected"
MessageDiag['line_color'] = '\"red\"'
MessageDiag['text_color'] = '\"red\"'
g_messages[event_id + event_id_offset] = MessageDiag
event_id_offset = event_id_offset + 1
g_diag_rlc_sn[rlc_key] = int(sn)
Message['type'] = "rx"
Message['tx'] = entity2_id
Message['rx'] = entity_id
Message['discarded'] = False
g_messages[event_id] = Message
g_messages[event_id + event_id_offset] = Message
elif arrow == '->':
Message['type'] = "tx"
Message['tx'] = entity_id
Message['rx'] = entity2_id
Message['discarded'] = False
g_messages[event_id] = Message
g_messages[event_id + event_id_offset] = Message
elif arrow == 'x-':
Message['type'] = "rx"
Message['tx'] = entity2_id
Message['rx'] = entity_id
Message['discarded'] = True
g_messages[event_id] = Message
g_messages[event_id + event_id_offset] = Message
elif arrow == '-x':
Message['type'] = "tx"
Message['tx'] = entity_id
Message['rx'] = entity2_id
Message['discarded'] = True
g_messages[event_id] = Message
g_messages[event_id + event_id_offset] = Message
elif MSC_BOX_STR == event_type:
sub_partition = partition[3].split(' ',1)
......@@ -184,9 +221,10 @@ def parse_oai_log_files():
Message['message'] = message
Message['line_color'] = g_display_color[entity_id]
Message['text_color'] = g_display_color[entity_id]
g_messages[event_id] = Message
g_messages[event_id + event_id_offset] = Message
except IOError, e:
print ("INPUT LINE: %s " % line)
print 'err message'
#print("------------------------------------")
......@@ -202,7 +240,7 @@ def msc_chart_write_header(fileP):
fileP.write("width = \"2048\";\n")
entity_line_list_str = ''
print (" %s " % ( g_proto_names ) )
#print (" %s " % ( g_proto_names ) )
for entity in g_proto_names:
if entity != 'NotDeclared':
entity_line_list_str = entity_line_list_str + ' ' + entity + ','
......@@ -237,8 +275,8 @@ g_page_index = 0
g_message_index = 0
g_now = datetime.datetime.now()
g_now_formated = 'mscgen_' + g_now.strftime("%Y-%m-%d_%H.%M.%S")
g_currentdir = os.curdir
g_resultdir = os.path.join(g_currentdir, g_now_formated)
#g_currentdir = os.curdir
g_resultdir = os.path.join(args.dir, g_now_formated)
os.mkdir(g_resultdir)
os.chdir(g_resultdir)
......
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