blob: d618f53478f4fe9f29df9ca23b6d136a401fbcdf [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
Instrumental0da89a72019-02-21 07:10:14 -060050echo "Current Dir: ${PWD}"
Sai Gandham94df0ae2018-10-09 16:29:54 -050051
Instrumental550892e2018-11-02 06:23:55 -050052# Locate to Docker dir
53cd auth/docker
Instrumental6f571ca2019-04-22 11:08:30 -050054cp d.props.csit d.props
55
Instrumental0da89a72019-02-21 07:10:14 -060056echo "Current Dir: ${PWD}"
Instrumental550892e2018-11-02 06:23:55 -050057source 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
Instrumental0da89a72019-02-21 07:10:14 -060062$SED "s/^LONGITUDE=.*/LONGITUDE=${LONGITUDE:=-72.0}/" d.props
Instrumental550892e2018-11-02 06:23:55 -050063# For Jenkins, gotta use 10001, not 10003
64DOCKER_REPOSITORY=nexus3.onap.org:10001
65$SED "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$DOCKER_REPOSITORY/" d.props
Sai Gandham94df0ae2018-10-09 16:29:54 -050066
Instrumental550892e2018-11-02 06:23:55 -050067$SED "s/HOSTNAME=.*/HOSTNAME=aaf.api.simpledemo.onap.org/" d.props
68DOCKER_NAME=$(docker info | grep Name | awk '{print $2}' )
69echo "Docker Name is $DOCKER_NAME"
70
Instrumental0da89a72019-02-21 07:10:14 -060071
72#if [ "$DOCKER_NAME" = "minikube" ]; then
73# echo "Minikube IP"
74# HOST_IP=$(minikube ip)
75#else
76# echo "Trying to get IP from Docker $DOCKER_NAME with 'ip route' method"
77# # ip route get 8.8.8.8
78# HOST_IP=$(ip route get 8.8.8.8 | awk '{print $7}')
79# if [ -z "$HOST_IP" ]; then
80# echo "Critical HOST_IP could not be obtained by 2 different methods. Exiting..."
81# exit
82# fi
83# echo
84#fi
85#$SED "s/HOST_IP=.*/HOST_IP=$HOST_IP/" d.props
86
87if [ -z "$SKIP_PULL" ]; then
88 # Pull latest Dockers
89 AAF_DOCKER_VERSION=${VERSION}
90 NEXUS_USERNAME=anonymous
91 NEXUS_PASSWD=anonymous
92 echo "$NEXUS_PASSWD" | docker login -u $NEXUS_USERNAME --password-stdin $DOCKER_REPOSITORY
93
Instrumental95ed65f2019-07-22 18:56:10 -050094 docker pull $DOCKER_REPOSITORY/onap/aaf/aaf-cass:$AAF_DOCKER_VERSION
95 docker pull $DOCKER_REPOSITORY/onap/aaf/aaf-config:$AAF_DOCKER_VERSION
96 docker pull $DOCKER_REPOSITORY/onap/aaf/aaf-cm:$AAF_DOCKER_VERSION
97 docker pull $DOCKER_REPOSITORY/onap/aaf/aaf-fs:$AAF_DOCKER_VERSION
98 docker pull $DOCKER_REPOSITORY/onap/aaf/aaf-gui:$AAF_DOCKER_VERSION
99 docker pull $DOCKER_REPOSITORY/onap/aaf/aaf-hello:$AAF_DOCKER_VERSION
100 docker pull $DOCKER_REPOSITORY/onap/aaf/aaf-locate:$AAF_DOCKER_VERSION
101 docker pull $DOCKER_REPOSITORY/onap/aaf/aaf-oauth:$AAF_DOCKER_VERSION
102 docker pull $DOCKER_REPOSITORY/onap/aaf/aaf-service:$AAF_DOCKER_VERSION
Instrumental550892e2018-11-02 06:23:55 -0500103fi
Instrumental550892e2018-11-02 06:23:55 -0500104# Cassandra Install/Start
105cd ../auth-cass/docker
106echo Cassandra Install
107bash ./dinstall.sh
108cd -
Sai Gandham94df0ae2018-10-09 16:29:54 -0500109
Instrumental550892e2018-11-02 06:23:55 -0500110source d.props
111cat d.props
Sai Gandham60119ea2018-10-24 09:44:43 -0500112
Instrumental550892e2018-11-02 06:23:55 -0500113# AAF Run
Sai Gandham94df0ae2018-10-09 16:29:54 -0500114bash ./drun.sh
115
116docker images
117
118docker ps -a
119
Instrumental0da89a72019-02-21 07:10:14 -0600120for C in aaf-service aaf-locate aaf-oauth aaf-cm aaf-gui aaf-hello aaf-fs; do
Instrumental0e977532018-11-04 18:01:31 -0600121 docker logs $C
122done
Sai Gandham94df0ae2018-10-09 16:29:54 -0500123
Instrumental0da89a72019-02-21 07:10:14 -0600124bash ./aaf.sh wait aaf-service
Sai Gandham94df0ae2018-10-09 16:29:54 -0500125
Instrumental0da89a72019-02-21 07:10:14 -0600126AAF_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf-service)
Gary Wu9abb61c2018-09-27 10:38:50 -0700127echo AAF_IP=${AAF_IP}
Gary Wu9abb61c2018-09-27 10:38:50 -0700128
Instrumental0da89a72019-02-21 07:10:14 -0600129openssl s_client -connect $AAF_IP:8100
130
131export ROBOT_VARIABLES="-v AAF_IP:${AAF_IP}"