From 1f339f886d01c6d6ac5cfd6467850c61fee4f675 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Fri, 17 Feb 2023 15:14:07 +0000 Subject: Restructure of csit files to be used both by docker and k8s config Issue-ID: POLICY-4125 Change-Id: Id63b3badb1b451b36e3226970dcafaa5a62d860f Signed-off-by: adheli.tavares --- csit/xacml-pdp/plans/setup.sh | 65 --------- csit/xacml-pdp/plans/teardown.sh | 21 --- csit/xacml-pdp/plans/testplan.txt | 3 - .../data/onap.policy.guard.decision.request.json | 16 --- .../onap.policy.monitoring.decision.request.json | 9 -- .../data/onap.policy.naming.decision.request.json | 13 -- .../onap.policy.optimization.decision.request.json | 15 --- .../tests/data/vCPE.policy.input.tosca.deploy.json | 5 - csit/xacml-pdp/tests/xacml-pdp-test.robot | 150 --------------------- 9 files changed, 297 deletions(-) delete mode 100755 csit/xacml-pdp/plans/setup.sh delete mode 100755 csit/xacml-pdp/plans/teardown.sh delete mode 100644 csit/xacml-pdp/plans/testplan.txt delete mode 100644 csit/xacml-pdp/tests/data/onap.policy.guard.decision.request.json delete mode 100644 csit/xacml-pdp/tests/data/onap.policy.monitoring.decision.request.json delete mode 100644 csit/xacml-pdp/tests/data/onap.policy.naming.decision.request.json delete mode 100644 csit/xacml-pdp/tests/data/onap.policy.optimization.decision.request.json delete mode 100644 csit/xacml-pdp/tests/data/vCPE.policy.input.tosca.deploy.json delete mode 100644 csit/xacml-pdp/tests/xacml-pdp-test.robot (limited to 'csit/xacml-pdp') diff --git a/csit/xacml-pdp/plans/setup.sh b/csit/xacml-pdp/plans/setup.sh deleted file mode 100755 index 646605ff..00000000 --- a/csit/xacml-pdp/plans/setup.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# ============LICENSE_START======================================================= -# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright 2021-2023 Nordix Foundation. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= - -echo "Uninstall docker-py and reinstall docker." -python3 -m pip uninstall -y docker-py -python3 -m pip uninstall -y docker -python3 -m pip install -U docker - -sudo apt-get -y install libxml2-utils - -source "${SCRIPTS}"/get-versions.sh -bash "${SCRIPTS}"/get-models-examples.sh - -docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d xacml-pdp - -unset http_proxy https_proxy - -POLICY_API_IP=$(get-instance-ip.sh policy-api) -POLICY_API_PORT=30440 -MARIADB_IP=$(get-instance-ip.sh mariadb) -POLICY_PDPX_IP=$(get-instance-ip.sh policy-xacml-pdp) -POLICY_PDPX_PORT=30441 -SIM_IP=$(get-instance-ip.sh simulator) -POLICY_PAP_IP=$(get-instance-ip.sh policy-pap) -POLICY_PAP_PORT=30442 - -export SIM_IP - -echo XACML-PDP IP IS "${POLICY_PDPX_IP}" -echo API IP IS "${POLICY_API_IP}" -echo PAP IP IS "${POLICY_PAP_IP}" -echo MARIADB IP IS "${MARIADB_IP}" -echo SIM_IP IS "${SIM_IP}" - -# wait for the app to start up -"${SCRIPTS}"/wait_for_rest.sh localhost "${POLICY_PDPX_PORT}" - -DATA2=${WORKSPACE}/models/models-examples/src/main/resources/policies - -ROBOT_VARIABLES="" -ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR_DMAAP:${SCRIPTS}" -ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA2:${DATA2}" -ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PDPX_IP:${POLICY_PDPX_IP}" -ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PDPX_PORT:${POLICY_PDPX_PORT}" -ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" -ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_PORT:${POLICY_API_PORT}" -ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_IP:${POLICY_PAP_IP}" -ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_PORT:${POLICY_PAP_PORT}" diff --git a/csit/xacml-pdp/plans/teardown.sh b/csit/xacml-pdp/plans/teardown.sh deleted file mode 100755 index 6f77caa4..00000000 --- a/csit/xacml-pdp/plans/teardown.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# ============LICENSE_START======================================================= -# Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. -# Modifications copyright (c) 2022 Nordix Foundation. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# 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========================================================= - -docker-compose -f ${SCRIPTS}/docker-compose-all.yml down -v diff --git a/csit/xacml-pdp/plans/testplan.txt b/csit/xacml-pdp/plans/testplan.txt deleted file mode 100644 index c8ffa39f..00000000 --- a/csit/xacml-pdp/plans/testplan.txt +++ /dev/null @@ -1,3 +0,0 @@ -# Test suites are relative paths under [policy/docker.git]/csit/[project]/tests. -# Place the suites in run order. -xacml-pdp-test.robot diff --git a/csit/xacml-pdp/tests/data/onap.policy.guard.decision.request.json b/csit/xacml-pdp/tests/data/onap.policy.guard.decision.request.json deleted file mode 100644 index ee90feaa..00000000 --- a/csit/xacml-pdp/tests/data/onap.policy.guard.decision.request.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "ONAPName": "Guard", - "ONAPComponent": "Guard-component", - "ONAPInstance": "Guard-component-instance", - "requestId": "unique-request-guard-1", - "action": "guard", - "resource": { - "guard": { - "actor": "APPC", - "operation": "ModifyConfig", - "target": "f17face5-69cb-4c88-9e0b-7426db7edddd", - "requestId": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65", - "clname": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a" - } - } -} diff --git a/csit/xacml-pdp/tests/data/onap.policy.monitoring.decision.request.json b/csit/xacml-pdp/tests/data/onap.policy.monitoring.decision.request.json deleted file mode 100644 index 053fa36d..00000000 --- a/csit/xacml-pdp/tests/data/onap.policy.monitoring.decision.request.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ONAPName": "DCAE", - "ONAPComponent": "PolicyHandler", - "ONAPInstance": "622431a4-9dea-4eae-b443-3b2164639c64", - "action": "configure", - "resource": { - "policy-id": "onap.restart.tca" - } -} diff --git a/csit/xacml-pdp/tests/data/onap.policy.naming.decision.request.json b/csit/xacml-pdp/tests/data/onap.policy.naming.decision.request.json deleted file mode 100644 index 3833a241..00000000 --- a/csit/xacml-pdp/tests/data/onap.policy.naming.decision.request.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "ONAPName": "SDNC", - "ONAPComponent": "SDNC-component", - "ONAPInstance": "SDNC-component-instance", - "requestId": "unique-request-sdnc-1", - "action": "naming", - "resource": { - "nfRole": [], - "naming-type": [], - "property-name": [], - "policy-type": ["onap.policies.Naming"] - } -} diff --git a/csit/xacml-pdp/tests/data/onap.policy.optimization.decision.request.json b/csit/xacml-pdp/tests/data/onap.policy.optimization.decision.request.json deleted file mode 100644 index d997099c..00000000 --- a/csit/xacml-pdp/tests/data/onap.policy.optimization.decision.request.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "ONAPName": "OOF", - "ONAPComponent": "OOF-component", - "ONAPInstance": "OOF-component-instance", - "context" : { - "subscriberName": [] - }, - "action": "optimize", - "resource": { - "scope": [], - "services": [], - "resources": [], - "geography": [] - } -} diff --git a/csit/xacml-pdp/tests/data/vCPE.policy.input.tosca.deploy.json b/csit/xacml-pdp/tests/data/vCPE.policy.input.tosca.deploy.json deleted file mode 100644 index 7ace047b..00000000 --- a/csit/xacml-pdp/tests/data/vCPE.policy.input.tosca.deploy.json +++ /dev/null @@ -1,5 +0,0 @@ -{"policies":[ - {"policy-id":"onap.restart.tca"}, - {"policy-id":"OSDF_CASABLANCA.Affinity_Default"} - ] -} diff --git a/csit/xacml-pdp/tests/xacml-pdp-test.robot b/csit/xacml-pdp/tests/xacml-pdp-test.robot deleted file mode 100644 index e29200ac..00000000 --- a/csit/xacml-pdp/tests/xacml-pdp-test.robot +++ /dev/null @@ -1,150 +0,0 @@ -*** Settings *** -Library Collections -Library RequestsLibrary -Library OperatingSystem -Library Process -Library json -Resource ${CURDIR}/../../common-library.robot - -*** Test Cases *** -Healthcheck - [Documentation] Verify policy xacml-pdp health check - ${resp}= PdpxGetReq /policy/pdpx/v1/healthcheck - Should Be Equal As Strings ${resp.json()['code']} 200 - -Statistics - [Documentation] Verify policy xacml-pdp statistics - ${resp}= PdpxGetReq /policy/pdpx/v1/statistics - Should Be Equal As Strings ${resp.json()['code']} 200 - -Metrics - [Documentation] Verify policy-xacml-pdp is exporting prometheus metrics - ${resp}= PdpxGetReq /metrics - Should Contain ${resp.text} jvm_threads_current - -MakeTopics - [Documentation] Creates the Policy topics - ${result}= Run Process ${SCR_DMAAP}/make_topic.sh POLICY-PDP-PAP - Should Be Equal As Integers ${result.rc} 0 - -ExecuteXacmlPolicy - CreateMonitorPolicy - CreateOptimizationPolicy - Wait Until Keyword Succeeds 1 min 15 sec GetDefaultDecision - DeployPolicies - Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterDeployed - Wait Until Keyword Succeeds 1 min 15 sec GetAbbreviatedDecisionResult - Wait Until Keyword Succeeds 1 min 15 sec GetMonitoringDecision - Wait Until Keyword Succeeds 1 min 15 sec GetNamingDecision - Wait Until Keyword Succeeds 1 min 15 sec GetOptimizationDecision - Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterDecision - UndeployMonitorPolicy - Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterUndeploy - -*** Keywords *** - -CreateMonitorPolicy - [Documentation] Create a Monitoring policy - ${postjson}= Get file ${DATA2}/vCPE.policy.monitoring.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 - -CreateOptimizationPolicy - [Documentation] Create an Optimization policy - ${postjson}= Get file ${DATA2}/vCPE.policies.optimization.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 200 ${postjson} OSDF_CASABLANCA.Affinity_Default 1.0.0 - -GetDefaultDecision - [Documentation] Get Default Decision with no policies in Xacml PDP - ${postjson}= Get file ${CURDIR}/data/onap.policy.guard.decision.request.json - ${resp}= DecisionPostReq ${postjson} abbrev=true - ${status}= Get From Dictionary ${resp.json()} status - Should Be Equal As Strings ${status} Permit - -DeployPolicies - [Documentation] Runs Policy PAP to deploy a policy - ${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.json - ${policyadmin}= PolicyAdminAuth - PerformPostRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/policies 202 ${postjson} null ${policyadmin} - ${result}= Run Process ${SCR_DMAAP}/wait_topic.sh POLICY-PDP-PAP - ... responseTo xacml ACTIVE onap.restart.tca - Should Be Equal As Integers ${result.rc} 0 - -GetStatisticsAfterDeployed - [Documentation] Verify policy xacml-pdp statistics after policy is deployed - ${resp}= PdpxGetReq /policy/pdpx/v1/statistics - Should Be Equal As Strings ${resp.json()['code']} 200 - Should Be Equal As Strings ${resp.json()['totalPoliciesCount']} 3 - -GetAbbreviatedDecisionResult - [Documentation] Get Decision with abbreviated results from Policy Xacml PDP - ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json - ${resp}= DecisionPostReq ${postjson} abbrev=true - ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca - Dictionary Should Contain Key ${policy} type - Dictionary Should Contain Key ${policy} metadata - Dictionary Should Not Contain Key ${policy} type_version - Dictionary Should Not Contain Key ${policy} properties - Dictionary Should Not Contain Key ${policy} name - Dictionary Should Not Contain Key ${policy} version - -GetMonitoringDecision - [Documentation] Get Decision from Monitoring Policy Xacml PDP - ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json - ${resp}= DecisionPostReq ${postjson} null - ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca - Dictionary Should Contain Key ${policy} type - Dictionary Should Contain Key ${policy} metadata - Dictionary Should Contain Key ${policy} type_version - Dictionary Should Contain Key ${policy} properties - Dictionary Should Contain Key ${policy} name - Dictionary Should Contain Key ${policy} version - -GetNamingDecision - [Documentation] Get Decision from Naming Policy Xacml PDP - ${postjson}= Get file ${CURDIR}/data/onap.policy.naming.decision.request.json - ${resp}= DecisionPostReq ${postjson} null - ${policy}= Get From Dictionary ${resp.json()['policies']} SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP - Dictionary Should Contain Key ${policy} type - Dictionary Should Contain Key ${policy} type_version - Dictionary Should Contain Key ${policy} properties - Dictionary Should Contain Key ${policy} name - -GetOptimizationDecision - [Documentation] Get Decision from Optimization Policy Xacml PDP - ${postjson}= Get file ${CURDIR}/data/onap.policy.optimization.decision.request.json - ${resp}= DecisionPostReq ${postjson} null - ${policy}= Get From Dictionary ${resp.json()['policies']} OSDF_CASABLANCA.Affinity_Default - Dictionary Should Contain Key ${policy} type - Dictionary Should Contain Key ${policy} type_version - Dictionary Should Contain Key ${policy} properties - Dictionary Should Contain Key ${policy} name - -GetStatisticsAfterDecision - [Documentation] Runs Policy Xacml PDP Statistics after Decision request - ${resp}= PdpxGetReq /policy/pdpx/v1/statistics - Should Be Equal As Strings ${resp.json()['code']} 200 - Should Be Equal As Strings ${resp.json()['permitDecisionsCount']} 4 - Should Be Equal As Strings ${resp.json()['notApplicableDecisionsCount']} 1 - -UndeployMonitorPolicy - [Documentation] Runs Policy PAP to undeploy a policy - ${policyadmin}= PolicyAdminAuth - PerformDeleteRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/policies/onap.restart.tca 202 ${policyadmin} - -GetStatisticsAfterUndeploy - [Documentation] Runs Policy Xacml PDP Statistics after policy is undeployed - ${resp}= PdpxGetReq /policy/pdpx/v1/statistics - Should Be Equal As Strings ${resp.json()['code']} 200 - Should Be Equal As Strings ${resp.json()['totalPoliciesCount']} 2 - -PdpxGetReq - [Arguments] ${url} - ${hcauth}= HealthCheckAuth - ${resp}= PerformGetRequest ${POLICY_PDPX_PORT} ${url} 200 null ${hcauth} - [return] ${resp} - -DecisionPostReq - [Arguments] ${postjson} ${abbr} - ${hcauth}= HealthCheckAuth - ${resp}= PerformPostRequest ${POLICY_PDPX_PORT} /policy/pdpx/v1/decision 200 ${postjson} ${abbr} ${hcauth} - [return] ${resp} -- cgit 1.2.3-korg