summaryrefslogtreecommitdiffstats
path: root/auth/csit/agent.sh
diff options
context:
space:
mode:
authorSai Gandham <sg481n@att.com>2018-10-10 04:31:59 -0500
committerSai Gandham <sg481n@att.com>2018-10-10 04:48:20 -0500
commit67a6d89b907a97a72cffe53daaac2f9ae2784852 (patch)
treed328acedb85cf8d9c50b159b3c3b2dad45acbbed /auth/csit/agent.sh
parente90fc5fc147df5a7d76cfb5bbc41aabe0d066ccc (diff)
add docker scripts for CSIT
Moving csit from docker folder Issue-ID: AAF-388 Change-Id: I7efb8e7fec54ef54d3d2704ca53f1b80b0b3fea2 Signed-off-by: Sai Gandham <sg481n@att.com>
Diffstat (limited to 'auth/csit/agent.sh')
-rw-r--r--auth/csit/agent.sh82
1 files changed, 82 insertions, 0 deletions
diff --git a/auth/csit/agent.sh b/auth/csit/agent.sh
new file mode 100644
index 00000000..af04cf29
--- /dev/null
+++ b/auth/csit/agent.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+
+# Fill out "aaf.props" if not filled out already
+if [ ! -e aaf.props ]; then
+ > ./aaf.props
+fi
+
+. ./aaf.props
+
+DOCKER=${DOCKER:=docker}
+CADI_VERSION=${CADI_VERSION:=2.1.2-SNAPSHOT}
+
+for V in VERSION DOCKER_REPOSITORY AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LONGITUDE; do
+ if [ "$(grep $V ./aaf.props)" = "" ]; then
+ unset DEF
+ case $V in
+ DOCKER_REPOSITORY)
+ PROMPT="Docker Repo"
+ DEF=""
+ ;;
+ AAF_FQDN) PROMPT="AAF's FQDN";;
+ DEPLOY_FQI) PROMPT="Deployer's FQI";;
+ AAF_FQDN_IP)
+ # Need AAF_FQDN's IP, because not might not be available in mini-container
+ PROMPT="AAF FQDN IP"
+ DEF=$(host $AAF_FQDN | grep "has address" | tail -1 | cut -f 4 -d ' ')
+ ;;
+ APP_FQI) PROMPT="App's FQI";;
+ APP_FQDN) PROMPT="App's Root FQDN";;
+ VOLUME) PROMPT="APP's AAF Configuration Volume";;
+ DRIVER) PROMPT=$V;DEF=local;;
+ VERSION) PROMPT="CADI Version";DEF=$CADI_VERSION;;
+ LATITUDE|LONGITUDE) PROMPT="$V of Node";;
+ *) PROMPT=$V;;
+ esac
+ if [ "$DEF" = "" ]; then
+ PROMPT="$PROMPT: "
+ else
+ PROMPT="$PROMPT ($DEF): "
+ fi
+ read -p "$PROMPT" VAR
+ if [ "$VAR" = "" ]; then
+ if [ "$DEF" = "" ]; then
+ echo "agent.sh needs each value queried. Please start again."
+ exit
+ else
+ VAR=$DEF
+ fi
+ fi
+ echo "$V=$VAR" >> ./aaf.props
+ fi
+done
+. ./aaf.props
+
+# Make sure Container Volume exists
+if [ "$($DOCKER volume ls | grep ${VOLUME})" = "" ]; then
+ echo -n "Creating Volume: "
+ $DOCKER volume create -d ${DRIVER} ${VOLUME}
+fi
+
+if [ -n "$DOCKER_REPOSITORY" ]; then
+ PREFIX="$DOCKER_REPOSITORY/"
+else
+ PREFIX=""
+fi
+
+$DOCKER run \
+ -it \
+ --rm \
+ -v "${VOLUME}:/opt/app/osaaf" \
+ --add-host="$AAF_FQDN:$AAF_FQDN_IP" \
+ --env AAF_FQDN=${AAF_FQDN} \
+ --env DEPLOY_FQI=${DEPLOY_FQI} \
+ --env DEPLOY_PASSWORD=${DEPLOY_PASSWORD} \
+ --env APP_FQI=${APP_FQI} \
+ --env APP_FQDN=${APP_FQDN} \
+ --env LATITUDE=${LATITUDE} \
+ --env LONGITUDE=${LONGITUDE} \
+ --name aaf_agent_$USER \
+ "$PREFIX"onap/aaf/aaf_agent:$VERSION \
+ /bin/bash "$@"