Versions Compared

Key

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

...

Code Block
languagexml
titleExample payload with "application/vnd.onap.drools.mvn+xml" Content-Type
linenumberstrue
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>

  <dependencies>
    <dependency>
      <groupId>org.onap.policy.controlloop<native</groupId>
      <artifactId>policy-ran-optimization</artifactId>
      <version>1.0.0-SNAPSHOT</version>
    </dependency>
  </dependencies>

</project>

...

HTTP MethodEndpointContent-TypeDescriptionExample
POST/nativesapplication/vnd.onap.drools.mvn+xml

Creates a native drools policy.

Returns the id, version and created drl contents.

Note: policy-id policyId is the same as <artifactId> specified in the payload; policy- version is the same as <version> specified in the payload; <groupId> specified in the payload could be a fixed one for all native drools policies, e.g. org.onap.policy.native.

200

Code Block
{
 
  "policy-idpolicyId": "idexample-1policy",

   "policy-version": "1.0.0", 
   "policy-bodypdpType": "xxxxxxxdrools", 

   "pdp-typebody": "droolsxxxxx"
}


PUT/natives/{policy-idpolicyId}application/vnd.onap.drools+text

Updates a native drools policy.

Return the id, version and updated drl contents.

Note: policy- version is an auto-increased version on off the original one. For example. the original version is "1.0.0". After this PUT call, the version returned could be "1.0.1".

200

Code Block
{
 
  "policy-idpolicyId": "idexample-1policy",
 
  "policy-version": "1.0.1", 
   "policy-bodypdpType": "xxxxxxxdrools",
 
  "pdp-typebody": "drools" 
}xxxxx"
}


POST/PUT/natives/{policyId}application/xacml+xml; version=3.0

Create a native xacml policy


TBD


POST/PUT/natives/{policyId}application/vnd.onap.apex+jsonCreate a native apex policy

TBD


GET/natives

application/json

application/yaml

Returns a list of ID/Version of native policies

200

Code Block
{
  "policies": [
    { "policy-idpolicyId": "id-1",
      "policy-version": "1.0.0",
      "pdp-typepdpType": "drools"
    },
    {
      "policy-idpolicyId": "id-2",
      "policy-version": "1.1.0",
      "pdp-typepdpType": "xacml"
    },
    {
      "policy-id"policyId": "id-3",
      "policy-version": "1.2.0",
      "pdp-typepdpType": "apex"
    }
  ]
}


GET/natives/{policy-idpolicyId}

application/json

application/yaml

Get a list of versions

200

Code Block
{
  "policies": [
    { "policy-idpolicyId": "id-1",
      "policy-version": "1.0.0",
      "pdp-typepdpType": "drools"
    },
    {
      "policy-idpolicyId": "id-1",
      "policy-version": "1.0.1",
      "pdp-typepdpType": "drools"
    },
    {
      "policy-idpolicyId": "id-1",
      "policy-version": "1.0.2",
      "pdp-typepdpType": "drools"
    }
  ]
}


GET/natives/{policy-idpolicyId}/versions/{policy-versionpolicyVersion}

application/json

application/yaml



Get a particular version

200

Code Block
{
 
  "policy-idpolicyId": "idexample-1policy",
 
  "policy-version": "1.0.1",
 
  "policy-bodypdpType": "xxxxxxxdrools",
 
  "pdp-typebody": "droolsxxxxx" 
}


DELETEGET/natives/{policy-idpolicyId}/versions/{policy-version}latest

application/json

application/yaml

Delete a particular Get the latest version

200

Code Block
{
 
  "policy-idpolicyId": "idexample-1policy",

   "policy-version": "1.0.1", 
   "policy-bodypdpType": "xxxxxxxdrools",
 
  "pdp-typebody": "droolsxxxxx"

}

3. PAP Enhancements

PDP Engines must now register with the PAP the native Content-Type's they support in order for policies to be deployed by the PAP engine to the PDP's. This will require an additional parameter in the Group Deploy/Undeploy to list the supported Content-Type's for the PDP engine. The proposal is to add a field "supportedContentTypes".

3.1 Example of PDP Register

TODO - add example register from Drools PDP. Chenfei.

Code Block
show drools registration

Question: Do we need a version attached to the native content-type? Might be easier to keep it around.

3.2 Example PDP Group Deploy

...

languagejs
linenumberstrue

...

}


(optional) GET/natives/{policyId}/versions/deployed

application/json

application/yaml

Get the deployed version(s)

200

Code Block
{
  ("pdpGroup1","1.0.0"): [
    {
      "

...

policyId": "example-policy",

...

      "version": "1.0.0",
 

...

     "pdpType": "drools",
      "

...

body": "

...

xxxxx"
    },
    {
      

...

"

...

policyId": "example-policy"

...

,

...

 

...

 

...

 

...

 

...

 

...

 

...

"version": "1.1.0",
      

...

"

...

pdpType": "

...

drools",

...


      "

...

body": 

...

"xxxxx"
    }
  ]
}


DELETE/natives/{policyId}/versions/{policyVersion}

application/json

application/yaml

Delete a particular version

200

Code Block
{
  

...

"

...

policyId": 

...

"example-policy",
  

...

"version": "1.0.1", 
  

...

"pdpType": "

...

drools",

...


  "

...

body": 

...

"xxxxx"
}

A safety net should be implemented for DELETE. That is, if a policy version is deployed in any PDP, it cannot be deleted. A 409 Conflict should be returned along with message saying this policy id:version is deployed in which PDP.

3. PAP Enhancements

PDP Engines must now register with the PAP the native Content-Type's they support in order for policies to be deployed by the PAP engine to the PDP's. This will require an additional parameter in the Group Deploy/Undeploy to list the supported Content-Type's for the PDP engine. The proposal is to add a field "supportedContentTypes".

3.1 Example of PDP Register

TODO - add example register from Drools PDP. Chenfei.

Code Block
show drools registration

Question: Do we need a version attached to the native content-type? Might be easier to keep it around.

3.2 Example PDP Group Deploy

Code Block
languagejs
linenumberstrue
{
    "groups": [
        {
            "name": "defaultGroup",
            "description": "The default group that registers all supported policy types and pdps.",
            "pdpGroupState": "ACTIVE",
            "properties": {},
            "pdpSubgroups": [
                {
                    "pdpType": "apex",
                    "supportedPolicyTypes": [
                        {
                            "name": "onap.policies.controlloop.operational.Apex",
                            "version": "1.0.0"
                        }
                    ],
                    "supportedContentTypes": [
                        {
                            "name": "application/vnd.onap.policies.controlloop.operational.Apexapex+json",
                            "version": "1.0.0"
                        }
                    ],
                    "supportedContentTypespolicies": [],
                    "currentInstanceCount": 0,
    {                "desiredInstanceCount": 1,
            "name": "application/vnd.onap.apex+json",       "properties": {},
                    "versionpdpInstances": "1.0.0"[
                        }{
                    ],        "instanceId": "apex_35",
           "policies": [],                     "currentInstanceCountpdpState": 0,"ACTIVE",
                            "desiredInstanceCounthealthy": 1"HEALTHY",
                     "properties": {},       "message": "Pdp Heartbeat"
               "pdpInstances": [        }
                {    ]
                },
       "instanceId": "apex_35",        {
                    "pdpStatepdpType": "ACTIVEdrools",
   
                        "healthysupportedPolicyTypes": "HEALTHY",[
                        {
   "message": "Pdp Heartbeat"                         }
"name": "onap.policies.controlloop.Operational",
                   ]         "version": "1.0.0"
      },                 { }
                   "pdpType": "drools" ],
                    "supportedPolicyTypessupportedContentTypes": [
                        {
                            "name": "application/vnd.onap.policies.controlloop.Operationaldrools+text",
                            "version": "1.0.0"
                        }
                "
   ],                     "supportedContentTypes": [},
                        {
                            "name": "application/vnd.onap.drools.mvn+textxml",
                            "version": "1.0.0"
                        },
                    ],
   {                 "policies": [],
           "name": "application/vnd.onap.drools.mvn+xml"         "currentInstanceCount": 0,
                    "versiondesiredInstanceCount": "1.0.0",
                        }"properties": {},
                    ],
    "pdpInstances": [
               "policies": [],               {
      "currentInstanceCount": 0,                     "desiredInstanceCountinstanceId": 1,"dev-policy-drools-0",
                     "properties": {},       "pdpState": "ACTIVE",
               "pdpInstances": [            "healthy": "HEALTHY"
           {             }
               "instanceId": "dev-policy-drools-0",    ]
                },
       "pdpState": "ACTIVE",        {
                    "healthypdpType": "HEALTHYxacml",
                    "supportedPolicyTypes": [
       }                 {
   ]                 },        "name": "onap.policies.controlloop.guard.FrequencyLimiter",
       {                     "pdpTypeversion": "xacml",1.0.0"
                       "supportedPolicyTypes": [ },
                        {
                            "name": "onap.policies.controlloop.guard.FrequencyLimiterMinMax",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.controlloop.guard.MinMaxBlacklist",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.controlloop.guard.coordination.BlacklistFirstBlocksSecond",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.controlloop.guard.coordination.FirstBlocksSecondMonitoring",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.Monitoring.policies.monitoring.cdap.tca.hi.lo.app",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.monitoring.cdapdcaegen2.tcacollectors.hidatafile.lo.datafile-app-server",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.monitoring.dcaegen2docker.collectorssonhandler.datafile.datafile-app-server",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.monitoring.docker.sonhandler.appoptimization.AffinityPolicy",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.optimization.AffinityPolicyDistancePolicy",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.optimization.DistancePolicyHpaPolicy",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.optimization.HpaPolicyOptimizationPolicy",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.optimization.OptimizationPolicyPciPolicy",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.optimization.PciPolicyQueryPolicy",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.optimization.QueryPolicySubscriberPolicy",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.optimization.SubscriberPolicyVim_fit",
                            "version": "1.0.0"
                        },
                        {
                            "name": "onap.policies.optimization.VnfPolicy",
                            "version": "1.0.0"
             "name": "onap.policies.optimization.Vim_fit",          }
                  "version": "1.0.0"
 ],
                    "supportedContentTypes": [
 },
                        {
                            "name": "onap.policies.optimization.VnfPolicyapplication/xacml+xml; version=3.0",
                            "version": "1.0.0"
                        }
                    ],
                    "supportedContentTypespolicies": [],
                        {"currentInstanceCount": 1,
                             "name"desiredInstanceCount": "application/xacml+xml; version=3.0"1,
                    "properties": {},
      "version": "1.0.0"             "pdpInstances": [
          }              {
       ],                     "policiesinstanceId": [],"dev-policy-policy-xacml-pdp-558c478477-g85jl",
                            "currentInstanceCountpdpState": 1,"ACTIVE",
                            "desiredInstanceCounthealthy": 1, "HEALTHY"
                        }
     "properties": {},               ]
       "pdpInstances": [        }
            ]
   {     }
                       "instanceId": "dev-policy-policy-xacml-pdp-558c478477-g85jl",
                            "pdpState": "ACTIVE",
                            "healthy": "HEALTHY"]
}

3.3 Deploy/Undeploy API

Simple vs Fully - what changes are needed if any?? Chenfei

4. PDP Changes

Each PDP will need to be able to support native policies being deploy/undeployed to it as done today.

4.1 Drools PDP

Drools PDP will need to be able to instantiate a new controller instance and then ingest native DRL to that controller. First change needed is to expose telemetry API to external users, particularly the one being used to create a new controller. One example is shown as below

curl -k --user "demo@people.osaaf.org:demo123456!" -X POST --data @example-controller.rest.json --header "Content-Type: application/json" https://localhost:9696/policy/pdp/engine/controllers

Code Block
languagejs
titleexample-controller.rest.json
{
    "controller.name": "example-controller",
    
    "ueb.source.topics": "EXAMPLE-SOURCE-TOPIC",
    "ueb.source.topics.EXAMPLE-SOURCE-TOPIC.servers": "example-dmaap-server",
       }
                "ueb.source.topics.EXAMPLE-SOURCE-TOPIC.events": "example-source-event-class",
   ] 
    "ueb.sink.topics": "EXAMPLE-SINK-TOPIC",
    "ueb.sink.topics.EXAMPLE-SINK-TOPIC.servers": "example-dmaap-server",
   }
  "ueb.sink.topics.EXAMPLE-SINK-TOPIC.events": "example-sink-event-class",
    
     ]"rules.groupId": "org.onap.policy.controlloop",
        }"rules.artifactId": "policy-ran-optimization",
     ]
}

3.3 Deploy/Undeploy API

Simple vs Fully - what changes are needed if any?? Chenfei

4. PDP Changes

Each PDP will need to be able to support native policies being deploy/undeployed to it as done today.

4.1 Drools PDP

...

"rules.version": "1.0.0-SNAPSHOT"
}

In addition, when drools PDP receives native policy deployed from PAP, given the deployment contains groupId, artifactId and version, drools PDP will need to pull the java artifact that contains drl rules as well as corresponding dependency artifacts then place them in local m2 repo. When a new controller shown above is created, it will scan local m2, search for the artifact with specified "rules.groupId", "rules.artifactId" and "rules.version" and load its contained drl rules into drools memory.

4.2 XACML PDP

XACML PDP will need to be able to ingest a XACML XML directly. One suggestion is to create an application specifically for the XACML natives rules by default. The opportunity exists where a policy designer could create a specific application that supports native XACML policies (with or without TOSCA Policy Types as an option) and uses the grouping of PDPs to differentiate itself from the default XACML native rule application. The XACML PDP should also be enhanced to support configuring of applications in order to provide flexibility to the policy designers as to where all of its possible policy types and content types are deployed.

...