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 {
echo " Original Author: Raphael Defosseux"
echo " Requirements:"
echo " -- uvtool uvtool-libvirt apt-cacher"
echo " -- xenial image already synced"
echo " -- $VM_OSREL image already synced"
echo " Default:"
echo " -- eNB with USRP"
echo ""
......@@ -33,31 +33,8 @@ function build_usage {
echo "------"
echo " oai-ci-vm-tool build [OPTIONS]"
echo ""
echo "Mandatory Options:"
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 ""
command_options_usage
}
function build_on_vm {
......@@ -95,7 +72,7 @@ function build_on_vm {
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
echo "############################################################"
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"
uvt-kvm wait $VM_NAME --insecure
......
......@@ -25,7 +25,7 @@ function create_usage {
echo " Original Author: Raphael Defosseux"
echo " Requirements:"
echo " -- uvtool uvtool-libvirt apt-cacher"
echo " -- xenial image already synced"
echo " -- $VM_OSREL image already synced"
echo " Default:"
echo " -- eNB with USRP"
echo ""
......@@ -90,7 +90,7 @@ function create_vm {
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
echo "############################################################"
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"
uvt-kvm wait $VM_NAME --insecure
......
......@@ -30,19 +30,7 @@ function destroy_usage {
echo "------"
echo " oai-ci-vm-tool destroy [OPTIONS]"
echo ""
echo "Mandatory Options:"
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 ""
command_options_usage
}
function destroy_vm {
......
......@@ -52,7 +52,7 @@ The main script is including a bunch of sub BASH scripts.
* ci-scripts/reportBuildLocally.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 #
......@@ -75,13 +75,122 @@ for OAI variant build:
* build log file to parse: LOG_PATTERN
* 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)
You can also go back to the [CI dev main page](./ci_dev_home.md)
......@@ -20,33 +20,299 @@
# * contact@openairinterface.org
# */
function top_usage {
echo "OAI CI VM script"
echo " Original Author: Raphael Defosseux"
echo " Requirements:"
echo " -- uvtool uvtool-libvirt apt-cacher"
echo " -- xenial image already synced"
echo " -- $VM_OSREL image already synced"
echo ""
echo "Usage:"
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 ""
}
function variant_usage {
echo " # OpenAirInterface Build Variants"
echo " --variant enb-usrp OR -v1"
echo " --variant basic-sim OR -v2"
echo " --variant phy-sim OR -v3"
echo " --variant cppcheck OR -v4"
echo " --variant enb-ethernet OR -v7"
echo " --variant ue-ethernet OR -v8"
echo " # non-OSA Build Variants"
echo " --variant flexran-rtc OR -v10"
echo " # OpenAirInterface Test Variants"
echo " --variant l1-sim OR -v20"
echo " --variant rf-sim OR -v21"
echo " --variant l2-sim OR -v22"
for (( i=0 ; i<${#VARIANTS_LONG[@]} ; i++ ))
do
unset BUILD_OPTIONS
unset VARIANT_INFO
check_set_variant "${VARIANTS_SHORT[$i]}"
printf " --variant %-15s OR -%-3s" "${VARIANTS_LONG[$i]}" "${VARIANTS_SHORT[$i]}"
if [ "$BUILD_OPTIONS" = "" ]
then
echo -n " ( test "
else
echo -n " ( build and test "
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))
......@@ -67,101 +333,263 @@ then
fi
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_OPTINDEX=0
JOB_NAME_OPTID=1
BUILD_ID=XX
VM_NAME=ci-enb-usrp
VM_MEMORY=2048
VM_CPU=4
ARCHIVES_LOC=enb_usrp
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=7
BUILD_OPTIONS="--eNB -w USRP"
BUILD_ID_OPTINDEX=1
BUILD_ID_OPTID=2
JENKINS_WKSP_OPTINDEX=2
JENKINS_WKSP_OPTID=4
KEEP_VM_ALIVE_OPTINDEX=3
KEEP_VM_ALIVE_OPTID=8
KEEP_VM_ALIVE=0
RUN_OPTIONS="none"
DAEMON_OPTINDEX=4
DAEMON_OPTID=$((2**4))
DAEMON=0
MR_TRIG=0
GITURL_OPTINDEX=5
GITURL_OPTID=$((2**5))
PU_OPTINDEX=6
PU_OPTID=$((2**6))
PU_TRIG=0
HELP_CMD=0
CREATE_CMD=0
BUILD_CMD=0
WAIT_CMD=0
DESTROY_CMD=0
TEST_CMD=0
REPORT_BUILD_CMD=0
REPORT_TEST_CMD=0
MR_OPTINDEX=7
MR_OPTID=$((2**7))
MR_TRIG=0
VARIANT_OPTINDEX=8
VARIANT_OPTID=$((2**8))
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
MANDATORY_OPTMASK=(0 0) # some command have two sets of mandatory options
ALLOWED_OPTMASK=0
while [[ $# -gt 0 ]]
do
key="$1"
if [ "$(type -t $funcname)" != 'function' ]; then
funcname=do_it_normal
fi
case $key in
-h|--help)
HELP_CMD=1
--debug)
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
;;
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
KEEP_VM_ALIVE=1
shift
;;
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
;;
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
;;
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
;;
destroy)
DESTROY_CMD=1
COMMAND[$key]=1
# For destroy, mandatory options: jn, id.
MANDATORY_OPTMASK[0]=$(($JOB_NAME_OPTID + $BUILD_ID_OPTID))
shift
;;
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
;;
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
;;
-jn|--job-name)
JOB_NAME="$2"
NBARGS=$[$NBARGS+1]
NBARGS=$[$NBARGS+$JOB_NAME_OPTID]
shift
shift
;;
-id|--build-id)
BUILD_ID="$2"
NBARGS=$[$NBARGS+2]
NBARGS=$[$NBARGS+$BUILD_ID_OPTID]
shift
shift
;;
-ws|--workspace)
JENKINS_WKSP="$2"
NBARGS=$[$NBARGS+4]
NBARGS=$[$NBARGS+$JENKINS_WKSP_OPTID]
shift
shift
;;
-k|--keep-vm-alive)
KEEP_VM_ALIVE=1
NBARGS=$[$NBARGS+8]
NBARGS=$[$NBARGS+$KEEP_VM_ALIVE_OPTID]
shift
;;
-D|--daemon)
DAEMON=1
NBARGS=$[$NBARGS+16]
NBARGS=$[$NBARGS+$DAEMON_OPTID]
shift
;;
-gu|--git-url)
GIT_URL="$2"
NBARGS=$[$NBARGS+32]
NBARGS=$[$NBARGS+$GITURL_OPTID]
shift
shift
;;
......@@ -170,9 +598,11 @@ case $key in
case $TRIG in
merge-request)
MR_TRIG=1
NBARGS=$[$NBARGS+$MR_OPTID]
;;
push)
PU_TRIG=1
NBARGS=$[$NBARGS+$PU_OPTID]
;;
*)
echo ""
......@@ -182,242 +612,83 @@ case $key in
exit
;;
esac
NBARGS=$[$NBARGS+64]
shift
shift
;;
-mr)
-mr|--merge-request)
MR_TRIG=1
NBARGS=$[$NBARGS+64]
NBARGS=$[$NBARGS+$MR_OPTID]
shift
;;
-pu)
-pu|--push)
PU_TRIG=1
NBARGS=$[$NBARGS+64]
NBARGS=$[$NBARGS+$PU_OPTID]
shift
;;
-sb|--src-branch)
SOURCE_BRANCH="$2"
NBARGS=$[$NBARGS+1024]
NBARGS=$[$NBARGS+$SB_OPTID]
shift
shift
;;
-sc|--src-commit)
SOURCE_COMMIT_ID="$2"
NBARGS=$[$NBARGS+2048]
NBARGS=$[$NBARGS+$SC_OPTID]
shift
shift
;;
-tb|--target-branch)
TARGET_BRANCH="$2"
NBARGS=$[$NBARGS+4096]
NBARGS=$[$NBARGS+$TB_OPTID]
shift
shift
;;
-tc|--target-commit)
TARGET_COMMIT_ID="$2"
NBARGS=$[$NBARGS+8192]
NBARGS=$[$NBARGS+$TC_OPTID]
shift
shift
;;
-br|--branch)
SOURCE_BRANCH="$2"
NBARGS=$[$NBARGS+16384]
NBARGS=$[$NBARGS+$BR_OPTID]
shift
shift
;;
-co|--commit)
SOURCE_COMMIT_ID="$2"
NBARGS=$[$NBARGS+32768]
NBARGS=$[$NBARGS+$CO_OPTID]
shift
shift
;;
-v1)
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]
-epc|--external-epc)
check_ipv4addr "$2"
check_ipv4addr "$3"
EPC_IPADDR="$2"
EPC_TUN_IPADDR="$3"
NBARGS=$[$NBARGS+$EPC_IPADDR_OPTID]
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
;;
-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
;;
-v4)
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]
-sim|--sim-file)
SIMFILE="$2"
NBARGS=$[$NBARGS+$SIM_OPTID]
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
;;
-v8)
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]
--setvar_*)
check_setvar "${key:9}" "$2"
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
;;
-v21)
VM_NAME=ci-rf-sim
ARCHIVES_LOC=rf_sim
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
-v[0-9] | -v[0-9][0-9])
check_set_variant ${key//"-"}
shift
;;
-v22)
VM_NAME=ci-l2-sim
ARCHIVES_LOC=l2_sim
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
shift
;;
--variant)
-var|--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
check_set_variant ${2}
shift
shift
;;
......@@ -429,117 +700,47 @@ case $key in
esac
done
MANY_CMDS=$[$CREATE_CMD+$BUILD_CMD+$WAIT_CMD+$DESTROY_CMD+$TEST_CMD+$REPORT_BUILD_CMD+$REPORT_TEST_CMD]
if [ $MANY_CMDS -gt 1 ]
then
echo "Syntax Error: too many commands"
top_usage
exit 1
fi
i=0
for (( COUNT=1 ; COUNT<${#COMMAND[@]} ; COUNT++ ))
do
if [ ${COMMAND[${COMMANDS_NAME[$COUNT]}]} -eq 1 ]
then
COMMAND_KEY[$i]=${COMMANDS_NAME[$COUNT]}
(( i++ ))
fi
done
if [ $HELP_CMD -eq 1 ]
if [ ${COMMAND["help"]} -eq 1 ]
then
if [ $MANY_CMDS -eq 0 ]
if [ ${#COMMAND_KEY[@]} -ne 1 ] && [ "$HELPCMD" == "" ]
then
top_usage
exit 0
fi
if [ $CREATE_CMD -eq 1 ]
then
create_usage
exit 0
fi
if [ $BUILD_CMD -eq 1 ]
then
build_usage
exit 0
fi
if [ $WAIT_CMD -eq 1 ]
elif [ "$HELPCMD" != "" ]
then
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
$HELPCMD
else
${COMMAND_KEY[0]//-/_}_usage
fi
if [ $REPORT_TEST_CMD -eq 1 ]
then
report_test_usage
exit 0
fi
else
if [ $MANY_CMDS -eq 0 ]
if [ ${#COMMAND_KEY[@]} -gt 1 ]
then
echo "Syntax Error: no command"
echo "Syntax Error, too many commands: ${COMMAND_KEY[@]}"
top_usage
exit 1
fi
# For create, mandatory options: jn, id. Optional: variant
if [ $CREATE_CMD -eq 1 ] && [ $NBARGS -ne 3 ] && [ $NBARGS -ne 259 ]
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 ]
if [ -z "${COMMAND_KEY[0]}" ]
then
echo "Syntax Error: unsupported option(s) for report-test command"
report_test_usage
echo "Syntax Error: no command, specify one of: ${COMMANDS_NAME[@]}"
top_usage
exit 1
fi
check_command_options $NBARGS MANDATORY_OPTMASK[@] $ALLOWED_OPTMASK ${COMMAND_KEY[0]}
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
# Checking uvt-kvm is installed
UVT_KVM_PATH=`which uvt-kvm | grep -c uvt-kvm`
......@@ -557,27 +758,31 @@ then
else
VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}-
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_CMDS=${VM_NAME}_cmds.txt
ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC}
STATUS=0
if [ $CREATE_CMD -eq 1 ]
if [ ${COMMAND[${COMMANDS_NAME[$CREATE_CMD]}]} -eq 1 ]
then
if [[ $VM_NAME =~ .*-l2-sim.* ]]
if [[ "$BUILD_OPTIONS" = "" ]]
then
echo "Selected variant is no more a build variant"
echo "$VM_NAME is not a build variant"
exit 0
else
create_vm
fi
fi
if [ $BUILD_CMD -eq 1 ]
if [ ${COMMAND[${COMMANDS_NAME[$BUILD_CMD]}]} -eq 1 ]
then
if [[ $VM_NAME =~ .*-l2-sim.* ]]
if [[ "$BUILD_OPTIONS" = "" ]]
then
echo "Selected variant is no more a build variant"
echo " $VM_NAME is not a build variant"
exit 0
else
build_on_vm
......@@ -587,11 +792,11 @@ then
check_on_vm_build
fi
fi
if [ $WAIT_CMD -eq 1 ]
if [ ${COMMAND[${COMMANDS_NAME[$WAIT_CMD]}]} -eq 1 ]
then
if [[ $VM_NAME =~ .*-l2-sim.* ]]
if [[ "$BUILD_OPTIONS" = "" ]]
then
echo "Selected variant is no more a build variant"
echo "$VM_NAME is not a build variant"
exit 0
else
wait_on_vm_build
......@@ -601,38 +806,31 @@ then
check_on_vm_build
fi
fi
if [ $TEST_CMD -eq 1 ]
if [ ${COMMAND[${COMMANDS_NAME[$TEST_CMD]}]} -eq 1 ]
then
# Comment out or delete the following lines if you want to run L1-simulator in your branch and/or merge request
if [[ $VM_NAME =~ .*-l1-sim.* ]]
# variant with EXPERIMENTAL variable set to true won't run and will be
# considered OK, except if --setvar_RUN_EXPERIMENTAL option has been set to true
if [ "$EXPERIMENTAL" = "true" ] && [ "$RUN_EXPERIMENTAL" != "true" ]
then
echo "Currently L1-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 "Currently $VM_NAME Testing is not implemented / enabled"
echo "remove EXPERIMENTAL variable definition from this variant"
echo " or use option --setvar_RUN_EXPERIMENTAL=true to enforce testing it"
echo "STATUS seems OK"
exit $STATUS
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
run_test_on_vm
fi
if [ $DESTROY_CMD -eq 1 ]
if [ ${COMMAND[${COMMANDS_NAME[$DESTROY_CMD]}]} -eq 1 ]
then
destroy_vm
fi
if [ $REPORT_BUILD_CMD -eq 1 ]
if [ ${COMMAND[${COMMANDS_NAME[$REPORT_BUILD_CMD]}]} -eq 1 ]
then
report_build
fi
if [ $REPORT_TEST_CMD -eq 1 ]
if [ ${COMMAND[${COMMANDS_NAME[$REPORT_TEST_CMD]}]} -eq 1 ]
then
report_test
fi
......
......@@ -28,56 +28,8 @@ function report_build_usage {
echo "------"
echo " oai-ci-vm-tool report-build [OPTIONS]"
echo ""
echo "Options:"
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 ""
command_options_usage
}
function trigger_usage {
......
......@@ -28,56 +28,7 @@ function report_test_usage {
echo "------"
echo " oai-ci-vm-tool report-test [OPTIONS]"
echo ""
echo "Options:"
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 ""
command_options_usage
}
function analyzePingFiles {
......
......@@ -20,12 +20,12 @@
# * contact@openairinterface.org
# */
function run_test_usage {
function test_usage {
echo "OAI CI VM script"
echo " Original Author: Raphael Defosseux"
echo " Requirements:"
echo " -- uvtool uvtool-libvirt apt-cacher"
echo " -- xenial image already synced"
echo " -- $VM_OSREL image already synced"
echo " Default:"
echo " -- eNB with USRP"
echo ""
......@@ -33,26 +33,7 @@ function run_test_usage {
echo "------"
echo " oai-ci-vm-tool test [OPTIONS]"
echo ""
echo "Options:"
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 ""
command_options_usage
}
function start_basic_sim_enb {
......@@ -126,7 +107,7 @@ function start_basic_sim_ue {
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
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 "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
......@@ -483,7 +464,7 @@ function install_epc_on_vm {
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
uvt-kvm create $LOC_EPC_VM_NAME release=$VM_OSREL --unsafe-caching
echo "Waiting for VM to be started"
uvt-kvm wait $LOC_EPC_VM_NAME --insecure
release_vm_create_lock
......@@ -629,14 +610,19 @@ function retrieve_real_epc_ip_addr {
local LOC_EPC_VM_CMDS=$2
local LOC_EPC_VM_IP_ADDR=$3
if [[ "$EPC_IPADDR" == "" ]]
then
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
else
REAL_EPC_IP_ADDR=$EPC_TUN_IPADDR
fi
echo "EPC IP Address is : $REAL_EPC_IP_ADDR"
}
function terminate_epc {
......@@ -1093,7 +1079,7 @@ function run_test_on_vm {
echo "############################################################"
echo "OAI CI VM script"
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
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
......@@ -1110,7 +1096,7 @@ function run_test_on_vm {
echo "JENKINS_WKSP = $JENKINS_WKSP"
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
echo "############################################################"
echo "Waiting for ENB VM to be started"
......@@ -1261,17 +1247,28 @@ function run_test_on_vm {
EPC_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#epc#"`
EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt
LTEBOX=0
if [[ "$EPC_IPADDR" == "" ]]
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
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_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
TRANS_MODES=("fdd" "tdd")
BW_CASES=(05 10 20)
#TRANS_MODES=("fdd" "tdd")
#BW_CASES=(05 10 20)
TRANS_MODES=("fdd")
BW_CASES=(05)
for TMODE in ${TRANS_MODES[@]}
do
......@@ -1305,6 +1302,9 @@ function run_test_on_vm {
fi
get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1
full_terminate
continue
echo "############################################################"
echo "Pinging the UE"
echo "############################################################"
......@@ -1446,7 +1446,10 @@ function run_test_on_vm {
echo "Terminate EPC"
echo "############################################################"
if [[ "$EPC_IPADDR" == "" ]]
then
terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
fi
full_basic_sim_destroy
......@@ -1474,33 +1477,43 @@ function run_test_on_vm {
rm -Rf $ARCHIVES_LOC
fi
mkdir --parents $ARCHIVES_LOC
if [[ "$EPC_IPADDR" == "" ]]
then
# 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`
fi
# withS1 configuration is not working
#EPC_CONFIGS=("wS1" "noS1")
#TRANS_MODES=("fdd" "tdd")
#BW_CASES=(05 10 20)
EPC_CONFIGS=("noS1")
EPC_CONFIGS=("noS1" "wS1")
TRANS_MODES=("fdd")
BW_CASES=(05)
for CN_CONFIG in ${EPC_CONFIGS[@]}
do
if [[ $CN_CONFIG =~ .*wS1.* ]]
then
if [[ "$EPC_IPADDR" == "" ]]
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 "Using external EPC " $EPC_IPADDR
echo "############################################################"
$EPC_VM_IP_ADDR=$EPC_IPADDR
S1_NOS1_CFG=1
LTEBOX=0
fi
else
echo "############################################################"
echo "Terminate EPC"
......@@ -1508,7 +1521,7 @@ function run_test_on_vm {
terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
echo "############################################################"
echo "Running now in a no-S1 configuration"
echo "Running now in a no-S1 "
echo "############################################################"
S1_NOS1_CFG=0
fi
......@@ -1532,7 +1545,7 @@ function run_test_on_vm {
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
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"
......
......@@ -25,7 +25,7 @@ function wait_usage {
echo " Original Author: Raphael Defosseux"
echo " Requirements:"
echo " -- uvtool uvtool-libvirt apt-cacher"
echo " -- xenial image already synced"
echo " -- $VM_OSREL image already synced"
echo " Default:"
echo " -- eNB with USRP"
echo ""
......@@ -33,28 +33,7 @@ function wait_usage {
echo "------"
echo " oai-ci-vm-tool wait [OPTIONS]"
echo ""
echo "Mandatory Options:"
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 ""
command_options_usage
}
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