X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=near-rt-ric-simulator%2Ftest%2FSTD_2.0.0%2Fbuild_and_start.sh;fp=near-rt-ric-simulator%2Ftest%2FSTD_2.0.0%2Fbuild_and_start.sh;h=e903cd590ea728e685b4abd6d4b14724a075171c;hb=e220bfc2cb1727996da2fe120b676a9454cf982e;hp=a58004ae8cf7ca33183631ae3d1ee9026d4d34fd;hpb=2b8adeb97b5c8ad8a769ec0018056b1b2f20e877;p=sim%2Fa1-interface.git diff --git a/near-rt-ric-simulator/test/STD_2.0.0/build_and_start.sh b/near-rt-ric-simulator/test/STD_2.0.0/build_and_start.sh index a58004a..e903cd5 100755 --- a/near-rt-ric-simulator/test/STD_2.0.0/build_and_start.sh +++ b/near-rt-ric-simulator/test/STD_2.0.0/build_and_start.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START=============================================== -# Copyright (C) 2021 Nordix Foundation. All rights reserved. +# Copyright (C) 2021-2022 Nordix Foundation. All rights reserved. # ======================================================================== # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,13 +21,14 @@ # Make sure to run the simulator with the same arg as this script print_usage() { - echo "Usage: ./build_and_start.sh duplicate-check|ignore-duplicate " + echo "Usage: ./build_and_start.sh duplicate-check|ignore-duplicate ext-srv|ext-srv-secure|ignore-ext-srv" exit 1 } -if [ $# -ne 1 ]; then +if [ $# -ne 2 ]; then print_usage fi + if [ $1 == "duplicate-check" ]; then DUP_CHECK=1 elif [ $1 == "ignore-duplicate" ]; then @@ -36,15 +37,60 @@ else print_usage fi -echo "Building image" -cd ../../ +if [ $2 == "ext-srv" ]; then + URL="http://localhost:9095/a1policy/" +elif [ $2 == "ext-srv-secure" ]; then + URL="https://localhost:9195/a1policy/" +elif [ $2 == "ignore-ext-srv" ]; then + URL="" +else + print_usage +fi -#Build the image -docker build -t a1test . +URL_FLAG="" +if [ ! -z "$URL" ]; then + URL_FLAG="-e EXT_SRV_URL=$URL" +fi + +# Stop and remove container images if they run +echo "Stopping A1 simulator image..." docker stop a1StdSimulator > /dev/null 2>&1 docker rm -f a1StdSimulator > /dev/null 2>&1 -echo "Starting ric-sim" -#Run the container in interactive mode, unsecure port 8085, secure port 8185 -docker run --rm -it -p 8085:8085 -p 8185:8185 -e A1_VERSION=STD_2.0.0 -e ALLOW_HTTP=true -e REMOTE_HOSTS_LOGGING=1 -e DUPLICATE_CHECK=$DUP_CHECK --volume "$PWD/certificate:/usr/src/app/cert" --name a1StdSimulator a1test +echo "Stopping external server image..." +docker stop externalserversimulator > /dev/null 2>&1 +docker rm -f externalserversimulator > /dev/null 2>&1 + +# Initialize path variables for certificate and build operations + +dirstd2=$PWD + +cd ../../ +dirnrtsim=$PWD + +cd test/EXT_SRV/ +dirextsrv=$PWD + +# Build containers + +cd $dirnrtsim +echo "Building A1 simulator image..." +docker build -t a1test . + +if [ ! -z "$URL" ]; then + cd $dirextsrv + echo "Building external server image..." + docker build -t external_server . +fi + +# Run containers + +# Runs external_server in detached mode +# In order to tail logs use:: docker logs -f externalserversimulator +if [ ! -z "$URL" ]; then + docker run -d --network host --rm -it -p 9095:9095 -p 9195:9195 -e ALLOW_HTTP=true --volume "$dirextsrv/certificate:/usr/src/app/cert" --name externalserversimulator external_server +fi + +# Runs A1 simulator +docker run --network host --rm -it -p 8085:8085 -p 8185:8185 -e A1_VERSION=STD_2.0.0 -e ALLOW_HTTP=true -e REMOTE_HOSTS_LOGGING=1 -e DUPLICATE_CHECK=$DUP_CHECK $URL_FLAG --volume "$dirnrtsim/certificate:/usr/src/app/cert" --name a1StdSimulator a1test