From 7d80c38635b4cf7ec0d517a95c63772c4c9aface Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Tue, 7 May 2019 13:36:39 +0000 Subject: Adding end to end CSIT test cases for PDP-A 1) Adding test case to do health check of PDP-A. 2) Adding test case for end to end testing - create policy type and policy using Policy API, deploy policy using PAP API and then execute policy in APEX engine. Change-Id: I97b208f4d7c319f993515719795d022ddfc429fa Issue-ID: POLICY-1739 Signed-off-by: a.sreekumar --- .../config/apex-pdp/OnapPfConfig.json | 17 ++++ .../config/apex-pdp/topic.properties | 23 +++++ scripts/policy/policy-apex-pdp/config/db/db.conf | 16 ++++ scripts/policy/policy-apex-pdp/config/db/db.sh | 22 +++++ .../policy-apex-pdp/config/pap/defaultConfig.json | 30 ++++++ .../policy/policy-apex-pdp/config/pap/logback.xml | 102 +++++++++++++++++++++ .../policy-apex-pdp/config/pap/s3pConfig.json | 11 +++ .../policy-apex-pdp/config/pap/ssl/policy-keystore | Bin 0 -> 4407 bytes .../config/pap/ssl/policy-truststore | Bin 0 -> 124176 bytes .../policy-apex-pdp/config/pap/topic.properties | 23 +++++ .../policy/policy-apex-pdp/docker-compose-apex.yml | 74 +++++++++++++++ 11 files changed, 318 insertions(+) create mode 100644 scripts/policy/policy-apex-pdp/config/apex-pdp/OnapPfConfig.json create mode 100644 scripts/policy/policy-apex-pdp/config/apex-pdp/topic.properties create mode 100644 scripts/policy/policy-apex-pdp/config/db/db.conf create mode 100644 scripts/policy/policy-apex-pdp/config/db/db.sh create mode 100644 scripts/policy/policy-apex-pdp/config/pap/defaultConfig.json create mode 100644 scripts/policy/policy-apex-pdp/config/pap/logback.xml create mode 100644 scripts/policy/policy-apex-pdp/config/pap/s3pConfig.json create mode 100644 scripts/policy/policy-apex-pdp/config/pap/ssl/policy-keystore create mode 100644 scripts/policy/policy-apex-pdp/config/pap/ssl/policy-truststore create mode 100644 scripts/policy/policy-apex-pdp/config/pap/topic.properties create mode 100644 scripts/policy/policy-apex-pdp/docker-compose-apex.yml (limited to 'scripts/policy') diff --git a/scripts/policy/policy-apex-pdp/config/apex-pdp/OnapPfConfig.json b/scripts/policy/policy-apex-pdp/config/apex-pdp/OnapPfConfig.json new file mode 100644 index 00000000..6944c9bd --- /dev/null +++ b/scripts/policy/policy-apex-pdp/config/apex-pdp/OnapPfConfig.json @@ -0,0 +1,17 @@ +{ + "name":"OnapPfParameterGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": true, + "aaf": false + }, + "pdpStatusParameters":{ + "timeIntervalMs": 10000, + "pdpType":"apex", + "description":"Pdp Heartbeat", + "supportedPolicyTypes":[{"name":"onap.policies.controlloop.operational.Apex","version":"1.0.0"}] + } +} diff --git a/scripts/policy/policy-apex-pdp/config/apex-pdp/topic.properties b/scripts/policy/policy-apex-pdp/config/apex-pdp/topic.properties new file mode 100644 index 00000000..b7df11a8 --- /dev/null +++ b/scripts/policy/policy-apex-pdp/config/apex-pdp/topic.properties @@ -0,0 +1,23 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +dmaap.source.topics=POLICY-PDP-PAP +dmaap.sink.topics=POLICY-PDP-PAP + +dmaap.source.topics.POLICY-PDP-PAP.servers= dmaap:3904 +dmaap.sink.topics.POLICY-PDP-PAP.servers= dmaap:3904 diff --git a/scripts/policy/policy-apex-pdp/config/db/db.conf b/scripts/policy/policy-apex-pdp/config/db/db.conf new file mode 100644 index 00000000..4768bfc4 --- /dev/null +++ b/scripts/policy/policy-apex-pdp/config/db/db.conf @@ -0,0 +1,16 @@ +# Copyright (C) 2019 Nordix Foundation. +# +# 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. +MYSQL_ROOT_PASSWORD=secret +MYSQL_USER=policy_user +MYSQL_PASSWORD=policy_user diff --git a/scripts/policy/policy-apex-pdp/config/db/db.sh b/scripts/policy/policy-apex-pdp/config/db/db.sh new file mode 100644 index 00000000..660f2c5a --- /dev/null +++ b/scripts/policy/policy-apex-pdp/config/db/db.sh @@ -0,0 +1,22 @@ +#!/bin/bash -xv +# Copyright (C) 2019 Nordix Foundation. +# +# 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. + +for db in policyadmin +do + mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};" + mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "GRANT ALL PRIVILEGES ON \`${db}\`.* TO '${MYSQL_USER}'@'%' ;" +done + +mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" diff --git a/scripts/policy/policy-apex-pdp/config/pap/defaultConfig.json b/scripts/policy/policy-apex-pdp/config/pap/defaultConfig.json new file mode 100644 index 00000000..32b6c30f --- /dev/null +++ b/scripts/policy/policy-apex-pdp/config/pap/defaultConfig.json @@ -0,0 +1,30 @@ +{ + "name": "PapGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": true, + "aaf": false + }, + "pdpParameters": { + "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" + } +} diff --git a/scripts/policy/policy-apex-pdp/config/pap/logback.xml b/scripts/policy/policy-apex-pdp/config/pap/logback.xml new file mode 100644 index 00000000..a34956c5 --- /dev/null +++ b/scripts/policy/policy-apex-pdp/config/pap/logback.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + ${logDir}/${errorLog}.log + + ${logDir}/${errorLog}.%d{yyyy-MM-dd}.%i.log.zip + + 50MB + 30 + 10GB + + + WARN + + + ${errorPattern} + + + + + + + + + ${logDir}/${debugLog}.log + + ${logDir}/${debugLog}.%d{yyyy-MM-dd}.%i.log.zip + + 50MB + 30 + 10GB + + + ${debugPattern} + + + + + + + + + ${logDir}/${networkLog}.log + + ${logDir}/${networkLog}.%d{yyyy-MM-dd}.%i.log.zip + + 50MB + 30 + 10GB + + + ${networkPattern} + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/policy/policy-apex-pdp/config/pap/s3pConfig.json b/scripts/policy/policy-apex-pdp/config/pap/s3pConfig.json new file mode 100644 index 00000000..3085f45d --- /dev/null +++ b/scripts/policy/policy-apex-pdp/config/pap/s3pConfig.json @@ -0,0 +1,11 @@ +{ + "name": "PapGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": true, + "aaf": false + } +} diff --git a/scripts/policy/policy-apex-pdp/config/pap/ssl/policy-keystore b/scripts/policy/policy-apex-pdp/config/pap/ssl/policy-keystore new file mode 100644 index 00000000..bf876b8a Binary files /dev/null and b/scripts/policy/policy-apex-pdp/config/pap/ssl/policy-keystore differ diff --git a/scripts/policy/policy-apex-pdp/config/pap/ssl/policy-truststore b/scripts/policy/policy-apex-pdp/config/pap/ssl/policy-truststore new file mode 100644 index 00000000..b7d52ad1 Binary files /dev/null and b/scripts/policy/policy-apex-pdp/config/pap/ssl/policy-truststore differ diff --git a/scripts/policy/policy-apex-pdp/config/pap/topic.properties b/scripts/policy/policy-apex-pdp/config/pap/topic.properties new file mode 100644 index 00000000..b7df11a8 --- /dev/null +++ b/scripts/policy/policy-apex-pdp/config/pap/topic.properties @@ -0,0 +1,23 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +dmaap.source.topics=POLICY-PDP-PAP +dmaap.sink.topics=POLICY-PDP-PAP + +dmaap.source.topics.POLICY-PDP-PAP.servers= dmaap:3904 +dmaap.sink.topics.POLICY-PDP-PAP.servers= dmaap:3904 diff --git a/scripts/policy/policy-apex-pdp/docker-compose-apex.yml b/scripts/policy/policy-apex-pdp/docker-compose-apex.yml new file mode 100644 index 00000000..9039b894 --- /dev/null +++ b/scripts/policy/policy-apex-pdp/docker-compose-apex.yml @@ -0,0 +1,74 @@ +# Copyright (C) 2019 Nordix Foundation. +# +# 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. +version: '2' +networks: + default: + driver: bridge +services: + mariadb: + image: mariadb:10.2.14 + container_name: mariadb + hostname: mariadb + command: ['--lower-case-table-names=1', '--wait_timeout=28800'] + env_file: config/db/db.conf + volumes: + - ./config/db:/docker-entrypoint-initdb.d + ports: + - "3306:3306" + dmaap: + image: dmaap/simulator + container_name: dmaap-simulator + hostname: dmaap-simulator + ports: + - "3904:3904" + pap: + image: nexus3.onap.org:10001/onap/policy-pap:2.0.0-SNAPSHOT-latest + container_name: policy-pap + depends_on: + - mariadb + - dmaap + hostname: policy-pap + volumes: + - ./config/pap/:/opt/app/policy/pap/etc/ + api: + image: nexus3.onap.org:10001/onap/policy-api + container_name: policy-api + depends_on: + - mariadb + hostname: policy-api + apex: + image: nexus3.onap.org:10001/onap/policy-apex-pdp:2.1-SNAPSHOT-latest + container_name: policy-apex-pdp + depends_on: + - mariadb + - dmaap + - pap + - api + hostname: policy-apex-pdp + command: ['/opt/app/policy/apex-pdp/bin/apexOnapPf.sh', '-c', '/opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json', '-p', '/opt/app/policy/apex-pdp/etc/onappf/config/topic.properties'] + volumes: + - ./config/apex-pdp/:/opt/app/policy/apex-pdp/etc/onappf/config/ + ports: + - "6969:6969" + - "23324:23324" + start_dependencies: + image: dadarek/wait-for-dependencies + container_name: policy-wait + depends_on: + - mariadb + - dmaap + hostname: policy-wait + command: + - mariadb:3306 + - dmaap:3904 -- cgit 1.2.3-korg