Add more textual explanation in api doc
[policy/parent.git] / docs / architecture / tosca-policy-primer.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 .. _tosca-label:
6
7 TOSCA Policy Primer
8 -------------------
9
10 .. contents::
11     :depth: 2
12
13 This page gives a short overview of how Policy is modelled in the
14 `TOSCA Simple Profile in YAML <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.1/TOSCA-Simple-Profile-YAML-v1.1.pdf>`__.
15
16 TOSCA defines three concepts for Policy: Policy Type, Policy, and Trigger.
17
18 .. image:: images/ToscaPolicyStructure.png
19    :width: 800
20
21 Policy Type
22 ~~~~~~~~~~~
23
24 A Policy Type is used to specify the types of policies that may be used in a service. The parameter definitions
25 for a policy of this type, the entity types to which it applies, and what triggers policies of this type may be
26 specified.
27
28
29 The types of policies that are used in a service are defined in the policy_types section of the TOSCA service template
30 as a Policy Type. More formally, TOSCA  defines a Policy Type as an artifact that "defines a type of requirement that
31 affects or governs an application or service’s topology at  some stage of its life cycle, but is not explicitly part of
32 the topology itself". In the definition of a Policy Type in TOSCA, you specify:
33
34 * its properties, which define the type of configuration parameters that the policy takes
35 * its targets, which define the node types and/or groups to which the policy type applies
36 * its triggers, which specify the conditions in which policies of this type are fired
37
38 Policy
39 ~~~~~~
40
41 A Policy is used to specify the actual instances of policies that are used in a service. The parameter values of the
42 policy and the actual entities to which it applies may be specified.
43
44 The policies that are used in a service are defined in the policies section of the TOSCA topology template as a Policy.
45 More formally, TOSCA  defines a Policy as an artifact that "defines a policy that can be associated with a TOSCA
46 topology or top-level entity definition". In the definition of a Policy in TOSCA, you specify:
47
48 * its properties, which define the values of the configuration parameters that the policy takes
49 * its targets, which define the node types and/or group types to which the policy type applies
50
51 Note that policy triggers are specified on the Policy Type definition and are not specified on the Policy itself.
52
53 Trigger
54 ~~~~~~~
55
56 A Trigger defines an event, condition, and action that is used to initiate execution of a policy associated with it.
57 The definition of the Trigger allows specification of the type of events to trigger on, the filters on those events,
58 conditions and constraints for trigger firing, the action to perform on triggering, and various other parameters.
59
60 The triggers that are used in a service are defined as reusable modules in the TOSCA service template as a Trigger.
61 More formally, TOSCA  defines a Trigger as an artifact that "defines the event, condition and action that is used to
62 “trigger” a policy it is associated with". In the definition of a Trigger in TOSCA, you specify:
63
64 * its event_type, which defines the name of the event that fires the policy
65 * its schedule, which defines the time interval in which the trigger is active
66 * its target_filter, which defines specific filters for firing such as specific characteristics of the nodes or
67 relations for which the trigger should or should not fire
68 * its condition, which defines extra conditions on the incoming event for firing the trigger
69 * its constraint, which defines extra conditions on the incoming event for not firing the trigger
70 * its period, which defines the period to use for evaluating conditions and constraints
71 * its evaluations, which defines the number of evaluations that must be performed over the period to assert the
72 condition or constraint exists
73 * its method, the method to use for evaluation of conditions and constraints
74 * its action, the workflow or operation to invoke when the trigger fires
75
76 Note that how a Trigger actually works with a Policy is not clear from the specification.
77
78 End of Document
79