Commit c53171a9 authored by Navid Nikaein's avatar Navid Nikaein

*add eNB app to the oaisim

*update target and ASN1 readmes
*update oai test cases



git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4513 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent b2e4d83e
......@@ -2,7 +2,8 @@ ASN1 message from S1AP TS 36.413-8a0
To successfully parse messages, the asn1c util should be patched with the patch provided (asn1cpatch.p0).
To do so:
1) Get the last revision of asn1c: svn co https://github.com/vlm/asn1c/trunk -r 1516
0) create asn1c directory
1) Get the last revision of asn1c: svn co https://github.com/vlm/asn1c/trunk asn1c -r 1516
2) Go to asn1c directory
3) patch -p0 < ../asn1cpatch.p0
......
......@@ -25,7 +25,10 @@ http://lionet.info/asn1c/blog/
or via svn from sourceforge (version 0.9.22)
For version 0.9.2:
svn co https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk asn1c
For the latest version:
svn co https://github.com/vlm/asn1c/trunk asn1c
and put it in the asn1c directory (you should have a second asn1c directory now). Compile it and install it locally
(or make sure your $PATH can find the asn1c executable) according to the instructions given (see INSTALL file)
......
......@@ -52,7 +52,7 @@ The 3 folders have the following structures
follow the README.txt in OPENAIR2_DIR/RRC/LITE/MESSAGES to checkou the ASN.1 RRC messages
follow the OPENAIR2_DIR/RRC/LITE/MESSAGE/asn1c/asn1c/INSTALL to install the asn1c
go back to $OPENAIR_TARGET and "make install" if you have not used the shell script to install asn1c
- cd $OPENAIR_TARGET, and make a sanity check by doing make check
- cd $OPENAIR_TARGET/SIMU/USER, and make a sanity check by doing make pre-ci (require 15 minutes)
- Check out simple examples in $OPENAIR_TARGET/SIMU/EXAMPLES
4. to automatically bring up the oai interfaces and configure the default radio beares (usefull when sending data traffic):
......
......@@ -202,8 +202,8 @@ include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/Makefile.inc
include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
include $(OPENAIR2_DIR)/UTIL/Makefile.inc
include $(OPENAIR2_DIR)/S1AP/Makefile.inc
include $(OPENAIR2_DIR)/S1AP/MESSAGES/Makefile.inc
#include $(OPENAIR2_DIR)/S1AP/Makefile.inc
#include $(OPENAIR2_DIR)/S1AP/MESSAGES/Makefile.inc
ITTI_MESSAGES_H = messages_xml.h
......
......@@ -372,6 +372,123 @@ static s32 UE_id = 0, eNB_id = 0;
static s32 RN_id=0;
#endif
int itti_create_task_successful(void){
#if defined(ENABLE_ITTI)
# if defined(ENABLE_USE_MME)
if (itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) {
LOG_E(EMU, "Create task failed");
LOG_D(EMU, "Initializing SCTP task interface: FAILED\n");
return -1;
}
if (itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL) < 0) {
LOG_E(EMU, "Create task failed");
LOG_D(EMU, "Initializing S1AP task interface: FAILED\n");
return -1;
}
# endif
if (itti_create_task(TASK_ENB_APP, eNB_app_task, NULL) < 0) {
LOG_E(EMU, "Create task failed");
LOG_D(EMU, "Initializing eNB APP task interface: FAILED\n");
return -1;
}
if (itti_create_task(TASK_L2L1, l2l1_task, NULL) < 0) {
LOG_E(EMU, "Create task failed");
LOG_D(EMU, "Initializing L2L1 task interface: FAILED\n");
return -1;
}
#endif
return 1;
}
/*
* later, the enb task will be moved from here
*/
void *eNB_app_task(void *args_p) {
#if defined(ENABLE_ITTI)
MessageDef *message_p;
# if defined(ENABLE_USE_MME)
/* Trying to register each eNB */
for (eNB_id = oai_emulation.info.first_enb_local;
(eNB_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.cli_start_enb[eNB_id] == 1);
eNB_id++) {
char *mme_address_v4;
if (EPC_MODE_ENABLED){
mme_address_v4 = EPC_MODE_MME_ADDRESS;
}else {
mme_address_v4 = "192.168.12.87";
}
char *mme_address_v6 = "2001:660:5502:12:30da:829a:2343:b6cf";
s1ap_register_eNB_t *s1ap_register_eNB;
uint32_t hash;
//note: there is an implicit relationship between the data struct and the message name
message_p = itti_alloc_new_message(TASK_ENB_APP, S1AP_REGISTER_ENB);
s1ap_register_eNB = &message_p->msg.s1ap_register_eNB;
hash = s1ap_generate_eNB_id();
/* Some default/random parameters */
s1ap_register_eNB->eNB_id = eNB_id + (hash & 0xFFFF8);
s1ap_register_eNB->cell_type = CELL_MACRO_ENB;
s1ap_register_eNB->tac = 0;
s1ap_register_eNB->mcc = 208;
s1ap_register_eNB->mnc = 34;
s1ap_register_eNB->default_drx = PAGING_DRX_256;
s1ap_register_eNB->nb_mme = 1;
s1ap_register_eNB->mme_ip_address[0].ipv4 = 1;
s1ap_register_eNB->mme_ip_address[0].ipv6 = 0;
memcpy(s1ap_register_eNB->mme_ip_address[0].ipv4_address, mme_address_v4,
strlen(mme_address_v4));
memcpy(s1ap_register_eNB->mme_ip_address[0].ipv6_address, mme_address_v6,
strlen(mme_address_v6));
itti_send_msg_to_task(TASK_S1AP, eNB_id, message_p);
}
# endif
itti_mark_task_ready (TASK_ENB_APP); // at the end of init for the current task
do {
// Checks if a message has been sent to L2L1 task
itti_receive_msg (TASK_ENB_APP, &message_p);
if (message_p != NULL) {
switch (ITTI_MSG_ID(message_p)) {
case TERMINATE_MESSAGE:
itti_exit_task ();
break;
case MESSAGE_TEST:
LOG_D(EMU, "Received %s\n", ITTI_MSG_NAME(message_p));
break;
/* case MME_REGISTERED:
LOG_D(EMU, "Received %s\n", ITTI_MSG_NAME(message_p));
itti_mark_task_ready (TASK_L2L1);
break;
*/
default:
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
break;
}
free (message_p);
}
} while(1);
itti_terminate_tasks(TASK_ENB_APP);
return NULL;
#endif
}
void *l2l1_task(void *args_p) {
// Framing variables
s32 slot, last_slot, next_slot;
......@@ -388,13 +505,6 @@ void *l2l1_task(void *args_p) {
MessageDef *message_p;
itti_mark_task_ready (TASK_L2L1);
# if defined(ENABLE_USE_MME)
/* Trying to register each eNB */
for (eNB_id = oai_emulation.info.first_enb_local;
(eNB_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.cli_start_enb[eNB_id] == 1);
eNB_id++)
{
char *mme_address_v4;
if (EPC_MODE_ENABLED)
{
......@@ -433,7 +543,6 @@ void *l2l1_task(void *args_p) {
itti_send_msg_to_task(TASK_S1AP, eNB_id, message_p);
}
# endif
#endif
for (frame = 0; frame < oai_emulation.info.n_frames; frame++) {
......@@ -1045,39 +1154,24 @@ int main(int argc, char **argv) {
t = clock ();
LOG_N(EMU, "\n\n>>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
#if defined(ENABLE_ITTI)
# if defined(ENABLE_USE_MME)
if (itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) {
LOG_E(EMU, "Create task failed");
LOG_D(EMU, "Initializing SCTP task interface: FAILED\n");
return -1;
}
if (itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL) < 0) {
LOG_E(EMU, "Create task failed");
LOG_D(EMU, "Initializing S1AP task interface: FAILED\n");
return -1;
}
# endif
if (itti_create_task(TASK_L2L1, l2l1_task, NULL) < 0) {
LOG_E(EMU, "Create task failed");
LOG_D(EMU, "Initializing L2L1 task interface: FAILED\n");
return -1;
}
// Handle signals until all tasks are terminated
if (itti_create_task_successful())
itti_wait_tasks_end();
else
exit(-1);
#else
eNB_app_task(NULL); // do nothing for the moment
l2l1_task (NULL);
#endif
t = clock () - t;
printf ("rrc Duration of the simulation: %f seconds\n", ((float) t) / CLOCKS_PER_SEC);
LOG_I (EMU,"Duration of the simulation: %f seconds\n", ((float) t) / CLOCKS_PER_SEC);
// fclose(SINRpost);
LOG_I(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU Ending <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU Ending <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
free (otg_pdcp_buffer);
......
......@@ -41,6 +41,12 @@ int ulsch_abstraction(double* sinr_dB,u8 TM, u8 mcs,u16 nb_rb, u16 first_rb);
void calc_path_loss(node_desc_t* node_tx, node_desc_t* node_rx, channel_desc_t *ch_desc, Environment_System_Config env_desc, double **SF);
void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, uint32_t frame, u16 next_slot, LTE_DL_FRAME_PARMS *frame_parms);
#ifdef ENABLE_ITTI
int itti_create_task_successful(void);
void *eNB_app_task(void *args_p);
void *l2l1_task(void *args_p);
#endif
#ifdef OPENAIR2
int omv_write (int pfd, Node_list enb_node_list, Node_list ue_node_list, Data_Flow_Unit omv_data);
void omv_end (int pfd, Data_Flow_Unit omv_data);
......
......@@ -418,6 +418,7 @@ int olg_config() {
int ocg_log_level = map_str_to_int(log_level_names, oai_emulation.emulation_config.log_emu.level);
int ocg_log_verbosity= map_str_to_int(log_verbosity_names, oai_emulation.emulation_config.log_emu.verbosity);
LOG_I(EMU, "ocg log level %d, oai log level%d \n ",ocg_log_level, oai_emulation.info.g_log_level);
// fix me:
oai_emulation.info.g_log_level = ((oai_emulation.info.ocg_enabled == 1) && (ocg_log_level != -1)) ? ocg_log_level : oai_emulation.info.g_log_level;
oai_emulation.info.g_log_verbosity = (((oai_emulation.info.ocg_enabled == 1) && (ocg_log_verbosity != -1)) ? ocg_log_verbosity :
map_str_to_int(log_verbosity_names, oai_emulation.info.g_log_verbosity));
......
......@@ -375,7 +375,7 @@ void get_simulation_options(int argc, char *argv[]) {
ip_length > 16 ? 16 : ip_length);
}
#else
printf("You enabled MME mode without MME support...\n");
printf("You enabled MME mode without compiling using ENABLE_USE_MME=1 ...\n");
#endif
break;
case 'o':
......
......@@ -41,10 +41,9 @@ import core
makerr1 = '***'
makerr2 = 'Error 1'
def execute(oai, user, pw, logfile):
def execute(oai, user, pw, logfile,logdir):
case = '01'
logs_dir = 'pre-ci-logs';
oai.send('cd $OPENAIR_TARGETS;')
try:
......@@ -65,13 +64,14 @@ def execute(oai, user, pw, logfile):
log.ok(case, test, name, conf, '', logfile)
oai.send('cd SIMU/USER;')
oai.send('mkdir ' + logs_dir + ';')
oai.send('mkdir ' + logdir + ';')
try:
test = '01'
name = 'Compile oai.rel8.make'
conf = 'make'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = "check the compilation errors for oai"
oai.send('make cleanall;')
oai.send('make cleanasn1;')
......@@ -79,7 +79,7 @@ def execute(oai, user, pw, logfile):
oai.send_expect_false('make -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel8;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -92,14 +92,16 @@ def execute(oai, user, pw, logfile):
oai.send('rm -f ./oaisim.rel8.nas;')
oai.send('rm -f ./nasmesh;')
oai.send('make nasmesh_clean;')
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_1.txt;'
trace = logdir + '/log_' + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('make nasmesh_fix' + tee, makerr1, 60)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_2.txt;'
trace = logdir + '/log_' + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('make NAS=1 -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel8.nas;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -110,14 +112,15 @@ def execute(oai, user, pw, logfile):
test = '03'
name = 'Compile oai.rel8.rf.make'
conf = 'make RTAI=0 Rel8=1'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for Rel8'
oai.send('make cleanall;')
oai.send('rm -f ./oaisim.rel8.rf;')
oai.send_expect_false('make RTAI=0 -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel8.rf;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -128,14 +131,15 @@ def execute(oai, user, pw, logfile):
test = '04'
name = 'Compile oai.rel8.phy.dlsim.make'
conf = 'make dlsim'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for dlsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY'
oai.send('make clean;')
oai.send('rm -f ./dlsim.rel8;')
oai.send_expect_false('make dlsim -j4' + tee, makerr1, 1500)
oai.send('cp ./dlsim ./dlsim.rel8;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -143,14 +147,15 @@ def execute(oai, user, pw, logfile):
test = '05'
name = 'Compile oai.rel8.phy.ulsim.make'
conf = 'make ulsim'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for dlsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY'
oai.send('make clean;')
oai.send('rm -f ./ulsim.rel8;')
oai.send_expect_false('make ulsim -j4' + tee, makerr1, 1500)
oai.send('cp ./ulsim ./ulsim.rel8;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -161,7 +166,8 @@ def execute(oai, user, pw, logfile):
test = '06'
name = 'Compile oai.rel10.make'
conf = 'make Rel10=1'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for Rel10'
oai.send('make clean;')
oai.send('make cleanall;')
......@@ -170,7 +176,7 @@ def execute(oai, user, pw, logfile):
oai.send_expect_false('make Rel10=1 -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel10;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -178,7 +184,7 @@ def execute(oai, user, pw, logfile):
#test = '07'
#name = 'Compile oai.rel8.cellular.eNB.make'
#conf = 'make rrc_cellular=1 eNB_flag=1'
#tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
#tee = ' | tee ' + logdir + '/log_' + case + test + '.txt;'
#diag = 'check the compilation errors for eNB/RG RRC Cellular'
#oai.send('make clean;')
#oai.send('make cleanall;')
......@@ -197,7 +203,7 @@ def execute(oai, user, pw, logfile):
#test = '08'
#name = 'Compile oai.rel8.cellular.UE.make'
#conf = 'make rrc_cellular=1 UE_flag=1'
#tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
#tee = ' | tee ' + logdir + '/log_' + case + test + '.txt;'
#diag = 'check the compilation errors for UE/MT RRC Cellular'
#oai.send('make clean;')
#oai.send('make cleanall;')
......@@ -216,7 +222,7 @@ def execute(oai, user, pw, logfile):
#test = '09'
#name = 'Compile oai.rel8.cellular.nas.eNB'
#conf = 'make nas_sim_rg_cellular'
#tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
#tee = ' | tee ' + logdir + '/log_' + case + test + '.txt;'
#diag = 'check the compilation errors for NAS SIM RRC Cellular (node RG)'
#oai.send('make clean;')
#oai.send('make cleanall;')
......@@ -235,7 +241,7 @@ def execute(oai, user, pw, logfile):
#test = '10'
#name = 'Compile oai.rel8.cellular.nas.UE'
#conf = 'make nas_sim_mt_cellular'
#tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
#tee = ' | tee ' + logdir + '/log_' + case + test + '.txt;'
#diag = 'check the compilation errors for NAS SIM RRC Cellular (node MT)'
#oai.send('make clean;')
#oai.send('make cleanall;')
......@@ -254,7 +260,8 @@ def execute(oai, user, pw, logfile):
test = '11'
name = 'Compile oai.rel8.itti.make'
conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ITTI Rel8'
oai.send('make clean;')
oai.send('make cleanall;')
......@@ -263,14 +270,15 @@ def execute(oai, user, pw, logfile):
oai.send_expect_false('make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1 -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel8.itti;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '12'
name = 'Compile oai.rel10.itti.make'
conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel10=1'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt;'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ITTI Rel10'
oai.send('make clean;')
oai.send('make cleanall;')
......@@ -279,7 +287,7 @@ def execute(oai, user, pw, logfile):
oai.send_expect_false('make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel10=1 -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel10.itti;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -44,28 +44,29 @@ NUM_UE=2
NUM_eNB=1
NUM_TRIALS=3
def execute(oai, user, pw, logfile):
def execute(oai, user, pw, logfile,logdir):
case = '02'
logs_dir = 'pre-ci-logs';
oai.send('cd $OPENAIR_TARGETS;')
oai.send('cd SIMU/USER;')
oai.send('mkdir ' + logs_dir + ';')
try:
test = '00'
name = 'Run oai.rel8.sf'
conf = '-a -A AWGN -n 100'
diag = 'OAI is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_1.txt'
trace = logdir + '/log_' + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel8 ' + conf + tee, 'Segmentation fault', 30)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_2.txt'
trace = logdir + '/log_' + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel8 ' + conf + tee, 'Exiting', 30)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_3.txt'
trace = logdir + '/log_' + case + test + '_3.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel8 ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -73,7 +74,8 @@ def execute(oai, user, pw, logfile):
test = '01'
name = 'Run oai.rel8.err'
conf = '-a -A AWGN -n 100'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt'
trace = logdir + '/log_' + case + test + '_3.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'Error(s) found in the execution, check the execution logs'
oai.send_expect_false('./oaisim.rel8 ' + conf, '[E]', 30)
......@@ -89,10 +91,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-a -A AWGN -n' + str((i+1+j) * 40) + ' -u' + str(i+1) +' -b'+ str(j+1)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 50)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -104,7 +107,8 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-a -A AWGN -u' + str(i+1) +' -b'+ str(j+1)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
if user == 'root' :
oai.send_nowait('./oaisim.rel8.nas ' + conf + ' > /dev/null &')
else :
......@@ -124,7 +128,7 @@ def execute(oai, user, pw, logfile):
oai.rm_driver(oai,user,pw)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -135,10 +139,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -s15 -x1'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -149,10 +154,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -F -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -s15 -x1'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -163,10 +169,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-a -A AWGN -n' + str((i+1+j) * 40) + ' -u' + str(i+1) +' -b'+ str(j+1)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8.itti ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 50)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......
......@@ -44,28 +44,29 @@ NUM_UE=2
NUM_eNB=1
NUM_TRIALS=3
def execute(oai, user, pw, logfile):
def execute(oai, user, pw, logfile,logdir):
case = '03'
logs_dir = 'pre-ci-logs';
oai.send('cd $OPENAIR_TARGETS;')
oai.send('cd SIMU/USER;')
oai.send('mkdir ' + logs_dir + ';')
try:
test = '00'
name = 'Run oai.rel10.sf'
conf = '-a -A AWGN -n 100'
diag = 'OAI is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_1.txt'
trace = logdir + '/log_' + case + test + '_1.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel10 ' + conf + tee, 'Segmentation fault', 30)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_2.txt'
trace = logdir + '/log_' + case + test + '_2.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel10 ' + conf + tee, 'Exiting', 30)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_3.txt'
trace = logdir + '/log_' + case + test + '_3.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel10 ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, di69ag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -73,12 +74,13 @@ def execute(oai, user, pw, logfile):
test = '01'
name = 'Run oai.rel10.err'
conf = '-a -A AWGN -n 100'
tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
diag = 'Error(s) found in the execution, check the execution logs'
oai.send_expect_false('./oaisim.rel10 ' + conf + tee, '[E]', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -89,10 +91,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-a -A AWGN -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -103,10 +106,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -s 15 -x 1 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -117,10 +121,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -F -s 15 -x 1 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -131,10 +136,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -s 15 -x 1 -Q3 -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Found MBSFNAreaConfiguration from eNB ' + str(j), (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -145,10 +151,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -s 15 -x 1 -T mscbr -Q3 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Received a multicast packet', (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, 'Note: check the packet loss from the OTG stats', logfile)
......@@ -159,10 +166,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -F -s 15 -x 1 -T mscbr -Q3 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Received a multicast packet', (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, 'Note: check the packet loss from the OTG stats', logfile)
......@@ -185,10 +193,11 @@ def execute(oai, user, pw, logfile):
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -s 15 -x 1 -Q3 -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1)
tee = ' | tee ' + logs_dir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel10.itti ' + conf + tee, ' Found MBSFNAreaConfiguration from eNB ' + str(j), (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile)
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
......@@ -79,13 +79,14 @@ class core:
"---> " + self.clean(got) + "\n" +\
"=============================================================================\n"
def failed(self, command, expect):
def failed(self, command, expect,debug):
time.sleep(2)
ret = "================================= Failure =================================\n"
ret +="_________________________________ Sent ____________________________________\n"
ret +="---> " + command + "\n"
ret +="______________________________Searching for _______________________________\n"
ret +="---> " + self.clean(expect) + "\n"
if debug >= 1 :
ret +="________________________________ Received _________________________________\n"
ret +="---> " + self.clean(self.oai.before) + "\n"
ret +="_______________________________ Remaining _________________________________\n"
......@@ -129,7 +130,7 @@ class core:
# 2) wait for a return prompt. Don't capture the response.
# 3) Check for error or timeout.
# ************************************************************
def send(self, command, timeout = 50, rsp1=None, rsp2=None):
def send(self, command, timeout = 50, rsp1=None, rsp2=None,debug=0):
if not rsp1:
rsp1 = self.prompt1
if not rsp2:
......@@ -144,7 +145,7 @@ class core:
if self.expect_echo:
cmd = self.oai.expect([re.escape(command), pexpect.TIMEOUT], timeout=timeout);
if cmd != 0:
raise log.err(self.failed(command, command))
raise log.err(self.failed(command, command,debug))
if self.expect_response:
index = self.oai.expect([re.escape(rsp1), re.escape(rsp2),'%', pexpect.TIMEOUT], timeout=timeout)
......@@ -158,14 +159,14 @@ class core:
else:
return 'OK'
else:
raise log.err(self.failed(command, rsp1 + ' or ' + rsp2))
raise log.err(self.failed(command, rsp1 + ' or ' + rsp2,debug))
# **************************send_recv*************************
# 1) send a command
# 2) wait for either rsp1 or rsp2 is found (normally prompts)
# 3) return everything seen before that
# ************************************************************
def send_recv(self, command, timeout=50, rsp1=None, rsp2=None):
def send_recv(self, command, timeout=50, rsp1=None, rsp2=None,debug=0):
if not rsp1:
rsp1 = self.prompt1
if not rsp2:
......@@ -180,7 +181,7 @@ class core:
if index == 0 or index == 1:
return self.oai.before
else:
raise log.err(self.failed(command, rsp1 + ' or ' + rsp2))
raise log.err(self.failed(command, rsp1 + ' or ' + rsp2,debug))
# **************************send_expect*************************
......@@ -188,13 +189,13 @@ class core:
# 2) search for an expected pattern in the response
# 3) return a error if not found
# **************************************************************
def send_expect(self, command, expect, delay = 50, rsp1=None, rsp2=None):
def send_expect(self, command, expect, delay = 50, rsp1=None, rsp2=None,debug=0):
rsp = self.send_recv(command, delay, rsp1, rsp2)
# print rsp
if (rsp.find(expect) != -1):
return 'Ok'
raise log.err(self.failed(command, expect))
raise log.err(self.failed(command, expect,debug))
# **************************send_expect_re*************************
......@@ -202,27 +203,27 @@ class core:
# 2) search for an expected pattern defined by a regular expression in the response
# 3) return a error if not found
# *****************************************************************
def send_expect_re(self, command, expect, delay = 5, rsp1=None, rsp2=None):
def send_expect_re(self, command, expect, delay = 5, rsp1=None, rsp2=None,debug=0):
rsp = self.send_recv(command, delay, rsp1, rsp2)
# print rsp
match = re.compile(expect).search(rsp)
if match:
return match
raise log.err(self.failed(command, expect))
raise log.err(self.failed(command, expect,debug))
# **************************send_expect*************************
# 1) send a command, and optionally specify a the time to wait
# 2) search for an expected pattern defined by a re in the response
# 3) return ok if not found
# **************************************************************
def send_expect_false(self, command, expect, delay = 5, rsp1=None, rsp2=None):
def send_expect_false(self, command, expect, delay = 5, rsp1=None, rsp2=None,debug=0):
rsp = self.send_recv(command, delay, rsp1, rsp2)
# print rsp
if (rsp.find(expect) == -1):
return 'OK'
raise log.err(self.failed(command, expect))
raise log.err(self.failed(command, expect,debug))
# **************************send_wait*************************
......@@ -232,7 +233,7 @@ class core:
# 4) return an error if not found after the numtries
# 3) return the response if found
# **************************************************************
def send_wait(self, command, expect, numretries=3, rsp1=None, rsp2=None):
def send_wait(self, command, expect, numretries=3, rsp1=None, rsp2=None,debug=0):
timer = 0
for i in range(numretries):
rsp = self.send_recv(command, 10, rsp1, rsp2)
......@@ -240,7 +241,7 @@ class core:
return rsp;
time.sleep(2)
timer = timer+2
raise log.err(self.failed(command, expect))
raise log.err(self.failed(command, expect,debug))
# **************************send_wait_re*************************
# 1) send a command, and optionally specify a the time to wait
......@@ -249,7 +250,7 @@ class core:
# 4) return an error if not found after the numtries
# 3) return the response if found
# **************************************************************
def send_wait_re(self, command, expect, numretries=3, rsp1=None, rsp2=None):
def send_wait_re(self, command, expect, numretries=3, rsp1=None, rsp2=None,debug=0):
timer = 0
for i in range(numretries):
rsp = self.send_recv(command)
......@@ -258,7 +259,7 @@ class core:
return rsp;
time.sleep(2)
timer = timer+2
raise log.err(self.failed(command, expect))
raise log.err(self.failed(command, expect,debug))
# **************************send_wait_false*************************
# 1) send a command, and optionally specify a the time to wait
......@@ -266,7 +267,7 @@ class core:
# 3) return the response if not found
# 4) return an error if the pattern found after the numtries
# **************************************************************
def send_wait_false(self, command, expect, numretries=3, rsp1=None, rsp2=None):
def send_wait_false(self, command, expect, numretries=3, rsp1=None, rsp2=None,debug=0):
timer = 1
for i in range(numretries):
rsp = self.send_recv(command)
......@@ -274,7 +275,7 @@ class core:
return rsp;
time.sleep(2)
timer = timer+2
raise log.err(self.failed(command, expect))
raise log.err(self.failed(command, expect,debug))
# **************************send_wait_false*************************
# 1) send a command, and optionally specify a the time to wait
......@@ -282,7 +283,7 @@ class core:
# 3) return the response if not found
# 4) return an error if the pattern found after the numtries
# **************************************************************
def send_wait_false_re(self, command, expect, numretries=3, rsp1=None, rsp2=None):
def send_wait_false_re(self, command, expect, numretries=3, rsp1=None, rsp2=None,debug=0):
timer = 0
for i in range(numretries):
rsp = self.send_recv(command)
......@@ -290,7 +291,7 @@ class core:
return rsp;
time.sleep(2)
timer = timer+2
raise log.err(self.failed(command, expect))
raise log.err(self.failed(command, expect,debug))
# **************************find*************************
# 1) find an exact pattern in a given string
......
......@@ -128,12 +128,14 @@ def log_record(level, message):
else :
print message
def fail(case, testnum, testname, conf, message, diag, output):
def fail(case, testnum, testname, conf, message, diag, output,trace):
# report(case, testnum, testname, conf, 'failed', output, diag, message)
report(case, testnum, testname, conf, 'failed', output, diag)
log_record('failed', case + testnum + ' : ' + testname + ' ('+ conf+')')
if message :
log_record('failed', "Output follows:\n" + message )
if trace :
log_record('failed', "trace file can be found in " + trace + "\n" )
stats['failed'] += 1
def failquiet(case, testnum, testname, conf):
......
......@@ -97,6 +97,9 @@ except :
test = 'test01'
ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d.%Hh%M")
logfile = user+'.'+test+'.'+ctime+'.txt'
logdir = 'pre-ci-logs';
oai.send_nowait('mkdir -p -m 755' + logdir + ';')
#print '=================start the ' + test + ' at ' + ctime + '=================\n'
#print 'Results will be reported in log file : ' + logfile
log.writefile(logfile,'====================start'+test+' at ' + ctime + '=======================\n')
......@@ -106,9 +109,9 @@ oai.kill(user, pw)
oai.rm_driver(oai,user,pw)
# start te test cases
case01.execute(oai, user, pw, logfile)
case02.execute(oai, user, pw, logfile)
case03.execute(oai, user, pw, logfile)
case01.execute(oai, user, pw, logfile,logdir)
case02.execute(oai, user, pw, logfile,logdir)
case03.execute(oai, user, pw, logfile,logdir)
oai.kill(user, pw)
oai.rm_driver(oai,user,pw)
......
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