...
In this design option, native policy author needs to provide all necessaries in the payload of POST custom policy type impl call. The payload will use application/json or application/yaml as content-type. All the necessaries include native policy rules with or without configurable properties (e.g. drl with ${xxx}), java dependency descriptors (i.e. groupId, artifactId, version) and other configuration required by corresponding PDP engine to load/execute these new rules (e.g. drools controller configuration which includes controller-name, dmaap server, dmaap topics, java classes for serialization/deserialization, filter, custom serializer, etc.).
Policy type, policy type implementation and policy are organized as hierarchical resources in RESTful path. Policy type implementation payload should include which policy type this implementation is associated with. Likewise, policy payload should include which policy type and which type implementation this policy is created off. If policy type implementation is not present in endpoint path, it means to use default type implementation for associated policy type. Basically, the RESTful resource hierarchy can be expressed as
/policytypes/{policyTypeName}/versions/{policyTypeVersion}/policytypeimpls/{policyTypeImplName}/versions/{policyTypeImplVersion}/policies/{policyName}/versions/{policyVersion}
Some endpoint paths are exemplified in the following table:
HTTP Method | Endpoint | Content-Type | Description |
---|---|---|---|
POST/GET | /policytypes/{policyTypeName}/versions/{policyTypeVersion}/policytypeimpls | application/yaml application/json | Create new custom policy type implementation(s) for an existing policy type version Retrieve custom policy type implementation(s) for an existing policy type version |
GET/PUT/DELETE | /policytypes/{policyTypeName}/versions/{policyTypeVersion}/policytypeimpls/{policyTypeImplName}/versions/{policyTypeImplVersion} | application/yaml application/json | Retrieve a particular version of policy type implementation for an existing policy type version Update a particular version of policy type implementation for an existing policy type version Delete a particular version of policy type implementation for an existing policy type version |
GET | /policytypes/{policyTypeName}/versions/{policyTypeVersion}/policytypeimpls/{policyTypeImplName}/versions/latest | application/yaml application/json | Retrieve the latest version of policy type implementation for an existing policy type version |
POST/GET | /policytypes/{policyTypeName}/versions/{policyTypeVersion}/policytypeimpls/{policyTypeImplName}/versions/{policyTypeImplVersion}/policies | application/yaml application/json | Create new polic(ies) off existing policy type and type implementation Retrieve polic(ies) created off existing policy type and type implementation |
GET/PUT/DELETE | /policytypes/{policyTypeName}/versions/{policyTypeVersion}/policytypeimpls/{policyTypeImplName}/versions/{policyTypeImplVersion}/policies/{policyName}/versions/{policyVersion} | application/yaml application/json | Retrieve a particular version of policy created off existing policy type and type implementation Update a particular version of policy created off existing policy type and type implementation Delee a particular version of policy created off existing policy type and type implementation |
GET | /policytypes/{policyTypeName}/versions/{policyTypeVersion}/policytypeimpls/{policyTypeImplName}/versions/{policyTypeImplVersion}/policies/{policyName}/versions/latest | application/yaml application/json | Retrieve the latest version of policy created off existing policy type and type implementation |
GET | /policytypes/{policyTypeName}/versions/{policyTypeVersion}/policytypeimpls/{policyTypeImplName}/versions/{policyTypeImplVersion}/policies/{policyName}/versions/deployed | application/yaml application/json | Retrieve the deployed version(s) of policy created off existing policy type and type implementation |
Code Block | ||
---|---|---|
| ||
policy_type_impls:
- onap.policies.controlloop.operational.opex.energysaving.Impl:
version: 1.0.0
type: onap.policies.controlloop.Operational
type_version: 1.0.0
pdp: drools
description: Implementation of opex energy saving drools rules
policy_body: "<policy body>"
properties:
dependencies:
- groupId: org.onap.policy.opex
artifactId: policy-energy-saving
version: 1.2.1-SNAPSHOT
controller:
name: ericsson-cell-sleep
config_body: "<config body>"
- onap.policies.controlloop.operational.opex.trafficoffloading.Impl:
version: 1.0.0
type: onap.policies.controlloop.Operational
type_version: 1.0.0
pdp: drools
description: Implementation of opex traffic offloading drools rules
policy_body: "<policy body>"
properties:
dependencies:
- groupId: org.onap.policy.opex
artifactId: policy-traffic-offloading
version: 1.0.0-SNAPSHOT
controller:
name: traffic-offloading
config_body: "<config body>" |
payload schema,
flow explanation, role of PAP and PDP-D,
...