blob: 33c524dac8a2bfddafe8572ee09776800f1e1b70 [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
57
Gary Wu9abb61c2018-09-27 10:38:50 -070058git clone --depth 1 http://gerrit.onap.org/r/aaf/authz -b master
59git pull
Sai Gandham94df0ae2018-10-09 16:29:54 -050060chmod -R 777 authz
61cd authz
62CURRENT_DIR=$(pwd)
63
Gary Wu9abb61c2018-09-27 10:38:50 -070064pwd
Sai Gandham94df0ae2018-10-09 16:29:54 -050065
66if [ ! -e auth/csit/d.props ]; then
67 cp auth/csit/d.props.init auth/csit/d.props
68fi
69
70if [ ! -e auth/docker/d.props ]; then
71 cp auth/docker/d.props.init auth/docker/d.props
72fi
Gary Wu9abb61c2018-09-27 10:38:50 -070073
Sai Gandham94df0ae2018-10-09 16:29:54 -050074NEXUS_USERNAME=anonymous
75NEXUS_PASSWD=anonymous
76NEXUS_DOCKER_REPO=nexus3.onap.org:10001
77sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$NEXUS_DOCKER_REPO/" auth/csit/d.props
78. auth/csit/d.props
Gary Wu9abb61c2018-09-27 10:38:50 -070079
Sai Gandham94df0ae2018-10-09 16:29:54 -050080
81
82HOSTNAME=`hostname`
83FQDN=aaf.api.simpledemo.onap.org
84HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
85export HOST_IP=${HOST_IP}
86
87
88CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4`
89CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP
90
91cd auth/auth-cass/docker
92if [ "`docker container ls | grep aaf_cass`" = "" ]; then
93 # Cassandra Install
94 echo Cassandra Install
95 bash ./dinstall.sh
96fi
97
98CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4`
99CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP
100if [ ! -e $WORKSPACE/archives/opt/authz/auth/csit/cass.props ]; then
101 cp $WORKSPACE/archives/opt/authz/auth/csit/cass.props.init $WORKSPACE/archives/opt/authz/auth/csit/cass.props
102fi
103
104sed -i "s/CASS_HOST=.*/CASS_HOST="$CASS_HOST"/g" $WORKSPACE/archives/opt/authz/auth/csit/cass.props
105
Sai Gandham94df0ae2018-10-09 16:29:54 -0500106
Sai Gandham94df0ae2018-10-09 16:29:54 -0500107# TODO Pull from Config Dir
108if [ "$LATITUDE" = "" ]; then
109 LATITUDE=37.781
110 LONGITUDE=-122.261
111 sed -i "s/LATITUDE=.*/LATITUDE=$LATITUDE/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
112 sed -i "s/LONGITUDE=.*/LONGITUDE=$LONGITUDE/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
113fi
114
115sed -i "s/VERSION=.*/VERSION=$VERSION/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
116sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
117sed -i "s/HOST_IP=.*/HOST_IP=$HOST_IP/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
118sed -i "s/AAF_REGISTER_AS=.*/AAF_REGISTER_AS=$FQDN/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props
119
120pwd
121
122cd ../../
123
124pwd
125
126cd csit
127tty
128# Need new Deployment system properties
129bash ./aaf.sh
130
131# run it
132bash ./drun.sh
133
134docker images
135
136docker ps -a
137
138cat /etc/sudoers
139
140docker logs aaf_hello
141
142docker logs aaf_locate
143
144docker logs aaf_cm
145
146docker logs aaf_gui
147
148docker logs aaf_fs
149
150docker logs aaf_oauth
151
152docker logs aaf_service
153
154# Wait for initialization of Docker containers
155for i in {1..50}; do
156 if [ $(docker inspect --format '{{ .State.Running }}' aaf_hello) ] && \
157 [ $(docker inspect --format '{{ .State.Running }}' aaf_cm) ] && \
158 [ $(docker inspect --format '{{ .State.Running }}' aaf_fs) ] && \
159 [ $(docker inspect --format '{{ .State.Running }}' aaf_gui) ] && \
160 [ $(docker inspect --format '{{ .State.Running }}' aaf_oauth) ] && \
161 [ $(docker inspect --format '{{ .State.Running }}' aaf_locate) ] && \
162 [ $(docker inspect --format '{{ .State.Running }}' aaf_service) ]
163 then
164 echo "aaf Service Running"
165 break
166 else
167 echo sleep $i
168 sleep $i
169 fi
Gary Wu9abb61c2018-09-27 10:38:50 -0700170done
171
172
Gary Wu9abb61c2018-09-27 10:38:50 -0700173
Sai Gandham94df0ae2018-10-09 16:29:54 -0500174AAF_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_service)
175CASSANDRA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_cass)
Gary Wu9abb61c2018-09-27 10:38:50 -0700176
177echo AAF_IP=${AAF_IP}
178echo CASSANDRA_IP=${CASSANDRA_IP}
179
Gary Wu9abb61c2018-09-27 10:38:50 -0700180# Wait for initialization of docker services
181for i in {1..12}; do
Sai Gandham94df0ae2018-10-09 16:29:54 -0500182 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 -0700183 echo sleep $i
184 sleep $i
185done
186
187#Pass any variables required by Robot test suites in ROBOT_VARIABLES
Sai Gandham94df0ae2018-10-09 16:29:54 -0500188ROBOT_VARIABLES="-v AAF_IP:${AAF_IP}"