X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=mc-core%2Fcontainer_start.sh;h=40008f9e68d3b8219d2d56a52143ed7e7ebdc5d5;hb=1d09ce755485acb017fab3c6cb3f794720b12836;hp=cd515f97226499b46fa08ba6ec278e7d034de714;hpb=ddaaf46a05789d0b3a26894411d115ea26e7ce4a;p=ric-app%2Fmc.git diff --git a/mc-core/container_start.sh b/mc-core/container_start.sh index cd515f9..40008f9 100755 --- a/mc-core/container_start.sh +++ b/mc-core/container_start.sh @@ -25,35 +25,56 @@ # This starts all of the related processes which normally would # be started in individual containers. # -# There are two environment variables which affect the operation +# There are environment variables which affect the operation # of this script: -# USE_NNG -- if set to !0 then the NNG version of the listener -# is started; undefined or when 0 then the SI95 -# version is used. # -# GSLITE_ROOT -- Assumed to be the root directory for the +# GSLITE_ROOT -- Assumed to be the root directory for the # core MC xAPP. If not defined, /mc/gs-lite is # assumed. # +# When NOT running in simulation mode, a registration message is +# sent to the xAPP manager via the registration script in /playpen. +# An unregister message is "queued" and should be sent when this +# script receives a terminating event, or exits normally. +# # Date: 13 February 2019 # Author: E. Scott Daniels # ---------------------------------------------------------------------- +# MUST have a posix style function declaration! +unreg() { + trap - EXIT # prevent running this again when we force the exit + /playpen/bin/xam_register -U + exit +} + set -e -SIMULATOR_MODE=`python /mc/extract_params.py $XAPP_DESCRIPTOR_PATH simulator_mode` +FIFO_DIR="/tmp/mcl/fifos" + +SIMULATOR_MODE=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json simulator_mode` +RMR_PORT=`python /mc/extract_rmr_port.py ${XAPP_DESCRIPTOR_PATH}/config-file.json rmr-data` + +mkdir -p $FIFO_DIR if [ "$SIMULATOR_MODE" != "true" ] then -# --- start "sidecars" first. They are expected to need /playpen as the working dir + # --- start "sidecars" first. They are expected to need /playpen as the working dir -( - cd /playpen - bin/mc_listener -) + ( + cd /playpen + if [ "$RMR_PORT" != "" ] + then + bin/mc_listener -p $RMR_PORT + else + bin/mc_listener + fi + ) >/tmp/listener.std 2>&1 & -echo "listener was started" >&2 + echo "listener was started" >&2 + trap 'unreg' EXIT 1 2 3 4 15 # unregister on exit/hup/quit/term + /playpen/bin/xam_register.sh # register the xapp now that listener is up fi @@ -61,4 +82,3 @@ fi cd ${GSLITE_ROOT:-/mc/gs-lite}/demo/queries ./runall -