diff options
author | Jim Hahn <jrh3@att.com> | 2020-04-01 11:03:31 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-04-01 12:04:48 -0400 |
commit | 88fedd4d3edbb581eabe20074a65c32b635fc3b2 (patch) | |
tree | b932b653aa2d89557f08570d51fc5204459dae93 /models-interactions/model-actors/actor.appc/src/main | |
parent | 3a99e95994963c8fd04d7c038cf6b0263b2bbdeb (diff) |
Set sub request ID before start callback
Modified new actor code to generate the sub request ID
before invoking the start callback.
Issue-ID: POLICY-2461
Change-Id: I4adabd6efda2c30c0e2da31f95f01dd5fe546c0a
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.appc/src/main')
2 files changed, 5 insertions, 11 deletions
diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java index 3ed23957a..75a4c9f58 100644 --- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java +++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java @@ -23,9 +23,7 @@ package org.onap.policy.controlloop.actor.appc; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.UUID; import java.util.concurrent.CompletableFuture; -import org.apache.commons.lang3.tuple.Pair; import org.onap.policy.appc.CommonHeader; import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; @@ -86,14 +84,11 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request, * @param targetVnf target VNF * @return a new request */ - protected Pair<String, Request> makeRequest(int attempt, String targetVnf) { + protected Request makeRequest(int attempt, String targetVnf) { Request request = new Request(); request.setCommonHeader(new CommonHeader()); request.getCommonHeader().setRequestId(params.getRequestId()); - - // TODO ok to use UUID, or does it have to be the "attempt"? - final String subreq = UUID.randomUUID().toString(); - request.getCommonHeader().setSubRequestId(subreq); + request.getCommonHeader().setSubRequestId(getSubRequestId()); request.setAction(getName()); @@ -107,7 +102,7 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request, // add/replace specific values request.getPayload().put(VNF_ID_KEY, targetVnf); - return Pair.of(subreq, request); + return request; } /** @@ -139,7 +134,7 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request, */ @Override protected List<String> getExpectedKeyValues(int attempt, Request request) { - return List.of(request.getCommonHeader().getSubRequestId()); + return List.of(getSubRequestId()); } @Override diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperation.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperation.java index e4fd51c07..a318444aa 100644 --- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperation.java +++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperation.java @@ -21,7 +21,6 @@ package org.onap.policy.controlloop.actor.appc; import java.util.concurrent.CompletableFuture; -import org.apache.commons.lang3.tuple.Pair; import org.onap.aai.domain.yang.GenericVnf; import org.onap.policy.aai.AaiConstants; import org.onap.policy.aai.AaiCqResponse; @@ -61,7 +60,7 @@ public class ModifyConfigOperation extends AppcOperation { } @Override - protected Pair<String, Request> makeRequest(int attempt) { + protected Request makeRequest(int attempt) { AaiCqResponse cq = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY); GenericVnf genvnf = cq.getGenericVnfByModelInvariantId(params.getTarget().getResourceID()); |