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============================================ |
| 21 | # =================================================================== |
| 22 | # ECOMP is a trademark and service mark of AT&T Intellectual Property. |
| 23 | # |
| 24 | # Place the scripts in run order: |
| 25 | source ${SCRIPTS}/common_functions.sh |
| 26 | |
| 27 | # Clone AAF Authz repo |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 28 | mkdir -p $WORKSPACE/archives/opt |
| 29 | cd $WORKSPACE/archives/opt |
| 30 | |
| 31 | |
| 32 | HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') |
| 33 | export HOST_IP=${HOST_IP} |
| 34 | |
| 35 | CURRENT_DIR=$(pwd) export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) |
| 36 | |
| 37 | NEXUS_USERNAME=anonymous |
| 38 | NEXUS_PASSWD=anonymous |
| 39 | NEXUS_DOCKER_REPO=nexus3.onap.org:10001 |
Sai Gandham | 60119ea | 2018-10-24 09:44:43 -0500 | [diff] [blame] | 40 | AAF_DOCKER_VERSION=2.1.5 |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 41 | |
| 42 | docker login -u $NEXUS_USERNAME -p "$NEXUS_PASSWD" $NEXUS_DOCKER_REPO |
| 43 | |
| 44 | docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION |
| 45 | docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_config:$AAF_DOCKER_VERSION |
| 46 | docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_cm:$AAF_DOCKER_VERSION |
| 47 | docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_fs:$AAF_DOCKER_VERSION |
| 48 | docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_gui:$AAF_DOCKER_VERSION |
| 49 | docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_hello:$AAF_DOCKER_VERSION |
| 50 | docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_locate:$AAF_DOCKER_VERSION |
| 51 | docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_oauth:$AAF_DOCKER_VERSION |
| 52 | docker pull $NEXUS_DOCKER_REPO/onap/aaf/aaf_service:$AAF_DOCKER_VERSION |
| 53 | |
| 54 | docker tag $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION nexus3.onap.org:10003/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION |
Sai Gandham | 60119ea | 2018-10-24 09:44:43 -0500 | [diff] [blame] | 55 | docker tag $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION nexus3.onap.org:10003/onap/aaf/aaf_cass:2.1.6-SNAPSHOT |
| 56 | docker tag $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:$AAF_DOCKER_VERSION $NEXUS_DOCKER_REPO/onap/aaf/aaf_cass:2.1.6-SNAPSHOT |
| 57 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 58 | git clone --depth 1 http://gerrit.onap.org/r/aaf/authz -b master |
| 59 | git pull |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 60 | chmod -R 777 authz |
| 61 | cd authz |
| 62 | CURRENT_DIR=$(pwd) |
| 63 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 64 | pwd |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 65 | |
| 66 | if [ ! -e auth/csit/d.props ]; then |
| 67 | cp auth/csit/d.props.init auth/csit/d.props |
| 68 | fi |
| 69 | |
| 70 | if [ ! -e auth/docker/d.props ]; then |
| 71 | cp auth/docker/d.props.init auth/docker/d.props |
| 72 | fi |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 73 | |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 74 | NEXUS_USERNAME=anonymous |
| 75 | NEXUS_PASSWD=anonymous |
| 76 | NEXUS_DOCKER_REPO=nexus3.onap.org:10001 |
| 77 | sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$NEXUS_DOCKER_REPO/" auth/csit/d.props |
| 78 | . auth/csit/d.props |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 79 | |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 80 | |
| 81 | |
| 82 | HOSTNAME=`hostname` |
| 83 | FQDN=aaf.api.simpledemo.onap.org |
| 84 | HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') |
| 85 | export HOST_IP=${HOST_IP} |
| 86 | |
| 87 | |
| 88 | CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4` |
| 89 | CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP |
| 90 | |
| 91 | cd auth/auth-cass/docker |
| 92 | if [ "`docker container ls | grep aaf_cass`" = "" ]; then |
| 93 | # Cassandra Install |
| 94 | echo Cassandra Install |
| 95 | bash ./dinstall.sh |
| 96 | fi |
| 97 | |
| 98 | CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4` |
| 99 | CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP |
| 100 | if [ ! -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 |
| 102 | fi |
| 103 | |
| 104 | sed -i "s/CASS_HOST=.*/CASS_HOST="$CASS_HOST"/g" $WORKSPACE/archives/opt/authz/auth/csit/cass.props |
| 105 | |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 106 | |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 107 | # TODO Pull from Config Dir |
| 108 | if [ "$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 |
| 113 | fi |
| 114 | |
| 115 | sed -i "s/VERSION=.*/VERSION=$VERSION/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props |
| 116 | sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props |
| 117 | sed -i "s/HOST_IP=.*/HOST_IP=$HOST_IP/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props |
| 118 | sed -i "s/AAF_REGISTER_AS=.*/AAF_REGISTER_AS=$FQDN/g" $WORKSPACE/archives/opt/authz/auth/csit/d.props |
| 119 | |
| 120 | pwd |
| 121 | |
| 122 | cd ../../ |
| 123 | |
| 124 | pwd |
| 125 | |
| 126 | cd csit |
| 127 | tty |
| 128 | # Need new Deployment system properties |
| 129 | bash ./aaf.sh |
| 130 | |
| 131 | # run it |
| 132 | bash ./drun.sh |
| 133 | |
| 134 | docker images |
| 135 | |
| 136 | docker ps -a |
| 137 | |
| 138 | cat /etc/sudoers |
| 139 | |
| 140 | docker logs aaf_hello |
| 141 | |
| 142 | docker logs aaf_locate |
| 143 | |
| 144 | docker logs aaf_cm |
| 145 | |
| 146 | docker logs aaf_gui |
| 147 | |
| 148 | docker logs aaf_fs |
| 149 | |
| 150 | docker logs aaf_oauth |
| 151 | |
| 152 | docker logs aaf_service |
| 153 | |
| 154 | # Wait for initialization of Docker containers |
| 155 | for 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 Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 170 | done |
| 171 | |
| 172 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 173 | |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 174 | AAF_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_service) |
| 175 | CASSANDRA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_cass) |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 176 | |
| 177 | echo AAF_IP=${AAF_IP} |
| 178 | echo CASSANDRA_IP=${CASSANDRA_IP} |
| 179 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 180 | # Wait for initialization of docker services |
| 181 | for i in {1..12}; do |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 182 | curl -k -u aaf_admin@people.osaaf.org:demo123456! https://${AAF_IP}:8100/authz/nss/org.osaaf.people && break |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 183 | echo sleep $i |
| 184 | sleep $i |
| 185 | done |
| 186 | |
| 187 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
Sai Gandham | 94df0ae | 2018-10-09 16:29:54 -0500 | [diff] [blame] | 188 | ROBOT_VARIABLES="-v AAF_IP:${AAF_IP}" |