Updating doc for policy participant
[policy/parent.git] / docs / clamp / acm / design-impl / participants / policy-framework-participant.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2
3 .. _clamp-acm-policy-framework-participant:
4
5 The CLAMP Policy Framework Participant
6 ######################################
7
8 .. contents::
9     :depth: 3
10
11 Automation Composition Elements in the Policy Framework Participant are configured using TOSCA metadata defined for the Policy Automation Composition Element type.
12
13 The Policy Framework participant receives messages through participant-intermediary common code, and handles them by invoking REST APIs towards policy-framework.
14
15 For example, When a PARTICIPANT_UPDATE message is received by policy participant prompted by a PRIME, it contains the Automation Composition Element Definitions from the Tosca Service Template that was commissioned. An Automation Composition Instance can then be created from the commissioned definitions. When the automation composition instance element state changed from UNDEPLOYED to DEPLOYED, the Policy-participant receives a AUTOMATION_COMPOSITION_DEPLOY message, which triggers the creation of policy-types and policies in Policy-Framework.
16
17 When the state changes from DEPLOYED to UNDEPLOYED, Policy-Participant deletes the policies, policy-types by invoking REST APIs towards the policy-framework.
18
19 Run Policy Framework Participant command line using Maven
20 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21
22 mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8082"
23
24 Run Policy Framework Participant command line using Jar
25 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
26
27 java -jar -Dserver.port=8082 -DtopicServer=localhost target/policy-clamp-participant-impl-policy-6.1.2-SNAPSHOT.jar
28
29 Distributing Policies
30 +++++++++++++++++++++
31
32 The Policy Framework participant uses the Policy PAP API to deploy and undeploy policies.
33
34 When a Policy Framework Automation Composition Element changes from state UNDEPLOYED to state DEPLOYED, the policy is deployed. When it changes from state DEPLOYED to state UNDEPLOYED, the policy is undeployed.
35
36 For more complete detail of the state machines please go to the state machines page :ref:`acm-states-label`.
37
38 The PDP group to which the policy should be deployed is specified in the Automation Composition Element metadata, see the Policy Automation Composition Element type definition. If the PDP group specified for policy deployment does not exist, an error is reported.
39
40 The PAP Policy Status API and Policy Deployment Status API are used to retrieve data to report on the deployment status of policies in Participant Status messages.
41
42 The PDP Statistics API is used to get statistics for statistics report from the Policy Framework Participant back to the CLAMP runtime.
43
44 Policy Type and Policy References
45 +++++++++++++++++++++++++++++++++
46
47 The Policy Framework uses the policyType and policyId properties defined in the Policy Automation Composition Element type references to specify what policy type and policy should be used by a Policy Automation Composition Element.
48
49 The Policy Type and Policy specified in the policyType and policyId reference must of course be available in the Policy Framework in order for them to be used in Automation Composition instances. In some cases, the Policy Type and/or the Policy may be already loaded in the Policy Framework. In other cases, the Policy Framework participant must load the Policy Type and/or policy.
50
51 Policy Type References
52 **********************
53
54 The Policy Participant uses the following steps for Policy Type References:
55
56 #. The Policy Participant reads the Policy Type ID from the policyType property specified for the Automation Composition Element.
57
58 #. It checks if a Policy Type with that Policy Type ID has been specified in the ToscaServiceTemplateFragment field in
59    the AutomationCompositionElement definition in the AutomationCompositionUpdate message, see :ref:`acm-participant-protocol-label`.
60
61   #. If the Policy Type has been specified, the Participant stores the Policy Type in the Policy framework. If the
62      Policy Type is successfully stored, execution proceeds, otherwise an error is reported.
63
64   #. If the Policy Type has not been specified, the Participant checks that the Policy Type is already in the Policy
65      framework. If the Policy Type already exists, execution proceeds, otherwise an error is reported.
66
67 Policy References
68 *****************
69
70 The Policy Participant uses the following steps for Policy References:
71
72 #. The Policy Participant reads the Policy ID from the policyId property specified for the Automation Composition Element.
73
74 #. It checks if a Policy with that Policy ID has been specified in the ToscaServiceTemplateFragment field in the
75    AutomationCompositionElement definition in the AutomationCompositionUpdate message, :ref:`acm-participant-protocol-label`.
76
77   #. If the Policy has been specified, the Participant stores the Policy in the Policy framework. If the Policy is
78      successfully stored, execution proceeds, otherwise an error is reported.
79
80   #. If the Policy has not been specified, the Participant checks that the Policy is already in the Policy framework. If
81      the Policy already exists, execution proceeds, otherwise an error is reported.