aboutsummaryrefslogtreecommitdiffstats
path: root/csit/resources
diff options
context:
space:
mode:
authorMurali Parthasarathy K <muraliparthasarathy.k@techmahindra.com>2025-02-28 07:24:26 +0100
committerMurali Parthasarathy K <muraliparthasarathy.k@techmahindra.com>2025-03-06 12:30:19 +0100
commit50a11cd101418eb7222d2b68041777bf2b395f47 (patch)
tree3f108c5e8074ebff6f8c0ff24ae9d3dcaed32d17 /csit/resources
parent975d270d75802bd535619c12a9f3b0f8a5397f00 (diff)
Update CSIT with opa-pdp test cases for Phase-2HEADmaster
Issue-ID: POLICY-5225 Change-Id: Ib1ee558cde1813ec182a52e5e7d8cfcf104e3415 Signed-off-by: Murali Parthasarathy K <muraliparthasarathy.k@techmahindra.com>
Diffstat (limited to 'csit/resources')
-rw-r--r--csit/resources/tests/common-library.robot34
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.data-empty.json12
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.decision.empty_filter_response.json61
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.decision.filter_response.json23
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.decision.request.json1
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.decision.request.output.json5
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.decision.request_filter.json1
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.decision.request_filter_empty.json1
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-incorrect-policyfilter.json19
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-incorrect-policyname.json19
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-policy-output.json12
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-add-output.json19
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-add.json1
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-remove.json17
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-replace-output.json19
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-replace.json18
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-create.yaml16
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-deploy.json9
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-duplicate-create.yaml16
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-output.json96
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-resource-not-found.json5
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-create.yaml17
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-deploy.json9
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-output.json18
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-create.yaml17
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-deploy.json8
-rw-r--r--csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-output.json27
-rw-r--r--csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-incorrect-policyfilter.json16
-rw-r--r--csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-incorrect-policyname.json16
-rw-r--r--csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-output.json32
-rw-r--r--csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-pemit-policy.json16
-rw-r--r--csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyfilter.json15
-rw-r--r--csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyname.json15
-rw-r--r--csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle_input.json14
-rw-r--r--csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle_output.json12
-rw-r--r--csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.zone-policy-input.json18
-rw-r--r--csit/resources/tests/opa-pdp-common.robot11
-rw-r--r--csit/resources/tests/opa-pdp-test.robot128
38 files changed, 690 insertions, 103 deletions
diff --git a/csit/resources/tests/common-library.robot b/csit/resources/tests/common-library.robot
index e0b1c0f1..89a9c726 100644
--- a/csit/resources/tests/common-library.robot
+++ b/csit/resources/tests/common-library.robot
@@ -11,6 +11,15 @@ PolicyAdminAuth
${policyadmin}= Create list policyadmin zb!XztG34
RETURN ${policyadmin}
+PerformPatchRequest
+ [Arguments] ${domain} ${url} ${expectedstatus} ${patchjson} ${params} ${auth}
+ Log Creating session http://${domain}
+ ${session}= Create Session policy http://${domain} auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= PATCH On Session policy ${url} data=${patchjson} params=${params} headers=${headers} expected_status=${expectedstatus}
+ Log Received response from policy ${resp.text}
+ RETURN ${resp}
+
PerformPostRequest
[Arguments] ${domain} ${url} ${expectedstatus} ${postjson} ${params} ${auth}
Log Creating session http://${domain}
@@ -20,6 +29,15 @@ PerformPostRequest
Log Received response from policy ${resp.text}
RETURN ${resp}
+PerformPostRequestWithYaml
+ [Arguments] ${domain} ${url} ${expectedstatus} ${postyaml} ${params} ${auth}
+ Log Creating session http://${domain}
+ ${session}= Create Session policy http://${domain} auth=${auth}
+ ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml
+ ${resp}= POST On Session policy ${url} data=${postyaml} params=${params} headers=${headers} expected_status=${expectedstatus}
+ Log Received response from policy ${resp.text}
+ RETURN ${resp}
+
PerformPutRequest
[Arguments] ${domain} ${url} ${expectedstatus} ${params} ${auth}
Log Creating session http://${domain}
@@ -52,6 +70,20 @@ CreatePolicy
${policyadmin}= PolicyAdminAuth
${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${policyadmin}
+CreatePolicyWithYaml
+ [Arguments] ${url} ${expectedstatus} ${postyaml}
+ [Documentation] Create the specific policy
+ ${policyadmin}= PolicyAdminAuth
+ ${resp}= PerformPostRequestWithYaml ${POLICY_API_IP} ${url} ${expectedstatus} ${postyaml} null ${policyadmin}
+
+CreateFailurePolicyWithYaml
+ [Arguments] ${url} ${expectedstatus} ${postyaml} ${keyword}
+ [Documentation] Trying to create policy with Invalid Data
+ ${policyadmin}= PolicyAdminAuth
+ ${resp}= PerformPostRequestWithYaml ${POLICY_API_IP} ${url} ${expectedstatus} ${postyaml} null ${policyadmin}
+ Should Contain ${resp.text} ${keyword}
+
+
CreatePolicySuccessfully
[Arguments] ${url} ${postjson} ${policyname} ${policyversion}
[Documentation] Create the specific policy
@@ -164,4 +196,4 @@ ValidatePolicyExecution
${resp}= QueryPrometheus ${url}
${rawNumber}= Evaluate ${resp['data']['result'][0]['value'][1]}
${actualTime}= Set Variable ${rawNumber * ${1000}}
- Should Be True ${actualTime} <= ${executionTime} \ No newline at end of file
+ Should Be True ${actualTime} <= ${executionTime}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.data-empty.json b/csit/resources/tests/data/onap.policy.opa.pdp.data-empty.json
new file mode 100644
index 00000000..432476a7
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.data-empty.json
@@ -0,0 +1,12 @@
+{
+ "data": {
+ "system": {
+ "version": {
+ "build_commit": "",
+ "build_hostname": "",
+ "build_timestamp": "",
+ "version": "1.1.0"
+ }
+ }
+ }
+}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.decision.empty_filter_response.json b/csit/resources/tests/data/onap.policy.opa.pdp.decision.empty_filter_response.json
deleted file mode 100644
index 040f0624..00000000
--- a/csit/resources/tests/data/onap.policy.opa.pdp.decision.empty_filter_response.json
+++ /dev/null
@@ -1,61 +0,0 @@
-{
- "output": {
- "allow": true,
- "role_grants": {
- "billing": [
- {
- "action": "read",
- "type": "finance"
- },
- {
- "action": "update",
- "type": "finance"
- }
- ],
- "customer": [
- {
- "action": "read",
- "type": "dog"
- },
- {
- "action": "read",
- "type": "cat"
- },
- {
- "action": "adopt",
- "type": "dog"
- },
- {
- "action": "adopt",
- "type": "cat"
- }
- ],
- "employee": [
- {
- "action": "read",
- "type": "dog"
- },
- {
- "action": "read",
- "type": "cat"
- },
- {
- "action": "update",
- "type": "dog"
- },
- {
- "action": "update",
- "type": "cat"
- }
- ]
- },
- "user_is_admin": true,
- "user_is_granted": [],
- "user_roles": {
- "alice": ["admin"],
- "bob": ["employee", "billing"],
- "eve": ["customer"]
- }
- },
- "policyName": "role"
-}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.decision.filter_response.json b/csit/resources/tests/data/onap.policy.opa.pdp.decision.filter_response.json
deleted file mode 100644
index d19f5fed..00000000
--- a/csit/resources/tests/data/onap.policy.opa.pdp.decision.filter_response.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "output": {
- "role_grants": {
- "billing": [
- {"action": "read", "type": "finance"},
- {"action": "update", "type": "finance"}
- ],
- "customer": [
- {"action": "read", "type": "dog"},
- {"action": "read", "type": "cat"},
- {"action": "adopt", "type": "dog"},
- {"action": "adopt", "type": "cat"}
- ],
- "employee": [
- {"action": "read", "type": "dog"},
- {"action": "read", "type": "cat"},
- {"action": "update", "type": "dog"},
- {"action": "update", "type": "cat"}
- ]
- }
- },
- "policyName": "role"
-}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.decision.request.json b/csit/resources/tests/data/onap.policy.opa.pdp.decision.request.json
deleted file mode 100644
index 748a5529..00000000
--- a/csit/resources/tests/data/onap.policy.opa.pdp.decision.request.json
+++ /dev/null
@@ -1 +0,0 @@
-{"onapName":"CDS","onapComponent":"CDS","onapInstance":"CDS","currentDate": "2024-11-22", "currentTime": "2024-11-22T11:34:56Z", "timeZone": "UTC", "timeOffset": "+05:30", "currentDateTime": "2024-11-22T12:08:00Z", "policyName":"role","input":{"user":"alice","action":"write","object":"id123","type":"dog"}}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.decision.request.output.json b/csit/resources/tests/data/onap.policy.opa.pdp.decision.request.output.json
deleted file mode 100644
index bf035c4b..00000000
--- a/csit/resources/tests/data/onap.policy.opa.pdp.decision.request.output.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "errorMessage": "Policy Filter is nil.",
- "policyName": "",
- "responseCode": "bad_request"
-}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.decision.request_filter.json b/csit/resources/tests/data/onap.policy.opa.pdp.decision.request_filter.json
deleted file mode 100644
index 1a621c26..00000000
--- a/csit/resources/tests/data/onap.policy.opa.pdp.decision.request_filter.json
+++ /dev/null
@@ -1 +0,0 @@
-{"onapName":"CDS","onapComponent":"CDS","onapInstance":"CDS","currentDate": "2024-11-22", "currentTime": "2024-11-22T11:34:56Z", "timeZone": "UTC", "timeOffset": "+05:30", "currentDateTime": "2024-11-22T12:08:00Z", "policyName":"role","policyFilter": ["role_grants"],"input":{"user":"alice","action":"write","object":"id123","type":"dog"}}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.decision.request_filter_empty.json b/csit/resources/tests/data/onap.policy.opa.pdp.decision.request_filter_empty.json
deleted file mode 100644
index fec2ba48..00000000
--- a/csit/resources/tests/data/onap.policy.opa.pdp.decision.request_filter_empty.json
+++ /dev/null
@@ -1 +0,0 @@
-{"onapName":"CDS","onapComponent":"CDS","onapInstance":"CDS","currentDate": "2024-11-22", "currentTime": "2024-11-22T11:34:56Z", "timeZone": "UTC", "timeOffset": "+05:30", "currentDateTime": "2024-11-22T12:08:00Z", "policyName":"role","policyFilter": [""],"input":{"user":"alice","action":"write","object":"id123","type":"dog"}}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-incorrect-policyfilter.json b/csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-incorrect-policyfilter.json
new file mode 100644
index 00000000..1c7f8b8f
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-incorrect-policyfilter.json
@@ -0,0 +1,19 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDate": "2024-11-22",
+ "policyName": "zoneB",
+ "policyFilter": ["has_ze_access"],
+ "input": {
+ "actions": ["view"],
+ "log_id": "log1",
+ "datatypes": ["access", "user"],
+ "time_period": {
+ "from": "2024-11-01T09:00:00Z",
+ "to": "2024-11-01T10:00:00Z"
+ },
+ "zone_id": "zoneA"
+ }
+}
+
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-incorrect-policyname.json b/csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-incorrect-policyname.json
new file mode 100644
index 00000000..dfa088b4
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-incorrect-policyname.json
@@ -0,0 +1,19 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDate": "2024-11-22",
+ "policyName": "zoeB",
+ "policyFilter": ["has_zone_access"],
+ "input": {
+ "actions": ["view"],
+ "log_id": "log1",
+ "datatypes": ["access", "user"],
+ "time_period": {
+ "from": "2024-11-01T09:00:00Z",
+ "to": "2024-11-01T10:00:00Z"
+ },
+ "zone_id": "zoneA"
+ }
+}
+
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-policy-output.json b/csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-policy-output.json
new file mode 100644
index 00000000..1e7228dd
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.decision.zone-policy-output.json
@@ -0,0 +1,12 @@
+{
+ "output": {
+ "has_zone_access": [
+ {
+ "access": "granted",
+ "user": "user1"
+ }
+ ]
+ },
+ "policyName": "zoneB",
+ "statusMessage": "OPA Allowed"
+}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-add-output.json b/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-add-output.json
new file mode 100644
index 00000000..eac292e5
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-add-output.json
@@ -0,0 +1,19 @@
+{
+ "data": {
+ "round": "trail",
+ "vehicles": [
+ {
+ "owner": "user1",
+ "status": "available",
+ "type": "car",
+ "vehicle_id": "v1"
+ },
+ {
+ "owner": "user2",
+ "status": "in use",
+ "type": "bike",
+ "vehicle_id": "v2"
+ }
+ ]
+ }
+}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-add.json b/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-add.json
new file mode 100644
index 00000000..04478eec
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-add.json
@@ -0,0 +1 @@
+{"onapName": "CDS","onapComponent": "CDS","onapInstance": "CDS","currentDateTime": "2025-01-17T08:26:41.857Z","currentDate": "2025-01-17","currentTime": "08:26:41.857Z","timeZone": "UTC","timeOffset": "+08:45","policyName": "vehicle","data": [{"op": "add","path": "/round","value": "trail"}]}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-remove.json b/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-remove.json
new file mode 100644
index 00000000..a4cac2f3
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-remove.json
@@ -0,0 +1,17 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDateTime": "2025-01-17T08:26:41.857Z",
+ "currentDate": "2025-01-17",
+ "currentTime": "08:26:41.857Z",
+ "timeZone": "UTC",
+ "timeOffset": "+08:45",
+ "policyName": "vehicle",
+ "data": [
+ {
+ "op": "remove",
+ "path": "/round"
+ }
+ ]
+}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-replace-output.json b/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-replace-output.json
new file mode 100644
index 00000000..8c00e047
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-replace-output.json
@@ -0,0 +1,19 @@
+{
+ "data": {
+ "round": 578,
+ "vehicles": [
+ {
+ "owner": "user1",
+ "status": "available",
+ "type": "car",
+ "vehicle_id": "v1"
+ },
+ {
+ "owner": "user2",
+ "status": "in use",
+ "type": "bike",
+ "vehicle_id": "v2"
+ }
+ ]
+ }
+}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-replace.json b/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-replace.json
new file mode 100644
index 00000000..c45138c0
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.dyn-data-replace.json
@@ -0,0 +1,18 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDateTime": "2025-01-17T08:26:41.857Z",
+ "currentDate": "2025-01-17",
+ "currentTime": "08:26:41.857Z",
+ "timeZone": "UTC",
+ "timeOffset": "+08:45",
+ "policyName": "vehicle",
+ "data": [
+ {
+ "op": "replace",
+ "path": "/round",
+ "value": 578
+ }
+ ]
+}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-create.yaml b/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-create.yaml
new file mode 100644
index 00000000..759fc162
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-create.yaml
@@ -0,0 +1,16 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+topology_template:
+ policies:
+ - abac:
+ type: onap.policies.native.opa
+ type_version: 1.0.0
+ properties:
+ data:
+ node.abac: ewogICAgInNlbnNvcl9kYXRhIjogWwogICAgICAgIHsKICAgICAgICAgICAgImlkIjogIjAwMDEiLAogICAgICAgICAgICAibG9jYXRpb24iOiAiU3JpIExhbmthIiwKICAgICAgICAgICAgInRlbXBlcmF0dXJlIjogIjI4IEMiLAogICAgICAgICAgICAicHJlY2lwaXRhdGlvbiI6ICIxMDAwIG1tIiwKICAgICAgICAgICAgIndpbmRzcGVlZCI6ICI1LjUgbS9zIiwKICAgICAgICAgICAgImh1bWlkaXR5IjogIjQwJSIsCiAgICAgICAgICAgICJwYXJ0aWNsZV9kZW5zaXR5IjogIjEuMyBnL2wiLAogICAgICAgICAgICAidGltZXN0YW1wIjogIjIwMjQtMDItMjYiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6ICIwMDAyIiwKICAgICAgICAgICAgImxvY2F0aW9uIjogIkNvbG9tYm8iLAogICAgICAgICAgICAidGVtcGVyYXR1cmUiOiAiMzAgQyIsCiAgICAgICAgICAgICJwcmVjaXBpdGF0aW9uIjogIjEyMDAgbW0iLAogICAgICAgICAgICAid2luZHNwZWVkIjogIjYuMCBtL3MiLAogICAgICAgICAgICAiaHVtaWRpdHkiOiAiNDUlIiwKICAgICAgICAgICAgInBhcnRpY2xlX2RlbnNpdHkiOiAiMS41IGcvbCIsCiAgICAgICAgICAgICJ0aW1lc3RhbXAiOiAiMjAyNC0wMi0yNiIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImlkIjogIjAwMDMiLAogICAgICAgICAgICAibG9jYXRpb24iOiAiS2FuZHkiLAogICAgICAgICAgICAidGVtcGVyYXR1cmUiOiAiMjUgQyIsCiAgICAgICAgICAgICJwcmVjaXBpdGF0aW9uIjogIjgwMCBtbSIsCiAgICAgICAgICAgICJ3aW5kc3BlZWQiOiAiNC41IG0vcyIsCiAgICAgICAgICAgICJodW1pZGl0eSI6ICI2MCUiLAogICAgICAgICAgICAicGFydGljbGVfZGVuc2l0eSI6ICIxLjEgZy9sIiwKICAgICAgICAgICAgInRpbWVzdGFtcCI6ICIyMDI0LTAyLTI2IgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiaWQiOiAiMDAwNCIsCiAgICAgICAgICAgICJsb2NhdGlvbiI6ICJHYWxsZSIsCiAgICAgICAgICAgICJ0ZW1wZXJhdHVyZSI6ICIzNSBDIiwKICAgICAgICAgICAgInByZWNpcGl0YXRpb24iOiAiNTAwIG1tIiwKICAgICAgICAgICAgIndpbmRzcGVlZCI6ICI3LjIgbS9zIiwKICAgICAgICAgICAgImh1bWlkaXR5IjogIjMwJSIsCiAgICAgICAgICAgICJwYXJ0aWNsZV9kZW5zaXR5IjogIjEuOCBnL2wiLAogICAgICAgICAgICAidGltZXN0YW1wIjogIjIwMjQtMDItMjciCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6ICIwMDA1IiwKICAgICAgICAgICAgImxvY2F0aW9uIjogIkphZmZuYSIsCiAgICAgICAgICAgICJ0ZW1wZXJhdHVyZSI6ICItNSBDIiwKICAgICAgICAgICAgInByZWNpcGl0YXRpb24iOiAiMzAwIG1tIiwKICAgICAgICAgICAgIndpbmRzcGVlZCI6ICIzLjggbS9zIiwKICAgICAgICAgICAgImh1bWlkaXR5IjogIjIwJSIsCiAgICAgICAgICAgICJwYXJ0aWNsZV9kZW5zaXR5IjogIjAuOSBnL2wiLAogICAgICAgICAgICAidGltZXN0YW1wIjogIjIwMjQtMDItMjciCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6ICIwMDA2IiwKICAgICAgICAgICAgImxvY2F0aW9uIjogIlRyaW5jb21hbGVlIiwKICAgICAgICAgICAgInRlbXBlcmF0dXJlIjogIjIwIEMiLAogICAgICAgICAgICAicHJlY2lwaXRhdGlvbiI6ICIxMDAwIG1tIiwKICAgICAgICAgICAgIndpbmRzcGVlZCI6ICI1LjAgbS9zIiwKICAgICAgICAgICAgImh1bWlkaXR5IjogIjU1JSIsCiAgICAgICAgICAgICJwYXJ0aWNsZV9kZW5zaXR5IjogIjEuMiBnL2wiLAogICAgICAgICAgICAidGltZXN0YW1wIjogIjIwMjQtMDItMjgiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6ICIwMDA3IiwKICAgICAgICAgICAgImxvY2F0aW9uIjogIk51d2FyYSBFbGl5YSIsCiAgICAgICAgICAgICJ0ZW1wZXJhdHVyZSI6ICIyNSBDIiwKICAgICAgICAgICAgInByZWNpcGl0YXRpb24iOiAiNjAwIG1tIiwKICAgICAgICAgICAgIndpbmRzcGVlZCI6ICI0LjAgbS9zIiwKICAgICAgICAgICAgImh1bWlkaXR5IjogIjUwJSIsCiAgICAgICAgICAgICJwYXJ0aWNsZV9kZW5zaXR5IjogIjEuMyBnL2wiLAogICAgICAgICAgICAidGltZXN0YW1wIjogIjIwMjQtMDItMjgiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6ICIwMDA4IiwKICAgICAgICAgICAgImxvY2F0aW9uIjogIkFudXJhZGhhcHVyYSIsCiAgICAgICAgICAgICJ0ZW1wZXJhdHVyZSI6ICIyOCBDIiwKICAgICAgICAgICAgInByZWNpcGl0YXRpb24iOiAiNzAwIG1tIiwKICAgICAgICAgICAgIndpbmRzcGVlZCI6ICI1LjggbS9zIiwKICAgICAgICAgICAgImh1bWlkaXR5IjogIjQwJSIsCiAgICAgICAgICAgICJwYXJ0aWNsZV9kZW5zaXR5IjogIjEuNCBnL2wiLAogICAgICAgICAgICAidGltZXN0YW1wIjogIjIwMjQtMDItMjkiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6ICIwMDA5IiwKICAgICAgICAgICAgImxvY2F0aW9uIjogIk1hdGFyYSIsCiAgICAgICAgICAgICJ0ZW1wZXJhdHVyZSI6ICIzMiBDIiwKICAgICAgICAgICAgInByZWNpcGl0YXRpb24iOiAiOTAwIG1tIiwKICAgICAgICAgICAgIndpbmRzcGVlZCI6ICI2LjUgbS9zIiwKICAgICAgICAgICAgImh1bWlkaXR5IjogIjY1JSIsCiAgICAgICAgICAgICJwYXJ0aWNsZV9kZW5zaXR5IjogIjEuNiBnL2wiLAogICAgICAgICAgICAidGltZXN0YW1wIjogIjIwMjQtMDItMjkiCiAgICAgICAgfQogICAgXQp9
+ policy:
+ abac: cGFja2FnZSBhYmFjCgppbXBvcnQgcmVnby52MQoKZGVmYXVsdCBhbGxvdyA6PSBmYWxzZQoKYWxsb3cgaWYgewogdmlld2FibGVfc2Vuc29yX2RhdGEKIGFjdGlvbl9pc19yZWFkCn0KCmFjdGlvbl9pc19yZWFkIGlmICJyZWFkIiBpbiBpbnB1dC5hY3Rpb25zCgp2aWV3YWJsZV9zZW5zb3JfZGF0YSBjb250YWlucyB2aWV3X2RhdGEgaWYgewogc29tZSBzZW5zb3JfZGF0YSBpbiBkYXRhLm5vZGUuYWJhYy5zZW5zb3JfZGF0YQogc2Vuc29yX2RhdGEudGltZXN0YW1wID49IGlucHV0LnRpbWVfcGVyaW9kLmZyb20KIHNlbnNvcl9kYXRhLnRpbWVzdGFtcCA8IGlucHV0LnRpbWVfcGVyaW9kLnRvCgogdmlld19kYXRhIDo9IHtkYXRhdHlwZTogc2Vuc29yX2RhdGFbZGF0YXR5cGVdIHwgZGF0YXR5cGUgaW4gaW5wdXQuZGF0YXR5cGVzfQp9
+ name: abac
+ version: 1.0.7
+ metadata:
+ policy-id: abac
+ policy-version: 1.0.7
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-deploy.json b/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-deploy.json
new file mode 100644
index 00000000..15c88261
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-deploy.json
@@ -0,0 +1,9 @@
+{
+ "policies": [
+ {
+ "policy-id": "abac",
+ "policy-version": "1.0.7"
+ }
+ ]
+}
+
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-duplicate-create.yaml b/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-duplicate-create.yaml
new file mode 100644
index 00000000..776b654b
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-duplicate-create.yaml
@@ -0,0 +1,16 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+topology_template:
+ policies:
+ - abac:
+ type: onap.policies.native.opa
+ type_version: 1.0.0
+ properties:
+ data:
+ node.abac: cGFja2FnZSBvcmdfYWNjZXNzX2NvbnRyb2wucG9saWN5CmltcG9ydCByZWdvLnYxCmltcG9ydCBkYXRhLm9yZ19hY2Nlc3NfY29udHJvbC5yb2xlcwppbXBvcnQgZGF0YS5vcmdfYWNjZXNzX2NvbnRyb2wudXNlcnMKaW1wb3J0IGRhdGEub3JnX2FjY2Vzc19jb250cm9sLmdyb3VwcwppbXBvcnQgZGF0YS5vcmdfYWNjZXNzX2NvbnRyb2wuZG9jdW1lbnRzCmRlZmF1bHQgYWxsb3cgPSBmYWxzZQojIEFsbG93IGFjY2VzcyBpZiB0aGUgdXNlciBoYXMgdGhlIHJlcXVpcmVkIHBlcm1pc3Npb24KYWxsb3cgaWZ7CiAgICBpbnB1dC51c2VyID0gdXNlcgogICAgaW5wdXQuYWN0aW9uID0gYWN0aW9uCiAgICB1c2VyX2hhc19wZXJtaXNzaW9uKHVzZXIsIGFjdGlvbikKfQojIENoZWNrIGlmIHRoZSB1c2VyIGhhcyBwZXJtaXNzaW9uIGJhc2VkIG9uIHRoZWlyIHJvbGUKdXNlcl9oYXNfcGVybWlzc2lvbih1c2VyLCBhY3Rpb24pIGlmewogICAgcm9sZSA6PSB1c2Vyc1t1c2VyXS5yb2xlIAogICAgYWN0aW9uIGluIHJvbGVzW3JvbGVdCn0KIyBBbGxvdyBhY2Nlc3MgZm9yIGEgZ3JvdXAgaWYgYW55IHVzZXIgaW4gdGhlIGdyb3VwIGhhcyB0aGUgcmVxdWlyZWQgcGVybWlzc2lvbgphbGxvd19ncm91cCBpZnsKICAgIGlucHV0Lmdyb3VwID0gZ3JvdXAKICAgIGlucHV0LmFjdGlvbiA9IGFjdGlvbgogICAgdXNlcl9pbl9ncm91cCA6PSBncm91cHNbZ3JvdXBdCiAgICB1c2VyX2hhc19wZXJtaXNzaW9uKHVzZXJfaW5fZ3JvdXAsIGFjdGlvbikgCn0KIyBBbGxvdyBhY2Nlc3MgdG8gZG9jdW1lbnRzIGJhc2VkIG9uIHRoZSB1c2VyJ3MgZG9jdW1lbnQgb3duZXJzaGlwCmFsbG93X2RvY3VtZW50X2FjY2VzcyBpZnsKICAgIGlucHV0LnVzZXIgPSB1c2VyCiAgICBpbnB1dC5kb2N1bWVudF9pZCA9IGRvY3VtZW50X2lkCiAgICBkb2N1bWVudF9vd25lciA6PSBkb2N1bWVudHNbZG9jdW1lbnRfaWRdLm93bmVyCiAgICB1c2VyID09IGRvY3VtZW50X293bmVyCn0=
+ policy:
+ abac: cGFja2FnZSBhYmFjCgppbXBvcnQgcmVnby52MQoKZGVmYXVsdCBhbGxvdyA6PSBmYWxzZQoKYWxsb3cgaWYgewogdmlld2FibGVfc2Vuc29yX2RhdGEKIGFjdGlvbl9pc19yZWFkCn0KCmFjdGlvbl9pc19yZWFkIGlmICJyZWFkIiBpbiBpbnB1dC5hY3Rpb25zCgp2aWV3YWJsZV9zZW5zb3JfZGF0YSBjb250YWlucyB2aWV3X2RhdGEgaWYgewogc29tZSBzZW5zb3JfZGF0YSBpbiBkYXRhLmFiYWMuc2Vuc29yX2RhdGEKIHNlbnNvcl9kYXRhLnRpbWVzdGFtcCA+PSBpbnB1dC50aW1lX3BlcmlvZC5mcm9tCiBzZW5zb3JfZGF0YS50aW1lc3RhbXAgPCBpbnB1dC50aW1lX3BlcmlvZC50bwoKIHZpZXdfZGF0YSA6PSB7ZGF0YXR5cGU6IHNlbnNvcl9kYXRhW2RhdGF0eXBlXSB8IGRhdGF0eXBlIGluIGlucHV0LmRhdGF0eXBlc30KfQ==
+ name: abac
+ version: 1.0.7
+ metadata:
+ policy-id: abac
+ policy-version: 1.0.7
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-output.json b/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-output.json
new file mode 100644
index 00000000..87c968bb
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-abac-output.json
@@ -0,0 +1,96 @@
+{
+ "data": {
+ "sensor_data": [
+ {
+ "humidity": "40%",
+ "id": "0001",
+ "location": "Sri Lanka",
+ "particle_density": "1.3 g/l",
+ "precipitation": "1000 mm",
+ "temperature": "28 C",
+ "timestamp": "2024-02-26",
+ "windspeed": "5.5 m/s"
+ },
+ {
+ "humidity": "45%",
+ "id": "0002",
+ "location": "Colombo",
+ "particle_density": "1.5 g/l",
+ "precipitation": "1200 mm",
+ "temperature": "30 C",
+ "timestamp": "2024-02-26",
+ "windspeed": "6.0 m/s"
+ },
+ {
+ "humidity": "60%",
+ "id": "0003",
+ "location": "Kandy",
+ "particle_density": "1.1 g/l",
+ "precipitation": "800 mm",
+ "temperature": "25 C",
+ "timestamp": "2024-02-26",
+ "windspeed": "4.5 m/s"
+ },
+ {
+ "humidity": "30%",
+ "id": "0004",
+ "location": "Galle",
+ "particle_density": "1.8 g/l",
+ "precipitation": "500 mm",
+ "temperature": "35 C",
+ "timestamp": "2024-02-27",
+ "windspeed": "7.2 m/s"
+ },
+ {
+ "humidity": "20%",
+ "id": "0005",
+ "location": "Jaffna",
+ "particle_density": "0.9 g/l",
+ "precipitation": "300 mm",
+ "temperature": "-5 C",
+ "timestamp": "2024-02-27",
+ "windspeed": "3.8 m/s"
+ },
+ {
+ "humidity": "55%",
+ "id": "0006",
+ "location": "Trincomalee",
+ "particle_density": "1.2 g/l",
+ "precipitation": "1000 mm",
+ "temperature": "20 C",
+ "timestamp": "2024-02-28",
+ "windspeed": "5.0 m/s"
+ },
+ {
+ "humidity": "50%",
+ "id": "0007",
+ "location": "Nuwara Eliya",
+ "particle_density": "1.3 g/l",
+ "precipitation": "600 mm",
+ "temperature": "25 C",
+ "timestamp": "2024-02-28",
+ "windspeed": "4.0 m/s"
+ },
+ {
+ "humidity": "40%",
+ "id": "0008",
+ "location": "Anuradhapura",
+ "particle_density": "1.4 g/l",
+ "precipitation": "700 mm",
+ "temperature": "28 C",
+ "timestamp": "2024-02-29",
+ "windspeed": "5.8 m/s"
+ },
+ {
+ "humidity": "65%",
+ "id": "0009",
+ "location": "Matara",
+ "particle_density": "1.6 g/l",
+ "precipitation": "900 mm",
+ "temperature": "32 C",
+ "timestamp": "2024-02-29",
+ "windspeed": "6.5 m/s"
+ }
+ ]
+ }
+}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-resource-not-found.json b/csit/resources/tests/data/onap.policy.opa.pdp.policy-resource-not-found.json
new file mode 100644
index 00000000..3fd7170e
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-resource-not-found.json
@@ -0,0 +1,5 @@
+{
+ "errorMessage": "Error in getting data - storage_not_found_error: /node/vehicle: document does not exist",
+ "policyName": "",
+ "responseCode": "resource_not_found"
+}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-create.yaml b/csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-create.yaml
new file mode 100644
index 00000000..93af4a93
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-create.yaml
@@ -0,0 +1,17 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+topology_template:
+ policies:
+ - vehicle:
+ type: onap.policies.native.opa
+ type_version: 1.0.0
+ properties:
+ data:
+ node.vehicle: ewogICJ2ZWhpY2xlcyI6IFsKICAgIHsgInZlaGljbGVfaWQiOiAidjEiLCAib3duZXIiOiAidXNlcjEiLCAidHlwZSI6ICJjYXIiLCAic3RhdHVzIjogImF2YWlsYWJsZSIgfSwKICAgIHsgInZlaGljbGVfaWQiOiAidjIiLCAib3duZXIiOiAidXNlcjIiLCAidHlwZSI6ICJiaWtlIiwgInN0YXR1cyI6ICJpbiB1c2UiIH0KICBdCn0K
+ policy:
+ vehicle: cGFja2FnZSB2ZWhpY2xlCgppbXBvcnQgIHJlZ28udjEKCmRlZmF1bHQgYWxsb3cgOj0gZmFsc2UKCmFsbG93IGlmIHsKICAgIHVzZXJfaGFzX3ZlaGljbGVfYWNjZXNzCiAgICBhY3Rpb25faXNfZ3JhbnRlZAp9CgphY3Rpb25faXNfZ3JhbnRlZCBpZiB7CiAgICAidXNlIiBpbiBpbnB1dC5hY3Rpb25zCn0KCnVzZXJfaGFzX3ZlaGljbGVfYWNjZXNzIGNvbnRhaW5zIHZlaGljbGVfZGF0YSBpZiB7CiAgICBzb21lIHZlaGljbGUgaW4gZGF0YS5ub2RlLnZlaGljbGUudmVoaWNsZXMKICAgIHZlaGljbGUudmVoaWNsZV9pZCA9PSBpbnB1dC52ZWhpY2xlX2lkCiAgICB2ZWhpY2xlLm93bmVyID09IGlucHV0LnVzZXIKICAgIHZlaGljbGVfZGF0YSA6PSB7aW5mbzogdmVoaWNsZVtpbmZvXSB8IGluZm8gaW4gaW5wdXQuYXR0cmlidXRlc30KfQo=
+ name: vehicle
+ version: 1.0.6
+ metadata:
+ policy-id: vehicle
+ policy-version: 1.0.6
+
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-deploy.json b/csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-deploy.json
new file mode 100644
index 00000000..ed275a25
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-deploy.json
@@ -0,0 +1,9 @@
+{
+ "policies": [
+ {
+ "policy-id": "vehicle",
+ "policy-version": "1.0.6"
+ }
+ ]
+}
+
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-output.json b/csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-output.json
new file mode 100644
index 00000000..09148079
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-vehicle-output.json
@@ -0,0 +1,18 @@
+{
+ "data": {
+ "vehicles": [
+ {
+ "owner": "user1",
+ "status": "available",
+ "type": "car",
+ "vehicle_id": "v1"
+ },
+ {
+ "owner": "user2",
+ "status": "in use",
+ "type": "bike",
+ "vehicle_id": "v2"
+ }
+ ]
+ }
+}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-create.yaml b/csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-create.yaml
new file mode 100644
index 00000000..47179c29
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-create.yaml
@@ -0,0 +1,17 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+topology_template:
+ policies:
+ - zoneB:
+ type: onap.policies.native.opa
+ type_version: 1.0.0
+ properties:
+ data:
+ node.zoneB: ewogICJ6b25lIjogewogICAgInpvbmVfYWNjZXNzX2xvZ3MiOiBbCiAgICAgIHsgImxvZ19pZCI6ICJsb2cxIiwgInRpbWVzdGFtcCI6ICIyMDI0LTExLTAxVDA5OjAwOjAwWiIsICJ6b25lX2lkIjogInpvbmVBIiwgImFjY2VzcyI6ICJncmFudGVkIiwgInVzZXIiOiAidXNlcjEiIH0sCiAgICAgIHsgImxvZ19pZCI6ICJsb2cyIiwgInRpbWVzdGFtcCI6ICIyMDI0LTExLTAxVDEwOjMwOjAwWiIsICJ6b25lX2lkIjogInpvbmVBIiwgImFjY2VzcyI6ICJkZW5pZWQiLCAidXNlciI6ICJ1c2VyMiIgfSwKICAgICAgeyAibG9nX2lkIjogImxvZzMiLCAidGltZXN0YW1wIjogIjIwMjQtMTEtMDFUMTE6MDA6MDBaIiwgInpvbmVfaWQiOiAiem9uZUIiLCAiYWNjZXNzIjogImdyYW50ZWQiLCAidXNlciI6ICJ1c2VyMyIgfQogICAgXQogIH0KfQ==
+ policy:
+ zoneB: cGFja2FnZSB6b25lQgogCmltcG9ydCByZWdvLnYxCiAKZGVmYXVsdCBhbGxvdyA6PSBmYWxzZQogCmFsbG93IGlmIHsKICAgIGhhc196b25lX2FjY2VzcwogICAgYWN0aW9uX2lzX2xvZ192aWV3Cn0KIAphY3Rpb25faXNfbG9nX3ZpZXcgaWYgewogICAgInZpZXciIGluIGlucHV0LmFjdGlvbnMKfQogCmhhc196b25lX2FjY2VzcyBjb250YWlucyBhY2Nlc3NfZGF0YSBpZiB7CiAgICBzb21lIHpvbmVfZGF0YSBpbiBkYXRhLm5vZGUuem9uZUIuem9uZS56b25lX2FjY2Vzc19sb2dzCiAgICB6b25lX2RhdGEudGltZXN0YW1wID49IGlucHV0LnRpbWVfcGVyaW9kLmZyb20KICAgIHpvbmVfZGF0YS50aW1lc3RhbXAgPCBpbnB1dC50aW1lX3BlcmlvZC50bwogICAgem9uZV9kYXRhLnpvbmVfaWQgPT0gaW5wdXQuem9uZV9pZAogICAgYWNjZXNzX2RhdGEgOj0ge2RhdGF0eXBlOiB6b25lX2RhdGFbZGF0YXR5cGVdIHwgZGF0YXR5cGUgaW4gaW5wdXQuZGF0YXR5cGVzfQp9
+ name: zoneB
+ version: 1.0.6
+ metadata:
+ policy-id: zoneB
+ policy-version: 1.0.6
+
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-deploy.json b/csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-deploy.json
new file mode 100644
index 00000000..ad5b3bd9
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-deploy.json
@@ -0,0 +1,8 @@
+{
+ "policies": [
+ {
+ "policy-id": "zoneB",
+ "policy-version": "1.0.6"
+ }
+ ]
+}
diff --git a/csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-output.json b/csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-output.json
new file mode 100644
index 00000000..d1d8e687
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.opa.pdp.policy-zone-output.json
@@ -0,0 +1,27 @@
+{
+ "data":{
+ "zone_access_logs":[
+ {
+ "access":"granted",
+ "log_id":"log1",
+ "timestamp":"2024-11-01T09:00:00Z",
+ "user":"user1",
+ "zone_id":"zoneA"
+ },
+ {
+ "access":"denied",
+ "log_id":"log2",
+ "timestamp":"2024-11-01T10:30:00Z",
+ "user":"user2",
+ "zone_id":"zoneA"
+ },
+ {
+ "access":"granted",
+ "log_id":"log3",
+ "timestamp":"2024-11-01T11:00:00Z",
+ "user":"user3",
+ "zone_id":"zoneB"
+ }
+ ]
+ }
+}
diff --git a/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-incorrect-policyfilter.json b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-incorrect-policyfilter.json
new file mode 100644
index 00000000..223dddbb
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-incorrect-policyfilter.json
@@ -0,0 +1,16 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDate": "2024-11-22",
+ "policyName": "abac",
+ "policyFilter": ["viewable_sesor_data"],
+ "input": {
+ "actions": ["read"],
+ "datatypes": ["location", "temperature", "precipitation", "windspeed"],
+ "time_period": {
+ "from": "2024-02-27",
+ "to": "2024-02-29"
+ }
+ }
+}
diff --git a/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-incorrect-policyname.json b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-incorrect-policyname.json
new file mode 100644
index 00000000..a1628bb9
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-incorrect-policyname.json
@@ -0,0 +1,16 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDate": "2024-11-22",
+ "policyName": "abc",
+ "policyFilter": ["viewable_sensor_data"],
+ "input": {
+ "actions": ["read"],
+ "datatypes": ["location", "temperature", "precipitation", "windspeed"],
+ "time_period": {
+ "from": "2024-02-27",
+ "to": "2024-02-29"
+ }
+ }
+}
diff --git a/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-output.json b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-output.json
new file mode 100644
index 00000000..f3bd987d
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-output.json
@@ -0,0 +1,32 @@
+{
+ "output": {
+ "viewable_sensor_data": [
+ {
+ "location": "Galle",
+ "precipitation": "500 mm",
+ "temperature": "35 C",
+ "windspeed": "7.2 m/s"
+ },
+ {
+ "location": "Jaffna",
+ "precipitation": "300 mm",
+ "temperature": "-5 C",
+ "windspeed": "3.8 m/s"
+ },
+ {
+ "location": "Nuwara Eliya",
+ "precipitation": "600 mm",
+ "temperature": "25 C",
+ "windspeed": "4.0 m/s"
+ },
+ {
+ "location": "Trincomalee",
+ "precipitation": "1000 mm",
+ "temperature": "20 C",
+ "windspeed": "5.0 m/s"
+ }
+ ]
+ },
+ "policyName": "abac",
+ "statusMessage": "OPA Allowed"
+}
diff --git a/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-pemit-policy.json b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-pemit-policy.json
new file mode 100644
index 00000000..fadf05bb
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.abac-pemit-policy.json
@@ -0,0 +1,16 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDate": "2024-11-22",
+ "policyName": "abac",
+ "policyFilter": ["viewable_sensor_data"],
+ "input": {
+ "actions": ["read"],
+ "datatypes": ["location", "temperature", "precipitation", "windspeed"],
+ "time_period": {
+ "from": "2024-02-27",
+ "to": "2024-02-29"
+ }
+ }
+}
diff --git a/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyfilter.json b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyfilter.json
new file mode 100644
index 00000000..290fd60d
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyfilter.json
@@ -0,0 +1,15 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDate": "2024-11-22",
+ "policyName": "vehicle",
+ "policyFilter": ["user_has_vecle_access"],
+ "input": {
+ "actions": ["use"],
+ "user": "user1",
+ "vehicle_id": "v1",
+ "attributes": ["type", "status"]
+ }
+}
+
diff --git a/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyname.json b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyname.json
new file mode 100644
index 00000000..b5f50b64
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyname.json
@@ -0,0 +1,15 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDate": "2024-11-22",
+ "policyName": "vehile",
+ "policyFilter": ["user_has_vehicle_access"],
+ "input": {
+ "actions": ["use"],
+ "user": "user1",
+ "vehicle_id": "v1",
+ "attributes": ["type", "status"]
+ }
+}
+
diff --git a/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle_input.json b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle_input.json
new file mode 100644
index 00000000..4ea1638a
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle_input.json
@@ -0,0 +1,14 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDate": "2024-11-22",
+ "policyName": "vehicle",
+ "policyFilter": ["user_has_vehicle_access"],
+ "input": {
+ "actions": ["use"],
+ "user": "user1",
+ "vehicle_id": "v1",
+ "attributes": ["type", "status"]
+ }
+}
diff --git a/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle_output.json b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle_output.json
new file mode 100644
index 00000000..c6271b21
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.vehicle_output.json
@@ -0,0 +1,12 @@
+{
+ "output": {
+ "user_has_vehicle_access": [
+ {
+ "status": "available",
+ "type": "car"
+ }
+ ]
+ },
+ "policyName": "vehicle",
+ "statusMessage": "OPA Allowed"
+}
diff --git a/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.zone-policy-input.json b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.zone-policy-input.json
new file mode 100644
index 00000000..0dca9cdc
--- /dev/null
+++ b/csit/resources/tests/data/onap.policy.policy.opa.pdp.decision.zone-policy-input.json
@@ -0,0 +1,18 @@
+{
+ "onapName": "CDS",
+ "onapComponent": "CDS",
+ "onapInstance": "CDS",
+ "currentDate": "2024-11-22",
+ "policyName": "zoneB",
+ "policyFilter": ["has_zone_access"],
+ "input": {
+ "actions": ["view"],
+ "log_id": "log1",
+ "datatypes": ["access", "user"],
+ "time_period": {
+ "from": "2024-11-01T09:00:00Z",
+ "to": "2024-11-01T10:00:00Z"
+ },
+ "zone_id": "zoneA"
+ }
+}
diff --git a/csit/resources/tests/opa-pdp-common.robot b/csit/resources/tests/opa-pdp-common.robot
new file mode 100644
index 00000000..c4eba43a
--- /dev/null
+++ b/csit/resources/tests/opa-pdp-common.robot
@@ -0,0 +1,11 @@
+*** Settings ***
+
+*** Keywords ***
+
+Is Variable Dictionary
+ [Arguments] ${variable}
+ ${is_dict}= Set Variable False
+ ${status} ${result}= Run Keyword And Ignore Error Should Contain ${variable} data
+ Run Keyword If '${status}'
+ ... Set Variable ${is_dict}= True # It means it's a dictionary.
+ RETURN ${is_dict}
diff --git a/csit/resources/tests/opa-pdp-test.robot b/csit/resources/tests/opa-pdp-test.robot
index 8e059ffd..98e413c4 100644
--- a/csit/resources/tests/opa-pdp-test.robot
+++ b/csit/resources/tests/opa-pdp-test.robot
@@ -5,27 +5,64 @@ Library OperatingSystem
Library Process
Library json
Resource common-library.robot
-
+Resource opa-pdp-common.robot
*** Variables ***
${OPA_PDP_HOST} /policy/pdpo/v1/healthcheck
${url} /policy/pdpo/v1/decision
+${DATA_URL} /policy/pdpo/v1/data/
*** Test Cases ***
Healthcheck
[Documentation] Verify OPA PDP health check
PdpxGetReq ${OPA_PDP_HOST} <Response [200]>
-ValidatingPolicyWithoutPolicyFilter
- [Documentation] Validating the policy without giving policy filter
- ValidatePolicyResponseWithoutFilter onap.policy.opa.pdp.decision.request.json 400 onap.policy.opa.pdp.decision.request.output.json
+ValidateDataBeforePolicyDeployment
+ ValidateGetDynamicData ${DATA_URL} 200 onap.policy.opa.pdp.data-empty.json data
+
+ValidatesZonePolicy
+ CreateOpaPolicy onap.policy.opa.pdp.policy-zone-create.yaml zoneB 1.0.3 201
+ DeployOpaPolicy onap.policy.opa.pdp.policy-zone-deploy.json zoneB
+ ${URL_CONTEXT}= Set Variable node/zoneB/zone
+ ${DYNAMIC_URL}= Set Variable ${DATA_URL}${URL_CONTEXT}
+ ValidateGetDynamicData ${DYNAMIC_URL} 200 onap.policy.opa.pdp.policy-zone-output.json data
+ ValidatePolicyResponse onap.policy.policy.opa.pdp.decision.zone-policy-input.json 200 onap.policy.opa.pdp.decision.zone-policy-output.json
+ ValidateIncorrectPolicyNameResponse onap.policy.opa.pdp.decision.zone-incorrect-policyname.json 400
+ ValidateIncorrectPolicyFilterResponse onap.policy.opa.pdp.decision.zone-incorrect-policyfilter.json 200
+ UndeployOpaPolicy /policy/pap/v1/pdps/policies/zoneB 202
+ UndeployOpaPolicy /policy/pap/v1/pdps/policies/zoneB 400
-ValidatingPolicyWithPolicyFilter
- [Documentation] Validating the policy with policy filter
- ValidatePolicyResponse onap.policy.opa.pdp.decision.request_filter.json 200 onap.policy.opa.pdp.decision.filter_response.json
+ValidatesVehiclePolicy
+ CreateOpaPolicy onap.policy.opa.pdp.policy-vehicle-create.yaml vehicle 1.0.3 201
+ DeployOpaPolicy onap.policy.opa.pdp.policy-vehicle-deploy.json vehicle
+ ${URL_CONTEXT}= Set Variable node/vehicle
+ ${DYNAMIC_URL}= Set Variable ${DATA_URL}${URL_CONTEXT}
+ ValidateGetDynamicData ${DYNAMIC_URL} 200 onap.policy.opa.pdp.policy-vehicle-output.json data
+ ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-add.json 204
+ ValidateGetDynamicData ${DYNAMIC_URL} 200 onap.policy.opa.pdp.dyn-data-add-output.json data
+ ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-replace.json 204
+ ValidateGetDynamicData ${DYNAMIC_URL} 200 onap.policy.opa.pdp.dyn-data-replace-output.json data
+ ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-remove.json 204
+ ValidateGetDynamicData ${DYNAMIC_URL} 200 onap.policy.opa.pdp.policy-vehicle-output.json data
+ ValidatePolicyResponse onap.policy.policy.opa.pdp.decision.vehicle_input.json 200 onap.policy.policy.opa.pdp.decision.vehicle_output.json
+ ValidateIncorrectPolicyNameResponse onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyname.json 400
+ ValidateIncorrectPolicyFilterResponse onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyfilter.json 200
+ UndeployOpaPolicy /policy/pap/v1/pdps/policies/vehicle 202
+ UndeployOpaPolicy /policy/pap/v1/pdps/policies/vehicle 400
+ ValidateGetDynamicData ${DYNAMIC_URL} 404 onap.policy.opa.pdp.policy-resource-not-found.json responseCode
+ ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-remove.json 400
-ValidatingPolicyWithEmptyPolicyFilter
- [Documentation] Validating the policy with empty policy filter
- ValidatePolicyResponse onap.policy.opa.pdp.decision.request_filter_empty.json 200 onap.policy.opa.pdp.decision.empty_filter_response.json
+ValidatesAbacPolicy
+ CreateOpaPolicy onap.policy.opa.pdp.policy-abac-create.yaml abac 1.0.2 201
+ DeployOpaPolicy onap.policy.opa.pdp.policy-abac-deploy.json abac
+ ${URL_CONTEXT}= Set Variable node/abac
+ ${DYNAMIC_URL}= Set Variable ${DATA_URL}${URL_CONTEXT}
+ ValidateGetDynamicData ${DYNAMIC_URL} 200 onap.policy.opa.pdp.policy-abac-output.json data
+ ValidatePolicyResponse onap.policy.policy.opa.pdp.decision.abac-pemit-policy.json 200 onap.policy.policy.opa.pdp.decision.abac-output.json
+ ValidateIncorrectPolicyNameResponse onap.policy.policy.opa.pdp.decision.abac-incorrect-policyname.json 400
+ ValidateIncorrectPolicyFilterResponse onap.policy.policy.opa.pdp.decision.abac-incorrect-policyfilter.json 200
+ CreatePolicyDeployFailure onap.policy.opa.pdp.policy-abac-duplicate-create.yaml 406 NOT_ACCEPTABLE
+ UndeployOpaPolicy /policy/pap/v1/pdps/policies/abac 202
+ UndeployOpaPolicy /policy/pap/v1/pdps/policies/abac 400
*** Keywords ***
PdpxGetReq
@@ -35,6 +72,34 @@ PdpxGetReq
${resp}= PerformGetRequest ${POLICY_OPA_IP} ${url} 200 null ${hcauth}
Should Be Equal As Strings ${resp} ${status}
+CreateOpaPolicy
+ [Documentation] Create a opa policy
+ [Arguments] ${jsonfile} ${policy_name} ${policy_version} ${expected_status}
+ ${postjson}= Get file ${CURDIR}/data/${jsonfile}
+ CreatePolicyWithYaml /policy/api/v1/policytypes/onap.policies.native.opa/versions/1.0.0/policies ${expected_status} ${postjson}
+
+CreatePolicyDeployFailure
+ [Documentation] Create a Failure opa policy
+ [Arguments] ${jsonfile} ${expected_status} ${keyword}
+ ${postjson}= Get file ${CURDIR}/data/onap.policy.opa.pdp.policy-abac-duplicate-create.yaml
+ CreateFailurePolicyWithYaml /policy/api/v1/policytypes/onap.policies.native.opa/versions/1.0.0/policies ${expected_status} ${postjson} ${keyword}
+
+DeployOpaPolicy
+ [Documentation] Runs Policy PAP to deploy a policy
+ [Arguments] ${jsonfile} ${policy_name}
+ ${postjson}= Get file ${CURDIR}/data/${jsonfile}
+ ${policyadmin}= PolicyAdminAuth
+ PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies 202 ${postjson} null ${policyadmin}
+ Sleep 20sec
+ ${result}= CheckKafkaTopic policy-notification ${policy_name}
+ Should Contain ${result} deployed-policies
+
+UndeployOpaPolicy
+ [Documentation] Runs Policy PAP to undeploy a policy
+ [Arguments] ${url} ${expected_status}
+ ${policyadmin}= PolicyAdminAuth
+ PerformDeleteRequest ${POLICY_PAP_IP} ${url} ${expected_status} ${policyadmin}
+
ValidatePolicyResponse
[Documentation] Validating the output for the policy
[Arguments] ${jsonfile} ${status} ${jsonfile1}
@@ -48,6 +113,31 @@ ValidatePolicyResponse
${expected_output}= Get From Dictionary ${expected_value} output
Dictionaries Should Be Equal ${response_data} ${expected_output}
+ValidateGetDynamicData
+ [Documentation] Validating the output for the policy
+ [Arguments] ${dyn_url} ${status} ${jsonfile1} ${json_key_name}
+ ${expectedStatus}= Set Variable ${status}
+ ${expected_data}= Get file ${CURDIR}/data/${jsonfile1}
+ ${hcauth}= PolicyAdminAuth
+ ${resp}= PerformGetRequest ${POLICY_OPA_IP} ${dyn_url} ${expectedStatus} abbrev=true ${hcauth}
+ ${response_data}= Get From Dictionary ${resp.json()} ${json_key_name}
+ ${expected_value}= Evaluate json.loads('''${expected_data}''') json
+ ${expected_output}= Get From Dictionary ${expected_value} ${json_key_name}
+ ${is_dict}= Is Variable Dictionary ${response_data}
+ Run Keyword If ${is_dict}
+ ... Should Be Equal ${response_data} ${expected_output}
+ Run Keyword If not ${is_dict}
+ ... Should Be Equal As Strings ${response_data} ${expected_output}
+
+ValidatePatchDynamicData
+ [Documentation] Validating the output for the policy
+ [Arguments] ${dyn_url} ${jsonfile} ${status}
+ ${expectedStatus}= Set Variable ${status}
+ ${patchjson}= Get file ${CURDIR}/data/${jsonfile}
+ ${hcauth}= PolicyAdminAuth
+ ${resp}= PerformPatchRequest ${POLICY_OPA_IP} ${dyn_url} ${expectedStatus} ${patchjson} abbrev=true ${hcauth}
+ Should Be Equal As Integers ${resp.status_code} ${expectedStatus}
+
ValidatePolicyResponseWithoutFilter
[Documentation] Validating the output for the policy
[Arguments] ${jsonfile} ${status} ${jsonfile1}
@@ -61,4 +151,22 @@ ValidatePolicyResponseWithoutFilter
${expected_output}= Get From Dictionary ${expected_value} responseCode
Should Be Equal As Strings ${response_data} ${expected_output}
+ValidateIncorrectPolicyNameResponse
+ [Documentation] Validating the incorrect name output for the policy
+ [Arguments] ${jsonfile} ${status}
+ ${expectedStatus}= Set Variable ${status}
+ ${postjson}= Get file ${CURDIR}/data/${jsonfile}
+ ${hcauth}= PolicyAdminAuth
+ ${resp}= PerformPostRequest ${POLICY_OPA_IP} ${url} ${expectedStatus} ${postjson} abbrev=true ${hcauth}
+ ${response_data}= Get From Dictionary ${resp.json()} responseCode
+ Should Be Equal As Strings ${response_data} bad_request
+ValidateIncorrectPolicyFilterResponse
+ [Documentation] Validating the incorrect filter output for the policy
+ [Arguments] ${jsonfile} ${status}
+ ${expectedStatus}= Set Variable ${status}
+ ${postjson}= Get file ${CURDIR}/data/${jsonfile}
+ ${hcauth}= PolicyAdminAuth
+ ${resp}= PerformPostRequest ${POLICY_OPA_IP} ${url} ${expectedStatus} ${postjson} abbrev=true ${hcauth}
+ ${response_data}= Get From Dictionary ${resp.json()} output
+ Should Be Equal As Strings ${response_data} None