Commit c6d43476 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/enhance_CI_extEPC' into develop_integration_2019_w25

parents 8f68d596 983f7597
...@@ -25,7 +25,7 @@ function build_usage { ...@@ -25,7 +25,7 @@ function build_usage {
echo " Original Author: Raphael Defosseux" echo " Original Author: Raphael Defosseux"
echo " Requirements:" echo " Requirements:"
echo " -- uvtool uvtool-libvirt apt-cacher" echo " -- uvtool uvtool-libvirt apt-cacher"
echo " -- xenial image already synced" echo " -- $VM_OSREL image already synced"
echo " Default:" echo " Default:"
echo " -- eNB with USRP" echo " -- eNB with USRP"
echo "" echo ""
...@@ -33,31 +33,8 @@ function build_usage { ...@@ -33,31 +33,8 @@ function build_usage {
echo "------" echo "------"
echo " oai-ci-vm-tool build [OPTIONS]" echo " oai-ci-vm-tool build [OPTIONS]"
echo "" echo ""
echo "Mandatory Options:" command_options_usage
echo "--------"
echo " --job-name #### OR -jn ####"
echo " Specify the name of the Jenkins job."
echo ""
echo " --build-id #### OR -id ####"
echo " Specify the build ID of the Jenkins job."
echo ""
echo " --workspace #### OR -ws ####"
echo " Specify the workspace."
echo ""
echo "Options:"
echo "--------"
variant_usage
echo " Specify the variant to build."
echo ""
echo " --keep-vm-alive OR -k"
echo " Keep the VM alive after the build."
echo ""
echo " --daemon OR -D"
echo " Run as daemon"
echo ""
echo " --help OR -h"
echo " Print this help message."
echo ""
} }
function build_on_vm { function build_on_vm {
...@@ -95,7 +72,7 @@ function build_on_vm { ...@@ -95,7 +72,7 @@ function build_on_vm {
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
echo "############################################################" echo "############################################################"
acquire_vm_create_lock acquire_vm_create_lock
uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml uvt-kvm create $VM_NAME release=$VM_OSREL --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml
echo "Waiting for VM to be started" echo "Waiting for VM to be started"
uvt-kvm wait $VM_NAME --insecure uvt-kvm wait $VM_NAME --insecure
......
...@@ -25,7 +25,7 @@ function create_usage { ...@@ -25,7 +25,7 @@ function create_usage {
echo " Original Author: Raphael Defosseux" echo " Original Author: Raphael Defosseux"
echo " Requirements:" echo " Requirements:"
echo " -- uvtool uvtool-libvirt apt-cacher" echo " -- uvtool uvtool-libvirt apt-cacher"
echo " -- xenial image already synced" echo " -- $VM_OSREL image already synced"
echo " Default:" echo " Default:"
echo " -- eNB with USRP" echo " -- eNB with USRP"
echo "" echo ""
...@@ -90,7 +90,7 @@ function create_vm { ...@@ -90,7 +90,7 @@ function create_vm {
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
echo "############################################################" echo "############################################################"
acquire_vm_create_lock acquire_vm_create_lock
uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml uvt-kvm create $VM_NAME release=$VM_OSREL --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml
echo "Waiting for VM to be started" echo "Waiting for VM to be started"
uvt-kvm wait $VM_NAME --insecure uvt-kvm wait $VM_NAME --insecure
......
...@@ -30,19 +30,7 @@ function destroy_usage { ...@@ -30,19 +30,7 @@ function destroy_usage {
echo "------" echo "------"
echo " oai-ci-vm-tool destroy [OPTIONS]" echo " oai-ci-vm-tool destroy [OPTIONS]"
echo "" echo ""
echo "Mandatory Options:" command_options_usage
echo "--------"
echo " --job-name #### OR -jn ####"
echo " Specify the name of the Jenkins job."
echo ""
echo " --build-id #### OR -id ####"
echo " Specify the build ID of the Jenkins job."
echo ""
echo "Options:"
echo "--------"
echo " --help OR -h"
echo " Print this help message."
echo ""
} }
function destroy_vm { function destroy_vm {
......
...@@ -52,7 +52,7 @@ The main script is including a bunch of sub BASH scripts. ...@@ -52,7 +52,7 @@ The main script is including a bunch of sub BASH scripts.
* ci-scripts/reportBuildLocally.sh * ci-scripts/reportBuildLocally.sh
* ci-scripts/reportTestLocally.sh * ci-scripts/reportTestLocally.sh
**NOTE: ci-scripts/runTestOnVM.sh is getting big and will certainly be split to facilate maintenance. Start functions will be also factorized.** **NOTE: ci-scripts/runTestOnVM.sh is getting big and will certainly be split to facilitate maintenance. Start functions will be also factorized.**
# 3. Main script features # # 3. Main script features #
...@@ -62,7 +62,7 @@ It is also **testing if uvtool and apt-cacher are installed.** ...@@ -62,7 +62,7 @@ It is also **testing if uvtool and apt-cacher are installed.**
It finally provides parameters to the requested functions. Parameter definition is centralized there. It finally provides parameters to the requested functions. Parameter definition is centralized there.
For example: For example:
for VM instance creation: for VM instance creation:
...@@ -75,13 +75,122 @@ for OAI variant build: ...@@ -75,13 +75,122 @@ for OAI variant build:
* build log file to parse: LOG_PATTERN * build log file to parse: LOG_PATTERN
* the number of log files to parse: NB_PATTERN_FILES * the number of log files to parse: NB_PATTERN_FILES
These last 2 variables are very important if you change the build options or if you modify the build system and add more targets to build (especially true for physical simulator). You can get the list of variant specific variables specifying the variant argument when asking for help:
``` bash
./ci-scripts/oai-ci-vm-tool help variant
--variant flexran-rtc OR -v10 ( build and test non-OSA )
VM_NAME=ci-flexran-rtc ARCHIVES_LOC=flexran
VM_MEMORY=2048 VM_CPU=4
NB_PATTERN_FILES=1 BUILD_OPTIONS="cmake . && make -j2"
LOG_PATTERN=.Rel14.txt
--variant enb-usrp OR -v1 ( build and test )
VM_NAME=ci-enb-usrp ARCHIVES_LOC=enb_usrp
VM_MEMORY=2048 VM_CPU=4
NB_PATTERN_FILES=9 BUILD_OPTIONS="--eNB -w USRP --mu"
LOG_PATTERN=.Rel14.txt
--variant l1-sim OR -v20 ( test )
VM_NAME=ci-l1-sim ARCHIVES_LOC=l1_sim
VM_MEMORY=2048 VM_CPU=4
NB_PATTERN_FILES=9 BUILD_OPTIONS=""
LOG_PATTERN=.Rel14.txt
--variant rf-sim OR -v21 ( test )
VM_NAME=ci-rf-sim ARCHIVES_LOC=rf_sim
VM_MEMORY=2048 VM_CPU=4
NB_PATTERN_FILES=9 BUILD_OPTIONS=""
LOG_PATTERN=.Rel14.txt
--variant l2-sim OR -v22 ( test )
VM_NAME=ci-l2-sim ARCHIVES_LOC=l2_sim
VM_MEMORY=2048 VM_CPU=4
NB_PATTERN_FILES=9 BUILD_OPTIONS=""
LOG_PATTERN=.Rel14.txt
--variant basic-sim OR -v2 ( build and test )
VM_NAME=ci-basic-sim ARCHIVES_LOC=basic_sim
VM_MEMORY=8192 VM_CPU=4
NB_PATTERN_FILES=13 BUILD_OPTIONS="--eNB --UE"
LOG_PATTERN=.Rel14.txt
--variant phy-sim OR -v3 ( build and test )
VM_NAME=ci-phy-sim ARCHIVES_LOC=phy_sim
VM_MEMORY=2048 VM_CPU=4
NB_PATTERN_FILES=3 BUILD_OPTIONS="--phy_simulators"
LOG_PATTERN=.Rel14.txt
--variant cppcheck OR -v4 ( build and test )
VM_NAME=ci-cppcheck ARCHIVES_LOC=cppcheck
VM_MEMORY=4096 VM_CPU=4
NB_PATTERN_FILES=1 BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -j4"
LOG_PATTERN=cppcheck.xml
--variant enb-ethernet OR -v7 ( build and test )
VM_NAME=ci-enb-ethernet ARCHIVES_LOC=enb_eth
VM_MEMORY=4096 VM_CPU=4
NB_PATTERN_FILES=8 BUILD_OPTIONS="--eNB"
LOG_PATTERN=.Rel14.txt
--variant ue-ethernet OR -v8 ( build and test )
VM_NAME=ci-ue-ethernet ARCHIVES_LOC=ue_eth
VM_MEMORY=4096 VM_CPU=4
NB_PATTERN_FILES=12 BUILD_OPTIONS="--UE"
LOG_PATTERN=.Rel14.txt
There are many more variables. ```
To define a new variant you just need to define a function which name conforms to `function variant__v<n>__<variant_name>` where n and variant_name will respectively define the short and long options for your variant. The function only needs to define the variant dependent variables. For many variables, default values are set in the `check_set_variant` function. When a variant doesn't define the BUILD_OPTIONS variable it cannot be used for the `build` `wait` and `create` commands.
The main scripts also allows the definition of non variant-dependant variable via the `--setvar_<variable name> <variable value>` options.
You can get the list of these variables by using `help setvar`:
```BASH
./ci-scripts/oai-ci-vm-tool help setvar
--setvar_<varname> <value> where varname is one of:
VM_OSREL : OS release to use in virtual machines
RUN_EXPERIMENTAL : Enforce execution of variants with EXPERIMENTAL variable set to "true"
```
To add a new non-variant dependant variable you need:
* Add an item to the `AUTHORIZED_VAR` array
* In the `setvar_usage`function, add your help string in the HELP_VAR["<your variable name>"] variable.
* Write the bash code for your variable.
Example of non variant dependent usage:
``` bash
./ci-scripts/oai-ci-vm-tool test -v21 -ws /usr/local/oai/enhance_CI_extEPC/openairinterface5g -id 1 -jn testci
Currently testci-b1-rf-sim Testing is not implemented / enabled
Comment out these lines in ./ci-scripts/oai-ci-vm-tool if you want to run it
or use option --setvar_RUN_EXPERIMENTAL=true to test it
./ci-scripts/oai-ci-vm-tool test -v21 -ws /usr/local/oai/enhance_CI_extEPC/openairinterface5g -id 1 -jn testci --setvar_RUN_EXPERIMENTAL true
Setting RUN_EXPERIMENTAL to true...
############################################################
OAI CI VM script
############################################################
ENB_VM_NAME = testci-b1-enb-ethernet
ENB_VM_CMD_FILE = testci-b1-enb-ethernet_cmds.txt
UE_VM_NAME = testci-b1-ue-ethernet
UE_VM_CMD_FILE = testci-b1-ue-ethernet_cmds.txt
JENKINS_WKSP = /usr/local/oai/enhance_CI_extEPC/openairinterface5g
ARCHIVES_LOC = /usr/local/oai/enhance_CI_extEPC/openairinterface5g/archives/rf_sim/test
############################################################
Waiting for ENB VM to be started
...........................
```
In the same way, you can set the variable `VM_OSREL` to run the test in virtual machines of the specified OS release:
``` bash
./ci-scripts/oai-ci-vm-tool test -v21 -ws /usr/local/oai/enhance_CI_extEPC/openairinterface5g -id 1 -jn testci --setvar_VM_OSREL bionic
```
--- ---
Next step: [how to create one or several VM instances](./vm_based_simulator_create.md) Next step: [how to create one or several VM instances](./vm_based_simulator_create.md)
You can also go back to the [CI dev main page](./ci_dev_home.md) You can also go back to the [CI dev main page](./ci_dev_home.md)
...@@ -20,35 +20,301 @@ ...@@ -20,35 +20,301 @@
# * contact@openairinterface.org # * contact@openairinterface.org
# */ # */
function top_usage { function top_usage {
echo "OAI CI VM script" echo "OAI CI VM script"
echo " Original Author: Raphael Defosseux" echo " Original Author: Raphael Defosseux"
echo " Requirements:" echo " Requirements:"
echo " -- uvtool uvtool-libvirt apt-cacher" echo " -- uvtool uvtool-libvirt apt-cacher"
echo " -- xenial image already synced" echo " -- $VM_OSREL image already synced"
echo "" echo ""
echo "Usage:" echo "Usage:"
echo "------" echo "------"
echo " oai-ci-vm-tool (-h|--help) {create,destroy,build,wait,test,report-build,report-test} ..." echo " oai-ci-vm-tool (-h|--help) { `for i in "${COMMANDS_NAME[@]}"; do echo -n $i,;done` ..." }
echo "" echo ""
} }
function variant_usage { function variant_usage {
echo " # OpenAirInterface Build Variants"
echo " --variant enb-usrp OR -v1" for (( i=0 ; i<${#VARIANTS_LONG[@]} ; i++ ))
echo " --variant basic-sim OR -v2" do
echo " --variant phy-sim OR -v3" unset BUILD_OPTIONS
echo " --variant cppcheck OR -v4" unset VARIANT_INFO
echo " --variant enb-ethernet OR -v7" check_set_variant "${VARIANTS_SHORT[$i]}"
echo " --variant ue-ethernet OR -v8" printf " --variant %-15s OR -%-3s" "${VARIANTS_LONG[$i]}" "${VARIANTS_SHORT[$i]}"
echo " # non-OSA Build Variants" if [ "$BUILD_OPTIONS" = "" ]
echo " --variant flexran-rtc OR -v10" then
echo " # OpenAirInterface Test Variants" echo -n " ( test "
echo " --variant l1-sim OR -v20" else
echo " --variant rf-sim OR -v21" echo -n " ( build and test "
echo " --variant l2-sim OR -v22" fi
echo "$VARIANT_INFO )"
if [ "$1" = "full" ]
then
printf " VM_NAME=%-15s ARCHIVES_LOC=%-15s\n" "$VM_NAME" "$ARCHIVES_LOC"
printf " VM_MEMORY=%-15s VM_CPU=%-15s\n" "$VM_MEMORY" "$VM_CPU"
printf " NB_PATTERN_FILES=%-15s BUILD_OPTIONS=%-15s\n" "$NB_PATTERN_FILES" "\"$BUILD_OPTIONS\""
printf " LOG_PATTERN=%-15s EXPERIMENTAL=%-15s\n\n\n" "$LOG_PATTERN" "$EXPERIMENTAL"
fi
done
}
function command_options_usage {
local -A HELP_MSG
HELP_MSG["jn"]=" Specify the name of the Jenkins job."
HELP_MSG["id"]=" Specify the build ID of the Jenkins job."
HELP_MSG["ws"]=" Specify the workspace"
HELP_MSG["var"]=" Specify the variant to build."
HELP_MSG["k"]=" Keep the VM alive after the build."
HELP_MSG["D"]=" Run as daemon"
HELP_MSG["gu"]=" Specify the URL of the GIT Repository."
HELP_MSG["pu"]=" trigger a push action from the Jenkins job to the specified url, \"--trigger pu\" can also be used"
HELP_MSG["mr"]=" trigger a merge request action from the Jenkins job, \"--trigger mr\" can also be used"
HELP_MSG["sb"]=" Specify the source branch of the merge request."
HELP_MSG["sc"]=" Specify the source commit ID (SHA-1) of the merge request."
HELP_MSG["tb"]=" Specify the target branch of the merge request (usually develop)."
HELP_MSG["tc"]=" Specify the target commit ID (SHA-1) of the merge request."
HELP_MSG["br"]=" Specify the branch of the push event."
HELP_MSG["co"]=" Specify the commit ID (SHA-1) of the push event."
HELP_MSG["epc"]=" (two arguments) Specify the ip addresses of an external EPC, on respectively the core network and the UEs network"
HELP_MSG["sim"]=" Specify the path to the sim file, used to emulate the oai UE sim card "
for (( m=0 ; m<2 ; m++ ))
do
if [[ $m -eq 0 || ( $m > 0 && ${MANDATORY_OPTMASK[$m]} > 0 ) ]]
then
echo "Mandatory Options ($((m+1))):"
echo "---------------------"
for (( i=0 ; i<${#SHORT_OPTIONS[@]} ; i++ ))
do
if [ $(( MANDATORY_OPTMASK[$m] & $(( 2**$i )) )) -ne 0 ]
then
if [ "${LONG_OPTIONS[$i]}" != "" ]
then
local ARGPATTERN
if [[ !("${HELP_MSG[${SHORT_OPTIONS[$i]}]}" =~ "Specify") ]]
then
ARGPATTERN=""
elif [[ "${HELP_MSG[${SHORT_OPTIONS[$i]}]}" =~ "(two arguments)" ]]
then
ARGPATTERN="#### ####"
else
ARGPATTERN="####"
fi
printf " %s %s OR " "--${LONG_OPTIONS[$i]}" "$ARGPATTERN"
fi
printf "%s %s \n" "-${SHORT_OPTIONS[$i]}" "$ARGPATTERN"
printf " %s\n\n" "${HELP_MSG[${SHORT_OPTIONS[$i]}]}"
fi
done
fi
done
echo "Options:"
echo "--------"
for (( i=0 ; i<${#SHORT_OPTIONS[@]} ; i++ ))
do
if [ $(( ALLOWED_OPTMASK & $(( 2**$i )) )) -ne 0 ]
then
if [ "${LONG_OPTIONS[$i]}" != "" ]
then
printf " %s #### OR " "--${LONG_OPTIONS[$i]}"
fi
printf "%s #### \n" "-${SHORT_OPTIONS[$i]}"
printf " %s\n\n" "${HELP_MSG[${SHORT_OPTIONS[$i]}]}"
fi
done
for (( i=0 ; i<${#SHORT_OPTIONS[@]} ; i++ ))
do
if [ $(( ALLOWED_OPTMASK & $(( 2**$i )) )) -ne 0 ]
then
if [ "$(type -t ${LONG_OPTIONS[$i]}_usage)" = 'function' ]
then
${LONG_OPTIONS[$i]}_usage
fi
fi
done
echo " --help OR -h"
echo " Print this help message."
echo ""
}
function setvar_usage {
declare -A HELP_VAR
HELP_VAR["VM_OSREL"]="OS release to use in virtual machines"
HELP_VAR["RUN_EXPERIMENTAL"]="Enforce execution of variants with EXPERIMENTAL variable set to \"true\""
echo "--setvar_<varname> <value> where varname is one of:"
for i in ${AUTHORIZED_VAR[@]}; do printf "%20s : %s\n" "$i" "${HELP_VAR[$i]}" ;done
}
# functions variant__v<n>__<variant name> are used to define build or test variants
# The only thing to do to define a new variant is to add a function which name
# match this template. Note that "_" character in function <varriant name> part
# will be replaced by "-" character in build_variant_arrays function, this is
# for compatibility reasons
function variant__v1__enb_usrp {
NB_PATTERN_FILES=9
BUILD_OPTIONS="--eNB -w USRP --mu"
}
function variant__v2__basic_sim {
NB_PATTERN_FILES=13
BUILD_OPTIONS="--eNB --UE"
VM_MEMORY=8192
RUN_OPTIONS="complex"
}
function variant__v3__phy_sim {
NB_PATTERN_FILES=3
BUILD_OPTIONS="--phy_simulators"
RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b"
}
function variant__v4__cppcheck {
VM_MEMORY=4096
LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -j4"
}
function variant__v7__enb_ethernet {
VM_MEMORY=4096
ARCHIVES_LOC=enb_eth
NB_PATTERN_FILES=8
BUILD_OPTIONS="--eNB"
}
function variant__v8__ue_ethernet {
VM_MEMORY=4096
ARCHIVES_LOC=ue_eth
NB_PATTERN_FILES=12
BUILD_OPTIONS="--UE"
} }
function variant__v10__flexran_rtc {
ARCHIVES_LOC=flexran
NB_PATTERN_FILES=1
BUILD_OPTIONS="cmake . && make -j2"
VARIANT_INFO="non-OSA"
}
function variant__v20__l1_sim {
ARCHIVES_LOC=l1_sim
RUN_OPTIONS="complex"
EXPERIMENTAL="true"
}
function variant__v21__rf_sim {
RUN_OPTIONS="complex"
EXPERIMENTAL="true"
}
function variant__v22__l2_sim {
RUN_OPTIONS="complex"
}
# Following function lists all variant__v<n>__<variant name> functions
# and set the VARIANTS_SHORT and VARIANTS_LONG arrays from
# the function names
function build_variant_arrays {
VARIANTS=`declare -F`
VARIANTS=${VARIANTS//"declare -f "}
for i in $VARIANTS
do
if [ `expr match "$i" 'variant__v'` -eq 10 ]
then
IDX1=`expr match "$i" 'variant__v[0-9]\+__'`
VARIANTS_SHORT+=(${i:9:$((IDX1-11))})
LONGNAME=${i:$IDX1}
VARIANTS_LONG+=(${LONGNAME//"_"/"-"})
fi
done
}
# check that the passed argument is a valid variant, set
# default values for variant related variables and then execute
# the corresponding variant__v<n>__<variant name> function
function check_set_variant {
for (( i=0 ; i<${#VARIANTS_SHORT[@]} ; i++ ))
do
if [ "$1" = "${VARIANTS_SHORT[$i]}" ] || [ "$1" = "${VARIANTS_LONG[$i]}" ]
then
VM_NAME=ci-${VARIANTS_LONG[$i]}
LOG_PATTERN=.$ASN1VER.txt
ARCHIVES_LOC=${VARIANTS_LONG[$i]//"-"/"_"}
VM_MEMORY=2048
VM_CPU=4
EXPERIMENTAL=""
NBARGS=$[$NBARGS+$VARIANT_OPTID]
variant__${VARIANTS_SHORT[$i]}__${VARIANTS_LONG[$i]//"-"/"_"}
return 0
fi
done
echo "$1" is not a valid variant
variant_usage
exit 1
}
function check_command_options {
GIVEN_OPTIONS=$1
declare -a MANDATORY_OPTIONS=("${!2}")
if [ ${MANDATORY_OPTIONS[1]} -eq 0 ]
then
MANDATORY_OPTIONS[1]=${MANDATORY_OPTIONS[0]}
fi
OPTIONAL_OPTIONS=$3
if [ $(($GIVEN_OPTIONS & ${MANDATORY_OPTIONS[0]} )) -ne ${MANDATORY_OPTIONS[0]} ] && [ $(($GIVEN_OPTIONS & ${MANDATORY_OPTIONS[1]} )) -ne ${MANDATORY_OPTIONS[1]} ]
then
echo "Syntax Error: missing option(s) for $4 command"
${4//-/_}_usage
exit 1
fi
if [ $(( $(($GIVEN_OPTIONS ^ ${MANDATORY_OPTIONS[0]})) | $OPTIONAL_OPTIONS )) -ne $(( $OPTIONAL_OPTIONS )) ] && [ $(( $(($GIVEN_OPTIONS ^ ${MANDATORY_OPTIONS[1]})) | $OPTIONAL_OPTIONS )) -ne $(( $OPTIONAL_OPTIONS )) ]
then
echo "Syntax Error: unknown option(s) for $4 command"
${4//-/_}_usage
exit 1
fi
}
function check_ipv4addr {
local ipaddr=$1
local stat=1
if [[ $ipaddr =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} ]]
then
OIFS=$IFS
IFS='.'
ipaddr=($ipaddr)
IFS=$OIFS
[[ ${ipaddr[0]} -le 255 && ${ipaddr[1]} -le 255 \
&& ${ipaddr[2]} -le 255 && ${ipaddr[3]} -le 255 ]]
stat=$?
fi
if [ $stat -ne 0 ]
then
echo $ipaddr " is not a valid ip V4 address"
exit 1
fi
}
function check_setvar {
for i in ${AUTHORIZED_VAR[@]}
do
if [ "$1" = "$i" ]
then
echo "Setting $1 to $2..."
export "$1"="$2"
return 0
fi
done
echo " $1 is not a variable you can set"
setvar_usage
exit 1
}
MY_DIR=$(dirname $(readlink -f $0)) MY_DIR=$(dirname $(readlink -f $0))
. $MY_DIR/createVM.sh . $MY_DIR/createVM.sh
. $MY_DIR/buildOnVM.sh . $MY_DIR/buildOnVM.sh
...@@ -67,101 +333,263 @@ then ...@@ -67,101 +333,263 @@ then
fi fi
VM_TEMPLATE=ci- VM_TEMPLATE=ci-
# look for default ASN1 release in cmake directives
# It will be the release used when building
ASN1VEROPT=( `grep "add_list2_option(RRC_ASN1_VERSION" cmake_targets/CMakeLists.txt` )
ASN1VER=${ASN1VEROPT[1]//\"}
unset ASN1VEROPT
# variable to identify and store the command (build, create ...)
# command index in the COMMAND and COMMANDS_NAME arrays
HELP_CMD=0
CREATE_CMD=1
BUILD_CMD=2
WAIT_CMD=3
DESTROY_CMD=4
TEST_CMD=5
REPORT_BUILD_CMD=6
REPORT_TEST_CMD=7
COMMANDS_NAME=(help create build wait destroy test report-build report-test)
#COMMAND will be used to save the command entered as argument
declare -A COMMAND
for i in "${COMMANDS_NAME[@]}"
do
COMMAND[$i]=0
done
# build the variant arrays
declare -a VARIANTS_SHORT
declare -a VARIANTS_LONG
build_variant_arrays
#variables to process options, for each option we define a variable to store
# its value and a bit mask, used to check allowed options depending on
# the command
# The two following arrays must be consistent: a given index must point to the long and short options
# of a given command
SHORT_OPTIONS=( "jn" "id" "ws" "k" "D" "gu" "pu" "mr" "var" "notused" "sb" "sc" "tb" "tc" "br" "co" "epc" "sim")
LONG_OPTIONS=( "job-name" "build-id" "workspace" "keep-vm-alive" "daemon" "git-url" "push" "merge-request"
"variant" "notused" "src-branch" "src-commit" "target-branch" "target-commit" "branch" "commit"
"external-epc" "sim-file")
JOB_NAME=XX JOB_NAME=XX
JOB_NAME_OPTINDEX=0
JOB_NAME_OPTID=1
BUILD_ID=XX BUILD_ID=XX
VM_NAME=ci-enb-usrp BUILD_ID_OPTINDEX=1
VM_MEMORY=2048 BUILD_ID_OPTID=2
VM_CPU=4
ARCHIVES_LOC=enb_usrp JENKINS_WKSP_OPTINDEX=2
LOG_PATTERN=.Rel14.txt JENKINS_WKSP_OPTID=4
NB_PATTERN_FILES=7
BUILD_OPTIONS="--eNB -w USRP" KEEP_VM_ALIVE_OPTINDEX=3
KEEP_VM_ALIVE_OPTID=8
KEEP_VM_ALIVE=0 KEEP_VM_ALIVE=0
RUN_OPTIONS="none"
DAEMON_OPTINDEX=4
DAEMON_OPTID=$((2**4))
DAEMON=0 DAEMON=0
MR_TRIG=0
GITURL_OPTINDEX=5
GITURL_OPTID=$((2**5))
PU_OPTINDEX=6
PU_OPTID=$((2**6))
PU_TRIG=0 PU_TRIG=0
HELP_CMD=0 MR_OPTINDEX=7
CREATE_CMD=0 MR_OPTID=$((2**7))
BUILD_CMD=0 MR_TRIG=0
WAIT_CMD=0
DESTROY_CMD=0 VARIANT_OPTINDEX=8
TEST_CMD=0 VARIANT_OPTID=$((2**8))
REPORT_BUILD_CMD=0
REPORT_TEST_CMD=0 SB_OPTINDEX=10
SB_OPTID=$((2**10))
SC_OPTINDEX=11
SC_OPTID=$((2**11))
TB_OPTINDEX=12
TB_OPTID=$((2**12))
TC_OPTINDEX=13
TC_OPTID=$((2**13))
BR_OPTINDEX=14
BR_OPTID=$((2**14))
CO_OPTINDEX=15
CO_OPTID=$((2**15))
EPC_IPADDR_OPTINDEX=16
EPC_IPADDR_OPTID=$((2**16))
EPC_IPADDR=""
SIM_OPTINDEX=17
SIM_OPTID=$((2**17))
SIMFILE=""
RUN_OPTIONS="none"
# list of variables that can be set via the --setvar option
AUTHORIZED_VAR=("VM_OSREL RUN_EXPERIMENTAL")
#variables to set which OS VM should use
#if [ -f "/etc/os-release" ]
#then
# source /etc/os-release
# VM_OS="$NAME"
# VM_OSREL="$VERSION_CODENAME"
# VM_ARCHI=`uname -m`
#else
VM_OS="ubuntu"
VM_OSREL="xenial"
VM_ARCHI="x86_64"
#fi
# variant option, ie the test variant which will be run triggers the
# variables listed below, used to configure the VM and to define what this
# VM will do. The variant can be specified by the --variant option or by a
# -V<xx> option.
VM_NAME=""
VM_MEMORY=0
VM_CPU=0
ARCHIVES_LOC=""
LOG_PATTERN=""
NB_PATTERN_FILES=0
BUILD_OPTIONS=""
RUN_OPTIONS=""
# NARGS is used to check that only valid options are used for the given command
# It is a bit mask, each bit set to 1 specifies the corresponding option
# has been entered on the command line. MANDATORY_OPTMASK and ALLOWED_OPTMASK define
# respectively the mandatory and optional parameters of the entered command
NBARGS=0 NBARGS=0
MANDATORY_OPTMASK=(0 0) # some command have two sets of mandatory options
ALLOWED_OPTMASK=0
while [[ $# -gt 0 ]] while [[ $# -gt 0 ]]
do do
key="$1" key="$1"
if [ "$(type -t $funcname)" != 'function' ]; then
funcname=do_it_normal
fi
case $key in case $key in
-h|--help) --debug)
HELP_CMD=1 set -v
set -x
shift
;;
-h|--help|help)
COMMAND["help"]=1
# following word might specify the topic for the help request
# but help can also be used without argument, so don't shift
if [ "$2" != "" ] && [ "$(type -t ${2//-/_}_usage)" = 'function' ]
then
HELPCMD="${2//-/_}_usage full"
fi
shift shift
;; ;;
create) create)
CREATE_CMD=1 COMMAND[$key]=1
# For create, mandatory options: jn, id. Optional: variant
MANDATORY_OPTMASK[0]=$(($JOB_NAME_OPTID + $BUILD_ID_OPTID ))
ALLOWED_OPTMASK=$(($VARIANT_OPTID))
# It is implied to keep the VM when creating it # It is implied to keep the VM when creating it
KEEP_VM_ALIVE=1 KEEP_VM_ALIVE=1
shift shift
;; ;;
build) build)
BUILD_CMD=1 COMMAND[$key]=1
# For build, mandatory options: jn, id, ws. Optional: variant, k, D
MANDATORY_OPTMASK[0]=$(($JOB_NAME_OPTID + $BUILD_ID_OPTID + $JENKINS_WKSP_OPTID))
ALLOWED_OPTMASK=$(($KEEP_VM_ALIVE_OPTID + $DAEMON_OPTID + $VARIANT_OPTID))
shift shift
;; ;;
wait) wait)
WAIT_CMD=1 # For test, mandatory options: jn, id, ws. Optional: variant, k
COMMAND[$key]=1
MANDATORY_OPTMASK[0]=$(($JOB_NAME_OPTID + $BUILD_ID_OPTID + $JENKINS_WKSP_OPTID))
ALLOWED_OPTMASK=$(($KEEP_VM_ALIVE_OPTID + $VARIANT_OPTID))
shift shift
;; ;;
test) test)
TEST_CMD=1 COMMAND[$key]=1
# For test, mandatory options: jn, id, ws. Optional: variant, k, epc
MANDATORY_OPTMASK[0]=$(($JOB_NAME_OPTID + $BUILD_ID_OPTID + $JENKINS_WKSP_OPTID))
ALLOWED_OPTMASK=$(($KEEP_VM_ALIVE_OPTID + $VARIANT_OPTID + $EPC_IPADDR_OPTID + $SIM_OPTID))
shift shift
;; ;;
destroy) destroy)
DESTROY_CMD=1 COMMAND[$key]=1
# For destroy, mandatory options: jn, id.
MANDATORY_OPTMASK[0]=$(($JOB_NAME_OPTID + $BUILD_ID_OPTID))
shift shift
;; ;;
report-build) report-build)
REPORT_BUILD_CMD=1 COMMAND[$key]=1
# For report-build, mandatory options: jn, id, ws, gu, pu, br,co.
# or: jn, id, ws, gu, mr, sb, sc, tb, tc.
MANDATORY_OPTMASK[0]=$(($JOB_NAME_OPTID + $BUILD_ID_OPTID + $JENKINS_WKSP_OPTID + $GITURL_OPTID + $PU_OPTID + $BR_OPTID + $CO_OPTID))
MANDATORY_OPTMASK[1]=$(($JOB_NAME_OPTID + $BUILD_ID_OPTID + $JENKINS_WKSP_OPTID + $GITURL_OPTID + $MR_OPTID + $SB_OPTID + $SC_OPTID))
MANDATORY_OPTMASK[1]=$(( ${MANDATORY_OPTMASK[1]} + $TB_OPTID + $TC_OPTID))
shift shift
;; ;;
report-test) report-test)
REPORT_TEST_CMD=1 COMMAND[$key]=1
# For report-test, mandatory options: jn, id, ws, gu, pu, br,co.
# or: jn, id, ws, gu, mr, sb, sc, tb, tc.
MANDATORY_OPTMASK[0]=$(($JOB_NAME_OPTID + $BUILD_ID_OPTID + $JENKINS_WKSP_OPTID))
MANDATORY_OPTMASK[0]=$((${MANDATORY_OPTMASK[0]} + $GITURL_OPTID + $PU_OPTID + $BR_OPTID + $CO_OPTID))
MANDATORY_OPTMASK[1]=$(($JOB_NAME_OPTID + $BUILD_ID_OPTID + $JENKINS_WKSP_OPTID))
MANDATORY_OPTMASK[1]=$((${MANDATORY_OPTMASK[1]} + GITURL_OPTID + $MR_OPTID + $SB_OPTID + $SC_OPTID))
MANDATORY_OPTMASK[1]=$((${MANDATORY_OPTMASK[1]} + $TB_OPTID + $TC_OPTID))
shift shift
;; ;;
-jn|--job-name) -jn|--job-name)
JOB_NAME="$2" JOB_NAME="$2"
NBARGS=$[$NBARGS+1] NBARGS=$[$NBARGS+$JOB_NAME_OPTID]
shift shift
shift shift
;; ;;
-id|--build-id) -id|--build-id)
BUILD_ID="$2" BUILD_ID="$2"
NBARGS=$[$NBARGS+2] NBARGS=$[$NBARGS+$BUILD_ID_OPTID]
shift shift
shift shift
;; ;;
-ws|--workspace) -ws|--workspace)
JENKINS_WKSP="$2" JENKINS_WKSP="$2"
NBARGS=$[$NBARGS+4] NBARGS=$[$NBARGS+$JENKINS_WKSP_OPTID]
shift shift
shift shift
;; ;;
-k|--keep-vm-alive) -k|--keep-vm-alive)
KEEP_VM_ALIVE=1 KEEP_VM_ALIVE=1
NBARGS=$[$NBARGS+8] NBARGS=$[$NBARGS+$KEEP_VM_ALIVE_OPTID]
shift shift
;; ;;
-D|--daemon) -D|--daemon)
DAEMON=1 DAEMON=1
NBARGS=$[$NBARGS+16] NBARGS=$[$NBARGS+$DAEMON_OPTID]
shift shift
;; ;;
-gu|--git-url) -gu|--git-url)
GIT_URL="$2" GIT_URL="$2"
NBARGS=$[$NBARGS+32] NBARGS=$[$NBARGS+$GITURL_OPTID]
shift shift
shift shift
;; ;;
...@@ -170,9 +598,11 @@ case $key in ...@@ -170,9 +598,11 @@ case $key in
case $TRIG in case $TRIG in
merge-request) merge-request)
MR_TRIG=1 MR_TRIG=1
NBARGS=$[$NBARGS+$MR_OPTID]
;; ;;
push) push)
PU_TRIG=1 PU_TRIG=1
NBARGS=$[$NBARGS+$PU_OPTID]
;; ;;
*) *)
echo "" echo ""
...@@ -182,242 +612,83 @@ case $key in ...@@ -182,242 +612,83 @@ case $key in
exit exit
;; ;;
esac esac
NBARGS=$[$NBARGS+64]
shift shift
shift shift
;; ;;
-mr) -mr|--merge-request)
MR_TRIG=1 MR_TRIG=1
NBARGS=$[$NBARGS+64] NBARGS=$[$NBARGS+$MR_OPTID]
shift shift
;; ;;
-pu) -pu|--push)
PU_TRIG=1 PU_TRIG=1
NBARGS=$[$NBARGS+64] NBARGS=$[$NBARGS+$PU_OPTID]
shift shift
;; ;;
-sb|--src-branch) -sb|--src-branch)
SOURCE_BRANCH="$2" SOURCE_BRANCH="$2"
NBARGS=$[$NBARGS+1024] NBARGS=$[$NBARGS+$SB_OPTID]
shift shift
shift shift
;; ;;
-sc|--src-commit) -sc|--src-commit)
SOURCE_COMMIT_ID="$2" SOURCE_COMMIT_ID="$2"
NBARGS=$[$NBARGS+2048] NBARGS=$[$NBARGS+$SC_OPTID]
shift shift
shift shift
;; ;;
-tb|--target-branch) -tb|--target-branch)
TARGET_BRANCH="$2" TARGET_BRANCH="$2"
NBARGS=$[$NBARGS+4096] NBARGS=$[$NBARGS+$TB_OPTID]
shift shift
shift shift
;; ;;
-tc|--target-commit) -tc|--target-commit)
TARGET_COMMIT_ID="$2" TARGET_COMMIT_ID="$2"
NBARGS=$[$NBARGS+8192] NBARGS=$[$NBARGS+$TC_OPTID]
shift shift
shift shift
;; ;;
-br|--branch) -br|--branch)
SOURCE_BRANCH="$2" SOURCE_BRANCH="$2"
NBARGS=$[$NBARGS+16384] NBARGS=$[$NBARGS+$BR_OPTID]
shift shift
shift shift
;; ;;
-co|--commit) -co|--commit)
SOURCE_COMMIT_ID="$2" SOURCE_COMMIT_ID="$2"
NBARGS=$[$NBARGS+32768] NBARGS=$[$NBARGS+$CO_OPTID]
shift shift
shift shift
;; ;;
-v1) -epc|--external-epc)
VM_NAME=ci-enb-usrp check_ipv4addr "$2"
ARCHIVES_LOC=enb_usrp check_ipv4addr "$3"
LOG_PATTERN=.Rel14.txt EPC_IPADDR="$2"
NB_PATTERN_FILES=9 EPC_TUN_IPADDR="$3"
BUILD_OPTIONS="--eNB -w USRP --mu" NBARGS=$[$NBARGS+$EPC_IPADDR_OPTID]
NBARGS=$[$NBARGS+256]
shift shift
;;
-v2)
VM_NAME=ci-basic-sim
ARCHIVES_LOC=basic_sim
LOG_PATTERN=Rel14.txt
NB_PATTERN_FILES=13
BUILD_OPTIONS="--eNB --UE"
VM_MEMORY=8192
VM_CPU=4
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
shift shift
;;
-v3)
VM_NAME=ci-phy-sim
ARCHIVES_LOC=phy_sim
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=3
BUILD_OPTIONS="--phy_simulators"
RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b"
NBARGS=$[$NBARGS+256]
shift shift
;; ;;
-v4) -sim|--sim-file)
VM_NAME=ci-cppcheck SIMFILE="$2"
VM_MEMORY=4096 NBARGS=$[$NBARGS+$SIM_OPTID]
ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -j4"
NBARGS=$[$NBARGS+256]
shift shift
;;
-v7)
VM_NAME=ci-enb-ethernet
VM_MEMORY=4096
VM_CPU=4
ARCHIVES_LOC=enb_eth
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=8
BUILD_OPTIONS="--eNB"
NBARGS=$[$NBARGS+256]
shift shift
;; ;;
-v8) --setvar_*)
VM_NAME=ci-ue-ethernet check_setvar "${key:9}" "$2"
VM_MEMORY=4096
VM_CPU=4
ARCHIVES_LOC=ue_eth
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=12
BUILD_OPTIONS="--UE"
NBARGS=$[$NBARGS+256]
shift shift
;;
-v10)
VM_NAME=ci-flexran-rtc
ARCHIVES_LOC=flexran
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=1
BUILD_OPTIONS="cmake . && make -j2"
NBARGS=$[$NBARGS+256]
shift
;;
-v20)
VM_NAME=ci-l1-sim
ARCHIVES_LOC=l1_sim
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
shift shift
;; ;;
-v21) -v[0-9] | -v[0-9][0-9])
VM_NAME=ci-rf-sim check_set_variant ${key//"-"}
ARCHIVES_LOC=rf_sim
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
shift shift
;; ;;
-v22) -var|--variant)
VM_NAME=ci-l2-sim variant="$2"
ARCHIVES_LOC=l2_sim check_set_variant ${2}
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
shift
;;
--variant)
variant="$2"
case $variant in
enb-usrp)
VM_NAME=ci-enb-usrp
ARCHIVES_LOC=enb_usrp
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=9
BUILD_OPTIONS="--eNB -w USRP --mu"
NBARGS=$[$NBARGS+256]
;;
basic-sim)
VM_NAME=ci-basic-sim
ARCHIVES_LOC=basic_sim
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=13
BUILD_OPTIONS="--UE --eNB"
VM_MEMORY=8192
VM_CPU=4
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
;;
phy-sim)
VM_NAME=ci-phy-sim
ARCHIVES_LOC=phy_sim
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=3
BUILD_OPTIONS="--phy_simulators"
RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b"
NBARGS=$[$NBARGS+256]
;;
cppcheck)
VM_NAME=ci-cppcheck
VM_MEMORY=4096
ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -j4"
NBARGS=$[$NBARGS+256]
;;
enb-ethernet)
VM_NAME=ci-enb-ethernet
VM_MEMORY=4096
VM_CPU=4
ARCHIVES_LOC=enb_eth
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=8
BUILD_OPTIONS="--eNB"
NBARGS=$[$NBARGS+256]
;;
ue-ethernet)
VM_NAME=ci-ue-ethernet
VM_MEMORY=4096
VM_CPU=4
ARCHIVES_LOC=ue_eth
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=12
BUILD_OPTIONS="--UE"
NBARGS=$[$NBARGS+256]
;;
flexran-rtc)
VM_NAME=ci-flexran-rtc
ARCHIVES_LOC=flexran
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=1
BUILD_OPTIONS="cmake . && make -j2"
NBARGS=$[$NBARGS+256]
;;
l1-sim)
VM_NAME=ci-l1-sim
ARCHIVES_LOC=l1_sim
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
;;
rf-sim)
VM_NAME=ci-rf-sim
ARCHIVES_LOC=rf_sim
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
;;
l2-sim)
VM_NAME=ci-l2-sim
ARCHIVES_LOC=l2_sim
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
;;
*)
echo ""
echo "Syntax Error: Invalid Variant option -> $variant"
echo ""
variant_usage
exit 1
esac
shift shift
shift shift
;; ;;
...@@ -429,117 +700,47 @@ case $key in ...@@ -429,117 +700,47 @@ case $key in
esac esac
done done
MANY_CMDS=$[$CREATE_CMD+$BUILD_CMD+$WAIT_CMD+$DESTROY_CMD+$TEST_CMD+$REPORT_BUILD_CMD+$REPORT_TEST_CMD] i=0
if [ $MANY_CMDS -gt 1 ] for (( COUNT=1 ; COUNT<${#COMMAND[@]} ; COUNT++ ))
then do
echo "Syntax Error: too many commands" if [ ${COMMAND[${COMMANDS_NAME[$COUNT]}]} -eq 1 ]
top_usage then
exit 1 COMMAND_KEY[$i]=${COMMANDS_NAME[$COUNT]}
fi (( i++ ))
fi
done
if [ $HELP_CMD -eq 1 ] if [ ${COMMAND["help"]} -eq 1 ]
then then
if [ $MANY_CMDS -eq 0 ] if [ ${#COMMAND_KEY[@]} -ne 1 ] && [ "$HELPCMD" == "" ]
then then
top_usage top_usage
exit 0 elif [ "$HELPCMD" != "" ]
fi
if [ $CREATE_CMD -eq 1 ]
then
create_usage
exit 0
fi
if [ $BUILD_CMD -eq 1 ]
then then
build_usage $HELPCMD
exit 0 else
fi ${COMMAND_KEY[0]//-/_}_usage
if [ $WAIT_CMD -eq 1 ] fi
then exit 0
wait_usage
exit 0
fi
if [ $TEST_CMD -eq 1 ]
then
run_test_usage
exit 0
fi
if [ $DESTROY_CMD -eq 1 ]
then
destroy_usage
exit 0
fi
if [ $REPORT_BUILD_CMD -eq 1 ]
then
report_build_usage
exit 0
fi
if [ $REPORT_TEST_CMD -eq 1 ]
then
report_test_usage
exit 0
fi
else else
if [ $MANY_CMDS -eq 0 ] if [ ${#COMMAND_KEY[@]} -gt 1 ]
then then
echo "Syntax Error: no command" echo "Syntax Error, too many commands: ${COMMAND_KEY[@]}"
top_usage top_usage
exit 1 exit 1
fi fi
# For create, mandatory options: jn, id. Optional: variant
if [ $CREATE_CMD -eq 1 ] && [ $NBARGS -ne 3 ] && [ $NBARGS -ne 259 ] if [ -z "${COMMAND_KEY[0]}" ]
then
echo "Syntax Error: unsupported option(s) for create command"
create_usage
exit 1
fi
# For build, mandatory options: jn, id, ws. Optional: variant, k, D
if [ $BUILD_CMD -eq 1 ] && [ $NBARGS -ne 7 ] && [ $NBARGS -ne 263 ] && [ $NBARGS -ne 15 ] && [ $NBARGS -ne 271 ] && [ $NBARGS -ne 23 ] && [ $NBARGS -ne 279 ] && [ $NBARGS -ne 31 ] && [ $NBARGS -ne 287 ]
then
echo "Syntax Error: unsupported option(s) for build command"
build_usage
exit 1
fi
# For wait, mandatory options: jn, id, ws. Optional: variant, k
if [ $WAIT_CMD -eq 1 ] && [ $NBARGS -ne 7 ] && [ $NBARGS -ne 263 ] && [ $NBARGS -ne 15 ] && [ $NBARGS -ne 271 ]
then
echo "Syntax Error: unsupported option(s) for wait command"
wait_usage
exit 1
fi
# For test, mandatory options: jn, id, ws. Optional: variant, k
if [ $TEST_CMD -eq 1 ] && [ $NBARGS -ne 7 ] && [ $NBARGS -ne 263 ] && [ $NBARGS -ne 15 ] && [ $NBARGS -ne 271 ]
then
echo "Syntax Error: unsupported option(s) for test command"
run_test_usage
exit 1
fi
# For destroy, mandatory options: jn, id.
if [ $DESTROY_CMD -eq 1 ] && [ $NBARGS -ne 3 ]
then
echo "Syntax Error: unsupported option(s) for destroy command"
destroy_usage
exit 1
fi
# For report-build, mandatory options: jn, id, ws, gu, pu, br,co.
# or: jn, id, ws, gu, mr, sb, sc, tb, tc.
if [ $REPORT_BUILD_CMD -eq 1 ] && [ $NBARGS -ne 15463 ] && [ $NBARGS -ne 49255 ]
then
echo "Syntax Error: unsupported option(s) for report-build command"
report_build_usage
exit 1
fi
# For report-test, mandatory options: jn, id, ws, gu, pu, br,co.
# or: jn, id, ws, gu, mr, sb, sc, tb, tc.
if [ $REPORT_TEST_CMD -eq 1 ] && [ $NBARGS -ne 15463 ] && [ $NBARGS -ne 49255 ]
then then
echo "Syntax Error: unsupported option(s) for report-test command" echo "Syntax Error: no command, specify one of: ${COMMANDS_NAME[@]}"
report_test_usage top_usage
exit 1 exit 1
fi fi
check_command_options $NBARGS MANDATORY_OPTMASK[@] $ALLOWED_OPTMASK ${COMMAND_KEY[0]}
fi fi
if [ $REPORT_BUILD_CMD -ne 1 ] && [ $REPORT_TEST_CMD -ne 1 ] if [ ${COMMAND[${COMMANDS_NAME[$REPORT_BUILD_CMD]}]} -ne 1 ] && [ ${COMMAND[${COMMANDS_NAME[$REPORT_TEST_CMD]}]} -ne 1 ]
then then
# Checking uvt-kvm is installed # Checking uvt-kvm is installed
UVT_KVM_PATH=`which uvt-kvm | grep -c uvt-kvm` UVT_KVM_PATH=`which uvt-kvm | grep -c uvt-kvm`
...@@ -557,27 +758,31 @@ then ...@@ -557,27 +758,31 @@ then
else else
VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}-
fi fi
# set default variant
if [ "$VM_NAME" = "" ]
then
check_set_variant "v1"
fi
VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"` VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"`
VM_CMDS=${VM_NAME}_cmds.txt VM_CMDS=${VM_NAME}_cmds.txt
ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC} ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC}
STATUS=0 STATUS=0
if [ $CREATE_CMD -eq 1 ] if [ ${COMMAND[${COMMANDS_NAME[$CREATE_CMD]}]} -eq 1 ]
then then
if [[ $VM_NAME =~ .*-l2-sim.* ]] if [[ "$BUILD_OPTIONS" = "" ]]
then then
echo "Selected variant is no more a build variant" echo "$VM_NAME is not a build variant"
exit 0 exit 0
else else
create_vm create_vm
fi fi
fi fi
if [ $BUILD_CMD -eq 1 ] if [ ${COMMAND[${COMMANDS_NAME[$BUILD_CMD]}]} -eq 1 ]
then then
if [[ $VM_NAME =~ .*-l2-sim.* ]] if [[ "$BUILD_OPTIONS" = "" ]]
then then
echo "Selected variant is no more a build variant" echo " $VM_NAME is not a build variant"
exit 0 exit 0
else else
build_on_vm build_on_vm
...@@ -587,11 +792,11 @@ then ...@@ -587,11 +792,11 @@ then
check_on_vm_build check_on_vm_build
fi fi
fi fi
if [ $WAIT_CMD -eq 1 ] if [ ${COMMAND[${COMMANDS_NAME[$WAIT_CMD]}]} -eq 1 ]
then then
if [[ $VM_NAME =~ .*-l2-sim.* ]] if [[ "$BUILD_OPTIONS" = "" ]]
then then
echo "Selected variant is no more a build variant" echo "$VM_NAME is not a build variant"
exit 0 exit 0
else else
wait_on_vm_build wait_on_vm_build
...@@ -601,38 +806,31 @@ then ...@@ -601,38 +806,31 @@ then
check_on_vm_build check_on_vm_build
fi fi
fi fi
if [ $TEST_CMD -eq 1 ] if [ ${COMMAND[${COMMANDS_NAME[$TEST_CMD]}]} -eq 1 ]
then then
# Comment out or delete the following lines if you want to run L1-simulator in your branch and/or merge request # variant with EXPERIMENTAL variable set to true won't run and will be
if [[ $VM_NAME =~ .*-l1-sim.* ]] # considered OK, except if --setvar_RUN_EXPERIMENTAL option has been set to true
if [ "$EXPERIMENTAL" = "true" ] && [ "$RUN_EXPERIMENTAL" != "true" ]
then then
echo "Currently L1-Simulator Testing is not implemented / enabled" echo "Currently $VM_NAME Testing is not implemented / enabled"
echo "Comment out these lines in ./ci-scripts/oai-ci-vm-tool if you want to run it" echo "remove EXPERIMENTAL variable definition from this variant"
echo " or use option --setvar_RUN_EXPERIMENTAL=true to enforce testing it"
echo "STATUS seems OK" echo "STATUS seems OK"
exit $STATUS exit $STATUS
fi fi
# end to comment out for L1-simulator
# Comment out or delete the following lines if you want to run RF-simulator in your branch and/or merge request
if [[ $VM_NAME =~ .*-rf-sim.* ]]
then
echo "Currently RF-Simulator Testing is not implemented / enabled"
echo "Comment out these lines in ./ci-scripts/oai-ci-vm-tool if you want to run it"
echo "STATUS seems OK"
exit $STATUS
fi
# end to comment out for RF-simulator
ARCHIVES_LOC=${ARCHIVES_LOC}/test ARCHIVES_LOC=${ARCHIVES_LOC}/test
run_test_on_vm run_test_on_vm
fi fi
if [ $DESTROY_CMD -eq 1 ] if [ ${COMMAND[${COMMANDS_NAME[$DESTROY_CMD]}]} -eq 1 ]
then then
destroy_vm destroy_vm
fi fi
if [ $REPORT_BUILD_CMD -eq 1 ] if [ ${COMMAND[${COMMANDS_NAME[$REPORT_BUILD_CMD]}]} -eq 1 ]
then then
report_build report_build
fi fi
if [ $REPORT_TEST_CMD -eq 1 ] if [ ${COMMAND[${COMMANDS_NAME[$REPORT_TEST_CMD]}]} -eq 1 ]
then then
report_test report_test
fi fi
......
...@@ -28,56 +28,8 @@ function report_build_usage { ...@@ -28,56 +28,8 @@ function report_build_usage {
echo "------" echo "------"
echo " oai-ci-vm-tool report-build [OPTIONS]" echo " oai-ci-vm-tool report-build [OPTIONS]"
echo "" echo ""
echo "Options:" command_options_usage
echo "--------"
echo ""
echo " --help OR -h"
echo " Print this help message."
echo ""
echo "Job Options:"
echo "------------"
echo ""
echo " --git-url #### OR -gu ####"
echo " Specify the URL of the GIT Repository."
echo ""
echo " --job-name #### OR -jn ####"
echo " Specify the name of the Jenkins job."
echo ""
echo " --build-id #### OR -id ####"
echo " Specify the build ID of the Jenkins job."
echo ""
echo " --workspace #### OR -ws ####"
echo " Specify the workspace."
echo ""
echo " --trigger merge-request OR -mr"
echo " --trigger push OR -pu"
echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event."
echo ""
echo "Merge-Request Options:"
echo "----------------------"
echo ""
echo " --src-branch #### OR -sb ####"
echo " Specify the source branch of the merge request."
echo ""
echo " --src-commit #### OR -sc ####"
echo " Specify the source commit ID (SHA-1) of the merge request."
echo ""
echo " --target-branch #### OR -tb ####"
echo " Specify the target branch of the merge request (usually develop)."
echo ""
echo " --target-commit #### OR -tc ####"
echo " Specify the target commit ID (SHA-1) of the merge request."
echo ""
echo "Push Options:"
echo "----------------------"
echo ""
echo " --branch #### OR -br ####"
echo " Specify the branch of the push event."
echo ""
echo " --commit #### OR -co ####"
echo " Specify the commit ID (SHA-1) of the push event."
echo ""
echo ""
} }
function trigger_usage { function trigger_usage {
......
...@@ -28,56 +28,7 @@ function report_test_usage { ...@@ -28,56 +28,7 @@ function report_test_usage {
echo "------" echo "------"
echo " oai-ci-vm-tool report-test [OPTIONS]" echo " oai-ci-vm-tool report-test [OPTIONS]"
echo "" echo ""
echo "Options:" command_options_usage
echo "--------"
echo ""
echo " --help OR -h"
echo " Print this help message."
echo ""
echo "Job Options:"
echo "------------"
echo ""
echo " --git-url #### OR -gu ####"
echo " Specify the URL of the GIT Repository."
echo ""
echo " --job-name #### OR -jn ####"
echo " Specify the name of the Jenkins job."
echo ""
echo " --build-id #### OR -id ####"
echo " Specify the build ID of the Jenkins job."
echo ""
echo " --workspace #### OR -ws ####"
echo " Specify the workspace."
echo ""
echo " --trigger merge-request OR -mr"
echo " --trigger push OR -pu"
echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event."
echo ""
echo "Merge-Request Options:"
echo "----------------------"
echo ""
echo " --src-branch #### OR -sb ####"
echo " Specify the source branch of the merge request."
echo ""
echo " --src-commit #### OR -sc ####"
echo " Specify the source commit ID (SHA-1) of the merge request."
echo ""
echo " --target-branch #### OR -tb ####"
echo " Specify the target branch of the merge request (usually develop)."
echo ""
echo " --target-commit #### OR -tc ####"
echo " Specify the target commit ID (SHA-1) of the merge request."
echo ""
echo "Push Options:"
echo "----------------------"
echo ""
echo " --branch #### OR -br ####"
echo " Specify the branch of the push event."
echo ""
echo " --commit #### OR -co ####"
echo " Specify the commit ID (SHA-1) of the push event."
echo ""
echo ""
} }
function analyzePingFiles { function analyzePingFiles {
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
# * contact@openairinterface.org # * contact@openairinterface.org
# */ # */
function run_test_usage { function test_usage {
echo "OAI CI VM script" echo "OAI CI VM script"
echo " Original Author: Raphael Defosseux" echo " Original Author: Raphael Defosseux"
echo " Requirements:" echo " Requirements:"
echo " -- uvtool uvtool-libvirt apt-cacher" echo " -- uvtool uvtool-libvirt apt-cacher"
echo " -- xenial image already synced" echo " -- $VM_OSREL image already synced"
echo " Default:" echo " Default:"
echo " -- eNB with USRP" echo " -- eNB with USRP"
echo "" echo ""
...@@ -33,26 +33,7 @@ function run_test_usage { ...@@ -33,26 +33,7 @@ function run_test_usage {
echo "------" echo "------"
echo " oai-ci-vm-tool test [OPTIONS]" echo " oai-ci-vm-tool test [OPTIONS]"
echo "" echo ""
echo "Options:" command_options_usage
echo "--------"
echo " --job-name #### OR -jn ####"
echo " Specify the name of the Jenkins job."
echo ""
echo " --build-id #### OR -id ####"
echo " Specify the build ID of the Jenkins job."
echo ""
echo " --workspace #### OR -ws ####"
echo " Specify the workspace."
echo ""
variant_usage
echo " Specify the variant to build."
echo ""
echo " --keep-vm-alive OR -k"
echo " Keep the VM alive after the build."
echo ""
echo " --help OR -h"
echo " Print this help message."
echo ""
} }
function start_basic_sim_enb { function start_basic_sim_enb {
...@@ -126,7 +107,7 @@ function start_basic_sim_ue { ...@@ -126,7 +107,7 @@ function start_basic_sim_ue {
echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" > $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 "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 echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build" >> $1
echo "echo \"./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_NB_RBS --log_config.global_log_options level,nocolor --basicsim\" > ./my-lte-uesoftmodem-run.sh" >> $1 echo "echo \"./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_NB_RBS --log_config.global_log_options nocolor,level --basicsim\" > ./my-lte-uesoftmodem-run.sh" >> $1
echo "chmod 775 ./my-lte-uesoftmodem-run.sh" >> $1 echo "chmod 775 ./my-lte-uesoftmodem-run.sh" >> $1
echo "cat ./my-lte-uesoftmodem-run.sh" >> $1 echo "cat ./my-lte-uesoftmodem-run.sh" >> $1
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 "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
...@@ -483,7 +464,7 @@ function install_epc_on_vm { ...@@ -483,7 +464,7 @@ function install_epc_on_vm {
echo "Creating test EPC VM ($LOC_EPC_VM_NAME) on Ubuntu Cloud Image base" echo "Creating test EPC VM ($LOC_EPC_VM_NAME) on Ubuntu Cloud Image base"
echo "############################################################" echo "############################################################"
acquire_vm_create_lock acquire_vm_create_lock
uvt-kvm create $LOC_EPC_VM_NAME release=xenial --unsafe-caching uvt-kvm create $LOC_EPC_VM_NAME release=$VM_OSREL --unsafe-caching
echo "Waiting for VM to be started" echo "Waiting for VM to be started"
uvt-kvm wait $LOC_EPC_VM_NAME --insecure uvt-kvm wait $LOC_EPC_VM_NAME --insecure
release_vm_create_lock release_vm_create_lock
...@@ -629,14 +610,19 @@ function retrieve_real_epc_ip_addr { ...@@ -629,14 +610,19 @@ function retrieve_real_epc_ip_addr {
local LOC_EPC_VM_CMDS=$2 local LOC_EPC_VM_CMDS=$2
local LOC_EPC_VM_IP_ADDR=$3 local LOC_EPC_VM_IP_ADDR=$3
if [ $LTEBOX -eq 1 ] if [[ "$EPC_IPADDR" == "" ]]
then then
# in our configuration file, we are using pool 5 if [ $LTEBOX -eq 1 ]
echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $LOC_EPC_VM_CMDS then
REAL_EPC_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS` # in our configuration file, we are using pool 5
echo "EPC IP Address is : $REAL_EPC_IP_ADDR" echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $LOC_EPC_VM_CMDS
rm $LOC_EPC_VM_CMDS REAL_EPC_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
rm $LOC_EPC_VM_CMDS
fi
else
REAL_EPC_IP_ADDR=$EPC_TUN_IPADDR
fi fi
echo "EPC IP Address is : $REAL_EPC_IP_ADDR"
} }
function terminate_epc { function terminate_epc {
...@@ -1093,7 +1079,7 @@ function run_test_on_vm { ...@@ -1093,7 +1079,7 @@ function run_test_on_vm {
echo "############################################################" echo "############################################################"
echo "OAI CI VM script" echo "OAI CI VM script"
echo "############################################################" echo "############################################################"
if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) || (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]] if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) ]] || [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]]
then then
ENB_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#enb-ethernet#" -e "s#rf-sim#enb-ethernet#"` 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 ENB_VM_CMDS=${ENB_VM_NAME}_cmds.txt
...@@ -1110,7 +1096,7 @@ function run_test_on_vm { ...@@ -1110,7 +1096,7 @@ function run_test_on_vm {
echo "JENKINS_WKSP = $JENKINS_WKSP" echo "JENKINS_WKSP = $JENKINS_WKSP"
echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "ARCHIVES_LOC = $ARCHIVES_LOC"
if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) || (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]] if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) ]] || [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]]
then then
echo "############################################################" echo "############################################################"
echo "Waiting for ENB VM to be started" echo "Waiting for ENB VM to be started"
...@@ -1142,7 +1128,7 @@ function run_test_on_vm { ...@@ -1142,7 +1128,7 @@ function run_test_on_vm {
echo "No run on VM testing for this variant currently" echo "No run on VM testing for this variant currently"
return return
fi fi
if [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]] if [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]]
then then
echo "############################################################" echo "############################################################"
...@@ -1261,17 +1247,28 @@ function run_test_on_vm { ...@@ -1261,17 +1247,28 @@ function run_test_on_vm {
EPC_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#epc#"` EPC_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#epc#"`
EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt
LTEBOX=0 LTEBOX=0
install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS if [[ "$EPC_IPADDR" == "" ]]
EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME` then
# Creating a VM for EPC and installing SW
install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS
EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME`
# Starting EPC # Starting EPC
start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
else
echo "We will use EPC on $EPC_IPADDR"
EPC_VM_IP_ADDR=$EPC_IPADDR
fi
# Retrieve EPC real IP address # Retrieve EPC real IP address
retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
TRANS_MODES=("fdd" "tdd") #TRANS_MODES=("fdd" "tdd")
BW_CASES=(05 10 20) #BW_CASES=(05 10 20)
TRANS_MODES=("fdd")
BW_CASES=(05)
for TMODE in ${TRANS_MODES[@]} for TMODE in ${TRANS_MODES[@]}
do do
...@@ -1304,7 +1301,10 @@ function run_test_on_vm { ...@@ -1304,7 +1301,10 @@ function run_test_on_vm {
continue continue
fi fi
get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1 get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1
full_terminate
continue
echo "############################################################" echo "############################################################"
echo "Pinging the UE" echo "Pinging the UE"
echo "############################################################" echo "############################################################"
...@@ -1446,7 +1446,10 @@ function run_test_on_vm { ...@@ -1446,7 +1446,10 @@ function run_test_on_vm {
echo "Terminate EPC" echo "Terminate EPC"
echo "############################################################" echo "############################################################"
terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR if [[ "$EPC_IPADDR" == "" ]]
then
terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
fi
full_basic_sim_destroy full_basic_sim_destroy
...@@ -1474,43 +1477,53 @@ function run_test_on_vm { ...@@ -1474,43 +1477,53 @@ function run_test_on_vm {
rm -Rf $ARCHIVES_LOC rm -Rf $ARCHIVES_LOC
fi fi
mkdir --parents $ARCHIVES_LOC mkdir --parents $ARCHIVES_LOC
if [[ "$EPC_IPADDR" == "" ]]
then
# Creating a VM for EPC and installing SW # Creating a VM for EPC and installing SW
EPC_VM_NAME=`echo $VM_NAME | sed -e "s#rf-sim#epc#"` EPC_VM_NAME=`echo $VM_NAME | sed -e "s#rf-sim#epc#"`
EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt
LTEBOX=0 LTEBOX=0
install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS
EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME` EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME`
fi
# withS1 configuration is not working # withS1 configuration is not working
#EPC_CONFIGS=("wS1" "noS1") #EPC_CONFIGS=("wS1" "noS1")
#TRANS_MODES=("fdd" "tdd") #TRANS_MODES=("fdd" "tdd")
#BW_CASES=(05 10 20) #BW_CASES=(05 10 20)
EPC_CONFIGS=("noS1") EPC_CONFIGS=("noS1" "wS1")
TRANS_MODES=("fdd") TRANS_MODES=("fdd")
BW_CASES=(05) BW_CASES=(05)
for CN_CONFIG in ${EPC_CONFIGS[@]} for CN_CONFIG in ${EPC_CONFIGS[@]}
do do
if [[ $CN_CONFIG =~ .*wS1.* ]] if [[ $CN_CONFIG =~ .*wS1.* ]]
then then
echo "############################################################" if [[ "$EPC_IPADDR" == "" ]]
echo "Start EPC for the wS1 configuration" then
echo "############################################################" echo "############################################################"
start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR echo "Start EPC for the wS1 configuration"
echo "############################################################"
# Retrieve EPC real IP address start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR # Retrieve EPC real IP address
S1_NOS1_CFG=1 retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
S1_NOS1_CFG=1
else
echo "############################################################"
echo "Using external EPC " $EPC_IPADDR
echo "############################################################"
$EPC_VM_IP_ADDR=$EPC_IPADDR
S1_NOS1_CFG=1
LTEBOX=0
fi
else else
echo "############################################################" echo "############################################################"
echo "Terminate EPC" echo "Terminate EPC"
echo "############################################################" echo "############################################################"
terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
echo "############################################################" echo "############################################################"
echo "Running now in a no-S1 configuration" echo "Running now in a no-S1 "
echo "############################################################" echo "############################################################"
S1_NOS1_CFG=0 S1_NOS1_CFG=0
fi fi
for TMODE in ${TRANS_MODES[@]} for TMODE in ${TRANS_MODES[@]}
do do
...@@ -1532,7 +1545,7 @@ function run_test_on_vm { ...@@ -1532,7 +1545,7 @@ function run_test_on_vm {
echo "${CN_CONFIG} : Starting the eNB in ${TMODE}-${BW}MHz mode" echo "${CN_CONFIG} : Starting the eNB in ${TMODE}-${BW}MHz mode"
echo "############################################################" echo "############################################################"
CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_enb.log 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 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 "############################################################"
echo "${CN_CONFIG} : Starting the UE" echo "${CN_CONFIG} : Starting the UE"
......
...@@ -25,7 +25,7 @@ function wait_usage { ...@@ -25,7 +25,7 @@ function wait_usage {
echo " Original Author: Raphael Defosseux" echo " Original Author: Raphael Defosseux"
echo " Requirements:" echo " Requirements:"
echo " -- uvtool uvtool-libvirt apt-cacher" echo " -- uvtool uvtool-libvirt apt-cacher"
echo " -- xenial image already synced" echo " -- $VM_OSREL image already synced"
echo " Default:" echo " Default:"
echo " -- eNB with USRP" echo " -- eNB with USRP"
echo "" echo ""
...@@ -33,28 +33,7 @@ function wait_usage { ...@@ -33,28 +33,7 @@ function wait_usage {
echo "------" echo "------"
echo " oai-ci-vm-tool wait [OPTIONS]" echo " oai-ci-vm-tool wait [OPTIONS]"
echo "" echo ""
echo "Mandatory Options:" command_options_usage
echo "--------"
echo " --job-name #### OR -jn ####"
echo " Specify the name of the Jenkins job."
echo ""
echo " --build-id #### OR -id ####"
echo " Specify the build ID of the Jenkins job."
echo ""
echo " --workspace #### OR -ws ####"
echo " Specify the workspace."
echo ""
variant_usage
echo " Specify the variant to build."
echo ""
echo "Options:"
echo "--------"
echo " --keep-vm-alive OR -k"
echo " Keep the VM alive after the build."
echo ""
echo " --help OR -h"
echo " Print this help message."
echo ""
} }
function wait_on_vm_build { function wait_on_vm_build {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment