summaryrefslogtreecommitdiffstats
path: root/auth/auth-cass/cass_init
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-11-21 16:06:17 -0600
committerInstrumental <jonathan.gathman@att.com>2018-11-21 16:06:24 -0600
commitf95fc5f7ae9cf1832eae2451be883477bbd08f16 (patch)
tree75beb85f559840a2019ce81257f4b9dc49d1e0ca /auth/auth-cass/cass_init
parente92832a4f8dbcc18dff57ff09232c5b75687742e (diff)
Batch upgrades for ONAP
Issue-ID: AAF-641 Change-Id: I7b5e8b97d8c6c484418c995b6e51507af78fc765 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-cass/cass_init')
-rw-r--r--auth/auth-cass/cass_init/authBatch.props26
-rw-r--r--auth/auth-cass/cass_init/restore.sh52
2 files changed, 78 insertions, 0 deletions
diff --git a/auth/auth-cass/cass_init/authBatch.props b/auth/auth-cass/cass_init/authBatch.props
new file mode 100644
index 00000000..90de4195
--- /dev/null
+++ b/auth/auth-cass/cass_init/authBatch.props
@@ -0,0 +1,26 @@
+aaf_data_dir=/opt/app/aaf/data
+aaf_root_ns=org.osaaf.aaf
+cadi_latitude=38.0
+cadi_longitude=-72.0
+
+## Supported Plugin Organizational Units
+Organization.att.com=org.onap.aaf.org.DefaultOrg
+
+DRY_RUN=false
+CASS_ENV=DOCKER
+
+UNKNOWN.LOG_DIR=logs/DOCKER
+
+## Cassandra Configurations, when commented out, uses LocalHost (non authenticated) and default ports
+DOCKER.cassandra.clusters=127.0.0.1
+DOCKER.cassandra.clusters.port=9042
+DOCKER.cassandra.clusters.user=cassandra
+DOCKER.cassandra.clusters.password=cassandra
+DOCKER.VERSION=3.1.0
+DOCKER.GUI_URL=https://mithrilcsp.sbc.com:8095/gui
+DOCKER.punt=1
+DOCKER.
+DOCKER.MAX_EMAILS=3
+DOCKER.SPECIAL_NAMES=aaf@aaf.osaaf.org
+
+cadi_loglevel=AUDIT
diff --git a/auth/auth-cass/cass_init/restore.sh b/auth/auth-cass/cass_init/restore.sh
new file mode 100644
index 00000000..768cf4c7
--- /dev/null
+++ b/auth/auth-cass/cass_init/restore.sh
@@ -0,0 +1,52 @@
+# echo -n "Password:"
+# read -s PWD
+# echo
+echo `date`
+ENV=DOCKER
+
+CQLSH="/usr/bin/cqlsh -k authz"
+
+cd dats
+if [ "$*" = "" ]; then
+ DATA=""
+ for Tdat in `ls *.dat`; do
+ if [ -s "${Tdat}" ]; then
+ DATA="$DATA ${Tdat%.dat}"
+ fi
+ done
+else
+ DATA="$*"
+fi
+cd -
+
+echo "You are about to REPLACE the data in the $ENV DB for the following tables:"
+echo "$DATA"
+echo -n 'If you are VERY sure, type "YES": '
+read YES
+
+if [ ! "$YES" = "YES" ]; then
+ echo 'Exiting ...'
+ exit
+fi
+
+UPLOAD=""
+for T in $DATA; do
+ if [ -s "dats/${T}.dat" ]; then
+ echo $T
+ case "$T" in
+ # 2.1.14 still has NULL problems for COPY. Fixed in 2.1.15+
+ "approval"|"artifact"|"cred"|"ns"|"x509"|"role")
+ $CQLSH -e "truncate $T"
+ UPLOAD="$UPLOAD dats/"$T
+ ;;
+ *)
+ $CQLSH -e "truncate $T; COPY authz.${T} FROM 'dats/${T}.dat' WITH DELIMITER='|'"
+ ;;
+ esac
+ fi
+done
+
+if [ ! "$UPLOAD" = "" ]; then
+ java -DCASS_ENV=$ENV -jar aaf-auth-batch-*-full.jar Upload $UPLOAD
+fi
+echo `date`