aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST
diff options
context:
space:
mode:
authorMichael Mokry <mm117s@att.com>2017-09-26 08:49:34 -0500
committerMichael Mokry <mm117s@att.com>2017-09-26 09:40:47 -0500
commitd86da782fa13652ab4fa7227394d4a3d1fe55e18 (patch)
tree409466e9afd7685fcfa5e7b6810383c2fbb83b95 /ONAP-PDP-REST
parent04c6945fea6a17b89affe2e1a1304e03005136b7 (diff)
Policy API support for Rainy Day Decision Policy
Enhances the Rainy Day Decision Policy by providing API support to manage Rainy Day Decision policies and dictionaries Change-Id: Ia7c49199ac057fa8bcc9de74f5e0b8dba395d43a Issue-ID: POLICY-269 Signed-off-by: Michael Mokry <mm117s@att.com>
Diffstat (limited to 'ONAP-PDP-REST')
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java9
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java3
2 files changed, 9 insertions, 3 deletions
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java
index c283ff14c..915e3b30f 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java
@@ -80,6 +80,8 @@ public class DecisionPolicyService{
}
Map<String,String> matchingAttributes = null;
Map<String,String> settingsAttributes = null;
+
+ //Get the MATCHING and/or SETTINGS attributes
if (policyParameters.getAttributes()!=null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)) {
matchingAttributes = policyParameters.getAttributes().get(AttributeType.MATCHING);
settingsAttributes = policyParameters.getAttributes().get(AttributeType.SETTINGS);
@@ -88,9 +90,10 @@ public class DecisionPolicyService{
}else if(policyParameters.getAttributes()!=null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && !policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)){
matchingAttributes = policyParameters.getAttributes().get(AttributeType.MATCHING);
}
- // Create Policy.
- StdPAPPolicy newPAPPolicy = new StdPAPPolicy(policyName, policyParameters.getPolicyDescription(), onapName, ruleProvider.toString(), matchingAttributes, settingsAttributes, policyParameters.getDynamicRuleAlgorithmLabels(),
- policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmField2(), null, null, null, updateFlag, policyScope, 0);
+ // Create StdPAPPolicy object used to send policy data to PAP-REST.
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy(policyName, policyParameters.getPolicyDescription(), onapName, ruleProvider.toString(), matchingAttributes, settingsAttributes,
+ policyParameters.getTreatments(), policyParameters.getDynamicRuleAlgorithmLabels(), policyParameters.getDynamicRuleAlgorithmFunctions(),
+ policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmField2(), null, null, null, updateFlag, policyScope, 0);
// Send JSON to PAP.
response = (String) papServices.callPAP(newPAPPolicy, new String[] {"operation="+operation, "apiflag=api", "policyType=Decision"}, policyParameters.getRequestID(), "Decision");
LOGGER.info(message);
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java
index 8f88ef7c7..d3628f3c1 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java
@@ -171,6 +171,9 @@ public class GetDictionaryService {
case "Settings":
jsonString = jsonString.replace("settingsDictionaryDatas", "DictionaryDatas");
break;
+ case "RainyDayTreatments":
+ jsonString = jsonString.replace("rainyDayDictionaryDatas", "DictionaryDatas");
+ break;
case "DescriptiveScope":
jsonString = jsonString.replace("descriptiveScopeDictionaryDatas", "DictionaryDatas");
break;