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.
29 * The Onap Name must be empty for the policy to work. To do this, **clone** the policy provided and then edit.
30 * Even though the number of requests exceeds the limit, the request is not denied.
32 .. image:: PolicyGUI_GuardPolicy.png
39 PUT /createPolicy to create a policy
41 The request should be in the following form for regular guard policy:
44 :caption: Regular Guard Policy Creation
48 "policyClass": "Decision",
49 "policyName": "Test.TestingGUARDapitest",
50 "policyDescription": "Testing new YAML Guard Policy",
52 "ruleProvider": "GUARD_YAML",
61 "timeUnits" : "minute",
62 "guardActiveStart": "05:00:00-05:00",
63 "guardActiveEnd": "23:59:59-05:00"
68 The request should be in the following form for blacklist guard policy:
71 :caption: Blacklist Guard Policy Creation
75 "policyClass": "Decision",
76 "policyName": "Test.TestingBLGUARD",
77 "policyDescription": "Testing New BL YAML Guard Policy",
79 "ruleProvider": "GUARD_BL_YAML",
85 "guardActiveStart": "05:00:00-05:00",
86 "guardActiveEnd": "23:59:59-05:00",
87 "blackList": "target1,target2,target3"
95 In order to use the guard policies just make an http request. For example:
100 POST pdp:8081/pdp/api/getDecision
101 Authorization:<yourAuth> ClientAuth:<yourClientAuth>
102 Environment:<environment> Content-Type:application/json < guard_request.json
105 | <yourAuth> is the string generated from user:pass converted to base64 encoding.
106 | <yourClientAuth> is generated the same way but from the client user and pass.
107 | <environment> is the context of the request. For example: TEST
109 The guard_request.json should be in the form of the following:
112 :caption: guard_request.json
115 "decisionAttributes": {
124 A response should be received that contains a "PERMIT" or "DENY" in all caps, like the following:
130 "decision": "PERMIT",
131 "details": "Decision Permit. OK!"