diff options
Diffstat (limited to 'ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyService.java')
-rw-r--r-- | ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyService.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyService.java index 3f0416492..64178fc00 100644 --- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyService.java +++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyService.java @@ -3,6 +3,7 @@ * ONAP-PDP-REST * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +30,7 @@ import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.pdp.rest.api.utils.PolicyApiUtils; import org.onap.policy.xacml.api.XACMLErrorConstants; import org.onap.policy.xacml.std.pap.StdPAPPolicy; +import org.onap.policy.xacml.std.pap.StdPAPPolicyParams; /** * Closed Loop PM policy Implementation. @@ -116,10 +118,24 @@ public class ClosedLoopPMPolicyService { String jsonBody = configBody.toString(); String serviceType = configBody.get("serviceTypePolicyName").toString().replace("\"", ""); // Create Policy. - StdPAPPolicy newPAPPolicy = new StdPAPPolicy("ClosedLoop_PM", policyName, - policyParameters.getPolicyDescription(), onapName, - jsonBody, false, null, serviceType, updateFlag, policyScope, 0, policyParameters.getRiskLevel(), - policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date); + // Creating CloseLoop_Fault and Performance Metric Policies + StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder() + .configPolicyType("ClosedLoop_PM") + .policyName(policyName) + .description(policyParameters.getPolicyDescription()) + .onapName(onapName) + .jsonBody(jsonBody) + .draft(false) + .oldPolicyFileName(null) + .serviceType(serviceType) + .editPolicy(updateFlag) + .domain(policyScope) + .highestVersion(0) + .riskLevel(policyParameters.getRiskLevel()) + .riskType(policyParameters.getRiskType()) + .guard(String.valueOf(policyParameters.getGuard())) + .ttlDate(date) + .build()); //send JSON object to PAP response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=" + operation, "apiflag=api", "policyType=Config"}, policyParameters.getRequestID(), "ConfigClosedLoop"); |