From: adheli.tavares Date: Thu, 27 Mar 2025 09:03:42 +0000 (+0000) Subject: Fix opa-pdp configuration X-Git-Tag: 4.1.2~4 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F140608%2F1;p=policy%2Fdocker.git Fix opa-pdp configuration - add groups.json for opa-pdp - revert apex-pdp being dependent on opa-pdp - revert the pap test changes to not consider opa-pdp group Issue-ID: POLICY-5225 Change-Id: I5a3f889ed9ba94e3eccb17567d15f1c21d63299a Signed-off-by: adheli.tavares --- diff --git a/compose/compose.yaml b/compose/compose.yaml index c7a2e79f..8ed55b92 100644 --- a/compose/compose.yaml +++ b/compose/compose.yaml @@ -2,7 +2,7 @@ # ===========LICENSE_START==================================================== # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. # Modifications Copyright (C) 2021 Bell Canada. All rights reserved. -# Modification Copyright 2021-2025 Nordix Foundation. +# Modifications Copyright 2021-2025 Nordix Foundation. # Modifications Copyright 2024-2025 Deutsche Telekom # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -77,7 +77,6 @@ services: - simulator - kafka - pap - - opa-pdp ports: - ${APEX_PORT}:6969 - ${APEX_EVENTS_PORT}:23324 @@ -133,7 +132,6 @@ services: 'kafka', '9092' ] - opa-pdp: image: ${CONTAINER_LOCATION}onap/policy-opa-pdp:${POLICY_OPA_PDP_VERSION} container_name: policy-opa-pdp diff --git a/compose/config/api/groups.json b/compose/config/api/groups.json index 5bbc0a70..6ee30e1c 100644 --- a/compose/config/api/groups.json +++ b/compose/config/api/groups.json @@ -130,32 +130,8 @@ "currentInstanceCount": 0, "desiredInstanceCount": 1, "policies": [] - }, - { - "name": "opaGroup", - "pdpGroupState": "ACTIVE", - "properties": {}, - "pdpSubgroups": [ - { - "pdpType": "opa", - "desiredInstanceCount": 1, - "properties": {}, - "supportedPolicyTypes": [ - { - "name": "onap.policies.native.opa", - "version": "1.0.0" - } - ], - "policies": [ - { - "name": "slice.capacity.check", - "version": "1.0.0" - } - ] } ] } - ] - } ] } diff --git a/compose/config/opa-pdp/groups.json b/compose/config/opa-pdp/groups.json new file mode 100644 index 00000000..30a81dce --- /dev/null +++ b/compose/config/opa-pdp/groups.json @@ -0,0 +1,28 @@ +{ + "groups": [ + { + "name": "opaGroup", + "pdpGroupState": "ACTIVE", + "properties": {}, + "pdpSubgroups": [ + { + "pdpType": "opa", + "desiredInstanceCount": 1, + "properties": {}, + "supportedPolicyTypes": [ + { + "name": "onap.policies.native.opa", + "version": "1.0.0" + } + ], + "policies": [ + { + "name": "slice.capacity.check", + "version": "1.0.0" + } + ] + } + ] + } + ] +} diff --git a/compose/config/pap/groups.json b/compose/config/pap/groups.json index e9a9e9a1..bd5c2868 100644 --- a/compose/config/pap/groups.json +++ b/compose/config/pap/groups.json @@ -23,30 +23,6 @@ "policies": [] } ] - }, - { - "name": "opaGroup", - "pdpGroupState": "ACTIVE", - "properties": {}, - "pdpSubgroups": [ - { - "pdpType": "opa", - "desiredInstanceCount": 1, - "properties": {}, - "supportedPolicyTypes": [ - { - "name": "onap.policies.native.opa", - "version": "1.0.0" - } - ], - "policies": [ - { - "name": "slice.capacity.check", - "version": "1.0.0" - } - ] - } - ] } ] } diff --git a/csit/resources/tests/common-library.robot b/csit/resources/tests/common-library.robot index 12939a73..89a9c726 100644 --- a/csit/resources/tests/common-library.robot +++ b/csit/resources/tests/common-library.robot @@ -102,7 +102,7 @@ CreateNodeTemplate QueryPdpGroups [Documentation] Verify pdp group query - suphosts upto 2 groups - [Arguments] ${groupsLength} ${group1Name} ${group1State} ${policiesLengthInGroup1} ${group2Name} ${group2State} ${policiesLengthInGroup2} ${group3Name} ${group3State} ${policiesLengthInGroup3} + [Arguments] ${groupsLength} ${group1Name} ${group1State} ${policiesLengthInGroup1} ${group2Name} ${group2State} ${policiesLengthInGroup2} ${policyadmin}= PolicyAdminAuth ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps 200 null ${policyadmin} Length Should Be ${resp.json()['groups']} ${groupsLength} @@ -112,9 +112,6 @@ QueryPdpGroups Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['name']} ${group2Name} Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['pdpGroupState']} ${group2State} Run Keyword If ${groupsLength}>1 Length Should Be ${resp.json()['groups'][1]['pdpSubgroups'][0]['policies']} ${policiesLengthInGroup2} - Run Keyword If ${groupsLength}>2 Should Be Equal As Strings ${resp.json()['groups'][2]['name']} ${group3Name} - Run Keyword If ${groupsLength}>2 Should Be Equal As Strings ${resp.json()['groups'][2]['pdpGroupState']} ${group3State} - Run Keyword If ${groupsLength}>2 Length Should Be ${resp.json()['groups'][2]['pdpSubgroups'][0]['policies']} ${policiesLengthInGroup3} QueryPolicyAudit [Arguments] ${url} ${expectedstatus} ${pdpGroup} ${pdpType} ${policyName} ${expectedAction} diff --git a/csit/resources/tests/pap-test.robot b/csit/resources/tests/pap-test.robot index 7021a141..e66820c7 100644 --- a/csit/resources/tests/pap-test.robot +++ b/csit/resources/tests/pap-test.robot @@ -38,7 +38,7 @@ Healthcheck Consolidated Healthcheck [Documentation] Verify policy consolidated health check - sleep 60 + sleep 20 ${resp}= GetReq /policy/pap/v1/components/healthcheck Should Be Equal As Strings ${resp.json()['healthy']} True @@ -48,7 +48,7 @@ Metrics ${resp}= GetMetrics ${POLICY_PAP_IP} ${auth} /policy/pap/v1/ Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck"} Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/components/healthcheck"} 1 - Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="save",repository="PdpGroupRepository",state="SUCCESS"} 2 + Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="save",repository="PdpGroupRepository",state="SUCCESS"} 1 Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findByKeyName",repository="PdpGroupRepository",state="SUCCESS"} 1 Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findAll",repository="PolicyStatusRepository",state="SUCCESS"} @@ -60,7 +60,7 @@ AddPdpGroup QueryPdpGroupsBeforeActivation [Documentation] Verify PdpGroups before activation - QueryPdpGroups 3 defaultGroup ACTIVE 0 opaGroup ACTIVE 1 testGroup PASSIVE 0 + QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup PASSIVE 0 ActivatePdpGroup [Documentation] Change the state of PdpGroup named 'testGroup' to ACTIVE @@ -69,7 +69,7 @@ ActivatePdpGroup QueryPdpGroupsAfterActivation [Documentation] Verify PdpGroups after activation - QueryPdpGroups 3 defaultGroup ACTIVE 0 opaGroup ACTIVE 1 testGroup ACTIVE 0 + QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 0 DeployPdpGroups [Documentation] Deploy policies in PdpGroups @@ -79,7 +79,7 @@ DeployPdpGroups QueryPdpGroupsAfterDeploy [Documentation] Verify PdpGroups after undeploy - QueryPdpGroups 3 defaultGroup ACTIVE 0 opaGroup ACTIVE 1 testGroup ACTIVE 1 + QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 1 QueryPolicyAuditAfterDeploy [Documentation] Verify policy audit record after deploy @@ -101,7 +101,7 @@ UndeployPolicyWithMetadataSet QueryPdpGroupsAfterUndeploy [Documentation] Verify PdpGroups after undeploy - QueryPdpGroups 3 defaultGroup ACTIVE 0 opaGroup ACTIVE 1 testGroup ACTIVE 0 + QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 0 QueryPolicyAuditAfterUnDeploy [Documentation] Verify policy audit record after undeploy @@ -123,4 +123,4 @@ DeletePdpGroups QueryPdpGroupsAfterDelete [Documentation] Verify PdpGroups after delete - QueryPdpGroups 2 defaultGroup ACTIVE 0 opaGroup ACTIVE 1 null null null + QueryPdpGroups 1 defaultGroup ACTIVE 0 null null null diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index f5bb890a..0e1b9c79 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -134,7 +134,6 @@ function setup_pap() { sleep 60 check_rest_endpoint "${PAP_PORT}" check_rest_endpoint "${APEX_PORT}" - check_rest_endpoint "${OPA_PDP_PORT}" apex_healthcheck } @@ -194,7 +193,8 @@ function setup_opa_pdp() { export PROJECT="opa-pdp" source "${DOCKER_COMPOSE_DIR}"/start-compose.sh opa-pdp echo "Waiting 3 minutes for OPA-PDP to start..." - sleep 145 + sleep 180 + check_rest_endpoint "${PAP_PORT}" check_rest_endpoint "${OPA_PDP_PORT}" } @@ -314,6 +314,10 @@ do export DO_NOT_TEARDOWN=true shift ;; + --stop) + export TEARDOWN=true + shift + ;; *) export PROJECT="${1}" shift @@ -342,6 +346,10 @@ cd "${WORKSPACE}" || exit sudo rm -rf "${ROBOT_LOG_DIR}" mkdir -p "${ROBOT_LOG_DIR}" +if [ "${TEARDOWN}" == "true" ]; then + on_exit +fi + # log into nexus docker docker login -u docker -p docker nexus3.onap.org:10001