Complete Architecture Document
[policy/parent.git] / docs / design / design.rst
1 .. This work is licensed under a
2 .. Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5 .. _design-label:
6
7 Policy Design and Development
8 -----------------------------
9
10 .. contents::
11     :depth: 3
12
13 This document provides examples that illustrate how to write, deploy, and run policies
14 of various types using the framework.
15
16 The figure below shows the Artifacts (Blue) in the ONAP Policy
17 Framework, the Activities (Yellow) that manipulate them, and important
18 components (Pink) that interact with them.
19
20 .. image:: design.png
21
22 Please see the `TOSCA Policy
23 Primer <tosca-label>`__ page for an
24 introduction to TOSCA policy concepts.
25
26 TOSCA defines a *PolicyType*, the definition of a type of policy that
27 can be applied to a service. It also defines a *Policy*, the definition
28 of an instance of a *PolicyType*. In the Policy Framework, we must
29 handle and manage these TOSCA definitions and tie them to real
30 implementations of policies that can run on PDPs.
31
32 The diagram above outlines how this is achieved. Each TOSCA *PolicyType*
33 must have a corresponding *PolicyTypeImpl* in the Policy Framework. The
34 TOSCA \ *PolicyType* definition can be used to create a TOSCA *Policy*
35 definition, either directly by the Policy Framework, by CLAMP, or by
36 some other system. Once the \ *Policy* artifact exists, it can be used
37 together with the *PolicyTypeImpl* artifact to create a *PolicyImpl*
38 artifact. A *PolicyImpl* artifact is an executable policy implementation
39 that can run on a PDP.
40
41 The TOSCA *PolicyType* artifact defines the external characteristics of
42 the policy; defining its properties, the types of entities it acts on,
43 and its triggers.  A *PolicyTypeImpl* artifact is an XACML, Drools, or
44 APEX implementation of that policy definition. *PolicyType* and
45 *PolicyTypeImpl* artifacts may be preloaded, may be loaded manually, or
46 may be created using the Lifecycle API. Alternatively, *PolicyType*
47 definitions may be loaded over the Lifecycle API for preloaded
48 *PolicyTypeImpl* artifacts. A TOSCA *PolicyType* artifact can be used by
49 clients (such as CLAMP or CLI tools) to create, parse, serialize, and/or
50 deserialize an actual Policy.
51
52 The TOSCA *Policy* artifact is used internally by the Policy Framework,
53 or is input by CLAMP or other systems. This artifact specifies the
54 values of the properties for the policy and specifies the specific
55 entities the policy acts on. Policy Design uses the TOSCA *Policy*
56 artifact and the *PolicyTypeImpl* artifact to create an executable
57 *PolicyImpl* artifact. 
58
59 1 ONAP Policy Types
60 ===================
61
62 Policy Type Design manages TOSCA *PolicyType* artifacts and their
63 *PolicyTypeImpl* implementations\ *.*
64
65 *TOSCA PolicyType* may ultimately be defined by the modeling team but
66 for now are defined by the Policy Framework project. Various editors and
67 GUIs are available for creating *PolicyTypeImpl* implementations.
68 However, systematic integration of *PolicyTypeImpl* implementation is
69 outside the scope of the ONAP Dublin release.
70
71 The \ *PolicyType* definitions and implementations listed below are
72 preloaded and are always available for use in the Policy Framework.
73
74 ====================================== ==================================================================================================
75 **Policy Type**                        **Description**
76 ====================================== ==================================================================================================
77 onap.policies.Monitoring               Overarching model that supports Policy driven DCAE microservice components used in a Control Loops
78 onap.policies.controlloop.Operational  Used to support actor/action operational policies for control loops
79 onap.policies.controlloop.Guard        Control Loop guard policies for policing control loops
80 onap.policies.controlloop.Coordination Control Loop Coordination policies to assist in coordinating multiple control loops at runtime
81 ====================================== ==================================================================================================
82
83 1.1 onap.policies.Monitoring Policy Type
84 ----------------------------------------
85
86 This is a base Policy Type that supports Policy driven DCAE microservice
87 components used in a Control Loops. The implementation of this Policy
88 Type is developed using the XACML PDP to support question/answer Policy
89 Decisions during runtime for the DCAE Policy Handler.
90
91 **Base Policy Type definition for onap.policies.Monitoring**  
92
93 .. codeblock:: yaml
94
95     tosca_definitions_version: tosca_simple_yaml_1_0_0
96     topology_template:
97         policy_types:
98             - onap.policies.Monitoring:
99                 derived_from: tosca.policies.Root
100                 version: 1.0.0
101                 description: a base policy type for all policies that govern monitoring provision
102
103 The \ *PolicyTypeImpl* implementation of the *onap.policies.Montoring*
104 Policy Type is generic to support definition of TOSCA *PolicyType*
105 artifacts in the Policy Framework using the Policy Type Design API.
106 Therefore many TOSCA *PolicyType* artifacts will use the same
107 *PolicyTypeImpl* implementation with different property types and
108 towards different targets. This allows dynamically generated DCAE
109 microservice component Policy Types to be created at Design Time.
110
111 DCAE microservice components can generate their own TOSCA \ *PolicyType*
112 using TOSCA-Lab Control Loop guard policies in SDC (Stretch Goal) or can
113 do so manually. See `How to generate artefacts for SDC catalog using
114 Tosca Lab
115 Tool <file://localhost/display/DW/How+to+generate+artefacts+for+SDC+catalog+using+Tosca+Lab+Tool>`__
116 for details on TOSCA-LAB in SDC. For Dublin, the DCAE team is defining
117 the manual steps required to build policy models \ `Onboarding steps for
118 DCAE MS through SDC/Policy/CLAMP
119 (Dublin) <file://localhost/pages/viewpage.action%3fpageId=60883710>`__.
120
121 NOTE: For Dublin, mS Policy Types will be pre-loaded into the SDC
122 platform and be available as a Normative. The policy framework will
123 pre-load support for those mS Monitoring policy types.
124
125
126 End of Document
127