From 3f9a0960ae775678d1e1d4b598b593b59146cb0f Mon Sep 17 00:00:00 2001 From: pdragosh Date: Tue, 16 Apr 2019 13:19:45 -0400 Subject: Finish drools CSIT infra Basic health check for now. Need to have ci-management jobs enabled for this to work on every merge. Cleaning out unused scripts and mock server. Renaming policy engine script so its obvious that is what it is for. Issue-ID: POLICY-1651 Change-Id: I469823795d4a9f5531d150610ba2ed0b75585677 Signed-off-by: pdragosh Signed-off-by: Pamela Dragosh Signed-off-by: pdragosh Signed-off-by: jhh --- plans/policy/drools-applications/setup.sh | 58 +++ plans/policy/drools-applications/teardown.sh | 18 + plans/policy/drools-applications/testplan.txt | 3 + plans/policy/drools-pdp/setup.sh | 17 +- plans/policy/drools-pdp/teardown.sh | 1 - plans/policy/health/setup.sh | 21 +- plans/policy/health/teardown.sh | 1 - plans/policy/health/testplan.txt | 2 +- scripts/policy/config/drools/base.conf | 119 ++++++ .../policy/config/drools/feature-healthcheck.conf | 18 + scripts/policy/docker-compose-drools-apps.yml | 47 +++ scripts/policy/docker-compose-drools.yml | 55 +++ scripts/policy/docker-compose-engine.yml | 75 ++++ scripts/policy/engine.sh | 208 +++++++++++ scripts/policy/mock-hello.sh | 31 -- scripts/policy/script1.sh | 208 ----------- .../drools-applications-test.robot | 17 + tests/policy/engine/Policy-CSIT.robot | 403 +++++++++++++++++++++ tests/policy/engine/__init__.robot | 2 + tests/policy/engine/configpolicy_vCPE.template | 6 + tests/policy/engine/configpolicy_vCPE_R1.template | 7 + tests/policy/engine/configpolicy_vDNS.template | 6 + tests/policy/engine/configpolicy_vDNS_R1.template | 7 + tests/policy/engine/configpolicy_vFW.template | 6 + tests/policy/engine/configpolicy_vFW_R1.template | 7 + tests/policy/engine/createpolicy.template | 21 ++ tests/policy/engine/deletepolicy.template | 5 + tests/policy/engine/getconfigpolicy.template | 8 + tests/policy/engine/getoofpolicy.template | 6 + tests/policy/engine/global_properties.robot | 30 ++ tests/policy/engine/json_templater.robot | 21 ++ tests/policy/engine/listpolicy.template | 3 + tests/policy/engine/multiple_pushpolicy.template | 5 + tests/policy/engine/multiple_unpushpolicy.template | 6 + tests/policy/engine/oofpolicy_HPA_R1.template | 6 + tests/policy/engine/opspolicy_VDNS.template | 26 ++ tests/policy/engine/opspolicy_VDNS_R1.template | 16 + tests/policy/engine/opspolicy_VFW.template | 24 ++ tests/policy/engine/opspolicy_VFW_R1.template | 16 + tests/policy/engine/opspolicy_vCPE.template | 16 + tests/policy/engine/opspolicy_vCPE_R1.template | 16 + tests/policy/engine/opspolicy_vOLTE.template | 16 + tests/policy/engine/opspolicy_vOLTE_R1.template | 16 + tests/policy/engine/policy_interface.robot | 70 ++++ tests/policy/engine/pushpolicy.template | 5 + tests/policy/engine/sdncnamingpolicy_vFW.template | 11 + tests/policy/engine/sdncnamingpolicy_vPG.template | 11 + tests/policy/suite1/Policy-CSIT.robot | 403 --------------------- tests/policy/suite1/__init__.robot | 2 - tests/policy/suite1/configpolicy_vCPE.template | 6 - tests/policy/suite1/configpolicy_vCPE_R1.template | 7 - tests/policy/suite1/configpolicy_vDNS.template | 6 - tests/policy/suite1/configpolicy_vDNS_R1.template | 7 - tests/policy/suite1/configpolicy_vFW.template | 6 - tests/policy/suite1/configpolicy_vFW_R1.template | 7 - tests/policy/suite1/createpolicy.template | 21 -- tests/policy/suite1/deletepolicy.template | 5 - tests/policy/suite1/getconfigpolicy.template | 8 - tests/policy/suite1/getoofpolicy.template | 6 - tests/policy/suite1/global_properties.robot | 30 -- tests/policy/suite1/json_templater.robot | 21 -- tests/policy/suite1/listpolicy.template | 3 - tests/policy/suite1/multiple_pushpolicy.template | 5 - tests/policy/suite1/multiple_unpushpolicy.template | 6 - tests/policy/suite1/oofpolicy_HPA_R1.template | 6 - tests/policy/suite1/opspolicy_VDNS.template | 26 -- tests/policy/suite1/opspolicy_VDNS_R1.template | 16 - tests/policy/suite1/opspolicy_VFW.template | 24 -- tests/policy/suite1/opspolicy_VFW_R1.template | 16 - tests/policy/suite1/opspolicy_vCPE.template | 16 - tests/policy/suite1/opspolicy_vCPE_R1.template | 16 - tests/policy/suite1/opspolicy_vOLTE.template | 16 - tests/policy/suite1/opspolicy_vOLTE_R1.template | 16 - tests/policy/suite1/policy_interface.robot | 70 ---- tests/policy/suite1/pushpolicy.template | 5 - tests/policy/suite1/sdncnamingpolicy_vFW.template | 11 - tests/policy/suite1/sdncnamingpolicy_vPG.template | 11 - 77 files changed, 1421 insertions(+), 1074 deletions(-) create mode 100755 plans/policy/drools-applications/setup.sh create mode 100755 plans/policy/drools-applications/teardown.sh create mode 100644 plans/policy/drools-applications/testplan.txt create mode 100644 scripts/policy/config/drools/base.conf create mode 100644 scripts/policy/config/drools/feature-healthcheck.conf create mode 100644 scripts/policy/docker-compose-drools-apps.yml create mode 100644 scripts/policy/docker-compose-drools.yml create mode 100644 scripts/policy/docker-compose-engine.yml create mode 100755 scripts/policy/engine.sh delete mode 100755 scripts/policy/mock-hello.sh delete mode 100755 scripts/policy/script1.sh create mode 100644 tests/policy/drools-applications/drools-applications-test.robot create mode 100644 tests/policy/engine/Policy-CSIT.robot create mode 100644 tests/policy/engine/__init__.robot create mode 100644 tests/policy/engine/configpolicy_vCPE.template create mode 100644 tests/policy/engine/configpolicy_vCPE_R1.template create mode 100644 tests/policy/engine/configpolicy_vDNS.template create mode 100644 tests/policy/engine/configpolicy_vDNS_R1.template create mode 100644 tests/policy/engine/configpolicy_vFW.template create mode 100644 tests/policy/engine/configpolicy_vFW_R1.template create mode 100644 tests/policy/engine/createpolicy.template create mode 100644 tests/policy/engine/deletepolicy.template create mode 100644 tests/policy/engine/getconfigpolicy.template create mode 100644 tests/policy/engine/getoofpolicy.template create mode 100644 tests/policy/engine/global_properties.robot create mode 100644 tests/policy/engine/json_templater.robot create mode 100644 tests/policy/engine/listpolicy.template create mode 100644 tests/policy/engine/multiple_pushpolicy.template create mode 100644 tests/policy/engine/multiple_unpushpolicy.template create mode 100644 tests/policy/engine/oofpolicy_HPA_R1.template create mode 100644 tests/policy/engine/opspolicy_VDNS.template create mode 100644 tests/policy/engine/opspolicy_VDNS_R1.template create mode 100644 tests/policy/engine/opspolicy_VFW.template create mode 100644 tests/policy/engine/opspolicy_VFW_R1.template create mode 100644 tests/policy/engine/opspolicy_vCPE.template create mode 100644 tests/policy/engine/opspolicy_vCPE_R1.template create mode 100644 tests/policy/engine/opspolicy_vOLTE.template create mode 100644 tests/policy/engine/opspolicy_vOLTE_R1.template create mode 100644 tests/policy/engine/policy_interface.robot create mode 100644 tests/policy/engine/pushpolicy.template create mode 100644 tests/policy/engine/sdncnamingpolicy_vFW.template create mode 100644 tests/policy/engine/sdncnamingpolicy_vPG.template delete mode 100644 tests/policy/suite1/Policy-CSIT.robot delete mode 100644 tests/policy/suite1/__init__.robot delete mode 100644 tests/policy/suite1/configpolicy_vCPE.template delete mode 100644 tests/policy/suite1/configpolicy_vCPE_R1.template delete mode 100644 tests/policy/suite1/configpolicy_vDNS.template delete mode 100644 tests/policy/suite1/configpolicy_vDNS_R1.template delete mode 100644 tests/policy/suite1/configpolicy_vFW.template delete mode 100644 tests/policy/suite1/configpolicy_vFW_R1.template delete mode 100644 tests/policy/suite1/createpolicy.template delete mode 100644 tests/policy/suite1/deletepolicy.template delete mode 100644 tests/policy/suite1/getconfigpolicy.template delete mode 100644 tests/policy/suite1/getoofpolicy.template delete mode 100644 tests/policy/suite1/global_properties.robot delete mode 100644 tests/policy/suite1/json_templater.robot delete mode 100644 tests/policy/suite1/listpolicy.template delete mode 100644 tests/policy/suite1/multiple_pushpolicy.template delete mode 100644 tests/policy/suite1/multiple_unpushpolicy.template delete mode 100644 tests/policy/suite1/oofpolicy_HPA_R1.template delete mode 100644 tests/policy/suite1/opspolicy_VDNS.template delete mode 100644 tests/policy/suite1/opspolicy_VDNS_R1.template delete mode 100644 tests/policy/suite1/opspolicy_VFW.template delete mode 100644 tests/policy/suite1/opspolicy_VFW_R1.template delete mode 100644 tests/policy/suite1/opspolicy_vCPE.template delete mode 100644 tests/policy/suite1/opspolicy_vCPE_R1.template delete mode 100644 tests/policy/suite1/opspolicy_vOLTE.template delete mode 100644 tests/policy/suite1/opspolicy_vOLTE_R1.template delete mode 100644 tests/policy/suite1/policy_interface.robot delete mode 100644 tests/policy/suite1/pushpolicy.template delete mode 100644 tests/policy/suite1/sdncnamingpolicy_vFW.template delete mode 100644 tests/policy/suite1/sdncnamingpolicy_vPG.template diff --git a/plans/policy/drools-applications/setup.sh b/plans/policy/drools-applications/setup.sh new file mode 100755 index 00000000..24422a63 --- /dev/null +++ b/plans/policy/drools-applications/setup.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +echo "Uninstall docker-py and reinstall docker." +pip uninstall -y docker-py +pip uninstall -y docker +pip install -U docker==2.7.0 + +docker login -u docker -p docker nexus3.onap.org:10001 + +# Adding this waiting container to avoid race condition between api and mariadb containers. +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml run --rm start_dependencies +docker logs mariadb +docker container ls -a + +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml up -d +sleep 1m + +docker logs mariadb +docker logs drools +docker container ls -a + +POLICY_DROOLS_IP=`get-instance-ip.sh drools` +MARIADB_IP=`get-instance-ip.sh mariadb` + +echo DROOLS IP IS ${POLICY_DROOLS_IP} +echo MARIADB IP IS ${MARIADB_IP} + +# Wait for initialization +for i in {1..10}; do + curl -sS ${MARIADB_IP}:3306 && break + echo sleep $i + sleep $i +done + +for i in {1..10}; do + curl -sS ${POLICY_DROOLS_IP}:6969 && break + echo sleep $i + sleep $i +done + +ROBOT_VARIABLES="-v POLICY_DROOLS_IP:${POLICY_DROOLS_IP}" diff --git a/plans/policy/drools-applications/teardown.sh b/plans/policy/drools-applications/teardown.sh new file mode 100755 index 00000000..48ab171d --- /dev/null +++ b/plans/policy/drools-applications/teardown.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# Copyright 2019 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +kill-instance.sh drools +kill-instance.sh mariadb diff --git a/plans/policy/drools-applications/testplan.txt b/plans/policy/drools-applications/testplan.txt new file mode 100644 index 00000000..3878a4e2 --- /dev/null +++ b/plans/policy/drools-applications/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +policy/drools-applications diff --git a/plans/policy/drools-pdp/setup.sh b/plans/policy/drools-pdp/setup.sh index a7ed4408..459805be 100755 --- a/plans/policy/drools-pdp/setup.sh +++ b/plans/policy/drools-pdp/setup.sh @@ -17,25 +17,10 @@ # Place the scripts in run order: source ${SCRIPTS}/common_functions.sh -docker run --name i-mock -d jamesdbloom/mockserver -MOCK_IP=`get-instance-ip.sh i-mock` -echo ${MOCK_IP} - -docker inspect i-mock - -# Wait for initialization -for i in {1..10}; do - curl -sS ${MOCK_IP}:1080 && break - echo sleep $i - sleep $i -done - -${WORKSPACE}/scripts/policy/mock-hello.sh ${MOCK_IP} - source ${WORKSPACE}/scripts/policy/drools-pdp-script.sh # Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v MOCK_IP:${MOCK_IP} -v IP:${IP} -v POLICY_IP:${POLICY_IP} -v PDP_IP:${PDP_IP} -v DOCKER_IP:${DOCKER_IP}" +ROBOT_VARIABLES="-v IP:${IP} -v POLICY_IP:${POLICY_IP} -v PDP_IP:${PDP_IP} -v DOCKER_IP:${DOCKER_IP}" export PDP_IP=${PDP_IP} export POLICY_IP=${POLICY_IP} export DOCKER_IP=${DOCKER_IP} diff --git a/plans/policy/drools-pdp/teardown.sh b/plans/policy/drools-pdp/teardown.sh index f1f0b21c..303ccff1 100755 --- a/plans/policy/drools-pdp/teardown.sh +++ b/plans/policy/drools-pdp/teardown.sh @@ -24,7 +24,6 @@ docker rm -v "${name}" mkdir -p "${WORKSPACE}"/archives -kill_instance i-mock kill_instance drools kill_instance pdp kill_instance brmsgw diff --git a/plans/policy/health/setup.sh b/plans/policy/health/setup.sh index 890df9b4..c99af3fa 100755 --- a/plans/policy/health/setup.sh +++ b/plans/policy/health/setup.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2017 AT&T Intellectual Property. All rights reserved. +# Copyright 2017, 2019 AT&T Intellectual Property. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,25 +17,10 @@ # Place the scripts in run order: source ${SCRIPTS}/common_functions.sh -docker run --name i-mock -d jamesdbloom/mockserver -MOCK_IP=`get-instance-ip.sh i-mock` -echo ${MOCK_IP} - -docker inspect i-mock - -# Wait for initialization -for i in {1..10}; do - curl -sS ${MOCK_IP}:1080 && break - echo sleep $i - sleep $i -done - -${WORKSPACE}/scripts/policy/mock-hello.sh ${MOCK_IP} - -source ${WORKSPACE}/scripts/policy/script1.sh +source ${WORKSPACE}/scripts/policy/engine.sh # Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v MOCK_IP:${MOCK_IP} -v IP:${IP} -v POLICY_IP:${POLICY_IP} -v PDP_IP:${PDP_IP} -v DOCKER_IP:${DOCKER_IP}" +ROBOT_VARIABLES="-v IP:${IP} -v POLICY_IP:${POLICY_IP} -v PDP_IP:${PDP_IP} -v DOCKER_IP:${DOCKER_IP}" export PDP_IP=${PDP_IP} export POLICY_IP=${POLICY_IP} export DOCKER_IP=${DOCKER_IP} diff --git a/plans/policy/health/teardown.sh b/plans/policy/health/teardown.sh index f1f0b21c..303ccff1 100755 --- a/plans/policy/health/teardown.sh +++ b/plans/policy/health/teardown.sh @@ -24,7 +24,6 @@ docker rm -v "${name}" mkdir -p "${WORKSPACE}"/archives -kill_instance i-mock kill_instance drools kill_instance pdp kill_instance brmsgw diff --git a/plans/policy/health/testplan.txt b/plans/policy/health/testplan.txt index ab8a5b08..6bad34fc 100644 --- a/plans/policy/health/testplan.txt +++ b/plans/policy/health/testplan.txt @@ -1,3 +1,3 @@ # Test suites are relative paths under [integration/csit.git]/tests/. # Place the suites in run order. -policy/suite1 +policy/engine diff --git a/scripts/policy/config/drools/base.conf b/scripts/policy/config/drools/base.conf new file mode 100644 index 00000000..d3164cb5 --- /dev/null +++ b/scripts/policy/config/drools/base.conf @@ -0,0 +1,119 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= + +# JVM options + +JVM_OPTIONS=-server -Xms512m -Xmx512m + +# SYSTEM software configuration + +POLICY_HOME=/opt/app/policy +POLICY_LOGS=/var/log/onap/policy/pdpd +JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk +KEYSTORE_PASSWD=Pol1cy_0nap +TRUSTSTORE_PASSWD=Pol1cy_0nap + +# Telemetry credentials + +TELEMETRY_PORT=9696 +TELEMETRY_HOST=0.0.0.0 +TELEMETRY_USER=demo@people.osaaf.org +TELEMETRY_PASSWORD=demo123456! + +# nexus repository + +SNAPSHOT_REPOSITORY_ID= +SNAPSHOT_REPOSITORY_URL= +RELEASE_REPOSITORY_ID= +RELEASE_REPOSITORY_URL= +REPOSITORY_USERNAME= +REPOSITORY_PASSWORD= + +# Relational (SQL) DB access + +SQL_HOST= +SQL_USER= +SQL_PASSWORD= + +# AAF + +AAF=false +AAF_NAMESPACE=org.onap.policy +AAF_HOST=aaf.api.simpledemo.onap.org + +# PDP-D DMaaP configuration channel + +PDPD_CONFIGURATION_TOPIC=PDPD-CONFIGURATION +PDPD_CONFIGURATION_API_KEY= +PDPD_CONFIGURATION_API_SECRET= +PDPD_CONFIGURATION_CONSUMER_GROUP= +PDPD_CONFIGURATION_CONSUMER_INSTANCE= +PDPD_CONFIGURATION_PARTITION_KEY= + +# PAP-PDP configuration channel + +POLICY_PDP_PAP_TOPIC=POLICY-PDP-PAP +POLICY_PDP_PAP_API_KEY= +POLICY_PDP_PAP_API_SECRET= + +# PAP + +PAP_HOST=pap +PAP_USERNAME=testpap +PAP_PASSWORD=alpha123 + +# PDP-X + +PDP_HOST=pdp +PDP_USERNAME=testpdp +PDP_PASSWORD=alpha123 +PDP_CLIENT_USERNAME=python +PDP_CLIENT_PASSWORD=test +PDP_ENVIRONMENT=TEST + +# DCAE DMaaP + +DCAE_TOPIC=unauthenticated.DCAE_CL_OUTPUT +DCAE_SERVERS=mr.api.simpledemo.onap.org +DCAE_CONSUMER_GROUP=dcae.policy.shared + +# Open DMaaP + +DMAAP_SERVERS=mr.api.simpledemo.onap.org + +# AAI + +AAI_URL=https://aai.api.simpledemo.onap.org:8443 +AAI_USERNAME=policy@policy.onap.org +AAI_PASSWORD=demo123456! + +# MSO + +SO_URL=http://vm1.mso.simpledemo.onap.org:8080/onap/so/infra +SO_USERNAME=InfraPortalClient +SO_PASSWORD=password1$ + +# VFC + +VFC_URL= +VFC_USERNAME= +VFC_PASSWORD= + +# SDNC + +SDNC_URL= +SDNC_USERNAME= +SDNC_PASSWORD= diff --git a/scripts/policy/config/drools/feature-healthcheck.conf b/scripts/policy/config/drools/feature-healthcheck.conf new file mode 100644 index 00000000..c205e9f7 --- /dev/null +++ b/scripts/policy/config/drools/feature-healthcheck.conf @@ -0,0 +1,18 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= + +HEALTHCHECK_USER=demo@people.osaaf.org +HEALTHCHECK_PASSWORD=demo123456! diff --git a/scripts/policy/docker-compose-drools-apps.yml b/scripts/policy/docker-compose-drools-apps.yml new file mode 100644 index 00000000..a42c2996 --- /dev/null +++ b/scripts/policy/docker-compose-drools-apps.yml @@ -0,0 +1,47 @@ +# Copyright 2019 AT&T Intellectual Property. All rights reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +version: '2' +services: + mariadb: + image: mariadb:10.2.14 + 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 + drools: + image: nexus3.onap.org:10001/onap/policy-pdpd-cl:1.4-SNAPSHOT-latest + container_name: drools + depends_on: + - mariadb + hostname: drools + expose: + - 6969 + - 9696 + volumes: + - ${WORKSPACE}/scripts/policy/config/drools:/tmp/policy-install/config + environment: + - DEBUG=y + start_dependencies: + image: dadarek/wait-for-dependencies + container_name: policy-wait + depends_on: + - mariadb + hostname: policy-wait + command: mariadb:3306 + diff --git a/scripts/policy/docker-compose-drools.yml b/scripts/policy/docker-compose-drools.yml new file mode 100644 index 00000000..ffee9cdc --- /dev/null +++ b/scripts/policy/docker-compose-drools.yml @@ -0,0 +1,55 @@ +# 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:10.2.14 + container_name: mariadb + hostname: mariadb + command: ['--lower-case-table-names=1', '--wait_timeout=28800'] + env_file: config/db/db.conf + volumes: + - ./config/db:/docker-entrypoint-initdb.d + expose: + - 3306 + nexus: + image: sonatype/nexus:2.14.8-01 + container_name: nexus + hostname: nexus + pap: + image: onap/policy-pe + environment: + - PRELOAD_POLICIES=${PRELOAD_POLICIES} + container_name: pap + depends_on: + - mariadb + hostname: pap + expose: + - 8443 + - 9091 + command: pap + volumes: + - ./config/pe:/tmp/policy-install/config + drools: + image: onap/policy-drools + container_name: drools + depends_on: + - mariadb + - nexus + hostname: drools + expose: + - 6969 + - 9696 + volumes: + - ./config/drools:/tmp/policy-install/config diff --git a/scripts/policy/docker-compose-engine.yml b/scripts/policy/docker-compose-engine.yml new file mode 100644 index 00000000..e67729e2 --- /dev/null +++ b/scripts/policy/docker-compose-engine.yml @@ -0,0 +1,75 @@ +# 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:10.2.14 + container_name: mariadb + hostname: mariadb + command: ['--lower-case-table-names=1', '--wait_timeout=28800'] + env_file: config/db/db.conf + volumes: + - ./config/db:/docker-entrypoint-initdb.d + expose: + - 3306 + nexus: + image: sonatype/nexus:2.14.8-01 + container_name: nexus + hostname: nexus + pap: + image: onap/policy-pe + environment: + - PRELOAD_POLICIES=${PRELOAD_POLICIES} + container_name: pap + depends_on: + - mariadb + hostname: pap + expose: + - 8443 + - 9091 + command: pap + volumes: + - ./config/pe:/tmp/policy-install/config + pdp: + image: onap/policy-pe + container_name: pdp + depends_on: + - pap + hostname: pdp + expose: + - 8081 + command: pdp + volumes: + - ./config/pe:/tmp/policy-install/config + brmsgw: + image: onap/policy-pe + container_name: brmsgw + depends_on: + - pap + hostname: brmsgw + command: brmsgw + volumes: + - ./config/pe:/tmp/policy-install/config + drools: + image: onap/policy-drools + container_name: drools + depends_on: + - mariadb + - nexus + hostname: drools + expose: + - 6969 + - 9696 + volumes: + - ./config/drools:/tmp/policy-install/config diff --git a/scripts/policy/engine.sh b/scripts/policy/engine.sh new file mode 100755 index 00000000..b806cec5 --- /dev/null +++ b/scripts/policy/engine.sh @@ -0,0 +1,208 @@ +#!/bin/bash +# +# Copyright 2017-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. +# +echo "This is ${WORKSPACE}/scripts/policy/engine.sh" + + +# 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 + +# bring down maven +mkdir maven +cd maven +curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz +tar -xzvf apache-maven-3.3.9-bin.tar.gz +ls -l +export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin +${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v +cd .. + +ifconfig + +export IP=`ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}'` +if [ -z "$IP" ]; then + echo "Could not determine IP address" + exit 1 +fi +echo $IP + +if ! ifconfig docker0; then + export DOCKER_IP="$IP" +else + export DOCKER_IP=`ifconfig docker0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'` +fi +echo $DOCKER_IP + +git clone http://gerrit.onap.org/r/oparent + +git clone http://gerrit.onap.org/r/policy/engine +cd engine/packages/docker +${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn prepare-package --settings ${WORK_DIR}/oparent/settings.xml +docker build -t onap/policy-pe target/policy-pe + +cd ${WORK_DIR} +git clone http://gerrit.onap.org/r/policy/drools-pdp +cd drools-pdp/packages/docker +${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn prepare-package --settings ${WORK_DIR}/oparent/settings.xml +docker build -t onap/policy-drools target/policy-drools + +cd ${WORK_DIR} +git clone http://gerrit.onap.org/r/policy/docker +cd docker + +chmod +x config/drools/drools-tweaks.sh + +echo $IP > config/pe/ip_addr.txt +ls -l config/pe/ip_addr.txt +cat config/pe/ip_addr.txt + +export MTU=9126 + +export PRELOAD_POLICIES=false +docker-compose -f docker-compose-integration.yml up -d + +if [ ! $? -eq 0 ]; then + echo "Docker compose failed" + exit 1 +fi + +docker ps + +POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` +echo ${POLICY_IP} + +PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` +echo ${PDP_IP} + +PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` +echo ${PAP_IP} + +BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` +echo ${BRMS_IP} + +NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` +echo ${NEXUS_IP} + +MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` +echo ${MARIADB_IP} + +sleep 3m + +docker logs mariadb 2>&1 | grep -q "mysqld: ready for connections" +if [ $? -eq 0 ]; then + # mariadb is ok - sleep a little longer for others + sleep 2m + +else + echo mariadb is not ready + echo Restarting... + + docker kill drools pdp pap brmsgw nexus mariadb + docker rm -f drools pdp pap brmsgw nexus mariadb + + docker-compose -f docker-compose-integration.yml up -d + + if [ ! $? -eq 0 ]; then + echo "Docker compose failed" + exit 1 + fi + + docker ps + + POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` + echo ${POLICY_IP} + + PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` + echo ${PDP_IP} + + PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` + echo ${PAP_IP} + + BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` + echo ${BRMS_IP} + + NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` + echo ${NEXUS_IP} + + MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` + echo ${MARIADB_IP} + + sleep 5m +fi + +netstat -tnl + +docker logs mariadb +${DIR}/wait_for_port.sh ${MARIADB_IP} 3306 + +docker logs pap +${DIR}/wait_for_port.sh ${PAP_IP} 9091 + +docker logs pdp +${DIR}/wait_for_port.sh ${PDP_IP} 8081 + +docker logs brmsgw +${DIR}/wait_for_port.sh ${BRMS_IP} 9989 + +docker logs nexus +${DIR}/wait_for_port.sh ${NEXUS_IP} 8081 + +docker logs drools +${DIR}/wait_for_port.sh ${POLICY_IP} 6969 + +TIME_OUT=600 +INTERVAL=20 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + curl -k -i --user "demo@people.osaaf.org:demo123456!" -H "ContentType: application/json" -H "Accept: application/json" https://${POLICY_IP}:6969/healthcheck && break + + echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + sleep $INTERVAL + TIME=$(($TIME+$INTERVAL)) + +done + +TIME_OUT=600 +INTERVAL=20 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + + curl -k -i -v -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -d '{"policyName": ".*"}' https://${PDP_IP}:8081/pdp/api/getConfig && break + +echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + sleep $INTERVAL + TIME=$(($TIME+$INTERVAL)) + +done + +# +# Add more sleep for everything to settle +# +sleep 3m diff --git a/scripts/policy/mock-hello.sh b/scripts/policy/mock-hello.sh deleted file mode 100755 index 6092dcba..00000000 --- a/scripts/policy/mock-hello.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# Copyright 2017 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. -# -# $1 ip address of the mock server - -curl -v -X PUT -d @- http://$1:1080/expectation < config/pe/ip_addr.txt -ls -l config/pe/ip_addr.txt -cat config/pe/ip_addr.txt - -export MTU=9126 - -export PRELOAD_POLICIES=false -docker-compose -f docker-compose-integration.yml up -d - -if [ ! $? -eq 0 ]; then - echo "Docker compose failed" - exit 1 -fi - -docker ps - -POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` -echo ${POLICY_IP} - -PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` -echo ${PDP_IP} - -PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` -echo ${PAP_IP} - -BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` -echo ${BRMS_IP} - -NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` -echo ${NEXUS_IP} - -MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` -echo ${MARIADB_IP} - -sleep 3m - -docker logs mariadb 2>&1 | grep -q "mysqld: ready for connections" -if [ $? -eq 0 ]; then - # mariadb is ok - sleep a little longer for others - sleep 2m - -else - echo mariadb is not ready - echo Restarting... - - docker kill drools pdp pap brmsgw nexus mariadb - docker rm -f drools pdp pap brmsgw nexus mariadb - - docker-compose -f docker-compose-integration.yml up -d - - if [ ! $? -eq 0 ]; then - echo "Docker compose failed" - exit 1 - fi - - docker ps - - POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` - echo ${POLICY_IP} - - PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` - echo ${PDP_IP} - - PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` - echo ${PAP_IP} - - BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` - echo ${BRMS_IP} - - NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` - echo ${NEXUS_IP} - - MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` - echo ${MARIADB_IP} - - sleep 5m -fi - -netstat -tnl - -docker logs mariadb -${DIR}/wait_for_port.sh ${MARIADB_IP} 3306 - -docker logs pap -${DIR}/wait_for_port.sh ${PAP_IP} 9091 - -docker logs pdp -${DIR}/wait_for_port.sh ${PDP_IP} 8081 - -docker logs brmsgw -${DIR}/wait_for_port.sh ${BRMS_IP} 9989 - -docker logs nexus -${DIR}/wait_for_port.sh ${NEXUS_IP} 8081 - -docker logs drools -${DIR}/wait_for_port.sh ${POLICY_IP} 6969 - -TIME_OUT=600 -INTERVAL=20 -TIME=0 -while [ "$TIME" -lt "$TIME_OUT" ]; do - curl -k -i --user "demo@people.osaaf.org:demo123456!" -H "ContentType: application/json" -H "Accept: application/json" https://${POLICY_IP}:6969/healthcheck && break - - echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds - sleep $INTERVAL - TIME=$(($TIME+$INTERVAL)) - -done - -TIME_OUT=600 -INTERVAL=20 -TIME=0 -while [ "$TIME" -lt "$TIME_OUT" ]; do - - curl -k -i -v -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -d '{"policyName": ".*"}' https://${PDP_IP}:8081/pdp/api/getConfig && break - -echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds - sleep $INTERVAL - TIME=$(($TIME+$INTERVAL)) - -done - -# -# Add more sleep for everything to settle -# -sleep 3m diff --git a/tests/policy/drools-applications/drools-applications-test.robot b/tests/policy/drools-applications/drools-applications-test.robot new file mode 100644 index 00000000..cf4d3cea --- /dev/null +++ b/tests/policy/drools-applications/drools-applications-test.robot @@ -0,0 +1,17 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Test Cases *** +Alive + [Documentation] Runs Policy PDP Alive Check + ${auth}= Create List demo@people.osaaf.org demo123456! + Log Creating session https://${POLICY_DROOLS_IP}:9696 + ${session}= Create Session policy https://${POLICY_DROOLS_IP}:9696 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Get Request policy /policy/pdp/engine 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()['alive']} True diff --git a/tests/policy/engine/Policy-CSIT.robot b/tests/policy/engine/Policy-CSIT.robot new file mode 100644 index 00000000..514cc840 --- /dev/null +++ b/tests/policy/engine/Policy-CSIT.robot @@ -0,0 +1,403 @@ +*** Settings *** +Documentation Policy ONAP CSIT Test cases +Library String +Library HttpLibrary.HTTP +LIbrary Process +Library BuiltIn +Resource policy_interface.robot +Resource json_templater.robot + +*** Variables *** +${RESOURCE_PATH_CREATE} /pdp/api/createPolicy +${RESOURCE_PATH_CREATE_PUSH} /pdp/api/pushPolicy +${RESOURCE_PATH_CREATE_DELETE} /pdp/api/deletePolicy +${RESOURCE_PATH_GET_CONFIG} /pdp/api/getConfig +${RESOURCE_PATH_LISTPOLICY} /pdp/api/listPolicy +${CREATE_CONFIG_VFW_TEMPLATE} ${CURDIR}/configpolicy_vFW_R1.template +${CREATE_CONFIG_VDNS_TEMPLATE} ${CURDIR}/configpolicy_vDNS_R1.template +${CREATE_CONFIG_VCPE_TEMPLATE} ${CURDIR}/configpolicy_vCPE_R1.template +${CREATE_OPS_VFW_TEMPLATE} ${CURDIR}/opspolicy_VFW_R1.template +${CREATE_OOF_HPA_TEMPLATE} ${CURDIR}/oofpolicy_HPA_R1.template +${CREATE_SDNC_VFW_TEMPLATE} ${CURDIR}/sdncnamingpolicy_vFW.template +${CREATE_SDNC_VPG_TEMPLATE} ${CURDIR}/sdncnamingpolicy_vPG.template +${PUSH_POLICY_TEMPLATE} ${CURDIR}/pushpolicy.template +${MULTIPLE_PUSH_POLICY_TEMPLATE} ${CURDIR}/multiple_pushpolicy.template +${MULTIPLE_UNPUSH_POLICY_TEMPLATE} ${CURDIR}/multiple_unpushpolicy.template +${CREATE_OPS_VDNS_TEMPLATE} ${CURDIR}/opspolicy_VDNS_R1.template +${DEL_POLICY_TEMPLATE} ${CURDIR}/deletepolicy.template +${GETCONFIG_TEMPLATE} ${CURDIR}/getconfigpolicy.template +${GETOOF_TEMPLATE} ${CURDIR}/getoofpolicy.template +${LISTPOLICY_TEMPLATE} ${CURDIR}/listpolicy.template +${CONFIG_POLICY_VFW_NAME} vFirewall +${CONFIG_POLICY_VFW_TYPE} MicroService +${CONFIG_POLICY_VDNS_NAME} vLoadBalancer +${CONFIG_POLICY_VDNS_TYPE} MicroService +${OPS_POLICY_VFW_NAME} vFirewall +${OPS_POLICY_VFW_TYPE} BRMS_PARAM +${OPS_POLICY_VDNS_NAME} vLoadBalancer +${OPS_POLICY_VDNS_TYPE} BRMS_PARAM +${CONFIG_POLICY_VCPE_NAME} vCPE +${CONFIG_POLICY_VCPE_TYPE} MicroService +${OPS_POLICY_VCPE_NAME} vCPE +${OPS_POLICY_VCPE_TYPE} BRMS_PARAM +${OPS_POLICY_VOLTE_NAME} VoLTE +${OPS_POLICY_VOLTE_TYPE} BRMS_PARAM +${OOF_POLICY_HPA_NAME} HPA +${OOF_POLICY_HPA_TYPE} Optimization +${SDNC_POLICY_VFW_NAME} ONAP_vFW_Naming +${SDNC_POLICY_VPG_NAME} ONAP_vPG_Naming +${MULTIPLE_PUSH_POLICY_NAME1} com.testBase1 +${MULTIPLE_PUSH_POLICY_NAME2} com.testBase2 +${MULTIPLE_PUSH_POLICY_NAME3} com.testBase3 +${file_path} ../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl +${RESOURCE_PATH_UPLOAD} /pdp/api/policyEngineImport?importParametersJson=%7B%22serviceName%22%3A%22Manyu456%22%2C%20%22serviceType%22%3A%22BRMSPARAM%22%7D +${CREATE_OPS_VCPE_TEMPLATE} ${CURDIR}/opspolicy_vCPE_R1.template +${CREATE_OPS_VOLTE_TEMPLATE} ${CURDIR}/opspolicy_vOLTE_R1.template + + +*** Test Cases *** +Policy Health check + Run Policy Health Check + +VFW Config Policy + ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy + Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} + #VFW Policy Tests + +VDNS Config Policy + ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy + Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE} + #VDNS Policy Tests + +VCPE Config Policy + ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy + Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE} + #VCPE Policy Tests + +VFW Ops Policy + ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy + Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE} + +VDNS Ops Policy + ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy + Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE} + +VCPE Ops Policy + ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy + Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE} + +VOLTE Ops Policy + ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy + Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE} + #VOLTE Policy Tests + +VFW SDNC Naming Policy + ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy + Push Config Policy ${SDNC_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} + #VFW Policy Tests + +VPG SDNC Naming Policy + ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy + Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE} + #VPG Policy Tests + +HPA OOF Policy + ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy + Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE} + #HPA Policy Tests + +VFW Get Configs Policy + Sleep 5s + Get Configs VFW Policy + +VDNS Get Configs Policy + Sleep 5s + Get Configs VDNS Policy + +VCPE Get Configs Policy + Sleep 5s + Get Configs VCPE Policy + +HPA Get OOF Policy + Sleep 5s + Get OOF HPA Policy + +ListPolicy + ListPolicy test com.Config_Sample.1.xml + +Multiple Push Policy + ${MULTIPLE_PUSH_POLICY_NAME1}= Create Ops VDNS Policy + ${MULTIPLE_PUSH_POLICY_NAME2}= Create Ops VDNS Policy + ${MULTIPLE_PUSH_POLICY_NAME3}= Create Ops VDNS Policy + Push Multiple Policy test ${MULTIPLE_PUSH_POLICY_NAME1} ${MULTIPLE_PUSH_POLICY_NAME2} ${MULTIPLE_PUSH_POLICY_NAME3} ${OPS_POLICY_VDNS_TYPE} + Sleep 5s + Delete Multiple Policy test ${MULTIPLE_PUSH_POLICY_NAME1} ${MULTIPLE_PUSH_POLICY_NAME2} ${MULTIPLE_PUSH_POLICY_NAME3} ${OPS_POLICY_VDNS_TYPE} + +*** Keywords *** + +VFW Policy Tests + ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy + Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} + Get Configs VFW Policy + ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy + Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE} + ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy + Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} + +VDNS Policy Tests + ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy + Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE} + Get Configs VDNS Policy + ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy + Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE} + +VCPE Policy Tests + ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy + Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE} + Get Configs VCPE Policy + ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy + Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE} + +VPG Policy Tests + ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy + Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE} + +VOLTE Policy Tests + ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy + Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE} + +HPA Policy Tests + ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy + Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE} + Get OOF HPA Policy + +Get Configs VFW Policy + [Documentation] Get Config Policy for VFW + ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VFW_NAME}* + ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} + ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} + ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} + Should Be Equal As Strings ${get_resp.status_code} 200 + +Create OOF HPA Policy + [Documentation] Create OOF Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname}_HPA + ${OOF_POLICY_HPA_NAME}= Set Test Variable ${policyname1} + ${hpapolicy}= Create Dictionary policy_name=${policyname1} + ${output} = Fill JSON Template File ${CREATE_OOF_HPA_TEMPLATE} ${hpapolicy} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Log ${put_resp} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Get OOF HPA Policy + [Documentation] Get OOF Policy for HPA + ${gethpapolicy}= Catenate .*${OOF_POLICY_HPA_NAME}* + ${hpapolicy_name}= Create Dictionary oof_policy_name=${gethpapolicy} + ${output} = Fill JSON Template File ${GETOOF_TEMPLATE} ${hpapolicy_name} + ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} + Should Be Equal As Strings ${get_resp.status_code} 200 + +Create Config VFW Policy + [Documentation] Create Config Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname}_vFirewall + ${CONFIG_POLICY_VFW_NAME}= Set Test Variable ${policyname1} + ${configpolicy}= Create Dictionary policy_name=${policyname1} + ${output} = Fill JSON Template File ${CREATE_CONFIG_VFW_TEMPLATE} ${configpolicy} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Create VPG SDNC Naming Policy + [Documentation] Create VPG SDNC Naming Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname}_ONAP_vPG_Naming + ${SDNC_POLICY_VPG_NAME}= Set Test Variable ${policyname1} + ${sdncpolicy}= Create Dictionary policy_name=${policyname1} + ${output} = Fill JSON Template File ${CREATE_SDNC_VPG_TEMPLATE} ${sdncpolicy} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Create VFW SDNC Naming Policy + [Documentation] Create VFW SDNC Naming Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname}_ONAP_vFW_Naming + ${SDNC_POLICY_VFW_NAME}= Set Test Variable ${policyname1} + ${sdncpolicy}= Create Dictionary policy_name=${policyname1} + ${output} = Fill JSON Template File ${CREATE_SDNC_VFW_TEMPLATE} ${sdncpolicy} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Create Policy Name + [Documentation] Generate Policy Name + [Arguments] ${prefix}=CSIT_ + ${random}= Generate Random String 15 [LOWER][NUMBERS] + ${policyname}= Catenate ${prefix}${random} + [Return] ${policyname} + +Create Ops VFW Policy + [Documentation] Create Operational Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname}_vFirewall + ${OPS_POLICY_VFW_NAME}= Set Test Variable ${policyname1} + ${dict}= Create Dictionary policy_name=${policyname1} + ${output} = Fill JSON Template File ${CREATE_OPS_VFW_TEMPLATE} ${dict} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Log ${put_resp} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Push Ops Policy + [Documentation] Push Ops Policy + [Arguments] ${policyname} ${policytype} + ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} + ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Push Config Policy + [Documentation] Push Config Policy + [Arguments] ${policyname} ${policytype} + ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} + ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Delete Ops Policy + [Documentation] Delete Config Policy + [Arguments] ${policy_name} + ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml + ${dict}= Create Dictionary policy_name=${policyname3} + ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Delete Config Policy + [Documentation] Delete Ops Policy + [Arguments] ${policy_name} + ${policyname3}= Catenate com.Config_MS_com.${policy_name}.1.xml + ${dict}= Create Dictionary policy_name=${policyname3} + ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Delete OOF Policy + [Documentation] Delete OOF Policy + [Arguments] ${policy_name} + ${policyname3}= Catenate com.Config_OOF_${policy_name}.1.xml + ${dict}= Create Dictionary policy_name=${policyname3} + ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Get Configs VDNS Policy + [Documentation] Get Config Policy for VDNS + ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VDNS_NAME}* + ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} + ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} + ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} + Should Be Equal As Strings ${get_resp.status_code} 200 + +Create Config VDNS Policy + [Documentation] Create Config Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer + ${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} + ${configpolicy}= Create Dictionary policy_name=${policyname1} + ${output} = Fill JSON Template File ${CREATE_CONFIG_VDNS_TEMPLATE} ${configpolicy} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Create Ops VDNS Policy + [Documentation] Create Operational Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer + ${OPS_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} + ${dict}= Create Dictionary policy_name=${policyname1} + ${output} = Fill JSON Template File ${CREATE_OPS_VDNS_TEMPLATE} ${dict} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Log ${put_resp} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Create Config VCPE Policy + [Documentation] Create Config Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname}_vCPE + ${CONFIG_POLICY_VCPE_NAME}= Set Test Variable ${policyname1} + ${configpolicy}= Create Dictionary policy_name=${policyname1} + ${output} = Fill JSON Template File ${CREATE_CONFIG_VCPE_TEMPLATE} ${configpolicy} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Get Configs VCPE Policy + [Documentation] Get Config Policy for VCPE + ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VCPE_NAME}* + ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} + ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} + ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} + Should Be Equal As Strings ${get_resp.status_code} 200 + +Create Ops vCPE Policy + [Documentation] Create Operational Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname}_vCPE + ${OPS_POLICY_VCPE_NAME}= Set Test Variable ${policyname1} + ${dict}= Create Dictionary policy_name=${policyname1} + ${output} = Fill JSON Template File ${CREATE_OPS_VCPE_TEMPLATE} ${dict} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Log ${put_resp} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Create Ops VolTE Policy + [Documentation] Create Operational Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname}_VoLTE + ${dict}= Create Dictionary policy_name=${policyname1} + ${output} = Fill JSON Template File ${CREATE_OPS_VOLTE_TEMPLATE} ${dict} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Log ${put_resp} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Upload DRL file + [Documentation] Upload DRL file1 + ${file_data}= Get Binary File ${file_path} + ${files}= Create Dictionary file=${file_data} + #${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} + # ${files2} = {'file': open('../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl', 'rb')} + # ${files}= Create Dictionary file ${file_data} + ${put_resp} = Run Policy Post form Request ${RESOURCE_PATH_UPLOAD} ${files} + Should Be Equal As Strings ${put_resp.status_code} 200 + +ListPolicy test + [Documentation] Listing Config Policies + [Arguments] ${policy_name} + ${dict}= Create Dictionary policy_name=${policy_name} + ${output} = Fill JSON Template File ${LISTPOLICY_TEMPLATE} ${dict} + ${put_resp} = policy_interface.Run Policy Post Request ${RESOURCE_PATH_LISTPOLICY} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Push Multiple Policy test + [Documentation] Push Multiple Policy + [Arguments] ${policyname1} ${policyname2} ${policyname3} ${policytype} + ${dict}= Create Dictionary policy_name1=${policyname1} policy_name2=${policyname2} policy_name3=${policyname3} policy_type=${policytype} + ${output} = Fill JSON Template File ${MULTIPLE_PUSH_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Delete Multiple Policy test + [Documentation] Delete Multiple Policy + [Arguments] ${policyname1} ${policyname2} ${policyname3} ${policytype} + ${dict}= Create Dictionary policy_name1=${policyname1} policy_name2=${policyname2} policy_name3=${policyname3} policy_type=${policytype} + ${output} = Fill JSON Template File ${MULTIPLE_UNPUSH_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + diff --git a/tests/policy/engine/__init__.robot b/tests/policy/engine/__init__.robot new file mode 100644 index 00000000..c7970e6a --- /dev/null +++ b/tests/policy/engine/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Policy - Suite 1 diff --git a/tests/policy/engine/configpolicy_vCPE.template b/tests/policy/engine/configpolicy_vCPE.template new file mode 100644 index 00000000..e3e3a2d0 --- /dev/null +++ b/tests/policy/engine/configpolicy_vCPE.template @@ -0,0 +1,6 @@ +{ +"configBody": "{ \"service\": \"policy_tosca_tca\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevCPE\", \"description\": \"MicroService vCPE Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.0.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"MAJOR\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ABATED\", \"closedLoopControlName\": \"CL-vCPEvGMUX-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241ABA1\", \"version\": \"1.0.2\", \"direction\": \"EQUAL\" }, { \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\", \"thresholdValue\": \"1000\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"CL-vCPEvGMUX-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241ABA1\", \"version\": \"1.0.2\", \"direction\": \"GREATER_OR_EQUAL\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"eventName\": \"vCPEvGMUXPacketLoss\" } }", +"policyConfigType": "MicroService", +"policyName": "${policy_name}", +"ecompName": "DCAE" +} diff --git a/tests/policy/engine/configpolicy_vCPE_R1.template b/tests/policy/engine/configpolicy_vCPE_R1.template new file mode 100644 index 00000000..77653c3f --- /dev/null +++ b/tests/policy/engine/configpolicy_vCPE_R1.template @@ -0,0 +1,7 @@ +{ + "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\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"MAJOR\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ABATED\", \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"direction\": \"EQUAL\" }, { \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"direction\": \"GREATER\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"eventName\": \"Measurement_vGMUX\" } }", + "policyConfigType": "MicroService", + "policyName": "${policy_name}", + "onapName": "DCAE", + "priority": "5" +} diff --git a/tests/policy/engine/configpolicy_vDNS.template b/tests/policy/engine/configpolicy_vDNS.template new file mode 100644 index 00000000..ab1d2e0d --- /dev/null +++ b/tests/policy/engine/configpolicy_vDNS.template @@ -0,0 +1,6 @@ +{ +"configBody": "{\"service\": \"policy_tosca_tca\",\"location\": \"TestMSLocation\",\"uuid\": \"/services/cdap-tca-hi-lo/instances/dfw1/configuration/metricsPerFunctionalRole/vLoadBalancer\",\"policyName\": \"vLoadBalancer\",\"description\": \"vLoadBalancer\",\"configName\": \"TestConfigName\",\"templateVersion\": \"1607\",\"version\": \"8.7.6.5\",\"priority\": \"1\",\"policyScope\": \"resource=TestResource,service=TestService,type=TestType,closedLoopControlName=TestClosedLoop\",\"riskType\": \"test\",\"riskLevel\": \"2\",\"guard\": \"False\",\"content\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"500\",\"closedLoopControlName\": \"CL-LBAL-LOW-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241AB1A\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"5000\",\"closedLoopControlName\": \"CL-LBAL-HIGH-TRAFFIC-SIG-0C5920A6-B564-8035-C878-0E814352BC2B\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"configuration.ae.microservice.tca.xml\",\"functionalRole\": \"ClosedLoop_F5-d925ed73-8231-4d02-9545-db4e101f88f8\"}}", +"policyConfigType": "MicroService", +"policyName": "${policy_name}", +"ecompName": "DCAE" +} \ No newline at end of file diff --git a/tests/policy/engine/configpolicy_vDNS_R1.template b/tests/policy/engine/configpolicy_vDNS_R1.template new file mode 100644 index 00000000..185a7c72 --- /dev/null +++ b/tests/policy/engine/configpolicy_vDNS_R1.template @@ -0,0 +1,7 @@ +{ + "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\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": \"300\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"version\": \"1.0.2\", \"direction\": \"GREATER_OR_EQUAL\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"eventName\": \"vLoadBalancer\" } }", + "policyConfigType": "MicroService", + "policyName": "${policy_name}", + "onapName": "DCAE", + "priority": "5" +} diff --git a/tests/policy/engine/configpolicy_vFW.template b/tests/policy/engine/configpolicy_vFW.template new file mode 100644 index 00000000..39e99e7b --- /dev/null +++ b/tests/policy/engine/configpolicy_vFW.template @@ -0,0 +1,6 @@ +{ +"configBody": "{\"service\": \"policy_tosca_tca\",\"location\": \"Ravi\",\"uuid\": \"/services/cdap-tca-hi-lo/instances/dfw1/configuration/metricsPerFunctionalRole/vFireWall\",\"policyName\": \"vFireWall\",\"description\": \"vFireWall\",\"configName\": \"TestConfigName\",\"templateVersion\": \"1607\",\"version\": \"8.7.6.5\",\"priority\": \"1\",\"policyScope\": \"resource=TestResource,service=TestService,type=TestType,closedLoopControlName=TestClosedLoop\",\"riskType\": \"test\",\"riskLevel\": \"2\",\"guard\": \"False\",\"content\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"4000\",\"closedLoopControlName\": \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"20000\",\"closedLoopControlName\": \"CL-FRWL-HIGH-TRAFFIC-SIG-EA36FE84-9342-5E13-A656-EC5F21309A09\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"configuration.ae.microservice.tca.xml\",\"functionalRole\": \"ClosedLoop_F5-d925ed73-8231-4d02-9545-db4e101f88f8\"}}", +"policyConfigType": "MicroService", +"policyName": "${policy_name}", +"ecompName": "DCAE" +} \ No newline at end of file diff --git a/tests/policy/engine/configpolicy_vFW_R1.template b/tests/policy/engine/configpolicy_vFW_R1.template new file mode 100644 index 00000000..067ed07f --- /dev/null +++ b/tests/policy/engine/configpolicy_vFW_R1.template @@ -0,0 +1,7 @@ +{ + "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\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\": \"300\",\"closedLoopEventStatus\": \"ONSET\",\"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\": \"700\",\"closedLoopEventStatus\": \"ONSET\",\"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"DCAE.Config_tca-hi-lo\",\"controlLoopSchemaType\": \"VNF\",\"policyScope\": \"DCAE\",\"eventName\": \"vFirewallBroadcastPackets\"}}", + "policyConfigType": "MicroService", + "policyName": "${policy_name}", + "onapName": "DCAE", + "priority": "5" +} diff --git a/tests/policy/engine/createpolicy.template b/tests/policy/engine/createpolicy.template new file mode 100644 index 00000000..7c693e84 --- /dev/null +++ b/tests/policy/engine/createpolicy.template @@ -0,0 +1,21 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "policyDescription": "Create BRMS Param policy", + "attributes": { + "RULE": { + "templateName": "ClosedLoopDemo_closedLoopControlName", + "aaiNamedQueryUUID": "2", + "aaiPassword": "2", + "aaiPatternMatch": "2", + "aaiURL": "2", + "actor": "2", + "appcTopic": "2", + "closedLoopControlName": "2", + "msoPassword": "2", + "msoURL": "2", + "msoUsername": "2", + "aaiUsername": "3" + } + } +} diff --git a/tests/policy/engine/deletepolicy.template b/tests/policy/engine/deletepolicy.template new file mode 100644 index 00000000..55510102 --- /dev/null +++ b/tests/policy/engine/deletepolicy.template @@ -0,0 +1,5 @@ +{ + "pdpGroup": "default", + "policyComponent": "PDP", + "policyName": "${policy_name}" +} diff --git a/tests/policy/engine/getconfigpolicy.template b/tests/policy/engine/getconfigpolicy.template new file mode 100644 index 00000000..611e65d0 --- /dev/null +++ b/tests/policy/engine/getconfigpolicy.template @@ -0,0 +1,8 @@ +{ + "configAttributes" : { + }, + "configName" : ".*", + "ecompName" : "DCAE", + "policyName" : "${config_policy_name}", + "unique" : false +} \ No newline at end of file diff --git a/tests/policy/engine/getoofpolicy.template b/tests/policy/engine/getoofpolicy.template new file mode 100644 index 00000000..37fe0471 --- /dev/null +++ b/tests/policy/engine/getoofpolicy.template @@ -0,0 +1,6 @@ +{ + "configAttributes" : { + }, + "policyName" : "${oof_policy_name}", + "unique" : false +} diff --git a/tests/policy/engine/global_properties.robot b/tests/policy/engine/global_properties.robot new file mode 100644 index 00000000..e0c816ea --- /dev/null +++ b/tests/policy/engine/global_properties.robot @@ -0,0 +1,30 @@ +*** Settings *** +Documentation store all properties that can change or are used in multiple places here +... format is all caps with underscores between words and prepended with GLOBAL +... make sure you prepend them with GLOBAL so that other files can easily see it is from this file. + + +*** Variables *** +${GLOBAL_APPLICATION_ID} robot-ete +${GLOBAL_MSO_STATUS_PATH} /ecomp/mso/infra/orchestrationRequests/v2/ +${GLOBAL_SELENIUM_BROWSER} chrome +${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} Create Dictionary +${GLOBAL_SELENIUM_DELAY} 0 +${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} 5 +${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} 15 +${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} orchestration +${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} volume +${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} compute +${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} network +${GLOBAL_OPENSTACK_GLANCE_SERVICE_TYPE} image +${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} identity +${GLOBAL_AAI_CLOUD_OWNER} Rackspace +${GLOBAL_BUILD_NUMBER} 31 +${GLOBAL_VM_PRIVATE_KEY} ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pvt +# policy info - everything is from the private oam network (also called ecomp private network) +${GLOBAL_POLICY_SERVER_URL} https://%{PDP_IP}:8081 +${GLOBAL_POLICY_AUTH} dGVzdHBkcDphbHBoYTEyMw== +${GLOBAL_POLICY_CLIENTAUTH} cHl0aG9uOnRlc3Q= +${GLOBAL_POLICY_HEALTHCHECK_URL} https://%{POLICY_IP}:6969 +${GLOBAL_POLICY_USERNAME} demo@people.osaaf.org +${GLOBAL_POLICY_PASSWORD} demo123456! diff --git a/tests/policy/engine/json_templater.robot b/tests/policy/engine/json_templater.robot new file mode 100644 index 00000000..a1cc7e35 --- /dev/null +++ b/tests/policy/engine/json_templater.robot @@ -0,0 +1,21 @@ +*** Settings *** +Documentation This resource is filling out json string templates and returning the json back +Library RequestsLibrary +Library eteutils/StringTemplater.py +Library OperatingSystem +Resource global_properties.robot + +*** Keywords *** +Fill JSON Template + [Documentation] Runs substitution on template to return a filled in json + [Arguments] ${json} ${arguments} + ${returned_string}= Template String ${json} ${arguments} + ${returned_json}= To Json ${returned_string} + [Return] ${returned_json} + +Fill JSON Template File + [Documentation] Runs substitution on template to return a filled in json + [Arguments] ${json_file} ${arguments} + ${json}= OperatingSystem.Get File ${json_file} + ${returned_json}= Fill JSON Template ${json} ${arguments} + [Return] ${returned_json} \ No newline at end of file diff --git a/tests/policy/engine/listpolicy.template b/tests/policy/engine/listpolicy.template new file mode 100644 index 00000000..aef17a23 --- /dev/null +++ b/tests/policy/engine/listpolicy.template @@ -0,0 +1,3 @@ +{ + "policyName": "${policy_name}" +} diff --git a/tests/policy/engine/multiple_pushpolicy.template b/tests/policy/engine/multiple_pushpolicy.template new file mode 100644 index 00000000..5f20b647 --- /dev/null +++ b/tests/policy/engine/multiple_pushpolicy.template @@ -0,0 +1,5 @@ +{ + "policyName":"${policy_name1},${policy_name2},${policy_name3}", + "policyType":"${policy_type}", + "pdpGroup":"default" +} diff --git a/tests/policy/engine/multiple_unpushpolicy.template b/tests/policy/engine/multiple_unpushpolicy.template new file mode 100644 index 00000000..afee7aeb --- /dev/null +++ b/tests/policy/engine/multiple_unpushpolicy.template @@ -0,0 +1,6 @@ +{ + "policyName": "${policy_name1},${policy_name2},${policy_name3}", + "policyType": "${policy_type}", + "policyComponent": "PDP", + "pdpGroup": "default" +} diff --git a/tests/policy/engine/oofpolicy_HPA_R1.template b/tests/policy/engine/oofpolicy_HPA_R1.template new file mode 100644 index 00000000..3a170b20 --- /dev/null +++ b/tests/policy/engine/oofpolicy_HPA_R1.template @@ -0,0 +1,6 @@ +{ + "configBody": "{\"service\":\"hpaPolicy\",\"policyName\":\"testWorkingTOSCA\",\"description\":\"testing\",\"templateVersion\":\"OpenSource.version.1\",\"version\":\"CSIT\",\"priority\":\"5\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"testIdentity\",\"policyScope\":[\"test1\",\"test2\",\"test3\"],\"policyType\":\"hpaPolicy\",\"resources\":\"testResources1\",\"flavorFeatures\":[{\"flavorLabel\":\"testFlavor\",\"flavorProperties\":[{\"score\":\"testScore\",\"featureAttributes\":[{\"unit\":\"testUnit\",\"attribute\":\"teatFeatureAttribute\",\"value\":\"testValue\",\"operator\":\"any\"}],\"mandatory\":\"testMandatory\",\"hpaFeature\":\"testHAPFeature\",\"architecture\":\"testArch\"}]}]}}", + "policyConfigType": "Optimization", + "policyName": "${policy_name}", + "onapName": "OOF" +} diff --git a/tests/policy/engine/opspolicy_VDNS.template b/tests/policy/engine/opspolicy_VDNS.template new file mode 100644 index 00000000..801773d5 --- /dev/null +++ b/tests/policy/engine/opspolicy_VDNS.template @@ -0,0 +1,26 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "policyDescription": "Create BRMS Param policy for vLB", + "attributes": { + "MATCHING": { + "controller": "vDNS" + }, + "RULE": { + "templateName": "ControlLoopDemo__closedLoopControlName", + "closedLoopControlName": "CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8", + "policyVersion": "v1.0", + "actor": "MSO", + "aaiNamedQueryUUID": "4ff56a54-9e3f-46b7-a337-07a1d3c6b469", + "aaiURL": "https://aai.api.simpledemo.openecomp.org:8443/aai/search/named-query", + "aaiUsername": "POLICY", + "aaiPassword": "POLICY", + "msoURL": "http://vm1.mso.simpledemo.openecomp.org:8080/ecomp/mso/infra", + "msoUsername": "InfraPortalClient", + "msoPassword": "password11", + "aaiPatternMatch": 0, + "notificationTopic": "POLICY-CL-MGT", + "appcTopic": "APPC-CL" + } + } +} \ No newline at end of file diff --git a/tests/policy/engine/opspolicy_VDNS_R1.template b/tests/policy/engine/opspolicy_VDNS_R1.template new file mode 100644 index 00000000..92627cc2 --- /dev/null +++ b/tests/policy/engine/opspolicy_VDNS_R1.template @@ -0,0 +1,16 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "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%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0D%0A++trigger_policy%3A+unique-policy-id-1-scale-up%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-scale-up%0D%0A++++name%3A+Create+a+new+VF+Module%0D%0A++++description%3A%0D%0A++++actor%3A+SO%0D%0A++++recipe%3A+VF+Module+Create%0D%0A++++target%3A%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%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" + } + } +} \ No newline at end of file diff --git a/tests/policy/engine/opspolicy_VFW.template b/tests/policy/engine/opspolicy_VFW.template new file mode 100644 index 00000000..224f5cf4 --- /dev/null +++ b/tests/policy/engine/opspolicy_VFW.template @@ -0,0 +1,24 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "policyDescription": "Create BRMS Param policy for vFW", + "attributes": { + "RULE": { + "templateName": "ControlLoopDemo__closedLoopControlName", + "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", + "policyVersion": "v1.0", + "aaiNamedQueryUUID": "null", + "aaiPassword": "null", + "aaiURL": "null", + "actor": "APPC", + "appcTopic": "APPC-CL", + "msoPassword": "null", + "msoURL": "null", + "msoUsername": "null", + "aaiUsername": "null", + "notificationTopic": "POLICY-CL-MGT", + "aaiPatternMatch": 1 + } + } +} + diff --git a/tests/policy/engine/opspolicy_VFW_R1.template b/tests/policy/engine/opspolicy_VFW_R1.template new file mode 100644 index 00000000..a93063f7 --- /dev/null +++ b/tests/policy/engine/opspolicy_VFW_R1.template @@ -0,0 +1,16 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "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" + } + } +} diff --git a/tests/policy/engine/opspolicy_vCPE.template b/tests/policy/engine/opspolicy_vCPE.template new file mode 100644 index 00000000..c17a1bc6 --- /dev/null +++ b/tests/policy/engine/opspolicy_vCPE.template @@ -0,0 +1,16 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "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+%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" + } + } +} \ No newline at end of file diff --git a/tests/policy/engine/opspolicy_vCPE_R1.template b/tests/policy/engine/opspolicy_vCPE_R1.template new file mode 100644 index 00000000..36695daa --- /dev/null +++ b/tests/policy/engine/opspolicy_vCPE_R1.template @@ -0,0 +1,16 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "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" + } + } +} \ No newline at end of file diff --git a/tests/policy/engine/opspolicy_vOLTE.template b/tests/policy/engine/opspolicy_vOLTE.template new file mode 100644 index 00000000..e43a3e6f --- /dev/null +++ b/tests/policy/engine/opspolicy_vOLTE.template @@ -0,0 +1,16 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "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+%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" + } + } +} \ No newline at end of file diff --git a/tests/policy/engine/opspolicy_vOLTE_R1.template b/tests/policy/engine/opspolicy_vOLTE_R1.template new file mode 100644 index 00000000..ff5fc42c --- /dev/null +++ b/tests/policy/engine/opspolicy_vOLTE_R1.template @@ -0,0 +1,16 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "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" + } + } +} \ No newline at end of file diff --git a/tests/policy/engine/policy_interface.robot b/tests/policy/engine/policy_interface.robot new file mode 100644 index 00000000..745f7817 --- /dev/null +++ b/tests/policy/engine/policy_interface.robot @@ -0,0 +1,70 @@ +*** Settings *** +Documentation The main interface for interacting with Policy. It handles low level stuff like managing the http request library and Policy required fields +Library eteutils/RequestsClientCert.py +#Library RequestsClientCert +Library RequestsLibrary +Library String +Library eteutils/JSONUtils.py +#Library JSONUtils +Library Collections +Resource global_properties.robot + +*** Variables *** +${POLICY_HEALTH_CHECK_PATH} /healthcheck + +*** Keywords *** + +Run Policy Health Check + [Documentation] Runs Policy Health check + ${auth}= Create List ${GLOBAL_POLICY_USERNAME} ${GLOBAL_POLICY_PASSWORD} + Log Creating session ${GLOBAL_POLICY_SERVER_URL} + ${session}= Create Session policy ${GLOBAL_POLICY_HEALTHCHECK_URL} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Get Request policy ${POLICY_HEALTH_CHECK_PATH} headers=${headers} + Log Received response from policy ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be True ${resp.json()['healthy']} + @{ITEMS}= Copy List ${resp.json()['details']} + :FOR ${ELEMENT} IN @{ITEMS} + \ Should Be Equal As Strings ${ELEMENT['code']} 200 + \ Should Be True ${ELEMENT['healthy']} + +Run Policy Put Request + [Documentation] Runs Policy Put request + [Arguments] ${data_path} ${data} + Log Creating session ${GLOBAL_POLICY_SERVER_URL} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST + ${resp}= Put Request policy ${data_path} data=${data} headers=${headers} + Log Received response from policy ${resp.text} + [Return] ${resp} + +Run Policy Post Request + [Documentation] Runs Policy Post request + [Arguments] ${data_path} ${data} + Log Creating session ${GLOBAL_POLICY_SERVER_URL} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST + ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} + Log Received response from policy ${resp.text} + [Return] ${resp} + +Run Policy Delete Request + [Documentation] Runs Policy Delete request + [Arguments] ${data_path} ${data} + Log Creating session ${GLOBAL_POLICY_SERVER_URL} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST + ${resp}= Delete Request policy ${data_path} data=${data} headers=${headers} + Log Received response from policy ${resp.text} + [Return] ${resp} + +Run Policy Get Configs Request + [Documentation] Runs Policy Get Configs request + [Arguments] ${data_path} ${data} + Log Creating session ${GLOBAL_POLICY_SERVER_URL} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} + ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} + Log Received response from policy ${resp.text} + [Return] ${resp} diff --git a/tests/policy/engine/pushpolicy.template b/tests/policy/engine/pushpolicy.template new file mode 100644 index 00000000..7e236e3d --- /dev/null +++ b/tests/policy/engine/pushpolicy.template @@ -0,0 +1,5 @@ +{ + "policyName":"${policy_name}", + "policyType":"${policy_type}", + "pdpGroup":"default" +} \ No newline at end of file diff --git a/tests/policy/engine/sdncnamingpolicy_vFW.template b/tests/policy/engine/sdncnamingpolicy_vFW.template new file mode 100644 index 00000000..d9c773d1 --- /dev/null +++ b/tests/policy/engine/sdncnamingpolicy_vFW.template @@ -0,0 +1,11 @@ +{ + "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": "${policy_name}", + "policyConfigType": "MicroService", + "onapName": "SDNC", + "riskLevel": "4", + "riskType": "test", + "guard": "false", + "priority": "4", + "description": "ONAP_VFW_NAMING_TIMESTAMP" +} \ No newline at end of file diff --git a/tests/policy/engine/sdncnamingpolicy_vPG.template b/tests/policy/engine/sdncnamingpolicy_vPG.template new file mode 100644 index 00000000..9bae20a1 --- /dev/null +++ b/tests/policy/engine/sdncnamingpolicy_vPG.template @@ -0,0 +1,11 @@ +{ + "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": "${policy_name}", + "policyName": "${policy_name}", + "policyConfigType": "MicroService", + "onapName": "SDNC", + "riskLevel": "4", + "riskType": "test", + "guard": "false", + "priority": "4", + "description": "ONAP_VPG_NAMING_TIMESTAMP" +} \ No newline at end of file diff --git a/tests/policy/suite1/Policy-CSIT.robot b/tests/policy/suite1/Policy-CSIT.robot deleted file mode 100644 index 514cc840..00000000 --- a/tests/policy/suite1/Policy-CSIT.robot +++ /dev/null @@ -1,403 +0,0 @@ -*** Settings *** -Documentation Policy ONAP CSIT Test cases -Library String -Library HttpLibrary.HTTP -LIbrary Process -Library BuiltIn -Resource policy_interface.robot -Resource json_templater.robot - -*** Variables *** -${RESOURCE_PATH_CREATE} /pdp/api/createPolicy -${RESOURCE_PATH_CREATE_PUSH} /pdp/api/pushPolicy -${RESOURCE_PATH_CREATE_DELETE} /pdp/api/deletePolicy -${RESOURCE_PATH_GET_CONFIG} /pdp/api/getConfig -${RESOURCE_PATH_LISTPOLICY} /pdp/api/listPolicy -${CREATE_CONFIG_VFW_TEMPLATE} ${CURDIR}/configpolicy_vFW_R1.template -${CREATE_CONFIG_VDNS_TEMPLATE} ${CURDIR}/configpolicy_vDNS_R1.template -${CREATE_CONFIG_VCPE_TEMPLATE} ${CURDIR}/configpolicy_vCPE_R1.template -${CREATE_OPS_VFW_TEMPLATE} ${CURDIR}/opspolicy_VFW_R1.template -${CREATE_OOF_HPA_TEMPLATE} ${CURDIR}/oofpolicy_HPA_R1.template -${CREATE_SDNC_VFW_TEMPLATE} ${CURDIR}/sdncnamingpolicy_vFW.template -${CREATE_SDNC_VPG_TEMPLATE} ${CURDIR}/sdncnamingpolicy_vPG.template -${PUSH_POLICY_TEMPLATE} ${CURDIR}/pushpolicy.template -${MULTIPLE_PUSH_POLICY_TEMPLATE} ${CURDIR}/multiple_pushpolicy.template -${MULTIPLE_UNPUSH_POLICY_TEMPLATE} ${CURDIR}/multiple_unpushpolicy.template -${CREATE_OPS_VDNS_TEMPLATE} ${CURDIR}/opspolicy_VDNS_R1.template -${DEL_POLICY_TEMPLATE} ${CURDIR}/deletepolicy.template -${GETCONFIG_TEMPLATE} ${CURDIR}/getconfigpolicy.template -${GETOOF_TEMPLATE} ${CURDIR}/getoofpolicy.template -${LISTPOLICY_TEMPLATE} ${CURDIR}/listpolicy.template -${CONFIG_POLICY_VFW_NAME} vFirewall -${CONFIG_POLICY_VFW_TYPE} MicroService -${CONFIG_POLICY_VDNS_NAME} vLoadBalancer -${CONFIG_POLICY_VDNS_TYPE} MicroService -${OPS_POLICY_VFW_NAME} vFirewall -${OPS_POLICY_VFW_TYPE} BRMS_PARAM -${OPS_POLICY_VDNS_NAME} vLoadBalancer -${OPS_POLICY_VDNS_TYPE} BRMS_PARAM -${CONFIG_POLICY_VCPE_NAME} vCPE -${CONFIG_POLICY_VCPE_TYPE} MicroService -${OPS_POLICY_VCPE_NAME} vCPE -${OPS_POLICY_VCPE_TYPE} BRMS_PARAM -${OPS_POLICY_VOLTE_NAME} VoLTE -${OPS_POLICY_VOLTE_TYPE} BRMS_PARAM -${OOF_POLICY_HPA_NAME} HPA -${OOF_POLICY_HPA_TYPE} Optimization -${SDNC_POLICY_VFW_NAME} ONAP_vFW_Naming -${SDNC_POLICY_VPG_NAME} ONAP_vPG_Naming -${MULTIPLE_PUSH_POLICY_NAME1} com.testBase1 -${MULTIPLE_PUSH_POLICY_NAME2} com.testBase2 -${MULTIPLE_PUSH_POLICY_NAME3} com.testBase3 -${file_path} ../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl -${RESOURCE_PATH_UPLOAD} /pdp/api/policyEngineImport?importParametersJson=%7B%22serviceName%22%3A%22Manyu456%22%2C%20%22serviceType%22%3A%22BRMSPARAM%22%7D -${CREATE_OPS_VCPE_TEMPLATE} ${CURDIR}/opspolicy_vCPE_R1.template -${CREATE_OPS_VOLTE_TEMPLATE} ${CURDIR}/opspolicy_vOLTE_R1.template - - -*** Test Cases *** -Policy Health check - Run Policy Health Check - -VFW Config Policy - ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy - Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} - #VFW Policy Tests - -VDNS Config Policy - ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy - Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE} - #VDNS Policy Tests - -VCPE Config Policy - ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy - Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE} - #VCPE Policy Tests - -VFW Ops Policy - ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy - Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE} - -VDNS Ops Policy - ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy - Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE} - -VCPE Ops Policy - ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy - Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE} - -VOLTE Ops Policy - ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy - Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE} - #VOLTE Policy Tests - -VFW SDNC Naming Policy - ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy - Push Config Policy ${SDNC_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} - #VFW Policy Tests - -VPG SDNC Naming Policy - ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy - Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE} - #VPG Policy Tests - -HPA OOF Policy - ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy - Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE} - #HPA Policy Tests - -VFW Get Configs Policy - Sleep 5s - Get Configs VFW Policy - -VDNS Get Configs Policy - Sleep 5s - Get Configs VDNS Policy - -VCPE Get Configs Policy - Sleep 5s - Get Configs VCPE Policy - -HPA Get OOF Policy - Sleep 5s - Get OOF HPA Policy - -ListPolicy - ListPolicy test com.Config_Sample.1.xml - -Multiple Push Policy - ${MULTIPLE_PUSH_POLICY_NAME1}= Create Ops VDNS Policy - ${MULTIPLE_PUSH_POLICY_NAME2}= Create Ops VDNS Policy - ${MULTIPLE_PUSH_POLICY_NAME3}= Create Ops VDNS Policy - Push Multiple Policy test ${MULTIPLE_PUSH_POLICY_NAME1} ${MULTIPLE_PUSH_POLICY_NAME2} ${MULTIPLE_PUSH_POLICY_NAME3} ${OPS_POLICY_VDNS_TYPE} - Sleep 5s - Delete Multiple Policy test ${MULTIPLE_PUSH_POLICY_NAME1} ${MULTIPLE_PUSH_POLICY_NAME2} ${MULTIPLE_PUSH_POLICY_NAME3} ${OPS_POLICY_VDNS_TYPE} - -*** Keywords *** - -VFW Policy Tests - ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy - Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} - Get Configs VFW Policy - ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy - Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE} - ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy - Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} - -VDNS Policy Tests - ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy - Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE} - Get Configs VDNS Policy - ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy - Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE} - -VCPE Policy Tests - ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy - Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE} - Get Configs VCPE Policy - ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy - Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE} - -VPG Policy Tests - ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy - Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE} - -VOLTE Policy Tests - ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy - Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE} - -HPA Policy Tests - ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy - Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE} - Get OOF HPA Policy - -Get Configs VFW Policy - [Documentation] Get Config Policy for VFW - ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VFW_NAME}* - ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} - ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} - Should Be Equal As Strings ${get_resp.status_code} 200 - -Create OOF HPA Policy - [Documentation] Create OOF Policy - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_HPA - ${OOF_POLICY_HPA_NAME}= Set Test Variable ${policyname1} - ${hpapolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_OOF_HPA_TEMPLATE} ${hpapolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Log ${put_resp} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Get OOF HPA Policy - [Documentation] Get OOF Policy for HPA - ${gethpapolicy}= Catenate .*${OOF_POLICY_HPA_NAME}* - ${hpapolicy_name}= Create Dictionary oof_policy_name=${gethpapolicy} - ${output} = Fill JSON Template File ${GETOOF_TEMPLATE} ${hpapolicy_name} - ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} - Should Be Equal As Strings ${get_resp.status_code} 200 - -Create Config VFW Policy - [Documentation] Create Config Policy - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vFirewall - ${CONFIG_POLICY_VFW_NAME}= Set Test Variable ${policyname1} - ${configpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_CONFIG_VFW_TEMPLATE} ${configpolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create VPG SDNC Naming Policy - [Documentation] Create VPG SDNC Naming Policy - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_ONAP_vPG_Naming - ${SDNC_POLICY_VPG_NAME}= Set Test Variable ${policyname1} - ${sdncpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_SDNC_VPG_TEMPLATE} ${sdncpolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create VFW SDNC Naming Policy - [Documentation] Create VFW SDNC Naming Policy - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_ONAP_vFW_Naming - ${SDNC_POLICY_VFW_NAME}= Set Test Variable ${policyname1} - ${sdncpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_SDNC_VFW_TEMPLATE} ${sdncpolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create Policy Name - [Documentation] Generate Policy Name - [Arguments] ${prefix}=CSIT_ - ${random}= Generate Random String 15 [LOWER][NUMBERS] - ${policyname}= Catenate ${prefix}${random} - [Return] ${policyname} - -Create Ops VFW Policy - [Documentation] Create Operational Policy - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vFirewall - ${OPS_POLICY_VFW_NAME}= Set Test Variable ${policyname1} - ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_OPS_VFW_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Log ${put_resp} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Push Ops Policy - [Documentation] Push Ops Policy - [Arguments] ${policyname} ${policytype} - ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} - ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Push Config Policy - [Documentation] Push Config Policy - [Arguments] ${policyname} ${policytype} - ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} - ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Delete Ops Policy - [Documentation] Delete Config Policy - [Arguments] ${policy_name} - ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml - ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Delete Config Policy - [Documentation] Delete Ops Policy - [Arguments] ${policy_name} - ${policyname3}= Catenate com.Config_MS_com.${policy_name}.1.xml - ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Delete OOF Policy - [Documentation] Delete OOF Policy - [Arguments] ${policy_name} - ${policyname3}= Catenate com.Config_OOF_${policy_name}.1.xml - ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Get Configs VDNS Policy - [Documentation] Get Config Policy for VDNS - ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VDNS_NAME}* - ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} - ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} - Should Be Equal As Strings ${get_resp.status_code} 200 - -Create Config VDNS Policy - [Documentation] Create Config Policy - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer - ${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} - ${configpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_CONFIG_VDNS_TEMPLATE} ${configpolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create Ops VDNS Policy - [Documentation] Create Operational Policy - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer - ${OPS_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} - ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_OPS_VDNS_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Log ${put_resp} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create Config VCPE Policy - [Documentation] Create Config Policy - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vCPE - ${CONFIG_POLICY_VCPE_NAME}= Set Test Variable ${policyname1} - ${configpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_CONFIG_VCPE_TEMPLATE} ${configpolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Get Configs VCPE Policy - [Documentation] Get Config Policy for VCPE - ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VCPE_NAME}* - ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} - ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} - Should Be Equal As Strings ${get_resp.status_code} 200 - -Create Ops vCPE Policy - [Documentation] Create Operational Policy - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vCPE - ${OPS_POLICY_VCPE_NAME}= Set Test Variable ${policyname1} - ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_OPS_VCPE_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Log ${put_resp} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create Ops VolTE Policy - [Documentation] Create Operational Policy - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_VoLTE - ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_OPS_VOLTE_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Log ${put_resp} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Upload DRL file - [Documentation] Upload DRL file1 - ${file_data}= Get Binary File ${file_path} - ${files}= Create Dictionary file=${file_data} - #${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} - # ${files2} = {'file': open('../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl', 'rb')} - # ${files}= Create Dictionary file ${file_data} - ${put_resp} = Run Policy Post form Request ${RESOURCE_PATH_UPLOAD} ${files} - Should Be Equal As Strings ${put_resp.status_code} 200 - -ListPolicy test - [Documentation] Listing Config Policies - [Arguments] ${policy_name} - ${dict}= Create Dictionary policy_name=${policy_name} - ${output} = Fill JSON Template File ${LISTPOLICY_TEMPLATE} ${dict} - ${put_resp} = policy_interface.Run Policy Post Request ${RESOURCE_PATH_LISTPOLICY} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Push Multiple Policy test - [Documentation] Push Multiple Policy - [Arguments] ${policyname1} ${policyname2} ${policyname3} ${policytype} - ${dict}= Create Dictionary policy_name1=${policyname1} policy_name2=${policyname2} policy_name3=${policyname3} policy_type=${policytype} - ${output} = Fill JSON Template File ${MULTIPLE_PUSH_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Delete Multiple Policy test - [Documentation] Delete Multiple Policy - [Arguments] ${policyname1} ${policyname2} ${policyname3} ${policytype} - ${dict}= Create Dictionary policy_name1=${policyname1} policy_name2=${policyname2} policy_name3=${policyname3} policy_type=${policytype} - ${output} = Fill JSON Template File ${MULTIPLE_UNPUSH_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - diff --git a/tests/policy/suite1/__init__.robot b/tests/policy/suite1/__init__.robot deleted file mode 100644 index c7970e6a..00000000 --- a/tests/policy/suite1/__init__.robot +++ /dev/null @@ -1,2 +0,0 @@ -*** Settings *** -Documentation Policy - Suite 1 diff --git a/tests/policy/suite1/configpolicy_vCPE.template b/tests/policy/suite1/configpolicy_vCPE.template deleted file mode 100644 index e3e3a2d0..00000000 --- a/tests/policy/suite1/configpolicy_vCPE.template +++ /dev/null @@ -1,6 +0,0 @@ -{ -"configBody": "{ \"service\": \"policy_tosca_tca\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevCPE\", \"description\": \"MicroService vCPE Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.0.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"MAJOR\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ABATED\", \"closedLoopControlName\": \"CL-vCPEvGMUX-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241ABA1\", \"version\": \"1.0.2\", \"direction\": \"EQUAL\" }, { \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\", \"thresholdValue\": \"1000\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"CL-vCPEvGMUX-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241ABA1\", \"version\": \"1.0.2\", \"direction\": \"GREATER_OR_EQUAL\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"eventName\": \"vCPEvGMUXPacketLoss\" } }", -"policyConfigType": "MicroService", -"policyName": "${policy_name}", -"ecompName": "DCAE" -} diff --git a/tests/policy/suite1/configpolicy_vCPE_R1.template b/tests/policy/suite1/configpolicy_vCPE_R1.template deleted file mode 100644 index 77653c3f..00000000 --- a/tests/policy/suite1/configpolicy_vCPE_R1.template +++ /dev/null @@ -1,7 +0,0 @@ -{ - "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\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"MAJOR\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ABATED\", \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"direction\": \"EQUAL\" }, { \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"direction\": \"GREATER\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"eventName\": \"Measurement_vGMUX\" } }", - "policyConfigType": "MicroService", - "policyName": "${policy_name}", - "onapName": "DCAE", - "priority": "5" -} diff --git a/tests/policy/suite1/configpolicy_vDNS.template b/tests/policy/suite1/configpolicy_vDNS.template deleted file mode 100644 index ab1d2e0d..00000000 --- a/tests/policy/suite1/configpolicy_vDNS.template +++ /dev/null @@ -1,6 +0,0 @@ -{ -"configBody": "{\"service\": \"policy_tosca_tca\",\"location\": \"TestMSLocation\",\"uuid\": \"/services/cdap-tca-hi-lo/instances/dfw1/configuration/metricsPerFunctionalRole/vLoadBalancer\",\"policyName\": \"vLoadBalancer\",\"description\": \"vLoadBalancer\",\"configName\": \"TestConfigName\",\"templateVersion\": \"1607\",\"version\": \"8.7.6.5\",\"priority\": \"1\",\"policyScope\": \"resource=TestResource,service=TestService,type=TestType,closedLoopControlName=TestClosedLoop\",\"riskType\": \"test\",\"riskLevel\": \"2\",\"guard\": \"False\",\"content\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"500\",\"closedLoopControlName\": \"CL-LBAL-LOW-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241AB1A\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"5000\",\"closedLoopControlName\": \"CL-LBAL-HIGH-TRAFFIC-SIG-0C5920A6-B564-8035-C878-0E814352BC2B\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"configuration.ae.microservice.tca.xml\",\"functionalRole\": \"ClosedLoop_F5-d925ed73-8231-4d02-9545-db4e101f88f8\"}}", -"policyConfigType": "MicroService", -"policyName": "${policy_name}", -"ecompName": "DCAE" -} \ No newline at end of file diff --git a/tests/policy/suite1/configpolicy_vDNS_R1.template b/tests/policy/suite1/configpolicy_vDNS_R1.template deleted file mode 100644 index 185a7c72..00000000 --- a/tests/policy/suite1/configpolicy_vDNS_R1.template +++ /dev/null @@ -1,7 +0,0 @@ -{ - "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\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": \"300\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"version\": \"1.0.2\", \"direction\": \"GREATER_OR_EQUAL\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"eventName\": \"vLoadBalancer\" } }", - "policyConfigType": "MicroService", - "policyName": "${policy_name}", - "onapName": "DCAE", - "priority": "5" -} diff --git a/tests/policy/suite1/configpolicy_vFW.template b/tests/policy/suite1/configpolicy_vFW.template deleted file mode 100644 index 39e99e7b..00000000 --- a/tests/policy/suite1/configpolicy_vFW.template +++ /dev/null @@ -1,6 +0,0 @@ -{ -"configBody": "{\"service\": \"policy_tosca_tca\",\"location\": \"Ravi\",\"uuid\": \"/services/cdap-tca-hi-lo/instances/dfw1/configuration/metricsPerFunctionalRole/vFireWall\",\"policyName\": \"vFireWall\",\"description\": \"vFireWall\",\"configName\": \"TestConfigName\",\"templateVersion\": \"1607\",\"version\": \"8.7.6.5\",\"priority\": \"1\",\"policyScope\": \"resource=TestResource,service=TestService,type=TestType,closedLoopControlName=TestClosedLoop\",\"riskType\": \"test\",\"riskLevel\": \"2\",\"guard\": \"False\",\"content\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"4000\",\"closedLoopControlName\": \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"20000\",\"closedLoopControlName\": \"CL-FRWL-HIGH-TRAFFIC-SIG-EA36FE84-9342-5E13-A656-EC5F21309A09\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"configuration.ae.microservice.tca.xml\",\"functionalRole\": \"ClosedLoop_F5-d925ed73-8231-4d02-9545-db4e101f88f8\"}}", -"policyConfigType": "MicroService", -"policyName": "${policy_name}", -"ecompName": "DCAE" -} \ No newline at end of file diff --git a/tests/policy/suite1/configpolicy_vFW_R1.template b/tests/policy/suite1/configpolicy_vFW_R1.template deleted file mode 100644 index 067ed07f..00000000 --- a/tests/policy/suite1/configpolicy_vFW_R1.template +++ /dev/null @@ -1,7 +0,0 @@ -{ - "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\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\": \"300\",\"closedLoopEventStatus\": \"ONSET\",\"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\": \"700\",\"closedLoopEventStatus\": \"ONSET\",\"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"DCAE.Config_tca-hi-lo\",\"controlLoopSchemaType\": \"VNF\",\"policyScope\": \"DCAE\",\"eventName\": \"vFirewallBroadcastPackets\"}}", - "policyConfigType": "MicroService", - "policyName": "${policy_name}", - "onapName": "DCAE", - "priority": "5" -} diff --git a/tests/policy/suite1/createpolicy.template b/tests/policy/suite1/createpolicy.template deleted file mode 100644 index 7c693e84..00000000 --- a/tests/policy/suite1/createpolicy.template +++ /dev/null @@ -1,21 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "policyDescription": "Create BRMS Param policy", - "attributes": { - "RULE": { - "templateName": "ClosedLoopDemo_closedLoopControlName", - "aaiNamedQueryUUID": "2", - "aaiPassword": "2", - "aaiPatternMatch": "2", - "aaiURL": "2", - "actor": "2", - "appcTopic": "2", - "closedLoopControlName": "2", - "msoPassword": "2", - "msoURL": "2", - "msoUsername": "2", - "aaiUsername": "3" - } - } -} diff --git a/tests/policy/suite1/deletepolicy.template b/tests/policy/suite1/deletepolicy.template deleted file mode 100644 index 55510102..00000000 --- a/tests/policy/suite1/deletepolicy.template +++ /dev/null @@ -1,5 +0,0 @@ -{ - "pdpGroup": "default", - "policyComponent": "PDP", - "policyName": "${policy_name}" -} diff --git a/tests/policy/suite1/getconfigpolicy.template b/tests/policy/suite1/getconfigpolicy.template deleted file mode 100644 index 611e65d0..00000000 --- a/tests/policy/suite1/getconfigpolicy.template +++ /dev/null @@ -1,8 +0,0 @@ -{ - "configAttributes" : { - }, - "configName" : ".*", - "ecompName" : "DCAE", - "policyName" : "${config_policy_name}", - "unique" : false -} \ No newline at end of file diff --git a/tests/policy/suite1/getoofpolicy.template b/tests/policy/suite1/getoofpolicy.template deleted file mode 100644 index 37fe0471..00000000 --- a/tests/policy/suite1/getoofpolicy.template +++ /dev/null @@ -1,6 +0,0 @@ -{ - "configAttributes" : { - }, - "policyName" : "${oof_policy_name}", - "unique" : false -} diff --git a/tests/policy/suite1/global_properties.robot b/tests/policy/suite1/global_properties.robot deleted file mode 100644 index e0c816ea..00000000 --- a/tests/policy/suite1/global_properties.robot +++ /dev/null @@ -1,30 +0,0 @@ -*** Settings *** -Documentation store all properties that can change or are used in multiple places here -... format is all caps with underscores between words and prepended with GLOBAL -... make sure you prepend them with GLOBAL so that other files can easily see it is from this file. - - -*** Variables *** -${GLOBAL_APPLICATION_ID} robot-ete -${GLOBAL_MSO_STATUS_PATH} /ecomp/mso/infra/orchestrationRequests/v2/ -${GLOBAL_SELENIUM_BROWSER} chrome -${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} Create Dictionary -${GLOBAL_SELENIUM_DELAY} 0 -${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} 5 -${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} 15 -${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} orchestration -${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} volume -${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} compute -${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} network -${GLOBAL_OPENSTACK_GLANCE_SERVICE_TYPE} image -${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} identity -${GLOBAL_AAI_CLOUD_OWNER} Rackspace -${GLOBAL_BUILD_NUMBER} 31 -${GLOBAL_VM_PRIVATE_KEY} ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pvt -# policy info - everything is from the private oam network (also called ecomp private network) -${GLOBAL_POLICY_SERVER_URL} https://%{PDP_IP}:8081 -${GLOBAL_POLICY_AUTH} dGVzdHBkcDphbHBoYTEyMw== -${GLOBAL_POLICY_CLIENTAUTH} cHl0aG9uOnRlc3Q= -${GLOBAL_POLICY_HEALTHCHECK_URL} https://%{POLICY_IP}:6969 -${GLOBAL_POLICY_USERNAME} demo@people.osaaf.org -${GLOBAL_POLICY_PASSWORD} demo123456! diff --git a/tests/policy/suite1/json_templater.robot b/tests/policy/suite1/json_templater.robot deleted file mode 100644 index a1cc7e35..00000000 --- a/tests/policy/suite1/json_templater.robot +++ /dev/null @@ -1,21 +0,0 @@ -*** Settings *** -Documentation This resource is filling out json string templates and returning the json back -Library RequestsLibrary -Library eteutils/StringTemplater.py -Library OperatingSystem -Resource global_properties.robot - -*** Keywords *** -Fill JSON Template - [Documentation] Runs substitution on template to return a filled in json - [Arguments] ${json} ${arguments} - ${returned_string}= Template String ${json} ${arguments} - ${returned_json}= To Json ${returned_string} - [Return] ${returned_json} - -Fill JSON Template File - [Documentation] Runs substitution on template to return a filled in json - [Arguments] ${json_file} ${arguments} - ${json}= OperatingSystem.Get File ${json_file} - ${returned_json}= Fill JSON Template ${json} ${arguments} - [Return] ${returned_json} \ No newline at end of file diff --git a/tests/policy/suite1/listpolicy.template b/tests/policy/suite1/listpolicy.template deleted file mode 100644 index aef17a23..00000000 --- a/tests/policy/suite1/listpolicy.template +++ /dev/null @@ -1,3 +0,0 @@ -{ - "policyName": "${policy_name}" -} diff --git a/tests/policy/suite1/multiple_pushpolicy.template b/tests/policy/suite1/multiple_pushpolicy.template deleted file mode 100644 index 5f20b647..00000000 --- a/tests/policy/suite1/multiple_pushpolicy.template +++ /dev/null @@ -1,5 +0,0 @@ -{ - "policyName":"${policy_name1},${policy_name2},${policy_name3}", - "policyType":"${policy_type}", - "pdpGroup":"default" -} diff --git a/tests/policy/suite1/multiple_unpushpolicy.template b/tests/policy/suite1/multiple_unpushpolicy.template deleted file mode 100644 index afee7aeb..00000000 --- a/tests/policy/suite1/multiple_unpushpolicy.template +++ /dev/null @@ -1,6 +0,0 @@ -{ - "policyName": "${policy_name1},${policy_name2},${policy_name3}", - "policyType": "${policy_type}", - "policyComponent": "PDP", - "pdpGroup": "default" -} diff --git a/tests/policy/suite1/oofpolicy_HPA_R1.template b/tests/policy/suite1/oofpolicy_HPA_R1.template deleted file mode 100644 index 3a170b20..00000000 --- a/tests/policy/suite1/oofpolicy_HPA_R1.template +++ /dev/null @@ -1,6 +0,0 @@ -{ - "configBody": "{\"service\":\"hpaPolicy\",\"policyName\":\"testWorkingTOSCA\",\"description\":\"testing\",\"templateVersion\":\"OpenSource.version.1\",\"version\":\"CSIT\",\"priority\":\"5\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"testIdentity\",\"policyScope\":[\"test1\",\"test2\",\"test3\"],\"policyType\":\"hpaPolicy\",\"resources\":\"testResources1\",\"flavorFeatures\":[{\"flavorLabel\":\"testFlavor\",\"flavorProperties\":[{\"score\":\"testScore\",\"featureAttributes\":[{\"unit\":\"testUnit\",\"attribute\":\"teatFeatureAttribute\",\"value\":\"testValue\",\"operator\":\"any\"}],\"mandatory\":\"testMandatory\",\"hpaFeature\":\"testHAPFeature\",\"architecture\":\"testArch\"}]}]}}", - "policyConfigType": "Optimization", - "policyName": "${policy_name}", - "onapName": "OOF" -} diff --git a/tests/policy/suite1/opspolicy_VDNS.template b/tests/policy/suite1/opspolicy_VDNS.template deleted file mode 100644 index 801773d5..00000000 --- a/tests/policy/suite1/opspolicy_VDNS.template +++ /dev/null @@ -1,26 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "policyDescription": "Create BRMS Param policy for vLB", - "attributes": { - "MATCHING": { - "controller": "vDNS" - }, - "RULE": { - "templateName": "ControlLoopDemo__closedLoopControlName", - "closedLoopControlName": "CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8", - "policyVersion": "v1.0", - "actor": "MSO", - "aaiNamedQueryUUID": "4ff56a54-9e3f-46b7-a337-07a1d3c6b469", - "aaiURL": "https://aai.api.simpledemo.openecomp.org:8443/aai/search/named-query", - "aaiUsername": "POLICY", - "aaiPassword": "POLICY", - "msoURL": "http://vm1.mso.simpledemo.openecomp.org:8080/ecomp/mso/infra", - "msoUsername": "InfraPortalClient", - "msoPassword": "password11", - "aaiPatternMatch": 0, - "notificationTopic": "POLICY-CL-MGT", - "appcTopic": "APPC-CL" - } - } -} \ No newline at end of file diff --git a/tests/policy/suite1/opspolicy_VDNS_R1.template b/tests/policy/suite1/opspolicy_VDNS_R1.template deleted file mode 100644 index 92627cc2..00000000 --- a/tests/policy/suite1/opspolicy_VDNS_R1.template +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "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%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0D%0A++trigger_policy%3A+unique-policy-id-1-scale-up%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-scale-up%0D%0A++++name%3A+Create+a+new+VF+Module%0D%0A++++description%3A%0D%0A++++actor%3A+SO%0D%0A++++recipe%3A+VF+Module+Create%0D%0A++++target%3A%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%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" - } - } -} \ No newline at end of file diff --git a/tests/policy/suite1/opspolicy_VFW.template b/tests/policy/suite1/opspolicy_VFW.template deleted file mode 100644 index 224f5cf4..00000000 --- a/tests/policy/suite1/opspolicy_VFW.template +++ /dev/null @@ -1,24 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "policyDescription": "Create BRMS Param policy for vFW", - "attributes": { - "RULE": { - "templateName": "ControlLoopDemo__closedLoopControlName", - "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "policyVersion": "v1.0", - "aaiNamedQueryUUID": "null", - "aaiPassword": "null", - "aaiURL": "null", - "actor": "APPC", - "appcTopic": "APPC-CL", - "msoPassword": "null", - "msoURL": "null", - "msoUsername": "null", - "aaiUsername": "null", - "notificationTopic": "POLICY-CL-MGT", - "aaiPatternMatch": 1 - } - } -} - diff --git a/tests/policy/suite1/opspolicy_VFW_R1.template b/tests/policy/suite1/opspolicy_VFW_R1.template deleted file mode 100644 index a93063f7..00000000 --- a/tests/policy/suite1/opspolicy_VFW_R1.template +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "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" - } - } -} diff --git a/tests/policy/suite1/opspolicy_vCPE.template b/tests/policy/suite1/opspolicy_vCPE.template deleted file mode 100644 index c17a1bc6..00000000 --- a/tests/policy/suite1/opspolicy_vCPE.template +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "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+%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" - } - } -} \ No newline at end of file diff --git a/tests/policy/suite1/opspolicy_vCPE_R1.template b/tests/policy/suite1/opspolicy_vCPE_R1.template deleted file mode 100644 index 36695daa..00000000 --- a/tests/policy/suite1/opspolicy_vCPE_R1.template +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "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" - } - } -} \ No newline at end of file diff --git a/tests/policy/suite1/opspolicy_vOLTE.template b/tests/policy/suite1/opspolicy_vOLTE.template deleted file mode 100644 index e43a3e6f..00000000 --- a/tests/policy/suite1/opspolicy_vOLTE.template +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "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+%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" - } - } -} \ No newline at end of file diff --git a/tests/policy/suite1/opspolicy_vOLTE_R1.template b/tests/policy/suite1/opspolicy_vOLTE_R1.template deleted file mode 100644 index ff5fc42c..00000000 --- a/tests/policy/suite1/opspolicy_vOLTE_R1.template +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "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" - } - } -} \ No newline at end of file diff --git a/tests/policy/suite1/policy_interface.robot b/tests/policy/suite1/policy_interface.robot deleted file mode 100644 index 745f7817..00000000 --- a/tests/policy/suite1/policy_interface.robot +++ /dev/null @@ -1,70 +0,0 @@ -*** Settings *** -Documentation The main interface for interacting with Policy. It handles low level stuff like managing the http request library and Policy required fields -Library eteutils/RequestsClientCert.py -#Library RequestsClientCert -Library RequestsLibrary -Library String -Library eteutils/JSONUtils.py -#Library JSONUtils -Library Collections -Resource global_properties.robot - -*** Variables *** -${POLICY_HEALTH_CHECK_PATH} /healthcheck - -*** Keywords *** - -Run Policy Health Check - [Documentation] Runs Policy Health check - ${auth}= Create List ${GLOBAL_POLICY_USERNAME} ${GLOBAL_POLICY_PASSWORD} - Log Creating session ${GLOBAL_POLICY_SERVER_URL} - ${session}= Create Session policy ${GLOBAL_POLICY_HEALTHCHECK_URL} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= Get Request policy ${POLICY_HEALTH_CHECK_PATH} headers=${headers} - Log Received response from policy ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - Should Be True ${resp.json()['healthy']} - @{ITEMS}= Copy List ${resp.json()['details']} - :FOR ${ELEMENT} IN @{ITEMS} - \ Should Be Equal As Strings ${ELEMENT['code']} 200 - \ Should Be True ${ELEMENT['healthy']} - -Run Policy Put Request - [Documentation] Runs Policy Put request - [Arguments] ${data_path} ${data} - Log Creating session ${GLOBAL_POLICY_SERVER_URL} - ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST - ${resp}= Put Request policy ${data_path} data=${data} headers=${headers} - Log Received response from policy ${resp.text} - [Return] ${resp} - -Run Policy Post Request - [Documentation] Runs Policy Post request - [Arguments] ${data_path} ${data} - Log Creating session ${GLOBAL_POLICY_SERVER_URL} - ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST - ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} - Log Received response from policy ${resp.text} - [Return] ${resp} - -Run Policy Delete Request - [Documentation] Runs Policy Delete request - [Arguments] ${data_path} ${data} - Log Creating session ${GLOBAL_POLICY_SERVER_URL} - ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST - ${resp}= Delete Request policy ${data_path} data=${data} headers=${headers} - Log Received response from policy ${resp.text} - [Return] ${resp} - -Run Policy Get Configs Request - [Documentation] Runs Policy Get Configs request - [Arguments] ${data_path} ${data} - Log Creating session ${GLOBAL_POLICY_SERVER_URL} - ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} - ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} - Log Received response from policy ${resp.text} - [Return] ${resp} diff --git a/tests/policy/suite1/pushpolicy.template b/tests/policy/suite1/pushpolicy.template deleted file mode 100644 index 7e236e3d..00000000 --- a/tests/policy/suite1/pushpolicy.template +++ /dev/null @@ -1,5 +0,0 @@ -{ - "policyName":"${policy_name}", - "policyType":"${policy_type}", - "pdpGroup":"default" -} \ No newline at end of file diff --git a/tests/policy/suite1/sdncnamingpolicy_vFW.template b/tests/policy/suite1/sdncnamingpolicy_vFW.template deleted file mode 100644 index d9c773d1..00000000 --- a/tests/policy/suite1/sdncnamingpolicy_vFW.template +++ /dev/null @@ -1,11 +0,0 @@ -{ - "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": "${policy_name}", - "policyConfigType": "MicroService", - "onapName": "SDNC", - "riskLevel": "4", - "riskType": "test", - "guard": "false", - "priority": "4", - "description": "ONAP_VFW_NAMING_TIMESTAMP" -} \ No newline at end of file diff --git a/tests/policy/suite1/sdncnamingpolicy_vPG.template b/tests/policy/suite1/sdncnamingpolicy_vPG.template deleted file mode 100644 index 9bae20a1..00000000 --- a/tests/policy/suite1/sdncnamingpolicy_vPG.template +++ /dev/null @@ -1,11 +0,0 @@ -{ - "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": "${policy_name}", - "policyName": "${policy_name}", - "policyConfigType": "MicroService", - "onapName": "SDNC", - "riskLevel": "4", - "riskType": "test", - "guard": "false", - "priority": "4", - "description": "ONAP_VPG_NAMING_TIMESTAMP" -} \ No newline at end of file -- cgit 1.2.3-korg