blob: 67cdda3ac56a7ffcd7567763dd24d20c466d7751 [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
Sai Gandham60119ea2018-10-24 09:44:43 -050040AAF_DOCKER_VERSION=2.1.5
Sai Gandham94df0ae2018-10-09 16:29:54 -050041
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
Sai Gandham60119ea2018-10-24 09:44:43 -050055docker tag $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION nexus3.onap.org:10003/onap/aaf/aaf_cass:2.1.6-SNAPSHOT
56docker tag $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:2.1.6-SNAPSHOT
Sai Gandham6b94dbd2018-11-01 11:28:24 -050057docker tag $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION nexus3.onap.org:10003/onap/aaf/aaf_cass:2.1.7-SNAPSHOT
58docker tag $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:2.1.7-SNAPSHOT
59docker tag $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION nexus3.onap.org:10003/onap/aaf/aaf_cass:2.1.8-SNAPSHOT
60docker tag $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:2.1.8-SNAPSHOT
Sai Gandham60119ea2018-10-24 09:44:43 -050061
Gary Wu9abb61c2018-09-27 10:38:50 -070062git clone --depth 1 http://gerrit.onap.org/r/aaf/authz -b master
63git pull
Sai Gandham94df0ae2018-10-09 16:29:54 -050064chmod -R 777 authz
65cd authz
66CURRENT_DIR=$(pwd)
67
Gary Wu9abb61c2018-09-27 10:38:50 -070068pwd
Sai Gandham94df0ae2018-10-09 16:29:54 -050069
70if [ ! -e auth/csit/d.props ]; then
71 cp auth/csit/d.props.init auth/csit/d.props
72fi
73
74if [ ! -e auth/docker/d.props ]; then
75 cp auth/docker/d.props.init auth/docker/d.props
76fi
Gary Wu9abb61c2018-09-27 10:38:50 -070077
Sai Gandham94df0ae2018-10-09 16:29:54 -050078NEXUS_USERNAME=anonymous
79NEXUS_PASSWD=anonymous
80NEXUS_DOCKER_REPO=nexus3.onap.org:10001
81sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$NEXUS_DOCKER_REPO/" auth/csit/d.props
82. auth/csit/d.props
Gary Wu9abb61c2018-09-27 10:38:50 -070083
Sai Gandham94df0ae2018-10-09 16:29:54 -050084
85
86HOSTNAME=`hostname`
87FQDN=aaf.api.simpledemo.onap.org
88HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
89export HOST_IP=${HOST_IP}
90
91
92CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4`
93CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP
94
95cd auth/auth-cass/docker
96if [ "`docker container ls | grep aaf_cass`" = "" ]; then
97 # Cassandra Install
98 echo Cassandra Install
99 bash ./dinstall.sh
100fi
101
102CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4`
103CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP
104if [ ! -e $WORKSPACE/archives/opt/authz/auth/csit/cass.props ]; then
105 cp $WORKSPACE/archives/opt/authz/auth/csit/cass.props.init $WORKSPACE/archives/opt/authz/auth/csit/cass.props
106fi
107
108sed -i "s/CASS_HOST=.*/CASS_HOST="$CASS_HOST"/g" $WORKSPACE/archives/opt/authz/auth/csit/cass.props
109
Sai Gandham94df0ae2018-10-09 16:29:54 -0500110
Sai Gandham94df0ae2018-10-09 16:29:54 -0500111# TODO Pull from Config Dir
112if [ "$LATITUDE" = "" ]; then
113 LATITUDE=37.781
114 LONGITUDE=-122.261
115 sed -i "s/LATITUDE=.*/LATITUDE=$LATITUDE/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
116 sed -i "s/LONGITUDE=.*/LONGITUDE=$LONGITUDE/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
117fi
118
119sed -i "s/VERSION=.*/VERSION=$VERSION/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
120sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
121sed -i "s/HOST_IP=.*/HOST_IP=$HOST_IP/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
122sed -i "s/AAF_REGISTER_AS=.*/AAF_REGISTER_AS=$FQDN/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
123
124pwd
125
126cd ../../
127
128pwd
129
130cd csit
131tty
132# Need new Deployment system properties
133bash ./aaf.sh
134
135# run it
136bash ./drun.sh
137
138docker images
139
140docker ps -a
141
142cat /etc/sudoers
143
144docker logs aaf_hello
145
146docker logs aaf_locate
147
148docker logs aaf_cm
149
150docker logs aaf_gui
151
152docker logs aaf_fs
153
154docker logs aaf_oauth
155
156docker logs aaf_service
157
158# Wait for initialization of Docker containers
159for i in {1..50}; do
160 if [ $(docker inspect --format '{{ .State.Running }}' aaf_hello) ] && \
161 [ $(docker inspect --format '{{ .State.Running }}' aaf_cm) ] && \
162 [ $(docker inspect --format '{{ .State.Running }}' aaf_fs) ] && \
163 [ $(docker inspect --format '{{ .State.Running }}' aaf_gui) ] && \
164 [ $(docker inspect --format '{{ .State.Running }}' aaf_oauth) ] && \
165 [ $(docker inspect --format '{{ .State.Running }}' aaf_locate) ] && \
166 [ $(docker inspect --format '{{ .State.Running }}' aaf_service) ]
167 then
168 echo "aaf Service Running"
169 break
170 else
171 echo sleep $i
172 sleep $i
173 fi
Gary Wu9abb61c2018-09-27 10:38:50 -0700174done
175
176
Gary Wu9abb61c2018-09-27 10:38:50 -0700177
Sai Gandham94df0ae2018-10-09 16:29:54 -0500178AAF_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_service)
179CASSANDRA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_cass)
Gary Wu9abb61c2018-09-27 10:38:50 -0700180
181echo AAF_IP=${AAF_IP}
182echo CASSANDRA_IP=${CASSANDRA_IP}
183
Gary Wu9abb61c2018-09-27 10:38:50 -0700184# Wait for initialization of docker services
185for i in {1..12}; do
Sai Gandham94df0ae2018-10-09 16:29:54 -0500186 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 -0700187 echo sleep $i
188 sleep $i
189done
190
191#Pass any variables required by Robot test suites in ROBOT_VARIABLES
Sai Gandham94df0ae2018-10-09 16:29:54 -0500192ROBOT_VARIABLES="-v AAF_IP:${AAF_IP}"