diff options
author | Liam Fallon <liam.fallon@est.tech> | 2022-02-17 12:57:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-02-17 12:57:59 +0000 |
commit | 6fe7a26007187510fad151dbbf8314c53787fe76 (patch) | |
tree | 7aaab320941748a357457ca87c4ca605662a8547 /csit | |
parent | 461a8bd824c06f42c717e6db55ba5cbb8b280c46 (diff) | |
parent | 7abe36cd557a9c2d5abebcf54a4ed5957a4168a1 (diff) |
Merge "Add docker configuration for Prometheus and Grafana"
Diffstat (limited to 'csit')
35 files changed, 931 insertions, 196 deletions
diff --git a/csit/apex-pdp/plans/setup.sh b/csit/apex-pdp/plans/setup.sh index 2bde0eae..1320b520 100644 --- a/csit/apex-pdp/plans/setup.sh +++ b/csit/apex-pdp/plans/setup.sh @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # Copyright (C) 2018 Ericsson. All rights reserved. # -# Modifications copyright (c) 2019, 2021 Nordix Foundation. +# Modifications Copyright (c) 2019-2022 Nordix Foundation. # Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. # Modifications Copyright (C) 2021 Bell Canada. All rights reserved. # ================================================================================ @@ -20,7 +20,6 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -source ${SCRIPTS}/get-branch-mariadb.sh echo "Uninstall docker-py and reinstall docker." python3 -m pip uninstall -y docker-py @@ -29,27 +28,27 @@ python3 -m pip install -U docker sudo apt-get -y install libxml2-utils -source ${SCRIPTS}/detmVers.sh +source "${SCRIPTS}"/get-versions.sh -docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d apex-pdp +docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d apex-pdp unset http_proxy https_proxy -POLICY_API_IP=`get-instance-ip.sh policy-api` -POLICY_PAP_IP=`get-instance-ip.sh policy-pap` -MARIADB_IP=`get-instance-ip.sh mariadb` -APEX_IP=`get-instance-ip.sh policy-apex-pdp` -SIM_IP=`get-instance-ip.sh simulator` +POLICY_API_IP=$(get-instance-ip.sh policy-api) +POLICY_PAP_IP=$(get-instance-ip.sh policy-pap) +MARIADB_IP=$(get-instance-ip.sh mariadb) +APEX_IP=$(get-instance-ip.sh policy-apex-pdp) +SIM_IP=$(get-instance-ip.sh simulator) export SIM_IP -echo PAP IP IS ${POLICY_PAP_IP} -echo MARIADB IP IS ${MARIADB_IP} -echo API IP IS ${POLICY_API_IP} -echo APEX IP IS ${APEX_IP} -echo DMAAP_IP IS ${SIM_IP} +echo PAP IP IS "${POLICY_PAP_IP}" +echo MARIADB IP IS "${MARIADB_IP}" +echo API IP IS "${POLICY_API_IP}" +echo APEX IP IS "${APEX_IP}" +echo DMAAP_IP IS "${SIM_IP}" # wait for the app to start up -${SCRIPTS}/wait_for_port.sh ${APEX_IP} 6969 +"${SCRIPTS}"/wait_for_port.sh "${APEX_IP}" 6969 ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCRIPTS:${SCRIPTS}" diff --git a/csit/apex-pdp/plans/teardown.sh b/csit/apex-pdp/plans/teardown.sh index f47fcd87..a44e3aab 100644 --- a/csit/apex-pdp/plans/teardown.sh +++ b/csit/apex-pdp/plans/teardown.sh @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # Copyright (C) 2018 Ericsson. All rights reserved. # -# Modifications copyright (c) 2019 Nordix Foundation. +# Modifications copyright (c) 2019-2022 Nordix Foundation. # Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,4 +20,9 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= +docker logs policy-api +docker logs simulator +docker logs policy-pap +docker logs apex-pdp + docker-compose -f ${SCRIPTS}/docker-compose-all.yml down -v diff --git a/csit/api/plans/setup.sh b/csit/api/plans/setup.sh index d20540d9..c8346e38 100644 --- a/csit/api/plans/setup.sh +++ b/csit/api/plans/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. -# Modification Copyright 2021. Nordix Foundation. +# Modifications Copyright 2021-2022 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,19 +18,15 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -# Select branch -source ${SCRIPTS}/get-branch-mariadb.sh - echo "Uninstall docker-py and reinstall docker." python3 -m pip uninstall -y docker-py python3 -m pip uninstall -y docker python3 -m pip install -U docker +source "${SCRIPTS}"/get-versions.sh sudo apt-get -y install libxml2-utils -bash ${SCRIPTS}/get-models-examples.sh - -source ${SCRIPTS}/detmVers.sh +bash "${SCRIPTS}"/get-models-examples.sh DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies @@ -44,22 +40,22 @@ sed -e 's!"version": "1.0.0"!"version": "2.0.0"!' \ ${DATA}/vCPE.policy.monitoring.input.tosca.json \ >${DATA}/vCPE.policy.monitoring.input.tosca.v2.json -echo ${POLICY_API_VERSION} +echo "${POLICY_API_VERSION}" -cd ${SCRIPTS} -docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d api +cd "${SCRIPTS}" +docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d api sleep 10 unset http_proxy https_proxy -POLICY_API_IP=`get-instance-ip.sh policy-api` -MARIADB_IP=`get-instance-ip.sh mariadb` +POLICY_API_IP=$(get-instance-ip.sh policy-api) +MARIADB_IP=$(get-instance-ip.sh mariadb) -echo API IP IS ${POLICY_API_IP} -echo MARIADB IP IS ${MARIADB_IP} +echo API IP IS "${POLICY_API_IP}" +echo MARIADB IP IS "${MARIADB_IP}" # wait for the app to start up -${SCRIPTS}/wait_for_port.sh ${POLICY_API_IP} 6969 +"${SCRIPTS}"/wait_for_port.sh "${POLICY_API_IP}" 6969 ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" diff --git a/csit/api/plans/teardown.sh b/csit/api/plans/teardown.sh index e101973f..71daccc6 100755 --- a/csit/api/plans/teardown.sh +++ b/csit/api/plans/teardown.sh @@ -1,6 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. +# Modifications copyright (c) 2022 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,4 +18,7 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= +docker logs policy-api +docker logs simulator + docker-compose -f ${SCRIPTS}/docker-compose-all.yml down -v diff --git a/csit/clamp/plans/setup.sh b/csit/clamp/plans/setup.sh index dbd5b6a4..d9a97dbf 100644 --- a/csit/clamp/plans/setup.sh +++ b/csit/clamp/plans/setup.sh @@ -1,6 +1,6 @@ #!/bin/bash # ============LICENSE_START======================================================= -# Copyright (C) 2021 Nordix Foundation. +# Copyright (C) 2021-2022 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -source ${SCRIPTS}/get-branch-mariadb.sh echo "Uninstall docker-py and reinstall docker." pip uninstall -y docker-py @@ -25,32 +24,32 @@ pip install -U docker==2.7.0 sudo apt-get -y install libxml2-utils -source ${SCRIPTS}/detmVers.sh +source "${SCRIPTS}"/get-versions.sh -docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d policy-clamp-cl-runtime +docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d policy-clamp-cl-runtime sleep 10 unset http_proxy https_proxy -POLICY_CONTROLLOOP_RUNTIME_IP=`get-instance-ip.sh policy-clamp-cl-runtime` -POLICY_PARTICIPANT_IP=`get-instance-ip.sh policy-clamp-cl-pf-ppnt` -K8S_PARTICIPANT_IP=`get-instance-ip.sh policy-clamp-cl-k8s-ppnt` -HTTP_PARTICIPANT_IP=`get-instance-ip.sh policy-clamp-cl-http-ppnt` -MARIADB_IP=`get-instance-ip.sh mariadb` -DMAAP_IP=`get-instance-ip.sh simulator` -POLICY_API_IP=`get-instance-ip.sh policy-api` - -echo MARIADB IP IS ${MARIADB_IP} -echo DMAAP_IP IS ${DMAAP_IP} -echo API IP IS ${POLICY_API_IP} -echo POLICY CONTROLLOOP RUNTIME IP IS ${POLICY_CONTROLLOOP_RUNTIME_IP} -echo POLICY PARTICIPANT IP IS ${POLICY_PARTICIPANT_IP} -echo K8S PARTICIPANT IP IS ${K8S_PARTICIPANT_IP} -echo HTTP PARTICIPANT IP IS ${HTTP_PARTICIPANT_IP} +POLICY_CONTROLLOOP_RUNTIME_IP=$(get-instance-ip.sh policy-clamp-cl-runtime) +POLICY_PARTICIPANT_IP=$(get-instance-ip.sh policy-clamp-cl-pf-ppnt) +K8S_PARTICIPANT_IP=$(get-instance-ip.sh policy-clamp-cl-k8s-ppnt) +HTTP_PARTICIPANT_IP=$(get-instance-ip.sh policy-clamp-cl-http-ppnt) +MARIADB_IP=$(get-instance-ip.sh mariadb) +DMAAP_IP=$(get-instance-ip.sh simulator) +POLICY_API_IP=$(get-instance-ip.sh policy-api) + +echo MARIADB IP IS "${MARIADB_IP}" +echo DMAAP_IP IS "${DMAAP_IP}" +echo API IP IS "${POLICY_API_IP}" +echo POLICY CONTROLLOOP RUNTIME IP IS "${POLICY_CONTROLLOOP_RUNTIME_IP}" +echo POLICY PARTICIPANT IP IS "${POLICY_PARTICIPANT_IP}" +echo K8S PARTICIPANT IP IS "${K8S_PARTICIPANT_IP}" +echo HTTP PARTICIPANT IP IS "${HTTP_PARTICIPANT_IP}" # wait for the app to start up -${SCRIPTS}/wait_for_port.sh ${POLICY_CONTROLLOOP_RUNTIME_IP} 6969 -${SCRIPTS}/wait_for_port.sh ${POLICY_API_IP} 6969 +"${SCRIPTS}"/wait_for_port.sh "${POLICY_CONTROLLOOP_RUNTIME_IP}" 6969 +"${SCRIPTS}"/wait_for_port.sh "${POLICY_API_IP}" 6969 ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_CONTROLLOOP_RUNTIME_IP:${POLICY_CONTROLLOOP_RUNTIME_IP}" diff --git a/csit/compose-grafana.yml b/csit/compose-grafana.yml new file mode 100644 index 00000000..9c5f7364 --- /dev/null +++ b/csit/compose-grafana.yml @@ -0,0 +1,241 @@ +# +# ===========LICENSE_START==================================================== +# Copyright (C) 2022 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. +# ============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-db-migrator: + image: nexus3.onap.org:10001/onap/policy-db-migrator:${POLICY_DOCKER_VERSION} + container_name: policy-db-migrator + hostname: policy-db-migrator + depends_on: + - mariadb + expose: + - 6824 + env_file: config/db/db.conf + environment: + SQL_DB: policyadmin + SQL_HOST: mariadb + volumes: + - ./db_migrator_policy_init.sh:/opt/app/policy/bin/db_migrator_policy_init.sh: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/bin/db_migrator_policy_init.sh', + 'mariadb', '3306' + ] + simulator: + image: nexus3.onap.org:10001/onap/policy-models-simulator:${POLICY_MODELS_VERSION} + container_name: simulator + hostname: simulator + networks: + default: + aliases: + - message-router + - aai-sim + - grpc-sim + - sdnc-sim + - so-sim + - vfc-sim + volumes: + - ./config/sim-all:/opt/app/policy/simulators/etc/mounted:ro + expose: + - 6666 + - 6668 + - 6669 + - 6670 + - 3904 + - 6680 + api: + image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} + container_name: policy-api + depends_on: + - policy-db-migrator + hostname: policy-api + expose: + - 6969 + volumes: + - ./config/api/apiParameters.yaml:/opt/app/policy/api/etc/apiParameters.yaml:ro + - ./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', + 'policy-db-migrator', '6824' + ] + pap: + image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} + container_name: policy-pap + depends_on: + - mariadb + - simulator + - api + hostname: policy-pap + expose: + - 6969 + volumes: + - ./config/pap/papParameters.yaml:/opt/app/policy/pap/etc/papParameters.yaml:ro + - ./config/pap/groups.json:/opt/app/policy/pap/etc/mounted/groups.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', + 'message-router', '3904', + '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 + - simulator + - 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', + 'message-router', '3904', + 'pap', '6969' + ] + drools: + image: nexus3.onap.org:10001/onap/policy-drools:${POLICY_DROOLS_VERSION} + container_name: drools + depends_on: + - mariadb + - simulator + - 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', + 'message-router', '3904' + ] + drools-apps: + image: nexus3.onap.org:10001/onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION} + container_name: drools-apps + depends_on: + - mariadb + - simulator + - pap + - xacml-pdp + hostname: drools-apps + expose: + - 6969 + - 9696 + volumes: + - ./config/drools-apps/custom:/tmp/policy-install/config:ro + - ./config/drools-apps/custom/feature-lifecycle.properties:/opt/app/policy/features/lifecycle/config/feature-lifecycle.properties: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', + 'message-router', '3904', + 'pap', '6969', + 'aai-sim', '6666', + 'sdnc-sim', '6668', + 'so-sim', '6669', + 'vfc-sim', '6670' + ] + apex-pdp: + image: nexus3.onap.org:10001/onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} + container_name: policy-apex-pdp + depends_on: + - mariadb + - simulator + - 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', + 'message-router', '3904', + '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 + - ./distribution/config/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', + 'message-router', '3904', + 'pap', '6969', + 'apex-pdp', '6969' + ] + prometheus: + image: prom/prometheus:v2.32.1 + container_name: prometheus + hostname: prometheus + expose: + - 9090 + volumes: + - ./metrics/prometheus.yml:/etc/prometheus/prometheus.yml + grafana: + image: grafana/grafana-oss:8.3.4 + container_name: grafana + depends_on: + - prometheus + hostname: grafana + expose: + - 3000 diff --git a/csit/config/apex-pdp/OnapPfConfig.json b/csit/config/apex-pdp/OnapPfConfig.json index d46a8b20..74085a19 100644 --- a/csit/config/apex-pdp/OnapPfConfig.json +++ b/csit/config/apex-pdp/OnapPfConfig.json @@ -5,7 +5,7 @@ "port": 6969, "userName": "healthcheck", "password": "zb!XztG34", - "https": true, + "https": {{HTTPS_ENABLED}}, "prometheus": true }, "pdpStatusParameters":{ @@ -29,13 +29,13 @@ "topic" : "POLICY-PDP-PAP", "servers" : [ "message-router" ], "topicCommInfrastructure" : "dmaap", - "useHttps" : true + "useHttps" : {{HTTPS_ENABLED}} }], "topicSinks" : [{ "topic" : "POLICY-PDP-PAP", "servers" : [ "message-router" ], "topicCommInfrastructure" : "dmaap", - "useHttps" : true + "useHttps" : {{HTTPS_ENABLED}} }] } } diff --git a/csit/config/api/apiParameters.yaml b/csit/config/api/apiParameters.yaml new file mode 100644 index 00000000..93b7c1b8 --- /dev/null +++ b/csit/config/api/apiParameters.yaml @@ -0,0 +1,67 @@ +server: + port: 6969 + ssl: + enabled: false + +spring: + security.user: + name: policyadmin + password: zb!XztG34 + mvc.converters.preferred-json-mapper: gson + +policy-api: + name: ApiGroup + aaf: false + +database: + name: PolicyProviderParameterGroup + implementation: org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl + driver: org.mariadb.jdbc.Driver + url: jdbc:mariadb://mariadb:3306/policyadmin + user: policy_user + password: policy_user + persistenceUnit: PolicyDb + +policy-preload: + policyTypes: + - policytypes/onap.policies.monitoring.tcagen2.yaml + - policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml + - policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml + - policytypes/onap.policies.monitoring.dcae-pm-subscription-handler.yaml + - policytypes/onap.policies.monitoring.dcae-pm-mapper.yaml + - policytypes/onap.policies.Optimization.yaml + - policytypes/onap.policies.optimization.Resource.yaml + - policytypes/onap.policies.optimization.Service.yaml + - policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml + - policytypes/onap.policies.optimization.resource.DistancePolicy.yaml + - policytypes/onap.policies.optimization.resource.HpaPolicy.yaml + - policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml + - policytypes/onap.policies.optimization.resource.PciPolicy.yaml + - policytypes/onap.policies.optimization.service.QueryPolicy.yaml + - policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml + - policytypes/onap.policies.optimization.resource.Vim_fit.yaml + - policytypes/onap.policies.optimization.resource.VnfPolicy.yaml + - policytypes/onap.policies.controlloop.guard.Common.yaml + - policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml + - policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml + - policytypes/onap.policies.controlloop.guard.common.MinMax.yaml + - policytypes/onap.policies.controlloop.guard.common.Filter.yaml + - policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml + - policytypes/onap.policies.Naming.yaml + - policytypes/onap.policies.Match.yaml + - policytypes/onap.policies.native.Drools.yaml + - policytypes/onap.policies.native.Xacml.yaml + - policytypes/onap.policies.native.Apex.yaml + - policytypes/onap.policies.controlloop.operational.Common.yaml + - policytypes/onap.policies.controlloop.operational.common.Apex.yaml + - policytypes/onap.policies.controlloop.operational.common.Drools.yaml + policies: + - policies/sdnc.policy.naming.input.tosca.yaml + +management: + endpoints: + web: + base-path: / + exposure: + include: health,metrics,prometheus + path-mapping.prometheus: metrics
\ No newline at end of file diff --git a/csit/config/distribution/defaultConfig.json b/csit/config/distribution/defaultConfig.json index 05640d92..50cb822e 100644 --- a/csit/config/distribution/defaultConfig.json +++ b/csit/config/distribution/defaultConfig.json @@ -5,7 +5,7 @@ "port":6969, "userName":"healthcheck", "password":"zb!XztG34", - "https": true, + "https": {{HTTPS_ENABLED}}, "prometheus": true }, "receptionHandlerParameters":{ @@ -59,7 +59,7 @@ "port": 6969, "userName": "policyadmin", "password": "zb!XztG34", - "useHttps": true + "useHttps": {{HTTPS_ENABLED}} }, "papParameters": { "clientName": "policy-pap", @@ -67,7 +67,7 @@ "port": 6969, "userName": "policyadmin", "password": "zb!XztG34", - "useHttps": true + "useHttps": {{HTTPS_ENABLED}} }, "deployPolicies": true } diff --git a/csit/config/drools-apps/custom/feature-lifecycle.properties b/csit/config/drools-apps/custom/feature-lifecycle.properties index 911cdca5..edf0759f 100644 --- a/csit/config/drools-apps/custom/feature-lifecycle.properties +++ b/csit/config/drools-apps/custom/feature-lifecycle.properties @@ -29,10 +29,10 @@ dmaap.source.topics.POLICY-PDP-PAP.servers=${envd:DMAAP_SERVERS} dmaap.source.topics.POLICY-PDP-PAP.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC} dmaap.source.topics.POLICY-PDP-PAP.apiKey=${envd:POLICY_PDP_PAP_API_KEY} dmaap.source.topics.POLICY-PDP-PAP.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET} -dmaap.source.topics.POLICY-PDP-PAP.https=true +dmaap.source.topics.POLICY-PDP-PAP.https={{HTTPS_ENABLED}} dmaap.sink.topics.POLICY-PDP-PAP.servers=${envd:DMAAP_SERVERS} dmaap.sink.topics.POLICY-PDP-PAP.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC} dmaap.sink.topics.POLICY-PDP-PAP.apiKey=${envd:POLICY_PDP_PAP_API_KEY} dmaap.sink.topics.POLICY-PDP-PAP.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET} -dmaap.sink.topics.POLICY-PDP-PAP.https=true +dmaap.sink.topics.POLICY-PDP-PAP.https={{HTTPS_ENABLED}} diff --git a/csit/config/drools-apps/env/base.conf b/csit/config/drools-apps/env/base.conf index 3ec5e831..9a3f80da 100644 --- a/csit/config/drools-apps/env/base.conf +++ b/csit/config/drools-apps/env/base.conf @@ -59,7 +59,7 @@ AAF_HOST=aaf.api.simpledemo.onap.org # HTTP Servers -HTTP_SERVER_HTTPS=true +HTTP_SERVER_HTTPS={{HTTPS_ENABLED}} PROMETHEUS=true # PDP-D DMaaP configuration channel diff --git a/csit/config/drools/env/base.conf b/csit/config/drools/env/base.conf index 8f3c4c0d..9871d62c 100644 --- a/csit/config/drools/env/base.conf +++ b/csit/config/drools/env/base.conf @@ -59,7 +59,7 @@ AAF_HOST=aaf.api.simpledemo.onap.org # HTTP Servers -HTTP_SERVER_HTTPS=true +HTTP_SERVER_HTTPS={{HTTPS_ENABLED}} PROMETHEUS=true # PDP-D DMaaP configuration channel diff --git a/csit/config/pap/papParameters.yaml b/csit/config/pap/papParameters.yaml index 8b4c0ce3..00912def 100644 --- a/csit/config/pap/papParameters.yaml +++ b/csit/config/pap/papParameters.yaml @@ -24,7 +24,7 @@ spring: server: port: 6969 ssl: - enabled: true + enabled: {{HTTPS_ENABLED}} pap: name: PapGroup @@ -43,7 +43,7 @@ pap: servers: - message-router topicCommInfrastructure: dmaap - useHttps: true + useHttps: {{HTTPS_ENABLED}} fetchTimeout: 15000 - topic: POLICY-HEARTBEAT effectiveTopic: POLICY-PDP-PAP @@ -51,26 +51,26 @@ pap: servers: - message-router topicCommInfrastructure: dmaap - useHttps: true + useHttps: {{HTTPS_ENABLED}} fetchTimeout: 15000 topicSinks: - topic: POLICY-PDP-PAP servers: - message-router topicCommInfrastructure: dmaap - useHttps: true + useHttps: {{HTTPS_ENABLED}} - topic: POLICY-NOTIFICATION servers: - message-router topicCommInfrastructure: dmaap - useHttps: true + useHttps: {{HTTPS_ENABLED}} healthCheckRestClientParameters: - clientName: api hostname: policy-api port: 6969 userName: policyadmin password: zb!XztG34 - useHttps: true + useHttps: {{HTTPS_ENABLED}} basePath: policy/api/v1/healthcheck management: diff --git a/csit/config/sim-all/simParameters.json b/csit/config/sim-all/simParameters.json index e33710c9..3d348125 100644 --- a/csit/config/sim-all/simParameters.json +++ b/csit/config/sim-all/simParameters.json @@ -8,15 +8,15 @@ "name": "DMaaP simulator", "providerClass": "org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1", "host": "0.0.0.0", - "port": 3905, - "https": true + "port": {{MESSAGE_ROUTER_PORT}}, + "https": {{HTTPS_ENABLED}} }, { "name": "A&AI simulator", "providerClass": "org.onap.policy.simulators.AaiSimulatorJaxRs", "host": "0.0.0.0", "port": 6666, - "https": true, + "https": {{HTTPS_ENABLED}}, "userName": "policy@policy.onap.org", "password": "demo123456!", "resourceLocation": "/opt/app/policy/simulators/etc/mounted/aairesponse/" @@ -26,7 +26,7 @@ "providerClass": "org.onap.policy.simulators.SdncSimulatorJaxRs", "host": "0.0.0.0", "port": 6668, - "https": true + "https": {{HTTPS_ENABLED}} }, { "name": "SO simulator", @@ -42,7 +42,7 @@ "providerClass": "org.onap.policy.simulators.VfcSimulatorJaxRs", "host": "0.0.0.0", "port": 6670, - "https": true + "https": {{HTTPS_ENABLED}} } ], "topicSinks": [ @@ -50,7 +50,7 @@ "topic": "APPC-CL", "servers": ["${HOST_NAME}"], "topicCommInfrastructure": "DMAAP", - "useHttps": true, + "useHttps": {{HTTPS_ENABLED}}, "apiKey": "some-key", "apiSecret": "some-secret" }, @@ -58,7 +58,7 @@ "topic": "APPC-LCM-WRITE", "servers": ["${HOST_NAME}"], "topicCommInfrastructure": "DMAAP", - "useHttps": true, + "useHttps": {{HTTPS_ENABLED}}, "apiKey": "some-key", "apiSecret": "some-secret" } @@ -68,7 +68,7 @@ "topic": "APPC-CL", "servers": ["${HOST_NAME}"], "topicCommInfrastructure": "DMAAP", - "useHttps": true, + "useHttps": {{HTTPS_ENABLED}}, "apiKey": "some-key", "apiSecret": "some-secret" }, @@ -76,7 +76,7 @@ "topic": "APPC-LCM-READ", "servers": ["${HOST_NAME}"], "topicCommInfrastructure": "DMAAP", - "useHttps": true, + "useHttps": {{HTTPS_ENABLED}}, "apiKey": "some-key", "apiSecret": "some-secret" } diff --git a/csit/config/xacml-pdp/defaultConfig.json b/csit/config/xacml-pdp/defaultConfig.json index e2536ce1..6ee07698 100644 --- a/csit/config/xacml-pdp/defaultConfig.json +++ b/csit/config/xacml-pdp/defaultConfig.json @@ -7,7 +7,7 @@ "port": 6969, "userName": "healthcheck", "password": "zb!XztG34", - "https": true, + "https": {{HTTPS_ENABLED}}, "aaf": false, "prometheus": true }, @@ -16,7 +16,7 @@ "port": 6969, "userName": "policyadmin", "password": "zb!XztG34", - "useHttps": true, + "useHttps": {{HTTPS_ENABLED}}, "aaf": false }, "applicationParameters": { @@ -27,13 +27,13 @@ "topic" : "POLICY-PDP-PAP", "servers" : [ "message-router" ], "topicCommInfrastructure" : "dmaap", - "useHttps" : true + "useHttps" : {{HTTPS_ENABLED}} }], "topicSinks" : [{ "topic" : "POLICY-PDP-PAP", "servers" : [ "message-router" ], "topicCommInfrastructure" : "dmaap", - "useHttps" : true + "useHttps" : {{HTTPS_ENABLED}} }] } } diff --git a/csit/distribution/plans/setup.sh b/csit/distribution/plans/setup.sh index df0bdb1f..b7495007 100644 --- a/csit/distribution/plans/setup.sh +++ b/csit/distribution/plans/setup.sh @@ -1,10 +1,8 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2018 Ericsson. All rights reserved. -# -# Modifications copyright (c) 2019 Nordix Foundation. +# Modifications Copyright (c) 2019-2022 Nordix Foundation. # Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. -# Modification Copyright 2021. Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +18,6 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -source ${SCRIPTS}/get-branch-mariadb.sh echo "Uninstall docker-py and reinstall docker." python3 -m pip uninstall -y docker-py @@ -29,37 +26,37 @@ python3 -m pip install -U docker sudo apt-get -y install libxml2-utils -source ${SCRIPTS}/detmVers.sh +source "${SCRIPTS}"/get-versions.sh SCRIPT_DIR=${TESTPLANDIR}/config # Remaking the csar file in case if the file got corrupted -zip -F ${SCRIPT_DIR}/csar/sample_csar_with_apex_policy.csar --out ${SCRIPT_DIR}/csar/csar_temp.csar +zip -F "${SCRIPT_DIR}"/csar/sample_csar_with_apex_policy.csar --out "${SCRIPT_DIR}"/csar/csar_temp.csar # Remake temp directory -rm -rf ${SCRIPT_DIR}/temp -mkdir ${SCRIPT_DIR}/temp +rm -rf "${SCRIPT_DIR}"/temp +mkdir "${SCRIPT_DIR}"/temp -docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d distribution +docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d distribution unset http_proxy https_proxy -POLICY_API_IP=`get-instance-ip.sh policy-api` -POLICY_PAP_IP=`get-instance-ip.sh policy-pap` -MARIADB_IP=`get-instance-ip.sh mariadb` -APEX_IP=`get-instance-ip.sh policy-apex-pdp` -DMAAP_IP=`get-instance-ip.sh simulator` -POLICY_DISTRIBUTION_IP=`get-instance-ip.sh policy-distribution` +POLICY_API_IP=$(get-instance-ip.sh policy-api) +POLICY_PAP_IP=$(get-instance-ip.sh policy-pap) +MARIADB_IP=$(get-instance-ip.sh mariadb) +APEX_IP=$(get-instance-ip.sh policy-apex-pdp) +DMAAP_IP=$(get-instance-ip.sh simulator) +POLICY_DISTRIBUTION_IP=$(get-instance-ip.sh policy-distribution) -echo PAP IP IS ${POLICY_PAP_IP} -echo MARIADB IP IS ${MARIADB_IP} -echo API IP IS ${POLICY_API_IP} -echo APEX IP IS ${APEX_IP} -echo DMAAP_IP IS ${DMAAP_IP} -echo POLICY_DISTRIBUTION_IP IS ${POLICY_DISTRIBUTION_IP} +echo PAP IP IS "${POLICY_PAP_IP}" +echo MARIADB IP IS "${MARIADB_IP}" +echo API IP IS "${POLICY_API_IP}" +echo APEX IP IS "${APEX_IP}" +echo DMAAP_IP IS "${DMAAP_IP}" +echo POLICY_DISTRIBUTION_IP IS "${POLICY_DISTRIBUTION_IP}" # wait for the app to start up -${SCRIPTS}/wait_for_port.sh ${POLICY_DISTRIBUTION_IP} 6969 +"${SCRIPTS}"/wait_for_port.sh "${POLICY_DISTRIBUTION_IP}" 6969 ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v APEX_IP:${APEX_IP}" diff --git a/csit/distribution/plans/teardown.sh b/csit/distribution/plans/teardown.sh index f47fcd87..e451ba66 100644 --- a/csit/distribution/plans/teardown.sh +++ b/csit/distribution/plans/teardown.sh @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # Copyright (C) 2018 Ericsson. All rights reserved. # -# Modifications copyright (c) 2019 Nordix Foundation. +# Modifications copyright (c) 2019-2022 Nordix Foundation. # Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,4 +20,9 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= +docker logs policy-api +docker logs simulator +docker logs policy-pap +docker logs policy-distribution + docker-compose -f ${SCRIPTS}/docker-compose-all.yml down -v diff --git a/csit/drools-applications/plans/setup.sh b/csit/drools-applications/plans/setup.sh index 438f82b2..6ca073bc 100755 --- a/csit/drools-applications/plans/setup.sh +++ b/csit/drools-applications/plans/setup.sh @@ -2,7 +2,7 @@ # # ===========LICENSE_START==================================================== # Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. -# Modification Copyright 2021. Nordix Foundation. +# Modifications Copyright 2021-2022 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ # limitations under the License. # ============LICENSE_END===================================================== # -source ${SCRIPTS}/get-branch-mariadb.sh echo "Uninstall docker-py and reinstall docker." python3 -m pip uninstall -y docker-py @@ -26,28 +25,28 @@ python3 -m pip install -U docker sudo apt-get -y install libxml2-utils -bash ${SCRIPTS}/get-models-examples.sh -source ${SCRIPTS}/detmVers.sh +source "${SCRIPTS}"/get-versions.sh +bash "${SCRIPTS}"/get-models-examples.sh -docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d drools-apps +docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d drools-apps unset http_proxy https_proxy -DROOLS_IP=`get-instance-ip.sh drools-apps` -API_IP=`get-instance-ip.sh policy-api` -PAP_IP=`get-instance-ip.sh policy-pap` -XACML_IP=`get-instance-ip.sh policy-xacml-pdp` -SIM_IP=`get-instance-ip.sh simulator` +DROOLS_IP=$(get-instance-ip.sh drools-apps) +API_IP=$(get-instance-ip.sh policy-api) +PAP_IP=$(get-instance-ip.sh policy-pap) +XACML_IP=$(get-instance-ip.sh policy-xacml-pdp) +SIM_IP=$(get-instance-ip.sh simulator) export SIM_IP -echo DROOLS IP IS ${DROOLS_IP} -echo API IP IS ${API_IP} -echo PAP IP IS ${PAP_IP} -echo XACML IP IS ${XACML_IP} -echo SIMULATORS IP IS ${SIM_IP} +echo DROOLS IP IS "${DROOLS_IP}" +echo API IP IS "${API_IP}" +echo PAP IP IS "${PAP_IP}" +echo XACML IP IS "${XACML_IP}" +echo SIMULATORS IP IS "${SIM_IP}" # wait for the app to start up -${SCRIPTS}/wait_for_port.sh ${DROOLS_IP} 6969 +"${SCRIPTS}"/wait_for_port.sh "${DROOLS_IP}" 6969 # give enough time for the controllers to come up sleep 15 diff --git a/csit/drools-applications/plans/teardown.sh b/csit/drools-applications/plans/teardown.sh index ce89740d..f1a8624f 100755 --- a/csit/drools-applications/plans/teardown.sh +++ b/csit/drools-applications/plans/teardown.sh @@ -2,6 +2,7 @@ # # ===========LICENSE_START==================================================== # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. +# Modifications copyright (c) 2022 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,4 +17,11 @@ # limitations under the License. # ============LICENSE_END===================================================== # + +docker logs policy-api +docker logs simulator +docker logs policy-pap +docker logs xacml-pdp +docker logs drools-apps + docker-compose -f ${SCRIPTS}/docker-compose-all.yml down -v diff --git a/csit/drools-pdp/plans/setup.sh b/csit/drools-pdp/plans/setup.sh index 6b02e76a..987c453c 100755 --- a/csit/drools-pdp/plans/setup.sh +++ b/csit/drools-pdp/plans/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright 2017-2021 AT&T Intellectual Property. All rights reserved. -# Modification Copyright 2021. Nordix Foundation. +# Modifications Copyright 2021-2022 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,9 +17,6 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -source ${SCRIPTS}/get-branch-mariadb.sh - -# OS upgrades echo "Uninstall docker-py and reinstall docker." python3 -m pip uninstall -y docker-py @@ -28,20 +25,21 @@ python3 -m pip install -U docker sudo apt-get -y install libxml2-utils -source ${SCRIPTS}/detmVers.sh +source "${SCRIPTS}"/get-versions.sh -docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d drools +docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d drools -POLICY_DROOLS_IP=`get-instance-ip.sh drools` -MARIADB_IP=`get-instance-ip.sh mariadb` +POLICY_DROOLS_IP=$(get-instance-ip.sh drools) +MARIADB_IP=$(get-instance-ip.sh mariadb) -echo DROOLS IP IS ${POLICY_DROOLS_IP} -echo MARIADB IP IS ${MARIADB_IP} +echo DROOLS IP IS "${POLICY_DROOLS_IP}" +echo MARIADB IP IS "${MARIADB_IP}" -# wait for the app to start up - looking for telemtry service on port 9696 -${SCRIPTS}/wait_for_port.sh ${POLICY_DROOLS_IP} 9696 +# wait for the app to start up - looking for telemetry service on port 9696 +"${SCRIPTS}"/wait_for_port.sh "${POLICY_DROOLS_IP}" 9696 # give enough time for the controllers to come up sleep 15 -ROBOT_VARIABLES="-v POLICY_DROOLS_IP:${POLICY_DROOLS_IP}" +ROBOT_VARIABLES="" +ROBOT_VARIABLES="${ROBOT_VARIABLES}-v POLICY_DROOLS_IP:${POLICY_DROOLS_IP}" diff --git a/csit/drools-pdp/plans/teardown.sh b/csit/drools-pdp/plans/teardown.sh index d16c1647..6ec00513 100755 --- a/csit/drools-pdp/plans/teardown.sh +++ b/csit/drools-pdp/plans/teardown.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright 2017-2021 AT&T Intellectual Property. All rights reserved. -# +# Modifications copyright (c) 2022 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,4 +16,9 @@ # limitations under the License. # ============LICENSE_END========================================================= +docker logs policy-api +docker logs simulator +docker logs policy-pap +docker logs drools + docker-compose -f ${SCRIPTS}/docker-compose-all.yml down -v diff --git a/csit/get-branch-mariadb.sh b/csit/get-branch.sh index 46af8f83..3ce51315 100644 --- a/csit/get-branch-mariadb.sh +++ b/csit/get-branch.sh @@ -1,5 +1,6 @@ # ============LICENSE_START==================================================== # Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. +# Modifications Copyright 2022 Nordix Foundation. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,10 +17,9 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END====================================================== -export POLICY_MARIADB_VER=10.5.8 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} +echo GERRIT_BRANCH="${GERRIT_BRANCH}" diff --git a/csit/get-models-examples.sh b/csit/get-models-examples.sh index e83b0245..fe75c90d 100644 --- a/csit/get-models-examples.sh +++ b/csit/get-models-examples.sh @@ -2,6 +2,7 @@ # # ============LICENSE_START=================================================== # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. +# Modifications Copyright 2022 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,11 +18,11 @@ # ============LICENSE_END===================================================== # -source ${SCRIPTS}/get-branch-mariadb.sh +source "${SCRIPTS}"/get-branch.sh -rm -rf ${WORKSPACE}/models -mkdir ${WORKSPACE}/models -cd ${WORKSPACE} +rm -rf "${WORKSPACE}"/models +mkdir "${WORKSPACE}"/models +cd "${WORKSPACE}" # download models examples -git clone -b ${GERRIT_BRANCH} --single-branch https://github.com/onap/policy-models.git models +git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-models.git models diff --git a/csit/detmVers.sh b/csit/get-versions.sh index 13e8fbe6..5abc747f 100644 --- a/csit/detmVers.sh +++ b/csit/get-versions.sh @@ -1,6 +1,6 @@ # ============LICENSE_START==================================================== # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. -# Modification Copyright 2021. Nordix Foundation. +# Modification Copyright 2021-2022 Nordix Foundation. # Modifications Copyright (C) 2021 Bell Canada. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,46 +18,47 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END====================================================== -source ${SCRIPTS}/get-branch-mariadb.sh +source "${SCRIPTS}"/get-branch.sh +export POLICY_MARIADB_VER=10.5.8 echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER} function getVersion { REPO=$1 curl -qL --silent \ - https://github.com/onap/policy-$REPO/raw/${GERRIT_BRANCH}/pom.xml | + https://github.com/onap/policy-"$REPO"/raw/"${GERRIT_BRANCH}"/pom.xml | xmllint --xpath \ '/*[local-name()="project"]/*[local-name()="version"]/text()' - | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}' } export POLICY_MODELS_VERSION=$(getVersion models) -echo POLICY_MODELS_VERSION=${POLICY_MODELS_VERSION} +echo POLICY_MODELS_VERSION="${POLICY_MODELS_VERSION}" export POLICY_API_VERSION=$(getVersion api) -echo POLICY_API_VERSION=${POLICY_API_VERSION} +echo POLICY_API_VERSION="${POLICY_API_VERSION}" export POLICY_PAP_VERSION=$(getVersion pap) -echo POLICY_PAP_VERSION=${POLICY_PAP_VERSION} +echo POLICY_PAP_VERSION="${POLICY_PAP_VERSION}" export POLICY_XACML_PDP_VERSION=$(getVersion xacml-pdp) -echo POLICY_XACML_PDP_VERSION=${POLICY_XACML_PDP_VERSION} +echo POLICY_XACML_PDP_VERSION="${POLICY_XACML_PDP_VERSION}" export POLICY_DROOLS_VERSION=$(getVersion drools-pdp) -echo POLICY_DROOLS_VERSION=${POLICY_DROOLS_VERSION} +echo POLICY_DROOLS_VERSION="${POLICY_DROOLS_VERSION}" export POLICY_DROOLS_APPS_VERSION=$(getVersion drools-applications) -echo POLICY_DROOLS_APPS_VERSION=${POLICY_DROOLS_APPS_VERSION} +echo POLICY_DROOLS_APPS_VERSION="${POLICY_DROOLS_APPS_VERSION}" export POLICY_APEX_PDP_VERSION=$(getVersion apex-pdp) -echo POLICY_APEX_PDP_VERSION=${POLICY_APEX_PDP_VERSION} +echo POLICY_APEX_PDP_VERSION="${POLICY_APEX_PDP_VERSION}" export POLICY_DISTRIBUTION_VERSION=$(getVersion distribution) -echo POLICY_DISTRIBUTION_VERSION=${POLICY_DISTRIBUTION_VERSION} +echo POLICY_DISTRIBUTION_VERSION="${POLICY_DISTRIBUTION_VERSION}" export POLICY_CLAMP_VERSION=$(getVersion clamp) -echo POLICY_CLAMP_VERSION=${POLICY_CLAMP_VERSION} +echo POLICY_CLAMP_VERSION="${POLICY_CLAMP_VERSION}" export POLICY_DOCKER_VERSION=$(getVersion docker) -echo POLICY_DOCKER_VERSION=${POLICY_DOCKER_VERSION} +echo POLICY_DOCKER_VERSION="${POLICY_DOCKER_VERSION}" diff --git a/csit/metrics/policy-dashboard-example.json b/csit/metrics/policy-dashboard-example.json new file mode 100644 index 00000000..ac479247 --- /dev/null +++ b/csit/metrics/policy-dashboard-example.json @@ -0,0 +1,173 @@ +{ + "panels": [ + { + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "GdZ1Voanz" + }, + "exemplar": true, + "expr": "jvm_memory_bytes_used{area=\"heap\"}", + "interval": "", + "legendFormat": "{{job}}", + "refId": "A" + } + ], + "title": "jvm_memory_bytes_used heap", + "type": "timeseries" + }, + { + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "GdZ1Voanz" + }, + "exemplar": true, + "expr": "jvm_threads_current{}", + "interval": "", + "legendFormat": "{{job}}", + "refId": "A" + } + ], + "title": "jvm_threads_current", + "type": "timeseries" + } + ] +}
\ No newline at end of file diff --git a/csit/metrics/prometheus.yml b/csit/metrics/prometheus.yml new file mode 100644 index 00000000..255ecd08 --- /dev/null +++ b/csit/metrics/prometheus.yml @@ -0,0 +1,101 @@ +# +# ===========LICENSE_START==================================================== +# Copyright (C) 2022 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. +# ============LICENSE_END===================================================== +# + +# my global config +global: + scrape_interval: 60s # Set the scrape interval to every 15 seconds. Default is every 1 minute. + evaluation_interval: 60s # Evaluate rules every 15 seconds. The default is every 1 minute. + #scrape_timeout is set to the global default (10s). + +# Alertmanager configuration +alerting: + alertmanagers: + - static_configs: + - targets: + # - alertmanager:9093 + +# Load rules once and periodically evaluate them according to the global 'evaluation_interval'. +rule_files: + # - "first_rules.yml" + # - "second_rules.yml" + +# A scrape configuration containing exactly one endpoint to scrape: +# Here it's Prometheus itself. +scrape_configs: + # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. +# - job_name: "prometheus" +# +# # metrics_path defaults to '/metrics' +# # scheme defaults to 'http'. +# +# static_configs: +# - targets: ["localhost:9090"] + + - job_name: "api-metrics" + static_configs: + - targets: ["policy-api:6969"] + basic_auth: + username: policyadmin + password: "zb!XztG34" + + - job_name: "pap-metrics" + static_configs: + - targets: ["policy-pap:6969"] + basic_auth: + username: policyadmin + password: "zb!XztG34" + + - job_name: "apex-pdp-metrics" + static_configs: + - targets: + - "policy-apex-pdp:6969" + basic_auth: + username: "healthcheck" + password: "zb!XztG34" + + - job_name: "drools-apps-metrics" + static_configs: + - targets: + - "drools-apps:9696" + basic_auth: + username: "demo@people.osaaf.org" + password: "demo123456!" + + - job_name: "drools-pdp-metrics" + static_configs: + - targets: + - "drools:9696" + basic_auth: + username: "demo@people.osaaf.org" + password: "demo123456!" + + - job_name: "distribution-metrics" + static_configs: + - targets: + - "policy-distribution:6969" + basic_auth: + username: "healthcheck" + password: "zb!XztG34" + + - job_name: "xacml-pdp-metrics" + static_configs: + - targets: + - "policy-xacml-pdp:6969" + basic_auth: + username: "healthcheck" + password: "zb!XztG34" diff --git a/csit/pap/plans/setup.sh b/csit/pap/plans/setup.sh index f65e857f..94a3b31b 100644 --- a/csit/pap/plans/setup.sh +++ b/csit/pap/plans/setup.sh @@ -1,8 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= -# Copyright (C) 2019 Nordix Foundation. +# Copyright (C) 2019-2022 Nordix Foundation. # Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. -# Modification Copyright 2021. Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,33 +18,30 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -source ${SCRIPTS}/get-branch-mariadb.sh - echo "Uninstall docker-py and reinstall docker." python3 -m pip uninstall -y docker-py python3 -m pip uninstall -y docker python3 -m pip install -U docker sudo apt-get -y install libxml2-utils -bash ${SCRIPTS}/get-models-examples.sh -source ${SCRIPTS}/detmVers.sh +source "${SCRIPTS}"/get-versions.sh +bash "${SCRIPTS}"/get-models-examples.sh -docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d pap +docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d pap unset http_proxy https_proxy -POLICY_PAP_IP=`get-instance-ip.sh policy-pap` -POLICY_API_IP=`get-instance-ip.sh policy-api` -MARIADB_IP=`get-instance-ip.sh mariadb` - -echo PAP IP IS ${POLICY_PAP_IP} -echo API IP IS ${POLICY_API_IP} -echo MARIADB IP IS ${MARIADB_IP} +POLICY_PAP_IP=$(get-instance-ip.sh policy-pap) +POLICY_API_IP=$(get-instance-ip.sh policy-api) +MARIADB_IP=$(get-instance-ip.sh mariadb) +echo PAP IP IS "${POLICY_PAP_IP}" +echo API IP IS "${POLICY_API_IP}" +echo MARIADB IP IS "${MARIADB_IP}" # wait for the app to start up -${SCRIPTS}/wait_for_port.sh ${POLICY_PAP_IP} 6969 +"${SCRIPTS}"/wait_for_port.sh "${POLICY_PAP_IP}" 6969 DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies diff --git a/csit/pap/plans/teardown.sh b/csit/pap/plans/teardown.sh index 0cd4455e..10c5f789 100644 --- a/csit/pap/plans/teardown.sh +++ b/csit/pap/plans/teardown.sh @@ -1,6 +1,6 @@ #!/bin/bash # ============LICENSE_START======================================================= -# Copyright (C) 2019 Nordix Foundation. +# Copyright (C) 2019-2022 Nordix Foundation. # Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,4 +18,8 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= +docker logs policy-api +docker logs simulator +docker logs policy-pap + docker-compose -f ${SCRIPTS}/docker-compose-all.yml down -v diff --git a/csit/prepare-config-files.py b/csit/prepare-config-files.py new file mode 100755 index 00000000..977df556 --- /dev/null +++ b/csit/prepare-config-files.py @@ -0,0 +1,57 @@ +#!/usr/bin/python3 +# +# ============LICENSE_START==================================================== +# Copyright (C) 2022 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====================================================== + +import os +import argparse + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Process configuration files for https/ssl ' + 'disabling.') + parser.add_argument('--https', default="true", + help='enable or disable https/ssl connection. ' + 'use https=true or https=false') + + https_enabled = parser.parse_args().https + message_router_port = '3905' if https_enabled == "true" else '3904' + + current_dir = os.getcwd() + config_dir = current_dir + "/config/" + + files = [] + for (dirpath, dirnames, filenames) in os.walk(config_dir): + for filename in filenames: + files.append(os.path.join(dirpath, filename)) + + for file in files: + try: + with open(file, 'r+') as f: + content = f.read() + new_content = content.replace("{{HTTPS_ENABLED}}", https_enabled) + new_content = new_content.replace("{{MESSAGE_ROUTER_PORT}}", message_router_port) + + if new_content != content: + f.seek(0) + f.truncate() + f.write(new_content) + print("File {0} updated!".format(file)) + except UnicodeDecodeError: + print("File didn't open: ", file) + + exit(0) diff --git a/csit/prepare-csit.sh b/csit/prepare-csit.sh index 9625c48b..4a6f3db6 100755 --- a/csit/prepare-csit.sh +++ b/csit/prepare-csit.sh @@ -2,7 +2,7 @@ # # Copyright 2019 © Samsung Electronics Co., Ltd. # Modification Copyright 2021 © AT&T Intellectual Property. -# Modification Copyright 2021. Nordix Foundation. +# Modification Copyright 2021-2022 Nordix Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,25 +20,25 @@ # if [ -z "$WORKSPACE" ]; then - export WORKSPACE=`git rev-parse --show-toplevel` + export WORKSPACE=$(git rev-parse --show-toplevel) fi # Assume that if ROBOT_VENV is set and virtualenv with system site packages can be activated, # include-raw-integration-install-robotframework.sh has already been executed -if [ -f ${WORKSPACE}/env.properties ]; then - source ${WORKSPACE}/env.properties +if [ -f "${WORKSPACE}"/env.properties ]; then + source "${WORKSPACE}"/env.properties fi -if [ -f ${ROBOT_VENV}/bin/activate ]; then - source ${ROBOT_VENV}/bin/activate +if [ -f "${ROBOT_VENV}"/bin/activate ]; then + source "${ROBOT_VENV}"/bin/activate else source ./include-raw-integration-install-robotframework.sh fi # install eteutils -mkdir -p ${ROBOT_VENV}/src/onap -rm -rf ${ROBOT_VENV}/src/onap/testsuite +mkdir -p "${ROBOT_VENV}"/src/onap +rm -rf "${ROBOT_VENV}"/src/onap/testsuite python3 -m pip install --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.5.1.*' --pre python3 -m pip freeze diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index d77b06fa..f09af486 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -3,7 +3,7 @@ # Copyright 2016-2017 Huawei Technologies Co., Ltd. # Modification Copyright 2019 © Samsung Electronics Co., Ltd. # Modification Copyright 2021 © AT&T Intellectual Property. -# Modification Copyright 2021. Nordix Foundation. +# Modification Copyright 2021-2022 Nordix Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -143,7 +143,11 @@ export SCRIPTS="${WORKSPACE}/csit" export ROBOT_VARIABLES= # get the plan from git clone -source ${SCRIPTS}/get-branch-mariadb.sh +source "${SCRIPTS}"/get-branch.sh + +# Prepare configuration files +cd "${WORKSPACE}/csit" +python3 ./prepare-config-files.py --https=true export PROJECT="${1}" diff --git a/csit/start-grafana.sh b/csit/start-grafana.sh new file mode 100755 index 00000000..0350ad25 --- /dev/null +++ b/csit/start-grafana.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# ============LICENSE_START==================================================== +# Copyright (C) 2022 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====================================================== + +SCRIPTS=$(git rev-parse --show-toplevel) +export SCRIPTS="${SCRIPTS}"/csit + +cd ${SCRIPTS} + +python3 ./prepare-config-files.py --https=false + +source ./get-versions.sh + +export PROJECT="${1}" + +if [ -z "${PROJECT}" ]; then + echo "Starting all components..." + docker-compose -f ./compose-grafana.yml up -d +else + echo "Starting ${PROJECT} application..." + docker-compose -f ./compose-grafana.yml up -d "${PROJECT}" grafana +fi + +prometheus=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' prometheus) +grafana=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' grafana) + +echo "Prometheus server: http://${prometheus}:9090" +echo "Grafana server: http://${grafana}:3000" diff --git a/csit/stop-grafana.sh b/csit/stop-grafana.sh new file mode 100755 index 00000000..901a0341 --- /dev/null +++ b/csit/stop-grafana.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# ============LICENSE_START==================================================== +# Copyright (C) 2022 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====================================================== + +SCRIPTS=$(git rev-parse --show-toplevel) +export SCRIPTS="${SCRIPTS}"/csit + +source "${SCRIPTS}"/get-versions.sh + +docker-compose -f "${SCRIPTS}"/compose-grafana.yml down diff --git a/csit/xacml-pdp/plans/setup.sh b/csit/xacml-pdp/plans/setup.sh index 718d5123..c99a0318 100644 --- a/csit/xacml-pdp/plans/setup.sh +++ b/csit/xacml-pdp/plans/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. -# Modification Copyright 2021. Nordix Foundation. +# Modifications Copyright 2021-2022 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -source ${SCRIPTS}/get-branch-mariadb.sh echo "Uninstall docker-py and reinstall docker." python3 -m pip uninstall -y docker-py @@ -25,30 +24,30 @@ python3 -m pip uninstall -y docker python3 -m pip install -U docker sudo apt-get -y install libxml2-utils -bash ${SCRIPTS}/get-models-examples.sh -source ${SCRIPTS}/detmVers.sh +source "${SCRIPTS}"/get-versions.sh +bash "${SCRIPTS}"/get-models-examples.sh -docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d xacml-pdp +docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d xacml-pdp unset http_proxy https_proxy -POLICY_API_IP=`get-instance-ip.sh policy-api` -MARIADB_IP=`get-instance-ip.sh mariadb` -POLICY_PDPX_IP=`get-instance-ip.sh policy-xacml-pdp` -SIM_IP=`get-instance-ip.sh simulator` -POLICY_PAP_IP=`get-instance-ip.sh policy-pap` +POLICY_API_IP=$(get-instance-ip.sh policy-api) +MARIADB_IP=$(get-instance-ip.sh mariadb) +POLICY_PDPX_IP=$(get-instance-ip.sh policy-xacml-pdp) +SIM_IP=$(get-instance-ip.sh simulator) +POLICY_PAP_IP=$(get-instance-ip.sh policy-pap) export SIM_IP -echo PDP IP IS ${POLICY_PDPX_IP} -echo API IP IS ${POLICY_API_IP} -echo PAP IP IS ${POLICY_PAP_IP} -echo MARIADB IP IS ${MARIADB_IP} -echo SIM_IP IS ${SIM_IP} +echo PDP IP IS "${POLICY_PDPX_IP}" +echo API IP IS "${POLICY_API_IP}" +echo PAP IP IS "${POLICY_PAP_IP}" +echo MARIADB IP IS "${MARIADB_IP}" +echo SIM_IP IS "${SIM_IP}" # wait for the app to start up -${SCRIPTS}/wait_for_port.sh ${POLICY_PDPX_IP} 6969 +"${SCRIPTS}"/wait_for_port.sh "${POLICY_PDPX_IP}" 6969 DATA2=${WORKSPACE}/models/models-examples/src/main/resources/policies diff --git a/csit/xacml-pdp/plans/teardown.sh b/csit/xacml-pdp/plans/teardown.sh index e101973f..3e2fc5f7 100644 --- a/csit/xacml-pdp/plans/teardown.sh +++ b/csit/xacml-pdp/plans/teardown.sh @@ -1,6 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. +# Modifications copyright (c) 2022 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,4 +18,9 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= +docker logs policy-api +docker logs simulator +docker logs policy-pap +docker logs xacml-pdp + docker-compose -f ${SCRIPTS}/docker-compose-all.yml down -v |