From: Morgan Richomme Date: Fri, 16 Oct 2020 06:41:04 +0000 (+0000) Subject: Merge "Modified to run both on guilin and master branch" X-Git-Tag: 7.0.1~13 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=a2a4be2e0d6f347c858e3e5295912910b065a568;hp=d8d052917c3b3f745dbd9586ac36accafec91b0b;p=integration%2Fcsit.git Merge "Modified to run both on guilin and master branch" --- diff --git a/plans/policy/apex-pdp/setup.sh b/plans/policy/apex-pdp/setup.sh index d3c1d629..02238e90 100644 --- a/plans/policy/apex-pdp/setup.sh +++ b/plans/policy/apex-pdp/setup.sh @@ -20,55 +20,17 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= source ${SCRIPTS}/policy/config/policy-csit.conf -export POLICY_MARIADB_VER -echo ${GERRIT_BRANCH} -echo ${POLICY_MARIADB_VER} echo "Uninstall docker-py and reinstall docker." pip uninstall -y docker-py pip uninstall -y docker pip install -U docker==2.7.0 -# the directory of the script -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -echo ${DIR} - -# the temp directory used, within $DIR -# omit the -p parameter to create a temporal directory in the default location -WORK_DIR=`mktemp -d -p "$DIR"` -echo ${WORK_DIR} - -cd ${WORK_DIR} - -# check if tmp dir was created -if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then - echo "Could not create temp dir" - exit 1 -fi - sudo apt-get -y install libxml2-utils -bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh -POLICY_API_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_PAP_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_APEX_PDP_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" +source ${SCRIPTS}/policy/detmVers.sh -echo ${POLICY_API_VERSION} -echo ${POLICY_PAP_VERSION} -echo ${POLICY_APEX_PDP_VERSION} - -# Adding this waiting container due to race condition between pap and mariadb -docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_dependencies - -#Configure the database -docker exec --tty mariadb chmod +x /docker-entrypoint-initdb.d/db.sh -docker exec --tty mariadb /docker-entrypoint-initdb.d/db.sh - -# now bring everything else up -docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_all +docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d apex-pdp unset http_proxy https_proxy @@ -76,7 +38,7 @@ 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 dmaap-simulator` +DMAAP_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org` echo PAP IP IS ${POLICY_PAP_IP} echo MARIADB IP IS ${MARIADB_IP} @@ -84,4 +46,10 @@ echo API IP IS ${POLICY_API_IP} echo APEX IP IS ${APEX_IP} echo DMAAP_IP IS ${DMAAP_IP} -ROBOT_VARIABLES="-v APEX_IP:${APEX_IP} -v POLICY_API_IP:${POLICY_API_IP} -v POLICY_PAP_IP:${POLICY_PAP_IP}" +# wait for the app to start up +${SCRIPTS}/policy/wait_for_port.sh ${APEX_IP} 6969 + +ROBOT_VARIABLES="" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v APEX_IP:${APEX_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_IP:${POLICY_PAP_IP}" diff --git a/plans/policy/apex-pdp/teardown.sh b/plans/policy/apex-pdp/teardown.sh index 6c02aea1..86416e6e 100644 --- a/plans/policy/apex-pdp/teardown.sh +++ b/plans/policy/apex-pdp/teardown.sh @@ -3,6 +3,7 @@ # Copyright (C) 2018 Ericsson. All rights reserved. # # Modifications copyright (c) 2019 Nordix Foundation. +# Modifications Copyright (C) 2020 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. @@ -19,8 +20,4 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -kill-instance.sh policy-apex-pdp -kill-instance.sh policy-pap -kill-instance.sh policy-api -kill-instance.sh mariadb -kill-instance.sh dmaap-simulator +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v diff --git a/plans/policy/api/setup.sh b/plans/policy/api/setup.sh index b75b492a..550337e9 100644 --- a/plans/policy/api/setup.sh +++ b/plans/policy/api/setup.sh @@ -19,9 +19,6 @@ # Select branch source ${SCRIPTS}/policy/config/policy-csit.conf -export POLICY_MARIADB_VER -echo ${GERRIT_BRANCH} -echo ${POLICY_MARIADB_VER} echo "Uninstall docker-py and reinstall docker." pip uninstall -y docker-py @@ -30,14 +27,9 @@ pip install -U docker==2.7.0 sudo apt-get -y install libxml2-utils -POLICY_API_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" +bash ${SCRIPTS}/policy/get-models-examples.sh -# download models - it contains the policy definitions -rm -rf ${WORKSPACE}/models -cd ${WORKSPACE} - -git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH} +source ${SCRIPTS}/policy/detmVers.sh DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies @@ -53,15 +45,8 @@ sed -e 's!"version": "1.0.0"!"version": "2.0.0"!' \ echo ${POLICY_API_VERSION} -# Adding this waiting container to avoid race condition between api and mariadb containers. -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-api.yml run --rm start_dependencies - -#Configure the database -docker exec --tty mariadb chmod +x /docker-entrypoint-initdb.d/db.sh -docker exec --tty mariadb /docker-entrypoint-initdb.d/db.sh +docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d api -# now bring everything else up -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-api.yml run --rm start_all unset http_proxy https_proxy @@ -71,6 +56,9 @@ MARIADB_IP=`get-instance-ip.sh mariadb` echo API IP IS ${POLICY_API_IP} echo MARIADB IP IS ${MARIADB_IP} +# wait for the app to start up +${SCRIPTS}/policy/wait_for_port.sh ${POLICY_API_IP} 6969 + ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA:${DATA}" diff --git a/plans/policy/api/teardown.sh b/plans/policy/api/teardown.sh index 0572e034..6942e353 100755 --- a/plans/policy/api/teardown.sh +++ b/plans/policy/api/teardown.sh @@ -1,6 +1,6 @@ #!/bin/bash # ============LICENSE_START======================================================= -# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2019-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. @@ -17,5 +17,4 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -kill-instance.sh policy-api -kill-instance.sh mariadb +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v diff --git a/plans/policy/distribution/setup.sh b/plans/policy/distribution/setup.sh index 52573b58..73226140 100644 --- a/plans/policy/distribution/setup.sh +++ b/plans/policy/distribution/setup.sh @@ -20,63 +20,26 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= source ${SCRIPTS}/policy/config/policy-csit.conf -export POLICY_MARIADB_VER -echo ${GERRIT_BRANCH} -echo ${POLICY_MARIADB_VER} echo "Uninstall docker-py and reinstall docker." pip uninstall -y docker-py pip uninstall -y docker pip install -U docker==2.7.0 -# the directory of the script -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -echo ${DIR} - -# the temp directory used, within $DIR -# omit the -p parameter to create a temporal directory in the default location -WORK_DIR=`mktemp -d -p "$DIR"` -echo ${WORK_DIR} - -cd ${WORK_DIR} - -# check if tmp dir was created -if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then - echo "Could not create temp dir" - exit 1 -fi - sudo apt-get -y install libxml2-utils -bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh -POLICY_API_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_PAP_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_APEX_PDP_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_DISTRIBUTION_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" +source ${SCRIPTS}/policy/detmVers.sh -echo ${POLICY_API_VERSION} -echo ${POLICY_PAP_VERSION} -echo ${POLICY_APEX_PDP_VERSION} -echo ${POLICY_DISTRIBUTION_VERSION} - -SCRIPT_DIR=${WORKSPACE}/scripts/policy/policy-distribution +SCRIPT_DIR=${SCRIPTS}/policy/policy-distribution # Remaking the csar file in case if the file got corrupted zip -F ${SCRIPT_DIR}/config/distribution/csar/sample_csar_with_apex_policy.csar --out ${SCRIPT_DIR}/config/distribution/csar/csar_temp.csar -# Adding this waiting container due to race condition between pap and mariadb -docker-compose -f ${SCRIPT_DIR}/docker-compose-distribution.yml run --rm start_dependencies - -#Configure the database -docker exec --tty mariadb chmod +x /docker-entrypoint-initdb.d/db.sh -docker exec --tty mariadb /docker-entrypoint-initdb.d/db.sh +# Remake temp directory +rm -rf ${SCRIPT_DIR}/config/distribution/temp +mkdir ${SCRIPT_DIR}/config/distribution/temp -# now bring everything else up -docker-compose -f ${SCRIPT_DIR}/docker-compose-distribution.yml run --rm start_all +docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d distribution unset http_proxy https_proxy @@ -84,7 +47,7 @@ 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 dmaap-simulator` +DMAAP_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org` POLICY_DISTRIBUTION_IP=`get-instance-ip.sh policy-distribution` echo PAP IP IS ${POLICY_PAP_IP} @@ -94,4 +57,10 @@ echo APEX IP IS ${APEX_IP} echo DMAAP_IP IS ${DMAAP_IP} echo POLICY_DISTRIBUTION_IP IS ${POLICY_DISTRIBUTION_IP} -ROBOT_VARIABLES="-v APEX_IP:${APEX_IP} -v SCRIPT_DIR:${SCRIPT_DIR} -v POLICY_DISTRIBUTION_IP:${POLICY_DISTRIBUTION_IP}" +# wait for the app to start up +${SCRIPTS}/policy/wait_for_port.sh ${POLICY_DISTRIBUTION_IP} 6969 + +ROBOT_VARIABLES="" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v APEX_IP:${APEX_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCRIPT_DIR:${SCRIPT_DIR}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_DISTRIBUTION_IP:${POLICY_DISTRIBUTION_IP}" diff --git a/plans/policy/distribution/teardown.sh b/plans/policy/distribution/teardown.sh index fbbf1de5..86416e6e 100644 --- a/plans/policy/distribution/teardown.sh +++ b/plans/policy/distribution/teardown.sh @@ -3,6 +3,7 @@ # Copyright (C) 2018 Ericsson. All rights reserved. # # Modifications copyright (c) 2019 Nordix Foundation. +# Modifications Copyright (C) 2020 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. @@ -19,9 +20,4 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -kill-instance.sh policy-apex-pdp -kill-instance.sh policy-pap -kill-instance.sh policy-api -kill-instance.sh mariadb -kill-instance.sh dmaap-simulator -kill-instance.sh policy-distribution +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v diff --git a/plans/policy/drools-applications/setup.sh b/plans/policy/drools-applications/setup.sh index 1a1dc331..c4cbfa60 100755 --- a/plans/policy/drools-applications/setup.sh +++ b/plans/policy/drools-applications/setup.sh @@ -20,9 +20,6 @@ # OS upgrades source ${SCRIPTS}/policy/config/policy-csit.conf -export POLICY_MARIADB_VER -echo ${GERRIT_BRANCH} -echo ${POLICY_MARIADB_VER} SCR2=${WORKSPACE}/scripts/policy/drools-apps @@ -32,37 +29,15 @@ pip uninstall -y docker pip install -U docker==2.7.0 sudo apt-get -y install libxml2-utils -${SCRIPTS}/policy/policy-models-simulators.sh +bash ${SCRIPTS}/policy/get-models-examples.sh -POLICY_API_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_PAP_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_XACML_PDP_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_DROOLS_APPS_VERSION_EXTRACT="$(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()' -)" -echo ${POLICY_DROOLS_APPS_VERSION_EXTRACT} -export POLICY_DROOLS_APPS_VERSION="${POLICY_DROOLS_APPS_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" +source ${SCRIPTS}/policy/detmVers.sh -echo ${POLICY_XACML_PDP_VERSION} -echo ${POLICY_DROOLS_APPS_VERSION} - -echo "user information: $(id)" -echo "docker and docker-compose versions:" -docker -v && docker-compose -v - -# Adding this waiting container due to race condition between drools and mariadb -docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_dependencies - -# Adding this waiting container due to race condition between pap and xacml -docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_pap - -# now bring everything else up -docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_all +docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d drools-apps unset http_proxy https_proxy -DROOLS_IP=`get-instance-ip.sh drools` +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` @@ -75,10 +50,13 @@ 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}/policy/wait_for_port.sh ${DROOLS_IP} 6969 + # give enough time for the controllers to come up sleep 15 -DATA=${WORKSPACE}/simulators/models/models-examples/src/main/resources/policies +DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR2:${SCR2}" diff --git a/plans/policy/drools-applications/teardown.sh b/plans/policy/drools-applications/teardown.sh index 8b577d8e..67de4a1a 100755 --- a/plans/policy/drools-applications/teardown.sh +++ b/plans/policy/drools-applications/teardown.sh @@ -18,6 +18,6 @@ # mkdir -p $WORKSPACE/archives/ -docker-compose -f ${WORKSPACE}/scripts/policy/drools-apps/docker-compose-drools-apps.yml logs > $WORKSPACE/archives/docker-compose-drools-apps.log +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml logs > $WORKSPACE/archives/docker-compose-drools-apps.log -docker-compose -f ${WORKSPACE}/scripts/policy/drools-apps/docker-compose-drools-apps.yml down -v +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v diff --git a/plans/policy/drools-pdp/setup.sh b/plans/policy/drools-pdp/setup.sh index d50106ff..6b951356 100755 --- a/plans/policy/drools-pdp/setup.sh +++ b/plans/policy/drools-pdp/setup.sh @@ -24,26 +24,15 @@ pip uninstall -y docker-py pip uninstall -y docker pip install -U docker==2.7.0 -echo "user information: $(id)" -echo "docker information:" -docker -v && docker-compose -v && docker info - # Component Versions source ${SCRIPTS}/policy/config/policy-csit.conf -export POLICY_MARIADB_VER -echo ${GERRIT_BRANCH} -echo ${POLICY_MARIADB_VER} sudo apt-get -y install libxml2-utils -POLICY_DROOLS_VERSION_EXTRACT="$(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_VERSION="${POLICY_DROOLS_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" -echo ${POLICY_DROOLS_VERSION} -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools.yml up -d -sleep 2m +source ${SCRIPTS}/policy/detmVers.sh -docker container ls -a +docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d drools POLICY_DROOLS_IP=`get-instance-ip.sh drools` MARIADB_IP=`get-instance-ip.sh mariadb` @@ -51,10 +40,10 @@ MARIADB_IP=`get-instance-ip.sh mariadb` echo DROOLS IP IS ${POLICY_DROOLS_IP} echo MARIADB IP IS ${MARIADB_IP} -for i in {1..10}; do - curl -sS ${POLICY_DROOLS_IP}:9696 && break - echo sleep $i - sleep $i -done +# wait for the app to start up - looking for telemtry service on port 9696 +${SCRIPTS}/policy/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}" diff --git a/plans/policy/drools-pdp/teardown.sh b/plans/policy/drools-pdp/teardown.sh index e08593d2..5a3f16e5 100755 --- a/plans/policy/drools-pdp/teardown.sh +++ b/plans/policy/drools-pdp/teardown.sh @@ -16,5 +16,5 @@ # mkdir -p $WORKSPACE/archives/ -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools.yml logs > $WORKSPACE/archives/docker-compose-drools.log -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools.yml down -v +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml logs > $WORKSPACE/archives/docker-compose-drools.log +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v diff --git a/plans/policy/pap/setup.sh b/plans/policy/pap/setup.sh index a89a6daf..a1d153f8 100644 --- a/plans/policy/pap/setup.sh +++ b/plans/policy/pap/setup.sh @@ -19,40 +19,21 @@ # ============LICENSE_END========================================================= source ${SCRIPTS}/policy/config/policy-csit.conf -export POLICY_MARIADB_VER -echo ${GERRIT_BRANCH} -echo ${POLICY_MARIADB_VER} echo "Uninstall docker-py and reinstall docker." pip uninstall -y docker-py pip uninstall -y docker pip install -U docker==2.7.0 - sudo apt-get -y install libxml2-utils -bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh - -POLICY_API_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_PAP_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" - -echo ${POLICY_API_VERSION} -echo ${POLICY_PAP_VERSION} - -# Adding this waiting container due to race condition between pap and mariadb -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-pap.yml run --rm start_dependencies +bash ${SCRIPTS}/policy/get-models-examples.sh -#Configure the database -docker exec --tty mariadb chmod +x /docker-entrypoint-initdb.d/db.sh -docker exec --tty mariadb /docker-entrypoint-initdb.d/db.sh +source ${SCRIPTS}/policy/detmVers.sh -# now bring everything else up -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-pap.yml run --rm start_all +docker-compose -f ${SCRIPTS}/policy/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` @@ -61,7 +42,12 @@ echo PAP IP IS ${POLICY_PAP_IP} echo API IP IS ${POLICY_API_IP} echo MARIADB IP IS ${MARIADB_IP} -DATA=${WORKSPACE}/dmaap-sim/models/models-examples/src/main/resources/policies + +# wait for the app to start up +${SCRIPTS}/policy/wait_for_port.sh ${POLICY_PAP_IP} 6969 + + +DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_IP:${POLICY_PAP_IP}" diff --git a/plans/policy/pap/teardown.sh b/plans/policy/pap/teardown.sh index c2d7e214..cfed2097 100644 --- a/plans/policy/pap/teardown.sh +++ b/plans/policy/pap/teardown.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2019 Nordix Foundation. -# Modifications Copyright (C) 2019 AT&T Intellectual Property. +# Modifications Copyright (C) 2019-2020 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. @@ -18,6 +18,4 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -kill-instance.sh policy-pap -kill-instance.sh policy-api -kill-instance.sh mariadb +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v diff --git a/plans/policy/xacml-pdp/setup.sh b/plans/policy/xacml-pdp/setup.sh index d6726c7a..7f557d13 100644 --- a/plans/policy/xacml-pdp/setup.sh +++ b/plans/policy/xacml-pdp/setup.sh @@ -18,60 +18,28 @@ # ============LICENSE_END========================================================= source ${SCRIPTS}/policy/config/policy-csit.conf -export POLICY_MARIADB_VER -echo ${GERRIT_BRANCH} -echo ${POLICY_MARIADB_VER} echo "Uninstall docker-py and reinstall docker." pip uninstall -y docker-py pip uninstall -y docker pip install -U docker==2.7.0 -# the directory of the script -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -echo ${DIR} - -# the temp directory used, within $DIR -# omit the -p parameter to create a temporal directory in the default location -WORK_DIR=`mktemp -d -p "$DIR"` -echo ${WORK_DIR} - -cd ${WORK_DIR} - -# check if tmp dir was created -if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then - echo "Could not create temp dir" - exit 1 -fi - SCR_DMAAP=${SCRIPTS}/policy/drools-apps sudo apt-get -y install libxml2-utils -bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh - -POLICY_API_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_PAP_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" -POLICY_XACML_PDP_VERSION_EXTRACT="$(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_EXTRACT:0:3}-SNAPSHOT-latest" +bash ${SCRIPTS}/policy/get-models-examples.sh -echo ${POLICY_API_VERSION} -echo ${POLICY_PAP_VERSION} -echo ${POLICY_XACML_PDP_VERSION} +source ${SCRIPTS}/policy/detmVers.sh -# Adding this waiting container due to race condition between pap and mariadb -docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_dependencies +docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d xacml-pdp -# now bring everything else up -docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_all 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` -DMAAP_IP=`get-instance-ip.sh dmaap-simulator` +DMAAP_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org` POLICY_PAP_IP=`get-instance-ip.sh policy-pap` echo PDP IP IS ${POLICY_PDPX_IP} @@ -80,7 +48,10 @@ echo PAP IP IS ${POLICY_PAP_IP} echo MARIADB IP IS ${MARIADB_IP} echo DMAAP_IP IS ${DMAAP_IP} -DATA2=${WORKSPACE}/dmaap-sim/models/models-examples/src/main/resources/policies +# wait for the app to start up +${SCRIPTS}/policy/wait_for_port.sh ${POLICY_PDPX_IP} 6969 + +DATA2=${WORKSPACE}/models/models-examples/src/main/resources/policies ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR_DMAAP:${SCR_DMAAP}" diff --git a/plans/policy/xacml-pdp/teardown.sh b/plans/policy/xacml-pdp/teardown.sh index 270d6cc6..6942e353 100644 --- a/plans/policy/xacml-pdp/teardown.sh +++ b/plans/policy/xacml-pdp/teardown.sh @@ -1,6 +1,6 @@ #!/bin/bash # ============LICENSE_START======================================================= -# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2019-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. @@ -17,8 +17,4 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -kill-instance.sh policy-xacml-pdp -kill-instance.sh policy-pap -kill-instance.sh policy-api -kill-instance.sh mariadb -kill-instance.sh dmaap-simulator +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v diff --git a/plans/vnfsdk-marketplace/sanity-check/setup.sh b/plans/vnfsdk-marketplace/sanity-check/setup.sh deleted file mode 100644 index 85c6bc27..00000000 --- a/plans/vnfsdk-marketplace/sanity-check/setup.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# Copyright 2016-2017 Huawei Technologies Co., Ltd. -# -# 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. -# -# These scripts are sourced by run-csit.sh. - - - -#Start market place -docker run -d -i -t --name=vnfmarket -p 8702:8702 onap/vnfmarket - -REPO_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' vnfmarket` - - -# Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v REPO_IP:${REPO_IP}" - - diff --git a/plans/vnfsdk-marketplace/testsuites/docker-compose.yml b/plans/vnfsdk-marketplace/testsuites/docker-compose.yml new file mode 100644 index 00000000..f1bb90c5 --- /dev/null +++ b/plans/vnfsdk-marketplace/testsuites/docker-compose.yml @@ -0,0 +1,43 @@ +# Copyright 2020 Huawei Technologies Co., Ltd. +# Copyright 2020 Nokia. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: '2' +networks: + default: + driver: bridge + driver_opts: + com.docker.network.driver.mtu: ${NETWORK_DRIVER_MTU} + +services: + postgres: + container_name: "postgres" + restart: "always" + image: "nexus3.onap.org:10001/onap/vnfsdk/refrepo/postgres:${POSTGRES_IMAGE_TAG}" + mem_limit: "1g" + memswap_limit: "1g" + ports: + - "5432:5432" + + refrepo: + container_name: "refrepo" + restart: "always" + image: "nexus3.onap.org:10001/onap/vnfsdk/refrepo:${REFREPO_IMAGE_TAG}" + ports: + - "8702-8703:8702-8703" + - "50051:50051" + environment: + POSTGRES_SERVICE_HOST: postgres + links: + - postgres diff --git a/plans/vnfsdk-marketplace/sanity-check/enterprise2DC.csar b/plans/vnfsdk-marketplace/testsuites/enterprise2DC.csar similarity index 100% rename from plans/vnfsdk-marketplace/sanity-check/enterprise2DC.csar rename to plans/vnfsdk-marketplace/testsuites/enterprise2DC.csar diff --git a/plans/vnfsdk-refrepo/sanity-check/setup.sh b/plans/vnfsdk-marketplace/testsuites/setup.sh similarity index 58% rename from plans/vnfsdk-refrepo/sanity-check/setup.sh rename to plans/vnfsdk-marketplace/testsuites/setup.sh index ed39d678..7623f71f 100644 --- a/plans/vnfsdk-refrepo/sanity-check/setup.sh +++ b/plans/vnfsdk-marketplace/testsuites/setup.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright 2016-2017 Huawei Technologies Co., Ltd. +# Copyright 2020 Nokia. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,25 +16,28 @@ # limitations under the License. # # These scripts are sourced by run-csit.sh. -VNFSDK_REFREPO_DOCKER_VERSION=1.3-STAGING-latest -#Start postgres database -docker run -d -i -t --name=postgres -p 5432:5432 nexus3.onap.org:10001/onap/vnfsdk/refrepo/postgres:latest +REFREPO_IMAGE_TAG=latest \ +POSTGRES_IMAGE_TAG=latest \ +NETWORK_DRIVER_MTU=1450 \ +docker-compose up -d -POSTGRES=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' postgres` - -#Start market place -docker run -d -i -t --name=refrepo -e POSTGRES_SERVICE_HOST=$POSTGRES -p 8702:8702 nexus3.onap.org:10001/onap/vnfsdk/refrepo:$VNFSDK_REFREPO_DOCKER_VERSION +DOCKER_IP=`get-docker-network-ip.sh` # Wait for Market place initialization echo Wait for VNF Repository initialization -for i in {1..30}; do - sleep 1 +# Active waiting with healthcheck and max retry count +MAX_RETRY=30 +TRY=1 +while (( $(curl -s -o /dev/null -w ''%{http_code}'' ${DOCKER_IP}:8702/onapapi/vnfsdk-marketplace/v1/PackageResource/healthcheck) != 200 )) && (($TRY < $MAX_RETRY)); do + sleep 4 + TRY=$[$TRY+1] done -REPO_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' refrepo` - +# Get refrepo logs for easier debug in case of failure +docker logs refrepo +REFREPO_IP=`get-instance-ip.sh refrepo` # Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS} -v REPO_IP:${REPO_IP}" +ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS} -v REPO_IP:${REFREPO_IP}" echo ${ROBOT_VARIABLES} diff --git a/plans/vnfsdk-marketplace/sanity-check/teardown.sh b/plans/vnfsdk-marketplace/testsuites/teardown.sh similarity index 93% rename from plans/vnfsdk-marketplace/sanity-check/teardown.sh rename to plans/vnfsdk-marketplace/testsuites/teardown.sh index 42d7b7fd..1bf79225 100644 --- a/plans/vnfsdk-marketplace/sanity-check/teardown.sh +++ b/plans/vnfsdk-marketplace/testsuites/teardown.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright 2016-2017 Huawei Technologies Co., Ltd. +# Copyright 2020 Nokia. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,6 +17,4 @@ # # This script is sourced by run-csit.sh after Robot test completion. - -kill-instance.sh vnfmarket - +docker-compose down diff --git a/plans/vnfsdk-marketplace/sanity-check/testplan.txt b/plans/vnfsdk-marketplace/testsuites/testplan.txt similarity index 100% rename from plans/vnfsdk-marketplace/sanity-check/testplan.txt rename to plans/vnfsdk-marketplace/testsuites/testplan.txt diff --git a/plans/vnfsdk-marketplace/sanity-check/uploadCSAR.sh b/plans/vnfsdk-marketplace/testsuites/uploadCSAR.sh similarity index 100% rename from plans/vnfsdk-marketplace/sanity-check/uploadCSAR.sh rename to plans/vnfsdk-marketplace/testsuites/uploadCSAR.sh diff --git a/plans/vnfsdk-refrepo/sanity-check/enterprise2DC.csar b/plans/vnfsdk-refrepo/sanity-check/enterprise2DC.csar deleted file mode 100644 index 0960b20a..00000000 Binary files a/plans/vnfsdk-refrepo/sanity-check/enterprise2DC.csar and /dev/null differ diff --git a/plans/vnfsdk-refrepo/sanity-check/uploadCSAR.sh b/plans/vnfsdk-refrepo/sanity-check/uploadCSAR.sh deleted file mode 100644 index 279912c3..00000000 --- a/plans/vnfsdk-refrepo/sanity-check/uploadCSAR.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env bash -############################################################################### -# Copyright 2017 Huawei Technologies Co., Ltd. -# -# 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. -############################################################################### -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -echo $SCRIPT_DIR - -#CHECK IF MSB_ADDR IS GIVEN IN COMMAND -if [ -z "$1" ] -then - echo "There is no MSB_ADDR" - exit 1 -fi -MSB_ADDR=$1 -CSAR_NAME=$2 -echo $MSB_ADDR -echo $CSAR_NAME - -# Wait for MSB initialization -echo Wait for MSB initialization -for i in {1..20}; do - curl -sS -m 1 $MSB_ADDR > /dev/null && break - sleep $i -done -#MSB initialized -########################################### -########################################### -########################################### -########################################### -########################################### -########################################### -############UOLOAD PACKAGE to MARKET PLACE###################### -echo -echo "############## UOLOAD PACKAGE to MARKET PLACE STARTED ##############"; -UploadPackageResponse=$(curl -sS -X POST -H "Content-Type: multipart/form-data;" -F "file=@$CSAR_NAME" http://$MSB_ADDR/openoapi/vnfsdk-marketplace/v1/PackageResource/csars) -if echo "$UploadPackageResponse" | grep -q "\"csarId\""; then - echo "UOLOAD PACKAGE TO MARKET PLACE SUCSSS !!!"; -else - echo "UploadPackageResponse :$UploadPackageResponse" - echo "UOLOAD PACKAGE TO MARKET PLACE FAILED !!!"; - exit 1; -fi -UploadCsarId=$(echo ${UploadPackageResponse:11:36}) -echo "PACKAGE ID:$UploadCsarId" -echo "############## UOLOAD PACKAGE to MARKET PLACE END ##################"; -#######UOLOAD PACKAGE to MARKET PLACE END############# -########################################### -########################################### -########################################### -########################################### -########################################### -########################################### -########################################### -################GET ON BOARD STATUS######## -echo -echo "####################### GETTING ON-BOARDING STATUS ##################"; -#sleeping for 10 sec so thate ON Boarding operation should be happened at backend -for pc in $(seq 1 10); do - status=$((${pc}*10)); - echo -ne "ON_BOARDING Status (%): $status\033[0K\r" - sleep 1 -done -echo - -#Three Retries for getting On Boarding Result -#count=0 -#while [ $count -lt 3 ] -#do -# OnBoardStatusResponse=$(curl -sS -X GET "http://$MSB_ADDR/openoapi/vnfsdk-marketplace/v1/PackageResource/csars/$UploadCsarId/onboardstatus?operTypeId=functiontest&operId=functestexec" -H "Accept: application/json" -H "Content-Type: application/json") -# echo $OnBoardStatusResponse -# if echo "$OnBoardStatusResponse" | grep -q "\"status\":0"; then -# break; -# else -# if [ $count -eq 3 ] -# then -# echo "ON-BOARDING OPERATION FAILED !!!"; -# fi -# count=`expr $count + 1`; -# sleep 3; -# fi -#done -echo "GET ON-BOARDING RESULT OPERATION SUCESS "; -echo "##################### GETTING ON-BOARDING STATUS END #################"; -####################GET ON BOARD STATUS END############ -########################################## -########################################## -########################################## -########################################## -########################################## -#################DOWNLOAD PACKAGE######### -echo -echo "############## DOWNLOADED PACKAGE FROM MARKET STARTED #################"; -PACKAGE_NAME=market_temp.csar -curl -sS -X GET "http://$MSB_ADDR/openoapi/vnfsdk-marketplace/v1/PackageResource/csars/$UploadCsarId/files" > $PACKAGE_NAME -fileSize=$(du -b $PACKAGE_NAME | cut -f 1) -if [ $fileSize -eq 0 ] -then - echo "DOWNLOADED PACKAGE FROM MARKET NOT PROPER, ON-BOARDING OPERATION FAILED !!!"; - exit 1; -fi -echo "DOWNLOADED PACKAGE FROM MARKET OPERATION SUCESS !!!"; -echo "MARKET PACKAGE NAME:$PACKAGE_NAME" -echo "##################### DOWNLOADED PACKAGE FROM MARKET ##################"; -###################DOWNLOAD PACKAGE END##################### -########################################## -########################################## -########################################## -########################################## -##########CATALOUGE START################# -echo -PACKAGE_NAME=$CSAR_NAME -#Check if common-tosca-catalog is registered with MSB or not -#curl -sS -X GET http://$MSB_ADDR/api/microservices/v1/services/catalog/version/v1 -H "Accept: application/json" -H "Content-Type: application/json" -#check if common-tosca-aria is registered with MSB or not -#curl -sS -X GET http://$MSB_ADDR/api/microservices/v1/services/tosca/version/v1 -H "Accept: application/json" -H "Content-Type: application/json" -#echo Sending POST request to Catalog -CsarIdString=$(curl -sS -X POST -H "Content-Type: multipart/form-data; boundary=-WebKitFormBoundary7MA4YWxkTrZu0gW" -H "Cache-Control: no-cache" -H "Postman-Token: abcb6497-b225-c592-01be-e9ff460ca188" -F "file=@$PACKAGE_NAME" http://$MSB_ADDR/openoapi/catalog/v1/csars) -#getting csarId from the output of curl request -CsarId=$(echo ${CsarIdString:11:36}) -echo $CsarId -echo $CsarIdString -#csarid is sucessfully stored in CsarId variable -echo "====finished======" -##########CATALOUGE END############ -echo "DELETING PACAKE LOCAL COPY:$PACKAGE_NAME"; -#rm $PACKAGE_NAME; diff --git a/plans/vnfsdk-refrepo/testsuites/setup.sh b/plans/vnfsdk-refrepo/testsuites/setup.sh new file mode 100644 index 00000000..0d41584b --- /dev/null +++ b/plans/vnfsdk-refrepo/testsuites/setup.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# Copyright 2020 Nokia. +# +# 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. +# +# These scripts are sourced by run-csit.sh. + +VNFSDK_REFREPO_DOCKER_VERSION=latest + +#Start market place +docker run -d -i -t --name refrepo -p 8702:8702 nexus3.onap.org:10001/onap/vnfsdk/refrepo:$VNFSDK_REFREPO_DOCKER_VERSION +DOCKER_IP=`get-docker-network-ip.sh` + +# Wait for Market place initialization +echo Wait for VNF Repository initialization +# Active waiting with healthcheck and max retry count +MAX_RETRY=30 +TRY=1 +while (( $(curl -s -o /dev/null -w ''%{http_code}'' ${DOCKER_IP}:8702/onapapi/vnfsdk-marketplace/v1/PackageResource/healthcheck) != 200 )) && (($TRY < $MAX_RETRY)); do + sleep 4 + TRY=$[$TRY+1] +done + +REFREPO_IP=`get-instance-ip.sh refrepo` + +# Get refrepo logs for easier debug in case of failure +docker logs refrepo + +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS} -v REFREPO_IP:${REFREPO_IP}" +echo ${ROBOT_VARIABLES} diff --git a/plans/vnfsdk-refrepo/sanity-check/teardown.sh b/plans/vnfsdk-refrepo/testsuites/teardown.sh similarity index 96% rename from plans/vnfsdk-refrepo/sanity-check/teardown.sh rename to plans/vnfsdk-refrepo/testsuites/teardown.sh index 19440bc7..f7c57113 100644 --- a/plans/vnfsdk-refrepo/sanity-check/teardown.sh +++ b/plans/vnfsdk-refrepo/testsuites/teardown.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright 2016-2017 Huawei Technologies Co., Ltd. +# Copyright 2020 Nokia. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,8 +17,5 @@ # # This script is sourced by run-csit.sh after Robot test completion. - kill-instance.sh refrepo -kill-instance.sh postgres - diff --git a/plans/vnfsdk-refrepo/sanity-check/testplan.txt b/plans/vnfsdk-refrepo/testsuites/testplan.txt similarity index 61% rename from plans/vnfsdk-refrepo/sanity-check/testplan.txt rename to plans/vnfsdk-refrepo/testsuites/testplan.txt index b5370f38..bc6629d6 100644 --- a/plans/vnfsdk-refrepo/sanity-check/testplan.txt +++ b/plans/vnfsdk-refrepo/testsuites/testplan.txt @@ -1,3 +1,3 @@ ## Test suites are relative paths under [integration/csit.git]/tests/. ## Place the suites in run order. -vnfsdk-marketplace/provision/sanity_test_vnfsdktestfunction.robot +vnfsdk-refrepo/csar_validation_tests.robot diff --git a/scripts/policy/config/pe/pap-tweaks.sh b/scripts/get-docker-network-ip.sh similarity index 75% rename from scripts/policy/config/pe/pap-tweaks.sh rename to scripts/get-docker-network-ip.sh index 87c6d21d..383decd7 100755 --- a/scripts/policy/config/pe/pap-tweaks.sh +++ b/scripts/get-docker-network-ip.sh @@ -1,14 +1,16 @@ -#! /bin/bash -# Copyright 2020 AT&T Intellectual Property. All rights reserved +#!/bin/bash +# Copyright 2020 Nokia. # # 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 +# 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. + +ip a | grep docker | grep inet | awk '{print $2}' | awk -F'/' '{print $1}' diff --git a/scripts/policy/config/apex-pdp/OnapPfConfig.json b/scripts/policy/config/apex-pdp/OnapPfConfig.json new file mode 100644 index 00000000..59ba604d --- /dev/null +++ b/scripts/policy/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/scripts/policy/policy-distribution/config/distribution/defaultConfig.json b/scripts/policy/config/distribution/defaultConfig.json similarity index 100% rename from scripts/policy/policy-distribution/config/distribution/defaultConfig.json rename to scripts/policy/config/distribution/defaultConfig.json diff --git a/scripts/policy/drools-apps/custom/papDefaultConfig.json b/scripts/policy/config/pap/defaultConfig.json similarity index 100% rename from scripts/policy/drools-apps/custom/papDefaultConfig.json rename to scripts/policy/config/pap/defaultConfig.json diff --git a/scripts/policy/config/pe/base.conf b/scripts/policy/config/pe/base.conf deleted file mode 100644 index 851234f3..00000000 --- a/scripts/policy/config/pe/base.conf +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 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. - -JAVA_HOME=/usr/local/openjdk-11 -POLICY_HOME=/opt/app/policy -POLICY_LOGS=/var/log/onap -KEYSTORE_PASSWD=Pol1cy_0nap -TRUSTSTORE_PASSWD=Pol1cy_0nap - -JDBC_DRIVER=org.mariadb.jdbc.Driver -JDBC_URL=jdbc:mariadb://mariadb:3306/onap_sdk?connectTimeout=30000&socketTimeout=60000&log=true&sessionVariables=max_statement_time=30 -JDBC_LOG_URL=jdbc:mariadb://mariadb:3306/log?connectTimeout=30000&socketTimeout=60000&log=true&sessionVariables=max_statement_time=30 -JDBC_USER=policy_user -JDBC_PASSWORD=policy_user - -site_name=site_1 -fp_monitor_interval=30 -failed_counter_threshold=3 -test_trans_interval=20 -write_fpc_interval=5 -max_fpc_update_interval=60 -test_via_jmx=false -jmx_fqdn= - -AAF_NAMESPACE=org.onap.policy -AAF_HOST=aaf.api.simpledemo.onap.org - -ENVIRONMENT=TEST - -#Micro Service Model Properties -policy_msOnapName= -policy_msPolicyName= diff --git a/scripts/policy/config/pe/brmsgw-tweaks.sh b/scripts/policy/config/pe/brmsgw-tweaks.sh deleted file mode 100755 index f74730cc..00000000 --- a/scripts/policy/config/pe/brmsgw-tweaks.sh +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/bash -# Copyright 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. - -PROPS_BUILD="${POLICY_HOME}/etc/build.info" - -PROPS_RUNTIME="${POLICY_HOME}/servers/brmsgw/config.properties" -PROPS_INSTALL="${POLICY_HOME}/install/servers/brmsgw/config.properties" - - -if [ ! -f "${PROPS_BUILD}" ]; then - echo "error: version information does not exist: ${PROPS_BUILD}" - exit 1 -fi - -source "${POLICY_HOME}/etc/build.info" - -if [ -z "${version}" ]; then - echo "error: no version information present" - exit 1 -fi - -for CONFIG in ${PROPS_RUNTIME} ${PROPS_INSTALL}; do - if [ ! -f "${CONFIG}" ]; then - echo "warning: configuration does not exist: ${CONFIG}" - else - sed -i -e "s/brms.dependency.version=.*/brms.dependency.version=${version}/g" "${CONFIG}" - fi -done diff --git a/scripts/policy/config/pe/brmsgw.conf b/scripts/policy/config/pe/brmsgw.conf deleted file mode 100644 index c2db9d12..00000000 --- a/scripts/policy/config/pe/brmsgw.conf +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 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. -# BRMSpep component installation configuration parameters -BRMSGW_JMX_PORT=9989 - -COMPONENT_X_MX_MB=512 -COMPONENT_X_MS_MB=512 - -REST_PAP_URL=https://pap:9091/pap/ -REST_PDP_ID=https://pdp:8081/pdp/ - -PDP_HTTP_USER_ID=testpdp -PDP_HTTP_PASSWORD=alpha123 -PDP_PAP_PDP_HTTP_USER_ID=testpap -PDP_PAP_PDP_HTTP_PASSWORD=alpha123 - -M2_HOME=/usr/share/java/maven-3 -snapshotRepositoryID=policy-nexus-snapshots -snapshotRepositoryName=Snapshots -snapshotRepositoryURL=http://nexus:8081/nexus/content/repositories/snapshots -releaseRepositoryID=policy-nexus-releases -releaseRepositoryName=Releases -releaseRepositoryURL=http://nexus:8081/nexus/content/repositories/releases -repositoryUsername=admin -repositoryPassword=admin123 -UEB_URL=mr.api.simpledemo.onap.org -UEB_TOPIC=PDPD-CONFIGURATION -UEB_API_KEY= -UEB_API_SECRET= - -groupID=org.onap.policy-engine -artifactID=drlPDPGroup -AMSTERDAM_GROUP_ID=org.onap.policy-engine.drools.amsterdam -AMSTERDAM_ARTIFACT_ID=policy-amsterdam-rules - -# the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase -resource_name=brmsgw_1 -node_type=brms_gateway - -#Environment should be Set either DEV, TEST or PROD -ENVIRONMENT=TEST - -#Notification Properties... type can be either websocket, ueb, or dmaap -BRMS_NOTIFICATION_TYPE=websocket -BRMS_UEB_URL=mr.api.simpledemo.onap.org -BRMS_UEB_TOPIC=PDPD-CONFIGURATION -BRMS_UEB_DELAY= -BRMS_CLIENT_ID=python -BRMS_CLIENT_KEY=dGVzdA== -BRMS_UEB_API_KEY= -BRMS_UEB_API_SECRET= - -#Dependency.json file version -BRMS_DEPENDENCY_VERSION=1.5.1 -BRMS_MODELS_DEPENDENCY_VERSION=2.1.2 - diff --git a/scripts/policy/config/pe/console.conf b/scripts/policy/config/pe/console.conf deleted file mode 100644 index ceaad638..00000000 --- a/scripts/policy/config/pe/console.conf +++ /dev/null @@ -1,145 +0,0 @@ -# Copyright 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. -# configs component installation configuration parameters - -# tomcat specific parameters - -TOMCAT_JMX_PORT=9993 -TOMCAT_SHUTDOWN_PORT=8090 -SSL_HTTP_CONNECTOR_PORT=8443 -SSL_HTTP_CONNECTOR_REDIRECT_PORT=8443 -SSL_AJP_CONNECTOR_PORT=8383 -SSL_AJP_CONNECTOR_REDIRECT_PORT=8443 - -TOMCAT_X_MS_MB=2048 -TOMCAT_X_MX_MB=2048 - -# ------------------ console properties --------------------------- - -# -# Authorization Policy - -ROOT_POLICIES=admin -ADMIN_FILE=Policy-Admin.xml - - -# Set your domain here: - -REST_ADMIN_DOMAIN=com - -# -# Location where the GIT repository is located -# -REST_ADMIN_REPOSITORY=repository - -# -# Location where all the user workspaces are located. -# -REST_ADMIN_WORKSPACE=${{POLICY_HOME}}/servers/console/bin/workspace - -# -# These can be set so the Admin Console knows who is logged on. Ideally, you can run the console in a J2EE -# container and setup authentication as you please. Setting HttpSession attribute values will override these -# values set in the properties files. -# -# ((HttpServletRequest) request).getSession().setAttribute("xacml.rest.admin.user.name", "Homer"); -# -# The default policy: Policy-Admin.xml is extremely simple. -# -# You can test authorization within the Admin Console by changing the user id. -# There are 3 supported user ids: -# guest - Read only access -# editor - Read/Write access -# admin - Read/Write/Admin access -# -# An empty or null value for xacml.rest.admin.user.id results in no access to the application at all. -# -# This is for development/demonstration purposes only. A production environment should provide authentication which is -# outside the scope of this application. This application can be used to develop a XACML policy for user authorization -# within this application. -# - -REST_ADMIN_USER_NAME=Administrator -REST_ADMIN_USER_ID=super-admin - -# -# -# Property to declare the max time frame for logs. -# -LOG_TIMEFRAME=30 - -# Property to declare the number of visible rows for users in MicroService Policy -COLUMN_COUNT=3 - -# Dashboard refresh rate in miliseconds -REFRESH_RATE=40000 - -# -# URL location for the PAP servlet. -# - - -REST_PAP_URL=https://pap:9091/pap/ - -# -# Config/Action Properties location. -# - -REST_CONFIG_HOME=${{POLICY_HOME}}/servers/pap/webapps/Config/ -REST_ACTION_HOME=${{POLICY_HOME}}/servers/pap/webapps/Action/ -REST_CONFIG_URL=https://pap:9091/ -REST_CONFIG_WEBAPPS=${{POLICY_HOME}}/servers/pap/webapps/ - -# PAP account information -CONSOLE_PAP_HTTP_USER_ID=testpap -CONSOLE_PAP_HTTP_PASSWORD=alpha123 - - -node_type=pap_admin -resource_name=console_1 - -# The (optional) period of time in seconds between executions of the integrity audit. -# Value < 0 : Audit does not run (default value if property is not present = -1) -# Value = 0 : Audit runs continuously -# Value > 0 : The period of time in seconds between execution of the audit on a particular node -integrity_audit_period_seconds=-1 - -#Automatic Policy Distribution -automatic_push=false - -#Diff of policies for Firewall feature -FW_GETURL= -FW_AUTHOURL= -FW_PROXY= -FW_PORT= - -#SMTP Server Details for Java Mail -onap_smtp_host= -onap_smtp_port=25 -onap_smtp_userName= -onap_smtp_password= -onap_smtp_emailExtension= -onap_application_name= - -#-----------------------ONAP-PORTAL-Properties---------------------- - -ONAP_REDIRECT_URL=http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm -ONAP_REST_URL=http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/auxapi -ONAP_UEB_URL_LIST= -ONAP_PORTAL_INBOX_NAME= -ONAP_UEB_APP_KEY= -ONAP_UEB_APP_SECRET= -ONAP_UEB_APP_MAILBOX_NAME= -APP_DISPLAY_NAME=ONAP Policy -ONAP_SHARED_CONTEXT_REST_URL=http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/context diff --git a/scripts/policy/config/pe/elk.conf b/scripts/policy/config/pe/elk.conf deleted file mode 100644 index a65fd17d..00000000 --- a/scripts/policy/config/pe/elk.conf +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 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. -# elasticsearch - -ELK_JMX_PORT=9995 \ No newline at end of file diff --git a/scripts/policy/config/pe/mysql.conf b/scripts/policy/config/pe/mysql.conf deleted file mode 100644 index 0f6ee8c7..00000000 --- a/scripts/policy/config/pe/mysql.conf +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 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. -# mysql scripts component installation configuration parameters - -# Path to mysql bin -MYSQL_BIN=/usr/local/mysql/bin - diff --git a/scripts/policy/config/pe/pap.conf b/scripts/policy/config/pe/pap.conf deleted file mode 100644 index 86f5a50c..00000000 --- a/scripts/policy/config/pe/pap.conf +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 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. -# pap component installation configuration parameters - -# tomcat specific parameters - -TOMCAT_JMX_PORT=9990 -TOMCAT_SHUTDOWN_PORT=9405 -SSL_HTTP_CONNECTOR_PORT=9091 -SSL_AJP_CONNECTOR_PORT=8380 -SSL_AJP_CONNECTOR_REDIRECT_PORT=8443 - -TOMCAT_X_MS_MB=512 -TOMCAT_X_MX_MB=512 - -# pap properties - -PAP_PDPS=${{POLICY_HOME}}/servers/pap/bin/pdps -PAP_URL=https://pap:9091/pap/ - -PAP_INITIATE_PDP=true -PAP_HEARTBEAT_INTERVAL=10000 -PAP_HEARTBEAT_TIMEOUT=10000 - -REST_ADMIN_DOMAIN=com -REST_ADMIN_REPOSITORY=repository -REST_ADMIN_WORKSPACE=workspace - -# PDP related properties - -PAP_PDP_URL=https://pdp:8081/pdp/ -PAP_PDP_HTTP_USER_ID=testpdp -PAP_PDP_HTTP_PASSWORD=alpha123 - -PAP_HTTP_USER_ID=testpap -PAP_HTTP_PASSWORD=alpha123 - -#new values added 10-21-2015 -PROP_PAP_TRANS_WAIT=500000 -PROP_PAP_TRANS_TIMEOUT=5000 -PROP_PAP_AUDIT_TIMEOUT=300000 -PROP_PAP_RUN_AUDIT_FLAG=true -PROP_PAP_AUDIT_FLAG=true - -PROP_PAP_INCOMINGNOTIFICATION_TRIES=4 - - -node_type=pap -resource_name=pap_1 -dependency_groups=paplp_1 -test_via_jmx=true - -# The (optional) period of time in seconds between executions of the integrity audit. -# Value < 0 : Audit does not run (default value if property is not present = -1) -# Value = 0 : Audit runs continuously -# Value > 0 : The period of time in seconds between execution of the audit on a particular node -integrity_audit_period_seconds=-1 diff --git a/scripts/policy/config/pe/paplp.conf b/scripts/policy/config/pe/paplp.conf deleted file mode 100644 index 647625cb..00000000 --- a/scripts/policy/config/pe/paplp.conf +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 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. -# JVM specific parameters -LOGPARSER_JMX_PORT=9996 -LOGPARSER_X_MS_MB=256 -LOGPARSER_X_MX_MB=256 - -SERVER=https://pap:9091/pap/ -LOGPATH=/var/log/onap/policy/pap/pap-rest.log -PARSERLOGPATH=${{POLICY_HOME}}/servers/paplp/bin/IntegrityMonitor.log - -node_type=logparser -# the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase -resource_name=paplp_1 diff --git a/scripts/policy/config/pe/pdp-tweaks.sh b/scripts/policy/config/pe/pdp-tweaks.sh deleted file mode 100755 index 87c6d21d..00000000 --- a/scripts/policy/config/pe/pdp-tweaks.sh +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash -# Copyright 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. diff --git a/scripts/policy/config/pe/pdp.conf b/scripts/policy/config/pe/pdp.conf deleted file mode 100644 index 0aa6b0b6..00000000 --- a/scripts/policy/config/pe/pdp.conf +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 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. -# pdp component installation configuration parameters - -# tomcat specific parameters - -TOMCAT_JMX_PORT=9991 -TOMCAT_SHUTDOWN_PORT=8087 -SSL_HTTP_CONNECTOR_PORT=8081 -SSL_AJP_CONNECTOR_PORT=8381 -SSL_AJP_CONNECTOR_REDIRECT_PORT=8443 - -TOMCAT_X_MS_MB=512 -TOMCAT_X_MX_MB=512 - -# pdp properties - -UEB_CLUSTER=mr.api.simpledemo.onap.org - -REST_PAP_URL=https://pap:9091/pap/ -REST_PDP_ID=https://pdp:8081/pdp/ -REST_PDP_CONFIG=${{POLICY_HOME}}/servers/pdp/bin/config -REST_PDP_WEBAPPS=${{POLICY_HOME}}/servers/pdp/webapps -REST_PDP_REGISTER=true -REST_PDP_REGISTER_SLEEP=15 -REST_PDP_REGISTER_RETRIES=-1 -REST_PDP_MAXCONTENT=999999999 - -# PDP related properties -PDP_HTTP_USER_ID=testpdp -PDP_HTTP_PASSWORD=alpha123 -PDP_PAP_PDP_HTTP_USER_ID=testpap -PDP_PAP_PDP_HTTP_PASSWORD=alpha123 - -node_type=pdp_xacml -resource_name=pdp_1 -dependency_groups=pdplp_1;brmsgw_1 -test_via_jmx=true - -# -# Notification Properties -# Notification type: websocket, ueb or dmaap... if left blank websocket is the default -PDP_NOTIFICATION_TYPE=websocket -PDP_UEB_CLUSTER= -PDP_UEB_TOPIC= -PDP_UEB_DELAY= -PDP_UEB_API_KEY= -PDP_UEB_API_SECRET= -PDP_DMAAP_AAF_LOGIN= -PDP_DMAAP_AAF_PASSWORD= - -#AAF Policy Name space -#Required only, when we use AAF -POLICY_AAF_NAMESPACE= -POLICY_AAF_RESOURCE= - -# Indeterminate resolution -DECISION_INDETERMINATE_RESPONSE=PERMIT diff --git a/scripts/policy/config/pe/pdplp.conf b/scripts/policy/config/pe/pdplp.conf deleted file mode 100644 index 4676b610..00000000 --- a/scripts/policy/config/pe/pdplp.conf +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 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. -# JVM specific parameters -LOGPARSER_JMX_PORT=9997 -LOGPARSER_X_MS_MB=256 -LOGPARSER_X_MX_MB=256 - -SERVER=https://pdp:8081/pdp/ -LOGPATH=/var/log/onap/policy/pdpx/pdp-rest.log -PARSERLOGPATH=${{POLICY_HOME}}/servers/pdplp/bin/IntegrityMonitor.log - -node_type=logparser -# the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase -resource_name=pdplp_1 diff --git a/scripts/policy/config/pe/push-policies.sh b/scripts/policy/config/pe/push-policies.sh deleted file mode 100755 index 65013138..00000000 --- a/scripts/policy/config/pe/push-policies.sh +++ /dev/null @@ -1,506 +0,0 @@ -#! /bin/bash -x -# Copyright 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. - -#########################################Upload BRMS Param Template########################################## - -echo "Upload BRMS Param Template" - -sleep 2 - -wget -O cl-amsterdam-template.drl https://git.onap.org/policy/drools-applications/plain/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl - -sleep 2 - -curl -k -v --silent -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -F "file=@cl-amsterdam-template.drl" -F "importParametersJson={\"serviceName\":\"ClosedLoopControlName\",\"serviceType\":\"BRMSPARAM\"}" 'https://pdp:8081/pdp/api/policyEngineImport' - -echo "PRELOAD_POLICIES is $PRELOAD_POLICIES" - -if [ "$PRELOAD_POLICIES" == "false" ]; then - exit 0 -fi - -#########################################Create BRMS Param policies########################################## - -echo "Create BRMSParam Operational Policies" - -sleep 2 - -echo "Create BRMSParamvFirewall Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamvFirewall", - "policyDescription": "BRMS Param vFirewall policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-modifyConfig%0D%0A++++name%3A+modify+packet+gen+config%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+TBD+-+Cannot+be+known+until+instantiation+is+done%0D%0A++++++resourceID%3A+Eace933104d443b496b8.nodes.heat.vpg%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create BRMSParamvDNS Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamvDNS", - "policyDescription": "BRMS Param vDNS policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "controlLoopYaml": "controlLoop%3A%0A++version%3A+2.0.0%0A++controlLoopName%3A+ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0A++trigger_policy%3A+unique-policy-id-1-scale-up%0A++timeout%3A+1200%0A++abatement%3A+false%0Apolicies%3A%0A++-+id%3A+unique-policy-id-1-scale-up%0A++++name%3A+Create+a+new+VF+Module%0A++++description%3A%0A++++actor%3A+SO%0A++++recipe%3A+VF+Module+Create%0A++++target%3A%0A++++++type%3A+VNF%0A++++payload%3A%0A++++++requestParameters%3A+%27%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D%27%0A++++++configurationParameters%3A+%27%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B9%5D%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B16%5D%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B23%5D%22%7D%5D%27%0A++++retry%3A+0%0A++++timeout%3A+1200%0A++++success%3A+final_success%0A++++failure%3A+final_failure%0A++++failure_timeout%3A+final_failure_timeout%0A++++failure_retries%3A+final_failure_retries%0A++++failure_exception%3A+final_failure_exception%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create BRMSParamVOLTE Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamVOLTE", - "policyDescription": "BRMS Param VOLTE policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b%0D%0A++trigger_policy%3A+unique-policy-id-1-restart%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-restart%0D%0A++++name%3A+Restart+the+VM%0D%0A++++description%3A%0D%0A++++actor%3A+VFC%0D%0A++++recipe%3A+Restart%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create BRMSParamvCPE Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamvCPE", - "policyDescription": "BRMS Param vCPE policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0D%0A++trigger_policy%3A+unique-policy-id-1-restart%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+true%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-restart%0D%0A++++name%3A+Restart+the+VM%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+Restart%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create BRMSParamvPCI Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamvPCI", - "policyDescription": "BRMS Param vPCI policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "casablanca" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+3.0.0%0D%0A++controlLoopName%3A+ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459%0D%0A++trigger_policy%3A+unique-policy-id-123-modifyconfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-123-modifyconfig%0D%0A++++name%3A+modify+PCI+config%0D%0A++++description%3A%0D%0A++++actor%3A+SDNR%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+These+fields+are+not+used%0D%0A++++++resourceID%3A+Eace933104d443b496b8.nodes.heat.vpg%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create BRMSParamCCVPN Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamCCVPN", - "policyDescription": "BRMS Param CCVPN policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-CCVPN-2179b738-fd36-4843-a71a-a8c24c70c66b", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-CCVPN-2179b738-fd36-4843-a71a-a8c24c70c66b%0D%0A++trigger_policy%3A+unique-policy-id-16-Reroute%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-16-Reroute%0D%0A++++name%3A+Connectivity Reroute%0D%0A++++description%3A%0D%0A++++actor%3A+SDNC%0D%0A++++recipe%3A+Reroute%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -#########################################Create Micro Service Config policies########################################## - -echo "Create MicroService Config Policies" - -sleep 2 - -echo "Create MicroServicevFirewall Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevFirewall\", \"description\": \"MicroService vFirewall Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"vFirewallBroadcastPackets\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 300, \"direction\": \"LESS_OR_EQUAL\", \"severity\": \"MAJOR\", \"closedLoopEventStatus\": \"ONSET\" }, { \"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 700, \"direction\": \"GREATER_OR_EQUAL\", \"severity\": \"CRITICAL\", \"closedLoopEventStatus\": \"ONSET\" } ] }] } } }", - "policyConfigType": "MicroService", - "policyName": "com.MicroServicevFirewall", - "onapName": "DCAE" -}' 'https://pdp:8081/pdp/api/createPolicy' - - -sleep 2 - -echo "Create MicroServicevDNS Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevDNS\", \"description\": \"MicroService vDNS Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"vLoadBalancer\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 300, \"direction\": \"GREATER_OR_EQUAL\", \"severity\": \"CRITICAL\", \"closedLoopEventStatus\": \"ONSET\" }] }] } } }", - "policyConfigType": "MicroService", - "policyName": "com.MicroServicevDNS", - "onapName": "DCAE" -}' 'https://pdp:8081/pdp/api/createPolicy' - - -sleep 2 - -echo "Create MicroServicevCPE Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevCPE\", \"description\": \"MicroService vCPE Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"Measurement_vGMUX\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": 0, \"direction\": \"EQUAL\", \"severity\": \"MAJOR\", \"closedLoopEventStatus\": \"ABATED\" }, { \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": 0, \"direction\": \"GREATER\", \"severity\": \"CRITICAL\", \"closedLoopEventStatus\": \"ONSET\" }] }] } } }", - "policyConfigType": "MicroService", - "policyName": "com.MicroServicevCPE", - "onapName": "DCAE" -}' 'https://pdp:8081/pdp/api/createPolicy' - -#########################################Create SDNC Naming Policies########################################## - -echo "Create SDNC Naming Policies" - -sleep 2 - -echo "Create SDNC vFW Naming Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{\"service\":\"SDNC-GenerateName\",\"version\":\"CSIT\",\"content\":{\"policy-instance-name\":\"ONAP_VFW_NAMING_TIMESTAMP\",\"naming-models\":[{\"naming-properties\":[{\"property-name\":\"AIC_CLOUD_REGION\"},{\"property-name\":\"nfRole\"},{\"property-name\":\"TIMESTAMP\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNF\",\"nfRole\":\"vFW\",\"naming-recipe\":\"AIC_CLOUD_REGION|DELIMITER|nfRole|DELIMITER|TIMESTAMP\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"ENTIRETY\",\"start-value\":\"001\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}},{\"property-name\":\"NFC_NAMING_CODE\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNFC\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"},{\"property-name\":\"VF_MODULE_LABEL\"},{\"property-name\":\"VF_MODULE_TYPE\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"PRECEEDING\",\"start-value\":\"01\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}}],\"naming-type\":\"VF-MODULE\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"}],\"naming-type\":\"KEY\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"protected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"protected_private_net_id\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"unprotected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"unprotected_private_net_id\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"}]}}", - "policyName": "SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP", - "policyConfigType": "MicroService", - "onapName": "SDNC", - "riskLevel": "4", - "riskType": "test", - "guard": "false", - "priority": "4", - "description": "ONAP_VFW_NAMING_TIMESTAMP" - }' 'https://pdp:8081/pdp/api/createPolicy' - - sleep 2 - - echo "Create SDNC vPG Naming Policy" - curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{\"service\":\"SDNC-GenerateName\",\"version\":\"CSIT\",\"content\":{\"policy-instance-name\":\"ONAP_VPG_NAMING_TIMESTAMP\",\"naming-models\":[{\"naming-properties\":[{\"property-name\":\"AIC_CLOUD_REGION\"},{\"property-name\":\"nfRole\"},{\"property-name\":\"TIMESTAMP\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNF\",\"nfRole\":\"vPG\",\"naming-recipe\":\"AIC_CLOUD_REGION|DELIMITER|nfRole|DELIMITER|TIMESTAMP\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"ENTIRETY\",\"start-value\":\"001\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}},{\"property-name\":\"NFC_NAMING_CODE\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNFC\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"},{\"property-name\":\"VF_MODULE_LABEL\"},{\"property-name\":\"VF_MODULE_TYPE\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"PRECEEDING\",\"start-value\":\"01\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}}],\"naming-type\":\"VF-MODULE\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"}],\"naming-type\":\"KEY\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"protected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"protected_private_net_id\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"unprotected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"unprotected_private_net_id\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"}]}}", - "policyName": "SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP", - "policyConfigType": "MicroService", - "onapName": "SDNC", - "riskLevel": "4", - "riskType": "test", - "guard": "false", - "priority": "4", - "description": "ONAP_VPG_NAMING_TIMESTAMP" - }' 'https://pdp:8081/pdp/api/createPolicy' - -#########################################Creating OOF PCI Policies########################################## -sleep 2 - -echo "Create MicroServicevPCI Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation_pci\", \"uuid\": \"test_pci\", \"policyName\": \"MicroServicevPCI\", \"description\": \"MicroService vPCI Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"vFirewallBroadcastPackets\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.executePolicy\", \"thresholdValue\": 1, \"direction\": \"GREATER_OR_EQUAL\", \"severity\": \"MAJOR\", \"closedLoopEventStatus\": \"ONSET\" } ] }] } } }", - "policyConfigType": "MicroService", - "policyName": "com.MicroServicevPCI", - "onapName": "DCAE" -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create PCI MS Config Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyName": "com.PCIMS_CONFIG_POLICY", - "configBody": "{ \"PCI_NEIGHBOR_CHANGE_CLUSTER_TIMEOUT_IN_SECS\":60, \"PCI_MODCONFIG_POLICY_NAME\":\"ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459\", \"PCI_OPTMIZATION_ALGO_CATEGORY_IN_OOF\":\"OOF-PCI-OPTIMIZATION\", \"PCI_SDNR_TARGET_NAME\":\"SDNR\" }", - "policyType": "Config", - "attributes" : { "matching" : { "key1" : "value1" } }, - "policyConfigType": "Base", - "onapName": "DCAE", - "configName": "PCIMS_CONFIG_POLICY", - "configBodyType": "JSON" -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create OOF Config Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyName": "com.OOF_PCI_CONFIG_POLICY", - "configBody": "{ \"ALGO_CATEGORY\":\"OOF-PCI-OPTIMIZATION\", \"PCI_OPTMIZATION_ALGO_NAME\":\"OOF-PCI-OPTIMIZATION-LEVEL1\", \"PCI_OPTIMIZATION_NW_CONSTRAINT\":\"MAX5PCICHANGESONLY\", \"PCI_OPTIMIZATION_PRIORITY\": 2, \"PCI_OPTIMIZATION_TIME_CONSTRAINT\":\"ONLYATNIGHT\" }", - "attributes" : { "matching" : { "key1" : "value1" } }, - "policyType": "Config", - "policyConfigType": "Base", - "onapName": "DCAE", - "configName": "OOF_PCI_CONFIG_POLICY", - "configBodyType": "JSON" -}' 'https://pdp:8081/pdp/api/createPolicy' - -#########################################Creating Decision Guard policies######################################### - -sleep 2 - -echo "Creating Decision Guard policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyClass": "Decision", - "policyName": "com.AllPermitGuard", - "policyDescription": "Testing all Permit YAML Guard Policy", - "onapName": "PDPD", - "ruleProvider": "GUARD_YAML", - "attributes": { - "MATCHING": { - "actor": ".*", - "recipe": ".*", - "targets": ".*", - "clname": ".*", - "limit": "10", - "timeWindow": "1", - "timeUnits": "minute", - "guardActiveStart": "00:00:01-05:00", - "guardActiveEnd": "23:59:59-05:00" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Creating Decision vDNS Guard - Frequency Limiter policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyClass": "Decision", - "policyName": "com.vDNS_Frequency", - "policyDescription": "Limit vDNS Scale Up over time period", - "onapName": "PDPD", - "ruleProvider": "GUARD_YAML", - "attributes": { - "MATCHING": { - "actor": "SO", - "recipe": "scaleOut", - "targets": ".*", - "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "limit": "1", - "timeWindow": "10", - "timeUnits": "minute", - "guardActiveStart": "00:00:01-05:00", - "guardActiveEnd": "23:59:59-05:00" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Creating Decision vDNS Guard - Min/Max policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyClass": "Decision", - "policyName": "com.vDNS_MinMax", - "policyDescription": "Ensure number of instances within a range", - "onapName": "SampleDemo", - "ruleProvider": "GUARD_MIN_MAX", - "attributes": { - "MATCHING": { - "actor": "SO", - "recipe": "scaleOut", - "targets": ".*", - "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "min": "1", - "max": "5", - "guardActiveStart": "00:00:01-05:00", - "guardActiveEnd": "23:59:59-05:00" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -#########################################Push Decision policy######################################### - -sleep 2 - -echo "Push Decision policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.AllPermitGuard", - "policyType": "DECISION" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "Push Decision policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.vDNS_Frequency", - "policyType": "DECISION" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "Push Decision policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.vDNS_MinMax", - "policyType": "DECISION" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -#########################################Pushing BRMS Param policies########################################## - -echo "Pushing BRMSParam Operational policies" - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamvFirewall" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamvFirewall", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamvDNS" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamvDNS", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamVOLTE" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamVOLTE", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamvCPE" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamvCPE", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamvPCI" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamvPCI", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamCCVPN" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamCCVPN", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -#########################################Pushing MicroService Config policies########################################## - -echo "Pushing MicroService Config policies" - -sleep 2 - -echo "pushPolicy : PUT : com.MicroServicevFirewall" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.MicroServicevFirewall", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 10 - -echo "pushPolicy : PUT : com.MicroServicevDNS" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.MicroServicevDNS", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 10 - -echo "pushPolicy : PUT : com.MicroServicevCPE" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.MicroServicevCPE", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -#########################################Pushing SDNC Naming Policies########################################## -echo "Pushing SDNC Naming Policies" - -sleep 2 - -echo "pushPolicy : PUT : SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 10 - -echo "pushPolicy : PUT : SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - - -#########################################Pushing OOF PCI Policies########################################## -sleep 10 - -echo "pushPolicy : PUT : com.MicroServicevPCI" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.MicroServicevPCI", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 10 - -echo "pushPolicy : PUT : com.PCIMS_CONFIG_POLICY" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.PCIMS_CONFIG_POLICY", - "policyType": "Base" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 10 - -echo "pushPolicy : PUT : com.OOF_PCI_CONFIG_POLICY" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.OOF_PCI_CONFIG_POLICY", - "policyType": "Base" -}' 'https://pdp:8081/pdp/api/pushPolicy' diff --git a/scripts/policy/config/sim-all/simParameters.json b/scripts/policy/config/sim-all/simParameters.json index e98acc03..4b009b6f 100644 --- a/scripts/policy/config/sim-all/simParameters.json +++ b/scripts/policy/config/sim-all/simParameters.json @@ -1,8 +1,7 @@ { "dmaapProvider": { "name": "DMaaP simulator", - "topicSweepSec": 300, - "restServerParameters": { } + "topicSweepSec": 300 }, "restServers": [ { @@ -94,5 +93,17 @@ "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/scripts/policy/drools-apps/custom/xacmlDefaultConfig.json b/scripts/policy/config/xacml-pdp/defaultConfig.json similarity index 100% rename from scripts/policy/drools-apps/custom/xacmlDefaultConfig.json rename to scripts/policy/config/xacml-pdp/defaultConfig.json diff --git a/scripts/policy/detmVers.sh b/scripts/policy/detmVers.sh new file mode 100644 index 00000000..d37b4792 --- /dev/null +++ b/scripts/policy/detmVers.sh @@ -0,0 +1,80 @@ +# ============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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== + +SCRIPTS="${SCRIPTS-scripts}" + +source ${SCRIPTS}/policy/config/policy-csit.conf +export POLICY_MARIADB_VER + +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/scripts/policy/docker-compose-all.yml b/scripts/policy/docker-compose-all.yml new file mode 100644 index 00000000..55044c91 --- /dev/null +++ b/scripts/policy/docker-compose-all.yml @@ -0,0 +1,190 @@ +# +# ===========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===================================================== +# +version: '2' +services: + mariadb: + image: 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', 'bash ./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', 'bash ./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', 'bash ./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/scripts/policy/docker-compose-api.yml b/scripts/policy/docker-compose-api.yml deleted file mode 100644 index e32190f1..00000000 --- a/scripts/policy/docker-compose-api.yml +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2019-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. -version: '2' -services: - mariadb: - image: 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 - expose: - - 3306 - api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - expose: - - 6969 - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - hostname: policy-wait - command: mariadb:3306 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait-all - depends_on: - - mariadb - - api - hostname: policy-wait-all - command: - mariadb:3306 - api:6969 diff --git a/scripts/policy/docker-compose-drools.yml b/scripts/policy/docker-compose-drools.yml deleted file mode 100644 index 5fc6ef67..00000000 --- a/scripts/policy/docker-compose-drools.yml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2018-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. -version: '2' -services: - mariadb: - image: mariadb:${POLICY_MARIADB_VER} - container_name: mariadb - hostname: mariadb - command: ['--lower-case-table-names=1', '--wait_timeout=28800'] - env_file: - - ${WORKSPACE}/scripts/policy/config/db/db.conf - volumes: - - ${WORKSPACE}/scripts/policy/config/db:/docker-entrypoint-initdb.d - expose: - - 3306 - nexus: - image: sonatype/nexus:2.14.8-01 - container_name: nexus - hostname: nexus - expose: - - 8081 - drools: - image: nexus3.onap.org:10001/onap/policy-drools:${POLICY_DROOLS_VERSION} - container_name: drools - depends_on: - - mariadb - - nexus - hostname: drools - expose: - - 6969 - - 9696 - volumes: - - ${WORKSPACE}/scripts/policy/config/drools/custom:/tmp/policy-install/config - env_file: - - ${WORKSPACE}/scripts/policy/config/drools/env/base.conf diff --git a/scripts/policy/docker-compose-engine.yml b/scripts/policy/docker-compose-engine.yml deleted file mode 100644 index 1fc5f9f3..00000000 --- a/scripts/policy/docker-compose-engine.yml +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2018 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. -version: '2' -services: - mariadb: - image: mariadb:${POLICY_MARIADB_VER} - container_name: mariadb - hostname: mariadb - command: ['--lower-case-table-names=1', '--wait_timeout=28800'] - env_file: - - ${WORKSPACE}/scripts/policy/config/db/db.conf - volumes: - - ${WORKSPACE}/scripts/policy/config/db:/docker-entrypoint-initdb.d - expose: - - 3306 - nexus: - image: sonatype/nexus:2.14.8-01 - container_name: nexus - hostname: nexus - pap: - image: nexus3.onap.org:10001/onap/policy-pe:${POLICY_ENGINE_VERSION} - environment: - - PRELOAD_POLICIES=${PRELOAD_POLICIES} - container_name: pap - depends_on: - - mariadb - hostname: pap - expose: - - 8443 - - 9091 - command: pap - volumes: - - ${WORKSPACE}/scripts/policy/config/pe:/tmp/policy-install/config - pdp: - image: nexus3.onap.org:10001/onap/policy-pe:${POLICY_ENGINE_VERSION} - container_name: pdp - depends_on: - - pap - hostname: pdp - expose: - - 8081 - command: pdp - volumes: - - ./config/pe:/tmp/policy-install/config - brmsgw: - image: nexus3.onap.org:10001/onap/policy-pe:${POLICY_ENGINE_VERSION} - container_name: brmsgw - depends_on: - - pap - hostname: brmsgw - command: brmsgw - volumes: - - ${WORKSPACE}/scripts/policy/config/pe:/tmp/policy-install/config diff --git a/scripts/policy/docker-compose-pap.yml b/scripts/policy/docker-compose-pap.yml deleted file mode 100644 index 934e1739..00000000 --- a/scripts/policy/docker-compose-pap.yml +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2019-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. -version: '2' -services: - mariadb: - image: 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 - expose: - - 3306 - message-router: - image: dmaap/simulator - container_name: dmaap-simulator - hostname: dmaap-simulator - expose: - - 3904 - pap: - image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - mariadb - hostname: policy-pap - expose: - - 6969 - api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - expose: - - 6969 - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - - message-router - hostname: policy-wait - command: - mariadb:3306 - message-router:3904 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait-all - depends_on: - - mariadb - - pap - - api - hostname: policy-wait-all - command: - mariadb:3306 - message-router:3904 - pap:6969 - api:6969 diff --git a/scripts/policy/drools-apps/docker-compose-drools-apps.yml b/scripts/policy/drools-apps/docker-compose-drools-apps.yml deleted file mode 100644 index 5098a177..00000000 --- a/scripts/policy/drools-apps/docker-compose-drools-apps.yml +++ /dev/null @@ -1,139 +0,0 @@ -# -# ===========LICENSE_START==================================================== -# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. -# ============================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END===================================================== -# -version: '2' -services: - mariadb: - image: 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: policy/simulators - container_name: policy.api.simpledemo.onap.org - hostname: policy.api.simpledemo.onap.org - volumes: - - ../config/sim-all:/opt/app/policy/simulators/etc/parameters: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 - pap: - image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - mariadb - hostname: policy-pap - expose: - - 6969 - volumes: - - ./custom/papDefaultConfig.json:/opt/app/policy/pap/etc/defaultConfig.json:ro - policy-xacml-pdp: - image: nexus3.onap.org:10001/onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} - container_name: policy-xacml-pdp - depends_on: - - mariadb - - policy.api.simpledemo.onap.org - hostname: policy-xacml-pdp - expose: - - 6969 - volumes: - - ./custom/xacmlDefaultConfig.json:/opt/app/policy/pdpx/etc/defaultConfig.json:ro - drools: - image: nexus3.onap.org:10001/onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION} - container_name: drools - depends_on: - - mariadb - - policy.api.simpledemo.onap.org - hostname: drools - expose: - - 6969 - - 9696 - volumes: - - ../config/drools-apps/custom:/tmp/policy-install/config:ro - env_file: - - ../config/drools-apps/env/base.conf - - ../config/drools-apps/env/feature-healthcheck.conf - - ../config/drools-apps/env/feature-pooling-dmaap.conf - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - - policy.api.simpledemo.onap.org - hostname: policy-wait - command: - mariadb:3306 - policy.api.simpledemo.onap.org:6666 - policy.api.simpledemo.onap.org:6668 - policy.api.simpledemo.onap.org:6669 - policy.api.simpledemo.onap.org:6670 - policy.api.simpledemo.onap.org:3905 - start_pap: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 120 - container_name: policy-wait-pap - depends_on: - - mariadb - - policy.api.simpledemo.onap.org - - pap - hostname: policy-wait-pap - command: - mariadb:3306 - policy.api.simpledemo.onap.org:3905 - pap:6969 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 120 - container_name: policy-wait-all - depends_on: - - mariadb - - policy.api.simpledemo.onap.org - - api - - pap - - policy-xacml-pdp - - drools - hostname: policy-wait-all - command: - mariadb:3306 - policy.api.simpledemo.onap.org:6666 - policy.api.simpledemo.onap.org:6668 - policy.api.simpledemo.onap.org:6669 - policy.api.simpledemo.onap.org:6670 - policy.api.simpledemo.onap.org:3905 - api:6969 - pap:6969 - drools:6969 diff --git a/scripts/policy/policy-xacml-pdp/config/db/db.conf b/scripts/policy/get-models-examples.sh similarity index 68% rename from scripts/policy/policy-xacml-pdp/config/db/db.conf rename to scripts/policy/get-models-examples.sh index b4449118..1860511e 100644 --- a/scripts/policy/policy-xacml-pdp/config/db/db.conf +++ b/scripts/policy/get-models-examples.sh @@ -1,6 +1,8 @@ -# ============LICENSE_START======================================================= -# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. -# ================================================================================ +#!/bin/bash +# +# ============LICENSE_START=================================================== +# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. +# ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -12,9 +14,14 @@ # 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===================================================== # -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -MYSQL_ROOT_PASSWORD=secret -MYSQL_USER=policy_user -MYSQL_PASSWORD=policy_user \ No newline at end of file + +source ${SCRIPTS}/policy/config/policy-csit.conf + +rm -rf ${WORKSPACE}/models +mkdir ${WORKSPACE}/models +cd ${WORKSPACE} + +# download models examples +git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH} diff --git a/scripts/policy/policy-apex-pdp/config/db/db.conf b/scripts/policy/policy-apex-pdp/config/db/db.conf deleted file mode 100644 index 4768bfc4..00000000 --- a/scripts/policy/policy-apex-pdp/config/db/db.conf +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2019 Nordix Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -MYSQL_ROOT_PASSWORD=secret -MYSQL_USER=policy_user -MYSQL_PASSWORD=policy_user diff --git a/scripts/policy/policy-apex-pdp/config/db/db.sh b/scripts/policy/policy-apex-pdp/config/db/db.sh deleted file mode 100644 index 660f2c5a..00000000 --- a/scripts/policy/policy-apex-pdp/config/db/db.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -xv -# Copyright (C) 2019 Nordix Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -for db in policyadmin -do - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};" - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "GRANT ALL PRIVILEGES ON \`${db}\`.* TO '${MYSQL_USER}'@'%' ;" -done - -mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" diff --git a/scripts/policy/policy-apex-pdp/docker-compose-apex.yml b/scripts/policy/policy-apex-pdp/docker-compose-apex.yml deleted file mode 100644 index b7ba21c8..00000000 --- a/scripts/policy/policy-apex-pdp/docker-compose-apex.yml +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (C) 2019 Nordix Foundation. -# Modifications Copyright (C) 2019 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. -version: '2' -networks: - default: - driver: bridge -services: - mariadb: - image: 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 - ports: - - "3306:3306" - message-router: - image: dmaap/simulator - container_name: dmaap-simulator - hostname: dmaap-simulator - ports: - - "3904:3904" - pap: - image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - mariadb - - message-router - hostname: policy-pap - - api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - apex: - image: nexus3.onap.org:10001/onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} - container_name: policy-apex-pdp - depends_on: - - mariadb - - message-router - - pap - hostname: policy-apex-pdp - command: ['/opt/app/policy/apex-pdp/bin/apexOnapPf.sh', '-c', '/opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json'] - - ports: - - "6969:6969" - - "23324:23324" - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - - message-router - hostname: policy-wait - command: - mariadb:3306 - message-router:3904 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait-all - depends_on: - - mariadb - - message-router - - api - - pap - - apex - hostname: policy-wait-all - command: - mariadb:3306 - message-router:3904 - api:6969 - pap:6969 - apex:6969 diff --git a/scripts/policy/policy-distribution/config/db/db.conf b/scripts/policy/policy-distribution/config/db/db.conf deleted file mode 100644 index 4768bfc4..00000000 --- a/scripts/policy/policy-distribution/config/db/db.conf +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2019 Nordix Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -MYSQL_ROOT_PASSWORD=secret -MYSQL_USER=policy_user -MYSQL_PASSWORD=policy_user diff --git a/scripts/policy/policy-distribution/config/db/db.sh b/scripts/policy/policy-distribution/config/db/db.sh deleted file mode 100644 index 660f2c5a..00000000 --- a/scripts/policy/policy-distribution/config/db/db.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -xv -# Copyright (C) 2019 Nordix Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -for db in policyadmin -do - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};" - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "GRANT ALL PRIVILEGES ON \`${db}\`.* TO '${MYSQL_USER}'@'%' ;" -done - -mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" diff --git a/scripts/policy/policy-distribution/config/distribution/csar/sample_csar_with_apex_policy.csar b/scripts/policy/policy-distribution/config/distribution/csar/sample_csar_with_apex_policy.csar index c2f90eaf..4d293e42 100644 Binary files a/scripts/policy/policy-distribution/config/distribution/csar/sample_csar_with_apex_policy.csar and b/scripts/policy/policy-distribution/config/distribution/csar/sample_csar_with_apex_policy.csar differ diff --git a/scripts/policy/policy-distribution/config/distribution/temp/sample_csar_with_apex_policy.csar b/scripts/policy/policy-distribution/config/distribution/temp/sample_csar_with_apex_policy.csar deleted file mode 100644 index 675e8897..00000000 Binary files a/scripts/policy/policy-distribution/config/distribution/temp/sample_csar_with_apex_policy.csar and /dev/null differ diff --git a/scripts/policy/policy-distribution/docker-compose-distribution.yml b/scripts/policy/policy-distribution/docker-compose-distribution.yml deleted file mode 100644 index f2398908..00000000 --- a/scripts/policy/policy-distribution/docker-compose-distribution.yml +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (C) 2019 Nordix Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -version: '2' -networks: - default: - driver: bridge -services: - mariadb: - image: mariadb:${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 - ports: - - "3306:3306" - message-router: - image: dmaap/simulator - container_name: dmaap-simulator - hostname: dmaap-simulator - ports: - - "3904:3904" - policy-pap: - image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - mariadb - - message-router - hostname: policy-pap - - - policy-api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - - - distribution: - image: nexus3.onap.org:10001/onap/policy-distribution:${POLICY_DISTRIBUTION_VERSION} - container_name: policy-distribution - hostname: policy-distribution - volumes: - - ./config/distribution/defaultConfig.json:/opt/app/policy/distribution/etc/defaultConfig.json - - ./config/distribution/temp/:/opt/app/policy/distribution/etc/temp/ - depends_on: - - mariadb - - message-router - - policy-pap - - policy-api - - apex - - apex: - image: nexus3.onap.org:10001/onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} - container_name: policy-apex-pdp - depends_on: - - mariadb - - message-router - - policy-pap - hostname: policy-apex-pdp - command: ['/opt/app/policy/apex-pdp/bin/apexOnapPf.sh', '-c', '/opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json'] - ports: - - "6969:6969" - - "23324:23324" - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - - message-router - hostname: policy-wait - command: - mariadb:3306 - message-router:3904 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait-all - depends_on: - - mariadb - - message-router - - policy-api - - policy-pap - - apex - - distribution - hostname: policy-wait-all - command: - mariadb:3306 - message-router:3904 - policy-api:6969 - policy-pap:6969 - apex:6969 - distribution:6969 diff --git a/scripts/policy/policy-models-dmaap-sim.sh b/scripts/policy/policy-models-dmaap-sim.sh deleted file mode 100644 index 2839e5c3..00000000 --- a/scripts/policy/policy-models-dmaap-sim.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# ============LICENSE_START======================================================= -# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= - -source ${SCRIPTS}/policy/config/policy-csit.conf - -rm -rf ${WORKSPACE}/dmaap-sim -mkdir ${WORKSPACE}/dmaap-sim -cd ${WORKSPACE}/dmaap-sim - -POLICY_MODELS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/models/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" -export POLICY_MODELS_VERSION="${POLICY_MODELS_VERSION_EXTRACT}" -echo ${POLICY_MODELS_VERSION} - -# download dmaap tarball and build docker image -git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH} -cd models/models-sim/models-sim-dmaap -item=`curl --silent -L ${NEXUS_URL}/org/onap/policy/models/sim/policy-models-sim-dmaap/${POLICY_MODELS_VERSION} | egrep 'policy-models-sim-dmaap-.*tarball' | cut '-d"' -f2 | egrep 'gz$' | sort | tail -1` -mkdir target -curl -L $item -o target/policy-models-sim-dmaap-${POLICY_MODELS_VERSION}-tarball.tar.gz -bash ./src/main/package/docker/docker_build.sh -cd ${WORKSPACE} diff --git a/scripts/policy/policy-models-simulators.sh b/scripts/policy/policy-models-simulators.sh deleted file mode 100755 index 9e67d487..00000000 --- a/scripts/policy/policy-models-simulators.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# ============LICENSE_START=================================================== -# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. -# ============================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END===================================================== -# - -source ${SCRIPTS}/policy/config/policy-csit.conf - -rm -rf ${WORKSPACE}/simulators -mkdir ${WORKSPACE}/simulators -cd ${WORKSPACE}/simulators - -POLICY_MODELS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/models/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" -export POLICY_MODELS_VERSION="${POLICY_MODELS_VERSION_EXTRACT}" -echo ${POLICY_MODELS_VERSION} - -# download simulators tarball and build docker image -git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH} -cd models/models-sim/policy-models-simulators -item=`curl --silent -L ${NEXUS_URL}/org/onap/policy/models/sim/policy-models-simulators/${POLICY_MODELS_VERSION} | egrep 'policy-models-simulators-.*tarball' | cut '-d"' -f2 | egrep 'gz$' | sort | tail -1` -mkdir target -curl -L $item -o target/policy-models-simulators-${POLICY_MODELS_VERSION}-tarball.tar.gz -bash ./src/main/package/docker/docker_build.sh - -cd ${WORKSPACE} diff --git a/scripts/policy/policy-xacml-pdp/config/db/db.sh b/scripts/policy/policy-xacml-pdp/config/db/db.sh deleted file mode 100755 index 499764df..00000000 --- a/scripts/policy/policy-xacml-pdp/config/db/db.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -xv -# ============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. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= - -for db in 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/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml b/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml deleted file mode 100644 index caf8315b..00000000 --- a/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml +++ /dev/null @@ -1,88 +0,0 @@ -# ============LICENSE_START======================================================= -# Copyright (C) 2019-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. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -version: '2' -services: - mariadb: - image: 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 - expose: - - 3306 - message-router: - image: dmaap/simulator - container_name: dmaap-simulator - hostname: dmaap-simulator - expose: - - 3904 - pap: - image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - mariadb - - message-router - hostname: policy-pap - api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - xacml-pdp: - image: nexus3.onap.org:10001/onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} - container_name: policy-xacml-pdp - depends_on: - - mariadb - - message-router - - pap - hostname: policy-xacml-pdp - expose: - - 6969 - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - - message-router - hostname: policy-wait - command: - mariadb:3306 - message-router:3904 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait-all - depends_on: - - mariadb - - message-router - - api - - pap - - xacml-pdp - hostname: policy-wait-all - command: - mariadb:3306 - message-router:3904 - api:6969 - pap:6969 - xacml-pdp:6969 diff --git a/scripts/policy/wait_for_port.sh b/scripts/policy/wait_for_port.sh index 58bf25d0..c50cd970 100755 --- a/scripts/policy/wait_for_port.sh +++ b/scripts/policy/wait_for_port.sh @@ -1,21 +1,40 @@ #!/bin/bash -if [[ $# -ne 2 ]]; then - echo "Usage: wait-for-port hostname port" >&2 +tmout=120 +cmd= + +while getopts c:t: opt; do + case "$opt" in + c) cmd="$OPTARG" ;; + t) tmout="$OPTARG" ;; + esac +done +let nargs=$OPTIND-1 +shift $nargs + +let even_args=$#%2 +if [[ $# -lt 2 || $even_args -ne 0 ]]; then + echo "args: [-t timeout] [-c command] hostname1 port1 hostname2 port2 ..." >&2 exit 1 fi -export host=$1 -export port=$2 +while [[ $# -ge 2 ]]; do + export host=$1 + export port=$2 + shift + shift -echo "Waiting for $host port $port open" -timeout 120 bash -c 'until nc -vz "$host" "$port"; do echo -n "."; sleep 1; done' -rc=$? + echo "Waiting for $host port $port..." + timeout $tmout bash -c 'until nc -vz "$host" "$port"; do echo -n "."; + sleep 1; done' + rc=$? -if [[ $rc != 0 ]]; then + if [[ $rc != 0 ]]; then echo "$host port $port cannot be reached" exit $rc -fi + fi +done + +$cmd -echo "$host port $port is open" exit 0 diff --git a/tests/dcaegen2/testcases/03__stndDefined_tests.robot b/tests/dcaegen2/testcases/03__stndDefined_tests.robot index ddd11fa8..08970ef2 100644 --- a/tests/dcaegen2/testcases/03__stndDefined_tests.robot +++ b/tests/dcaegen2/testcases/03__stndDefined_tests.robot @@ -85,3 +85,29 @@ Publish Single VES Event With Incorrect StndDefined Data [Documentation] Post single event with incorrect stndDefined data Send Request And Validate Response Publish Event To VES Collector ${https_basic_auth_session} ${VES_EVENTLISTENER_V7} ${VES_STND_DEFINED_INVALID_TYPE_DATA} 202 +############################################################################################ +## Section for tests with stndDefined validation ON and schemas with refernce to other files +############################################################################################ +Add refeerence to other schemas + [Tags] DCAE-VESC-R1 DCAE-VESC-HC DCAE-VESC-STNDDEFINED + [Documentation] Add refeerence to other schemas and Run Health Check + Override Collector Properties ${VES_ADD_REFERENCE_TO_OTHER_SCHEMAS} + Run Healthcheck ${https_basic_auth_session} + + +Publish Single VES VNF Measurement Event with Standard Defined Fields with certBasicAuth over HTTPS and valid reference to other file + [Tags] DCAE-VESC-R1 DCAE-VESC-HC DCAE-VESC-STNDDEFINED + [Documentation] Post single event with valid data with Standard Defined Fields and valid username/password to /eventListener/v7 endpoint over HTTPS and valid reference to ther file and expect 202 Response Status Code + Send Request And Validate Response Publish Event To VES Collector ${https_basic_auth_session} ${VES_EVENTLISTENER_V7} ${VES_VALID_JSON_WITH_RFERENCE_TO_VALID_SCHEMA} 202 stndDefined-gNB-Nokia-PowerLost + + +Publish Single VES VNF Measurement Event with Standard Defined Fields with certBasicAuth over HTTPS and invalid reference to other schema file + [Tags] DCAE-VESC-R1 DCAE-VESC-HC DCAE-VESC-STNDDEFINED + [Documentation] Post single event with valid data with Standard Defined Fields and valid username/password to /eventListener/v7 endpoint over HTTPS and invalid reference to other schema file and expect 400 Response Status Code + Send Request And Validate Response Publish Event To VES Collector ${https_basic_auth_session} ${VES_EVENTLISTENER_V7} ${VES_VALID_JSON_V7_STND_DEF_FIELDS_WRONG_SCHEMA_FILE_REF} 400 + + +Publish Single VES VNF Measurement Event with Standard Defined Fields with certBasicAuth over HTTPS and invalid internal schema reference + [Tags] DCAE-VESC-R1 DCAE-VESC-HC DCAE-VESC-STNDDEFINED + [Documentation] Post single event with valid data with Standard Defined Fields and valid username/password to /eventListener/v7 endpoint over HTTPS and invalid internal schema reference and expect 400 Response Status Code + Send Request And Validate Response Publish Event To VES Collector ${https_basic_auth_session} ${VES_EVENTLISTENER_V7} ${VES_VALID_JSON_V7_STND_DEF_FIELDS_WRONG_SCHEMA_INTERNAL_REF} 400 diff --git a/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields.json b/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields.json index b999ea3b..f31b9c7e 100644 --- a/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields.json +++ b/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields.json @@ -15,7 +15,7 @@ "priority": "High" }, "stndDefinedFields": { - "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", "data": { "href": 1, "uri": "1", diff --git a/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_to_schema_with_wrong_file_ref.json b/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_to_schema_with_wrong_file_ref.json new file mode 100644 index 00000000..0b976024 --- /dev/null +++ b/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_to_schema_with_wrong_file_ref.json @@ -0,0 +1,54 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.1", + "vesEventListenerVersion": "7.2", + "domain": "stndDefined", + "eventId": "stndDefined-gNB_Nokia000001", + "eventName": "stndDefined-gNB-Nokia-PowerLost", + "stndDefinedNamespace": "3GPP-FaultSupervision", + "startEpochMicrosec": 1413378172000000, + "lastEpochMicrosec": 1413378172000000, + "reportingEntityName": "ibcx0001vm002oam001", + "sourceName": "scfx0001vm002cap001", + "sequence": 1, + "priority": "High" + }, + "stndDefinedFields": { + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_file_reference.yaml#components/schemas/NotifyNewAlarm", + "data": { + "href": 1, + "uri": "1", + "notificationId": 1, + "notificationType": "notifyNewAlarm", + "eventTime": "xyz", + "systemDN": "xyz", + "probableCause": 1, + "perceivedSeverity": "INDETERMINATE", + "rootCauseIndicator": false, + "specificProblem": "xyz", + "correlatedNotifications": [], + "backedUpStatus": true, + "backUpObject": "xyz", + "trendIndication": "MORE_SEVERE", + "thresholdInfo": { + "observedMeasurement": "new", + "observedValue": 123 + }, + "stateChangeDefinition": { + }, + "monitoredAttributes": { + "newAtt": "new" + }, + "proposedRepairActions": "xyz", + "additionalText": "xyz", + "additionalInformation": { + "addInfo": "new" + }, + "alarmId": "1", + "alarmType": "COMMUNICATIONS_ALARM" + }, + "stndDefinedFieldsVersion": "1.0" + } + } +} \ No newline at end of file diff --git a/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_to_schema_with_wrong_internal_ref.json b/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_to_schema_with_wrong_internal_ref.json new file mode 100644 index 00000000..7a4875a0 --- /dev/null +++ b/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_to_schema_with_wrong_internal_ref.json @@ -0,0 +1,54 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.1", + "vesEventListenerVersion": "7.2", + "domain": "stndDefined", + "eventId": "stndDefined-gNB_Nokia000001", + "eventName": "stndDefined-gNB-Nokia-PowerLost", + "stndDefinedNamespace": "3GPP-FaultSupervision", + "startEpochMicrosec": 1413378172000000, + "lastEpochMicrosec": 1413378172000000, + "reportingEntityName": "ibcx0001vm002oam001", + "sourceName": "scfx0001vm002cap001", + "sequence": 1, + "priority": "High" + }, + "stndDefinedFields": { + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_internal_reference.yaml#components/schemas/NotifyNewAlarm", + "data": { + "href": 1, + "uri": "1", + "notificationId": 1, + "notificationType": "notifyNewAlarm", + "eventTime": "xyz", + "systemDN": "xyz", + "probableCause": 1, + "perceivedSeverity": "INDETERMINATE", + "rootCauseIndicator": false, + "specificProblem": "xyz", + "correlatedNotifications": [], + "backedUpStatus": true, + "backUpObject": "xyz", + "trendIndication": "MORE_SEVERE", + "thresholdInfo": { + "observedMeasurement": "new", + "observedValue": 123 + }, + "stateChangeDefinition": { + }, + "monitoredAttributes": { + "newAtt": "new" + }, + "proposedRepairActions": "xyz", + "additionalText": "xyz", + "additionalInformation": { + "addInfo": "new" + }, + "alarmId": "1", + "alarmType": "COMMUNICATIONS_ALARM" + }, + "stndDefinedFieldsVersion": "1.0" + } + } +} \ No newline at end of file diff --git a/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_with_valid_schema_ref.json b/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_with_valid_schema_ref.json new file mode 100644 index 00000000..f31b9c7e --- /dev/null +++ b/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_with_valid_schema_ref.json @@ -0,0 +1,54 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.1", + "vesEventListenerVersion": "7.2", + "domain": "stndDefined", + "eventId": "stndDefined-gNB_Nokia000001", + "eventName": "stndDefined-gNB-Nokia-PowerLost", + "stndDefinedNamespace": "3GPP-FaultSupervision", + "startEpochMicrosec": 1413378172000000, + "lastEpochMicrosec": 1413378172000000, + "reportingEntityName": "ibcx0001vm002oam001", + "sourceName": "scfx0001vm002cap001", + "sequence": 1, + "priority": "High" + }, + "stndDefinedFields": { + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", + "data": { + "href": 1, + "uri": "1", + "notificationId": 1, + "notificationType": "notifyNewAlarm", + "eventTime": "xyz", + "systemDN": "xyz", + "probableCause": 1, + "perceivedSeverity": "INDETERMINATE", + "rootCauseIndicator": false, + "specificProblem": "xyz", + "correlatedNotifications": [], + "backedUpStatus": true, + "backUpObject": "xyz", + "trendIndication": "MORE_SEVERE", + "thresholdInfo": { + "observedMeasurement": "new", + "observedValue": 123 + }, + "stateChangeDefinition": { + }, + "monitoredAttributes": { + "newAtt": "new" + }, + "proposedRepairActions": "xyz", + "additionalText": "xyz", + "additionalInformation": { + "addInfo": "new" + }, + "alarmId": "1", + "alarmType": "COMMUNICATIONS_ALARM" + }, + "stndDefinedFieldsVersion": "1.0" + } + } +} \ No newline at end of file diff --git a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-FaultSupervision.json b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-FaultSupervision.json index 78d682bb..fd1ce98d 100644 --- a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-FaultSupervision.json +++ b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-FaultSupervision.json @@ -15,7 +15,7 @@ "priority": "High" }, "stndDefinedFields": { - "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", "data": { "href": 1, "uri": "1", diff --git a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-Heartbeat.json b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-Heartbeat.json index e1ca3117..ed4d748d 100644 --- a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-Heartbeat.json +++ b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-Heartbeat.json @@ -15,7 +15,7 @@ "priority": "High" }, "stndDefinedFields": { - "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", "data": { "href": 1, "uri": "1", diff --git a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-PerformanceAssurance.json b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-PerformanceAssurance.json index cbcd2eee..7ec3a3a0 100644 --- a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-PerformanceAssurance.json +++ b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-PerformanceAssurance.json @@ -15,7 +15,7 @@ "priority": "High" }, "stndDefinedFields": { - "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", "data": { "href": 1, "uri": "1", diff --git a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-Provisioning.json b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-Provisioning.json index 1f12dc0a..de233004 100644 --- a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-Provisioning.json +++ b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-Provisioning.json @@ -15,7 +15,7 @@ "priority": "High" }, "stndDefinedFields": { - "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", "data": { "href": 1, "uri": "1", diff --git a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_empty_data_fields.json b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_empty_data_fields.json index 14595a7a..4667b52e 100644 --- a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_empty_data_fields.json +++ b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_empty_data_fields.json @@ -15,7 +15,7 @@ "priority": "High" }, "stndDefinedFields": { - "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", "data": {}, "stndDefinedFieldsVersion": "1.0" } diff --git a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_empty_namespace.json b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_empty_namespace.json index 0964e5a2..909214a5 100644 --- a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_empty_namespace.json +++ b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_empty_namespace.json @@ -15,7 +15,7 @@ "priority": "High" }, "stndDefinedFields": { - "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", "data": { "href": 1, "uri": "1", diff --git a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_invalid_type_data_field.json b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_invalid_type_data_field.json index ad659640..5d7b683a 100644 --- a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_invalid_type_data_field.json +++ b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_invalid_type_data_field.json @@ -15,7 +15,7 @@ "priority": "High" }, "stndDefinedFields": { - "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", "data": { "href": 1, "uri": "1", diff --git a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_missing_namespace.json b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_missing_namespace.json index 54861598..60554fc2 100644 --- a/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_missing_namespace.json +++ b/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_missing_namespace.json @@ -14,7 +14,7 @@ "priority": "High" }, "stndDefinedFields": { - "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", + "schemaReference": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm", "data": { "href": 1, "uri": "1", diff --git a/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/comDefs.yaml b/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/comDefs.yaml new file mode 100644 index 00000000..5289940b --- /dev/null +++ b/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/comDefs.yaml @@ -0,0 +1,129 @@ +openapi: 3.0.1 +info: + title: Common Type Definitions + version: 16.5.0 + description: >- + OAS 3.0.1 specification of common type definitions in the Generic NRM + © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 28.623 V16.5.0; Generic NRM, Common Type Definitions + url: http://www.3gpp.org/ftp/Specs/archive/28_series/28.623/ +paths: {} +components: + schemas: + Long: + type: number + format: long + Float: + type: number + format: float + DateTime: + type: string + format: date-Time + Dn: + type: string + DnList: + type: array + items: + $ref: '#/components/schemas/Dn' + Mcc: + type: string + pattern: '^[0-9]{3}$' + Mnc: + type: string + pattern: '^[0-9]{2,3}$' + Fqdn: + type: string + Uri: + type: string + Ipv4Addr: + type: string + pattern: '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$' + example: '198.51.100.1' + Ipv6Addr: + type: string + allOf: + - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))$' + - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))$' + example: '2001:db8:85a3::8a2e:370:7334' + Ipv6Prefix: + type: string + allOf: + - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))$' + - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\/.+)$' + example: '2001:db8:abcd:12::0/64' + AdministrativeState: + type: string + enum: + - LOCKED + - UNLOCKED + OperationalState: + type: string + enum: + - ENABLED + - DISABLED + UsageState: + type: string + enum: + - IDEL + - ACTIVE + - BUSY + AttributeNameValuePairSet: + type: object + minProperties: 1 + AttributeValueChangeSet: + description: >- + The key in this map is the attribute name. The value of each key is an array. + When only one item is present in the array, it carries the new attribute + value. If two items are present, then the first item carries the old value + and the second item the new value. The items can be of any type including null. + type: object + additionalProperties: + type: array + minItems: 1 + maxItems: 2 + items: + nullable: true + Filter: + type: string + SystemDN: + type: string + NotificationId: + type: integer + NotificationType: + oneOf: + - $ref: 'faultMnS1.yaml#/components/schemas/AlarmNotificationType' + # more to be added + NotificationHeader: + description: >- + Header used for all notifications types + type: object + required: + - uri + - notificationId + - notificationType + - eventTime + - systemDN + properties: + uri: + $ref: '#/components/schemas/Uri' + notificationId: + $ref: '#/components/schemas/NotificationId' + notificationType: + $ref: '#/components/schemas/NotificationType' + eventTime: + $ref: '#/components/schemas/DateTime' + systemDN: + $ref: '#/components/schemas/SystemDN' + ErrorResponse: + description: >- + Default schema for the response message body in case the request + is not successful. + type: object + properties: + error: + type: object + properties: + errorInfo: + type: string diff --git a/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS1.yaml b/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS1.yaml new file mode 100644 index 00000000..8b324921 --- /dev/null +++ b/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS1.yaml @@ -0,0 +1,1063 @@ +openapi: 3.0.1 +info: + title: Fault Supervision MnS + version: 16.5.0 + description: >- + OAS 3.0.1 definition of the Fault Supervision MnS + © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 28.532 V16.5.0; Generic management services + url: http://www.3gpp.org/ftp/Specs/archive/28_series/28.532/ +servers: + - url: '{MnSRoot}/FaultSupervisionMnS/{version}' + variables: + MnSRoot: + description: See subclause 4.4.3 of TS 32.158 + default: http://example.com/3GPPManagement + version: + description: Version number of the OpenAPI definition + default: XXX +paths: + /alarms: + get: + summary: Retrieve multiple alarms + description: >- + Retrieves the alarms identified by alarmAckState, baseObjectInstance + and filter. + parameters: + - name: alarmAckState + in: query + required: false + schema: + $ref: '#/components/schemas/AlarmAckState' + - name: baseObjectInstance + in: query + required: false + schema: + $ref: 'comDefs.yaml#/components/schemas/Dn' + - name: filter + in: query + required: false + schema: + $ref: 'comDefs.yaml#/components/schemas/Filter' + responses: + '200': + description: >- + Success case ("200 OK"). + Returns the alarms identified in the request. The alarmId is the key + of the map. + content: + application/json: + schema: + type: object + additionalProperties: + type: object + allOf: + - type: object + properties: + lastNotificationHeader: + $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - $ref: '#/components/schemas/AlarmRecord' + - type: object + properties: + comments: + $ref: '#/components/schemas/Comments' + default: + description: Response in case of error. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + patch: + summary: 'Clear, acknowledge or unacknowledge multiple alarms' + description: >- + Clears, acknowledges or unacknowledges multiple alarms using patch. Depending + on which action is to be performed, different merge patch documents need + to be used. + requestBody: + description: >- + Patch documents for acknowledging and unacknowledging, or clearing multiple + alarms. The keys in the map are the alarmIds to be patched. + content: + application/merge-patch+json: + schema: + oneOf: + - type: object + additionalProperties: + $ref: '#/components/schemas/MergePatchAcknowledgeAlarm' + - type: object + additionalProperties: + $ref: '#/components/schemas/MergePatchClearAlarm' + responses: + '204': + description: >- + Success case ("204 No content"). + The response message body is empty. + default: + description: Response in case of error. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/FailedAlarm' + /alarms/alarmCount: + get: + summary: Get the alarm count per perceived severity + parameters: + - name: alarmAckState + in: query + required: false + schema: + $ref: '#/components/schemas/AlarmAckState' + - name: filter + in: query + required: false + schema: + type: string + responses: + '200': + description: >- + Success case ("200 OK"). + The alarm count per perceived severity is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/AlarmCount' + default: + description: Response in case of error. The error case needs rework. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + /alarms/{alarmId}: + patch: + summary: 'Clear, acknowledge or unacknowledge a single alarm' + description: >- + Clears, acknowledges or uncknowldeges a single alarm by patching the alarm + information. A conditional acknowledge request based on the perceived + severity is not supported. + parameters: + - name: alarmId + in: path + description: Identifies the alarm to be patched. + required: true + schema: + type: string + requestBody: + required: true + content: + application/merge-patch+json: + schema: + oneOf: + - $ref: '#/components/schemas/MergePatchAcknowledgeAlarm' + - $ref: '#/components/schemas/MergePatchClearAlarm' + responses: + '204': + description: >- + Success case (204 No content). + The response message body is absent. + default: + description: Response in case of error. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + /alarms/{alarmId}/comments: + post: + summary: Add a comment to a single alarm + description: >- + Adds a comment to an alarm identified by alarmId. The id of the new comment + is allocated by the producer. + parameters: + - name: alarmId + in: path + description: Identifies the alarm to which the comment shall be added. + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + '201': + description: >- + Success case (201 Created). + The representation of the newly created comment resource shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + headers: + Location: + description: URI of the newly created comment resource. + required: true + schema: + type: string + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + + /subscriptions: + post: + summary: Create a subscription + description: >- + To create a subscription the representation of the subscription is + POSTed on the /subscriptions collection resource. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Subscription' + responses: + '201': + description: >- + Success case ("201 Created"). + The representation of the newly created subscription resource shall + be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/Subscription' + headers: + Location: + description: URI of the newly created subscription resource + required: true + schema: + type: string + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + callbacks: + notifyNewAlarm: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/NotifyNewAlarm' + - $ref: '#/components/schemas/NotifyNewSecAlarm' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyClearedAlarm: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyClearedAlarm' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyChangedAlarm: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyChangedAlarm' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyChangedAlarmGeneral: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/NotifyChangedAlarmGeneral' + - $ref: '#/components/schemas/NotifyChangedSecAlarmGeneral' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyCorrelatedNotificationChanged: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyCorrelatedNotificationChanged' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyAckStateChanged: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyAckStateChanged' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyComments: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyComments' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyPotentialFaultyAlarmList: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyPotentialFaultyAlarmList' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyAlarmListRebuilt: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyAlarmListRebuilt' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + /subscriptions/{subscriptionId}: + delete: + summary: Delete a subscription + description: >- + The subscription is deleted by deleting the corresponding subscription + resource. The resource to be deleted is identified with the path + component of the URI. + parameters: + - name: subscriptionId + in: path + description: Identifies the subscription to be deleted. + required: true + schema: + type: string + responses: + '204': + description: >- + Success case ("204 No Content"). + The subscription resource has been deleted. The response message body + is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + +components: + schemas: + + #---- Definition of AlarmRecord ----------------------------------------------------# + + AlarmId: + type: string + AlarmType: + type: string + enum: + - COMMUNICATIONS_ALARM + - QUALITY_OF_SERVICE_ALARM + - PROCESSING_ERROR_ALARM + - EQUIPMENT_ALARM + - ENVIRONMENTAL_ALARM + - INTEGRITY_VIOLATION + - OPERATIONAL_VIOLATION + - PHYSICAL_VIOLATION + - SECURITY_SERVICE_OR_MECHANISM_VIOLATION + - TIME_DOMAIN_VIOLATION + ProbableCause: + description: >- + The value of the probable cause may be a specific standardized string, or any + vendor provided string. Probable cause strings are not standardized in the + present document. They may be added in a future version. Up to then the + mapping of the generic probable cause strings "PROBABLE_CAUSE_001" to + "PROBABLE_CAUSE_005" is vendor specific. + The value of the probable cause may also be an integer. The mapping of integer + values to probable causes is vendor specific. + oneOf: + - anyOf: + - type: string + enum: + - PROBABLE_CAUSE_001 + - PROBABLE_CAUSE_002 + - PROBABLE_CAUSE_003 + - PROBABLE_CAUSE_004 + - PROBABLE_CAUSE_005 + - type: string + - type: integer + SpecificProblem: + oneOf: + - type: string + - type: integer + PerceivedSeverity: + type: string + enum: + - INDETERMINATE + - CRITICAL + - MAJOR + - MINOR + - WARNING + - CLEARED + TrendIndication: + type: string + enum: + - MORE_SEVERE + - NO_CHANGE + - LESS_SEVERE + ThresholdHysteresis: + type: object + required: + - high + properties: + high: + oneOf: + - type: integer + - $ref: 'comDefs.yaml#/components/schemas/Float' + low: + $ref: 'comDefs.yaml#/components/schemas/Float' + ThresholdLevelInd: + type: object + required: + - up + properties: + up: + $ref: '#/components/schemas/ThresholdHysteresis' + low: + $ref: '#/components/schemas/ThresholdHysteresis' + ThresholdInfo: + type: object + required: + - observedMeasurement + - observedValue + properties: + observedMeasurement: + type: string + observedValue: + type: integer + oneOf: + - $ref: 'comDefs.yaml#/components/schemas/Float' + thresholdLevelInd: + $ref: '#/components/schemas/ThresholdLevelInd' + armTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + CorrelatedNotification: + type: object + required: + - source + - notificationId + properties: + sourceObjectInstance: + $ref: 'comDefs.yaml#/components/schemas/Dn' + notificationIds: + type: array + items: + $ref: 'comDefs.yaml#/components/schemas/NotificationId' + CorrelatedNotifications: + type: array + items: + $ref: '#/components/schemas/CorrelatedNotification' + AckState: + type: string + enum: + - ACKNOWLEDGED + - UNACKNOWLEDGED + + AlarmRecord: + description: >- + The alarmId is not a property of an alarm record. It is used as key + in the map of alarm records instead. + type: object + properties: + # alarmId: + # $ref: '#/components/schemas/AlarmId' + objectInstance: + $ref: 'comDefs.yaml#/components/schemas/Dn' + notificationId: + $ref: 'comDefs.yaml#/components/schemas/NotificationId' + alarmRaisedTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + alarmChangedTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + alarmClearedTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + specificProblem: + $ref: '#/components/schemas/SpecificProblem' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + backedUpStatus: + type: boolean + backUpObject: + $ref: 'comDefs.yaml#/components/schemas/Dn' + trendIndication: + $ref: '#/components/schemas/TrendIndication' + thresholdinfo: + $ref: '#/components/schemas/ThresholdInfo' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + stateChangeDefinition: + $ref: 'comDefs.yaml#/components/schemas/AttributeValueChangeSet' + monitoredAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + proposedRepairActions: + type: string + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + + rootCauseIndicator: + type: boolean + + ackTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + ackUserId: + type: string + ackSystemId: + type: string + ackState: + $ref: '#/components/schemas/AckState' + + clearUserId: + type: string + clearSystemId: + type: string + serviceUser: + type: string + serviceProvider: + type: string + securityAlarmDetector: + type: string + + #---- Definition of alarm notifications --------------------------------------------# + + AlarmNotificationType: + type: string + enum: + - notifyNewAlarm + - notifyChangedAlarm + - notifyChangedAlarmGeneral + - notifyAckStateChanged + - notifyCorrelatedNotificationChanged + - notifyComments + - notifyClearedAlarm + - notifyAlarmListRebuiltAlarm + - notifyPotentialFaultyAlarmList + AlarmListAlignmentRequirement: + type: string + enum: + - ALIGNMENT_REQUIRED + - ALIGNMENT_NOT_REQUIRED + + NotifyNewAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + specificProblem: + $ref: '#/components/schemas/SpecificProblem' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + backedUpStatus: + type: boolean + backUpObject: + $ref: 'comDefs.yaml#/components/schemas/Dn' + trendIndication: + $ref: '#/components/schemas/TrendIndication' + thresholdInfo: + $ref: '#/components/schemas/ThresholdInfo' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + stateChangeDefinition: + $ref: 'comDefs.yaml#/components/schemas/AttributeValueChangeSet' + monitoredAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + proposedRepairActions: + type: string + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + NotifyNewSecAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - serviceUser + - serviceProvider + - securityAlarmDetector + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + serviceUser: + type: string + serviceProvider: + type: string + securityAlarmDetector: + type: string + NotifyClearedAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + clearUserId: + type: string + clearSystemId: + type: string + NotifyChangedAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + NotifyChangedAlarmGeneral: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - changedAlarmAttributes + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + specificProblem: + $ref: '#/components/schemas/SpecificProblem' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + backedUpStatus: + type: boolean + backUpObject: + $ref: 'comDefs.yaml#/components/schemas/Dn' + trendIndication: + $ref: '#/components/schemas/TrendIndication' + thresholdInfo: + $ref: '#/components/schemas/ThresholdInfo' + stateChangeDefinition: + $ref: 'comDefs.yaml#/components/schemas/AttributeValueChangeSet' + monitoredAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + proposedRepairActions: + type: string + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + changedAlarmAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + NotifyChangedSecAlarmGeneral: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - serviceUser + - serviceProvider + - securityAlarmDetector + - changedAlarmAttributes + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + serviceUser: + type: string + serviceProvider: + type: string + securityAlarmDetector: + type: string + changedAlarmAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + NotifyCorrelatedNotificationChanged: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - correlatedNotifications + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + rootCauseIndicator: + type: boolean + NotifyAckStateChanged: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - ackState + - ackUserId + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + ackState: + $ref: '#/components/schemas/AckState' + ackUserId: + type: string + ackSystemId: + type: string + NotifyComments: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - comments + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + comments: + $ref: '#/components/schemas/Comments' + NotifyPotentialFaultyAlarmList: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - reason + properties: + reason: + type: string + NotifyAlarmListRebuilt: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - reason + properties: + reason: + type: string + alarmListAlignmentRequirement: + $ref: '#/components/schemas/AlarmListAlignmentRequirement' + + #---- Definition of query parameters -----------------------------------------------# + + AlarmAckState: + type: string + enum: + - ALL_ALARMS + - ALL_ACTIVE_ALARMS + - ALL_ACTIVE_AND_ACKNOWLEDGED_ALARMS + - ALL_ACTIVE_AND_UNACKNOWLEDGED_ALARMS + - ALL_CLEARED_AND_UNACKNOWLEDGED_ALARMS + - ALL_UNACKNOWLEDGED_ALARMS + + #---- Definition of patch documents ------------------------------------------------# + + MergePatchAcknowledgeAlarm: + description: >- + Patch document acknowledging or unacknowledging a single alarm. For + acknowleding an alarm the value of ackState is ACKNOWLEDGED, for unacknowleding + an alarm the value of ackState is UNACKNOWLEDGED. + type: object + required: + - ackUserId + - ackState + properties: + ackUserId: + type: string + ackSystemId: + type: string + ackState: + $ref: '#/components/schemas/AckState' + MergePatchClearAlarm: + description: Patch document for clearing a single alarm + type: object + required: + - clearUserId + - perceivedSeverity + properties: + clearUserId: + type: string + clearSystemId: + type: string + perceivedSeverity: + type: string + enum: + - CLEARED + + #---- Definition of method responses -----------------------------------------------# + + FailedAlarm: + type: object + required: + - alarmId + - failureReason + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + failureReason: + type: string + + #---- Definition of resources ------------------------------------------------------# + + AlarmCount: + type: object + required: + - criticalCount + - majorCount + - minorCount + - warningCount + - indeterminateCount + - clearedCount + properties: + criticalCount: + type: integer + majorCount: + type: integer + minorCount: + type: integer + warningCount: + type: integer + indeterminateCount: + type: integer + clearedCount: + type: integer + Comment: + type: object + properties: + commentTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + commentUserId: + type: string + commentSystemId: + type: string + commentText: + type: string + Comments: + description: >- + Collection of comments. The comment identifiers are allocated by the + MnS producer and used as key in the map. + type: object + additionalProperties: + $ref: '#/components/schemas/Comment' + Subscription: + type: object + properties: + consumerReference: + $ref: 'comDefs.yaml#/components/schemas/Uri' + timeTick: + $ref: 'comDefs.yaml#/components/schemas/Long' + filter: + $ref: 'comDefs.yaml#/components/schemas/Filter' \ No newline at end of file diff --git a/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_file_reference.yaml b/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_file_reference.yaml new file mode 100644 index 00000000..f17b0995 --- /dev/null +++ b/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_file_reference.yaml @@ -0,0 +1,1063 @@ +openapi: 3.0.1 +info: + title: Fault Supervision MnS + version: 16.5.0 + description: >- + OAS 3.0.1 definition of the Fault Supervision MnS + © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 28.532 V16.5.0; Generic management services + url: http://www.3gpp.org/ftp/Specs/archive/28_series/28.532/ +servers: + - url: '{MnSRoot}/FaultSupervisionMnS/{version}' + variables: + MnSRoot: + description: See subclause 4.4.3 of TS 32.158 + default: http://example.com/3GPPManagement + version: + description: Version number of the OpenAPI definition + default: XXX +paths: + /alarms: + get: + summary: Retrieve multiple alarms + description: >- + Retrieves the alarms identified by alarmAckState, baseObjectInstance + and filter. + parameters: + - name: alarmAckState + in: query + required: false + schema: + $ref: '#/components/schemas/AlarmAckState' + - name: baseObjectInstance + in: query + required: false + schema: + $ref: 'comDefs.yaml#/components/schemas/Dn' + - name: filter + in: query + required: false + schema: + $ref: 'comDefs.yaml#/components/schemas/Filter' + responses: + '200': + description: >- + Success case ("200 OK"). + Returns the alarms identified in the request. The alarmId is the key + of the map. + content: + application/json: + schema: + type: object + additionalProperties: + type: object + allOf: + - type: object + properties: + lastNotificationHeader: + $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - $ref: '#/components/schemas/AlarmRecord' + - type: object + properties: + comments: + $ref: '#/components/schemas/Comments' + default: + description: Response in case of error. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + patch: + summary: 'Clear, acknowledge or unacknowledge multiple alarms' + description: >- + Clears, acknowledges or unacknowledges multiple alarms using patch. Depending + on which action is to be performed, different merge patch documents need + to be used. + requestBody: + description: >- + Patch documents for acknowledging and unacknowledging, or clearing multiple + alarms. The keys in the map are the alarmIds to be patched. + content: + application/merge-patch+json: + schema: + oneOf: + - type: object + additionalProperties: + $ref: '#/components/schemas/MergePatchAcknowledgeAlarm' + - type: object + additionalProperties: + $ref: '#/components/schemas/MergePatchClearAlarm' + responses: + '204': + description: >- + Success case ("204 No content"). + The response message body is empty. + default: + description: Response in case of error. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/FailedAlarm' + /alarms/alarmCount: + get: + summary: Get the alarm count per perceived severity + parameters: + - name: alarmAckState + in: query + required: false + schema: + $ref: '#/components/schemas/AlarmAckState' + - name: filter + in: query + required: false + schema: + type: string + responses: + '200': + description: >- + Success case ("200 OK"). + The alarm count per perceived severity is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/AlarmCount' + default: + description: Response in case of error. The error case needs rework. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + /alarms/{alarmId}: + patch: + summary: 'Clear, acknowledge or unacknowledge a single alarm' + description: >- + Clears, acknowledges or uncknowldeges a single alarm by patching the alarm + information. A conditional acknowledge request based on the perceived + severity is not supported. + parameters: + - name: alarmId + in: path + description: Identifies the alarm to be patched. + required: true + schema: + type: string + requestBody: + required: true + content: + application/merge-patch+json: + schema: + oneOf: + - $ref: '#/components/schemas/MergePatchAcknowledgeAlarm' + - $ref: '#/components/schemas/MergePatchClearAlarm' + responses: + '204': + description: >- + Success case (204 No content). + The response message body is absent. + default: + description: Response in case of error. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + /alarms/{alarmId}/comments: + post: + summary: Add a comment to a single alarm + description: >- + Adds a comment to an alarm identified by alarmId. The id of the new comment + is allocated by the producer. + parameters: + - name: alarmId + in: path + description: Identifies the alarm to which the comment shall be added. + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + '201': + description: >- + Success case (201 Created). + The representation of the newly created comment resource shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + headers: + Location: + description: URI of the newly created comment resource. + required: true + schema: + type: string + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + + /subscriptions: + post: + summary: Create a subscription + description: >- + To create a subscription the representation of the subscription is + POSTed on the /subscriptions collection resource. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Subscription' + responses: + '201': + description: >- + Success case ("201 Created"). + The representation of the newly created subscription resource shall + be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/Subscription' + headers: + Location: + description: URI of the newly created subscription resource + required: true + schema: + type: string + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + callbacks: + notifyNewAlarm: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/NotifyNewAlarm' + - $ref: '#/components/schemas/NotifyNewSecAlarm' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyClearedAlarm: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyClearedAlarm' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyChangedAlarm: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyChangedAlarm' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyChangedAlarmGeneral: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/NotifyChangedAlarmGeneral' + - $ref: '#/components/schemas/NotifyChangedSecAlarmGeneral' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyCorrelatedNotificationChanged: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyCorrelatedNotificationChanged' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyAckStateChanged: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyAckStateChanged' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyComments: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyComments' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyPotentialFaultyAlarmList: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyPotentialFaultyAlarmList' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyAlarmListRebuilt: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyAlarmListRebuilt' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + /subscriptions/{subscriptionId}: + delete: + summary: Delete a subscription + description: >- + The subscription is deleted by deleting the corresponding subscription + resource. The resource to be deleted is identified with the path + component of the URI. + parameters: + - name: subscriptionId + in: path + description: Identifies the subscription to be deleted. + required: true + schema: + type: string + responses: + '204': + description: >- + Success case ("204 No Content"). + The subscription resource has been deleted. The response message body + is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + +components: + schemas: + + #---- Definition of AlarmRecord ----------------------------------------------------# + + AlarmId: + type: string + AlarmType: + type: string + enum: + - COMMUNICATIONS_ALARM + - QUALITY_OF_SERVICE_ALARM + - PROCESSING_ERROR_ALARM + - EQUIPMENT_ALARM + - ENVIRONMENTAL_ALARM + - INTEGRITY_VIOLATION + - OPERATIONAL_VIOLATION + - PHYSICAL_VIOLATION + - SECURITY_SERVICE_OR_MECHANISM_VIOLATION + - TIME_DOMAIN_VIOLATION + ProbableCause: + description: >- + The value of the probable cause may be a specific standardized string, or any + vendor provided string. Probable cause strings are not standardized in the + present document. They may be added in a future version. Up to then the + mapping of the generic probable cause strings "PROBABLE_CAUSE_001" to + "PROBABLE_CAUSE_005" is vendor specific. + The value of the probable cause may also be an integer. The mapping of integer + values to probable causes is vendor specific. + oneOf: + - anyOf: + - type: string + enum: + - PROBABLE_CAUSE_001 + - PROBABLE_CAUSE_002 + - PROBABLE_CAUSE_003 + - PROBABLE_CAUSE_004 + - PROBABLE_CAUSE_005 + - type: string + - type: integer + SpecificProblem: + oneOf: + - type: string + - type: integer + PerceivedSeverity: + type: string + enum: + - INDETERMINATE + - CRITICAL + - MAJOR + - MINOR + - WARNING + - CLEARED + TrendIndication: + type: string + enum: + - MORE_SEVERE + - NO_CHANGE + - LESS_SEVERE + ThresholdHysteresis: + type: object + required: + - high + properties: + high: + oneOf: + - type: integer + - $ref: 'comDefs.yaml#/components/schemas/Float' + low: + $ref: 'comDefs.yaml#/components/schemas/Float' + ThresholdLevelInd: + type: object + required: + - up + properties: + up: + $ref: '#/components/schemas/ThresholdHysteresis' + low: + $ref: '#/components/schemas/ThresholdHysteresis' + ThresholdInfo: + type: object + required: + - observedMeasurement + - observedValue + properties: + observedMeasurement: + type: string + observedValue: + type: integer + oneOf: + - $ref: 'comDefs.yaml#/components/schemas/Float' + thresholdLevelInd: + $ref: '#/components/schemas/ThresholdLevelInd' + armTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + CorrelatedNotification: + type: object + required: + - source + - notificationId + properties: + sourceObjectInstance: + $ref: 'comDefs.yaml#/components/schemas/Dn' + notificationIds: + type: array + items: + $ref: 'comDefs.yaml#/components/schemas/NotificationId' + CorrelatedNotifications: + type: array + items: + $ref: '#/components/schemas/CorrelatedNotification' + AckState: + type: string + enum: + - ACKNOWLEDGED + - UNACKNOWLEDGED + + AlarmRecord: + description: >- + The alarmId is not a property of an alarm record. It is used as key + in the map of alarm records instead. + type: object + properties: + # alarmId: + # $ref: '#/components/schemas/AlarmId' + objectInstance: + $ref: 'comDefs.yaml#/components/schemas/Dn' + notificationId: + $ref: 'comDefs.yaml#/components/schemas/NotificationId' + alarmRaisedTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + alarmChangedTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + alarmClearedTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + specificProblem: + $ref: '#/components/schemas/SpecificProblem' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + backedUpStatus: + type: boolean + backUpObject: + $ref: 'comDefs.yaml#/components/schemas/Dn' + trendIndication: + $ref: '#/components/schemas/TrendIndication' + thresholdinfo: + $ref: '#/components/schemas/ThresholdInfo' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + stateChangeDefinition: + $ref: 'comDefs.yaml#/components/schemas/AttributeValueChangeSet' + monitoredAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + proposedRepairActions: + type: string + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + + rootCauseIndicator: + type: boolean + + ackTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + ackUserId: + type: string + ackSystemId: + type: string + ackState: + $ref: '#/components/schemas/AckState' + + clearUserId: + type: string + clearSystemId: + type: string + serviceUser: + type: string + serviceProvider: + type: string + securityAlarmDetector: + type: string + + #---- Definition of alarm notifications --------------------------------------------# + + AlarmNotificationType: + type: string + enum: + - notifyNewAlarm + - notifyChangedAlarm + - notifyChangedAlarmGeneral + - notifyAckStateChanged + - notifyCorrelatedNotificationChanged + - notifyComments + - notifyClearedAlarm + - notifyAlarmListRebuiltAlarm + - notifyPotentialFaultyAlarmList + AlarmListAlignmentRequirement: + type: string + enum: + - ALIGNMENT_REQUIRED + - ALIGNMENT_NOT_REQUIRED + + NotifyNewAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + specificProblem: + $ref: '#/components/schemas/SpecificProblem' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + backedUpStatus: + type: boolean + backUpObject: + $ref: 'comDefs.yaml#/components/schemas/Dn' + trendIndication: + $ref: '#/components/schemas/TrendIndication' + thresholdInfo: + $ref: '#/components/schemas/ThresholdInfo' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + stateChangeDefinition: + $ref: 'comDefs.yaml#/components/schemas/AttributeValueChangeSet' + monitoredAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + proposedRepairActions: + type: string + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + NotifyNewSecAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - serviceUser + - serviceProvider + - securityAlarmDetector + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + serviceUser: + type: string + serviceProvider: + type: string + securityAlarmDetector: + type: string + NotifyClearedAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + clearUserId: + type: string + clearSystemId: + type: string + NotifyChangedAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + NotifyChangedAlarmGeneral: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - changedAlarmAttributes + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + specificProblem: + $ref: '#/components/schemas/SpecificProblem' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + backedUpStatus: + type: boolean + backUpObject: + $ref: 'comDefs.yaml#/components/schemas/Dn' + trendIndication: + $ref: '#/components/schemas/TrendIndication' + thresholdInfo: + $ref: '#/components/schemas/ThresholdInfo' + stateChangeDefinition: + $ref: 'comDefs.yaml#/components/schemas/AttributeValueChangeSet' + monitoredAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + proposedRepairActions: + type: string + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + changedAlarmAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + NotifyChangedSecAlarmGeneral: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - serviceUser + - serviceProvider + - securityAlarmDetector + - changedAlarmAttributes + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + serviceUser: + type: string + serviceProvider: + type: string + securityAlarmDetector: + type: string + changedAlarmAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + NotifyCorrelatedNotificationChanged: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - correlatedNotifications + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + rootCauseIndicator: + type: boolean + NotifyAckStateChanged: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - ackState + - ackUserId + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + ackState: + $ref: '#/components/schemas/AckState' + ackUserId: + type: string + ackSystemId: + type: string + NotifyComments: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - comments + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + comments: + $ref: '#/components/schemas/Comments' + NotifyPotentialFaultyAlarmList: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - reason + properties: + reason: + type: string + NotifyAlarmListRebuilt: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - reason + properties: + reason: + type: string + alarmListAlignmentRequirement: + $ref: '#/components/schemas/AlarmListAlignmentRequirement' + + #---- Definition of query parameters -----------------------------------------------# + + AlarmAckState: + type: string + enum: + - ALL_ALARMS + - ALL_ACTIVE_ALARMS + - ALL_ACTIVE_AND_ACKNOWLEDGED_ALARMS + - ALL_ACTIVE_AND_UNACKNOWLEDGED_ALARMS + - ALL_CLEARED_AND_UNACKNOWLEDGED_ALARMS + - ALL_UNACKNOWLEDGED_ALARMS + + #---- Definition of patch documents ------------------------------------------------# + + MergePatchAcknowledgeAlarm: + description: >- + Patch document acknowledging or unacknowledging a single alarm. For + acknowleding an alarm the value of ackState is ACKNOWLEDGED, for unacknowleding + an alarm the value of ackState is UNACKNOWLEDGED. + type: object + required: + - ackUserId + - ackState + properties: + ackUserId: + type: string + ackSystemId: + type: string + ackState: + $ref: '#/components/schemas/AckState' + MergePatchClearAlarm: + description: Patch document for clearing a single alarm + type: object + required: + - clearUserId + - perceivedSeverity + properties: + clearUserId: + type: string + clearSystemId: + type: string + perceivedSeverity: + type: string + enum: + - CLEARED + + #---- Definition of method responses -----------------------------------------------# + + FailedAlarm: + type: object + required: + - alarmId + - failureReason + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + failureReason: + type: string + + #---- Definition of resources ------------------------------------------------------# + + AlarmCount: + type: object + required: + - criticalCount + - majorCount + - minorCount + - warningCount + - indeterminateCount + - clearedCount + properties: + criticalCount: + type: integer + majorCount: + type: integer + minorCount: + type: integer + warningCount: + type: integer + indeterminateCount: + type: integer + clearedCount: + type: integer + Comment: + type: object + properties: + commentTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + commentUserId: + type: string + commentSystemId: + type: string + commentText: + type: string + Comments: + description: >- + Collection of comments. The comment identifiers are allocated by the + MnS producer and used as key in the map. + type: object + additionalProperties: + $ref: '#/components/schemas/Comment' + Subscription: + type: object + properties: + consumerReference: + $ref: 'comDefs1.yaml#/components/schemas/Uri' + timeTick: + $ref: 'comDefs1.yaml#/components/schemas/Long' + filter: + $ref: 'comDefs1.yaml#/components/schemas/Filter' \ No newline at end of file diff --git a/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_internal_reference.yaml b/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_internal_reference.yaml new file mode 100644 index 00000000..576ddeb6 --- /dev/null +++ b/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_internal_reference.yaml @@ -0,0 +1,1063 @@ +openapi: 3.0.1 +info: + title: Fault Supervision MnS + version: 16.5.0 + description: >- + OAS 3.0.1 definition of the Fault Supervision MnS + © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 28.532 V16.5.0; Generic management services + url: http://www.3gpp.org/ftp/Specs/archive/28_series/28.532/ +servers: + - url: '{MnSRoot}/FaultSupervisionMnS/{version}' + variables: + MnSRoot: + description: See subclause 4.4.3 of TS 32.158 + default: http://example.com/3GPPManagement + version: + description: Version number of the OpenAPI definition + default: XXX +paths: + /alarms: + get: + summary: Retrieve multiple alarms + description: >- + Retrieves the alarms identified by alarmAckState, baseObjectInstance + and filter. + parameters: + - name: alarmAckState + in: query + required: false + schema: + $ref: '#/components/schemas/AlarmAckState' + - name: baseObjectInstance + in: query + required: false + schema: + $ref: 'comDefs.yaml#/components/schemas/Dn' + - name: filter + in: query + required: false + schema: + $ref: 'comDefs.yaml#/components/schemas/Filter' + responses: + '200': + description: >- + Success case ("200 OK"). + Returns the alarms identified in the request. The alarmId is the key + of the map. + content: + application/json: + schema: + type: object + additionalProperties: + type: object + allOf: + - type: object + properties: + lastNotificationHeader: + $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - $ref: '#/components/schemas/AlarmRecord' + - type: object + properties: + comments: + $ref: '#/components/schemas/Comments' + default: + description: Response in case of error. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + patch: + summary: 'Clear, acknowledge or unacknowledge multiple alarms' + description: >- + Clears, acknowledges or unacknowledges multiple alarms using patch. Depending + on which action is to be performed, different merge patch documents need + to be used. + requestBody: + description: >- + Patch documents for acknowledging and unacknowledging, or clearing multiple + alarms. The keys in the map are the alarmIds to be patched. + content: + application/merge-patch+json: + schema: + oneOf: + - type: object + additionalProperties: + $ref: '#/components/schemas/MergePatchAcknowledgeAlarm' + - type: object + additionalProperties: + $ref: '#/components/schemas/MergePatchClearAlarm' + responses: + '204': + description: >- + Success case ("204 No content"). + The response message body is empty. + default: + description: Response in case of error. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/FailedAlarm' + /alarms/alarmCount: + get: + summary: Get the alarm count per perceived severity + parameters: + - name: alarmAckState + in: query + required: false + schema: + $ref: '#/components/schemas/AlarmAckState' + - name: filter + in: query + required: false + schema: + type: string + responses: + '200': + description: >- + Success case ("200 OK"). + The alarm count per perceived severity is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/AlarmCount' + default: + description: Response in case of error. The error case needs rework. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + /alarms/{alarmId}: + patch: + summary: 'Clear, acknowledge or unacknowledge a single alarm' + description: >- + Clears, acknowledges or uncknowldeges a single alarm by patching the alarm + information. A conditional acknowledge request based on the perceived + severity is not supported. + parameters: + - name: alarmId + in: path + description: Identifies the alarm to be patched. + required: true + schema: + type: string + requestBody: + required: true + content: + application/merge-patch+json: + schema: + oneOf: + - $ref: '#/components/schemas/MergePatchAcknowledgeAlarm' + - $ref: '#/components/schemas/MergePatchClearAlarm' + responses: + '204': + description: >- + Success case (204 No content). + The response message body is absent. + default: + description: Response in case of error. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + /alarms/{alarmId}/comments: + post: + summary: Add a comment to a single alarm + description: >- + Adds a comment to an alarm identified by alarmId. The id of the new comment + is allocated by the producer. + parameters: + - name: alarmId + in: path + description: Identifies the alarm to which the comment shall be added. + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + '201': + description: >- + Success case (201 Created). + The representation of the newly created comment resource shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + headers: + Location: + description: URI of the newly created comment resource. + required: true + schema: + type: string + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + + /subscriptions: + post: + summary: Create a subscription + description: >- + To create a subscription the representation of the subscription is + POSTed on the /subscriptions collection resource. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Subscription' + responses: + '201': + description: >- + Success case ("201 Created"). + The representation of the newly created subscription resource shall + be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/Subscription' + headers: + Location: + description: URI of the newly created subscription resource + required: true + schema: + type: string + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + callbacks: + notifyNewAlarm: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/NotifyNewAlarm' + - $ref: '#/components/schemas/NotifyNewSecAlarm' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyClearedAlarm: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyClearedAlarm' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyChangedAlarm: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyChangedAlarm' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyChangedAlarmGeneral: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/NotifyChangedAlarmGeneral' + - $ref: '#/components/schemas/NotifyChangedSecAlarmGeneral' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyCorrelatedNotificationChanged: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyCorrelatedNotificationChanged' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyAckStateChanged: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyAckStateChanged' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyComments: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyComments' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyPotentialFaultyAlarmList: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyPotentialFaultyAlarmList' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + notifyAlarmListRebuilt: + '{request.body#/consumerReference}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyAlarmListRebuilt' + responses: + '204': + description: >- + Success case ("204 No Content"). + The notification is successfully delivered. The response message + body is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + /subscriptions/{subscriptionId}: + delete: + summary: Delete a subscription + description: >- + The subscription is deleted by deleting the corresponding subscription + resource. The resource to be deleted is identified with the path + component of the URI. + parameters: + - name: subscriptionId + in: path + description: Identifies the subscription to be deleted. + required: true + schema: + type: string + responses: + '204': + description: >- + Success case ("204 No Content"). + The subscription resource has been deleted. The response message body + is absent. + default: + description: Error case. + content: + application/json: + schema: + $ref: 'comDefs.yaml#/components/schemas/ErrorResponse' + +components: + schemas: + + #---- Definition of AlarmRecord ----------------------------------------------------# + + AlarmId: + type: string + AlarmType: + type: string + enum: + - COMMUNICATIONS_ALARM + - QUALITY_OF_SERVICE_ALARM + - PROCESSING_ERROR_ALARM + - EQUIPMENT_ALARM + - ENVIRONMENTAL_ALARM + - INTEGRITY_VIOLATION + - OPERATIONAL_VIOLATION + - PHYSICAL_VIOLATION + - SECURITY_SERVICE_OR_MECHANISM_VIOLATION + - TIME_DOMAIN_VIOLATION + ProbableCause: + description: >- + The value of the probable cause may be a specific standardized string, or any + vendor provided string. Probable cause strings are not standardized in the + present document. They may be added in a future version. Up to then the + mapping of the generic probable cause strings "PROBABLE_CAUSE_001" to + "PROBABLE_CAUSE_005" is vendor specific. + The value of the probable cause may also be an integer. The mapping of integer + values to probable causes is vendor specific. + oneOf: + - anyOf: + - type: string + enum: + - PROBABLE_CAUSE_001 + - PROBABLE_CAUSE_002 + - PROBABLE_CAUSE_003 + - PROBABLE_CAUSE_004 + - PROBABLE_CAUSE_005 + - type: string + - type: integer + SpecificProblem: + oneOf: + - type: string + - type: integer + PerceivedSeverity: + type: string + enum: + - INDETERMINATE + - CRITICAL + - MAJOR + - MINOR + - WARNING + - CLEARED + TrendIndication: + type: string + enum: + - MORE_SEVERE + - NO_CHANGE + - LESS_SEVERE + ThresholdHysteresis: + type: object + required: + - high + properties: + high: + oneOf: + - type: integer + - $ref: 'comDefs.yaml#/components/schemas/Float' + low: + $ref: 'comDefs.yaml#/components/schemas/Float' + ThresholdLevelInd: + type: object + required: + - up + properties: + up: + $ref: '#/components/schemas/ThresholdHysteresis' + low: + $ref: '#/components/schemas/ThresholdHysteresis' + ThresholdInfo: + type: object + required: + - observedMeasurement + - observedValue + properties: + observedMeasurement: + type: string + observedValue: + type: integer + oneOf: + - $ref: 'comDefs.yaml#/components/schemas/Float' + thresholdLevelInd: + $ref: '#/components/schemas/ThresholdLevelInd' + armTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + CorrelatedNotification: + type: object + required: + - source + - notificationId + properties: + sourceObjectInstance: + $ref: 'comDefs.yaml#/components/schemas/Dn' + notificationIds: + type: array + items: + $ref: 'comDefs.yaml#/components/schemas/NotificationId' + CorrelatedNotifications: + type: array + items: + $ref: '#/components/schemas/CorrelatedNotification' + AckState: + type: string + enum: + - ACKNOWLEDGED + - UNACKNOWLEDGED + + AlarmRecord: + description: >- + The alarmId is not a property of an alarm record. It is used as key + in the map of alarm records instead. + type: object + properties: + # alarmId: + # $ref: '#/components/schemas/AlarmId' + objectInstance: + $ref: 'comDefs.yaml#/components/schemas/Dn' + notificationId: + $ref: 'comDefs.yaml#/components/schemas/NotificationId' + alarmRaisedTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + alarmChangedTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + alarmClearedTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + specificProblem: + $ref: '#/components/schemas/SpecificProblem' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + backedUpStatus: + type: boolean + backUpObject: + $ref: 'comDefs.yaml#/components/schemas/Dn' + trendIndication: + $ref: '#/components/schemas/TrendIndication' + thresholdinfo: + $ref: '#/components/schemas/ThresholdInfo' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + stateChangeDefinition: + $ref: 'comDefs.yaml#/components/schemas/AttributeValueChangeSet' + monitoredAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + proposedRepairActions: + type: string + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + + rootCauseIndicator: + type: boolean + + ackTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + ackUserId: + type: string + ackSystemId: + type: string + ackState: + $ref: '#/components/schemas/AckState' + + clearUserId: + type: string + clearSystemId: + type: string + serviceUser: + type: string + serviceProvider: + type: string + securityAlarmDetector: + type: string + + #---- Definition of alarm notifications --------------------------------------------# + + AlarmNotificationType: + type: string + enum: + - notifyNewAlarm + - notifyChangedAlarm + - notifyChangedAlarmGeneral + - notifyAckStateChanged + - notifyCorrelatedNotificationChanged + - notifyComments + - notifyClearedAlarm + - notifyAlarmListRebuiltAlarm + - notifyPotentialFaultyAlarmList + AlarmListAlignmentRequirement: + type: string + enum: + - ALIGNMENT_REQUIRED + - ALIGNMENT_NOT_REQUIRED + + NotifyNewAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + specificProblem: + $ref: '#/components/schemas/SpecificProblem' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + backedUpStatus: + type: boolean + backUpObject: + $ref: 'comDefs.yaml#/components/schemas/Dn' + trendIndication: + $ref: '#/components/schemas/TrendIndication' + thresholdInfo: + $ref: '#/components/schemas/ThresholdInfo' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + stateChangeDefinition: + $ref: 'comDefs.yaml#/components/schemas/AttributeValueChangeSet' + monitoredAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + proposedRepairActions: + type: string + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + NotifyNewSecAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - serviceUser + - serviceProvider + - securityAlarmDetector + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + serviceUser: + type: string + serviceProvider: + type: string + securityAlarmDetector: + type: string + NotifyClearedAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + clearUserId: + type: string + clearSystemId: + type: string + NotifyChangedAlarm: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + NotifyChangedAlarmGeneral: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - changedAlarmAttributes + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + specificProblem: + $ref: '#/components/schemas/SpecificProblem' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + backedUpStatus: + type: boolean + backUpObject: + $ref: 'comDefs.yaml#/components/schemas/Dn' + trendIndication: + $ref: '#/components/schemas/TrendIndication' + thresholdInfo: + $ref: '#/components/schemas/ThresholdInfo' + stateChangeDefinition: + $ref: 'comDefs.yaml#/components/schemas/AttributeValueChangeSet' + monitoredAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + proposedRepairActions: + type: string + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + changedAlarmAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + NotifyChangedSecAlarmGeneral: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - serviceUser + - serviceProvider + - securityAlarmDetector + - changedAlarmAttributes + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + additionalText: + type: string + additionalInformation: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + rootCauseIndicator: + type: boolean + serviceUser: + type: string + serviceProvider: + type: string + securityAlarmDetector: + type: string + changedAlarmAttributes: + $ref: 'comDefs.yaml#/components/schemas/AttributeNameValuePairSet' + NotifyCorrelatedNotificationChanged: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - correlatedNotifications + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + correlatedNotifications: + $ref: '#/components/schemas/CorrelatedNotifications' + rootCauseIndicator: + type: boolean + NotifyAckStateChanged: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - ackState + - ackUserId + properties: + alarmId: + $ref: '#/components/schemas/AlarmI' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + ackState: + $ref: '#/components/schemas/AckState' + ackUserId: + type: string + ackSystemId: + type: string + NotifyComments: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - alarmId + - alarmType + - probableCause + - perceivedSeverity + - comments + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + alarmType: + $ref: '#/components/schemas/AlarmType' + probableCause: + $ref: '#/components/schemas/ProbableCause' + perceivedSeverity: + $ref: '#/components/schemas/PerceivedSeverity' + comments: + $ref: '#/components/schemas/Comments' + NotifyPotentialFaultyAlarmList: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - reason + properties: + reason: + type: string + NotifyAlarmListRebuilt: + allOf: + - $ref: 'comDefs.yaml#/components/schemas/NotificationHeader' + - type: object + required: + - reason + properties: + reason: + type: string + alarmListAlignmentRequirement: + $ref: '#/components/schemas/AlarmListAlignmentRequirement' + + #---- Definition of query parameters -----------------------------------------------# + + AlarmAckState: + type: string + enum: + - ALL_ALARMS + - ALL_ACTIVE_ALARMS + - ALL_ACTIVE_AND_ACKNOWLEDGED_ALARMS + - ALL_ACTIVE_AND_UNACKNOWLEDGED_ALARMS + - ALL_CLEARED_AND_UNACKNOWLEDGED_ALARMS + - ALL_UNACKNOWLEDGED_ALARMS + + #---- Definition of patch documents ------------------------------------------------# + + MergePatchAcknowledgeAlarm: + description: >- + Patch document acknowledging or unacknowledging a single alarm. For + acknowleding an alarm the value of ackState is ACKNOWLEDGED, for unacknowleding + an alarm the value of ackState is UNACKNOWLEDGED. + type: object + required: + - ackUserId + - ackState + properties: + ackUserId: + type: string + ackSystemId: + type: string + ackState: + $ref: '#/components/schemas/AckState' + MergePatchClearAlarm: + description: Patch document for clearing a single alarm + type: object + required: + - clearUserId + - perceivedSeverity + properties: + clearUserId: + type: string + clearSystemId: + type: string + perceivedSeverity: + type: string + enum: + - CLEARED + + #---- Definition of method responses -----------------------------------------------# + + FailedAlarm: + type: object + required: + - alarmId + - failureReason + properties: + alarmId: + $ref: '#/components/schemas/AlarmId' + failureReason: + type: string + + #---- Definition of resources ------------------------------------------------------# + + AlarmCount: + type: object + required: + - criticalCount + - majorCount + - minorCount + - warningCount + - indeterminateCount + - clearedCount + properties: + criticalCount: + type: integer + majorCount: + type: integer + minorCount: + type: integer + warningCount: + type: integer + indeterminateCount: + type: integer + clearedCount: + type: integer + Comment: + type: object + properties: + commentTime: + $ref: 'comDefs.yaml#/components/schemas/DateTime' + commentUserId: + type: string + commentSystemId: + type: string + commentText: + type: string + Comments: + description: >- + Collection of comments. The comment identifiers are allocated by the + MnS producer and used as key in the map. + type: object + additionalProperties: + $ref: '#/components/schemas/Comment' + Subscription: + type: object + properties: + consumerReference: + $ref: 'comDefs.yaml#/components/schemas/Uri' + timeTick: + $ref: 'comDefs.yaml#/components/schemas/Long' + filter: + $ref: 'comDefs.yaml#/components/schemas/Filter' \ No newline at end of file diff --git a/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/schema-map.json b/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/schema-map.json new file mode 100644 index 00000000..389e5a69 --- /dev/null +++ b/tests/dcaegen2/testcases/assets/test_schemas/externalRepo/schema-map.json @@ -0,0 +1,14 @@ +[ + { + "publicURL": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/ves7_valid_eventWithStndDefinedFields_with_valid_schema_ref.json", + "localURL": "3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/ves7_valid_eventWithStndDefinedFields_with_valid_schema_ref.json" + }, + { + "publicURL": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_file_reference.yaml", + "localURL": "3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_file_reference.yaml" + }, + { + "publicURL": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_internal_reference.yaml", + "localURL": "3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS_wrong_internal_reference.yaml" + } +] \ No newline at end of file diff --git a/tests/dcaegen2/testcases/resources/collector_stnd_defined_new_schema_map.properties b/tests/dcaegen2/testcases/resources/collector_stnd_defined_new_schema_map.properties new file mode 100644 index 00000000..cd417635 --- /dev/null +++ b/tests/dcaegen2/testcases/resources/collector_stnd_defined_new_schema_map.properties @@ -0,0 +1,73 @@ +############################################################################### +## +## Collector Server config +## +## - Default values are shown as commented settings. +## +############################################################################### +## +## HTTP(S) service +## +## Normally: +## +## - 8080 is http service +## - https is disabled by default +## +## - At this time, the server always binds to 0.0.0.0 +## +## +collector.service.port=8080 + +## Authentication is only supported via secure port +## When enabled - require valid keystore defined +collector.service.secure.port=8443 + +# auth.method flags: +# +# noAuth - default option - no security (http) +# certBasicAuth - auth by certificate and basic auth username / password (https) +auth.method=certBasicAuth + +## Combination of userid,hashPassword encoded pwd list to be supported +## userid and pwd comma separated; pipe delimitation between each pair +## Password is generated by crypt-password library using BCrypt algorithm stored in dcaegen2/sdk package +## or https://nexus.onap.org/#nexus-search;quick~crypt-password +header.authlist=sample1,$2a$10$0buh.2WeYwN868YMwnNNEuNEAMNYVU9.FSMJGyIKV3dGET/7oGOi6 + +## The keystore must be setup per installation when secure port is configured +collector.keystore.file.location=etc/keystore +collector.keystore.passwordfile=etc/passwordfile + +collector.cert.subject.matcher=etc/certSubjectMatcher.properties + +## The truststore must be setup per installation when mutual tls support is configured +collector.truststore.file.location=etc/truststore +collector.truststore.passwordfile=etc/trustpasswordfile + +## Schema Validation checkflag +## default no validation checkflag (-1) +## If enabled (1) - schemafile location must be specified +collector.schema.checkflag=1 +collector.schema.file={\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2_ONAP.json\"} + +## Schema StndDefinedFields Validation checkflag +## default no validation checkflag (-1) +## If enabled (1) - schema files locations must be specified, mapping file path must be specified, schema reference path +## in event json must be specified, path to stndDefined data field in event json must be specified +collector.externalSchema.checkflag=1 +collector.externalSchema.schemasLocation=./etc/externalRepo/ +collector.externalSchema.mappingFileLocation=./etc/externalRepo/schema-map.json +event.externalSchema.schemaRefPath=/event/stndDefinedFields/schemaReference +event.externalSchema.stndDefinedDataPath=/event/stndDefinedFields/data + +## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile +collector.dmaap.streamid=fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance +collector.dmaapfile=./etc/DmaapConfig.json + +## Event transformation Flag - when set expects configurable transformation +## defined under ./etc/eventTransform.json +## Enabled by default; to disable set to 0 +event.transform.flag=1 + +# Describes at what frequency (measured in minutes) should application try to fetch config from CBS +collector.dynamic.config.update.frequency=5 diff --git a/tests/dcaegen2/testcases/resources/dcae_keywords.robot b/tests/dcaegen2/testcases/resources/dcae_keywords.robot index b45ee57d..660f1451 100644 --- a/tests/dcaegen2/testcases/resources/dcae_keywords.robot +++ b/tests/dcaegen2/testcases/resources/dcae_keywords.robot @@ -171,8 +171,9 @@ Send Request And Expect Error [Arguments] ${keyword} ${session} ${evtpath} ${evtjson} ${error_type} @{error_content} ${evtdata}= Get Data From File ${evtjson} ${err_msg}= Run Keyword And Expect Error ${error_type} ${keyword} ${session} ${evtpath} ${evtdata} - :FOR ${content} IN @{error_content} - \ Should Contain ${err_msg} ${content} + FOR ${content} IN @{error_content} + Should Contain ${err_msg} ${content} + END Log Recieved error message ${err_msg} Run Healthcheck diff --git a/tests/dcaegen2/testcases/resources/dcae_properties.robot b/tests/dcaegen2/testcases/resources/dcae_properties.robot index 65eba841..2ae46f92 100644 --- a/tests/dcaegen2/testcases/resources/dcae_properties.robot +++ b/tests/dcaegen2/testcases/resources/dcae_properties.robot @@ -60,6 +60,10 @@ ${VES_STND_DEFINED_NO_VALUE} %{WORKSPACE}/tests/dcaegen2/testcases/a ${VES_STND_DEFINED_INVALID_TYPE_DATA} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_invalid_type_data_field.json ${VES_CERT_BASIC_AUTH_COLLECTOR_PROPERTIES} %{WORKSPACE}/tests/dcaegen2/testcases/resources/collector_basic_auth.properties ${VES_DISABLED_STNDDEFINED_COLLECTOR_PROPERTIES} %{WORKSPACE}/tests/dcaegen2/testcases/resources/collector_stnd_defined.properties +${VES_ADD_REFERENCE_TO_OTHER_SCHEMAS} %{WORKSPACE}/tests/dcaegen2/testcases/resources/collector_stnd_defined_new_schema_map.properties +${VES_VALID_JSON_WITH_RFERENCE_TO_VALID_SCHEMA} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_with_valid_schema_ref.json +${VES_VALID_JSON_V7_STND_DEF_FIELDS_WRONG_SCHEMA_FILE_REF} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_to_schema_with_wrong_file_ref.json +${VES_VALID_JSON_V7_STND_DEF_FIELDS_WRONG_SCHEMA_INTERNAL_REF} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves7_valid_eventWithStndDefinedFields_to_schema_with_wrong_internal_ref.json #DCAE Health Check ${CONFIG_BINDING_URL} http://localhost:8443 diff --git a/tests/dcaegen2/testcases/resources/override_collector_properties_with_new_files.sh b/tests/dcaegen2/testcases/resources/override_collector_properties_with_new_files.sh new file mode 100755 index 00000000..f185ac39 --- /dev/null +++ b/tests/dcaegen2/testcases/resources/override_collector_properties_with_new_files.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2020 Nokia. 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. +if [ $# -ne 1 ]; then + echo "Incorrect number of parameters" + exit 1 +fi + +LOCAL_COLLECTOR_PROPERTIES_PATH=$1 +FILENAME=$(basename $LOCAL_COLLECTOR_PROPERTIES_PATH) +TEST_FILES_PATH=$2 +ETC_PATH=/opt/app/VESCollector/etc +APP_CONTROLLER_PATH=/opt/app/VESCollector/bin/appController.sh + +docker exec vesc $APP_CONTROLLER_PATH stop +sleep 2 +docker cp $LOCAL_COLLECTOR_PROPERTIES_PATH vesc:$ETC_PATH +sleep 10 +docker cp $TEST_FILES_PATH vesc:$ETC_PATH +sleep 10 +docker exec vesc mv $ETC_PATH/$FILENAME $ETC_PATH/collector.properties +docker exec vesc $APP_CONTROLLER_PATH start +sleep 5 +echo "VES Collector Restarted with overridden collector.properties" diff --git a/tests/policy/drools-applications/drools-applications-test.robot b/tests/policy/drools-applications/drools-applications-test.robot index a1ca5e20..0b73ccf8 100644 --- a/tests/policy/drools-applications/drools-applications-test.robot +++ b/tests/policy/drools-applications/drools-applications-test.robot @@ -35,10 +35,10 @@ Controller Log Creating session https://${DROOLS_IP}:9696 ${session}= Create Session policy https://${DROOLS_IP}:9696 auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= Get Request policy /policy/pdp/engine/controllers/frankfurt/drools/facts headers=${headers} + ${resp}= Get Request policy /policy/pdp/engine/controllers/usecases/drools/facts headers=${headers} Log Received response from policy ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 - Should Be Equal As Strings ${resp.json()['frankfurt']} 0 + Should Be Equal As Strings ${resp.json()['usecases']} 0 MakeTopics [Documentation] Creates the Policy topics diff --git a/tests/vnfsdk-refrepo/csar/invalid_pm_dictionary.csar b/tests/vnfsdk-refrepo/csar/invalid_pm_dictionary.csar new file mode 100644 index 00000000..81a0e23a Binary files /dev/null and b/tests/vnfsdk-refrepo/csar/invalid_pm_dictionary.csar differ diff --git a/tests/vnfsdk-refrepo/csar/valid_no_security.csar b/tests/vnfsdk-refrepo/csar/valid_no_security.csar new file mode 100644 index 00000000..11d19453 Binary files /dev/null and b/tests/vnfsdk-refrepo/csar/valid_no_security.csar differ diff --git a/tests/vnfsdk-refrepo/csar_validation_tests.robot b/tests/vnfsdk-refrepo/csar_validation_tests.robot new file mode 100644 index 00000000..9994d567 --- /dev/null +++ b/tests/vnfsdk-refrepo/csar_validation_tests.robot @@ -0,0 +1,68 @@ +*** Settings *** +Resource ./resources/vnfsdk_keywords.robot + +*** Test Cases *** + +Perform vnf refrepo healthcheck + [Documentation] Check if vnf refrepo is up and running + + Create Session refrepo ${base_url} + ${response}= Get Request refrepo /PackageResource/healthcheck + Should Be Equal As Strings ${response.status_code} 200 + +Validate correct, no security CSAR + [Documentation] Valid CSAR with no security should PASS validation and should return no error + + ${response}= Validate CSAR usign Post request ${csar_valid_no_security} ${execute_no_security_csar_validation} + # Removing strings that are causing errors during evaluation, + # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes + ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\" + ${json_response}= evaluate json.loads('''${response}''') json + Should Be Equal As Strings ${json_response[0]["results"]["criteria"]} PASS + FOR ${resault} IN @{json_response[0]["results"]["results"]} + Should Be Equal As Strings ${resault["errors"]} [] + Should Be Equal As Strings ${resault["passed"]} True + END + + +Validate CSAR using rule r130206 and use get method to receive outcome + [Documentation] Validate CSAR with invalid PM_Dictionary (r130206) using rule r130206 , then use get method with validation id to receive valdiation outcome + + ${response}= Validate CSAR usign Post request ${csar_invalid_pm_dictionary} ${execute_invalid_pm_dictionary_r130206_validation} + # Removing strings that are causing errors during evaluation, + # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes + ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\" + ${json_response}= evaluate json.loads('''${response}''') json + + ${get_response}= Get validation result using GET request ${json_response[0]["executionId"]} + # Removing strings that are causing errors during evaluation, + # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes + ${get_response}= Remove String ${get_response} \\\\ \\u0027 + ${json_get_response}= evaluate json.loads('''${get_response}''') json + Should Be Equal As Strings ${json_get_response[0]["status"]} failed + ${errors_number}= Get Length ${json_get_response[0]["results"]} + Should Be Equal As Strings ${errors_number} 4 + FOR ${error} IN @{json_get_response[0]["results"]} + Should Contain ${error["code"]} R130206 + END + +Validate CSAR using all rule and use get method to receive outcome + [Documentation] Validate CSAR with invalid PM_Dictionary (r130206) using all rules, then use get method with validation id to receive valdiation outcome + + ${response}= Validate CSAR usign Post request ${csar_invalid_pm_dictionary} ${execute_invalid_pm_dictionary_validation} + # Removing strings that are causing errors during evaluation, + # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes + ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\" + ${json_response}= evaluate json.loads('''${response}''') json + + ${get_response}= Get validation result using GET request ${json_response[0]["executionId"]} + # Removing strings that are causing errors during evaluation, + # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes + ${get_response}= Remove String ${get_response} \\\\ \\u0027 \\u003c \\u003e \\" + ${json_get_response}= evaluate json.loads('''${get_response}''') json + Should Be Equal As Strings ${json_response[0]["results"]["criteria"]} FAILED + FOR ${resault} IN @{json_response[0]["results"]["results"]} + Should Be Equal As Strings ${resault["warnings"]} [] + Run keyword if "${resault["vnfreqName"]}" == "r130206" + ... Should Be Equal As Strings ${resault["passed"]} False + END diff --git a/tests/vnfsdk-refrepo/resources/vnfsdk_keywords.robot b/tests/vnfsdk-refrepo/resources/vnfsdk_keywords.robot new file mode 100644 index 00000000..11bb6015 --- /dev/null +++ b/tests/vnfsdk-refrepo/resources/vnfsdk_keywords.robot @@ -0,0 +1,25 @@ +*** Settings *** +Resource ./vnfsdk_properties.robot + +Library OperatingSystem +Library Process +Library String +Library Collections +Library RequestsLibrary +Library json + +*** Keywords *** + +Validate CSAR usign Post request + [Documentation] Perform POST Request to vnfsdk marketplace with CSAR and execution options, in order to perfvorm CSAR validation + [Arguments] ${csar_name} ${execution_json} + ${response}= Run curl -s --location --request POST '${base_url}/vtp/executions' --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --form 'file=@${csarpath}/${csar_name}' --form 'executions=${execution_json}' + ${response}= String.Replace String ${response} \\n ${SPACE} + [Return] ${response} + +Get validation result using GET request + [Documentation] Perform GET request to vnfsdk marketplace with request id or execution id, in order to get that request/execution result + [Arguments] ${requestId} + ${response}= Run curl -s --location --request GET '${base_url}/vtp/executions?requestId=${requestId}' --header 'Accept: application/json' + ${response}= String.Replace String ${response} \\n ${SPACE} + [Return] ${response} diff --git a/tests/vnfsdk-refrepo/resources/vnfsdk_properties.robot b/tests/vnfsdk-refrepo/resources/vnfsdk_properties.robot new file mode 100644 index 00000000..e46eba6f --- /dev/null +++ b/tests/vnfsdk-refrepo/resources/vnfsdk_properties.robot @@ -0,0 +1,12 @@ +*** Variables *** +${base_url}= http://${REFREPO_IP}:8702/onapapi/vnfsdk-marketplace/v1 + +${csarpath}= ${SCRIPTS}/../tests/vnfsdk-refrepo/csar + +${csar_valid_no_security}= valid_no_security.csar +${execute_no_security_csar_validation}= [{"scenario": "onap-dublin","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_valid_no_security}","pnf":"true"}}] + +${csar_invalid_pm_dictionary}= invalid_pm_dictionary.csar +${execute_invalid_pm_dictionary_r130206_validation}= [{"scenario": "onap-dublin","testSuiteName": "validation","testCaseName": "csar-validate-r130206","parameters": {"csar": "file://${csar_invalid_pm_dictionary}","pnf":"true"}}] +${execute_invalid_pm_dictionary_validation}= [{"scenario": "onap-dublin","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_invalid_pm_dictionary}","pnf":"true"}}] +