f6daab636bdb6ec69e17bbb139d6fe05da19f616
[optf/osdf.git] / csit / scripts / simulator_script.sh
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/simulator_script.sh"
22 #
23 # add here whatever commands is needed to prepare the optf/osdf CSIT testing
24 #
25
26 #echo "i am ${USER} : only non jenkins users may need proxy settings"
27 if [ ${USER} != 'jenkins' ]; then
28
29     # add proxy settings into this script when you work behind a proxy
30     ${WORKSPACE}/scripts/osdf_proxy_settings.sh ${WORK_DIR}
31
32 fi
33
34 # prepare osdf_sim
35 cd ${WORKSPACE}/../test/functest/simulators
36
37 # check Dockerfile content
38 cat ./Dockerfile
39
40 # build osdf_sim
41 chmod +x ./build_sim_image.sh
42 ./build_sim_image.sh
43
44 # run osdf_sim
45 docker run -d --name osdf_sim -p "5000:5000"  osdf_sim:latest;
46
47 #wait for docker setup a while
48 sleep 10
49
50 docker ps -a
51
52 echo "logs of the osdf_sim"
53 sudo cat `docker inspect -f '{{.LogPath}}' osdf_sim`
54
55
56 OSDF_SIM_IP=`${WORKSPACE}/scripts/get-instance-ip.sh osdf_sim`
57 echo "OSDF_SIM_IP=${OSDF_SIM_IP}"
58
59 docker inspect osdf_sim
60
61 ${WORKSPACE}/scripts/wait_for_port.sh ${OSDF_SIM_IP} 5000
62
63
64 # wait a while before continuing
65 sleep 2
66
67 echo "inspect docker things for tracing purpose"
68