summaryrefslogtreecommitdiffstats
path: root/heat/ONAP/cloud-config/aaf_vm_init.sh
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-08-03 07:56:14 -0700
committerGary Wu <gary.i.wu@huawei.com>2018-08-06 08:20:47 -0700
commitb9a2a29a9e1e93cd04bfa46f9ed66a2117ef56e5 (patch)
treebcf2b80a434326360f3ce1ec0d64110d5b09e1e8 /heat/ONAP/cloud-config/aaf_vm_init.sh
parent16509432a21feb3f90bbf954ec4815c2bf7f0033 (diff)
Refactor ONAP HEAT template config, part 2
Change-Id: Ic4930654395ec9e9d57836733cd47e7a3b0bf972 Issue-ID: INT-605 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'heat/ONAP/cloud-config/aaf_vm_init.sh')
-rw-r--r--heat/ONAP/cloud-config/aaf_vm_init.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/heat/ONAP/cloud-config/aaf_vm_init.sh b/heat/ONAP/cloud-config/aaf_vm_init.sh
new file mode 100644
index 00000000..a388bf2f
--- /dev/null
+++ b/heat/ONAP/cloud-config/aaf_vm_init.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)
+NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)
+NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
+DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt)
+HOSTNAME=`hostname`
+FQDN=aaf.api.simpledemo.onap.org
+HOST_IP=$(cat /opt/config/local_ip.txt)
+
+docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
+
+cd /opt/authz
+git pull
+
+
+cd /opt/authz/auth/auth-cass/docker
+if [ "`docker container ls | grep aaf_cass`" = "" ]; then
+ # Cassandra Install
+ echo Phase 1 Cassandra Install
+ ./dinstall.sh
+fi
+
+CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4`
+CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP
+
+sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY="$NEXUS_DOCKER_REPO"/g" /opt/authz/auth/docker/d.props
+#sed -i "s/VERSION=.*/VERSION="$DOCKER_IMAGE_VERSION"/g" /opt/authz/auth/docker/d.props
+sed -i "s/HOSTNAME=.*/HOSTNAME="$HOSTNAME"/g" /opt/authz/auth/docker/d.props
+sed -i "s/HOST_IP=.*/HOST_IP="$HOST_IP"/g" /opt/authz/auth/docker/d.props
+sed -i "s/CASS_HOST=.*/CASS_HOST="$CASS_HOST"/g" /opt/authz/auth/docker/d.props
+
+if [ ! -e "/opt/app/osaaf/etc" ]; then
+ # Nothing installed, install sample
+ mkdir -p /opt/app/osaaf/logs
+ cd /opt/app/osaaf/logs
+ mkdir fs cm gui hello locate oauth service
+ cd /opt
+ cp -Rf /opt/authz/auth/sample/* /opt/app/osaaf
+fi
+# Set Location information
+# Need new Deployment system properties
+CADI_LATITUDE=37.781
+CADI_LONGITUDE=-122.261
+
+CADI_TRUST_MASKS="${HOST_IP%\.[0-9]*}\\/24,${CASS_IP%\.[0-9]*}\\/24"
+sed -i "s/cadi_latitude=.*/cadi_latitude="$CADI_LATITUDE"/g" /opt/app/osaaf/local/org.osaaf.location.props
+sed -i "s/cadi_longitude=.*/cadi_longitude="$CADI_LONGITUDE"/g" /opt/app/osaaf/local/org.osaaf.location.props
+sed -i "s/cadi_registration_hostname=.*/cadi_registration_hostname="$FQDN"/g" /opt/app/osaaf/local/org.osaaf.location.props
+sed -i "s/cadi_trust_masks=.*/cadi_trust_masks="$CADI_TRUST_MASKS"/g" /opt/app/osaaf/local/org.osaaf.location.props
+
+cd /opt/authz/auth/docker
+./dbuild.sh
+sleep 5
+./drun.sh