diff options
Diffstat (limited to 'models-interactions/model-actors/actor.cds/src/main')
-rw-r--r-- | models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProvider.java | 7 | ||||
-rw-r--r-- | models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/beans/CdsActionRequest.java (renamed from models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/beans/ConfigDeployRequest.java) | 25 |
2 files changed, 25 insertions, 7 deletions
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProvider.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProvider.java index aaf07ac21..1ad184e49 100644 --- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProvider.java +++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProvider.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.UUID; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; @@ -42,7 +43,7 @@ import org.onap.policy.cds.client.CdsProcessorGrpcClient; import org.onap.policy.cds.properties.CdsServerProperties; import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.VirtualControlLoopEvent; -import org.onap.policy.controlloop.actor.cds.beans.ConfigDeployRequest; +import org.onap.policy.controlloop.actor.cds.beans.CdsActionRequest; import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants; import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; import org.onap.policy.controlloop.policy.Policy; @@ -112,8 +113,10 @@ public class CdsActorServiceProvider implements Actor { String cbaActionName = policy.getRecipe(); // Embed payload from policy to ConfigDeployRequest object, serialize and inject into grpc request. - ConfigDeployRequest request = new ConfigDeployRequest(); + CdsActionRequest request = new CdsActionRequest(); request.setConfigDeployProperties(payload); + request.setActionName(cbaActionName); + request.setResolutionKey(UUID.randomUUID().toString()); // Inject AAI properties into payload map. Offer flexibility to the usecase // implementation to inject whatever AAI parameters are of interest to them. diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/beans/ConfigDeployRequest.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/beans/CdsActionRequest.java index f33f226f9..8aac67bb0 100644 --- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/beans/ConfigDeployRequest.java +++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/beans/CdsActionRequest.java @@ -18,26 +18,41 @@ package org.onap.policy.controlloop.actor.cds.beans; -import com.google.gson.Gson; import com.google.gson.annotations.SerializedName; import java.util.Map; import lombok.Getter; import lombok.Setter; +import org.onap.policy.common.utils.coder.Coder; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.common.utils.coder.StandardCoder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Getter @Setter -public class ConfigDeployRequest { +public class CdsActionRequest { - private static final Gson GSON = new Gson(); + private static final Logger LOGGER = LoggerFactory.getLogger(CdsActionRequest.class); + private static final Coder CODER = new StandardCoder(); - @SerializedName("config-deploy-properties") + @SerializedName("policy-payload") private Map<String, String> configDeployProperties; @SerializedName("aai-properties") private Map<String, String> aaiProperties; + @SerializedName("resolution-key") + private String resolutionKey; + + private transient String actionName; + @Override public String toString() { - return "{\"config-deploy-request\":" + GSON.toJson(this) + '}'; + try { + return "{" + "\"" + actionName + "-request\":" + CODER.encode(this) + '}'; + } catch (CoderException e) { + LOGGER.error("Failure serializing CdsActionRequest object: ", e); + return ""; + } } } |