This page shows how the Policy Design and API Flow to/from the PAP and PDP's will work to support Model Driven Control Loops in Dublin.
The figure below shows the Artifacts (Blue) in the ONAP Policy Framework, the Activities (Yellow) that manipulate them, and important components (Pink) that interact with them.
Please see the TOSCA Policy Primer page for an introduction to TOSCA policy concepts.
TOSCA defines a PolicyType, the definition of a type of policy that can be applied to a service. It also defines a Policy, the definition of an instance of a PolicyType. In the Policy Framework, we must handle and manage these TOSCA definitions and tie them to real implementations of policies that can run on PDPs.
The diagram above outlines how this is achieved. Each TOSCA PolicyType must have a corresponding PolicyTypeImpl in the Policy Framework. The TOSCA PolicyType definition is used to create a TOSCA Policy definition, either directly by the Policy Framework, by CLAMP, or by some other system. Once the Policy artifact exists, it can be used together with the PolicyTypeImpl artifact to create a PolicyImpl artifact. A PolicyImpl artifact is an executable policy implementation that can run on a PDP.
The TOSCA PolicyType artifact defines the external characteristics of the policy; defining its properties, the types of entities it acts on, and its triggers. A PolicyTypeImpl artifact is an XACML, Drools, or APEX implementation of that policy definition. PolicyType and PolicyTypeImpl artifacts may be preloaded, may be loaded manually, or may be created using the Lifecycle API. Alternatively, PolicyType definitions may be loaded over the Lifecycle API for preloaded PolicyTypeImpl artifacts.
The TOSCA Policy artifact is used internally by the Policy Framework, or is input by CLAMP or other systems. This artifact specifies the values of the properties for the policy and specifies the specific entities the policy acts on. Policy Design uses the TOSCA Policy artifact and the PolicyTypeImpl artifact to create an executable PolicyImpl artifact.
1 Policy Types
Policy Type Design manages TOSCA PolicyType artifacts and their PolicyTypeImpl implementations.
TOSCA PolicyType may ultimately be defined by the modeling team but for now are defined by the Policy Framework project. Various editors and GUIs are available for creating PolicyTypeImpl implementations. However, systematic integration of PolicyTypeImpl implementation is outside the scope of the ONAP Dublin release.
The PolicyType definitions and implementations listed below are preloaded and are always available for use in the Policy Framework.
Policy Type | Description |
---|---|
onap.policies.Monitoring | Overarching model that supports Policy driven DCAE microservice components used in a Control Loops |
onap.policies.controlloop.Operational | Used to support actor/action operational policies for control loops |
onap.policies.controlloop.Guard | Control Loop guard policies for policing control loops |
onap.policies.controlloop.Coordination | Control Loop Coordination policies to assist in coordinating multiple control loops at runtime |
1.1 onap.policies.Monitoring Policy Type
This is a base Policy Type that supports Policy driven DCAE microservice components used in a Control Loops. The implementation of this Policy Type is developed using the XACML PDP to support question/answer Policy Decisions during runtime for the DCAE Policy Handler.
The PolicyTypeImpl implementation of the onap.policies.Montoring Policy Type is generic to support definition of TOSCA PolicyType artifacts in the Policy Framework using the Policy Type Design API. Therefore many TOSCA PolicyType artifacts will use the same PolicyTypeImpl implementation with different property types and towards different targets. This allows dynamically generated DCAE microservice component Policy Types to be created at Design Time.
DCAE microservice components can generate their own TOSCA PolicyType using TOSCA-Lab Control Loop guard policiesin SDC (Stretch Goal) or can do so manually. See How to generate artefacts for SDC catalog using Tosca Lab Tool for details on TOSCA-LAB in SDC.
TOSCA-LAB produces the following example yaml:
1.2 onap.policies.controlloop.Operational Policy Type
This policy type is used to support actor/action operational policies for control loops. There are two types of implementations for this policy type
- Existing Drools implementations that supports runtime Control Loop actions taken on components such as SO/APPC/VFC/SDNC/SDNR
- New implementations using APEX to support Control Loops.
TODO: Operational Policy Model Parameter Schema for Drools
TODO: Operational Policy Model Parameter Schema for APEX
1.3 onap.policies.controlloop.Guard Policy Type
This policy type is the the type definition for Control Loop guard policies for frequency limiting, blacklisting and min/max guards to help protect runtime Control Loop Actions from doing harm to the network. This policy type is developed using the XACML PDP to support question/answer Policy Decisions during runtime for the Drools and APEX onap.controlloop.Operational policy type implementations.
The base schema is defined as below:
As with onap.policies.Monitoring policy type, the PolicyTypeImpl implementation of the onap.policies.controlloop.Guard Policy Type is generic to support definition of TOSCA PolicyType artifacts in the Policy Framework using the Policy Type Design API.
The derived Policy Type definitions below are preloaded in the Policy Framework.
1.3.1 onap.policies.controlloop.Guard.FrequencyLimiter Policy Type
1.3.2 onap.policies.controlloop.Guard.Blacklist Policy Type
1.3.3 onap.policies.controlloop.Guard.MinMax Policy Type
1.3.4 onap.policies.controlloop.Coordination Policy Type (STRETCH)
This policy type defines Control Loop Coordination policies to assist in coordinating multiple control loops during runtime. This policy type is developed using XACML PDP to support question/answer policy decisions at runtime for the onap.policies.controlloop.operational policy types.
2 PDP Deployment and Registration with PAP
The unit of execution and scaling in the Policy Framework is a PolicyImpl entity. A PolicyImpl entity runs on a PDP. As is explained above a PolicyImpl entity is a PolicyTypeImpl implementation parameterized with a TOSCA Policy.
In order to achieve horizontal scalability, we group the PDPs running instances of a given PolicyImpl entity logically together into a PDPSubGroup. The number of PDPs in a PDPSubGroup can then be scaled up and down using Kubernetes. In other words, all PDPs in a subgroup run the same PolicyImpl, that is the same policy template implementation (in XACML, Drools, or APEX) with the same parameters.
The figure above shows the layout of PDPGroup and PDPSubGroup entities. The figure shows examples of PDP groups for Control Loop and Monitoring policies on the right.
The health of PDPs is monitored by the PAP in order to alert operations teams managing policy. The PAP manages the life cycle of policies running on PDPs.
The table below shows the methods in which PolicyImpl entities can be deployed to PDP Subgroups
Method | Description | Advantages | Disadvantages |
---|---|---|---|
Cold Deployment | The PolicyImpl (PolicyTypeImpl and TOSCA Policy) are predeployed on the PDP. The PDP is fully configured and ready to execute when started. PDPs register with the PAP when they start, providing the PolicyImpl they have been predeployed with. | No run time configuration required and run time administration is simple. | Very restrictive, no run time configuration of PDPs is possible. |
Warm Deployment | The PolicyTypeImpl entity is predeployed on the PDP. A TOSCA Policy may be loaded at startup. The PDP may be configured or reconfigured with a new or updated TOSCA Policy at run time. PDPs register with the PAP when they start, providing the PolicyImpl they have been predeployed with if any. The PAP may update the TOSCA Policy on a PDP at any time after registration. | The configuration and parameters of the PDPs in a PDP group may be changed at run time by loading or updating the TOSCA Policy of the PDP Group at run time. Lifecycle management of TOSCA Policy entities is supported, allowing features such as PolicyImpl Safe Mode and PolicyImpl retirement. | Administration and management is required. The configuration and life cycle of the TOSCA policies can change at run time and must be administered and managed. |
Hot Deployment | The PolicyImpl (PolicyTypeImpl and TOSCA Policy) are deployed at run time. The PolicyImpl (PolicyTypeImpl and TOSCA Policy) may be loaded at startup. The PDP may be configured or reconfigured with a new or updated PolicyTypeImpl and/or TOSCA Policy at run time. PDPs register with the PAP when they start, providing the PolicyImpl they have been predeployed with if any. The PAP may update the TOSCA Policy and PolicyTypeImpl on a PDP at any time after registration. | The policy logic, rules, configuration, and parameters of the PDPs in a PDP group may be changed at run time by loading or updating the PolicyTypeImpl and TOSCA Policy of the PDP Group at run time. Lifecycle management of TOSCA Policy entities and PolicyTypeImpl entites is supported, allowing features such as PolicyImpl Safe Mode and PolicyImpl retirement. | Administration and management is more complex. The PolicyImpl itself and its configuration and life cycle as well as the life cycle of the TOSCA policies can change at run time and must be administered and managed. |
3. APIs
The Policy Framework supports the APIs documented in the subsections below.
3.1 Policy Type Design API
The purpose of this API is to support CRUD of TOSCA PolicyType entities. It also supports CRUD of PolicyTypeImpl policy type implementations, where the XACML, Drools, and APEX policy type implementations are supplied as strings. This API is privided but the PolicyDevelopment component of the Policy Framework, see The ONAP Policy Framework architecture.
Note that client-side editing support for TOSCA PolicyType definitions or for PolicyTypeImpl implementations in XACML, Drools, or APEX is outside the current scope of the API.
3.1.1 TOSCA Policy Types
The API allows applications to create, update, delete, and query PolicyType entities so that they become available for use in ONAP by applications such as CLAMP. Some Policy Type entities are preloaded in the Policy Framework. The TOSCA fields below are valid on API calls:
Field | GET | POST | DELETE | Comment |
---|---|---|---|---|
(name) | M | M | M | The definition of the reference to the Policy Type, GET allows ranges to be specified |
version | O | M | C | GET allows ranges to be specified, must be specified if more than one version of the Policy Type exists |
description | N/A | O | O | |
derived_from | N/A | C | N/A | Must be specified when a Policy Type is derived from another Policy Type such as in the case of derived Monitoring Policy Types |
metadata | N/A | O | N/A | |
properties | N/A | M | N/A | This field holds the specification of the specific Policy Type in ONAP |
targets | N/A | O | N/A | A list of node types and/or group types to which the Policy tType can be applied |
triggers | N/A | O | N/A | Specification of policy triggers, not currently supported in ONAP |
Note: Preloaded policy types may only be queried over this API, modification or deletion of preloaded policy type implementations is disabled.
Note: Policy types that are in use (referenced by defined Policies) may not be deleted
3.1.1.1 Policy Type query
The API allows applications (such as CLAMP and Integration) to query the PolicyType entities that are available for Policy creation using a GET operation.
http:{url}:{port}/api/v1/policytype GET
Following creation of a DCAE TCA policy type operation, the GET call for Monitoring policies returns looks similar to the output below:
http:{url}:{port}/api/v1/policytype?name=onap.Monitoring* GET
Now the onap.policies.Monitoring.cdap.tca.hi.lo.app Policy Type is available to CLAMP for creating concrete policies. See the Yaml contribution on the Model driven Control Loop Design page for a full listing of the DCAE TCA policy type used in the example above.
The table below shows some more examples of GET operations
Example | Description |
---|---|
http:{url}:{port}/api/v1/policytype | Get all Policy Type entities in the system |
http:{url}:{port}/api/v1/policytype?name=onap.Monitoring* | Get all Policy Types that match the name wildcard supplied |
http:{url}:{port}/api/v1/policytype? | Get the specific Policy Type with the specified name and version |
3.1.1.2 Policy Type Create/Update
The API allows applications and users (such as a DCAE microservice component developer) to create or update a Policy Type using a POST operation. This API allows new Policy Types to be created or existing Policy Types to be modified. POST operations with a new Policy Type name or a new version of an existing Policy Type name are used to create a new Policy Type. POST operations with an existing Policy Type name and version are used to update an existing Policy Type. Many Policy Types can be created or updated in a single POST operation by specifying more than one Policy Type on the TOSCA policy_types list.
For example, the POST operation below with the TOSCA body below is used t create a new Policy type for a DCAE microservice.
http:{url}:{port}/api/v1/policytype POST
See the Yaml contribution on the Model driven Control Loop Design page for a full listing of the DCAE TCA policy type used in the example above
Once this call is made, the Policy Type query in Section 3.1.1.1 returns a result with the new Policy Type defined.
3.1.1.3 Policy Type Delete
The API also allows Policy Types to be deleted with a DELETE operation. The format of the delete operation is as below:
http:{url}:{port}/api/v1/policytype?name=onap.policy.monitoring.cdap.tca.hi.lo.app&version=1.0.0
Note: Predefined policy types cannot be deleted
Note: Policy types that are in use (Parameterized by a TOSCA Policy) may not be deleted, the parameterizing TOSCA policies must be deleted first
Note: The version parameter may be omitted on the DELETE operation if there is only one version of the policy type in the system
3.1.2 Policy Type Implementations
The policy Framework must have implementations for all Policy Type entities that may be specified in TOSCA. Policy type implementations may be predefined and preloaded into the Policy Framework. They may also be added, modified, queried, or deleted using this API.
Note: Preloaded policy type implementations may only be queried over this API, modification or deletion of preloaded policy type implementations is disabled.
Note: Policy type implementations that are in use (referenced by defined Policy Types) may not be deleted.
*** Note: The APIs in this section will be added later ***
3.2 Policy Design API
The purpose of this API is to support CRUD of TOSCA Policy entities from TOSCA compliant PolicyType definitions. TOSCA Policy entities become the parameters for PolicyTypeImpl entities, producing PolicyImpl entities that can run on PDPs. This API is privided but the PolicyDevelopment component of the Policy Framework, see The ONAP Policy Framework architecture.
This API allows applications (such as CLAMP and Integration) to create, update, delete, and query Policy entities. The TOSCA fields below are valid on API calls:
Field | GET | POST | DELETE | Comment |
---|---|---|---|---|
(name) | M | M | M | The definition of the reference to the Policy, GET allows ranges to be specified |
type | O | M | O | The Policy Type of the policy, see section 3.1 |
description | N/A | O | O | |
metadata | N/A | O | N/A | |
properties | N/A | M | N/A | This field holds the specification of the specific Policy Type in ONAP |
targets | N/A | O | N/A | A list of node types and/or group types to which the Policy tType can be applied |
Note: Policies that are deployed (used on deployed PolicyImpl entities) may not be deleted
Note: This API is NOT used by DCAE for a decision on what policy the DCAE PolicyHandler should retrieve and enforce
3.2.1 Policy query
The API allows applications (such as CLAMP and Integration) to query the Policy entities that are available for deployment using a GET operation.
Note: This operation simply returns TOSCA policies that are defined in the Policy Framework, it does NOT make a decision.
http:{url}:{port}/api/v1/policy GET
The table below shows some more examples of GET operations
Example | Description |
---|---|
http:{url}:{port}/api/v1/policy | Get all Policies in the system |
http:{url}:{port}/api/v1/policy?type=onap.Monitoring* | Get all policies for the Policy Types that match the name wildcard supplied |
http:{url}:{port}/api/v1/policy?name=onap.scaleout* | Get all policies that match the name wildcard supplied |
http:{url}:{port}/api/v1/policy?name=onap.scaleout.tca | Get the specific Policy with the specified name |
3.2.2 Policy Create/Update
The API allows applications and users (such as CLAMP and Integration) to create or update a Policy using a POST operation. This API allows new Policies to be created or existing Policies to be modified. POST operations with a new Policy name are used to create a new Policy. POST operations with an existing Policy name are used to update an existing Policy. Many Policies can be created or updated in a single POST operation by specifying more than one Policy on the TOSCA policies list.
3.2.2.1 Monitoring Policy Create/Update
While designing a control loop using CLAMP, a Control Loop Designer uses the Policy Type for a specific DCAE mS component (See Section 3.1.1) to create a specific Policy. CLAMP then uses this API operation to submit the Policy to the Policy Framework.
For example, the POST operation below with the TOSCA body below is used to create a new scaleout Policy for the onap.policy.monitoring.cdap.tca.hi.lo.app microservice.
http:{url}:{port}/api/v1/policy POST
The POST operation below is used to create the same scaleout Policy for the onap.policy.monitoring.cdap.tca.hi.lo.app microservice as above, but with a JSON body.
http:{url}:{port}/api/v1/policy POST
*** The JSON above needs to be fleshed out ***
3.2.2.2 Operational Policy Create/Update
TBD Liam Fallon Jorge Hernandez
3.2.2.3 Guard Policy Create/Update
TBD Pamela Dragosh Similar to Operational Policies
3.2.2.4 Policy Lifecycle API - Creating Coordination Policies
TBD Policy Design and API Flow for Model Driven Control Loop - Draft Similar to Operational Policies, stretch for Dublin
3.2.3 Policy Delete
The API also allows Policies to be deleted with a DELETE operation. The format of the delete operation is as below:
http:{url}:{port}/api/v1/policy?name=onap.scaleout.tca
Note: Policies that are in use (deployed or used in a PolicyImpl entity) may not be deleted, the policy must be undeployed first
*** Note: This page has been restructured as far as here ***
3.3 Policy Administration API
The purpose of this API is to support CRUD of PDP groups and subgroups and to support the assignment and life cycles of PolicyImpl entities (TOSCA Policy and PolicyTypeImpl entities) on PDP sub groups and PDPs. This API is privided but the PolicyAdministration component (PAP) of the Policy Framework, see The ONAP Policy Framework architecture.
3.3.1 PDP Group Query
http:{url}:{port}/pap/v1/pdps GET
3.3.2 PDP Group Creation
http:{url}:{port}/pap/v1/pdpgroup POST
3.3.3 PAP API - Deploying Policies
For CLAMP to deploy policies, we need to make sure there is a simple default way for this to support Dublin.
3.4 Policy Decision API - Getting Policy Decisions
Policy decisions are required by ONAP components to support the policy-driven ONAP architecture. Currently implemented using the XACML PDP, the calling application is required to provide attributes in order for the XACML PDP to return a correct decision.
This is the Decision API Schema (DRAFT): NOTE: some sections/fields are optional, we need to mark these.
Here is a simple example in which ALL the deployed policies for a specific policy-type would be returned (DRAFT):
Here is a simple example in which a specific policy (the latest deployed version) would be returned: (DRAFT)
Here is an example that shows possible values (NOTE: It uses ALL the fields making this call as fine-grained as one can create):