6 setup_sdc_for_sanity.sh [tad|tud]
9 setup_sdc_for_sanity.sh
10 just setup sdc component (containers)
12 setup_sdc_for_sanity.sh tad
13 setup sdc and run api test suite
15 setup_sdc_for_sanity.sh tud
16 setup sdc and run ui test suite
20 # arg: <variable name>
21 # returns 0: if <variable name> is set to true value
22 # returns 1: otherwise
24 _value=$(eval echo "\$${1}" | tr '[:upper:]' '[:lower:]')
35 # returns 0: if SDC_LOCAL_IMAGES is set to true value
36 # returns 1: otherwise
37 function using_local_images {
38 is_true SDC_LOCAL_IMAGES
41 # returns 0: if SDC_TEST_HTTPS is set to true value
42 # returns 1: otherwise
43 function using_https {
44 is_true SDC_TEST_HTTPS
50 echo "This is ${WORKSPACE}/scripts/sdc/setup_sdc_for_sanity.sh"
56 export TEST_SUITE="-${1}"
59 # we will just setup sdc - no tests
63 ENABLE_SIMULATOR="--simulator"
71 # Clone sdc enviroment template
72 mkdir -p "${WORKSPACE}/data/environments/"
73 mkdir -p "${WORKSPACE}/data/clone/"
75 cd "${WORKSPACE}/data/clone"
76 if using_local_images && [ -n "$SDC_LOCAL_GITREPO" ] ; then
77 SDC_LOCAL_GITREPO=$(realpath "$SDC_LOCAL_GITREPO")
78 if [ -d "$SDC_LOCAL_GITREPO" ] ; then
80 cp -a "$SDC_LOCAL_GITREPO" ./sdc
82 echo "[ERROR]: Local git repo for sdc does not exist: ${SDC_LOCAL_GITREPO}"
86 git clone --depth 1 "https://gerrit.onap.org/r/sdc" -b ${GERRIT_BRANCH}
90 chmod -R 777 "${WORKSPACE}/data/clone"
92 # set enviroment variables
94 export ENV_NAME='CSIT'
95 export MR_IP_ADDR='10.0.0.1'
98 IP_ADDRESS=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'`
99 export HOST_IP="$IP_ADDRESS"
101 # setup enviroment json
102 # TODO: use jq or find a better way altogether...
103 cp "${WORKSPACE}/data/clone/sdc/sdc-os-chef/environments/Template.json" \
104 "${WORKSPACE}/data/environments/$ENV_NAME.json"
106 -e "s/xxx/${ENV_NAME}/g" \
107 -e "s/yyy/${IP_ADDRESS}/g" \
108 -e "s/\"ueb_url_list\":.*/\"ueb_url_list\": \"${MR_IP_ADDR},${MR_IP_ADDR}\",/g" \
109 -e "s/\"fqdn\":.*/\"fqdn\": [\"${MR_IP_ADDR}\", \"${MR_IP_ADDR}\"]/g" \
110 "${WORKSPACE}/data/environments/$ENV_NAME.json"
111 if using_https ; then
112 # this is very fragile (as all above) and relies on the current state of Template.json in another project...
113 # using jq filters would be much better approach and no need for some "yyy"...
115 -e 's/"disableHttp":[[:space:]]*"\?[[:alnum:]]*"\?/"disableHttp": true/' \
116 "${WORKSPACE}/data/environments/$ENV_NAME.json"
119 cp "${WORKSPACE}/data/clone/sdc/sdc-os-chef/scripts/docker_run.sh" "${WORKSPACE}/scripts/sdc/"
121 source "${WORKSPACE}/data/clone/sdc/version.properties"
122 export RELEASE="${major}.${minor}-STAGING-latest"
124 if using_local_images ; then
125 if [ -n "$SDC_LOCAL_TAG" ] ; then
126 RELEASE="$SDC_LOCAL_TAG"
127 elif [ -z "$SDC_LOCAL_GITREPO" ] ; then
128 echo "[WARNING]: Local images used but no tag and no source (git repo) provided for them - we will use tag 'latest'"
132 echo "[INFO]: We will use the locally built images (tag: ${RELEASE})"
133 "${WORKSPACE}/scripts/sdc/docker_run.sh" \
137 -p 10001 ${TEST_SUITE} ${ENABLE_SIMULATOR}
139 echo "[INFO]: We will download images from the default registry (tag: ${RELEASE})"
140 ${WORKSPACE}/scripts/sdc/docker_run.sh \
143 -p 10001 ${TEST_SUITE} ${ENABLE_SIMULATOR}
146 # final step if the robot test needs to be adjusted
147 # TODO: again grab the values from Template directly with jq
148 # jq should be mandatory installed package (is it?)
149 if using_https ; then
150 ROBOT_VARIABLES="${ROBOT_VARIABLES} \
151 -v SDC_FE_PROTOCOL:https \
152 -v SDC_FE_PORT:9443 \
153 -v SDC_BE_PROTOCOL:https \
154 -v SDC_BE_PORT:8443 \
155 -v SDC_ONBOARDING_BE_PROTOCOL:https \
156 -v SDC_ONBOARDING_BE_PORT:8443 \
159 ROBOT_VARIABLES="${ROBOT_VARIABLES} \
160 -v SDC_FE_PROTOCOL:http \
161 -v SDC_FE_PORT:8181 \
162 -v SDC_BE_PROTOCOL:http \
163 -v SDC_BE_PORT:8080 \
164 -v SDC_ONBOARDING_BE_PROTOCOL:http \
165 -v SDC_ONBOARDING_BE_PORT:8081 \
169 # This file is sourced in another script which is out of our control...