diff options
author | Jim Hahn <jrh3@att.com> | 2020-04-15 08:43:54 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-04-15 17:12:53 -0400 |
commit | f340ddbd8422bf51dd537b851ebda62d25b1826f (patch) | |
tree | 30bf3be7a8032caee114234d08aba199ea08b008 /scripts | |
parent | 426ddc1c61efc12b95aa1013d9137411a4e46d5e (diff) |
End-to-end policy CSIT
Modified the CSIT for drools-apps to use more components:
- api to create policies
- pap to deploy policies
Also removed tabs.
Issue-ID: POLICY-2491
Change-Id: Iacd8d1953068bb718a63de8813dd1c307c21b1f8
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'scripts')
15 files changed, 164 insertions, 303 deletions
diff --git a/scripts/policy/drools-apps/activate.drools.json b/scripts/policy/drools-apps/activate.drools.json deleted file mode 100644 index 681bf6ab..00000000 --- a/scripts/policy/drools-apps/activate.drools.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "messageName": "PDP_STATE_CHANGE", - "requestId": "88891208-2a73-452c-8d71-c93b422a7e03", - "timestampMs": 1584652299629, - "name": "drools", - "pdpGroup": "defaultGroup", - "pdpSubgroup": "drools", - "state": "ACTIVE" -} diff --git a/scripts/policy/drools-apps/activate.xacml.json b/scripts/policy/drools-apps/activate.xacml.json deleted file mode 100644 index 1ee79c26..00000000 --- a/scripts/policy/drools-apps/activate.xacml.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "messageName": "PDP_STATE_CHANGE", - "requestId": "88891208-2a73-452c-8d71-c93b422a7e03", - "timestampMs": 1584652299629, - "name": "policy-xacml-pdp", - "pdpGroup": "defaultGroup", - "pdpSubgroup": "xacml", - "state": "ACTIVE" -} diff --git a/scripts/policy/drools-apps/custom/logback.xml b/scripts/policy/drools-apps/custom/logback.xml deleted file mode 100644 index 7f20cfc0..00000000 --- a/scripts/policy/drools-apps/custom/logback.xml +++ /dev/null @@ -1,104 +0,0 @@ -<!-- - ============LICENSE_START=================================================== - Copyright (C) 2020 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===================================================== ---> - -<configuration scan="true" scanPeriod="30 seconds" debug="false"> - - <property name="logDir" value="${POLICY_LOGS}" /> - - <property name="errorLog" value="error" /> - <property name="debugLog" value="debug" /> - <property name="networkLog" value="network" /> - - <property name="debugPattern" - value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%level|%logger{0}|%thread] %msg%n" /> - <property name="errorPattern" value="${debugPattern}" /> - <property name="networkPattern" value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%t]%m%n" /> - - <appender name="ErrorOut" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDir}/${errorLog}.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logDir}/${errorLog}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>30</maxHistory> - <totalSizeCap>10GB</totalSizeCap> - </rollingPolicy> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> - <level>WARN</level> - </filter> - <encoder> - <pattern>${errorPattern}</pattern> - </encoder> - </appender> - - <appender name="AsyncErrorOut" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="ErrorOut" /> - </appender> - - <appender name="DebugOut" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDir}/${debugLog}.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logDir}/${debugLog}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>30</maxHistory> - <totalSizeCap>10GB</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>${debugPattern}</pattern> - </encoder> - </appender> - - <appender name="AsyncDebugOut" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="DebugOut" /> - </appender> - - <appender name="NetworkOut" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDir}/${networkLog}.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logDir}/${networkLog}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>30</maxHistory> - <totalSizeCap>10GB</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>${networkPattern}</pattern> - </encoder> - </appender> - - <appender name="AsyncNetworkOut" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="NetworkOut" /> - </appender> - - <logger name="network" level="INFO" additivity="false"> - <appender-ref ref="AsyncNetworkOut" /> - </logger> - - <logger name="org.eclipse.jetty.server.RequestLog" level="info" additivity="false"> - <appender-ref ref="AsyncNetworkOut" /> - </logger> - - <logger name="org.eclipse.jetty" level="ERROR" /> - - <root level="INFO"> - <appender-ref ref="AsyncDebugOut" /> - <appender-ref ref="AsyncErrorOut" /> - </root> - -</configuration> diff --git a/scripts/policy/drools-apps/custom/papDefaultConfig.json b/scripts/policy/drools-apps/custom/papDefaultConfig.json new file mode 100644 index 00000000..2575d8a5 --- /dev/null +++ b/scripts/policy/drools-apps/custom/papDefaultConfig.json @@ -0,0 +1,64 @@ +{ + "name": "PapGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": true, + "aaf": false + }, + "pdpParameters": { + "heartBeatMs": 120000, + "updateParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + }, + "stateChangeParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.mariadb.jdbc.Driver", + "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin", + "databaseUser": "policy_user", + "databasePassword": "cG9saWN5X3VzZXI=", + "persistenceUnit": "PolicyMariaDb" + }, + "topicParameterGroup": { + "topicSources" : [{ + "topic" : "POLICY-PDP-PAP", + "servers" : [ "policy.api.simpledemo.onap.org" ], + "topicCommInfrastructure" : "dmaap", + "useHttps": true, + "allowSelfSignedCerts" : true + }], + "topicSinks" : [{ + "topic" : "POLICY-PDP-PAP", + "servers" : [ "policy.api.simpledemo.onap.org" ], + "topicCommInfrastructure" : "dmaap", + "useHttps": true, + "allowSelfSignedCerts" : true + }, + { + "topic" : "POLICY-NOTIFICATION", + "servers" : [ "policy.api.simpledemo.onap.org" ], + "topicCommInfrastructure" : "dmaap", + "useHttps": true, + "allowSelfSignedCerts" : true + }] + }, + "healthCheckRestClientParameters":[{ + "clientName": "api", + "hostname": "policy-api", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "useHttps": true, + "allowSelfSignedCerts" : true, + "basePath": "policy/api/v1/healthcheck" + }] +} diff --git a/scripts/policy/drools-apps/custom/ssl/policy-keystore b/scripts/policy/drools-apps/custom/ssl/policy-keystore Binary files differdeleted file mode 100644 index 389df5fe..00000000 --- a/scripts/policy/drools-apps/custom/ssl/policy-keystore +++ /dev/null diff --git a/scripts/policy/drools-apps/custom/ssl/policy-truststore b/scripts/policy/drools-apps/custom/ssl/policy-truststore Binary files differdeleted file mode 100644 index 8834ac25..00000000 --- a/scripts/policy/drools-apps/custom/ssl/policy-truststore +++ /dev/null diff --git a/scripts/policy/drools-apps/custom/defaultConfig.json b/scripts/policy/drools-apps/custom/xacmlDefaultConfig.json index 5a6573a3..5a6573a3 100644 --- a/scripts/policy/drools-apps/custom/defaultConfig.json +++ b/scripts/policy/drools-apps/custom/xacmlDefaultConfig.json diff --git a/scripts/policy/drools-apps/deploy.drools.policies.json b/scripts/policy/drools-apps/deploy.drools.policies.json new file mode 100644 index 00000000..24c90d0d --- /dev/null +++ b/scripts/policy/drools-apps/deploy.drools.policies.json @@ -0,0 +1,27 @@ +{ + "groups": [ + { + "name": "defaultGroup", + "deploymentSubgroups": [ + { + "pdpType": "drools", + "action": "POST", + "policies": [ + { + "name": "operational.restart", + "version": "1.0.0" + }, + { + "name": "operational.scaleout", + "version": "1.0.0" + }, + { + "name": "operational.modifyconfig", + "version": "1.0.0" + } + ] + } + ] + } + ] +} diff --git a/scripts/policy/drools-apps/deploy.xacml.policies.json b/scripts/policy/drools-apps/deploy.xacml.policies.json new file mode 100644 index 00000000..46da9021 --- /dev/null +++ b/scripts/policy/drools-apps/deploy.xacml.policies.json @@ -0,0 +1,27 @@ +{ + "groups": [ + { + "name": "defaultGroup", + "deploymentSubgroups": [ + { + "pdpType": "xacml", + "action": "POST", + "policies": [ + { + "name": "onap.restart.tca", + "version": "1.0.0" + }, + { + "name": "onap.scaleout.tca", + "version": "1.0.0" + }, + { + "name": "onap.vfirewall.tca", + "version": "1.0.0" + } + ] + } + ] + } + ] +} diff --git a/scripts/policy/drools-apps/docker-compose-drools-apps.yml b/scripts/policy/drools-apps/docker-compose-drools-apps.yml index 076157f4..5098a177 100644 --- a/scripts/policy/drools-apps/docker-compose-drools-apps.yml +++ b/scripts/policy/drools-apps/docker-compose-drools-apps.yml @@ -39,6 +39,24 @@ services: - 6669 - 6670 - 3905 + api: + image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} + container_name: policy-api + depends_on: + - mariadb + hostname: policy-api + expose: + - 6969 + pap: + image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} + container_name: policy-pap + depends_on: + - mariadb + hostname: policy-pap + expose: + - 6969 + volumes: + - ./custom/papDefaultConfig.json:/opt/app/policy/pap/etc/defaultConfig.json:ro policy-xacml-pdp: image: nexus3.onap.org:10001/onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} container_name: policy-xacml-pdp @@ -49,7 +67,7 @@ services: expose: - 6969 volumes: - - ./custom:/opt/app/policy/pdpx/etc:ro + - ./custom/xacmlDefaultConfig.json:/opt/app/policy/pdpx/etc/defaultConfig.json:ro drools: image: nexus3.onap.org:10001/onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION} container_name: drools @@ -82,6 +100,20 @@ services: policy.api.simpledemo.onap.org:6669 policy.api.simpledemo.onap.org:6670 policy.api.simpledemo.onap.org:3905 + start_pap: + image: dadarek/wait-for-dependencies + environment: + TIMEOUT_LENGTH: 120 + container_name: policy-wait-pap + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - pap + hostname: policy-wait-pap + command: + mariadb:3306 + policy.api.simpledemo.onap.org:3905 + pap:6969 start_all: image: dadarek/wait-for-dependencies environment: @@ -90,6 +122,8 @@ services: depends_on: - mariadb - policy.api.simpledemo.onap.org + - api + - pap - policy-xacml-pdp - drools hostname: policy-wait-all @@ -100,4 +134,6 @@ services: policy.api.simpledemo.onap.org:6669 policy.api.simpledemo.onap.org:6670 policy.api.simpledemo.onap.org:3905 + api:6969 + pap:6969 drools:6969 diff --git a/scripts/policy/drools-apps/manage.sh b/scripts/policy/drools-apps/manage.sh deleted file mode 100755 index 36352385..00000000 --- a/scripts/policy/drools-apps/manage.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# ===========LICENSE_START==================================================== -# Copyright (C) 2020 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===================================================== -# - -# -# Injects a management request on the PDP-PAP topic. -# - -if [ $# -ne 1 ] -then - echo "arg(s): json-message-file-name" >&2 - exit 1 -fi - -curl -k -H "Content-type: application/json" --data-binary @$1 \ - https://${SIM_IP}:3905/events/POLICY-PDP-PAP -echo diff --git a/scripts/policy/drools-apps/passive.drools.json b/scripts/policy/drools-apps/passive.drools.json deleted file mode 100644 index dca16d28..00000000 --- a/scripts/policy/drools-apps/passive.drools.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "messageName": "PDP_STATE_CHANGE", - "requestId": "88891208-2a73-452c-8d71-c93b422a7e03", - "timestampMs": 1584652299629, - "name": "drools", - "pdpGroup": "defaultGroup", - "pdpSubgroup": "drools", - "state": "PASSIVE" -} diff --git a/scripts/policy/drools-apps/policies.json b/scripts/policy/drools-apps/policies.json deleted file mode 100644 index b4775661..00000000 --- a/scripts/policy/drools-apps/policies.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "messageName": "PDP_UPDATE", - "requestId": "88891208-2a73-452c-8d71-c93b422a7e03", - "timestampMs": 1584652299629, - "name": "drools", - "pdpGroup": "defaultGroup", - "pdpSubgroup": "drools", - "policies": [ - { - "type": "onap.policies.controlloop.operational.common.Drools", - "type_version": "1.0.0", - "version": "1.0.0", - "name": "operational.restart", - "metadata": { - "policy-id": "operational.restart" - }, - "properties": { - "controllerName": "frankfurt", - "id": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", - "timeout": 3600, - "abatement": false, - "trigger": "unique-policy-id-1-restart", - "operations": [ - { - "id": "unique-policy-id-1-restart", - "description": "Restart the VM", - "operation": { - "actor": "APPC", - "operation": "Restart", - "target": { - "targetType": "VM" - } - }, - "timeout": 1200, - "retries": 3, - "success": "final_success", - "failure": "final_failure", - "failure_timeout": "final_failure_timeout", - "failure_retries": "final_failure_retries", - "failure_exception": "final_failure_exception", - "failure_guard": "final_failure_guard" - } - ] - } - }, - { - "type": "onap.policies.controlloop.operational.common.Drools", - "type_version": "1.0.0", - "version": "1.0.0", - "name": "operational.scale.up", - "metadata": { - "policy-id": "operational.scale.up" - }, - "properties": { - "controllerName": "frankfurt", - "id": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "timeout": 60, - "abatement": false, - "trigger": "unique-policy-id-1-scale-up", - "operations": [ - { - "id": "unique-policy-id-1-scale-up", - "description": "Scale up", - "operation": { - "actor": "SO", - "operation": "VF Module Create", - "target": { - "targetType": "VFMODULE", - "entityIds": { - "modelInvariantId": "e6130d03-56f1-4b0a-9a1d-e1b2ebc30e0e", - "modelVersionId": "94b18b1d-cc91-4f43-911a-e6348665f292", - "modelName": "VfwclVfwsnkBbefb8ce2bde..base_vfw..module-0", - "modelVersion": 1, - "modelCustomizationId": "47958575-138f-452a-8c8d-d89b595f8164" - } - }, - "payload": { - "requestParameters": "{\"usePreload\":true,\"userParams\":[]}", - "configurationParameters": "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\",\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\",\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]" - } - }, - "timeout": 30, - "retries": 0, - "success": "final_success", - "failure": "final_failure", - "failure_timeout": "final_failure_timeout", - "failure_retries": "final_failure_retries", - "failure_exception": "final_failure_exception", - "failure_guard": "final_failure_guard" - } - ] - } - }, - { - "type": "onap.policies.controlloop.operational.common.Drools", - "type_version": "1.0.0", - "name": "operational.modifyconfig", - "version": "1.0.0", - "metadata": { - "policy-id": "operational.modifyconfig" - }, - "properties": { - "controllerName": "frankfurt", - "id": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "timeout": 60, - "abatement": false, - "trigger": "unique-policy-id-1-modifyConfig", - "operations": [ - { - "id": "unique-policy-id-1-modifyConfig", - "description": "Modify the packet generator", - "operation": { - "actor": "APPC", - "operation": "ModifyConfig", - "target": { - "targetType": "VNF", - "entityIds": { - "resourceID": "bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38" - } - } - }, - "timeout": 7, - "retries": 0, - "success": "final_success", - "failure": "final_failure", - "failure_timeout": "final_failure_timeout", - "failure_retries": "final_failure_retries", - "failure_exception": "final_failure_exception", - "failure_guard": "final_failure_guard" - } - ] - } - } - ] -} diff --git a/scripts/policy/policy-models-dmaap-sim.sh b/scripts/policy/policy-models-dmaap-sim.sh index 0abd9f94..2839e5c3 100644 --- a/scripts/policy/policy-models-dmaap-sim.sh +++ b/scripts/policy/policy-models-dmaap-sim.sh @@ -19,6 +19,10 @@ source ${SCRIPTS}/policy/config/policy-csit.conf +rm -rf ${WORKSPACE}/dmaap-sim +mkdir ${WORKSPACE}/dmaap-sim +cd ${WORKSPACE}/dmaap-sim + POLICY_MODELS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/models/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" export POLICY_MODELS_VERSION="${POLICY_MODELS_VERSION_EXTRACT}" echo ${POLICY_MODELS_VERSION} @@ -31,5 +35,3 @@ mkdir target curl -L $item -o target/policy-models-sim-dmaap-${POLICY_MODELS_VERSION}-tarball.tar.gz bash ./src/main/package/docker/docker_build.sh cd ${WORKSPACE} -rm -rf ${WORK_DIR} - diff --git a/scripts/policy/policy-models-simulators.sh b/scripts/policy/policy-models-simulators.sh index 445a529b..9e67d487 100755 --- a/scripts/policy/policy-models-simulators.sh +++ b/scripts/policy/policy-models-simulators.sh @@ -19,6 +19,10 @@ source ${SCRIPTS}/policy/config/policy-csit.conf +rm -rf ${WORKSPACE}/simulators +mkdir ${WORKSPACE}/simulators +cd ${WORKSPACE}/simulators + POLICY_MODELS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/models/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" export POLICY_MODELS_VERSION="${POLICY_MODELS_VERSION_EXTRACT}" echo ${POLICY_MODELS_VERSION} @@ -30,6 +34,5 @@ item=`curl --silent -L ${NEXUS_URL}/org/onap/policy/models/sim/policy-models-sim mkdir target curl -L $item -o target/policy-models-simulators-${POLICY_MODELS_VERSION}-tarball.tar.gz bash ./src/main/package/docker/docker_build.sh -cd ${WORKSPACE} -rm -rf ${WORK_DIR} +cd ${WORKSPACE} |