1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
4 *********************************
5 Creating and Using Guard Policies
6 *********************************
14 Guard policies are used to limit what operations shall be permitted. These policies are specified in the Policy GUI or restful API and either return "PERMIT" or "DENY" on request.
16 There are 2 types of policies, guard policies and blacklist guard policies. The blacklist describes what is not allowed to be permitted and guard policies describe what is allowed to be permitted. Note: as of 1802 release, Policy PDP behaves as a PERMIT overrides fashion so if any policy permits, it will override any denies.
18 Creating Guard Policies
19 ^^^^^^^^^^^^^^^^^^^^^^^
21 There are two options for creating guard policies: (1) through the GUI and (2) through the restful API.
26 The GUARD policy can be created from the POLICY GUI as shown below.
28 .. image:: PolicyGUI_GuardPolicy.png
30 .. note:: The Onap Name must be empty for the policy to work. To accomplish this, instead of creating a new policy, **clone** the provided policy first and then **edit** it.
32 .. warning:: The request does not get denied, even though the number of requests exceeds the limit.
38 Use PUT /createPolicy to create a policy.
39 The request should be in the following form for regular guard policy:
42 :caption: Regular Guard Policy Creation
46 "policyClass": "Decision",
47 "policyName": "Test.TestingGUARDapitest",
48 "policyDescription": "Testing new YAML Guard Policy",
50 "ruleProvider": "GUARD_YAML",
59 "timeUnits" : "minute",
60 "guardActiveStart": "05:00:00-05:00",
61 "guardActiveEnd": "23:59:59-05:00"
66 The request should be in the following form for blacklist guard policy:
69 :caption: Blacklist Guard Policy Creation
73 "policyClass": "Decision",
74 "policyName": "Test.TestingBLGUARD",
75 "policyDescription": "Testing New BL YAML Guard Policy",
77 "ruleProvider": "GUARD_BL_YAML",
83 "guardActiveStart": "05:00:00-05:00",
84 "guardActiveEnd": "23:59:59-05:00",
85 "blackList": "target1,target2,target3"
93 In order to use the guard policies just make an http request. For example:
98 POST pdp:8081/pdp/api/getDecision
99 Authorization:<yourAuth> ClientAuth:<yourClientAuth>
100 Environment:<environment> Content-Type:application/json < guard_request.json
103 | *<yourAuth>* is the string generated from user:pass converted to base64 encoding.
104 | *<yourClientAuth>* is generated the same way but from the client user and pass.
105 | *<environment>* is the context of the request. For example: TEST
107 The guard_request.json should be in the form of the following:
110 :caption: guard_request.json
113 "decisionAttributes": {
122 A response containing a "PERMIT" or "DENY" in uppercase is returned as follows:
128 "decision": "PERMIT",
129 "details": "Decision Permit. OK!"