Fix opa-pdp configuration 08/140608/1
authoradheli.tavares <adheli.tavares@est.tech>
Thu, 27 Mar 2025 09:03:42 +0000 (09:03 +0000)
committeradheli.tavares <adheli.tavares@est.tech>
Thu, 27 Mar 2025 14:04:22 +0000 (14:04 +0000)
- 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 <adheli.tavares@est.tech>
compose/compose.yaml
compose/config/api/groups.json
compose/config/opa-pdp/groups.json [new file with mode: 0644]
compose/config/pap/groups.json
csit/resources/tests/common-library.robot
csit/resources/tests/pap-test.robot
csit/run-project-csit.sh

index c7a2e79..8ed55b9 100644 (file)
@@ -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
index 5bbc0a7..6ee30e1 100644 (file)
           "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 (file)
index 0000000..30a81dc
--- /dev/null
@@ -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"
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
index e9a9e9a..bd5c286 100644 (file)
           "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"
-            }
-          ]
-        }
-      ]
     }
   ]
 }
index 12939a7..89a9c72 100644 (file)
@@ -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}
index 7021a14..e66820c 100644 (file)
@@ -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
index f5bb890..0e1b9c7 100755 (executable)
@@ -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