Merge remote-tracking branch 'origin/msc-removal' into integration_2022_wk08
@@ -46,7 +46,6 @@ Description Timer utilities
|
||||
#include "intertask_interface.h"
|
||||
#include "nas_timer.h"
|
||||
#include "commonDef.h"
|
||||
#include "msc.h"
|
||||
|
||||
/****************************************************************************/
|
||||
/**************** E X T E R N A L D E F I N I T I O N S ****************/
|
||||
|
||||
@@ -812,7 +812,6 @@ void *nas_nrue_task(void *args_p)
|
||||
|
||||
ue_security_key=(ue_sa_security_key_t **)calloc(1,sizeof(ue_sa_security_key_t*)*NB_UE_INST);
|
||||
itti_mark_task_ready (TASK_NAS_NRUE);
|
||||
MSC_START_USE();
|
||||
|
||||
while(1) {
|
||||
// Wait for a message or an event
|
||||
|
||||
@@ -47,14 +47,6 @@ Description Defines constants and functions used by the AS simulator
|
||||
/********************* G L O B A L C O N S T A N T S *******************/
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* Constansts used for MSCGEN (Message Sequence Chart Generator)
|
||||
*/
|
||||
#define MSCGEN(args...) fprintf(stderr, ##args);
|
||||
#define _ue_id "UE"
|
||||
#define _mme_id "MME"
|
||||
#define _as_id "AS"
|
||||
|
||||
/****************************************************************************/
|
||||
/************************ G L O B A L T Y P E S ************************/
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -102,7 +102,7 @@ int process_cell_info_req(int msg_id, const cell_info_req_t* req,
|
||||
index += _process_plmn(_mscgen_buffer, &req->plmnID, MSCGEN_BUFFER_SIZE);
|
||||
snprintf(_mscgen_buffer + index, MSCGEN_BUFFER_SIZE - index,
|
||||
", rat = 0x%x%c", req->rat, '\0');
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- Cell Information Request (0x%.4x)\\n%s --->][%s]\n",
|
||||
printf("[%s][%s][--- Cell Information Request (0x%.4x)\\n%s --->][%s]\n",
|
||||
getTime(), _ue_id, msg_id, _mscgen_buffer, _as_id);
|
||||
|
||||
/* Setup cell information confirm message */
|
||||
@@ -116,7 +116,7 @@ int process_cell_info_req(int msg_id, const cell_info_req_t* req,
|
||||
snprintf(_mscgen_buffer, MSCGEN_BUFFER_SIZE,
|
||||
"tac = 0x%.4x, cellID = 0x%.8x, rat = 0x%x, RSRQ = %u, RSRP = %u%c",
|
||||
cnf->tac, cnf->cellID, cnf->rat, cnf->rsrq, cnf->rsrp, '\0');
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- Cell Information Confirm (0x%.4x)\\n%s --->][%s]\n",
|
||||
printf("[%s][%s][--- Cell Information Confirm (0x%.4x)\\n%s --->][%s]\n",
|
||||
getTime(), _as_id, AS_CELL_INFO_CNF, _mscgen_buffer, _ue_id);
|
||||
|
||||
printf("INFO\t: %s - Send cell informtion confirm\n", __FUNCTION__);
|
||||
@@ -146,13 +146,13 @@ int process_nas_establish_req(int msg_id, const nas_establish_req_t* req,
|
||||
"cause = %s, type = %s, tmsi = {MMEcode = %d, m_tmsi = %u}%c",
|
||||
rrcCause(req->cause), rrcType(req->type),
|
||||
req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi, '\0');
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment Request "
|
||||
printf("[%s][%s][--- NAS Signalling Connection Establishment Request "
|
||||
"(0x%.4x)\\n%s --->][%s]\n",
|
||||
getTime(), _ue_id, msg_id, _mscgen_buffer, _as_id);
|
||||
|
||||
_process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE,
|
||||
(char*)req->initialNasMsg.data, req->initialNasMsg.length);
|
||||
MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _ue_id, _as_id, _mscgen_buffer);
|
||||
printf("[%s][%s][%s]\n", _ue_id, _as_id, _mscgen_buffer);
|
||||
|
||||
/* Process initial NAS message */
|
||||
bytes = nas_process(_mscgen_buffer, MSCGEN_BUFFER_SIZE,
|
||||
@@ -160,7 +160,7 @@ int process_nas_establish_req(int msg_id, const nas_establish_req_t* req,
|
||||
req->initialNasMsg.length);
|
||||
|
||||
if (bytes < 0) {
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment "
|
||||
printf("[%s][%s][--- NAS Signalling Connection Establishment "
|
||||
"Indication (0x%.4x)\\ntac = 0x%.4x\\n%s ---x][%s]\n", getTime(),
|
||||
_as_id, AS_NAS_ESTABLISH_IND, ind->tac, _mscgen_buffer, _mme_id);
|
||||
/* Setup NAS signalling connection establishment confirmation message */
|
||||
@@ -190,7 +190,7 @@ int process_nas_establish_req(int msg_id, const nas_establish_req_t* req,
|
||||
// Transmission failure of Attach Request message
|
||||
//cnf->errCode = AS_FAILURE; // UE DEBUG
|
||||
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment Indication "
|
||||
printf("[%s][%s][--- NAS Signalling Connection Establishment Indication "
|
||||
"(0x%.4x)\\nUEid = %u, tac = 0x%.4x\\n%s --->][%s]\n", getTime(),
|
||||
_as_id, AS_NAS_ESTABLISH_IND, ind->UEid, ind->tac, _mscgen_buffer, _mme_id);
|
||||
|
||||
@@ -224,13 +224,13 @@ int process_ul_info_transfer_req(int msg_id, const ul_info_transfer_req_t* req,
|
||||
snprintf(_mscgen_buffer, MSCGEN_BUFFER_SIZE,
|
||||
"tmsi = {MMEcode = %d, m_tmsi = %u}%c",
|
||||
req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi, '\0');
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- Uplink Information Request "
|
||||
printf("[%s][%s][--- Uplink Information Request "
|
||||
"(0x%.4x)\\n%s --->][%s]\n",
|
||||
getTime(), _ue_id, msg_id, _mscgen_buffer, _as_id);
|
||||
|
||||
_process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE,
|
||||
(char*)req->nasMsg.data, req->nasMsg.length);
|
||||
MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _ue_id, _as_id, _mscgen_buffer);
|
||||
printf("[%s][%s][%s]\n", _ue_id, _as_id, _mscgen_buffer);
|
||||
|
||||
/* Process NAS message */
|
||||
bytes = nas_process(_mscgen_buffer, MSCGEN_BUFFER_SIZE,
|
||||
@@ -238,7 +238,7 @@ int process_ul_info_transfer_req(int msg_id, const ul_info_transfer_req_t* req,
|
||||
req->nasMsg.length);
|
||||
|
||||
if (bytes < 0) {
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- Uplink Information Indication "
|
||||
printf("[%s][%s][--- Uplink Information Indication "
|
||||
"(0x%.4x)\\n%s ---x][%s]\n", getTime(),
|
||||
_as_id, AS_UL_INFO_TRANSFER_IND, _mscgen_buffer, _mme_id);
|
||||
/* Setup uplink information confirmation message */
|
||||
@@ -279,7 +279,7 @@ int process_ul_info_transfer_req(int msg_id, const ul_info_transfer_req_t* req,
|
||||
// cnf->errCode = AS_FAILURE; // UE DEBUG
|
||||
//}
|
||||
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- Uplink Information Indication "
|
||||
printf("[%s][%s][--- Uplink Information Indication "
|
||||
"(0x%.4x), UEid = %u\\n%s --->][%s]\n", getTime(),
|
||||
_as_id, AS_UL_INFO_TRANSFER_IND, ind->UEid, _mscgen_buffer, _mme_id);
|
||||
|
||||
@@ -297,7 +297,7 @@ int process_nas_release_req(int msg_id, const nas_release_req_t* req)
|
||||
printf("INFO\t: %s - Process NAS signalling connection release request\n",
|
||||
__FUNCTION__);
|
||||
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Release Request "
|
||||
printf("[%s][%s][--- NAS Signalling Release Request "
|
||||
"(0x%.4x), tmsi = {MMEcode = %d, m_tmsi = %u}, "
|
||||
"cause = %s (%u) --->][%s]\n", getTime(), _ue_id, msg_id,
|
||||
req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi,
|
||||
@@ -332,14 +332,14 @@ int process_nas_establish_rsp(int msg_id, const nas_establish_rsp_t* rsp,
|
||||
//rsp->nasMsg.data[21] = 0xc4; // MME DEBUG (Send ESM status)
|
||||
//}
|
||||
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment "
|
||||
printf("[%s][%s][--- NAS Signalling Connection Establishment "
|
||||
"Response (0x%.4x)\\nerrCode = %s, UEid = %u --->][%s]\n",
|
||||
getTime(), _mme_id, msg_id,
|
||||
rrcErrCode(rsp->errCode), rsp->UEid, _as_id);
|
||||
|
||||
_process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE,
|
||||
(char*)rsp->nasMsg.data, rsp->nasMsg.length);
|
||||
MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _mme_id, _as_id, _mscgen_buffer);
|
||||
printf("[%s][%s][%s]\n", _mme_id, _as_id, _mscgen_buffer);
|
||||
|
||||
// Discard Attach Accept message
|
||||
//return (0); // UE DEBUG
|
||||
@@ -350,7 +350,7 @@ int process_nas_establish_rsp(int msg_id, const nas_establish_rsp_t* rsp,
|
||||
rsp->nasMsg.length);
|
||||
|
||||
if (bytes < 0) {
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment "
|
||||
printf("[%s][%s][--- NAS Signalling Connection Establishment "
|
||||
"Confirm (0x%.4x)\\n%s ---x][%s]\n", getTime(),
|
||||
_as_id, AS_NAS_ESTABLISH_CNF, _mscgen_buffer, _ue_id);
|
||||
return (0);
|
||||
@@ -369,7 +369,7 @@ int process_nas_establish_rsp(int msg_id, const nas_establish_rsp_t* rsp,
|
||||
}
|
||||
}
|
||||
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment "
|
||||
printf("[%s][%s][--- NAS Signalling Connection Establishment "
|
||||
"Confirm (0x%.4x)\\n%s --->][%s]\n", getTime(),
|
||||
_as_id, AS_NAS_ESTABLISH_CNF, _mscgen_buffer, _ue_id);
|
||||
|
||||
@@ -401,13 +401,13 @@ int process_dl_info_transfer_req(int msg_id, const dl_info_transfer_req_t* req,
|
||||
// req->nasMsg.data[6] = 0x02; // UE DEBUG
|
||||
//}
|
||||
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- Downlink Information Request "
|
||||
printf("[%s][%s][--- Downlink Information Request "
|
||||
"(0x%.4x), UEid = %u --->][%s]\n",
|
||||
getTime(), _mme_id, msg_id, req->UEid, _as_id);
|
||||
|
||||
_process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE,
|
||||
(char*)req->nasMsg.data, req->nasMsg.length);
|
||||
MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _mme_id, _as_id, _mscgen_buffer);
|
||||
printf("[%s][%s][%s]\n", _mme_id, _as_id, _mscgen_buffer);
|
||||
|
||||
/* Process NAS message */
|
||||
bytes = nas_process(_mscgen_buffer, MSCGEN_BUFFER_SIZE,
|
||||
@@ -415,7 +415,7 @@ int process_dl_info_transfer_req(int msg_id, const dl_info_transfer_req_t* req,
|
||||
req->nasMsg.length);
|
||||
|
||||
if (bytes < 0) {
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- Downlink Information Indication "
|
||||
printf("[%s][%s][--- Downlink Information Indication "
|
||||
"(0x%.4x)\\n%s ---x][%s]\n", getTime(),
|
||||
_as_id, AS_DL_INFO_TRANSFER_IND, _mscgen_buffer, _ue_id);
|
||||
/* Setup downlink information confirmation message */
|
||||
@@ -445,7 +445,7 @@ int process_dl_info_transfer_req(int msg_id, const dl_info_transfer_req_t* req,
|
||||
// return (0); // MME DEBUG
|
||||
//}
|
||||
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- Downlink Information Indication "
|
||||
printf("[%s][%s][--- Downlink Information Indication "
|
||||
"(0x%.4x)\\n%s --->][%s]\n", getTime(),
|
||||
_as_id, AS_DL_INFO_TRANSFER_IND, _mscgen_buffer, _ue_id);
|
||||
|
||||
@@ -464,14 +464,14 @@ int process_nas_release_ind(int msg_id, const nas_release_req_t* req,
|
||||
printf("INFO\t: %s - Process NAS signalling connection release request\n",
|
||||
__FUNCTION__);
|
||||
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Release Request "
|
||||
printf("[%s][%s][--- NAS Signalling Connection Release Request "
|
||||
"(0x%.4x), UEid = %u, cause = %s (%u) --->][%s]\n",
|
||||
getTime(), _mme_id, msg_id, req->UEid,
|
||||
rrcReleaseCause(req->cause), req->cause, _as_id);
|
||||
|
||||
/* Forward NAS release indication to the UE */
|
||||
ind->cause = req->cause;
|
||||
MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Release Indication "
|
||||
printf("[%s][%s][--- NAS Signalling Connection Release Indication "
|
||||
"(0x%.4x), cause = %s (%u) --->][%s]\n",
|
||||
getTime(), _as_id, msg_id, rrcReleaseCause(req->cause),
|
||||
ind->cause, _ue_id);
|
||||
|
||||
@@ -193,7 +193,7 @@ int main (int argc, const char* argv[])
|
||||
printf("INFO\t: %s - The RRC Simulator is now connected to %s/%s (%d)\n",
|
||||
__FUNCTION__, mhost, mport, socket_get_fd(_as_simulator_mme_sid));
|
||||
|
||||
MSCGEN("[MSC_NEW][%s][AS=%s]\n", getTime(), _as_id);
|
||||
printf("[%s][AS=%s]\n", getTime(), _as_id);
|
||||
|
||||
/*
|
||||
* Set up signal handler
|
||||
@@ -325,7 +325,7 @@ static void* _as_simulator_ue_mngr(void* args)
|
||||
|
||||
printf("INFO\t: %s - UE connection manager started\n", __FUNCTION__);
|
||||
|
||||
MSCGEN("[MSC_NEW][%s][NAS-UE=%s]\n", getTime(), _ue_id);
|
||||
printf("[%s][NAS-UE=%s]\n", getTime(), _ue_id);
|
||||
|
||||
/* Receiving loop */
|
||||
while (_as_simulator_ue_is_running) {
|
||||
@@ -407,7 +407,7 @@ static void* _as_simulator_mme_mngr(void* args)
|
||||
|
||||
printf("INFO\t: %s - MME connection manager started\n", __FUNCTION__);
|
||||
|
||||
MSCGEN("[MSC_NEW][%s][NAS-MME=%s]\n", getTime(), _mme_id);
|
||||
printf("[%s][NAS-MME=%s]\n", getTime(), _mme_id);
|
||||
|
||||
/* Receiving loop */
|
||||
while (_as_simulator_mme_is_running) {
|
||||
|
||||
|
Before Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
@@ -1,34 +0,0 @@
|
||||
================================================================================
|
||||
Message Sequence Chart generation
|
||||
================================================================================
|
||||
|
||||
Message Sequence Charts (MSCs) are a way of representing entities and
|
||||
interactions to demonstrate how protocols operate between network elements.
|
||||
|
||||
The Access Stratum simulator generates MSC description file that can be
|
||||
processed by the Python script msc_gen.py to generate a PNG (Portable
|
||||
Network Graphic) file.
|
||||
|
||||
msc_gen.py use mscgen utility that is fully discribed at
|
||||
http://www.mcternan.me.uk/mscgen/
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
How to generate MSC description file ?
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Redirect stderr stream to a file that will be used as input by the Python
|
||||
script msc_gen.py:
|
||||
|
||||
ASprocess 2> ASprocess.msc
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
How to generate PNG file ?
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Parse the MSC description file using the Python script msc_gen.py:
|
||||
|
||||
./msc_gen.py ASprocess.msc
|
||||
|
||||
Warning: msc_gen.py needs mscgen utility to be installed. mscgen is a C
|
||||
program that uses the GD graphics library for PNG output.
|
||||
|
||||
|
Before Width: | Height: | Size: 3.6 KiB |
@@ -1,354 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Lionel GAUTHIER
|
||||
# This script is a downgrade of a python script written for the openair stack, generating sequence diagrams charts, displaying
|
||||
# messages exchanged between LTE access stratum protocol entities.
|
||||
# This script needs mscgen tool (http://www.mcternan.me.uk/mscgen/).
|
||||
#
|
||||
# The aim of this script is to collect some traces from oaisim stack and generate a mscgen script, then generate a sequence diagram
|
||||
# image (png or jpeg) based on the scripts generated.
|
||||
# An example of how it can be invoqued: msc_gen.py /tmp/msc_log.txt /tmp/msc_log2.txt msc_logx.txt are input text files,
|
||||
# They/It are/is generated by the execution of executables in linux user space. May be it is better to operate on log files 'grepped' with MSC:
|
||||
# ./my_exe.exe | grep \[MSC > /tmp/msc_log1.txt
|
||||
|
||||
|
||||
# Now, examples of how to generate a mscgen trace in a C executable:
|
||||
# -First you have to declare the instance(s) of the protocol(s) that will send or receive messages.
|
||||
# This is done with the following line:
|
||||
# [MSC_NEW][system time][protocol_name=instance_name]
|
||||
# examples:
|
||||
# printf("[MSC_NEW][%s][MIH-F=%s]\n", getTimeStamp4Log(), g_mihf_id); for declaring a new instance of a protocol entity of type MIH-F
|
||||
# with an instance name g_mihf_id (of type char*)
|
||||
# printf("[MSC_NEW][%s][NAS=%s]\n", getTimeStamp4Log(), "nas"); other example.
|
||||
# This declaration of instances of protocols is mandatory to for this script to work.
|
||||
#
|
||||
# -Then for tracing a message you have to log a line following this format:
|
||||
# [MSC_MSG][system time][source instance_name][--- message_name --->][destination instance_name]
|
||||
# Note:
|
||||
# ---> means a message that has been received correctly by destination
|
||||
# ---x means a message lost by destination
|
||||
# example
|
||||
# NOTICE("[MSC_MSG][%s][%s][--- Link_Register.indication\\n%s ---x][%s]\n",getTimeStamp4Log(),g_link_id,g_msc_gen_buf,g_mihf_id);
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import re
|
||||
import socket
|
||||
import datetime
|
||||
import os.path
|
||||
from datetime import date
|
||||
|
||||
MSCGEN_OUTPUT_TYPE = "png"
|
||||
MAX_MESSAGES_PER_PAGE = 36
|
||||
|
||||
SYSTEM_FRAME_NUMBER_STR = 'FRAME'
|
||||
MODULE_STR = 'MOD'
|
||||
RADIO_BEARER_STR = 'RB'
|
||||
MSC_NEW_STR = '[MSC_NEW]'
|
||||
MSC_MSG_STR = '[MSC_MSG]'
|
||||
MSC_NBOX_STR = '[MSC_NBOX]'
|
||||
MSC_BOX_STR = '[MSC_BOX]'
|
||||
MSC_ABOX_STR = '[MSC_ABOX]'
|
||||
MSC_RBOX_STR = '[MSC_RBOX]'
|
||||
|
||||
# This dic is filled as follow : g_entities_dic[protocol_instance_name].append(protocol_name)
|
||||
# where protocol_name can be any of the following MI-USER, MIH-F, RAL, LINK-SAP
|
||||
g_entities_dic = {}
|
||||
g_reverse_entities_dic = {}
|
||||
|
||||
|
||||
# g_messages is filled with dictionnaries:
|
||||
# message_dic['entity_src'] = protocol_entity_src
|
||||
# message_dic['entity_dst'] = protocol_entity_dest
|
||||
# message_dic['msg'] = message
|
||||
# message_dic['line_color'] = g_display_color[entity_name]
|
||||
# message_dic['text_color'] = g_display_color[entity_name]
|
||||
# message_dic['time'] = system_frame_number
|
||||
# message_dic['seq_no'] = sequence_number_generator()
|
||||
# g_messages.append(message_dic)
|
||||
g_messages = []
|
||||
g_messages_dic = {}
|
||||
|
||||
|
||||
# g_display_order_dic is a dictionnary where the order of the display of entities sharing the same module identifier is hardcoded
|
||||
#MAC and PHY valus have to be above num max radio bearer value
|
||||
#g_display_order_dic = {'MIH-USER': 0, 'MIH-F': 1, 'RAL': 3, 'NAS': 4}
|
||||
g_display_order_dic = {'NAS-UE': 0, 'AS': 1, 'NAS-MME': 3}
|
||||
|
||||
# Display color of messages of sending entities
|
||||
g_display_color = {'IP': '\"teal\"',
|
||||
'RRC_UE': '\"red\"',
|
||||
'MIH-USER': '\"black\"',
|
||||
'MIH-F': '\"black\"',
|
||||
'RAL': '\"black\"',
|
||||
'RAL_M': '\"black\"',
|
||||
'RLC_UM': '\"navy\"',
|
||||
'RLC_TM': '\"navy\"',
|
||||
'NAS': '\"black\"',
|
||||
'MAC_eNB': '\"indigo\"',
|
||||
'PHY': '\"purple\"',
|
||||
'NAS-UE': '\"black\"',
|
||||
'NAS-MME': '\"black\"',
|
||||
'AS': '\"black\"'}
|
||||
|
||||
|
||||
g_final_display_order_list = []
|
||||
g_sequence_generator = 0
|
||||
|
||||
def sequence_number_generator():
|
||||
global g_sequence_generator
|
||||
l_seq = g_sequence_generator
|
||||
g_sequence_generator = g_sequence_generator + 1
|
||||
return l_seq
|
||||
|
||||
def parse_log_file_for_discovering_protocol_entities(filename):
|
||||
global g_entities_dic
|
||||
global g_entities
|
||||
global g_messages
|
||||
global g_final_display_order_list
|
||||
#open TXT file that contain OAI filtered traces for mscgen
|
||||
|
||||
fhandle = open(filename, 'r')
|
||||
fcontent = fhandle.read()
|
||||
fhandle.close()
|
||||
|
||||
# split file content in lines
|
||||
lines = fcontent.splitlines()
|
||||
for line in lines:
|
||||
system_time = 'unknown'
|
||||
|
||||
# if line is a trace of the creation of a new protocol instance
|
||||
if MSC_NEW_STR in line:
|
||||
partition = line.rpartition(MSC_NEW_STR)
|
||||
msc_log_string = partition[2]
|
||||
#print (" %s " % msc_log_string)
|
||||
partition = msc_log_string.split('[')
|
||||
print ("\n\n %s \n" % partition)
|
||||
#if len(partition) == 2:
|
||||
|
||||
item = partition[1]
|
||||
item = item.strip()
|
||||
item = item.strip(']')
|
||||
system_time = item.split(' ')[-1]
|
||||
print ("NEW system_time %s " % system_time)
|
||||
|
||||
item = partition[2]
|
||||
item = item.strip()
|
||||
item = item.strip(']')
|
||||
protocol_entity_type = item.split('=')[0]
|
||||
protocol_entity_name = item.split('=')[-1]
|
||||
print ("NEW protocol_entity_type %s " % protocol_entity_type)
|
||||
print ("NEW protocol_entity_name %s " % protocol_entity_name)
|
||||
|
||||
if protocol_entity_name not in g_entities_dic:
|
||||
g_entities_dic[protocol_entity_name] = protocol_entity_type
|
||||
|
||||
if protocol_entity_type not in g_reverse_entities_dic:
|
||||
g_reverse_entities_dic[protocol_entity_type] = protocol_entity_name
|
||||
else:
|
||||
entity_name_list = g_reverse_entities_dic[protocol_entity_type]
|
||||
entity_name_list.append(protocol_entity_name)
|
||||
g_reverse_entities_dic[protocol_entity_type] = entity_name_list
|
||||
#print (" g_entities_dic[%d][%d].append(%s)" % (module_id_int, radio_bearer_id_int, entity_name_src))
|
||||
print (" g_entities_dic= %s\n\n" % (g_entities_dic))
|
||||
print (" g_reverse_entities_dic= %s\n\n" % (g_reverse_entities_dic))
|
||||
|
||||
#g_entities.append(protocol_entity_type)
|
||||
#print (" %s \n" % protocol_entity)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def parse_log_file(filename):
|
||||
global g_entities_dic
|
||||
global g_entities
|
||||
global g_messages
|
||||
global g_final_display_order_list
|
||||
#open TXT file that contain OAI filtered traces for mscgen
|
||||
fhandle = open(filename, 'r')
|
||||
fcontent = fhandle.read()
|
||||
fhandle.close()
|
||||
|
||||
# split file content in lines
|
||||
lines = fcontent.splitlines()
|
||||
for line in lines:
|
||||
system_time = 'unknown'
|
||||
message = 'unknown'
|
||||
entity_name_src = 'unknown'
|
||||
entity_name_dest = 'unknown'
|
||||
|
||||
|
||||
# if line is a trace of the creation of a new protocol instance
|
||||
if MSC_MSG_STR in line:
|
||||
partition = line.strip().rpartition(MSC_MSG_STR)
|
||||
msc_log_string = partition[2].strip()
|
||||
print (" ++++ %s " % msc_log_string)
|
||||
partition = msc_log_string.split('[')
|
||||
print (" ++++ %s " % partition)
|
||||
|
||||
#if len(partition) == 9:
|
||||
message_dic = {}
|
||||
|
||||
system_time = partition[1].strip().split(' ')[-1].strip(']')
|
||||
message_dic['display_time'] = system_time
|
||||
seconds_int = int(system_time.split(':')[0])
|
||||
micro_seconds_int = int(system_time.split(':')[-1])
|
||||
system_time_int = seconds_int*1000000 + micro_seconds_int
|
||||
system_time=str(system_time_int)
|
||||
print ('system_time %s' % system_time)
|
||||
|
||||
entity_name_src = partition[2].strip().split(' ')[-1].strip(']')
|
||||
print ('entity_name_src %s' % entity_name_src)
|
||||
|
||||
message = partition[3].strip().strip(']').strip()
|
||||
if (message[-1] == 'x') or (message[-1] == 'X'):
|
||||
message_dic['arc'] = '-x'
|
||||
elif message[-1] == '>':
|
||||
message_dic['arc'] = '=>'
|
||||
message = message.strip('<').strip('>').strip('x').strip('X').strip('-').strip('=').strip()
|
||||
print ('message %s' % message)
|
||||
|
||||
entity_name_dest = partition[4].strip().split(' ')[-1].strip(']')
|
||||
print ('entity_name_dest %s' % entity_name_dest)
|
||||
message_dic['entity_src'] = entity_name_src
|
||||
message_dic['entity_dst'] = entity_name_dest
|
||||
message_dic['msg'] = message
|
||||
message_dic['line_color'] = g_display_color[g_entities_dic[entity_name_src]]
|
||||
message_dic['text_color'] = g_display_color[g_entities_dic[entity_name_src]]
|
||||
message_dic['time'] = system_time
|
||||
#message_dic['seq_no'] = sequence_number_generator()
|
||||
print ('%s\n\n' % message_dic)
|
||||
g_messages_dic[system_time_int] = message_dic
|
||||
#g_messages.append(message_dic)
|
||||
|
||||
#TODO !!!
|
||||
if MSC_RBOX_STR in line:
|
||||
partition = line.strip().rpartition(MSC_RBOX_STR)
|
||||
msc_log_string = partition[2].strip()
|
||||
print (" ==== %s " % msc_log_string)
|
||||
partition = msc_log_string.split('[')
|
||||
print (" ==== %s " % partition)
|
||||
#TODO !!!
|
||||
|
||||
def generate_sorted_message_list():
|
||||
first_time_stamp = 0
|
||||
for system_time_int in sorted(g_messages_dic.iterkeys()):
|
||||
if first_time_stamp == 0:
|
||||
first_time_stamp = system_time_int
|
||||
message_dic = g_messages_dic[system_time_int]
|
||||
message_dic['seq_no'] = sequence_number_generator()
|
||||
message_dic['display_time'] = str(system_time_int - first_time_stamp)
|
||||
g_messages.append(message_dic)
|
||||
|
||||
def generate_sorted_entity_display_list():
|
||||
module_display_order_dic = {}
|
||||
for entity_name in sorted(g_entities_dic.iterkeys()):
|
||||
module_display_order_dic[g_display_order_dic[g_entities_dic[entity_name]]] = entity_name
|
||||
|
||||
|
||||
print("------------------------------------")
|
||||
print(" %s " % (module_display_order_dic))
|
||||
|
||||
for display_priority in sorted(module_display_order_dic.iterkeys()):
|
||||
g_final_display_order_list.append(module_display_order_dic[display_priority])
|
||||
|
||||
def msc_chart_write_header(fileP):
|
||||
global g_final_display_order_list
|
||||
fileP.write("msc {\n")
|
||||
fileP.write("width = \"2048\";\n")
|
||||
|
||||
entity_line_list_str = ''
|
||||
for entity in g_final_display_order_list:
|
||||
entity_line_list_str = entity_line_list_str + ' ' + entity + ','
|
||||
|
||||
entity_line_list_str = entity_line_list_str.rstrip().strip(',')
|
||||
fileP.write(" %s;" % (entity_line_list_str))
|
||||
|
||||
|
||||
def msc_chart_write_footer(fileP):
|
||||
fileP.write("\n}\n")
|
||||
|
||||
def msc_chart_generate(file_nameP):
|
||||
global MSCGEN_OUTPUT_TYPE
|
||||
command_line = "mscgen -T " + MSCGEN_OUTPUT_TYPE + " -i " + file_nameP + "; chmod 777 " +file_nameP + ";"
|
||||
|
||||
print("Command Line: %s " % (command_line))
|
||||
fi,fo,fe=os.popen3(command_line)
|
||||
for i in fe.readlines():
|
||||
print "error:",i
|
||||
|
||||
def get_nem_file_descriptor():
|
||||
global g_base_file_name
|
||||
global g_page_index
|
||||
l_file_name = g_base_file_name + str(g_page_index)+'.txt'
|
||||
l_file = open(l_file_name, "w", 0777)
|
||||
return l_file
|
||||
|
||||
|
||||
###### MAIN START HERE #################
|
||||
num_args = len(sys.argv)
|
||||
if num_args < 2: # the program name and the arguments
|
||||
# stop the program and print an error message
|
||||
sys.exit("Must provide at least one file to parse")
|
||||
|
||||
for i in range(1,num_args):
|
||||
print sys.argv[i]
|
||||
|
||||
for i in range(1,num_args):
|
||||
parse_log_file_for_discovering_protocol_entities(sys.argv[i])
|
||||
|
||||
for i in range(1,num_args):
|
||||
parse_log_file(sys.argv[i])
|
||||
|
||||
generate_sorted_message_list()
|
||||
generate_sorted_entity_display_list()
|
||||
|
||||
g_page_index = 0
|
||||
g_message_index = 0
|
||||
g_message_index_in_current_page = 0
|
||||
g_now = datetime.datetime.now()
|
||||
g_now_formated = g_now.strftime("%Y-%m-%d_%H.%M.%S")
|
||||
g_currentdir = os.curdir
|
||||
g_resultdir = os.path.join(g_currentdir, g_now_formated)
|
||||
os.mkdir(g_resultdir, 0777)
|
||||
os.chdir(g_resultdir)
|
||||
|
||||
g_base_file_name = 'mih_mscgen_page_'
|
||||
|
||||
g_file = get_nem_file_descriptor()
|
||||
msc_chart_write_header(g_file)
|
||||
|
||||
for message in g_messages:
|
||||
|
||||
if 'msg' in message:
|
||||
print ('message %s' % message)
|
||||
g_file.write(" %s%s%s [ label = \"(%d) T%s %s\", linecolour=%s , textcolour=%s ] ;\n" % (message['entity_src'], message['arc'], message['entity_dst'], message['seq_no'], message['display_time'], message['msg'], message['line_color'], message['text_color']))
|
||||
elif 'box' in message:
|
||||
g_file.write(" %s %s %s [ label = \"%s\", textbgcolour=%s , textcolour=%s ] ;\n" % (message['entity_src'], message['box_type'], message['entity_dst'], message['box'], message['textbg_color'], message['text_color']))
|
||||
|
||||
g_message_index = g_message_index + 1
|
||||
g_message_index_in_current_page = g_message_index_in_current_page + 1
|
||||
|
||||
if (g_message_index_in_current_page == MAX_MESSAGES_PER_PAGE):
|
||||
msc_chart_write_footer(g_file)
|
||||
g_file.close()
|
||||
msc_chart_generate(g_file.name)
|
||||
g_page_index = g_page_index + 1
|
||||
g_message_index_in_current_page = 0
|
||||
|
||||
g_file = get_nem_file_descriptor()
|
||||
msc_chart_write_header(g_file)
|
||||
|
||||
|
||||
msc_chart_write_footer(g_file)
|
||||
g_file.close()
|
||||
if g_message_index_in_current_page >= 1:
|
||||
msc_chart_generate(g_file.name)
|
||||
else:
|
||||
print("Removing empty seq diagram file: %s " % (g_file.name))
|
||||
os.remove(g_file.name)
|
||||
@@ -53,7 +53,6 @@ Description Defines the detach related EMM procedure executed by the
|
||||
|
||||
#include "emm_sap.h"
|
||||
#include "esm_sap.h"
|
||||
#include "msc.h"
|
||||
|
||||
#include <stdlib.h> // free
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ Description Defines the identification EMM procedure executed by the
|
||||
#include "emmData.h"
|
||||
|
||||
#include "emm_sap.h"
|
||||
#include "msc.h"
|
||||
#include "user_defs.h"
|
||||
|
||||
#include <stdlib.h> // malloc, free
|
||||
|
||||
@@ -61,7 +61,6 @@ Description Defines the EMMAS Service Access Point that provides
|
||||
#if defined(NAS_BUILT_IN_UE)
|
||||
# include "nas_itti_messaging.h"
|
||||
#endif
|
||||
#include "msc.h"
|
||||
|
||||
/****************************************************************************/
|
||||
/**************** E X T E R N A L D E F I N I T I O N S ****************/
|
||||
|
||||
@@ -63,7 +63,6 @@ Description Defines the security mode control EMM procedure executed by the
|
||||
|
||||
# include "assertions.h"
|
||||
#include "secu_defs.h"
|
||||
#include "msc.h"
|
||||
#include "SecurityModeControl.h"
|
||||
|
||||
#if defined(NAS_BUILT_IN_UE)
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "nas_itti_messaging.h"
|
||||
#include "msc.h"
|
||||
|
||||
# define TASK_ORIGIN TASK_NAS_UE
|
||||
|
||||
@@ -104,27 +103,6 @@ int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id) {
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_KENB_REFRESH_REQ);
|
||||
memcpy(NAS_KENB_REFRESH_REQ(message_p).kenb, kenb, sizeof(NAS_KENB_REFRESH_REQ(message_p).kenb));
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_NAS_UE,
|
||||
MSC_RRC_UE,
|
||||
NULL,0,
|
||||
"0 NAS_KENB_REFRESH_REQ KeNB "
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x",
|
||||
kenb[0], kenb[1], kenb[2], kenb[3],
|
||||
kenb[4], kenb[5], kenb[6], kenb[7],
|
||||
kenb[8], kenb[9], kenb[10], kenb[11],
|
||||
kenb[12], kenb[13], kenb[14], kenb[15],
|
||||
kenb[16], kenb[17], kenb[18], kenb[19],
|
||||
kenb[20], kenb[21], kenb[22], kenb[23],
|
||||
kenb[24], kenb[25], kenb[26], kenb[27],
|
||||
kenb[28], kenb[29], kenb[30], kenb[31]);
|
||||
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
|
||||
}
|
||||
|
||||
@@ -133,13 +111,6 @@ int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id) {
|
||||
message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_CELL_SELECTION_REQ);
|
||||
NAS_CELL_SELECTION_REQ(message_p).plmnID = plmnID;
|
||||
NAS_CELL_SELECTION_REQ(message_p).rat = rat;
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_NAS_UE,
|
||||
MSC_RRC_UE,
|
||||
NULL,0,
|
||||
"0 NAS_CELL_SELECTION_REQ PLMN %X%X%X.%X%X%X",
|
||||
plmnID.MCCdigit1, plmnID.MCCdigit2, plmnID.MCCdigit3,
|
||||
plmnID.MNCdigit1, plmnID.MNCdigit2, plmnID.MNCdigit3);
|
||||
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
|
||||
}
|
||||
|
||||
@@ -152,14 +123,6 @@ int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t
|
||||
NAS_CONN_ESTABLI_REQ(message_p).plmnID = plmnID;
|
||||
NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.data = data;
|
||||
NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.length = length;
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_NAS_UE,
|
||||
MSC_RRC_UE,
|
||||
NULL,0,
|
||||
"0 NAS_CONN_ESTABLI_REQ MME code %u m-TMSI %u PLMN %X%X%X.%X%X%X",
|
||||
s_tmsi.MMEcode, s_tmsi.m_tmsi,
|
||||
plmnID.MCCdigit1, plmnID.MCCdigit2, plmnID.MCCdigit3,
|
||||
plmnID.MNCdigit1, plmnID.MNCdigit2, plmnID.MNCdigit3);
|
||||
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
|
||||
}
|
||||
|
||||
@@ -178,11 +141,5 @@ int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID,
|
||||
NAS_RAB_ESTABLI_RSP(message_p).s_tmsi = s_tmsi;
|
||||
NAS_RAB_ESTABLI_RSP(message_p).rabID = rabID;
|
||||
NAS_RAB_ESTABLI_RSP(message_p).errCode = errCode;
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_NAS_UE,
|
||||
MSC_RRC_UE,
|
||||
NULL,0,
|
||||
"0 NAS_RAB_ESTABLI_RSP MME code %u m-TMSI %u rb id %u status %u",
|
||||
s_tmsi.MMEcode, s_tmsi.m_tmsi,rabID, errCode );
|
||||
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "assertions.h"
|
||||
#include "intertask_interface.h"
|
||||
#include "esm_proc.h"
|
||||
#include "msc.h"
|
||||
|
||||
#ifndef NAS_ITTI_MESSAGING_H_
|
||||
#define NAS_ITTI_MESSAGING_H_
|
||||
|
||||
@@ -46,7 +46,6 @@ Description NAS procedure call manager
|
||||
|
||||
#include "esm_main.h"
|
||||
#include "esm_sap.h"
|
||||
#include "msc.h"
|
||||
|
||||
#include <stdio.h> // sprintf
|
||||
|
||||
|
||||
@@ -29,12 +29,9 @@
|
||||
# include "user_api.h"
|
||||
# include "nas_parser.h"
|
||||
# include "nas_proc.h"
|
||||
# include "msc.h"
|
||||
# include "memory.h"
|
||||
|
||||
#include "nas_user.h"
|
||||
#include <common/utils/msc/msc.h>
|
||||
|
||||
// FIXME make command line option for NAS_UE_AUTOSTART
|
||||
# define NAS_UE_AUTOSTART 1
|
||||
|
||||
@@ -97,7 +94,6 @@ void *nas_ue_task(void *args_p)
|
||||
nas_user_container_t *users=args_p;
|
||||
|
||||
itti_mark_task_ready (TASK_NAS_UE);
|
||||
MSC_START_USE();
|
||||
LOG_I(NAS, "ue_idx_standalone val:: %u\n", ue_idx_standalone);
|
||||
/* Initialize UE NAS (EURECOM-NAS) */
|
||||
// Intead of for loop for standalone mode
|
||||
|
||||