[POLICY-73] replace openecomp for policy-engine
[policy/engine.git] / ONAP-PDP / src / test / resources / CSVPolicy.xml
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 <!--
3   ============LICENSE_START=======================================================
4   ONAP-PDP
5   ================================================================================
6   Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
7   ================================================================================
8   Licensed under the Apache License, Version 2.0 (the "License");
9   you may not use this file except in compliance with the License.
10   You may obtain a copy of the License at
11   
12        http://www.apache.org/licenses/LICENSE-2.0
13   
14   Unless required by applicable law or agreed to in writing, software
15   distributed under the License is distributed on an "AS IS" BASIS,
16   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   See the License for the specific language governing permissions and
18   limitations under the License.
19   ============LICENSE_END=========================================================
20   -->
21
22 <Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:fb9e6bed-b5dd-430c-acd4-1baed0c1f1cf" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit">
23     <Description>This Policy handles the Take action and Advice action operations. </Description>
24     <Target />
25         <!--<Target>
26         <AnyOf>
27             <AllOf>
28                 <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
29                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">VM</AttributeValue>
30                     <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
31                 </Match>
32             </AllOf>
33         </AnyOf>
34     </Target> -->
35     <VariableDefinition VariableId="doesItRequireNewVM">
36         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:or">
37             <Description>Check the CPU Utilization or Network Load</Description>
38             <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than">
39                 <Description>Load</Description>
40                 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
41                     <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="com:att:labs:onap:resource:vm:load" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="true"/>
42                 </Apply>
43                                 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">95</AttributeValue>
44                 <!--<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
45                     <AttributeDesignator Category="com:att:research:xacml:test:pip:csv:category:server" AttributeId="com:att:research:xacml:test:pip:csv:server:loadval" DataType="http://www.w3.org/2001/XMLSchema#integer" Issuer="com:att:research:xacml:test:pip:csv" MustBePresent="false"/>
46                 </Apply> -->
47             </Apply>
48             <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than">
49                 <Description>CPU</Description>
50                 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
51                     <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="com:att:labs:onap:resource:vm:cpu" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="true"/>
52                 </Apply>
53                                 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">95</AttributeValue>
54                 <!-- <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
55                     <AttributeDesignator Category="com:att:research:xacml:test:pip:csv:category:server" AttributeId="com:att:research:xacml:test:pip:csv:server:cpuval" DataType="http://www.w3.org/2001/XMLSchema#integer" Issuer="com:att:research:xacml:test:pip:csv" MustBePresent="false"/>
56                 </Apply> -->
57             </Apply>
58         </Apply>
59     </VariableDefinition>
60         <Rule RuleId="urn:com:xacml:rule:id:9f8e2241-8205-4656-b6f6-143637cc0c66" Effect="Permit">
61         <Description>Permit to create a new VM with Obligation</Description>
62         <Target />
63                 <!--<Target>
64                         <AnyOf>
65                                 <AllOf>
66                                         <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
67                                                 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">create_Action</AttributeValue>
68                                                 <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
69                                         </Match>
70                                 </AllOf>
71                         </AnyOf>
72                 </Target> -->
73                 <Condition>
74             <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal">
75                 <Description>If the Requirement has met create the VM</Description>
76                 <VariableReference VariableId="doesItRequireNewVM"/>
77                 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#boolean">true</AttributeValue>
78             </Apply>
79         </Condition>
80                 <ObligationExpressions>
81             <ObligationExpression ObligationId="com.att.research.nvp.test.obligation" FulfillOn="Permit">
82                 <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.obligation.key" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
83                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Action_Info</AttributeValue>
84                 </AttributeAssignmentExpression>
85             </ObligationExpression>
86             <ObligationExpression ObligationId="com.att.research.nvp.test.multiobligation" FulfillOn="Permit">
87                 <AttributeAssignmentExpression AttributeId="com.att.research.nvp.obligation.value" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action">
88                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Create_NEW_VM</AttributeValue>
89                 </AttributeAssignmentExpression>
90             </ObligationExpression>
91         </ObligationExpressions>
92     </Rule>
93     <Rule RuleId="urn:com:xacml:rule:id:6dd4c4b2-8864-4bae-b497-7472b464ffe7" Effect="Permit">
94         <Description>Permit to create a new VM with Advice</Description>
95         <Target>
96                         <AnyOf>
97                                 <AllOf>
98                                         <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
99                                                 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">create_adviceAction</AttributeValue>
100                                                 <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
101                                         </Match>
102                                 </AllOf>
103                         </AnyOf>
104                 </Target>
105                 <Condition>
106             <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal">
107                 <Description>If the Requirement has met create the VM</Description>
108                 <VariableReference VariableId="doesItRequireNewVM"/>
109                 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#boolean">true</AttributeValue>
110             </Apply>
111         </Condition>
112                 <AdviceExpressions>
113             <AdviceExpression AdviceId="com.att.research.nvp.test.advice.multi" AppliesTo="Permit">
114                 <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.key">
115                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Action_Info</AttributeValue>
116                 </AttributeAssignmentExpression>
117             </AdviceExpression>
118             <AdviceExpression AdviceId="com.att.research.nvp.test.advice.multiadvice" AppliesTo="Permit">
119                                 <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.multival">
120                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Created New VM</AttributeValue>
121                 </AttributeAssignmentExpression>
122                                 <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.val" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
123                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">http://localhost:8080/pdp/?type=hb</AttributeValue>
124                 </AttributeAssignmentExpression>
125             </AdviceExpression>
126         </AdviceExpressions>
127     </Rule>
128         <VariableDefinition VariableId="removeVM">
129         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-less-than">
130             <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
131                 <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="com:att:research:xacml:test:pip:csv:resource:cpu" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="true"/>
132             </Apply>
133             <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
134                 <AttributeDesignator Category="com:att:research:xacml:test:pip:csv:category:server" AttributeId="com:att:research:xacml:test:pip:csv:server:minval" DataType="http://www.w3.org/2001/XMLSchema#integer" Issuer="com:att:research:xacml:test:pip:csv" MustBePresent="false"/>
135             </Apply>
136         </Apply>
137     </VariableDefinition>
138     <Rule RuleId="urn:com:xacml:rule:id:262fc3fd-f3f3-4aaa-8b9c-504f89be5ba2" Effect="Permit">
139         <Description>Permit to remove a VM with Obligation</Description>
140         <Target>
141                         <AnyOf>
142                                 <AllOf>
143                                         <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
144                                                 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">remove_Action</AttributeValue>
145                                                 <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
146                                         </Match>
147                                 </AllOf>
148                         </AnyOf>
149                 </Target>
150                 <Condition>
151             <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal">
152                 <Description>If the resource usage is low then remove the VM</Description>
153                 <VariableReference VariableId="removeVM"/>
154                 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#boolean">true</AttributeValue>
155             </Apply>
156         </Condition>
157                 <ObligationExpressions>
158             <ObligationExpression ObligationId="com.att.research.nvp.test.obligation" FulfillOn="Permit">
159                 <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.obligation.key" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
160                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Action_Info</AttributeValue>
161                 </AttributeAssignmentExpression>
162             </ObligationExpression>
163             <ObligationExpression ObligationId="com.att.research.nvp.test.multiobligation" FulfillOn="Permit">
164                 <AttributeAssignmentExpression AttributeId="com.att.research.nvp.obligation.value" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action">
165                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Remove_VM</AttributeValue>
166                 </AttributeAssignmentExpression>
167             </ObligationExpression>
168         </ObligationExpressions>
169     </Rule>
170     <Rule RuleId="urn:com:xacml:rule:id:6b17c532-6b43-4577-b499-30c862bc7df3" Effect="Permit">
171         <Description>Permit to remove a VM with Advice</Description>
172         <Target>
173                         <AnyOf>
174                                 <AllOf>
175                                         <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
176                                                 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">remove_adviceAction</AttributeValue>
177                                                 <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
178                                         </Match>
179                                 </AllOf>
180                         </AnyOf>
181                 </Target>
182                 <Condition>
183             <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal">
184                 <Description>If the resource usage is low then remove the VM</Description>
185                 <VariableReference VariableId="removeVM"/>
186                 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#boolean">true</AttributeValue>
187             </Apply>
188         </Condition>
189                 <AdviceExpressions>
190             <AdviceExpression AdviceId="com.att.research.nvp.test.advice.multi" AppliesTo="Permit">
191                 <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.key">
192                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Action_Info</AttributeValue>
193                 </AttributeAssignmentExpression>
194             </AdviceExpression>
195             <AdviceExpression AdviceId="com.att.research.nvp.test.advice.multiadvice" AppliesTo="Permit">
196                                 <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.multival">
197                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Removed VM</AttributeValue>
198                 </AttributeAssignmentExpression>
199                                 <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.val" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
200                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">http://localhost:8080/pdp/?type=hb</AttributeValue>
201                 </AttributeAssignmentExpression>
202             </AdviceExpression>
203         </AdviceExpressions>
204     </Rule>
205 </Policy>