blob: d061b1b7686b537df0e306e08ce79cfed6696b58 [file] [log] [blame]
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -04001.. This work is licensed under a
2.. Creative Commons Attribution 4.0 International License.
3.. http://creativecommons.org/licenses/by/4.0
4
Pamela Dragosh9fcabd02020-05-13 07:54:15 -04005.. DO NOT REMOVE THIS LABEL - EVEN IF IT GENERATES A WARNING
6.. _architecture:
7
8.. THIS IS USED INTERNALLY IN POLICY ONLY
liamfallon4d1d9832019-05-30 20:53:05 +00009.. _architecture-label:
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040010
Pamela Dragosh5f3716b2019-06-03 12:19:22 -040011Policy Framework Architecture
12#############################
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040013
14Abstract
15
liamfallonc9e27902019-05-28 13:27:04 +000016This document describes the ONAP Policy Framework. It lays out the architecture of the framework and shows the APIs
17provided to other components that interwork with the framework. It describes the implementation of the framework,
18mapping out the components, software structure, and execution ecosystem of the framework.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040019
20.. contents::
liamfallone62f7112019-05-24 10:50:57 +000021 :depth: 6
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040022
liamfallone62f7112019-05-24 10:50:57 +0000231. Overview
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040024===========
25
liamfallonc9e27902019-05-28 13:27:04 +000026The ONAP Policy Framework is a comprehensive policy design, deployment, and execution environment. The Policy Framework
27is the decision making component in `an ONAP system
28<https://www.onap.org/wp-content/uploads/sites/20/2018/11/ONAP_CaseSolution_Architecture_112918FNL.pdf>`__.
29It allows you to specify, deploy, and execute the governance of the features and functions in your ONAP system, be they
30closed loop, orchestration, or more traditional open loop use case implementations. The Policy Framework is the
31component that is the source of truth for all policy decisions.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040032
liamfallonc9e27902019-05-28 13:27:04 +000033One of the most important goals of the Policy Framework is to support Policy Driven Operational Management during the
34execution of ONAP control loops at run time. In addition, use case implementations such as orchestration and control
35benefit from the ONAP policy Framework because they can use the capabilities of the framework to manage and execute
36their policies rather than embedding the decision making in their applications.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040037
liamfallonc9e27902019-05-28 13:27:04 +000038The Policy Framework is deployment agnostic, it manages Policy Execution (in PDPs) and Enforcement (in PEPs) regardless
liamfallonc5d11f02020-04-07 12:41:34 +010039of how the PDPs and PEPs are deployed. This allows policy execution and enforcement to be deployed in a manner that
liamfallonc9e27902019-05-28 13:27:04 +000040meets the performance requirements of a given application or use case. In one deployment, policy execution could be
41deployed in a separate executing entity in a Docker container. In another, policy execution could be co-deployed with
42an application to increase performance. An example of co-deployment is the Drools PDP Control Loop image, which is a
43Docker image that combines the ONAP Drools use case application and dependencies with the Drools PDP engine.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040044
liamfallonc9e27902019-05-28 13:27:04 +000045The ONAP Policy Framework architecture separates policies from the platform that is supporting them. The framework
46supports development, deployment, and execution of any type of policy in ONAP. The Policy Framework is metadata (model)
47driven so that policy development, deployment, and execution is as flexible as possible and can support modern rapid
liamfallonc5d11f02020-04-07 12:41:34 +010048development ways of working such as `DevOps
49<https://en.wikipedia.org/wiki/DevOps>`__. A metadata driven approach also allows the amount of programmed support
liamfallonc9e27902019-05-28 13:27:04 +000050required for policies to be reduced or ideally eliminated.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040051
liamfallonc9e27902019-05-28 13:27:04 +000052We have identified five capabilities as being essential for the framework:
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040053
liamfallonc9e27902019-05-28 13:27:04 +0000541. Most obviously, the framework must be capable of being triggered by an event or invoked, and making decisions at run
55 time.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040056
liamfallonc9e27902019-05-28 13:27:04 +0000572. It must be deployment agnostic; capable of managing policies for various Policy Decision Points (PDPs) or policy
58 engines.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040059
liamfallonc9e27902019-05-28 13:27:04 +0000603. It must be metadata driven, allowing policies to be deployed, modified, upgraded, and removed as the system executes.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040061
liamfallonc9e27902019-05-28 13:27:04 +0000624. It must provide a flexible model driven policy design approach for policy type programming and specification of
63 policies.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040064
liamfallonc9e27902019-05-28 13:27:04 +0000655. It must be extensible, allowing straightforward integration of new PDPs, policy formats, and policy development
66 environments.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040067
liamfallonc9e27902019-05-28 13:27:04 +000068Another important aim of the architecture of a model driven policy framework is that it enables much more flexible
69policy specification. The ONAP Policy Framework complies with the `TOSCA
70<http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.1/TOSCA-Simple-Profile-YAML-v1.1.pdf>`__ modelling
71approach for policies, see the :ref:`TOSCA Policy Primer <tosca-label>` for more information on how policies are modeled
72in TOSCA.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040073
liamfallonc5d11f02020-04-07 12:41:34 +010074 1. A *Policy Type* describes the properties, targets, and triggers that the policy for a feature can have. A Policy type is
75 implementation independent. It is the metadata that specifies:
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040076
liamfallonc5d11f02020-04-07 12:41:34 +010077 - the *configuration* data that the policy can take. The Policy Type describes each property that a policy of a
78 given type can take. A Policy Type definition also allows the default value, optionality, and the ranges of properties
79 to be defined.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040080
liamfallonc5d11f02020-04-07 12:41:34 +010081 - the *targets* such as network element types, functions, services, or resources on which a policy of the given type
82 can act.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040083
liamfallonc5d11f02020-04-07 12:41:34 +010084 - the *triggers* such as the event type, filtered event, scheduled trigger, or conditions that can activate a policy
85 of the given type.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -040086
liamfallonc5d11f02020-04-07 12:41:34 +010087 Policy Types are hierarchical, A Policy Type can inherit from a parent Policy Type, inheriting the properties, targets,
88 and triggers of its parent. Policy Types are developed by domain experts in consultation with the developers that
89 implement the logic and rules for the Policy Type.
90
91 2. A *Policy* is defined using a Policy Type. The Policy defines:
92
93 - the values for each property of the policy type
94 - the specific targets (network elements, functions, services, resources) on which this policy will act
95 - the specific triggers that trigger this policy.
96
97 3. A *Policy Type Implementation* or *Raw Policy*, is the logic that implements the policy. It is implemented by a
98 skilled policy developer in consultation with domain experts. The implementation has software that reads the Policy
liamfallon091a2262020-04-09 08:13:45 +010099 Type and parses the incoming configuration properties. The software has domain logic that is triggered when one of the
liamfallonc5d11f02020-04-07 12:41:34 +0100100 triggers described in the Policy Type occurs. The software logic executes and acts on the targets specified in the
101 Policy Type.
102
103
104For example, a Policy Type could be written to describe how to manage Service Level Agreements for VPNs. The VPN Policy
105Type can be used to create VPN policies for a bank network, a car dealership network, or a university with many campuses.
106The Policy Type has two parameters:
107
108 - The *maximumDowntime* parameter allows the maximum downtime allowed per year to be specified
109 - The *mitigationStrategy* parameter allows one of three strategies to be selected for downtime breaches
110
111 - *allocateMoreResources*, which will automatically allocate more resources to mitigate the problem
112 - *report*, which report the downtime breach to a trouble ticketing system
113 - *ignore*, which logs the breach and takes no further action
114
115The Policy Type defines a trigger event, an event that is received from an analytics system when the maximum downtime
116value for a VPN is breached. The target of the policy type is an instance of the VPN service.
117
118The Policy Type Implementation is developed that can configure the maximum downtime parameter in an analytics system,
119can receive a trigger from the analytics system when the maximum downtime is breached, and that can either request more
120resources, report an issue to a trouble ticketing system, and can log a breach.
121
liamfallon1c7c5202020-04-14 13:42:34 +0100122VPN Policies are created by specifying values for the properties, triggers, and targets specified in VPN Policy Type.
liamfallonc5d11f02020-04-07 12:41:34 +0100123
124In the case of the bank network, the *maximumDowntime* threshold is specified as 5 minutes downtime per year and the
125*mitigationStrategy* is defined as *allocateMoreResources*, and the target is specified as being the bank's VPN service
126ID. When a breach is detected by the analytics system, the policy is executed, the target is identified as being the
127bank's network, and more resources are allocated by the policy.
128
129For the car dealership VPN policy, a less stringent downtime threshold of 60 minutes per year is specified, and the
130mitigation strategy is to issue a trouble ticket. The university network is best effort, so a downtime of 4 days per
131year is specified. Breaches are logged and mitigated as routine network administration tasks.
132
133In ONAP, specific ONAP Policy Types are used to create specific policies that drive the ONAP Platform and Components.
liamfallonc9e27902019-05-28 13:27:04 +0000134For more detailed information on designing Policy Types and developing an implementation for that policy type, see
135:ref:`Policy Design and Development <design-label>`.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400136
liamfallonc9e27902019-05-28 13:27:04 +0000137The ONAP Policy Framework for building, configuring and deploying PDPs is extendable. It allows the use of ONAP PDPs as
138is, the extension of ONAP PDPs, and lastly provides the capability for users to create and deploy their own PDPs. The
139ONAP Policy Framework provides distributed policy management for **all** policies in ONAP at run time. Not only does
140this provide unified policy access and version control, it provides life cycle control for policies and allows detection
141of conflicts across all policies running in an ONAP installation.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400142
1432. Architecture
144===============
145
liamfallonc9e27902019-05-28 13:27:04 +0000146The diagram below shows the architecture of the ONAP Policy Framework at its highest level.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400147
liamfallon4d1d9832019-05-30 20:53:05 +0000148.. image:: images/PFHighestLevel.svg
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400149
liamfallonc9e27902019-05-28 13:27:04 +0000150The *PolicyDevelopment* component implements the functionality for development of policy types and policies.
151*PolicyAdministration* is responsible for the deployment life cycle of policies as well as interworking with the
152mechanisms required to orchestrate the nodes and containers on which policies run. *PolicyAdministration* is also
153responsible for the administration of policies at run time; ensuring that policies are available to users, that policies
154are executing correctly, and that the state and status of policies is monitored. *PolicyExecution* is the set of PDPs
155running in the ONAP system and is responsible for making policy decisions and for managing the administrative state of
156the PDPs as directed by \ *PolicyAdministration.*
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400157
liamfallon091a2262020-04-09 08:13:45 +0100158*PolicyDevelopment* provides APIs that allow creation of policy artifacts and supporting information in the policy
159database. *PolicyAdministration* reads those artifacts and the supporting information from the policy database whilst
160deploying policy artifacts. Once the policy artifacts are deployed, *PolicyAdministration* handles the run-time
161management of the PDPs on which the policies are running. *PolicyDevelopment* interacts with the database, and has
162no programmatic interface with *PolicyAdministration*, *PolicyExecution* or any other run-time ONAP components.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400163
liamfallonc9e27902019-05-28 13:27:04 +0000164The diagram below shows a more detailed view of the architecture, as inspired by
165`RFC-2753 <https://tools.ietf.org/html/rfc2753>`__ and `RFC-3198 <https://tools.ietf.org/html/rfc3198>`__.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400166
liamfallon4d1d9832019-05-30 20:53:05 +0000167.. image:: images/PFDesignAndAdmin.svg
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400168
liamfallonc9e27902019-05-28 13:27:04 +0000169*PolicyDevelopment* provides a `CRUD <https://en.wikipedia.org/wiki/Create,_read,_update_and_delete>`__ API for policy
liamfallon091a2262020-04-09 08:13:45 +0100170types and policies. The policy types and policy artifacts and their metadata (information about policies, policy types,
liamfallonc9e27902019-05-28 13:27:04 +0000171and their interrelations) are stored in the *PolicyDB*. The *PolicyDevGUI*, PolicyDistribution, and other applications
liamfallon091a2262020-04-09 08:13:45 +0100172such as *CLAMP* can use the *PolicyDevelopment* API to create, update, delete, and read policy types and policies.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400173
174*PolicyAdministration* has two important functions:
175
liamfallonc9e27902019-05-28 13:27:04 +0000176- Management of the life cycle of PDPs in an ONAP installation. PDPs register with *PolicyAdministration* when they come
liamfallon091a2262020-04-09 08:13:45 +0100177 up. *PolicyAdministration* handles the allocation of PDPs to PDP Groups and PDP Subgroups, so that they can be
178 managed as microservices in infrastructure management systems such as Kubernetes.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400179
liamfallonc9e27902019-05-28 13:27:04 +0000180- Management of the deployment of policies to PDPs in an ONAP installation. *PolicyAdministration* gives each PDP group
181 a set of domain policies to execute.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400182
liamfallonc9e27902019-05-28 13:27:04 +0000183*PolicyAdministration* handles PDPs and policy allocation to PDPs using asynchronous messaging over DMaaP. It provides
184three APIs:
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400185
liamfallonc9e27902019-05-28 13:27:04 +0000186- a CRUD API for policy groups and subgroups
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400187
liamfallon091a2262020-04-09 08:13:45 +0100188- an API that allows the allocation of policies to PDP groups and subgroups to be controlled
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400189
liamfallonc9e27902019-05-28 13:27:04 +0000190- an API allows policy execution to be managed, showing the status of policy execution on PDP Groups, subgroups, and
191 individual PDPs as well as the life cycle state of PDPs
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400192
liamfallonc9e27902019-05-28 13:27:04 +0000193*PolicyExecution* is the set of running PDPs that are executing policies, logically partitioned into PDP groups and
194subgroups.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400195
liamfallon4d1d9832019-05-30 20:53:05 +0000196.. image:: images/PolicyExecution.svg
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400197
liamfallonc9e27902019-05-28 13:27:04 +0000198The figure above shows how *PolicyExecution* looks at run time with PDPs running in Kubernetes. A *PDPGroup* is a purely
199logical construct that collects all the PDPs that are running policies for a particular domain together. A *PDPSubGroup*
200is a group of PDPs of the same type that are running the same policies. *A PDPSubGroup* is deployed as a Kubernetes
201`Deployment <https://kubernetes.io/docs/concepts/workloads/controllers/deployment/>`__. PDPs are defined as Kubernetes
202`Pods <https://kubernetes.io/docs/concepts/workloads/pods/pod/>`__. At run time, the actual number of PDPs in each
203*PDPSubGroup* is specified in the configuration of the *Deployment* of that *PDPSubGroup* in Kubernetes. This
204structuring of PDPs is required because, in order to simplify deployment and scaling of PDPs in Kubernetes, we gather
205all the PDPs of the same type that are running the same policies together for deployment.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400206
liamfallon091a2262020-04-09 08:13:45 +0100207For example, assume we have policies for the SON (Self Organizing Network) and ACPS (Advanced Customer Premises Service)
208domains. For SON,we have XACML, Drools, and APEX policies, and for ACPS we have XACML and Drools policies. The table
liamfallonc9e27902019-05-28 13:27:04 +0000209below shows the resulting \ *PDPGroup*, *PDPSubGroup*, and PDP allocations:
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400210
liamfallonc9e27902019-05-28 13:27:04 +0000211============= ================ ========================= ======================================== ================
212**PDP Group** **PDP Subgroup** **Kubernetes Deployment** **Kubernetes Deployment Strategy** **PDPs in Pods**
213============= ================ ========================= ======================================== ================
214SON SON-XACML SON-XACML-Dep Always 2, be geo redundant 2 PDP-X
215\ SON-Drools SON-Drools-Dep At Least 4, scale up on 70% load, >= 4 PDP-D
216 scale down on 40% load, be geo-redundant
217\ SON-APEX SON-APEX-Dep At Least 3, scale up on 70% load, scale >= 3 PDP-A
218 down on 40% load, be geo-redundant
liamfallon091a2262020-04-09 08:13:45 +0100219ACPS ACPS-XACML ACPS-XACML-Dep Always 2 2 PDP-X
220\ ACPS-Drools ACPS-Drools-Dep At Least 2, scale up on 80% load, scale >=2 PDP-D
liamfallonc9e27902019-05-28 13:27:04 +0000221 down on 50% load
222============= ================ ========================= ======================================== ================
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400223
liamfallonc9e27902019-05-28 13:27:04 +0000224For more details on *PolicyAdministration* APIs and management of *PDPGroup* and *PDPSubGroup*, see the documentation
225for :ref:`Policy Administration Point (PAP) Architecture <pap-label>`.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400226
2272.1 Policy Framework Object Model
228---------------------------------
229
liamfallonc9e27902019-05-28 13:27:04 +0000230This section describes the structure of and relations between the main concepts in the Policy Framework. This model is
231implemented as a common model and is used by *PolicyDevelopment*, *PolicyDeployment,* and *PolicyExecution.*
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400232
liamfallon4d1d9832019-05-30 20:53:05 +0000233.. image:: images/ClassStructure.svg
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400234
liamfallon091a2262020-04-09 08:13:45 +0100235The UML class diagram above shows thePolicy Framework Object Model.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400236
2372.2 Policy Design Architecture
238------------------------------
239
liamfallon1c7c5202020-04-14 13:42:34 +0100240This section describes the architecture of the model driven system used to develop policy types and to create
liamfallonc9e27902019-05-28 13:27:04 +0000241policies using policy types. The output of Policy Design is deployment-ready artifacts and Policy metadata in the Policy
242Framework database.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400243
liamfallon1c7c5202020-04-14 13:42:34 +0100244Policy types that are expressed via natural language or a model require an implementation that allows them to be
245translated into runtime policies. Some Policy Type implementations are set up and available in the platform during
liamfallonc9e27902019-05-28 13:27:04 +0000246startup such as Control Loop Operational Policy Models, OOF placement Models, DCAE microservice models. Policy type
liamfallon1c7c5202020-04-14 13:42:34 +0100247implementations can also be loaded and deployed at run time.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400248
2492.2.1 Policy Type Design
liamfallone62f7112019-05-24 10:50:57 +0000250^^^^^^^^^^^^^^^^^^^^^^^^
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400251
liamfallonc9e27902019-05-28 13:27:04 +0000252Policy Type Design is the task of creating policy types that capture the generic and vendor independent aspects of a
liamfallon1c7c5202020-04-14 13:42:34 +0100253policy for a particular domain use case.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400254
liamfallon1c7c5202020-04-14 13:42:34 +0100255All policy types are specified in TOSCA service templates. Once policy types are defined and created in the system,
liamfallon091a2262020-04-09 08:13:45 +0100256*PolicyDevelopment* manages them and uses them to allow policies to be created from these policy types in a uniform
257way regardless of the domain that the policy type is addressing or the PDP technology that will execute the policy.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400258
liamfallon091a2262020-04-09 08:13:45 +0100259A *PolicyTypeImpl* is developed for a policy type for a certain type of PDP (for example XACML oriented for decision
260policies, Drools rules or Apex state machines oriented for ECA policies). While a policy type is implementation
261independent, a policy type implementation for a policy type is specific for the technology of the PDP on which
liamfallon1c7c5202020-04-14 13:42:34 +0100262policies that use that policy type implementation will execute. A Policy Type may have many implementations. A
263*PolicyTypeImpl* is the specification of the specific rules or tasks, the flow of the policy, its internal states
264and data structures and other relevant information. A *PolicyTypeImpl* can be specific to a particular policy type
265or it can be more general, providing the implementation of a class of policy types. Further, the design environment
266and tool chain for implementing implementations of policy types is specific to the technology of the PDP on which
267the implementation will run.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400268
liamfallon3602c182020-04-16 09:29:45 +0100269In the *xacml-pdp* and *drools-pdp*, an *application* is written for a given category of policy types. Such an
270application may have logic written in Java or another programming language, and may have additional artifacts such
271as scripts and SQL queries. The *application* unmarshals and marshals events going into and out of policies as well
272as handling the sequencing of events for interactions of the policies with other components in ONAP. For example,
273*drools-applications* handles the interactions for operational policies running in the drools PDP. In the
274*apex-pdp*, all unmarshaling, marshaling, and component interactions are captured in the state machine, logic, and
275configuraiton of the policy, a Java application is not used.
276
liamfallon091a2262020-04-09 08:13:45 +0100277*PolicyDevelopment* provides the RESTful :ref:`Policy Design API <design-label>`, which allows other components to query
278policy types, Those components can then create policies that specify values for the properties, triggers, and targets
279specified in a policy type. This API is used by components such as *CLAMP* and *PolicyDistribution* to create policies
280from policy types.
liamfallonc9e27902019-05-28 13:27:04 +0000281
282Consider a policy type created for managing faults on vCPE equipment in a vendor independent way. The policy type
liamfallon091a2262020-04-09 08:13:45 +0100283implementation captures the generic logic required to manage the faults and specifies the vendor specific information
284that must be supplied to the type for specific vendor vCPE VFs. The actual vCPE policy that is used for managing
285particular vCPE equipment is created by setting the properties specified in the policy type for that vendor model
286of vCPE.
liamfallonc9e27902019-05-28 13:27:04 +0000287
2882.2.1.1 Generating Policy Types
289"""""""""""""""""""""""""""""""
290
291It is possible to generate policy types using MDD (Model Driven Development) techniques. Policy types are expressed
292using a DSL (Domain Specific Language) or a policy specification environment for a particular application domain. For
293example, policy types for specifying SLAs could be expressed in a SLA DSL and policy types for managing SON features
294could be generated from a visual SON management tool. The ONAP Policy framework provides an API that allows tool chains
liamfallon1c7c5202020-04-14 13:42:34 +0100295to create policy types, see the :ref:`Policy Design and Development <design-label>` page.
liamfallonc9e27902019-05-28 13:27:04 +0000296
297.. image:: images/PolicyTypeDesign.svg
298
liamfallon1c7c5202020-04-14 13:42:34 +0100299A GUI implementation in another ONAP component (a *PolicyTypeDesignClient*) may use the *API_User* API to create and
300edit ONAP policy types.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400301
liamfallonc9e27902019-05-28 13:27:04 +00003022.2.1.2 Programming Policy Type Implementations
liamfallone62f7112019-05-24 10:50:57 +0000303"""""""""""""""""""""""""""""""""""""""""""""""
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400304
liamfallonc9e27902019-05-28 13:27:04 +0000305For skilled developers, the most straightforward way to create a policy type is to program it. Programming a policy type
306might simply mean creating and editing text files, thus manually creating the TOSCA Policy Type YAML file and the policy
307type implementation for the policy type.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400308
liamfallonc9e27902019-05-28 13:27:04 +0000309A more formal approach is preferred. For policy type implementations, programmers use a specific Eclipse project type
310for developing each type of implementation, a Policy Type Implementation SDK. The project is under source control in
311git. This Eclipse project is structured correctly for creating implementations for a specific type of PDP. It includes
312the correct POM files for generating the policy type implementation and has editors and perspectives that aid
313programmers in their work
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400314
3152.2.2 Policy Design
liamfallone62f7112019-05-24 10:50:57 +0000316^^^^^^^^^^^^^^^^^^^
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400317
liamfallonc9e27902019-05-28 13:27:04 +0000318The *PolicyCreation* function of *PolicyDevelopment* creates policies from a policy type. The information expressed
319during policy type design is used to parameterize a policy type to create an executable policy. A service designer
320and/or operations team can use tooling that reads the TOSCA Policy Type specifications to express and capture a policy
321at its highest abstraction level. Alternatively, the parameter for the policy can be expressed in a raw JSON or YAML
322file and posted over the policy design API described on the :ref:`Policy Design and Development <design-label>` page.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400323
liamfallonc9e27902019-05-28 13:27:04 +0000324A number of mechanisms for policy creation are supported in ONAP. The process in *PolicyDevelopment* for creating a
325policy is the same for all mechanisms. The most general mechanism for creating a policy is using the RESTful
326*Policy Design API*, which provides a full interface to the policy creation support of *PolicyDevelopment*. This API may
liamfallon1c7c5202020-04-14 13:42:34 +0100327be exercised directly using utilities such as *curl*.
328
329In future releases, the Policy Framework may provide a command line tool that will be a loose wrapper around the API. It
330may also provide a general purpose Policy GUI in the ONAP Portal for policy creation, which again would be a general
331purpose wrapper around the policy creation API. The Policy GUI would interpret any TOSCA Model that has been loaded into
332it and flexibly presents a GUI for a user to create policies from. The development of these mechanisms will be phased
333over a number of ONAP releases.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400334
liamfallonc9e27902019-05-28 13:27:04 +0000335A number of ONAP components use policy in manners which are specific to their particular needs. The manner in which the
336policy creation process is triggered and the way in which information required to create a policy is specified and
337accessed is specialized for these ONAP components.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400338
liamfallon1c7c5202020-04-14 13:42:34 +0100339For example, *CLAMP* provides a GUI for creation of Control Loop policies, which reads the Policy Type associated
340with a control loop, presents the properties as fields in its GUI, and creates a policy using the property values entered
341by the user.
342
liamfallonc9e27902019-05-28 13:27:04 +0000343The following subsections outline the mechanisms for policy creation and modification supported by the ONAP Policy
344Framework.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400345
3462.2.2.1 Policy Design in the ONAP Policy Framework
liamfallone62f7112019-05-24 10:50:57 +0000347""""""""""""""""""""""""""""""""""""""""""""""""""
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400348
liamfallonc9e27902019-05-28 13:27:04 +0000349Policy creation in *PolicyDevelopment* follows the general sequence shown in the sequence diagram below. An *API_USER*
350is any component that wants to create a policy from a policy type. *PolicyDevelopment* supplies a REST interface that
351exposes the API and also provides a command line tool and general purpose client that wraps the API.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400352
liamfallonc9e27902019-05-28 13:27:04 +0000353.. image:: images/PolicyDesign.svg
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400354
liamfallonc9e27902019-05-28 13:27:04 +0000355An *API_User* first gets a reference to and the metadata for the Policy type for the policy they want to work on from
356*PolicyDevelopment*. *PolicyDevelopment* reads the metadata and artifact for the policy type from the database. The
357*API_User* then asks for a reference and the metadata for the policy. *PolicyDevelopment* looks up the policy in the
358database. If the policy already exists, *PolicyDevelopment* reads the artifact and returns the reference of the existing
359policy to the *API_User* with the metadata for the existing policy. If the policy does not exist, *PolicyDevelopment*
liamfallon1c7c5202020-04-14 13:42:34 +0100360informs the *API_User*.
liamfallonc9e27902019-05-28 13:27:04 +0000361
362The *API_User* may now proceed with a policy specification session, where the parameters are set for the policy using
363the policy type specification. Once the *API_User* is happy that the policy is completely and correctly specified, it
364requests *PolicyDevelopment* to create the policy. *PolicyDevelopment* creates the policy, stores the created policy
365artifact and its metadata in the database.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400366
3672.2.2.2 Model Driven VF (Virtual Function) Policy Design via VNF SDK Packaging
liamfallone62f7112019-05-24 10:50:57 +0000368""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400369
liamfallonc9e27902019-05-28 13:27:04 +0000370VF vendors express policies such as SLA, Licenses, hardware placement, run-time metric suggestions, etc. These details
371are captured within the VNF SDK and uploaded into the SDC Catalog. The `SDC Distribution APIs
372<https://wiki.onap.org/display/DW/SDC+Distribution+client+AID>`__ are used to interact with SDC. For example, SLA and
373placement policies may be captured via TOSCA specification. License policies can be captured via TOSCA or an XACML
374specification. Run-time metric vendor recommendations can be captured via the VES Standard specification.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400375
liamfallonc9e27902019-05-28 13:27:04 +0000376The sequence diagram below is a high level view of SDC-triggered concrete policy generation for some arbitrary entity
377*EntityA*. The parameters to create a policy are read from a TOSCA Policy specification read from a CSAR received from
378SDC.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400379
liamfallonc9e27902019-05-28 13:27:04 +0000380.. image:: images/ModelDrivenPolicyDesign.svg
381
382*PolicyDesign* uses the *PolicyDistribution* component for managing SDC-triggered policy creation and update requests.
383*PolicyDistribution* is an *API_User*, it uses the Policy Design API for policy creation and update. It reads the
384information it needs to populate the policy type from a TOSCA specification in a CSAR received from SDC and then uses
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400385this information to automatically generate a policy.
386
liamfallonc9e27902019-05-28 13:27:04 +0000387Note that SDC provides a wrapper for the SDC API as a Java Client and also provides a TOSCA parser. See the
388documentation for the `Policy Distribution Component
389<https://docs.onap.org/en/latest/submodules/policy/distribution.git/docs/index.html>`__.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400390
liamfallonc9e27902019-05-28 13:27:04 +0000391In Step 4 above, the \ *PolicyDesign* must download the CSAR file. If the policy is to be composed from the TOSCA
392definition, it must also parse the TOSCA definition.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400393
liamfallonc9e27902019-05-28 13:27:04 +0000394In Step 11 above, the \ *PolicyDesign* must send back/publish status events to SDC such as DOWNLOAD_OK, DOWNLOAD_ERROR,
395DEPLOY_OK, DEPLOY_ERROR, NOTIFIED.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400396
liamfallone62f7112019-05-24 10:50:57 +00003972.2.2.3 Scripted Model Driven Policy Design
398"""""""""""""""""""""""""""""""""""""""""""
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400399
liamfallonc9e27902019-05-28 13:27:04 +0000400Service policies such as optimization and placement policies can be specified as a TOSCA Policy at design time. These
401policies use a TOSCA Policy Type specification as their schemas. Therefore, scripts can be used to create TOSCA policies
402using TOSCA Policy Types.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400403
liamfallonc9e27902019-05-28 13:27:04 +0000404.. image:: images/ScriptedPolicyDesign.svg
405
liamfallon1c7c5202020-04-14 13:42:34 +0100406One straightforward way of generating policies from Policy types is to use commands specified in a script file. A
407command line utility such as *curl* is an *API_User*. Commands read policy types using the Policy Type API, parse the
408policy type and uses the properties of the policy type to prepare a TOSCA Policy. It then issues further commands to use
409the Policy API to create policies.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400410
4112.2.3 Policy Design Process
liamfallone62f7112019-05-24 10:50:57 +0000412^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400413
liamfallonc9e27902019-05-28 13:27:04 +0000414All policy types must be certified as being fit for deployment prior to run time deployment. Where design is executed
415using the SDC application, it is assumed the life cycle being implemented by SDC certifies any policy types that
416are declared within the ONAP Service CSAR. For other policy types and policy type implementations, the life cycle
417associated with the applied software development process suffices. Since policy types and their implementations are
418designed and implemented using software development best practices, they can be utilized and configured for various
419environments (eg. development, testing, production) as desired.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400420
4212.3 Policy Runtime Architecture
422-------------------------------
423
liamfallonc9e27902019-05-28 13:27:04 +0000424The Policy Framework Platform components are themselves designed as microservices that are easy to configure and deploy
425via Docker images and K8S both supporting resiliency and scalability if required. PAPs and PDPs are deployed by the
426underlying ONAP management infrastructure and are designed to comply with the ONAP interfaces for deploying containers.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400427
liamfallonc9e27902019-05-28 13:27:04 +0000428The PAPs keep track of PDPs, support the deployment of PDP groups and the deployment of a *policy set* across those PDP
429groups. A PAP is stateless in a RESTful sense. Therefore, if there is more than one PAP deployed, it does not matter
430which PAP a user contacts to handle a request. The PAP uses the database (persistent storage) to keep track of ongoing
liamfallon3602c182020-04-16 09:29:45 +0100431sessions with PDPs. Policy management on PDPs is the responsibility of PAPs; management of policy sets or policies by
liamfallonc9e27902019-05-28 13:27:04 +0000432any other manner is not permitted.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400433
liamfallonc9e27902019-05-28 13:27:04 +0000434In the ONAP Policy Framework, the interfaces to the PDP are designed to be as streamlined as possible. Because the PDP
435is the main unit of scalability in the Policy Framework, the framework is designed to allow PDPs in a PDP group to
436arbitrarily appear and disappear and for policy consistency across all PDPs in a PDP group to be easily maintained.
437Therefore, PDPs have just two interfaces; an interface that users can use to execute policies and interface to the PAP
438for administration, life cycle management and monitoring. The PAP is responsible for controlling the state across the
439PDPs in a PDP group. The PAP interacts with the Policy database and transfers policy sets to PDPs, and may cache the
440policy sets for PDP groups.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400441
liamfallonc9e27902019-05-28 13:27:04 +0000442See also Section 2 of the :ref:`Policy Design and Development <design-label>` page, where the mechanisms for PDP
443Deployment and Registration with PAP are explained.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400444
4452.3.1 Policy Framework Services
liamfallone62f7112019-05-24 10:50:57 +0000446^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400447
liamfallonc9e27902019-05-28 13:27:04 +0000448The ONAP Policy Framework follows the architectural approach for microservices recommended by the `ONAP Architecture
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400449Subcommittee <https://wiki.onap.org/display/DW/Architecture+Subcommittee>`__.
450
liamfallon3602c182020-04-16 09:29:45 +0100451The ONAP Policy Framework uses an infrastructure such as Kubernetes `Services
liamfallonc9e27902019-05-28 13:27:04 +0000452<https://kubernetes.io/docs/concepts/services-networking/service/>`__ to manage the life cycle of Policy Framework
453executable components at runtime. A Kubernetes service allows, among other parameters, the number of instances (*pods*
454in Kubernetes terminology) that should be deployed for a particular service to be specified and a common endpoint for
455that service to be defined. Once the service is started in Kubernetes, Kubernetes ensures that the specified number of
456instances is always kept running. As requests are received on the common endpoint, they are distributed across the
457service instances. More complex call distribution and instance deployment strategies may be used; please see the
458`Kubernetes Services <https://kubernetes.io/docs/concepts/services-networking/service/>`__ documentation for those
459details.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400460
liamfallonc9e27902019-05-28 13:27:04 +0000461If, for example, a service called *policy-pdpd-control-loop* is defined that runs 5 PDP-D instances. The service has the
462end point *https://policy-pdpd-control-loop.onap/<service-specific-path>*. When the service is started, Kubernetes spins
463up 5 PDP-Ds. Calls to the end point *https://policy-pdpd-control-loop.onap/<service-specific-path>* are distributed
464across the 5 PDP-D instances. Note that the *.onap* part of the service endpoint is the namespace being used and is
465specified for the full ONAP Kubernetes installation.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400466
467The following services will be required for the ONAP Policy Framework:
468
liamfallonc9e27902019-05-28 13:27:04 +0000469================ ============================== =======================================================================
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400470**Service** **Endpoint** **Description**
liamfallonc9e27902019-05-28 13:27:04 +0000471================ ============================== =======================================================================
472PAP https://policy-pap The PAP service, used for policy administration and deployment. See
473 :ref:`Policy Design and Development <design-label>` for details of the
474 API for this service
475PDP-X-\ *domain* https://policy-pdpx-\ *domain* A PDP service is defined for each PDP group. A PDP group is identified
476 by the domain on which it operates.
477
478 For example, there could be two PDP-X domains, one for admission
479 policies for ONAP proper and another for admission policies for VNFs of
480 operator *Supacom*. Two PDP-X services are defined:
481
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400482 | https://policy-pdpx-onap
483 | https://policy-pdpx-\ *supacom*
484PDP-D-\ *domain* https://policy-pdpd-\ *domain*
485PDP-A-\ *domain* https://policy-pdpa-\ *domain*
liamfallonc9e27902019-05-28 13:27:04 +0000486================ ============================== =======================================================================
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400487
liamfallonc9e27902019-05-28 13:27:04 +0000488There is one and only one PAP service, which handles policy deployment, administration, and monitoring for all policies
489in all PDPs and PDP groups in the system. There are multiple PDP services, one PDP service for each domain for which
490there are policies.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400491
4922.3.2 The Policy Framework Information Structure
liamfallone62f7112019-05-24 10:50:57 +0000493^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400494
liamfallonc9e27902019-05-28 13:27:04 +0000495The following diagram captures the relationship between Policy Framework concepts at run time.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400496
liamfallonc9e27902019-05-28 13:27:04 +0000497.. image:: images/RuntimeRelationships.svg
498
499There is a one to one relationship between a PDP SubGroup, a Kubernetes PDP service, and the set of policies assigned to
500run in the PDP subgroup. Each PDP service runs a single PDP subgroup with multiple PDPs, which executes a specific
501Policy Set containing a number of policies that have been assigned to that PDP subgroup. Having and maintaining this
502principle makes policy deployment and administration much more straightforward than it would be if complex relationships
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400503between PDP services, PDP subgroups, and policy sets.
504
liamfallonc9e27902019-05-28 13:27:04 +0000505The topology of the PDPs and their policy sets is held in the Policy Framework database and is administered by the PAP service.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400506
liamfallonc9e27902019-05-28 13:27:04 +0000507.. image:: images/PolicyDatabase.svg
508
509The diagram above gives an indicative structure of the run time topology information in the Policy Framework database.
510Note that the *PDP_SUBGROUP_STATE* and *PDP_STATE* fields hold state information for life cycle management of PDP groups
511and PDPs.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400512
5132.3.3 Startup, Shutdown and Restart
liamfallone62f7112019-05-24 10:50:57 +0000514^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400515
liamfallonc9e27902019-05-28 13:27:04 +0000516This section describes the interactions between Policy Framework components themselves and with other ONAP components at
517startup, shutdown and restart.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400518
5192.3.3.1 PAP Startup and Shutdown
liamfallone62f7112019-05-24 10:50:57 +0000520""""""""""""""""""""""""""""""""
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400521
522The sequence diagram below shows the actions of the PAP at startup.
523
liamfallonc9e27902019-05-28 13:27:04 +0000524.. image:: images/PAPStartStop.svg
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400525
liamfallonc9e27902019-05-28 13:27:04 +0000526The PAP is the run time point of coordination for the ONAP Policy Framework. When it is started, it initializes itself
527using data from the database. It then waits for periodic PDP status updates and for administration requests.
528
529PAP shutdown is trivial. On receipt or a shutdown request, the PAP completes or aborts any ongoing operations and shuts
530down gracefully.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400531
5322.3.3.2 PDP Startup and Shutdown
liamfallone62f7112019-05-24 10:50:57 +0000533""""""""""""""""""""""""""""""""
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400534
liamfallonc9e27902019-05-28 13:27:04 +0000535The sequence diagram below shows the actions of the PDP at startup. See also Section 4 of the
536:ref:`Policy Design and Development <design-label>` page for the API used to implement this sequence.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400537
liamfallonc9e27902019-05-28 13:27:04 +0000538.. image:: images/PDPStartStop.svg
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400539
liamfallonc9e27902019-05-28 13:27:04 +0000540At startup, the PDP initializes itself. At this point it is in PASSIVE mode. The PDP begins sending periodic Status
541messages to the PAP. The first Status message initializes the process of loading the correct Policy Set on the PDP in
542the PAP.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400543
liamfallonc9e27902019-05-28 13:27:04 +0000544On receipt or a shutdown request, the PDP completes or aborts any ongoing policy executions and shuts down gracefully.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400545
5462.3.4 Policy Execution
liamfallone62f7112019-05-24 10:50:57 +0000547^^^^^^^^^^^^^^^^^^^^^^
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400548
liamfallonc9e27902019-05-28 13:27:04 +0000549Policy execution is the execution of a policy in a PDP. Policy enforcement occurs in the component that receives a
550policy decision.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400551
liamfallon4d1d9832019-05-30 20:53:05 +0000552.. image:: images/PolicyExecutionFlow.svg
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400553
liamfallonc9e27902019-05-28 13:27:04 +0000554Policy execution can be *synchronous* or *asynchronous*. In *synchronous* policy execution, the component requesting a
555policy decision requests a policy decision and waits for the result. The PDP-X and PDP-A implement synchronous policy
556execution. In *asynchronous* policy execution, the component that requests a policy decision does not wait for the
557decision. Indeed, the decision may be passed to another component. The PDP-D and PDP-A implement asynchronous polic
558execution.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400559
liamfallonc9e27902019-05-28 13:27:04 +0000560Policy execution is carried out using the current life cycle mode of operation of the PDP. While the actual
561implementation of the mode may vary somewhat between PDPs of different types, the principles below hold true for all
562PDP types:
563
564================== =====================================================================================================
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400565**Lifecycle Mode** **Behaviour**
liamfallonc9e27902019-05-28 13:27:04 +0000566================== =====================================================================================================
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400567PASSIVE MODE Policy execution is always rejected irrespective of PDP type.
568ACTIVE MODE Policy execution is executed in the live environment by the PDP.
liamfallon3602c182020-04-16 09:29:45 +0100569SAFE MODE* Policy execution proceeds, but changes to domain state or context are not carried out. The PDP
liamfallonc9e27902019-05-28 13:27:04 +0000570 returns an indication that it is running in SAFE mode together with the action it would have
571 performed if it was operating in ACTIVE mode. The PDP type and the policy types it is running must
572 support SAFE mode operation.
liamfallon3602c182020-04-16 09:29:45 +0100573TEST MODE* Policy execution proceeds and changes to domain and state are carried out in a test or sandbox
liamfallonc9e27902019-05-28 13:27:04 +0000574 environment. The PDP returns an indication it is running in TEST mode together with the action it has
575 performed on the test environment. The PDP type and the policy types it is running must support TEST
576 mode operation.
577================== =====================================================================================================
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400578
liamfallon3602c182020-04-16 09:29:45 +0100579\* SAFE Mode and TEST Mode will be implemented in future versions of the Policy Framework.
580
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -04005812.3.5 Policy Lifecycle Management
liamfallone62f7112019-05-24 10:50:57 +0000582^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400583
liamfallonc9e27902019-05-28 13:27:04 +0000584Policy lifecycle management manages the deployment and life cycle of policies in PDP groups at run time. Policy sets can
585be deployed at run time without restarting PDPs or stopping policy execution. PDPs preserve state for minor/patch
586version upgrades and rollbacks.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400587
5882.3.5.1 Load/Update Policies on PDP
liamfallone62f7112019-05-24 10:50:57 +0000589"""""""""""""""""""""""""""""""""""
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400590
liamfallonc9e27902019-05-28 13:27:04 +0000591The sequence diagram below shows how policies are loaded or updated on a PDP.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400592
liamfallonc9e27902019-05-28 13:27:04 +0000593.. image:: images/DownloadPoliciesToPDP.svg
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400594
liamfallonc9e27902019-05-28 13:27:04 +0000595This sequence can be initiated in two ways; from the PDP or from a user action.
596
5971. A PDP sends regular status update messages to the PAP. If this message indicates that the PDP has no policies or
598 outdated policies loaded, then this sequence is initiated
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400599
6002. A user may explicitly trigger this sequence to load policies on a PDP
601
liamfallonc9e27902019-05-28 13:27:04 +0000602The PAP controls the entire process. The PAP reads the current PDP metadata and the required policy and policy set
603artifacts from the database. It then builds the policy set for the PDP. Once the policies are ready, the PAP sets the
604mode of the PDP to PASSIVE. The Policy Set is transparently passed to the PDP by the PAP. The PDP loads all the policies
605in the policy set including any models, rules, tasks, or flows in the policy set in the policy implementations.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400606
liamfallonc9e27902019-05-28 13:27:04 +0000607Once the Policy Set is loaded, the PAP orders the PDP to enter the life cycle mode that has been specified for it
liamfallon3602c182020-04-16 09:29:45 +0100608(ACTIVE/SAFE*/TEST*). The PDP begins to execute policies in the specified mode (see section 2.3.4).
609
610\* SAFE Mode and TEST Mode will be implemented in future versions of the Policy Framework.
liamfallonc9e27902019-05-28 13:27:04 +0000611
612.. _policy-rollout:
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400613
6142.3.5.2 Policy Rollout
liamfallone62f7112019-05-24 10:50:57 +0000615""""""""""""""""""""""
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400616
liamfallonc9e27902019-05-28 13:27:04 +0000617A policy set steps through a number of life cycle modes when it is rolled out.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400618
liamfallonc9e27902019-05-28 13:27:04 +0000619.. image:: images/PolicyRollout.svg
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400620
liamfallonc9e27902019-05-28 13:27:04 +0000621The user defines the set of policies for a PDP group. It is deployed to a PDP group and is initially in PASSIVE mode.
622The user sets the PDP Group into TEST mode. The policies are run in a test or sandboxed environment for a period of
623time. The test results are passed back to the user. The user may revert the policy set to PASSIVE mode a number of times
624and upgrade the policy set during test operation.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400625
liamfallonc9e27902019-05-28 13:27:04 +0000626When the user is satisfied with policy set execution and when quality criteria have been reached for the policy set, the
627PDP group is set to run in SAFE mode. In this mode, the policies run on the target environment but do not actually
628exercise any actions or change any context in the target environment. Again, as in TEST mode, the operator may decide to
629revert back to TEST mode or even PASSIVE mode if issues arise with a policy set.
630
631Finally, when the user is satisfied with policy set execution and when quality criteria have been reached, the PDP group
632is set into ACTIVE state and the policy set executes on the target environment. The results of target operation are
633reported. The PDP group can be reverted to SAFE, TEST, or even PASSIVE mode at any time if problems arise.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400634
liamfallon3602c182020-04-16 09:29:45 +0100635\* SAFE Mode and TEST Mode will be implemented in future versions of the Policy Framework. In current versions, policies
636transition directly from PASSIVE mode to ACTIVE mode.
637
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -04006382.3.5.3 Policy Upgrade and Rollback
liamfallone62f7112019-05-24 10:50:57 +0000639"""""""""""""""""""""""""""""""""""
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400640
liamfallon3602c182020-04-16 09:29:45 +0100641There are a number of approaches for managing policy upgrade and rollback. Upgrade and rollback will be implemented in
642future versions of the Policy Framework.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400643
liamfallonc9e27902019-05-28 13:27:04 +0000644The most straightforward approach is to use the approach described in section :ref:`policy-rollout` for upgrading and
645rolling back policy sets. In order to upgrade a policy set, one follows the process in :ref:`policy-rollout` with the
646new policy set version. For rollback, one follows the process in :ref:`policy-rollout` with the older policy set, most
647probably setting the old policy set into ACTIVE mode immediately. The advantage of this approach is that the approach is
648straightforward. The obvious disadvantage is that the PDP group is not executing on the target environment while the new
649policy set is in PASSIVE, TEST, and SAFE mode.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400650
liamfallonc9e27902019-05-28 13:27:04 +0000651A second manner to tackle upgrade and rollback is to use a spare-wheel approach. An special upgrade PDP group service is
652set up as a K8S service in parallel with the active one during the upgrade procedure. The spare wheel service is used to
653execute the process described in :ref:`policy-rollout`. When the time comes to activate the policy set, the references
654for the active and spare wheel services are simply swapped. The advantage of this approach is that the down time during
655upgrade is minimized, the spare wheel PDP group can be abandoned at any time without affecting the in service PDP group,
656and the upgrade can be rolled back easily for a period simply by preserving the old service for a time. The disadvantage
657is that this approach is more complex and uses more resources than the first approach.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400658
liamfallonc9e27902019-05-28 13:27:04 +0000659A third approach is to have two policy sets running in each PDP, an active set and a standby set. However such an
660approach would increase the complexity of implementation in PDPs significantly.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400661
6622.3.6 Policy Monitoring
liamfallone62f7112019-05-24 10:50:57 +0000663^^^^^^^^^^^^^^^^^^^^^^^
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400664
liamfallonc9e27902019-05-28 13:27:04 +0000665PDPs provide a periodic report of their status to the PAP. All PDPs report using a standard reporting format that is
666extended to provide information for specific PDP types. PDPs provide at least the information below:
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400667
668===================== ===============================================================================
669**Field** **Description**
670===================== ===============================================================================
liamfallon3602c182020-04-16 09:29:45 +0100671State Lifecycle State (PASSIVE/TEST*/SAFE*/ACTIVE)
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400672Timestamp Time the report record was generated
673InvocationCount The number of execution invocations the PDP has processed since the last report
674LastInvocationTime The time taken to process the last execution invocation
675AverageInvocationTime The average time taken to process an invocation since the last report
676StartTime The start time of the PDP
677UpTime The length of time the PDP has been executing
678RealTimeInfo Real time information on running policies.
679===================== ===============================================================================
680
liamfallon3602c182020-04-16 09:29:45 +0100681\* SAFE Mode and TEST Mode will be implemented in future versions of the Policy Framework.
682
683Currently, policy monitoring is supported by PAP and by pdp-apex. Policy monitoring for all PDPs will be supported in
684future versions of the Policy Framework.
685
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -04006862.3.7 PEP Registration and Enforcement Guidelines
liamfallone62f7112019-05-24 10:50:57 +0000687^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400688
liamfallonc9e27902019-05-28 13:27:04 +0000689In ONAP there are several applications outside the Policy Framework that enforce policy decisions based on models
690provided to the Policy Framework. These applications are considered Policy Enforcement Engines (PEP) and roles will be
691provided to those applications using AAF/CADI to ensure only those applications can make calls to the Policy Decision
692APIs. Some example PEPs are: DCAE, OOF, and SDNC.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400693
liamfallonc9e27902019-05-28 13:27:04 +0000694See Section 3.4 of the :ref:`Policy Design and Development <design-label>`
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400695for more information on the Decision APIs.
696
6973. APIs Provided by the Policy Framework
698========================================
699
liamfallonc9e27902019-05-28 13:27:04 +0000700See the :ref:`Policy Design and Development <design-label>` page.
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400701
7024. Terminology
703==============
704
liamfallonc9e27902019-05-28 13:27:04 +0000705================================= ==================================================================================
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400706PAP (Policy Administration Point) A component that administers and manages policies
liamfallonc9e27902019-05-28 13:27:04 +0000707================================= ==================================================================================
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400708PDP (Policy Deployment Point) A component that executes a policy artifact (One or many?)
709PDP_<> A specific type of PDP
710PDP Group A group of PDPs that execute the same set of policies
711Policy Development The development environment for policies
liamfallonc9e27902019-05-28 13:27:04 +0000712Policy Type A generic prototype definition of a type of policy in TOSCA, see the
713 :ref:`TOSCA Policy Primer <tosca-label>`
714Policy An executable policy defined in TOSCA and created using a Policy Type, see the
715 :ref:`TOSCA Policy Primer <tosca-label>`
716Policy Set A set of policies that are deployed on a PDP group. One and only one Policy Set is
717 deployed on a PDP group
718================================= ==================================================================================
Pamela Dragosh5fc2fdb2019-05-17 09:42:27 -0400719
720
721End of Document