diff options
Diffstat (limited to 'docs/opa/resources')
-rw-r--r-- | docs/opa/resources/cell_consistency.json | 5 | ||||
-rw-r--r-- | docs/opa/resources/cell_consistency.rego | 14 | ||||
-rw-r--r-- | docs/opa/resources/cell_consistency.yaml | 17 | ||||
-rw-r--r-- | docs/opa/resources/cell_consistency_topology.rego | 6 | ||||
-rw-r--r-- | docs/opa/resources/data_add_request.json | 27 | ||||
-rw-r--r-- | docs/opa/resources/data_get_response.json | 7 | ||||
-rw-r--r-- | docs/opa/resources/data_remove_request.json | 18 | ||||
-rw-r--r-- | docs/opa/resources/data_replace_request.json | 18 | ||||
-rw-r--r-- | docs/opa/resources/decision_request.json | 16 | ||||
-rw-r--r-- | docs/opa/resources/decision_response.json | 6 | ||||
-rw-r--r-- | docs/opa/resources/onap.policies.native.opa.yaml | 27 | ||||
-rw-r--r-- | docs/opa/resources/registration_message.json | 15 | ||||
-rw-r--r-- | docs/opa/resources/response_to_pdp_state_change.json | 18 | ||||
-rw-r--r-- | docs/opa/resources/response_to_pdp_update.json | 19 |
14 files changed, 213 insertions, 0 deletions
diff --git a/docs/opa/resources/cell_consistency.json b/docs/opa/resources/cell_consistency.json new file mode 100644 index 00000000..3e397049 --- /dev/null +++ b/docs/opa/resources/cell_consistency.json @@ -0,0 +1,5 @@ +{ + "allowedCellId" : 445611193265040129, + "minPCI": 1, + "maxPCI": 3000 + }
\ No newline at end of file diff --git a/docs/opa/resources/cell_consistency.rego b/docs/opa/resources/cell_consistency.rego new file mode 100644 index 00000000..c5f3dd25 --- /dev/null +++ b/docs/opa/resources/cell_consistency.rego @@ -0,0 +1,14 @@ +package cell.consistency +import rego.v1 +import data.cell.consistency.topology +default allow = false +# Rule to allow if PCI is within range 1-3000 +allow_if_pci_in_range if { + input.PCI >= data.node.cell.consistency.minPCI + input.PCI <= data.node.cell.consistency.maxPCI +} +# Main rule to determine the final decision +allow if{ + topology.check_cell_consistency + allow_if_pci_in_range +}
\ No newline at end of file diff --git a/docs/opa/resources/cell_consistency.yaml b/docs/opa/resources/cell_consistency.yaml new file mode 100644 index 00000000..7437fcfa --- /dev/null +++ b/docs/opa/resources/cell_consistency.yaml @@ -0,0 +1,17 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +topology_template: + policies: + - cell.consistency: + type: onap.policies.native.opa + type_version: 1.0.0 + properties: + data: + node.cell.consistency: eyAgIAogICJhbGxvd2VkQ2VsbElkIiA6IDQ0NTYxMTE5MzI2NTA0MDEyOSwgCiAgIm1pblBDSSI6IDEsIAogICJtYXhQQ0kiOiAzMDAwICAKIH0= + policy: + cell.consistency: cGFja2FnZSBjZWxsLmNvbnNpc3RlbmN5CmltcG9ydCByZWdvLnYxCmltcG9ydCBkYXRhLmNlbGwuY29uc2lzdGVuY3kudG9wb2xvZ3kKZGVmYXVsdCBhbGxvdyA9IGZhbHNlCiMgUnVsZSB0byBhbGxvdyBpZiBQQ0kgaXMgd2l0aGluIHJhbmdlIDEtMzAwMAphbGxvd19pZl9wY2lfaW5fcmFuZ2UgIGlmIHsKICAgIGlucHV0LlBDSSA+PSBkYXRhLm5vZGUuY2VsbC5jb25zaXN0ZW5jeS5taW5QQ0kKICAgIGlucHV0LlBDSSA8PSBkYXRhLm5vZGUuY2VsbC5jb25zaXN0ZW5jeS5tYXhQQ0kKfQojIE1haW4gcnVsZSB0byBkZXRlcm1pbmUgdGhlIGZpbmFsIGRlY2lzaW9uCmFsbG93ICBpZnsKICAgIHRvcG9sb2d5LmNoZWNrX2NlbGxfY29uc2lzdGVuY3kKICAgIGFsbG93X2lmX3BjaV9pbl9yYW5nZQp9 + cell.consistency.topology: cGFja2FnZSBjZWxsLmNvbnNpc3RlbmN5LnRvcG9sb2d5CmltcG9ydCByZWdvLnYxCiMgUnVsZSB0byBjaGVjayBjZWxsIGNvbnNpc3RlbmN5CmNoZWNrX2NlbGxfY29uc2lzdGVuY3kgaWYgewogICAgaW5wdXQuY2VsbCAhPSBkYXRhLm5vZGUuY2VsbC5jb25zaXN0ZW5jeS5hbGxvd2VkQ2VsbElkCn0= + name: cell.consistency + version: 1.0.0 + metadata: + policy-id: cell.consistency + policy-version: 1.0.0
\ No newline at end of file diff --git a/docs/opa/resources/cell_consistency_topology.rego b/docs/opa/resources/cell_consistency_topology.rego new file mode 100644 index 00000000..e8f22f7e --- /dev/null +++ b/docs/opa/resources/cell_consistency_topology.rego @@ -0,0 +1,6 @@ +package cell.consistency.topology +import rego.v1 +# Rule to check cell consistency +check_cell_consistency if { + input.cell != data.node.cell.consistency.allowedCellId +}
\ No newline at end of file diff --git a/docs/opa/resources/data_add_request.json b/docs/opa/resources/data_add_request.json new file mode 100644 index 00000000..e41d9f4f --- /dev/null +++ b/docs/opa/resources/data_add_request.json @@ -0,0 +1,27 @@ +{ + "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": "cell.consistency", + "data": [ + { + "op": "add", + "path": "/test", + "value": { + "id": "s5", + "name": "job", + "protocols": [ + "amqp" + ], + "ports": [ + "p3" + ] + } + } + ] +}
\ No newline at end of file diff --git a/docs/opa/resources/data_get_response.json b/docs/opa/resources/data_get_response.json new file mode 100644 index 00000000..c7487c89 --- /dev/null +++ b/docs/opa/resources/data_get_response.json @@ -0,0 +1,7 @@ +{ + "data": { + "allowedCellId": 445611193265040100, + "maxPCI": 3000, + "minPCI": 1 + } +} diff --git a/docs/opa/resources/data_remove_request.json b/docs/opa/resources/data_remove_request.json new file mode 100644 index 00000000..ed091f9c --- /dev/null +++ b/docs/opa/resources/data_remove_request.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": "cell.consistency", + "data": [ + { + "op": "remove", + "path": "maxPCI", + "value": 4000 + } + ] +}
\ No newline at end of file diff --git a/docs/opa/resources/data_replace_request.json b/docs/opa/resources/data_replace_request.json new file mode 100644 index 00000000..ba41109b --- /dev/null +++ b/docs/opa/resources/data_replace_request.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": "cell.consistency", + "data": [ + { + "op": "replace", + "path": "maxPCI", + "value": 4000 + } + ] +}
\ No newline at end of file diff --git a/docs/opa/resources/decision_request.json b/docs/opa/resources/decision_request.json new file mode 100644 index 00000000..89661ac5 --- /dev/null +++ b/docs/opa/resources/decision_request.json @@ -0,0 +1,16 @@ +{ + "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": "cell.consistency", + "policyFilter": ["allow"], + "input": { + "cell": 445611193265040128, + "PCI": 2 + } +} diff --git a/docs/opa/resources/decision_response.json b/docs/opa/resources/decision_response.json new file mode 100644 index 00000000..45c2ef43 --- /dev/null +++ b/docs/opa/resources/decision_response.json @@ -0,0 +1,6 @@ +{ + "output": { + "allow": true + }, + "policyName": "cell.consistency" +}
\ No newline at end of file diff --git a/docs/opa/resources/onap.policies.native.opa.yaml b/docs/opa/resources/onap.policies.native.opa.yaml new file mode 100644 index 00000000..8d695c53 --- /dev/null +++ b/docs/opa/resources/onap.policies.native.opa.yaml @@ -0,0 +1,27 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.Native: + derived_from: tosca.policies.Root + description: a base policy type for all native PDP policies + version: 1.0.0 + name: onap.policies.Native + onap.policies.native.opa: + derived_from: onap.policies.Native + version: 1.0.0 + name: onap.policies.native.opa + description: a policy type for native opa policies + properties: + data: + type: map + type_version: 0.0.0 + description: The base64 encoded json data for Policy. + required: false + metadata: + encoding: Base64 + policy: + type: map + type_version: 0.0.0 + description: The base64 encoded rego PolicySet or Policy. + required: true + metadata: + encoding: Base64
\ No newline at end of file diff --git a/docs/opa/resources/registration_message.json b/docs/opa/resources/registration_message.json new file mode 100644 index 00000000..bd5d4b07 --- /dev/null +++ b/docs/opa/resources/registration_message.json @@ -0,0 +1,15 @@ +{ + "messageName": "PDP_STATUS", + "pdpType": "opa", + "state": "PASSIVE", + "healthy": "HEALTHY", + "description": "Pdp Status Registration Message", + "response": null, + "policies": [], + "name": "opa-4cd0a060-19bc-45ab-9955-7664d2b9604b", + "requestId": "9c73856c-3d02-4236-838f-3d58ea5cc058", + "pdpGroup": "opaGroup", + "pdpSubgroup": null, + "timestampMs": "1743010891210", + "deploymentInstanceInfo": "" +}
\ No newline at end of file diff --git a/docs/opa/resources/response_to_pdp_state_change.json b/docs/opa/resources/response_to_pdp_state_change.json new file mode 100644 index 00000000..f08cea6b --- /dev/null +++ b/docs/opa/resources/response_to_pdp_state_change.json @@ -0,0 +1,18 @@ +{ + "messageName": "PDP_STATUS", + "pdpType": "opa", + "state": "ACTIVE", + "healthy": "HEALTHY", + "description": "Pdp Status Response Message to Pdp State Change", + "response": { + "responseTo": "3edbb47c-b015-4fd9-9572-26cde97cc23c", + "responseStatus": "SUCCESS", + "responseMessage": "PDP State Changed From PASSIVE TO Active" + }, + "policies": null, + "name": "opa-949018d3-cc9b-429b-96ae-46ca9c314e42", + "requestId": "02b186a6-485d-4392-90fa-d4cac34be97a", + "pdpGroup": "defaultGroup", + "pdpSubgroup": "opa", + "timestampMs": "1731335550069" +}
\ No newline at end of file diff --git a/docs/opa/resources/response_to_pdp_update.json b/docs/opa/resources/response_to_pdp_update.json new file mode 100644 index 00000000..b1b65702 --- /dev/null +++ b/docs/opa/resources/response_to_pdp_update.json @@ -0,0 +1,19 @@ +{ + "messageName": "PDP_STATUS", + "pdpType": "opa", + "state": "PASSIVE", + "healthy": "HEALTHY", + "description": "Pdp Status Response Message For Pdp Update", + "response": { + "responseTo": "06f6d05f-6045-48d9-bcd8-40364fb695ae", + "responseStatus": "SUCCESS", + "responseMessage": "PDP Update was Successful" + }, + "policies": null, + "name": "opa-949018d3-cc9b-429b-96ae-46ca9c314e42", + "requestId": "e6a0607f-5fc8-4d62-afca-3cb984d827a3", + "pdpGroup": "defaultGroup", + "pdpSubgroup": "opa", + "timestampMs": "1731335550030", + "deploymentInstanceInfo":"" +}
\ No newline at end of file |