summaryrefslogtreecommitdiffstats
path: root/src/main/swm/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/swm/common')
-rw-r--r--src/main/swm/common/common.env21
-rw-r--r--src/main/swm/common/deinstall.env1
-rw-r--r--src/main/swm/common/deinstall_postproc.sh26
-rw-r--r--src/main/swm/common/deinstall_preproc.sh26
-rw-r--r--src/main/swm/common/install.env1
-rw-r--r--src/main/swm/common/install_postproc.sh26
-rw-r--r--src/main/swm/common/install_preproc.sh26
-rw-r--r--src/main/swm/common/localize.sh170
8 files changed, 297 insertions, 0 deletions
diff --git a/src/main/swm/common/common.env b/src/main/swm/common/common.env
new file mode 100644
index 0000000..e788212
--- /dev/null
+++ b/src/main/swm/common/common.env
@@ -0,0 +1,21 @@
+export ROOT_DIR=${INSTALL_ROOT}opt/app/workload/fe3c/cambria
+
+OS=`uname`
+
+if [ "${OS}" = "SunOS" ]; then
+ CURRENT_USER=`/usr/xpg4/bin/id -un`
+ CURRENT_GROUP=`/usr/xpg4/bin/id -gn`
+else
+ CURRENT_USER=`id -un`
+ CURRENT_GROUP=`id -gn`
+fi
+
+export CURRENT_USER CURRENT_GROUP
+
+# Fail - used to quickly exit with a rc and error message
+fail() {
+ rc=$1
+ shift;
+ echo "ERROR: $@"
+ exit $rc
+}
diff --git a/src/main/swm/common/deinstall.env b/src/main/swm/common/deinstall.env
new file mode 100644
index 0000000..43a8d00
--- /dev/null
+++ b/src/main/swm/common/deinstall.env
@@ -0,0 +1 @@
+. `dirname $0`/common.env
diff --git a/src/main/swm/common/deinstall_postproc.sh b/src/main/swm/common/deinstall_postproc.sh
new file mode 100644
index 0000000..51d1b4c
--- /dev/null
+++ b/src/main/swm/common/deinstall_postproc.sh
@@ -0,0 +1,26 @@
+#!/bin/sh -x
+#*******************************************************************************
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+#*******************************************************************************
+
+. `dirname $0`/deinstall.env
+
+exit 0
diff --git a/src/main/swm/common/deinstall_preproc.sh b/src/main/swm/common/deinstall_preproc.sh
new file mode 100644
index 0000000..51d1b4c
--- /dev/null
+++ b/src/main/swm/common/deinstall_preproc.sh
@@ -0,0 +1,26 @@
+#!/bin/sh -x
+#*******************************************************************************
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+#*******************************************************************************
+
+. `dirname $0`/deinstall.env
+
+exit 0
diff --git a/src/main/swm/common/install.env b/src/main/swm/common/install.env
new file mode 100644
index 0000000..6dbd12c
--- /dev/null
+++ b/src/main/swm/common/install.env
@@ -0,0 +1 @@
+#NOOP \ No newline at end of file
diff --git a/src/main/swm/common/install_postproc.sh b/src/main/swm/common/install_postproc.sh
new file mode 100644
index 0000000..4166481
--- /dev/null
+++ b/src/main/swm/common/install_postproc.sh
@@ -0,0 +1,26 @@
+#!/bin/sh -x
+#*******************************************************************************
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+#*******************************************************************************
+
+. `dirname $0`/install.env
+
+exit 0
diff --git a/src/main/swm/common/install_preproc.sh b/src/main/swm/common/install_preproc.sh
new file mode 100644
index 0000000..4166481
--- /dev/null
+++ b/src/main/swm/common/install_preproc.sh
@@ -0,0 +1,26 @@
+#!/bin/sh -x
+#*******************************************************************************
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+#*******************************************************************************
+
+. `dirname $0`/install.env
+
+exit 0
diff --git a/src/main/swm/common/localize.sh b/src/main/swm/common/localize.sh
new file mode 100644
index 0000000..c6aa5ed
--- /dev/null
+++ b/src/main/swm/common/localize.sh
@@ -0,0 +1,170 @@
+#!/bin/sh
+#*******************************************************************************
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+#*******************************************************************************
+FINAL_CONFIG_FILE=${ROOT_DIR}/etc/cambriaApi.properties
+TEMPLATE_CONFIG_FILE=${ROOT_DIR}/etc/cambriaApi_template.properties
+BACKUP1_CONFIG_FILE=${ROOT_DIR}/etc/cambriaApi.properties.bk.1
+BACKUP2_CONFIG_FILE=${ROOT_DIR}/etc/cambriaApi.properties.bk.2
+
+echo "Localizing the Cambria API Server configuration"
+
+if [ -z "${ELASTICSEARCH_NODES}" ]; then
+ echo "ERROR: ELASTICSEARCH_NODES must be set"; exit 1
+fi
+
+if [ -z "${ZOOKEEPER_ENSEMBLE}" ]; then
+ echo "ERROR: ZOOKEEPER_ENSEMBLE must be set"; exit 2
+fi
+
+if [ -z "${ZOOKEEPER_CLIENT_PORT}" ]; then
+ ZOOKEEPER_CLIENT_PORT=2181
+fi
+
+if [ -z "${CAMBRIA_SERVICE_PORT}" ]; then
+ CAMBRIA_SERVICE_PORT=3904
+fi
+
+if [ -z "${CAMBRIA_BROKER_TYPE}" ]; then
+ CAMBRIA_BROKER_TYPE=kafka
+fi
+
+if [ -z "${KAFKA_PORT}" ]; then
+ KAFKA_PORT=9092
+fi
+
+if [ -z "${KAFKA_BROKER_LIST}" ]; then
+ KAFKA_BROKER_LIST=localhost:${KAFKA_PORT}
+fi
+
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${BACKUP1_CONFIG_FILE} ]; then
+ cp -f ${BACKUP1_CONFIG_FILE} ${BACKUP2_CONFIG_FILE} || {
+ echo "ERROR: Could not copy ${BACKUP1_CONFIG_FILE} to ${BACKUP2_CONFIG_FILE}"
+ exit 5
+ }
+fi
+
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${FINAL_CONFIG_FILE} ]; then
+ cp -f ${FINAL_CONFIG_FILE} ${BACKUP1_CONFIG_FILE} || {
+ echo "ERROR: Could not copy ${FINAL_CONFIG_FILE} to ${BACKUP1_CONFIG_FILE}"
+ exit 6
+ }
+fi
+
+CAMBRIA_ZOOKEEPER_NODES=`echo ${ZOOKEEPER_ENSEMBLE} | sed -e "s/ /:${ZOOKEEPER_CLIENT_PORT},/g" | sed -e "s/$/:${ZOOKEEPER_CLIENT_PORT}/g"`
+
+#------------------------------------------------------------------------
+#- PROCESS THE TEMPLATE
+#------------------------------------------------------------------------
+sed -e 's/${CAMBRIA_SERVICE_PORT}/'${CAMBRIA_SERVICE_PORT}'/g' \
+ -e 's/${CAMBRIA_BROKER_TYPE}/'${CAMBRIA_BROKER_TYPE}'/g' \
+ -e 's/${KAFKA_BROKER_LIST}/'${KAFKA_BROKER_LIST}'/g' \
+ -e 's/${CAMBRIA_ZOOKEEPER_NODES}/'${CAMBRIA_ZOOKEEPER_NODES}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}"
+ exit 7
+ }
+
+FINAL_LOG4J_FILE=${ROOT_DIR}/etc/log4j.xml
+TEMPLATE_LOG4J_FILE=${ROOT_DIR}/etc/log4j_template.xml
+BACKUP1_LOG4J_FILE=${ROOT_DIR}/etc/log4j.xml.bk.1
+BACKUP2_LOG4J_FILE=${ROOT_DIR}/etc/log4j.xml.bk.2
+
+if [ -z "${CAMBRIA_LOG_DIR}" ]; then
+ CAMBRIA_LOG_DIR=${ROOT_DIR}/logs
+fi
+
+if [ -z "${CAMBRIA_LOG_THRESHOLD}" ]; then
+ CAMBRIA_LOG_THRESHOLD="INFO"
+fi
+
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${BACKUP1_LOG4J_FILE} ]; then
+ cp -f ${BACKUP1_LOG4J_FILE} ${BACKUP2_LOG4J_FILE} || {
+ echo "ERROR: Could not copy ${BACKUP1_LOG4J_FILE} to ${BACKUP2_LOG4J_FILE}"
+ exit 8
+ }
+fi
+
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${FINAL_LOG4J_FILE} ]; then
+ cp -f ${FINAL_LOG4J_FILE} ${BACKUP1_LOG4J_FILE} || {
+ echo "ERROR: Could not copy ${FINAL_LOG4J_FILE} to ${BACKUP1_LOG4J_FILE}"
+ exit 9
+ }
+fi
+
+#------------------------------------------------------------------------
+#- PROCESS THE TEMPLATE
+#------------------------------------------------------------------------
+sed -e 's/${CAMBRIA_LOG_THRESHOLD}/'${CAMBRIA_LOG_THRESHOLD}'/g' \
+ -e 's,${CAMBRIA_LOG_DIR},'${CAMBRIA_LOG_DIR}',g' ${TEMPLATE_LOG4J_FILE} > ${FINAL_LOG4J_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_LOG4J_FILE} into ${FINAL_LOG4J_FILE}"
+ exit 10
+ }
+
+FINAL_LOGSTASH_FILE=${ROOT_DIR}/etc/messages.conf
+TEMPLATE_LOGSTASH_FILE=${ROOT_DIR}/etc/logstash_cambria_template.conf
+BACKUP1_LOGSTASH_FILE=${ROOT_DIR}/etc/messages.conf.bk.1
+BACKUP2_LOGSTASH_FILE=${ROOT_DIR}/etc/messages.conf.bk.2
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${BACKUP1_LOGSTASH_FILE} ]; then
+ cp -f ${BACKUP1_LOGSTASH_FILE} ${BACKUP2_LOGSTASH_FILE} || {
+ echo "ERROR: Could not copy ${BACKUP1_LOGSTASH_FILE} to ${BACKUP2_LOGSTASH_FILE}"
+ exit 11
+ }
+fi
+
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${FINAL_LOGSTASH_FILE} ]; then
+ cp -f ${FINAL_LOGSTASH_FILE} ${BACKUP1_LOGSTASH_FILE} || {
+ echo "ERROR: Could not copy ${FINAL_LOGSTASH_FILE} to ${BACKUP1_LOGSTASH_FILE}"
+ exit 12
+ }
+fi
+
+#------------------------------------------------------------------------
+#- PROCESS THE TEMPLATE
+#------------------------------------------------------------------------
+sed -e 's,${CAMBRIA_SERVER_LOG},'${CAMBRIA_LOG_DIR}/cambria.log',g' \
+ -e 's/${ELASTICSEARCH_NODES}/'${ELASTICSEARCH_NODES}'/g' ${TEMPLATE_LOGSTASH_FILE} > ${FINAL_LOGSTASH_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_LOGSTASH_FILE} into ${FINAL_LOGSTASH_FILE}"
+ exit 13
+ }
+
+#------------------------------------------------------------------------
+#- CLEAN EXIT
+#------------------------------------------------------------------------
+echo "Localized Successfully."
+exit 0