2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.policy.api;
23 import java.util.ArrayList;
24 import java.util.Date;
25 import java.util.List;
27 import java.util.UUID;
30 * <code>PolicyParameters</code> defines the Policy Parameters
31 * which are required to Create/Update a Policy.
35 public class PolicyParameters {
36 private PolicyClass policyClass;
37 private PolicyConfigType policyConfigType;
38 private String policyName;
39 private String policyDescription;
40 private String ecompName;
41 private String configName;
42 private Map<AttributeType, Map<String,String>> attributes;
43 private String configBody;
44 private PolicyType configBodyType;
45 private String actionPerformer;
46 private String actionAttribute;
47 private UUID requestID;
48 private List<String> dynamicRuleAlgorithmLabels;
49 private List<String> dynamicRuleAlgorithmFunctions;
50 private List<String> dynamicRuleAlgorithmField1;
51 private List<String> dynamicRuleAlgorithmField2;
52 private String priority;
53 private RuleProvider ruleProvider;
54 private String controllerName;
55 private ArrayList<String> dependencyNames;
57 private boolean guard = false;
58 private String riskLevel = "5";
59 private String riskType = "default";
60 private String extendedOption;
63 * Sets Config Policy Parameters.
65 * @param policyConfigType the {@link org.openecomp.policy.api.PolicyConfigType} Enum format of the Config Type
66 * @param policyName the <code>String</code> format of the Policy Name
67 * @param policyDescription the <code>String</code> format of the Policy Description
68 * @param ecompName the <code>String</code> format of the ECOMP Name
69 * @param configName the <code>String</code> format of the Config Name
70 * @param attributes the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
71 * @param configBodyType the {@link org.openecomp.policy.api.PolicyType} Enum format of the config Body Type.
72 * @param configBody the <code>String</code> format of the Policy Body
73 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
74 * A different request ID should be passed for each request.
76 public void setConfigPolicyParameters(PolicyConfigType policyConfigType, String policyName, String policyDescription, String ecompName, String configName,
77 Map<AttributeType, Map<String, String>> attributes, PolicyType configBodyType, String configBody, UUID requestID){
78 this.setPolicyConfigType(policyConfigType);
79 this.setPolicyName(policyName);
80 this.setPolicyDescription(policyDescription);
81 this.setEcompName(ecompName);
82 this.setConfigName(configName);
83 this.setAttributes(attributes);
84 this.setConfigBody(configBody);
85 this.setConfigBodyType(configBodyType);
86 this.setRequestID(requestID);
90 * Sets config Firewall Policy Parameters.
92 * @param policyName the <code>String</code> format of the Policy Name
93 * @param firewallJson the <code>String</code> representation of the Firewall Rules List
94 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
95 * A different request ID should be passed for each request.
97 public void setConfigFirewallPolicyParameters(String policyName, String firewallJson, UUID requestID){
98 this.setPolicyConfigType(PolicyConfigType.Firewall);
99 this.setPolicyName(policyName);
100 this.setConfigBody(firewallJson);
101 this.setConfigBodyType(PolicyType.JSON);
102 this.setRequestID(requestID);
106 * Gets the PolicyName of the Policy Parameters.
108 * @return policyName the <code>String</code> format of the Policy Name
110 public String getPolicyName() {
115 * Sets the policyName of the Policy Parameters.
117 * @param policyName the <code>String</code> format of the Policy Name
119 public void setPolicyName(String policyName) {
120 this.policyName = policyName;
124 * Gets the policy Description.
126 * @return the <code>String</code> format of the Policy Description
128 public String getPolicyDescription() {
129 return policyDescription;
133 * Sets the policy Description of the Policy Description.
135 * @param policyDescription the <code>String</code> format of the Policy Description
137 public void setPolicyDescription(String policyDescription) {
138 this.policyDescription = policyDescription;
142 * Gets the ECOMP Name value of the Policy Paramters.
144 * @return <code>String</code> format of the ECOMP Name
146 public String getEcompName() {
151 * Sets the ECOMP Name field of the Policy Parameters.
153 * @param ecompName the <code>String</code> format of the ECOMP Name
155 public void setEcompName(String ecompName) {
156 this.ecompName = ecompName;
160 * Gets the Config Name value of the Policy Parameters.
162 * @return <code>String</code> format of the Config Name
164 public String getConfigName() {
169 * Sets the Config Name field of the Policy Parameters.
171 * @param configName the <code>String</code> format of the Config Name
173 public void setConfigName(String configName) {
174 this.configName = configName;
178 * Gets the Attributes of the policy Parameters.
180 * @return <code>List</code> the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
182 public Map<AttributeType, Map<String, String>> getAttributes() {
187 * Sets the Attributes of the Policy Parameters.
189 * @param attributes the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
191 public void setAttributes(Map<AttributeType, Map<String, String>> attributes) {
192 this.attributes = attributes;
196 * Gets the Policy Config Type value the Policy parameters.
198 * @return {@link org.openecomp.policy.api.PolicyConfigType} Enum of the Config Type
200 public PolicyConfigType getPolicyConfigType() {
201 return policyConfigType;
205 * Sets the Policy Config Type field of the policy Parameters.
207 * @param policyConfigType the {@link org.openecomp.policy.api.PolicyConfigType} Enum format of the Config Type
209 public void setPolicyConfigType(PolicyConfigType policyConfigType) {
210 if(policyConfigType!=null){
211 setPolicyClass(PolicyClass.Config);
213 this.policyConfigType = policyConfigType;
217 * Gets the configBody value of the Policy Parameters.
219 * @return the <code>String</code> format of the Policy Body
221 public String getConfigBody() {
226 * Sets the configBody field of the Policy Parameters.
228 * @param configBody the <code>String</code> format of the Policy Body
230 public void setConfigBody(String configBody) {
231 this.configBody = configBody;
235 * Gets the config Body Type value of the Policy Parameters.
237 * @return the <code>PolicyType</code> representation of the configBodyType
239 public PolicyType getConfigBodyType() {
240 return configBodyType;
244 * Sets the configBodyType field of the Policy Parameters.
246 * @param configBodyType the <code>PolicyType</code> representation of the config BodyType
248 public void setConfigBodyType(PolicyType configBodyType) {
249 this.configBodyType = configBodyType;
253 * Gets the requestID of the Policy Parameters.
255 * @return unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
257 public UUID getRequestID() {
262 * Sets the requestID of the Policy Parameters.
264 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
266 public void setRequestID(UUID requestID) {
267 this.requestID = requestID;
271 * Gets the Policy Class of the Policy Parameters.
273 * @return {@link org.openecomp.policy.api.PolicyClass} of the Policy Parameters.
275 public PolicyClass getPolicyClass() {
280 * Sets the Policy Class of the Policy Parameters.
282 * @param policyClass the Enum {@link org.openecomp.policy.api.PolicyClass} to set Policy Class Type of Policy parameters.
284 public void setPolicyClass(PolicyClass policyClass) {
285 this.policyClass = policyClass;
289 * Gets the Action Performer value of the Policy Parameters for Action Policies.
291 * @return the <code>String</code> value of the Action Performer for Action Policies
293 public String getActionPerformer() {
294 return actionPerformer;
298 * Sets the Action Performer value of the Policy Parameters for Action Policies.
300 * @param actionPerformer the <code>String</code> format of the Action Performer
302 public void setActionPerformer(String actionPerformer) {
303 this.actionPerformer = actionPerformer;
307 * Gets the Action Attribute value of the Policy Parameters for Action Policies.
309 * @return the <code>String</code> value of the Action Attribute for Action Policies
311 public String getActionAttribute() {
312 return actionAttribute;
316 * Sets the Action Attribute value of the Policy Parameters for Action Policies.
318 * @param actionAttribute the <code>String</code> format of the Action Attribute
320 public void setActionAttribute(String actionAttribute) {
321 this.actionAttribute = actionAttribute;
325 * Gets the Dynamic Rule Algorithm Label of the policy Parameters. Used in conjunction with the Label, Field1,
326 * Function, and Field2 to complete the complex and simple Rule Algorithms
328 * @return <code>List</code> the Dynamic Rule Algorithm Label that must contain the Labels in order
330 public List<String> getDynamicRuleAlgorithmLabels() {
331 return dynamicRuleAlgorithmLabels;
335 * Sets the Dynamic Rule Algorithm Labels used in conjunction with the Label, Field1,
336 * Function, and Field2 to complete the complex and simple Rule Algorithms
338 * @param dynamicRuleAlgorithmLabels the <code>List</code> dynamicRuleAlgoritmLabels in order
340 public void setDynamicRuleAlgorithmLabels(
341 List<String> dynamicRuleAlgorithmLabels) {
342 this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
346 * Gets the Dynamic Rule Algorithm Function of the policy Parameters. Used in conjunction with the Label, Field1,
347 * FunctionDef, and Field2 to complete the complex and simple Rule Algorithms
349 * @return <code>List</code> the Dynamic Rule Algorithm Functions that must contain the values in order
351 public List<String> getDynamicRuleAlgorithmFunctions() {
352 return dynamicRuleAlgorithmFunctions;
356 * Sets the Dynamic Rule Algorithm Functions used in conjunction with the Label, Field1,
357 * Function, and Field2 to complete the complex and simple Rule Algorithms
359 * @param dynamicRuleAlgorithmFunctions the <code>List</code> dynamicRuleAlgorithmFunctions in order
361 public void setDynamicRuleAlgorithmFunctions(List<String> dynamicRuleAlgorithmFunctions) {
362 this.dynamicRuleAlgorithmFunctions = dynamicRuleAlgorithmFunctions;
366 * Gets the Dynamic Rule Algorithm Field1 of the policy Parameters. Used in conjunction with the Label, Field1,
367 * Function, and Field2 to complete the complex and simple Rule Algorithms
369 * @return <code>List</code> the Dynamic Rule Algorithm Field1 that must contain the Field1 values in order
371 public List<String> getDynamicRuleAlgorithmField1() {
372 return dynamicRuleAlgorithmField1;
376 * Sets the Dynamic Rule Algorithm Field1 used in conjunction with the Label, Field1,
377 * Function, and Field2 to complete the complex and simple Rule Algorithms
379 * @param dynamicRuleAlgorithmField1 the <code>List</code> dynamicRuleAlgorithmField1 in order
381 public void setDynamicRuleAlgorithmField1(
382 List<String> dynamicRuleAlgorithmField1) {
383 this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
387 * Gets the Dynamic Rule Algorithm Field2 of the policy Parameters. Used in conjunction with the Label, Field1,
388 * Operator, and Field2 to complete the complex and simple Rule Algorithms
390 * @return <code>List</code> the Dynamic Rule Algorithm Field2 that must contain the Field2 values in order
392 public List<String> getDynamicRuleAlgorithmField2() {
393 return dynamicRuleAlgorithmField2;
397 * Sets the Dynamic Rule Algorithm Field2 used in conjunction with the Label, Field1,
398 * Function, and Field2 to complete the complex and simple Rule Algorithms
400 * @param dynamicRuleAlgorithmField2 the <code>List</code> dynamicRuleAlgorithmField2 in order
402 public void setDynamicRuleAlgorithmField2(
403 List<String> dynamicRuleAlgorithmField2) {
404 this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
408 * Gets the Priority of the Policy Parameters.
410 * @return priority the <code>String</code> format of the Micro Services priority
412 public String getPriority() {
417 * Sets the Priority of the Policy Parameters.
419 * @param priority the <code>String</code> format of the Micro Services priority
421 public void setPriority(String priority) {
422 this.priority = priority;
425 public RuleProvider getRuleProvider() {
429 public void setRuleProvider(RuleProvider ruleProvider) {
430 this.ruleProvider = ruleProvider;
433 * Sets the Guard field of the Policy Parameters.
435 * @param guard the <code>Boolean</code> format of the guard value
437 public void setGuard(boolean guard){
442 * Gets the guard value of the Policy Parameters for Action Policies.
444 * @return the <code>boolean</code> value of the Guard for Config Policies
446 public boolean getGuard(){
451 * Sets the riskType field of the Policy Parameters.
453 * @param riskType the <code>String</code> format of the riskType value
455 public void setRiskType(String riskType){
456 this.riskType = riskType;
460 * Gets the riskType value of the Policy Parameters for Config Policies.
462 * @return the <code>String</code> value of the riskType for Config Policies
464 public String getRiskType(){
469 * Sets the riskLevel field of the Policy Parameters.
471 * @param riskLevel the <code>String</code> format of the riskType value
473 public void setRiskLevel(String riskLevel){
474 this.riskLevel = riskLevel;
478 * Gets the riskLevel value of the Policy Parameters for Config Policies.
480 * @return the <code>String</code> value of the riskLevel for Config Policies
482 public String getRiskLevel(){
487 * Sets the TTLDate field of the Policy Parameters.
489 * @param TTLDate the <code>Date</code> format of the TTLDate value
491 public void setTtlDate(Date TTLDate){
492 this.TTLDate = TTLDate;
496 * Gets the TTLDate value of the Policy Parameters for Config Policies.
498 * @return the <code>Date</code> value of the TTLDate for Config Policies
500 public Date getTtlDate(){
505 * Gets the Controller Name for your policy.
507 * @return String format of the controller Name.
509 public String getControllerName() {
510 return controllerName;
514 * Sets Controller Name for your policy.
516 * @param controllerName to identify the controller information for your policy.
518 public void setControllerName(String controllerName) {
519 this.controllerName = controllerName;
523 * Gets Dependency Names for your policy.
525 * @return ArrayList of String(s) format of dependency names.
527 public ArrayList<String> getDependencyNames() {
528 return dependencyNames;
532 * Sets Dependency that your policy is dependent on.
534 * @param dependencyNames ArrayList of String(s).
536 public void setDependencyNames(ArrayList<String> dependencyNames) {
537 this.dependencyNames = dependencyNames;
540 public String getExtendedOption() {
541 return extendedOption;
544 public void setExtendedOption(String extendedOption) {
545 this.extendedOption = extendedOption;
548 public String toString() {
549 return "PolicyParameters [ policyName=" + policyName + ", policyDescription=" + policyDescription + ", ecompName="+ ecompName
550 + ", configName=" + configName + ", attributes=" + attributes + ", configBody=" + configBody
551 + ",dynamicRuleAlgorithmLabels=" + dynamicRuleAlgorithmLabels + ",dynamicRuleAlgorithmFunctions=" + dynamicRuleAlgorithmFunctions
552 + ",dynamicRuleAlgorithmField1=" + dynamicRuleAlgorithmField1 + ",dynamicRuleAlgorithmField2=" + dynamicRuleAlgorithmField2
553 + ", actionPerformer=" + actionPerformer + ", actionAttribute=" + actionAttribute + ", priority=" + priority
554 + ", ruleProvider= " + ruleProvider + ", riskLevel= " + riskLevel + ", riskType= " + riskType + ", extendedOption= " + extendedOption