blob: d561ee09e5337648f8f83d52e2c002177f1d0b06 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001#!/bin/bash
2#
3# ============LICENSE_START=======================================================
4# ONAP AAF
5# ================================================================================
6# Copyright (C) 2017 AT&T Intellectual Property. All rights
7# reserved.
8# ================================================================================
9# Licensed under the Apache License, Version 2.0 (the "License");
10# you may not use this file except in compliance with the License.
11# You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing, software
16# distributed under the License is distributed on an "AS IS" BASIS,
17# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18# See the License for the specific language governing permissions and
19# limitations under the License.
20# ============LICENSE_END============================================
21# ===================================================================
22# ECOMP is a trademark and service mark of AT&T Intellectual Property.
23#
24# Place the scripts in run order:
25source ${SCRIPTS}/common_functions.sh
26
27# Clone AAF Authz repo
Sai Gandham94df0ae2018-10-09 16:29:54 -050028mkdir -p $WORKSPACE/archives/opt
29cd $WORKSPACE/archives/opt
30
31
32HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
33export HOST_IP=${HOST_IP}
34
35CURRENT_DIR=$(pwd) export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
36
37NEXUS_USERNAME=anonymous
38NEXUS_PASSWD=anonymous
39NEXUS_DOCKER_REPO=nexus3.onap.org:10001
40AAF_DOCKER_VERSION=2.1.3-SNAPSHOT
41
42docker login -u $NEXUS_USERNAME -p "$NEXUS_PASSWD" $NEXUS_DOCKER_REPO
43
44docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION
45docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_config:$AAF_DOCKER_VERSION
46docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_cm:$AAF_DOCKER_VERSION
47docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_fs:$AAF_DOCKER_VERSION
48docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_gui:$AAF_DOCKER_VERSION
49docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_hello:$AAF_DOCKER_VERSION
50docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_locate:$AAF_DOCKER_VERSION
51docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_oauth:$AAF_DOCKER_VERSION
52docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_service:$AAF_DOCKER_VERSION
53
54docker tag $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION nexus3.onap.org:10003/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION
Gary Wu9abb61c2018-09-27 10:38:50 -070055git clone --depth 1 http://gerrit.onap.org/r/aaf/authz -b master
56git pull
Sai Gandham94df0ae2018-10-09 16:29:54 -050057chmod -R 777 authz
58cd authz
59CURRENT_DIR=$(pwd)
60
Gary Wu9abb61c2018-09-27 10:38:50 -070061pwd
Sai Gandham94df0ae2018-10-09 16:29:54 -050062
63if [ ! -e auth/csit/d.props ]; then
64 cp auth/csit/d.props.init auth/csit/d.props
65fi
66
67if [ ! -e auth/docker/d.props ]; then
68 cp auth/docker/d.props.init auth/docker/d.props
69fi
Gary Wu9abb61c2018-09-27 10:38:50 -070070
71
Gary Wu9abb61c2018-09-27 10:38:50 -070072
Sai Gandham94df0ae2018-10-09 16:29:54 -050073NEXUS_USERNAME=anonymous
74NEXUS_PASSWD=anonymous
75NEXUS_DOCKER_REPO=nexus3.onap.org:10001
76sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$NEXUS_DOCKER_REPO/" auth/csit/d.props
77. auth/csit/d.props
Gary Wu9abb61c2018-09-27 10:38:50 -070078
Sai Gandham94df0ae2018-10-09 16:29:54 -050079sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$NEXUS_DOCKER_REPO/" auth/docker/d.props
80. auth/docker/d.props
81
82
83HOSTNAME=`hostname`
84FQDN=aaf.api.simpledemo.onap.org
85HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
86export HOST_IP=${HOST_IP}
87
88
89CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4`
90CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP
91
92cd auth/auth-cass/docker
93if [ "`docker container ls | grep aaf_cass`" = "" ]; then
94 # Cassandra Install
95 echo Cassandra Install
96 bash ./dinstall.sh
97fi
98
99CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4`
100CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP
101if [ ! -e $WORKSPACE/archives/opt/authz/auth/csit/cass.props ]; then
102 cp $WORKSPACE/archives/opt/authz/auth/csit/cass.props.init $WORKSPACE/archives/opt/authz/auth/csit/cass.props
103fi
104
105sed -i "s/CASS_HOST=.*/CASS_HOST="$CASS_HOST"/g" $WORKSPACE/archives/opt/authz/auth/csit/cass.props
106
107if [ ! -e $WORKSPACE/archives/opt/authz/auth/docker/cass.props ]; then
108 cp $WORKSPACE/archives/opt/authz/auth/docker/cass.props.init $WORKSPACE/archives/opt/authz/auth/docker/cass.props
109fi
110
111sed -i "s/CASS_HOST=.*/CASS_HOST="$CASS_HOST"/g" $WORKSPACE/archives/opt/authz/auth/docker/cass.props
112# TODO Pull from Config Dir
113if [ "$LATITUDE" = "" ]; then
114 LATITUDE=37.781
115 LONGITUDE=-122.261
116 sed -i "s/LATITUDE=.*/LATITUDE=$LATITUDE/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
117 sed -i "s/LONGITUDE=.*/LONGITUDE=$LONGITUDE/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
118fi
119
120sed -i "s/VERSION=.*/VERSION=$VERSION/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
121sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
122sed -i "s/HOST_IP=.*/HOST_IP=$HOST_IP/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
123sed -i "s/AAF_REGISTER_AS=.*/AAF_REGISTER_AS=$FQDN/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
124
125pwd
126
127cd ../../
128
129pwd
130
131cd csit
132tty
133# Need new Deployment system properties
134bash ./aaf.sh
135
136# run it
137bash ./drun.sh
138
139docker images
140
141docker ps -a
142
143cat /etc/sudoers
144
145docker logs aaf_hello
146
147docker logs aaf_locate
148
149docker logs aaf_cm
150
151docker logs aaf_gui
152
153docker logs aaf_fs
154
155docker logs aaf_oauth
156
157docker logs aaf_service
158
159# Wait for initialization of Docker containers
160for i in {1..50}; do
161 if [ $(docker inspect --format '{{ .State.Running }}' aaf_hello) ] && \
162 [ $(docker inspect --format '{{ .State.Running }}' aaf_cm) ] && \
163 [ $(docker inspect --format '{{ .State.Running }}' aaf_fs) ] && \
164 [ $(docker inspect --format '{{ .State.Running }}' aaf_gui) ] && \
165 [ $(docker inspect --format '{{ .State.Running }}' aaf_oauth) ] && \
166 [ $(docker inspect --format '{{ .State.Running }}' aaf_locate) ] && \
167 [ $(docker inspect --format '{{ .State.Running }}' aaf_service) ]
168 then
169 echo "aaf Service Running"
170 break
171 else
172 echo sleep $i
173 sleep $i
174 fi
Gary Wu9abb61c2018-09-27 10:38:50 -0700175done
176
177
Gary Wu9abb61c2018-09-27 10:38:50 -0700178
Sai Gandham94df0ae2018-10-09 16:29:54 -0500179AAF_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_service)
180CASSANDRA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_cass)
Gary Wu9abb61c2018-09-27 10:38:50 -0700181
182echo AAF_IP=${AAF_IP}
183echo CASSANDRA_IP=${CASSANDRA_IP}
184
Gary Wu9abb61c2018-09-27 10:38:50 -0700185# Wait for initialization of docker services
186for i in {1..12}; do
Sai Gandham94df0ae2018-10-09 16:29:54 -0500187 curl -k -u aaf_admin@people.osaaf.org:demo123456! https://${AAF_IP}:8100/authz/nss/org.osaaf.people && break
Gary Wu9abb61c2018-09-27 10:38:50 -0700188 echo sleep $i
189 sleep $i
190done
191
192#Pass any variables required by Robot test suites in ROBOT_VARIABLES
Sai Gandham94df0ae2018-10-09 16:29:54 -0500193ROBOT_VARIABLES="-v AAF_IP:${AAF_IP}"