Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright 2016-2017 Huawei Technologies Co., Ltd. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 17 | echo "### This is ${WORKSPACE}/scripts/optf-has/has/simulator_script.sh" |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 18 | # |
| 19 | # add here whatever commands is needed to prepare the optf/has CSIT testing |
| 20 | # |
| 21 | |
| 22 | # assume the base is /tmp dir |
| 23 | DIR=/tmp |
| 24 | |
| 25 | # the directory of the script |
| 26 | echo ${DIR} |
| 27 | cd ${DIR} |
| 28 | |
| 29 | # the temp directory used, within $DIR |
| 30 | # omit the -p parameter to create a temporal directory in the default location |
| 31 | WORK_DIR=`mktemp -d -p "$DIR"` |
| 32 | echo ${WORK_DIR} |
| 33 | cd ${WORK_DIR} |
| 34 | |
| 35 | # clone optf-has project |
| 36 | git clone https://gerrit.onap.org/r/optf/has |
| 37 | |
| 38 | #echo "i am ${USER} : only non jenkins users may need proxy settings" |
| 39 | if [ ${USER} != 'jenkins' ]; then |
| 40 | |
| 41 | # add proxy settings into this script when you work behind a proxy |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 42 | ${WORKSPACE}/scripts/optf-has/has/has_proxy_settings.sh ${WORK_DIR} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 43 | |
| 44 | fi |
| 45 | |
| 46 | # prepare aaisim |
krishnaa96 | 4e76bd1 | 2020-10-23 14:33:09 +0530 | [diff] [blame] | 47 | cd ${WORK_DIR}/has/conductor/conductor/tests/functional/simulators/ |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 48 | |
| 49 | # run aaisim |
krishnaa96 | 4e76bd1 | 2020-10-23 14:33:09 +0530 | [diff] [blame] | 50 | ./run_aaisim.sh |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 51 | |
| 52 | AAISIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' aaisim` |
| 53 | echo "AAISIM_IP=${AAISIM_IP}" |
| 54 | |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 55 | ${WORKSPACE}/scripts/optf-has/has/wait_for_port.sh ${AAISIM_IP} 8081 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 56 | |
| 57 | # prepare multicloudsim |
| 58 | cd ${WORK_DIR}/has/conductor/conductor/tests/functional/simulators/multicloudsim/ |
| 59 | |
| 60 | # check Dockerfile content |
| 61 | cat ./Dockerfile |
| 62 | |
| 63 | # build multicloudsim |
| 64 | docker build -t multicloudsim . |
| 65 | |
| 66 | # run multicloudsim |
| 67 | docker run -d --name multicloudsim -p 8082:8082 multicloudsim |
| 68 | |
| 69 | MULTICLOUDSIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' multicloudsim` |
| 70 | echo "MULTICLOUDSIM_IP=${MULTICLOUDSIM_IP}" |
| 71 | |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 72 | ${WORKSPACE}/scripts/optf-has/has/wait_for_port.sh ${MULTICLOUDSIM_IP} 8082 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 73 | |
Dileep Ranganathan | 5dc29ae | 2018-10-06 16:35:11 -0700 | [diff] [blame] | 74 | # prepare aafsim |
| 75 | echo "simulator_script: prepare aafsim " |
| 76 | cd ${WORK_DIR}/has/conductor/conductor/tests/functional/simulators/aafsim/ |
| 77 | |
| 78 | # check Dockerfile content |
| 79 | echo "simulator_script: Dockerfile " |
| 80 | cat ./Dockerfile |
| 81 | |
| 82 | # build aafsim |
| 83 | echo "simulator_script: build docker " |
| 84 | docker build -t aafsim . |
| 85 | |
| 86 | # run aafsim |
| 87 | echo "simulator_script: run docker " |
| 88 | docker run -d --name aafsim -p 8100:8100 aafsim |
| 89 | |
| 90 | AAFSIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' aafsim` |
| 91 | echo "simulator_script: AAFSIM_IP=${AAFSIM_IP}" |
| 92 | |
| 93 | #echo "simulator_script: wait_for_port" |
| 94 | ${WORKSPACE}/scripts/optf-has/has/wait_for_port.sh ${AAFSIM_IP} 8100 |
| 95 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 96 | # wait a while before continuing |
| 97 | sleep 2 |
| 98 | |
| 99 | echo "inspect docker things for tracing purpose" |
| 100 | docker inspect aaisim |
| 101 | docker inspect multicloudsim |
Dileep Ranganathan | 5dc29ae | 2018-10-06 16:35:11 -0700 | [diff] [blame] | 102 | docker inspect aafsim |