blob: 114cd7aab0b76f180589723ca9577e7a2e4cc5e2 [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============================================
Gary Wu9abb61c2018-09-27 10:38:50 -070021#
Instrumental550892e2018-11-02 06:23:55 -050022
23echo "AAF setup.sh"
24# Starting Directory
25CURRENT_DIR=$(pwd)
26
27if [ "$(uname)" = "Darwin" ]; then
28 SED="sed -i .bak"
29else
30 SED="sed -i"
31fi
32
Gary Wu9abb61c2018-09-27 10:38:50 -070033# Place the scripts in run order:
34source ${SCRIPTS}/common_functions.sh
35
36# Clone AAF Authz repo
Instrumental550892e2018-11-02 06:23:55 -050037CODE_DIR="$WORKSPACE/archives/opt"
38mkdir -p $CODE_DIR
39cd $CODE_DIR
40
41# Get or refresh AAF Code set
42if [ -e authz ]; then
43 cd authz
44 git pull
45else
46 git clone --depth 1 http://gerrit.onap.org/r/aaf/authz -b master
47 chmod -R 777 authz
48 cd authz
49fi
Sai Gandham94df0ae2018-10-09 16:29:54 -050050
51
Instrumental550892e2018-11-02 06:23:55 -050052# Locate to Docker dir
53cd auth/docker
54if [ ! -e d.props ]; then
55 cp d.props.init d.props
56fi
57source d.props
Sai Gandham94df0ae2018-10-09 16:29:54 -050058
Instrumental550892e2018-11-02 06:23:55 -050059# Fill in anything missing
60$SED "s/^LATITUDE=.*/LATITUDE=${LATITUDE:=38.0}/" d.props
61$SED "s/^LONGITUDE=.*/LONGITUDE=${LONGITUDE:=-72.0}/" d.props
62# For Jenkins, gotta use 10001, not 10003
63DOCKER_REPOSITORY=nexus3.onap.org:10001
64$SED "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$DOCKER_REPOSITORY/" d.props
Sai Gandham94df0ae2018-10-09 16:29:54 -050065
Instrumental550892e2018-11-02 06:23:55 -050066$SED "s/HOSTNAME=.*/HOSTNAME=aaf.api.simpledemo.onap.org/" d.props
67DOCKER_NAME=$(docker info | grep Name | awk '{print $2}' )
68echo "Docker Name is $DOCKER_NAME"
69
70if [ "$DOCKER_NAME" = "minikube" ]; then
71 echo "Minikube IP"
72 HOST_IP=$(minikube ip)
73else
74 echo "Trying to get IP from Docker $DOCKER_NAME with 'ip route' method"
75 # ip route get 8.8.8.8
76 HOST_IP=$(ip route get 8.8.8.8 | awk '{print $7}')
77 if [ -z "$HOST_IP" ]; then
78 echo "Critical HOST_IP could not be obtained by 2 different methods. Exiting..."
79 exit
80 fi
81 echo
82fi
83$SED "s/HOST_IP=.*/HOST_IP=$HOST_IP/" d.props
84
85cat d.props
86
87# Pull latest Dockers
88AAF_DOCKER_VERSION=${VERSION}
Sai Gandham94df0ae2018-10-09 16:29:54 -050089NEXUS_USERNAME=anonymous
90NEXUS_PASSWD=anonymous
Instrumental550892e2018-11-02 06:23:55 -050091echo "$NEXUS_PASSWD" | docker login -u $NEXUS_USERNAME --password-stdin $DOCKER_REPOSITORY
Sai Gandham94df0ae2018-10-09 16:29:54 -050092
Instrumental550892e2018-11-02 06:23:55 -050093docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION
94docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_config:$AAF_DOCKER_VERSION
95docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_cm:$AAF_DOCKER_VERSION
96docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_fs:$AAF_DOCKER_VERSION
97docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_gui:$AAF_DOCKER_VERSION
98docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_hello:$AAF_DOCKER_VERSION
99docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_locate:$AAF_DOCKER_VERSION
100docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_oauth:$AAF_DOCKER_VERSION
101docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_service:$AAF_DOCKER_VERSION
Sai Gandham94df0ae2018-10-09 16:29:54 -0500102
Instrumental550892e2018-11-02 06:23:55 -0500103# Cassandra Install/Start
104cd ../auth-cass/docker
105echo Cassandra Install
106bash ./dinstall.sh
107cd -
Sai Gandham94df0ae2018-10-09 16:29:54 -0500108
Instrumental550892e2018-11-02 06:23:55 -0500109source d.props
110cat d.props
Sai Gandham60119ea2018-10-24 09:44:43 -0500111
Instrumental550892e2018-11-02 06:23:55 -0500112# AAF Run
Sai Gandham94df0ae2018-10-09 16:29:54 -0500113bash ./drun.sh
114
115docker images
116
117docker ps -a
118
Sai Gandham94df0ae2018-10-09 16:29:54 -0500119docker logs aaf_hello
120
121docker logs aaf_locate
122
123docker logs aaf_cm
124
125docker logs aaf_gui
126
127docker logs aaf_fs
128
129docker logs aaf_oauth
130
131docker logs aaf_service
132
Sai Gandham94df0ae2018-10-09 16:29:54 -0500133AAF_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_service)
Gary Wu9abb61c2018-09-27 10:38:50 -0700134echo AAF_IP=${AAF_IP}
Gary Wu9abb61c2018-09-27 10:38:50 -0700135
136#Pass any variables required by Robot test suites in ROBOT_VARIABLES
Instrumental550892e2018-11-02 06:23:55 -0500137ROBOT_VARIABLES="-v AAF_IP:${AAF_IP}"