From 3982f4f67314ec37fd9b22ae54049958af777c1b Mon Sep 17 00:00:00 2001 From: jimmydot Date: Sun, 7 May 2017 14:58:24 -0400 Subject: [VID-6] Initial rebase push Change-Id: I9077be9663754d9b22f77c6a7b3109b361b39346 Signed-off-by: jimmydot --- epsdk-app-onap/src/main/swm/common/common.sh | 35 ++++ epsdk-app-onap/src/main/swm/common/localize.sh | 33 ++++ .../src/main/swm/common/localize_asdc.sh | 68 ++++++++ .../src/main/swm/common/localize_cache.sh | 41 +++++ .../src/main/swm/common/localize_log4j.sh | 54 +++++++ .../src/main/swm/common/localize_logback.sh | 46 ++++++ .../src/main/swm/common/localize_portal.sh | 84 ++++++++++ .../src/main/swm/common/localize_quartz.sh | 67 ++++++++ .../src/main/swm/common/localize_system.sh | 178 +++++++++++++++++++++ .../src/main/swm/deinstall/postproc/post_proc | 4 + .../src/main/swm/deinstall/preproc/pre_proc | 4 + epsdk-app-onap/src/main/swm/descriptor.xml | 34 ++++ .../src/main/swm/fallback/postproc/post_proc | 1 + .../src/main/swm/fallback/preproc/pre_proc | 1 + .../src/main/swm/initinst/postproc/post_proc | 7 + .../src/main/swm/initinst/preproc/pre_proc | 7 + .../src/main/swm/install/postproc/post_proc | 38 +++++ .../src/main/swm/install/preproc/pre_proc | 18 +++ epsdk-app-onap/src/main/swm/notes.txt | 52 ++++++ 19 files changed, 772 insertions(+) create mode 100755 epsdk-app-onap/src/main/swm/common/common.sh create mode 100755 epsdk-app-onap/src/main/swm/common/localize.sh create mode 100755 epsdk-app-onap/src/main/swm/common/localize_asdc.sh create mode 100755 epsdk-app-onap/src/main/swm/common/localize_cache.sh create mode 100755 epsdk-app-onap/src/main/swm/common/localize_log4j.sh create mode 100755 epsdk-app-onap/src/main/swm/common/localize_logback.sh create mode 100755 epsdk-app-onap/src/main/swm/common/localize_portal.sh create mode 100755 epsdk-app-onap/src/main/swm/common/localize_quartz.sh create mode 100755 epsdk-app-onap/src/main/swm/common/localize_system.sh create mode 100755 epsdk-app-onap/src/main/swm/deinstall/postproc/post_proc create mode 100755 epsdk-app-onap/src/main/swm/deinstall/preproc/pre_proc create mode 100755 epsdk-app-onap/src/main/swm/descriptor.xml create mode 100755 epsdk-app-onap/src/main/swm/fallback/postproc/post_proc create mode 100755 epsdk-app-onap/src/main/swm/fallback/preproc/pre_proc create mode 100755 epsdk-app-onap/src/main/swm/initinst/postproc/post_proc create mode 100755 epsdk-app-onap/src/main/swm/initinst/preproc/pre_proc create mode 100755 epsdk-app-onap/src/main/swm/install/postproc/post_proc create mode 100755 epsdk-app-onap/src/main/swm/install/preproc/pre_proc create mode 100755 epsdk-app-onap/src/main/swm/notes.txt (limited to 'epsdk-app-onap/src/main/swm') diff --git a/epsdk-app-onap/src/main/swm/common/common.sh b/epsdk-app-onap/src/main/swm/common/common.sh new file mode 100755 index 000000000..4b98a5eac --- /dev/null +++ b/epsdk-app-onap/src/main/swm/common/common.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +if [[ "${INSTALL_ROOT}" = */ ]]; then + export ROOT_DIR=${INSTALL_ROOT}opt/app/vid/portal +else + export ROOT_DIR=${INSTALL_ROOT}/opt/app/vid/portal +fi + +export JAVA_HOME=/opt/app/java/jdk/jdk180 + + +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 +export TOMCAT_HOME=/opt/app/vid/tomcat + +if [ -z "${VID_ENDPOINT_NAME}" ]; then + VID_ENDPOINT_NAME="vid" +fi + +# Fail - used to quickly exit with a rc and error message +fail() { + rc=$1 + shift; + echo "ERROR: $@" + exit $rc +} diff --git a/epsdk-app-onap/src/main/swm/common/localize.sh b/epsdk-app-onap/src/main/swm/common/localize.sh new file mode 100755 index 000000000..711287e1f --- /dev/null +++ b/epsdk-app-onap/src/main/swm/common/localize.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +COMMON_DIR="$(dirname "$AFTSWM_ACTIONHANDLER_SCRIPT")/../../common" + +source "${COMMON_DIR}/localize_logback.sh" || { + echo "ERROR: Localizing logback.xml failed" + exit 1 +} + +source "${COMMON_DIR}/localize_portal.sh" || { + echo "ERROR: Localizing portal.properties failed" + exit 1 +} + +source "${COMMON_DIR}/localize_quartz.sh" || { + echo "ERROR: Localizing quartz.properties failed" + exit 1 +} + +source "${COMMON_DIR}/localize_system.sh" || { + echo "ERROR: Localizing system.properties failed" + exit 1 +} + +source "${COMMON_DIR}/localize_cache.sh" || { + echo "ERROR: Localizing cache.ccf failed" + exit 1 +} + +source "${COMMON_DIR}/localize_asdc.sh" || { + echo "ERROR: Localizing asdc.properties failed" + exit 1 +} diff --git a/epsdk-app-onap/src/main/swm/common/localize_asdc.sh b/epsdk-app-onap/src/main/swm/common/localize_asdc.sh new file mode 100755 index 000000000..5774e5a0c --- /dev/null +++ b/epsdk-app-onap/src/main/swm/common/localize_asdc.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/asdc.properties +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/asdc_template.properties +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/asdc.properties.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/asdc.properties.bk.2 + +echo "Localizing the SDC client configuration" + +if [ -z "${ASDC_CLIENT_TYPE}" ]; then + ASDC_CLIENT_TYPE=REST +fi + +if [ "${ASDC_CLIENT_TYPE}" = "REST" ]; then + if [ -z "${ASDC_CLIENT_REST_HOST}" ]; then + echo 'ASDC_CLIENT_REST_HOST must be provided when ASDC_CLIENT_TYPE=REST' + exit 1 + fi + + if [ -z "${ASDC_CLIENT_REST_AUTH}" ]; then + echo 'ASDC_CLIENT_REST_AUTH must be provided when ASDC_CLIENT_TYPE=REST' + exit 2 + fi + + if [ -z "${ASDC_CLIENT_REST_PROTOCOL}" ]; then + ASDC_CLIENT_REST_PROTOCOL=http + fi + + if [ -z "${ASDC_CLIENT_REST_PORT}" ]; then + ASDC_CLIENT_REST_PORT=8080 + fi +else + ASDC_CLIENT_REST_HOST="" + ASDC_CLIENT_REST_AUTH="" + ASDC_CLIENT_REST_PROTOCOL="http" + ASDC_CLIENT_REST_PORT="8080" +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 2 + } +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 3 + } +fi + +sed -e 's ${ASDC_CLIENT_TYPE} '${ASDC_CLIENT_TYPE}' g' \ + -e 's ${ASDC_CLIENT_REST_HOST} '${ASDC_CLIENT_REST_HOST}' g' \ + -e 's ${ASDC_CLIENT_REST_PORT} '${ASDC_CLIENT_REST_PORT}' g' \ + -e 's ${ASDC_CLIENT_REST_PROTOCOL} '${ASDC_CLIENT_REST_PROTOCOL}' g' \ + -e 's/${ASDC_CLIENT_REST_AUTH}/'"${ASDC_CLIENT_REST_AUTH}"'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 4 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/epsdk-app-onap/src/main/swm/common/localize_cache.sh b/epsdk-app-onap/src/main/swm/common/localize_cache.sh new file mode 100755 index 000000000..00069f89f --- /dev/null +++ b/epsdk-app-onap/src/main/swm/common/localize_cache.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache.ccf +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache_template.ccf +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache.ccf.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache.ccf.bk.2 + +echo "Localizing the VID cache configuration" + +if [ -z "${CACHE_DIRECTORY}" ]; then + CACHE_DIRECTORY=${ROOT_DIR}/cache +fi + +mkdir -p "${CACHE_DIRECTORY}" + +#------------------------------------------------------------------------ +#- 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 1 + } +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 2 + } +fi + +sed -e 's,${CACHE_DIRECTORY},'${CACHE_DIRECTORY}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 3 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/epsdk-app-onap/src/main/swm/common/localize_log4j.sh b/epsdk-app-onap/src/main/swm/common/localize_log4j.sh new file mode 100755 index 000000000..1b044aa6b --- /dev/null +++ b/epsdk-app-onap/src/main/swm/common/localize_log4j.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/log4j.properties +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/log4j_template.properties +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/log4j.properties.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/log4j.properties.bk.2 + +echo "Localizing the VID log4j configuration" + +if [ -z "${LOG4J_LOGLEVEL}" ]; then + LOG4J_LOGLEVEL=INFO +fi + + +if [ -z "${LOG4J_APPENDER}" ]; then + LOG4J_APPENDER=rollingfile +fi + +if [ -z "${LOG4J_LOGS_DIRECTORY}" ]; then + LOG4J_LOGS_DIRECTORY=${ROOT_DIR}/logs +fi + +mkdir -p ${LOG4J_LOGS_DIRECTORY} + +#------------------------------------------------------------------------ +#- 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 1 + } +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 2 + } +fi + +sed -e 's/${LOG4J_LOGLEVEL}/'${LOG4J_LOGLEVEL}'/g' \ + -e 's/${LOG4J_APPENDER}/'${LOG4J_APPENDER}'/g' \ + -e 's,${LOG4J_LOGS_DIRECTORY},'${LOG4J_LOGS_DIRECTORY}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 3 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." + + diff --git a/epsdk-app-onap/src/main/swm/common/localize_logback.sh b/epsdk-app-onap/src/main/swm/common/localize_logback.sh new file mode 100755 index 000000000..bda2486d4 --- /dev/null +++ b/epsdk-app-onap/src/main/swm/common/localize_logback.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/logback.xml +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/logback_template.xml +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/logback.xml.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/logback.xml.bk.2 + +echo "Localizing the VID logback configuration" + +if [ -z "${VID_LOG_DIR}" ]; then + VID_LOG_DIR="${ROOT_DIR}/logs" +fi + +if [ -z "${VID_LOG_LEVEL}" ]; then + VID_LOG_LEVEL="INFO" +fi + +mkdir -p "${VID_LOG_DIR}" + +#------------------------------------------------------------------------ +#- 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 1 + } +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 2 + } +fi + +sed -e 's/${VID_LOG_LEVEL}/'${VID_LOG_LEVEL}'/g' \ + -e 's,${VID_LOG_DIR},'${VID_LOG_DIR}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 3 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/epsdk-app-onap/src/main/swm/common/localize_portal.sh b/epsdk-app-onap/src/main/swm/common/localize_portal.sh new file mode 100755 index 000000000..77e68df30 --- /dev/null +++ b/epsdk-app-onap/src/main/swm/common/localize_portal.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/portal.properties +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/portal_template.properties +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/portal.properties.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/portal.properties.bk.2 + +echo "Localizing the VID portal configuration" + +if [ -z "${VID_ECOMP_REDIRECT_URL}" ]; then + VID_ECOMP_REDIRECT_URL=https://portal.openecomp.org/ecompportal/ecompportal/process_csp +fi + +if [ -z "${VID_WJ_LOGOUT_URL}" ]; then + VID_WJ_LOGOUT_URL=https://portal.openecomp.org/ecompportal/ecompportal/process_csp +fi + +if [ -z "${VID_ECOMP_REST_URL}" ]; then + VID_ECOMP_REST_URL=https://portal.openecomp.org/ecompportal/auxapi +fi + +if [ -z "${VID_UEB_URL_LIST}" ]; then + VID_UEB_URL_LIST=ueb.openecomp.org +fi + +if [ -z "${VID_UEB_CONSUMER_GROUP}" ]; then + VID_UEB_CONSUMER_GROUP=VID +fi + +if [ -z "${VID_ECOMP_PORTAL_INBOX_NAME}" ]; then + VID_ECOMP_PORTAL_INBOX_NAME=ECOMP-PORTAL-INBOX-DEV-LOCAL +fi + +if [ -z "${VID_UEB_APP_KEY}" ]; then + VID_UEB_APP_KEY=sYH0NJnsKmJC1B2A +fi + +if [ -z "${VID_UEB_APP_SECRET}" ]; then + VID_UEB_APP_SECRET=YOtknsT2wVFz9WISlSPDaAtd +fi + +if [ -z "${VID_UEB_APP_MAILBOX_NAME}" ]; then + VID_UEB_APP_MAILBOX_NAME="ECOMP-PORTAL-OUTBOX-90" +fi + +if [ -z "${VID_UEB_LISTENERS_ENABLE}" ]; then + VID_UEB_LISTENERS_ENABLE="false" +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 2 + } +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 3 + } +fi + +sed -e 's ${VID_WJ_LOGOUT_URL} '${VID_WJ_LOGOUT_URL}' g' \ + -e 's ${VID_ECOMP_REDIRECT_URL} '${VID_ECOMP_REDIRECT_URL}' g' \ + -e 's ${VID_ECOMP_REST_URL} '${VID_ECOMP_REST_URL}' g' \ + -e 's ${VID_UEB_URL_LIST} '${VID_UEB_URL_LIST}' g' \ + -e 's ${VID_ECOMP_PORTAL_INBOX_NAME} '${VID_ECOMP_PORTAL_INBOX_NAME}' g' \ + -e 's ${VID_UEB_APP_KEY} '${VID_UEB_APP_KEY}' g' \ + -e 's ${VID_UEB_APP_SECRET} '${VID_UEB_APP_SECRET}' g' \ + -e 's ${VID_UEB_APP_MAILBOX_NAME} '${VID_UEB_APP_MAILBOX_NAME}' g' \ + -e 's ${VID_UEB_LISTENERS_ENABLE} '${VID_UEB_LISTENERS_ENABLE}' g' \ + -e 's/${VID_UEB_CONSUMER_GROUP}/'${VID_UEB_CONSUMER_GROUP}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 4 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/epsdk-app-onap/src/main/swm/common/localize_quartz.sh b/epsdk-app-onap/src/main/swm/common/localize_quartz.sh new file mode 100755 index 000000000..9a646867c --- /dev/null +++ b/epsdk-app-onap/src/main/swm/common/localize_quartz.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/quartz.properties +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/quartz_template.properties +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/quartz.properties.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/quartz.properties.bk.2 + +echo "Localizing the VID quartz configuration" + +if [ -z "${VID_MYSQL_HOST}" ]; then + VID_MYSQL_HOST=localhost +fi + +if [ -z "${VID_MYSQL_PORT}" ]; then + VID_MYSQL_PORT=3306 +fi + +if [ -z "${VID_MYSQL_DBNAME}" ]; then + VID_MYSQL_DBNAME=vid_portal +fi + +if [ -z "${VID_MYSQL_USER}" ]; then + VID_MYSQL_USER=$(id -un) +fi + +if [ -z "${VID_MYSQL_MAXCONNECTIONS}" ]; then + VID_MYSQL_MAXCONNECTIONS=5 +fi + +if [ -z "${VID_MYSQL_PASS}" ]; then + echo "Missing required parameter VID_MYSQL_PASS" + exit 1 +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 2 + } +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 3 + } +fi + +sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \ + -e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \ + -e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \ + -e 's/${VID_MYSQL_USER}/'${VID_MYSQL_USER}'/g' \ + -e 's/${VID_MYSQL_PASS}/'${VID_MYSQL_PASS}'/g' \ + -e 's/${VID_MYSQL_MAXCONNECTIONS}/'${VID_MYSQL_MAXCONNECTIONS}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 4 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." + + diff --git a/epsdk-app-onap/src/main/swm/common/localize_system.sh b/epsdk-app-onap/src/main/swm/common/localize_system.sh new file mode 100755 index 000000000..bf4735d76 --- /dev/null +++ b/epsdk-app-onap/src/main/swm/common/localize_system.sh @@ -0,0 +1,178 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/system.properties +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/system_template.properties +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/system.properties.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/system.properties.bk.2 + +echo "Localizing the VID system configuration" + +if [ -z "${VID_MYSQL_HOST}" ]; then + VID_MYSQL_HOST=localhost +fi + +if [ -z "${VID_MYSQL_PORT}" ]; then + VID_MYSQL_PORT=3306 +fi + +if [ -z "${VID_MYSQL_DBNAME}" ]; then + VID_MYSQL_DBNAME=vid_portal +fi + +if [ -z "${VID_MYSQL_USER}" ]; then + VID_MYSQL_USER=vid_admin +fi + +if [ -z "${VID_MYSQL_MAXCONNECTIONS}" ]; then + VID_MYSQL_MAXCONNECTIONS=5 +fi + +if [ -z "${VID_AAI_HOST}" ]; then + VID_AAI_HOST=aai.api.openecomp.org +fi + +if [ -z "${VID_AAI_PORT}" ]; then + VID_AAI_PORT=8443 +fi + +if [ -z "${VID_APP_DISPLAY_NAME}" ]; then + VID_APP_DISPLAY_NAME=VID +fi + +if [ -z "${VID_ECOMP_SHARED_CONTEXT_REST_URL}" ]; then + VID_ECOMP_SHARED_CONTEXT_REST_URL="https://portal.openecomp.org:8080/ecompportal/context" +fi + +if [ -z "${VID_ECOMP_REDIRECT_URL}" ]; then + VID_ECOMP_REDIRECT_URL=https://portal.openecomp.org/ecompportal/ecompportal/process_csp +fi + +if [ -z "${VID_ECOMP_REST_URL}" ]; then + VID_ECOMP_REST_URL=https://portal.openecomp.org/ecompportal/auxapi +fi + +if [ -z "${VID_MSO_SERVER_URL}" ]; then + VID_MSO_SERVER_URL=https://mso.api.openecomp.org:8443 +fi + +if [ -z "${VID_TRUSTSTORE_FILE}" ]; then + VID_TRUSTSTORE_FILE=${ROOT_DIR}/etc/vid_keystore.jks +fi + +if [ -z "${VID_MYLOGIN_FEED_DIRECTORY}" ]; then + VID_MYLOGIN_FEED_DIRECTORY=/tmp/MyLogins +fi + +if [ -z "${VID_TRUSTSTORE_PASS}" ]; then + echo "ERROR: Missing required parameter VID_TRUSTSTORE_PASS" + exit 1 +fi + +if [ -z "${VID_MSO_USER}" ]; then + echo "ERROR: Missing required parameter VID_MSO_USER" + exit 1 +fi + +if [ -z "${VID_MSO_PASS}" ]; then + echo "ERROR: Missing required parameter VID_MSO_PASS"; + exit 1 +fi + +if [ -z "${VID_MYSQL_PASS}" ]; then + echo "ERROR: Missing required parameter VID_MYSQL_PASS" + exit 1 +fi + +if [ -z "${MSO_DME2_CLIENT_TIMEOUT}" ]; then + echo "ERROR: Missing required parameter MSO_DME2_CLIENT_TIMEOUT" + exit 1 +fi + +if [ -z "${MSO_DME2_CLIENT_READ_TIMEOUT}" ]; then + echo "ERROR: Missing required parameter MSO_DME2_CLIENT_READ_TIMEOUT" + exit 1 +fi + +if [ -z "${MSO_DME2_SERVER_URL}" ]; then + echo "ERROR: Missing required parameter MSO_DME2_SERVER_URL" + exit 1 +fi +if [ -z "${MSO_DME2_ENABLED}" ]; then + echo "ERROR: Missing required parameter MSO_DME2_ENABLED" + exit 1 +fi +if [ -z "${MSO_POLLING_INTERVAL_MSECS}" ]; then + MSO_POLLING_INTERVAL_MSECS=10000 +fi + +if [ -z "${AAI_TRUSTSTORE_FILENAME}" ]; then + AAI_TRUSTSTORE_FILENAME=tomcat_keystore +fi + +if [ -z "${AAI_TRUSTSTORE_PASSWD_X}" ]; then + AAI_TRUSTSTORE_PASSWD_X=70c87528c88dcd9f9c2558d30e817868 +fi + +if [ -z "${AAI_KEYSTORE_FILENAME}" ]; then + AAI_KEYSTORE_FILENAME=aai-client-cert.p12 +fi + +if [ -z "${AAI_KEYSTORE_PASSWD_X}" ]; then + AAI_KEYSTORE_PASSWD_X=70c87528c88dcd9f9c2558d30e817868 +fi + +mkdir -p "${VID_MYLOGIN_FEED_DIRECTORY}" + +#------------------------------------------------------------------------ +#- 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 2 + } +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 3 + } +fi + +sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \ + -e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \ + -e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \ + -e 's/${VID_MYSQL_USER}/'${VID_MYSQL_USER}'/g' \ + -e 's/${VID_MYSQL_PASS}/'${VID_MYSQL_PASS}'/g' \ + -e 's/${VID_AAI_HOST}/'${VID_AAI_HOST}'/g' \ + -e 's/${VID_AAI_PORT}/'${VID_AAI_PORT}'/g' \ + -e 's,${AAI_TRUSTSTORE_FILENAME},'${AAI_TRUSTSTORE_FILENAME}',g' \ + -e 's/${AAI_TRUSTSTORE_PASSWD_X}/'${AAI_TRUSTSTORE_PASSWD_X}'/g' \ + -e 's,${AAI_KEYSTORE_FILENAME},'${AAI_KEYSTORE_FILENAME}',g' \ + -e 's/${AAI_KEYSTORE_PASSWD_X}/'${AAI_KEYSTORE_PASSWD_X}'/g' \ + -e 's/${VID_APP_DISPLAY_NAME}/'${VID_APP_DISPLAY_NAME}'/g' \ + -e 's ${VID_ECOMP_SHARED_CONTEXT_REST_URL} '${VID_ECOMP_SHARED_CONTEXT_REST_URL}' g' \ + -e 's ${VID_ECOMP_REDIRECT_URL} '${VID_ECOMP_REDIRECT_URL}' g' \ + -e 's ${VID_ECOMP_REST_URL} '${VID_ECOMP_REST_URL}' g' \ + -e 's ${VID_MSO_SERVER_URL} '${VID_MSO_SERVER_URL}' g' \ + -e 's/${VID_MSO_USER}/'${VID_MSO_USER}'/g' \ + -e 's/${VID_MSO_PASS}/'${VID_MSO_PASS}'/g' \ + -e 's,${VID_MYLOGIN_FEED_DIRECTORY},'${VID_MYLOGIN_FEED_DIRECTORY}',g' \ + -e 's,${MSO_DME2_CLIENT_TIMEOUT},'${MSO_DME2_CLIENT_TIMEOUT}',g' \ + -e 's,${MSO_DME2_CLIENT_READ_TIMEOUT},'${MSO_DME2_CLIENT_READ_TIMEOUT}',g' \ + -e 's,${MSO_DME2_SERVER_URL},'${MSO_DME2_SERVER_URL}',g' \ + -e 's,${MSO_DME2_ENABLED},'${MSO_DME2_ENABLED}',g' \ + -e 's,${MSO_POLLING_INTERVAL_MSECS},'${MSO_POLLING_INTERVAL_MSECS}',g' \ + -e 's,${VID_TRUSTSTORE_FILE},'${VID_TRUSTSTORE_FILE}',g' \ + -e 's/${VID_TRUSTSTORE_PASS}/'${VID_TRUSTSTORE_PASS}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 4 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." + + diff --git a/epsdk-app-onap/src/main/swm/deinstall/postproc/post_proc b/epsdk-app-onap/src/main/swm/deinstall/postproc/post_proc new file mode 100755 index 000000000..103d18d38 --- /dev/null +++ b/epsdk-app-onap/src/main/swm/deinstall/postproc/post_proc @@ -0,0 +1,4 @@ +#!/bin/sh + +cd ../../common +exec sh -x ./deinstall_postproc.sh \ No newline at end of file diff --git a/epsdk-app-onap/src/main/swm/deinstall/preproc/pre_proc b/epsdk-app-onap/src/main/swm/deinstall/preproc/pre_proc new file mode 100755 index 000000000..ce87ecffb --- /dev/null +++ b/epsdk-app-onap/src/main/swm/deinstall/preproc/pre_proc @@ -0,0 +1,4 @@ +#!/bin/sh + +cd ../../common +exec sh -x ./deinstall_preproc.sh \ No newline at end of file diff --git a/epsdk-app-onap/src/main/swm/descriptor.xml b/epsdk-app-onap/src/main/swm/descriptor.xml new file mode 100755 index 000000000..7c09ef3a8 --- /dev/null +++ b/epsdk-app-onap/src/main/swm/descriptor.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epsdk-app-onap/src/main/swm/fallback/postproc/post_proc b/epsdk-app-onap/src/main/swm/fallback/postproc/post_proc new file mode 100755 index 000000000..96b4b06ad --- /dev/null +++ b/epsdk-app-onap/src/main/swm/fallback/postproc/post_proc @@ -0,0 +1 @@ +#!/bin/sh \ No newline at end of file diff --git a/epsdk-app-onap/src/main/swm/fallback/preproc/pre_proc b/epsdk-app-onap/src/main/swm/fallback/preproc/pre_proc new file mode 100755 index 000000000..96b4b06ad --- /dev/null +++ b/epsdk-app-onap/src/main/swm/fallback/preproc/pre_proc @@ -0,0 +1 @@ +#!/bin/sh \ No newline at end of file diff --git a/epsdk-app-onap/src/main/swm/initinst/postproc/post_proc b/epsdk-app-onap/src/main/swm/initinst/postproc/post_proc new file mode 100755 index 000000000..a986928c0 --- /dev/null +++ b/epsdk-app-onap/src/main/swm/initinst/postproc/post_proc @@ -0,0 +1,7 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +source ${DIR}/../../install/postproc/post_proc || { + echo "INITINST post_proc script failed"; exit 1 +} diff --git a/epsdk-app-onap/src/main/swm/initinst/preproc/pre_proc b/epsdk-app-onap/src/main/swm/initinst/preproc/pre_proc new file mode 100755 index 000000000..983d0c535 --- /dev/null +++ b/epsdk-app-onap/src/main/swm/initinst/preproc/pre_proc @@ -0,0 +1,7 @@ +#!/bin/bash + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +source "${DIR}/../../install/preproc/pre_proc" || { + echo "INITINST pre_proc script failed"; exit 1 +} diff --git a/epsdk-app-onap/src/main/swm/install/postproc/post_proc b/epsdk-app-onap/src/main/swm/install/postproc/post_proc new file mode 100755 index 000000000..370d44b61 --- /dev/null +++ b/epsdk-app-onap/src/main/swm/install/postproc/post_proc @@ -0,0 +1,38 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +COMMON_SCRIPT=${DIR}/../../common/common.sh + +source "${COMMON_SCRIPT}" || { + echo "ERROR: Common script failed" + exit 1 +} + +mkdir -p "${TOMCAT_HOME}/temp" + +#Extract the WAR so it can be customized by the localization script +mkdir -p ${ROOT_DIR}/war +cp "${ROOT_DIR}/lib/vid.war" "${ROOT_DIR}/war/${VID_ENDPOINT_NAME}.war" +cd "${ROOT_DIR}/war" +${JAVA_HOME}/bin/jar -xf ${VID_ENDPOINT_NAME}.war +rm ${ROOT_DIR}/war/${VID_ENDPOINT_NAME}.war + +LOCALIZE_SCRIPT=$(dirname "$AFTSWM_ACTIONHANDLER_SCRIPT")/../../common/localize.sh + + +source "${LOCALIZE_SCRIPT}" || { + echo "ERROR: Localization script failed" + exit 2 +} + +#Create the customized WAR and deploy it to Tomcat +mkdir -p "${ROOT_DIR}/deployed" +cd "${ROOT_DIR}/war" +${JAVA_HOME}/bin/jar -cvf "${ROOT_DIR}/deployed/${VID_ENDPOINT_NAME}.war" . +cd +rm -rf "${ROOT_DIR}/war" +mv -f "${ROOT_DIR}/deployed/${VID_ENDPOINT_NAME}.war" "${TOMCAT_HOME}/webapps" + +if [ -f "${TOMCAT_HOME}/bin/startup.sh" ]; then + "${TOMCAT_HOME}/bin/startup.sh" +fi diff --git a/epsdk-app-onap/src/main/swm/install/preproc/pre_proc b/epsdk-app-onap/src/main/swm/install/preproc/pre_proc new file mode 100755 index 000000000..a09a9c46f --- /dev/null +++ b/epsdk-app-onap/src/main/swm/install/preproc/pre_proc @@ -0,0 +1,18 @@ +#!/bin/bash + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +COMMON_SCRIPT=${DIR}/../../common/common.sh + +source "${COMMON_SCRIPT}" || { + echo "ERROR: Common script failed" + exit 1 +} + +if [ -f "${TOMCAT_HOME}/bin/shutdown.sh" ]; then + "${TOMCAT_HOME}/bin/shutdown.sh" + + if [ -d "${TOMCAT_HOME}/webapps/${VID_ENDPOINT_NAME}" ]; then + rm -r "${TOMCAT_HOME}/webapps/${VID_ENDPOINT_NAME}" + fi +fi + diff --git a/epsdk-app-onap/src/main/swm/notes.txt b/epsdk-app-onap/src/main/swm/notes.txt new file mode 100755 index 000000000..f0a8fa974 --- /dev/null +++ b/epsdk-app-onap/src/main/swm/notes.txt @@ -0,0 +1,52 @@ +This package will install the Virtual Infrastructure Deployment (VID) war to the local tomcat server. +The Tomcat server is marked as a dependency of this package and will be installed automatically on the +target server if it has not already been installed. The current version of Tomcat used by VID +is 8.0.36. MariaDB is also necessary for VID and can be installed by whichever method you choose. + +The following are variables that can be set to customize your installation of VID: + +Variable Default Description + +ASDC_CLIENT_REST_AUTH unset Basic authentication header value (e.g. Basic asdfoijwelkjsg=) +ASDC_CLIENT_REST_HOST unset Host where the SDC Catalog Service is running +ASDC_CLIENT_REST_PORT 8080 Port where the SDC Catalog Service is running +ASDC_CLIENT_TYPE REST Set to IN_MEMORY for testing, REST for connecting with an actual SDC Catalog Service + +MSO_DME2_CLIENT_READ_TIMEOUT unset Time in ms before DME2 MSO read requests timeout +MSO_DME2_CLIENT_TIMEOUT unset Time in ms before DME2 MSO requests timeout +MSO_DME2_ENABLED unset Whether the enable the MSO DME2 client or not +MSO_DME2_SERVER_URL unset The server URL for connecting to the MSO service +MSO_POLLING_INTERVAL_MSECS 10000 The interval at which to poll MSO for orchestration requests +VID_MSO_PASS unset The password for connecting with the MSO service +VID_MSO_SERVER_URL unset The server URL for connecting with the MSO service +VID_MSO_USER unset The user name for connecting with the MSO service + +VID_LOG_DIR ${ROOT_DIR}/logs The directory to store log files in +VID_LOG_LEVEL INFO The level at which to log (follows logback logging levels) +VID_ECOMP_REDIRECT_URL https://portal.openecomp.org/ecompportal/ecompportal/process_csp See ECOMP SDK Documentation +VID_ECOMP_REST_URL https://portal.openecomp.org/ecompportal/auxapi See ECOMP SDK Documentation +VID_ENDPOINT_NAME vid http://{host}:{port}/{VID_ENDPOINT_NAME} + +VID_MYSQL_HOST unset The host where the VID MariaDB instance is running +VID_MYSQL_MAXCONNECTIONS 5 The maximum connections to use to connect to the MariaDB instance +VID_MYSQL_PORT 3306 The port where the VID MariaDB instance is running +VID_MYSQL_DBNAME vid_portal The database name (i.e. CREATE DATABASE ${VID_MYSQL_DBNAME} +VID_MYSQL_USER vidadmin The user to connect as to the MariaDB instance +VID_MYSQL_PASS unset The password for the ${VID_MYSQL_USER} @ ${VID_MYSQL_HOST} + +VID_AAI_HOST unset The host where the A&AI service is running +VID_AAI_PORT 8443 The port where the A&AI service is running +VID_TRUSTSTORE_PASS unset The password for the VID truststore (A&AI client) +VID_TRUSTSTORE_FILE unset The location on the file system of the truststore (A&AI client) +AAI_TRUSTSTORE_FILENAME tomcat_keystore A file name +AAI_TRUSTSTORE_PASSWD_X (dev env creds) A password +AAI_KEYSTORE_FILENAME aai-client-cert.p12 A file name +AAI_KEYSTORE_PASSWD_X (dev env creds) A password + +VID_UEB_URL_LIST ueb.openecomp.org The hosts where UEB is running +VID_UEB_CONSUMER_GROUP VID The UEB consumer group name to use +VID_ECOMP_PORTAL_INBOX_NAME ECOMP-PORTAL-INBOX-DEV-LOCAL A UEB Topic to send messages to the ECOMP portal on +VID_UEB_APP_KEY sYH0NJnsKmJC1B2A The UEB App Key (mandatory) +VID_UEB_APP_SECRET YOtknsT2wVFz9WISlSPDaAtd The UEB App Secret +VID_UEB_APP_MAILBOX_NAME ECOMP-PORTAL-OUTBOX-90 A UEB Topic to listen for messages from the ECOMP portal on +VID_UEB_LISTENERS_ENABLE false Enable the UEB listeners for the specified mailboxes (In 1610, this should always be false) -- cgit 1.2.3-korg