diff options
author | Sébastien Determe <sd378r@intl.att.com> | 2017-09-28 14:38:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-28 14:38:49 +0000 |
commit | fedee6f12db71c31c01635ff02c1601b0fba514a (patch) | |
tree | c4bc531cfe4951e38681025feec24533ea7d53cd /src/main | |
parent | 38a4e2a804c7f758cad7060373a0c20aaaee21d3 (diff) | |
parent | 9ff8c96c2704a00afa0e12fb9bd7e4245117c63c (diff) |
Merge "new method for policy client"
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/client/PolicyClient.java | 41 |
1 files changed, 39 insertions, 2 deletions
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 391e39556..7aa1330f2 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); @@ -197,6 +197,43 @@ public class PolicyClient { } /** + * 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. * * @param policyParameters |