X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fclamp%2Fclds%2Fclient%2FPolicyClient.java;h=7aa1330f2dd430fd77a23762055fdd513268ec4e;hb=9ff8c96c2704a00afa0e12fb9bd7e4245117c63c;hp=391e39556130c3e5f545413d2ae0907ec014a4c0;hpb=0bc898a0d69d3206b55ef71685fbef642436b661;p=clamp.git diff --git a/src/main/java/org/onap/clamp/clds/client/PolicyClient.java b/src/main/java/org/onap/clamp/clds/client/PolicyClient.java index 391e3955..7aa1330f 100644 --- a/src/main/java/org/onap/clamp/clds/client/PolicyClient.java +++ b/src/main/java/org/onap/clamp/clds/client/PolicyClient.java @@ -140,7 +140,7 @@ public class PolicyClient { // Set Policy Type policyParameters.setPolicyConfigType(PolicyConfigType.MicroService); - policyParameters.setEcompName(refProp.getStringValue("policy.ecomp.name")); + policyParameters.setEcompName(refProp.getStringValue("policy.onap.name")); policyParameters.setPolicyName(prop.getCurrentPolicyScopeAndPolicyName()); policyParameters.setConfigBody(policyJson); @@ -177,7 +177,7 @@ public class PolicyClient { // Set Policy Type policyParameters.setPolicyConfigType(PolicyConfigType.Base); - policyParameters.setEcompName(refProp.getStringValue("policy.ecomp.name")); + policyParameters.setEcompName(refProp.getStringValue("policy.onap.name")); policyParameters.setPolicyName(prop.getCurrentPolicyScopeAndPolicyName()); policyParameters.setConfigBody(configBody); @@ -196,6 +196,43 @@ public class PolicyClient { return rtnMsg; } + /** + * Perform send of Microservice policy in OTHER type. + * + * @param configBody + * The config policy string body + * @param prop + * The ModelProperties + * @param policyRequestUuid + * The policy request UUID + * @return The answer from policy call + */ + public String sendMicroServiceInOther(String configBody, ModelProperties prop, String policyRequestUuid) { + + PolicyParameters policyParameters = new PolicyParameters(); + + // Set Policy Type + policyParameters.setPolicyConfigType(PolicyConfigType.MicroService); + policyParameters.setEcompName(refProp.getStringValue("policy.onap.name")); + policyParameters.setPolicyName(prop.getCurrentPolicyScopeAndPolicyName()); + + policyParameters.setConfigBody(configBody); + policyParameters.setConfigBodyType(PolicyType.OTHER); + + policyParameters.setRequestID(UUID.fromString(policyRequestUuid)); + String policyNamePrefix = refProp.getStringValue("policy.ms.policyNamePrefix"); + + // Adding this line to clear the policy id from policy name while + // pushing to policy engine + prop.setPolicyUniqueId(""); + + String rtnMsg = send(policyParameters, prop, policyNamePrefix); + String policyType = refProp.getStringValue("policy.ms.type"); + push(policyType, prop); + + return rtnMsg; + } + /** * Perform send of policy. *