From 126102491526b5ba06092855b84ffe359b117df0 Mon Sep 17 00:00:00 2001 From: Mandeep Khinda Date: Thu, 14 Sep 2017 11:37:33 +0000 Subject: [PATCH] move policy config to onap 1.1 was the cause of the robot failure for policy in oom Issue-ID: OOM-297 Change-Id: Iabb24cc7a007ef852cde3ebe2cbb9226bb4153b3 Signed-off-by: Mandeep Khinda Signed-off-by: Ahmed Alabulrahman --- .../policy/opt/policy/config/drools/base.conf | 91 ++++++++++------ .../opt/policy/config/drools/drools-tweaks.sh | 47 ++++---- .../policy/config/drools/feature-healthcheck.conf | 2 + .../config/policy/opt/policy/config/pe/base.conf | 8 +- .../policy/opt/policy/config/pe/brmsgw-tweaks.sh | 22 +++- .../config/policy/opt/policy/config/pe/brmsgw.conf | 23 +++- .../policy/opt/policy/config/pe/console.conf | 43 ++++---- .../config/policy/opt/policy/config/pe/elk.conf | 3 + .../policy/opt/policy/config/pe/pap-tweaks.sh | 14 --- .../config/policy/opt/policy/config/pe/pdp.conf | 19 +++- .../policy/opt/policy/config/pe/push-policies.sh | 121 +++++++++++++++++++++ .../policy/opt/policy/config/pe/pypdp-tweaks.sh | 3 - kubernetes/policy/templates/all-services.yaml | 16 --- kubernetes/policy/templates/dep-maria.yaml | 7 +- kubernetes/policy/templates/dep-nexus.yaml | 6 +- kubernetes/policy/values.yaml | 8 +- 16 files changed, 289 insertions(+), 144 deletions(-) create mode 100644 kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/feature-healthcheck.conf create mode 100644 kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/elk.conf create mode 100644 kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/push-policies.sh delete mode 100755 kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/pypdp-tweaks.sh diff --git a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/base.conf b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/base.conf index 164c03821c..f531c0fa85 100755 --- a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/base.conf +++ b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/base.conf @@ -1,43 +1,39 @@ +### +# ============LICENSE_START======================================================= +# ONAP POLICY +# ================================================================================ +# 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========================================================= +### + + +# SYSTEM software configuration + POLICY_HOME=/opt/app/policy JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 KEYSTORE_PASSWD=PolicyR0ck$ +# Telemetry credentials + ENGINE_MANAGEMENT_PORT=9696 ENGINE_MANAGEMENT_HOST=localhost ENGINE_MANAGEMENT_USER=@1b3rt -ENGINE_MANAGEMENT_PASSWORD=31nst@1n - -JDBC_DRIVER=org.mariadb.jdbc.Driver -JDBC_URL=jdbc:mysql://mariadb.onap-policy:3306/ecomp_sdk -JDBC_DROOLS_URL=jdbc:mysql://mariadb.onap-policy:3306/drools -JDBC_USER=policy_user -JDBC_PASSWORD=policy_user - -# Integrity Monitor properties -site_name=site_1 -fp_monitor_interval=30 -failed_counter_threshold=3 -test_trans_interval=20 -write_fpc_interval=5 -max_fpc_update_interval=60 -test_via_jmx=false -jmx_fqdn= -node_type=pdp_drools -# Dependency groups are groups of resources upon which a node operational state is dependent upon. -# Each group is a comma-separated list of resource names and groups are separated by a semicolon. -dependency_groups= -resource_name=pdpd_1 - -# The (optional) period of time in seconds between executions of the integrity audit. -# Value < 0 : Audit does not run (default value if property is not present = -1) -# Value = 0 : Audit runs continuously -# Value > 0 : The period of time in seconds between execution of the audit on a particular node -integrity_audit_period_seconds=-1 - -host_port=0.0.0.0:9981 - -# To use a Nexus repository for rules artifacts, -# following properties must be uncommented and set: +ENGINE_MANAGEMENT_PASSWORD=31nst31n + +# nexus repository + snapshotRepositoryID=policy-nexus-snapshots snapshotRepositoryUrl=http://nexus:8081/nexus/content/repositories/snapshots/ releaseRepositoryID=policy-nexus-releases @@ -45,6 +41,14 @@ releaseRepositoryUrl=http://nexus:8081/nexus/content/repositories/releases/ repositoryUsername=admin repositoryPassword=admin123 +# Relational (SQL) DB access + +SQL_HOST=mariadb.onap-policy +SQL_USER=policy_user +SQL_PASSWORD=policy_user + +# PDP-D DMaaP configuration channel + PDPD_CONFIGURATION_TOPIC=PDPD-CONFIGURATION PDPD_CONFIGURATION_SERVERS=dmaap.onap-message-router PDPD_CONFIGURATION_API_KEY= @@ -52,3 +56,24 @@ PDPD_CONFIGURATION_API_SECRET= PDPD_CONFIGURATION_CONSUMER_GROUP= PDPD_CONFIGURATION_CONSUMER_INSTANCE= PDPD_CONFIGURATION_PARTITION_KEY= + +# PAP + +PAP_HOST=pap.onap-policy +PAP_USERNAME=testpap +PAP_PASSWORD=alpha123 + +# PDP-X + +PDP_HOST=pdp.onap-policy +PDP_USERNAME=testpdp +PDP_PASSWORD=alpha123 + +# DCAE DMaaP + +DCAE_TOPIC=unauthenticated.TCA_EVENT_OUTPUT +DCAE_SERVERS=dcae-controller.onap-dcae + +# Open DMaaP + +DMAAP_SERVERS=dmaap.onap-message-router diff --git a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/drools-tweaks.sh b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/drools-tweaks.sh index edf5e9d563..8bff59c2e7 100755 --- a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/drools-tweaks.sh +++ b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/drools-tweaks.sh @@ -1,30 +1,23 @@ #! /bin/bash -# changes for health check -options enable policy-healthcheck -sedArgs=("-i") -while read var value ; do - if [[ "${var}" == "" ]] ; then - continue - fi - sedArgs+=("-e" "s@\${{${var}}}@${value}@g") -done <<-EOF - PAP_HOST pap - PAP_USERNAME testpap - PAP_PASSWORD alpha123 - PDP_HOST pdp - PDP_USERNAME testpdp - PDP_PASSWORD alpha123 -EOF +### +# ============LICENSE_START======================================================= +# ONAP +# ================================================================================ +# 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========================================================= +### -# convert file -sed "${sedArgs[@]}" ${POLICY_HOME}/config/*health* - -cat >>${POLICY_HOME}/config/*health* <<-'EOF' - http.server.services.HEALTHCHECK.userName=healthcheck - http.server.services.HEALTHCHECK.password=zb!XztG34 -EOF - -sed -i -e 's/DCAE-CL-EVENT/unauthenticated.TCA_EVENT_OUTPUT/' \ - -e '/TCA_EVENT_OUTPUT\.servers/s/servers=.*$/servers=10.0.4.102/' \ - $POLICY_HOME/config/v*-controller.properties +${POLICY_HOME}/bin/features enable healthcheck diff --git a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/feature-healthcheck.conf b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/feature-healthcheck.conf new file mode 100644 index 0000000000..31baed21e3 --- /dev/null +++ b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/drools/feature-healthcheck.conf @@ -0,0 +1,2 @@ +HEALTHCHECK_USER=healthcheck +HEALTHCHECK_PASSWORD=zb!XztG34 diff --git a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/base.conf b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/base.conf index bd4b433179..9c87d9ca72 100755 --- a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/base.conf +++ b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/base.conf @@ -3,8 +3,8 @@ POLICY_HOME=/opt/app/policy KEYSTORE_PASSWD=PolicyR0ck$ JDBC_DRIVER=org.mariadb.jdbc.Driver -JDBC_URL=jdbc:mariadb://mariadb.onap-policy:3306/ecomp_sdk -JDBC_LOG_URL=jdbc:mariadb://mariadb.onap-policy:3306/log +JDBC_URL=jdbc:mariadb://mariadb.onap-policy:3306/onap_sdk?failOverReadOnly=false&autoReconnect=true +JDBC_LOG_URL=jdbc:mariadb://mariadb.onap-policy:3306/log?failOverReadOnly=false&autoReconnect=true JDBC_USER=policy_user JDBC_PASSWORD=policy_user @@ -18,3 +18,7 @@ test_via_jmx=false jmx_fqdn= ENVIRONMENT=TEST + +#Micro Service Model Properties +policy_msOnapName= +policy_msPolicyName= \ No newline at end of file diff --git a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/brmsgw-tweaks.sh b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/brmsgw-tweaks.sh index 350b9c7039..d318d4d189 100755 --- a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/brmsgw-tweaks.sh +++ b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/brmsgw-tweaks.sh @@ -13,14 +13,26 @@ fi source "${POLICY_HOME}/etc/build.info" +if [ -z "${version}" ]; then + echo "error: no version information present" + exit 1 +fi + for CONFIG in ${PROPS_RUNTIME} ${PROPS_INSTALL}; do if [ ! -f "${CONFIG}" ]; then echo "warning: configuration does not exist: ${CONFIG}" else - if [ -n "${version}" ]; then - /bin/sed -i -e "s/brms.dependency.version=.*/brms.dependency.version=${version}/g" "${CONFIG}" - else - echo "error: no version information present" - fi + sed -i -e "s/brms.dependency.version=.*/brms.dependency.version=${version}/g" "${CONFIG}" + fi +done + +DEPS_JSON_RUNTIME="${POLICY_HOME}/servers/brmsgw/dependency.json" +DEPS_JSON_INSTALL="${POLICY_HOME}/install/servers/brmsgw/dependency.json" + +for DEP in ${DEPS_JSON_RUNTIME} ${DEPS_JSON_INSTALL}; do + if [ ! -f "${DEP}" ]; then + echo "warning: configuration does not exist: ${DEP}" + else + sed -i -e "s/\"version\":.*/\"version\": \"${version}\"/g" "${DEP}" fi done diff --git a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/brmsgw.conf b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/brmsgw.conf index 8c70090550..3cafc32a4c 100755 --- a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/brmsgw.conf +++ b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/brmsgw.conf @@ -26,11 +26,11 @@ UEB_TOPIC=PDPD-CONFIGURATION UEB_API_KEY= UEB_API_SECRET= -groupID=org.openecomp.policy-engine +groupID=org.onap.policy-engine artifactID=drlPDPGroup -VFW_GROUP_ID=org.openecomp.policy-engine.drools.vFW +VFW_GROUP_ID=org.onap.policy-engine.drools.vFW VFW_ARTIFACT_ID=policy-vFW-rules -VDNS_GROUP_ID=org.openecomp.policy-engine.drools.vDNS +VDNS_GROUP_ID=org.onap.policy-engine.drools.vDNS VDNS_ARTIFACT_ID=policy-vDNS-rules @@ -38,6 +38,19 @@ VDNS_ARTIFACT_ID=policy-vDNS-rules resource_name=brmsgw_1 node_type=brms_gateway -CLIENT_ID=PyPDPServer -CLIENT_KEY=test +#Environment should be Set either DEV, TEST or PROD ENVIRONMENT=TEST + +#Notification Properties... type can be either websocket, ueb, or dmaap +BRMS_NOTIFICATION_TYPE=websocket +BRMS_UEB_URL=dmaap.onap-message-router +BRMS_UEB_TOPIC=PDPD-CONFIGURATION +BRMS_UEB_DELAY= +BRMS_CLIENT_ID=python +BRMS_CLIENT_KEY=dGVzdA== +BRMS_UEB_API_KEY= +BRMS_UEB_API_SECRET= + +#Dependency.json file version +BRMS_DEPENDENCY_VERSION=1.1.0-SNAPSHOT + diff --git a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/console.conf b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/console.conf index 35867eb220..d5be80a675 100755 --- a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/console.conf +++ b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/console.conf @@ -77,7 +77,7 @@ REFRESH_RATE=40000 # -REST_PAP_URL=http://pap:9091/pap/ +REST_PAP_URL=http://pap.onap-policy:9091/pap/ # # Config/Action Properties location. @@ -102,7 +102,7 @@ resource_name=console_1 # Value > 0 : The period of time in seconds between execution of the audit on a particular node integrity_audit_period_seconds=-1 -#Automatic Policy Distribution +#Automatic Policy Distribution automatic_push=false #Diff of policies for Firewall feature @@ -112,24 +112,21 @@ FW_PROXY= FW_PORT= #SMTP Server Details for Java Mail -ecomp_smtp_host= -ecomp_smtp_port=25 -ecomp_smtp_userName= -ecomp_smtp_password= -ecomp_application_name= - -#-----------------------ECOMP-PORTAL-Properties---------------------- - -ECOMP_REDIRECT_URL=http://portalapps.onap-portal:8989/ECOMPPORTAL/login.htm -ECOMP_REST_URL= -ECOMP_UEB_URL_LIST= -ECOMP_PORTAL_INBOX_NAME= -ECOMP_UEB_APP_KEY= -ECOMP_UEB_APP_SECRET= -ECOMP_UEB_APP_MAILBOX_NAME= -APP_DISPLAY_NAME=OpenECOMP Policy -ECOMP_SHARED_CONTEXT_REST_URL=http://portalapps.onap-portal:8989/ECOMPPORTAL/context - -#Add the Rest PAP url and pap auth password on adding delimiter @Auth@ - -REST_PAPURL_WITH_AUTH_PASSWORD=http://pap.onap-policy:9091/pap/@Auth@dGVzdHBhcDphbHBoYTEyMw== +onap_smtp_host= +onap_smtp_port=25 +onap_smtp_userName= +onap_smtp_password= +onap_smtp_emailExtension= +onap_application_name= + +#-----------------------ONAP-PORTAL-Properties---------------------- + +ONAP_REDIRECT_URL=http://portalapps.onap-portal:8989/ECOMPPORTAL/login.htm +ONAP_REST_URL= +ONAP_UEB_URL_LIST= +ONAP_PORTAL_INBOX_NAME= +ONAP_UEB_APP_KEY= +ONAP_UEB_APP_SECRET= +ONAP_UEB_APP_MAILBOX_NAME= +APP_DISPLAY_NAME=ONAP Policy +ONAP_SHARED_CONTEXT_REST_URL=http://portalapps.onap-portal:8989/ECOMPPORTAL/context diff --git a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/elk.conf b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/elk.conf new file mode 100644 index 0000000000..938954ce63 --- /dev/null +++ b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/elk.conf @@ -0,0 +1,3 @@ +# elasticsearch + +ELK_JMX_PORT=9995 \ No newline at end of file diff --git a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/pap-tweaks.sh b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/pap-tweaks.sh index be8a905af0..36ac3689b1 100755 --- a/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/pap-tweaks.sh +++ b/kubernetes/config/docker/init/src/config/policy/opt/policy/config/pe/pap-tweaks.sh @@ -1,15 +1 @@ #! /bin/bash - -# config directory may contain an ip_addr.txt file that specifies -# the VM IP address. Substitute this value in the URL in the -# config.json file, overriding the hostname that came from the -# REST_PAPURL_WITH_AUTH_PASSWORD property in console.conf. This is -# to avoid hardcoding an IP address in console.conf that can change -# from one VM instance to the next. - -if [[ -f config/ip_addr.txt ]]; then - vm_ip=$(