vrvarma | 3fe70c7 | 2018-09-28 10:30:00 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # ------------------------------------------------------------------------- |
| 4 | # Copyright (c) 2018 AT&T Intellectual Property |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | # ------------------------------------------------------------------------- |
| 19 | # |
| 20 | |
| 21 | echo "### This is ${WORKSPACE}/scripts/optf-osdf/osdf/simulator_script.sh" |
| 22 | # |
| 23 | # add here whatever commands is needed to prepare the optf/osdf CSIT testing |
| 24 | # |
| 25 | # assume the base is /tmp dir |
| 26 | |
| 27 | DIR=/tmp |
| 28 | |
| 29 | # the directory of the script |
| 30 | echo ${DIR} |
| 31 | cd ${DIR} |
| 32 | |
| 33 | # the temp directory used, within $DIR |
| 34 | # omit the -p parameter to create a temporal directory in the default location |
| 35 | WORK_DIR=`mktemp -d -p "$DIR"` |
| 36 | echo ${WORK_DIR} |
| 37 | cd ${WORK_DIR} |
| 38 | |
| 39 | # clone optf-osdf project |
| 40 | git clone https://gerrit.onap.org/r/optf/osdf |
| 41 | |
| 42 | #echo "i am ${USER} : only non jenkins users may need proxy settings" |
| 43 | if [ ${USER} != 'jenkins' ]; then |
| 44 | |
| 45 | # add proxy settings into this script when you work behind a proxy |
| 46 | ${WORKSPACE}/scripts/optf-osdf/osdf/osdf_proxy_settings.sh ${WORK_DIR} |
| 47 | |
| 48 | fi |
| 49 | |
| 50 | # prepare osdf_sim |
| 51 | cd ${WORK_DIR}/osdf/test/functest/simulators |
| 52 | |
| 53 | # check Dockerfile content |
| 54 | cat ./Dockerfile |
| 55 | |
| 56 | # build osdf_sim |
| 57 | chmod +x ./build_sim_image.sh |
| 58 | ./build_sim_image.sh |
| 59 | |
| 60 | # run osdf_sim |
| 61 | docker run -d --name osdf_sim -p "5000:5000" osdf_sim:latest; |
| 62 | |
| 63 | OSDF_SIM_IP=`get-instance-ip.sh osdf_sim` |
| 64 | echo "OSDF_SIM_IP=${OSDF_SIM_IP}" |
| 65 | |
| 66 | ${WORKSPACE}/scripts/optf-osdf/osdf/wait_for_port.sh ${OSDF_SIM_IP} 5000 |
| 67 | |
| 68 | |
| 69 | # wait a while before continuing |
| 70 | sleep 2 |
| 71 | |
| 72 | echo "inspect docker things for tracing purpose" |
| 73 | docker inspect osdf_sim |
| 74 | |