3 # ============LICENSE_START====================================================
5 # ===========================================================================
6 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
7 # ===========================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 # ============LICENSE_END====================================================
23 # Fill out "aaf.props" if not filled out already
24 if [ ! -e aaf.props ]; then
30 DOCKER=${DOCKER:=docker}
31 CADI_VERSION=${CADI_VERSION:=2.1.10-SNAPSHOT}
33 for V in VERSION DOCKER_REPOSITORY HOSTNAME AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LONGITUDE; do
34 if [ "$(grep $V ./aaf.props)" = "" ]; then
42 PROMPT="HOSTNAME (blank for Default)"
45 AAF_FQDN) PROMPT="AAF's FQDN";;
46 DEPLOY_FQI) PROMPT="Deployer's FQI";;
48 # Need AAF_FQDN's IP, because not might not be available in mini-container
50 DEF=$(host $AAF_FQDN | grep "has address" | tail -1 | cut -f 4 -d ' ')
52 APP_FQI) PROMPT="App's FQI";;
53 APP_FQDN) PROMPT="App's Root FQDN";;
54 VOLUME) PROMPT="APP's AAF Configuration Volume";;
55 DRIVER) PROMPT=$V;DEF=local;;
56 VERSION) PROMPT="CADI Version";DEF=$CADI_VERSION;;
57 LATITUDE|LONGITUDE) PROMPT="$V of Node";;
60 if [ "$DEF" = "" ]; then
63 PROMPT="$PROMPT ($DEF): "
66 if [ "$VAR" = "" ]; then
67 if [ "$DEF" = "" ]; then
68 if [ "$V" != "HOSTNAME" ]; then
69 echo "agent.sh needs each value queried. Please start again."
76 echo "$V=$VAR" >> ./aaf.props
81 # Make sure Container Volume exists
82 if [ "$($DOCKER volume ls | grep ${VOLUME})" = "" ]; then
83 echo -n "Creating Volume: "
84 $DOCKER volume create -d ${DRIVER} ${VOLUME}
87 if [ -n "$DOCKER_REPOSITORY" ]; then
88 PREFIX="$DOCKER_REPOSITORY/"
96 -v "${VOLUME}:/opt/app/osaaf" \
97 --add-host="$AAF_FQDN:$AAF_FQDN_IP" \
98 --env AAF_FQDN=${AAF_FQDN} \
99 --env DEPLOY_FQI=${DEPLOY_FQI} \
100 --env DEPLOY_PASSWORD=${DEPLOY_PASSWORD} \
101 --env APP_FQI=${APP_FQI} \
102 --env APP_FQDN=${APP_FQDN} \
103 --env LATITUDE=${LATITUDE} \
104 --env LONGITUDE=${LONGITUDE} \
105 --name aaf_agent_$USER \
106 "$PREFIX"onap/aaf/aaf_agent:$VERSION \