" >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
@@ -112,45 +232,61 @@ function report_test {
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
- echo " Build Start Time (UTC) " >> ./test_simulator_results.html
+ echo " Build Start Time (UTC) " >> ./test_simulator_results.html
echo " TEMPLATE_BUILD_TIME " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
- echo " GIT Repository " >> ./test_simulator_results.html
+ echo " GIT Repository " >> ./test_simulator_results.html
echo " $GIT_URL " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
- echo " Job Trigger " >> ./test_simulator_results.html
+ echo " Job Trigger " >> ./test_simulator_results.html
if [ $PU_TRIG -eq 1 ]; then echo " Push Event " >> ./test_simulator_results.html; fi
if [ $MR_TRIG -eq 1 ]; then echo " Merge-Request " >> ./test_simulator_results.html; fi
echo " " >> ./test_simulator_results.html
if [ $PU_TRIG -eq 1 ]
then
echo " " >> ./test_simulator_results.html
- echo " Branch " >> ./test_simulator_results.html
+ echo " Branch " >> ./test_simulator_results.html
echo " $SOURCE_BRANCH " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
- echo " Commit ID " >> ./test_simulator_results.html
+ echo " Commit ID " >> ./test_simulator_results.html
echo " $SOURCE_COMMIT_ID " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
+ if [ -e .git/CI_COMMIT_MSG ]
+ then
+ echo " " >> ./test_simulator_results.html
+ echo " Commit Message " >> ./test_simulator_results.html
+ MSG=`cat .git/CI_COMMIT_MSG`
+ echo " $MSG " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ fi
fi
if [ $MR_TRIG -eq 1 ]
then
echo " " >> ./test_simulator_results.html
- echo " Source Branch " >> ./test_simulator_results.html
+ echo " Source Branch " >> ./test_simulator_results.html
echo " $SOURCE_BRANCH " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
- echo " Source Commit ID " >> ./test_simulator_results.html
+ echo " Source Commit ID " >> ./test_simulator_results.html
echo " $SOURCE_COMMIT_ID " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
+ if [ -e .git/CI_COMMIT_MSG ]
+ then
+ echo " " >> ./test_simulator_results.html
+ echo " Commit Message " >> ./test_simulator_results.html
+ MSG=`cat .git/CI_COMMIT_MSG`
+ echo " $MSG " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ fi
echo " " >> ./test_simulator_results.html
- echo " Target Branch " >> ./test_simulator_results.html
+ echo " Target Branch " >> ./test_simulator_results.html
echo " $TARGET_BRANCH " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
- echo " Target Commit ID " >> ./test_simulator_results.html
+ echo " Target Commit ID " >> ./test_simulator_results.html
echo " $TARGET_COMMIT_ID " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
fi
@@ -162,6 +298,26 @@ function report_test {
then
echo " Basic 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 " More details on Basic Simulator test results " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
echo "
" >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
echo " Log File Name " >> ./test_simulator_results.html
@@ -174,6 +330,14 @@ function report_test {
BW_CASES=(05 10 20)
for TMODE in ${TRANS_MODES[@]}
do
+ echo " " >> ./test_simulator_results.html
+ if [[ $TMODE =~ .*fdd.* ]]
+ then
+ echo " Test in FDD " >> ./test_simulator_results.html
+ else
+ echo " Test in TDD " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
for BW in ${BW_CASES[@]}
do
ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log
@@ -238,128 +402,156 @@ function report_test {
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
fi
- PING_CASE=$ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt
- if [ -f $PING_CASE ]
- then
- echo " " >> ./test_simulator_results.html
- NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"`
- echo " $NAME " >> ./test_simulator_results.html
- CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"`
- echo " $CMD " >> ./test_simulator_results.html
- FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE`
- if [ $FILE_COMPLETE -eq 0 ]
- then
- echo " KO " >> ./test_simulator_results.html
- echo " N/A " >> ./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 " OK " >> ./test_simulator_results.html
- else
- echo " KO " >> ./test_simulator_results.html
- fi
- echo " " >> ./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
- fi
- echo " " >> ./test_simulator_results.html
- fi
+
+ PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt 2> /dev/null`
+ analyzePingFiles
- if [ -f $ARCHIVES_LOC/${TMODE}_${BW}*iperf*dl*client*txt ]
- then
- IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}*iperf*client*txt`
- else
- echo "There are no iperf files"
- IPERF_TESTS=""
- fi
- for IPERF_CASE in $IPERF_TESTS
- do
- echo " " >> ./test_simulator_results.html
- NAME=`echo $IPERF_CASE | sed -e "s#$ARCHIVES_LOC/##"`
- echo " $NAME " >> ./test_simulator_results.html
- CMD=`egrep "COMMAND IS" $IPERF_CASE | sed -e "s#COMMAND IS: ##"`
- echo " $CMD " >> ./test_simulator_results.html
- REQ_BITRATE=`echo $CMD | sed -e "s#^.*-b ##" -e "s#-i 1.*##"`
- if [[ $REQ_BITRATE =~ .*K.* ]]
- then
- REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#K##"`
- FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000.0" | bc -l`
- fi
- if [[ $REQ_BITRATE =~ .*M.* ]]
- then
- REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#M##"`
- FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000.0" | bc -l`
- fi
- if [[ $REQ_BITRATE =~ .*G.* ]]
- then
- REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#G##"`
- FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000000.0" | bc -l`
- fi
- FILE_COMPLETE=`egrep -c "Server Report" $IPERF_CASE`
- if [ $FILE_COMPLETE -eq 0 ]
- then
- echo " KO " >> ./test_simulator_results.html
- SERVER_FILE=`echo $IPERF_CASE | sed -e "s#client#server#"`
- FLOAT_EFF_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; printf "%.0f", br}'`
- EFFECTIVE_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; if(br>1000000){printf "%.2f MBits/sec", br/1000000}}'`
- PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'`
- JITTER=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*/sec *##" -e "s# *ms.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{jitter=s/n; printf "%.3f ms", jitter}'`
- PACKETLOSS_NOSIGN=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*(##" -e "s#%.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{per=s/n; printf "%.1f", per}'`
- PACKETLOSS=`echo "${PACKETLOSS_NOSIGN}%"`
- else
- EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
- if [[ $EFFECTIVE_BITRATE =~ .*Kbits/sec.* ]]
- then
- EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Kbits/sec.*##"`
- FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000" | bc -l`
- fi
- if [[ $EFFECTIVE_BITRATE =~ .*Mbits/sec.* ]]
- then
- EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Mbits/sec.*##"`
- FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000" | bc -l`
- fi
- if [[ $EFFECTIVE_BITRATE =~ .*Gbits/sec.* ]]
- then
- EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Gbits/sec.*##"`
- FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000000" | bc -l`
- fi
- PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'`
- PERF_INT=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.0f", $0}'`
- if [[ $PERF_INT -lt 90 ]]
- then
- echo " KO " >> ./test_simulator_results.html
- else
- echo " OK " >> ./test_simulator_results.html
- fi
- EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
- JITTER=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*Mbits/sec *##" -e "s#ms.*#ms#"`
- PACKETLOSS=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*(##" -e "s#).*##"`
- fi
- echo " " >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- echo "Bitrate : $EFFECTIVE_BITRATE" >> ./test_simulator_results.html
- echo "Bitrate Perf : $PERF %" >> ./test_simulator_results.html
- echo "Jitter : $JITTER" >> ./test_simulator_results.html
- echo "Packet Loss : $PACKETLOSS" >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- done
+ IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}*iperf*client*txt 2> /dev/null`
+ analyzeIperfFiles
done
done
echo "
" >> ./test_simulator_results.html
+ echo "
" >> ./test_simulator_results.html
+ fi
+
+ if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ]
+ then
+ echo " Basic Simulator + FlexRan Controller Check " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html
+ echo "
" >> ./test_simulator_results.html
+ echo " More details on Basic Simulator + Fleran Controller test results " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ echo "
" >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ echo " Log File Name " >> ./test_simulator_results.html
+ echo " JSON Query Response " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+
+ FLEXRAN_QUERIES=`ls $ARCHIVES_LOC/flexran_ctl_query_*log`
+ for QUERY in $FLEXRAN_QUERIES
+ do
+ echo " " >> ./test_simulator_results.html
+ NAME=`echo $QUERY | sed -e "s#$ARCHIVES_LOC/##"`
+ echo " $NAME " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ egrep -v "LOG_NAME|\-\-\-\-\-" $QUERY >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ done
+ echo "
" >> ./test_simulator_results.html
+ 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 " More details on L2-NFAPI Simulator test results " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ echo "
" >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ echo " Log File Name " >> ./test_simulator_results.html
+ echo " Command " >> ./test_simulator_results.html
+ echo " Status " >> ./test_simulator_results.html
+ echo " Statistics " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+
+ EPC_CONFIGS=("wS1" "noS1")
+ TRANS_MODES=("fdd")
+ BW_CASES=(05)
+ NB_USERS=(01 04)
+ for CN_CONFIG in ${EPC_CONFIGS[@]}
+ do
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ for BW in ${BW_CASES[@]}
+ do
+ for UES in ${NB_USERS[@]}
+ do
+ echo " " >> ./test_simulator_results.html
+ if [[ $CN_CONFIG =~ .*wS1.* ]]
+ then
+ echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}MHz -- ${UES} user(s) " >> ./test_simulator_results.html
+ else
+ echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}MHz -- ${UES} user(s) " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
+ ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_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 " $NAME_ENB --- $NAME_UE " >> ./test_simulator_results.html
+ echo " N/A " >> ./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 " OK " >> ./test_simulator_results.html
+ else
+ echo " KO " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./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 " " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ fi
+ PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping*.log 2> /dev/null`
+ analyzePingFiles
+
+ IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl*client*txt 2> /dev/null`
+ analyzeIperfFiles
+
+ IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul*client*txt 2> /dev/null`
+ analyzeIperfFiles
+ done
+ done
+ done
+ done
+
+ echo "
" >> ./test_simulator_results.html
+ echo "
" >> ./test_simulator_results.html
fi
ARCHIVES_LOC=archives/phy_sim/test
@@ -367,6 +559,24 @@ function report_test {
then
echo " Physical Simulators 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 " Log File Name " >> ./test_simulator_results.html
@@ -399,6 +609,10 @@ function report_test {
done
echo "
" >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+
+ echo " More details on Physical Simulators test results " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
echo "
Details " >> ./test_simulator_results.html
for XML_FILE in $XML_TESTS
@@ -449,6 +663,9 @@ function report_test {
done
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
}
diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh
index da6649ed05..f8958b9d1d 100755
--- a/ci-scripts/runTestOnVM.sh
+++ b/ci-scripts/runTestOnVM.sh
@@ -61,6 +61,7 @@ function start_basic_sim_enb {
local LOC_LOG_FILE=$4
local LOC_NB_RBS=$5
local LOC_CONF_FILE=$6
+ local LOC_FLEXRAN_CTL_IP_ADRR=$7
echo "cd /home/ubuntu/tmp" > $1
echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1
echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
@@ -71,6 +72,12 @@ function start_basic_sim_enb {
echo "cd ci-scripts/conf_files/" >> $1
echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1
echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
+ if [[ $LOC_FLEXRAN_CTL_IP_ADRR =~ .*none.* ]]
+ then
+ echo "sed -i -e 's#CI_FLEXRAN_CTL_IP_ADDR#127.0.0.1#' ci-$LOC_CONF_FILE" >> $1
+ else
+ echo "sed -i -e 's#FLEXRAN_ENABLED = .*no.*;#FLEXRAN_ENABLED = \"yes\";#' -e 's#CI_FLEXRAN_CTL_IP_ADDR#$LOC_FLEXRAN_CTL_IP_ADRR#' ci-$LOC_CONF_FILE" >> $1
+ fi
echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1
echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1
echo "echo \"cd /home/ubuntu/tmp/cmake_targets/basic_simulator/enb/\"" >> $1
@@ -83,9 +90,33 @@ function start_basic_sim_enb {
echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
echo "sudo -E daemon --inherit --unsafe --name=enb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/basic_simulator/enb -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
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1
rm $1
+ sleep 5
+
+ local i="0"
+ echo "egrep -c \"got sync\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1
+ while [ $i -lt 10 ]
+ do
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1`
+ if [ $CONNECTED -ne 0 ]
+ then
+ i="100"
+ else
+ sleep 5
+ i=$[$i+1]
+ fi
+ done
+ ENB_SYNC=0
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ ENB_SYNC=0
+ echo "Basic-Sim eNB: eNB did NOT got sync"
+ else
+ echo "Basic-Sim eNB: eNB GOT SYNC --> waiting for UE to connect"
+ fi
+ sleep 5
}
function start_basic_sim_ue {
@@ -101,15 +132,15 @@ function start_basic_sim_ue {
echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE; fi" >> $1
echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp/cmake_targets/basic_simulator/ue -o /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE ./my-lte-uesoftmodem-run.sh" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm $1
local i="0"
- echo "ifconfig oip1 | egrep -c \"inet addr\"" > $1
+ echo "ifconfig oaitun_ue1 | egrep -c \"inet addr\"" > $1
while [ $i -lt 10 ]
do
sleep 5
- CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1`
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1`
if [ $CONNECTED -eq 1 ]
then
i="100"
@@ -117,27 +148,96 @@ function start_basic_sim_ue {
i=$[$i+1]
fi
done
+ UE_SYNC=1
rm $1
if [ $i -lt 50 ]
then
UE_SYNC=0
+ echo "Basic-Sim UE: oaitun_ue1 is DOWN and/or NOT CONFIGURED"
else
- UE_SYNC=1
+ echo "Basic-Sim UE: oaitun_ue1 is UP and CONFIGURED"
+ fi
+ i="0"
+ echo "egrep -c \"Generating RRCConnectionReconfigurationComplete\" /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE" > $1
+ while [ $i -lt 10 ]
+ do
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1`
+ if [ $CONNECTED -ne 0 ]
+ then
+ i="100"
+ else
+ sleep 5
+ i=$[$i+1]
+ fi
+ done
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ UE_SYNC=0
+ echo "Basic-Sim UE: UE did NOT complete RRC Connection"
+ else
+ echo "Basic-Sim UE: UE did COMPLETE RRC Connection"
fi
}
function get_ue_ip_addr {
- echo "ifconfig oip1 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1
- UE_IP_ADDR=`ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1`
- echo "UE IP Address for EPC is : $UE_IP_ADDR"
+ local LOC_IF_ID=$3
+ echo "ifconfig oaitun_ue${LOC_IF_ID} | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1
+ UE_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1`
+ echo "Test UE${LOC_IF_ID} IP Address is : $UE_IP_ADDR"
+ rm $1
+}
+
+function get_enb_noS1_ip_addr {
+ echo "ifconfig oaitun_enb1 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1
+ ENB_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1`
+ echo "Test eNB IP Address is : $ENB_IP_ADDR"
rm $1
}
function ping_ue_ip_addr {
- echo "echo \"ping -c 20 $3\"" > $1
+ local LOC_FG_OR_BG=$5
echo "echo \"COMMAND IS: ping -c 20 $3\" > $4" > $1
- echo "ping -c 20 $UE_IP_ADDR | tee -a $4" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ echo "echo \"ping -c 20 $3\"" >> $1
+ if [ $LOC_FG_OR_BG -eq 0 ]
+ then
+ echo "ping -c 20 $UE_IP_ADDR >> $4 2>&1" >> $1
+ echo "tail -3 $4" >> $1
+ else
+ echo "nohup ping -c 20 $UE_IP_ADDR >> $4 &" >> $1
+ fi
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ rm -f $1
+}
+
+function ping_epc_ip_addr {
+ local LOC_IF_ID=$5
+ local LOC_FG_OR_BG=$6
+ echo "echo \"COMMAND IS: ping -I oaitun_ue${LOC_IF_ID} -c 20 $3\" > $4" > $1
+ echo "echo \"ping -I oaitun_ue${LOC_IF_ID} -c 20 $3\"" >> $1
+ if [ $LOC_FG_OR_BG -eq 0 ]
+ then
+ echo "ping -I oaitun_ue${LOC_IF_ID} -c 20 $3 >> $4 2>&1" >> $1
+ echo "tail -3 $4" >> $1
+ else
+ echo "nohup ping -I oaitun_ue${LOC_IF_ID} -c 20 $3 >> $4 &" >> $1
+ fi
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ rm -f $1
+}
+
+function ping_enb_ip_addr {
+ local LOC_FG_OR_BG=$5
+ echo "echo \"COMMAND IS: ping -I oaitun_enb1 -c 20 $3\" > $4" > $1
+ echo "echo \"ping -I oaitun_enb1 -c 20 $3\"" >> $1
+ if [ $LOC_FG_OR_BG -eq 0 ]
+ then
+ echo "ping -I oaitun_enb1 -c 20 $3 >> $4 2>&1" >> $1
+ echo "tail -3 $4" >> $1
+ else
+ echo "nohup ping -I oaitun_enb1 -c 20 $3 >> $4 &" >> $1
+ fi
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm -f $1
}
@@ -150,108 +250,165 @@ 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
- PING_STATUS=-1
+ LOC_NB_PINGS=$[$2-1]
+ ALL_PACKET_RECEIVED=`egrep -c "$LOC_NB_PINGS received" $LOC_PING_FILE`
+ if [ $ALL_PACKET_RECEIVED -eq 1 ]
+ then
+ echo "got almost all ping packets"
+ else
+ echo "got NOT all ping packets"
+ PING_STATUS=-1
+ fi
fi
fi
else
+ echo "ping file not present"
PING_STATUS=-1
fi
}
-function iperf_dl {
- local REQ_BANDWIDTH=$5
- local BASE_LOG_FILE=$6
- echo "echo \"iperf -u -s -i 1\"" > $1
- echo "echo \"COMMAND IS: iperf -u -s -i 1\" > tmp/cmake_targets/log/${BASE_LOG_FILE}_server.txt" > $1
- echo "nohup iperf -u -s -i 1 >> tmp/cmake_targets/log/${BASE_LOG_FILE}_server.txt &" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
- rm $1
+# In DL: iperf server should be on UE side
+# -B oaitun_ue{j}-IP-Addr
+# iperf client should be on EPC (S1) or eNB (noS1) side
+# -c oaitun_ue{j}-IP-Addr -B oaitun_enb1-IP-Addr (in noS1)
+# In UL: iperf server should be on EPC (S1) or eNB (noS1) side
+# -B oaitun_enb1-IP-Addr
+# iperf client should be on UE side
+# -c oaitun_enb1-IP-Addr -B oaitun_ue{j}-IP-Addr (in noS1)
+function generic_iperf {
+ local LOC_ISERVER_CMD=$1
+ local LOC_ISERVER_IP=$2
+ local LOC_ISERVER_BOND_IP=$3
+ local LOC_ICLIENT_CMD=$4
+ local LOC_ICLIENT_IP=$5
+ local LOC_ICLIENT_BOND_IP=$6
+ local LOC_REQ_BANDWIDTH=$7
+ local LOC_BASE_LOG_FILE=$8
+ local LOC_PORT_ID=$[$9+5001]
+ local LOC_FG_OR_BG=${10}
+ # Starting Iperf Server
+ echo "iperf -B ${LOC_ISERVER_BOND_IP} -u -s -i 1 -fm -p ${LOC_PORT_ID}"
+ echo "nohup iperf -B ${LOC_ISERVER_BOND_IP} -u -s -i 1 -fm -p ${LOC_PORT_ID} > ${LOC_BASE_LOG_FILE}_server.txt 2>&1 &" > ${LOC_ISERVER_CMD}
+ ssh -T -o StrictHostKeyChecking=no ubuntu@${LOC_ISERVER_IP} < ${LOC_ISERVER_CMD}
+ rm ${LOC_ISERVER_CMD}
- echo "echo \"iperf -c $UE_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1\"" > $3
- echo "echo \"COMMAND IS: iperf -c $UE_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1\" > ${BASE_LOG_FILE}_client.txt" > $3
- echo "iperf -c $UE_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1 | tee -a ${BASE_LOG_FILE}_client.txt" >> $3
- ssh -o StrictHostKeyChecking=no ubuntu@$4 < $3
- rm -f $3
+ # Starting Iperf Client
+ echo "iperf -c ${LOC_ISERVER_BOND_IP} -u -t 30 -b ${LOC_REQ_BANDWIDTH}M -i 1 -fm -B ${LOC_ICLIENT_BOND_IP} -p ${LOC_PORT_ID}"
+ echo "echo \"COMMAND IS: iperf -c ${LOC_ISERVER_BOND_IP} -u -t 30 -b ${LOC_REQ_BANDWIDTH}M -i 1 -fm -B ${LOC_ICLIENT_BOND_IP} -p ${LOC_PORT_ID}\" > ${LOC_BASE_LOG_FILE}_client.txt" > ${LOC_ICLIENT_CMD}
+ if [ $LOC_FG_OR_BG -eq 0 ]
+ then
+ echo "iperf -c ${LOC_ISERVER_BOND_IP} -u -t 30 -b ${LOC_REQ_BANDWIDTH}M -i 1 -fm -B ${LOC_ICLIENT_BOND_IP} -p ${LOC_PORT_ID} >> ${LOC_BASE_LOG_FILE}_client.txt 2>&1" >> ${LOC_ICLIENT_CMD}
+ echo "tail -3 ${LOC_BASE_LOG_FILE}_client.txt | grep -v datagram" >> ${LOC_ICLIENT_CMD}
+ else
+ echo "nohup iperf -c ${LOC_ISERVER_BOND_IP} -u -t 30 -b ${LOC_REQ_BANDWIDTH}M -i 1 -fm -B ${LOC_ICLIENT_BOND_IP} -p ${LOC_PORT_ID} >> ${LOC_BASE_LOG_FILE}_client.txt 2>&1 &" >> ${LOC_ICLIENT_CMD}
+ fi
+ ssh -T -o StrictHostKeyChecking=no ubuntu@${LOC_ICLIENT_IP} < ${LOC_ICLIENT_CMD}
+ rm -f ${LOC_ICLIENT_CMD}
- echo "killall --signal SIGKILL iperf" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
- rm $1
-}
-
-function iperf_ul {
- local REQ_BANDWIDTH=$5
- local BASE_LOG_FILE=$6
- echo "echo \"iperf -u -s -i 1\"" > $3
- echo "echo \"COMMAND IS: iperf -u -s -i 1\" > ${BASE_LOG_FILE}_server.txt" > $3
- echo "nohup iperf -u -s -i 1 >> ${BASE_LOG_FILE}_server.txt &" >> $3
- ssh -o StrictHostKeyChecking=no ubuntu@$4 < $3
- rm $3
-
- echo "echo \"iperf -c $REAL_EPC_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1\"" > $1
- echo "echo \"COMMAND IS: iperf -c $REAL_EPC_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1\" > /home/ubuntu/tmp/cmake_targets/log/${BASE_LOG_FILE}_client.txt" > $1
- echo "iperf -c $REAL_EPC_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1 | tee -a /home/ubuntu/tmp/cmake_targets/log/${BASE_LOG_FILE}_client.txt" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
- rm -f $1
-
- echo "killall --signal SIGKILL iperf" >> $3
- ssh -o StrictHostKeyChecking=no ubuntu@$4 < $3
- rm $3
+ # Stopping Iperf Server
+ if [ $LOC_FG_OR_BG -eq 0 ]
+ then
+ echo "killall --signal SIGKILL iperf"
+ echo "killall --signal SIGKILL iperf" > ${LOC_ISERVER_CMD}
+ ssh -T -o StrictHostKeyChecking=no ubuntu@${LOC_ISERVER_IP} < ${LOC_ISERVER_CMD}
+ rm ${LOC_ISERVER_CMD}
+ fi
}
function check_iperf {
local LOC_BASE_LOG=$1
local LOC_REQ_BW=$2
local LOC_REQ_BW_MINUS_ONE=`echo "$LOC_REQ_BW - 1" | bc -l`
+ local LOC_REQ_BW_MINUS_TWO=`echo "$LOC_REQ_BW - 2" | bc -l`
+ local LOC_REQ_BW_MINUS_THREE=`echo "$LOC_REQ_BW - 3" | bc -l`
+ local LOC_IS_DL=`echo $LOC_BASE_LOG | grep -c _dl`
+ local LOC_IS_BASIC_SIM=`echo $LOC_BASE_LOG | grep -c basic_sim`
if [ -f ${LOC_BASE_LOG}_client.txt ]
then
local FILE_COMPLETE=`egrep -c "Server Report" ${LOC_BASE_LOG}_client.txt`
if [ $FILE_COMPLETE -eq 0 ]
then
IPERF_STATUS=-1
+ echo "File Report not found"
else
local EFFECTIVE_BANDWIDTH=`tail -n3 ${LOC_BASE_LOG}_client.txt | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
- if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*Mbits.* ]]
+ if [ $LOC_IS_DL -eq 1 ] && [ $LOC_IS_BASIC_SIM -eq 1 ]
then
- echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
+ if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_TWO}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_THREE}.*Mbits.* ]]
+ then
+ echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
+ else
+ echo "got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
+ IPERF_STATUS=-1
+ fi
else
- IPERF_STATUS=-1
+ if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*Mbits.* ]]
+ then
+ if [ $LOC_IS_DL -eq 1 ]
+ then
+ echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
+ else
+ echo "got requested UL bandwidth: $EFFECTIVE_BANDWIDTH"
+ fi
+ else
+ echo "not basic-sim got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
+ IPERF_STATUS=-1
+ fi
fi
fi
else
IPERF_STATUS=-1
+ echo "File not found"
fi
}
function terminate_enb_ue_basic_sim {
+ # mode = 0 : eNB + UE
+ # mode = 1 : eNB
+ # mode = 2 : UE
+ local LOC_MODE=$3
echo "NB_OAI_PROCESSES=\`ps -aux | grep modem | grep -v grep | grep -c softmodem\`" > $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo daemon --name=enb_daemon --stop\"; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo daemon --name=enb_daemon --stop; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo daemon --name=ue_daemon --stop\"; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo daemon --name=ue_daemon --stop; fi" >> $1
+ if [ $LOC_MODE -eq 0 ] || [ $LOC_MODE -eq 1 ]
+ then
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo daemon --name=enb_daemon --stop\"; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo daemon --name=enb_daemon --stop; fi" >> $1
+ fi
+ if [ $LOC_MODE -eq 0 ] || [ $LOC_MODE -eq 2 ]
+ then
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo daemon --name=ue_daemon --stop\"; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo daemon --name=ue_daemon --stop; fi" >> $1
+ fi
echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi" >> $1
echo "echo \"ps -aux | grep softmodem\"" >> $1
echo "ps -aux | grep softmodem | grep -v grep" >> $1
echo "NB_OAI_PROCESSES=\`ps -aux | grep modem | grep -v grep | grep -c softmodem\`" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGINT lte-softmodem\"; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGINT lte-softmodem; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi" >> $1
+ if [ $LOC_MODE -eq 0 ] || [ $LOC_MODE -eq 1 ]
+ then
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGINT lte-softmodem\"; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGINT lte-softmodem; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi" >> $1
+ echo "echo \"ps -aux | grep softmodem\"" >> $1
+ echo "ps -aux | grep softmodem | grep -v grep" >> $1
+ echo "NB_OAI_PROCESSES=\`ps -aux | grep modem | grep -v grep | grep -c softmodem\`" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGKILL lte-softmodem\"; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGKILL lte-softmodem; fi" >> $1
+ fi
+ if [ $LOC_MODE -eq 0 ] || [ $LOC_MODE -eq 2 ]
+ then
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGKILL lte-uesoftmodem\"; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGKILL lte-uesoftmodem; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi" >> $1
+ fi
echo "echo \"ps -aux | grep softmodem\"" >> $1
echo "ps -aux | grep softmodem | grep -v grep" >> $1
- echo "NB_OAI_PROCESSES=\`ps -aux | grep modem | grep -v grep | grep -c softmodem\`" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGKILL lte-softmodem\"; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGKILL lte-softmodem; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGKILL lte-uesoftmodem\"; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGKILL lte-uesoftmodem; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi" >> $1
- echo "echo \"ps -aux | grep softmodem\"" >> $1
- echo "ps -aux | grep softmodem | grep -v grep" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm -f $1
}
@@ -267,46 +424,730 @@ function recover_core_dump {
echo "sudo rm core" >> $1
echo "rm ci-lte-basic-sim.conf" >> $1
echo "sync" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/basic_simulator/enb/basic-simulator-enb-core-${TC}.bz2 $4
rm -f $1
fi
}
-function terminate_ltebox_epc {
- echo "echo \"cd /opt/ltebox/tools\"" > $1
- echo "cd /opt/ltebox/tools" >> $1
- echo "echo \"sudo ./stop_ltebox\"" >> $1
- echo "sudo ./stop_ltebox" >> $1
- echo "echo \"sudo daemon --name=simulated_hss --stop\"" >> $1
- echo "sudo daemon --name=simulated_hss --stop" >> $1
- echo "echo \"sudo killall --signal SIGKILL hss_sim\"" >> $1
- echo "sudo killall --signal SIGKILL hss_sim" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+function full_terminate {
+ echo "############################################################"
+ echo "Terminate enb/ue simulators"
+ echo "############################################################"
+ terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0
+ 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
+ recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ sleep 10
+}
+
+function full_basic_sim_destroy {
+ if [ $KEEP_VM_ALIVE -eq 0 ]
+ then
+ echo "############################################################"
+ echo "Destroying VMs"
+ echo "############################################################"
+ uvt-kvm destroy $VM_NAME
+ ssh-keygen -R $VM_IP_ADDR
+ if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ]
+ then
+ uvt-kvm destroy $FLEXRAN_CTL_VM_NAME
+ ssh-keygen -R $FLEXRAN_CTL_VM_IP_ADDR
+ fi
+ fi
+}
+
+function install_epc_on_vm {
+ local LOC_EPC_VM_NAME=$1
+ local LOC_EPC_VM_CMDS=$2
+
+ if [ -d /opt/ltebox-archives/ ]
+ then
+ # Checking if all ltebox archives are available to run ltebx epc on a brand new VM
+ if [ -f /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ] && [ -f /opt/ltebox-archives/etc-conf.zip ] && [ -f /opt/ltebox-archives/hss-sim-develop.zip ]
+ then
+ echo "############################################################"
+ echo "Destroying VM"
+ echo "############################################################"
+ uvt-kvm destroy $VM_NAME
+ ssh-keygen -R $VM_IP_ADDR
+ fi
+ rm -f $VM_CMDS
+
+ # Do we need to start the EPC VM
+ echo "EPC_VM_CMD_FILE = $LOC_EPC_VM_CMDS"
+ IS_EPC_VM_ALIVE=`uvt-kvm list | grep -c $LOC_EPC_VM_NAME`
+ if [ $IS_EPC_VM_ALIVE -eq 0 ]
+ then
+ echo "############################################################"
+ echo "Creating test EPC VM ($LOC_EPC_VM_NAME) on Ubuntu Cloud Image base"
+ echo "############################################################"
+ acquire_vm_create_lock
+ uvt-kvm create $LOC_EPC_VM_NAME release=xenial --unsafe-caching
+ echo "Waiting for VM to be started"
+ uvt-kvm wait $LOC_EPC_VM_NAME --insecure
+ release_vm_create_lock
+ else
+ echo "Waiting for VM to be started"
+ uvt-kvm wait $LOC_EPC_VM_NAME --insecure
+ fi
+
+ local LOC_EPC_VM_IP_ADDR=`uvt-kvm ip $LOC_EPC_VM_NAME`
+
+ echo "$LOC_EPC_VM_NAME has for IP addr = $LOC_EPC_VM_IP_ADDR"
+ scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
+
+ # ltebox specific actions (install and start)
+ LTE_BOX_TO_INSTALL=1
+ if [ $LTEBOX -eq 1 ]
+ then
+ echo "ls -ls /opt/ltebox/tools/start_ltebox" > $LOC_EPC_VM_CMDS
+ RESPONSE=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
+ NB_EXES=`echo $RESPONSE | grep -c ltebox`
+ if [ $NB_EXES -eq 1 ]; then LTE_BOX_TO_INSTALL=0; fi
+ fi
+
+ if [ $LTEBOX -eq 1 ] && [ $LTE_BOX_TO_INSTALL -eq 1 ]
+ then
+ echo "############################################################"
+ echo "Copying ltebox archives into EPC VM ($LOC_EPC_VM_NAME)"
+ echo "############################################################"
+ scp -o StrictHostKeyChecking=no /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
+ scp -o StrictHostKeyChecking=no /opt/ltebox-archives/etc-conf.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
+ scp -o StrictHostKeyChecking=no /opt/ltebox-archives/hss-sim-develop.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
+
+ echo "############################################################"
+ echo "Install EPC on EPC VM ($LOC_EPC_VM_NAME)"
+ echo "############################################################"
+ echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $LOC_EPC_VM_CMDS
+ echo "touch /home/ubuntu/.hushlogin" >> $LOC_EPC_VM_CMDS
+ echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $LOC_EPC_VM_CMDS
+ echo "sudo apt-get update > zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS
+ echo "sudo apt-get --yes install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf >> zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS
+
+ # Installing HSS
+ echo "echo \"cd /opt\"" >> $LOC_EPC_VM_CMDS
+ echo "cd /opt" >> $LOC_EPC_VM_CMDS
+ echo "echo \"sudo unzip -qq /home/ubuntu/hss-sim-develop.zip\"" >> $LOC_EPC_VM_CMDS
+ echo "sudo unzip -qq /home/ubuntu/hss-sim-develop.zip" >> $LOC_EPC_VM_CMDS
+ echo "echo \"cd /opt/hss_sim0609\"" >> $LOC_EPC_VM_CMDS
+ echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS
+
+ # Installing ltebox
+ echo "echo \"cd /home/ubuntu\"" >> $LOC_EPC_VM_CMDS
+ echo "cd /home/ubuntu" >> $LOC_EPC_VM_CMDS
+ echo "echo \"sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb \"" >> $LOC_EPC_VM_CMDS
+ echo "sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb >> zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS
+
+ echo "echo \"cd /opt/ltebox/etc/\"" >> $LOC_EPC_VM_CMDS
+ echo "cd /opt/ltebox/etc/" >> $LOC_EPC_VM_CMDS
+ echo "echo \"sudo unzip -qq -o /home/ubuntu/etc-conf.zip\"" >> $LOC_EPC_VM_CMDS
+ echo "sudo unzip -qq -o /home/ubuntu/etc-conf.zip" >> $LOC_EPC_VM_CMDS
+ echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$LOC_EPC_VM_IP_ADDR#' gw.conf" >> $LOC_EPC_VM_CMDS
+ echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$LOC_EPC_VM_IP_ADDR#' mme.conf" >> $LOC_EPC_VM_CMDS
+
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS
+ rm -f $LOC_EPC_VM_CMDS
+ fi
+}
+
+function add_user_to_epc_lists {
+ local LOC_EPC_VM_CMDS=$1
+ local LOC_EPC_VM_IP_ADDR=$2
+ local LOC_NB_USERS=$3
+ if [ $LTEBOX -eq 1 ]
+ then
+ scp -o StrictHostKeyChecking=no $JENKINS_WKSP/ci-scripts/add_user_to_subscriber_list.awk ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu/
+ echo "cd /opt/hss_sim0609" > $LOC_EPC_VM_CMDS
+ echo "if [ -e subscriber.data.orig ]; then sudo mv subscriber.data.orig subscriber.data; fi" >> $1
+ echo "if [ -e profile.data.orig ]; then sudo mv profile.data.orig profile.data; fi" >> $1
+ echo "sudo cp subscriber.data subscriber.data.orig" >> $LOC_EPC_VM_CMDS
+ echo "sudo cp profile.data profile.data.orig" >> $LOC_EPC_VM_CMDS
+ echo "sudo awk -v num_ues=$LOC_NB_USERS -f /home/ubuntu/add_user_to_subscriber_list.awk subscriber.data.orig > /tmp/subscriber.data" >> $LOC_EPC_VM_CMDS
+ echo "sudo awk -v num_ues=$LOC_NB_USERS -f /home/ubuntu/add_user_to_subscriber_list.awk profile.data.orig > /tmp/profile.data" >> $LOC_EPC_VM_CMDS
+ echo "sudo cp /tmp/subscriber.data subscriber.data" >> $LOC_EPC_VM_CMDS
+ echo "sudo cp /tmp/profile.data profile.data" >> $LOC_EPC_VM_CMDS
+
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS
+ rm -f $LOC_EPC_VM_CMDS
+ fi
+}
+
+function start_epc {
+ local LOC_EPC_VM_NAME=$1
+ local LOC_EPC_VM_CMDS=$2
+ local LOC_EPC_VM_IP_ADDR=$3
+
+ if [ $LTEBOX -eq 1 ]
+ then
+ echo "############################################################"
+ echo "Start EPC on EPC VM ($LOC_EPC_VM_NAME)"
+ echo "############################################################"
+ echo "echo \"cd /opt/hss_sim0609\"" > $LOC_EPC_VM_CMDS
+ echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS
+ echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $LOC_EPC_VM_CMDS
+ echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $LOC_EPC_VM_CMDS
+
+ echo "echo \"cd /opt/ltebox/tools/\"" >> $LOC_EPC_VM_CMDS
+ echo "cd /opt/ltebox/tools/" >> $LOC_EPC_VM_CMDS
+ echo "echo \"sudo ./start_ltebox\"" >> $LOC_EPC_VM_CMDS
+ echo "nohup sudo ./start_ltebox > /home/ubuntu/ltebox.txt" >> $LOC_EPC_VM_CMDS
+ echo "touch /home/ubuntu/try.txt" >> $LOC_EPC_VM_CMDS
+ echo "sudo rm -f /home/ubuntu/*.txt" >> $LOC_EPC_VM_CMDS
+
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS
+ rm -f $LOC_EPC_VM_CMDS
+
+ i="0"
+ echo "ifconfig tun5 | egrep -c \"inet addr\"" > $LOC_EPC_VM_CMDS
+ while [ $i -lt 10 ]
+ do
+ sleep 2
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
+ if [ $CONNECTED -eq 1 ]
+ then
+ echo "############################################################"
+ echo "Doing some adaptation on UE side"
+ echo "############################################################"
+ ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < /opt/ltebox-archives/adapt_ue_sim.txt
+ fi
+ done
+ rm $LOC_EPC_VM_CMDS
+ if [ $i -lt 50 ]
+ then
+ echo "Problem w/ starting ltebox EPC"
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ exit -1
+ fi
+ get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
+
+ echo "############################################################"
+ echo "Pinging the UE"
+ echo "############################################################"
+ PING_LOG_FILE=fdd_05MHz_ping_ue.txt
+ ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+
+}
+
+function retrieve_real_epc_ip_addr {
+ local LOC_EPC_VM_NAME=$1
+ local LOC_EPC_VM_CMDS=$2
+ local LOC_EPC_VM_IP_ADDR=$3
+
+ if [ $LTEBOX -eq 1 ]
+ then
+ # in our configuration file, we are using pool 5
+ echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $LOC_EPC_VM_CMDS
+ REAL_EPC_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
+ echo "EPC IP Address is : $REAL_EPC_IP_ADDR"
+ rm $LOC_EPC_VM_CMDS
+ fi
+}
+
+function terminate_epc {
+ if [ $LTEBOX -eq 1 ]
+ then
+ echo "echo \"cd /opt/ltebox/tools\"" > $1
+ echo "cd /opt/ltebox/tools" >> $1
+ echo "echo \"sudo ./stop_ltebox\"" >> $1
+ echo "sudo ./stop_ltebox" >> $1
+ echo "echo \"sudo daemon --name=simulated_hss --stop\"" >> $1
+ echo "sudo daemon --name=simulated_hss --stop" >> $1
+ echo "echo \"sudo killall --signal SIGKILL hss_sim\"" >> $1
+ echo "sudo killall --signal SIGKILL hss_sim" >> $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ rm $1
+ fi
+}
+
+function start_flexran_ctrl {
+ echo "cd /home/ubuntu/tmp" > $1
+ echo "if [ -f cmake_targets/log/flexran_ctl_run.log ]; then rm -f cmake_targets/log/flexran_ctl_run.log cmake_targets/log/flexran_ctl_query*.log; fi" >> $1
+ echo "echo \" sudo build/rt_controller -c log_config/basic_log\"" >> $1
+ echo "nohup sudo build/rt_controller -c log_config/basic_log > cmake_targets/log/flexran_ctl_run.log 2>&1 &" >> $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ rm $1
+ sleep 10
+}
+
+function stop_flexran_ctrl {
+ echo "echo \"sudo killall --signal SIGKILL rt_controller\"" > $1
+ echo "sudo killall --signal SIGKILL rt_controller" > $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ rm $1
+ sleep 2
+}
+
+function query_flexran_ctrl_status {
+ local LOC_MESSAGE=$3
+ echo "cd /home/ubuntu/tmp" > $1
+ echo "echo \"------------------------------------------------------------\" > cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1
+ echo "echo \"LOG_NAME: $LOC_MESSAGE\" >> cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1
+ echo "echo \"------------------------------------------------------------\" >> cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1
+ echo "curl http://localhost:9999/stats | jq '.' | tee -a cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm $1
}
+function build_ue_on_separate_folder {
+ echo "mkdir tmp-ue" > $1
+ echo "cd tmp-ue" >> $1
+ echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $1
+ echo "unzip -qq -DD ../localZip.zip" >> $1
+ echo "echo \"source oaienv\"" >> $1
+ echo "source oaienv" >> $1
+ echo "cd cmake_targets/" >> $1
+ echo "mkdir log" >> $1
+ echo "chmod 777 log" >> $1
+ echo "echo \"./build_oai --UE -t ETHERNET \"" >> $1
+ echo "./build_oai --UE -t ETHERNET > log/ue-build.txt 2>&1" >> $1
+ echo "cd tools" >> $1
+ echo "sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up" >> $1
+ echo "sudo chmod 666 /etc/iproute2/rt_tables" >> $1
+ echo "source init_nas_s1 UE" >> $1
+ echo "ifconfig" >> $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ rm -f $1
+}
+
+function start_l2_sim_enb {
+ local LOC_ENB_VM_IP_ADDR=$2
+ local LOC_EPC_IP_ADDR=$3
+ local LOC_UE_VM_IP_ADDR=$4
+ local LOC_LOG_FILE=$5
+ local LOC_NB_RBS=$6
+ local LOC_CONF_FILE=$7
+ # 1 is with S1 and 0 without S1 aka noS1
+ local LOC_S1_CONFIGURATION=$8
+ echo "cd /home/ubuntu/tmp" > $1
+ echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1
+ echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
+ echo "echo \"source oaienv\"" >> $1
+ echo "source oaienv" >> $1
+ echo "cd ci-scripts/conf_files/" >> $1
+ echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1
+ echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_ENB_VM_IP_ADDR#' -e 's#CI_UE_IP_ADDR#$LOC_UE_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
+ echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1
+ echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1
+ echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
+ echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --noS1\" > ./my-lte-softmodem-run.sh " >> $1
+ else
+ echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE\" > ./my-lte-softmodem-run.sh " >> $1
+ fi
+ echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
+ echo "cat ./my-lte-softmodem-run.sh" >> $1
+ echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
+ 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 -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1
+ 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 -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1`
+ if [ $CONNECTED -ne 0 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ fi
+ done
+ rm $1
+ ENB_SYNC=1
+ if [ $i -lt 50 ]
+ then
+ ENB_SYNC=0
+ echo "L2-SIM eNB is NOT sync'ed: process still alive?"
+ else
+ echo "L2-SIM eNB is sync'ed: waiting for UE(s) to connect"
+ fi
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "ifconfig oaitun_enb1 | egrep -c \"inet addr\"" > $1
+ # Checking oaitun_enb1 interface has now an IP address
+ i="0"
+ while [ $i -lt 10 ]
+ do
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1`
+ if [ $CONNECTED -eq 1 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ sleep 5
+ fi
+ done
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ ENB_SYNC=0
+ echo "L2-SIM eNB oaitun_enb1 is DOWN or NOT CONFIGURED"
+ else
+ echo "L2-SIM eNB oaitun_enb1 is UP and CONFIGURED"
+ fi
+ fi
+ sleep 10
+}
+
+function add_ue_l2_sim_ue {
+ local LOC_UE_VM_IP_ADDR=$2
+ local LOC_NB_UES=$3
+ echo "cd /home/ubuntu/tmp/" > $1
+ echo "source oaienv" >> $1
+ if [ $LOC_NB_UES -gt 1 ]
+ then
+ echo "echo \"cd openair3/NAS/TOOLS/\"" >> $1
+ echo "cd openair3/NAS/TOOLS/" >> $1
+ echo "echo \"awk -v num_ues=$LOC_NB_UES -f /home/ubuntu/tmp/ci-scripts/add_user_to_conf_file.awk ue_eurecom_test_sfr.conf > ue_eurecom_test_sfr_multi_ues.conf\"" >> $1
+ echo "awk -v num_ues=$LOC_NB_UES -f /home/ubuntu/tmp/ci-scripts/add_user_to_conf_file.awk ue_eurecom_test_sfr.conf > ue_eurecom_test_sfr_multi_ues.conf" >> $1
+ fi
+ echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
+ echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ echo "sudo rm -f *.u*" >> $1
+ if [ $LOC_NB_UES -eq 1 ]
+ then
+ echo "echo \"sudo ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o .\"" >> $1
+ echo "sudo ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o . > /home/ubuntu/tmp/cmake_targets/log/ue_adapt.txt 2>&1" >> $1
+ else
+ echo "echo \"sudo ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr_multi_ues.conf -o .\"" >> $1
+ echo "sudo ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr_multi_ues.conf -o . > /home/ubuntu/tmp/cmake_targets/log/ue_adapt.txt 2>&1" >> $1
+ fi
+
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
+ rm $1
+}
+
+function start_l2_sim_ue {
+ local LOC_UE_VM_IP_ADDR=$2
+ local LOC_ENB_VM_IP_ADDR=$3
+ local LOC_LOG_FILE=$4
+ local LOC_CONF_FILE=$5
+ local LOC_NB_UES=$6
+ # 1 is with S1 and 0 without S1 aka noS1
+ local LOC_S1_CONFIGURATION=$7
+ echo "echo \"sudo apt-get --yes --quiet install daemon \"" > $1
+ echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
+ echo "cd /home/ubuntu/tmp/ci-scripts/conf_files/" >> $1
+ echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1
+ echo "sed -i -e 's#CI_ENB_IP_ADDR#$LOC_ENB_VM_IP_ADDR#' -e 's#CI_UE_IP_ADDR#$LOC_UE_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
+ echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
+ echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nokrnmod 1 --noS1\" > ./my-lte-softmodem-run.sh " >> $1
+ else
+ echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nokrnmod 1\" > ./my-lte-softmodem-run.sh " >> $1
+ fi
+ echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
+ echo "cat ./my-lte-softmodem-run.sh" >> $1
+ echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
+ echo "sudo -E daemon --inherit --unsafe --name=ue_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 -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
+ 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 -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1`
+ if [ $CONNECTED -eq 1 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ fi
+ done
+ rm $1
+ UE_SYNC=1
+ if [ $i -lt 50 ]
+ then
+ UE_SYNC=0
+ echo "L2-SIM UE is NOT sync'ed w/ eNB"
+ return
+ else
+ echo "L2-SIM UE is sync'ed w/ eNB"
+ fi
+ local max_interfaces_to_check=1
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]; then max_interfaces_to_check=$LOC_NB_UES; fi
+ local j="1"
+ while [ $j -le $max_interfaces_to_check ]
+ do
+ echo "ifconfig oaitun_ue${j} | egrep -c \"inet addr\"" > $1
+ # Checking oaitun_ue1 interface has now an IP address
+ i="0"
+ while [ $i -lt 10 ]
+ do
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1`
+ if [ $CONNECTED -eq 1 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ sleep 5
+ fi
+ done
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ UE_SYNC=0
+ echo "L2-SIM UE oaitun_ue${j} is DOWN or NOT CONFIGURED"
+ else
+ echo "L2-SIM UE oaitun_ue${j} is UP and CONFIGURED"
+ fi
+ j=$[$j+1]
+ done
+ sleep 10
+ # for debug
+ if [ $LOC_S1_CONFIGURATION -eq 1 ]
+ then
+ echo "ifconfig" > $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
+ rm $1
+ fi
+}
+
+function full_l2_sim_destroy {
+ if [ $KEEP_VM_ALIVE -eq 0 ]
+ then
+ echo "############################################################"
+ echo "Destroying VMs"
+ echo "############################################################"
+ uvt-kvm destroy $ENB_VM_NAME
+ ssh-keygen -R $ENB_VM_IP_ADDR
+ uvt-kvm destroy $UE_VM_NAME
+ ssh-keygen -R $UE_VM_IP_ADDR
+ fi
+}
+
+function start_rf_sim_enb {
+ local LOC_ENB_VM_IP_ADDR=$2
+ local LOC_EPC_IP_ADDR=$3
+ local LOC_LOG_FILE=$4
+ local LOC_NB_RBS=$5
+ local LOC_CONF_FILE=$6
+ # 1 is with S1 and 0 without S1 aka noS1
+ local LOC_S1_CONFIGURATION=$7
+ echo "cd /home/ubuntu/tmp" > $1
+ echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1
+ echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
+ echo "echo \"export RFSIMULATOR=enb\"" >> $1
+ echo "export RFSIMULATOR=enb" >> $1
+ echo "echo \"source oaienv\"" >> $1
+ echo "source oaienv" >> $1
+ echo "cd ci-scripts/conf_files/" >> $1
+ echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1
+ echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_ENB_VM_IP_ADDR#' -e 's#CI_UE_IP_ADDR#$LOC_UE_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
+ echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1
+ echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1
+ echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
+ echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim --noS1\" > ./my-lte-softmodem-run.sh " >> $1
+ else
+ echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim\" > ./my-lte-softmodem-run.sh " >> $1
+ fi
+ echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
+ echo "cat ./my-lte-softmodem-run.sh" >> $1
+ echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
+ 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 -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1
+ rm $1
+
+ local i="0"
+ echo "egrep -c \"got sync\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1
+ while [ $i -lt 10 ]
+ do
+ sleep 5
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_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 "RF-SIM eNB is NOT sync'ed: process still alive?"
+ else
+ ENB_SYNC=1
+ echo "RF-SIM eNB is sync'ed: waiting for UE(s) to connect"
+ fi
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "ifconfig oaitun_enb1 | egrep -c \"inet addr\"" > $1
+ # Checking oaitun_enb1 interface has now an IP address
+ i="0"
+ while [ $i -lt 10 ]
+ do
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1`
+ if [ $CONNECTED -eq 1 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ sleep 5
+ fi
+ done
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ ENB_SYNC=0
+ echo "RF-SIM eNB oaitun_enb1 is DOWN or NOT CONFIGURED"
+ else
+ echo "RF-SIM eNB oaitun_enb1 is UP and CONFIGURED"
+ fi
+ fi
+ sleep 10
+}
+
+function start_rf_sim_ue {
+ local LOC_UE_VM_IP_ADDR=$2
+ local LOC_ENB_VM_IP_ADDR=$3
+ local LOC_LOG_FILE=$4
+ local LOC_PRB=$5
+ local LOC_FREQUENCY=$6
+ # 1 is with S1 and 0 without S1 aka noS1
+ local LOC_S1_CONFIGURATION=$7
+ echo "echo \"sudo apt-get --yes --quiet install daemon \"" > $1
+ echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
+ echo "echo \"export RFSIMULATOR=${LOC_ENB_VM_IP_ADDR}\"" >> $1
+ echo "export RFSIMULATOR=${LOC_ENB_VM_IP_ADDR}" >> $1
+ echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
+ echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --nokrnmod 1 --rfsim --noS1\" > ./my-lte-softmodem-run.sh " >> $1
+ else
+ echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --nokrnmod 1 --rfsim\" > ./my-lte-softmodem-run.sh " >> $1
+ fi
+ echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
+ echo "cat ./my-lte-softmodem-run.sh" >> $1
+ echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
+ echo "sudo -E daemon --inherit --unsafe --name=ue_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 -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
+ rm $1
+
+ local i="0"
+ echo "egrep -c \"got sync\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1
+ while [ $i -lt 10 ]
+ do
+ sleep 5
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1`
+ if [ $CONNECTED -ne 0 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ fi
+ done
+ UE_SYNC=1
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ UE_SYNC=0
+ echo "RF-SIM UE is NOT sync'ed w/ eNB"
+ return
+ else
+ echo "RF-SIM UE is sync'ed w/ eNB"
+ fi
+ # Checking oaitun_ue1 interface has now an IP address
+ i="0"
+ echo "ifconfig oaitun_ue1 | egrep -c \"inet addr\"" > $1
+ while [ $i -lt 10 ]
+ do
+ sleep 5
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_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 "RF-SIM UE oaitun_ue1 is DOWN or NOT CONFIGURED"
+ else
+ echo "RF-SIM UE oaitun_ue1 is UP and CONFIGURED"
+ fi
+ sleep 10
+}
+
+
function run_test_on_vm {
echo "############################################################"
echo "OAI CI VM script"
echo "############################################################"
- echo "VM_NAME = $VM_NAME"
- echo "VM_CMD_FILE = $VM_CMDS"
+ if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) || (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]]
+ then
+ ENB_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#enb-ethernet#" -e "s#rf-sim#enb-ethernet#"`
+ ENB_VM_CMDS=${ENB_VM_NAME}_cmds.txt
+ echo "ENB_VM_NAME = $ENB_VM_NAME"
+ echo "ENB_VM_CMD_FILE = $ENB_VM_CMDS"
+ UE_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#ue-ethernet#" -e "s#rf-sim#ue-ethernet#"`
+ UE_VM_CMDS=${UE_VM_NAME}_cmds.txt
+ echo "UE_VM_NAME = $UE_VM_NAME"
+ echo "UE_VM_CMD_FILE = $UE_VM_CMDS"
+ else
+ echo "VM_NAME = $VM_NAME"
+ echo "VM_CMD_FILE = $VM_CMDS"
+ fi
echo "JENKINS_WKSP = $JENKINS_WKSP"
echo "ARCHIVES_LOC = $ARCHIVES_LOC"
- echo "############################################################"
- echo "Waiting for VM to be started"
- echo "############################################################"
- uvt-kvm wait $VM_NAME --insecure
+ if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) || (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]]
+ then
+ echo "############################################################"
+ echo "Waiting for ENB VM to be started"
+ echo "############################################################"
+ uvt-kvm wait $ENB_VM_NAME --insecure
- VM_IP_ADDR=`uvt-kvm ip $VM_NAME`
- echo "$VM_NAME has for IP addr = $VM_IP_ADDR"
+ ENB_VM_IP_ADDR=`uvt-kvm ip $ENB_VM_NAME`
+ echo "$ENB_VM_NAME has for IP addr = $ENB_VM_IP_ADDR"
+
+ echo "############################################################"
+ echo "Waiting for UE VM to be started"
+ echo "############################################################"
+ uvt-kvm wait $UE_VM_NAME --insecure
+
+ UE_VM_IP_ADDR=`uvt-kvm ip $UE_VM_NAME`
+ echo "$UE_VM_NAME has for IP addr = $UE_VM_IP_ADDR"
+ else
+ echo "############################################################"
+ echo "Waiting for VM to be started"
+ echo "############################################################"
+ uvt-kvm wait $VM_NAME --insecure
+
+ VM_IP_ADDR=`uvt-kvm ip $VM_NAME`
+ echo "$VM_NAME has for IP addr = $VM_IP_ADDR"
+ fi
if [ "$RUN_OPTIONS" == "none" ]
then
echo "No run on VM testing for this variant currently"
- exit $STATUS
+ return
fi
if [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]]
@@ -330,7 +1171,7 @@ function run_test_on_vm {
echo "cd log" >> $VM_CMDS
echo "zip -r -qq tmp.zip *.* 0*" >> $VM_CMDS
- ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
echo "############################################################"
echo "Creating a tmp folder to store results and artifacts"
@@ -405,6 +1246,12 @@ function run_test_on_vm {
if [ $NB_RUNS -eq 0 ]; then STATUS=-1; fi
if [ $NB_FAILURES -ne 0 ]; then STATUS=-1; fi
+ if [ $STATUS -eq 0 ]
+ then
+ echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log
+ else
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ fi
fi
if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-basic-sim.* ]]
@@ -417,487 +1264,205 @@ function run_test_on_vm {
fi
mkdir --parents $ARCHIVES_LOC
+ # Creating a VM for EPC and installing SW
EPC_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#epc#"`
+ EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt
LTEBOX=0
- if [ -d /opt/ltebox-archives/ ]
- then
- # Checking if all ltebox archives are available to run ltebx epc on a brand new VM
- if [ -f /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ] && [ -f /opt/ltebox-archives/etc-conf.zip ] && [ -f /opt/ltebox-archives/hss-sim.zip ]
- then
- echo "############################################################"
- echo "Test EPC on VM ($EPC_VM_NAME) will be using ltebox"
- echo "############################################################"
- LTEBOX=1
- fi
- fi
- # Here we could have other types of EPC detection
-
- # Do we need to start the EPC VM
- EPC_VM_CMDS=`echo $VM_CMDS | sed -e "s#cmds#epc-cmds#"`
- echo "EPC_VM_CMD_FILE = $EPC_VM_CMDS"
- IS_EPC_VM_ALIVE=`uvt-kvm list | grep -c $EPC_VM_NAME`
- if [ $IS_EPC_VM_ALIVE -eq 0 ]
- then
- echo "############################################################"
- echo "Creating test EPC VM ($EPC_VM_NAME) on Ubuntu Cloud Image base"
- echo "############################################################"
- acquire_vm_create_lock
- uvt-kvm create $EPC_VM_NAME release=xenial --unsafe-caching
- echo "Waiting for VM to be started"
- uvt-kvm wait $EPC_VM_NAME --insecure
- release_vm_create_lock
- else
- echo "Waiting for VM to be started"
- uvt-kvm wait $EPC_VM_NAME --insecure
- fi
-
+ install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS
EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME`
- echo "$EPC_VM_NAME has for IP addr = $EPC_VM_IP_ADDR"
- scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu
-
- # ltebox specific actions (install and start)
- LTE_BOX_TO_INSTALL=1
- if [ $LTEBOX -eq 1 ]
- then
- echo "ls -ls /opt/ltebox/tools/start_ltebox" > $EPC_VM_CMDS
- RESPONSE=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS`
- NB_EXES=`echo $RESPONSE | grep -c ltebox`
- if [ $NB_EXES -eq 1 ]; then LTE_BOX_TO_INSTALL=0; fi
- fi
-
- if [ $LTEBOX -eq 1 ] && [ $LTE_BOX_TO_INSTALL -eq 1 ]
- then
- echo "############################################################"
- echo "Copying ltebox archives into EPC VM ($EPC_VM_NAME)"
- echo "############################################################"
- scp -o StrictHostKeyChecking=no /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu
- scp -o StrictHostKeyChecking=no /opt/ltebox-archives/etc-conf.zip ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu
- scp -o StrictHostKeyChecking=no /opt/ltebox-archives/hss-sim.zip ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu
-
- echo "############################################################"
- echo "Install EPC on EPC VM ($EPC_VM_NAME)"
- echo "############################################################"
- echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $EPC_VM_CMDS
- echo "touch /home/ubuntu/.hushlogin" >> $EPC_VM_CMDS
- echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $EPC_VM_CMDS
- echo "sudo apt-get update > zip-install.txt 2>&1" >> $EPC_VM_CMDS
- echo "sudo apt-get --yes install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf >> zip-install.txt 2>&1" >> $EPC_VM_CMDS
-
- # Installing HSS
- echo "echo \"cd /opt\"" >> $EPC_VM_CMDS
- echo "cd /opt" >> $EPC_VM_CMDS
- echo "echo \"sudo unzip -qq /home/ubuntu/hss-sim.zip\"" >> $EPC_VM_CMDS
- echo "sudo unzip -qq /home/ubuntu/hss-sim.zip" >> $EPC_VM_CMDS
- echo "echo \"cd /opt/hss_sim0609\"" >> $EPC_VM_CMDS
- echo "cd /opt/hss_sim0609" >> $EPC_VM_CMDS
-
- # Installing ltebox
- echo "echo \"cd /home/ubuntu\"" >> $EPC_VM_CMDS
- echo "cd /home/ubuntu" >> $EPC_VM_CMDS
- echo "echo \"sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb \"" >> $EPC_VM_CMDS
- echo "sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb >> zip-install.txt 2>&1" >> $EPC_VM_CMDS
-
- echo "echo \"cd /opt/ltebox/etc/\"" >> $EPC_VM_CMDS
- echo "cd /opt/ltebox/etc/" >> $EPC_VM_CMDS
- echo "echo \"sudo unzip -qq -o /home/ubuntu/etc-conf.zip\"" >> $EPC_VM_CMDS
- echo "sudo unzip -qq -o /home/ubuntu/etc-conf.zip" >> $EPC_VM_CMDS
- echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$EPC_VM_IP_ADDR#' gw.conf" >> $EPC_VM_CMDS
- echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$EPC_VM_IP_ADDR#' mme.conf" >> $EPC_VM_CMDS
- fi
# Starting EPC
- if [ $LTEBOX -eq 1 ]
- then
- echo "############################################################"
- echo "Start EPC on EPC VM ($EPC_VM_NAME)"
- echo "############################################################"
- echo "echo \"cd /opt/hss_sim0609\"" >> $EPC_VM_CMDS
- echo "cd /opt/hss_sim0609" >> $EPC_VM_CMDS
- echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $EPC_VM_CMDS
- echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $EPC_VM_CMDS
-
- echo "echo \"cd /opt/ltebox/tools/\"" >> $EPC_VM_CMDS
- echo "cd /opt/ltebox/tools/" >> $EPC_VM_CMDS
- echo "echo \"sudo ./start_ltebox\"" >> $EPC_VM_CMDS
- echo "nohup sudo ./start_ltebox > /home/ubuntu/ltebox.txt" >> $EPC_VM_CMDS
-
- ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS
- rm -f $EPC_VM_CMDS
-
- # We may have some adaptation to do
- if [ -f /opt/ltebox-archives/adapt_ue_sim.txt ]
- then
- echo "############################################################"
- echo "Doing some adaptation on UE side"
- echo "############################################################"
- ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < /opt/ltebox-archives/adapt_ue_sim.txt
- fi
-
- i="0"
- echo "ifconfig tun5 | egrep -c \"inet addr\"" > $EPC_VM_CMDS
- while [ $i -lt 10 ]
- do
- sleep 2
- CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS`
- if [ $CONNECTED -eq 1 ]
- then
- i="100"
- else
- i=$[$i+1]
- fi
- done
- rm $EPC_VM_CMDS
- if [ $i -lt 50 ]
- then
- echo "Problem w/ starting ltebox EPC"
- exit -1
- fi
- fi
-
- # HERE ADD ANY INSTALL ACTIONS FOR ANOTHER EPC
+ start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
# Retrieve EPC real IP address
- if [ $LTEBOX -eq 1 ]
- then
- # in our configuration file, we are using pool 5
- echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $EPC_VM_CMDS
- REAL_EPC_IP_ADDR=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS`
- echo "EPC IP Address is : $REAL_EPC_IP_ADDR"
- rm $EPC_VM_CMDS
- fi
+ retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
- echo "############################################################"
- echo "Starting the eNB in FDD-5MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=fdd_05MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-fdd-basic-sim.conf
+ TRANS_MODES=("fdd" "tdd")
+ BW_CASES=(05 10 20)
- echo "############################################################"
- echo "Starting the UE in FDD-5MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=fdd_05MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2680
- if [ $UE_SYNC -eq 0 ]
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ for BW in ${BW_CASES[@]}
+ do
+ # Not Running in TDD-10MHz and TDD-20MHz : too unstable
+ #if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*10.* ]]; then continue; fi
+ #if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*20.* ]]; then continue; fi
+
+ if [[ $BW =~ .*05.* ]]; then PRB=25; fi
+ if [[ $BW =~ .*10.* ]]; then PRB=50; fi
+ if [[ $BW =~ .*20.* ]]; then PRB=100; fi
+ if [[ $TMODE =~ .*fdd.* ]]; then FREQUENCY=2680; else FREQUENCY=2350; fi
+
+ echo "############################################################"
+ echo "Starting the eNB in ${TMODE}-${BW}MHz mode"
+ echo "############################################################"
+ CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_enb.log
+ start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE $PRB lte-${TMODE}-basic-sim.conf none
+
+ echo "############################################################"
+ echo "Starting the UE in ${TMODE}-${BW}MHz mode"
+ echo "############################################################"
+ CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_ue.log
+ start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE $PRB $FREQUENCY
+ if [ $UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ eNB and UE not syncing"
+ terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0
+ 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
+ recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ full_basic_sim_destroy
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ STATUS=-1
+ return
+ fi
+ get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1
+
+ echo "############################################################"
+ echo "Pinging the UE"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_ping_ue.txt
+ ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+
+ # Not more testing in any TDD : too unstable
+ if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*05.* ]]; then full_terminate; continue; fi
+ if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*10.* ]]; then full_terminate; continue; fi
+ if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*20.* ]]; then full_terminate; continue; fi
+ echo "############################################################"
+ echo "Iperf DL"
+ echo "############################################################"
+ if [[ $TMODE =~ .*fdd.* ]]
+ then
+ if [[ $BW =~ .*20.* ]]; then THROUGHPUT=12; else THROUGHPUT=10; fi
+ else
+ THROUGHPUT=6
+ fi
+ CURR_IPERF_LOG_BASE=${TMODE}_${BW}MHz_iperf_dl
+ generic_iperf $VM_CMDS $VM_IP_ADDR $UE_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR $REAL_EPC_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 0 0
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT
+
+ # Not more testing in FDD-20MHz : too unstable
+ if [[ $TMODE =~ .*fdd.* ]] && [[ $BW =~ .*20.* ]]; then full_terminate; continue; fi
+ echo "############################################################"
+ echo "Iperf UL"
+ echo "############################################################"
+ THROUGHPUT=2
+ CURR_IPERF_LOG_BASE=${TMODE}_${BW}MHz_iperf_ul
+ generic_iperf $EPC_VM_CMDS $EPC_VM_IP_ADDR $REAL_EPC_IP_ADDR $VM_CMDS $VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 0 0
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT
+
+ full_terminate
+
+ done
+ done
+
+ if [ -d $JENKINS_WKSP/flexran ]
then
- echo "Problem w/ eNB and UE not syncing"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
+ echo "############################################################"
+ echo "Flexran testing is possible"
+ echo "############################################################"
+ local j="0"
+ while [ $j -lt 20 ]
+ do
+ if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ]
+ then
+ echo "Found an proper flexran controller vm build"
+ j="100"
+ else
+ j=$[$j+1]
+ sleep 30
+ fi
+ done
+ if [ $j -lt 50 ]
+ then
+ echo "ERROR: compiling flexran controller on vm went wrong"
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ STATUS=-1
+ return
+ fi
+ FLEXRAN_CTL_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#flexran-rtc#"`
+ FLEXRAN_CTL_VM_CMDS=`echo $VM_CMDS | sed -e "s#cmds#flexran-rtc-cmds#"`
+ IS_FLEXRAN_VM_ALIVE=`uvt-kvm list | grep -c $FLEXRAN_CTL_VM_NAME`
+ if [ $IS_FLEXRAN_VM_ALIVE -eq 0 ]
+ then
+ echo "ERROR: Flexran Ctl VM is not alive"
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ full_basic_sim_destroy
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ STATUS=-1
+ return
+ fi
+ uvt-kvm wait $FLEXRAN_CTL_VM_NAME --insecure
+ FLEXRAN_CTL_VM_IP_ADDR=`uvt-kvm ip $FLEXRAN_CTL_VM_NAME`
+
+ echo "$FLEXRAN_CTL_VM_NAME has for IP addr = $FLEXRAN_CTL_VM_IP_ADDR"
+ echo "FLEXRAN_CTL_VM_CMDS = $FLEXRAN_CTL_VM_CMDS"
+ echo "############################################################"
+ echo "Starting the FLEXRAN CONTROLLER"
+ echo "############################################################"
+ start_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR
+ query_flexran_ctrl_status $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR 01_no_enb_connected
+
+ echo "############################################################"
+ echo "Starting the eNB in FDD-5MHz mode with Flexran ON"
+ echo "############################################################"
+ CURRENT_ENB_LOG_FILE=fdd_05fMHz_enb.log
+ start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-fdd-basic-sim.conf $FLEXRAN_CTL_VM_IP_ADDR
+ query_flexran_ctrl_status $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR 02_enb_connected
+
+ echo "############################################################"
+ echo "Starting the UE in FDD-5MHz mode"
+ echo "############################################################"
+ CURRENT_UE_LOG_FILE=fdd_05fMHz_ue.log
+ start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2680
+ if [ $UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ eNB and UE not syncing"
+ terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0
+ 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
+ recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ stop_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ STATUS=-1
+ return
+ fi
+ query_flexran_ctrl_status $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR 03_enb_ue_connected
+ get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1
+
+ sleep 30
+ echo "############################################################"
+ echo "Terminate enb/ue simulators"
+ echo "############################################################"
+ terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0
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
recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- exit -1
+ sleep 10
+
+ echo "############################################################"
+ echo "Stopping the FLEXRAN CONTROLLER"
+ echo "############################################################"
+ stop_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR
+ scp -o StrictHostKeyChecking=no ubuntu@$FLEXRAN_CTL_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/flexran_ctl_*.log $ARCHIVES_LOC
fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
-
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=fdd_05MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-
- echo "############################################################"
- echo "Iperf DL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=fdd_05MHz_iperf_dl
- iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15
-
- echo "############################################################"
- echo "Iperf UL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=fdd_05MHz_iperf_ul
- iperf_ul $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 2 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 2
-
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
-
- echo "############################################################"
- echo "Starting the eNB in FDD-10MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=fdd_10MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 50 lte-fdd-basic-sim.conf
-
- echo "############################################################"
- echo "Starting the UE in FDD-10MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=fdd_10MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 50 2680
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- exit -1
- fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
-
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=fdd_10MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-
- echo "############################################################"
- echo "Iperf DL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=fdd_10MHz_iperf_dl
- iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15
-
- echo "############################################################"
- echo "Iperf UL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=fdd_10MHz_iperf_ul
- iperf_ul $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 2 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 2
-
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
-
- echo "############################################################"
- echo "Starting the eNB in FDD-20MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=fdd_20MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 100 lte-fdd-basic-sim.conf
-
- echo "############################################################"
- echo "Starting the UE in FDD-20MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=fdd_20MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 100 2680
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- exit -1
- fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
-
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=fdd_20MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-
- echo "############################################################"
- echo "Iperf DL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=fdd_20MHz_iperf_dl
- iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15
-
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
-
- echo "############################################################"
- echo "Starting the eNB in TDD-5MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=tdd_05MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-tdd-basic-sim.conf
-
- echo "############################################################"
- echo "Starting the UE in TDD-5MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=tdd_05MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2350
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- exit -1
- fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
-
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=tdd_05MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-
-# Bug in TDD 5Mhz --- not running it
-# echo "############################################################"
-# echo "Iperf DL"
-# echo "############################################################"
-# CURR_IPERF_LOG_BASE=tdd_05MHz_iperf_dl
-# iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE
-# scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
-# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
-# check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6
-
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
-
- echo "############################################################"
- echo "Starting the eNB in TDD-10MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=tdd_10MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 50 lte-tdd-basic-sim.conf
-
- echo "############################################################"
- echo "Starting the UE in TDD-10MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=tdd_10MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 50 2350
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- exit -1
- fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
-
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=tdd_10MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-
- echo "############################################################"
- echo "Iperf DL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=tdd_10MHz_iperf_dl
- iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6
-
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
-
- echo "############################################################"
- echo "Starting the eNB in TDD-20MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=tdd_20MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 100 lte-tdd-basic-sim.conf
-
- echo "############################################################"
- echo "Starting the UE in TDD-20MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=tdd_20MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 100 2350
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- exit -1
- fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
-
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=tdd_20MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-
- echo "############################################################"
- echo "Iperf DL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=tdd_20MHz_iperf_dl
- iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6
-
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- 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
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
echo "############################################################"
echo "Terminate EPC"
echo "############################################################"
- if [ $LTEBOX -eq 1 ]
- then
- terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- fi
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- if [ $KEEP_VM_ALIVE -eq 0 ]
- then
- echo "############################################################"
- echo "Destroying VMs"
- echo "############################################################"
- uvt-kvm destroy $VM_NAME
- ssh-keygen -R $VM_IP_ADDR
- uvt-kvm destroy $EPC_VM_NAME
- ssh-keygen -R $EPC_VM_IP_ADDR
- fi
+ full_basic_sim_destroy
echo "############################################################"
echo "Checking run status"
@@ -906,5 +1471,509 @@ function run_test_on_vm {
if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi
if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi
+ if [ $STATUS -eq 0 ]
+ then
+ echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log
+ else
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ fi
+ fi
+
+ if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]]
+ then
+ PING_STATUS=0
+ IPERF_STATUS=0
+ if [ -d $ARCHIVES_LOC ]
+ then
+ rm -Rf $ARCHIVES_LOC
+ fi
+ mkdir --parents $ARCHIVES_LOC
+
+ # Creating a VM for EPC and installing SW
+ EPC_VM_NAME=`echo $VM_NAME | sed -e "s#rf-sim#epc#"`
+ EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt
+ LTEBOX=0
+ install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS
+ EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME`
+
+ # withS1 configuration is not working
+ #EPC_CONFIGS=("wS1" "noS1")
+ #TRANS_MODES=("fdd" "tdd")
+ #BW_CASES=(05 10 20)
+ EPC_CONFIGS=("noS1")
+ TRANS_MODES=("fdd")
+ BW_CASES=(05)
+ for CN_CONFIG in ${EPC_CONFIGS[@]}
+ do
+ if [[ $CN_CONFIG =~ .*wS1.* ]]
+ then
+ echo "############################################################"
+ echo "Start EPC for the wS1 configuration"
+ echo "############################################################"
+ start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+
+ # Retrieve EPC real IP address
+ retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ S1_NOS1_CFG=1
+ else
+ echo "############################################################"
+ echo "Terminate EPC"
+ echo "############################################################"
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+
+ echo "############################################################"
+ echo "Running now in a no-S1 configuration"
+ echo "############################################################"
+ S1_NOS1_CFG=0
+ fi
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ if [[ $TMODE =~ .*fdd.* ]]
+ then
+ CONF_FILE=enb.band7.tm1.50PRB.usrpb210.conf
+ FREQUENCY=2680
+ else
+ CONF_FILE=enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf
+ FREQUENCY=2350
+ fi
+ for BW in ${BW_CASES[@]}
+ do
+ if [[ $BW =~ .*05.* ]]; then PRB=25; fi
+ if [[ $BW =~ .*10.* ]]; then PRB=50; fi
+ if [[ $BW =~ .*20.* ]]; then PRB=100; fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the eNB in ${TMODE}-${BW}MHz mode"
+ echo "############################################################"
+ CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_enb.log
+ start_rf_sim_enb $ENB_VM_CMDS $ENB_VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the UE"
+ echo "############################################################"
+ CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ue.log
+ start_rf_sim_ue $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_VM_IP_ADDR $CURRENT_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG
+ if [ $UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ eNB and UE not syncing"
+ terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1
+ terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ fi
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ STATUS=-1
+ return
+ fi
+
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the EPC from UE"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ping_epc.log
+ ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE 1 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ else
+ get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the eNB from UE"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ping_enb_from_ue.log
+ ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_IP_ADDR $PING_LOG_FILE 1 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ fi
+
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the UE from EPC"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ping_ue.log
+ ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ else
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the UE from eNB"
+ echo "############################################################"
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ping_from_enb_ue.log
+ ping_enb_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ fi
+
+ if [ $S1_NOS1_CFG -eq 0 ]
+ then
+ get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
+ echo "############################################################"
+ echo "${CN_CONFIG} : iperf DL -- UE is server and eNB is client"
+ echo "############################################################"
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
+ THROUGHPUT=4
+ generic_iperf $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE 1 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : iperf UL -- eNB is server and UE is client"
+ echo "############################################################"
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_ul
+ THROUGHPUT=2
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
+ generic_iperf $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE 1 0
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+ fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Terminate enb/ue simulators"
+ echo "############################################################"
+ terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1
+ terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+
+ done
+ done
+ done
+
+ full_l2_sim_destroy
+
+ echo "############################################################"
+ echo "Checking run status"
+ echo "############################################################"
+
+ if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi
+ if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi
+ if [ $STATUS -eq 0 ]
+ then
+ echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log
+ else
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ fi
+ fi
+
+ if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-l2-sim.* ]]
+ then
+ PING_STATUS=0
+ IPERF_STATUS=0
+ if [ -d $ARCHIVES_LOC ]
+ then
+ rm -Rf $ARCHIVES_LOC
+ fi
+ mkdir --parents $ARCHIVES_LOC
+
+ # Building UE elsewhere in VM
+ #build_ue_on_separate_folder $VM_CMDS $VM_IP_ADDR
+
+ # Creating a VM for EPC and installing SW
+ EPC_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#epc#"`
+ EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt
+ LTEBOX=0
+ install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS
+ EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME`
+
+ # adding 16 users to EPC subscriber lists
+ add_user_to_epc_lists $EPC_VM_CMDS $EPC_VM_IP_ADDR 16
+
+ EPC_CONFIGS=("wS1" "noS1")
+ TRANS_MODES=("fdd")
+ BW_CASES=(05)
+ NB_USERS=(01 04)
+ for CN_CONFIG in ${EPC_CONFIGS[@]}
+ do
+ if [[ $CN_CONFIG =~ .*wS1.* ]]
+ then
+ echo "############################################################"
+ echo "Start EPC for the wS1 configuration"
+ echo "############################################################"
+ start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+
+ # Retrieve EPC real IP address
+ retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ S1_NOS1_CFG=1
+ else
+ echo "############################################################"
+ echo "Terminate EPC"
+ echo "############################################################"
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+
+ echo "############################################################"
+ echo "Running now in a no-S1 configuration"
+ echo "############################################################"
+ S1_NOS1_CFG=0
+ fi
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ for BW in ${BW_CASES[@]}
+ do
+ for UES in ${NB_USERS[@]}
+ do
+ INT_NB_UES=`echo $UES | sed -e "s#^0*##"`
+ echo "############################################################"
+ echo "${CN_CONFIG} : Adding ${INT_NB_UES} UE(s) to conf file and recompile"
+ echo "############################################################"
+ add_ue_l2_sim_ue $UE_VM_CMDS $UE_VM_IP_ADDR $INT_NB_UES
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the eNB in ${TMODE}-${BW}MHz mode"
+ echo "############################################################"
+ CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_enb.log
+ start_l2_sim_enb $ENB_VM_CMDS $ENB_VM_IP_ADDR $EPC_VM_IP_ADDR $UE_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 rcc.band7.tm1.nfapi.conf $S1_NOS1_CFG
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the UE for ${INT_NB_UES} user(s)"
+ echo "############################################################"
+ CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ue.log
+ start_l2_sim_ue $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_VM_IP_ADDR $CURRENT_UE_LOG_FILE ue.nfapi.conf $INT_NB_UES $S1_NOS1_CFG
+ if [ $UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ eNB and UE not syncing"
+ terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1
+ terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ fi
+ full_l2_sim_destroy
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ STATUS=-1
+ return
+ fi
+
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the EPC from UE(s)"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_epc.log
+ ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE 1 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ else
+ get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the eNB from UE(s)"
+ echo "############################################################"
+ echo " --- Sequentially ---"
+ local j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_enb_seq_from_ue${j}.log
+ ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_IP_ADDR $PING_LOG_FILE ${j} 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ j=$[$j+1]
+ done
+ if [ $INT_NB_UES -gt 1 ]
+ then
+ echo " --- In parallel ---"
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_enb_para_from_ue${j}.log
+ ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_IP_ADDR $PING_LOG_FILE ${j} 1
+ j=$[$j+1]
+ done
+ sleep 25
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_enb_para_from_ue${j}.log
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ tail -3 $ARCHIVES_LOC/$PING_LOG_FILE
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ j=$[$j+1]
+ done
+ fi
+ fi
+
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the UE(s) from EPC"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_ue.log
+ ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ else
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the UE(s) from eNB"
+ echo "############################################################"
+ echo " --- Sequentially ---"
+ local j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_enb_seq_ue${j}.log
+ ping_enb_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ j=$[$j+1]
+ done
+ if [ $INT_NB_UES -gt 1 ]
+ then
+ echo " --- In parallel ---"
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_enb_para_ue${j}.log
+ ping_enb_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 1
+ j=$[$j+1]
+ done
+ sleep 25
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_enb_para_ue${j}.log
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ tail -3 $ARCHIVES_LOC/$PING_LOG_FILE
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ j=$[$j+1]
+ done
+ fi
+ fi
+
+ if [ $S1_NOS1_CFG -eq 0 ]
+ then
+ get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
+ echo "############################################################"
+ echo "${CN_CONFIG} : iperf DL -- UE is server and eNB is client"
+ echo "############################################################"
+ echo " --- Sequentially ---"
+ local j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl_seq_ue${j}
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ THROUGHPUT=3
+ generic_iperf $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE $j 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+ j=$[$j+1]
+ done
+ if [ $INT_NB_UES -gt 1 ]
+ then
+ echo " --- In parallel ---"
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl_para_ue${j}
+ THROUGHPUT=1
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ generic_iperf $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE $j 1
+ j=$[$j+1]
+ done
+ sleep 35
+ echo "killall --signal SIGKILL iperf"
+ echo "killall --signal SIGKILL iperf" > $UE_VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR < $UE_VM_CMDS
+ rm $UE_VM_CMDS
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl_para_ue${j}
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ tail -3 $ARCHIVES_LOC/${IPERF_LOG_FILE}_client.txt | grep -v datagram
+ #check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+ j=$[$j+1]
+ done
+ fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : iperf UL -- eNB is server and UE is client"
+ echo "############################################################"
+ echo " --- Sequentially ---"
+ local j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul_seq_ue${j}
+ THROUGHPUT=2
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ generic_iperf $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE $j 0
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+ j=$[$j+1]
+ done
+ if [ $INT_NB_UES -gt 1 ]
+ then
+ echo " --- In parallel ---"
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul_para_ue${j}
+ THROUGHPUT=1
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ generic_iperf $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE $j 1
+ j=$[$j+1]
+ done
+ sleep 35
+ echo "killall --signal SIGKILL iperf"
+ echo "killall --signal SIGKILL iperf" > $UE_VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR < $UE_VM_CMDS
+ rm $UE_VM_CMDS
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul_para_ue${j}
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ tail -3 $ARCHIVES_LOC/${IPERF_LOG_FILE}_client.txt | grep -v datagram
+ #check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+ j=$[$j+1]
+ done
+ fi
+ fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Terminate enb/ue simulators"
+ echo "############################################################"
+ terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1
+ terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+
+ done
+ done
+ done
+ done
+
+ full_l2_sim_destroy
+
+ echo "############################################################"
+ echo "Checking run status"
+ echo "############################################################"
+
+ if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi
+ if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi
+ if [ $STATUS -eq 0 ]
+ then
+ echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log
+ else
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ fi
fi
}
diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh
index 208bf06318..3f63a592ff 100755
--- a/ci-scripts/waitBuildOnVM.sh
+++ b/ci-scripts/waitBuildOnVM.sh
@@ -98,7 +98,7 @@ function wait_on_vm_build {
echo "while [ \$(ps -aux | grep --color=never build_oai | grep -v grep | wc -l) -gt 0 ]; do sleep 3; done" >> $VM_CMDS
fi
- ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
rm -f $VM_CMDS
}
@@ -124,11 +124,16 @@ function check_on_vm_build {
if [ $KEEP_VM_ALIVE -eq 0 ]
then
+ if [[ "$VM_NAME" == *"-enb-ethernet"* ]] || [[ "$VM_NAME" == *"-ue-ethernet"* ]]
+ then
+ echo "Hack to not destroy in current pipeline"
+ else
echo "############################################################"
echo "Destroying VM"
echo "############################################################"
uvt-kvm destroy $VM_NAME
ssh-keygen -R $VM_IP_ADDR
+ fi
fi
rm -f $VM_CMDS
@@ -136,7 +141,12 @@ function check_on_vm_build {
echo "Checking build status"
echo "############################################################"
- LOG_FILES=`ls $ARCHIVES_LOC/*.txt $ARCHIVES_LOC/*.xml`
+ if [[ "$VM_NAME" == *"-cppcheck"* ]]
+ then
+ LOG_FILES=`ls $ARCHIVES_LOC/*.txt $ARCHIVES_LOC/*.xml`
+ else
+ LOG_FILES=`ls $ARCHIVES_LOC/*.txt`
+ fi
STATUS=0
NB_FOUND_FILES=0
@@ -171,4 +181,25 @@ function check_on_vm_build {
STATUS=-1
fi
-}
+ # If we were building the FlexRan Controller, flag-touch for basic-simulator to continue
+ if [[ "$VM_NAME" == *"-flexran-rtc"* ]]
+ then
+ if [[ $STATUS -eq 0 ]]
+ then
+ touch $JENKINS_WKSP/flexran/flexran_build_complete.txt
+ fi
+ fi
+
+ if [[ "$VM_NAME" == *"-cppcheck"* ]]
+ then
+ echo "COMMAND: cppcheck $BUILD_OPTIONS . 2> cppcheck.xml" > $ARCHIVES_LOC/build_final_status.log
+ else
+ echo "COMMAND: build_oai -I $BUILD_OPTIONS" > $ARCHIVES_LOC/build_final_status.log
+ fi
+ if [[ $STATUS -eq 0 ]]
+ then
+ echo "BUILD_OK" >> $ARCHIVES_LOC/build_final_status.log
+ else
+ echo "BUILD_KO" >> $ARCHIVES_LOC/build_final_status.log
+ fi
+}
\ No newline at end of file
diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_closure.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_closure.xml
new file mode 100644
index 0000000000..8587db959d
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_closure.xml
@@ -0,0 +1,48 @@
+
+
+ epc-closure
+ EPC-Closure
+ log-out
+
+ 050201 060201 070201
+
+
+
+
+
+ Terminate_HSS
+ Terminate HSS
+
+
+
+ Terminate_MME
+ Terminate MME
+
+
+
+ Terminate_SPGW
+ Terminate SPGW
+
+
+
diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_start.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_start.xml
new file mode 100644
index 0000000000..e22c5b4da2
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_start.xml
@@ -0,0 +1,47 @@
+
+
+ epc-start
+ EPC-Start
+ log-in
+
+ 050101 060101 070101
+
+
+
+
+ Initialize_HSS
+ Initialize HSS
+
+
+
+ Initialize_MME
+ Initialize MME
+
+
+
+ Initialize_SPGW
+ Initialize SPGW
+
+
+
diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml
new file mode 100644
index 0000000000..cded08284a
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml
@@ -0,0 +1,117 @@
+
+
+ test-05-tm1-nos1-tunnel
+ Test-05MHz-TM1-noS1-tunnel
+ tasks
+
+ 030201 090109
+ 030101 000001 090101 000002 040501 040502 000001 040601 040641 040642 000001 090109 030201
+
+
+
+
+ IdleSleep
+ Sleep
+ 10
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ IdleSleep
+ Sleep
+ 60
+
+
+
+ Initialize_eNB
+ Initialize eNB (FDD/Band7/5MHz)
+ -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --noS1
+
+
+
+ Terminate_eNB
+ Terminate eNB
+
+
+
+ Initialize_OAI_UE
+ Initialize OAI UE (FDD/Band7/5MHz)
+ -C 2680000000 -r 25 --ue-rxgain 120 --ue-txgain 0 --ue-max-power 0 --ue-scan-carrier --nokrnmod 1 --noS1
+
+
+
+ Terminate_OAI_UE
+ Terminate OAI UE
+
+
+
+ Ping
+ ping (5MHz - 20 sec)(from eNB to OAI UE)
+ -I oaitun_enb1 -c 20 10.0.1.2
+ 5
+
+
+
+ Ping
+ ping (5MHz - 20 sec)(from OAI UE to eNB)
+ -I oaitun_ue1 -c 20 10.0.1.1
+ 5
+
+
+
+ Iperf
+ iperf (5MHz - DL/1Mbps/UDP)(30 sec)
+ -c 10.0.1.2 -u -b 1M -t 30 -i 1 -fm -B 10.0.1.1
+ 50
+
+
+
+ Iperf
+ iperf (5MHz - DL/1.2Mbps/UDP)(30 sec)
+ -c 10.0.1.2 -u -b 1.2M -t 30 -i 1 -fm -B 10.0.1.1
+ 50
+
+
+
+ Iperf
+ iperf (5MHz - UL/1Mbps/UDP)(30 sec)
+ -c 10.0.1.1 -u -b 1M -t 30 -i 1 -fm -B 10.0.1.2 -R
+ 50
+ balanced
+
+
+
+ Iperf
+ iperf (5MHz - UL/8Mbps/UDP)(30 sec)
+ -c 10.0.1.1 -u -b 8M -t 30 -i 1 -fm -B 10.0.1.2 -R
+ 50
+ balanced
+
+
+
diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml
new file mode 100644
index 0000000000..15735d94db
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml
@@ -0,0 +1,104 @@
+
+
+ test-05-tm1-tunnel
+ Test-05MHz-TM1-tunnel
+ tasks
+
+ 030201 090109
+ 030102 000001 090102 000002 040503 000001 040603 040643 040644 000001 090109 030201
+
+
+
+
+ IdleSleep
+ Sleep
+ 10
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ Initialize_eNB
+ Initialize eNB (FDD/Band7/5MHz)
+ -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
+
+
+
+ Terminate_eNB
+ Terminate eNB
+
+
+
+ Initialize_OAI_UE
+ Initialize OAI UE (FDD/Band7/5MHz)
+ -C 2680000000 -r 25 --ue-rxgain 120 --ue-txgain 0 --ue-max-power 0 --ue-scan-carrier --nokrnmod 1
+
+
+
+ Terminate_OAI_UE
+ Terminate OAI UE
+
+
+
+ Ping
+ ping (5MHz - 20 sec)
+ -c 20
+ 5
+
+
+
+ Iperf
+ iperf (5MHz - DL/1Mbps/UDP)(30 sec)
+ -u -b 1M -t 30 -i 1 -fm
+ 50
+
+
+
+ Iperf
+ iperf (5MHz - DL/1.2Mbps/UDP)(30 sec)
+ -b 1.2M -t 30 -i 1 -fm
+ 50
+
+
+
+ Iperf
+ iperf (5MHz - UL/1Mbps/UDP)(30 sec)
+ -u -b 1M -t 30 -i 1 -fm -R
+ 50
+ balanced
+
+
+
+ Iperf
+ iperf (5MHz - UL/8Mbps/UDP)(30 sec)
+ -u -b 8M -t 30 -i 1 -fm -R
+ 50
+ balanced
+
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band13_build.xml b/ci-scripts/xml_files/enb_usrp210_band13_build.xml
new file mode 100644
index 0000000000..24283a52d0
--- /dev/null
+++ b/ci-scripts/xml_files/enb_usrp210_band13_build.xml
@@ -0,0 +1,55 @@
+
+
+ build-tab
+ Build
+ wrench
+
+ 010101
+ 050101 060101 070101
+
+
+
+
+
+ Build_eNB
+ Build eNB (USRP)
+ -w USRP -c --eNB
+
+
+
+ Initialize_HSS
+ Initialize HSS
+
+
+
+ Initialize_MME
+ Initialize MME
+
+
+
+ Initialize_SPGW
+ Initialize SPGW
+
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band13_epc_closure.xml b/ci-scripts/xml_files/enb_usrp210_band13_epc_closure.xml
new file mode 100644
index 0000000000..07fb6951f8
--- /dev/null
+++ b/ci-scripts/xml_files/enb_usrp210_band13_epc_closure.xml
@@ -0,0 +1,47 @@
+
+
+ epc-closure
+ EPC-Closure
+ log-out
+
+ 050201 060201 070201
+
+
+
+
+ Terminate_HSS
+ Terminate HSS
+
+
+
+ Terminate_MME
+ Terminate MME
+
+
+
+ Terminate_SPGW
+ Terminate SPGW
+
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band13_test_10mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band13_test_10mhz_tm1.xml
new file mode 100644
index 0000000000..5425428bc2
--- /dev/null
+++ b/ci-scripts/xml_files/enb_usrp210_band13_test_10mhz_tm1.xml
@@ -0,0 +1,79 @@
+
+
+ test-10-tm1
+ Test-10MHz-TM1
+ tasks
+
+ 030201
+ 040102
+ 030121 000001 040302 000001 040502 000001 040402 040202 000001 030201
+
+
+
+
+
+ IdleSleep
+ Waiting for a moment...
+ 15
+
+
+
+ Initialize_eNB
+ Initialize eNB (FDD/Band13/10MHz)
+ -O ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf
+
+
+
+ Terminate_eNB
+ Terminate eNB
+
+
+
+ Initialize_CatM_module
+ Initialize CAT-M Module
+
+
+
+ Terminate_CatM_module
+ Terminate CAT-M Module
+
+
+
+ Attach_CatM_module
+ Attach CAT-M Module
+
+
+
+ Detach_CatM_module
+ Detach CAT-M Module
+
+
+
+ Ping_CatM_module
+ ping (10MHz - 20 sec)
+ -c 20
+ 5
+
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml
index d5a25c7fa7..7fa7814238 100644
--- a/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml
@@ -25,8 +25,9 @@
Test-05MHz-TM1
tasks
+ 030201
040101
- 030104 040301 040501 040602 040601 040603 040642 040641 040643 040401 040201 030201
+ 030104 040301 040501 040602 040601 040603 040604 040605 040642 040641 040643 040644 040645 040401 040201 030201
@@ -92,6 +93,21 @@
unbalanced
+
+ Iperf
+ iperf (5MHz - DL/TCP)(30 sec)(single-ue profile)
+ -t 30 -i 1 -fm
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (5MHz - DL/TCP)(30 sec)
+ -t 30 -i 1 -fm
+ 50
+
+
Iperf
iperf (5MHz - UL/2Mbps/UDP)(30 sec)(balanced)
@@ -116,4 +132,19 @@
unbalanced
+
+ Iperf
+ iperf (5MHz - UL/TCP)(30 sec)(single-ue)
+ -t 30 -i 1 -fm -R
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (5MHz - UL/TCP)(30 sec)
+ -t 30 -i 1 -fm -R
+ 50
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml
index ef50933d4a..4859224606 100644
--- a/ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml
@@ -25,8 +25,9 @@
Test-10MHz-TM1
tasks
+ 030201
040101
- 030114 040301 040511 040612 040611 040613 040652 040651 040653 040401 040201 030201
+ 030114 040301 040511 040612 040611 040613 040614 040615 040652 040651 040653 040654 040655 040401 040201 030201
@@ -51,38 +52,38 @@
Terminate UE
-
- Attach_UE
- Attach UE
-
+
+ Attach_UE
+ Attach UE
+
-
- Detach_UE
- Detach UE
-
+
+ Detach_UE
+ Detach UE
+
-
- Ping
- ping (10MHz - 20 sec)
- -c 20
- 25
-
+
+ Ping
+ ping (10MHz - 20 sec)
+ -c 20
+ 25
+
- Iperf
- iperf (10MHz - DL/13.5Mbps/UDP)(30 sec)(balanced)
- -u -b 13.5M -t 30 -i 1
- 50
- balanced
-
+ Iperf
+ iperf (10MHz - DL/13.5Mbps/UDP)(30 sec)(balanced)
+ -u -b 13.5M -t 30 -i 1
+ 50
+ balanced
+
-
- Iperf
- iperf (10MHz - DL/13.5Mbps/UDP)(30 sec)(single-ue)
- -u -b 13.5M -t 30 -i 1
- 50
- single-ue
-
+
+ Iperf
+ iperf (10MHz - DL/13.5Mbps/UDP)(30 sec)(single-ue)
+ -u -b 13.5M -t 30 -i 1
+ 50
+ single-ue
+
Iperf
@@ -92,6 +93,21 @@
unbalanced
+
+ Iperf
+ iperf (10MHz - DL/TCP)(30 sec)(single-ue)
+ -t 30 -i 1 -fm
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (10MHz - DL/TCP)(30 sec)
+ -t 30 -i 1 -fm
+ 50
+
+
Iperf
iperf (10MHz - UL/2Mbps/UDP)(30 sec)(balanced)
@@ -116,4 +132,19 @@
unbalanced
+
+ Iperf
+ iperf (10MHz - UL/TCP)(30 sec)(single-ue)
+ -t 30 -i 1 -fm -R
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (10MHz - UL/TCP)(30 sec)
+ -t 30 -i 1 -fm -R
+ 50
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml
new file mode 100644
index 0000000000..bcbf742ef7
--- /dev/null
+++ b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml
@@ -0,0 +1,150 @@
+
+
+ test-20-tm1
+ Test-20MHz-TM1
+ tasks
+
+ 030201
+ 040101
+ 030124 040301 040521 040622 040621 040623 040624 040625 040662 040661 040663 040664 040665 040401 040201 030201
+
+
+
+
+ Initialize_eNB
+ Initialize eNB (TDD/Band40/20MHz/info)
+ -O ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf
+
+
+
+ Terminate_eNB
+ Terminate eNB
+
+
+
+ Initialize_UE
+ Initialize UE
+
+
+
+ Terminate_UE
+ Terminate UE
+
+
+
+ Attach_UE
+ Attach UE
+
+
+
+ Detach_UE
+ Detach UE
+
+
+
+ Ping
+ ping (20MHz - 20 sec)
+ -c 20
+ 25
+
+
+
+ Iperf
+ iperf (20MHz - DL/13.5Mbps/UDP)(30 sec)(balanced)
+ -u -b 13.5M -t 30 -i 1
+ 50
+ balanced
+
+
+
+ Iperf
+ iperf (20MHz - DL/13.5Mbps/UDP)(30 sec)(single-ue)
+ -u -b 13.5M -t 30 -i 1
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (20MHz - DL/13.5Mbps/UDP)(30 sec)(unbalanced)
+ -u -b 13.5M -t 30 -i 1
+ 50
+ unbalanced
+
+
+
+ Iperf
+ iperf (20MHz - DL/TCP)(30 sec)(single-ue)
+ -t 30 -i 1 -fm
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (20MHz - DL/TCP)(30 sec)
+ -t 30 -i 1 -fm
+ 50
+
+
+
+ Iperf
+ iperf (20MHz - UL/2Mbps/UDP)(30 sec)(balanced)
+ -u -b 2M -t 30 -i 1 -R
+ 50
+ balanced
+
+
+
+ Iperf
+ iperf (20MHz - UL/2Mbps/UDP)(30 sec)(single-ue)
+ -u -b 2M -t 30 -i 1 -R
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (20MHz - UL/2Mbps/UDP)(30 sec)(unbalanced)
+ -u -b 2M -t 30 -i 1 -R
+ 50
+ unbalanced
+
+
+
+ Iperf
+ iperf (20MHz - UL/TCP)(30 sec)(single-ue)
+ -t 30 -i 1 -fm -R
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (20MHz - UL/TCP)(30 sec)
+ -t 30 -i 1 -fm -R
+ 50
+
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml
index 0057eaefa4..edc87c90ff 100644
--- a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml
@@ -25,6 +25,7 @@
Test-05MHz-TM1
tasks
+ 030201
040101
030101 040301 040501 040603 040604 040605 040606 040607 040641 040642 040643 040644 040401 040201 030201
diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml
index 92ec1efa6e..ccbe71cd14 100644
--- a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml
@@ -25,6 +25,7 @@
Test-10MHz-TM1
tasks
+ 030201
040101
030111 040301 040511 040613 040614 040615 040616 040617 040651 040652 040653 040654 040401 040201 030201
diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml
index b6c441b19a..03263bb86f 100644
--- a/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml
@@ -25,6 +25,7 @@
Test-20MHz-TM1
tasks
+ 030201
040101
030121 040301 040521 040623 040624 040625 040662 040401 040201 030201
diff --git a/ci-scripts/xml_files/f1_usrp210_band7_test_05mhz.xml b/ci-scripts/xml_files/f1_usrp210_band7_test_05mhz.xml
new file mode 100644
index 0000000000..fdf795fb30
--- /dev/null
+++ b/ci-scripts/xml_files/f1_usrp210_band7_test_05mhz.xml
@@ -0,0 +1,104 @@
+
+
+ test-f1-05
+ Test-F1-CU/DU-05MHz
+ tasks
+
+ 030201
+ 040101
+ 030142 030141 040301 040541 040601 040641 040401 040201 030201 030202
+
+
+
+
+
+ Initialize_eNB
+ Initialize DU (FDD/Band7/5MHz)
+ -O ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf
+ 1
+
+
+
+ Initialize_eNB
+ Initialize CU (FDD/Band7/5MHz)
+ -O ci-scripts/conf_files/cu.band7.tm1.25PRB.conf
+ 0
+
+
+
+ Terminate_eNB
+ Terminate CU
+ 0
+
+
+
+ Terminate_eNB
+ Terminate DU
+ 1
+
+
+
+ Initialize_UE
+ Initialize UE
+
+
+
+ Terminate_UE
+ Terminate UE
+
+
+
+ Attach_UE
+ Attach UE
+
+
+
+ Detach_UE
+ Detach UE
+
+
+
+ Ping
+ ping (5MHz - 20 sec)
+ -c 20
+ 5
+
+
+
+ Iperf
+ iperf (5MHz - DL/15Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 15M -t 30 -i 1
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (5MHz - UL/9Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 9M -t 30 -i 1 -R
+ 60
+ single-ue
+
+
+
diff --git a/ci-scripts/xml_files/f1_usrp210_band7_test_10mhz.xml b/ci-scripts/xml_files/f1_usrp210_band7_test_10mhz.xml
new file mode 100644
index 0000000000..3592759fc6
--- /dev/null
+++ b/ci-scripts/xml_files/f1_usrp210_band7_test_10mhz.xml
@@ -0,0 +1,104 @@
+
+
+ test-f1-10
+ Test-F1-CU/DU-10MHz
+ tasks
+
+ 030201
+ 040101
+ 030152 030151 040301 040551 040611 040651 040401 040201 030201 030202
+
+
+
+
+
+ Initialize_eNB
+ Initialize DU (FDD/Band7/10MHz)
+ -O ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf
+ 1
+
+
+
+ Initialize_eNB
+ Initialize CU (FDD/Band7/10MHz)
+ -O ci-scripts/conf_files/cu.band7.tm1.50PRB.conf
+ 0
+
+
+
+ Terminate_eNB
+ Terminate CU
+ 0
+
+
+
+ Terminate_eNB
+ Terminate DU
+ 1
+
+
+
+ Initialize_UE
+ Initialize UE
+
+
+
+ Terminate_UE
+ Terminate UE
+
+
+
+ Attach_UE
+ Attach UE
+
+
+
+ Detach_UE
+ Detach UE
+
+
+
+ Ping
+ ping (10MHz - 20 sec)
+ -c 20
+ 5
+
+
+
+ Iperf
+ iperf (10MHz - DL/32Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 32M -t 30 -i 1
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (10MHz - UL/15Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 15M -t 30 -i 1 -R
+ 60
+ single-ue
+
+
+
diff --git a/ci-scripts/xml_files/f1_usrp210_band7_test_20mhz.xml b/ci-scripts/xml_files/f1_usrp210_band7_test_20mhz.xml
new file mode 100644
index 0000000000..f2cb155127
--- /dev/null
+++ b/ci-scripts/xml_files/f1_usrp210_band7_test_20mhz.xml
@@ -0,0 +1,104 @@
+
+
+ test-f1-20
+ Test-F1-CU/DU-20MHz
+ tasks
+
+ 030201
+ 040101
+ 030162 030161 040301 040561 040621 040661 040401 040201 030201 030202
+
+
+
+
+
+ Initialize_eNB
+ Initialize DU (FDD/Band7/20MHz)
+ -O ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf
+ 1
+
+
+
+ Initialize_eNB
+ Initialize CU (FDD/Band7/20MHz)
+ -O ci-scripts/conf_files/cu.band7.tm1.100PRB.conf
+ 0
+
+
+
+ Terminate_eNB
+ Terminate CU
+ 0
+
+
+
+ Terminate_eNB
+ Terminate DU
+ 1
+
+
+
+ Initialize_UE
+ Initialize UE
+
+
+
+ Terminate_UE
+ Terminate UE
+
+
+
+ Attach_UE
+ Attach UE
+
+
+
+ Detach_UE
+ Detach UE
+
+
+
+ Ping
+ ping (20MHz - 20 sec)
+ -c 20
+ 5
+
+
+
+ Iperf
+ iperf (20MHz - DL/70Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 70M -t 30 -i 1
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (20MHz - UL/15Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 15M -t 30 -i 1 -R
+ 60
+ single-ue
+
+
+
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml
index 1de23d05d6..00c93f4faf 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml
@@ -25,6 +25,7 @@
Test-05MHz
tasks
+ 030201
040101
030104 030105 040301 040501 040602 040642 040401 040201 030201 030202
@@ -34,7 +35,7 @@
Initialize_eNB
Initialize RRU (TDD/Band40)
- -O ci-scripts/conf_files/rru.tdd.band40.conf
+ -O ci-scripts/conf_files/rru.tdd.band40.conf --RUs.[0].max_rxgain 125
0
@@ -67,30 +68,30 @@
Terminate UE
-
- Attach_UE
- Attach UE
-
+
+ Attach_UE
+ Attach UE
+
-
- Detach_UE
- Detach UE
-
+
+ Detach_UE
+ Detach UE
+
-
- Ping
- ping (5MHz - 20 sec)
- -c 20
- 25
-
+
+ Ping
+ ping (5MHz - 20 sec)
+ -c 20
+ 25
+
-
+
Iperf
iperf (5MHz - DL/6.5Mbps/UDP)(30 sec)(single-ue)
-u -b 6.5M -t 30 -i 1
50
single-ue
-
+
Iperf
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml
index e68a893247..4371cb2a11 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml
@@ -25,23 +25,17 @@
Test-10MHz
tasks
- 000001
-
-
+ 030201
040101
030114 030115 040301 040511 040612 040652 040401 040201 030201 030202
+
+
-
- IdleSleep
- No Test in IF4.5 for FDD-10MHz
- 10
-
-
Initialize_eNB
Initialize RRU (TDD/Band40)
- -O ci-scripts/conf_files/rru.tdd.band40.conf
+ -O ci-scripts/conf_files/rru.tdd.band40.conf --RUs.[0].max_rxgain 120
0
@@ -74,36 +68,36 @@
Terminate UE
-
- Attach_UE
- Attach UE
-
+
+ Attach_UE
+ Attach UE
+
-
- Detach_UE
- Detach UE
-
+
+ Detach_UE
+ Detach UE
+
-
- Ping
- ping (10MHz - 20 sec)
- -c 20
- 25
-
+
+ Ping
+ ping (10MHz - 20 sec)
+ -c 20
+ 25
+
-
- Iperf
- iperf (10MHz - DL/13.5Mbps/UDP)(30 sec)(single-ue)
- -u -b 13.5M -t 30 -i 1
- 50
- single-ue
-
+
+ Iperf
+ iperf (10MHz - DL/13.5Mbps/UDP)(30 sec)(single-ue)
+ -u -b 13.5M -t 30 -i 1
+ 50
+ single-ue
+
Iperf
iperf (10MHz - UL/2Mbps/UDP)(30 sec)(single-ue)
-u -b 2M -t 30 -i 1 -R
- 50
+ 60
single-ue
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml
new file mode 100644
index 0000000000..a2356891f1
--- /dev/null
+++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml
@@ -0,0 +1,104 @@
+
+
+ test-20
+ Test-20MHz
+ tasks
+
+ 030201
+ 040101
+ 030124 030125 040301 040521 040622 040662 040401 040201 030201 030202
+
+
+
+
+
+ Initialize_eNB
+ Initialize RRU (TDD/Band40)
+ -O ci-scripts/conf_files/rru.tdd.band40.conf
+ 0
+
+
+
+ Initialize_eNB
+ Initialize RCC (TDD/Band40/20MHz/info)
+ -O ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf
+ 1
+
+
+
+ Terminate_eNB
+ Terminate RCC
+ 1
+
+
+
+ Terminate_eNB
+ Terminate RRU
+ 0
+
+
+
+ Initialize_UE
+ Initialize UE
+
+
+
+ Terminate_UE
+ Terminate UE
+
+
+
+ Attach_UE
+ Attach UE
+
+
+
+ Detach_UE
+ Detach UE
+
+
+
+ Ping
+ ping (20MHz - 20 sec)
+ -c 20
+ 25
+
+
+
+ Iperf
+ iperf (20MHz - DL/13.5Mbps/UDP)(30 sec)(single-ue)
+ -u -b 13.5M -t 30 -i 1
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (20MHz - UL/2Mbps/UDP)(30 sec)(single-ue)
+ -u -b 2M -t 30 -i 1 -R
+ 50
+ single-ue
+
+
+
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_test_05mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_05mhz.xml
index b0501e9875..1464a4a624 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band7_test_05mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_05mhz.xml
@@ -21,10 +21,11 @@
-->
- test-05
- Test-05MHz
+ test-if4p5-05
+ Test-IF4.5-05MHz
tasks
+ 030201
040101
030101 030102 040301 040501 040604 040642 040401 040201 030201 030202
@@ -34,7 +35,7 @@
Initialize_eNB
Initialize RRU (FDD/Band7)
- -O ci-scripts/conf_files/rru.fdd.band7.conf
+ -O ci-scripts/conf_files/rru.fdd.band7.conf --RUs.[0].max_rxgain 125
1
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml
index 86bd6521ca..98e1aed575 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml
@@ -21,27 +21,21 @@
-->
- test-10
- Test-10MHz
+ test-if4p5-10
+ Test-IF4.5-10MHz
tasks
- 000001
-
-
+ 030201
040101
030111 030112 040301 040511 040614 040652 040401 040201 030201 030202
+
+
-
- IdleSleep
- No Test in IF4.5 for FDD-10MHz
- 10
-
-
Initialize_eNB
Initialize RRU (FDD/Band7)
- -O ci-scripts/conf_files/rru.fdd.band7.conf
+ -O ci-scripts/conf_files/rru.fdd.band7.conf --RUs.[0].max_rxgain 120
1
@@ -74,30 +68,30 @@
Terminate UE
-
- Attach_UE
- Attach UE
-
+
+ Attach_UE
+ Attach UE
+
-
- Detach_UE
- Detach UE
-
+
+ Detach_UE
+ Detach UE
+
-
- Ping
- ping (10MHz - 20 sec)
- -c 20
- 5
-
+
+ Ping
+ ping (10MHz - 20 sec)
+ -c 20
+ 5
+
-
+
Iperf
iperf (10MHz - DL/32Mbps/UDP)(30 sec)(single-ue profile)
-u -b 32M -t 30 -i 1
50
single-ue
-
+
Iperf
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml
index 63997fc925..2cf4e0fbf5 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml
@@ -21,23 +21,17 @@
-->
- test-20
- Test-20MHz
+ test-if4p5-20
+ Test-IF4.5-20MHz
tasks
- 000001
-
-
+ 030201
040101
030121 030122 040301 040521 040624 040662 040401 040201 030201 030202
+
+
-
- IdleSleep
- No Test in IF4.5 for FDD-20MHz
- 10
-
-
Initialize_eNB
Initialize RRU (FDD/Band7)
@@ -74,30 +68,30 @@
Terminate UE
-
- Attach_UE
- Attach UE
-
+
+ Attach_UE
+ Attach UE
+
-
- Detach_UE
- Detach UE
-
+
+ Detach_UE
+ Detach UE
+
-
- Ping
- ping (20MHz - 20 sec)
- -c 20
- 5
-
+
+ Ping
+ ping (20MHz - 20 sec)
+ -c 20
+ 5
+
-
+
Iperf
iperf (20MHz - DL/50Mbps/UDP)(30 sec)(single-ue profile)
-u -b 50M -t 30 -i 1
50
single-ue
-
+
Iperf
diff --git a/ci-scripts/xml_files/test_case_list_template.xml b/ci-scripts/xml_files/test_case_list_template.xml
index 25519dcd03..bdf16af0e3 100644
--- a/ci-scripts/xml_files/test_case_list_template.xml
+++ b/ci-scripts/xml_files/test_case_list_template.xml
@@ -107,6 +107,28 @@
Reboot UE
+
+
+
+ Initialize_CatM_module
+ Initialize CAT-M Module
+
+
+
+ Terminate_CatM_module
+ Terminate CAT-M Module
+
+
+
+ Attach_CatM_module
+ Attach CAT-M Module
+
+
+
+ Detach_CatM_module
+ Detach CAT-M Module
+
+
diff --git a/ci-scripts/xml_files/ue_band20_build.xml b/ci-scripts/xml_files/ue_band20_build.xml
new file mode 100644
index 0000000000..9ca1a2b234
--- /dev/null
+++ b/ci-scripts/xml_files/ue_band20_build.xml
@@ -0,0 +1,38 @@
+
+
+ build-tab
+ Build
+ wrench
+
+090101
+
+
+
+
+ Build_OAI_UE
+ Build OAI UE
+ -w USRP --UE
+
+
+
diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml
new file mode 100644
index 0000000000..594ea7b923
--- /dev/null
+++ b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml
@@ -0,0 +1,50 @@
+
+
+ test-10mhz-orange
+ Test-10Mhz-Orange
+ tasks
+
+ 090109
+ 090110 000001 090109
+
+
+
+
+ Initialize_OAI_UE
+ Initialize OAI UE -- sniffing Orange frequency
+ -C 816000000 -r 50 --ue-rxgain 135 --ue-scan-carrier --no-L2-connect --nokrnmod 1
+
+
+
+ IdleSleep
+ Sleep
+ 30
+
+
+
+ Terminate_OAI_UE
+ Terminate OAI UE
+
+
+
diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml
new file mode 100644
index 0000000000..89370be983
--- /dev/null
+++ b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml
@@ -0,0 +1,50 @@
+
+
+ test-10mHz-sfr
+ Test-10MHz-SFR
+ tasks
+
+ 090109
+ 090111 000001 090109
+
+
+
+
+ Initialize_OAI_UE
+ Initialize OAI UE -- sniffing SFR frequency
+ -C 806000000 -r 50 --ue-rxgain 130 --ue-scan-carrier --no-L2-connect --nokrnmod 1
+
+
+
+ IdleSleep
+ Sleep
+ 30
+
+
+
+ Terminate_OAI_UE
+ Terminate OAI UE
+
+
+
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index a1cbc2516a..075c92ef25 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -23,9 +23,9 @@
cmake_minimum_required (VERSION 3.0)
-#############################################
-# Base directories, compatible with legacy OAI building
-################################################
+#########################################################
+# Base directories, compatible with legacy OAI building #
+#########################################################
set (OPENAIR_DIR $ENV{OPENAIR_DIR})
set (NFAPI_DIR ${OPENAIR_DIR}/nfapi/open-nFAPI)
set (NFAPI_USER_DIR ${OPENAIR_DIR}/nfapi/oai_integration)
@@ -176,7 +176,6 @@ set(CMAKE_C_FLAGS
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 -D${MKVER}"
)
-add_definitions("-DASN_DISABLE_OER_SUPPORT")
#########################
@@ -184,7 +183,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU
#########################
# set a flag for changes in the source code
# these changes are related to hardcoded path to include .h files
-add_definitions(-DCMAKER)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2")
@@ -229,11 +227,10 @@ add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_CO
add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"")
-
# Debug related options
#########################################
add_boolean_option(ASN_DEBUG False "ASN1 coder/decoder Debug")
-add_boolean_option(EMIT_ASN_DEBUG False "ASN1 coder/decoder Debug")
+add_boolean_option(ASN_EMIT_DEBUG False "ASN1 coder/decoder Debug")
add_boolean_option(MSG_PRINT False "print debug messages")
add_boolean_option(DISABLE_XER_PRINT False "print XER Format")
add_boolean_option(XER_PRINT False "print XER Format")
@@ -253,7 +250,7 @@ add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace")
add_boolean_option(DISABLE_LOG_X False "Deactivate all LOG_* macros")
add_boolean_option(USRP_REC_PLAY False "Enable USRP record playback mode")
add_boolean_option(UE_NAS_USE_TUN False "Enable UE NAS TUN device instead of ue_ip.ko")
-add_boolean_option(NOS1 False "Allows to run without a EPC")
+add_boolean_option(NOS1 False "Allows to run without a EPC")
add_boolean_option(BASIC_SIMULATOR False "Has to be True when building the basic simulator, False otherwise")
add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
@@ -271,9 +268,9 @@ add_dependencies(ITTI rrc_flag)
set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c)
endif (${ENABLE_ITTI})
-#############################
-# ASN.1 grammar C code generation & dependencies
-################################
+##################################################
+# ASN.1 grammar C code generation & dependencies #
+##################################################
# A difficulty: asn1c generates C code of a un-predictable list of files
# so, generate the c from asn1c once at cmake run time
# So, if someone modify the asn.1 source file in such as way that it will create
@@ -292,36 +289,36 @@ add_list2_option(RRC_ASN1_VERSION "Rel15" "ASN.1 version of RRC interface" "Rel8
if (${RRC_ASN1_VERSION} STREQUAL "Rel8")
- make_version(RRC_VERSION 8 6 0)
+ make_version(LTE_RRC_VERSION 8 6 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "CBA")
- make_version(RRC_VERSION 10 2 0)
+ make_version(LTE_RRC_VERSION 10 2 0)
add_definitions(-DCBA)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10")
- make_version(RRC_VERSION 10 2 0)
+ make_version(LTE_RRC_VERSION 10 2 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel11")
- make_version(RRC_VERSION 11 18 0)
+ make_version(LTE_RRC_VERSION 11 18 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-11.18.0.asn1)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel12")
- make_version(RRC_VERSION 12 16 0)
+ make_version(LTE_RRC_VERSION 12 16 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-12.16.0.asn1)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel13")
- make_version(RRC_VERSION 13 9 1)
+ make_version(LTE_RRC_VERSION 13 9 1)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel14")
- make_version(RRC_VERSION 14 7 0)
+ make_version(LTE_RRC_VERSION 14 7 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.7.0.asn1)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel15")
- make_version(RRC_VERSION 15 3 0)
- set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.3.0.asn1)
+ make_version(LTE_RRC_VERSION 15 2 2)
+ set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.2.2.asn1)
endif (${RRC_ASN1_VERSION} STREQUAL "Rel8")
-add_definitions(-DRRC_VERSION=${RRC_VERSION})
+add_definitions(-DLTE_RRC_VERSION=${LTE_RRC_VERSION})
set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}"
+execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_"
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
@@ -329,10 +326,11 @@ endif (NOT ${ret} STREQUAL 0)
file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
add_custom_target (
rrc_flag ALL
- ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}"
+ ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_"
DEPENDS ${RRC_GRAMMAR}
)
+set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code
add_library(RRC_LIB ${rrc_source}
${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg.c
${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c)
@@ -340,7 +338,7 @@ add_dependencies(RRC_LIB rrc_flag)
include_directories ("${RRC_FULL_DIR}")
#NR RRC
-######
+#######
add_list2_option(NR_RRC_ASN1_VERSION "NR_Rel15" "ASN.1 version of NR_RRC interface")
@@ -506,15 +504,63 @@ add_library(X2AP_ENB
${X2AP_DIR}/x2ap_eNB_itti_messaging.c
${X2AP_DIR}/x2ap_eNB_management_procedures.c
${X2AP_DIR}/x2ap_eNB_generate_messages.c
+ ${X2AP_DIR}/x2ap_ids.c
+ ${X2AP_DIR}/x2ap_timers.c
)
add_dependencies(X2AP_ENB rrc_flag x2_flag)
+
+# F1AP
+##############
+add_list1_option(F1AP_RELEASE R15 "F1AP ASN.1 grammar version" R15)
+set(F1AP_DIR ${OPENAIR2_DIR}/F1AP)
+if (${F1AP_RELEASE} STREQUAL "R15")
+ make_version(F1AP_VERSION 15 2 1)
+ set (ASN1RELDIR R15.2.1)
+endif(${F1AP_RELEASE} STREQUAL "R15")
+add_definitions(-DF1AP_VERSION=${F1AP_VERSION})
+set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
+set(F1AP_ASN_FILES
+ ${F1AP_ASN_DIR}/F1AP-CommonDataTypes.asn
+ ${F1AP_ASN_DIR}/F1AP-Constants.asn
+ ${F1AP_ASN_DIR}/F1AP-PDU-Descriptions.asn
+ ${F1AP_ASN_DIR}/F1AP-PDU-Contents.asn
+ ${F1AP_ASN_DIR}/F1AP-IEs.asn
+ ${F1AP_ASN_DIR}/F1AP-Containers.asn
+ )
+
+set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR})
+message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}")
+execute_process(COMMAND mkdir -p ${F1AP_ASN_GENERATED_C_DIR}
+ COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}
+ RESULT_VARIABLE ret
+ OUTPUT_QUIET
+ ERROR_QUIET)
+
+if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "asn1c: error")
+endif (NOT ${ret} STREQUAL 0)
+
+file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c)
+add_library(F1AP_LIB
+ ${F1AP_ASN_GENERATED_C_FILES}
+)
+
+include_directories ("${F1AP_ASN_GENERATED_C_DIR}")
+include_directories ("${F1AP_DIR}")
+
+file(GLOB F1AP_C_FILES ${F1AP_DIR}/*.c)
+add_library(F1AP
+ ${F1AP_C_FILES}
+)
+
+
# Hardware dependant options
###################################
add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
-add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR")
+add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR" "OAI_SIMU")
if (NOT ${RF_BOARD} STREQUAL "None")
add_definitions(-DMANAGED_RF=1)
endif()
@@ -584,6 +630,15 @@ set(TPLIB_ETHERNET_SOURCE
)
add_library(oai_eth_transpro MODULE ${TPLIB_ETHERNET_SOURCE} )
+include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/")
+set(option_HWIRISLIB_lib "-l SoapySDR")
+set(HWLIB_IRIS_SOURCE
+ ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp
+ )
+add_library(oai_irisdevif MODULE ${HWLIB_IRIS_SOURCE})
+target_include_directories(oai_irisdevif PRIVATE /usr/local/lib/SoapySDR/modules0.7/)
+target_link_libraries(oai_irisdevif SoapySDR)
+
include_directories("${OPENAIR_TARGETS}/ARCH/mobipass/")
set(TPLIB_MOBIPASS_SOURCE
${OPENAIR_TARGETS}/ARCH/mobipass/interface.c
@@ -631,7 +686,6 @@ Message("CPU_Affinity flag is ${CPU_AFFINITY}")
##############################################################
# ???!!! TO BE DOCUMENTED OPTIONS !!!???
##############################################################
-add_boolean_option(ENABLE_SECURITY True "Enable LTE integrity and ciphering between RRC UE and eNB")
add_boolean_option(ENABLE_USE_MME True "eNB connected to MME (INTERFACE S1-C), not standalone eNB")
add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO")
add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the default bearer")
@@ -652,6 +706,11 @@ add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION w
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE")
+########################
+# Include order
+##########################
+add_boolean_option(ENB_MODE True "Swap the include directories between openair2 and openair3" )
+
##########################
# SCHEDULING/REAL-TIME/PERF options
##########################
@@ -660,7 +719,6 @@ add_boolean_option(ENABLE_VCD True "always true now, time measurem
add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)")
add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???")
add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False")
-add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true")
add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true")
##########################
@@ -724,10 +782,10 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE
##########################
# PDCP LAYER OPTIONS
##########################
-add_boolean_option(PDCP_USE_NETLINK False "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO")
-add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues")
-add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver")
-add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)")
+#add_boolean_option(PDCP_USE_NETLINK False "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO")
+#add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues")
+#add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver")
+#add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)")
##########################
# RRC LAYER OPTIONS
@@ -768,6 +826,9 @@ include_directories("${NFAPI_DIR}/sim_common/inc")
include_directories("${NFAPI_DIR}/pnf_sim/inc")
include_directories("${OPENAIR1_DIR}")
include_directories("${OPENAIR2_DIR}")
+include_directories("${OPENAIR3_DIR}/NAS/TOOLS")
+include_directories("${OPENAIR2_DIR}/ENB_APP")
+include_directories("${OPENAIR2_DIR}/GNB_APP")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0")
@@ -790,20 +851,21 @@ include_directories("${OPENAIR3_DIR}/SECU")
include_directories("${OPENAIR3_DIR}/SCTP")
include_directories("${OPENAIR3_DIR}/S1AP")
include_directories("${OPENAIR2_DIR}/X2AP")
+include_directories("${OPENAIR2_DIR}/F1AP")
include_directories("${OPENAIR3_DIR}/UDP")
include_directories("${OPENAIR3_DIR}/GTPV1-U")
include_directories("${OPENAIR_DIR}/targets/COMMON")
include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS")
-include_directories("${OPENAIR2_DIR}/ENB_APP")
-include_directories("${OPENAIR2_DIR}/GNB_APP")
+include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PHY")
include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC")
include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC")
include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP")
include_directories("${OPENAIR2_DIR}/UTIL/OSA")
include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc")
include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc")
+include_directories("${OPENAIR2_DIR}/LAYER2/PROTO_AGENT")
include_directories("${OPENAIR2_DIR}/UTIL/MEM")
include_directories("${OPENAIR2_DIR}/UTIL/LISTS")
include_directories("${OPENAIR2_DIR}/UTIL/FIFO")
@@ -845,7 +907,7 @@ set(FLPT_MSG_FILES
${FLPT_MSG_DIR}/control_delegation.proto
)
-set(FLPT_C_DIR ${protobuf_generated_dir}/${FLPTDIR})
+set(FLPT_C_DIR ${protobuf_generated_dir}/FLPT_${FLPTDIR})
#message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}")
execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES})
file(GLOB FLPT_source ${FLPT_C_DIR}/*.c)
@@ -888,6 +950,7 @@ add_library(FLEXRAN_AGENT
${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_timer.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c
+ ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c
@@ -913,6 +976,63 @@ MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES)
#set(PROTOBUF_LIB "protobuf") #for Cpp
+# set the version of protobuf messages, V3 not supported yet
+add_list1_option(FSPT_VERSION V2 "FSPT MSG protobuf grammar version" V2 V3)
+
+if (${FSPT_VERSION} STREQUAL "V2")
+ set (FSPTDIR V2)
+elseif (${FSPT_VERSION} STREQUAL "V3")
+ set (FSPTDIR V3)
+endif(${FSPT_VERSION} STREQUAL "V2")
+
+set(FSPT_MSG_DIR ${OPENAIR_DIR}/targets/COMMON/MESSAGES/${FSPTDIR} )
+set(FSPT_MSG_FILES
+ ${FSPT_MSG_DIR}/flexsplit.proto
+ )
+
+set(FSPT_C_DIR ${protobuf_generated_dir}/FSPT_${FSPTDIR})
+message("calling protoc_call=${protoc_call} FSPT_C_DIR=${FSPT_C_DIR} FSPT_MSG_DIR=${FSPT_MSG_DIR} FSPT_MSG_FILES=${FSPT_MSG_FILES}")
+execute_process(COMMAND ${protoc_call} ${FSPT_C_DIR} ${FSPT_MSG_DIR} ${FSPT_MSG_FILES})
+file(GLOB FSPT_source ${FSPT_C_DIR}/*.c)
+set(FSPT_OAI_generated
+ ${FSPT_C_DIR}/flexsplit.pb-c.c
+ )
+
+file(GLOB fspt_h ${FSPT_C_DIR}/*.h)
+set(fspt_h ${fspt_h} )
+
+add_library(FSPT_MSG
+ ${FSPT_OAI_generated}
+ ${FSPT_source}
+ )
+set(FSPT_MSG_LIB FSPT_MSG)
+message("fspt c dir is : ${FSPT_C_DIR}")
+include_directories (${FSPT_C_DIR})
+
+# add_library(ASYNC_IF
+# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c
+# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c
+# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c
+# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c
+# )
+# set(ASYNC_IF_LIB ASYNC_IF)
+# include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF)
+
+add_library(PROTO_AGENT
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c
+ )
+set(PROTO_AGENT_LIB PROTO_AGENT)
+include_directories(${OPENAIR2_DIR}/LAYER2/PROTO_AGENT)
+
+
+
+set(PROTOBUF_LIB "protobuf-c")
+
+#set(PROTOBUF_LIB "protobuf") #for Cpp
add_library(HASHTABLE
${OPENAIR_DIR}/common/utils/hashtable/hashtable.c
@@ -948,7 +1068,7 @@ set(UTIL_SRC
# ${OPENAIR2_DIR}/UTIL/OMG/job.c
# ${OPENAIR2_DIR}/UTIL/OMG/mobility_parser.c
# ${OPENAIR2_DIR}/UTIL/OMG/omg.c
- #${OPENAIR2_DIR}/UTIL/OMG/omg_hashtable.c
+# ${OPENAIR2_DIR}/UTIL/OMG/omg_hashtable.c
# ${OPENAIR2_DIR}/UTIL/OMG/rwalk.c
# ${OPENAIR2_DIR}/UTIL/OMG/rwp.c
# ${OPENAIR2_DIR}/UTIL/OMG/static.c
@@ -1005,6 +1125,7 @@ set(SCHED_SRC
)
add_library(SCHED_LIB ${SCHED_SRC})
add_dependencies(SCHED_LIB rrc_flag)
+
set(SCHED_NR_SRC
${OPENAIR1_DIR}/SCHED_NR/fapi_nr_l1.c
${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c
@@ -1029,6 +1150,7 @@ set(SCHED_SRC_UE
)
add_library(SCHED_UE_LIB ${SCHED_SRC_UE})
add_dependencies(SCHED_UE_LIB rrc_flag)
+
set(SCHED_SRC_NR_UE
${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_ue.c
${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c
@@ -1040,6 +1162,7 @@ set(SCHED_SRC_NR_UE
)
add_library(SCHED_NR_UE_LIB ${SCHED_SRC_NR_UE})
+
# nFAPI
#################################
set(NFAPI_COMMON_SRC
@@ -1257,7 +1380,6 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz_ue.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
- ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
@@ -1367,6 +1489,7 @@ add_library(PHY_UE ${PHY_SRC_UE})
add_dependencies(PHY_UE rrc_flag)
add_library(PHY_NR ${PHY_NR_SRC})
add_library(PHY_NR_UE ${PHY_NR_UE_SRC})
+
add_library(PHY_RU ${PHY_SRC_RU})
add_dependencies(PHY_RU rrc_flag)
@@ -1448,7 +1571,7 @@ set(L2_SRC
${RLC_DIR}/rlc.c
${RLC_DIR}/rlc_rrc.c
${RLC_DIR}/rlc_mpls.c
- ${RRC_DIR}/rrc_UE.c
+# ${RRC_DIR}/rrc_UE.c
${RRC_DIR}/rrc_eNB.c
${RRC_DIR}/rrc_eNB_S1AP.c
${RRC_DIR}/rrc_eNB_UE_context.c
@@ -1569,6 +1692,8 @@ set (MAC_NR_SRC_UE
set (ENB_APP_SRC
${OPENAIR2_DIR}/ENB_APP/enb_app.c
${OPENAIR2_DIR}/ENB_APP/enb_config.c
+ ${OPENAIR2_DIR}/ENB_APP/enb_config_SL.c
+ ${OPENAIR2_DIR}/ENB_APP/enb_config_eMTC.c
${OPENAIR2_DIR}/ENB_APP/RRC_config_tools.c
)
@@ -1603,20 +1728,16 @@ add_library(L2_UE
${L2_SRC_UE}
${MAC_SRC_UE}
)
+
if (NOT ${NOS1})
target_compile_definitions(L2_UE PUBLIC -DPDCP_USE_NETLINK)
endif()
add_dependencies(L2_UE rrc_flag s1ap_flag x2_flag)
-add_library( NR_L2_UE
- ${NR_L2_SRC_UE}
- ${MAC_NR_SRC_UE}
- )
+add_library( NR_L2_UE ${NR_L2_SRC_UE} ${MAC_NR_SRC_UE} )
-add_library( MAC_NR_COMMON
- ${OPENAIR2_DIR}/LAYER2/NR_MAC_gNB/nr_mac_common.c
- )
+add_library( MAC_NR_COMMON ${OPENAIR2_DIR}/LAYER2/NR_MAC_gNB/nr_mac_common.c )
include_directories("${OPENAIR2_DIR}/NR_UE_PHY_INTERFACE")
include_directories("${OPENAIR2_DIR}/LAYER2/NR_MAC_UE")
@@ -2029,6 +2150,15 @@ include_directories(${CRYPTO_INCLUDE_DIRS})
if (${RF_BOARD} STREQUAL "OAI_USRP")
find_package(Boost REQUIRED)
include_directories(${LIBBOOST_INCLUDE_DIR})
+
+elseif (${RF_BOARD} STREQUAL "OAI_IRIS")
+ include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/")
+ include_directories("/usr/local/include/")
+ set(HW_SOURCE ${HW_SOURCE}
+ ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp)
+ LINK_DIRECTORIES("/usr/local/lib")
+ set(option_HW_lib "-lSoapySDR -rdynamic -ldl")
+
endif (${RF_BOARD} STREQUAL "OAI_USRP")
pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2)
@@ -2170,10 +2300,13 @@ add_executable(lte-softmodem
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
+ ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+ ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
+ ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
@@ -2191,11 +2324,39 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag)
target_link_libraries (lte-softmodem
-Wl,--start-group
- RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
- ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
+ RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
+ ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl)
+add_executable(cu_test
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/cu_test.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c
+ ${T_SOURCE}
+)
+target_link_libraries(cu_test
+ ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB}
+ ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ${ITTI_LIB}
+)
+
+add_executable(du_test
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/du_test.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c
+ ${T_SOURCE}
+)
+target_link_libraries(du_test
+ ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB}
+ ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ${ITTI_LIB}
+)
+
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES})
@@ -2208,6 +2369,7 @@ add_executable(lte-softmodem-nos1
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
+ ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
@@ -2217,25 +2379,29 @@ add_executable(lte-softmodem-nos1
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
+ ${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
+ ${GTPU_need_ITTI}
${XFORMS_SOURCE}
${XFORMS_SOURCE_SOFTMODEM}
${T_SOURCE}
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
+
+add_dependencies(lte-softmodem-nos1 rrc_flag s1ap_flag x2_flag)
+
target_link_libraries (lte-softmodem-nos1
-Wl,--start-group
- RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${RAL_LIB} ${ITTI_LIB}
- ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
+ RRC_LIB F1AP F1AP_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
+ ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
- -Wl,--end-group z dl )
+ -Wl,--end-group z dl)
target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 ${T_LIB})
-
# lte-uesoftmodem is UE implementation
#######################################
@@ -2243,11 +2409,14 @@ add_executable(lte-uesoftmodem
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
+ ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+ ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
+ ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
@@ -2262,12 +2431,13 @@ add_executable(lte-uesoftmodem
)
add_dependencies(lte-uesoftmodem rrc_flag s1ap_flag x2_flag)
+
if (NOT ${NOS1})
target_compile_definitions(lte-uesoftmodem PRIVATE -DPDCP_USE_NETLINK)
endif()
target_link_libraries (lte-uesoftmodem
-Wl,--start-group
- RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU
+ RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP F1AP_LIB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl)
@@ -2283,6 +2453,7 @@ add_executable(lte-uesoftmodem-nos1
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
+ ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
@@ -2293,6 +2464,7 @@ add_executable(lte-uesoftmodem-nos1
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
+ ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${XFORMS_SOURCE}
@@ -2303,18 +2475,20 @@ add_executable(lte-uesoftmodem-nos1
)
add_dependencies(lte-uesoftmodem-nos1 rrc_flag s1ap_flag x2_flag)
+
target_link_libraries (lte-uesoftmodem-nos1
-Wl,--start-group
- RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU ${RAL_LIB} ${ITTI_LIB}
- ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
+ RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP F1AP_LIB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU
+ ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
- -Wl,--end-group z dl )
+ -Wl,--end-group z dl)
target_link_libraries (lte-uesoftmodem-nos1 ${LIBXML2_LIBRARIES})
target_link_libraries (lte-uesoftmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
target_link_libraries (lte-uesoftmodem-nos1 ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB})
+
# nr-softmodem
###################################################
@@ -2463,6 +2637,7 @@ target_link_libraries (nr-uesoftmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt cryp
target_link_libraries (nr-uesoftmodem-nos1 ${LIB_LMS_LIBRARIES})
target_link_libraries (nr-uesoftmodem-nos1 ${T_LIB})
+
# USIM process
#################
#add_executable(usim
@@ -2555,10 +2730,11 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
${T_SOURCE}
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
+ ${NFAPI_USER_DIR}/nfapi.c
)
target_link_libraries (${myExe}
-Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
- pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
+ pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
)
endforeach(myExe)
@@ -2568,11 +2744,10 @@ add_executable(test_epc_generate_scenario
${OPENAIR2_DIR}/ENB_APP/enb_config.h
${OPENAIR2_DIR}/COMMON/commonDef.h
${OPENAIR2_DIR}/COMMON/messages_def.h
- ${OPENAIR2_DIR}/COMMON/messages_types.h
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
)
target_link_libraries (test_epc_generate_scenario
- -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
+ -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
add_executable(test_epc_play_scenario
@@ -2588,11 +2763,10 @@ add_executable(test_epc_play_scenario
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h
${OPENAIR2_DIR}/COMMON/commonDef.h
${OPENAIR2_DIR}/COMMON/messages_def.h
- ${OPENAIR2_DIR}/COMMON/messages_types.h
)
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario
- -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
+ -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
@@ -2627,69 +2801,18 @@ if (${T_TRACER})
lte-softmodem lte-softmodem-nos1 lte-uesoftmodem lte-uesoftmodem-nos1
nr-softmodem nr-softmodem-nos1 nr-uesoftmodem nr-uesoftmodem-nos1
dlsim_tm4 nr_dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
- pdcchsim pucchsim prachsim syncsim ulsim
- ldpctest polartest
+ pdcchsim pucchsim prachsim syncsim ulsim ldpctest polartest
+ cu_test du_test
#all "add_library" definitions
-ITTI
-RRC_LIB
-NR_RRC_LIB
-S1AP_LIB
-S1AP_ENB
-X2AP_LIB
-X2AP_ENB
-params_libconfig
-oai_exmimodevif
-oai_usrpdevif
-oai_bladerfdevif
-oai_lmssdrdevif
-oai_eth_transpro
-oai_mobipass
-tcp_bridge
-tcp_bridge_oai
-coding
-FLPT_MSG
-ASYNC_IF
-FLEXRAN_AGENT
-HASHTABLE
-MSC
-UTIL
-SECU_OSA
-SECU_CN
-SCHED_LIB
-SCHED_NR_LIB
-SCHED_RU_LIB
-SCHED_UE_LIB
-SCHED_NR_UE_LIB
-NFAPI_COMMON_LIB
-NFAPI_LIB
-NFAPI_PNF_LIB
-NFAPI_VNF_LIB
-NFAPI_USER_LIB
-PHY_COMMON
-PHY
-PHY_UE
-PHY_NR
-PHY_NR_UE
-PHY_RU
-PHY_MEX
-L2
-L2_NR
-L2_UE
-NR_L2_UE
-MAC_NR_COMMON
-MAC_NR
-MAC_UE_NR
-CN_UTILS
-GTPV1U
-SCTP_CLIENT
-UDP
-LIB_NAS_UE
-NB_IoT
-LFDS
-LFDS7
-SIMU
-SIMU_ETH
-OPENAIR0_LIB)
+ ITTI RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP_LIB
+ F1AP params_libconfig oai_exmimodevif oai_usrpdevif oai_bladerfdevif
+ oai_lmssdrdevif oai_eth_transpro oai_mobipass tcp_bridge tcp_bridge_oai
+ coding FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO
+ SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB
+ SCHED_NR_UE_LIB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB
+ NFAPI_USER_LIB PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_UE PHY_RU PHY_MEX
+ L2 L2_NR L2_UE NR_L2_UE MAC_NR_COMMON MAC_NR MAC_UE_NR CN_UTILS GTPV1U
+ SCTP_CLIENT UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU SIMU_ETH OPENAIR0_LIB)
if (TARGET ${i})
add_dependencies(${i} generate_T)
endif()
diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt
old mode 100755
new mode 100644
index 54f369f977..bd71125cf0
--- a/cmake_targets/at_commands/CMakeLists.txt
+++ b/cmake_targets/at_commands/CMakeLists.txt
@@ -76,7 +76,6 @@ macro(add_boolean_option name val helpstr)
endmacro(add_boolean_option)
# compilation flags
-# added CMAKER conditional compilation to not bother legacy building system
#############################################
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
@@ -84,7 +83,7 @@ endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel)
#
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -DCMAKER")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat ")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb -DMALLOC_CHECK_=3 -O2")
diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml
index 792e46cec6..d44a37ed17 100644
--- a/cmake_targets/autotests/test_case_list.xml
+++ b/cmake_targets/autotests/test_case_list.xml
@@ -965,7 +965,7 @@
-m26 -gF -s17.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -O60
-m26 -gF -s17.3 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1600 -O60
-m26 -gF -s16.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1899 -O60
- -m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O60
+ -m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O60
-m13 -gF -s5.9 -w1.0 -f.2 -n500 -B25 -c3 -x2 -y2 -z2 -O60
dlsim.test1 dlsim.test5 dlsim.test6 dlsim.test6b dlsim.test7 dlsim.test7b dlsim.test10 dlsim.test10b dlsim.test11 dlsim.test11a dlsim.test11b dlsim.test11c dlsim.TM2_test1 dlsim.TM2_test1b
"passed"
@@ -989,9 +989,9 @@
$OPENAIR_DIR/targets/bin/ulsim.Rel15
-BnbRBs=25 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=25 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
- -BnbRBs=50 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
+ -BnbRBs=50 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=50 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
- -BnbRBs=100 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
+ -BnbRBs=100 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=100 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
ulsim.test1 ulsim.test2 ulsim.test3 ulsim.test4 ulsim.test5 ulsim.test6
"passed"
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
index 398b763888..d99ca88807 100644
--- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth6";
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
index 46b6484737..86c54a82f7 100644
--- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth6";
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
index 93b82773e6..dad0ab5a23 100644
--- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth6";
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
index b412b00e52..369b6184fd 100644
--- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
index f0d688903a..14ae99c80c 100644
--- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
index 929c91fffb..9302ac7c58 100644
--- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
index 98358eb269..0ae9e659b4 100644
--- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
+++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
index bc31e051e5..1d22c19ec8 100644
--- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
+++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
index 2cfc227e67..3f35175ff4 100644
--- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
+++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
index 9b135a9498..0a6a8cccc6 100644
--- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
+++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
@@ -143,6 +143,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
index 9f84057299..7ffdd063a6 100644
--- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
+++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
@@ -143,6 +143,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
index 7197e93322..409fa49910 100644
--- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
+++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
@@ -143,6 +143,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index af051abab7..bdfc7e5a59 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -109,12 +109,14 @@ Options
Specify gen_nvram_path (default \"$gen_nvram_path\")
--HWLAT
Makes test program for haw latency tests
+-a | --agent
+ Enables agent for software-defined control of the eNB
-r | --3gpp-release
default is Rel14,
Rel8 limits the implementation to 3GPP Release 8 version
Rel10 limits the implementation to 3GPP Release 10 version
-w | --hardware
- EXMIMO, USRP, BLADERF, ETHERNET, LMSSDR, ADRV9371_ZC706, SIMU, None (Default)
+ EXMIMO, USRP, BLADERF, ETHERNET, LMSSDR, IRIS, ADRV9371_ZC706, SIMU, None (Default)
Adds this RF board support (in external packages installation and in compilation)
-t | --transport protocol
ETHERNET , None
@@ -238,6 +240,10 @@ function main() {
UE_EXPANSION="True"
echo_info "Will compile with UE_EXPANSION"
shift;;
+ --musim)
+ UESIM_EXPANSION="True"
+ echo_info "Will compile with UESIM_EXPANSION"
+ shift;;
--UE-conf-nvram)
conf_nvram_path=$(readlink -f $2)
shift 2;;
@@ -249,36 +255,29 @@ function main() {
echo_info "Setting release to: $REL"
shift 2;;
-w | --hardware)
- HW="$2" #"${i#*=}"
- # Use OAI_USRP as the key word USRP is used inside UHD driver
- if [ "$HW" != "BLADERF" -a "$HW" != "USRP" -a "$HW" != "LMSSDR" -a "$HW" != "None" -a "$HW" != "EXMIMO" -a "$HW" != "ADRV9371_ZC706" -a "$HW" != "SIMU" ] ; then
- echo_fatal "Unknown HW type $HW will exit..."
- else
- if [ "$HW" == "USRP" ] ; then
- HW="OAI_USRP"
- fi
- if [ "$HW" == "ADRV9371_ZC706" ] ; then
- HW="OAI_ADRV9371_ZC706"
- fi
- if [ "$HW" == "BLADERF" ] ; then
- HW="OAI_BLADERF"
- fi
- if [ "$HW" == "LMSSDR" ] ; then
- HW="OAI_LMSSDR"
- fi
- if [ "$HW" == "SIMU" ] ; then
- HW="OAI_SIMU"
- fi
- echo_info "Setting hardware to: $HW"
- fi
+ # Use OAI_USRP as the key word USRP is used inside UHD driver
+ case "$2" in
+ "EXMIMO")
+ HW="EXMIMO"
+ ;;
+ "USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "ADRV9371_ZC706" | "SIMU")
+ HW="OAI_"$2
+ ;;
+ "None")
+ HW="None"
+ ;;
+ *)
+ echo_fatal "Unknown HW type $HW: exit..."
+ esac
+ echo_info "Setting hardware to: $HW"
shift 2;;
- -t | --transport_protocol)
- TP="$2" #"${i#*=}"
- if [ "$TP" != "ETHERNET" -a "$TP" != "None" ] ; then
- echo_fatal "Unknown TP type $TP will exit..."
- else
- echo_info "Setting transport protocol to: $TP"
- fi
+ -t | --transport_protocol)
+ TP="$2" #"${i#*=}"
+ if [ "$TP" != "ETHERNET" -a "$TP" != "None" ] ; then
+ echo_fatal "Unknown TP type $TP will exit..."
+ else
+ echo_info "Setting transport protocol to: $TP"
+ fi
shift 2;;
--phy_simulators)
SIMUS_PHY=1
@@ -404,11 +403,11 @@ function main() {
BASIC_SIMULATOR=1
echo_info "Compiling the basic simulator"
shift 1;;
- --rfsimulator)
- RFSIMULATOR=true
- echo_info "Compiling the RF simulator"
- shift 1;;
- -h | --help)
+ --rfsimulator)
+ RFSIMULATOR=true
+ echo_info "Compiling the RF simulator"
+ shift 1;;
+ -h | --help)
print_help
exit 1;;
*)
@@ -449,18 +448,18 @@ function main() {
fi
fi
- echo_info "RF HW set to $HW"
- # If the user doesn't specify the Linux scheduler to use, we set a value
- if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then
- case "$HW" in
- "EXMIMO")
+ echo_info "RF HW set to $HW"
+ # If the user doesn't specify the Linux scheduler to use, we set a value
+ if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then
+ case "$HW" in
+ "EXMIMO")
DEADLINE_SCHEDULER_FLAG_USER="True"
;;
- *)
+ *)
DEADLINE_SCHEDULER_FLAG_USER="False"
;;
- esac
- fi
+ esac
+ fi
#Disable CPU Affinity for deadline scheduler
if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "True" ] ; then
@@ -524,6 +523,13 @@ function main() {
flash_firmware_bladerf
fi
fi
+ if [ "$HW" == "OAI_IRIS" ] ; then
+ echo_info "installing packages for IRIS support"
+ check_install_soapy
+ #if [ ! "$DISABLE_HARDWARE_DEPENDENCY" == "True" ]; then
+ # flash_firmware_iris
+ #fi
+ fi
echo_info "installing protobuf/protobuf-c for flexran agent support"
install_protobuf_from_source
install_protobuf_c_from_source
@@ -565,6 +571,8 @@ function main() {
if [ "$T_TRACER" = "False" ] ; then
lte_build_dir=${lte_build_dir}_noLOG
fi
+
+ lte_build_dir="lte${noS1Dir}_build_oai${noLOGDirsuffix}"
# configuration module libraries, one currently available, using libconfig
config_libconfig_shlib=params_libconfig
@@ -585,6 +593,7 @@ function main() {
echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file
# echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file
+ echo "set ( UESIM_EXPANSION $UESIM_EXPANSION )" >> $cmake_file
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( NR_RRC_ASN1_VERSION \"${NR_REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
@@ -634,7 +643,29 @@ function main() {
fi
fi
- if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then
+ if [ "$UE" = 1 ] ; then
+ lte_exec=lte-uesoftmodem${bin_suffix}
+ compilations \
+ $lte_build_dir $lte_exec \
+ $lte_exec $dbin/$lte_exec.$REL
+
+ # mandatory shared lib
+ compilations \
+ $lte_build_dir $config_libconfig_shlib \
+ lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
+ compilations \
+ $lte_build_dir coding \
+ libcoding.so $dbin/libcoding.so
+
+ if [ "$NOS1" = "1" ] ; then
+ compilations \
+ $lte_build_dir nasmesh \
+ CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+ compilations \
+ $lte_build_dir rb_tool \
+ rb_tool $dbin/rb_tool
+ cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
+ else
# ue_ip driver compilation
echo_info "Compiling UE specific part"
compilations \
@@ -674,6 +705,7 @@ function main() {
echo_warning "not generated UE NAS files: binaries not found"
fi
fi
+ fi
if [ "$SIMUS_PHY" = "1" -o "$SIMUS_CORE" = "1" ] ; then
cd $OPENAIR_DIR/cmake_targets/phy_simulators
@@ -698,6 +730,9 @@ function main() {
compilations \
phy_simulators coding \
libcoding.so $dbin/libcoding.so
+# compilations \
+# lte-simulators $config_libconfig_shlib \
+# lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
fi
# Core simulators
@@ -735,23 +770,19 @@ function main() {
cp $OPENAIR_DIR/cmake_targets/tools/init_exmimo2 $dbin
fi
-
-
# Telnet server compilation
#####################
if [ "$BUILD_TELNETSRV" = "1" ] ; then
- build_dir=$build_dir
compilations \
- $build_dir telnetsrv \
+ $lte_build_dir telnetsrv \
libtelnetsrv.so $dbin/libtelnetsrv.so
fi
- # Telnet server compilation
+ # msc library compilation
#####################
if [ "$MSC_GEN" = "1" ] ; then
- build_dir=$lte_build_dir
compilations \
- $build_dir msc \
+ $lte_build_dir msc \
libmsc.so $dbin/libmsc.so
fi
@@ -815,8 +846,6 @@ function main() {
#####################################
if [ "$eNB" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
- build_dir=$build_dir
-
# build RF device libraries
if [ "$HW" != "None" ] ; then
rm -f liboai_device.so
@@ -825,7 +854,7 @@ function main() {
# link liboai_device.so with the selected RF device library
if [ "$HW" == "EXMIMO" ] ; then
compilations \
- $build_dir oai_exmimodevif \
+ $lte_build_dir oai_exmimodevif \
liboai_exmimodevif.so $dbin/liboai_exmimodevif.so.$REL
ln -sf liboai_exmimodevif.so liboai_device.so
@@ -847,7 +876,7 @@ function main() {
elif [ "$HW" == "OAI_USRP" ] ; then
compilations \
- $build_dir oai_usrpdevif \
+ $lte_build_dir oai_usrpdevif \
liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
ln -sf liboai_usrpdevif.so liboai_device.so
@@ -856,7 +885,7 @@ function main() {
elif [ "$HW" == "OAI_BLADERF" ] ; then
if [ -f "/usr/include/libbladeRF.h" ] ; then
compilations \
- $build_dir oai_bladerfdevif \
+ $lte_build_dir oai_bladerfdevif \
liboai_bladerfdevif.so $dbin/liboai_bladerfdevif.so.$REL
fi
@@ -864,36 +893,55 @@ function main() {
ln -sf $dbin/liboai_bladerfdevif.so.$REL $dbin/liboai_device.so
echo_info "liboai_device.so is linked to BLADERF device library"
elif [ "$HW" == "OAI_LMSSDR" ] ; then
-# if [ -f "/usr/include/libbladeRF.h" ] ; then
+ # if [ -f "/usr/include/libbladeRF.h" ] ; then
compilations \
- $build_dir oai_lmssdrdevif \
+ $lte_build_dir oai_lmssdrdevif \
liboai_lmssdrdevif.so $dbin/liboai_lmssdrdevif.so.$REL
-# fi
+ # fi
ln -sf liboai_lmssdrdevif.so liboai_device.so
ln -sf $dbin/liboai_lmssdrdevif.so.$REL $dbin/liboai_device.so
echo_info "liboai_device.so is linked to LMSSDR device library"
+ elif [ "$HW" == "OAI_IRIS" ] ; then
+ compilations \
+ $lte_build_dir oai_irisdevif \
+ liboai_irisdevif.so $dbin/liboai_irisdevif.so.$REL
+
+ ln -s liboai_irisdevif.so liboai_device.so
+ ln -s $dbin/liboai_irisdevif.so.$REL $dbin/liboai_device.so
+ echo_info "liboai_device.so is linked to IRIS device library"
else
echo_info "liboai_device.so is not linked to any device library"
fi
fi
- # build trasport protocol libraries (currently only ETHERNET is available)
- if [ "$TP" != "None" ] ; then
+ # build simulators devices
+ echo_info "Compiling rfsimulator"
+ compilations \
+ $lte_build_dir rfsimulator \
+ librfsimulator.so $dbin/librfsimulator.so.$REL
+ echo_info "Compiling basicsimulator"
+ compilations \
+ $lte_build_dir tcp_bridge_oai \
+ libtcp_bridge_oai.so $dbin/libtcp_bridge_oai.so.$REL
+ # build transport protocol libraries (currently only ETHERNET is available)
+
rm -f liboai_transpro.so
rm -f $dbin/liboai_transpro.so
-
- if [ "$TP" == "ETHERNET" ] ; then
compilations \
- $build_dir oai_eth_transpro \
+ $lte_build_dir oai_eth_transpro \
liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
ln -sf liboai_eth_transpro.so liboai_transpro.so
ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
- echo_info "liboai_transpro.so is linked with ETHERNET library"
- fi
+ echo_info "liboai_transpro.so is linked to ETHERNET transport"
fi
-fi
+ if [ "$RFSIMULATOR" == "true" -o "$HW" == "OAI_SIMU" ] ; then
+ echo_info "Compiling rfsimulator"
+ compilations \
+ $lte_build_dir rfsimulator \
+ librfsimulator.so $dbin/librfsimulator.so.$REL
+ fi
# Doxygen Support
#####################
@@ -1024,7 +1072,7 @@ fi
echo "set (LINUX True )" >> $cmake_file
echo "set (PDCP_USE_NETLINK True )" >> $cmake_file
echo "set (BASIC_SIMULATOR \"True\" )" >> $cmake_file
- echo "set (UE_NAS_USE_TUN \"True\" )" >> $cmake_file
+# echo "set (UE_NAS_USE_TUN \"True\" )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)' >> $cmake_file
echo_info "Build UE"
diff --git a/cmake_targets/build_ue b/cmake_targets/build_ue
old mode 100644
new mode 100755
diff --git a/cmake_targets/epc_test/CMakeLists.template b/cmake_targets/epc_test/CMakeLists.template
index e046bb7539..7a097fffb0 100644
--- a/cmake_targets/epc_test/CMakeLists.template
+++ b/cmake_targets/epc_test/CMakeLists.template
@@ -9,7 +9,6 @@ set ( EMIT_ASN_DEBUG False )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True )
set ( ENABLE_NEW_MULTICAST True )
-set ( ENABLE_SECURITY True )
set ( ENABLE_STANDALONE_EPC False)
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME True )
diff --git a/cmake_targets/oaisim_build_oai/CMakeLists.template b/cmake_targets/oaisim_build_oai/CMakeLists.template
index 22faac75b5..cffbddc93c 100644
--- a/cmake_targets/oaisim_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_build_oai/CMakeLists.template
@@ -8,7 +8,6 @@ set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_RAL False )
-set ( ENABLE_SECURITY True )
set ( ENABLE_STANDALONE_EPC False)
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME True )
diff --git a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
index b18b23ee9a..eac29006da 100644
--- a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
@@ -8,7 +8,6 @@ set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST False )
set ( ENABLE_RAL False )
-set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME False )
set ( ENABLE_USE_MME False )
diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
index bc416cff55..343e928090 100644
--- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
@@ -7,7 +7,6 @@ set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_RAL False )
-set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False)
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME False )
diff --git a/cmake_targets/phy_simulators/CMakeLists.txt b/cmake_targets/phy_simulators/CMakeLists.txt
index 4347189bc2..b43f7dd389 100644
--- a/cmake_targets/phy_simulators/CMakeLists.txt
+++ b/cmake_targets/phy_simulators/CMakeLists.txt
@@ -10,4 +10,4 @@ set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
set(RRC_ASN1_VERSION "Rel15")
set(T_TRACER True)
-include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
\ No newline at end of file
diff --git a/cmake_targets/s1c_mme_test/CMakeLists.template b/cmake_targets/s1c_mme_test/CMakeLists.template
index 9f1ff3e360..e62df04bc6 100644
--- a/cmake_targets/s1c_mme_test/CMakeLists.template
+++ b/cmake_targets/s1c_mme_test/CMakeLists.template
@@ -9,7 +9,6 @@ set ( ENABLE_NAS_UE_LOGGING True )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_RAL False )
-set ( ENABLE_SECURITY True )
set ( ENABLE_STANDALONE_EPC False)
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME True )
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 1c4b291069..f31428478c 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -32,8 +32,8 @@ OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g")
OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g")
case "$OS_DISTRO" in
fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake" ;;
- rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;;
- centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;;
+ rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum --skip-broken"; CMAKE="cmake3" ;;
+ centos) OS_BASEDISTRO="fedora"; INSTALLER="yum --skip-broken"; CMAKE="cmake3" ;;
debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
esac
@@ -102,6 +102,7 @@ check_supported_distribution() {
"ubuntu14.04") return 0 ;;
"fedora24") return 0 ;;
"rhel7") return 0 ;;
+ "rhel7.6") return 0 ;;
"centos7") return 0 ;;
esac
return 1
@@ -252,7 +253,7 @@ install_usrp_uhd_driver_from_source(){
rm -rf /tmp/uhd
git clone https://github.com/EttusResearch/uhd.git
cd uhd
- git checkout tags/release_003_010_001_001
+ git checkout tags/v3.13.0.2
mkdir -p host/build
cd host/build
$CMAKE ../
@@ -310,10 +311,20 @@ install_usrp_uhd_driver() {
# On newer kernels, it fails to install
$SUDO apt-get -y install uhd-host
fi
+ # quick workaround for RHE7.6
+ local distribution=$(get_distribution_release)
if [ -z $1 ]; then
- $SUDO uhd_images_downloader
+ if [[ "$distribution" == "rhel7.6" ]]; then
+ $SUDO /usr/local/bin/uhd_images_downloader
+ else
+ $SUDO uhd_images_downloader
+ fi
else
- $SUDO uhd_images_downloader -i $1
+ if [[ "$distribution" == "rhel7.6" ]]; then
+ $SUDO /usr/local/bin/uhd_images_downloader -i $1
+ else
+ $SUDO uhd_images_downloader -i $1
+ fi
fi
}
@@ -372,13 +383,81 @@ check_install_lmssdr_driver(){
else
echo_error "lmssdr support implies installing lmssdr drivers and tools" \
" from sources. check:"
- echo_info "https://open-cells.com/index.php/2017/05/10/limesdr-installation/"
+ echo_info "https://wiki.myriadrf.org/Lime_Suite"
echo_fatal "Cannot compile lmssdr device"
fi
}
+install_soapy_from_source(){
+ soapy_install_log=$OPENAIR_DIR/cmake_targets/log/soapy_install_log.txt
+ echo_info "\nInstalling Soapy EcoSystem from source. The log file for Soapy installation is here: $soapy_install_log "
+ (
+ cd /tmp
+ echo "Downloading SoapySDR"
+ rm -rf /tmp/soapysdr
+ git clone -b soapy-sdr-0.7.0 --single-branch https://github.com/pothosware/SoapySDR.git
+ cd SoapySDR
+ #git checkout tags/release_003_010_001_001
+ mkdir -p build
+ cd build
+ $CMAKE ../
+ echo "Compiling SoapySDR"
+ make -j`nproc`
+ $SUDO make install
+ $SUDO ldconfig
+ cd /tmp
+ echo "Downloading SoapyRemote"
+ rm -rf /tmp/soapyremote
+ git clone -b soapy-remote-0.5.0 --single-branch https://github.com/pothosware/SoapyRemote.git
+ cd SoapyRemote
+ #git checkout tags/release_003_010_001_001
+ mkdir -p build
+ cd build
+ cmake ../
+ echo "Compiling SoapyRemote"
+ make -j`nproc`
+ $SUDO make install
+ $SUDO ldconfig
+ ) >& $soapy_install_log
+}
+
+install_soapy_iris_from_source(){
+ iris_install_log=$OPENAIR_DIR/cmake_targets/log/iris_install_log.txt
+ echo_info "\nInstalling Iris driver from source. The log file for Iris driver installation is here: $iris_install_log "
+ (
+ cd /tmp
+ echo "Downloading SoapyIris"
+ rm -rf /tmp/sklk-soapyiris
+ git clone -b soapy-iris-2018.08.0.1 --single-branch https://github.com/skylarkwireless/sklk-soapyiris.git
+ cd sklk-soapyiris
+ mkdir -p build
+ cd build
+ cmake ../
+ echo "Compiling SoapyIris"
+ make -j`nproc`
+ $SUDO make install
+ $SUDO ldconfig
+ ) >& $iris_install_log
+}
+
+check_install_soapy () {
+ #if [[ "$OS_DISTRO" == "ubuntu" ]]; then
+ #first we remove old installation
+ $SUDO apt-get remove -y soapysdr soapysdr-server libsoapysdr-dev python-soapysdr python3-soapysdr soapysdr-module-remote || true
+ #$SUDO add-apt-repository -y ppa:myriadrf/drivers
+ #$SUDO apt-get update
+ #$SUDO apt-get install -y soapysdr soapysdr-server libsoapysdr-dev python-soapysdr python3-soapysdr soapysdr-module-remote
+
+ #elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
+ # $SUDO $INSTALLER -y install software-properties-common python3-software-properties python-software-properties subversion git python3 python-numpy python3-numpy cmake swig python-dev
+ install_soapy_from_source
+ #fi
+ install_soapy_iris_from_source
+
+}
+
check_install_additional_tools (){
$SUDO $INSTALLER update -y
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
@@ -560,8 +639,6 @@ check_install_oai_software() {
libidn2-0-dev \
libidn11-dev \
libmysqlclient-dev \
- liboctave-dev \
- libpgm-dev \
libpython2.7-dev \
libsctp1 \
libsctp-dev \
@@ -572,7 +649,6 @@ check_install_oai_software() {
libxml2-dev \
libxslt1-dev \
mscgen \
- octave \
octave-signal \
openssh-client \
openssh-server \
@@ -584,7 +660,8 @@ check_install_oai_software() {
pydb \
libyaml-dev \
wget \
- libxpm-dev
+ libxpm-dev \
+ libboost-all-dev
$SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET"
@@ -632,8 +709,6 @@ check_install_oai_software() {
libidn2-devel \
libidn-devel \
mariadb-devel \
- octave-devel \
- openpgm-devel \
lksctp-tools \
lksctp-tools-devel \
openssl-devel \
@@ -643,8 +718,6 @@ check_install_oai_software() {
libxml2 \
libxml2-devel \
libxslt-devel \
- octave \
- octave-signal \
openssh-clients \
openssh-server \
openssl \
@@ -667,7 +740,7 @@ check_install_oai_software() {
libyaml-devel
fi
- install_asn1c_from_source
+ install_asn1c_from_source $1
$SUDO rm -fr /opt/ssh
$SUDO git clone https://gist.github.com/2190472.git /opt/ssh
}
diff --git a/cmake_targets/tools/exmimo2_2brxg.lime b/cmake_targets/tools/exmimo2_2brxg.lime
old mode 100755
new mode 100644
diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1
index cba93f5898..351fb4d5c8 100755
--- a/cmake_targets/tools/fix_asn1
+++ b/cmake_targets/tools/fix_asn1
@@ -23,7 +23,7 @@ reset_color="$(tput sgr0)"
function error()
{
echo -e "$red_color"ERROR: "$@""$reset_color"
- exit 1
+# exit 1
}
function check_sha1()
@@ -56,11 +56,11 @@ function patch_file()
echo -e "$green_color""patch file $file with $OPENAIR_DIR/cmake_targets/tools/$patch""$reset_color"
- patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch"
- if [ $? -ne 0 ]
- then
- error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed"
- fi
+# patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch"
+# if [ $? -ne 0 ]
+# then
+# error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed"
+# fi
}
function apply_patches()
@@ -161,6 +161,22 @@ function patch_s1ap()
esac
}
+function patch_f1ap()
+{
+ local directory="$1"
+ local version="$2"
+
+ case "$version" in
+ R15 )
+ #nothing to do anymore (fixes went to asn1c)
+ ;;
+ * )
+ error unknwon/unhandled F1AP version \'"$version"\'
+ ;;
+ esac
+}
+
+
function main()
{
if [ $# -ne 3 ]
@@ -191,6 +207,9 @@ function main()
S1AP )
patch_s1ap "$directory" "$version"
;;
+ F1AP )
+ patch_f1ap "$directory" "$version"
+ ;;
* )
error unknown module "$module"
;;
diff --git a/cmake_targets/tools/generate_asn1 b/cmake_targets/tools/generate_asn1
index 0c990f7072..00efe7b132 100755
--- a/cmake_targets/tools/generate_asn1
+++ b/cmake_targets/tools/generate_asn1
@@ -2,8 +2,11 @@
function main()
{
-mkdir -p $1
-cd $1
+PROTOCOL_DIR=$1
+mkdir -p ${PROTOCOL_DIR}
+cd ${PROTOCOL_DIR}
+
+# Because use $* also include directory, so we need shift
shift
local module="$2"
@@ -12,15 +15,15 @@ local module="$2"
#(there may be a better way...)
if [ $# -eq 2 ]; then
-#asn1c does not work well with extension groups, we need the following fix:
-# replace [[ by ' SEQUENCE {'
-# and ]] by '} OPTIONAL'
-# is ext with N starting from 1 and incremented at each new [[ ]] just
-#following another [[ ]]
-#
-#this is what the following C program does
+ #asn1c does not work well with extension groups, we need the following fix:
+ # replace [[ by ' SEQUENCE {'
+ # and ]] by '} OPTIONAL'
+ # is ext with N starting from 1 and incremented at each new [[ ]] just
+ #following another [[ ]]
+ #
+ #this is what the following C program does
-echo generate asnfix.c
+ echo generate asnfix.c
cat << EOF > asnfix.c
/* transforms:
@@ -87,19 +90,19 @@ int main(void)
}
EOF
-echo compile asnfix.c
+ echo compile asnfix.c
-gcc -Wall -o asnfix asnfix.c
+ gcc -Wall -o asnfix asnfix.c
-echo run asnfix on $1
+ echo run asnfix on $1
-./asnfix < $1 > fixed_grammar.asn
+ ./asnfix < $1 > fixed_grammar.asn
-rm -f asnfix asnfix.c
+ rm -f asnfix asnfix.c
-echo done with asnfix
+ echo done with asnfix
-echo running asn1c
+ echo running asn1c
case "$module" in
RRC )
@@ -120,11 +123,14 @@ case "$module" in
esac
+ rm -f fixed_grammar.asn
-rm -f fixed_grammar.asn
-
-echo asn1c done
+ echo asn1c done
+elif echo ${PROTOCOL_DIR} | grep -q "F1AP"; then
+
+ asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
+
else
case "$module" in
diff --git a/cmake_targets/tools/init_nas_s1 b/cmake_targets/tools/init_nas_s1
index cab4ad047b..b78ab34ff9 100755
--- a/cmake_targets/tools/init_nas_s1
+++ b/cmake_targets/tools/init_nas_s1
@@ -52,20 +52,20 @@ load_module ../../targets/bin/ue_ip.ko
if [ "$1" = "UE" ]; then
echo "bring up $LTEIF interface for UE"
- ifconfig $LTEIF up
+ sudo ifconfig $LTEIF up
fi
-ip route flush cache
+sudo ip route flush cache
sleep 1
-sysctl -w net.ipv4.conf.all.log_martians=1
+sudo sysctl -w net.ipv4.conf.all.log_martians=1
echo "Disabling reverse path filtering"
-sysctl -w net.ipv4.conf.all.rp_filter=0
-ip route flush cache
+sudo sysctl -w net.ipv4.conf.all.rp_filter=0
+sudo ip route flush cache
# Check table 200 lte in /etc/iproute2/rt_tables
fgrep lte /etc/iproute2/rt_tables > /dev/null
if [ $? -ne 0 ]; then
echo "200 lte " >> /etc/iproute2/rt_tables
fi
-ip rule add fwmark 1 table lte
-ip route add default dev $LTEIF table lte
+sudo ip rule add fwmark 1 table lte
+sudo ip route add default dev $LTEIF table lte
diff --git a/cmake_targets/tools/make_asn1c_includes.sh b/cmake_targets/tools/make_asn1c_includes.sh
index bd4254c938..a60d66fe16 100755
--- a/cmake_targets/tools/make_asn1c_includes.sh
+++ b/cmake_targets/tools/make_asn1c_includes.sh
@@ -3,13 +3,13 @@ GENERATED_FULL_DIR=$1
shift
ASN1_SOURCE_DIR=$1
shift
-export ASN1C_PREFIX=$1
+export ASN1C_PREFIX=$1
shift
options=$*
done_flag="$GENERATED_FULL_DIR"/done
-if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
+if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
rm -f "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.c "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.h
mkdir -p "$GENERATED_FULL_DIR"
asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example $options -D $GENERATED_FULL_DIR $ASN1_SOURCE_DIR |& egrep -v "^Copied|^Compiled" | sort -u
fi
-touch $done_flag
+touch $done_flag
\ No newline at end of file
diff --git a/cmake_targets/tools/run_ue_s1 b/cmake_targets/tools/run_ue_s1
old mode 100644
new mode 100755
diff --git a/common/config/DOC/config.md b/common/config/DOC/config.md
new file mode 100644
index 0000000000..1c2ef25594
--- /dev/null
+++ b/common/config/DOC/config.md
@@ -0,0 +1,11 @@
+# OAI configuration module
+
+The configuration module provides an api that other oai components can use to get parameters at init time. It defines a parameter structure, used to describe parameters attributes (for example name and type). The same structure includes a pointer to the variable where the configuration module writes the parameter value, at run time, when calling config_get or config_getlist functions. For each parameter a function to check the value can be specified and pre-defined functions are provided for some common parameter validations (integer in a range or in a list, string in a list). The module also include an api to check that no unknown options have been entered on the command line and a a mechanism to display a help text for suppoted parameters.
+
+## Documentation
+
+* [runtime usage](config/rtusage.md)
+* [developer usage](config/devusage.md)
+* [module architecture](config/arch.md)
+
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/config/DOC/config/arch.md b/common/config/DOC/config/arch.md
new file mode 100644
index 0000000000..f888724c41
--- /dev/null
+++ b/common/config/DOC/config/arch.md
@@ -0,0 +1,7 @@
+# config module source files
+
+# config module components
+
+
+
+[Configuration module home](../config.md)
diff --git a/common/config/DOC/config/devusage.md b/common/config/DOC/config/devusage.md
new file mode 100644
index 0000000000..151ffeafa8
--- /dev/null
+++ b/common/config/DOC/config/devusage.md
@@ -0,0 +1,20 @@
+The configuration module objectives are
+1. Allow easy parameters management in oai, helping the development of a flexible, modularized and fully configurable softmodem.
+1. Use a common configuration API in all oai modules
+1. Allow development of alternative configuration sources without modifying the oai code. Today the only delivered configuration source is the libconfig format configuration file.
+
+As a developer you may need to look at these sections:
+
+* [add parameters in an existing section](devusage/addaparam.md)
+* [add a parameter set, in a new section](devusage/addparamset.md)
+* [configuration module API](devusage/api.md)
+* [configuration module public structures](devusage/struct.md)
+
+Whatever your need is, configuration module usage examples can be found in oai sources:
+* complex example, using all the configuration module functionalities, including parameter checking:
+[NB-IoT configuration code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/ENB_APP/NB_IoT_config.c) and [NB-IoT configuration include file](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/ENB_APP/NB_IoT_paramdef.h)
+* very simple example, just reading a parameter set corresponding to a dedicated section: the telnetsrv_autoinit function in [common/utils/telnetsrv/telnetsrv.c, around line 726](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/telnetsrv/telnetsrv.c#L726)
+* an example with run-time definition of parameters, in the logging sub-system: the log_getconfig function at the top of [openair2/UTIL/LOG/log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/UTIL/LOG/log.c)
+
+
+[Configuration module home](../config.md)
diff --git a/common/config/DOC/config/devusage/addaparam.md b/common/config/DOC/config/devusage/addaparam.md
new file mode 100644
index 0000000000..246c494526
--- /dev/null
+++ b/common/config/DOC/config/devusage/addaparam.md
@@ -0,0 +1,86 @@
+To add a new parameter in an existing section you insert an item in a `paramdef_t` array, which describes the parameters to be read in the existing `config_get` call. You also need to increment the numparams argument.
+
+existing code:
+```c
+unsigned int varopt1;
+paramdef_t someoptions[] = {
+/*---------------------------------------------------------------------------------*/
+/* configuration parameters for some module */
+/* optname helpstr paramflags XXXptr defXXXval type numelt */
+/*---------------------------------------------------------------------------------*/
+ {"opt1", "", 0, uptr:&varopt1, defuintval:0, TYPE_UINT, 0 },
+};
+
+config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
+
+```
+new code:
+```c
+unsigned int varopt1;
+
+
+/* varopt2 will be allocated by the config module and free at end_configmodule call
+ except if PARAMFLAG_NOFREE bit is set in paramflags field*/
+char *varopt2;
+paramdef_t someoptions[] = {
+/*---------------------------------------------------------------------------------*/
+/* configuration parameters for some module */
+/* optname helpstr paramflags XXXptr defXXXval type numelt */
+/*---------------------------------------------------------------------------------*/
+ {"opt1", "", 0, uptr:&varopt1, defuintval:0,TYPE_UINT, 0 },
+ {"opt2", "", 0, strptr:&varopt2,defstrval:"",TYPE_STRING,0 },
+};
+
+config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
+
+```
+
+The corresponding configuration file may now include opt2 parameter in the somesection section:
+
+```c
+somesection =
+{
+opt1 = 3;
+opt2 = "abcd";
+};
+```
+
+In these examples the variables used to retrieve the parameters values are pointed by the `uptr` or `strptr` fields of the `paramdef_t` structure. After the `config_get` call `varopt1` and `varopt2` have been set to the value specified in the config file. It is also possible to specify a `NULL` value to the `< XXX >ptr` fields, which are then allocated by the config module and possibly free when calling `config_end()`, if the `PARAMFLAG_NOFREE` bit has not been set in the `paramflags` field.
+
+The configuration module provides a mechanism to check the parameter value read from the configuration source. The following functions are implemented:
+1. Check an integer parameter against a list of authorized values
+1. Check an integer parameter against a list of authorized values and set the parameter to a new value
+1. Check an integer parameter against a range
+1. Check a C string parameter against a list of authorized values
+1. Check a C string parameter against a list of authorized values and set the parameter to a new integer value
+
+ A `checkedparam_t` structure array provides the parameter verification procedures:
+
+```c
+/*
+ definition of the verification to be done on param opt1 and opt2.
+ opt1 is an integer option we must be set to 0,2,3,4 or 7 in the
+ config source.
+ if opt1 is set to 0 in the config file, it will be set to 1, etc
+ opt2 is C string option with the authorize values "zero","oneThird","twoThird","one"
+ */
+#define OPT1_OKVALUES {0,2,3,4,7}
+#define OPT1_NEWVALUES {1,1,0,6,9}
+#define OPT2_OKVALUES {"zero","oneThird","twoThird","one"}
+
+#define OPT_CHECK_DESC { \
+ { .s1a= { config_check_modify_integer, OPT1_OKVALUE, OPT1_NEWVALUES ,5 }}, \
+ { .s3= { config_check_strval, OPT2_OKVALUES,4 }}, \
+}
+checkedparam_t checkopt[] = OPT_CHECK_DESC;
+.....
+/* assign the verification procedures to the parameters definitions */
+for(int i=0 ; i < sizeof(someoptions)/sizeof(paramdesc_t) ; i ++) {
+ someoptions[i].chkPptr = &(checkopt[i]);
+}
+....
+```
+When you need a specific verification algorithm, you can provide your own verification function and use it in place of the available ones, in the `checkedparam_t` union. If no existing structure definition match your need, you can enhance the configuration module. You then have to add a new verification function in https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_userapi.c and add a new structure definition in the `checkedparam_t` type defined in https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h
+
+[Configuration module developer main page](../../config/devusage.md)
+[Configuration module home](../../config.md)
diff --git a/common/config/DOC/config/devusage/addparamset.md b/common/config/DOC/config/devusage/addparamset.md
new file mode 100644
index 0000000000..49448e11da
--- /dev/null
+++ b/common/config/DOC/config/devusage/addparamset.md
@@ -0,0 +1,131 @@
+The configuration module maps a configuration file section to a `paramdef_t` structure array. One `config_get` call can be used to return the values of all the parameters described in the `paramdef_t` array.
+Retrieving a single occurence of a parameter set ( a group in the libconfig terminology) is just a two steps task:
+1. describe the parameters in a `paramdef_t` array
+1. call the `config_get` function
+
+
+[config_get example](../../config/devusage/addaparam.md)
+
+
+In oai some parameters set may be instantiated a variable number of occurrences. In a configuration file this is mapped to lists of group of parameters, with this syntax:
+```c
+NB-IoT_MACRLCs =
+/* start list element 1 */
+(
+ /* start a group of parameters */
+ {
+ num_cc = 2;
+ .....
+ remote_s_portd = 55001;
+ }
+),
+/* start list element 2 */
+(
+ /* start a group of parameters */
+ {
+ num_cc = 1;
+ ......
+ remote_s_portd = 65001;
+ }
+);
+
+```
+The configuration module provides the `config_getlist` call to support lists of group of parameters. Below is a commented code example, using the config_getlist call.
+
+```c
+/* name of section containing the list */
+#define NBIOT_MACRLCLIST_CONFIG_STRING "NB-IoT_MACRLCs"
+
+/*
+The following macro define the parameters names, as used in the
+configuration file
+*/
+#define CONFIG_STRING_MACRLC_CC "num_cc"
+.....
+#define CONFIG_MACRLC_S_PORTD "remote_s_portd"
+
+/*
+ now define a macro which will be used to initialize the NbIoT_MacRLC_Params
+ variable. NbIoT_MacRLC_Params is an array of paramdef_t structure, each item
+ describing a parameter. When using the config_getlist call you must let the config
+ module allocate the memory for the parameters values.
+*/
+/*------------------------------------------------------------------------------------------------------------*/
+/* optname helpstr paramflags XXXptr defXXXval type numelt */
+/*------------------------------------------------------------------------------------------------------------*/
+
+#define MACRLCPARAMS_DESC { \
+{CONFIG_STRING_MACRLC_CC, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \
+............. \
+{CONFIG_MACRLC_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
+}
+
+/*
+the following macros define the indexes used to access the NbIoT_MacRLC_Params array
+items. They must be maintained consistent with the previous MACRLCPARAMS_DESC macro
+which is used to initialize the NbIoT_MacRLC_Params variable
+*/
+#define MACRLC_CC_IDX 0
+.........
+#define MACRLC_REMOTE_S_PORTD_IDX 16
+
+
+
+void RCconfig_NbIoTmacrlc(void) {
+
+
+/*
+ define and initialize the array of paramdef_t structures describing the groups of
+ parameters we want to read. It will be passed as the second argument of the
+ config_getlist call, which will use it as an input only argument.
+*/
+ paramdef_t NbIoT_MacRLC_Params[] = MACRLCPARAMS_DESC;
+
+/*
+ now define and initialize a paramlist_def_t structure which will be passed
+ to the config_getlist call. The first field is the only one to be initialized
+ it contains the name of the section to be read.
+ that section contains the list of group of parameters.
+ The two other fields are output parameters used to return respectively
+ a pointer to a two dimensional array of paramdef_t structures pointers, and the
+ number of items in the list of groups (size of first dimension, the second one
+ being the number of parameters in each group.
+*/
+ paramlist_def_t NbIoT_MacRLC_ParamList = {NBIOT_MACRLCLIST_CONFIG_STRING,NULL,0};
+
+
+ /*
+ the config_getlist will allocate the second field of the paramlist_def_t structure, a
+two dimensional array of paramdef_t pointers. In each param_def item it will allocate
+the value pointer and set the value to what it will get from the config source. The
+numelt field of the paramlist_def_t structure will be set to the number of groups of
+parameters in the list.
+ in this example the last argument of config_getlist is unused, it may contain a
+character string, used as a prefix for the section name. It has to be specified when the
+list to be read is under another section.
+*/
+ config_getlist( &NbIoT_MacRLC_ParamList,NbIoT_MacRLC_Params,
+ sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t),
+ NULL);
+
+/*
+ start a loop in the nuber of groups in the list, the numelt field of the
+ paramlist_def_t structure has been set in the config_getlist call
+*/
+ for (j=0 ; jeth_params_s.remote_portd =
+ *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
+............
+
+ } // MacRLC_ParamList.numelt > 0
+}
+
+
+```
+
+[Configuration module developer main page](../../config/devusage.md)
+[Configuration module home](../../config.md)
diff --git a/common/config/DOC/config/devusage/api.md b/common/config/DOC/config/devusage/api.md
new file mode 100644
index 0000000000..06c22dba6f
--- /dev/null
+++ b/common/config/DOC/config/devusage/api.md
@@ -0,0 +1,49 @@
+```c
+configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags)
+```
+* Parses the command line options, looking for the –O argument
+* Loads the `libparams_.so` (today `libparams_libconfig.so`) shared library
+* Looks for `config__init` symbol and calls it , passing it an array of string corresponding to the « : » separated strings used in the –O option
+* Looks for `config__get`, `config__getlist` and `config__end` symbols which are the three functions a configuration library should implement. Get and getlist are mandatory, end is optional.
+* Stores all the necessary information in a `configmodule_interface_t structure`, which is of no use for caller as long as we only use one configuration source.
+* if the bit CONFIG_ENABLECMDLINEONLY is set in `initflags` then the module allows parameters to be set only via the command line. This is used for the oai UE.
+
+```c
+void End_configmodule(void)
+```
+* Free memory which has been allocated by the configuration module since its initialization.
+* Possibly calls the `config__end` function
+
+```c
+int config_get(paramdef_t *params,int numparams, char *prefix)
+```
+* Reads as many parameters as described in params, they must all be in the same configuration file section
+* Calls the `config__get` function
+* Calls the `config_process_cmdline` function
+* `params` points to an array of `paramdef_t` structures which describes the parameters to be read, possibly including a pointer to a checking function. The following bits can possibly be set in the `paramflags` mask before calling
+ - `PARAMFLAG_MANDATORY`: -1 is returned if the parameter is not explicitly defined in the config source.
+ - `PARAMFLAG_DISABLECMDLINE`: parameter cannot be modified via the command line
+ - `PARAMFLAG_DONOTREAD`: ignore the parameter, can be used at run-time, to alter a pre-defined `paramdef_t` array which is used in several `config_get` or/and `config_getlist` calls.
+ - `PARAMFLAG_NOFREE`: do not free the memory possibly allocated by the config module to store the value of the parameter. Default behavior is for the config module to free the memory it has allocated when the `config_end` function is called.
+ - `PARAMFLAG_BOOL`: Only relevant for integer types. tell the config module that when processing the command line, the corresponding option can be specified without any arggument and that in this case it must set the value to 1.
+
+* `params` is also used as an output parameter, `< XXX >ptr >` field is used by the config module to store the value it has read. The following bits can possibly be set in the `paramflags` mask after the call:
+ - `PARAMFLAG_MALLOCINCONFIG`: memory has been allocated for the ` < XXX >ptr > ` field
+ - `PARAMFLAG_PARAMSET`: parameter has been found in the config source, it is not set to default value.
+ - `PARAMFLAG_PARAMSET`: parameter has been set to its default value
+* `numparams` is the number of entries in the params array
+* `prefix` is a character string to be appended to the parameters name, it defines the parameters position in the configuration file hierarchy (the section name in libconfig terminology).
+* The returned value is the number of parameters which have been assigned a value or -1 if a severe error occured
+
+```c
+int config_libconfig_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix)
+```
+* Reads multiple occurrences of a parameters array
+* Calls the `config__get` function for each list occurrence
+* `params` points to an array of `paramdef_t` structures which describes the parameters in each occurrence of the list
+* `ParamList` points to a structure, where `paramarray` field points to an array of `paramdef_t` structure, allocated by the function. It is used to return the values of the parameters.
+* The returned value is the number of occurrences in the list or -1 in case of severe error
+
+
+[Configuration module developer main page](../../config/devusage.md)
+[Configuration module home](../../config.md)
diff --git a/common/config/DOC/config/devusage/struct.md b/common/config/DOC/config/devusage/struct.md
new file mode 100644
index 0000000000..e8b15fc0f1
--- /dev/null
+++ b/common/config/DOC/config/devusage/struct.md
@@ -0,0 +1,85 @@
+# `paramdef_t`structure
+It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L103). This structure is used by developers to describe parameters and by the configuration module to return parameters value. A pointer to a `paramdef_t` array is passed to `config_get` and `config_getlist` calls to instruct the configuration module what parameters it should read.
+
+| Fields | Description | I/O |
+|:-----------|:------------------------------------------------------------------|----:|
+| `optname` | parameter name, as used when looking for it in the config source, 63 bytes max (64 with trailing \0) | I |
+| `helstr` | pointer to a C string printed when using --help on the command line | I |
+| `strptr` `strlistptr` `u8ptr` `i8ptr` `u16ptr` `i16ptr` `uptr` `iptr` `u64ptr` `i64ptr` `dblptr` `voidptr` | a pointer to a variable where the parameter value(s) will be returned. This field is an anonymous union, the supported pointer types have been built to avoid type mismatch warnings at compile time. | O |
+| `defstrval` `defstrlistval` `defuintval` `defintval` `defint64val` `defintarrayval` `defdblval` | this field is an anonymous union, it can be used to define the default value for the parameter. It is ignored if `PARAMFLAG_MANDATORY` is set in the `paramflags` field.| I |
+| `type` | Supported parameter types are defined as integer macros. Supported simple types are `TYPE_STRING`, parameter value is returned in `strptr` field, `TYPE_INT8` `TYPE_UINT8` `TYPE_INT16` `TYPE_UINT16` `TYPE_INT32` `TYPE_UINT32` `TYPE_INT64` `TYPE_UINT64`, parameter value is returned in the corresponding uXptr or iXptr, `TYPE_MASK`, value is returned in `u32ptr`, `TYPE_DOUBLE` value is returned in `dblptr`, `TYPE_IPV4ADDR` value is returned in binary, network bytes order in `u32ptr` field. `TYPE_STRINGLIST`, `TYPE_INTARRAY` and `TYPE_UINTARRAY` are multiple values types. Multiple values are returned in respectively, `strlistptr`, `iptr` and `uptr` fields which then point to arrays. The `numelt` field gives the number of item in the array. | I |
+| `numelt` | For `TYPE_STRING` where `strptr` points to a preallocated string, this field must contain the size in bytes of the available memory. For all multiple values types, this field contains the number of values in the value field.| I/O |
+| `chkPptr` | possible pointer to the structure containing the info used to check parameter values | I |
+| `processedvalue` | When `chkPptr` is not `ǸULL`, is used to return a value, computed from the original parameter, as read from the configuration source. | O |
+
+# `paramlist_def_t`structure
+It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L160).
+It is used as an argument to `config_getlist` calls, to get values of multiple occurrences of group of parameters.
+
+| Fields | Description | I/O |
+|:-----------|:------------------------------------------------------------------|----:|
+| `listname` | Name of the section containing the list, 63 bytes max (64 with trailing \0). It is used to prefix each paramater name when looking for its value. In the libconfig syntax, the parameter name full path build by the configuration module is: listname.[occurence index].optname. | I |
+| `paramarray` | Pointer to an array of `ǹumelt` `paramdef_t` pointers. It is allocated by the configuration module and is used to return the parameters values. All input fields of each `paramdef_t` occurence are a copy of the `paramdef_t` argument passed to the `config_getlist` call. | O |
+| `numelt` | Number of items in the `paramarray` field | O |
+
+# `checkedparam_t` union
+It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L62).
+This union of structures is used to provide a parameter checking mechanism. Each `paramdef_t` instance may include a pointer to a `checkedparam_t`structure which is then used by the configuration module to check the value it got from the config source.
+Each structure in the union provides one parameter verification method, which returns `-1` when the verification fails. Currently the following structures are defined in the `checkedparam_t` union:
+
+| structure name | Description |
+|:-----------|:------------------------------------------------------------------|----:|
+| `s1` | check an integer against a list of authorized values |
+| `s1a` | check an integer against a list of authorized values and set the parameter value to another integer depending on the read value|
+| `s2` | check an integer against an authorized range, defined by its min and max value|
+| `s3` | check a string against a list of authorized values |
+| `s3a` | check a string against a list of authorized values and set the parameter value to an integer depending on the read value|
+| `s4` | generic structure, to be used to provide a specific, not defined in the configuration module, verification algorithm |
+
+each of these structures provide the required fields to perform the specified parameter check. The first field is a pointer to a function, taking one argument, the `paramdef_t` structure describing the parameter to be checked. This function is called by the configuration module, in the `config_get` call , after the parameter value has been set, it then uses the other fields of the structure to perform the check.
+The configuration module provides an implementation of the functions to be used to check parameters, qs described below.
+
+## `s1` structure
+| field | Description |
+|:-----------|:------------------------------------------------------------------|
+| `f1` | pointer to the checking function. Initialize to `config_check_intval` to use the config module implementation |
+| `okintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the authorized values |
+| `num_okintval` | number of used values in `okintval` |
+
+## `s1a` structure
+| field | Description |
+|:-----------|:------------------------------------------------------------------|
+| `f1a` | pointer to the checking function. Initialize to `config_check_modify_integer` to use the config module implementation |
+| `okintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the authorized values |
+| `setintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the values to be used for the parameter. The configuration module implementation set the parameter value to `setintval[i]` when the configured value is `okintval[i]` |
+| `num_okintval` | number of used values in `okintval` and `setintval` |
+
+## `s2` structure
+| field | Description |
+|:-----------|:------------------------------------------------------------------|
+| `f2` | pointer to the checking function. Initialize to `config_check_intrange` to use the config module implementation |
+| `okintrange` | array of 2 integers containing the min and max values for the parameter |
+
+## `s3` structure
+| field | Description |
+|:-----------|:------------------------------------------------------------------|
+| `f3` | pointer to the checking function. Initialize to `config_check_strval` to use the config module implementation |
+| `okstrval` | array of `CONFIG_MAX_NUMCHECKVAL` C string pointers containing the authorized values |
+| `num_okstrval` | number of used values in `okstrtval` |
+
+
+## `s3a` structure
+| field | Description |
+|:-----------|:------------------------------------------------------------------|
+| `f3a` | pointer to the checking function. Initialize to `config_checkstr_assign_integer` to use the config module implementation |
+| `okstrval` | array of `CONFIG_MAX_NUMCHECKVAL` C string pointers containing the authorized values |
+| `setintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the values to be used for the parameter. The configuration module implementation set the parameter value to `setintval[i]` when the configured value is `okstrval[i]` |
+| `num_okstrval` | number of used values in `okintval` and `setintval` |
+
+## `s4` and `s5` structures
+| field | Description |
+|:-----------|:------------------------------------------------------------------|
+| `f4` or `f5` | pointer to the checking function. they are generic structures to be used when no existing structure provides the required parameter verification. `f4` takes one argument, the `paramdef_t` structure corresponding to the parameter to be checked (`int (*f4)(paramdef_t *param)`), `f5` taxes no argument (`void (*checkfunc)(void)`) |
+
+[Configuration module developer main page](../../config/devusage.md)
+[Configuration module home](../../config.md)
diff --git a/common/config/DOC/config/rtusage.md b/common/config/DOC/config/rtusage.md
new file mode 100644
index 0000000000..10cbee2495
--- /dev/null
+++ b/common/config/DOC/config/rtusage.md
@@ -0,0 +1,109 @@
+
+ -O is the only mandatory command line option to start the eNodeb softmodem (lte-softmodem executable), it is used to specify the configuration source with the associated parameters:
+```bash
+$ ./lte-softmodem -O :::...
+```
+ The configuration module can also be used without a configuration source, ie to only parse the command line. In this case the -O switch is optional. This mode is used in the ue-softmodem executable and by the phy_simulators executables (ulsim, dlsim)
+
+Currently the available config sources are:
+
+- **libconfig**: libconfig file. [libconfig file format](http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files) Parameter1 is the file path and parameter 2 can be used to specify the level of console messages printed by the configuration module.
+```bash
+$ ./lte-softmodem -O libconfig::dbgl
+```
+- **cmdlineonly**: command line only, the default mode for lte-uesoftmodem and the phy simiulators. In this case -O may be used to specify the config module debug level.
+
+The debug level is a mask:
+* bit 1: print parameters values
+* bit 2: print memory allocation/free performed by the config module
+* bit 3: print command line processing messages
+* bit 4: disable execution abort when parameters checking fails
+
+As a oai user, you may have to use bit 1 (dbgl1) , to check your configuration and get the full name of a parameter you would like to modify on the command line. Other bits are for developers usage, (dbgl7 will print all debug messages).
+
+```bash
+$ ./lte-softmodem -O libconfig::dbgl1
+```
+```bash
+$ ./lte-uesoftmodem -O cmdlineonly:dbgl1
+```
+To get help on supported parameters you can use specific options:
+* ---help: print help for command line only parameters and for parameters not defined in a specific section
+ * ---help_< prefix > : print help for parameters defined under the section < prefix >
+
+```
+./lte-softmodem -O libconfig:/usr/local/oai/conf/enb.nbiot.band7.tm1.50PRB.usrpb210.conf --help
+[CONFIG] get parameters from libconfig /usr/local/oai/conf/enb.nbiot.band7.tm1.50PRB.usrpb210.conf , debug flags: 0x00000000
+.............................................
+[LIBCONFIG] (root): 19/19 parameters successfully set, (16 to default value)
+
+-----Help for section (root section) : 019 entries------
+ --rf-config-file: Configuration file for front-end (e.g. LMS7002M)
+ --ulsch-max-errors: set the eNodeB max ULSCH erros
+ --phy-test: test UE phy layer, mac disabled
+ --usim-test: use XOR autentication algo in case of test usim mode
+ --emulate-rf: Emulated RF enabled(disable by defult)
+ --clock: tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)
+ --wait-for-sync: Help string not specified
+ --single-thread-enable: Disables single-thread mode in lte-softmodem
+ -C: Set the downlink frequency for all component carriers
+ -a: Channel id offset
+ -d: Enable soft scope and L1 and L2 stats (Xforms)
+ -q: Enable processing timing measurement of lte softmodem on per subframe basis
+ -S: Skip the missed slots/subframes
+ --numerology: adding numerology for 5G
+ --parallel-config: three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'
+ --worker-config: two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'
+ --nbiot-disable: disable nb-iot, even if defined in config
+ --noS1: Disable s1 interface
+ --nokrnmod: (noS1 only): Use tun instead of namesh module
+--------------------------------------------------------------------
+
+[LIBCONFIG] (root): 4/4 parameters successfully set, (4 to default value)
+
+-----Help for section (root section) : 004 entries------
+ -R: Enable online log
+ -g: Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))
+ --telnetsrv: Start embedded telnet server
+ --msc: Enable the MSC tracing utility
+--------------------------------------------------------------------
+
+[LIBCONFIG] loader: 2/2 parameters successfully set, (2 to default value)
+[LIBCONFIG] loader.telnetsrv: 2/2 parameters successfully set, (1 to default value)
+[LOADER] library libtelnetsrv.so is not loaded: libtelnetsrv.so: cannot open shared object file: No such file or directory
+Getting ENBSParams
+[LIBCONFIG] (root): 3/3 parameters successfully set, (1 to default value)
+
+-----Help for section (root section) : 003 entries------
+ --Asn1_verbosity: Help string not specified
+ --Active_eNBs: Help string not specified
+ --noS1: Help string not specified
+--------------------------------------------------------------------
+
+/usr/local/oai/issue390_configmodule_cmdlinebug/openairinterface5g/common/config/config_cmdline.c:224 config_process_cmdline() Exiting OAI softmodem: [CONFIG] Exiting after displaying help
+
+```
+
+For the lte-softmodem (the eNodeB) The config source parameter defaults to libconfig, preserving the initial -O option format. In this case you cannot specify the debug level.
+
+```bash
+$ ./lte-softmodem -O
+```
+
+Configuration file parameters, except for the configuration file path, can be specified in a **config** section in the configuration file:
+
+```
+config:
+{
+ debugflags = 1;
+}
+```
+Configuration files examples can be found in the targets/PROJECTS/GENERIC-LTE-EPC/CONF sub-directory of the oai source tree. To minimize the number of configuration file to maintain, any parameter can also be specified on the command line. For example to modify the lte bandwidth to 20 MHz where the configuration file specifies 10MHz you can enter:
+
+```bash
+$ ./lte-softmodem -O --eNBs.[0].component_carriers.[0].N_RB_DL 100
+```
+
+As specified earlier, use the dbgl1 debug level to get the full name of a parameter you would like to modify on the command line.
+
+[Configuration module home](../config.md)
diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c
index 3bd41cf6cc..0083c2e66b 100644
--- a/common/config/config_cmdline.c
+++ b/common/config/config_cmdline.c
@@ -20,7 +20,7 @@
*/
/*! \file common/config/cmdline/config_libconfig.c
- * \brief configuration module, command line parsing implementation
+ * \brief configuration module, command line parsing implementation
* \author Francois TABURET
* \date 2017
* \version 0.1
@@ -37,183 +37,260 @@
#include
#include
#include "config_userapi.h"
+#include "../utils/LOG/log.h"
+int parse_stringlist(paramdef_t *cfgoptions, char *val) {
+ char *atoken;
+ char *tokctx;
+ char *tmpval=strdup(val);
+ int numelt=0;
+ cfgoptions->numelt=0;
+ atoken=strtok_r(tmpval, ",",&tokctx);
-int parse_stringlist(paramdef_t *cfgoptions, char *val)
-{
-char *atoken;
-char *tokctx;
-char *tmpval=strdup(val);
-int numelt=0;
+ while(atoken != NULL) {
+ numelt++ ;
+ atoken=strtok_r(NULL, ",",&tokctx);
+ }
- cfgoptions->numelt=0;
+ free(tmpval);
+ config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
+ cfgoptions->numelt=numelt;
+ atoken=strtok_r(val, ",",&tokctx);
- atoken=strtok_r(tmpval, ",",&tokctx);
- while(atoken != NULL) {
- numelt++ ;
- atoken=strtok_r(NULL, ",",&tokctx);
- }
- free(tmpval);
- config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
- cfgoptions->numelt=numelt;
+ for( int i=0; inumelt && atoken != NULL ; i++) {
+ config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(atoken)+1);
+ sprintf(cfgoptions->strlistptr[i],"%s",atoken);
+ printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
+ atoken=strtok_r(NULL, ",",&tokctx);
+ }
- atoken=strtok_r(val, ",",&tokctx);
- for( int i=0; inumelt && atoken != NULL ; i++) {
- config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(atoken)+1);
- sprintf(cfgoptions->strlistptr[i],"%s",atoken);
- printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
- atoken=strtok_r(NULL, ",",&tokctx);
- }
- return (cfgoptions->numelt > 0);
-}
-
-int processoption(paramdef_t *cfgoptions, char *value)
-{
-char *tmpval = value;
-int optisset=0;
-char defbool[2]="1";
-
-
- if ( value == NULL) {
- if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */
- fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
- return 0;
- } else { /* boolean value option without argument, set value to true*/
- tmpval = defbool;
- }
- }
- switch(cfgoptions->type)
- {
- case TYPE_STRING:
- if (cfgoptions->numelt == 0 ) {
- config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1);
- sprintf(*(cfgoptions->strptr), "%s",tmpval);
- } else {
- sprintf( (char *)(cfgoptions->strptr), "%s",tmpval);
- }
- printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval);
- optisset=1;
- break;
-
- case TYPE_STRINGLIST:
- optisset=parse_stringlist(cfgoptions,tmpval);
- break;
- case TYPE_UINT32:
- case TYPE_INT32:
- case TYPE_UINT16:
- case TYPE_INT16:
- case TYPE_UINT8:
- case TYPE_INT8:
- config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t));
- config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,NULL,0));
- optisset=1;
- break;
- case TYPE_UINT64:
- case TYPE_INT64:
- config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t));
- *(cfgoptions->i64ptr)=strtoll(tmpval,NULL,0);
- printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr));
- optisset=1;
- break;
- case TYPE_UINTARRAY:
- case TYPE_INTARRAY:
-
- break;
- case TYPE_DOUBLE:
- config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
- *(cfgoptions->dblptr) = strtof(tmpval,NULL);
- printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
- optisset=1;
- break;
-
- case TYPE_IPV4ADDR:
-
- break;
-
- default:
- fprintf(stderr,"[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type);
- break;
- } /* switch on param type */
- if (optisset == 1) {
- cfgoptions->paramflags = cfgoptions->paramflags | PARAMFLAG_PARAMSET;
- }
- return optisset;
+ return (cfgoptions->numelt > 0);
}
-int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
-{
+int processoption(paramdef_t *cfgoptions, char *value) {
+ char *tmpval = value;
+ int optisset=0;
+ char defbool[2]="1";
+
+ if ( value == NULL) {
+ if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */
+ CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
+ } else { /* boolean value option without argument, set value to true*/
+ tmpval = defbool;
+ }
+ }
+
+ switch(cfgoptions->type) {
+ char *charptr;
+
+ case TYPE_STRING:
+ if (cfgoptions->numelt == 0 ) {
+ config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1);
+ sprintf(*(cfgoptions->strptr), "%s",tmpval);
+ } else {
+ sprintf( (char *)(cfgoptions->strptr), "%s",tmpval);
+ }
+
+ printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval);
+ optisset=1;
+ break;
+
+ case TYPE_STRINGLIST:
+ optisset=parse_stringlist(cfgoptions,tmpval);
+ break;
+
+ case TYPE_UINT32:
+ case TYPE_INT32:
+ case TYPE_UINT16:
+ case TYPE_INT16:
+ case TYPE_UINT8:
+ case TYPE_INT8:
+ config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t));
+ config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,&charptr,0));
+
+ if( *charptr != 0) {
+ CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname);
+ }
+
+ optisset=1;
+ break;
+
+ case TYPE_UINT64:
+ case TYPE_INT64:
+ config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t));
+ *(cfgoptions->i64ptr)=strtoll(tmpval,&charptr,0);
+
+ if( *charptr != 0) {
+ CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname);
+ }
+
+ printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr));
+ optisset=1;
+ break;
+
+ case TYPE_UINTARRAY:
+ case TYPE_INTARRAY:
+ break;
+
+ case TYPE_DOUBLE:
+ config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
+ *(cfgoptions->dblptr) = strtof(tmpval,&charptr);
+
+ if( *charptr != 0) {
+ CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires a double argument\n",cfgoptions->optname);
+ }
+
+ printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
+ optisset=1;
+ break;
+
+ case TYPE_IPV4ADDR:
+ break;
+
+ default:
+ CONFIG_PRINTF_ERROR("[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type);
+ break;
+ } /* switch on param type */
+
+ if (optisset == 1) {
+ cfgoptions->paramflags = cfgoptions->paramflags | PARAMFLAG_PARAMSET;
+ }
+
+ return optisset;
+}
+
+/*--------------------------------------------------------------------*/
+/* check unknown options in the command line
+*/
+int config_check_unknown_cmdlineopt(char *prefix) {
+ int unknowndetected=0;
+ char testprefix[CONFIG_MAXOPTLENGTH];
+ int finalcheck = 0;
+ memset(testprefix,0,sizeof(testprefix));
+
+ memset(testprefix,0,sizeof(testprefix));
+ if (prefix != NULL) {
+ if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
+ finalcheck = 1;
+ else if (strlen(prefix) > 0) {
+ sprintf(testprefix,"--%.*s.",CONFIG_MAXOPTLENGTH-4,prefix);
+ }
+ }
+
+ for (int i=1; iargc ; i++) {
+ if ( !finalcheck && strstr(config_get_if()->argv[i],testprefix) == NULL ) continue;
+
+ if ( !finalcheck && testprefix[0]==0 && index(config_get_if()->argv[i],'.') != NULL) continue;
+
+ if ( !finalcheck && isdigit(config_get_if()->argv[i][0])) continue;
+
+ if ( !finalcheck && config_get_if()->argv[i][0] == '-' && isdigit(config_get_if()->argv[i][1])) continue;
+
+ if ( (config_get_if()->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0 ) {
+ fprintf(stderr,"[CONFIG] unknown option: %s\n",
+ config_get_if()->argv[i] );
+ unknowndetected++;
+ }
+ }
+
+ if (unknowndetected > 0) {
+ CONFIG_PRINTF_ERROR("[CONFIG] %i unknown option(s) in command line starting with %s (section %s)\n",
+ unknowndetected,testprefix,((prefix==NULL)?"":prefix));
+ }
+
+ return unknowndetected;
+} /* config_check_unknown_cmdlineopt */
+
+int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) {
int c = config_get_if()->argc;
int i,j;
char *pp;
- char cfgpath[512]; /* 512 should be enough for the sprintf below */
-
+ char cfgpath[CONFIG_MAXOPTLENGTH];
j = 0;
i = 0;
- while (c > 0 ) {
- char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
- /* first check help options, either --help, -h or --help_ */
- if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) {
- char *tokctx;
- pp=strtok_r(oneargv, "_",&tokctx);
- if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
- if( prefix == NULL) {
- config_printhelp(cfgoptions,numoptions);
- if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP)))
- exit_fun("[CONFIG] Exiting after displaying help\n");
- }
- } else {
- pp=strtok_r(NULL, " ",&tokctx);
- if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
- printf ("Help for %s section:\n",prefix);
- config_printhelp(cfgoptions,numoptions);
- if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) {
- fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix);
- exit_fun(" Exiting after displaying help\n");
- }
- }
- }
+
+ while (c > 0 ) {
+ char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
+
+ /* first check help options, either --help, -h or --help_ */
+ if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) {
+ char *tokctx;
+ pp=strtok_r(oneargv, "_",&tokctx);
+ config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
+
+ if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
+ if( prefix == NULL) {
+ config_printhelp(cfgoptions,numoptions,"(root section)");
+
+ if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP)))
+ exit_fun("[CONFIG] Exiting after displaying help\n");
+ }
+ } else {
+ pp=strtok_r(NULL, " ",&tokctx);
+
+ if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
+ config_printhelp(cfgoptions,numoptions,prefix);
+
+ if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) {
+ fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix);
+ exit_fun(" Exiting after displaying help\n");
+ }
+ }
+ }
+ }
+
+ /* now, check for non help options */
+ if (oneargv[0] == '-') {
+ for(int n=0; n 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) {
- char *valptr=NULL;
- int ret;
- if (c > 0) {
- pp = config_get_if()->argv[i+1];
- if (pp != NULL ) {
- ret = strlen(pp);
- if (ret > 0 ) {
- if (pp[0] != '-')
- valptr=pp;
- else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) )
- valptr=pp;
- }
- }
- }
- j += processoption(&(cfgoptions[n]), valptr);
- if ( valptr != NULL ) {
- i++;
- c--;
- }
- break;
- }
- } /* for n... */
- } /* if (oneargv[0] == '-') */
- free(oneargv);
- i++;
- c--;
- } /* fin du while */
+ if (prefix != NULL) {
+ sprintf(cfgpath,"%s.%s",prefix,cfgoptions[n].optname);
+ } else {
+ sprintf(cfgpath,"%s",cfgoptions[n].optname);
+ }
+
+ if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */
+ ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) {
+ char *valptr=NULL;
+ int ret;
+ config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
+
+ if (c > 0) {
+ pp = config_get_if()->argv[i+1];
+
+ if (pp != NULL ) {
+ ret = strlen(pp);
+
+ if (ret > 0 ) {
+ if (pp[0] != '-')
+ valptr=pp;
+ else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) )
+ valptr=pp;
+ }
+ }
+ }
+
+ j += processoption(&(cfgoptions[n]), valptr);
+
+ if ( valptr != NULL ) {
+ i++;
+ config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
+ c--;
+ }
+
+ break;
+ }
+ } /* for n... */
+ } /* if (oneargv[0] == '-') */
+
+ free(oneargv);
+ i++;
+ c--;
+ } /* fin du while */
+
printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j);
- return j;
+ return j;
} /* parse_cmdline*/
diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c
index a41f395edd..a6316d6c3f 100644
--- a/common/config/config_load_configmodule.c
+++ b/common/config/config_load_configmodule.c
@@ -20,7 +20,7 @@
*/
/*! \file common/config/config_load_configmodule.c
- * \brief configuration module, load the shared library implementing the configuration module
+ * \brief configuration module, load the shared library implementing the configuration module
* \author Francois TABURET
* \date 2017
* \version 0.1
@@ -36,284 +36,323 @@
#include
#include
#include
+#include
#define CONFIG_LOADCONFIG_MAIN
#include "config_load_configmodule.h"
#include "config_userapi.h"
+#include "../utils/LOG/log.h"
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
-int load_config_sharedlib(configmodule_interface_t *cfgptr)
-{
-void *lib_handle;
-char fname[128];
-char libname[FILENAME_MAX];
-int st;
- st=0;
- sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgptr->cfgmode);
+int load_config_sharedlib(configmodule_interface_t *cfgptr) {
+ void *lib_handle;
+ char fname[128];
+ char libname[FILENAME_MAX];
+ int st;
+ st=0;
+ sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgptr->cfgmode);
+ lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
- lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
- if (!lib_handle) {
- fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror());
+ if (!lib_handle) {
+ fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror());
+ st = -1;
+ } else {
+ sprintf (fname,"config_%s_init",cfgptr->cfgmode);
+ cfgptr->init = dlsym(lib_handle,fname);
+
+ if (cfgptr->init == NULL ) {
+ printf("[CONFIG] %s %d no function %s for config mode %s\n",
+ __FILE__, __LINE__,fname, cfgptr->cfgmode);
+ } else {
+ st=cfgptr->init(cfgptr->cfgP,cfgptr->num_cfgP);
+ printf("[CONFIG] function %s returned %i\n",
+ fname, st);
+ }
+
+ sprintf (fname,"config_%s_get",cfgptr->cfgmode);
+ cfgptr->get = dlsym(lib_handle,fname);
+
+ if (cfgptr->get == NULL ) {
+ printf("[CONFIG] %s %d no function %s for config mode %s\n",
+ __FILE__, __LINE__,fname, cfgptr->cfgmode);
st = -1;
- } else {
- sprintf (fname,"config_%s_init",cfgptr->cfgmode);
- cfgptr->init = dlsym(lib_handle,fname);
+ }
- if (cfgptr->init == NULL ) {
- printf("[CONFIG] %s %d no function %s for config mode %s\n",
- __FILE__, __LINE__,fname, cfgptr->cfgmode);
- } else {
- st=cfgptr->init(cfgptr->cfgP,cfgptr->num_cfgP);
- printf("[CONFIG] function %s returned %i\n",
- fname, st);
- }
+ sprintf (fname,"config_%s_getlist",cfgptr->cfgmode);
+ cfgptr->getlist = dlsym(lib_handle,fname);
- sprintf (fname,"config_%s_get",cfgptr->cfgmode);
- cfgptr->get = dlsym(lib_handle,fname);
- if (cfgptr->get == NULL ) {
- printf("[CONFIG] %s %d no function %s for config mode %s\n",
- __FILE__, __LINE__,fname, cfgptr->cfgmode);
- st = -1;
- }
-
- sprintf (fname,"config_%s_getlist",cfgptr->cfgmode);
- cfgptr->getlist = dlsym(lib_handle,fname);
- if (cfgptr->getlist == NULL ) {
- printf("[CONFIG] %s %d no function %s for config mode %s\n",
- __FILE__, __LINE__,fname, cfgptr->cfgmode);
- st = -1;
- }
+ if (cfgptr->getlist == NULL ) {
+ printf("[CONFIG] %s %d no function %s for config mode %s\n",
+ __FILE__, __LINE__,fname, cfgptr->cfgmode);
+ st = -1;
+ }
- sprintf (fname,"config_%s_end",cfgptr->cfgmode);
- cfgptr->end = dlsym(lib_handle,fname);
- if (cfgptr->getlist == NULL ) {
- printf("[CONFIG] %s %d no function %s for config mode %s\n",
- __FILE__, __LINE__,fname, cfgptr->cfgmode);
- }
- }
-
- return st;
+ sprintf (fname,"config_%s_end",cfgptr->cfgmode);
+ cfgptr->end = dlsym(lib_handle,fname);
+
+ if (cfgptr->getlist == NULL ) {
+ printf("[CONFIG] %s %d no function %s for config mode %s\n",
+ __FILE__, __LINE__,fname, cfgptr->cfgmode);
+ }
+ }
+
+ return st;
}
/*-----------------------------------------------------------------------------------*/
/* from here: interface implementtion of the configuration module */
int nooptfunc(void) {
- return 0;
+ return 0;
};
-int config_cmdlineonly_getlist(paramlist_def_t *ParamList,
- paramdef_t *params, int numparams, char *prefix)
-{
- ParamList->numelt = 0;
- return 0;
+int config_cmdlineonly_getlist(paramlist_def_t *ParamList,
+ paramdef_t *params, int numparams, char *prefix) {
+ ParamList->numelt = 0;
+ return 0;
}
-int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
-{
+int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
int defval;
int fatalerror=0;
int numdefvals=0;
-
- for(int i=0;i option, default cfgmode to libconfig
- with one parameter, the path to the configuration file */
- modeparams=cfgmode;
- cfgmode=strdup(CONFIG_LIBCONFIGFILE);
- }
- cfgptr = malloc(sizeof(configmodule_interface_t));
- memset(cfgptr,0,sizeof(configmodule_interface_t));
+ /* parse the config parameters to set the config source */
+ i = sscanf(cfgparam,"%m[^':']:%ms",&cfgmode,&modeparams);
- cfgptr->rtflags = cfgptr->rtflags | tmpflags;
- cfgptr->argc = argc;
- cfgptr->argv = argv;
- cfgptr->cfgmode=strdup(cfgmode);
- cfgptr->num_cfgP=0;
- atoken=strtok_r(modeparams,":",&strtokctx);
- while ( cfgptr->num_cfgP< CONFIG_MAX_OOPT_PARAMS && atoken != NULL) {
- /* look for debug level in the config parameters, it is commom to all config mode
- and will be removed frome the parameter array passed to the shared module */
- char *aptr;
- aptr=strcasestr(atoken,"dbgl");
- if (aptr != NULL) {
- cfgptr->rtflags = cfgptr->rtflags | strtol(aptr+4,NULL,0);
+ if (i< 0) {
+ fprintf(stderr,"[CONFIG] %s, %d, sscanf error parsing config source %s: %s\n", __FILE__, __LINE__,cfgparam, strerror(errno));
+ exit(-1) ;
+ } else if ( i == 1 ) {
+ /* -O argument doesn't contain ":" separator, assume -O option, default cfgmode to libconfig
+ with one parameter, the path to the configuration file cfgmode must not be NULL */
+ modeparams=cfgmode;
+ cfgmode=strdup(CONFIG_LIBCONFIGFILE);
+ }
- } else {
- cfgptr->cfgP[cfgptr->num_cfgP] = strdup(atoken);
- cfgptr->num_cfgP++;
- }
- atoken = strtok_r(NULL,":",&strtokctx);
- }
+ cfgptr = calloc(sizeof(configmodule_interface_t),1);
+ cfgptr->argv_info = calloc(sizeof(int32_t), argc);
+ cfgptr->argv_info[0] |= CONFIG_CMDLINEOPT_PROCESSED;
-
- printf("[CONFIG] get parameters from %s ",cfgmode);
- for (i=0;inum_cfgP; i++) {
- printf("%s ",cfgptr->cfgP[i]);
- }
- printf(", debug flags: 0x%08x\n",cfgptr->rtflags);
+ if (OoptIdx >= 0) {
+ cfgptr->argv_info[OoptIdx] |= CONFIG_CMDLINEOPT_PROCESSED;
+ cfgptr->argv_info[OoptIdx+1] |= CONFIG_CMDLINEOPT_PROCESSED;
+ }
- if (strstr(cfgparam,CONFIG_CMDLINEONLY) == NULL) {
- i=load_config_sharedlib(cfgptr);
- if (i == 0) {
- printf("[CONFIG] config module %s loaded\n",cfgmode);
- Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].uptr=&(cfgptr->rtflags);
- config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME );
- } else {
- fprintf(stderr,"[CONFIG] %s %d config module \"%s\" couldn't be loaded\n", __FILE__, __LINE__,cfgmode);
- cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT;
- }
- } else {
- cfgptr->init = (configmodule_initfunc_t)nooptfunc;
- cfgptr->get = config_cmdlineonly_get;
- cfgptr->getlist = config_cmdlineonly_getlist;
- cfgptr->end = (configmodule_endfunc_t)nooptfunc;
- }
+ cfgptr->rtflags = cfgptr->rtflags | tmpflags;
+ cfgptr->argc = argc;
+ cfgptr->argv = argv;
+ cfgptr->cfgmode=strdup(cfgmode);
+ cfgptr->num_cfgP=0;
+ atoken=strtok_r(modeparams,":",&strtokctx);
-
+ while ( cfgptr->num_cfgP< CONFIG_MAX_OOPT_PARAMS && atoken != NULL) {
+ /* look for debug level in the config parameters, it is commom to all config mode
+ and will be removed frome the parameter array passed to the shared module */
+ char *aptr;
+ aptr=strcasestr(atoken,"dbgl");
- if (modeparams != NULL) free(modeparams);
- if (cfgmode != NULL) free(cfgmode);
- if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
- config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
-// exit(-1);
- }
- return cfgptr;
+ if (aptr != NULL) {
+ cfgptr->rtflags = cfgptr->rtflags | strtol(aptr+4,NULL,0);
+ } else {
+ cfgptr->cfgP[cfgptr->num_cfgP] = strdup(atoken);
+ cfgptr->num_cfgP++;
+ }
+
+ atoken = strtok_r(NULL,":",&strtokctx);
+ }
+
+ printf("[CONFIG] get parameters from %s ",cfgmode);
+
+ for (i=0; inum_cfgP; i++) {
+ printf("%s ",cfgptr->cfgP[i]);
+ }
+
+ printf(", debug flags: 0x%08x\n",cfgptr->rtflags);
+
+ if (strstr(cfgparam,CONFIG_CMDLINEONLY) == NULL) {
+ i=load_config_sharedlib(cfgptr);
+
+ if (i == 0) {
+ printf("[CONFIG] config module %s loaded\n",cfgmode);
+ Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].uptr=&(cfgptr->rtflags);
+ config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME );
+ } else {
+ fprintf(stderr,"[CONFIG] %s %d config module \"%s\" couldn't be loaded\n", __FILE__, __LINE__,cfgmode);
+ cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT;
+ }
+ } else {
+ cfgptr->init = (configmodule_initfunc_t)nooptfunc;
+ cfgptr->get = config_cmdlineonly_get;
+ cfgptr->getlist = config_cmdlineonly_getlist;
+ cfgptr->end = (configmodule_endfunc_t)nooptfunc;
+ }
+
+ if (modeparams != NULL) free(modeparams);
+
+ if (cfgmode != NULL) free(cfgmode);
+
+ if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
+ config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params),CONFIG_SECTIONNAME );
+ // exit(-1);
+ }
+
+ return cfgptr;
}
/* free memory allocated when reading parameters */
/* config module could be initialized again after this call */
-void end_configmodule(void)
-{
+void end_configmodule(void) {
if (cfgptr != NULL) {
- if (cfgptr->end != NULL) {
- printf ("[CONFIG] calling config module end function...\n");
- cfgptr->end();
- }
+ if (cfgptr->end != NULL) {
+ printf ("[CONFIG] calling config module end function...\n");
+ cfgptr->end();
+ }
- printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
- for(int i=0; inumptrs ; i++) {
- if (cfgptr->ptrs[i] != NULL) {
- free(cfgptr->ptrs[i]);
- cfgptr->ptrs[i]=NULL;
- }
+ printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
+
+ for(int i=0; inumptrs ; i++) {
+ if (cfgptr->ptrs[i] != NULL) {
+ free(cfgptr->ptrs[i]);
+ cfgptr->ptrs[i]=NULL;
}
- cfgptr->numptrs=0;
+ }
+
+ cfgptr->numptrs=0;
}
}
/* free all memory used by config module */
/* should be called only at program exit */
-void free_configmodule(void)
-{
+void free_configmodule(void) {
if (cfgptr != NULL) {
- end_configmodule();
- if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
- printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);
- for (int i=0; inum_cfgP; i++) {
- if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
- }
+ end_configmodule();
+ if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
- free(cfgptr);
- cfgptr=NULL;
+ printf ("[CONFIG] free %i config parameter pointers\n",cfgptr->num_cfgP);
+
+ for (int i=0; inum_cfgP; i++) {
+ if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
+ }
+
+ free(cfgptr);
+ cfgptr=NULL;
}
}
diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h
index ff3fa80f4e..d0309c62c3 100644
--- a/common/config/config_load_configmodule.h
+++ b/common/config/config_load_configmodule.h
@@ -20,8 +20,8 @@
*/
/*! \file common/config/config_load_configmodule.h
- * \brief: configuration module, include file to be used by the source code calling the
- * configuration module initialization
+ * \brief: configuration module, include file to be used by the source code calling the
+ * configuration module initialization
* \author Francois TABURET
* \date 2017
* \version 0.1
@@ -31,12 +31,13 @@
* \warning
*/
#ifndef INCLUDE_CONFIG_LOADCONFIGMODULE_H
-#define INCLUDE_CONFIG_LOADCONFIGMODULE_H
+#define INCLUDE_CONFIG_LOADCONFIGMODULE_H
#include
#include
#include "common/config/config_paramdesc.h"
+#include "common/utils/T/T.h"
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O :P1:P2...
#define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module
@@ -44,12 +45,13 @@
#define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file
#define CONFIG_CMDLINEONLY "cmdline" // use only command line options
#define DEFAULT_CFGFILENAME "oai.conf" // default config file
-
-/* rtflags bit position definitions */
+/* bit position definition for the argv_info mask of the configmodule_interface_t structure */
+#define CONFIG_CMDLINEOPT_PROCESSED (1<<0) // command line option has been processed
+/* bit position definitions for the rtflags mask of the configmodule_interface_t structure*/
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages
-#define CONFIG_NOABORTONCHKF (1<<3) // disable abort execution when parameter checking function fails
+#define CONFIG_NOABORTONCHKF (1<<4) // disable abort execution when parameter checking function fails
#define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help
#define CONFIG_HELP (1<<20) // print help message
#define CONFIG_ABORT (1<<21) // config failed,abort execution
@@ -58,10 +60,10 @@ typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix);
typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
typedef void(*configmodule_endfunc_t)(void);
-typedef struct configmodule_interface
-{
+typedef struct configmodule_interface {
int argc;
char **argv;
+ uint32_t *argv_info;
char *cfgmode;
int num_cfgP;
char *cfgP[CONFIG_MAX_OOPT_PARAMS];
@@ -71,7 +73,7 @@ typedef struct configmodule_interface
configmodule_endfunc_t end;
uint32_t numptrs;
uint32_t rtflags;
- char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
+ char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
} configmodule_interface_t;
#ifdef CONFIG_LOADCONFIG_MAIN
@@ -81,17 +83,17 @@ static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugfl
debugflags can also be defined in the config_libconfig section of the config file\n \
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
4->print command line processing debug messages\n ";
-
+
#define CONFIG_SECTIONNAME "config"
#define CONFIGPARAM_DEBUGFLAGS_IDX 0
static paramdef_t Config_Params[] = {
-/*-----------------------------------------------------------------------------------------------------------------------*/
-/* config parameters for config module */
-/* optname helpstr paramflags XXXptr defXXXval type numelt */
-/*-----------------------------------------------------------------------------------------------------------------------*/
-{"debugflags", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_MASK, 0},
+ /*-----------------------------------------------------------------------------------------------------------------------*/
+ /* config parameters for config module */
+ /* optname helpstr paramflags XXXptr defXXXval type numelt */
+ /*-----------------------------------------------------------------------------------------------------------------------*/
+ {"debugflags", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_MASK, 0},
};
#else
@@ -100,10 +102,13 @@ extern configmodule_interface_t *cfgptr;
#define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); }
-#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); }
+#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); }
#define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); }
-
-extern configmodule_interface_t *load_configmodule(int argc, char **argv);
+
+#define CONFIG_ENABLECMDLINEONLY (1<<1)
+extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags);
extern void end_configmodule(void);
+#define CONFIG_PRINTF_ERROR(f, x... ) if (isLogInitDone ()) { LOG_E(ENB_APP,f,x);} else {printf(f,x);}; if ( !CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) ) exit_fun("exit because configuration failed\n");
+
#endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */
diff --git a/common/config/config_paramdesc.h b/common/config/config_paramdesc.h
index c65e298dfb..627c232f85 100644
--- a/common/config/config_paramdesc.h
+++ b/common/config/config_paramdesc.h
@@ -38,7 +38,7 @@
#define MAX_OPTNAME_SIZE 64
-
+#define CONFIG_MAXOPTLENGTH 512 /* max full option length, full option name exemple: (prefix1.[].prefix2.optname */
/* parameter flags definitions */
@@ -55,83 +55,81 @@
#define PARAMFLAG_PARAMSET (1 << 16) // parameter has been explicitely set in get functions
#define PARAMFLAG_PARAMSETDEF (1 << 17) // parameter has been set to default value in get functions
-
/* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */
#define CONFIG_MAX_NUMCHECKVAL 20
typedef struct paramdef paramdef_t;
typedef union checkedparam {
- struct {
- int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */
- int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */
- int num_okintval; /* number of valid values in the checkingval array */
- } s1;
- struct {
- int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */
- /* to the corresponding item in setintval array (mainly for RRC params) */
- int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */
- int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
- int num_okintval; /* number of valid values in the checkingval array */
- } s1a;
- struct {
- int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
- int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */
-
- } s2;
- struct {
- int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */
- char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
- int num_okstrval; /* number of valid values in the checkingval array */
- } s3;
- struct {
- int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */
- /* to the corresponding item in setintval array (mainly for RRC params) */
- char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
- int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
- int num_okstrval; /* number of valid values in the checkingval array */
- } s3a;
- struct {
- int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */
-
- } s4;
- struct {
- void (*checkfunc)(void) ;
- } s5;
+ struct {
+ int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */
+ int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */
+ int num_okintval; /* number of valid values in the checkingval array */
+ } s1;
+ struct {
+ int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */
+ /* to the corresponding item in setintval array (mainly for RRC params) */
+ int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */
+ int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
+ int num_okintval; /* number of valid values in the checkingval array */
+ } s1a;
+ struct {
+ int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
+ int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */
+
+ } s2;
+ struct {
+ int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */
+ char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
+ int num_okstrval; /* number of valid values in the checkingval array */
+ } s3;
+ struct {
+ int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */
+ /* to the corresponding item in setintval array (mainly for RRC params) */
+ char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
+ int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
+ int num_okstrval; /* number of valid values in the checkingval array */
+ } s3a;
+ struct {
+ int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */
+
+ } s4;
+ struct {
+ void (*checkfunc)(void) ;
+ } s5;
} checkedparam_t;
/* paramdef is used to describe a parameter, array of paramdef_t strustures is used as the main parameter in */
/* config apis used to retrieve parameters values */
-typedef struct paramdef
-{
- char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
- char *helpstr; /* help string */
- unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
- union { /* pointer to the parameter value, completed by the config module */
- char **strptr;
- char **strlistptr;
- uint8_t *u8ptr;
- int8_t *i8ptr;
- uint16_t *u16ptr;
- int16_t *i16ptr;
- uint32_t *uptr;
- int32_t *iptr;
- uint64_t *u64ptr;
- int64_t *i64ptr;
- double *dblptr;
- void *voidptr;
- } ;
- union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
- char *defstrval;
- char **defstrlistval;
- uint32_t defuintval;
- int defintval;
- uint64_t defint64val;
- int *defintarrayval;
- double defdblval;
- } ;
- char type; /* parameter value type, as listed below as TYPE_XXXX macro */
- int numelt; /* number of elements in a list or array parameters or max size of string value */
- checkedparam_t *chkPptr; /* possible pointer to the structure containing the info used to check parameter values */
- int *processedvalue; /* used to store integer values computed from string original value */
+typedef struct paramdef {
+ char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
+ char *helpstr; /* help string */
+ unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
+ union { /* pointer to the parameter value, completed by the config module */
+ char **strptr;
+ char **strlistptr;
+ uint8_t *u8ptr;
+ int8_t *i8ptr;
+ uint16_t *u16ptr;
+ int16_t *i16ptr;
+ uint32_t *uptr;
+ int32_t *iptr;
+ uint64_t *u64ptr;
+ int64_t *i64ptr;
+ double *dblptr;
+ void *voidptr;
+ } ;
+ union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
+ char *defstrval;
+ char **defstrlistval;
+ uint32_t defuintval;
+ int defintval;
+ uint64_t defint64val;
+ int *defintarrayval;
+ double defdblval;
+ } ;
+ char type; /* parameter value type, as listed below as TYPE_XXXX macro */
+ int numelt; /* number of elements in a list or array parameters or max size of string value */
+ checkedparam_t *chkPptr; /* possible pointer to the structure containing the info used to check parameter values */
+ int *processedvalue; /* used to store integer values computed from string original value */
} paramdef_t;
#define TYPE_INT TYPE_INT32
@@ -161,9 +159,9 @@ typedef struct paramdef
#define ANY_IPV4ADDR_STRING "0.0.0.0"
typedef struct paramlist_def {
- char listname[MAX_OPTNAME_SIZE];
- paramdef_t **paramarray;
- int numelt ;
+ char listname[MAX_OPTNAME_SIZE];
+ paramdef_t **paramarray;
+ int numelt ;
} paramlist_def_t;
/* macro helpers for module users */
diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c
index 0ec2e23790..66d3078d33 100644
--- a/common/config/config_userapi.c
+++ b/common/config/config_userapi.c
@@ -39,414 +39,453 @@
#include
#include
#include
-
#include
#include "config_userapi.h"
+#include "../utils/LOG/log.h"
-
-configmodule_interface_t *config_get_if(void)
-{
- if (cfgptr == NULL) {
- fprintf(stderr,"[CONFIG] %s %d config module not initialized\n",__FILE__, __LINE__);
- exit(-1);
- }
- return cfgptr;
-}
-
-char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
-{
- if (ptr == NULL ) {
- ptr = malloc(sizeof(char *));
- if (ptr != NULL) {
- *ptr=NULL;
- cfgoptions->strptr=ptr;
- if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
- config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr;
- config_get_if()->numptrs++;
- }
- } else {
- fprintf(stderr, "[CONFIG] %s %d option %s, cannot allocate pointer: %s \n",
- __FILE__, __LINE__, cfgoptions->optname, strerror(errno));
- exit(-1);
- }
- }
- printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length);
- if(cfgoptions->numelt > 0 && PARAM_ISSCALAR(cfgoptions) ) { /* already allocated */
- if (*ptr != NULL) {
- return *ptr;
- } else {
- fprintf(stderr,"[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n",
- __FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt);
- exit(-1);
- }
- }
-
- if (*ptr == NULL) {
- *ptr = malloc(length);
- if ( *ptr != NULL) {
- memset(*ptr,0,length);
- if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
- config_get_if()->ptrs[config_get_if()->numptrs] = *ptr;
- config_get_if()->numptrs++;
- }
- } else {
- fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
- exit(-1);
- }
- }
- return *ptr;
-}
-
-void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val)
-{
-int tmpval=val;
- if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) {
- tmpval =1;
+configmodule_interface_t *config_get_if(void) {
+ if (cfgptr == NULL) {
+ CONFIG_PRINTF_ERROR("[CONFIG] %s %d config module not initialized\n",__FILE__,__LINE__);
}
+
+ return cfgptr;
+}
+
+char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
+ if (ptr == NULL ) {
+ ptr = malloc(sizeof(char *));
+
+ if (ptr != NULL) {
+ *ptr=NULL;
+ cfgoptions->strptr=ptr;
+
+ if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
+ config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr;
+ config_get_if()->numptrs++;
+ }
+ } else {
+ CONFIG_PRINTF_ERROR("[CONFIG] %s %d option %s, cannot allocate pointer: %s \n",
+ __FILE__, __LINE__, cfgoptions->optname, strerror(errno));
+ }
+ }
+
+ printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length);
+
+ if(cfgoptions->numelt > 0 && PARAM_ISSCALAR(cfgoptions) ) { /* already allocated */
+ if (*ptr != NULL) {
+ return *ptr;
+ } else {
+ CONFIG_PRINTF_ERROR("[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n",
+ __FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt);
+ }
+ }
+
+ if (*ptr == NULL) {
+ *ptr = malloc(length);
+
+ if ( *ptr != NULL) {
+ memset(*ptr,0,length);
+
+ if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
+ config_get_if()->ptrs[config_get_if()->numptrs] = *ptr;
+ config_get_if()->numptrs++;
+ }
+ } else {
+ CONFIG_PRINTF_ERROR("[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
+ }
+ }
+
+ return *ptr;
+}
+
+void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val) {
+ int tmpval=val;
+
+ if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) {
+ tmpval =1;
+ }
+
switch (cfgoptions->type) {
- case TYPE_UINT8:
- *(cfgoptions->u8ptr) = (uint8_t)tmpval;
- printf_params("[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval);
- break;
- case TYPE_INT8:
- *(cfgoptions->i8ptr) = (int8_t)tmpval;
- printf_params("[CONFIG] %s: %i\n", fullname, (int8_t)tmpval);
- break;
- case TYPE_UINT16:
- *(cfgoptions->u16ptr) = (uint16_t)tmpval;
- printf_params("[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval);
- break;
- case TYPE_INT16:
- *(cfgoptions->i16ptr) = (int16_t)tmpval;
- printf_params("[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval);
- break;
- case TYPE_UINT32:
- *(cfgoptions->uptr) = (uint32_t)tmpval;
- printf_params("[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval);
- break;
- case TYPE_MASK:
- *(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval;
- printf_params("[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval);
- break;
- case TYPE_INT32:
- *(cfgoptions->iptr) = (int32_t)tmpval;
- printf_params("[CONFIG] %s: %i\n", fullname, (int32_t)tmpval);
- break;
- default:
- fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname);
- break;
+ case TYPE_UINT8:
+ *(cfgoptions->u8ptr) = (uint8_t)tmpval;
+ printf_params("[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval);
+ break;
+
+ case TYPE_INT8:
+ *(cfgoptions->i8ptr) = (int8_t)tmpval;
+ printf_params("[CONFIG] %s: %i\n", fullname, (int8_t)tmpval);
+ break;
+
+ case TYPE_UINT16:
+ *(cfgoptions->u16ptr) = (uint16_t)tmpval;
+ printf_params("[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval);
+ break;
+
+ case TYPE_INT16:
+ *(cfgoptions->i16ptr) = (int16_t)tmpval;
+ printf_params("[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval);
+ break;
+
+ case TYPE_UINT32:
+ *(cfgoptions->uptr) = (uint32_t)tmpval;
+ printf_params("[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval);
+ break;
+
+ case TYPE_MASK:
+ *(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval;
+ printf_params("[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval);
+ break;
+
+ case TYPE_INT32:
+ *(cfgoptions->iptr) = (int32_t)tmpval;
+ printf_params("[CONFIG] %s: %i\n", fullname, (int32_t)tmpval);
+ break;
+
+ default:
+ fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname);
+ break;
}
}
void config_assign_processedint(paramdef_t *cfgoption, int val) {
- cfgoption->processedvalue = malloc(sizeof(int));
- if ( cfgoption->processedvalue != NULL) {
- *(cfgoption->processedvalue) = val;
- } else {
- fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
- exit(-1);
- }
+ cfgoption->processedvalue = malloc(sizeof(int));
+
+ if ( cfgoption->processedvalue != NULL) {
+ *(cfgoption->processedvalue) = val;
+ } else {
+ CONFIG_PRINTF_ERROR("[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
+ }
}
int config_get_processedint(paramdef_t *cfgoption) {
- int ret;
- if ( cfgoption->processedvalue != NULL) {
- ret=*(cfgoption->processedvalue);
- free( cfgoption->processedvalue);
- cfgoption->processedvalue=NULL;
- printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *(cfgoption->strptr), ret);
- } else {
- fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname);
- ret=0;
- }
-return ret;
+ int ret;
+
+ if ( cfgoption->processedvalue != NULL) {
+ ret=*(cfgoption->processedvalue);
+ free( cfgoption->processedvalue);
+ cfgoption->processedvalue=NULL;
+ printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *(cfgoption->strptr), ret);
+ } else {
+ fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname);
+ ret=0;
+ }
+
+ return ret;
}
-void config_printhelp(paramdef_t *params,int numparams)
-{
- for (int i=0 ; is4.f4 != NULL) {
- st += params[i].chkPptr->s4.f4(&(params[i]));
- }
- }
- if (st != 0) {
- fprintf(stderr,"[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st);
- if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) {
- exit_fun("exit because configuration failed\n");
- }
- }
-return st;
+ for (int i=0 ; is4.f4 != NULL) {
+ st += params[i].chkPptr->s4.f4(&(params[i]));
+ }
+ }
+
+ if (st != 0) {
+ CONFIG_PRINTF_ERROR("[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st);
+ }
+
+ return st;
}
-int config_get(paramdef_t *params,int numparams, char *prefix)
-{
-int ret= -1;
+int config_get(paramdef_t *params,int numparams, char *prefix) {
+ int ret= -1;
-if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
+ if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
fprintf(stderr,"[CONFIG] config_get, section %s skipped, config module not properly initialized\n",prefix);
return ret;
-}
-configmodule_interface_t *cfgif = config_get_if();
- if (cfgif != NULL) {
- ret = config_get_if()->get(params, numparams,prefix);
- if (ret >= 0) {
- config_process_cmdline(params,numparams,prefix);
- config_execcheck(params,numparams,prefix);
- }
- return ret;
}
-return ret;
+
+ configmodule_interface_t *cfgif = config_get_if();
+
+ if (cfgif != NULL) {
+ ret = config_get_if()->get(params, numparams,prefix);
+
+ if (ret >= 0) {
+ config_process_cmdline(params,numparams,prefix);
+ config_execcheck(params,numparams,prefix);
+ }
+
+ return ret;
+ }
+
+ return ret;
}
-int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix)
-{
+int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix) {
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n");
return -1;
}
+
if (!config_get_if())
return -1;
const int ret = config_get_if()->getlist(ParamList, params, numparams, prefix);
+
if (ret >= 0 && params) {
char *newprefix;
+
if (prefix) {
int rc = asprintf(&newprefix, "%s.%s", prefix, ParamList->listname);
+
if (rc < 0) newprefix = NULL;
} else {
newprefix = ParamList->listname;
}
+
char cfgpath[MAX_OPTNAME_SIZE*2 + 6]; /* prefix.listname.[listindex] */
+
for (int i = 0; i < ParamList->numelt; ++i) {
// TODO config_process_cmdline?
sprintf(cfgpath, "%s.[%i]", newprefix, i);
+ config_process_cmdline(ParamList->paramarray[i],numparams,cfgpath);
config_execcheck(ParamList->paramarray[i], numparams, cfgpath);
}
+
if (prefix)
free(newprefix);
}
+
return ret;
}
-int config_isparamset(paramdef_t *params,int paramidx)
-{
+int config_isparamset(paramdef_t *params,int paramidx) {
if ((params[paramidx].paramflags & PARAMFLAG_PARAMSET) != 0) {
- return 1;
+ return 1;
} else {
- return 0;
+ return 0;
}
}
void print_intvalueerror(paramdef_t *param, char *fname, int *okval, int numokval) {
- fprintf(stderr,"[CONFIG] %s: %s: %i invalid value, authorized values:\n ",
- fname,param->optname, (int)*(param->uptr));
- for ( int i=0; ichkPptr->s1.num_okintval ; i++) {
- if( *(param->uptr) == param->chkPptr->s1.okintval[i] ) {
- return 0;
- }
- }
- print_intvalueerror(param,"config_check_intval", param->chkPptr->s1.okintval,param->chkPptr->s1.num_okintval);
- return -1;
+ fprintf(stderr,"[CONFIG] %s: %s: %i invalid value, authorized values:\n ",
+ fname,param->optname, (int)*(param->uptr));
+
+ for ( int i=0; ichkPptr->s1a.num_okintval ; i++) {
- if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) {
- printf_params("[CONFIG] %s: read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]);
- *(param->uptr) = param->chkPptr->s1a.setintval [i];
- return 0;
- }
- }
- print_intvalueerror(param,"config_check_modify_integer", param->chkPptr->s1a.okintval,param->chkPptr->s1a.num_okintval);
+int config_check_intval(paramdef_t *param) {
+ if ( param == NULL ) {
+ fprintf(stderr,"[CONFIG] config_check_intval: NULL param argument\n");
return -1;
+ }
+
+ for ( int i=0; ichkPptr->s1.num_okintval ; i++) {
+ if( *(param->uptr) == param->chkPptr->s1.okintval[i] ) {
+ return 0;
+ }
+ }
+
+ print_intvalueerror(param,"config_check_intval", param->chkPptr->s1.okintval,param->chkPptr->s1.num_okintval);
+ return -1;
}
-int config_check_intrange(paramdef_t *param)
-{
- if( *(param->iptr) >= param->chkPptr->s2.okintrange[0] && *(param->iptr) <= param->chkPptr->s2.okintrange[1] ) {
- return 0;
- }
- fprintf(stderr,"[CONFIG] config_check_intrange: %s: %i invalid value, authorized range: %i %i\n",
- param->optname, (int)*(param->uptr), param->chkPptr->s2.okintrange[0], param->chkPptr->s2.okintrange[1]);
- return -1;
+int config_check_modify_integer(paramdef_t *param) {
+ for (int i=0; i < param->chkPptr->s1a.num_okintval ; i++) {
+ if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) {
+ printf_params("[CONFIG] %s: read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]);
+ *(param->uptr) = param->chkPptr->s1a.setintval [i];
+ return 0;
+ }
+ }
+
+ print_intvalueerror(param,"config_check_modify_integer", param->chkPptr->s1a.okintval,param->chkPptr->s1a.num_okintval);
+ return -1;
+}
+
+int config_check_intrange(paramdef_t *param) {
+ if( *(param->iptr) >= param->chkPptr->s2.okintrange[0] && *(param->iptr) <= param->chkPptr->s2.okintrange[1] ) {
+ return 0;
+ }
+
+ fprintf(stderr,"[CONFIG] config_check_intrange: %s: %i invalid value, authorized range: %i %i\n",
+ param->optname, (int)*(param->uptr), param->chkPptr->s2.okintrange[0], param->chkPptr->s2.okintrange[1]);
+ return -1;
}
void print_strvalueerror(paramdef_t *param, char *fname, char **okval, int numokval) {
- fprintf(stderr,"[CONFIG] %s: %s: %s invalid value, authorized values:\n ",
- fname,param->optname, *(param->strptr));
- for ( int i=0; ioptname, *(param->strptr));
+
+ for ( int i=0; ichkPptr->s3.num_okstrval ; i++) {
- if( strcasecmp(*(param->strptr),param->chkPptr->s3.okstrval[i] ) == 0) {
- return 0;
- }
- }
- print_strvalueerror(param, "config_check_strval", param->chkPptr->s3.okstrval, param->chkPptr->s3.num_okstrval);
+
+int config_check_strval(paramdef_t *param) {
+ if ( param == NULL ) {
+ fprintf(stderr,"[CONFIG] config_check_strval: NULL param argument\n");
return -1;
+ }
+
+ for ( int i=0; ichkPptr->s3.num_okstrval ; i++) {
+ if( strcasecmp(*(param->strptr),param->chkPptr->s3.okstrval[i] ) == 0) {
+ return 0;
+ }
+ }
+
+ print_strvalueerror(param, "config_check_strval", param->chkPptr->s3.okstrval, param->chkPptr->s3.num_okstrval);
+ return -1;
}
-int config_checkstr_assign_integer(paramdef_t *param)
-{
+int config_checkstr_assign_integer(paramdef_t *param) {
+ for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) {
+ if (strcasecmp(*(param->strptr),param->chkPptr->s3a.okstrval[i] ) == 0) {
+ config_assign_processedint(param, param->chkPptr->s3a.setintval[i]);
+ return 0;
+ }
+ }
-
- for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) {
- if (strcasecmp(*(param->strptr),param->chkPptr->s3a.okstrval[i] ) == 0) {
- config_assign_processedint(param, param->chkPptr->s3a.setintval[i]);
- return 0;
- }
- }
- print_strvalueerror(param, "config_check_strval", param->chkPptr->s3a.okstrval, param->chkPptr->s3a.num_okstrval);
-
- return -1;
+ print_strvalueerror(param, "config_check_strval", param->chkPptr->s3a.okstrval, param->chkPptr->s3a.num_okstrval);
+ return -1;
}
-int config_setdefault_string(paramdef_t *cfgoptions, char *prefix)
-{
+void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams) {
+ for (int i=0; i< numparams ; i++ ) {
+ params[i].chkPptr = &(checkfunctions[i]);
+ }
+}
+
+int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
+
if( cfgoptions->defstrval != NULL) {
- status=1;
+ status=1;
- if (cfgoptions->numelt == 0 ) {
- config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *));
- config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(cfgoptions->defstrval)+1);
- sprintf(*(cfgoptions->strptr), "%s",cfgoptions->defstrval);
- printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *(cfgoptions->strptr));
- } else {
- sprintf((char *)*(cfgoptions->strptr), "%s",cfgoptions->defstrval);
- printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (char *)*(cfgoptions->strptr));
- }
+ if (cfgoptions->numelt == 0 ) {
+ config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *));
+ config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(cfgoptions->defstrval)+1);
+ sprintf(*(cfgoptions->strptr), "%s",cfgoptions->defstrval);
+ printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *(cfgoptions->strptr));
+ } else {
+ sprintf((char *)*(cfgoptions->strptr), "%s",cfgoptions->defstrval);
+ printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (char *)*(cfgoptions->strptr));
+ }
}
+
return status;
}
-int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix)
-{
+int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
+
if( cfgoptions->defstrlistval != NULL) {
- cfgoptions->strlistptr=cfgoptions->defstrlistval;
- status=1;
- for(int j=0; jnumelt; j++)
- printf_params("[CONFIG] %s.%s[%i] set to default value %s\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname,j, cfgoptions->strlistptr[j]);
+ cfgoptions->strlistptr=cfgoptions->defstrlistval;
+ status=1;
+
+ for(int j=0; jnumelt; j++)
+ printf_params("[CONFIG] %s.%s[%i] set to default value %s\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname,j, cfgoptions->strlistptr[j]);
}
+
return status;
}
-int config_setdefault_int(paramdef_t *cfgoptions, char *prefix)
-{
+int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
config_check_valptr(cfgoptions, (char **)(&(cfgoptions->iptr)),sizeof(int32_t));
- if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
- config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval);
- status=1;
- printf_params("[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname);
- }
- return status;
-}
-int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix)
-{
+ if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
+ config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval);
+ status=1;
+ printf_params("[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname);
+ }
+
+ return status;
+}
+
+int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(long long));
+
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
- *(cfgoptions->u64ptr)=cfgoptions->defuintval;
- status=1;
- printf_params("[CONFIG] %s.%s set to default value %llu\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (long long unsigned)(*(cfgoptions->u64ptr)));
+ *(cfgoptions->u64ptr)=cfgoptions->defuintval;
+ status=1;
+ printf_params("[CONFIG] %s.%s set to default value %llu\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (long long unsigned)(*(cfgoptions->u64ptr)));
}
+
return status;
}
-int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix)
-{
- int status = 0;
+int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) {
+ int status = 0;
+
if( cfgoptions->defintarrayval != NULL) {
- config_check_valptr(cfgoptions,(char **)&(cfgoptions->iptr), sizeof(int32_t*));
+ config_check_valptr(cfgoptions,(char **)&(cfgoptions->iptr), sizeof(int32_t *));
cfgoptions->iptr=cfgoptions->defintarrayval;
status=1;
+
for (int j=0; jnumelt ; j++) {
- printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname ,j,(int)cfgoptions->iptr[j]);
+ printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname ,j,(int)cfgoptions->iptr[j]);
}
}
+
return status;
}
-int config_setdefault_double(paramdef_t *cfgoptions, char *prefix)
-{
+int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
- if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
- *(cfgoptions->u64ptr)=cfgoptions->defdblval;
- status=1;
- printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname , *(cfgoptions->dblptr));
- }
- return status;
-}
-int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr)
-{
- config_check_valptr(cfgoptions,(char **)&(cfgoptions->uptr), sizeof(int));
- int rst=inet_pton(AF_INET, ipv4addr ,cfgoptions->uptr );
- if (rst == 1 && *(cfgoptions->uptr) > 0) {
- printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr);
- return 1;
- } else {
- if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) {
- printf_params("[CONFIG] %s:%s (INADDR_ANY) \n",cfgoptions->optname,ipv4addr);
- *cfgoptions->uptr=INADDR_ANY;
- return 1;
- } else {
- fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname);
- return -1;
- }
+ if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
+ *(cfgoptions->u64ptr)=cfgoptions->defdblval;
+ status=1;
+ printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname , *(cfgoptions->dblptr));
}
+
+ return status;
+}
+
+int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr) {
+ config_check_valptr(cfgoptions,(char **)&(cfgoptions->uptr), sizeof(int));
+ int rst=inet_pton(AF_INET, ipv4addr ,cfgoptions->uptr );
+
+ if (rst == 1 && *(cfgoptions->uptr) > 0) {
+ printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr);
+ return 1;
+ } else {
+ if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) {
+ printf_params("[CONFIG] %s:%s (INADDR_ANY) \n",cfgoptions->optname,ipv4addr);
+ *cfgoptions->uptr=INADDR_ANY;
+ return 1;
+ } else {
+ fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname);
+ return -1;
+ }
+ }
+
return 0;
}
-int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix)
-{
+int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
-
+
if (cfgoptions->defstrval != NULL) {
- status = config_assign_ipv4addr(cfgoptions, cfgoptions->defstrval);
+ status = config_assign_ipv4addr(cfgoptions, cfgoptions->defstrval);
}
+
return status;
-}
+}
diff --git a/common/config/config_userapi.h b/common/config/config_userapi.h
index 2b40f8401b..cc07b1af5f 100644
--- a/common/config/config_userapi.h
+++ b/common/config/config_userapi.h
@@ -20,7 +20,7 @@
*/
/*! \file common/config/config_userapi.h
- * \brief: configuration module, include file to be used by the source code calling the
+ * \brief: configuration module, include file to be used by the source code calling the
* configuration module to access configuration parameters
* \author Francois TABURET
* \date 2017
@@ -31,7 +31,7 @@
* \warning
*/
#ifndef INCLUDE_CONFIG_USERAPI_H
-#define INCLUDE_CONFIG_USERAPI_H
+#define INCLUDE_CONFIG_USERAPI_H
#include "config_load_configmodule.h"
#ifdef __cplusplus
@@ -48,17 +48,22 @@ extern "C"
#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
/* utility functions, to be used by configuration module and/or configuration libraries */
extern configmodule_interface_t *config_get_if(void);
-extern char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
-extern void config_printhelp(paramdef_t *,int numparams);
+extern char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
+extern void config_printhelp(paramdef_t *,int numparams, char *prefix);
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
extern void config_assign_processedint(paramdef_t *cfgoption, int val);
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr);
-/* apis to get parameters, to be used by oai modules, at configuration time */
+/* apis to get/check parameters, to be used by oai modules, at configuration time */
+#define CONFIG_CHECKALLSECTIONS "ALLSECTIONS"
+extern int config_check_unknown_cmdlineopt(char *prefix);
extern int config_get(paramdef_t *params,int numparams, char *prefix);
extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix);
+/* apis to set some of the paramdef_t fields before using the get/getlist api's */
+extern void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams);
+
/* apis to retrieve parameters info after calling get or getlist functions */
extern int config_isparamset(paramdef_t *params,int paramidx);
extern int config_get_processedint(paramdef_t *cfgoption);
diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c
index cb6fa46293..2d861f2dc3 100644
--- a/common/config/libconfig/config_libconfig.c
+++ b/common/config/libconfig/config_libconfig.c
@@ -42,60 +42,60 @@
#include "errno.h"
#if ( LIBCONFIG_VER_MAJOR == 1 && LIBCONFIG_VER_MINOR < 5)
-#define config_setting_lookup config_lookup_from
+ #define config_setting_lookup config_lookup_from
#endif
void config_libconfig_end(void );
-int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath)
-{
-const char *str;
-int st;
-int numelt;
+int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) {
+ const char *str;
+ int st;
+ int numelt;
+ numelt=config_setting_length(setting);
+ config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
+ st=0;
- numelt=config_setting_length(setting);
- config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
- st=0;
- for (int i=0; i< numelt ; i++) {
- str=config_setting_get_string_elem(setting,i);
- if (str==NULL) {
- printf("[LIBCONFIG] %s%i not found in config file\n", cfgoptions->optname,i);
- } else {
- config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(str)+1);
- sprintf(cfgoptions->strlistptr[i],"%s",str);
- st++;
- printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]);
- }
- }
- cfgoptions->numelt=numelt;
- return st;
+ for (int i=0; i< numelt ; i++) {
+ str=config_setting_get_string_elem(setting,i);
+
+ if (str==NULL) {
+ printf("[LIBCONFIG] %s%i not found in config file\n", cfgoptions->optname,i);
+ } else {
+ config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(str)+1);
+ sprintf(cfgoptions->strlistptr[i],"%s",str);
+ st++;
+ printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]);
+ }
+ }
+
+ cfgoptions->numelt=numelt;
+ return st;
}
-int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath)
-{
+int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) {
+ cfgoptions->numelt=config_setting_length(setting);
- cfgoptions->numelt=config_setting_length(setting);
-
- if (cfgoptions->numelt > 0) {
- cfgoptions->iptr=malloc(sizeof(int) * (cfgoptions->numelt));
- for (int i=0; i< cfgoptions->numelt && cfgoptions->iptr != NULL; i++) {
- cfgoptions->iptr[i]=config_setting_get_int_elem(setting,i);
- printf_params("[LIBCONFIG] %s[%i]: %i\n", cfgpath,i,cfgoptions->iptr[i]);
- } /* for loop on array element... */
- }
- return cfgoptions->numelt;
+ if (cfgoptions->numelt > 0) {
+ cfgoptions->iptr=malloc(sizeof(int) * (cfgoptions->numelt));
+
+ for (int i=0; i< cfgoptions->numelt && cfgoptions->iptr != NULL; i++) {
+ cfgoptions->iptr[i]=config_setting_get_int_elem(setting,i);
+ printf_params("[LIBCONFIG] %s[%i]: %i\n", cfgpath,i,cfgoptions->iptr[i]);
+ } /* for loop on array element... */
+ }
+
+ return cfgoptions->numelt;
}
-int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
-{
+int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
config_setting_t *setting;
char *str;
int i,u;
long long int llu;
- double dbl;
+ double dbl;
int rst;
int status=0;
int notfound;
@@ -104,211 +104,244 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
int numdefvals=0;
char cfgpath[512]; /* 512 should be enough for the sprintf below */
- for(i=0;iparamflags & PARAMFLAG_DONOTREAD) != 0) {
+ printf_params("[LIBCONFIG] %s.%s ignored\n", cfgpath,cfgoptions[i].optname );
+ continue;
+ }
- if( (cfgoptions->paramflags & PARAMFLAG_DONOTREAD) != 0) {
- printf_params("[LIBCONFIG] %s.%s ignored\n", cfgpath,cfgoptions[i].optname );
- continue;
- }
- notfound=0;
- defval=0;
- switch(cfgoptions[i].type)
- {
- case TYPE_STRING:
- if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
- if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) {
- fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n",
- cfgpath,str,cfgoptions[i].numelt);
- str[strlen(str)-1] = 0;
- }
- if (cfgoptions[i].numelt == 0 ) {
- // config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
- config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
- sprintf( *(cfgoptions[i].strptr) , "%s", str);
- printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) );
- } else {
- sprintf( (char *)(cfgoptions[i].strptr) , "%s", str);
- printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr );
- }
- } else {
- defval=config_setdefault_string(&(cfgoptions[i]),prefix);
- }
- break;
- case TYPE_STRINGLIST:
- setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
- if ( setting != NULL) {
- read_strlist(&cfgoptions[i],setting,cfgpath);
- } else {
- defval=config_setdefault_stringlist(&(cfgoptions[i]),prefix);
- }
- break;
- case TYPE_UINT8:
- case TYPE_INT8:
- case TYPE_UINT16:
- case TYPE_INT16:
- case TYPE_UINT32:
- case TYPE_INT32:
- case TYPE_MASK:
- if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) {
- config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t));
- config_assign_int(&(cfgoptions[i]),cfgpath,u);
- } else {
- defval=config_setdefault_int(&(cfgoptions[i]),prefix);
- }
- break;
- case TYPE_UINT64:
- case TYPE_INT64:
- if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) {
- config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long));
- if(cfgoptions[i].type==TYPE_UINT64) {
- *(cfgoptions[i].u64ptr) = (uint64_t)llu;
- printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) );
- } else {
- *(cfgoptions[i].iptr) = llu;
- printf_params("[LIBCONFIG] %s: %lli\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) );
- }
- } else {
- defval=config_setdefault_int64(&(cfgoptions[i]),prefix);
- }
- break;
- case TYPE_UINTARRAY:
- case TYPE_INTARRAY:
- setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
- if ( setting != NULL) {
- read_intarray(&cfgoptions[i],setting,cfgpath);
- } else {
- defval=config_setdefault_intlist(&(cfgoptions[i]),prefix);
- }
- break;
- case TYPE_DOUBLE:
- if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) {
- config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double));
- *(cfgoptions[i].dblptr) = dbl;
- printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) );
- } else {
- defval=config_setdefault_double(&(cfgoptions[i]),prefix);
- }
- break;
- case TYPE_IPV4ADDR:
- if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
- defval=config_setdefault_ipv4addr(&(cfgoptions[i]),prefix);
- } else {
- rst=config_assign_ipv4addr(cfgoptions, str);
- if (rst < 0) {
- fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath);
- fatalerror=1;
- }
- }
- break;
- case TYPE_LIST:
- setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
- if ( setting) {
- cfgoptions[i].numelt=config_setting_length(setting);
- } else {
- notfound=1;
- }
- break;
- default:
- fprintf(stderr,"[LIBCONFIG] %s type %i not supported\n", cfgpath,cfgoptions[i].type);
- fatalerror=1;
- break;
- } /* switch on param type */
- if( notfound == 1) {
- printf("[LIBCONFIG] %s not found in %s ", cfgpath,libconfig_privdata.configfile );
- if ( (cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) != 0) {
- fatalerror=1;
- printf(" mandatory parameter missing\n");
+ notfound=0;
+ defval=0;
+
+ switch(cfgoptions[i].type) {
+ case TYPE_STRING:
+ if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
+ if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) {
+ fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n",
+ cfgpath,str,cfgoptions[i].numelt);
+ str[strlen(str)-1] = 0;
+ }
+
+ if (cfgoptions[i].numelt == 0 ) {
+ // config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
+ config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
+ sprintf( *(cfgoptions[i].strptr) , "%s", str);
+ printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) );
+ } else {
+ sprintf( (char *)(cfgoptions[i].strptr) , "%s", str);
+ printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr );
+ }
} else {
- printf("\n");
+ defval=config_setdefault_string(&(cfgoptions[i]),prefix);
}
+
+ break;
+
+ case TYPE_STRINGLIST:
+ setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
+
+ if ( setting != NULL) {
+ read_strlist(&cfgoptions[i],setting,cfgpath);
+ } else {
+ defval=config_setdefault_stringlist(&(cfgoptions[i]),prefix);
+ }
+
+ break;
+
+ case TYPE_UINT8:
+ case TYPE_INT8:
+ case TYPE_UINT16:
+ case TYPE_INT16:
+ case TYPE_UINT32:
+ case TYPE_INT32:
+ case TYPE_MASK:
+ if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) {
+ config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t));
+ config_assign_int(&(cfgoptions[i]),cfgpath,u);
+ } else {
+ defval=config_setdefault_int(&(cfgoptions[i]),prefix);
+ }
+
+ break;
+
+ case TYPE_UINT64:
+ case TYPE_INT64:
+ if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) {
+ config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long));
+
+ if(cfgoptions[i].type==TYPE_UINT64) {
+ *(cfgoptions[i].u64ptr) = (uint64_t)llu;
+ printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) );
+ } else {
+ *(cfgoptions[i].iptr) = llu;
+ printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) );
+ }
+ } else {
+ defval=config_setdefault_int64(&(cfgoptions[i]),prefix);
+ }
+
+ break;
+
+ case TYPE_UINTARRAY:
+ case TYPE_INTARRAY:
+ setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
+
+ if ( setting != NULL) {
+ read_intarray(&cfgoptions[i],setting,cfgpath);
+ } else {
+ defval=config_setdefault_intlist(&(cfgoptions[i]),prefix);
+ }
+
+ break;
+
+ case TYPE_DOUBLE:
+ if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) {
+ config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double));
+ *(cfgoptions[i].dblptr) = dbl;
+ printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) );
+ } else {
+ defval=config_setdefault_double(&(cfgoptions[i]),prefix);
+ }
+
+ break;
+
+ case TYPE_IPV4ADDR:
+ if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
+ defval=config_setdefault_ipv4addr(&(cfgoptions[i]),prefix);
+ } else {
+ rst=config_assign_ipv4addr(cfgoptions, str);
+
+ if (rst < 0) {
+ fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath);
+ fatalerror=1;
+ }
+ }
+
+ break;
+
+ case TYPE_LIST:
+ setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
+
+ if ( setting) {
+ cfgoptions[i].numelt=config_setting_length(setting);
+ } else {
+ notfound=1;
+ }
+
+ break;
+
+ default:
+ fprintf(stderr,"[LIBCONFIG] %s type %i not supported\n", cfgpath,cfgoptions[i].type);
+ fatalerror=1;
+ break;
+ } /* switch on param type */
+
+ if( notfound == 1) {
+ printf("[LIBCONFIG] %s not found in %s ", cfgpath,libconfig_privdata.configfile );
+
+ if ( (cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) != 0) {
+ fatalerror=1;
+ printf(" mandatory parameter missing\n");
+ } else {
+ printf("\n");
+ }
} else {
if (defval == 1) {
- numdefvals++;
- cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSETDEF;
+ numdefvals++;
+ cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSETDEF;
} else {
- cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSET;
+ cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSET;
}
+
status++;
}
} /* for loop on options */
+
printf("[LIBCONFIG] %s: %i/%i parameters successfully set, (%i to default value)\n",
- ((prefix == NULL)?"(root)":prefix),
+ ((prefix == NULL)?"(root)":prefix),
status,numoptions,numdefvals );
+
if (fatalerror == 1) {
- fprintf(stderr,"[LIBCONFIG] fatal errors found when processing %s \n", libconfig_privdata.configfile );
- config_libconfig_end();
- end_configmodule();
+ fprintf(stderr,"[LIBCONFIG] fatal errors found when processing %s \n", libconfig_privdata.configfile );
+ config_libconfig_end();
+ end_configmodule();
}
+
return status;
}
-int config_libconfig_getlist(paramlist_def_t *ParamList,
- paramdef_t *params, int numparams, char *prefix)
-{
-config_setting_t *setting;
-int i,j,status;
-char *listpath=NULL;
-char cfgpath[MAX_OPTNAME_SIZE*2 + 6]; /* prefix.listname.[listindex] */
+int config_libconfig_getlist(paramlist_def_t *ParamList,
+ paramdef_t *params, int numparams, char *prefix) {
+ config_setting_t *setting;
+ int i,j,status;
+ char *listpath=NULL;
+ char cfgpath[MAX_OPTNAME_SIZE*2 + 6]; /* prefix.listname.[listindex] */
- if (prefix != NULL)
- {
- i=asprintf(&listpath ,"%s.%s",prefix,ParamList->listname);
- }
- else
- {
- i=asprintf(&listpath ,"%s",ParamList->listname);
- }
- setting = config_lookup(&(libconfig_privdata.cfg), listpath);
- if ( setting) {
- status = ParamList->numelt = config_setting_length(setting);
- printf_params("[LIBCONFIG] %i %s in config file %s \n",
- ParamList->numelt,listpath,libconfig_privdata.configfile );
+ if (prefix != NULL) {
+ i=asprintf(&listpath ,"%s.%s",prefix,ParamList->listname);
+ } else {
+ i=asprintf(&listpath ,"%s",ParamList->listname);
+ }
+
+ setting = config_lookup(&(libconfig_privdata.cfg), listpath);
+
+ if ( setting) {
+ status = ParamList->numelt = config_setting_length(setting);
+ printf_params("[LIBCONFIG] %i %s in config file %s \n",
+ ParamList->numelt,listpath,libconfig_privdata.configfile );
+ } else {
+ printf("[LIBCONFIG] list %s not found in config file %s \n",
+ listpath,libconfig_privdata.configfile );
+ ParamList->numelt= 0;
+ status = -1;
+ }
+
+ if (ParamList->numelt > 0 && params != NULL) {
+ ParamList->paramarray = malloc(ParamList->numelt * sizeof(paramdef_t *));
+
+ if ( ParamList->paramarray != NULL) {
+ config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray);
+ config_get_if()->numptrs++;
} else {
- printf("[LIBCONFIG] list %s not found in config file %s \n",
- listpath,libconfig_privdata.configfile );
- ParamList->numelt= 0;
- status = -1;
+ fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
+ exit(-1);
}
- if (ParamList->numelt > 0 && params != NULL) {
- ParamList->paramarray = malloc(ParamList->numelt * sizeof(paramdef_t *));
- if ( ParamList->paramarray != NULL) {
- config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray);
- config_get_if()->numptrs++;
- } else {
- fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
- exit(-1);
- }
- for (i=0 ; i < ParamList->numelt ; i++) {
- ParamList->paramarray[i] = malloc(numparams * sizeof(paramdef_t));
- if ( ParamList->paramarray[i] != NULL) {
- config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray[i]);
- config_get_if()->numptrs++;
- } else {
- fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
- exit(-1);
- }
-
- memcpy(ParamList->paramarray[i], params, sizeof(paramdef_t)*numparams);
- for (j=0;jparamarray[i][j].strptr = NULL ;
- }
- sprintf(cfgpath,"%s.[%i]",listpath,i);
- config_libconfig_get(ParamList->paramarray[i], numparams, cfgpath );
- } /* for i... */
- } /* ParamList->numelt > 0 && params != NULL */
- if (listpath != NULL)
- free(listpath);
- return status;
+
+ for (i=0 ; i < ParamList->numelt ; i++) {
+ ParamList->paramarray[i] = malloc(numparams * sizeof(paramdef_t));
+
+ if ( ParamList->paramarray[i] != NULL) {
+ config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray[i]);
+ config_get_if()->numptrs++;
+ } else {
+ fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
+ exit(-1);
+ }
+
+ memcpy(ParamList->paramarray[i], params, sizeof(paramdef_t)*numparams);
+
+ for (j=0; jparamarray[i][j].strptr = NULL ;
+ }
+
+ sprintf(cfgpath,"%s.[%i]",listpath,i);
+ config_libconfig_get(ParamList->paramarray[i], numparams, cfgpath );
+ } /* for i... */
+ } /* ParamList->numelt > 0 && params != NULL */
+
+ if (listpath != NULL)
+ free(listpath);
+
+ return status;
}
-int config_libconfig_init(char *cfgP[], int numP)
-{
+int config_libconfig_init(char *cfgP[], int numP) {
config_init(&(libconfig_privdata.cfg));
libconfig_privdata.configfile = strdup((char *)cfgP[0]);
config_get_if()->numptrs=0;
@@ -317,24 +350,22 @@ int config_libconfig_init(char *cfgP[], int numP)
/* Read the file. If there is an error, report it and exit. */
if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) {
fprintf(stderr,"[LIBCONFIG] %s %d file %s - %d - %s\n",__FILE__, __LINE__,
- libconfig_privdata.configfile, config_error_line(&(libconfig_privdata.cfg)),
- config_error_text(&(libconfig_privdata.cfg)));
+ libconfig_privdata.configfile, config_error_line(&(libconfig_privdata.cfg)),
+ config_error_text(&(libconfig_privdata.cfg)));
config_destroy(&(libconfig_privdata.cfg));
printf( "\n");
return -1;
}
-
return 0;
}
-void config_libconfig_end(void )
-{
+void config_libconfig_end(void ) {
config_destroy(&(libconfig_privdata.cfg));
+
if ( libconfig_privdata.configfile != NULL ) {
- free(libconfig_privdata.configfile);
- libconfig_privdata.configfile=NULL;
- }
-
+ free(libconfig_privdata.configfile);
+ libconfig_privdata.configfile=NULL;
+ }
}
diff --git a/openair2/COMMON/messages_types.h b/common/ngran_types.h
similarity index 56%
rename from openair2/COMMON/messages_types.h
rename to common/ngran_types.h
index 5e5fdadd2a..224a85def5 100644
--- a/openair2/COMMON/messages_types.h
+++ b/common/ngran_types.h
@@ -19,32 +19,33 @@
* contact@openairinterface.org
*/
-/*
- * messages_types.h
- *
- * Created on: Oct 14, 2013
- * Author: winckel
- */
+/*! \file common/ngran_types.h
+* \brief Definitions for NGRAN node types
+* \author R. Knopp
+* \date 2018
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr
+* \note
+* \warning
+*/
-#ifndef MESSAGES_TYPES_H_
-#define MESSAGES_TYPES_H_
+#ifndef __NGRAN_TYPES_H__
+#define __NGRAN_TYPES_H__
-#include "intertask_messages_types.h"
-#include "timer_messages_types.h"
+typedef enum {
+ ngran_eNB = 0,
+ ngran_ng_eNB = 1,
+ ngran_gNB = 2,
+ ngran_eNB_CU = 3,
+ ngran_ng_eNB_CU = 4,
+ ngran_gNB_CU = 5,
+ ngran_eNB_DU = 6,
+ ngran_gNB_DU = 7
+} ngran_node_t;
+
+#define NODE_IS_MONOLITHIC(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB || (nOdE_TyPe) == ngran_ng_eNB || (nOdE_TyPe) == ngran_gNB)
+#define NODE_IS_CU(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB_CU || (nOdE_TyPe) == ngran_ng_eNB_CU || (nOdE_TyPe) == ngran_gNB_CU)
+#define NODE_IS_DU(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB_DU || (nOdE_TyPe) == ngran_gNB_DU)
-#include "phy_messages_types.h"
-#include "mac_messages_types.h"
-#include "rlc_messages_types.h"
-#include "pdcp_messages_types.h"
-#include "rrc_messages_types.h"
-#include "nas_messages_types.h"
-#if ENABLE_RAL
-#include "ral_messages_types.h"
#endif
-#include "s1ap_messages_types.h"
-#include "x2ap_messages_types.h"
-#include "sctp_messages_types.h"
-#include "udp_messages_types.h"
-#include "gtpv1_u_messages_types.h"
-
-#endif /* MESSAGES_TYPES_H_ */
diff --git a/common/ran_context.h b/common/ran_context.h
index 61e2ac477e..73bc536cc2 100644
--- a/common/ran_context.h
+++ b/common/ran_context.h
@@ -19,13 +19,13 @@
* contact@openairinterface.org
*/
-/*! \file PHY/impl_defs_lte.h
+/*! \file common/ran_context.h
* \brief LTE Physical channel configuration and variable structure definitions
* \author R. Knopp, F. Kaltenberger
* \date 2011
* \version 0.1
* \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+* \email: knopp@eurecom.fr, florian.kaltenberger@eurecom.fr
* \note
* \warning
*/
@@ -38,7 +38,9 @@
#include "PHY/defs_eNB.h"
#include "PHY/types.h"
#include "PHY/impl_defs_top.h"
-#include "RRC/LTE/rrc_defs.h"
+#include "PHY/defs_L1_NB_IoT.h"
+#include "PHY/defs_RU.h"
+#include "ENB_APP/enb_config.h"
#include "flexran_agent_defs.h"
#include "gtpv1u.h"
@@ -47,8 +49,8 @@
#include "NwGtpv1uPrivate.h"
#include "gtpv1u_eNB_defs.h"
-#include "PHY/defs_L1_NB_IoT.h"
#include "RRC/LTE/defs_NB_IoT.h"
+#include "RRC/LTE/rrc_defs.h"
#include "RRC/NR/nr_rrc_defs.h"
diff --git a/common/utils/DOC/loader.md b/common/utils/DOC/loader.md
new file mode 100644
index 0000000000..91ff0c02f0
--- /dev/null
+++ b/common/utils/DOC/loader.md
@@ -0,0 +1,17 @@
+# OAI shared library loader
+
+Shared libraries usage is modularization mechanism which provides the following advantages:
+1. Prevents including in the main executable code which is not used in a given configuration
+1. Provides flexibility, several implementation of a given functionality can be chosen at run-time, without any compilation step. For example you can build several devices (USRP, BladeFR, LimeSDR) and choose which one you want to use on the command line or via the configuration.
+1. Makes code evolution easier: as soon as the shared library interface is clearly defined, you can work on the functionality implemented in a shared library while regularly updating the other components of the code. You can decide to develop your own version of a functionality, decide to deliver it or not, letting the user decide wwhat version he wants to use.
+
+The main drawback is a performance cost at init time, when loading libraries.
+
+
+## Documentation
+
+* [runtime usage](loader/rtusage.md)
+* [developer usage](loader/devusage.md)
+* [module architecture](loader/arch.md)
+
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
diff --git a/common/utils/DOC/loader/arch.md b/common/utils/DOC/loader/arch.md
new file mode 100644
index 0000000000..52ffd428dd
--- /dev/null
+++ b/common/utils/DOC/loader/arch.md
@@ -0,0 +1,7 @@
+# loader source files
+
+The oai shared library loader is implemented in two source files, located in [common/utils](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils)
+1. [load_module_shlib.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/load_module_shlib.c) contains the loader implementation
+1. [load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/load_module_shlib.h) is the loader include file containing both private and public data type definitions. It also contain API prototypes.
+
+[loader home page](../loader.md)
diff --git a/common/utils/DOC/loader/devusage.md b/common/utils/DOC/loader/devusage.md
new file mode 100644
index 0000000000..bd45c88a85
--- /dev/null
+++ b/common/utils/DOC/loader/devusage.md
@@ -0,0 +1,16 @@
+The loader objectives are
+1. provides a common mechanism to prevent an executable to include code that is only used under specific configurations, without rebuilding the code
+1. Provide a common mechanism to allow to choose between different implementations of a given set of functions, without rebuilding the code
+
+As a developer you may need to look at these sections:
+
+* [loading a shared library](devusage/loading.md)
+* [loader API](devusage/api.md)
+* [loader public structures](devusage/struct.md)
+
+Loader usage examples can be found in oai sources:
+
+* device and transport initialization code: [function `load_lib` in *targets/ARCH/COMMON/__common_lib.c__* ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/targets/ARCH/COMMON/common_lib.c#L91)
+* turbo encoder and decoder initialization: [function `load_codinglib`in *openair1/PHY/CODING/__coding_load.c__*](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/CODING/coding_load.c#L113)
+
+[loader home page](../loader.md)
diff --git a/common/utils/DOC/loader/devusage/api.md b/common/utils/DOC/loader/devusage/api.md
new file mode 100644
index 0000000000..a6e59c5938
--- /dev/null
+++ b/common/utils/DOC/loader/devusage/api.md
@@ -0,0 +1,20 @@
+ Loader API is defined in the [common/utils/load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/load_module_shlib.h) include file.
+```c
+int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
+```
+* possibly initializes the loader, if it has not been already initialized
+* Formats the full shared library path, using the `modname` argument and the loader `shlibpath` and `shlibversion`configuration parameters.
+* loads the shared library, using the dlopen system call
+* looks for `< modname >_autoinit` symbol, using the `dlsym` system call and possibly call the corresponding function.
+* looks for `< modname >_checkbuildver` symbol, using the `dlsym` system call and possibly calls the corresponding function. If the return value of this call is `-1`, program execution is stopped. It is the responsibility of the shared library developer to implement or not a `< modname >_checkbuildver` function and to decide if a version mismatch is a fatal condition. The `< modname >_checkbuildver` function must match the `checkverfunc_t` function type. The first argument is the main executable version, as set in the `PACKAGE_VERSION` macro defined in the [oai CMakeLists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt#L218), around line 218. The second argument points to the shared library version which should be set by the `< modname >_checkbuildver` function.
+* If the farray pointer is null, looks for `< modname >_getfarray` symbol, calls the corresponding function when the symbol is found. `< modname >_getfarray` takes one argument, a pointer to a `loader_shlibfunc_t` array, and returns the number of items in this array, as defined by the `getfarrayfunc_t` type. The `loader_shlibfunc_t` array returned by the shared library must be fully filled (both `fname` and `fptr` fields).
+* looks for the `numf` function symbols listed in the `farray[i].fname` arguments and set the corresponding `farray[i].fptr`function pointers
+
+
+```c
+void * get_shlibmodule_fptr(char *modname, char *fname)
+```
+Returns a pointer to the symbol `fname`, defined in module `modname`, or `NULL` if the symbol is not found.
+
+[loader home page](../../loader.md)
+[loader developer home page](../devusage.md)
diff --git a/common/utils/DOC/loader/devusage/loading.md b/common/utils/DOC/loader/devusage/loading.md
new file mode 100644
index 0000000000..b34782ecd3
--- /dev/null
+++ b/common/utils/DOC/loader/devusage/loading.md
@@ -0,0 +1,56 @@
+Implementing a shared library dynamic load using the oai loader is a two steps task:
+1. define the `loader_shlibfunc_t` array, describing the list of externally available functions implemented in the library. This is the interface of the module.
+1. Call the `load_module_shlib` function, passing it the previously defined array and the number of items in this array. The first argument to `load_module_shlib` is the name identifying the module, which is also used to format the corresponding library name, as described [here](loader/rtusage#shared-library-names)
+
+After a successful `load__module_shlib` call, the function pointer of each `loader_shlibfunc_t` array item has been set and can be used to call the corresponding function.
+
+Typical loader usage looks like:
+
+```c
+/* shared library loader include file */
+#include "common/utils/load_module_shlib.h"
+.............
+/*
+ define and initialize the array, describing the list of functions
+ implemented in "mymodule"
+*/
+ loader_shlibfunc_t mymodule_fdesc[2];
+ mymodule_fdesc[0].fname="mymodule_f1";
+ mymodule_fdesc[1].fname="mymodule_f2";
+
+/*
+ load the library, it's name must be libmymod.so. Configuration can be
+ used to specify a specific path to look for libmymod.so. Configuration
+ can also specify a version, for example "V1", in this case the loader
+ will look for libmymodV1.so
+*/
+ ret=load_module_shlib("mymod",mymodule_fdesc, sizeof(mymodule_fdesc)/sizeof(loader_shlibfunc_t));
+ if (ret < 0) {
+ fprintf(stderr,"Library couldn't be loaded\n");
+ } else {
+/*
+library has been loaded, we probably want to call some functions...
+*/
+ ret=((funcf1_t)mymodule_fdesc[0].fptr)();
+
+..................
+/*
+later and/or somewhere else in the code you may want to call function "mymodule_f2"
+You can use the loader get_shlibmodule_fptr(char *modname, char *fname) function
+to retrieve the pointer to that function
+*/
+funcf2_t *f2;
+int ret;
+int intarg1;
+char *strarg;
+........................
+f2 = (funcf2_t)get_shlibmodule_fptr("mymodule", "mymodule_f2")
+if (f2 != NULL) {
+ ret = f2(intarg1,strarg);
+}
+...............
+```
+When loading a shared library the loader looks for a symbol named `< module name > _autoinit` and, if it finds it, calls it. The `autoinit` function is called without any argument and the returned value, if any, is not tested.
+
+[loader home page](../loader.md)
+[loader developer home page](../../loader/devusage.md)
diff --git a/common/utils/DOC/loader/devusage/struct.md b/common/utils/DOC/loader/devusage/struct.md
new file mode 100644
index 0000000000..08d4ce9558
--- /dev/null
+++ b/common/utils/DOC/loader/devusage/struct.md
@@ -0,0 +1,10 @@
+# `loader_shlibfunc_t`structure
+It is defined in include file [ common/util/load_module_shlib.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/load_module_shlib.h#L38). This structure is used to list the symbols that should be searched by the loader when calling the `load_module_shlib` function.
+
+| Fields | Description | I/O |
+|:-----------|:------------------------------------------------------------------|----:|
+| `fname` | symbol name, is passed to the [`dlsym`](http://man7.org/linux/man-pages/man3/dlsym.3.html) system call performed by the loader to get a pointer to the symbol | I |
+| `fptr` | pointer to the symbol name, set by the loader. `fptr` is defined as a `int (*fptr)(void)` function type | O |
+
+[loader home page](../../loader.md)
+[loader developer home page](../devusage.md)
diff --git a/common/utils/DOC/loader/rtusage.md b/common/utils/DOC/loader/rtusage.md
new file mode 100644
index 0000000000..0bcdf6429f
--- /dev/null
+++ b/common/utils/DOC/loader/rtusage.md
@@ -0,0 +1,50 @@
+## shared library names
+Shared library full names are built by the loader using the format:
+> < *path* >/lib< *module name* >< *module version* >.so
+
+1. the < *module name* > is defined at development time, it comes from the `modname` argument of the `load_module_shlib` call.
+1. the < *module version* > and < *path* > optional parameters, are defined at run-time, depending on the configuration.
+
+## loader parameters
+The loader is using the [configuration module](../../../config/DOC/config.md), and defines global and per library parameters. Global parameters must be specified under the **loader** section and library specific parameters under a **loader.<*module name*>** section. Module specific parameters override the global parameters.
+### Global loader parameters
+| name | type | default | description |
+|:---:|:---:|:---:|:----|
+| `shlibpath` | `string of char` | `""` | directory path used to look for shared libraries, may be superseded by the library specific `shlibpath`.|
+| `maxshlibs` | `integer` | 10 | Maximum number of shared libraries the loader can manage. |
+
+### library specific loader parameters
+| name | type | default | description |
+|:---:|:---:|:---:|:----|
+| `shlibpath` | `string of char` | `""` | directory path used to look for this shared library.|
+| `shlibversion` | `string of char` | `""` | version to be used to load this shared library.|
+
+### loader configuration examples
+
+The following configuration file example just reproduce the default loader parameters:
+```c
+loader :
+{
+ shlibpath = "./";
+ maxshlibs = 10;
+ liboai_device :
+ {
+ shlibpath = "./";
+ shlibversion = "";
+ }
+};
+```
+If you want to load a device called *liboai_device_USRP.so* without writting a specific configuration, you can start the softmodem using the following command:
+> ./lte-softmodem -O libconfig:/usr/local/oai/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.nbiot.band7.tm1.50PRB.usrpb210.conf:dbgl5 --loader.oai_device.shlibversion _USRP
+
+With this latest example, nn the softmodem logs, you can check that the right device library has been loaded:
+```bash
+[LIBCONFIG] loader.oai_device.shlibpath not found in /usr/local/oai/develop-nb-iot-merge/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.nbiot.band7.tm1.50PRB.usrpb210.conf
+[LIBCONFIG] loader.oai_device.shlibversion set to default value ""
+[LIBCONFIG] loader.oai_device: 1/2 parameters successfully set, (1 to default value)
+[CONFIG] shlibversion set to _USRP from command line
+[CONFIG] loader.oai_device 1 options set from command line
+
+```
+
+[loader home page](../loader.md)
diff --git a/common/utils/LOG/DOC/addconsoletrace.md b/common/utils/LOG/DOC/addconsoletrace.md
new file mode 100644
index 0000000000..9ab90cf120
--- /dev/null
+++ b/common/utils/LOG/DOC/addconsoletrace.md
@@ -0,0 +1,110 @@
+### Adding console traces in oai code
+#### console messages macros
+```C
+LOG_E(,,,...)
+LOG_W(,,,...)
+LOG_I(,,,...)
+LOG_D(,,,...)
+LOG_T(,,,...)
+)
+```
+these macros are used in place of the printf C function. The additionnal ***component*** parameter identifies the functionnal module which generates the message. At run time, the message will only be printed if the configured log level for the component is greater or equal than the macro level used in the code.
+
+| macro | level letter | level value | level name |
+|:---------|:---------------|:---------------|----------------:|
+| LOG_E | E | 0 | error |
+| LOG_W | W | 1 | warning |
+| LOG_I | I | 2 | informational |
+| LOG_D | D | 3 | debug |
+| LOG_T | T | 4 | trace |
+
+component list is defined as an `enum` in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h). A new component can be defined by adding an item in this type, it must also be defined in the T tracer [T_messages.txt ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/T/T_messages.txt).
+
+Most oai sources are including LOG macros.
+
+#### conditional code macros
+
+```C
+LOG_DEBUGFLAG()
+```
+this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md)
+```C
+if ( LOG_DEBUGFLAG() {
+/*
+ the code below is only executed if the corresponding
+ _debug option is set.
+ */
+......................
+......................
+}
+```
+[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396)
+
+#### memory dump macros
+```C
+LOG_DUMPFLAG()
+```
+this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md). It is mainly provided to surround LOG_M macros or direct calls to `log_dump`which otherwise would be unconditionals.
+```C
+if ( LOG_DUMPFLAG() {
+/*
+ the code below is only executed if the corresponding
+ _dump option is set.
+ */
+LOG_M(.............
+LOG_M(.............
+log_dump(...
+}
+
+[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
+#### matlab format dump
+```C
+LOG_M(file, vector, data, len, dec, format)
+```
+|argument| type| description |
+|:-----------|:-------|-----------------:|
+| file | char* |path to the fle which will contain the dump |
+|vector |char * |name of the dump, printed at the top of the dump file |
+|data| void *| pointer to the memory to be dumpped |
+|len | int | length of the data to be dumpped, in `dec` unit|
+| dec| int | length of each data item.Interpretation depends on format|
+|format| int | defines the type of data to be dumped|
+
+This macro can be used to dump a buffer in a format that can be used for analyze via tools like matlab or octave. **It must be surrounded by LOG_DEBUGFLAG or LOG_DUMPFLAG macros, to prevent the dump to be built unconditionally.** The LOG_M macro points to the `write_file_matlab` function implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). **This function should be revisited for more understandable implementation and ease of use (format parameter ???)**
+[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
+
+#### hexadecimal format dump
+```C
+LOG_DUMPMSG(c, f, b, s, x...)
+```
+dumps a memory region if the corresponding debug flag `f` is set as explained here [run time usage page](rtusage.md)
+
+|argument| type| description |
+|:-----------|:-------|-----------------:|
+| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments |
+|f |int |flag used to filter the dump depending on the logs configuration. flag list is defined by the LOG_MASKMAP_INIT macro in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) |
+|b| void *| pointer to the memory to be dumpped |
+|s | int | length of the data to be dumpped in char|
+| x...| printf format and arguments| text string to be printed at the top of the dump|
+
+This macro can be used to conditionaly dump a buffer, bytes by bytes, giving the integer value of each byte in hexadecimal form.
+[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/RRC/LTE/rrc_eNB.c#L1181)
+
+This macro points to the `log_dump` function, implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). This function can also dump buffers containing `double` data via the LOG_UDUMPMSG macro
+
+```C
+LOG_UDUMPMSG(c, b, s, f, x...)
+```
+|argument| type| description |
+|:-----------|:-------|-----------------:|
+| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments |
+|b| void *| pointer to the memory to be dumpped |
+|s | int | length of the data to be dumpped in char|
+|f| int | format of dumped data LOG_DUMP_CHAR or LOG_DUMP_DOUBLE|
+| x...| printf format and arguments| text string to be printed at the top of the dump|
+
+[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974)
+
+[logging facility developer main page](devusage.md)
+[logging facility main page](log.md)
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/DOC/arch.md b/common/utils/LOG/DOC/arch.md
new file mode 100644
index 0000000000..1d6aeae6aa
--- /dev/null
+++ b/common/utils/LOG/DOC/arch.md
@@ -0,0 +1,12 @@
+# logging facility source files
+
+The oai logging facility is implemented in two source files, located in [common/utils/LOG](LOG)
+1. [log.c](../log.c) contains logging implementation
+1. [log.h](../log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes.
+
+The logging facility doesn't create any thread, all api's are executed in the context of the caller. The tracing macro's `LOG_` are all using the logRecord_mt function to output the messages. To keep this function thread safe it must perform a single system call to the output stream. The buffer used to build the message must be specific to the calling thread, which is today enforced by using a variable in the logRecord_mt stack.
+
+Data used by the logging utility are defined by the `log_t` structure which is allocated at init time, when calling the `logInit` function.
+
+[logging facility main page](log.md)
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/DOC/configurelog.md b/common/utils/LOG/DOC/configurelog.md
new file mode 100644
index 0000000000..862c02162b
--- /dev/null
+++ b/common/utils/LOG/DOC/configurelog.md
@@ -0,0 +1,49 @@
+### Initializing and configuring the logging facility
+
+#### logging facility APIs
+```C
+int logInit (void);
+```
+Allocate the internal data used by the logging utility, set the configuration, using the [configuration module](../../../config/DOC/config.md)
+
+```C
+void logClean (void)
+```
+Reset console attributes (color settings) and possibly close opened log files. Logging facility is still usable after this call, the internal data are not freed.
+
+```C
+int set_log(int component, int level)
+void set_glog(int level)
+```
+Set a component or all components logiing level. Messages which level is lower than this level are not printed to the console.
+
+```C
+void set_glog_onlinelog(int enable)
+```
+Enable or disable all logging messages. Even error level messages are discarded, which is not advised. This can be usefull to temporarily workaround high rate of logging messages.
+
+```C
+void set_component_filelog(int comp)
+void close_component_filelog(int comp)
+```
+
+Redirect or reset to stdout the output stream used by the logging facility. When the output stream is redirected to a file, it is created under /tmp with a hard-coded filename including the componemt name.
+
+```C
+SET_LOG_DEBUG(flag)
+CLEAR_LOG_DEBUG(flag)
+SET_LOG_DUMP(flag)
+CLEAR_LOG_DUMP(flag)
+```
+ These macros are used to set or clear the corresponding bit flag, trigerring the activation or un-activation of conditional code or memory dumps generation.
+
+Example of using the logging utility APIs can be found, for initialization and cleanup, in [lte-softmodem.c](../../../../targets/RT/USER/lte-softmodem.c) and in the [telnet server log command implementation](../../telnetsrv/telnetsrv_proccmd.c) for a complete access to the logging facility features.
+
+#### components and debug flags definitions
+
+Adding a new component is just adding an item in the `comp_name_t` enum defined in [log.h](../log.h) . You must also declare it in the T Tracer facility [message fefinitions](../../T/T_messages.txt).
+To add a flag than can then be used for adding conditional code or memory dumps you have to add the flag definition in the `LOG_MASKMAP_INIT` macro, in [log.h](../log.h).
+
+[logging facility developer main page](devusage.md)
+[logging facility main page](log.md)
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/DOC/devusage.md b/common/utils/LOG/DOC/devusage.md
new file mode 100644
index 0000000000..61d25734e0
--- /dev/null
+++ b/common/utils/LOG/DOC/devusage.md
@@ -0,0 +1,14 @@
+### logging facility developer usage
+The logging facility objectives are
+1. provide a common console tracing mechanism
+1. Allow a flexible activation of console traces, by configuration or dynamically at any time while code is running.
+
+Most developpers will only use the log macros to add console messages to the code. The logging facility also provides an api that is used for initialization and configuration.
+
+[Adding console traces in oaicode](addconsoletrace.md)
+
+[Configuring the logging facility](configurelog.md)
+
+
+[logging facility main page](log.md)
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/DOC/log.md b/common/utils/LOG/DOC/log.md
new file mode 100644
index 0000000000..4b3e5981e1
--- /dev/null
+++ b/common/utils/LOG/DOC/log.md
@@ -0,0 +1,19 @@
+# OAI console logging facility
+
+oai includes a console logging facility that any component should use when writting informational or debugging messages to the softmodem or uesoftmodem stdout stream.
+By default, this facility is included at build-time and activated at run-time. The T Tracer and the Logging facility share common options for activation:
+
+- To disable the logging facility (and T Tracer) at build-time use the *--disable-T-Tracer* switch:
+
+```bash
+/build_oai --disable-T-Tracer
+```
+- To use the the T-Tracer instead of the console logging facility, use the command line option *T_stdout*. *T_stdout* is a boolean option, which, when set to 0 (false) disable the console logging facility. All stdout messages are then sent to the T-Tracer.
+
+## Documentation
+
+* [runtime usage](rtusage.md)
+* [developer usage](devusage.md)
+* [module architecture](arch.md)
+
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/DOC/rtusage.md b/common/utils/LOG/DOC/rtusage.md
new file mode 100644
index 0000000000..445f335725
--- /dev/null
+++ b/common/utils/LOG/DOC/rtusage.md
@@ -0,0 +1,265 @@
+## configuring the logging facility
+The logging facility is fully configurable and it uses the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify the logging facility behavior
+
+All logging facility parameters are defined in the log_config section. Some parameters are global to the logging facility, they modify the way messages are printed to stdout. Conversely, some parameters are specific to a component and only modify the behavior for messages issued by a given component. A third type of parameters can be used to activate conditional debug code or dump messages or buffers.
+
+### global parameters
+
+| name | type | default | description |
+|:---:|:---:|:---:|:----|
+| `global_log_level` | `pre-defined string of char` | `info` | Allows printing of messages up to the specified level. Available levels, from lower to higher are `error`,`warn`,`info`,`debug`,`trace` |
+| `global_log_online` | `boolean` | 1 (=true) | If false, all console messages are discarded, whatever their level |
+| `global_log_options` | `list of pre-defined string of char` | | 3 options can be specified to trigger the information added in the header of the message: `nocolor`, disable color usage in log messages, usefull when redirecting logs to a file, where escape sequences used for color selection can be annoying, `level`, add a one letter level id in the message header (T,D,I,W,E for trace, debug, info, warning, error),`thread`, add the thread name in the message header|
+
+### Component specific parameters
+| name | type | default | description |
+|:---:|:---:|:---:|:----|
+| `_log_level` | `boolean` | global log level, as defined by the `global_log_level ` parameter) |
+| `_log_infile` | `boolean` | 0 = false| Triggers the redirection of log messages printed by the specified component in a file. The file path and name is /tmp/.[extension] the extension is optional and component dependant, it can be `log `, `dat `, `txt `|
+
+The list of components defined within oai can be retrieved from the [config module](../../../config/config.md) traces, when asking for config module debugging info on the command line:
+
+```bash
+./lte-softmodem -O libconfig::dbgl5
+
+[LIBCONFIG] log_config.global_log_level: "info"
+[CONFIG] global_log_online: 1
+[CONFIG] log_config.global_log_online set to default value
+[LIBCONFIG] log_config: 3/3 parameters successfully set, (1 to default value)
+[LIBCONFIG] global_log_options[0]: nocolor
+[LIBCONFIG] global_log_options[1]: level
+[LIBCONFIG] global_log_options[2]: thread
+[CONFIG] log_config 1 options set from command line
+[LIBCONFIG] log_config.phy_log_level: "info"
+[LIBCONFIG] log_config.mac_log_level: "info"
+[CONFIG] log_config.sim_log_level set to default value "info"
+[CONFIG] log_config.ocg_log_level set to default value "info"
+[CONFIG] log_config.omg_log_level set to default value "info"
+[CONFIG] log_config.opt_log_level set to default value "info"
+[CONFIG] log_config.otg_log_level set to default value "info"
+[CONFIG] log_config.otg_latency_log_level set to default value "info"
+[CONFIG] log_config.otg_latency_bg_log_level set to default value "info"
+[CONFIG] log_config.otg_gp_log_level set to default value "info"
+[CONFIG] log_config.otg_gp_bg_log_level set to default value "info"
+[CONFIG] log_config.otg_jitter_log_level set to default value "info"
+[LIBCONFIG] log_config.rlc_log_level: "info"
+[LIBCONFIG] log_config.pdcp_log_level: "info"
+[LIBCONFIG] log_config.rrc_log_level: "info"
+[CONFIG] log_config.nas_log_level set to default value "info"
+[CONFIG] log_config.perf_log_level set to default value "info"
+[CONFIG] log_config.oip_log_level set to default value "info"
+[CONFIG] log_config.cli_log_level set to default value "info"
+[CONFIG] log_config.msc_log_level set to default value "info"
+[CONFIG] log_config.ocm_log_level set to default value "info"
+[CONFIG] log_config.udp_log_level set to default value "info"
+[CONFIG] log_config.gtpv1u_log_level set to default value "info"
+[CONFIG] log_config.comp23?_log_level set to default value "info"
+[CONFIG] log_config.s1ap_log_level set to default value "info"
+[CONFIG] log_config.sctp_log_level set to default value "info"
+[LIBCONFIG] log_config.hw_log_level: "info"
+[CONFIG] log_config.osa_log_level set to default value "info"
+[CONFIG] log_config.eral_log_level set to default value "info"
+[CONFIG] log_config.mral_log_level set to default value "info"
+[CONFIG] log_config.enb_app_log_level set to default value "info"
+[CONFIG] log_config.flexran_agent_log_level set to default value "info"
+[CONFIG] log_config.tmr_log_level set to default value "info"
+[CONFIG] log_config.usim_log_level set to default value "info"
+[CONFIG] log_config.localize_log_level set to default value "info"
+[CONFIG] log_config.x2ap_log_level set to default value "info"
+[CONFIG] log_config.loader_log_level set to default value "info"
+[CONFIG] log_config.asn_log_level set to default value "info"
+[LIBCONFIG] log_config: 38/38 parameters successfully set, (32 to default value)
+[CONFIG] log_config 0 options set from command line
+[CONFIG] phy_log_infile: 0
+[CONFIG] log_config.phy_log_infile set to default value
+[CONFIG] mac_log_infile: 0
+[CONFIG] log_config.mac_log_infile set to default value
+[CONFIG] sim_log_infile: 0
+[CONFIG] log_config.sim_log_infile set to default value
+[CONFIG] ocg_log_infile: 0
+[CONFIG] log_config.ocg_log_infile set to default value
+[CONFIG] omg_log_infile: 0
+[CONFIG] log_config.omg_log_infile set to default value
+[CONFIG] opt_log_infile: 0
+[CONFIG] log_config.opt_log_infile set to default value
+[CONFIG] otg_log_infile: 0
+[CONFIG] log_config.otg_log_infile set to default value
+[CONFIG] otg_latency_log_infile: 0
+[CONFIG] log_config.otg_latency_log_infile set to default value
+[CONFIG] otg_latency_bg_log_infile: 0
+[CONFIG] log_config.otg_latency_bg_log_infile set to default value
+[CONFIG] otg_gp_log_infile: 0
+[CONFIG] log_config.otg_gp_log_infile set to default value
+[CONFIG] otg_gp_bg_log_infile: 0
+[CONFIG] log_config.otg_gp_bg_log_infile set to default value
+[CONFIG] otg_jitter_log_infile: 0
+[CONFIG] log_config.otg_jitter_log_infile set to default value
+[CONFIG] rlc_log_infile: 0
+[CONFIG] log_config.rlc_log_infile set to default value
+[CONFIG] pdcp_log_infile: 0
+[CONFIG] log_config.pdcp_log_infile set to default value
+[CONFIG] rrc_log_infile: 0
+[CONFIG] log_config.rrc_log_infile set to default value
+[CONFIG] nas_log_infile: 0
+[CONFIG] log_config.nas_log_infile set to default value
+[CONFIG] perf_log_infile: 0
+[CONFIG] log_config.perf_log_infile set to default value
+[CONFIG] oip_log_infile: 0
+[CONFIG] log_config.oip_log_infile set to default value
+[CONFIG] cli_log_infile: 0
+[CONFIG] log_config.cli_log_infile set to default value
+[CONFIG] msc_log_infile: 0
+[CONFIG] log_config.msc_log_infile set to default value
+[CONFIG] ocm_log_infile: 0
+[CONFIG] log_config.ocm_log_infile set to default value
+[CONFIG] udp_log_infile: 0
+[CONFIG] log_config.udp_log_infile set to default value
+[CONFIG] gtpv1u_log_infile: 0
+[CONFIG] log_config.gtpv1u_log_infile set to default value
+[CONFIG] comp23?_log_infile: 0
+[CONFIG] log_config.comp23?_log_infile set to default value
+[CONFIG] s1ap_log_infile: 0
+[CONFIG] log_config.s1ap_log_infile set to default value
+[CONFIG] sctp_log_infile: 0
+[CONFIG] log_config.sctp_log_infile set to default value
+[CONFIG] hw_log_infile: 0
+[CONFIG] log_config.hw_log_infile set to default value
+[CONFIG] osa_log_infile: 0
+[CONFIG] log_config.osa_log_infile set to default value
+[CONFIG] eral_log_infile: 0
+[CONFIG] log_config.eral_log_infile set to default value
+[CONFIG] mral_log_infile: 0
+[CONFIG] log_config.mral_log_infile set to default value
+[CONFIG] enb_app_log_infile: 0
+[CONFIG] log_config.enb_app_log_infile set to default value
+[CONFIG] flexran_agent_log_infile: 0
+[CONFIG] log_config.flexran_agent_log_infile set to default value
+[CONFIG] tmr_log_infile: 0
+[CONFIG] log_config.tmr_log_infile set to default value
+[CONFIG] usim_log_infile: 0
+[CONFIG] log_config.usim_log_infile set to default value
+[CONFIG] localize_log_infile: 0
+[CONFIG] log_config.localize_log_infile set to default value
+[CONFIG] x2ap_log_infile: 0
+[CONFIG] log_config.x2ap_log_infile set to default value
+[CONFIG] loader_log_infile: 0
+[CONFIG] log_config.loader_log_infile set to default value
+[CONFIG] asn_log_infile: 0
+[CONFIG] log_config.asn_log_infile set to default value
+[LIBCONFIG] log_config: 38/38 parameters successfully set, (38 to default value)
+[CONFIG] log_config 0 options set from command line
+[CONFIG] PRACH_debug: 0
+[CONFIG] log_config.PRACH_debug set to default value
+[CONFIG] RU_debug: 0
+[CONFIG] log_config.RU_debug set to default value
+[CONFIG] UE_PHYPROC_debug: 0
+[CONFIG] log_config.UE_PHYPROC_debug set to default value
+[CONFIG] LTEESTIM_debug: 0
+[CONFIG] log_config.LTEESTIM_debug set to default value
+[CONFIG] DLCELLSPEC_debug: 0
+[CONFIG] log_config.DLCELLSPEC_debug set to default value
+[CONFIG] ULSCH_debug: 0
+[CONFIG] log_config.ULSCH_debug set to default value
+[CONFIG] RRC_debug: 0
+[CONFIG] log_config.RRC_debug set to default value
+[CONFIG] PDCP_debug: 0
+[CONFIG] log_config.PDCP_debug set to default value
+[CONFIG] DFT_debug: 0
+[CONFIG] log_config.DFT_debug set to default value
+[CONFIG] ASN1_debug: 0
+[CONFIG] log_config.ASN1_debug set to default value
+[CONFIG] CTRLSOCKET_debug: 0
+[CONFIG] log_config.CTRLSOCKET_debug set to default value
+[CONFIG] SECURITY_debug: 0
+[CONFIG] log_config.SECURITY_debug set to default value
+[CONFIG] NAS_debug: 0
+[CONFIG] log_config.NAS_debug set to default value
+[CONFIG] RLC_debug: 0
+[CONFIG] log_config.RLC_debug set to default value
+[CONFIG] UE_TIMING_debug: 0
+[CONFIG] log_config.UE_TIMING_debug set to default value
+[LIBCONFIG] log_config: 15/15 parameters successfully set, (15 to default value)
+[CONFIG] log_config 0 options set from command line
+[CONFIG] PRACH_dump: 0
+[CONFIG] log_config.PRACH_dump set to default value
+[CONFIG] RU_dump: 0
+[CONFIG] log_config.RU_dump set to default value
+[CONFIG] UE_PHYPROC_dump: 0
+[CONFIG] log_config.UE_PHYPROC_dump set to default value
+[CONFIG] LTEESTIM_dump: 0
+[CONFIG] log_config.LTEESTIM_dump set to default value
+[CONFIG] DLCELLSPEC_dump: 0
+[CONFIG] log_config.DLCELLSPEC_dump set to default value
+[CONFIG] ULSCH_dump: 0
+[CONFIG] log_config.ULSCH_dump set to default value
+[CONFIG] RRC_dump: 0
+[CONFIG] log_config.RRC_dump set to default value
+[CONFIG] PDCP_dump: 0
+[CONFIG] log_config.PDCP_dump set to default value
+[CONFIG] DFT_dump: 0
+[CONFIG] log_config.DFT_dump set to default value
+[CONFIG] ASN1_dump: 0
+[CONFIG] log_config.ASN1_dump set to default value
+[CONFIG] CTRLSOCKET_dump: 0
+[CONFIG] log_config.CTRLSOCKET_dump set to default value
+[CONFIG] SECURITY_dump: 0
+[CONFIG] log_config.SECURITY_dump set to default value
+[CONFIG] NAS_dump: 0
+[CONFIG] log_config.NAS_dump set to default value
+[CONFIG] RLC_dump: 0
+[CONFIG] log_config.RLC_dump set to default value
+[CONFIG] UE_TIMING_dump: 0
+[CONFIG] log_config.UE_TIMING_dump set to default value
+[LIBCONFIG] log_config: 15/15 parameters successfully set, (15 to default value)
+[CONFIG] log_config 0 options set from command line
+log init done
+
+```
+It can also be retrieved when using the telnet server, as explained [below](### Using the telnet server to configure the logging facility)
+
+### parameters to activate conditional code
+| name | type | default | description |
+|:---:|:---:|:---:|:----|
+| `_debug` | `boolean` | 0 = false | Triggers the activation of conditional code identified by the specified flag.
+| `_dump` | `boolean` | 0 = false| Triggers buffer dump, on the console in text form or in a file in matlab format, depending on the developper choice and forcasted usage|
+
+### Using the configuration file to configure the logging facility
+The following example sets all components log level to info, exept for hw,phy,mac,rlc,pdcp,rrc which log levels are set to error or warning.
+```bash
+ log_config :
+ {
+ global_log_level ="info";
+ hw_log_level ="error";
+ phy_log_level ="error";
+ mac_log_level ="warn";
+ rlc_log_level ="error"
+ pdcp_log_level ="error";
+ rrc_log_level ="error";
+ };
+```
+### Using the command line to configure the logging facility
+Command line parameter values supersedes values specified in the configuration file.
+```bash
+./lte-softmodem -O --log_config.global_log_options nocolor,level,thread --log_config.prach_log_level debug --log_config.PRACH_debug
+```
+In this example to get all the debug PRACH messages it is necessary to also set the PRACH_debug flag. This is a choice from the developper.
+The log messages will be printed whithout color and the header will include the lmessage evel and the thread name:
+```bash
+[PHY]I ru thread Time in secs now: 104652566
+[PHY]I ru thread Time in secs last pps: 91827117
+[PHY]I ru thread RU 0 rf device ready
+[PHY]I ru thread RU 0 no asynch_south interface
+[MAC]E rxtx processing SCHED_MODE=0
+[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0
+[PHY]I lte-softmodem prach_I0 = 0.0 dB
+[PHY]I rxtx processing max_I0 21, min_I0 0
+[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0
+[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0
+```
+
+### Using the telnet server to configure the logging facility
+The telnet server includes a `log` command which can be used to dymically modify the logging facility configuration parameters.
+[telnet server ***softmodem log*** commands](../../telnetsrv/DOC/telnetlog.md)
+
+[logging facility main page](log.md)
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c
index 1124a26b72..b4b9722ca4 100644
--- a/common/utils/LOG/log.c
+++ b/common/utils/LOG/log.c
@@ -39,19 +39,13 @@
#include "vcd_signal_dumper.h"
#include "assertions.h"
-#if defined(ENABLE_ITTI)
- #include "intertask_interface.h"
-#endif
-
-# include
-# include
-#include
+#include
+#include
+#include
#include "common/config/config_userapi.h"
// main log variables
-
-
mapping log_level_names[] = {
{"error", OAILOG_ERR},
{"warn", OAILOG_WARNING},
@@ -75,7 +69,13 @@ char *log_level_highlight_start[] = {LOG_RED, LOG_ORANGE, "", LOG_BLUE, LOG_CYBL
char *log_level_highlight_end[] = {LOG_RESET,LOG_RESET,LOG_RESET, LOG_RESET,LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */
-int write_file_matlab(const char *fname,const char *vname,void *data,int length,int dec,char format) {
+int write_file_matlab(const char *fname,
+ const char *vname,
+ void *data,
+ int length,
+ int dec,
+ char format)
+{
FILE *fp=NULL;
int i;
@@ -215,7 +215,8 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length,
}
/* get log parameters from configuration file */
-void log_getconfig(log_t *g_log) {
+void log_getconfig(log_t *g_log)
+{
char *gloglevel = NULL;
int consolelog ;
paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC;
@@ -309,6 +310,7 @@ void log_getconfig(log_t *g_log) {
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
+ config_check_unknown_cmdlineopt(CONFIG_STRING_LOG_PREFIX);
/* set the debug mask according to the debug parameters values */
for (int i=0; log_maskmap[i].name != NULL ; i++) {
@@ -323,7 +325,10 @@ void log_getconfig(log_t *g_log) {
set_glog_onlinelog(consolelog);
}
-int register_log_component(char *name, char *fext, int compidx) {
+int register_log_component(char *name,
+ char *fext,
+ int compidx)
+{
int computed_compidx=compidx;
if (strlen(fext) > 3) {
@@ -346,13 +351,25 @@ int register_log_component(char *name, char *fext, int compidx) {
g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/.%s */
sprintf(g_log->log_component[computed_compidx].filelog_name,"/tmp/%s.%s",name,fext);
} else {
- fprintf(stderr,"{LOG} %s %d Couldn't register componemt %s\n",__FILE__,__LINE__,name);
+ fprintf(stderr,"{LOG} %s %d Couldn't register component %s\n",__FILE__,__LINE__,name);
}
return computed_compidx;
}
-int logInit (void) {
+int isLogInitDone (void)
+{
+ if (g_log == NULL)
+ return 0;
+
+ if (!(g_log->flag & FLAG_INITIALIZED))
+ return 0;
+
+ return 1;
+}
+
+int logInit (void)
+{
int i;
g_log = calloc(1, sizeof(log_t));
@@ -378,7 +395,6 @@ int logInit (void) {
register_log_component("OCG","",OCG);
register_log_component("PERF","",PERF);
register_log_component("OIP","",OIP);
- register_log_component("CLI","",CLI);
register_log_component("MSC","log",MSC);
register_log_component("OCM","log",OCM);
register_log_component("HW","",HW);
@@ -387,6 +403,7 @@ int logInit (void) {
register_log_component("mRAL","",RAL_UE);
register_log_component("ENB_APP","log",ENB_APP);
register_log_component("FLEXRAN_AGENT","log",FLEXRAN_AGENT);
+ register_log_component("PROTO_AGENT","log",PROTO_AGENT);
register_log_component("TMR","",TMR);
register_log_component("USIM","txt",USIM);
register_log_component("SIM","txt",SIM);
@@ -396,11 +413,13 @@ int logInit (void) {
register_log_component("UDP","",UDP_);
register_log_component("GTPV1U","",GTPU);
register_log_component("S1AP","",S1AP);
- register_log_component("X2AP","",X2AP);
+ register_log_component("F1AP","",F1AP);
register_log_component("SCTP","",SCTP);
register_log_component("X2AP","",X2AP);
register_log_component("LOADER","log",LOADER);
register_log_component("ASN","log",ASN);
+ register_log_component("NFAPI_VNF","log",NFAPI_VNF);
+ register_log_component("NFAPI_PNF","log",NFAPI_PNF);
for (int i=0 ; log_level_names[i].name != NULL ; i++)
g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name
@@ -413,12 +432,15 @@ int logInit (void) {
memset(&(g_log->log_component[i]),0,sizeof(log_component_t));
}
+ g_log->flag = g_log->flag | FLAG_INITIALIZED;
printf("log init done\n");
return 0;
}
-char *log_getthreadname(char *threadname, int bufsize) {
+char *log_getthreadname(char *threadname,
+ int bufsize)
+{
int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ;
if (rt == 0) {
@@ -428,7 +450,12 @@ char *log_getthreadname(char *threadname, int bufsize) {
}
}
-static int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) {
+static int log_header(char *log_buffer,
+ int buffsize,
+ int comp,
+ int level,
+ const char *format)
+{
char threadname[PR_SET_NAME];
return snprintf(log_buffer, buffsize, "%s%s[%s]%c %s %s%s",
log_level_highlight_end[level],
@@ -440,7 +467,14 @@ static int log_header(char *log_buffer, int buffsize, int comp, int level,const
log_level_highlight_end[level]);
}
-void logRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, ... ) {
+void logRecord_mt(const char *file,
+ const char *func,
+ int line,
+ int comp,
+ int level,
+ const char *format,
+ ... )
+{
char log_buffer[MAX_LOG_TOTAL]= {0};
va_list args;
va_start(args, format);
@@ -450,7 +484,26 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
va_end(args);
}
-void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ) {
+void vlogRecord_mt(const char *file,
+ const char *func,
+ int line,
+ int comp,
+ int level,
+ const char *format,
+ va_list args )
+{
+ char log_buffer[MAX_LOG_TOTAL];
+ log_header(log_buffer,MAX_LOG_TOTAL,comp, level,format);
+ g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args);
+}
+
+void log_dump(int component,
+ void *buffer,
+ int buffsize,
+ int datatype,
+ const char *format,
+ ... )
+{
va_list args;
char *wbuf;
@@ -491,7 +544,9 @@ void log_dump(int component, void *buffer, int buffsize,int datatype, const char
}
}
-int set_log(int component, int level) {
+int set_log(int component,
+ int level)
+{
/* Checking parameters */
DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS),
component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
@@ -507,13 +562,15 @@ int set_log(int component, int level) {
-void set_glog(int level) {
+void set_glog(int level)
+{
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
set_log(c, level);
}
}
-void set_glog_onlinelog(int enable) {
+void set_glog_onlinelog(int enable)
+{
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
if ( enable ) {
g_log->log_component[c].level = g_log->log_component[c].savedlevel;
@@ -525,7 +582,8 @@ void set_glog_onlinelog(int enable) {
}
}
}
-void set_glog_filelog(int enable) {
+void set_glog_filelog(int enable)
+{
static FILE *fptr;
if ( enable ) {
@@ -549,7 +607,8 @@ void set_glog_filelog(int enable) {
}
}
-void set_component_filelog(int comp) {
+void set_component_filelog(int comp)
+{
if (g_log->log_component[comp].stream == NULL || g_log->log_component[comp].stream == stdout) {
g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w");
}
@@ -558,7 +617,8 @@ void set_component_filelog(int comp) {
g_log->log_component[comp].print = fprintf;
g_log->log_component[comp].filelog = 1;
}
-void close_component_filelog(int comp) {
+void close_component_filelog(int comp)
+{
g_log->log_component[comp].filelog = 0;
if (g_log->log_component[comp].stream != NULL && g_log->log_component[comp].stream != stdout ) {
@@ -575,7 +635,9 @@ void close_component_filelog(int comp) {
* with string value NULL
*/
/* map a string to an int. Takes a mapping array and a string as arg */
-int map_str_to_int(mapping *map, const char *str) {
+int map_str_to_int(mapping *map,
+ const char *str)
+{
while (1) {
if (map->name == NULL) {
return(-1);
@@ -590,7 +652,9 @@ int map_str_to_int(mapping *map, const char *str) {
}
/* map an int to a string. Takes a mapping array and a value */
-char *map_int_to_str(mapping *map, int val) {
+char *map_int_to_str(mapping *map,
+ int val)
+{
while (1) {
if (map->name == NULL) {
return NULL;
@@ -604,7 +668,9 @@ char *map_int_to_str(mapping *map, int val) {
}
}
-int is_newline( char *str, int size) {
+int is_newline(char *str,
+ int size)
+{
int i;
for ( i = 0; i < size; i++ ) {
@@ -617,12 +683,16 @@ int is_newline( char *str, int size) {
return 0;
}
-void logClean (void) {
+void logClean (void)
+{
int i;
- LOG_UI(PHY,"\n");
- for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
- close_component_filelog(i);
+ if(isLogInitDone()) {
+ LOG_UI(PHY,"\n");
+
+ for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
+ close_component_filelog(i);
+ }
}
}
diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h
index b8a72ece7b..4d87d40320 100644
--- a/common/utils/LOG/log.h
+++ b/common/utils/LOG/log.h
@@ -116,12 +116,11 @@ extern "C" {
* @{*/
-#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */
-#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */
-#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */
-#define FLAG_FUNCT 0x0020
-#define FLAG_FILE_LINE 0x0040
-#define FLAG_TIME 0x0100
+#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */
+#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */
+#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */
+#define FLAG_TIME 0x0100
+#define FLAG_INITIALIZED 0x8000
#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O)
#define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O))
@@ -147,6 +146,7 @@ extern "C" {
#define DEBUG_CTRLSOCKET (1<<10)
#define DEBUG_SECURITY (1<<11)
#define DEBUG_NAS (1<<12)
+#define DEBUG_RLC (1<<13)
#define UE_TIMING (1<<20)
@@ -164,6 +164,7 @@ extern "C" {
{"CTRLSOCKET", DEBUG_CTRLSOCKET},\
{"SECURITY", DEBUG_SECURITY},\
{"NAS", DEBUG_NAS},\
+ {"RLC", DEBUG_RLC},\
{"UE_TIMING", UE_TIMING},\
{NULL,-1}\
}
@@ -182,7 +183,6 @@ typedef enum {
MIN_LOG_COMPONENTS = 0,
PHY = MIN_LOG_COMPONENTS,
MAC,
- EMU,
SIM,
OCG,
OMG,
@@ -199,13 +199,13 @@ typedef enum {
NAS,
PERF,
OIP,
- CLI,
MSC,
OCM,
UDP_,
GTPU,
SPGW,
S1AP,
+ F1AP,
SCTP,
HW,
OSA,
@@ -216,13 +216,13 @@ typedef enum {
TMR,
USIM,
LOCALIZE,
+ PROTO_AGENT,
+ F1U,
X2AP,
- GNB_APP,
- NR_RRC,
- NR_MAC,
- NR_PHY,
LOADER,
ASN,
+ NFAPI_VNF,
+ NFAPI_PNF,
MAX_LOG_PREDEF_COMPONENTS,
}
comp_name_t;
@@ -289,7 +289,9 @@ extern "C" {
# include "log_if.h"
/*----------------------------------------------------------------------------*/
int logInit (void);
+int isLogInitDone (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
+void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args );
void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... );
int set_log(int component, int level);
void set_glog(int level);
@@ -351,6 +353,8 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
}
#define LOG_OPTIONS_IDX 2
+
+
/*----------------------------------------------------------------------------------*/
/** @defgroup _debugging debugging macros
* @ingroup _macro
@@ -367,9 +371,9 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
+# define VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
-# define nfapi_log(FILE, FNC, LN, COMP, LVL, F...) do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F) ;}} while (0) /* */
/* bitmask dependant macros, to isolate debugging code */
# define LOG_DEBUGFLAG(D) (g_log->debug_mask & D)
@@ -426,9 +430,12 @@ static __inline__ uint64_t rdtsc(void) {
extern double cpuf;
-static inline uint64_t checkTCPU(int timeout, char *file, int line) {
- static __thread uint64_t lastCPUTime=0;
- static __thread uint64_t last=0;
+static inline uint64_t checkTCPU(int timeout,
+ char *file,
+ int line)
+{
+ static uint64_t __thread lastCPUTime=0;
+ static uint64_t __thread last=0;
uint64_t cur=rdtsc();
struct timespec CPUt;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &CPUt);
@@ -448,8 +455,11 @@ static inline uint64_t checkTCPU(int timeout, char *file, int line) {
return cur;
}
-static inline unsigned long long checkT(int timeout, char *file, int line) {
- static __thread unsigned long long last=0;
+static inline unsigned long long checkT(int timeout,
+ char *file,
+ int line)
+{
+ static unsigned long long __thread last=0;
unsigned long long cur=rdtsc();
int microCycles=(int)(cpuf*1000);
int duration=(int)((cur-last)/microCycles);
@@ -468,7 +478,10 @@ typedef struct m {
uint64_t maxArray[11];
} Meas;
-static inline void printMeas(char *txt, Meas *M, int period) {
+static inline void printMeas(char *txt,
+ Meas *M,
+ int period)
+{
if (M->iterations%period == 0 ) {
char txt2[512];
sprintf(txt2,"%s avg=%" PRIu64 " iterations=%" PRIu64 " max=%"
@@ -486,13 +499,19 @@ static inline void printMeas(char *txt, Meas *M, int period) {
}
}
-static inline int cmpint(const void *a, const void *b) {
+static inline int cmpint(const void *a,
+ const void *b)
+{
uint64_t *aa=(uint64_t *)a;
uint64_t *bb=(uint64_t *)b;
return (int)(*aa-*bb);
}
-static inline void updateTimes(uint64_t start, Meas *M, int period, char *txt) {
+static inline void updateTimes(uint64_t start,
+ Meas *M,
+ int period,
+ char *txt)
+{
if (start!=0) {
uint64_t end=rdtsc();
long long diff=(end-start)/(cpuf*1000);
@@ -529,5 +548,3 @@ static inline void updateTimes(uint64_t start, Meas *M, int period, char *txt) {
#endif
#endif
-
-
diff --git a/common/utils/LOG/vcd_signal_dumper.c b/common/utils/LOG/vcd_signal_dumper.c
index 12971c3761..1fc1a16f53 100644
--- a/common/utils/LOG/vcd_signal_dumper.c
+++ b/common/utils/LOG/vcd_signal_dumper.c
@@ -190,7 +190,14 @@ const char* eurecomVariablesNames[] = {
"enb_thread_rxtx_CPUID",
"ru_thread_CPUID",
"ru_thread_tx_CPUID",
-
+ "ue0_on_duration_timer",
+ "ue0_drx_inactivity",
+ "ue0_drx_short_cycle",
+ "ue0_short_drx_cycle_number",
+ "ue0_drx_long_cycle",
+ "ue0_drx_retransmission_harq0",
+ "ue0_drx_active_time",
+ "ue0_drx_active_time_condition",
/*signal for NR*/
"frame_number_TX0_gNB",
"frame_number_TX1_gNB",
@@ -200,6 +207,7 @@ const char* eurecomVariablesNames[] = {
"slot_number_TX1_gNB",
"slot_number_RX0_gNB",
"slot_number_RX1_gNB"
+
};
const char* eurecomFunctionsNames[] = {
diff --git a/common/utils/LOG/vcd_signal_dumper.h b/common/utils/LOG/vcd_signal_dumper.h
index 7b439d4dd5..9e34bea25c 100644
--- a/common/utils/LOG/vcd_signal_dumper.h
+++ b/common/utils/LOG/vcd_signal_dumper.h
@@ -167,7 +167,14 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD,
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,
-
+ VCD_SIGNAL_DUMPER_VARIABLES_ON_DURATION_TIMER,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_INACTIVITY,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_SHORT_CYCLE,
+ VCD_SIGNAL_DUMPER_VARIABLES_SHORT_DRX_CYCLE_NUMBER,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_LONG_CYCLE,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_RETRANSMISSION_HARQ0,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_ACTIVE_TIME,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_ACTIVE_TIME_CONDITION,
/*signal for NR*/
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_GNB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_GNB,
@@ -178,6 +185,7 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX0_GNB,
VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX1_GNB,
+
VCD_SIGNAL_DUMPER_VARIABLES_END
} vcd_signal_dump_variables;
diff --git a/common/utils/T/Makefile b/common/utils/T/Makefile
index 87a6e34c5d..0588c88a45 100644
--- a/common/utils/T/Makefile
+++ b/common/utils/T/Makefile
@@ -19,7 +19,7 @@ T_IDs.h: $(GENIDS) T_messages.txt
./$(GENIDS) T_messages.txt T_IDs.h
check_vcd:
- gcc -Wall -I. -I.. -I../itti -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread
+ gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread
./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false)
rm -f ./_check_vcd
diff --git a/common/utils/T/T.c b/common/utils/T/T.c
index fbd3f75a0c..8ee359b77f 100644
--- a/common/utils/T/T.c
+++ b/common/utils/T/T.c
@@ -12,14 +12,16 @@
#include "common/config/config_userapi.h"
#define QUIT(x) do { \
- printf("T tracer: QUIT: %s\n", x); \
- exit(1); \
-} while (0)
+ printf("T tracer: QUIT: %s\n", x); \
+ exit(1); \
+ } while (0)
/* array used to activate/disactivate a log */
static int T_IDs[T_NUMBER_OF_IDS];
int *T_active = T_IDs;
-int T_stdout;
+
+int T_stdout = 1;
+
static int T_socket;
@@ -32,125 +34,159 @@ volatile int *T_freelist_head = &_T_freelist_head;
T_cache_t *T_cache;
#if BASIC_SIMULATOR
-/* global variables used by T_GET_SLOT, see in T.h */
-volatile uint64_t T_next_id;
-volatile uint64_t T_active_id;
+ /* global variables used by T_GET_SLOT, see in T.h */
+ volatile uint64_t T_next_id;
+ volatile uint64_t T_active_id;
#endif
-static void get_message(int s)
-{
+static void get_message(int s) {
char t;
int l;
int id;
int is_on;
if (read(s, &t, 1) != 1) QUIT("get_message fails");
-printf("T tracer: got mess %d\n", t);
+
+ printf("T tracer: got mess %d\n", t);
+
switch (t) {
- case 0:
- /* toggle all those IDs */
- /* optimze? (too much syscalls) */
- if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
- while (l) {
- if (read(s, &id, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
- T_IDs[id] = 1 - T_IDs[id];
- l--;
- }
- break;
- case 1:
- /* set IDs as given */
- /* optimize? */
- if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
- id = 0;
- while (l) {
- if (read(s, &is_on, sizeof(int)) != sizeof(int))
- QUIT("get_message fails");
- T_IDs[id] = is_on;
- id++;
- l--;
- }
- break;
- case 2: break; /* do nothing, this message is to wait for local tracer */
+ case 0:
+
+ /* toggle all those IDs */
+ /* optimze? (too much syscalls) */
+ if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
+
+ while (l) {
+ if (read(s, &id, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
+
+ T_IDs[id] = 1 - T_IDs[id];
+ l--;
+ }
+
+ break;
+
+ case 1:
+
+ /* set IDs as given */
+ /* optimize? */
+ if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
+
+ id = 0;
+
+ while (l) {
+ if (read(s, &is_on, sizeof(int)) != sizeof(int))
+ QUIT("get_message fails");
+
+ T_IDs[id] = is_on;
+ id++;
+ l--;
+ }
+
+ break;
+
+ case 2:
+ break; /* do nothing, this message is to wait for local tracer */
}
}
-static void *T_receive_thread(void *_)
-{
+static void *T_receive_thread(void *_) {
while (1) get_message(T_socket);
+
return NULL;
}
-static void new_thread(void *(*f)(void *), void *data)
-{
+static void new_thread(void *(*f)(void *), void *data) {
pthread_t t;
pthread_attr_t att;
- if (pthread_attr_init(&att))
- { fprintf(stderr, "pthread_attr_init err\n"); exit(1); }
- if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED))
- { fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); }
- if (pthread_create(&t, &att, f, data))
- { fprintf(stderr, "pthread_create err\n"); exit(1); }
- if (pthread_attr_destroy(&att))
- { fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); }
+ if (pthread_attr_init(&att)) {
+ fprintf(stderr, "pthread_attr_init err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
+ fprintf(stderr, "pthread_attr_setdetachstate err\n");
+ exit(1);
+ }
+
+ if (pthread_create(&t, &att, f, data)) {
+ fprintf(stderr, "pthread_create err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_destroy(&att)) {
+ fprintf(stderr, "pthread_attr_destroy err\n");
+ exit(1);
+ }
}
/* defined in local_tracer.c */
void T_local_tracer_main(int remote_port, int wait_for_tracer,
- int local_socket, void *shm_array);
+ int local_socket, void *shm_array);
/* We monitor the tracee and the local tracer processes.
* When one dies we forcefully kill the other.
*/
#include
#include
-static void monitor_and_kill(int child1, int child2)
-{
+static void monitor_and_kill(int child1, int child2) {
int child;
int status;
-
child = wait(&status);
+
if (child == -1) perror("wait");
+
kill(child1, SIGKILL);
kill(child2, SIGKILL);
exit(0);
}
-void T_init(int remote_port, int wait_for_tracer, int dont_fork)
-{
+void T_init(int remote_port, int wait_for_tracer, int dont_fork) {
int socket_pair[2];
int s;
int child1, child2;
int i;
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair))
- { perror("socketpair"); abort(); }
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair)) {
+ perror("socketpair");
+ abort();
+ }
/* setup shared memory */
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
- if (T_cache == MAP_FAILED)
- { perror("mmap"); abort(); }
+
+ if (T_cache == MAP_FAILED) {
+ perror("mmap");
+ abort();
+ }
/* let's garbage the memory to catch some potential problems
* (think multiprocessor sync issues, barriers, etc.)
*/
memset(T_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t));
+
for (i = 0; i < T_CACHE_SIZE; i++) T_cache[i].busy = 0;
/* child1 runs the local tracer and child2 (or main) runs the tracee */
+ child1 = fork();
+
+ if (child1 == -1) abort();
- child1 = fork(); if (child1 == -1) abort();
if (child1 == 0) {
close(socket_pair[1]);
T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0],
T_cache);
exit(0);
}
+
close(socket_pair[0]);
if (dont_fork == 0) {
- child2 = fork(); if (child2 == -1) abort();
+ child2 = fork();
+
+ if (child2 == -1) abort();
+
if (child2 != 0) {
close(socket_pair[1]);
munmap(T_cache, T_CACHE_SIZE * sizeof(T_cache_t));
@@ -161,27 +197,21 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
s = socket_pair[1];
/* wait for first message - initial list of active T events */
get_message(s);
-
T_socket = s;
-
new_thread(T_receive_thread, NULL);
}
-void T_Config_Init(void)
-{
- int T_port; /* by default we wait for the tracer */
- int T_nowait; /* default port to listen to to wait for the tracer */
- int T_dont_fork; /* default is to fork, see 'T_init' to understand */
-
+void T_Config_Init(void) {
+ int T_port=TTRACER_DEFAULT_PORTNUM; /* by default we wait for the tracer */
+ int T_nowait=0; /* default port to listen to to wait for the tracer */
+ int T_dont_fork=0; /* default is to fork, see 'T_init' to understand */
paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC;
-
/* for a cleaner config file, TTracer params should be defined in a
* specific section...
*/
config_get(ttraceparams,
sizeof(ttraceparams) / sizeof(paramdef_t),
TTRACER_CONFIG_PREFIX);
-
/* compatibility: look for TTracer command line options in root section */
config_process_cmdline(ttraceparams,
sizeof(ttraceparams) / sizeof(paramdef_t),
diff --git a/common/utils/T/T.h b/common/utils/T/T.h
index 18e4a590d9..626dbafd25 100644
--- a/common/utils/T/T.h
+++ b/common/utils/T/T.h
@@ -8,7 +8,7 @@
#include "T_defs.h"
#ifdef T_SEND_TIME
-#include
+ #include
#endif
/* T message IDs */
@@ -76,13 +76,13 @@
T_BUFFER_MAX - T_LOCAL_size, T_PUT_printf_deref x); \
if (T_PUT_len < 0) { \
printf("%s:%d:%s: you can't read this, or can you?", \
- __FILE__, __LINE__, __FUNCTION__); \
+ __FILE__, __LINE__, __FUNCTION__); \
abort(); \
} \
if (T_PUT_len >= T_BUFFER_MAX - T_LOCAL_size) { \
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
- ", consider increasing T_BUFFER_MAX (%d)\n", \
- __FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
+ ", consider increasing T_BUFFER_MAX (%d)\n", \
+ __FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
abort(); \
} \
T_LOCAL_size += T_PUT_len + 1; \
@@ -97,9 +97,9 @@ struct T_header;
/* T macro tricks */
extern int T_stdout;
#define TN(...) TN_N(__VA_ARGS__,33,32,31,30,29,28,27,26,25,24,23,22,21,\
- 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__)
+ 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__)
#define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\
- n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
+ n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
#define T(...) do { if (T_stdout == 0) TN(__VA_ARGS__); } while (0)
/* type used to send arbitrary buffer data */
@@ -119,30 +119,30 @@ extern int *T_active;
*/
#if BASIC_SIMULATOR
# define T_GET_SLOT \
- do { \
- extern volatile uint64_t T_next_id; \
- extern volatile uint64_t T_active_id; \
- uint64_t id; \
- /* get a ticket */ \
- id = __sync_fetch_and_add(&T_next_id, 1); \
- /* wait for our turn */ \
- while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \
- /* this is our turn, try to acquire the slot until it's free */ \
- do { \
- T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \
- if (T_LOCAL_busy & 0x01) usleep(100); \
- } while (T_LOCAL_busy & 0x01); \
- /* check that there are still some tickets */ \
- if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \
- printf("T: reached the end of times, bye...\n"); \
- abort(); \
- } \
- /* free our ticket, which signals the next waiter that it's its turn */ \
- (void)__sync_fetch_and_add(&T_active_id, 1); \
- } while (0)
+ do { \
+ extern volatile uint64_t T_next_id; \
+ extern volatile uint64_t T_active_id; \
+ uint64_t id; \
+ /* get a ticket */ \
+ id = __sync_fetch_and_add(&T_next_id, 1); \
+ /* wait for our turn */ \
+ while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \
+ /* this is our turn, try to acquire the slot until it's free */ \
+ do { \
+ T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \
+ if (T_LOCAL_busy & 0x01) usleep(100); \
+ } while (T_LOCAL_busy & 0x01); \
+ /* check that there are still some tickets */ \
+ if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \
+ printf("T: reached the end of times, bye...\n"); \
+ abort(); \
+ } \
+ /* free our ticket, which signals the next waiter that it's its turn */ \
+ (void)__sync_fetch_and_add(&T_active_id, 1); \
+ } while (0)
#else
# define T_GET_SLOT \
- T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01);
+ T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01);
#endif
/* used at header of Tn, allocates buffer */
@@ -172,8 +172,8 @@ extern int *T_active;
#define T_CHECK_SIZE(len, argnum) \
if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
- ", consider increasing T_BUFFER_MAX (%d)\n", \
- __FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
+ ", consider increasing T_BUFFER_MAX (%d)\n", \
+ __FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
abort(); \
}
@@ -598,20 +598,21 @@ extern int *T_active;
#define TTRACER_CONFIG_PREFIX "TTracer"
-/*------------------------------------------------------------------------------------------------------------------------------------------*/
-/* configuration parameters for TTRACE utility */
-/* optname helpstr paramflags XXXptr defXXXval type numelt */
-/*------------------------------------------------------------------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
+/* configuration parameters for TTRACE utility */
+/* optname helpstr paramflags XXXptr defXXXval type numelt */
+/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
+#define TTRACER_DEFAULT_PORTNUM 2021
#define CMDLINE_TTRACEPARAMS_DESC { \
-{"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:2021, TYPE_INT, 0}, \
-{"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0}, \
-{"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0}, \
-{"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0}, \
-}
+ {"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:TTRACER_DEFAULT_PORTNUM, TYPE_INT, 0},\
+ {"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0},\
+ {"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0},\
+ {"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0},\
+ }
- /* log on stdout */
+/* log on stdout */
void T_init(int remote_port, int wait_for_tracer, int dont_fork);
void T_Config_Init(void);
#else /* T_TRACER */
diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h
index 5300237178..5b630e9da8 100644
--- a/common/utils/T/T_defs.h
+++ b/common/utils/T/T_defs.h
@@ -1,3 +1,35 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+/*!\file common/utils/T/T_defs.h
+ * \brief
+ * \author
+ * \date
+ * \version
+ * \company EURECOM
+ * \email
+ * \note
+ * \warning
+*/
+
#ifndef _T_defs_H_
#define _T_defs_H_
@@ -41,10 +73,10 @@ typedef struct {
} T_cache_t;
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
-#define VCD_NUM_FUNCTIONS 192//190
+#define VCD_NUM_FUNCTIONS 192
/* number of VCD variables (to be kept up to date! see in T_messages.txt) */
-#define VCD_NUM_VARIABLES 136//128
+#define VCD_NUM_VARIABLES 144
/* first VCD function (to be kept up to date! see in T_messages.txt) */
#define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP)
diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt
index 10dc5fb07c..c68fac8ae1 100644
--- a/common/utils/T/T_messages.txt
+++ b/common/utils/T/T_messages.txt
@@ -75,12 +75,16 @@ ID = ENB_PHY_MSG3_ALLOCATION
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,first_transmission : int,Msg3_frame : int,Msg3_subframe
ID = ENB_PHY_INITIATE_RA_PROCEDURE
DESC = eNodeB initiates a random access procedure after detecting enough energy for one of the preambles
- GROUP = ALL:PHY:ENB
+ GROUP = ALL:PHY:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,frame : int,subframe : int,preamble : int,energy : int,delay
ID = GNB_PHY_DL_TICK
DESC = gNodeB downlink tick - one tick per ms at start of downlink processing
GROUP = ALL:PHY:GRAPHIC:GNB
FORMAT = int,gNB_ID : int,frame : int,subframe
+ID = ENB_PHY_MIB
+ DESC = MIB data
+ GROUP = ALL:PHY:ENB:WIRESHARK
+ FORMAT = int,eNB_ID : int,frame : int,subframe : buffer,data
#MAC logs
ID = ENB_MAC_UE_DL_SDU
@@ -101,7 +105,7 @@ ID = ENB_MAC_UE_UL_PDU
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu
ID = ENB_MAC_UE_UL_PDU_WITH_DATA
DESC = MAC uplink UE received PDU
- GROUP = ALL:MAC:ENB
+ GROUP = ALL:MAC:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu : buffer,data
ID = ENB_MAC_UE_UL_SDU
DESC = MAC uplink UE received SDU
@@ -117,12 +121,16 @@ ID = ENB_MAC_UE_UL_CE
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,ce
ID = ENB_MAC_UE_DL_PDU_WITH_DATA
DESC = MAC downlink PDU for an UE
- GROUP = ALL:MAC:ENB
+ GROUP = ALL:MAC:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
ID = ENB_MAC_SCHEDULING_REQUEST
DESC = MAC scheduling request detected for an UE
GROUP = ALL:MAC:ENB
FORMAT = int,eNB_ID : int,CC_id : int,frame : int,subframe : int,rnti
+ID = ENB_MAC_UE_DL_RAR_PDU_WITH_DATA
+ DESC = MAC downlink PDU for an UE
+ GROUP = ALL:MAC:ENB:WIRESHARK
+ FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
#RLC logs
ID = ENB_RLC_DL
@@ -709,7 +717,7 @@ ID = LEGACY_OCM_DEBUG
FORMAT = string,log
ID = LEGACY_OCM_TRACE
DESC = OCM legacy logs - trace level
- GROUP = ALL:LEGACY_OCM:LEGACY_GROUP_TRACE:LEGACY
+ OGROUP = ALL:LEGACY_OCM:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_OIP_INFO
@@ -880,6 +888,47 @@ ID = LEGACY_SIM_TRACE
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
+ID = LEGACY_NFAPI_VNF_INFO
+ DESC = NFAPI_VNF legacy logs - info level
+ GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_INFO:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_VNF_ERROR
+ DESC = NFAPI_VNF legacy logs - error level
+ GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_ERROR:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_VNF_WARNING
+ DESC = NFAPI_VNF legacy logs - warning level
+ GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_WARNING:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_VNF_DEBUG
+ DESC = NFAPI_VNF legacy logs - debug level
+ GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_DEBUG:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_VNF_TRACE
+ DESC = NFAPI_VNF legacy logs - trace level
+ GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_TRACE:LEGACY
+ FORMAT = string,log
+
+ID = LEGACY_NFAPI_PNF_INFO
+ DESC = NFAPI_PNF legacy logs - info level
+ GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_INFO:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_PNF_ERROR
+ DESC = NFAPI_PNF legacy logs - error level
+ GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_ERROR:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_PNF_WARNING
+ DESC = NFAPI_PNF legacy logs - warning level
+ GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_WARNING:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_PNF_DEBUG
+ DESC = NFAPI_PNF legacy logs - debug level
+ GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_DEBUG:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_PNF_TRACE
+ DESC = NFAPI_PNF legacy logs - trace level
+ GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_TRACE:LEGACY
+ FORMAT = string,log
# this is a bad hack but I won't fix (function util_print_hex_octets
# in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
# does funky things with the LOG_x macros but we work on the C pre-processor
@@ -925,26 +974,62 @@ ID = LEGACY_componentP_TRACE
GROUP = ALL:LEGACY_componentP:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
-#needed?
-ID = LEGACY_CLI_INFO
- DESC = CLI legacy logs - info level
- GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_INFO:LEGACY
+
+
+ID = LEGACY_PROTO_AGENT_DEBUG
+ DESC = PROTO AGENT DEBUG LEVEL
+ GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
-ID = LEGACY_CLI_ERROR
- DESC = CLI legacy logs - error level
- GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_ERROR:LEGACY
+
+ID = LEGACY_PROTO_AGENT_INFO
+ DESC = PROTO AGENT INFO LEVEL
+ GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
-ID = LEGACY_CLI_WARNING
- DESC = CLI legacy logs - warning level
- GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_WARNING:LEGACY
+
+ID = LEGACY_PROTO_AGENT_WARNING
+ DESC = PROTO AGENT WARNING LEVEL
+ GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
-ID = LEGACY_CLI_DEBUG
- DESC = CLI legacy logs - debug level
- GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_DEBUG:LEGACY
+
+ID = LEGACY_PROTO_AGENT_ERROR
+ DESC = PROTO AGENT ERROR LEVEL
+ GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
-ID = LEGACY_CLI_TRACE
- DESC = CLI legacy logs - trace level
- GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_TRACE:LEGACY
+
+ID = LEGACY_F1U_DEBUG
+ DESC = F1U DEBUG LEVEL
+ GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_DEBUG:LEGACY
+ FORMAT = string,log
+
+ID = LEGACY_F1U_INFO
+ DESC = F1U INFO LEVEL
+ GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_INFO:LEGACY
+ FORMAT = string,log
+
+ID = LEGACY_F1U_ERROR
+ DESC = F1U ERROR LEVEL
+ GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_ERROR:LEGACY
+ FORMAT = string,log
+
+ID = LEGACY_F1AP_TRACE
+ DESC = F1AP TRACE LEVEL
+ GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_TRACE:LEGACY
+ FORMAT = string,log
+ID = LEGACY_F1AP_DEBUG
+ DESC = F1AP DEBUG LEVEL
+ GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_DEBUG:LEGACY
+ FORMAT = string,log
+ID = LEGACY_F1AP_INFO
+ DESC = F1AP INFO LEVEL
+ GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_INFO:LEGACY
+ FORMAT = string,log
+ID = LEGACY_F1AP_WARNING
+ DESC = F1AP WARNING LEVEL
+ GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_WARNING:LEGACY
+ FORMAT = string,log
+ID = LEGACY_F1AP_ERROR
+ DESC = F1AP ERROR LEVEL
+ GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
#################
@@ -1679,6 +1764,46 @@ ID = VCD_VARIABLE_CPUID_RU_THREAD_TX
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = ru_thread_tx_CPUID
+ID = VCD_VARIABLE_ON_DURATION_TIMER
+ DESC = VCD variable ON_DURATION_TIMER
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_on_duration_timer
+ID = VCD_VARIABLE_DRX_INACTIVITY
+ DESC = VCD variable DRX_INACTIVITY
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_inactivity
+ID = VCD_VARIABLE_DRX_SHORT_CYCLE
+ DESC = VCD variable DRX_SHORT_CYCLE
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_short_cycle
+ID = VCD_VARIABLE_SHORT_DRX_CYCLE_NUMBER
+ DESC = VCD variable SHORT_DRX_CYCLE_NUMBER
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_short_drx_cycle_number
+ID = VCD_VARIABLE_DRX_LONG_CYCLE
+ DESC = VCD variable DRX_LONG_CYCLE
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_long_cycle
+ID = VCD_VARIABLE_DRX_RETRANSMISSION_HARQ0
+ DESC = VCD variable DRX_RETRANSMISSION_HARQ0
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_retransmission_harq0
+ID = VCD_VARIABLE_DRX_ACTIVE_TIME
+ DESC = VCD variable DRX_ACTIVE_TIME
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_active_time
+ID = VCD_VARIABLE_DRX_ACTIVE_TIME_CONDITION
+ DESC = VCD variable DRX_ACTIVE_TIME_CONDITION
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_active_time_condition
#variable for gNB
ID = VCD_VARIABLE_FRAME_NUMBER_TX0_GNB
diff --git a/common/utils/T/genids.c b/common/utils/T/genids.c
index 8e5adbf587..a130988262 100644
--- a/common/utils/T/genids.c
+++ b/common/utils/T/genids.c
@@ -8,27 +8,35 @@ char **unique_ids;
int unique_ids_size;
int unique_ids_maxsize;
-int cmp(const void *p1, const void *p2)
-{
- return strcmp(*(char * const *)p1, *(char * const *)p2);
+int cmp(const void *p1, const void *p2) {
+ return strcmp(*(char *const *)p1, *(char *const *)p2);
}
/* return 1 if s was not already known, 0 if it was */
-int new_unique_id(char *s, char *input_file)
-{
+int new_unique_id(char *s, char *input_file) {
if (unique_ids_size)
- if (bsearch(&s, unique_ids, unique_ids_size, sizeof(char *), cmp) != NULL) {
- printf("error: ID %s is not unique in %s\n", s, input_file);
- return 0;
- }
+ if (bsearch(&s, unique_ids, unique_ids_size, sizeof(char *), cmp) != NULL) {
+ printf("error: ID %s is not unique in %s\n", s, input_file);
+ return 0;
+ }
+
if (unique_ids_size == unique_ids_maxsize) {
unique_ids_maxsize += 256;
unique_ids = realloc(unique_ids, unique_ids_maxsize * sizeof(char *));
- if (unique_ids == NULL) { printf("erorr: out of memory\n"); abort(); }
+
+ if (unique_ids == NULL) {
+ printf("error: out of memory\n");
+ abort();
+ }
}
+
unique_ids[unique_ids_size] = strdup(s);
- if (unique_ids[unique_ids_size] == NULL)
- { printf("erorr: out of memory\n"); abort(); }
+
+ if (unique_ids[unique_ids_size] == NULL) {
+ printf("error: out of memory\n");
+ abort();
+ }
+
unique_ids_size++;
qsort(unique_ids, unique_ids_size, sizeof(char *), cmp);
return 1;
@@ -38,14 +46,17 @@ char *bufname;
int bufname_size;
int bufname_maxsize;
-void putname(int c)
-{
+void putname(int c) {
if (bufname_size == bufname_maxsize) {
bufname_maxsize += 256;
bufname = realloc(bufname, bufname_maxsize);
- if (bufname == NULL)
- { printf("erorr: memory allocation error\n"); exit(1); }
+
+ if (bufname == NULL) {
+ printf("error: memory allocation error\n");
+ exit(1);
+ }
}
+
bufname[bufname_size] = c;
bufname_size++;
}
@@ -54,42 +65,54 @@ char *bufvalue;
int bufvalue_size;
int bufvalue_maxsize;
-void putvalue(int c)
-{
+void putvalue(int c) {
if (bufvalue_size == bufvalue_maxsize) {
bufvalue_maxsize += 256;
bufvalue = realloc(bufvalue, bufvalue_maxsize);
- if (bufvalue == NULL)
- { printf("error: memory allocation error\n"); exit(1); }
+
+ if (bufvalue == NULL) {
+ printf("error: memory allocation error\n");
+ exit(1);
+ }
}
+
bufvalue[bufvalue_size] = c;
bufvalue_size++;
}
-void smash_spaces(FILE *f)
-{
+void smash_spaces(FILE *f) {
int c;
+
while (1) {
c = fgetc(f);
+
if (isspace(c)) continue;
+
if (c == ' ') continue;
+
if (c == '\t') continue;
+
if (c == '\n') continue;
+
if (c == 10 || c == 13) continue;
+
if (c == '#') {
while (1) {
c = fgetc(f);
+
if (c == '\n' || c == EOF) break;
}
+
continue;
}
+
break;
}
+
if (c != EOF) ungetc(c, f);
}
-void get_line(FILE *f, char **name, char **value)
-{
+void get_line(FILE *f, char **name, char **value) {
int c;
bufname_size = 0;
bufvalue_size = 0;
@@ -97,23 +120,39 @@ void get_line(FILE *f, char **name, char **value)
*value = NULL;
smash_spaces(f);
c = fgetc(f);
- while (!(c == '=' || isspace(c) || c == EOF)) { putname(c); c = fgetc(f); }
+
+ while (!(c == '=' || isspace(c) || c == EOF)) {
+ putname(c);
+ c = fgetc(f);
+ }
+
if (c == EOF) return;
+
putname(0);
+
while (!(c == EOF || c == '=')) c = fgetc(f);
+
if (c == EOF) return;
+
smash_spaces(f);
c = fgetc(f);
- while (!(c == 10 || c == 13 || c == EOF)) { putvalue(c); c = fgetc(f); }
+
+ while (!(c == 10 || c == 13 || c == EOF)) {
+ putvalue(c);
+ c = fgetc(f);
+ }
+
putvalue(0);
+
if (bufname_size <= 1) return;
+
if (bufvalue_size <= 1) return;
+
*name = bufname;
*value = bufvalue;
}
-int main(int n, char **v)
-{
+int main(int n, char **v) {
FILE *in;
FILE *out;
char *name;
@@ -121,36 +160,54 @@ int main(int n, char **v)
char *in_name;
char *out_name;
- if (n != 3) { printf("error: gimme \n"); exit(1); }
+ if (n != 3) {
+ printf("error: gimme \n");
+ exit(1);
+ }
n = 0;
-
in_name = v[1];
out_name = v[2];
+ in = fopen(in_name, "r");
- in = fopen(in_name, "r"); if (in == NULL) { perror(in_name); exit(1); }
- out = fopen(out_name, "w"); if (out == NULL) { perror(out_name); exit(1); }
+ if (in == NULL) {
+ perror(in_name);
+ exit(1);
+ }
+
+ out = fopen(out_name, "w");
+
+ if (out == NULL) {
+ perror(out_name);
+ exit(1);
+ }
fprintf(out, "/* generated file, do not edit by hand */\n\n");
while (1) {
get_line(in, &name, &value);
+
if (name == NULL) break;
+
if (isspace(value[strlen(value)-1])) {
printf("error: bad value '%s' (no space at the end please!)\n", value);
unlink(out_name);
exit(1);
}
+
if (!strcmp(name, "ID")) {
- if (!new_unique_id(value, in_name)) { unlink(out_name); exit(1); }
+ if (!new_unique_id(value, in_name)) {
+ unlink(out_name);
+ exit(1);
+ }
+
fprintf(out, "#define T_%s T_ID(%d)\n", value, n);
n++;
}
}
- fprintf(out, "#define T_NUMBER_OF_IDS %d\n", n);
+ fprintf(out, "#define T_NUMBER_OF_IDS %d\n", n);
fclose(in);
fclose(out);
-
return 0;
}
diff --git a/common/utils/T/local_tracer.c b/common/utils/T/local_tracer.c
index f8e92881a9..4be0b35d16 100644
--- a/common/utils/T/local_tracer.c
+++ b/common/utils/T/local_tracer.c
@@ -31,7 +31,7 @@ typedef struct {
int remote_port;
pthread_mutex_t lock;
pthread_cond_t cond;
- databuf * volatile head, *tail;
+ databuf *volatile head, *tail;
uint64_t memusage;
uint64_t last_warning_memusage;
} forward_data;
@@ -40,80 +40,115 @@ typedef struct {
/* utility functions */
/****************************************************************************/
-static void new_thread(void *(*f)(void *), void *data)
-{
+static void new_thread(void *(*f)(void *), void *data) {
pthread_t t;
pthread_attr_t att;
- if (pthread_attr_init(&att))
- { fprintf(stderr, "pthread_attr_init err\n"); exit(1); }
- if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED))
- { fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); }
- if (pthread_attr_setstacksize(&att, 10000000))
- { fprintf(stderr, "pthread_attr_setstacksize err\n"); exit(1); }
- if (pthread_create(&t, &att, f, data))
- { fprintf(stderr, "pthread_create err\n"); exit(1); }
- if (pthread_attr_destroy(&att))
- { fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); }
+ if (pthread_attr_init(&att)) {
+ fprintf(stderr, "pthread_attr_init err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
+ fprintf(stderr, "pthread_attr_setdetachstate err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_setstacksize(&att, 10000000)) {
+ fprintf(stderr, "pthread_attr_setstacksize err\n");
+ exit(1);
+ }
+
+ if (pthread_create(&t, &att, f, data)) {
+ fprintf(stderr, "pthread_create err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_destroy(&att)) {
+ fprintf(stderr, "pthread_attr_destroy err\n");
+ exit(1);
+ }
}
-static int get_connection(char *addr, int port)
-{
+static int get_connection(char *addr, int port) {
struct sockaddr_in a;
socklen_t alen;
int s, t;
-
printf("T tracer: waiting for connection on %s:%d\n", addr, port);
-
s = socket(AF_INET, SOCK_STREAM, 0);
- if (s == -1) { perror("socket"); exit(1); }
+
+ if (s == -1) {
+ perror("socket");
+ exit(1);
+ }
+
t = 1;
- if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int)))
- { perror("setsockopt"); exit(1); }
+
+ if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int))) {
+ perror("setsockopt");
+ exit(1);
+ }
a.sin_family = AF_INET;
a.sin_port = htons(port);
a.sin_addr.s_addr = inet_addr(addr);
- if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); }
- if (listen(s, 5)) { perror("bind"); exit(1); }
+ if (bind(s, (struct sockaddr *)&a, sizeof(a))) {
+ perror("bind");
+ exit(1);
+ }
+
+ if (listen(s, 5)) {
+ perror("bind");
+ exit(1);
+ }
+
alen = sizeof(a);
t = accept(s, (struct sockaddr *)&a, &alen);
- if (t == -1) { perror("accept"); exit(1); }
+
+ if (t == -1) {
+ perror("accept");
+ exit(1);
+ }
+
close(s);
-
printf("T tracer: connected\n");
-
return t;
}
static void forward(void *_forwarder, char *buf, int size);
-void send_T_messages_txt(void *forwarder)
-{
+void send_T_messages_txt(void *forwarder) {
char buf[T_BUFFER_MAX];
char *T_LOCAL_buf = buf;
int T_LOCAL_size;
unsigned char *src;
int src_len;
-
/* trace T_message.txt
* Send several messages -1 with content followed by message -2.
*/
src = T_messages_txt;
src_len = T_messages_txt_len;
+
while (src_len) {
int send_size = src_len;
+
if (send_size > T_PAYLOAD_MAXSIZE - sizeof(int))
send_size = T_PAYLOAD_MAXSIZE - sizeof(int);
+
/* TODO: be careful, we use internal T stuff, to rewrite? */
T_LOCAL_size = 0;
T_HEADER(T_ID(-1));
- T_PUT_buffer(1, ((T_buffer){addr:(src), length:(send_size)}));
+ T_PUT_buffer(1, ((T_buffer) {
+addr:
+(src), length:
+ (send_size)
+ }));
forward(forwarder, buf, T_LOCAL_size);
src += send_size;
src_len -= send_size;
}
+
T_LOCAL_size = 0;
T_HEADER(T_ID(-2));
forward(forwarder, buf, T_LOCAL_size);
@@ -123,49 +158,54 @@ void send_T_messages_txt(void *forwarder)
/* forward functions */
/****************************************************************************/
-static void *data_sender(void *_f)
-{
+static void *data_sender(void *_f) {
forward_data *f = _f;
databuf *cur;
char *buf, *b;
int size;
-
wait:
+
if (pthread_mutex_lock(&f->lock)) abort();
+
while (f->head == NULL)
if (pthread_cond_wait(&f->cond, &f->lock)) abort();
+
cur = f->head;
buf = cur->d;
size = cur->l;
f->head = cur->next;
f->memusage -= size;
+
if (f->head == NULL) f->tail = NULL;
+
if (pthread_mutex_unlock(&f->lock)) abort();
+
free(cur);
goto process;
-
process:
b = buf;
+
if (f->socket_remote != -1)
- while (size) {
- int l = write(f->socket_remote, b, size);
- if (l <= 0) {
- printf("T tracer: forward error\n");
- close(f->socket_remote);
- f->socket_remote = -1;
- break;
+ while (size) {
+ int l = write(f->socket_remote, b, size);
+
+ if (l <= 0) {
+ printf("T tracer: forward error\n");
+ close(f->socket_remote);
+ f->socket_remote = -1;
+ break;
+ }
+
+ size -= l;
+ b += l;
}
- size -= l;
- b += l;
- }
free(buf);
-
goto wait;
}
-static void *forward_remote_messages(void *_f)
-{
+
+static void *forward_remote_messages(void *_f) {
#define PUT(x) do { \
if (bufsize == bufmaxsize) { \
bufmaxsize += 4096; \
@@ -180,7 +220,6 @@ static void *forward_remote_messages(void *_f)
int len = l; \
while (len) { PUT(*zz); zz++; len--; } \
} while (0)
-
forward_data *f = _f;
int from;
int to;
@@ -190,43 +229,53 @@ static void *forward_remote_messages(void *_f)
int bufsize = 0;
int bufmaxsize = 0;
char t;
-
again:
while (1) {
from = f->socket_remote;
to = f->socket_local;
-
bufsize = 0;
-
/* let's read and process messages */
- len = read(from, &t, 1); if (len <= 0) goto dead;
+ len = read(from, &t, 1);
+
+ if (len <= 0) goto dead;
+
PUT(t);
switch (t) {
- case 0:
- case 1:
- /* message 0 and 1: get a length and then 'length' numbers */
- if (read(from, &len, sizeof(int)) != sizeof(int)) goto dead;
- PUT_BUF(&len, 4);
- while (len) {
- if (read(from, &l, sizeof(int)) != sizeof(int)) goto dead;
- PUT_BUF(&l, 4);
- len--;
- }
- break;
+ case 0:
+ case 1:
- case 2: break;
- default:
- printf("%s:%d:%s: unhandled message type %d\n",
- __FILE__, __LINE__, __FUNCTION__, t);
- abort();
+ /* message 0 and 1: get a length and then 'length' numbers */
+ if (read(from, &len, sizeof(int)) != sizeof(int)) goto dead;
+
+ PUT_BUF(&len, 4);
+
+ while (len) {
+ if (read(from, &l, sizeof(int)) != sizeof(int)) goto dead;
+
+ PUT_BUF(&l, 4);
+ len--;
+ }
+
+ break;
+
+ case 2:
+ break;
+
+ default:
+ printf("%s:%d:%s: unhandled message type %d\n",
+ __FILE__, __LINE__, __FUNCTION__, t);
+ abort();
}
b = buf;
+
while (bufsize) {
l = write(to, b, bufsize);
+
if (l <= 0) abort();
+
bufsize -= l;
b += l;
}
@@ -236,71 +285,80 @@ dead:
/* socket died, let's stop all traces and wait for another tracer */
/* TODO: be careful with those write, they might write less than wanted */
buf[0] = 1;
+
if (write(to, buf, 1) != 1) abort();
+
len = T_NUMBER_OF_IDS;
+
if (write(to, &len, sizeof(int)) != sizeof(int)) abort();
+
l = 0;
+
while (len) {
if (write(to, &l, sizeof(int)) != sizeof(int)) abort();
+
len--;
};
close(f->socket_remote);
+
f->socket_remote = get_connection("0.0.0.0", f->remote_port);
+
send_T_messages_txt(f);
+
goto again;
return NULL;
}
-static void *forwarder(int port, int s)
-{
+static void *forwarder(int port, int s) {
forward_data *f;
+ f = malloc(sizeof(*f));
- f = malloc(sizeof(*f)); if (f == NULL) abort();
+ if (f == NULL) abort();
pthread_mutex_init(&f->lock, NULL);
pthread_cond_init(&f->cond, NULL);
-
f->socket_local = s;
f->head = f->tail = NULL;
-
f->memusage = 0;
f->last_warning_memusage = 0;
-
printf("T tracer: waiting for remote tracer on port %d\n", port);
-
f->remote_port = port;
f->socket_remote = get_connection("0.0.0.0", port);
send_T_messages_txt(f);
-
new_thread(data_sender, f);
new_thread(forward_remote_messages, f);
-
return f;
}
-static void forward(void *_forwarder, char *buf, int size)
-{
+static void forward(void *_forwarder, char *buf, int size) {
forward_data *f = _forwarder;
int32_t ssize = size;
databuf *new;
+ new = malloc(sizeof(*new));
- new = malloc(sizeof(*new)); if (new == NULL) abort();
+ if (new == NULL) abort();
if (pthread_mutex_lock(&f->lock)) abort();
- new->d = malloc(size + 4); if (new->d == NULL) abort();
+ new->d = malloc(size + 4);
+
+ if (new->d == NULL) abort();
+
/* put the size of the message at the head */
memcpy(new->d, &ssize, 4);
memcpy(new->d+4, buf, size);
new->l = size+4;
new->next = NULL;
- if (f->head == NULL) f->head = new;
- if (f->tail != NULL) f->tail->next = new;
- f->tail = new;
+ if (f->head == NULL) f->head = new;
+
+ if (f->tail != NULL) f->tail->next = new;
+
+ f->tail = new;
#if BASIC_SIMULATOR
+
/* When runnng the basic simulator, the tracer may be too slow.
* Let's not take too much memory in the tracee and
* wait if there is too much data to send. 200MB is
@@ -308,26 +366,30 @@ static void forward(void *_forwarder, char *buf, int size)
*/
while (f->memusage > 200 * 1024 * 1024) {
if (pthread_cond_signal(&f->cond)) abort();
+
if (pthread_mutex_unlock(&f->lock)) abort();
+
usleep(1000);
+
if (pthread_mutex_lock(&f->lock)) abort();
}
-#endif /* BASIC_SIMULATOR */
+#endif /* BASIC_SIMULATOR */
f->memusage += size+4;
+
/* warn every 100MB */
if (f->memusage > f->last_warning_memusage &&
f->memusage - f->last_warning_memusage > 100000000) {
f->last_warning_memusage += 100000000;
printf("T tracer: WARNING: memory usage is over %"PRIu64"MB\n",
f->last_warning_memusage / 1000000);
- } else
- if (f->memusage < f->last_warning_memusage &&
- f->last_warning_memusage - f->memusage > 100000000) {
+ } else if (f->memusage < f->last_warning_memusage &&
+ f->last_warning_memusage - f->memusage > 100000000) {
f->last_warning_memusage = (f->memusage/100000000) * 100000000;
}
if (pthread_cond_signal(&f->cond)) abort();
+
if (pthread_mutex_unlock(&f->lock)) abort();
}
@@ -335,14 +397,12 @@ static void forward(void *_forwarder, char *buf, int size)
/* local functions */
/****************************************************************************/
-static void wait_message(void)
-{
+static void wait_message(void) {
while ((T_local_cache[T_busylist_head].busy & 0x02) == 0) usleep(1000);
}
void T_local_tracer_main(int remote_port, int wait_for_tracer,
- int local_socket, void *shm_array)
-{
+ int local_socket, void *shm_array) {
int s;
int port = remote_port;
int dont_wait = wait_for_tracer ? 0 : 1;
@@ -350,16 +410,16 @@ void T_local_tracer_main(int remote_port, int wait_for_tracer,
/* write on a socket fails if the other end is closed and we get SIGPIPE */
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
- printf("local tracer received SIGPIPE\n");
- abort();
+ printf("local tracer received SIGPIPE\n");
+ abort();
}
T_local_cache = shm_array;
-
s = local_socket;
if (dont_wait) {
char t = 2;
+
if (write(s, &t, 1) != 1) abort();
}
diff --git a/common/utils/T/tracer/Makefile b/common/utils/T/tracer/Makefile
index 3da4aa13a1..792c2a407c 100644
--- a/common/utils/T/tracer/Makefile
+++ b/common/utils/T/tracer/Makefile
@@ -60,6 +60,11 @@ macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \
multi: multi.o utils.o database.o config.o
$(CC) $(CFLAGS) -o multi $^ $(LIBS)
+multi.o: ../T_IDs.h
+
+../T_IDs.h:
+ cd .. && $(MAKE)
+
.PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a
gui/gui.a:
diff --git a/common/utils/T/tracer/extract.c b/common/utils/T/tracer/extract.c
index 2aec38831f..d66e8a3bb8 100644
--- a/common/utils/T/tracer/extract.c
+++ b/common/utils/T/tracer/extract.c
@@ -16,6 +16,8 @@ void usage(void)
" -f field 'name' of 'event' has to match 'value'\n"
" type of 'name' must be int\n"
" (you can use several -f options)\n"
+" -after 'event' time has to be greater than this\n"
+" -count dump 'n' matching events (less if EOF reached)\n"
);
exit(1);
}
@@ -51,6 +53,10 @@ int main(int n, char **v)
int filter_count = 0;
int buffer_arg;
int found;
+ int count = 1;
+ int check_time = 0;
+ time_t sec;
+ long nsec;
for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
@@ -63,6 +69,14 @@ int main(int n, char **v)
filter_value[filter_count++] = atoi(v[++i]);
continue;
}
+ if (!strcmp(v[i], "-after")) { if (i>n-3) usage();
+ check_time = 1;
+ sec = atoll(v[++i]);
+ nsec = atol(v[++i]);
+ continue;
+ }
+ if (!strcmp(v[i], "-count"))
+ { if (i > n-2) usage(); count = atoi(v[++i]); continue; }
if (file == NULL) { file = v[i]; continue; }
if (event_name == NULL) { event_name = v[i]; continue; }
if (buffer_name == NULL) { buffer_name = v[i]; continue; }
@@ -111,13 +125,20 @@ int main(int n, char **v)
break;
if (i != filter_count)
continue;
+ if (check_time &&
+ !(e.sending_time.tv_sec > sec ||
+ (e.sending_time.tv_sec == sec && e.sending_time.tv_nsec >= nsec)))
+ continue;
if (fwrite(e.e[buffer_arg].b, e.e[buffer_arg].bsize, 1, out) != 1)
{ perror(output_file); exit(1); }
- found = 1;
- break;
+ found++;
+ if (found == count)
+ break;
}
if (found == 0) printf("ERROR: event not found\n");
+ if (found != count)
+ printf("WARNING: dumped %d events (wanted %d)\n", found, count);
fclose(out);
diff --git a/common/utils/T/tracer/gui/notify.c b/common/utils/T/tracer/gui/notify.c
index 7ff4006941..5798a01219 100644
--- a/common/utils/T/tracer/gui/notify.c
+++ b/common/utils/T/tracer/gui/notify.c
@@ -5,62 +5,56 @@
#include
unsigned long register_notifier(gui *_g, char *notification, widget *w,
- notifier handler, void *private)
-{
+ notifier handler, void *private) {
struct gui *g = _g;
unsigned long ret;
-
glock(g);
if (g->next_notifier_id == 2UL * 1024 * 1024 * 1024)
ERR("%s:%d: report a bug\n", __FILE__, __LINE__);
g->notifiers = realloc(g->notifiers,
- (g->notifiers_count+1) * sizeof(struct notifier));
+ (g->notifiers_count+1) * sizeof(struct notifier));
+
if (g->notifiers == NULL) abort();
ret = g->next_notifier_id;
-
g->notifiers[g->notifiers_count].handler = handler;
g->notifiers[g->notifiers_count].id = g->next_notifier_id;
g->next_notifier_id++;
g->notifiers[g->notifiers_count].notification = strdup(notification);
+
if (g->notifiers[g->notifiers_count].notification == NULL) abort();
+
g->notifiers[g->notifiers_count].w = w;
g->notifiers[g->notifiers_count].private = private;
/* initialize done to 1 so as not to call the handler if it's created
* by the call of another one that is in progress
*/
g->notifiers[g->notifiers_count].done = 1;
-
g->notifiers_count++;
-
gunlock(g);
-
return ret;
}
-void unregister_notifier(gui *_g, unsigned long notifier_id)
-{
+void unregister_notifier(gui *_g, unsigned long notifier_id) {
struct gui *g = _g;
int i;
-
glock(g);
for (i = 0; i < g->notifiers_count; i++)
if (g->notifiers[i].id == notifier_id) break;
if (i == g->notifiers_count)
- ERR("%s:%d: notifier_id %ld not found\n", __FILE__,__LINE__,notifier_id);
+ ERR("%s:%d: notifier_id %lu not found\n", __FILE__,__LINE__,notifier_id);
free(g->notifiers[i].notification);
-
memmove(g->notifiers + i, g->notifiers + i + 1,
- (g->notifiers_count-1 - i) * sizeof(struct notifier));
-
+ (g->notifiers_count-1 - i) * sizeof(struct notifier));
g->notifiers_count--;
g->notifiers = realloc(g->notifiers,
- g->notifiers_count * sizeof(struct notifier));
+ g->notifiers_count * sizeof(struct notifier));
+
if (g->notifiers == NULL) abort();
gunlock(g);
@@ -68,19 +62,19 @@ void unregister_notifier(gui *_g, unsigned long notifier_id)
/* called with lock ON */
void gui_notify(struct gui *g, char *notification, widget *w,
- void *notification_data)
-{
+ void *notification_data) {
void *private;
notifier handler;
int i;
-
/* this function is not re-entrant, for the moment keep as is
* and if the need is there, we'll make a new thread to handle
* notifications (or something)
* for now let's crash in case of recursive call
*/
static int inside = 0;
+
if (inside) ERR("%s:%d: BUG! contact the authors\n", __FILE__, __LINE__);
+
inside = 1;
/* clear all handlers */
@@ -91,26 +85,25 @@ void gui_notify(struct gui *g, char *notification, widget *w,
* need to be careful here
*/
loop:
+
for (i = 0; i < g->notifiers_count; i++) {
if (g->notifiers[i].done == 1 ||
g->notifiers[i].w != w ||
strcmp(g->notifiers[i].notification, notification) != 0)
continue;
+
break;
}
+
if (i == g->notifiers_count) goto done;
g->notifiers[i].done = 1;
-
handler = g->notifiers[i].handler;
private = g->notifiers[i].private;
-
gunlock(g);
handler(private, g, notification, w, notification_data);
glock(g);
-
goto loop;
-
done:
inside = 0;
}
diff --git a/common/utils/T/tracer/gui/x.c b/common/utils/T/tracer/gui/x.c
index ef5334767c..71bd805455 100644
--- a/common/utils/T/tracer/gui/x.c
+++ b/common/utils/T/tracer/gui/x.c
@@ -7,21 +7,19 @@
#include
#include
-int x_connection_fd(x_connection *_x)
-{
+int x_connection_fd(x_connection *_x) {
struct x_connection *x = _x;
return ConnectionNumber(x->d);
}
-static GC create_gc(Display *d, char *color)
-{
+static GC create_gc(Display *d, char *color) {
GC ret = XCreateGC(d, DefaultRootWindow(d), 0, NULL);
XGCValues gcv;
XColor rcol, scol;
-
XCopyGC(d, DefaultGC(d, DefaultScreen(d)), -1L, ret);
+
if (XAllocNamedColor(d, DefaultColormap(d, DefaultScreen(d)),
- color, &scol, &rcol)) {
+ color, &scol, &rcol)) {
gcv.foreground = scol.pixel;
XChangeGC(d, ret, GCForeground, &gcv);
} else ERR("X: could not allocate color '%s'\n", color);
@@ -29,82 +27,81 @@ static GC create_gc(Display *d, char *color)
return ret;
}
-int x_new_color(x_connection *_x, char *color)
-{
+int x_new_color(x_connection *_x, char *color) {
struct x_connection *x = _x;
x->ncolors++;
-
x->colors = realloc(x->colors, x->ncolors * sizeof(GC));
- if (x->colors == NULL) OOM;
- x->colors[x->ncolors-1] = create_gc(x->d, color);
+ if (x->colors == NULL) OOM;
+
+ x->colors[x->ncolors-1] = create_gc(x->d, color);
x->xft_colors = realloc(x->xft_colors, x->ncolors * sizeof(XftColor));
+
if (x->xft_colors == NULL) OOM;
+
if (XftColorAllocName(x->d, DefaultVisual(x->d, DefaultScreen(x->d)),
- DefaultColormap(x->d, DefaultScreen(x->d)),
- color, &x->xft_colors[x->ncolors-1]) == False)
+ DefaultColormap(x->d, DefaultScreen(x->d)),
+ color, &x->xft_colors[x->ncolors-1]) == False)
ERR("could not allocate color '%s'\n", color);
return x->ncolors - 1;
}
-int x_new_font(x_connection *_x, char *font)
-{
+int x_new_font(x_connection *_x, char *font) {
struct x_connection *x = _x;
/* TODO: allocate fonts only once */
x->nfonts++;
x->fonts = realloc(x->fonts, x->nfonts * sizeof(XftFont *));
+
if (x->fonts == NULL) OOM;
+
x->fonts[x->nfonts-1] = XftFontOpenName(x->d, DefaultScreen(x->d), font);
+
if (x->fonts[x->nfonts-1] == NULL)
ERR("failed allocating font '%s'\n", font);
+
return x->nfonts - 1;
}
-x_connection *x_open(void)
-{
+x_connection *x_open(void) {
struct x_connection *ret;
-
ret = calloc(1, sizeof(struct x_connection));
+
if (ret == NULL) OOM;
ret->d = XOpenDisplay(0);
LOGD("XOpenDisplay display %p return x_connection %p\n", ret->d, ret);
+
if (ret->d == NULL) ERR("error calling XOpenDisplay: no X? you root?\n");
x_new_color(ret, "white"); /* background color */
x_new_color(ret, "black"); /* foreground color */
-
x_new_font(ret, "sans-8");
-
return ret;
}
x_window *x_create_window(x_connection *_x, int width, int height,
- char *title)
-{
+ char *title) {
struct x_connection *x = _x;
struct x_window *ret;
-
ret = calloc(1, sizeof(struct x_window));
+
if (ret == NULL) OOM;
ret->w = XCreateSimpleWindow(x->d, DefaultRootWindow(x->d), 0, 0,
- width, height, 0, WhitePixel(x->d, DefaultScreen(x->d)),
- WhitePixel(x->d, DefaultScreen(x->d)));
+ width, height, 0, WhitePixel(x->d, DefaultScreen(x->d)),
+ WhitePixel(x->d, DefaultScreen(x->d)));
ret->width = width;
ret->height = height;
-
XStoreName(x->d, ret->w, title);
-
ret->p = XCreatePixmap(x->d, ret->w, width, height,
- DefaultDepth(x->d, DefaultScreen(x->d)));
+ DefaultDepth(x->d, DefaultScreen(x->d)));
XFillRectangle(x->d, ret->p, x->colors[BACKGROUND_COLOR],
- 0, 0, width, height);
-
+ 0, 0, width, height);
ret->xft = XftDrawCreate(x->d, ret->p,
- DefaultVisual(x->d, DefaultScreen(x->d)),
- DefaultColormap(x->d, DefaultScreen(x->d)));
+ DefaultVisual(x->d, DefaultScreen(x->d)),
+ DefaultColormap(x->d, DefaultScreen(x->d)));
+
if (ret->xft == NULL) ERR("XftDrawCreate failed\n");
/* enable backing store */
@@ -113,23 +110,19 @@ x_window *x_create_window(x_connection *_x, int width, int height,
att.backing_store = Always;
XChangeWindowAttributes(x->d, ret->w, CWBackingStore, &att);
}
-
XSelectInput(x->d, ret->w,
- KeyPressMask |
- ButtonPressMask |
- ButtonReleaseMask |
- PointerMotionMask |
- ExposureMask |
- StructureNotifyMask);
-
+ KeyPressMask |
+ ButtonPressMask |
+ ButtonReleaseMask |
+ PointerMotionMask |
+ ExposureMask |
+ StructureNotifyMask);
XMapWindow(x->d, ret->w);
-
return ret;
}
x_image *x_create_image(x_connection *_x, unsigned char *data,
- int width, int height)
-{
+ int width, int height) {
struct x_connection *x = _x;
struct x_image *ret;
XImage *ximage;
@@ -137,8 +130,9 @@ x_image *x_create_image(x_connection *_x, unsigned char *data,
XVisualInfo template;
int nvs;
Visual *v;
+ ret = calloc(1, sizeof(struct x_image));
- ret = calloc(1, sizeof(struct x_image)); if (ret == NULL) OOM;
+ if (ret == NULL) OOM;
template.class = TrueColor;
template.depth = 24;
@@ -146,68 +140,65 @@ x_image *x_create_image(x_connection *_x, unsigned char *data,
template.green_mask = 0x00ff00;
template.blue_mask = 0x0000ff;
template.bits_per_rgb = 8;
-
vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask |
- VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
- VisualBitsPerRGBMask, &template, &nvs);
+ VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
+ VisualBitsPerRGBMask, &template, &nvs);
if (vs == NULL) {
/* try again with 32 bpp */
template.depth = 32;
vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask |
- VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
- VisualBitsPerRGBMask, &template, &nvs);
+ VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
+ VisualBitsPerRGBMask, &template, &nvs);
}
if (vs == NULL) ERR("no good visual found\n");
v = vs[0].visual;
XFree(vs);
-
ximage = XCreateImage(x->d, v, 24, ZPixmap, 0,
- (char*)data, width, height, 32, 0);
+ (char *)data, width, height, 32, 0);
+
if (ximage == NULL) ERR("image creation failed\n");
ret->p = XCreatePixmap(x->d, DefaultRootWindow(x->d), width, height, 24);
-
XPutImage(x->d, ret->p, DefaultGC(x->d, DefaultScreen(x->d)),
- ximage, 0, 0, 0, 0, width, height);
-
+ ximage, 0, 0, 0, 0, width, height);
/* TODO: be sure it's fine to set data to NULL */
ximage->data = NULL;
XDestroyImage(ximage);
-
ret->width = width;
ret->height = height;
-
return ret;
}
-static struct toplevel_window_widget *find_x_window(struct gui *g, Window id)
-{
+static struct toplevel_window_widget *find_x_window(struct gui *g, Window id) {
struct widget_list *cur;
struct toplevel_window_widget *w;
struct x_window *xw;
cur = g->toplevel;
+
while (cur) {
w = (struct toplevel_window_widget *)cur->item;
xw = w->x;
+
if (xw->w == id) return w;
+
cur = cur->next;
}
+
return NULL;
}
-void x_events(gui *_gui)
-{
+void x_events(gui *_gui) {
struct gui *g = _gui;
struct widget_list *cur;
struct x_connection *x = g->x;
struct toplevel_window_widget *w;
-
LOGD("x_events START\n");
/* preprocessing (to "compress" events) */
cur = g->toplevel;
+
while (cur) {
struct x_window *xw;
w = (struct toplevel_window_widget *)cur->item;
@@ -222,58 +213,84 @@ void x_events(gui *_gui)
XEvent ev;
XNextEvent(x->d, &ev);
LOGD("XEV %d\n", ev.type);
+
switch (ev.type) {
- case MapNotify:
- case Expose:
- if ((w = find_x_window(g, ev.xexpose.window)) != NULL) {
- struct x_window *xw = w->x;
- xw->redraw = 1;
- }
- break;
- case ConfigureNotify:
- if ((w = find_x_window(g, ev.xconfigure.window)) != NULL) {
- struct x_window *xw = w->x;
- xw->resize = 1;
- xw->new_width = ev.xconfigure.width;
- xw->new_height = ev.xconfigure.height;
- if (xw->new_width < 10) xw->new_width = 10;
- if (xw->new_height < 10) xw->new_height = 10;
- LOGD("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height);
- }
- break;
- case ButtonPress:
- if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
- int key_modifiers = 0;
- if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
- if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
- if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
- w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
- ev.xbutton.button, 0);
- }
- break;
- case ButtonRelease:
- if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
- int key_modifiers = 0;
- if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
- if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
- if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
- w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
- ev.xbutton.button, 1);
- }
- break;
- default: if (gui_logd) WARN("TODO: X event type %d\n", ev.type); break;
+ case MapNotify:
+ case Expose:
+ if ((w = find_x_window(g, ev.xexpose.window)) != NULL) {
+ struct x_window *xw = w->x;
+ xw->redraw = 1;
+ }
+
+ break;
+
+ case ConfigureNotify:
+ if ((w = find_x_window(g, ev.xconfigure.window)) != NULL) {
+ struct x_window *xw = w->x;
+ xw->resize = 1;
+ xw->new_width = ev.xconfigure.width;
+ xw->new_height = ev.xconfigure.height;
+
+ if (xw->new_width < 10) xw->new_width = 10;
+
+ if (xw->new_height < 10) xw->new_height = 10;
+
+ LOGD("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height);
+ }
+
+ break;
+
+ case ButtonPress:
+ if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
+ int key_modifiers = 0;
+
+ if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
+
+ if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
+
+ if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
+
+ w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
+ ev.xbutton.button, 0);
+ }
+
+ break;
+
+ case ButtonRelease:
+ if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
+ int key_modifiers = 0;
+
+ if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
+
+ if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
+
+ if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
+
+ w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
+ ev.xbutton.button, 1);
+ }
+
+ break;
+
+ default:
+ if (gui_logd) WARN("TODO: X event type %d\n", ev.type);
+
+ break;
}
}
/* postprocessing */
LOGD("post processing\n");
cur = g->toplevel;
+
while (cur) {
struct toplevel_window_widget *w =
- (struct toplevel_window_widget *)cur->item;
+ (struct toplevel_window_widget *)cur->item;
struct x_window *xw = w->x;
+
if (xw->resize) {
LOGD("resize old %d %d new %d %d\n", xw->width, xw->height, xw->new_width, xw->new_height);
+
if (xw->width != xw->new_width || xw->height != xw->new_height) {
w->common.allocate(g, w, 0, 0, xw->new_width, xw->new_height);
xw->width = xw->new_width;
@@ -281,46 +298,47 @@ void x_events(gui *_gui)
XftDrawDestroy(xw->xft);
XFreePixmap(x->d, xw->p);
xw->p = XCreatePixmap(x->d, xw->w, xw->width, xw->height,
- DefaultDepth(x->d, DefaultScreen(x->d)));
+ DefaultDepth(x->d, DefaultScreen(x->d)));
XFillRectangle(x->d, xw->p, x->colors[BACKGROUND_COLOR],
- 0, 0, xw->width, xw->height);
+ 0, 0, xw->width, xw->height);
xw->xft = XftDrawCreate(x->d, xw->p,
- DefaultVisual(x->d, DefaultScreen(x->d)),
- DefaultColormap(x->d, DefaultScreen(x->d)));
+ DefaultVisual(x->d, DefaultScreen(x->d)),
+ DefaultColormap(x->d, DefaultScreen(x->d)));
+
if (xw->xft == NULL) ERR("XftDrawCreate failed\n");
//xw->repaint = 1;
}
}
+
if (xw->repaint) {
w->common.paint(g, w);
xw->redraw = 1;
}
+
if (xw->redraw) {
struct x_connection *x = g->x;
LOGD("XCopyArea w h %d %d\n", xw->width, xw->height);
XCopyArea(x->d, xw->p, xw->w, x->colors[1],
- 0, 0, xw->width, xw->height, 0, 0);
+ 0, 0, xw->width, xw->height, 0, 0);
}
+
cur = cur->next;
}
+
LOGD("x_events DONE\n");
}
-void x_flush(x_connection *_x)
-{
+void x_flush(x_connection *_x) {
struct x_connection *x = _x;
XFlush(x->d);
}
void x_text_get_dimensions(x_connection *_c, int font, const char *t,
- int *width, int *height, int *baseline)
-{
+ int *width, int *height, int *baseline) {
struct x_connection *c = _c;
XGlyphInfo ext;
-
XftTextExtentsUtf8(c->d, c->fonts[font], (FcChar8 *)t, strlen(t), &ext);
-
*width = ext.width;
*height = c->fonts[font]->height;
*baseline = c->fonts[font]->ascent;
@@ -331,63 +349,57 @@ void x_text_get_dimensions(x_connection *_c, int font, const char *t,
/***********************************************************************/
void x_draw_line(x_connection *_c, x_window *_w, int color,
- int x1, int y1, int x2, int y2)
-{
+ int x1, int y1, int x2, int y2) {
struct x_connection *c = _c;
struct x_window *w = _w;
XDrawLine(c->d, w->p, c->colors[color], x1, y1, x2, y2);
}
void x_draw_rectangle(x_connection *_c, x_window *_w, int color,
- int x, int y, int width, int height)
-{
+ int x, int y, int width, int height) {
struct x_connection *c = _c;
struct x_window *w = _w;
XDrawRectangle(c->d, w->p, c->colors[color], x, y, width, height);
}
void x_fill_rectangle(x_connection *_c, x_window *_w, int color,
- int x, int y, int width, int height)
-{
+ int x, int y, int width, int height) {
struct x_connection *c = _c;
struct x_window *w = _w;
XFillRectangle(c->d, w->p, c->colors[color], x, y, width, height);
}
void x_draw_string(x_connection *_c, x_window *_w, int font, int color,
- int x, int y, const char *t)
-{
+ int x, int y, const char *t) {
struct x_connection *c = _c;
struct x_window *w = _w;
int tlen = strlen(t);
XftDrawStringUtf8(w->xft, &c->xft_colors[color], c->fonts[font],
- x, y, (const unsigned char *)t, tlen);
+ x, y, (const unsigned char *)t, tlen);
}
void x_draw_clipped_string(x_connection *_c, x_window *_w, int font,
- int color, int x, int y, const char *t,
- int clipx, int clipy, int clipwidth, int clipheight)
-{
+ int color, int x, int y, const char *t,
+ int clipx, int clipy, int clipwidth, int clipheight) {
struct x_window *w = _w;
-
XRectangle clip = { clipx, clipy, clipwidth, clipheight };
+
if (XftDrawSetClipRectangles(w->xft, 0, 0, &clip, 1) == False) abort();
+
x_draw_string(_c, _w, font, color, x, y, t);
+
if (XftDrawSetClip(w->xft, NULL) == False) abort();
}
-void x_draw_image(x_connection *_c, x_window *_w, x_image *_img, int x, int y)
-{
+void x_draw_image(x_connection *_c, x_window *_w, x_image *_img, int x, int y) {
struct x_connection *c = _c;
struct x_window *w = _w;
struct x_image *img = _img;
-
XCopyArea(c->d, img->p, w->p, DefaultGC(c->d, DefaultScreen(c->d)),
- 0, 0, img->width, img->height, x, y);
+ 0, 0, img->width, img->height, x, y);
}
-void x_draw(x_connection *_c, x_window *_w)
-{
+void x_draw(x_connection *_c, x_window *_w) {
struct x_connection *c = _c;
struct x_window *w = _w;
LOGD("x_draw XCopyArea w h %d %d display %p window %d pixmap %d\n", w->width, w->height, c->d, (int)w->w, (int)w->p);
@@ -397,13 +409,13 @@ void x_draw(x_connection *_c, x_window *_w)
/* those two special functions are to plot many points
* first call x_add_point many times then x_plot_points once
*/
-void x_add_point(x_connection *_c, int x, int y)
-{
+void x_add_point(x_connection *_c, int x, int y) {
struct x_connection *c = _c;
if (c->pts_size == c->pts_maxsize) {
c->pts_maxsize += 65536;
c->pts = realloc(c->pts, c->pts_maxsize * sizeof(XPoint));
+
if (c->pts == NULL) OOM;
}
@@ -412,12 +424,11 @@ void x_add_point(x_connection *_c, int x, int y)
c->pts_size++;
}
-void x_plot_points(x_connection *_c, x_window *_w, int color)
-{
+void x_plot_points(x_connection *_c, x_window *_w, int color) {
struct x_connection *c = _c;
LOGD("x_plot_points %d points\n", c->pts_size);
struct x_window *w = _w;
XDrawPoints(c->d, w->p, c->colors[color], c->pts, c->pts_size,
- CoordModeOrigin);
+ CoordModeOrigin);
c->pts_size = 0;
}
diff --git a/common/utils/T/tracer/gui/xy_plot.c b/common/utils/T/tracer/gui/xy_plot.c
index 0f15f4862a..c10b76c6ee 100644
--- a/common/utils/T/tracer/gui/xy_plot.c
+++ b/common/utils/T/tracer/gui/xy_plot.c
@@ -130,9 +130,13 @@ static void paint(gui *_gui, widget *_this)
this->common.y + FLIP(y),
this->common.x + this->vrule_width + 5,
this->common.y + FLIP(y));
+ /* do not print out of the widget (take care of top) */
+ y = FLIP(y)-this->label_height/2+this->label_baseline;
+ if (y - this->label_baseline < 0)
+ y = this->label_baseline;
x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR,
this->common.x + this->vrule_width - vwidth - 2,
- this->common.y + FLIP(y)-this->label_height/2+this->label_baseline,
+ this->common.y + y,
v);
}
break;
diff --git a/common/utils/T/tracer/hacks/Makefile b/common/utils/T/tracer/hacks/Makefile
index f49e437bf5..af2663e48f 100644
--- a/common/utils/T/tracer/hacks/Makefile
+++ b/common/utils/T/tracer/hacks/Makefile
@@ -3,7 +3,7 @@ CFLAGS=-Wall -g -pthread -DT_TRACER -I. -I..
LIBS=-lX11 -lm -lpng -lXft
-all: dump_nack_signal time_meas timeplot
+all: dump_nack_signal time_meas timeplot multi-rru-clean
dump_nack_signal: ../utils.o ../database.o ../config.o ../event.o \
dump_nack_signal.o
@@ -16,6 +16,9 @@ time_meas: ../utils.o ../database.o ../config.o ../event.o \
timplot: timeplot.o
$(CC) $(CFLAGS) -o timeplot $^ $(LIBS)
+multi-rru-clean: ../utils.o ../database.o ../event.o ../config.o multi-rru-clean.o
+ $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+
.PHONY: all
%.o: %.c
diff --git a/common/utils/T/tracer/hacks/dump_nack_signal.c b/common/utils/T/tracer/hacks/dump_nack_signal.c
index bb8f1a9477..02825202fb 100644
--- a/common/utils/T/tracer/hacks/dump_nack_signal.c
+++ b/common/utils/T/tracer/hacks/dump_nack_signal.c
@@ -7,21 +7,19 @@
#include "config.h"
#include "../T_defs.h"
-void usage(void)
-{
+void usage(void) {
printf(
-"options:\n"
-" -d this option is mandatory\n"
-" -ip connect to given IP address (default %s)\n"
-" -p connect to given port (default %d)\n",
- DEFAULT_REMOTE_IP,
- DEFAULT_REMOTE_PORT
+ "options:\n"
+ " -d this option is mandatory\n"
+ " -ip connect to given IP address (default %s)\n"
+ " -p connect to given port (default %d)\n",
+ DEFAULT_REMOTE_IP,
+ DEFAULT_REMOTE_PORT
);
exit(1);
}
-int main(int n, char **v)
-{
+int main(int n, char **v) {
char *database_filename = NULL;
void *database;
char *ip = DEFAULT_REMOTE_IP;
@@ -36,11 +34,28 @@ int main(int n, char **v)
for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
- if (!strcmp(v[i], "-d"))
- { if (i > n-2) usage(); database_filename = v[++i]; continue; }
- if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
- if (!strcmp(v[i], "-p"))
- { if (i > n-2) usage(); port = atoi(v[++i]); continue; }
+
+ if (!strcmp(v[i], "-d")) {
+ if (i > n-2) usage();
+
+ database_filename = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-ip")) {
+ if (i > n-2) usage();
+
+ ip = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-p")) {
+ if (i > n-2) usage();
+
+ port = atoi(v[++i]);
+ continue;
+ }
+
usage();
}
@@ -50,71 +65,92 @@ int main(int n, char **v)
}
database = parse_database(database_filename);
-
load_config_file(database_filename);
-
number_of_events = number_of_ids(database);
is_on = calloc(number_of_events, sizeof(int));
+
if (is_on == NULL) abort();
on_off(database, "ENB_PHY_INPUT_SIGNAL", is_on, 1);
on_off(database, "ENB_PHY_ULSCH_UE_NACK", is_on, 1);
on_off(database, "ENB_PHY_ULSCH_UE_ACK", is_on, 1);
-
ev_input = event_id_from_name(database, "ENB_PHY_INPUT_SIGNAL");
ev_nack = event_id_from_name(database, "ENB_PHY_ULSCH_UE_NACK");
ev_ack = event_id_from_name(database, "ENB_PHY_ULSCH_UE_ACK");
-
socket = connect_to(ip, port);
-
t = 1;
+
if (socket_send(socket, &t, 1) == -1 ||
socket_send(socket, &number_of_events, sizeof(int)) == -1 ||
socket_send(socket, is_on, number_of_events * sizeof(int)) == -1)
abort();
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
-
char dump[10][T_BUFFER_MAX];
event dump_ev[10];
-FILE *z = fopen("/tmp/dd", "w"); if (z == NULL) abort();
+ FILE *z = fopen("/tmp/dd", "w");
+
+ if (z == NULL) abort();
+
while (1) {
char *v;
event e;
e = get_event(socket, &ebuf, database);
v = ebuf.obuf;
+
if (e.type == -1) break;
+
if (e.type == ev_input) {
int sf = e.e[2].i;
- if (ebuf.osize > T_BUFFER_MAX)
- { printf("event size too big\n"); exit(1); }
+
+ if (ebuf.osize > T_BUFFER_MAX) {
+ printf("event size too big\n");
+ exit(1);
+ }
+
memcpy(dump[sf], ebuf.obuf, ebuf.osize);
dump_ev[sf] = e;
printf("input %d/%d\n", e.e[1].i, sf);
-if (fwrite(dump_ev[sf].e[4].b, dump_ev[sf].e[4].bsize, 1, z) != 1) abort();
-fflush(z);
+
+ if (fwrite(dump_ev[sf].e[4].b, dump_ev[sf].e[4].bsize, 1, z) != 1) abort();
+
+ fflush(z);
}
+
if (e.type == ev_nack) {
int sf = e.e[2].i;
printf("nack %d/%d\n", e.e[1].i, sf);
- FILE *f = fopen("/tmp/dump.raw", "w"); if (f == NULL) abort();
+ FILE *f = fopen("/tmp/dump.raw", "w");
+
+ if (f == NULL) abort();
+
if (fwrite(dump[sf] + ((char *)dump_ev[sf].e[4].b - v),
- dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
+ dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
+
if (fclose(f)) abort();
+
printf("dumped... press enter (delta %d)\n", (int)((char *)dump_ev[sf].e[4].b - v));
-// getchar();
+ // getchar();
}
+
if (e.type == ev_ack) {
int sf = e.e[2].i;
printf("ack %d/%d\n", e.e[1].i, sf);
- FILE *f = fopen("/tmp/dump.raw", "w"); if (f == NULL) abort();
+ FILE *f = fopen("/tmp/dump.raw", "w");
+
+ if (f == NULL) abort();
+
if (fwrite(dump[sf] + ((char *)dump_ev[sf].e[4].b - v),
- dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
+ dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
+
if (fclose(f)) abort();
+
printf("dumped... press enter (delta %d)\n", (int)((char *)dump_ev[sf].e[4].b - v));
-// getchar();
+ // getchar();
}
}
+ if (z)
+ fclose(z);
return 0;
}
diff --git a/common/utils/T/tracer/hacks/multi-rru-clean.c b/common/utils/T/tracer/hacks/multi-rru-clean.c
new file mode 100644
index 0000000000..c85dc0de7f
--- /dev/null
+++ b/common/utils/T/tracer/hacks/multi-rru-clean.c
@@ -0,0 +1,230 @@
+#include
+#include
+#include
+#include "database.h"
+#include "utils.h"
+#include "event.h"
+#include "../T_defs.h"
+
+void usage(void)
+{
+ printf(
+ "usage: \n"
+ "options:\n"
+ " -d this option is mandatory\n"
+ );
+ exit(1);
+}
+
+#define ERR printf("ERROR: read file %s failed\n", input_filename)
+
+typedef struct {
+ OBUF b;
+ struct timespec t;
+ int filled;
+ int error;
+} cache_t;
+
+void clear_cache(int n, cache_t *c)
+{
+ int i;
+ for (i = 0; i < n; i++) {
+ c[i].filled = 0;
+ c[i].error = 0;
+ c[i].b.osize = 0;
+ }
+}
+
+void store_in_cache(cache_t *c, int pos, OBUF *b)
+{
+ int i;
+ for (i = 0; i < b->osize; i++)
+ PUTC(&c[pos].b, b->obuf[i]);
+}
+
+int get_field(database_event_format *f, char *field, char *type)
+{
+ int i;
+ for (i = 0; i < f->count; i++)
+ if (!strcmp(f->name[i], field)) {
+ if (strcmp(f->type[i], type)) break;
+ return i;
+ }
+ printf("bad field %s, check that it exists and has type '%s'\n",field,type);
+ exit(1);
+}
+
+void process_cache(FILE *out, cache_t *c, int n, int frame, int subframe)
+{
+ int i;
+ struct tm *t;
+
+ for (i = 0; i < n; i++)
+ if (c[i].filled == 0 || c[i].error == 1)
+ goto error;
+
+ for (i = 0; i < n; i++)
+ fwrite(c[i].b.obuf, c[i].b.osize, 1, out);
+
+ clear_cache(n, c);
+ return;
+
+error:
+ printf("ERROR: incorrect data at frame %d subframe %d", frame, subframe);
+ for (i = 0; i < n; i++) if (c[i].filled) {
+ t = localtime(&c[i].t.tv_sec);
+ printf(" [tag %d time %2.2d:%2.2d:%2.2d.%9.9ld]", i,
+ t->tm_hour, t->tm_min, t->tm_sec, c[i].t.tv_nsec);
+ }
+ printf("\n");
+ clear_cache(n, c);
+}
+
+int main(int n, char **v)
+{
+ char *database_filename = NULL;
+ void *database;
+ int channel_estimate_id;
+ int number_of_tags = -1;
+ char *input_filename = NULL;
+ char *output_filename = NULL;
+ int i;
+ FILE *in;
+ FILE *out;
+ database_event_format f;
+ int frame_arg;
+ int subframe_arg;
+ int tag_arg;
+
+ cache_t *cache;
+ int cur_frame = -1;
+ int cur_subframe = -1;
+ int frame;
+ int subframe;
+ int tag;
+
+ for (i = 1; i < n; i++) {
+ if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
+ if (!strcmp(v[i], "-d")) { if (i > n-2) usage();
+ database_filename = v[++i]; continue; }
+ if (number_of_tags == -1) { number_of_tags = atoi(v[i]);
+ if (number_of_tags <= 0) {usage();} continue; }
+ if (input_filename == NULL) { input_filename = v[i]; continue; }
+ if (output_filename == NULL) { output_filename = v[i]; continue; }
+ usage();
+ }
+
+ if (database_filename == NULL) {
+ printf("ERROR: provide a database file (-d)\n");
+ exit(1);
+ }
+
+ if (output_filename == NULL || input_filename == NULL || number_of_tags == -1)
+ usage();
+
+ database = parse_database(database_filename);
+
+ channel_estimate_id = event_id_from_name(database, "CALIBRATION_CHANNEL_ESTIMATES");
+ f = get_format(database, channel_estimate_id);
+
+ frame_arg = get_field(&f, "frame", "int");
+ subframe_arg = get_field(&f, "subframe", "int");
+ tag_arg = get_field(&f, "tag", "int");
+
+ in = fopen(input_filename, "r");
+ if (in == NULL) { perror(input_filename); abort(); }
+ out = fopen(output_filename, "w");
+ if (out == NULL) { perror(output_filename); abort(); }
+
+ cache = calloc(number_of_tags, sizeof(cache_t));
+ if (cache == NULL) { perror("malloc"); exit(1); }
+
+ clear_cache(number_of_tags, cache);
+
+ OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
+
+ while (1) {
+ int type;
+ int32_t length;
+ char *v;
+ int vpos = 0;
+ struct timespec t;
+ char *buf;
+
+ /* read event from file */
+ if (fread(&length, 4, 1, in) != 1) break;
+ if (ebuf.omaxsize < length) {
+ ebuf.omaxsize = (length + 65535) & ~65535;
+ ebuf.obuf = realloc(ebuf.obuf, ebuf.omaxsize);
+ if (ebuf.obuf == NULL) { printf("out of memory\n"); exit(1); }
+ }
+ v = ebuf.obuf;
+ memcpy(v+vpos, &length, 4);
+ vpos += 4;
+#ifdef T_SEND_TIME
+ if (length < sizeof(struct timespec)) { ERR; break; }
+ if (fread(&t, sizeof(struct timespec), 1, in) != 1) { ERR; break; }
+ memcpy(v+vpos, &t, sizeof(struct timespec));
+ vpos += sizeof(struct timespec);
+ length -= sizeof(struct timespec);
+#endif
+ if (length < sizeof(int)) { ERR; break; }
+ if (fread(&type, sizeof(int), 1, in) != 1) { ERR; break; }
+ memcpy(v+vpos, &type, sizeof(int));
+ vpos += sizeof(int);
+ length -= sizeof(int);
+ if (length) if (fread(v+vpos, length, 1, in) != 1) { ERR; break; }
+ buf = v + vpos;
+ vpos += length;
+ ebuf.osize = vpos;
+
+ if (type != channel_estimate_id) continue;
+
+ event e;
+#ifdef T_SEND_TIME
+ e = new_event(t, type, length, buf, database);
+#else
+ e = new_event(type, length, buf, database);
+#endif
+
+ frame = e.e[frame_arg].i;
+ subframe = e.e[subframe_arg].i;
+ tag = e.e[tag_arg].i;
+
+ if (tag < 0 || tag >= number_of_tags) {
+ struct tm *tt;
+ tt = localtime(&t.tv_sec);
+ printf("ERROR: invalid tag (%d), skipping event for frame %d subframe %d (time %2.2d:%2.2d:%2.2d.%9.9ld)\n",
+ tag, frame, subframe,
+ tt->tm_hour, tt->tm_min, tt->tm_sec, t.tv_nsec);
+ continue;
+ }
+
+ if (cur_frame != frame || cur_subframe != subframe)
+ if (cur_frame != -1)
+ process_cache(out, cache, number_of_tags, cur_frame, cur_subframe);
+
+ cur_frame = frame;
+ cur_subframe = subframe;
+
+ if (cache[tag].filled) {
+ struct tm *tt;
+ tt = localtime(&t.tv_sec);
+ printf("ERROR: tag %d present twice at frame %d subframe %d (time %2.2d:%2.2d:%2.2d.%9.9ld)\n",
+ tag, frame, subframe,
+ tt->tm_hour, tt->tm_min, tt->tm_sec, t.tv_nsec);
+ cache[tag].error = 1;
+ continue;
+ }
+
+ store_in_cache(cache, tag, &ebuf);
+ cache[tag].filled = 1;
+ cache[tag].t = t;
+ }
+
+ if (fclose(in)) perror(input_filename);
+ if (fclose(out)) perror(output_filename);
+ free(cache);
+
+ return 0;
+}
diff --git a/common/utils/T/tracer/logger/logger.h b/common/utils/T/tracer/logger/logger.h
index 434cf5a90f..7c019b4797 100644
--- a/common/utils/T/tracer/logger/logger.h
+++ b/common/utils/T/tracer/logger/logger.h
@@ -30,6 +30,7 @@ void framelog_set_skip(logger *_this, int skip_delay);
void framelog_set_update_only_at_sf9(logger *_this, int update_only_at_sf9);
void textlog_dump_buffer(logger *_this, int dump_buffer);
+void textlog_raw_time(logger *_this, int raw_time);
#include "view/view.h"
diff --git a/common/utils/T/tracer/logger/textlog.c b/common/utils/T/tracer/logger/textlog.c
index 9eb6fd02d8..76f920e1e2 100644
--- a/common/utils/T/tracer/logger/textlog.c
+++ b/common/utils/T/tracer/logger/textlog.c
@@ -33,6 +33,7 @@ struct textlog {
/* local output buffer */
OBUF o;
int dump_buffer;
+ int raw_time;
};
static void _event(void *p, event e)
@@ -51,9 +52,13 @@ static void _event(void *p, event e)
#ifdef T_SEND_TIME
t = localtime(&e.sending_time.tv_sec);
- /* round tv_nsec to nearest millisecond */
- sprintf(tt, "%2.2d:%2.2d:%2.2d.%9.9ld: ", t->tm_hour, t->tm_min, t->tm_sec,
- e.sending_time.tv_nsec);
+ if (l->raw_time)
+ sprintf(tt, "%2.2d:%2.2d:%2.2d.%9.9ld [%ld]: ",
+ t->tm_hour, t->tm_min, t->tm_sec,
+ e.sending_time.tv_nsec, e.sending_time.tv_sec);
+ else
+ sprintf(tt, "%2.2d:%2.2d:%2.2d.%9.9ld: ", t->tm_hour, t->tm_min, t->tm_sec,
+ e.sending_time.tv_nsec);
PUTS(&l->o, tt);
#endif
@@ -215,3 +220,9 @@ void textlog_dump_buffer(logger *_this, int dump_buffer)
struct textlog *l = _this;
l->dump_buffer = dump_buffer;
}
+
+void textlog_raw_time(logger *_this, int raw_time)
+{
+ struct textlog *l = _this;
+ l->raw_time = raw_time;
+}
diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c
index 954f668aa4..8720efd8c0 100644
--- a/common/utils/T/tracer/macpdu2wireshark.c
+++ b/common/utils/T/tracer/macpdu2wireshark.c
@@ -14,6 +14,11 @@
#define DEFAULT_IP "127.0.0.1"
#define DEFAULT_PORT 9999
+#define DEFAULT_LIVE_IP "127.0.0.1"
+#define DEFAULT_LIVE_PORT 2021
+
+#define NO_PREAMBLE -1
+
typedef struct {
int socket;
struct sockaddr_in to;
@@ -28,142 +33,241 @@ typedef struct {
int dl_frame;
int dl_subframe;
int dl_data;
+ /* mib */
+ int mib_frame;
+ int mib_subframe;
+ int mib_data;
+ /* RA preamble */
+ int preamble_frame;
+ int preamble_subframe;
+ int preamble_preamble;
+ /* RAR */
+ int rar_rnti;
+ int rar_frame;
+ int rar_subframe;
+ int rar_data;
+ /* config */
+ int no_mib;
+ int no_sib;
+ int max_mib;
+ int max_sib;
+ int live;
+ /* runtime vars */
+ int cur_mib;
+ int cur_sib;
} ev_data;
-void ul(void *_d, event e)
-{
- ev_data *d = _d;
+void trace(ev_data *d, int direction, int rnti_type, int rnti,
+ int frame, int subframe, void *buf, int bufsize, int preamble) {
ssize_t ret;
int fsf;
int i;
-
d->buf.osize = 0;
-
PUTS(&d->buf, MAC_LTE_START_STRING);
PUTC(&d->buf, FDD_RADIO);
- PUTC(&d->buf, DIRECTION_UPLINK);
- PUTC(&d->buf, C_RNTI);
+ PUTC(&d->buf, direction);
+ PUTC(&d->buf, rnti_type);
- PUTC(&d->buf, MAC_LTE_RNTI_TAG);
- PUTC(&d->buf, (e.e[d->ul_rnti].i>>8) & 255);
- PUTC(&d->buf, e.e[d->ul_rnti].i & 255);
+ if (rnti_type == C_RNTI || rnti_type == RA_RNTI) {
+ PUTC(&d->buf, MAC_LTE_RNTI_TAG);
+ PUTC(&d->buf, (rnti>>8) & 255);
+ PUTC(&d->buf, rnti & 255);
+ }
/* for newer version of wireshark? */
- fsf = (e.e[d->ul_frame].i << 4) + e.e[d->ul_subframe].i;
+ fsf = (frame << 4) + subframe;
/* for older version? */
- fsf = e.e[d->ul_subframe].i;
+ //fsf = subframe;
PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
PUTC(&d->buf, (fsf>>8) & 255);
PUTC(&d->buf, fsf & 255);
+ if (preamble != NO_PREAMBLE) {
+ PUTC(&d->buf, MAC_LTE_SEND_PREAMBLE_TAG);
+ PUTC(&d->buf, preamble);
+ PUTC(&d->buf, 0); /* rach attempt - always 0 for us (not sure of this) */
+ }
+
PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
- for (i = 0; i < e.e[d->ul_data].bsize; i++)
- PUTC(&d->buf, ((char*)e.e[d->ul_data].b)[i]);
+
+ for (i = 0; i < bufsize; i++)
+ PUTC(&d->buf, ((char *)buf)[i]);
ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0,
- (struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
+ (struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
+
if (ret != d->buf.osize) abort();
}
-void dl(void *_d, event e)
-{
+void ul(void *_d, event e) {
ev_data *d = _d;
- ssize_t ret;
- int fsf;
- int i;
-
- d->buf.osize = 0;
-
- PUTS(&d->buf, MAC_LTE_START_STRING);
- PUTC(&d->buf, FDD_RADIO);
- PUTC(&d->buf, DIRECTION_DOWNLINK);
- PUTC(&d->buf, C_RNTI);
-
- PUTC(&d->buf, MAC_LTE_RNTI_TAG);
- PUTC(&d->buf, (e.e[d->dl_rnti].i>>8) & 255);
- PUTC(&d->buf, e.e[d->dl_rnti].i & 255);
-
- /* for newer version of wireshark? */
- fsf = (e.e[d->dl_frame].i << 4) + e.e[d->dl_subframe].i;
- /* for older version? */
- fsf = e.e[d->dl_subframe].i;
- PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
- PUTC(&d->buf, (fsf>>8) & 255);
- PUTC(&d->buf, fsf & 255);
-
- PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
- for (i = 0; i < e.e[d->dl_data].bsize; i++)
- PUTC(&d->buf, ((char*)e.e[d->dl_data].b)[i]);
-
- ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0,
- (struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
- if (ret != d->buf.osize) abort();
+ trace(d, DIRECTION_UPLINK, C_RNTI, e.e[d->ul_rnti].i,
+ e.e[d->ul_frame].i, e.e[d->ul_subframe].i,
+ e.e[d->ul_data].b, e.e[d->ul_data].bsize,
+ NO_PREAMBLE);
}
-void setup_data(ev_data *d, void *database, int ul_id, int dl_id)
-{
+void dl(void *_d, event e) {
+ ev_data *d = _d;
+
+ if (e.e[d->dl_rnti].i == 0xffff) {
+ if (d->no_sib) return;
+
+ if (d->max_sib && d->cur_sib == d->max_sib) return;
+
+ d->cur_sib++;
+ }
+
+ trace(d, DIRECTION_DOWNLINK,
+ e.e[d->dl_rnti].i != 0xffff ? C_RNTI : SI_RNTI, e.e[d->dl_rnti].i,
+ e.e[d->dl_frame].i, e.e[d->dl_subframe].i,
+ e.e[d->dl_data].b, e.e[d->dl_data].bsize,
+ NO_PREAMBLE);
+}
+
+void mib(void *_d, event e) {
+ ev_data *d = _d;
+
+ if (d->no_mib) return;
+
+ if (d->max_mib && d->cur_mib == d->max_mib) return;
+
+ d->cur_mib++;
+ trace(d, DIRECTION_DOWNLINK, NO_RNTI, 0,
+ e.e[d->mib_frame].i, e.e[d->mib_subframe].i,
+ e.e[d->mib_data].b, e.e[d->mib_data].bsize,
+ NO_PREAMBLE);
+}
+
+void preamble(void *_d, event e) {
+ ev_data *d = _d;
+ trace(d, DIRECTION_UPLINK, NO_RNTI, 0,
+ e.e[d->preamble_frame].i, e.e[d->preamble_subframe].i,
+ NULL, 0,
+ e.e[d->preamble_preamble].i);
+}
+
+void rar(void *_d, event e) {
+ ev_data *d = _d;
+ trace(d, DIRECTION_DOWNLINK, RA_RNTI, e.e[d->rar_rnti].i,
+ e.e[d->rar_frame].i, e.e[d->rar_subframe].i,
+ e.e[d->rar_data].b, e.e[d->rar_data].bsize,
+ NO_PREAMBLE);
+}
+
+void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id,
+ int preamble_id, int rar_id) {
database_event_format f;
int i;
-
- d->ul_rnti = -1;
- d->ul_frame = -1;
- d->ul_subframe = -1;
- d->ul_data = -1;
-
- d->dl_rnti = -1;
- d->dl_frame = -1;
- d->dl_subframe = -1;
- d->dl_data = -1;
-
+ d->ul_rnti = -1;
+ d->ul_frame = -1;
+ d->ul_subframe = -1;
+ d->ul_data = -1;
+ d->dl_rnti = -1;
+ d->dl_frame = -1;
+ d->dl_subframe = -1;
+ d->dl_data = -1;
+ d->mib_frame = -1;
+ d->mib_subframe = -1;
+ d->mib_data = -1;
+ d->preamble_frame = -1;
+ d->preamble_subframe = -1;
+ d->preamble_preamble = -1;
+ d->rar_rnti = -1;
+ d->rar_frame = -1;
+ d->rar_subframe = -1;
+ d->rar_data = -1;
#define G(var_name, var_type, var) \
if (!strcmp(f.name[i], var_name)) { \
if (strcmp(f.type[i], var_type)) goto error; \
var = i; \
continue; \
}
-
/* ul: rnti, frame, subframe, data */
f = get_format(database, ul_id);
+
for (i = 0; i < f.count; i++) {
G("rnti", "int", d->ul_rnti);
G("frame", "int", d->ul_frame);
G("subframe", "int", d->ul_subframe);
G("data", "buffer", d->ul_data);
}
+
if (d->ul_rnti == -1 || d->ul_frame == -1 || d->ul_subframe == -1 ||
d->ul_data == -1) goto error;
/* dl: rnti, frame, subframe, data */
f = get_format(database, dl_id);
+
for (i = 0; i < f.count; i++) {
G("rnti", "int", d->dl_rnti);
G("frame", "int", d->dl_frame);
G("subframe", "int", d->dl_subframe);
G("data", "buffer", d->dl_data);
}
+
if (d->dl_rnti == -1 || d->dl_frame == -1 || d->dl_subframe == -1 ||
d->dl_data == -1) goto error;
+ /* MIB: frame, subframe, data */
+ f = get_format(database, mib_id);
+
+ for (i = 0; i < f.count; i++) {
+ G("frame", "int", d->mib_frame);
+ G("subframe", "int", d->mib_subframe);
+ G("data", "buffer", d->mib_data);
+ }
+
+ if (d->mib_frame == -1 || d->mib_subframe == -1 || d->mib_data == -1)
+ goto error;
+
+ /* preamble: frame, subframe, preamble */
+ f = get_format(database, preamble_id);
+
+ for (i = 0; i < f.count; i++) {
+ G("frame", "int", d->preamble_frame);
+ G("subframe", "int", d->preamble_subframe);
+ G("preamble", "int", d->preamble_preamble);
+ }
+
+ if (d->preamble_frame == -1 || d->preamble_subframe == -1 ||
+ d->preamble_preamble == -1) goto error;
+
+ /* rar: rnti, frame, subframe, data */
+ f = get_format(database, rar_id);
+
+ for (i = 0; i < f.count; i++) {
+ G("rnti", "int", d->rar_rnti);
+ G("frame", "int", d->rar_frame);
+ G("subframe", "int", d->rar_subframe);
+ G("data", "buffer", d->rar_data);
+ }
+
+ if (d->rar_rnti == -1 || d->rar_frame == -1 || d->rar_subframe == -1 ||
+ d->rar_data == -1) goto error;
+
#undef G
-
return;
-
error:
printf("bad T_messages.txt\n");
abort();
}
-void *receiver(void *_d)
-{
+void *receiver(void *_d) {
ev_data *d = _d;
int s;
char buf[100000];
-
s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s == -1) { perror("socket"); abort(); }
- if (bind(s, (struct sockaddr *)&d->to, sizeof(struct sockaddr_in)) == -1)
- { perror("bind"); abort(); }
+ if (s == -1) {
+ perror("socket");
+ abort();
+ }
+
+ if (bind(s, (struct sockaddr *)&d->to, sizeof(struct sockaddr_in)) == -1) {
+ perror("bind");
+ abort();
+ }
while (1) {
if (recv(s, buf, 100000, 0) <= 0) abort();
@@ -172,43 +276,120 @@ void *receiver(void *_d)
return 0;
}
-void usage(void)
-{
+void usage(void) {
printf(
-"options:\n"
-" -d this option is mandatory\n"
-" -i read events from this dump file\n"
-" -ip send packets to this IP address (default %s)\n"
-" -p send packets to this port (default %d)\n",
- DEFAULT_IP,
- DEFAULT_PORT
+ "options:\n"
+ " -d this option is mandatory\n"
+ " -i read events from this dump file\n"
+ " -ip send packets to this IP address (default %s)\n"
+ " -p send packets to this port (default %d)\n"
+ " -no-mib do not report MIB\n"
+ " -no-sib do not report SIBs\n"
+ " -max-mib report at maximum n MIB\n"
+ " -max-sib report at maximum n SIBs\n"
+ " -live run live\n"
+ " -live-ip tracee's IP address (default %s)\n"
+ " -live-port tracee's port (default %d)\n"
+ "-i and -live are mutually exclusive options. One of them must be provided\n"
+ "but not both.\n",
+ DEFAULT_IP,
+ DEFAULT_PORT,
+ DEFAULT_LIVE_IP,
+ DEFAULT_LIVE_PORT
);
exit(1);
}
-int main(int n, char **v)
-{
+int main(int n, char **v) {
char *database_filename = NULL;
char *input_filename = NULL;
void *database;
event_handler *h;
int in;
int i;
- int ul_id, dl_id;
+ int ul_id, dl_id, mib_id = -1, preamble_id, rar_id;
ev_data d;
char *ip = DEFAULT_IP;
int port = DEFAULT_PORT;
-
+ char *live_ip = DEFAULT_LIVE_IP;
+ int live_port = DEFAULT_LIVE_PORT;
+ int live = 0;
memset(&d, 0, sizeof(ev_data));
for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
- if (!strcmp(v[i], "-d"))
- { if (i > n-2) usage(); database_filename = v[++i]; continue; }
- if (!strcmp(v[i], "-i"))
- { if (i > n-2) usage(); input_filename = v[++i]; continue; }
- if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
- if (!strcmp(v[i], "-p")) {if(i>n-2)usage(); port=atoi(v[++i]); continue; }
+
+ if (!strcmp(v[i], "-d")) {
+ if (i > n-2) usage();
+
+ database_filename = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-i")) {
+ if (i > n-2) usage();
+
+ input_filename = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-ip")) {
+ if (i > n-2) usage();
+
+ ip = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-p")) {
+ if(i>n-2)usage();
+
+ port=atoi(v[++i]);
+ continue;
+ }
+
+ if (!strcmp(v[i], "-no-mib")) {
+ d.no_mib = 1;
+ continue;
+ }
+
+ if (!strcmp(v[i], "-no-sib")) {
+ d.no_sib = 1;
+ continue;
+ }
+
+ if (!strcmp(v[i], "-max-mib")) {
+ if (i > n-2) usage();
+
+ d.max_mib = atoi(v[++i]);
+ continue;
+ }
+
+ if (!strcmp(v[i], "-max-sib")) {
+ if (i > n-2) usage();
+
+ d.max_sib = atoi(v[++i]);
+ continue;
+ }
+
+ if (!strcmp(v[i], "-live")) {
+ live = 1;
+ continue;
+ }
+
+ if (!strcmp(v[i], "-live-ip")) {
+ if (i > n-2) usage();
+
+ live_ip = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-live-port")) {
+ if (i > n-2) usage();
+
+ live_port = atoi(v[++i]);
+ continue;
+ }
+
usage();
}
@@ -217,43 +398,91 @@ int main(int n, char **v)
exit(1);
}
- if (input_filename == NULL) {
- printf("ERROR: provide an input file (-i)\n");
+ if (input_filename == NULL && live == 0) {
+ printf("ERROR: provide an input file (-i) or run live (-live)\n");
exit(1);
}
- in = open(input_filename, O_RDONLY);
- if (in == -1) { perror(input_filename); return 1; }
+ if (input_filename != NULL && live != 0) {
+ printf("ERROR: cannot use both -i and -live\n");
+ exit(1);
+ }
+
+ if (live == 0) {
+ in = open(input_filename, O_RDONLY);
+
+ if (in == -1) {
+ perror(input_filename);
+ return 1;
+ }
+ } else
+ in = connect_to(live_ip, live_port);
database = parse_database(database_filename);
load_config_file(database_filename);
-
h = new_handler(database);
+ if (live) {
+ char mt = 1;
+ int number_of_events = number_of_ids(database);
+ int *is_on = calloc(number_of_events, sizeof(int));
+
+ if (is_on == NULL) {
+ printf("ERROR: out of memory\n");
+ exit(1);
+ }
+
+ on_off(database, "ENB_MAC_UE_UL_PDU_WITH_DATA", is_on, 1);
+ on_off(database, "ENB_MAC_UE_DL_PDU_WITH_DATA", is_on, 1);
+ on_off(database, "ENB_PHY_MIB", is_on, 1);
+ on_off(database, "ENB_PHY_INITIATE_RA_PROCEDURE", is_on, 1);
+ on_off(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA", is_on, 1);
+
+ /* activate selected traces */
+ if (socket_send(in, &mt, 1) == -1 ||
+ socket_send(in, &number_of_events, sizeof(int)) == -1 ||
+ socket_send(in, is_on, number_of_events * sizeof(int)) == -1) {
+ printf("ERROR: socket_send failed\n");
+ exit(1);
+ }
+
+ free(is_on);
+ }
+
ul_id = event_id_from_name(database, "ENB_MAC_UE_UL_PDU_WITH_DATA");
dl_id = event_id_from_name(database, "ENB_MAC_UE_DL_PDU_WITH_DATA");
- setup_data(&d, database, ul_id, dl_id);
-
+ mib_id = event_id_from_name(database, "ENB_PHY_MIB");
+ preamble_id = event_id_from_name(database, "ENB_PHY_INITIATE_RA_PROCEDURE");
+ rar_id = event_id_from_name(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA");
+ setup_data(&d, database, ul_id, dl_id, mib_id, preamble_id, rar_id);
register_handler_function(h, ul_id, ul, &d);
register_handler_function(h, dl_id, dl, &d);
-
+ register_handler_function(h, mib_id, mib, &d);
+ register_handler_function(h, preamble_id, preamble, &d);
+ register_handler_function(h, rar_id, rar, &d);
d.socket = socket(AF_INET, SOCK_DGRAM, 0);
- if (d.socket == -1) { perror("socket"); exit(1); }
+
+ if (d.socket == -1) {
+ perror("socket");
+ exit(1);
+ }
d.to.sin_family = AF_INET;
d.to.sin_port = htons(port);
d.to.sin_addr.s_addr = inet_addr(ip);
-
new_thread(receiver, &d);
-
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
/* read messages */
while (1) {
event e;
e = get_event(in, &ebuf, database);
+
if (e.type == -1) break;
- if (!(e.type == ul_id || e.type == dl_id)) continue;
+
+ if (!(e.type == ul_id || e.type == dl_id || e.type == mib_id ||
+ e.type == preamble_id || e.type == rar_id)) continue;
+
handle_event(h, e);
}
diff --git a/common/utils/T/tracer/textlog.c b/common/utils/T/tracer/textlog.c
index bb773b4215..f83cc7efd3 100644
--- a/common/utils/T/tracer/textlog.c
+++ b/common/utils/T/tracer/textlog.c
@@ -52,6 +52,7 @@ void usage(void)
" they will be processed in order\n"
" by default, all is off\n"
" -full also dump buffers' content\n"
+" -raw-time also prints 'raw time'\n"
" -ip connect to given IP address (default %s)\n"
" -p connect to given port (default %d)\n"
" -x GUI output\n"
@@ -91,6 +92,7 @@ int main(int n, char **v)
int gui_active = 1;
textlog_data textlog_data;
int full = 0;
+ int raw_time = 0;
/* write on a socket fails if the other end is closed and we get SIGPIPE */
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
@@ -117,6 +119,7 @@ int main(int n, char **v)
if (!strcmp(v[i], "-debug-gui")) { gui_logd = 1; continue; }
if (!strcmp(v[i], "-no-gui")) { gui_active = 0; continue; }
if (!strcmp(v[i], "-full")) { full = 1; continue; }
+ if (!strcmp(v[i], "-raw-time")) { raw_time = 1; continue; }
usage();
}
@@ -162,6 +165,7 @@ int main(int n, char **v)
// "ev: {} eNB_id [eNB_ID] frame [frame] subframe [subframe]");
logger_add_view(textlog, out);
if (full) textlog_dump_buffer(textlog, 1);
+ if (raw_time) textlog_raw_time(textlog, 1);
free(name);
free(desc);
}
@@ -187,9 +191,12 @@ int main(int n, char **v)
while (1) {
event e;
e = get_event(textlog_data.socket, &ebuf, database);
- if (e.type == -1) abort();
+ if (e.type == -1) break;
handle_event(h, e);
}
+ free(on_off_name);
+ free(on_off_action);
+
return 0;
}
diff --git a/common/utils/T/tracer/ue.c b/common/utils/T/tracer/ue.c
index 7b03210cd2..bafa0384f2 100644
--- a/common/utils/T/tracer/ue.c
+++ b/common/utils/T/tracer/ue.c
@@ -23,9 +23,6 @@ typedef struct {
view *pdcpview;
view *rrcview;
view *legacy;
- widget *current_ue_label;
- widget *prev_ue_button;
- widget *next_ue_button;
widget *pdsch_iq_ue_xy_plot;
widget *dl_estimate_ue_xy_plot;
widget *pdcch_energy_ue_xy_plot;
@@ -121,15 +118,14 @@ static void *gui_thread(void *_g)
return NULL;
}
-static filter *ticktime_filter(void *database, char *event, int i, int ue)
+static filter *ticktime_filter(void *database, char *event, int i)
{
- /* filter is "harq_pid == i && UE_id == 0 && eNB_id == 0" */
+ /* filter is "harq_pid == i and eNB_id == 0" */
return
filter_and(
filter_eq(filter_evarg(database, event, "harq_pid"), filter_int(i)),
- filter_and(
- filter_eq(filter_evarg(database, event, "UE_id"), filter_int(ue)),
- filter_eq(filter_evarg(database, event, "eNB_ID"), filter_int(0))));
+ filter_eq(filter_evarg(database, event, "eNB_ID"), filter_int(0)));
+
}
static void set_current_ue(gui *g, ue_data *e, int ue)
@@ -137,8 +133,6 @@ static void set_current_ue(gui *g, ue_data *e, int ue)
int i;
char s[256];
- sprintf(s, "[UE %d] ", ue);
- label_set_text(g, e->e->current_ue_label, s);
sprintf(s, "PDSCH IQ [UE %d]", ue);
xy_plot_set_title(g, e->e->pdsch_iq_ue_xy_plot, s);
sprintf(s, "DL estimated channel [UE %d]", ue);
@@ -161,97 +155,24 @@ static void set_current_ue(gui *g, ue_data *e, int ue)
xy_plot_set_title(g, e->e->pucch_power_xy_plot, s);
sprintf(s, "PHY Measurements [UE %d]", ue);
xy_plot_set_title(g, e->e->phy_meas_xy_plot, s);
-
- logger_set_filter(e->e->pdsch_iq_ue_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PDSCH_IQ", "UE_ID"),
- filter_int(ue)));
- logger_set_filter(e->e->dl_estimate_ue_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_DL_CHANNEL_ESTIMATE", "UE_ID"),
- filter_int(ue)));
- logger_set_filter(e->e->pdcch_energy_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PDCCH_ENERGY", "UE_ID"),
- filter_int(ue)));
- logger_set_filter(e->e->pdsch_energy_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PDSCH_ENERGY", "UE_ID"),
- filter_int(ue)));
- logger_set_filter(e->e->phy_meas_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_MEAS", "UE_ID"),
- filter_int(ue)));
- /*logger_set_filter(e->pucch1_energy_ue_energy_logger,
- filter_eq(
- filter_evarg(e->database, "ENB_PHY_PUCCH_1_ENERGY", "UE_ID"),
- filter_int(ue)));*/
- /*logger_set_filter(e->e->pdcch_iq_ue_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PDCCH_IQ", "UE_ID"),
- filter_int(ue)));*/
+
for (i = 0; i < 8; i++) {
logger_set_filter(e->e->dl_dci_logger[i],
- ticktime_filter(e->database, "UE_PHY_DLSCH_UE_DCI", i, ue));
+ ticktime_filter(e->database, "UE_PHY_DLSCH_UE_DCI", i));
logger_set_filter(e->e->dl_ack_logger[i],
- ticktime_filter(e->database, "UE_PHY_DLSCH_UE_ACK", i, ue));
+ ticktime_filter(e->database, "UE_PHY_DLSCH_UE_ACK", i));
logger_set_filter(e->e->dl_nack_logger[i],
- ticktime_filter(e->database, "UE_PHY_DLSCH_UE_NACK", i, ue));
+ ticktime_filter(e->database, "UE_PHY_DLSCH_UE_NACK", i));
logger_set_filter(e->e->ul_dci_logger[i],
- ticktime_filter(e->database, "UE_PHY_ULSCH_UE_DCI", i, ue));
+ ticktime_filter(e->database, "UE_PHY_ULSCH_UE_DCI", i));
/*logger_set_filter(e->ul_dci_retransmission_logger[i],
ticktime_filter(e->database,
- "ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", i, ue));*/
+ "ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", i));*/
logger_set_filter(e->e->ul_ack_logger[i],
- ticktime_filter(e->database, "UE_PHY_ULSCH_UE_ACK", i, ue));
+ ticktime_filter(e->database, "UE_PHY_ULSCH_UE_ACK", i));
logger_set_filter(e->e->ul_nack_logger[i],
- ticktime_filter(e->database, "UE_PHY_ULSCH_UE_NACK", i, ue));
+ ticktime_filter(e->database, "UE_PHY_ULSCH_UE_NACK", i));
}
- logger_set_filter(e->e->dl_mcs_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_DLSCH_UE_DCI", "UE_id"),
- filter_int(ue)));
- logger_set_filter(e->e->ul_mcs_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_ULSCH_UE_DCI", "UE_id"),
- filter_int(ue)));
- logger_set_filter(e->e->pusch_power_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PUSCH_TX_POWER", "UE_id"),
- filter_int(ue)));
- logger_set_filter(e->e->pusch_ampl_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PUSCH_TX_POWER", "UE_id"),
- filter_int(ue)));
- logger_set_filter(e->e->pucch_power_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PUCCH_TX_POWER", "UE_id"),
- filter_int(ue)));
- logger_set_filter(e->e->pucch_ampl_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PUCCH_TX_POWER", "UE_id"),
- filter_int(ue)));
-}
-
-static void click(void *private, gui *g,
- char *notification, widget *w, void *notification_data)
-{
- int *d = notification_data;
- int button = d[0];
- ue_data *ed = private;
- ue_gui *e = ed->e;
- int ue = ed->ue;
-
- if (button != 1) return;
- if (w == e->prev_ue_button) { ue--; if (ue < 0) ue = 0; }
- if (w == e->next_ue_button) ue++;
-
- if (pthread_mutex_lock(&ed->lock)) abort();
- if (ue != ed->ue) {
- set_current_ue(g, ed, ue);
- ed->ue = ue;
- }
- if (pthread_mutex_unlock(&ed->lock)) abort();
}
static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
@@ -271,7 +192,7 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
widget *text;
view *textview;
int i;
- widget *w, *w2;
+ widget *w;
view *v;
logger *l;
@@ -283,24 +204,8 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
widget_add_child(g, top_container, line, -1);
logo = new_image(g, openair_logo_png, openair_logo_png_len);
- /* logo + prev/next UE buttons */
- col = new_container(g, VERTICAL);
- widget_add_child(g, col, logo, -1);
- w = new_container(g, HORIZONTAL);
- widget_add_child(g, col, w, -1);
- w2 = new_label(g, "");
- widget_add_child(g, w, w2, -1);
- e->current_ue_label = w2;
- /* TODO: use button widget, not label widget */
- w2 = new_label(g, " [prev UE] ");
- widget_add_child(g, w, w2, -1);
- label_set_clickable(g, w2, 1);
- e->prev_ue_button = w2;
- w2 = new_label(g, " [next UE] ");
- widget_add_child(g, w, w2, -1);
- label_set_clickable(g, w2, 1);
- e->next_ue_button = w2;
- widget_add_child(g, line, col, -1);
+ /* logo */
+ widget_add_child(g, line, logo, -1);
input_signal_plot = new_xy_plot(g, 256, 55, "input signal", 20);
widget_add_child(g, line, input_signal_plot, -1);
@@ -356,80 +261,13 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
v = new_view_tti(10, g, w, new_color(g, "#0c720c"));
logger_add_view(l, v);
e->phy_meas_logger = l;
-
- /* UE x PDSCH energy */
- w = new_xy_plot(g, 128, 55, "", 50);
- e->pdsch_energy_ue_xy_plot = w;
+
+ /* a bit of space */
+ line = new_container(g, HORIZONTAL);
+ widget_add_child(g, top_container, line, -1);
+ w = new_space(g, 1, 10);
widget_add_child(g, line, w, -1);
- xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
- l = new_ttilog(h, database,
- "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level00", 1);
- v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
- logger_add_view(l, v);
- e->pdsch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level01", 1);
- v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
- logger_add_view(l, v);
- e->pdsch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level10", 1);
- v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
- logger_add_view(l, v);
- e->pdsch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level11", 1);
- v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
- logger_add_view(l, v);
- e->pdsch_energy_logger = l;
-
- /* UE x PDCCH energy */
- w = new_xy_plot(g, 128, 55, "", 50);
- e->pdcch_energy_ue_xy_plot = w;
- widget_add_child(g, line, w, -1);
- xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
- l = new_ttilog(h, database,
- "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level00", 1);
- v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
- logger_add_view(l, v);
- e->pdcch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level01", 1);
- v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
- logger_add_view(l, v);
- e->pdcch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level10", 1);
- v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
- logger_add_view(l, v);
- e->pdcch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level11", 1);
- v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
- logger_add_view(l, v);
- e->pdcch_energy_logger = l;
-
- /* UE x PDCCH IQ data */
- w = new_xy_plot(g, 55, 55, "", 50);
- e->pdcch_iq_ue_xy_plot = w;
- widget_add_child(g, line, w, -1);
- xy_plot_set_range(g, w, -100, 100, -100, 100);
- l = new_iqlog(h, database, "UE_PHY_PDCCH_IQ", "nb_rb",
- "NB_RB_DL", "symbols_per_tti", "rxdataF_comp");
- v = new_view_xy(100*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
- logger_add_view(l, v);
- e->pdcch_iq_ue_logger = l;
-
- /* UE x PDCCH IQ data */
- /*w = new_xy_plot(g, 55, 55, "", 50);
- e->pdcch_iq_ue_xy_plot = w;
- widget_add_child(g, line, w, -1);
- xy_plot_set_range(g, w, -2000, 2000, -2000, 2000);
- l = new_iqdotlog(h, database, "UE_PHY_PDCCH_IQ", "I", "Q");
- v = new_view_xy(500, 10, g, w, new_color(g,"#000"), XY_LOOP_MODE);
- logger_add_view(l, v);
- e->pdcch_iq_ue_logger = l;*/
-
+
/* UE x DL mcs */
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
@@ -448,7 +286,7 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
xy_plot_set_range(g, w, 0, 1024*10, -2, 30);
e->ul_mcs_xy_plot = w;
widget_add_child(g, line, w, -1);
- l = new_ticked_ttilog(h, database, "UE_PHY_UL_TICK", "frame", "subframe",
+ l = new_ticked_ttilog(h, database, "UE_PHY_DL_TICK", "frame", "subframe",
"UE_PHY_ULSCH_UE_DCI", "mcs", 0, -1);
v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
logger_add_view(l, v);
@@ -471,7 +309,7 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
v = new_view_tti(10, g, w, new_color(g, "#720c0c"));
logger_add_view(l, v);
e->pusch_ampl_logger = l;
-
+
/* UE x PUCCH TX Power */
// line = new_container(g, HORIZONTAL);
// widget_add_child(g, top_container, line, -1);
@@ -489,8 +327,81 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
v = new_view_tti(10, g, w, new_color(g, "#720c0c"));
logger_add_view(l, v);
e->pucch_ampl_logger = l;
-
-
+
+ /* UE x PDSCH energy */
+ w = new_xy_plot(g, 128, 55, "", 50);
+ e->pdsch_energy_ue_xy_plot = w;
+ widget_add_child(g, line, w, -1);
+ xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
+ l = new_ttilog(h, database,
+ "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level00", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
+ logger_add_view(l, v);
+ e->pdsch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level01", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
+ logger_add_view(l, v);
+ e->pdsch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level10", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
+ logger_add_view(l, v);
+ e->pdsch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level11", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
+ logger_add_view(l, v);
+ e->pdsch_energy_logger = l;
+
+ /* UE x PDCCH energy */
+ w = new_xy_plot(g, 128, 55, "", 50);
+ e->pdcch_energy_ue_xy_plot = w;
+ widget_add_child(g, line, w, -1);
+ xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
+ l = new_ttilog(h, database,
+ "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level00", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
+ logger_add_view(l, v);
+ e->pdcch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level01", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
+ logger_add_view(l, v);
+ e->pdcch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level10", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
+ logger_add_view(l, v);
+ e->pdcch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level11", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
+ logger_add_view(l, v);
+ e->pdcch_energy_logger = l;
+
+ /* UE x PDCCH IQ data */
+ w = new_xy_plot(g, 55, 55, "", 50);
+ e->pdcch_iq_ue_xy_plot = w;
+ widget_add_child(g, line, w, -1);
+ xy_plot_set_range(g, w, -100, 100, -100, 100);
+ l = new_iqlog(h, database, "UE_PHY_PDCCH_IQ", "nb_rb",
+ "NB_RB_DL", "symbols_per_tti", "rxdataF_comp");
+ v = new_view_xy(100*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
+ logger_add_view(l, v);
+ e->pdcch_iq_ue_logger = l;
+
+ /* UE x PDCCH IQ data */
+ /*w = new_xy_plot(g, 55, 55, "", 50);
+ e->pdcch_iq_ue_xy_plot = w;
+ widget_add_child(g, line, w, -1);
+ xy_plot_set_range(g, w, -2000, 2000, -2000, 2000);
+ l = new_iqdotlog(h, database, "UE_PHY_PDCCH_IQ", "I", "Q");
+ v = new_view_xy(500, 10, g, w, new_color(g,"#000"), XY_LOOP_MODE);
+ logger_add_view(l, v);
+ e->pdcch_iq_ue_logger = l;*/
+
+
/* downlink/uplink UE DCIs */
widget_add_child(g, top_container,
new_label(g,"DL/UL TICK/DCI/ACK/NACK [all UEs]"), -1);
@@ -600,14 +511,14 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
logger_add_view(timelog, subview);
e->ul_dci_logger[i] = timelog;
/* retransmission */
-
+
timelog = new_ticklog(h, database,
"ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", "frame", "subframe");
subview = new_subview_ticktime(timeview, i+9+1,
new_color(g,"#99f"), 3600*1000);
logger_add_view(timelog, subview);
e->ul_dci_retransmission_logger[i] = timelog;
-
+
}
/* UL ACK */
@@ -707,8 +618,6 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
#endif
set_current_ue(g, ed, 0);
- register_notifier(g, "click", e->prev_ue_button, click, ed);
- register_notifier(g, "click", e->next_ue_button, click, ed);
}
void view_add_log(view *v, char *log, event_handler *h, void *database,
@@ -824,13 +733,11 @@ int main(int n, char **v)
on_off(database, "UE_PHY_PUSCH_TX_POWER", is_on, 1);
on_off(database, "UE_PHY_PUCCH_TX_POWER", is_on, 1);
on_off(database, "UE_PHY_MEAS", is_on, 1);
-
+
on_off(database, "LEGACY_GROUP_INFO", is_on, 1);
on_off(database, "LEGACY_GROUP_ERROR", is_on, 1);
on_off(database, "LEGACY_GROUP_WARNING", is_on, 1);
-
- view_add_log(eg.phyview, "UE_PHY_UL_TICK", h, database, is_on);
- view_add_log(eg.phyview, "UE_PHY_DL_TICK", h, database, is_on);
+
view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_DCI", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_ACK", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_NACK",h, database, is_on);
@@ -838,8 +745,6 @@ int main(int n, char **v)
view_add_log(eg.phyview, "UE_PHY_ULSCH_UE_ACK", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_ULSCH_UE_NACK", h, database, is_on);
-
-
/* deactivate those two by default, they are a bit heavy */
//on_off(database, "ENB_MAC_UE_UL_SDU_WITH_DATA", is_on, 0);
//on_off(database, "ENB_MAC_UE_UL_PDU_WITH_DATA", is_on, 0);
diff --git a/common/utils/T/tracer/utils.c b/common/utils/T/tracer/utils.c
index 7f58b6f5aa..39e04fb973 100644
--- a/common/utils/T/tracer/utils.c
+++ b/common/utils/T/tracer/utils.c
@@ -9,27 +9,38 @@
#include
#include
-void new_thread(void *(*f)(void *), void *data)
-{
+void new_thread(void *(*f)(void *), void *data) {
pthread_t t;
pthread_attr_t att;
- if (pthread_attr_init(&att))
- { fprintf(stderr, "pthread_attr_init err\n"); exit(1); }
- if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED))
- { fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); }
- if (pthread_attr_setstacksize(&att, 10000000))
- { fprintf(stderr, "pthread_attr_setstacksize err\n"); exit(1); }
- if (pthread_create(&t, &att, f, data))
- { fprintf(stderr, "pthread_create err\n"); exit(1); }
- if (pthread_attr_destroy(&att))
- { fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); }
+ if (pthread_attr_init(&att)) {
+ fprintf(stderr, "pthread_attr_init err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
+ fprintf(stderr, "pthread_attr_setdetachstate err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_setstacksize(&att, 10000000)) {
+ fprintf(stderr, "pthread_attr_setstacksize err\n");
+ exit(1);
+ }
+
+ if (pthread_create(&t, &att, f, data)) {
+ fprintf(stderr, "pthread_create err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_destroy(&att)) {
+ fprintf(stderr, "pthread_attr_destroy err\n");
+ exit(1);
+ }
}
-void sleepms(int ms)
-{
+void sleepms(int ms) {
struct timespec t;
-
t.tv_sec = ms / 1000;
t.tv_nsec = (ms % 1000) * 1000000L;
@@ -37,12 +48,15 @@ void sleepms(int ms)
if (nanosleep(&t, NULL)) abort();
}
-void bps(char *out, float v, char *suffix)
-{
+void bps(char *out, float v, char *suffix) {
static char *bps_unit[4] = { "", "k", "M", "G" };
int flog;
- if (v < 1000) flog = 0; else flog = floor(floor(log10(v)) / 3);
+
+ if (v < 1000) flog = 0;
+ else flog = floor(floor(log10(v)) / 3);
+
if (flog > 3) flog = 3;
+
v /= pow(10, flog*3);
sprintf(out, "%g%s%s", round(v*100)/100, bps_unit[flog], suffix);
}
@@ -51,25 +65,31 @@ void bps(char *out, float v, char *suffix)
/* list */
/****************************************************************************/
-list *list_remove_head(list *l)
-{
+list *list_remove_head(list *l) {
list *ret;
+
if (l == NULL) return NULL;
+
ret = l->next;
+
if (ret != NULL) ret->last = l->last;
+
free(l);
return ret;
}
-list *list_append(list *l, void *data)
-{
+list *list_append(list *l, void *data) {
list *new = calloc(1, sizeof(list));
+
if (new == NULL) abort();
+
new->data = data;
+
if (l == NULL) {
new->last = new;
return new;
}
+
l->last->next = new;
l->last = new;
return l;
@@ -79,88 +99,107 @@ list *list_append(list *l, void *data)
/* socket */
/****************************************************************************/
-int create_listen_socket(char *addr, int port)
-{
+int create_listen_socket(char *addr, int port) {
struct sockaddr_in a;
int s;
int v;
-
s = socket(AF_INET, SOCK_STREAM, 0);
- if (s == -1) { perror("socket"); exit(1); }
+
+ if (s == -1) {
+ perror("socket");
+ exit(1);
+ }
+
v = 1;
- if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(int)))
- { perror("setsockopt"); exit(1); }
+
+ if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(int))) {
+ perror("setsockopt");
+ exit(1);
+ }
a.sin_family = AF_INET;
a.sin_port = htons(port);
a.sin_addr.s_addr = inet_addr(addr);
- if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); }
- if (listen(s, 5)) { perror("listen"); exit(1); }
+ if (bind(s, (struct sockaddr *)&a, sizeof(a))) {
+ perror("bind");
+ exit(1);
+ }
+
+ if (listen(s, 5)) {
+ perror("listen");
+ exit(1);
+ }
return s;
}
-int socket_accept(int s)
-{
+int socket_accept(int s) {
struct sockaddr_in a;
socklen_t alen;
alen = sizeof(a);
return accept(s, (struct sockaddr *)&a, &alen);
}
-int socket_send(int socket, void *buffer, int size)
-{
+int socket_send(int socket, void *buffer, int size) {
char *x = buffer;
int ret;
+
while (size) {
ret = write(socket, x, size);
+
if (ret <= 0) return -1;
+
size -= ret;
x += ret;
}
+
return 0;
}
-int get_connection(char *addr, int port)
-{
+int get_connection(char *addr, int port) {
int s, t;
-
printf("waiting for connection on %s:%d\n", addr, port);
-
s = create_listen_socket(addr, port);
-
t = socket_accept(s);
- if (t == -1) { perror("accept"); exit(1); }
+
+ if (t == -1) {
+ perror("accept");
+ exit(1);
+ }
+
close(s);
-
printf("connected\n");
-
return t;
}
-int fullread(int fd, void *_buf, int count)
-{
+int fullread(int fd, void *_buf, int count) {
char *buf = _buf;
int ret = 0;
int l;
+
while (count) {
l = read(fd, buf, count);
+
if (l <= 0) return -1;
+
count -= l;
buf += l;
ret += l;
}
+
return ret;
}
-int try_connect_to(char *addr, int port)
-{
+int try_connect_to(char *addr, int port) {
int s;
struct sockaddr_in a;
-
s = socket(AF_INET, SOCK_STREAM, 0);
- if (s == -1) { perror("socket"); exit(1); }
+
+ if (s == -1) {
+ perror("socket");
+ exit(1);
+ }
a.sin_family = AF_INET;
a.sin_port = htons(port);
@@ -175,14 +214,12 @@ int try_connect_to(char *addr, int port)
return s;
}
-int connect_to(char *addr, int port)
-{
+int connect_to(char *addr, int port) {
int s;
-
printf("connecting to %s:%d\n", addr, port);
-
again:
s = try_connect_to(addr, port);
+
if (s == -1) {
printf("trying again in 1s\n");
sleep(1);
@@ -196,50 +233,46 @@ again:
/* buffer */
/****************************************************************************/
-void PUTC(OBUF *o, char c)
-{
+void PUTC(OBUF *o, char c) {
if (o->osize == o->omaxsize) {
o->omaxsize += 512;
o->obuf = realloc(o->obuf, o->omaxsize);
+
if (o->obuf == NULL) abort();
}
+
o->obuf[o->osize] = c;
o->osize++;
}
-void PUTS(OBUF *o, char *s)
-{
+void PUTS(OBUF *o, char *s) {
while (*s) PUTC(o, *s++);
}
-static int clean(char c)
-{
+static int clean(char c) {
if (!isprint(c)) c = ' ';
+
return c;
}
-void PUTS_CLEAN(OBUF *o, char *s)
-{
+void PUTS_CLEAN(OBUF *o, char *s) {
while (*s) PUTC(o, clean(*s++));
}
-void PUTI(OBUF *o, int i)
-{
+void PUTI(OBUF *o, int i) {
char s[64];
sprintf(s, "%d", i);
PUTS(o, s);
}
-void PUTX2(OBUF *o, int i)
-{
+void PUTX2(OBUF *o, int i) {
char s[64];
sprintf(s, "%2.2x", i);
PUTS(o, s);
}
-void PUTUL(OBUF *o, unsigned long l)
-{
+void PUTUL(OBUF *o, unsigned long l) {
char s[128];
- sprintf(s, "%ld", l);
+ sprintf(s, "%lu", l);
PUTS(o, s);
}
diff --git a/common/utils/assertions.h b/common/utils/assertions.h
index b872b009e2..97f1866274 100644
--- a/common/utils/assertions.h
+++ b/common/utils/assertions.h
@@ -22,9 +22,7 @@
#include
#include
#include
-#ifdef CMAKER
#include
-#endif
#if defined(ENB_MODE)
# define display_backtrace()
@@ -37,13 +35,11 @@
void output_log_mem(void);
#define _Assert_Exit_ \
-{ \
fprintf(stderr, "\nExiting execution\n"); \
display_backtrace(); \
fflush(stdout); \
fflush(stderr); \
exit(EXIT_FAILURE); \
-}
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
do { \
diff --git a/common/utils/backtrace.c b/common/utils/backtrace.c
index 889e0d84d1..f6de74f156 100644
--- a/common/utils/backtrace.c
+++ b/common/utils/backtrace.c
@@ -31,18 +31,18 @@
#include "backtrace.h"
/* Obtain a backtrace and print it to stdout. */
-void display_backtrace(void)
-{
+void display_backtrace(void) {
void *array[10];
size_t size;
char **strings;
size_t i;
- char* test=getenv("NO_BACKTRACE");
- if (test!=0) *((int*)0)=0;
+ char *test=getenv("NO_BACKTRACE");
+
+ if (test!=0) *((int *)0)=0;
+
size = backtrace(array, 10);
strings = backtrace_symbols(array, size);
-
- printf("Obtained %zd stack frames.\n", size);
+ printf("Obtained %u stack frames.\n", (unsigned int)size);
for (i = 0; i < size; i++)
printf("%s\n", strings[i]);
@@ -50,8 +50,7 @@ void display_backtrace(void)
free(strings);
}
-void backtrace_handle_signal(siginfo_t *info)
-{
+void backtrace_handle_signal(siginfo_t *info) {
display_backtrace();
//exit(EXIT_FAILURE);
}
diff --git a/common/utils/collection/queue.h b/common/utils/collection/queue.h
old mode 100755
new mode 100644
diff --git a/common/utils/collection/tree.h b/common/utils/collection/tree.h
old mode 100755
new mode 100644
diff --git a/common/utils/hashtable/hashtable.c b/common/utils/hashtable/hashtable.c
index 2c7b35744c..7b0fc42213 100644
--- a/common/utils/hashtable/hashtable.c
+++ b/common/utils/hashtable/hashtable.c
@@ -2,9 +2,9 @@
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
+ * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
+ * except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
@@ -28,17 +28,33 @@
//-------------------------------------------------------------------------------------------------------------------------------
-char* hashtable_rc_code2string(hashtable_rc_t rcP)
+char *hashtable_rc_code2string(hashtable_rc_t rcP)
//-------------------------------------------------------------------------------------------------------------------------------
{
- switch (rcP) {
- case HASH_TABLE_OK: return "HASH_TABLE_OK";break;
- case HASH_TABLE_INSERT_OVERWRITTEN_DATA: return "HASH_TABLE_INSERT_OVERWRITTEN_DATA";break;
- case HASH_TABLE_KEY_NOT_EXISTS: return "HASH_TABLE_KEY_NOT_EXISTS";break;
- case HASH_TABLE_KEY_ALREADY_EXISTS: return "HASH_TABLE_KEY_ALREADY_EXISTS";break;
- case HASH_TABLE_BAD_PARAMETER_HASHTABLE: return "HASH_TABLE_BAD_PARAMETER_HASHTABLE";break;
- default: return "UNKNOWN hashtable_rc_t";
- }
+ switch (rcP) {
+ case HASH_TABLE_OK:
+ return "HASH_TABLE_OK";
+ break;
+
+ case HASH_TABLE_INSERT_OVERWRITTEN_DATA:
+ return "HASH_TABLE_INSERT_OVERWRITTEN_DATA";
+ break;
+
+ case HASH_TABLE_KEY_NOT_EXISTS:
+ return "HASH_TABLE_KEY_NOT_EXISTS";
+ break;
+
+ case HASH_TABLE_KEY_ALREADY_EXISTS:
+ return "HASH_TABLE_KEY_ALREADY_EXISTS";
+ break;
+
+ case HASH_TABLE_BAD_PARAMETER_HASHTABLE:
+ return "HASH_TABLE_BAD_PARAMETER_HASHTABLE";
+ break;
+
+ default:
+ return "UNKNOWN hashtable_rc_t";
+ }
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
@@ -46,7 +62,7 @@ char* hashtable_rc_code2string(hashtable_rc_t rcP)
* hash_free_int_func() is used when this hashtable is used to store int values as data (pointer = value).
*/
-void hash_free_int_func(void* memoryP){}
+void hash_free_int_func(void *memoryP) {}
//-------------------------------------------------------------------------------------------------------------------------------
/*
@@ -55,9 +71,8 @@ void hash_free_int_func(void* memoryP){}
* This is a simple/naive hash function which adds the key's ASCII char values. It will probably generate lots of collisions on large hash tables.
*/
-static hash_size_t def_hashfunc(const uint64_t keyP)
-{
- return (hash_size_t)keyP;
+static hash_size_t def_hashfunc(const uint64_t keyP) {
+ return (hash_size_t)keyP;
}
//-------------------------------------------------------------------------------------------------------------------------------
@@ -67,132 +82,147 @@ static hash_size_t def_hashfunc(const uint64_t keyP)
* The user can also specify a hash function. If the hashfunc argument is NULL, a default hash function is used.
* If an error occurred, NULL is returned. All other values in the returned hash_table_t pointer should be released with hashtable_destroy().
*/
-hash_table_t *hashtable_create(const hash_size_t sizeP, hash_size_t (*hashfuncP)(const hash_key_t ), void (*freefuncP)(void*))
-{
- hash_table_t *hashtbl = NULL;
+hash_table_t *hashtable_create(const hash_size_t sizeP, hash_size_t (*hashfuncP)(const hash_key_t ), void (*freefuncP)(void *)) {
+ hash_table_t *hashtbl = NULL;
- if(!(hashtbl=malloc(sizeof(hash_table_t)))) {
- return NULL;
- }
+ if(!(hashtbl=malloc(sizeof(hash_table_t)))) {
+ return NULL;
+ }
- if(!(hashtbl->nodes=calloc(sizeP, sizeof(hash_node_t*)))) {
- free(hashtbl);
- return NULL;
- }
+ if(!(hashtbl->nodes=calloc(sizeP, sizeof(hash_node_t *)))) {
+ free(hashtbl);
+ return NULL;
+ }
- hashtbl->size=sizeP;
+ hashtbl->size=sizeP;
- if(hashfuncP) hashtbl->hashfunc=hashfuncP;
- else hashtbl->hashfunc=def_hashfunc;
+ if(hashfuncP) hashtbl->hashfunc=hashfuncP;
+ else hashtbl->hashfunc=def_hashfunc;
- if(freefuncP) hashtbl->freefunc=freefuncP;
- else hashtbl->freefunc=free;
+ if(freefuncP) hashtbl->freefunc=freefuncP;
+ else hashtbl->freefunc=free;
- return hashtbl;
+ return hashtbl;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Cleanup
* The hashtable_destroy() walks through the linked lists for each possible hash value, and releases the elements. It also releases the nodes array and the hash_table_t.
*/
-hashtable_rc_t hashtable_destroy(hash_table_t * hashtblP)
-{
- hash_size_t n;
- hash_node_t *node, *oldnode;
+hashtable_rc_t hashtable_destroy(hash_table_t **hashtblP) {
+ hash_size_t n;
+ hash_node_t *node, *oldnode;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
+ if (*hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
- for(n=0; nsize; ++n) {
- node=hashtblP->nodes[n];
- while(node) {
- oldnode=node;
- node=node->next;
- if (oldnode->data) {
- hashtblP->freefunc(oldnode->data);
- }
- free(oldnode);
- }
- }
- free(hashtblP->nodes);
- free(hashtblP);
- hashtblP=NULL;
- return HASH_TABLE_OK;
-}
-//-------------------------------------------------------------------------------------------------------------------------------
-hashtable_rc_t hashtable_is_key_exists (const hash_table_t * const hashtblP, const hash_key_t keyP)
-//-------------------------------------------------------------------------------------------------------------------------------
-{
- hash_node_t *node = NULL;
- hash_size_t hash = 0;
+ for(n=0; n<(*hashtblP)->size; ++n) {
+ node=(*hashtblP)->nodes[n];
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
-
- hash=hashtblP->hashfunc(keyP)%hashtblP->size;
- node=hashtblP->nodes[hash];
while(node) {
- if(node->key == keyP) {
- return HASH_TABLE_OK;
- }
+ oldnode=node;
+ node=node->next;
+
+ if (oldnode->data) {
+ (*hashtblP)->freefunc(oldnode->data);
+ }
+
+ free(oldnode);
+ }
+ }
+
+ free((*hashtblP)->nodes);
+ free((*hashtblP));
+ *hashtblP=NULL;
+ return HASH_TABLE_OK;
+}
+//-------------------------------------------------------------------------------------------------------------------------------
+hashtable_rc_t hashtable_is_key_exists (const hash_table_t *const hashtblP, const hash_key_t keyP)
+//-------------------------------------------------------------------------------------------------------------------------------
+{
+ hash_node_t *node = NULL;
+ hash_size_t hash = 0;
+
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ return HASH_TABLE_OK;
+ }
+
+ node=node->next;
+ }
+
+ return HASH_TABLE_KEY_NOT_EXISTS;
+}
+//-------------------------------------------------------------------------------------------------------------------------------
+hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *const hashtblP, void functP(hash_key_t keyP, void *dataP, void *parameterP), void *parameterP)
+//-------------------------------------------------------------------------------------------------------------------------------
+{
+ hash_node_t *node = NULL;
+ unsigned int i = 0;
+ unsigned int num_elements = 0;
+
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ while ((num_elements < hashtblP->num_elements) && (i < hashtblP->size)) {
+ if (hashtblP->nodes[i] != NULL) {
+ node=hashtblP->nodes[i];
+
+ while(node) {
+ num_elements += 1;
+ functP(node->key, node->data, parameterP);
node=node->next;
+ }
}
- return HASH_TABLE_KEY_NOT_EXISTS;
+
+ i += 1;
+ }
+
+ return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
-hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *const hashtblP, void functP(hash_key_t keyP, void* dataP, void* parameterP), void* parameterP)
+hashtable_rc_t hashtable_dump_content (const hash_table_t *const hashtblP, char *const buffer_pP, int *const remaining_bytes_in_buffer_pP )
//-------------------------------------------------------------------------------------------------------------------------------
{
- hash_node_t *node = NULL;
- unsigned int i = 0;
- unsigned int num_elements = 0;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
- while ((num_elements < hashtblP->num_elements) && (i < hashtblP->size)) {
- if (hashtblP->nodes[i] != NULL) {
- node=hashtblP->nodes[i];
- while(node) {
- num_elements += 1;
- functP(node->key, node->data, parameterP);
- node=node->next;
- }
- }
- i += 1;
- }
- return HASH_TABLE_OK;
-}
-//-------------------------------------------------------------------------------------------------------------------------------
-hashtable_rc_t hashtable_dump_content (const hash_table_t * const hashtblP, char * const buffer_pP, int * const remaining_bytes_in_buffer_pP )
-//-------------------------------------------------------------------------------------------------------------------------------
-{
- hash_node_t *node = NULL;
- unsigned int i = 0;
- if (hashtblP == NULL) {
+ hash_node_t *node = NULL;
+ unsigned int i = 0;
+
+ if (hashtblP == NULL) {
+ *remaining_bytes_in_buffer_pP = snprintf(
+ buffer_pP,
+ *remaining_bytes_in_buffer_pP,
+ "HASH_TABLE_BAD_PARAMETER_HASHTABLE");
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ while ((i < hashtblP->size) && (*remaining_bytes_in_buffer_pP > 0)) {
+ if (hashtblP->nodes[i] != NULL) {
+ node=hashtblP->nodes[i];
+
+ while(node) {
*remaining_bytes_in_buffer_pP = snprintf(
- buffer_pP,
- *remaining_bytes_in_buffer_pP,
- "HASH_TABLE_BAD_PARAMETER_HASHTABLE");
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ buffer_pP,
+ *remaining_bytes_in_buffer_pP,
+ "Key 0x%"PRIx64" Element %p\n",
+ node->key,
+ node->data);
+ node=node->next;
+ }
}
- while ((i < hashtblP->size) && (*remaining_bytes_in_buffer_pP > 0)) {
- if (hashtblP->nodes[i] != NULL) {
- node=hashtblP->nodes[i];
- while(node) {
- *remaining_bytes_in_buffer_pP = snprintf(
- buffer_pP,
- *remaining_bytes_in_buffer_pP,
- "Key 0x%"PRIx64" Element %p\n",
- node->key,
- node->data);
- node=node->next;
- }
- }
- i += 1;
- }
- return HASH_TABLE_OK;
+
+ i += 1;
+ }
+
+ return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
@@ -200,97 +230,110 @@ hashtable_rc_t hashtable_dump_content (const hash_table_t * const hashtblP, char
* Adding a new element
* To make sure the hash value is not bigger than size, the result of the user provided hash function is used modulo size.
*/
-hashtable_rc_t hashtable_insert(hash_table_t * const hashtblP, const hash_key_t keyP, void *dataP)
-{
- hash_node_t *node = NULL;
- hash_size_t hash = 0;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
- hash=hashtblP->hashfunc(keyP)%hashtblP->size;
+hashtable_rc_t hashtable_insert(hash_table_t *const hashtblP, const hash_key_t keyP, void *dataP) {
+ hash_node_t *node = NULL;
+ hash_size_t hash = 0;
- node=hashtblP->nodes[hash];
- while(node) {
- if(node->key == keyP) {
- if (node->data) {
- hashtblP->freefunc(node->data);
- }
- node->data=dataP;
- return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
- }
- node=node->next;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ if (node->data) {
+ hashtblP->freefunc(node->data);
+ }
+
+ node->data=dataP;
+ return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
}
- if(!(node=malloc(sizeof(hash_node_t)))) return -1;
- node->key=keyP;
- node->data=dataP;
- if (hashtblP->nodes[hash]) {
- node->next=hashtblP->nodes[hash];
- } else {
- node->next = NULL;
- }
- hashtblP->nodes[hash]=node;
- hashtblP->num_elements += 1;
- return HASH_TABLE_OK;
+
+ node=node->next;
+ }
+
+ if(!(node=malloc(sizeof(hash_node_t)))) return -1;
+
+ node->key=keyP;
+ node->data=dataP;
+
+ if (hashtblP->nodes[hash]) {
+ node->next=hashtblP->nodes[hash];
+ } else {
+ node->next = NULL;
+ }
+
+ hashtblP->nodes[hash]=node;
+ hashtblP->num_elements += 1;
+ return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* To remove an element from the hash table, we just search for it in the linked list for that hash value,
* and remove it if it is found. If it was not found, it is an error and -1 is returned.
*/
-hashtable_rc_t hashtable_remove(hash_table_t * const hashtblP, const hash_key_t keyP)
-{
- hash_node_t *node, *prevnode=NULL;
- hash_size_t hash = 0;
+hashtable_rc_t hashtable_remove(hash_table_t *const hashtblP, const hash_key_t keyP) {
+ hash_node_t *node, *prevnode=NULL;
+ hash_size_t hash = 0;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ if(prevnode) prevnode->next=node->next;
+ else hashtblP->nodes[hash]=node->next;
+
+ if (node->data) {
+ hashtblP->freefunc(node->data);
+ }
+
+ free(node);
+ hashtblP->num_elements -= 1;
+ return HASH_TABLE_OK;
}
- hash=hashtblP->hashfunc(keyP)%hashtblP->size;
- node=hashtblP->nodes[hash];
- while(node) {
- if(node->key == keyP) {
- if(prevnode) prevnode->next=node->next;
- else hashtblP->nodes[hash]=node->next;
- if (node->data) {
- hashtblP->freefunc(node->data);
- }
- free(node);
- hashtblP->num_elements -= 1;
- return HASH_TABLE_OK;
- }
- prevnode=node;
- node=node->next;
- }
- return HASH_TABLE_KEY_NOT_EXISTS;
+
+ prevnode=node;
+ node=node->next;
+ }
+
+ return HASH_TABLE_KEY_NOT_EXISTS;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Searching for an element is easy. We just search through the linked list for the corresponding hash value.
* NULL is returned if we didn't find it.
*/
-hashtable_rc_t hashtable_get(const hash_table_t * const hashtblP, const hash_key_t keyP, void** dataP)
-{
- hash_node_t *node = NULL;
- hash_size_t hash = 0;
+hashtable_rc_t hashtable_get(const hash_table_t *const hashtblP, const hash_key_t keyP, void **dataP) {
+ hash_node_t *node = NULL;
+ hash_size_t hash = 0;
- if (hashtblP == NULL) {
- *dataP = NULL;
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
- hash=hashtblP->hashfunc(keyP)%hashtblP->size;
-/* fprintf(stderr, "hashtable_get() key=%s, hash=%d\n", key, hash);*/
-
- node=hashtblP->nodes[hash];
-
- while(node) {
- if(node->key == keyP) {
- *dataP = node->data;
- return HASH_TABLE_OK;
- }
- node=node->next;
- }
+ if (hashtblP == NULL) {
*dataP = NULL;
- return HASH_TABLE_KEY_NOT_EXISTS;
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP)%hashtblP->size;
+ /* fprintf(stderr, "hashtable_get() key=%s, hash=%d\n", key, hash);*/
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ *dataP = node->data;
+ return HASH_TABLE_OK;
+ }
+
+ node=node->next;
+ }
+
+ *dataP = NULL;
+ return HASH_TABLE_KEY_NOT_EXISTS;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
@@ -304,36 +347,33 @@ hashtable_rc_t hashtable_get(const hash_table_t * const hashtblP, const hash_key
* After that, we can just free the old table and copy the elements from newtbl to hashtbl.
*/
-hashtable_rc_t hashtable_resize(hash_table_t * const hashtblP, const hash_size_t sizeP)
-{
- hash_table_t newtbl;
- hash_size_t n;
- hash_node_t *node,*next;
+hashtable_rc_t hashtable_resize(hash_table_t *const hashtblP, const hash_size_t sizeP) {
+ hash_table_t newtbl;
+ hash_size_t n;
+ hash_node_t *node,*next;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ newtbl.size = sizeP;
+ newtbl.hashfunc = hashtblP->hashfunc;
+
+ if(!(newtbl.nodes=calloc(sizeP, sizeof(hash_node_t *)))) return -1;
+
+ for(n=0; nsize; ++n) {
+ for(node=hashtblP->nodes[n]; node; node=next) {
+ next = node->next;
+ hashtable_insert(&newtbl, node->key, node->data);
+ // Lionel GAUTHIER: BAD CODE TO BE REWRITTEN
+ hashtable_remove(hashtblP, node->key);
}
+ }
- newtbl.size = sizeP;
- newtbl.hashfunc = hashtblP->hashfunc;
-
- if(!(newtbl.nodes=calloc(sizeP, sizeof(hash_node_t*)))) return -1;
-
- for(n=0; nsize; ++n) {
- for(node=hashtblP->nodes[n]; node; node=next) {
- next = node->next;
- hashtable_insert(&newtbl, node->key, node->data);
- // Lionel GAUTHIER: BAD CODE TO BE REWRITTEN
- hashtable_remove(hashtblP, node->key);
-
- }
- }
-
- free(hashtblP->nodes);
- hashtblP->size=newtbl.size;
- hashtblP->nodes=newtbl.nodes;
-
- return HASH_TABLE_OK;
+ free(hashtblP->nodes);
+ hashtblP->size=newtbl.size;
+ hashtblP->nodes=newtbl.nodes;
+ return HASH_TABLE_OK;
}
diff --git a/common/utils/hashtable/hashtable.h b/common/utils/hashtable/hashtable.h
index 62002fb60f..3f770684fa 100644
--- a/common/utils/hashtable/hashtable.h
+++ b/common/utils/hashtable/hashtable.h
@@ -2,9 +2,9 @@
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
+ * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
+ * except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
@@ -31,41 +31,41 @@ typedef uint64_t hash_key_t;
#define HASHTABLE_NOT_A_KEY_VALUE ((uint64_t)-1)
typedef enum hashtable_return_code_e {
- HASH_TABLE_OK = 0,
- HASH_TABLE_INSERT_OVERWRITTEN_DATA = 1,
- HASH_TABLE_KEY_NOT_EXISTS = 2,
- HASH_TABLE_KEY_ALREADY_EXISTS = 3,
- HASH_TABLE_BAD_PARAMETER_HASHTABLE = 4,
- HASH_TABLE_SYSTEM_ERROR = 5,
- HASH_TABLE_CODE_MAX
+ HASH_TABLE_OK = 0,
+ HASH_TABLE_INSERT_OVERWRITTEN_DATA = 1,
+ HASH_TABLE_KEY_NOT_EXISTS = 2,
+ HASH_TABLE_KEY_ALREADY_EXISTS = 3,
+ HASH_TABLE_BAD_PARAMETER_HASHTABLE = 4,
+ HASH_TABLE_SYSTEM_ERROR = 5,
+ HASH_TABLE_CODE_MAX
} hashtable_rc_t;
typedef struct hash_node_s {
- hash_key_t key;
- void *data;
- struct hash_node_s *next;
+ hash_key_t key;
+ void *data;
+ struct hash_node_s *next;
} hash_node_t;
typedef struct hash_table_s {
- hash_size_t size;
- hash_size_t num_elements;
- struct hash_node_s **nodes;
- hash_size_t (*hashfunc)(const hash_key_t);
- void (*freefunc)(void*);
+ hash_size_t size;
+ hash_size_t num_elements;
+ struct hash_node_s **nodes;
+ hash_size_t (*hashfunc)(const hash_key_t);
+ void (*freefunc)(void *);
} hash_table_t;
-char* hashtable_rc_code2string(hashtable_rc_t rcP);
-void hash_free_int_func(void* memoryP);
-hash_table_t *hashtable_create (const hash_size_t size, hash_size_t (*hashfunc)(const hash_key_t ), void (*freefunc)(void*));
-hashtable_rc_t hashtable_destroy(hash_table_t * const hashtbl);
-hashtable_rc_t hashtable_is_key_exists (const hash_table_t * const hashtbl, const uint64_t key);
-hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t * const hashtblP, void funct(hash_key_t keyP, void* dataP, void* parameterP), void* parameterP);
-hashtable_rc_t hashtable_dump_content (const hash_table_t * const hashtblP, char * const buffer_pP, int * const remaining_bytes_in_buffer_pP );
-hashtable_rc_t hashtable_insert (hash_table_t * const hashtbl, const hash_key_t key, void *data);
-hashtable_rc_t hashtable_remove (hash_table_t * const hashtbl, const hash_key_t key);
-hashtable_rc_t hashtable_get (const hash_table_t * const hashtbl, const hash_key_t key, void **dataP);
-hashtable_rc_t hashtable_resize (hash_table_t * const hashtbl, const hash_size_t size);
+char *hashtable_rc_code2string(hashtable_rc_t rcP);
+void hash_free_int_func(void *memoryP);
+hash_table_t *hashtable_create (const hash_size_t size, hash_size_t (*hashfunc)(const hash_key_t ), void (*freefunc)(void *));
+hashtable_rc_t hashtable_destroy(hash_table_t **hashtbl);
+hashtable_rc_t hashtable_is_key_exists (const hash_table_t *const hashtbl, const uint64_t key);
+hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *const hashtblP, void funct(hash_key_t keyP, void *dataP, void *parameterP), void *parameterP);
+hashtable_rc_t hashtable_dump_content (const hash_table_t *const hashtblP, char *const buffer_pP, int *const remaining_bytes_in_buffer_pP );
+hashtable_rc_t hashtable_insert (hash_table_t *const hashtbl, const hash_key_t key, void *data);
+hashtable_rc_t hashtable_remove (hash_table_t *const hashtbl, const hash_key_t key);
+hashtable_rc_t hashtable_get (const hash_table_t *const hashtbl, const hash_key_t key, void **dataP);
+hashtable_rc_t hashtable_resize (hash_table_t *const hashtbl, const hash_size_t size);
diff --git a/common/utils/hashtable/obj_hashtable.c b/common/utils/hashtable/obj_hashtable.c
index 7fb68d1681..643dcce552 100644
--- a/common/utils/hashtable/obj_hashtable.c
+++ b/common/utils/hashtable/obj_hashtable.c
@@ -2,9 +2,9 @@
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
+ * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
+ * except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
@@ -30,13 +30,12 @@
* This is a simple/naive hash function which adds the key's ASCII char values. It will probably generate lots of collisions on large hash tables.
*/
-static hash_size_t def_hashfunc(const void *keyP, int key_sizeP)
-{
- hash_size_t hash=0;
+static hash_size_t def_hashfunc(const void *keyP, int key_sizeP) {
+ hash_size_t hash=0;
- while(key_sizeP) hash^=((unsigned char*)keyP)[key_sizeP --];
+ while(key_sizeP) hash^=((unsigned char *)keyP)[key_sizeP --];
- return hash;
+ return hash;
}
//-------------------------------------------------------------------------------------------------------------------------------
@@ -46,201 +45,221 @@ static hash_size_t def_hashfunc(const void *keyP, int key_sizeP)
* The user can also specify a hash function. If the hashfunc argument is NULL, a default hash function is used.
* If an error occurred, NULL is returned. All other values in the returned obj_hash_table_t pointer should be released with hashtable_destroy().
*/
-obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfuncP)(const void*, int ), void (*freekeyfuncP)(void*), void (*freedatafuncP)(void*))
-{
- obj_hash_table_t *hashtbl;
+obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfuncP)(const void *, int ), void (*freekeyfuncP)(void *), void (*freedatafuncP)(void *)) {
+ obj_hash_table_t *hashtbl;
- if(!(hashtbl=malloc(sizeof(obj_hash_table_t)))) return NULL;
+ if(!(hashtbl=malloc(sizeof(obj_hash_table_t)))) return NULL;
- if(!(hashtbl->nodes=calloc(sizeP, sizeof(obj_hash_node_t*)))) {
- free(hashtbl);
- return NULL;
- }
+ if(!(hashtbl->nodes=calloc(sizeP, sizeof(obj_hash_node_t *)))) {
+ free(hashtbl);
+ return NULL;
+ }
- hashtbl->size=sizeP;
+ hashtbl->size=sizeP;
- if(hashfuncP) hashtbl->hashfunc=hashfuncP;
- else hashtbl->hashfunc=def_hashfunc;
+ if(hashfuncP) hashtbl->hashfunc=hashfuncP;
+ else hashtbl->hashfunc=def_hashfunc;
- if(freekeyfuncP) hashtbl->freekeyfunc=freekeyfuncP;
- else hashtbl->freekeyfunc=free;
+ if(freekeyfuncP) hashtbl->freekeyfunc=freekeyfuncP;
+ else hashtbl->freekeyfunc=free;
- if(freedatafuncP) hashtbl->freedatafunc=freedatafuncP;
- else hashtbl->freedatafunc=free;
+ if(freedatafuncP) hashtbl->freedatafunc=freedatafuncP;
+ else hashtbl->freedatafunc=free;
- return hashtbl;
+ return hashtbl;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Cleanup
* The hashtable_destroy() walks through the linked lists for each possible hash value, and releases the elements. It also releases the nodes array and the obj_hash_table_t.
*/
-hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP)
-{
- hash_size_t n;
- obj_hash_node_t *node, *oldnode;
+hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP) {
+ hash_size_t n;
+ obj_hash_node_t *node, *oldnode;
- for(n=0; nsize; ++n) {
- node=hashtblP->nodes[n];
- while(node) {
- oldnode=node;
- node=node->next;
- hashtblP->freekeyfunc(oldnode->key);
- hashtblP->freedatafunc(oldnode->data);
- free(oldnode);
- }
+ for(n=0; nsize; ++n) {
+ node=hashtblP->nodes[n];
+
+ while(node) {
+ oldnode=node;
+ node=node->next;
+ hashtblP->freekeyfunc(oldnode->key);
+ hashtblP->freedatafunc(oldnode->data);
+ free(oldnode);
}
- free(hashtblP->nodes);
- free(hashtblP);
- return HASH_TABLE_OK;
+ }
+
+ free(hashtblP->nodes);
+ free(hashtblP);
+ return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
-hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* keyP, int key_sizeP)
+hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void *keyP, int key_sizeP)
//-------------------------------------------------------------------------------------------------------------------------------
{
- obj_hash_node_t *node;
- hash_size_t hash;
+ obj_hash_node_t *node;
+ hash_size_t hash;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ return HASH_TABLE_OK;
+ } else if (node->key_size == key_sizeP) {
+ if (memcmp(node->key, keyP, key_sizeP) == 0) {
+ return HASH_TABLE_OK;
+ }
}
- hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
- node=hashtblP->nodes[hash];
- while(node) {
- if(node->key == keyP) {
- return HASH_TABLE_OK;
- } else if (node->key_size == key_sizeP) {
- if (memcmp(node->key, keyP, key_sizeP) == 0) {
- return HASH_TABLE_OK;
- }
- }
- node=node->next;
- }
- return HASH_TABLE_KEY_NOT_EXISTS;
+
+ node=node->next;
+ }
+
+ return HASH_TABLE_KEY_NOT_EXISTS;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Adding a new element
* To make sure the hash value is not bigger than size, the result of the user provided hash function is used modulo size.
*/
-hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void* keyP, int key_sizeP, void *dataP)
-{
- obj_hash_node_t *node;
- hash_size_t hash;
+hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void *keyP, int key_sizeP, void *dataP) {
+ obj_hash_node_t *node;
+ hash_size_t hash;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ if (node->data) {
+ hashtblP->freedatafunc(node->data);
+ }
+
+ node->data=dataP;
+ // waste of memory here (keyP is lost) we should free it now
+ return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
}
- hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
- node=hashtblP->nodes[hash];
- while(node) {
- if(node->key == keyP) {
- if (node->data) {
- hashtblP->freedatafunc(node->data);
- }
- node->data=dataP;
- // waste of memory here (keyP is lost) we should free it now
- return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
- }
- node=node->next;
- }
- if(!(node=malloc(sizeof(obj_hash_node_t)))) return -1;
- node->key=keyP;
- node->data=dataP;
- if (hashtblP->nodes[hash]) {
- node->next=hashtblP->nodes[hash];
- } else {
- node->next = NULL;
- }
- hashtblP->nodes[hash]=node;
- return HASH_TABLE_OK;
+
+ node=node->next;
+ }
+
+ if(!(node=malloc(sizeof(obj_hash_node_t)))) return -1;
+
+ node->key=keyP;
+ node->data=dataP;
+
+ if (hashtblP->nodes[hash]) {
+ node->next=hashtblP->nodes[hash];
+ } else {
+ node->next = NULL;
+ }
+
+ hashtblP->nodes[hash]=node;
+ return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* To remove an element from the hash table, we just search for it in the linked list for that hash value,
* and remove it if it is found. If it was not found, it is an error and -1 is returned.
*/
-hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP)
-{
- obj_hash_node_t *node, *prevnode=NULL;
- hash_size_t hash;
+hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void *keyP, int key_sizeP) {
+ obj_hash_node_t *node, *prevnode=NULL;
+ hash_size_t hash;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if ((node->key == keyP) || ((node->key_size == key_sizeP) && (memcmp(node->key, keyP, key_sizeP) == 0))) {
+ if(prevnode) {
+ prevnode->next=node->next;
+ } else {
+ hashtblP->nodes[hash]=node->next;
+ }
+
+ hashtblP->freekeyfunc(node->key);
+ hashtblP->freedatafunc(node->data);
+ free(node);
+ return HASH_TABLE_OK;
}
- hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
- node=hashtblP->nodes[hash];
- while(node) {
- if ((node->key == keyP) || ((node->key_size == key_sizeP) && (memcmp(node->key, keyP, key_sizeP) == 0))){
- if(prevnode) {
- prevnode->next=node->next;
- } else {
- hashtblP->nodes[hash]=node->next;
- }
- hashtblP->freekeyfunc(node->key);
- hashtblP->freedatafunc(node->data);
- free(node);
- return HASH_TABLE_OK;
- }
- prevnode=node;
- node=node->next;
- }
- return HASH_TABLE_KEY_NOT_EXISTS;
+ prevnode=node;
+ node=node->next;
+ }
+
+ return HASH_TABLE_KEY_NOT_EXISTS;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Searching for an element is easy. We just search through the linked list for the corresponding hash value.
* NULL is returned if we didn't find it.
*/
-hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP, void** dataP)
-{
- obj_hash_node_t *node;
- hash_size_t hash;
+hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void *keyP, int key_sizeP, void **dataP) {
+ obj_hash_node_t *node;
+ hash_size_t hash;
- if (hashtblP == NULL) {
- *dataP = NULL;
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
- hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
- node=hashtblP->nodes[hash];
- while(node) {
- if(node->key == keyP) {
- *dataP = node->data;
- return HASH_TABLE_OK;
- } else if (node->key_size == key_sizeP) {
- if (memcmp(node->key, keyP, key_sizeP) == 0) {
- *dataP = node->data;
- return HASH_TABLE_OK;
- }
- }
- node=node->next;
- }
+ if (hashtblP == NULL) {
*dataP = NULL;
- return HASH_TABLE_KEY_NOT_EXISTS;
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ *dataP = node->data;
+ return HASH_TABLE_OK;
+ } else if (node->key_size == key_sizeP) {
+ if (memcmp(node->key, keyP, key_sizeP) == 0) {
+ *dataP = node->data;
+ return HASH_TABLE_OK;
+ }
+ }
+
+ node=node->next;
+ }
+
+ *dataP = NULL;
+ return HASH_TABLE_KEY_NOT_EXISTS;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Function to return all keys of an object hash table
*/
-hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP, unsigned int *sizeP)
-{
- size_t n = 0;
- obj_hash_node_t *node = NULL;
- obj_hash_node_t *next = NULL;
- *sizeP = 0;
- keysP = calloc(hashtblP->num_elements, sizeof(void *));
- if (keysP) {
- for(n=0; nsize; ++n) {
- for(node=hashtblP->nodes[n]; node; node=next) {
- keysP[*sizeP++] = node->key;
- next = node->next;
- }
- }
- return HASH_TABLE_OK;
+hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void **keysP, unsigned int *sizeP) {
+ size_t n = 0;
+ obj_hash_node_t *node = NULL;
+ obj_hash_node_t *next = NULL;
+ *sizeP = 0;
+ keysP = calloc(hashtblP->num_elements, sizeof(void *));
+
+ if (keysP) {
+ for(n=0; nsize; ++n) {
+ for(node=hashtblP->nodes[n]; node; node=next) {
+ keysP[*sizeP++] = node->key;
+ next = node->next;
+ }
}
- return HASH_TABLE_SYSTEM_ERROR;
+
+ // cppcheck-suppress memleak
+ return HASH_TABLE_OK;
+ }
+
+ return HASH_TABLE_SYSTEM_ERROR;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
@@ -253,34 +272,32 @@ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP,
* This allows us to reuse hashtable_insert() and hashtable_remove(), when moving the elements to the new table.
* After that, we can just free the old table and copy the elements from newtbl to hashtbl.
*/
-hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t sizeP)
-{
- obj_hash_table_t newtbl;
- hash_size_t n;
- obj_hash_node_t *node,*next;
+hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t sizeP) {
+ obj_hash_table_t newtbl;
+ hash_size_t n;
+ obj_hash_node_t *node,*next;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ newtbl.size = sizeP;
+ newtbl.hashfunc = hashtblP->hashfunc;
+
+ if(!(newtbl.nodes=calloc(sizeP, sizeof(obj_hash_node_t *)))) return HASH_TABLE_SYSTEM_ERROR;
+
+ for(n=0; nsize; ++n) {
+ for(node=hashtblP->nodes[n]; node; node=next) {
+ next = node->next;
+ obj_hashtable_insert(&newtbl, node->key, node->key_size, node->data);
+ obj_hashtable_remove(hashtblP, node->key, node->key_size);
}
+ }
- newtbl.size = sizeP;
- newtbl.hashfunc = hashtblP->hashfunc;
-
- if(!(newtbl.nodes=calloc(sizeP, sizeof(obj_hash_node_t*)))) return HASH_TABLE_SYSTEM_ERROR;
-
- for(n=0; nsize; ++n) {
- for(node=hashtblP->nodes[n]; node; node=next) {
- next = node->next;
- obj_hashtable_insert(&newtbl, node->key, node->key_size, node->data);
- obj_hashtable_remove(hashtblP, node->key, node->key_size);
- }
- }
-
- free(hashtblP->nodes);
- hashtblP->size=newtbl.size;
- hashtblP->nodes=newtbl.nodes;
-
- return HASH_TABLE_OK;
+ free(hashtblP->nodes);
+ hashtblP->size=newtbl.size;
+ hashtblP->nodes=newtbl.nodes;
+ return HASH_TABLE_OK;
}
diff --git a/common/utils/memory_pools.c b/common/utils/memory_pools.c
index 78b6923dc8..9f37e47080 100644
--- a/common/utils/memory_pools.c
+++ b/common/utils/memory_pools.c
@@ -23,19 +23,19 @@
#include "memory_pools.h"
#if T_TRACER
-#include
-#include "T.h"
+ #include
+ #include "T.h"
#endif
/*------------------------------------------------------------------------------*/
const static int mp_debug = 0;
# define MP_DEBUG(x, args...) do { if (mp_debug) fprintf(stdout, "[MP][D]"x, ##args); fflush (stdout); } \
- while(0)
+ while(0)
/*------------------------------------------------------------------------------*/
#ifndef CHARS_TO_UINT32
-#define CHARS_TO_UINT32(c1, c2, c3, c4) (((c1) << 24) | ((c2) << 16) | ((c3) << 8) | (c4))
+ #define CHARS_TO_UINT32(c1, c2, c3, c4) (((c1) << 24) | ((c2) << 16) | ((c3) << 8) | (c4))
#endif
#define MEMORY_POOL_ITEM_INFO_NUMBER 2
@@ -129,33 +129,25 @@ static const pool_start_mark_t POOL_START_MARK = CHARS_TO_UINT32 ('P'
static const pools_start_mark_t POOLS_START_MARK = CHARS_TO_UINT32 ('P', 'S', 's', 't');
/*------------------------------------------------------------------------------*/
-static inline uint32_t items_group_number_items (items_group_t *items_group)
-{
+static inline uint32_t items_group_number_items (items_group_t *items_group) {
return items_group->number_plus_one - 1;
}
-static inline uint32_t items_group_free_items (items_group_t *items_group)
-{
+static inline uint32_t items_group_free_items (items_group_t *items_group) {
items_group_positions_t positions;
uint32_t free_items;
-
positions.all = items_group->positions.all;
-
free_items = items_group->number_plus_one + positions.ind.put - positions.ind.get;
free_items %= items_group->number_plus_one;
-
return free_items;
}
-static inline items_group_index_t items_group_get_free_item (items_group_t *items_group)
-{
+static inline items_group_index_t items_group_get_free_item (items_group_t *items_group) {
items_group_position_t get_raw;
items_group_position_t put;
items_group_position_t get;
items_group_position_t free_items;
-
items_group_index_t index = ITEMS_GROUP_INDEX_INVALID;
-
/* Get current put position */
put = items_group->positions.ind.put % items_group->number_plus_one;
/* Get current get position and increase it */
@@ -193,11 +185,9 @@ static inline items_group_index_t items_group_get_free_item (items_group_t *item
return (index);
}
-static inline int items_group_put_free_item (items_group_t *items_group, items_group_index_t index)
-{
+static inline int items_group_put_free_item (items_group_t *items_group, items_group_index_t index) {
items_group_position_t put_raw;
items_group_position_t put;
-
/* Get current put position and increase it */
put_raw = __sync_fetch_and_add (&items_group->positions.ind.put, 1);
put = put_raw % items_group->number_plus_one;
@@ -209,70 +199,54 @@ static inline int items_group_put_free_item (items_group_t *items_group, items_g
AssertError (items_group->indexes[put] <= ITEMS_GROUP_INDEX_INVALID, return (EXIT_FAILURE),
"Index at current put position (%d) is not marked as free (%d)!\n", put, items_group->number_plus_one);
-
/* Save freed item index at current put position */
items_group->indexes[put] = index;
return (EXIT_SUCCESS);
}
/*------------------------------------------------------------------------------*/
-static inline memory_pools_t *memory_pools_from_handler (memory_pools_handle_t memory_pools_handle)
-{
+static inline memory_pools_t *memory_pools_from_handler (memory_pools_handle_t memory_pools_handle) {
memory_pools_t *memory_pools;
-
/* Recover memory_pools */
memory_pools = (memory_pools_t *) memory_pools_handle;
/* Sanity check on passed handle */
AssertError (memory_pools->start_mark == POOLS_START_MARK, memory_pools = NULL,
"Handle %p is not a valid memory pools handle, start mark is missing!\n", memory_pools_handle);
-
return (memory_pools);
}
-static inline memory_pool_item_t *memory_pool_item_from_handler (memory_pool_item_handle_t memory_pool_item_handle)
-{
+static inline memory_pool_item_t *memory_pool_item_from_handler (memory_pool_item_handle_t memory_pool_item_handle) {
void *address;
memory_pool_item_t *memory_pool_item;
-
/* Recover memory_pools */
address = memory_pool_item_handle - sizeof(memory_pool_item_start_t);
memory_pool_item = (memory_pool_item_t *) address;
-
/* Sanity check on passed handle */
AssertError (memory_pool_item->start.start_mark == POOL_ITEM_START_MARK, memory_pool_item = NULL,
"Handle %p is not a valid memory pool item handle, start mark is missing!\n", memory_pool_item);
-
return (memory_pool_item);
}
-static inline memory_pool_item_t *memory_pool_item_from_index (memory_pool_t *memory_pool, items_group_index_t index)
-{
+static inline memory_pool_item_t *memory_pool_item_from_index (memory_pool_t *memory_pool, items_group_index_t index) {
void *address;
-
address = (void *) memory_pool->items;
address += index * memory_pool->pool_item_size;
-
return (address);
}
/*------------------------------------------------------------------------------*/
-memory_pools_handle_t memory_pools_create (uint32_t pools_number)
-{
+memory_pools_handle_t memory_pools_create (uint32_t pools_number) {
memory_pools_t *memory_pools;
pool_id_t pool;
-
AssertFatal (pools_number <= MAX_POOLS_NUMBER, "Too many memory pools requested (%d/%d)!\n", pools_number, MAX_POOLS_NUMBER); /* Limit to a reasonable number of pools */
-
/* Allocate memory_pools */
memory_pools = malloc (sizeof(memory_pools_t));
AssertFatal (memory_pools != NULL, "Memory pools structure allocation failed!\n");
-
/* Initialize memory_pools */
{
memory_pools->start_mark = POOLS_START_MARK;
memory_pools->pools_number = pools_number;
memory_pools->pools_defined = 0;
-
/* Allocate pools */
memory_pools->pools = calloc (pools_number, sizeof(memory_pool_t));
AssertFatal (memory_pools->pools != NULL, "Memory pools allocation failed!\n");
@@ -282,12 +256,10 @@ memory_pools_handle_t memory_pools_create (uint32_t pools_number)
memory_pools->pools[pool].start_mark = POOL_START_MARK;
}
}
-
return ((memory_pools_handle_t) memory_pools);
}
-char *memory_pools_statistics(memory_pools_handle_t memory_pools_handle)
-{
+char *memory_pools_statistics(memory_pools_handle_t memory_pools_handle) {
memory_pools_t *memory_pools;
pool_id_t pool;
char *statistics;
@@ -296,13 +268,10 @@ char *memory_pools_statistics(memory_pools_handle_t memory_pools_handle)
uint32_t allocated_pools_memory = 0;
items_group_t *items_group;
uint32_t pool_items_size;
-
/* Recover memory_pools */
memory_pools = memory_pools_from_handler (memory_pools_handle);
AssertFatal (memory_pools != NULL, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
-
statistics = malloc(memory_pools->pools_defined * 200);
-
printed_chars = sprintf (&statistics[0], "Pool: size, number, minimum, free, address space and memory used in Kbytes\n");
for (pool = 0; pool < memory_pools->pools_defined; pool++) {
@@ -321,32 +290,25 @@ char *memory_pools_statistics(memory_pools_handle_t memory_pools_handle)
}
printed_chars = sprintf (&statistics[printed_chars], "Pools memory %u Kbytes\n", allocated_pools_memory / (1024));
-
return (statistics);
}
-int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t pool_items_number, uint32_t pool_item_size)
-{
+int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t pool_items_number, uint32_t pool_item_size) {
memory_pools_t *memory_pools;
memory_pool_t *memory_pool;
pool_id_t pool;
items_group_index_t item_index;
memory_pool_item_t *memory_pool_item;
-
AssertFatal (pool_items_number <= MAX_POOL_ITEMS_NUMBER, "Too many items for a memory pool (%u/%d)!\n", pool_items_number, MAX_POOL_ITEMS_NUMBER); /* Limit to a reasonable number of items */
AssertFatal (pool_item_size <= MAX_POOL_ITEM_SIZE, "Item size is too big for memory pool items (%u/%d)!\n", pool_item_size, MAX_POOL_ITEM_SIZE); /* Limit to a reasonable item size */
-
/* Recover memory_pools */
memory_pools = memory_pools_from_handler (memory_pools_handle);
AssertFatal (memory_pools != NULL, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
-
/* Check number of already created pools */
AssertFatal (memory_pools->pools_defined < memory_pools->pools_number, "Can not allocate more memory pool (%d)!\n", memory_pools->pools_number);
-
/* Select pool */
pool = memory_pools->pools_defined;
memory_pool = &memory_pools->pools[pool];
-
/* Initialize pool */
{
memory_pool->pool_id = pool;
@@ -357,7 +319,6 @@ int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t p
memory_pool->items_group_free.minimum = pool_items_number;
memory_pool->items_group_free.positions.ind.put = pool_items_number;
memory_pool->items_group_free.positions.ind.get = 0;
-
/* Allocate free indexes */
memory_pool->items_group_free.indexes = malloc(memory_pool->items_group_free.number_plus_one * sizeof(items_group_index_t));
AssertFatal (memory_pool->items_group_free.indexes != NULL, "Memory pool indexes allocation failed!\n");
@@ -369,7 +330,6 @@ int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t p
/* Last index is not allocated */
memory_pool->items_group_free.indexes[item_index] = ITEMS_GROUP_INDEX_INVALID;
-
/* Allocate items */
memory_pool->items = calloc (pool_items_number, memory_pool->pool_item_size);
AssertFatal (memory_pool->items != NULL, "Memory pool items allocation failed!\n");
@@ -383,20 +343,16 @@ int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t p
memory_pool_item->data[memory_pool->item_data_number] = POOL_ITEM_END_MARK;
}
}
-
memory_pools->pools_defined ++;
-
return (0);
}
-memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_pools_handle, uint32_t item_size, uint16_t info_0, uint16_t info_1)
-{
+memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_pools_handle, uint32_t item_size, uint16_t info_0, uint16_t info_1) {
memory_pools_t *memory_pools;
memory_pool_item_t *memory_pool_item;
memory_pool_item_handle_t memory_pool_item_handle = NULL;
pool_id_t pool;
items_group_index_t item_index = ITEMS_GROUP_INDEX_INVALID;
-
/* Recover memory_pools */
memory_pools = memory_pools_from_handler (memory_pools_handle);
AssertError (memory_pools != NULL, {}, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
@@ -424,12 +380,10 @@ memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_po
/* Sanity check on item status, must be free */
AssertFatal (memory_pool_item->start.item_status == ITEM_STATUS_FREE, "Item status is not set to free (%d) in pool %u, item %d!\n",
memory_pool_item->start.item_status, pool, item_index);
-
memory_pool_item->start.item_status = ITEM_STATUS_ALLOCATED;
memory_pool_item->start.info[0] = info_0;
memory_pool_item->start.info[1] = info_1;
memory_pool_item_handle = memory_pool_item->data;
-
MP_DEBUG(" Alloc [%2u][%6d]{%6d}, %3u %3u, %6u, %p, %p, %p\n",
pool, item_index,
items_group_free_items (&memory_pools->pools[pool].items_group_free),
@@ -445,8 +399,7 @@ memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_po
return memory_pool_item_handle;
}
-int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, uint16_t info_0)
-{
+int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, uint16_t info_0) {
memory_pools_t *memory_pools;
memory_pool_item_t *memory_pool_item;
pool_id_t pool;
@@ -455,36 +408,29 @@ int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_it
uint32_t pool_item_size;
uint16_t info_1;
int result;
-
/* Recover memory_pools */
memory_pools = memory_pools_from_handler (memory_pools_handle);
AssertError (memory_pools != NULL, return (EXIT_FAILURE), "Failed to retrieve memory pools for handle %p!\n", memory_pools_handle);
-
/* Recover memory pool item */
memory_pool_item = memory_pool_item_from_handler (memory_pool_item_handle);
AssertError (memory_pool_item != NULL, return (EXIT_FAILURE), "Failed to retrieve memory pool item for handle %p!\n", memory_pool_item_handle);
-
info_1 = memory_pool_item->start.info[1];
-
/* Recover pool index */
pool = memory_pool_item->start.pool_id;
AssertFatal (pool < memory_pools->pools_defined, "Pool index is invalid (%u/%u)!\n", pool, memory_pools->pools_defined);
-
item_size = memory_pools->pools[pool].item_data_number;
pool_item_size = memory_pools->pools[pool].pool_item_size;
item_index = (((void *) memory_pool_item) - ((void *) memory_pools->pools[pool].items)) / pool_item_size;
-
MP_DEBUG(" Free [%2u][%6d]{%6d}, %3u %3u, %p, %p, %p, %u\n",
pool, item_index,
items_group_free_items (&memory_pools->pools[pool].items_group_free),
memory_pool_item->start.info[0], info_1,
memory_pool_item_handle, memory_pool_item,
memory_pools->pools[pool].items, ((uint32_t) (item_size * sizeof(memory_pool_data_t))));
-
/* Sanity check on calculated item index */
AssertFatal (memory_pool_item == memory_pool_item_from_index(&memory_pools->pools[pool], item_index),
"Incorrect memory pool item address (%p, %p) for pool %u, item %d!\n",
- memory_pool_item, memory_pool_item_from_index(&memory_pools->pools[pool], item_index), pool, item_index);
+ memory_pool_item,(void *)memory_pool_item_from_index(&memory_pools->pools[pool], item_index), pool, item_index);
/* Sanity check on end marker, must still be present (no write overflow) */
AssertFatal (memory_pool_item->data[item_size] == POOL_ITEM_END_MARK,
"Memory pool item is corrupted, end mark is not present for pool %u, item %d!\n", pool, item_index);
@@ -492,31 +438,23 @@ int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_it
AssertFatal (memory_pool_item->start.item_status == ITEM_STATUS_ALLOCATED,
"Trying to free a non allocated (%x) memory pool item (pool %u, item %d)!\n",
memory_pool_item->start.item_status, pool, item_index);
-
memory_pool_item->start.item_status = ITEM_STATUS_FREE;
-
result = items_group_put_free_item(&memory_pools->pools[pool].items_group_free, item_index);
-
AssertError (result == EXIT_SUCCESS, {}, "Failed to free memory pool item (pool %u, item %d)!\n", pool, item_index);
-
return (result);
}
-void memory_pools_set_info (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, int index, uint16_t info)
-{
+void memory_pools_set_info (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, int index, uint16_t info) {
memory_pools_t *memory_pools;
memory_pool_item_t *memory_pool_item;
pool_id_t pool;
items_group_index_t item_index;
uint32_t item_size;
uint32_t pool_item_size;
-
AssertFatal (index < MEMORY_POOL_ITEM_INFO_NUMBER, "Incorrect info index (%d/%d)!\n", index, MEMORY_POOL_ITEM_INFO_NUMBER);
-
/* Recover memory pool item */
memory_pool_item = memory_pool_item_from_handler (memory_pool_item_handle);
AssertFatal (memory_pool_item != NULL, "Failed to retrieve memory pool item for handle %p!\n", memory_pool_item_handle);
-
/* Set info[1] */
memory_pool_item->start.info[index] = info;
@@ -525,26 +463,22 @@ void memory_pools_set_info (memory_pools_handle_t memory_pools_handle, memory_po
/* Recover memory_pools */
memory_pools = memory_pools_from_handler (memory_pools_handle);
AssertFatal (memory_pools != NULL, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
-
/* Recover pool index */
pool = memory_pool_item->start.pool_id;
AssertFatal (pool < memory_pools->pools_defined, "Pool index is invalid (%u/%u)!\n", pool, memory_pools->pools_defined);
-
item_size = memory_pools->pools[pool].item_data_number;
pool_item_size = memory_pools->pools[pool].pool_item_size;
item_index = (((void *) memory_pool_item) - ((void *) memory_pools->pools[pool].items)) / pool_item_size;
-
MP_DEBUG(" Info [%2u][%6d]{%6d}, %3u %3u, %p, %p, %p, %u\n",
pool, item_index,
items_group_free_items (&memory_pools->pools[pool].items_group_free),
memory_pool_item->start.info[0], memory_pool_item->start.info[1],
memory_pool_item_handle, memory_pool_item,
memory_pools->pools[pool].items, ((uint32_t) (item_size * sizeof(memory_pool_data_t))));
-
/* Sanity check on calculated item index */
AssertFatal (memory_pool_item == memory_pool_item_from_index(&memory_pools->pools[pool], item_index),
"Incorrect memory pool item address (%p, %p) for pool %u, item %d!\n",
- memory_pool_item, memory_pool_item_from_index(&memory_pools->pools[pool], item_index), pool, item_index);
+ memory_pool_item, (void *)memory_pool_item_from_index(&memory_pools->pools[pool], item_index), pool, item_index);
/* Sanity check on end marker, must still be present (no write overflow) */
AssertFatal (memory_pool_item->data[item_size] == POOL_ITEM_END_MARK,
"Memory pool item is corrupted, end mark is not present for pool %u, item %d!\n", pool, item_index);
diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c
index 4c9e3827b0..ae87a8e326 100644
--- a/common/utils/msc/msc.c
+++ b/common/utils/msc/msc.c
@@ -49,7 +49,7 @@
//-------------------------------
-FILE* g_msc_fd;
+FILE *g_msc_fd;
char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH];
@@ -70,15 +70,11 @@ void *msc_task(void *args_p)
//------------------------------------------------------------------------------
{
MessageDef *received_message_p = NULL;
-// const char *msg_name = NULL;
-// instance_t instance = 0;
+ // const char *msg_name = NULL;
+ // instance_t instance = 0;
long timer_id;
-
itti_mark_task_ready(TASK_MSC);
-
msc_start_use();
-
-
timer_setup(0, // seconds
50000, // usec
TASK_MSC,
@@ -91,20 +87,18 @@ void *msc_task(void *args_p)
itti_receive_msg(TASK_MSC, &received_message_p);
if (received_message_p != NULL) {
-// msg_name = ITTI_MSG_NAME (received_message_p);
-// instance = ITTI_MSG_INSTANCE (received_message_p);
-
+ // msg_name = ITTI_MSG_NAME (received_message_p);
+ // instance = ITTI_MSG_INSTANCE (received_message_p);
switch (ITTI_MSG_ID(received_message_p)) {
-
case TIMER_HAS_EXPIRED: {
- msc_flush_messages();
+ msc_flush_messages();
}
break;
case TERMINATE_MESSAGE: {
fprintf(stderr, " *** Exiting MSC thread\n");
timer_remove(timer_id);
- msc_end();
+ msc_end();
itti_exit_task();
}
break;
@@ -119,6 +113,7 @@ void *msc_task(void *args_p)
}
}
}
+
fprintf(stderr, "Task MSC exiting\n");
return NULL;
}
@@ -132,15 +127,16 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
void *pointer_p;
char msc_filename[256];
fprintf(stderr, "Initializing MSC logs\n");
+ rv = snprintf(msc_filename, 256, "/tmp/openair.msc.%i.log", envP); // TODO NAME
- rv = snprintf(msc_filename, 256, "/tmp/openair.msc.%u.log", envP); // TODO NAME
- if ((0 >= rv) || (256 < rv)){
+ if ((0 >= rv) || (256 < rv)) {
fprintf(stderr, "Error in MSC log file name");
}
+
g_msc_fd = fopen(msc_filename,"w");
AssertFatal(g_msc_fd != NULL, "Could not open MSC log file %s : %s", msc_filename, strerror(errno));
-
rv = lfds611_stack_new(&g_msc_memory_stack_p, (lfds611_atom_t)max_threadsP + 2);
+
if (0 >= rv) {
AssertFatal (0, "lfds611_stack_new failed!\n");
}
@@ -153,190 +149,356 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
for (i=0; i < max_threadsP * 30; i++) {
pointer_p = malloc(MSC_MAX_MESSAGE_LENGTH);
AssertFatal (pointer_p, "malloc failed!\n");
- rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p );
- AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %u\n", i);
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p );
+ AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %d\n", i);
}
for (i = MIN_MSC_PROTOS; i < MAX_MSC_PROTOS; i++) {
switch (i) {
case MSC_IP_UE:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_IP_ENB:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if (envP == MSC_E_UTRAN_LIPA) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_NAS_UE:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_RRC_UE:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_PDCP_UE:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_RLC_UE:
- rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_UE");
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_MAC_UE:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_log_declare_proto(i);
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
}
+
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+
break;
+
case MSC_PHY_UE:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_PHY_ENB:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_MAC_ENB:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_RLC_ENB:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_PDCP_ENB:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_RRC_ENB:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_S1AP_ENB:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_GTPU_ENB:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_GTPU_SGW:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_SGW");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_MME_GW) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_S1AP_MME:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_MME");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_MME_GW) || (envP == MSC_MME) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_MMEAPP_MME:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MME_APP");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_NAS_MME:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_MME");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
msc_log_declare_proto(i);
break;
+
case MSC_NAS_EMM_MME:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_EMM");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_NAS_ESM_MME:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_ESM");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_SP_GWAPP_MME:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "SP_GW_MME");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if (envP == MSC_MME_GW) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_S11_MME:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S11_MME");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if (envP == MSC_MME) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_S6A_MME:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S6A");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
msc_log_declare_proto(i);
}
+
break;
+
case MSC_HSS:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "HSS");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
+
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
msc_log_declare_proto(i);
}
+
+ break;
+ case MSC_F1AP_CU:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "F1AP_CU");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ //if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) {
+ msc_log_declare_proto(i);
+ //}
+ break;
+ case MSC_F1AP_DU:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "F1AP_DU");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ //if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) {
+ msc_log_declare_proto(i);
+ //}
break;
default:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "UNKNOWN");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+ g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+ }
}
}
+
rv = itti_create_task (TASK_MSC, msc_task, NULL);
AssertFatal (rv == 0, "Create task for MSC failed!\n");
fprintf(stderr, "Initializing MSC logs Done\n");
@@ -359,15 +521,17 @@ void msc_flush_messages(void)
int rv;
msc_queue_item_t *item_p = NULL;
- while ((rv = lfds611_queue_dequeue( g_msc_message_queue_p, (void**)&item_p )) == 1) {
- if (NULL != item_p->message_str) {
- fputs(item_p->message_str, g_msc_fd);
- // TODO BIN DATA
- rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, item_p->message_str );
- }
- // TODO FREE BIN DATA
- free(item_p);
+ while ((rv = lfds611_queue_dequeue( g_msc_message_queue_p, (void **)&item_p )) == 1) {
+ if (NULL != item_p->message_str) {
+ fputs(item_p->message_str, g_msc_fd);
+ // TODO BIN DATA
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, item_p->message_str );
+ }
+
+ // TODO FREE BIN DATA
+ free(item_p);
}
+
fflush(g_msc_fd);
}
@@ -377,23 +541,27 @@ void msc_end(void)
//------------------------------------------------------------------------------
{
int rv;
+
if (NULL != g_msc_fd ) {
- msc_flush_messages();
+ msc_flush_messages();
rv = fflush(g_msc_fd);
- if (rv != 0) {
- fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
- }
- rv = fclose(g_msc_fd);
+
if (rv != 0) {
- fprintf(stderr, "Error while closing MSC log file: %s", strerror(errno));
+ fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
+ }
+
+ rv = fclose(g_msc_fd);
+
+ if (rv != 0) {
+ fprintf(stderr, "Error while closing MSC log file: %s", strerror(errno));
}
}
}
//------------------------------------------------------------------------------
void msc_log_declare_proto(
- const msc_proto_t protoP
- )
+ const msc_proto_t protoP
+)
//------------------------------------------------------------------------------
{
int rv = 0;
@@ -401,47 +569,55 @@ void msc_log_declare_proto(
char *char_message_p = NULL;
if ((MIN_MSC_PROTOS <= protoP) && (MAX_MSC_PROTOS > protoP)) {
- // may be build a memory pool for that also ?
- new_item_p = malloc(sizeof(msc_queue_item_t));
- if (NULL != new_item_p) {
+ // may be build a memory pool for that also ?
+ new_item_p = malloc(sizeof(msc_queue_item_t));
- rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
- if (0 == rv) {
- msc_flush_messages();
- rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
- }
- if (1 == rv) {
+ if (NULL != new_item_p) {
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
+
+ if (0 == rv) {
+ msc_flush_messages();
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
+ }
+
+ if (1 == rv) {
rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [PROTO] %d %s\n", __sync_fetch_and_add (&g_message_number, 1), protoP, &g_msc_proto2str[protoP][0]);
+
if (0 > rv) {
fprintf(stderr, "Error while declaring new protocol in MSC: %s", strerror(errno));
}
+
new_item_p->message_str = char_message_p;
new_item_p->message_str_size = rv;
new_item_p->message_bin = NULL;
new_item_p->message_bin_size = 0;
rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
- if (0 == rv) {
- rv = lfds611_queue_guaranteed_enqueue(g_msc_message_queue_p, new_item_p );
- if (0 == rv) {
+
+ if (0 == rv) {
+ rv = lfds611_queue_guaranteed_enqueue(g_msc_message_queue_p, new_item_p );
+
+ if (0 == rv) {
fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
- rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
- free(new_item_p);
- }
- }
- return;
- } else {
- fprintf(stderr, "Error while lfds611_stack_pop()\n");
- }
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+ free(new_item_p);
+ }
+ }
+
+ return;
+ } else {
+ fprintf(stderr, "Error while lfds611_stack_pop()\n");
+ }
+
free(new_item_p);
- } else {
+ } else {
fprintf(stderr, "Error while malloc in MSC");
- }
+ }
}
}
//------------------------------------------------------------------------------
void msc_log_event(
- const msc_proto_t protoP,
- char *format, ...)
+ const msc_proto_t protoP,
+ char *format, ...)
//------------------------------------------------------------------------------
{
va_list args;
@@ -450,52 +626,62 @@ void msc_log_event(
msc_queue_item_t *new_item_p = NULL;
char *char_message_p = NULL;
-
if ((MIN_MSC_PROTOS > protoP) || (MAX_MSC_PROTOS <= protoP)) {
- return;
+ return;
}
- new_item_p = malloc(sizeof(msc_queue_item_t));
- if (NULL != new_item_p) {
- rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
+ new_item_p = malloc(sizeof(msc_queue_item_t));
+
+ if (NULL != new_item_p) {
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
+
if (0 == rv) {
msc_flush_messages();
- rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
}
+
if (1 == rv) {
rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [EVENT] %d ", __sync_fetch_and_add (&g_message_number, 1), protoP);
+
if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) {
fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
goto error_event;
}
+
va_start(args, format);
rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, format, args);
va_end(args);
+
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
goto error_event;
}
+
rv += rv2;
rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n");
+
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
goto error_event;
}
+
rv += rv2;
new_item_p->message_str = char_message_p;
new_item_p->message_str_size = rv;
new_item_p->message_bin = NULL;
new_item_p->message_bin_size = 0;
rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
- if (0 == rv) {
+
+ if (0 == rv) {
fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
- rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
- free(new_item_p);
- }
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+ free(new_item_p);
+ }
} else {
fprintf(stderr, "Error while lfds611_stack_pop()\n");
- }
+ }
}
+
return;
error_event:
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
@@ -503,12 +689,12 @@ error_event:
}
//------------------------------------------------------------------------------
void msc_log_message(
- const char * const message_operationP,
- const msc_proto_t proto1P,
- const msc_proto_t proto2P,
- const uint8_t * const bytesP,
- const unsigned int num_bytes,
- char *format, ...)
+ const char *const message_operationP,
+ const msc_proto_t proto1P,
+ const msc_proto_t proto2P,
+ const uint8_t *const bytesP,
+ const unsigned int num_bytes,
+ char *format, ...)
//------------------------------------------------------------------------------
{
va_list args;
@@ -518,56 +704,65 @@ void msc_log_message(
msc_queue_item_t *new_item_p = NULL;
char *char_message_p = NULL;
-
if ((MIN_MSC_PROTOS > proto1P) || (MAX_MSC_PROTOS <= proto1P) ||
- (MIN_MSC_PROTOS > proto2P) || (MAX_MSC_PROTOS <= proto2P) ) {
+ (MIN_MSC_PROTOS > proto2P) || (MAX_MSC_PROTOS <= proto2P) ) {
return;
}
new_item_p = malloc(sizeof(msc_queue_item_t));
- if (NULL != new_item_p) {
- rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
+ if (NULL != new_item_p) {
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
+
if (0 == rv) {
msc_flush_messages();
- rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
- }
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
+ }
+
if (1 == rv) {
rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [MESSAGE] %d %s %d %"PRIu64" ",
- __sync_fetch_and_add (&g_message_number, 1), proto1P, message_operationP, proto2P, mac);
+ __sync_fetch_and_add (&g_message_number, 1), proto1P, message_operationP, proto2P, mac);
+
if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) {
fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
goto error_event;
}
+
va_start(args, format);
rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, format, args);
va_end(args);
+
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
goto error_event;
}
+
rv += rv2;
rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n");
+
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
goto error_event;
}
+
rv += rv2;
new_item_p->message_str = char_message_p;
new_item_p->message_str_size = rv;
new_item_p->message_bin = NULL; // TO DO
new_item_p->message_bin_size = 0; // TO DO
rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
- if (0 == rv) {
+
+ if (0 == rv) {
fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
- rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
- free(new_item_p);
- }
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+ free(new_item_p);
+ }
} else {
fprintf(stderr, "Error while lfds611_stack_pop()\n");
msc_flush_messages();
- }
+ }
}
+
return;
error_event:
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
@@ -578,8 +773,7 @@ error_event:
// function called when oai loader loads the msc shared lib
int msc_autoinit(msc_interface_t *msc_interface)
//------------------------------------------------------------------------------
- {
-
+{
msc_interface->msc_init = msc_init;
msc_interface->msc_start_use = msc_start_use;
msc_interface->msc_end = msc_end;
@@ -587,4 +781,4 @@ int msc_autoinit(msc_interface_t *msc_interface)
msc_interface->msc_log_message = msc_log_message;
msc_interface->msc_loaded = 1;
return 0;
- }
+}
diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h
index e8a8a4a0e8..49c99abb56 100644
--- a/common/utils/msc/msc.h
+++ b/common/utils/msc/msc.h
@@ -25,46 +25,48 @@
#include
typedef enum {
- MIN_MSC_ENV = 0,
- MSC_E_UTRAN = MIN_MSC_ENV,
- MSC_E_UTRAN_LIPA,
- MSC_MME_GW,
- MSC_MME,
- MSC_SP_GW,
- MAX_MSC_ENV
+ MIN_MSC_ENV = 0,
+ MSC_E_UTRAN = MIN_MSC_ENV,
+ MSC_E_UTRAN_LIPA,
+ MSC_MME_GW,
+ MSC_MME,
+ MSC_SP_GW,
+ MAX_MSC_ENV
} msc_env_t;
typedef enum {
- MIN_MSC_PROTOS = 0,
- MSC_IP_UE = MIN_MSC_PROTOS,
- MSC_NAS_UE,
- MSC_RRC_UE,
- MSC_PDCP_UE,
- MSC_RLC_UE,
- MSC_MAC_UE,
- MSC_PHY_UE,
- MSC_PHY_ENB,
- MSC_MAC_ENB,
- MSC_RLC_ENB,
- MSC_PDCP_ENB,
- MSC_RRC_ENB,
- MSC_IP_ENB,
- MSC_S1AP_ENB,
- MSC_GTPU_ENB,
- MSC_GTPU_SGW,
- MSC_S1AP_MME,
- MSC_MMEAPP_MME,
- MSC_NAS_MME,
- MSC_NAS_EMM_MME,
- MSC_NAS_ESM_MME,
- MSC_SP_GWAPP_MME,
- MSC_S11_MME,
- MSC_S6A_MME,
- MSC_HSS,
- MAX_MSC_PROTOS,
- MSC_X2AP_SRC_ENB,
- MSC_X2AP_TARGET_ENB,
+ MIN_MSC_PROTOS = 0,
+ MSC_IP_UE = MIN_MSC_PROTOS,
+ MSC_NAS_UE,
+ MSC_RRC_UE,
+ MSC_PDCP_UE,
+ MSC_RLC_UE,
+ MSC_MAC_UE,
+ MSC_PHY_UE,
+ MSC_PHY_ENB,
+ MSC_MAC_ENB,
+ MSC_RLC_ENB,
+ MSC_PDCP_ENB,
+ MSC_RRC_ENB,
+ MSC_IP_ENB,
+ MSC_S1AP_ENB,
+ MSC_GTPU_ENB,
+ MSC_GTPU_SGW,
+ MSC_S1AP_MME,
+ MSC_MMEAPP_MME,
+ MSC_NAS_MME,
+ MSC_NAS_EMM_MME,
+ MSC_NAS_ESM_MME,
+ MSC_SP_GWAPP_MME,
+ MSC_S11_MME,
+ MSC_S6A_MME,
+ MSC_HSS,
+ MSC_F1AP_CU,
+ MSC_F1AP_DU,
+ MSC_X2AP_SRC_ENB,
+ MSC_X2AP_TARGET_ENB,
+ MAX_MSC_PROTOS,
} msc_proto_t;
@@ -73,22 +75,22 @@ typedef enum {
#define MSC_AS_TIME_FMT "%05u:%02u"
#define MSC_AS_TIME_ARGS(CTXT_Pp) \
- (CTXT_Pp)->frame, \
- (CTXT_Pp)->subframe
+ (CTXT_Pp)->frame, \
+ (CTXT_Pp)->subframe
typedef int(*msc_init_t)(const msc_env_t, const int );
typedef void(*msc_start_use_t)(void );
typedef void(*msc_end_t)(void);
typedef void(*msc_log_event_t)(const msc_proto_t,char *, ...);
-typedef void(*msc_log_message_t)(const char * const, const msc_proto_t, const msc_proto_t,
- const uint8_t* const, const unsigned int, char * , ...);
+typedef void(*msc_log_message_t)(const char *const, const msc_proto_t, const msc_proto_t,
+ const uint8_t *const, const unsigned int, char *, ...);
typedef struct msc_interface {
- int msc_loaded;
- msc_init_t msc_init;
- msc_start_use_t msc_start_use;
- msc_end_t msc_end;
- msc_log_event_t msc_log_event;
- msc_log_message_t msc_log_message;
+ int msc_loaded;
+ msc_init_t msc_init;
+ msc_start_use_t msc_start_use;
+ msc_end_t msc_end;
+ msc_log_event_t msc_log_event;
+ msc_log_message_t msc_log_message;
} msc_interface_t;
#ifdef MSC_LIBRARY
@@ -99,15 +101,17 @@ void msc_end(void);
void msc_log_declare_proto(const msc_proto_t protoP);
void msc_log_event(const msc_proto_t protoP,char *format, ...);
void msc_log_message(
- const char * const message_operationP,
- const msc_proto_t receiverP,
- const msc_proto_t senderP,
- const uint8_t* const bytesP,
- const unsigned int num_bytes,
- char *format, ...);
+ const char *const message_operationP,
+ const msc_proto_t receiverP,
+ const msc_proto_t senderP,
+ const uint8_t *const bytesP,
+ const unsigned int num_bytes,
+ char *format, ...);
#else
+#define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded
+
msc_interface_t msc_interface;
#define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2)
#define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use
@@ -119,4 +123,4 @@ msc_interface_t msc_interface;
#define MSC_LOG_TX_MESSAGE_FAILED(sENDER, rECEIVER, bYTES, nUMbYTES, fORMAT, aRGS...) if(msc_interface.msc_loaded) msc_interface.msc_log_message("-x",sENDER, rECEIVER, (const uint8_t *)bYTES, nUMbYTES, fORMAT, ##aRGS)
#endif
-#endif
+#endif
diff --git a/common/utils/ocp_itti/all_msg.h b/common/utils/ocp_itti/all_msg.h
index f439572400..bbbe576e1b 100644
--- a/common/utils/ocp_itti/all_msg.h
+++ b/common/utils/ocp_itti/all_msg.h
@@ -13,3 +13,4 @@
#include "openair2/COMMON/udp_messages_def.h"
#include "openair2/COMMON/gtpv1_u_messages_def.h"
#include "openair2/COMMON/flexran_messages_def.h"
+#include "openair2/COMMON/f1ap_messages_def.h"
diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp
index 5b8d1a430e..3d0bd0e1a3 100644
--- a/common/utils/ocp_itti/intertask_interface.cpp
+++ b/common/utils/ocp_itti/intertask_interface.cpp
@@ -1,6 +1,6 @@
/*
Author: Laurent THOMAS, Open Cells
- copyleft: OpenAirInterface Software Alliance and it's licence
+ copyleft: OpenAirInterface Software Alliance and it's licence
*/
#include
#include
@@ -122,7 +122,7 @@ extern "C" {
pthread_mutex_unlock (&t->queue_cond_lock);
t->admin.func(NULL);
pthread_mutex_lock (&t->queue_cond_lock);
- }
+ }
pthread_mutex_unlock (&t->queue_cond_lock);
return ret;
}
@@ -290,12 +290,12 @@ extern "C" {
struct sched_param sparam;
memset(&sparam, 0, sizeof(sparam));
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO)-10;
- policy = SCHED_FIFO ;
+ policy = SCHED_FIFO ;
if (pthread_setschedparam(t->thread, policy, &sparam) != 0) {
LOG_E(TMR,"task %s : Failed to set pthread priority\n", itti_get_task_name(task_id) );
}
}
-#endif
+#endif
return 0;
}
diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h
index 9194f88dc0..97c820edf5 100644
--- a/common/utils/ocp_itti/intertask_interface.h
+++ b/common/utils/ocp_itti/intertask_interface.h
@@ -1,6 +1,6 @@
/*
Author: Laurent THOMAS, Open Cells
- Copyleft: OpenAirInterface software alliance and it's licence
+ Copyleft: OpenAirInterface software alliance and it's licence
*/
#ifndef INTERTASK_INTERFACE_H_
#define INTERTASK_INTERFACE_H_
@@ -302,6 +302,8 @@ typedef struct {
TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\
+ TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
+ TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAX, TASK_PRIORITY_MED, 200, NULL, NULL)
#define TASK_DEF(TaskID, pRIO, qUEUEsIZE, FuNc, ThreadFunc) { pRIO, qUEUEsIZE, #TaskID, FuNc, ThreadFunc },
diff --git a/common/utils/telnetsrv/DOC/telnetaddcmd.md b/common/utils/telnetsrv/DOC/telnetaddcmd.md
new file mode 100644
index 0000000000..c759128254
--- /dev/null
+++ b/common/utils/telnetsrv/DOC/telnetaddcmd.md
@@ -0,0 +1,116 @@
+# code example of adding a command to the telnet server
+
+The following example is extracted from [the oai `openair1/PHY/CODING/coding_load.c` file](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/CODING/coding_load.c).
+
+```c
+/*
+include the telnet server data structures and API definitions
+*/
+#include "common/utils/telnetsrv/telnetsrv.h"
+
+
+/*
+define the null terminated array of telnetshell_cmddef_t structures
+which map each sub-command string to a function implementing it.
+you may also provide a help string which will be printed when
+the global help command is used. The prototype for the function
+implementing sub commands must match the `cmdfunc_t` type defined
+in `telnetsrv.h`
+*/
+static int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt);
+static telnetshell_cmddef_t coding_cmdarray[] = {
+ {"mode","[sse,avx2,stdc,none]",coding_setmod_cmd},
+ {"","",NULL},
+};
+
+/*
+define the null terminated list of telnetshell_vardef_t structures defining the
+variables that can be set and get using the pre-defined get and set command
+of the telnet server
+*/
+telnetshell_vardef_t coding_vardef[] = {
+{"maxiter",TELNET_VARTYPE_INT32,&max_turbo_iterations},
+{"",0,NULL}
+};
+.................
+/*
+ look for telnet server, if it is loaded, add the coding commands to it
+ we use the shared library loader API to check the telnet server availibility
+The telnet server TELNET_ADDCMD_FNAME function takes three arguments:
+1. The name of the telnet command to be added, here "coding"
+1. The `coding_cmdarray` list of "coding" sub-commands we defined earlier
+1. The `coding_varde f`list of variables we defined earlier
+*/
+ add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);
+ if (addcmd != NULL) {
+ addcmd("coding",coding_vardef,coding_cmdarray);
+.......
+/*
+ functions implementing the "coding mode" sub command, as defined in
+ the `coding_cmdarray` passed earlier to the TELNET_ADDCMD_FNAME function.
+ This function will be called by the telnet server, when the `coding_cmdarray`
+ command is received from the telnet client
+*/
+int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt)
+{
+ /*
+ 1. buff argument is an input argument, pointer to the string received
+ from the telnet client, the command and sub-command parts are removed
+ In this case it points after "coding setmod" and is of no use as
+ we don't have second level sub-commands.
+ 1. debug argument is an input argument set by the telnet server
+ 1. prnt arguments is also an input argument, a function pointer, to be used
+ in place of printf to print messages on the telnet client interface. As this function
+ is called by the telnet server stdout points to the main executable console,
+ */
+ if (debug > 0)
+ prnt( "coding_setmod_cmd received %s\n",buff);
+
+ if (strcasestr(buff,"sse") != NULL) {
+ decoding_setmode(MODE_DECODE_SSE);
+ } else if (strcasestr(buff,"avx2") != NULL) {
+ decoding_setmode(MODE_DECODE_AVX2);
+ } else if (strcasestr(buff,"stdc") != NULL) {
+ decoding_setmode(MODE_DECODE_C);
+ } else if (strcasestr(buff,"none") != NULL) {
+ decoding_setmode(MODE_DECODE_NONE);
+ } else {
+ prnt("%s: wrong setmod parameter...\n",buff);
+ }
+ prnt("Coding and decoding current mode: %s\n",modedesc[curmode]);
+ return 0;
+}
+
+..............
+
+```
+# telnet server API
+
+```c
+int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd)
+```
+Add a command and the `cmd` list of sub-commands to the telnet server. After a successful call to `add_telnetcmd` function, the telnet server calls the function defined for each sub-commands in the null terminated `cmd` array, when the character string received from the telnet client matches the command and sub-command strings.
+Also adds the list of variables described in the `var` array to the list of variable which can be set and read.
+The function returns -1 if one argument is NULL.
+The telnet server is dynamically loaded, to use the `add_telnetcmd` function, the shared library loader API should be used to check the availability of the telnet server and retrieve it's address, as shown in [the example at the top of this page](telnetaddcmd.md#code-example-of-adding-a-command-to-the-telnet-server).
+
+# telnet server public data types
+## `telnetshell_vardef_t`structure
+ This structure is used by developers to describe the variables that can be set or read using the get,set and getall sub-commands.
+
+| Fields | type |Description |
+|:-----------|:------:|:-----------------------|
+| `varname` | `char[TELNET_CMD_MAXSIZE]` | variable name, as specified when using the get and set commands. |
+| `vartype` | `char` | Defines the type of the variable pointed by the `varvalptr`field. Supported values: TELNET_VARTYPE_INT32 TELNET_VARTYPE_INT16 TELNET_VARTYPE_INT64 TELNET_VARTYPE_STRING TELNET_VARTYPE_DOUBLE |
+| `varvalptr` | `void*` | Defines the type of the variable pointed by the `varvalptr`field |
+
+## `telnetshell_cmddef_t`structure
+ This structure is used by developers to describe the first level sub-commands to be added to the telnet server.
+
+| Fields | type |Description |
+|:-----------|:------:|:-----------------------|
+| `cmdname` | `char[TELNET_CMD_MAXSIZE]` | command name, as tested by the telnet server to check it should call the `cmdfunc` function |
+| `helpstr` | `char[TELNET_HELPSTR_SIZE]` | character string to print when the elp`command is received from the telnet client |
+| `cmdfunc` | `cmdfunc_t` | pointer to the function implementing the `cmdname` sub command. |
+
+[oai telnet server home](telnetsrv.md)
diff --git a/common/utils/telnetsrv/DOC/telnetarch.md b/common/utils/telnetsrv/DOC/telnetarch.md
new file mode 100644
index 0000000000..ebb2342c22
--- /dev/null
+++ b/common/utils/telnetsrv/DOC/telnetarch.md
@@ -0,0 +1,21 @@
+# telnet server principles
+
+The oai telnet server is implemented in a shared library to be loaded by the [oai shared library loader](loader). The implementation includes a `telnetsrv_autoinit` function which is automatically called at load time, starts the telnet server and registers a first set of commands, which are delivered with the server (telnet, softmodem, loader).
+
+Currently the telnet server only supports one user connection. The same dedicated thread is used to wait for a user connection and process the input received from this connection.
+
+The telnet server provides an API which can be used by any oai component to add new CLI commands to the server. A pre-defined command can be used to get or set a list of variables.
+
+
+
+# telnet server source files
+
+telnet server source files are located in [common/utils/telnetsrv](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv)
+
+1. [telnetsrv.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.c) contains the telnet server implementation, including the implementation of the telnet CLI command.
+1. [telnetsrv.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.h) is the telnet server include file containing both private and public data type definitions. It also contains API prototypes for functions that are used to register a new command in the server.
+1. `telnetsrv\_\.c`: implementation of \ CLI command which are delivered with the telnet server.
+1. `telnetsrv\_\.h`: include file for the implementation of XXX CLI command. Usually included only in the corresponding `.c`file
+1. [telnetsrv_CMakeLists.txt](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/telnetsrv/telnetsrv_CMakeLists.txt): CMakelists file containing the cmake instructions to build the telnet server. this file is included in the [global oai CMakelists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt).
+
+[oai telnet server home](telnetsrv.md)
diff --git a/common/utils/telnetsrv/DOC/telnetgetset.md b/common/utils/telnetsrv/DOC/telnetgetset.md
new file mode 100644
index 0000000000..d851e90a8f
--- /dev/null
+++ b/common/utils/telnetsrv/DOC/telnetgetset.md
@@ -0,0 +1,21 @@
+getall command can be used to get the list of variables that can bet set or get from the telnet shell. Knowing the names of the variables they can then be set or read. Setting a variable is not always relevant, the telnet server doesn't provide a mechanism to restrict the set command.
+
+```bash
+softmodem> telnet getall
+telnet, debug = 0
+telnet, prio = 0
+telnet, loopc = 10
+telnet, loopd = 5000
+telnet, phypb = 65000
+telnet, hsize = 50
+telnet, hfile = "oaitelnet.history"
+softmodem> telnet set loopc 100
+telnet, loopc set to
+100
+softmodem> telnet get loopc
+telnet, loopc = 100
+softmodem>
+
+```
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
diff --git a/common/utils/telnetsrv/DOC/telnethelp.md b/common/utils/telnetsrv/DOC/telnethelp.md
new file mode 100644
index 0000000000..b18f5caae7
--- /dev/null
+++ b/common/utils/telnetsrv/DOC/telnethelp.md
@@ -0,0 +1,57 @@
+# oai telnet server global help
+
+``` bash
+alblf@at8020-a:~$ telnet 10.133.10.77 9090
+Trying 10.133.10.77...
+Connected to 10.133.10.77.
+Escape character is '^]'.
+
+softmodem> help
+ module 0 = telnet:
+ telnet [get set] debug
+ telnet [get set] prio
+ telnet [get set] loopc
+ telnet [get set] loopd
+ telnet [get set] phypb
+ telnet [get set] hsize
+ telnet [get set] hfile
+ telnet redirlog [here,file,off]
+ telnet param [prio]
+ telnet history [list,reset]
+ module 1 = softmodem:
+ softmodem show loglvl|thread|config
+ softmodem log (enter help for details)
+ softmodem thread (enter help for details)
+ softmodem exit
+ module 2 = phy:
+ phy disp [phycnt,uedump,uestat UE]
+ module 3 = loader:
+ loader [get set] mainversion
+ loader [get set] defpath
+ loader [get set] maxshlibs
+ loader [get set] numshlibs
+ loader show [params,modules]
+ module 4 = coding:
+ coding [get set] maxiter
+ coding mode [sse,avx2,stdc,none]
+softmodem>
+```
+
+# oai telnet server, specific commands help
+
+``` bash
+softmodem> softmodem log help
+ log sub commands:
+ show: display current log configuration
+ online, noonline: enable or disable console logs
+ enable, disable id1-id2: enable or disable logs for components index id1 to id2
+ level_ id1-id2: set log level to for components index id1 to id2
+ level_ id1-id2: set log verbosity to for components index id1 to id2
+use the show command to get the values for , and the list of component indexes that can be used for id1 and id2
+softmodem>
+
+
+```
+
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
diff --git a/common/utils/telnetsrv/DOC/telnethist.md b/common/utils/telnetsrv/DOC/telnethist.md
new file mode 100644
index 0000000000..b7cf152502
--- /dev/null
+++ b/common/utils/telnetsrv/DOC/telnethist.md
@@ -0,0 +1,44 @@
+The telnet server implements a simple history system
+```bash
+softmodem> telnet history list
+1: telnet history list
+2: telnet history list
+3: help
+4: loader show modules
+5: softmodem show loglvl
+6: help
+7: telnet history
+8: help
+9: telnet history list
+10: help
+11: loader show modules
+12: softmodem show loglvl
+13: softmodem log help
+14: softmodem log disable 0-35
+15: softmodem log show
+16: help
+17: telnet history list
+18: loader show modules
+19: softmodem thread show
+20: help
+21: softmodem thread help
+22: softmodem log show
+23: softmodem log help
+24: softmodem log level_error 0-4
+25: loader show modules
+26: loader show config
+27: help
+28: loader show params
+29: loader show modules
+softmodem> !28
+softmodem> loader show params
+loader parameters:
+ Main executable build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100"
+ Default shared lib path: ""
+ Max number of shared lib : 10
+softmodem>
+
+```
+
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
diff --git a/common/utils/telnetsrv/DOC/telnetloader.md b/common/utils/telnetsrv/DOC/telnetloader.md
new file mode 100644
index 0000000000..d6a0f158c6
--- /dev/null
+++ b/common/utils/telnetsrv/DOC/telnetloader.md
@@ -0,0 +1,47 @@
+loader command can be used to check loader configuration parameters and the list of loaded shared libraries and for each library the list of available functions.
+
+```bash
+softmodem> loader show params
+loader parameters:
+ Main executable build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100"
+ Default shared lib path: ""
+ Max number of shared lib : 10
+softmodem> loader show modules
+4 shared lib have been dynamicaly loaded by the oai loader
+ Module 0: telnetsrv
+ Shared library build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100"
+ Shared library path: "libtelnetsrv.so"
+ 1 function pointers registered:
+ function 0 add_telnetcmd at 0x7ff8b772a2b0
+ Module 1: NB_IoT
+ Shared library build version: ""
+ Shared library path: "libNB_IoT.so"
+ 1 function pointers registered:
+ function 0 RCConfig_NbIoT at 0x7ff8b6b1b390
+ Module 2: coding
+ Shared library build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100"
+ Shared library path: "libcoding.so"
+ 13 function pointers registered:
+ function 0 init_td8 at 0x7ff8adde63a0
+ function 1 init_td16 at 0x7ff8adde9760
+ function 2 init_td16avx2 at 0x7ff8addec050
+ function 3 phy_threegpplte_turbo_decoder8 at 0x7ff8adde6780
+ function 4 phy_threegpplte_turbo_decoder16 at 0x7ff8adde9a90
+ function 5 phy_threegpplte_turbo_decoder_scalar at 0x7ff8addef4a0
+ function 6 phy_threegpplte_turbo_decoder16avx2 at 0x7ff8addec530
+ function 7 free_td8 at 0x7ff8adde61d0
+ function 8 free_td16 at 0x7ff8adde9590
+ function 9 free_td16avx2 at 0x7ff8addebe80
+ function 10 threegpplte_turbo_encoder_sse at 0x7ff8adde45b0
+ function 11 threegpplte_turbo_encoder at 0x7ff8adde4a30
+ function 12 init_encoder_sse at 0x7ff8adde49d0
+ Module 3: oai_device
+ Shared library build version: ""
+ Shared library path: "liboai_device_usrp.so"
+ 1 function pointers registered:
+ function 0 device_init at 0x7ff8ac16a7a0
+softmodem>
+```
+
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
diff --git a/common/utils/telnetsrv/DOC/telnetlog.md b/common/utils/telnetsrv/DOC/telnetlog.md
new file mode 100644
index 0000000000..36c5cfb348
--- /dev/null
+++ b/common/utils/telnetsrv/DOC/telnetlog.md
@@ -0,0 +1,96 @@
+The log command can be used to get the status of the log parameters and to dynamically modify these parameters. The log command has its own [help](telnethelp.md#oai-telnet-server-specific-commands-help)
+```bash
+softmodem> softmodem log disable 0-35
+log level/verbosity comp 0 PHY set to info / medium (disabled)
+log level/verbosity comp 1 MAC set to info / medium (disabled)
+log level/verbosity comp 2 EMU set to info / medium (disabled)
+log level/verbosity comp 3 OCG set to info / medium (disabled)
+log level/verbosity comp 4 OMG set to info / medium (disabled)
+log level/verbosity comp 5 OPT set to info / medium (disabled)
+log level/verbosity comp 6 OTG set to info / medium (disabled)
+log level/verbosity comp 7 OTG_LATENCY set to info / medium (disabled)
+log level/verbosity comp 8 OTG_LATENCY_BG set to info / medium (disabled)
+log level/verbosity comp 9 OTG_GP set to info / medium (disabled)
+log level/verbosity comp 10 OTG_GP_BG set to info / medium (disabled)
+log level/verbosity comp 11 OTG_JITTER set to info / medium (disabled)
+log level/verbosity comp 12 RLC set to info / medium (disabled)
+log level/verbosity comp 13 PDCP set to info / medium (disabled)
+log level/verbosity comp 14 RRC set to info / medium (disabled)
+log level/verbosity comp 15 NAS set to info / medium (disabled)
+log level/verbosity comp 16 PERF set to info / medium (disabled)
+log level/verbosity comp 17 OIP set to info / medium (disabled)
+log level/verbosity comp 18 CLI set to info / medium (disabled)
+log level/verbosity comp 19 MSC set to info / medium (disabled)
+log level/verbosity comp 20 OCM set to info / medium (disabled)
+log level/verbosity comp 21 UDP set to info / medium (disabled)
+log level/verbosity comp 22 GTPV1U set to info / medium (disabled)
+log level/verbosity comp 23 comp23? set to info / medium (disabled)
+log level/verbosity comp 24 S1AP set to info / medium (disabled)
+log level/verbosity comp 25 SCTP set to info / medium (disabled)
+log level/verbosity comp 26 HW set to info / medium (disabled)
+log level/verbosity comp 27 OSA set to info / medium (disabled)
+log level/verbosity comp 28 eRAL set to info / medium (disabled)
+log level/verbosity comp 29 mRAL set to info / medium (disabled)
+log level/verbosity comp 30 ENB_APP set to info / medium (disabled)
+log level/verbosity comp 31 FLEXRAN_AGENT set to info / medium (disabled)
+log level/verbosity comp 32 TMR set to info / medium (disabled)
+log level/verbosity comp 33 USIM set to info / medium (disabled)
+log level/verbosity comp 34 LOCALIZE set to info / medium (disabled)
+log level/verbosity comp 35 RRH set to info / medium (disabled)
+softmodem> softmodem log show
+Available log levels:
+ emerg alert crit error warn notice info debug file trace
+Available verbosity:
+ none low medium high full
+component verbosity level enabled
+00 PHY: medium info N
+01 MAC: medium info N
+02 EMU: medium info N
+03 OCG: medium info N
+04 OMG: medium info N
+05 OPT: medium info N
+06 OTG: medium info N
+07 OTG_LATENCY: medium info N
+08 OTG_LATENCY_BG: medium info N
+09 OTG_GP: medium info N
+10 OTG_GP_BG: medium info N
+11 OTG_JITTER: medium info N
+12 RLC: medium info N
+13 PDCP: medium info N
+14 RRC: medium info N
+15 NAS: medium info N
+16 PERF: medium info N
+17 OIP: medium info N
+18 CLI: medium info N
+19 MSC: medium info N
+20 OCM: medium info N
+21 UDP: medium info N
+22 GTPV1U: medium info N
+23 comp23?: medium info N
+24 S1AP: medium info N
+25 SCTP: medium info N
+26 HW: medium info N
+27 OSA: medium info N
+28 eRAL: medium info N
+29 mRAL: medium info N
+30 ENB_APP: medium info N
+31 FLEXRAN_AGENT: medium info N
+32 TMR: medium info N
+33 USIM: medium info N
+34 LOCALIZE: medium info N
+35 RRH: medium info N
+36 comp36?: medium info Y
+37 LOADER: medium alert Y
+softmodem> softmodem log level_error 0-4
+log level/verbosity comp 0 PHY set to error / medium (enabled)
+log level/verbosity comp 1 MAC set to error / medium (enabled)
+log level/verbosity comp 2 EMU set to error / medium (enabled)
+log level/verbosity comp 3 OCG set to error / medium (enabled)
+log level/verbosity comp 4 OMG set to error / medium (enabled)
+softmodem> exit
+Connection closed by foreign host.
+```
+
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/telnetsrv/DOC/telnetloop.md b/common/utils/telnetsrv/DOC/telnetloop.md
new file mode 100644
index 0000000000..a86baad6eb
--- /dev/null
+++ b/common/utils/telnetsrv/DOC/telnetloop.md
@@ -0,0 +1,40 @@
+The telnet server includes a **_loop_** command that can be used to iterate a given command. The number of iterations and the delay, in ms between two iterations can be modified, as shown in the following example:
+
+```bash
+softmodem> telnet get loopc
+telnet, loopc = 10
+softmodem> telnet get loopd
+telnet, loopd = 2000
+softmodem> telnet set loopd 1000
+telnet, loopd set to
+1000
+softmodem> loop softmodem show thread
+ 2018-03-27 17:58:49.000 2/10
+ id name state USRmod KRNmod prio nice vsize proc pol
+
+ 3946 lte-softmodem S 20005 9440 20 0 236560384 2 0 other
+
+ 3946 lte-softmodem S 7 95 20 0 236560384 2 0 other
+ 3948 telnet R 0 0 20 0 236560384 2 0 other
+ 3949 ITTI acceptor S 2 9 20 0 236560384 2 0 other
+ 3951 ITTI 12 S 2 2 20 0 236560384 7 0 other
+ 3952 ITTI 11 S 0 0 20 0 236560384 0 0 other
+ 3953 ITTI 9 S 0 0 20 0 236560384 1 0 other
+ 3954 ITTI 7 S 0 0 20 0 236560384 7 0 other
+ 3955 ITTI 8 S 0 0 20 0 236560384 7 0 other
+ 3956 ITTI 4 S 35 0 20 0 236560384 2 0 other
+ 3957 ru_thread S 15366 3072 -10 0 236560384 0 2 rt: rr
+ 3958 ru_thread_prach S 0 0 -10 0 236560384 7 1 rt: fifo
+ 3959 fep_thread S 1874 123 -10 0 236560384 5 1 rt: fifo
+ 3960 feptx_thread S 1554 101 -10 0 236560384 7 1 rt: fifo
+ 3969 ru_thread S 0 0 -10 0 236560384 0 2 rt: rr
+ 3970 ru_thread S 1313 5522 -10 0 236560384 5 2 rt: rr
+ 3971 ru_thread S 4 6 -10 0 236560384 1 2 rt: rr
+ 3972 lte-softmodem S 318 9 -10 0 236560384 7 1 rt: fifo
+ 3973 lte-softmodem S 6 13 -10 0 236560384 4 1 rt: fifo
+
+```
+A **_loop_** command can be interrupted by pressing the **_enter_** key till getting the prompt.
+
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
diff --git a/common/utils/telnetsrv/DOC/telnetsrv.md b/common/utils/telnetsrv/DOC/telnetsrv.md
new file mode 100644
index 0000000000..11c6cf071f
--- /dev/null
+++ b/common/utils/telnetsrv/DOC/telnetsrv.md
@@ -0,0 +1,7 @@
+The oai embedded telnet server is an optional monitoring and debugging tool. It provides a simple Command Line Interface to the oai softmem. New commands can easily be added by developers to the telnet server.
+
+* [Using the telnet server](telnetusage.md)
+* [Adding commands to the oai telnet server](telnetaddcmd.md)
+* [telnet server architecture ](telnetarch.md)
+
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/telnetsrv/DOC/telnetusage.md b/common/utils/telnetsrv/DOC/telnetusage.md
new file mode 100644
index 0000000000..0356143226
--- /dev/null
+++ b/common/utils/telnetsrv/DOC/telnetusage.md
@@ -0,0 +1,39 @@
+# starting the softmodem with the telnet server
+By default the embedded telnet server, which is implemented in a shared library, is not built. It can be built after compiling the softmodem executable using the `build_oai` script:
+
+```bash
+ cd \/openairinterface5g
+ source oaienv
+ cd cmake_targets
+ ./build_oai --build-telnetsrv
+```
+
+This will create the `libtelnetsrv.so` file in the `targets/bin` and `cmake_targets/lte_build_oai/build` sub directories of the oai repository.
+
+When starting the softmodem, you must specify the **_\-\-telnetsrv_** option to load and start the telnet server. The telnet server is loaded via the [oai shared library loader](loader).
+
+# using the Command Line Interface
+By default the telnet server listen on all the ip addresses configured on the system and on port 9090. This behavior can be changed using the `listenaddr` and `listenport` parameters.
+The telnet server includes a basic help, listing available commands and some commands also provide a specific detailed help sub-command.
+Below are examples of telnet sessions:
+
+* [getting help](telnethelp.md)
+* [using the history](telnethist.md)
+* [using the get and set commands](telnetgetset.md)
+* [using the loop command](telnetloop.md)
+* [loader command](telnetloader.md)
+* [log command](telnetlog.md)
+
+# telnet server parameters
+The telnet server is using the [oai configuration module](Config/Rtusage). Telnet parameters must be specified in the `telnetsrv` section. Some parameters can be modified via the telnet telnet server command, as specified in the last column of the following table.
+
+| name | type | default | description | dynamic |
+|:---:|:---:|:---:|:----|:----:|
+| `listenaddr` | `ipV4 address, ascii format` | "0.0.0.0" | local address the server is listening on| N |
+| `listenport` | `integer` | 9090 | port number the server is listening on | N |
+| `loopcount` | `integer` | 10 | number of iterations for the loop command | Y |
+| `loopdelay` | `integer` | 5000 | delay (in ms) between 2 loop command iterations | Y |
+| `histfile` | `character string` | "oaitelnet.history" | file used for command history persistency | Y |
+| `histfsize` | `integer` | 50 | maximum number of commands saved in the history | Y |
+
+[oai telnet server home](telnetsrv.md)
diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c
index a49311d099..7f8645be02 100644
--- a/common/utils/telnetsrv/telnetsrv.c
+++ b/common/utils/telnetsrv/telnetsrv.c
@@ -51,14 +51,14 @@
#include
#include
#include
-#include "common/utils/load_module_shlib.h"
+#include "common/utils/load_module_shlib.h"
#include "common/config/config_userapi.h"
#include
#include "telnetsrv_phycmd.h"
-#include "telnetsrv_proccmd.h"
-static char* telnet_defstatmod[] = {"softmodem","phy","loader"};
+#include "telnetsrv_proccmd.h"
+static char *telnet_defstatmod[] = {"softmodem","phy","loader","measur"};
static telnetsrv_params_t telnetparams;
#define TELNETSRV_LISTENADDR 0
#define TELNETSRV_LISTENPORT 1
@@ -66,179 +66,169 @@ static telnetsrv_params_t telnetparams;
#define TELNETSRV_DEBUG 3
#define TELNETSRV_LOOPC 4
#define TELNETSRV_LOOPD 5
-#define TELNETSRV_HISFILE 6
-#define TELNETSRV_HISSIZE 7
-#define TELNETSRV_PHYBSIZE 8
+#define TELNETSRV_HISFILE 6
+#define TELNETSRV_HISSIZE 7
+#define TELNETSRV_PHYBSIZE 8
#define TELNETSRV_STATICMOD 9
#define TELNETSRV_SHRMOD 10
paramdef_t telnetoptions[] = {
-/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
-/* configuration parameters for telnet utility */
-/* optname helpstr paramflags XXXptr defXXXval type numelt */
-/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
- {"listenaddr", "", 0, uptr:&telnetparams.listenaddr, defstrval:"0.0.0.0", TYPE_IPV4ADDR, 0 },
- {"listenport", "", 0, uptr:&(telnetparams.listenport), defuintval:9090, TYPE_UINT, 0 },
- {"priority", "