diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2017-02-14 19:41:00 -0500 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2017-02-14 19:41:32 -0500 |
commit | 91d04c64771832a0b8815ffbe1f0f9920320d94d (patch) | |
tree | fb02d5e1c84a3d91def9a7ee95bc87f9c046cc96 /packages/base/src/files/install/servers/brmsgw | |
parent | b9d4caa40ef8e3566ac475968bce17b9b64b6939 (diff) |
Initial OpenECOMP policy/engine commit
Change-Id: I7dbff37733b661643dd4d1caefa3d7dccc361b6e
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'packages/base/src/files/install/servers/brmsgw')
4 files changed, 287 insertions, 0 deletions
diff --git a/packages/base/src/files/install/servers/brmsgw/client.properties b/packages/base/src/files/install/servers/brmsgw/client.properties new file mode 100644 index 000000000..0b8dc258e --- /dev/null +++ b/packages/base/src/files/install/servers/brmsgw/client.properties @@ -0,0 +1,22 @@ +### +# ============LICENSE_START======================================================= +# ECOMP 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========================================================= +### + +python=test,MASTER +PyPDPServer=test,MASTER
\ No newline at end of file diff --git a/packages/base/src/files/install/servers/brmsgw/config.properties b/packages/base/src/files/install/servers/brmsgw/config.properties new file mode 100644 index 000000000..f46a27840 --- /dev/null +++ b/packages/base/src/files/install/servers/brmsgw/config.properties @@ -0,0 +1,87 @@ +### +# ============LICENSE_START======================================================= +# ECOMP 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========================================================= +### + +BRMSGW_JMX_PORT=${{BRMSGW_JMX_PORT}} +COMPONENT_X_MX_MB=${{COMPONENT_X_MX_MB}} +COMPONENT_X_MS_MB=${{COMPONENT_X_MS_MB}} + +PDP_URL = ${{REST_PDP_ID}} , ${{PDP_HTTP_USER_ID}} , ${{PDP_HTTP_PASSWORD}} +PAP_URL = ${{REST_PAP_URL}} , ${{PDP_PAP_PDP_HTTP_USER_ID}} , ${{PDP_PAP_PDP_HTTP_PASSWORD}} +NOTIFICATION_TYPE=websocket +NOTIFICATION_UEB_SERVERS= +CLIENT_ID=${{CLIENT_ID}} +CLIENT_KEY=${{CLIENT_KEY}} +# Environment should be Set either DEV, TEST or PROD +ENVIRONMENT=${{ENVIRONMENT}} + +# BRMS Properties. +## defaultName is the default group name to which the rule gets pushed if no artifactID is specified. +defaultName = default +## repositoryID +repositoryID = ${{releaseRepositoryID}} +## reposiroryName +repositoryName = ${{releaseRepositoryName}} +## repositoryURL +repositoryURL = ${{releaseRepositoryURL}} +repositoryUsername = ${{repositoryUsername}} +repositoryPassword = ${{repositoryPassword}} +## policyKeyID the value of Policy Key whose value will be the group Name. +policyKeyID = controller +# UEB Notification Details. +UEB_URL=${{UEB_URL}} +UEB_TOPIC=${{UEB_TOPIC}} +UEB_API_KEY=${{UEB_API_KEY}} +UEB_API_SECRET=${{UEB_API_SECRET}} +## GroupNames can be comma separated values. +groupNames = default, vFW , vDNS + +default.groupID = ${{groupID}} +default.artifactID = ${{artifactID}} +vFW.groupID= ${{VFW_GROUP_ID}} +vFW.artifactID= ${{VFW_ARTIFACT_ID}} +vDNS.groupID= ${{VDNS_GROUP_ID}} +vDNS.artifactID= ${{VDNS_ARTIFACT_ID}} + +#Integrity Monitor values +#database driver for Integrity Monitor +javax.persistence.jdbc.driver=${{JDBC_DRIVER}} +#database URL for Integrity Monitor +javax.persistence.jdbc.url=${{JDBC_URL}} +#database username for Integrity Monitor +javax.persistence.jdbc.user=${{JDBC_USER}} +#database password for Integrity Monitor +javax.persistence.jdbc.password=${{JDBC_PASSWORD}} +#resource name +RESOURCE_NAME=${{resource_name}} +#***Properties for IntegrityMonitor integration defined in IntegrityMonitorProperties.java*** +site_name=${{site_name}} +node_type=${{node_type}} +fp_monitor_interval=${{fp_monitor_interval}} +failed_counter_threshold=${{failed_counter_threshold}} +test_trans_interval=${{test_trans_interval}} +write_fpc_interval=${{write_fpc_interval}} +max_fpc_update_interval=${{max_fpc_update_interval}} +test_via_jmx=${{test_via_jmx}} + +ping_interval=30000 + +brms.dependency.version=1.0.0-SNAPSHOT + +CLIENT_FILE=client.properties diff --git a/packages/base/src/files/install/servers/brmsgw/config/policyLogger.properties b/packages/base/src/files/install/servers/brmsgw/config/policyLogger.properties new file mode 100644 index 000000000..0deb1b3d6 --- /dev/null +++ b/packages/base/src/files/install/servers/brmsgw/config/policyLogger.properties @@ -0,0 +1,44 @@ +### +# ============LICENSE_START======================================================= +# ECOMP 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========================================================= +### + +################################### Set concurrentHashMap and timer info ####################### +#Timer initial delay and the delay between in milliseconds before task is to be execute. +timer.delay.time=1000 +#Timer scheduleAtFixedRate period - time in milliseconds between successive task executions. +check.interval= 30000 +#Longest time an event info can be stored in the concurrentHashMap for logging - in seconds. +event.expired.time=86400 +#Size of the concurrentHashMap which stores the event starting time, etc - when its size reaches this limit, the Timer gets executed +#to remove all expired records from this concurrentHashMap. +concurrentHashMap.limit=5000 +#Size of the concurrentHashMap - when its size drops to this point, stop the Timer +stop.check.point=2500 +################################### Set logging format ############################################# +# set EELF for EELF logging format, set LOG4J for using log4j, set SYSTEMOUT for using system.out.println +logger.type=EELF +#################################### Set level for EELF or SYSTEMOUT logging ################################## +# Set level for debug file. Set DEBUG to enable .info, .warn and .debug; set INFO for enable .info and .warn; set OFF to disable all +debugLogger.level=INFO +# Set level for metrics file. Set OFF to disable; set ON to enable +metricsLogger.level=ON +# Set level for error file. Set OFF to disable; set ON to enable +error.level=ON +# Set level for audit file. Set OFF to disable; set ON to enable +audit.level=ON diff --git a/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw b/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw new file mode 100644 index 000000000..c3b406b42 --- /dev/null +++ b/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw @@ -0,0 +1,134 @@ +#!/bin/bash + +BRMSGW_BASE=${POLICY_HOME}/servers/brmsgw/ +COMPONENT=brmsgw +brmsgw_RUNNING="pgrep -f "${BRMSGW_BASE}"" + +RETVAL=0 + +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() { + pid=$(pgrep -f "${BRMSGW_BASE}" 2> /dev/null) + kill -9 "${pid}" + RETVAL=$? +} + +function stop() { + um_stop + if [[ ${RETVAL} != 0 ]]; then + update_monitor ${COMPONENT} on + else + update_monitor ${COMPONENT} off + fi +} + +# unmonitored start, does not change monitor status (immutable) +function um_start() { + unset JMX_JAVA_OPTS JVM_SECURITY + JMX_JAVA_OPTS+=("-Dcom.sun.management.jmxremote") + JMX_JAVA_OPTS+=("-Dcom.sun.management.jmxremote.port=$BRMSGW_JMX_PORT") + JMX_JAVA_OPTS+=("-Dcom.sun.management.jmxremote.ssl=false") + JMX_JAVA_OPTS+=("-Dcom.sun.management.jmxremote.authenticate=false") + JVM_JAVA_OPTS=("-Xms${COMPONENT_X_MS_MB}M" "-Xmx${COMPONENT_X_MX_MB}M") + JVM_SECURITY+=("-Djavax.net.ssl.keyStore=${POLICY_HOME}/etc/ssl/policy-keystore") + JVM_SECURITY+=("-Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWD}") + JVM_SECURITY+=("-Djavax.net.ssl.trustStore=${POLICY_HOME}/etc/ssl/policy-keystore") + JVM_SECURITY+=("-Djavax.net.ssl.trustStorePassword=${KEYSTORE_PASSWD}") + + JAVA_OPTS=("${JVM_JAVA_OPTS[@]}" "${JMX_JAVA_OPTS[@]}" "${JVM_SECURITY[@]}") + + cd $POLICY_HOME/servers/brmsgw + nohup $JAVA_HOME/bin/java -jar "${JAVA_OPTS[@]}" $POLICY_HOME/servers/brmsgw/BRMSGateway.jar>> $POLICY_HOME/logs/brmsgw.log 2>&1 & + RETVAL=$? +} + +function start() { + um_start + if [[ ${RETVAL} != 0 ]]; then + update_monitor ${COMPONENT} off + else + update_monitor ${COMPONENT} on + fi +} + +function status() { + # check status + pid=$(pgrep -f "${BRMSGW_BASE}" 2> /dev/null) + RETVAL=$? + + # If the PID was returned means the application is running + if [ ${RETVAL} -eq 0 ]; then + echo "running with pid ${pid}" + else + echo "stopped" + fi +} + + +# main + +COMPONENT=$(basename $0) + +CONF_FILE="${POLICY_HOME}/servers/${COMPONENT}/config.properties" + +# read properties + +shopt -s extglob +configfile="dos_or_unix" # set the actual path name of your (DOS or Unix) config file +while IFS='= ' read lhs rhs +do + if [[ ! $lhs =~ ^\ *# && -n $lhs ]]; then + rhs="${rhs%%\#*}" # Del in line right comments + rhs="${rhs%%*( )}" # Del trailing spaces + rhs="${rhs%\"*}" # Del opening string quotes + rhs="${rhs#\"*}" # Del closing string quotes + if [[ $lhs != *"."* ]]; then + declare $lhs="$rhs" + fi + fi +done < "${CONF_FILE}" + + +if [ $? -ne 0 ]; then + echo "error: cannot source configuration ${CONF_FILE}" + exit 1 +fi + +case "$1" in + status) + status + ;; + restart) + stop + sleep 2 + start + ;; + start) + start + ;; + umstart) + um_start + ;; + stop) + stop + ;; + umstop) + um_stop + ;; + *) + echo "error: invalid option $@" + RETVAL=1 + ;; +esac + +exit ${RETVAL} |