0bfc7e013fe921aaebfdf56b92bcd2a05763d8d3
[integration/csit.git] / scripts / sdc-dcae-d / setup_sdc_dcaed.sh
1 #!/bin/bash
2 #
3 # Copyright 2019 © Samsung Electronics 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 #
17
18 set -x
19
20 echo "This is ${WORKSPACE}/scripts/sdc-dcae-d/setup_sdc_dcaed.sh"
21
22 # Clone sdc enviroment template
23 mkdir -p ${WORKSPACE}/data/environments/
24 mkdir -p ${WORKSPACE}/data/clone/
25 cd ${WORKSPACE}/data/clone
26 git clone --depth 1 http://gerrit.onap.org/r/sdc/dcae-d/dt-be-main
27 git clone --depth 1 http://gerrit.onap.org/r/sdc
28
29 chmod -R 777 ${WORKSPACE}/data/clone
30
31 # set enviroment variables
32
33 export ENV_NAME='CSIT'
34 export MR_IP_ADDR='10.0.0.1'
35 export TEST_SUITE=$1
36
37 ifconfig
38 IP_ADDRESS=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'`
39 export HOST_IP=$IP_ADDRESS
40
41 # setup enviroment json
42
43 cat ${WORKSPACE}/data/clone/sdc/sdc-os-chef/environments/Template.json | sed "s/yyy/"$IP_ADDRESS"/g" > ${WORKSPACE}/data/environments/$ENV_NAME.json
44
45 source ${WORKSPACE}/data/clone/sdc/version.properties
46 export RELEASE=$major.$minor-STAGING-latest
47 source ${WORKSPACE}/data/clone/dt-be-main/version.properties
48 export DCAE_RELEASE=$major.$minor-STAGING-latest
49 export DEP_ENV=$ENV_NAME
50
51 cp ${WORKSPACE}/data/clone/sdc/sdc-os-chef/scripts/docker_run.sh ${WORKSPACE}/scripts/sdc-dcae-d/
52 cp ${WORKSPACE}/data/clone/dt-be-main/docker/scripts/docker_run.sh ${WORKSPACE}/scripts/sdc-dcae-d/dcaed_docker_run.sh
53
54 ${WORKSPACE}/scripts/sdc-dcae-d/docker_run.sh -r ${RELEASE} -e ${ENV_NAME} -p 10001
55 ${WORKSPACE}/scripts/sdc-dcae-d/dcaed_docker_run.sh -r ${DCAE_RELEASE} -e ${ENV_NAME} -p 10001
56
57