blob: f5e2977adf7a22ba2e95b1c4ab9246bcf0722f61 [file] [log] [blame]
Pamela Dragoshf62375d2019-06-04 14:00:11 -04001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2
3.. _xacml-label:
4
5Policy XACML PDP Engine
6#######################
7
8.. toctree::
9 :maxdepth: 2
10
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -040011The ONAP XACML Policy PDP Engine uses an `open source implementation <https://github.com/att/XACML>`__ of the `OASIS XACML 3.0 Standard <https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xacml>`__ to support fine-grained policy decisions in the ONAP. The XACML 3.0 Standard is a language for both policies and requests/responses for access control decisions. The ONAP XACML PDP translates TOSCA Compliant Policies into the XACML policy language, loads the policies into the XACML engine and exposes a Decision API which uses the XACML request/response language to render decisions for ONAP components.
Pamela Dragoshf62375d2019-06-04 14:00:11 -040012
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -040013ONAP XACML PDP Supported Policy Types
14*************************************
Pamela Dragoshf62375d2019-06-04 14:00:11 -040015
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -040016The following Policy Types are supported by the XACML PDP Engine (PDP-X):
Pamela Dragoshf62375d2019-06-04 14:00:11 -040017
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -040018.. csv-table:: Supported Base Policy Types
19 :header: "Application", "Base Policy Type", "Action", "Description"
20
21 "Monitoring", "onap.policies.Monitoring", "configure", "Control Loop DCAE Monitoring Policies"
22 "Guard", "onap.policies.controlloop.guard.Common", "guard", "Control Loop Guard and Coordination Policies"
23 "Optimization", "onap.policies.Optimization", "optimize", "Optimization policy types used by OOF"
24 "Naming", "onap.policies.Naming", "naming", "Naming policy types used by SDNC"
25 "Native", "onap.policies.native.Xacml", "native", "Native XACML Policies"
26
27Each Policy Type is implemented as an application that extends the **XacmlApplicationServiceProvider**, and provides a **ToscaPolicyTranslator** that translates the TOSCA representation of the policy into a XACML OASIS 3.0 standard policy.
28
29By cloning the policy/xacml-pdp repository, a developer can run the JUnit tests for the applications to get a better understanding on how applications are built using translators and the XACML Policies that are generated for each Policy Type. Each application supports one or more Policy Types and an associated "action" used by the Decision API when making these calls.
30
31See the :ref:`policy-development-tools-label` for more information on cloning and developing the policy repositories.
32
33XACML-PDP applications are located in the 'applications' sub-module in the policy/xacml-pdp repo. `Click here to view the applications sub-modules <https://github.com/onap/policy-xacml-pdp/tree/master/applications>`_
34
35XACML PDP TOSCA Translators
36===========================
37
38The following common translators are available in ONAP for use by developers. Each is used or extended by the standard PDP-X applications in ONAP.
39
40StdCombinedPolicyResultsTranslator Translator
41---------------------------------------------
42A simple translator that wraps the TOSCA policy into a XACML policy and performs matching of the policy based on either policy-id and/or policy-type. The use of this translator is discouraged as it behaves like a database call and does not take advantage of the fine-grain decision making features described by the XACML OASIS 3.0 standard. It is used to support backward compatibility of legacy "configure" policies.
43
44`Implementation of Combined Results Translator <https://github.com/onap/policy-xacml-pdp/blob/master/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java>`_.
45
46The Monitoring and Naming applications use this translator.
47
48StdMatchableTranslator Translator
49---------------------------------
50More robust translator that searches metadata of TOSCA properties for a **matchable** field set to **true**. The translator then uses those "matchable" properties to translate a policy into a XACML OASIS 3.0 policy which allows for fine-grained decision making such that ONAP applications can retrieve the appropriate policy(s) to be enforced during runtime.
51
52Each of the properties designated as "matchable" are treated relative to each other as an "AND" during a Decision request call. In addition, each value of a "matchable property that is an array, is treated as an "OR". The more properties specified in a decision request, the more fine-grained a policy will be returned. In addition, the use of "policy-type" can be used in a decision request to further filter the decision results to a specific type of policy.
53
54`Implementation of Matchable Translator <https://github.com/onap/policy-xacml-pdp/blob/master/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java>`_.
55
56The Optimization application uses this translator.
57
58GuardTranslator and CoordinationGuardTranslator
59-----------------------------------------------
60These two translators are used by the Guard application and are very specific to those Policy Types. They are good examples on how to build your own translator for a very specific implementation of a policy type. This can be the case if any of the Std* translators are not appropriate to use directly or override for your application.
61
62`Implementation of Guard Translator <https://github.com/onap/policy-xacml-pdp/blob/master/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java>`_
63
64`Implementation of Coordination Translator <https://github.com/onap/policy-xacml-pdp/blob/master/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java>`_
65
66Native XACML OAISIS 3.0 XML Policy Translator
67-----------------------------------------------
68
69This translator pulls a URL encoded XML XACML policy from a TOSCA Policy and loads it into a XACML Engine. This allows native XACML policies to be used to support complex use cases in which a translation from TOSCA to XACML is too difficult.
70
71`Implementation of Native Policy Translator <https://github.com/onap/policy-xacml-pdp/tree/master/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ>`_
Pamela Dragoshf62375d2019-06-04 14:00:11 -040072
73Monitoring Policy Types
74=======================
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -040075These Policy Types are used by Control Loop DCAE microservice components to support monitoring of VNF/PNF entities to support an implementation of a Control Loops. The DCAE Platform makes a call to Decision API to request the contents of these policies. The implementation involves creating an overarching XACML Policy that contains the TOSCA policy as a payload that is returned to the DCAE Platform.
76
77The following policy types derive from onap.policies.Monitoring:
Pamela Dragoshf62375d2019-06-04 14:00:11 -040078
79.. csv-table::
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -040080 :header: "Derived Policy Type", "Action", "Description"
Pamela Dragoshf62375d2019-06-04 14:00:11 -040081
Pamela Dragosh56316602020-08-20 09:16:20 -040082 "onap.policies.monitoring.tcagen2", "configure", "TCA DCAE microservice gen2 component"
Pamela Dragoshf62375d2019-06-04 14:00:11 -040083 "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server", "configure", "REST Collector"
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -040084 "onap.policies.monitoring.docker.sonhandler.app", "configure", "SON Handler microservice component"
Pamela Dragoshf62375d2019-06-04 14:00:11 -040085
Pamela Dragosh56316602020-08-20 09:16:20 -040086.. note::
87 DCAE project deprecated TCA DCAE microservice in lieu for their gen2 microservice. Thus, the policy type onap.policies.monitoring.cdap.tca.hi.lo.app was removed from Policy Framework.
88
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -040089This is an example Decision API payload made to retrieve a decision for a Monitoring Policy by id. Not recommended - as users may change id's of a policy. Available for backward compatibility.
Pamela Dragoshf62375d2019-06-04 14:00:11 -040090
91.. literalinclude:: decision.monitoring.json
92 :language: JSON
93
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -040094This is an example Decision API payload made to retrieve a decision for all deployed Monitoring Policies for a specific type of Monitoring policy.
95
96.. literalinclude:: decision.monitoring.type.json
97 :language: JSON
98
99Guard and Control Loop Coordination Policy Types
100================================================
101These Policy Types are used by Control Loop Drools Engine to support guarding control loop operations and coordination of Control Loops during runtime control loop execution.
Pamela Dragoshf62375d2019-06-04 14:00:11 -0400102
103.. csv-table::
104 :header: "Policy Type", "Action", "Description"
105
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -0400106 "onap.policies.controlloop.guard.common.FrequencyLimiter", "guard", "Limits frequency of actions over a specified time period"
107 "onap.policies.controlloop.guard.common.Blacklist", "guard", "Blacklists a regexp of VNF IDs"
108 "onap.policies.controlloop.guard.common.MinMax", "guard", "For scaling, enforces a min/max number of VNFS"
109 "onap.policies.controlloop.guard.coordination.FirstBlocksSecond", "guard", "Gives priority to one control loop vs another"
Pamela Dragoshf62375d2019-06-04 14:00:11 -0400110
111This is an example Decision API payload made to retrieve a decision for a Guard Policy Type.
112
113.. literalinclude:: decision.guard.json
114 :language: JSON
115
Pamela Dragosh9a890582020-06-19 09:51:50 -0400116The return decision simply has "permit" or "deny" in the response to tell the calling application whether they are allowed to perform the operation.
117
118.. literalinclude:: decision.guard.response.json
119 :language: JSON
120
Pamela Dragoshf65c8ff2020-04-29 08:23:12 -0400121.. _xacml-optimization-label:
122
Pamela Dragoshf62375d2019-06-04 14:00:11 -0400123Optimization Policy Types
124=========================
Pamela Dragoshf65c8ff2020-04-29 08:23:12 -0400125These Policy Types are designed to be used by the OOF Project support several domains including VNF placement in ONAP.
126The OOF Platform makes a call to the Decision API to request these Policies based on the values specified in the
127onap.policies.Optimization properties. Each of these properties are treated relative to each other as an "AND". In
128addition, each value for each property itself is treated as an "OR".
Pamela Dragoshf62375d2019-06-04 14:00:11 -0400129
130.. csv-table::
131 :header: "Policy Type", "Action"
132
Pamela Dragosh20cf0272019-09-10 12:25:24 -0400133 "onap.policies.Optimization", "optimize"
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -0400134 "onap.policies.optimization.Service", "optimize"
135 "onap.policies.optimization.Resource", "optimize"
136 "onap.policies.optimization.resource.AffinityPolicy", "optimize"
137 "onap.policies.optimization.resource.DistancePolicy", "optimize"
138 "onap.policies.optimization.resource.HpaPolicy", "optimize"
139 "onap.policies.optimization.resource.OptimizationPolicy", "optimize"
140 "onap.policies.optimization.resource.PciPolicy", "optimize"
141 "onap.policies.optimization.service.QueryPolicy", "optimize"
142 "onap.policies.optimization.service.SubscriberPolicy", "optimize"
143 "onap.policies.optimization.resource.Vim_fit", "optimize"
144 "onap.policies.optimization.resource.VnfPolicy", "optimize"
Pamela Dragoshf62375d2019-06-04 14:00:11 -0400145
Pamela Dragoshf65c8ff2020-04-29 08:23:12 -0400146The optimization application extends the StdMatchablePolicyTranslator in that the application applies a "closest match"
147algorithm internally after a XACML decision. This filters the results of the decision to return the one or more policies
148that match the incoming decision request as close as possible. In addition, there is special consideration for the
149Subscriber Policy Type. If a decision request contains subscriber context attributes, then internally the application
150will apply an initial decision to retrieve the scope of the subscriber. The resulting scope attributes are then added
151into a final internal decision call.
Pamela Dragoshf62375d2019-06-04 14:00:11 -0400152
153This is an example Decision API payload made to retrieve a decision for an Optimization Policy Type.
154
155.. literalinclude:: decision.affinity.json
156 :language: JSON
157
Chenfei Gao7984ada2020-03-17 22:34:15 -0400158Native XACML Policy Type
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -0400159========================
160
Chenfei Gao7984ada2020-03-17 22:34:15 -0400161This Policy type is used by any client or ONAP component who has the need of native XACML evaluation. A native XACML policy or policy set encoded in XML can be created off this policy type and loaded into the XACML PDP engine by invoking the PAP policy deployment API. Native XACML requests encoded in either JSON or XML can be sent to the XACML PDP engine for evaluation by invoking the native decision API. Native XACML responses will be returned upon evaluating the requests against the matching XACML policies. Those native XACML policies, policy sets, requests and responses all follow the `OASIS XACML 3.0 Standard <https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xacml>`__.
162
163.. csv-table::
164 :header: "Policy Type", "Action", "Description"
165
166 "onap.policies.native.Xacml", "native", "any client or ONAP component"
167
Chenfei Gao7984ada2020-03-17 22:34:15 -0400168According to the XACML 3.0 specification, two content-types are supported and used to present the native requests/responses. They are formally defined as "application/xacml+json" and "application/xacml+xml".
169
170This is an example Native Decision API payload made to retrieve a decision for whether Julius Hibbert can read http://medico.com/record/patient/BartSimpson.
171
172.. literalinclude:: decision.native.json
173 :language: JSON
174
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -0400175Supporting Your Own Policy Types and Translators
176************************************************
Pamela Dragoshf62375d2019-06-04 14:00:11 -0400177
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -0400178In order to support your own custom Policy Type that the XACML PDP Engine can support, one needs to build a Java service application that extends the **XacmlApplicationServiceProvider** interface and implement a **ToscaPolicyTranslator** application. Your application should register itself as a Java service application and expose it in the classpath used to be loaded into the ONAP XACML PDP Engine. Ensure you define and create the TOSCA Policy Type according to these :ref:`Policy Design and Development <design-label>`. You should be able to load your custom Policy Type using the :ref:`Policy Lifecycle API <api-label>`. Once successful, you should be able to start creating policies from your custom Policy Type.
Pamela Dragoshf62375d2019-06-04 14:00:11 -0400179
Pamela Dragoshb4a8ef22020-04-21 15:30:35 -0400180XacmlApplicationServiceProvider
181===============================
182
183`Interface for XacmlApplicationServiceProvider <https://github.com/onap/policy-xacml-pdp/blob/master/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlApplicationServiceProvider.java>`_
184
185See each of the ONAP Policy Type application implementations which re-use the **StdXacmlApplicationServiceProvider** class. This implementation can be used as a basis for your own custom applications.
186
187`Standard Application Service Provider implementation <https://github.com/onap/policy-xacml-pdp/blob/master/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java>`_
188
189ToscaPolicyTranslator
190=====================
191
192Your custom **XacmlApplicationServiceProvider** must provide an implementation of a *ToscaPolicyTranslator*.
193
194`Interface for ToscaPolicyTranslator <https://github.com/onap/policy-xacml-pdp/blob/master/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/ToscaPolicyTranslator.java>`_
195
196See each of the ONAP Policy type application implementations which each have their own *ToscaPolicyTranslator*. Most use or extend the **StdBaseTranslator**.
197
198`Standard Tosca Policy Translator implementation <https://github.com/onap/policy-xacml-pdp/blob/master/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java>`.
199
200XACML Application Tutorial
201==========================
202
203The following tutorial can be helpful to get started:
204
205.. toctree::
206 :maxdepth: 1
207
208 xacml-tutorial
Pamela Dragosh0ac4c6a2019-06-11 10:55:04 -0400209
210Once your application is developed and the ONAP XACML PDP Engine can find your application via setting the classpath appropriately, then use the :ref:`PAP REST API <pap-label>` to ensure the ONAP XACML PDP is registering your custom Policy Type with the PAP. Once successful, then you should be able to start deploying the created policies to the XACML PDP Engine.
Pamela Dragoshf62375d2019-06-04 14:00:11 -0400211