From cfb63b2c5c381434a6fdea794ad0c2e89a2be328 Mon Sep 17 00:00:00 2001 From: Priyadharshini Date: Mon, 16 Mar 2020 05:55:43 +0000 Subject: Initial code check-in RANSim Controller and RANSim GUI Issue-ID: INT-1485 Signed-off-by: Priyadharshini Change-Id: I99fe693065072ff5c9b188f2177488a4cd93237d --- .../packages/base/src/files/etc/cron.d/audit.cron | 1 + .../base/src/files/etc/cron.d/logrotate.cron | 1 + .../base/src/files/etc/cron.d/monitor.cron | 1 + .../base/src/files/etc/monitor/monitor.cfg | 9 ++ .../packages/base/src/files/etc/profile.d/env.sh | 25 +++ .../packages/base/src/files/etc/profile.d/su.cfg | 1 + .../install/mysql/data/181010_upgrade_script.sql | 33 ++++ .../install/servers/common/tomcat/conf/server.xml | 128 ++++++++++++++++ .../install/servers/common/tomcat/init.d/tomcatd | 91 +++++++++++ .../files/install/servers/configs/conf/server.xml | 167 +++++++++++++++++++++ .../packages/base/src/files/m2/settings.xml | 116 ++++++++++++++ 11 files changed, 573 insertions(+) create mode 100644 ransim/ransimctrlr/packages/base/src/files/etc/cron.d/audit.cron create mode 100644 ransim/ransimctrlr/packages/base/src/files/etc/cron.d/logrotate.cron create mode 100644 ransim/ransimctrlr/packages/base/src/files/etc/cron.d/monitor.cron create mode 100644 ransim/ransimctrlr/packages/base/src/files/etc/monitor/monitor.cfg create mode 100644 ransim/ransimctrlr/packages/base/src/files/etc/profile.d/env.sh create mode 100644 ransim/ransimctrlr/packages/base/src/files/etc/profile.d/su.cfg create mode 100644 ransim/ransimctrlr/packages/base/src/files/install/mysql/data/181010_upgrade_script.sql create mode 100644 ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/conf/server.xml create mode 100644 ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/init.d/tomcatd create mode 100644 ransim/ransimctrlr/packages/base/src/files/install/servers/configs/conf/server.xml create mode 100644 ransim/ransimctrlr/packages/base/src/files/m2/settings.xml (limited to 'ransim/ransimctrlr/packages/base/src/files') diff --git a/ransim/ransimctrlr/packages/base/src/files/etc/cron.d/audit.cron b/ransim/ransimctrlr/packages/base/src/files/etc/cron.d/audit.cron new file mode 100644 index 0000000..1e6bbee --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/etc/cron.d/audit.cron @@ -0,0 +1 @@ +0 0 * * * . ${{POLICY_HOME}}/etc/profile.d/env.sh; elk.sh --audit < /dev/null > /dev/null 2>&1 diff --git a/ransim/ransimctrlr/packages/base/src/files/etc/cron.d/logrotate.cron b/ransim/ransimctrlr/packages/base/src/files/etc/cron.d/logrotate.cron new file mode 100644 index 0000000..aa78eed --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/etc/cron.d/logrotate.cron @@ -0,0 +1 @@ +5 1 * * * /usr/sbin/logrotate -s ${{POLICY_HOME}}/var/logrotate.status ${{POLICY_HOME}}/etc/logrotate.d/monitor.conf diff --git a/ransim/ransimctrlr/packages/base/src/files/etc/cron.d/monitor.cron b/ransim/ransimctrlr/packages/base/src/files/etc/cron.d/monitor.cron new file mode 100644 index 0000000..4272bf4 --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/etc/cron.d/monitor.cron @@ -0,0 +1 @@ +* * * * * . ${{POLICY_HOME}}/etc/profile.d/env.sh; monitor.sh /dev/null 2>&1 diff --git a/ransim/ransimctrlr/packages/base/src/files/etc/monitor/monitor.cfg b/ransim/ransimctrlr/packages/base/src/files/etc/monitor/monitor.cfg new file mode 100644 index 0000000..64ef7d9 --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/etc/monitor/monitor.cfg @@ -0,0 +1,9 @@ +# Line Format: component=status where +# component=ransim and +# status=on|off|uninstalled where +# on: component is to be monitored and should started +# off: component is to be monitored and should stopped +# uninstalled: component is NOT to be monitored +# There should be no component duplicate lines + +ransim=uninstalled diff --git a/ransim/ransimctrlr/packages/base/src/files/etc/profile.d/env.sh b/ransim/ransimctrlr/packages/base/src/files/etc/profile.d/env.sh new file mode 100644 index 0000000..de0dcc0 --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/etc/profile.d/env.sh @@ -0,0 +1,25 @@ +### +# ============LICENSE_START======================================================= +# ONAP Policy Engine +# ================================================================================ +# Copyright (C) 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========================================================= +### + +export POLICY_HOME=${{POLICY_HOME}} +export POLICY_USER=${{POLICY_USER}} +export POLICY_GROUP=${{POLICY_GROUP}} +export KEYSTORE_PASSWD=${{KEYSTORE_PASSWD}} + +export JAVA_HOME=${{JAVA_HOME}} +export PATH=${PATH}:${{POLICY_HOME}}/bin diff --git a/ransim/ransimctrlr/packages/base/src/files/etc/profile.d/su.cfg b/ransim/ransimctrlr/packages/base/src/files/etc/profile.d/su.cfg new file mode 100644 index 0000000..8ba4edd --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/etc/profile.d/su.cfg @@ -0,0 +1 @@ +#name=value pairs for su purposes diff --git a/ransim/ransimctrlr/packages/base/src/files/install/mysql/data/181010_upgrade_script.sql b/ransim/ransimctrlr/packages/base/src/files/install/mysql/data/181010_upgrade_script.sql new file mode 100644 index 0000000..5f0548a --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/install/mysql/data/181010_upgrade_script.sql @@ -0,0 +1,33 @@ +/*- +* ============LICENSE_START======================================================= +* Ransim Controller DB +* ================================================================================ +* Copyright (C) 2020 Wipro Limited 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========================================================= +*/ + +CREATE DATABASE IF NOT EXISTS `ransim_db`; + +USE `ransim_db`; +set foreign_key_checks=0; + +-- +-- Increasing the Database variable timeouts +-- + +set wait_timeout=2147483; +set interactive_timeout=2147483; + +-- drop table if exists `constrainttype`; diff --git a/ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/conf/server.xml b/ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/conf/server.xml new file mode 100644 index 0000000..4738420 --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/conf/server.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/init.d/tomcatd b/ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/init.d/tomcatd new file mode 100644 index 0000000..df20485 --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/init.d/tomcatd @@ -0,0 +1,91 @@ +#!/bin/bash + +function update_monitor() { + COMPONENT=$1 + STATUS=$2 + if [[ -f ${POLICY_HOME}/etc/monitor/monitor.cfg ]]; then + /bin/sed -i.bak \ + -e "s/^${COMPONENT}=.*/${COMPONENT}=${STATUS}/g" \ + ${POLICY_HOME}/etc/monitor/monitor.cfg + fi +} + +# unmonitored stop, does not change monitor status (immutable) +function um_stop() { + cd ${TOMCAT_BASE}/bin/ + ${TOMCAT_BASE}/bin/catalina.sh stop -force + + # make sure .. + pid=$(pgrep -f -u ${POLICY_USER} "${TOMCAT_RUNNING}" 2> /dev/null) + RETVAL=$? + if [[ ${RETVAL} == 0 ]]; then + pkill -u ${POLICY_USER} -f "${TOMCAT_RUNNING}" -KILL + RETVAL=$? + fi +} + +function stop() { + um_stop + update_monitor ${{COMPONENT_TYPE}} off +} + +# unmonitored start, does not change monitor status (immutable) +function um_start() { + cd ${TOMCAT_BASE}/bin/ + ${TOMCAT_BASE}/bin/catalina.sh start + RETVAL=$? +} + +function start() { + um_start + if [[ ${RETVAL} != 0 ]]; then + update_monitor ${{COMPONENT_TYPE}} off + else + update_monitor ${{COMPONENT_TYPE}} on + fi +} + +TOMCAT_BASE=${POLICY_HOME}/servers/${{COMPONENT_TYPE}} +TOMCAT_RUNNING="^$JAVA_HOME/bin/java .* -Dcatalina.base=${TOMCAT_BASE} .* start$" + +PWD_ENTER=${PWD} +RETVAL=0 + +. ${POLICY_HOME}/etc/profile.d/env.sh + +case "$1" in + status) + pid=$(pgrep -f -u ${POLICY_USER} "${TOMCAT_RUNNING}" 2> /dev/null) + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + echo "running with pid ${pid}" + else + echo "stopped" + fi + ;; + restart) + stop + sleep 2 + start + ;; + start) + start + ;; + umstart) + um_start + ;; + stop) + stop + ;; + umstop) + um_stop + ;; + *) + cd ${TOMCAT_BASE}/bin/ + ${TOMCAT_BASE}/bin/catalina.sh "$@" + RETVAL=$? + ;; +esac + +cd ${PWD_ENTER} +exit ${RETVAL} diff --git a/ransim/ransimctrlr/packages/base/src/files/install/servers/configs/conf/server.xml b/ransim/ransimctrlr/packages/base/src/files/install/servers/configs/conf/server.xml new file mode 100644 index 0000000..7f45094 --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/install/servers/configs/conf/server.xml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ransim/ransimctrlr/packages/base/src/files/m2/settings.xml b/ransim/ransimctrlr/packages/base/src/files/m2/settings.xml new file mode 100644 index 0000000..89edce1 --- /dev/null +++ b/ransim/ransimctrlr/packages/base/src/files/m2/settings.xml @@ -0,0 +1,116 @@ + + + + + + + + + ransimapp-profile + + true + + + + + ${{snapshotRepositoryID}} + ${{snapshotRepositoryURL}} + + false + always + + + true + always + + + + onap-releases + onap-releases + https://nexus.onap.org/content/repositories/releases/ + + true + + + false + + + + onap-staging + onap-staging + https://nexus.onap.org/content/repositories/staging/ + + true + always + + + false + + + + onap-snapshots + onap-snapshots + https://nexus.onap.org/content/repositories/snapshots/ + + false + + + true + always + + + + ${{releaseRepositoryID}} + ${{releaseRepositoryURL}} + + true + always + + + false + always + + + + + + + + + ransimapp-profile + + + + + ${{snapshotRepositoryID}} + ${{repositoryUsername}} + ${{repositoryPassword}} + + + ${{releaseRepositoryID}} + ${{repositoryUsername}} + ${{repositoryPassword}} + + + + -- cgit 1.2.3-korg