Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

OPA PDP after receiving the message on KAFKA will parse the message, extract policy, perform base64 decoding and deploys the policy to OPA. OPA PDP will send a PDP_STATUS message with the status of  policy deployment.

Policy Deployment - In Memory Mode

Drawio
mVer2
simple0
zoom1
inComment0
pageId81264688
custContentId82215397
diagramDisplayNameUntitled Diagram-1734262495141.drawio
lbox1
contentVer2
revision2
baseUrlhttps://lf-onap.atlassian.net/wiki
diagramNameUntitled Diagram-1734262495141.drawio
pCenter0
width694.5
links
tbstyle
height391.5

Policy Deployment - Bundle Mode

Drawio
mVer2
simple0
zoom1
inComment0
pageId81264688
custContentId82084473
diagramDisplayNameUntitled Diagram-1734262495141.drawio
lbox1
contentVer2
revision2
baseUrlhttps://lf-onap.atlassian.net/wiki
diagramName1734271988361-Untitled Diagram-1734262495141.drawio
pCenter0
width724.5
links
tbstyle
height453.5

Option: 2 Packing both static Data and Policy in the same message.

Create a new Policy Type which includes data field also

Code Block
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: string 
        type_version: 0.0.0
        description: Data for corresponding Rego policy
        required: false
        metadata:
          encoding: Base64
      policy:
        type: list 
        type_version: 0.0.0
        description: The Rego PolicySet or Policy
        required: true
        metadata:
          encoding: Base64

Create policy tosca definition for OPA

Code Block
Tosca Definition for OPA

tosca_definitions_version: tosca_simple_yaml_1_1_0
topology_template:
    policies:
        - native.cellconsistency.opa:
              type: onap.policies.native.opa
              type_version: 1.0.0
              properties:                  			        	     policy: cGFja2FnZSBjZWxsY29uc2lzdGVuY3kKCmltcG9ydCByZWdvLnYxCmRlZmF1bHQgYWxsb3cgPSBmYWxzZQojIFJ1bGUgdG8gY2hlY2sgY2VsbCBjb25zaXN0ZW5jeQpjaGVja19jZWxsX2NvbnNpc3RlbmN5IGlmIHsKICAgIGlucHV0LmNlbGwgPT0gZGF0YS5jZWxsY29uc2lzdGVuY3kuYWxsb3dlZENlbGxJZAp9CiMgUnVsZSB0byBhbGxvdyBpZiBQQ0kgaXMgd2l0aGluIHJhbmdlIDEtMzAwMAphbGxvd19pZl9wY2lfaW5fcmFuZ2UgaWYgewogICAgaW5wdXQuUENJID49IGRhdGEuY2VsbGNvbnNpc3RlbmN5Lm1pblBDSQogICAgaW5wdXQuUENJIDw9IGRhdGEuY2VsbGNvbnNpc3RlbmN5Lm1heFBDSQp9CiMgTWFpbiBydWxlIHRvIGRldGVybWluZSB0aGUgZmluYWwgZGVjaXNpb24KYWxsb3cgaWYgewogICBjaGVja19jZWxsX2NvbnNpc3RlbmN5CiAgIGFsbG93X2lmX3BjaV9pbl9yYW5nZQp9

                 data: eyAgIAogICJhbGxvd2VkQ2VsbElkIiA6IDQ0NTYxMTE5MzI2NTA0MDEyOSwgCiAgIm1pblBDSSI6IDEsIAogICJtYXhQQ0kiOiAzMDAwICAKIH0K
              name: native.cellconsistency.opa
              version: 1.0.0
              metadata:
                  policy-id: native.cellconsistency.opa
                  policy-version: 1.0.0