From 5e35d909747e31698d1e69b00c6bdd1ec35cb127 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 23 Jan 2019 16:53:52 +0100 Subject: [PATCH] CI: adding L2-NFAPI simulator test results to HTML report Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 8 +-- ci-scripts/reportTestLocally.sh | 124 ++++++++++++++++++++++++++++++++ ci-scripts/runTestOnVM.sh | 86 ++++++++++++++++++++-- nfapi/open-nFAPI/pnf/src/pnf.c | 5 +- 4 files changed, 212 insertions(+), 11 deletions(-) diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index b050eff60e..fc0290fc44 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -41,7 +41,7 @@ pipeline { disableConcurrentBuilds() timestamps() gitLabConnection('OAI GitLab') - gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Analysis with cppcheck", "Test phy-sim", "Test basic-sim", "Test-FDD-Band7", "Test-TDD-Band40", "Test-IF4p5-FDD-Band7", "Test-IF4p5-TDD-Band40"]) + gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Analysis with cppcheck", "Test phy-sim", "Test basic-sim", "Test L2-sim", "Test-FDD-Band7", "Test-TDD-Band40", "Test-IF4p5-FDD-Band7", "Test-IF4p5-TDD-Band40"]) ansiColor('xterm') } @@ -332,11 +332,11 @@ pipeline { } stage ("Test L2 simulator") { steps { - //gitlabCommitStatus(name: "Test basic-sim") { + gitlabCommitStatus(name: "Test L2-sim") { timeout (time: 30, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } - //} + } } } stage ("Build Flexran Controller") { @@ -534,7 +534,7 @@ pipeline { always { script { dir ('archives') { - sh "if [ -d basic_sim/test ] || [ -d phy_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi" + sh "if [ -d basic_sim/test ] || [ -d phy_sim/test ] || [ -d l2_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi" } if(fileExists('archives/vm_tests_logs.zip')) { archiveArtifacts artifacts: 'archives/vm_tests_logs.zip' diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index 60dcb1e421..004e021de1 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -417,6 +417,130 @@ function report_test { echo " " >> ./test_simulator_results.html fi + ARCHIVES_LOC=archives/l2_sim/test + if [ -d $ARCHIVES_LOC ] + then + echo "

L2-NFAPI Simulator Check

" >> ./test_simulator_results.html + + if [ -f $ARCHIVES_LOC/test_final_status.log ] + then + if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ] + then + echo "
" >> ./test_simulator_results.html + echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + else + echo "
" >> ./test_simulator_results.html + echo " TEST was a FAILURE! " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + else + echo "
" >> ./test_simulator_results.html + echo " COULD NOT DETERMINE TEST FINAL STATUS! " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + + echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + + TRANS_MODES=("fdd") + BW_CASES=(05) + for TMODE in ${TRANS_MODES[@]} + do + for BW in ${BW_CASES[@]} + do + ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log + UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"` + if [ -f $ENB_LOG ] && [ -f $UE_LOG ] + then + NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"` + NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG` + NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG` + NB_ENB_SYNCED_WITH_UE=`egrep -c "Sending NFAPI_START_RESPONSE" $UE_LOG` + if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 3 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] + then + echo " " >> ./test_simulator_results.html + else + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + fi + PING_CASE=$ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_epc.txt + if [ -f $PING_CASE ] + then + echo " " >> ./test_simulator_results.html + NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"` + echo " " >> ./test_simulator_results.html + CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"` + echo " " >> ./test_simulator_results.html + FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE` + if [ $FILE_COMPLETE -eq 0 ] + then + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + else + NB_TR_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s# packets transmitted.*##"` + NB_RC_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*packets transmitted, ##" -e "s# received,.*##"` + if [ $NB_TR_PACKETS -eq $NB_RC_PACKETS ] + then + echo " " >> ./test_simulator_results.html + else + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + fi + + done + done + + echo "
Log File NameCommandStatusStatistics
$NAME_ENB --- $NAME_UEN/AOKKO
" >> ./test_simulator_results.html
+                    if [ $NB_ENB_GOT_SYNC -eq 1 ]
+                    then
+                        echo "- eNB --> got sync" >> ./test_simulator_results.html
+                    else
+                        echo "- eNB NEVER got sync" >> ./test_simulator_results.html
+                    fi
+                    if [ $NB_UE_GOT_SYNC -eq 3 ]
+                    then
+                        echo "- UE --> got sync" >> ./test_simulator_results.html
+                    else
+                        echo "- UE NEVER got sync" >> ./test_simulator_results.html
+                    fi
+                    if [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
+                    then
+                        echo "- UE attached to eNB" >> ./test_simulator_results.html
+                    else
+                        echo "- UE NEVER attached to eNB" >> ./test_simulator_results.html
+                    fi
+                    echo "        
$NAME$CMDKON/AOKKO" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html
+                        STATS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*received, ##" -e "s#, time.*##" -e "s# packet loss##"`
+                        echo "Packet Loss : $STATS" >> ./test_simulator_results.html
+                        RTTMIN=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[1] " " $5}'`
+                        echo "RTT Minimal : $RTTMIN" >> ./test_simulator_results.html
+                        RTTAVG=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[2] " " $5}'`
+                        echo "RTT Average : $RTTAVG" >> ./test_simulator_results.html
+                        RTTMAX=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[3] " " $5}'`
+                        echo "RTT Maximal : $RTTMAX" >> ./test_simulator_results.html
+                        echo "            
" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + ARCHIVES_LOC=archives/phy_sim/test if [ -d $ARCHIVES_LOC ] then diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index 4d87ba5791..7ff04e23f8 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -148,6 +148,15 @@ function ping_ue_ip_addr { rm -f $1 } +function ping_epc_ip_addr { + echo "echo \"COMMAND IS: ping -I oip1 -c 20 $3\" > $4" > $1 + echo "rm -f $4" >> $1 + echo "ping -I oip1 -c 20 $3 | tee -a $4" >> $1 + cat $1 + ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 + rm -f $1 +} + function check_ping_result { local LOC_PING_FILE=$1 local LOC_NB_PINGS=$2 @@ -157,16 +166,19 @@ function check_ping_result { if [ $FILE_COMPLETE -eq 0 ] then PING_STATUS=-1 + echo "ping file incomplete" else local ALL_PACKET_RECEIVED=`egrep -c "$LOC_NB_PINGS received" $LOC_PING_FILE` if [ $ALL_PACKET_RECEIVED -eq 1 ] then echo "got all ping packets" else + echo "got NOT all ping packets" PING_STATUS=-1 fi fi else + echo "ping file not present" PING_STATUS=-1 fi } @@ -533,8 +545,30 @@ function start_l2_sim_enb { echo "sudo -E daemon --inherit --unsafe --name=enb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1 ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 - sleep 10 rm $1 + + local i="0" + echo "egrep -c \"Waiting for PHY_config_req\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1 + while [ $i -lt 10 ] + do + sleep 5 + CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1` + if [ $CONNECTED -ne 0 ] + then + i="100" + else + i=$[$i+1] + fi + done + rm $1 + if [ $i -lt 50 ] + then + ENB_SYNC=0 + echo "L2-SIM eNB is NOT sync'ed: process still alive?" + else + ENB_SYNC=1 + echo "L2-SIM eNB is sync'ed: waiting for UE(s) to connect" + fi } function start_l2_sim_ue { @@ -551,8 +585,31 @@ function start_l2_sim_ue { echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1 ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 - sleep 10 rm $1 + + local i="0" + echo "egrep -c \"Received NFAPI_START_REQ\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1 + while [ $i -lt 10 ] + do + sleep 5 + CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1` + if [ $CONNECTED -eq 1 ] + then + i="100" + else + i=$[$i+1] + fi + done + rm $1 + if [ $i -lt 50 ] + then + UE_SYNC=0 + echo "L2-SIM UE is NOT sync'ed w/eNB" + else + UE_SYNC=1 + echo "L2-SIM UE is sync'ed w/eNB" + fi + sleep 10 } function run_test_on_vm { @@ -1197,10 +1254,24 @@ function run_test_on_vm { echo "############################################################" CURRENT_UE_LOG_FILE=fdd_05MHz_ue.log start_l2_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE ue.nfapi.conf + if [ $UE_SYNC -eq 0 ] + then + echo "Problem w/ eNB and UE not syncing" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi - sleep 30 - echo "ping -I oip1 -c 20 $REAL_EPC_IP_ADDR" > $VM_CMDS - ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS + echo "############################################################" + echo "Pinging the EPC from UE" + echo "############################################################" + PING_LOG_FILE=fdd_05MHz_ping_epc.txt + ping_epc_ip_addr $VM_CMDS $VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC + check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 echo "############################################################" echo "Terminate enb/ue simulators" @@ -1226,6 +1297,11 @@ function run_test_on_vm { ssh-keygen -R $EPC_VM_IP_ADDR fi + echo "############################################################" + echo "Checking run status" + echo "############################################################" + + if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi if [ $STATUS -eq 0 ] then echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c index 0cacf8c66f..eec9ff80c3 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf.c +++ b/nfapi/open-nFAPI/pnf/src/pnf.c @@ -1237,11 +1237,11 @@ int pnf_connect(pnf_t* pnf) } struct addrinfo *p = servinfo; - int i = 0; int connected = 0; while(p != NULL && connected == 0) { +#ifdef NFAPI_TRACE_ENABLED char* family = "Unknown"; char* address = "Unknown"; char _addr[128]; @@ -1260,7 +1260,8 @@ int pnf_connect(pnf_t* pnf) address = inet_ntoa(addr->sin_addr); } - //NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); + NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); +#endif if (pnf->sctp) {