diff options
author | Taka Cho <takamune.cho@att.com> | 2021-01-11 16:48:33 -0500 |
---|---|---|
committer | Taka Cho <takamune.cho@att.com> | 2021-01-14 14:33:09 +0000 |
commit | 6d188afbef71b620063d5d4c1687a30c8f54ee8e (patch) | |
tree | c4ef82e5b59b2f1fa5fbfb7cc18e81ed2d60c83e | |
parent | 1fe9893bee8c0f53dd3d6fbc9dc26dfa8b37f4c9 (diff) |
move csit/scripts, docker-compose to docker repo
part of moving csit to project level
scripts shares with all applications repo reside in
docker repo.
all docker-compose relate volume files reside in
docker repo.
align with new JJB template
Issue-ID: POLICY-2895
Change-Id: I8fd97c6932e41779b01c1c941564763415c83f16
Signed-off-by: Taka Cho <takamune.cho@att.com>
22 files changed, 1425 insertions, 0 deletions
diff --git a/csit/config/apex-pdp/OnapPfConfig.json b/csit/config/apex-pdp/OnapPfConfig.json new file mode 100644 index 00000000..59ba604d --- /dev/null +++ b/csit/config/apex-pdp/OnapPfConfig.json @@ -0,0 +1,42 @@ +{ + "name":"OnapPfParameterGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": true + }, + "pdpStatusParameters":{ + "pdpGroup": "defaultGroup", + "timeIntervalMs": 120000, + "pdpType":"apex", + "description":"Pdp Heartbeat", + "supportedPolicyTypes": [ + { + "name": "onap.policies.controlloop.operational.common.Apex", + "version": "1.0.0" + }, + { + "name": "onap.policies.native.Apex", + "version": "1.0.0" + } + ] + }, + "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 + }] + } +} diff --git a/csit/config/db/db.conf b/csit/config/db/db.conf new file mode 100644 index 00000000..22b37f8b --- /dev/null +++ b/csit/config/db/db.conf @@ -0,0 +1,16 @@ +# Copyright 2019,2021 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. +MYSQL_ROOT_PASSWORD=secret +MYSQL_USER=policy_user +MYSQL_PASSWORD=policy_user diff --git a/csit/config/db/db.sh b/csit/config/db/db.sh new file mode 100755 index 00000000..a5c81296 --- /dev/null +++ b/csit/config/db/db.sh @@ -0,0 +1,22 @@ +#!/bin/bash -xv +# Copyright 2019,2021 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. + +for db in support onap_sdk log migration operationshistory10 pooling policyadmin operationshistory +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/csit/config/distribution/defaultConfig.json b/csit/config/distribution/defaultConfig.json new file mode 100644 index 00000000..facee9bc --- /dev/null +++ b/csit/config/distribution/defaultConfig.json @@ -0,0 +1,72 @@ +{ + "name":"SDCDistributionGroup", + "restServerParameters":{ + "host":"0.0.0.0", + "port":6969, + "userName":"healthcheck", + "password":"zb!XztG34", + "https": true + }, + "receptionHandlerParameters":{ + "FileReceptionHandler":{ + "receptionHandlerType":"File", + "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.file.FileSystemReceptionHandler", + "receptionHandlerConfigurationName":"fileConfiguration", + "pluginHandlerParameters":{ + "policyDecoders":{ + "ApexDecoder":{ + "decoderType":"ApexDecoder", + "decoderClassName":"org.onap.policy.distribution.reception.decoding.policy.file.PolicyDecoderFileInCsarToPolicy", + "decoderConfigurationName": "apexDecoderConfiguration" + } + }, + "policyForwarders":{ + "LifeCycleApiForwarder":{ + "forwarderType":"LifeCycleAPI", + "forwarderClassName":"org.onap.policy.distribution.forwarding.lifecycle.api.LifecycleApiPolicyForwarder", + "forwarderConfigurationName": "lifecycleApiConfiguration" + } + } + } + } + }, + "receptionHandlerConfigurationParameters":{ + "fileConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.reception.handling.file.FileSystemReceptionHandlerConfigurationParameterGroup", + "parameters":{ + "watchPath": "/opt/app/policy/distribution/etc/temp/", + "maxThread": 1 + } + } + }, + "policyDecoderConfigurationParameters":{ + "apexDecoderConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.reception.decoding.policy.file.PolicyDecoderFileInCsarToPolicyParameterGroup", + "parameters":{ + "policyFileName": "apex_policy.json", + "policyTypeFileName": "apex_policy_type.json" + } + } + }, + "policyForwarderConfigurationParameters":{ + "lifecycleApiConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.forwarding.lifecycle.api.LifecycleApiForwarderParameters", + "parameters":{ + "apiParameters": { + "hostName": "policy-api", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34" + }, + "papParameters": { + "hostName": "policy-pap", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34" + }, + "isHttps": true, + "deployPolicies": true + } + } + } +} diff --git a/csit/config/drools-apps/custom/features.pre.sh b/csit/config/drools-apps/custom/features.pre.sh new file mode 100755 index 00000000..e9c77a0f --- /dev/null +++ b/csit/config/drools-apps/custom/features.pre.sh @@ -0,0 +1,18 @@ +#!/bin/bash -x +# ============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===================================================== + +bash -c "features disable distributed-locking" diff --git a/csit/config/drools-apps/custom/standalone-settings.xml b/csit/config/drools-apps/custom/standalone-settings.xml new file mode 100644 index 00000000..ebd6dd2a --- /dev/null +++ b/csit/config/drools-apps/custom/standalone-settings.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + Base Package + ================================================================================ + Copyright (C) 2017-2019 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========================================================= + --> + + +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> + + <offline>true</offline> + + <profiles> + + <profile> + <id>policy-local</id> + + <repositories> + <repository> + <id>file-repository</id> + <url>file:${user.home}/.m2/file-repository</url> + <releases> + <enabled>true</enabled> + <updatePolicy>always</updatePolicy> + </releases> + <snapshots> + <enabled>true</enabled> + <updatePolicy>always</updatePolicy> + </snapshots> + </repository> + </repositories> + + </profile> + + </profiles> + + <activeProfiles> + <activeProfile>policy-local</activeProfile> + </activeProfiles> + +</settings> diff --git a/csit/config/drools-apps/env/base.conf b/csit/config/drools-apps/env/base.conf new file mode 100644 index 00000000..673cfaf3 --- /dev/null +++ b/csit/config/drools-apps/env/base.conf @@ -0,0 +1,132 @@ +# ============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==================================================== + +# JVM options + +JVM_OPTIONS=-server -Xms512m -Xmx512m + +# SYSTEM software configuration + +DEBUG=y +POLICY_HOME=/opt/app/policy +POLICY_LOGS=/var/log/onap/policy/pdpd +KEYSTORE_PASSWD=Pol1cy_0nap +TRUSTSTORE_PASSWD=Pol1cy_0nap + +# Telemetry credentials + +TELEMETRY_PORT=9696 +TELEMETRY_HOST=0.0.0.0 +TELEMETRY_USER=demo@people.osaaf.org +TELEMETRY_PASSWORD=demo123456! + +# nexus repository + +SNAPSHOT_REPOSITORY_ID= +SNAPSHOT_REPOSITORY_URL= +RELEASE_REPOSITORY_ID= +RELEASE_REPOSITORY_URL= +REPOSITORY_USERNAME= +REPOSITORY_PASSWORD= +REPOSITORY_OFFLINE=true + +# Relational (SQL) DB access + +SQL_HOST=mariadb +SQL_USER=policy_user +SQL_PASSWORD=policy_user + +# AAF + +AAF=false +AAF_NAMESPACE=org.onap.policy +AAF_HOST=aaf.api.simpledemo.onap.org + +# PDP-D DMaaP configuration channel + +PDPD_CONFIGURATION_TOPIC=PDPD-CONFIGURATION +PDPD_CONFIGURATION_API_KEY= +PDPD_CONFIGURATION_API_SECRET= +PDPD_CONFIGURATION_CONSUMER_GROUP= +PDPD_CONFIGURATION_CONSUMER_INSTANCE= +PDPD_CONFIGURATION_PARTITION_KEY= + +# PAP-PDP configuration channel + +POLICY_PDP_PAP_TOPIC=POLICY-PDP-PAP +POLICY_PDP_PAP_API_KEY= +POLICY_PDP_PAP_API_SECRET= + +# PAP + +PAP_HOST=pap +PAP_USERNAME=testpap +PAP_PASSWORD=alpha123 + +# PDP-X + +GUARD_DISABLED=false +PDP_HOST=policy-xacml-pdp +PDP_PORT=6969 +PDP_CONTEXT_URI=policy/pdpx/v1/ +PDP_USERNAME=healthcheck +PDP_PASSWORD=zb!XztG34 +PDP_CLIENT_USERNAME=python +PDP_CLIENT_PASSWORD=test +PDP_ENVIRONMENT=TEST + +# DCAE DMaaP + +DCAE_TOPIC=unauthenticated.DCAE_CL_OUTPUT +DCAE_SERVERS=policy.api.simpledemo.onap.org +DCAE_CONSUMER_GROUP=dcae.policy.shared + +# Open DMaaP + +DMAAP_SERVERS=policy.api.simpledemo.onap.org + +# AAI + +AAI_HOST=policy.api.simpledemo.onap.org +AAI_PORT=6666 +AAI_CONTEXT_URI= +AAI_USERNAME=policy@policy.onap.org +AAI_PASSWORD=demo123456! + +# MSO + +SO_HOST=policy.api.simpledemo.onap.org +SO_PORT=6669 +SO_CONTEXT_URI= +SO_URL=https://policy.api.simpledemo.onap.org:6669/ +SO_USERNAME=InfraPortalClient +SO_PASSWORD=password1$ + +# VFC + +VFC_HOST=policy.api.simpledemo.onap.org +VFC_PORT=6670 +VFC_CONTEXT_URI= +VFC_USERNAME= +VFC_PASSWORD= + +# SDNC + +SDNC_HOST=policy.api.simpledemo.onap.org +SDNC_PORT=6668 +SDNC_CONTEXT_URI= +SDNC_USERNAME= +SDNC_PASSWORD= diff --git a/csit/config/drools-apps/env/feature-healthcheck.conf b/csit/config/drools-apps/env/feature-healthcheck.conf new file mode 100644 index 00000000..1c710547 --- /dev/null +++ b/csit/config/drools-apps/env/feature-healthcheck.conf @@ -0,0 +1,18 @@ +# ============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========================================================= + +HEALTHCHECK_USER=demo@people.osaaf.org +HEALTHCHECK_PASSWORD=demo123456! diff --git a/csit/config/drools-apps/env/feature-pooling-dmaap.conf b/csit/config/drools-apps/env/feature-pooling-dmaap.conf new file mode 100644 index 00000000..3808e3d9 --- /dev/null +++ b/csit/config/drools-apps/env/feature-pooling-dmaap.conf @@ -0,0 +1,17 @@ +# ============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========================================================= + +POOLING_TOPIC=POOLING diff --git a/csit/config/drools/custom/noop.pre.sh b/csit/config/drools/custom/noop.pre.sh new file mode 100755 index 00000000..63bdc4cf --- /dev/null +++ b/csit/config/drools/custom/noop.pre.sh @@ -0,0 +1,22 @@ +#!/bin/bash -x +# ============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========================================================= + +sed -i "s/^dmaap/noop/g" \ + ${POLICY_HOME}/config/engine.properties \ + ${POLICY_HOME}/config/feature-lifecycle.properties + +chmod 644 ${POLICY_HOME}/config/engine.properties ${POLICY_HOME}/config/feature-lifecycle.properties diff --git a/csit/config/drools/env/base.conf b/csit/config/drools/env/base.conf new file mode 100644 index 00000000..891de49f --- /dev/null +++ b/csit/config/drools/env/base.conf @@ -0,0 +1,132 @@ +# ============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========================================================= + +# JVM options + +JVM_OPTIONS=-server -Xms512m -Xmx512m + +# SYSTEM software configuration + +DEBUG=y +POLICY_HOME=/opt/app/policy +POLICY_LOGS=/var/log/onap/policy/pdpd +KEYSTORE_PASSWD=Pol1cy_0nap +TRUSTSTORE_PASSWD=Pol1cy_0nap + +# Telemetry credentials + +TELEMETRY_PORT=9696 +TELEMETRY_HOST=0.0.0.0 +TELEMETRY_USER=demo@people.osaaf.org +TELEMETRY_PASSWORD=demo123456! + +# nexus repository + +SNAPSHOT_REPOSITORY_ID=policy-nexus-snapshots +SNAPSHOT_REPOSITORY_URL=http://nexus:8081/nexus/content/repositories/snapshots/ +RELEASE_REPOSITORY_ID=policy-nexus-releases +RELEASE_REPOSITORY_URL=http://nexus:8081/nexus/content/repositories/releases/ +REPOSITORY_USERNAME=admin +REPOSITORY_PASSWORD=admin123 +REPOSITORY_OFFLINE=false + +# Relational (SQL) DB access + +SQL_HOST=mariadb +SQL_USER=policy_user +SQL_PASSWORD=policy_user + +# AAF + +AAF=false +AAF_NAMESPACE=org.onap.policy +AAF_HOST=aaf.api.simpledemo.onap.org + +# PDP-D DMaaP configuration channel + +PDPD_CONFIGURATION_TOPIC=PDPD-CONFIGURATION +PDPD_CONFIGURATION_API_KEY= +PDPD_CONFIGURATION_API_SECRET= +PDPD_CONFIGURATION_CONSUMER_GROUP= +PDPD_CONFIGURATION_CONSUMER_INSTANCE= +PDPD_CONFIGURATION_PARTITION_KEY= + +# PAP-PDP configuration channel + +POLICY_PDP_PAP_TOPIC=POLICY-PDP-PAP +POLICY_PDP_PAP_API_KEY= +POLICY_PDP_PAP_API_SECRET= + +# PAP + +PAP_HOST= +PAP_USERNAME= +PAP_PASSWORD= + +# PDP-X + +PDP_HOST= +PDP_PORT= +PDP_CONTEXT_URI=policy/pdpx/v1/ +PDP_USERNAME= +PDP_PASSWORD= +PDP_CLIENT_USERNAME= +PDP_CLIENT_PASSWORD= +PDP_ENVIRONMENT= +GUARD_DISABLED=false + +# DCAE DMaaP + +DCAE_TOPIC=unauthenticated.DCAE_CL_OUTPUT +DCAE_SERVERS= +DCAE_CONSUMER_GROUP=dcae.policy.shared + +# Open DMaaP + +DMAAP_SERVERS=mr.api.simpledemo.onap.org + +# AAI + +AAI_HOST=aai.api.simpledemo.onap.org +AAI_PORT=8443 +AAI_CONTEXT_URI= +AAI_USERNAME=policy@policy.onap.org +AAI_PASSWORD=demo123456! + +# MSO + +SO_HOST=vm1.mso.simpledemo.onap.org +SO_PORT=8080 +SO_CONTEXT_URI=onap/so/infra/ +SO_URL=http://vm1.mso.simpledemo.onap.org:8080/onap/so/infra +SO_USERNAME=InfraPortalClient +SO_PASSWORD=password1$ + +# VFC + +VFC_HOST= +VFC_PORT= +VFC_CONTEXT_URI=api/nslcm/v1/ +VFC_USERNAME= +VFC_PASSWORD= + +# SDNC + +SDNC_HOST= +SDNC_PORT= +SDNC_CONTEXT_URI=restconf/operations/ +SDNC_USERNAME= +SDNC_PASSWORD= diff --git a/csit/config/pap/defaultConfig.json b/csit/config/pap/defaultConfig.json new file mode 100644 index 00000000..1e47c7e7 --- /dev/null +++ b/csit/config/pap/defaultConfig.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": "policy_user", + "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/csit/config/sim-all/simParameters.json b/csit/config/sim-all/simParameters.json new file mode 100644 index 00000000..4b009b6f --- /dev/null +++ b/csit/config/sim-all/simParameters.json @@ -0,0 +1,109 @@ +{ + "dmaapProvider": { + "name": "DMaaP simulator", + "topicSweepSec": 300 + }, + "restServers": [ + { + "name": "DMaaP simulator", + "providerClass": "org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1", + "host": "0.0.0.0", + "port": 3905, + "https": true + }, + { + "name": "A&AI simulator", + "providerClass": "org.onap.policy.simulators.AaiSimulatorJaxRs", + "host": "0.0.0.0", + "port": 6666, + "https": true, + "userName": "policy@policy.onap.org", + "password": "demo123456!" + }, + { + "name": "SDNC simulator", + "providerClass": "org.onap.policy.simulators.SdncSimulatorJaxRs", + "host": "0.0.0.0", + "port": 6668, + "https": true + }, + { + "name": "SO simulator", + "providerClass": "org.onap.policy.simulators.SoSimulatorJaxRs", + "host": "0.0.0.0", + "port": 6669, + "https": false, + "userName": "InfraPortalClient", + "password": "password1$" + }, + { + "name": "VFC simulator", + "providerClass": "org.onap.policy.simulators.VfcSimulatorJaxRs", + "host": "0.0.0.0", + "port": 6670, + "https": true + } + ], + "topicSinks": [ + { + "topic": "APPC-CL", + "servers": ["${HOST_NAME}"], + "topicCommInfrastructure": "DMAAP", + "useHttps": true, + "apiKey": "some-key", + "apiSecret": "some-secret" + }, + { + "topic": "APPC-LCM-WRITE", + "servers": ["${HOST_NAME}"], + "topicCommInfrastructure": "DMAAP", + "useHttps": true, + "apiKey": "some-key", + "apiSecret": "some-secret" + } + ], + "topicSources": [ + { + "topic": "APPC-CL", + "servers": ["${HOST_NAME}"], + "topicCommInfrastructure": "DMAAP", + "useHttps": true, + "apiKey": "some-key", + "apiSecret": "some-secret" + }, + { + "topic": "APPC-LCM-READ", + "servers": ["${HOST_NAME}"], + "topicCommInfrastructure": "DMAAP", + "useHttps": true, + "apiKey": "some-key", + "apiSecret": "some-secret" + } + ], + "topicServers": [ + { + "name": "APPC Legacy simulator", + "providerClass": "org.onap.policy.simulators.AppcLegacyTopicServer", + "sink": "APPC-CL", + "source": "APPC-CL" + }, + { + "name": "APPC-LCM simulator", + "providerClass": "org.onap.policy.simulators.AppcLcmTopicServer", + "sink": "APPC-LCM-WRITE", + "source": "APPC-LCM-READ" + } + ], + "grpcServer": { + "name": "CDS simulator", + "providerClass": "org.onap.policy.simulators.CdsSimulator", + "host": "0.0.0.0", + "port": 6680, + "timeout": 30, + "username": "ccsdkapps", + "password": "ccsdkapps", + "resourceLocation": "org/onap/policy/simulators/cds/", + "successRepeatCount": 0, + "requestedResponseDelayMs": 0 + } +} diff --git a/csit/config/xacml-pdp/defaultConfig.json b/csit/config/xacml-pdp/defaultConfig.json new file mode 100644 index 00000000..5a6573a3 --- /dev/null +++ b/csit/config/xacml-pdp/defaultConfig.json @@ -0,0 +1,37 @@ +{ + "name": "XacmlPdpParameters", + "pdpGroup": "defaultGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": true, + "aaf": false + }, + "policyApiParameters": { + "host": "policy-api", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": true, + "aaf": false + }, + "applicationPath": "/opt/app/policy/pdpx/apps", + "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 + }] + } +} diff --git a/csit/detmVers.sh b/csit/detmVers.sh new file mode 100644 index 00000000..1906292c --- /dev/null +++ b/csit/detmVers.sh @@ -0,0 +1,77 @@ +# ============LICENSE_START==================================================== +# Copyright (C) 2020-2021 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== + +source ${SCRIPTS}/get-branch-mariadb.sh + +echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER} + +POLICY_MODELS_VERSION=$( + 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:0:3}-SNAPSHOT-latest +echo POLICY_MODELS_VERSION=${POLICY_MODELS_VERSION} + +POLICY_API_VERSION=$( + curl -q --silent \ + https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} | + xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -) +export POLICY_API_VERSION=${POLICY_API_VERSION:0:3}-SNAPSHOT-latest +echo POLICY_API_VERSION=${POLICY_API_VERSION} + +POLICY_PAP_VERSION=$( + curl -q --silent \ + https://git.onap.org/policy/pap/plain/pom.xml?h=${GERRIT_BRANCH} | + xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -) +export POLICY_PAP_VERSION=${POLICY_PAP_VERSION:0:3}-SNAPSHOT-latest +echo POLICY_PAP_VERSION=${POLICY_PAP_VERSION} + +POLICY_XACML_PDP_VERSION=$( + curl -q --silent \ + https://git.onap.org/policy/xacml-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | + xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -) +export POLICY_XACML_PDP_VERSION=${POLICY_XACML_PDP_VERSION:0:3}-SNAPSHOT-latest +echo POLICY_XACML_PDP_VERSION=${POLICY_XACML_PDP_VERSION} + +POLICY_DROOLS_VERSION=$( + curl -q --silent \ + https://git.onap.org/policy/drools-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | + xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -) +export POLICY_DROOLS_VERSION=${POLICY_DROOLS_VERSION:0:3}-SNAPSHOT-latest +echo POLICY_DROOLS_VERSION=${POLICY_DROOLS_VERSION} + +POLICY_DROOLS_APPS_VERSION=$( + curl -q --silent \ + https://git.onap.org/policy/drools-applications/plain/pom.xml?h=${GERRIT_BRANCH} | + xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -) +export POLICY_DROOLS_APPS_VERSION=${POLICY_DROOLS_APPS_VERSION:0:3}-SNAPSHOT-latest +echo POLICY_DROOLS_APPS_VERSION=${POLICY_DROOLS_APPS_VERSION} + +POLICY_APEX_PDP_VERSION=$( + curl -q --silent \ + https://git.onap.org/policy/apex-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | + xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -) +export POLICY_APEX_PDP_VERSION=${POLICY_APEX_PDP_VERSION:0:3}-SNAPSHOT-latest +echo POLICY_APEX_PDP_VERSION=${POLICY_APEX_PDP_VERSION} + +POLICY_DISTRIBUTION_VERSION=$( + curl -q --silent \ + https://git.onap.org/policy/distribution/plain/pom.xml?h=${GERRIT_BRANCH} | + xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -) +export POLICY_DISTRIBUTION_VERSION=${POLICY_DISTRIBUTION_VERSION:0:3}-SNAPSHOT-latest +echo POLICY_DISTRIBUTION_VERSION=${POLICY_DISTRIBUTION_VERSION} diff --git a/csit/docker-compose-all.yml b/csit/docker-compose-all.yml new file mode 100644 index 00000000..e59cc35b --- /dev/null +++ b/csit/docker-compose-all.yml @@ -0,0 +1,190 @@ +# +# ===========LICENSE_START==================================================== +# Copyright (C) 2020-2021 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===================================================== +# +version: '2' +services: + mariadb: + image: nexus3.onap.org:10001/mariadb:${POLICY_MARIADB_VER} + 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:ro + expose: + - 3306 + policy.api.simpledemo.onap.org: + image: nexus3.onap.org:10001/onap/policy-models-simulator:${POLICY_MODELS_VERSION} + container_name: policy.api.simpledemo.onap.org + hostname: policy.api.simpledemo.onap.org + volumes: + - ./config/sim-all:/opt/app/policy/simulators/etc/mounted:ro + expose: + - 6666 + - 6668 + - 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 + volumes: + - ./wait_for_port.sh:/opt/app/policy/api/bin/wait_for_port.sh:ro + entrypoint: ./wait_for_port.sh + command: [ + '-c', './policy-api.sh', + 'mariadb', '3306' + ] + pap: + image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} + container_name: policy-pap + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - api + hostname: policy-pap + expose: + - 6969 + volumes: + - ./config/pap/defaultConfig.json:/opt/app/policy/pap/etc/defaultConfig.json:ro + - ./wait_for_port.sh:/opt/app/policy/pap/bin/wait_for_port.sh:ro + entrypoint: ./wait_for_port.sh + command: [ + '-c', './policy-pap.sh', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905', + 'api', '6969' + ] + xacml-pdp: + image: nexus3.onap.org:10001/onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} + container_name: policy-xacml-pdp + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - pap + hostname: policy-xacml-pdp + expose: + - 6969 + volumes: + - ./config/xacml-pdp/defaultConfig.json:/opt/app/policy/pdpx/etc/defaultConfig.json:ro + - ./wait_for_port.sh:/opt/app/policy/pdpx/bin/wait_for_port.sh:ro + entrypoint: ./wait_for_port.sh + command: [ + '-c', './policy-pdpx.sh', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905', + 'pap', '6969' + ] + drools: + image: nexus3.onap.org:10001/onap/policy-drools:${POLICY_DROOLS_VERSION} + container_name: drools + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - pap + hostname: drools + expose: + - 6969 + - 9696 + volumes: + - ./config/drools/custom:/tmp/policy-install/config:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + env_file: + - config/drools/env/base.conf + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', '/opt/app/policy/bin/pdpd-entrypoint.sh boot', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905' + ] + drools-apps: + image: nexus3.onap.org:10001/onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION} + container_name: drools-apps + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - pap + - xacml-pdp + hostname: drools-apps + expose: + - 6969 + - 9696 + volumes: + - ./config/drools-apps/custom:/tmp/policy-install/config:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + env_file: + - config/drools-apps/env/base.conf + - config/drools-apps/env/feature-healthcheck.conf + - config/drools-apps/env/feature-pooling-dmaap.conf + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', '/opt/app/policy/bin/pdpd-cl-entrypoint.sh boot', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905', + 'pap', '6969', + 'policy.api.simpledemo.onap.org', '6666', + 'policy.api.simpledemo.onap.org', '6668', + 'policy.api.simpledemo.onap.org', '6669', + 'policy.api.simpledemo.onap.org', '6670' + ] + apex-pdp: + image: nexus3.onap.org:10001/onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} + container_name: policy-apex-pdp + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - pap + hostname: policy-apex-pdp + expose: + - 6969 + - 23324 + volumes: + - ./config/apex-pdp/OnapPfConfig.json:/opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', '/opt/app/policy/apex-pdp/bin/apexOnapPf.sh -c /opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905', + 'pap', '6969' + ] + distribution: + image: nexus3.onap.org:10001/onap/policy-distribution:${POLICY_DISTRIBUTION_VERSION} + container_name: policy-distribution + depends_on: + - mariadb + - api + - pap + - apex-pdp + hostname: policy-distribution + volumes: + - ./config/distribution/defaultConfig.json:/opt/app/policy/distribution/etc/defaultConfig.json:ro + - ./policy-distribution/config/distribution/temp/:/opt/app/policy/distribution/etc/temp/:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './policy-dist.sh', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905', + 'pap', '6969', + 'apex-pdp', '6969' + ] diff --git a/csit/get-branch-mariadb.sh b/csit/get-branch-mariadb.sh new file mode 100644 index 00000000..f5d10a38 --- /dev/null +++ b/csit/get-branch-mariadb.sh @@ -0,0 +1,25 @@ +# ============LICENSE_START==================================================== +# Copyright (C) 2021 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== + +export POLICY_MARIADB_VER=10.2.25 +export NEXUS_URL=https://nexus.onap.org/content/repositories/snapshots + +GIT_TOP=$(git rev-parse --show-toplevel) +GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ + "${GIT_TOP}"/.gitreview) +echo GERRIT_BRANCH=${GERRIT_BRANCH} diff --git a/csit/get-instance-ip.sh b/csit/get-instance-ip.sh new file mode 100755 index 00000000..d6e055f4 --- /dev/null +++ b/csit/get-instance-ip.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# Modification Copyright 2021 © AT&T Intellectual Property. +# +# 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. +# +docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $1 diff --git a/csit/get-models-examples.sh b/csit/get-models-examples.sh new file mode 100644 index 00000000..75b65288 --- /dev/null +++ b/csit/get-models-examples.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# ============LICENSE_START=================================================== +# Copyright (C) 2020-2021 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===================================================== +# + +source ${SCRIPTS}/get-branch-mariadb.sh + +rm -rf ${WORKSPACE}/models +mkdir ${WORKSPACE}/models +cd ${WORKSPACE} + +# download models examples +git clone -b ${GERRIT_BRANCH} --single-branch git://gerrit-mirror-ap.onap.org/mirror/policy/models.git diff --git a/csit/prepare-csit.sh b/csit/prepare-csit.sh new file mode 100755 index 00000000..4ca2c416 --- /dev/null +++ b/csit/prepare-csit.sh @@ -0,0 +1,61 @@ +#!/bin/bash -x +# +# Copyright 2019 © Samsung Electronics Co., Ltd. +# Modification Copyright 2021 © AT&T Intellectual Property. +# +# 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. +# +# This script installs common libraries required by CSIT tests +# + +if [ -z "$WORKSPACE" ]; then + export WORKSPACE=`git rev-parse --show-toplevel` +fi + +TESTPLANDIR=${WORKSPACE}/${TESTPLAN} + +# Assume that if ROBOT_VENV is set and virtualenv with system site packages can be activated, +# ci-management/jjb/integration/include-raw-integration-install-robotframework.sh has already +# been executed + +if [ -f ${WORKSPACE}/env.properties ]; then + source ${WORKSPACE}/env.properties +fi +if [ -f ${ROBOT_VENV}/bin/activate ]; then + source ${ROBOT_VENV}/bin/activate +else + rm -rf /tmp/ci-management + rm -f ${WORKSPACE}/env.properties + cd /tmp + git clone -b master --single-branch git://gerrit-mirror-ap.onap.org/mirror/ci-management.git + source /tmp/ci-management/jjb/integration/include-raw-integration-install-robotframework.sh +fi + +# install required Robot libraries +pip install robotframework-selenium2library==1.8.0 robotframework-extendedselenium2library==0.9.1 + +# install eteutils +mkdir -p ${ROBOT_VENV}/src/onap +rm -rf ${ROBOT_VENV}/src/onap/testsuite +pip install --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.5.1.*' --pre + +pip freeze + +# install chrome driver +if [ ! -x ${ROBOT_VENV}/bin/chromedriver ]; then + pushd ${ROBOT_VENV}/bin + wget -N http://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip + unzip chromedriver_linux64.zip + chmod +x chromedriver + popd +fi diff --git a/csit/run-policy-csit.sh b/csit/run-policy-csit.sh new file mode 100755 index 00000000..2a62e1c0 --- /dev/null +++ b/csit/run-policy-csit.sh @@ -0,0 +1,213 @@ +#!/bin/bash -x +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# Modification Copyright 2019 © Samsung Electronics Co., Ltd. +# Modification Copyright 2021 © AT&T Intellectual Property. +# +# 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. +# +# $1 functionality +# $2 robot options + +# +# functions +# + +function on_exit(){ + rc=$? + if [[ ${WORKSPACE} ]]; then + if [[ ${WORKDIR} ]]; then + rsync -av "$WORKDIR/" "$WORKSPACE/archives/$TESTPLAN" + fi + # Record list of active docker containers + docker ps --format "{{.Image}}" > "$WORKSPACE/archives/$TESTPLAN/_docker-images.log" + + # show memory consumption after all docker instances initialized + docker_stats | tee "$WORKSPACE/archives/$TESTPLAN/_sysinfo-2-after-robot.txt" + fi + # Run teardown script plan if it exists + cd "${TESTPLANDIR}/csit/plans/" + TEARDOWN="${TESTPLANDIR}/csit/plans/teardown.sh" + if [ -f "${TEARDOWN}" ]; then + echo "Running teardown script ${TEARDOWN}" + source_safely "${TEARDOWN}" + fi + # TODO: do something with the output + exit $rc +} + +# ensure that teardown and other finalizing steps are always executed +trap on_exit EXIT + +function docker_stats(){ + #General memory details + echo "> top -bn1 | head -3" + top -bn1 | head -3 + echo + + echo "> free -h" + free -h + echo + + #Memory details per Docker + echo "> docker ps" + docker ps + echo + + echo "> docker stats --no-stream" + docker stats --no-stream + echo +} + +# save current set options +function save_set() { + RUN_CSIT_SAVE_SET="$-" + RUN_CSIT_SHELLOPTS="$SHELLOPTS" +} + +# load the saved set options +function load_set() { + _setopts="$-" + + # bash shellopts + for i in $(echo "$SHELLOPTS" | tr ':' ' ') ; do + set +o ${i} + done + for i in $(echo "$RUN_CSIT_SHELLOPTS" | tr ':' ' ') ; do + set -o ${i} + done + + # other options + for i in $(echo "$_setopts" | sed 's/./& /g') ; do + set +${i} + done + set -${RUN_CSIT_SAVE_SET} +} + +# set options for quick bailout when error +function harden_set() { + set -xeo pipefail + set +u # enabled it would probably fail too many often +} + +# relax set options so the sourced file will not fail +# the responsibility is shifted to the sourced file... +function relax_set() { + set +e + set +o pipefail +} + +# wrapper for sourcing a file +function source_safely() { + [ -z "$1" ] && return 1 + relax_set + . "$1" + load_set +} + +# +# main +# + +# set and save options for quick failure +harden_set && save_set + +if [ $# -eq 0 ] +then + echo + echo "Usage: $0 <project> [<robot-options>]" + echo + echo " <project> <robot-options>: " + echo + exit 1 +fi + +if [ -z "$WORKSPACE" ]; then + export WORKSPACE=$(git rev-parse --show-toplevel) +fi + +# Add csit scripts to PATH +export PATH="${PATH}:${WORKSPACE}/docker/csit:${WORKSPACE}/scripts:${ROBOT_VENV}/bin" +export SCRIPTS="${WORKSPACE}/docker/csit" +export ROBOT_VARIABLES= + +# get the plan from git clone +source ${SCRIPTS}/get-branch-mariadb.sh + +export PROJECT="${1}" +rm -rf ${WORKSPACE}/${PROJECT} +mkdir ${WORKSPACE}/${PROJECT} +cd ${WORKSPACE} + +# get the plan from git clone +if ! `git clone -b ${GERRIT_BRANCH} --single-branch git://gerrit-mirror-ap.onap.org/mirror/policy/${PROJECT}.git` ; then + echo "repo not found: policy/${PROJECT}" + exit 1 +fi + +# temp fix +cp -rf /root/${PROJECT}/csit ${WORKSPACE}/${PROJECT} + +if [ -f "${WORKSPACE}/${1}/csit/plans/testplan.txt" ]; then + export TESTPLAN="${1}" +else + echo "testplan not found: ${WORKSPACE}/${1}/csit/plans/testplan.txt" + exit 2 +fi + +export TESTOPTIONS="${2}" + +rm -rf "$WORKSPACE/archives/$TESTPLAN" +mkdir -p "$WORKSPACE/archives/$TESTPLAN" + +TESTPLANDIR="${WORKSPACE}/${TESTPLAN}" + +# Run installation of prerequired libraries +source_safely "${SCRIPTS}/prepare-csit.sh" + +# Activate the virtualenv containing all the required libraries installed by prepare-csit.sh +source_safely "${ROBOT_VENV}/bin/activate" + +WORKDIR=$(mktemp -d --suffix=-robot-workdir) +cd "${WORKDIR}" + +# Sign in to nexus3 docker repo +docker login -u docker -p docker nexus3.onap.org:10001 + +# Run setup script plan if it exists +cd "${TESTPLANDIR}/csit/plans/" +SETUP="${TESTPLANDIR}/csit/plans/setup.sh" +if [ -f "${SETUP}" ]; then + echo "Running setup script ${SETUP}" + source_safely "${SETUP}" +fi + +# show memory consumption after all docker instances initialized +docker_stats | tee "$WORKSPACE/archives/$TESTPLAN/_sysinfo-1-after-setup.txt" + +# Run test plan +cd "$WORKDIR" +echo "Reading the testplan:" +cat "${TESTPLANDIR}/csit/plans/testplan.txt" | egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' | sed "s|^|${TESTPLANDIR}/csit/tests/|" > testplan.txt +cat testplan.txt +SUITES=$( xargs -a testplan.txt ) + +echo ROBOT_VARIABLES="${ROBOT_VARIABLES}" +echo "Starting Robot test suites ${SUITES} ..." +relax_set +python -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES} +RESULT=$? +load_set +echo "RESULT: $RESULT" +# Note that the final steps are done in on_exit function after this exit! +exit $RESULT diff --git a/csit/wait_for_port.sh b/csit/wait_for_port.sh new file mode 100755 index 00000000..aec5f222 --- /dev/null +++ b/csit/wait_for_port.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# ============LICENSE_START==================================================== +# Copyright (C) 2021 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== + +tmout=120 +cmd= +while getopts c:t: opt; do + case "$opt" in + c) cmd="$OPTARG" ;; + t) tmout="$OPTARG" ;; + esac +done +nargs=$(expr $OPTIND - 1) +shift $nargs + +even_args=$(expr $# % 2) +if [ $# -lt 2 -o $even_args -ne 0 ]; then + echo "args: [-t timeout] [-c command] hostname1 port1 hostname2 port2 ..." >&2 + exit 1 +fi + +while [ $# -ge 2 ]; do + export host=$1 + export port=$2 + shift + shift + + echo "Waiting for $host port $port..." + timeout $tmout sh -c 'until nc -vz "$host" "$port"; do echo -n "."; + sleep 1; done' + rc=$? + + if [ $rc != 0 ]; then + echo "$host port $port cannot be reached" + exit $rc + fi +done + +$cmd + +exit 0 |