. ../common/test_env.sh
-echo "Test case started as: ${BASH_SOURCE[$i+1]} "$1 $2
+echo "Test case started as: ${BASH_SOURCE[$i+1]} "$1 $2 $3
echo "Numbers of ric simulator started" $2
# This is a script that contains all the functions needed for auto test
IMAGE_TAG="1.0.0-SNAPSHOT"
IMAGE_TAG_REMOTE="latest"
RIC_NUMBER=$2
+SDNC=$3
-if [ $# -lt 1 ] || [ $# -gt 2 ]; then
- echo "Expected arg: local | remote and numbers of the rics "
+if [ $# -lt 1 ] || [ $# -gt 4 ]; then
+ echo "Expected arg: local | remote and numbers of the rics and SDNC "
exit 1
elif [ $1 == "local" ]; then
if [ -z $POLICY_AGENT_LOCAL_IMAGE ]; then
echo ""
echo "Building images for the simulators"
-curdir=$PWD
-cd $SIM_GROUP
-cd ../ric-plt/a1
+if [ -z "$SIM_DIR" ]; then
+ SIM_DIR=$(find . -type d -path "*a1-interface/near-rt-ric-simulator/scripts*" 2>/dev/null -print -quit)
+ if [ ! -d $SIM_DIR ]; then
+ echo "Trying to set env var SIM_DIR to dir 'a1-interface/near-rt-ric-simulator/scripts' in the sim repo, but failed."
+ echo "It might be that you did not download the repository of the near-rt-ric simulator.In that case, run the command:"
+ echo "git clone 'https://gerrit.o-ran-sc.org/oransc/sim/a1-interface'"
+ echo "Otherwise, please set the SIM_DIR manually in the test_env.sh"
+ exit 1
+ else
+ echo "SIM_DIR auto set to: " $SIM_DIR
+ fi
+fi
+cd $SIM_DIR
docker build -t ric-simulator:latest . &> /dev/null
cd $curdir
echo ""
}
+start_dashboard() {
+
+ DOCKER_SIM_NWNAME="nonrtric-docker-net"
+ echo "Creating docker network $DOCKER_SIM_NWNAME, if needed"
+ docker network ls| grep $DOCKER_SIM_NWNAME > /dev/null || docker network create $DOCKER_SIM_NWNAME
+
+ echo "start dashboard"
+ curdir=$PWD
+ cd $SIM_GROUP
+ cd dashboard/
+
+ docker-compose up -d
+
+ cd $curdir
+ echo ""
+}
+
+start_sdnc() {
+
+ if [ $SDNC == "sdnc" ]; then
+ DOCKER_SIM_NWNAME="nonrtric-docker-net"
+ echo "Creating docker network $DOCKER_SIM_NWNAME, if needed"
+ docker network ls| grep $DOCKER_SIM_NWNAME > /dev/null || docker network create $DOCKER_SIM_NWNAME
+
+ echo "start sdnc"
+ curdir=$PWD
+ cd $SIM_GROUP
+ cd sdnc/
+
+ docker-compose up -d a1-controller
+
+ cd $curdir
+ echo ""
+ fi
+}
+
prepare_consul_config() {
echo "prepare consul config"
curdir=$PWD
echo ""
}
+
+
clean_containers() {
echo "Stopping all containers, policy agent app(s) and simulators with name prefix 'policy_agent'"
docker stop $(docker ps -q --filter name=/policy-agent) &> /dev/null
docker stop $(docker ps -q --filter name=ric-simulator) &> /dev/null
echo "Removing all containers, policy agent app and simulators with name prefix 'ric-simulator'"
docker rm $(docker ps -a -q --filter name=ric-simulator) &> /dev/null
+ echo "Removing all containers, policy agent app and simulators with name prefix 'dashboard'"
+ docker rm $(docker ps -a -q --filter name=dashboard) &> /dev/null
+ echo "Removing all containers, policy agent app and simulators with name prefix 'a1-controller'"
+ docker rm $(docker ps -a -q --filter name=a1-controller) &> /dev/null
+ echo "Removing all containers, policy agent app and simulators with name prefix 'sdnc_db_container'"
+ docker rm $(docker ps -a -q --filter name=sdnc_db_container) &> /dev/null
+ echo "Removing all containers, policy agent app and simulators with name prefix 'cbs'"
+ docker rm $(docker ps -a -q --filter name=polman_cbs) &> /dev/null
+ echo "Removing all containers, policy agent app and simulators with name prefix 'consul'"
+ docker rm $(docker ps -a -q --filter name=polman_consul) &> /dev/null
echo "Removing unused docker networks with substring 'policy agent' in network name"
docker network rm $(docker network ls -q --filter name=nonrtric)
echo ""