Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | #!/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 Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 21 | # |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 22 | |
| 23 | echo "AAF setup.sh" |
| 24 | # Starting Directory |
| 25 | CURRENT_DIR=$(pwd) |
| 26 | |
| 27 | if [ "$(uname)" = "Darwin" ]; then |
| 28 | SED="sed -i .bak" |
| 29 | else |
| 30 | SED="sed -i" |
| 31 | fi |
| 32 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 33 | # Place the scripts in run order: |
| 34 | source ${SCRIPTS}/common_functions.sh |
| 35 | |
| 36 | # Clone AAF Authz repo |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 37 | CODE_DIR="$WORKSPACE/archives/opt" |
| 38 | mkdir -p $CODE_DIR |
| 39 | cd $CODE_DIR |
| 40 | |
| 41 | # Get or refresh AAF Code set |
| 42 | if [ -e authz ]; then |
| 43 | cd authz |
| 44 | git pull |
| 45 | else |
| 46 | git clone --depth 1 http://gerrit.onap.org/r/aaf/authz -b master |
| 47 | chmod -R 777 authz |
| 48 | cd authz |
| 49 | fi |
Instrumental | 0da89a7 | 2019-02-21 07:10:14 -0600 | [diff] [blame^] | 50 | echo "Current Dir: ${PWD}" |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 51 | |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 52 | # Locate to Docker dir |
| 53 | cd auth/docker |
| 54 | if [ ! -e d.props ]; then |
| 55 | cp d.props.init d.props |
| 56 | fi |
Instrumental | 0da89a7 | 2019-02-21 07:10:14 -0600 | [diff] [blame^] | 57 | echo "Current Dir: ${PWD}" |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 58 | source d.props |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 59 | |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 60 | # Fill in anything missing |
| 61 | $SED "s/^LATITUDE=.*/LATITUDE=${LATITUDE:=38.0}/" d.props |
| 62 | $SED "s/^LONGITUDE=.*/LONGITUDE=${LONGITUDE:=-72.0}/" d.props |
Instrumental | 0da89a7 | 2019-02-21 07:10:14 -0600 | [diff] [blame^] | 63 | $SED "s/^LONGITUDE=.*/LONGITUDE=${LONGITUDE:=-72.0}/" d.props |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 64 | # For Jenkins, gotta use 10001, not 10003 |
| 65 | DOCKER_REPOSITORY=nexus3.onap.org:10001 |
| 66 | $SED "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$DOCKER_REPOSITORY/" d.props |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 67 | |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 68 | $SED "s/HOSTNAME=.*/HOSTNAME=aaf.api.simpledemo.onap.org/" d.props |
| 69 | DOCKER_NAME=$(docker info | grep Name | awk '{print $2}' ) |
| 70 | echo "Docker Name is $DOCKER_NAME" |
| 71 | |
Instrumental | 0da89a7 | 2019-02-21 07:10:14 -0600 | [diff] [blame^] | 72 | |
| 73 | #if [ "$DOCKER_NAME" = "minikube" ]; then |
| 74 | # echo "Minikube IP" |
| 75 | # HOST_IP=$(minikube ip) |
| 76 | #else |
| 77 | # echo "Trying to get IP from Docker $DOCKER_NAME with 'ip route' method" |
| 78 | # # ip route get 8.8.8.8 |
| 79 | # HOST_IP=$(ip route get 8.8.8.8 | awk '{print $7}') |
| 80 | # if [ -z "$HOST_IP" ]; then |
| 81 | # echo "Critical HOST_IP could not be obtained by 2 different methods. Exiting..." |
| 82 | # exit |
| 83 | # fi |
| 84 | # echo |
| 85 | #fi |
| 86 | #$SED "s/HOST_IP=.*/HOST_IP=$HOST_IP/" d.props |
| 87 | |
| 88 | if [ -z "$SKIP_PULL" ]; then |
| 89 | # Pull latest Dockers |
| 90 | AAF_DOCKER_VERSION=${VERSION} |
| 91 | NEXUS_USERNAME=anonymous |
| 92 | NEXUS_PASSWD=anonymous |
| 93 | echo "$NEXUS_PASSWD" | docker login -u $NEXUS_USERNAME --password-stdin $DOCKER_REPOSITORY |
| 94 | |
| 95 | docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION |
| 96 | docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_config:$AAF_DOCKER_VERSION |
| 97 | docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_cm:$AAF_DOCKER_VERSION |
| 98 | docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_fs:$AAF_DOCKER_VERSION |
| 99 | docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_gui:$AAF_DOCKER_VERSION |
| 100 | docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_hello:$AAF_DOCKER_VERSION |
| 101 | docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_locate:$AAF_DOCKER_VERSION |
| 102 | docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_oauth:$AAF_DOCKER_VERSION |
| 103 | docker pull $DOCKER_REPOSITORY/onap/aaf/aaf_service:$AAF_DOCKER_VERSION |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 104 | fi |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 105 | # Cassandra Install/Start |
| 106 | cd ../auth-cass/docker |
| 107 | echo Cassandra Install |
| 108 | bash ./dinstall.sh |
| 109 | cd - |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 110 | |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 111 | source d.props |
| 112 | cat d.props |
Sai Gandham | 60119ea | 2018-10-24 09:44:43 -0500 | [diff] [blame] | 113 | |
Instrumental | 550892e | 2018-11-02 06:23:55 -0500 | [diff] [blame] | 114 | # AAF Run |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 115 | bash ./drun.sh |
| 116 | |
| 117 | docker images |
| 118 | |
| 119 | docker ps -a |
| 120 | |
Instrumental | 0da89a7 | 2019-02-21 07:10:14 -0600 | [diff] [blame^] | 121 | for C in aaf-service aaf-locate aaf-oauth aaf-cm aaf-gui aaf-hello aaf-fs; do |
Instrumental | 0e97753 | 2018-11-04 18:01:31 -0600 | [diff] [blame] | 122 | docker logs $C |
| 123 | done |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 124 | |
Instrumental | 0da89a7 | 2019-02-21 07:10:14 -0600 | [diff] [blame^] | 125 | bash ./aaf.sh wait aaf-service |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 126 | |
Instrumental | 0da89a7 | 2019-02-21 07:10:14 -0600 | [diff] [blame^] | 127 | AAF_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf-service) |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 128 | echo AAF_IP=${AAF_IP} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 129 | |
Instrumental | 0da89a7 | 2019-02-21 07:10:14 -0600 | [diff] [blame^] | 130 | openssl s_client -connect $AAF_IP:8100 |
| 131 | |
| 132 | export ROBOT_VARIABLES="-v AAF_IP:${AAF_IP}" |