From ce76c7dc637edba5f606c1657b056bb3ef4addd9 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 21 Feb 2019 07:18:51 -0600 Subject: [PATCH] CSIT and non-container Agent Issue-ID: AAF-767 Change-Id: I8bf40dc33bc4b855c556ca5cb264e24917e0d9dd Signed-off-by: Instrumental --- auth/csit/README.txt | 20 ++++++++++------- auth/docker/.gitignore | 3 +++ auth/docker/agent.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 8 deletions(-) diff --git a/auth/csit/README.txt b/auth/csit/README.txt index 7ae99c4d..81e3e4f4 100644 --- a/auth/csit/README.txt +++ b/auth/csit/README.txt @@ -27,14 +27,18 @@ You can emulate the JENKINS build locally cd 2) If not exist, create a "workspace" directory. mkdir -p workspace -3) Create an empty common functions script - > workspace/common_functions.sh -4) cd to the plans - cd csit/plans/aaf/aafapi -5) Run setup with variables set to the Workspace you created -WORKSPACE=/workspace; SCRIPTS=$WORKSPACE; export WORKSPACE SCRIPTS; bash setup.sh +3) cd to workspace +4) export WORKSPACE="${PWD}" +5) Create an empty common functions script + > common_functions.sh +6) cd to the plans + cd ../csit/plans/aaf/aafapi +7) Run setup with variables set to the Workspace you created +SCRIPTS=$WORKSPACE; export WORKSPACE SCRIPTS; bash setup.sh -6) To practice the Shutdown, do: -WORKSPACE=/workspace; SCRIPTS=$WORKSPACE; export WORKSPACE SCRIPTS; bash teardown.sh +8) To practice the Shutdown, do: +SCRIPTS=$WORKSPACE; export WORKSPACE SCRIPTS; bash teardown.sh +OTHER) If nexus isn't working (and you have the latest images to test with), you can + export SKIP_PULL=true diff --git a/auth/docker/.gitignore b/auth/docker/.gitignore index ad950a43..30b97d74 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 7340d30d..7e7d08c0 100644 --- a/auth/docker/agent.sh +++ b/auth/docker/agent.sh @@ -125,6 +125,28 @@ function run_it() { 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 @@ case "$1" in 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 ;; -- 2.16.6