CSIT and non-container Agent

Issue-ID: AAF-767
Change-Id: I8bf40dc33bc4b855c556ca5cb264e24917e0d9dd
Signed-off-by: Instrumental <jonathan.gathman@att.com>
diff --git a/auth/docker/.gitignore b/auth/docker/.gitignore
index ad950a4..30b97d7 100644
--- a/auth/docker/.gitignore
+++ b/auth/docker/.gitignore
@@ -9,3 +9,6 @@
 /.curl_auth
 /test.sh
 /*.tgz
+/*.jar
+/*.jks
+/sdnc
diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh
index 7340d30..7e7d08c 100644
--- a/auth/docker/agent.sh
+++ b/auth/docker/agent.sh
@@ -125,6 +125,28 @@
     bash -c "bash /opt/app/aaf_config/bin/agent.sh $PARAMS"
 }
 
+function sso {
+  if [ -n "$2" ]; then
+    echo "$1=$2" >> ~/.aaf/sso.props
+  fi
+}
+
+function reset_sso {
+    mkdir -p ~/.aaf
+    > ~/.aaf/sso.props
+    sso aaf_locate_url "https://$AAF_FQDN:8095"
+    sso cadi_latitude "$LATITUDE"
+    sso cadi_longitude "$LONGITUDE"
+    sso cadi_loglevel "DEBUG"
+    TRUSTSTORE="$(ls truststore*.jks | tail -1)"
+    if [ -z "$TRUSTSTORE" ]; then
+      echo "Place a truststore*.jar which has YOUR CA in it here"
+      exit
+    fi
+    sso cadi_truststore "${PWD}/${TRUSTSTORE}"
+    sso cadi_truststore_password changeit
+}
+
 PARAMS=$@
 case "$1" in 
   bash)
@@ -134,6 +156,42 @@
   taillog)
     run_it -it --rm 
     ;;
+  aafcli) 
+    shift
+    reset_sso
+    if [ -f aaf-auth-cmd-$VERSION*-full.jar ]; then
+      java -Dcadi_prop_files="~\/.aaf\/sso.props" -jar aaf-auth-cmd-$VERSION*-full.jar $@
+    else 
+      echo "For local use, you need to have 'aaf-cadi-aaf-$VERSION*-full.jar' (or newer)"
+    fi
+    ;;
+  local) 
+    shift
+    CMD="$1"
+    if [ -z "$2" ]; then 
+	CMD="$CMD $APP_FQI $APP_FQDN"
+    else 
+      if [ "-" = "$2" ]; then
+         CMD="$CMD $APP_FQI"
+      else
+         CMD="$CMD $2"
+      fi
+      if [ "-" = "$3" ]; then
+         CMD="$CMD $APP_FQDN"
+      else
+         CMD="$CMD $3"
+      fi
+    fi
+    reset_sso
+    sso aaf_id "$DEPLOY_FQI"
+    sso aaf_password "$DEPLOY_PASSWORD"
+    if [ -f aaf-auth-cmd-$VERSION*-full.jar ]; then
+      mkdir -p $APP_FQDN
+      java -Dcadi_prop_files="~\/.aaf\/sso.props" -cp aaf-auth-cmd-$VERSION*-full.jar org.onap.aaf.cadi.configure.Agent $CMD 
+    else 
+      echo "For local use, you need to have 'aaf-cadi-aaf-$VERSION*-full.jar' (or newer)"
+    fi
+    ;;
   *)
     run_it --rm 
     ;;