diff options
author | Jim Hahn <jrh3@att.com> | 2020-03-06 18:22:28 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-03-06 19:04:13 -0500 |
commit | 2440b81428fa4bfa28a51f87c58e12c78ced744b (patch) | |
tree | 61ca5668446ed47301ee3b2cca520cc7a83d46aa /models-interactions/model-actors/actor.appc/src/main | |
parent | 3c1fb89886d7ebf2efe1183e92b4ed8191f506b4 (diff) |
Add subrequest ID to OperationOutcome
Rule notifications need the subrequest ID to be populated in the
OperationOutcome object, where possible.
Issue-ID: POLICY-2385
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: Ic44320f67ad8df7bcb3000cfa667f95427818e71
Diffstat (limited to 'models-interactions/model-actors/actor.appc/src/main')
2 files changed, 7 insertions, 4 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 43bb81de0..5e84871cc 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 @@ -25,6 +25,7 @@ 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; @@ -85,13 +86,14 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request, * @param targetVnf target VNF * @return a new request */ - protected Request makeRequest(int attempt, String targetVnf) { + protected Pair<String, 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"? - request.getCommonHeader().setSubRequestId(UUID.randomUUID().toString()); + final String subreq = UUID.randomUUID().toString(); + request.getCommonHeader().setSubRequestId(subreq); request.setAction(getName()); @@ -105,7 +107,7 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request, // add/replace specific values request.getPayload().put(VNF_ID_KEY, targetVnf); - return request; + return Pair.of(subreq, request); } /** 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 a318444aa..e4fd51c07 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,6 +21,7 @@ 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; @@ -60,7 +61,7 @@ public class ModifyConfigOperation extends AppcOperation { } @Override - protected Request makeRequest(int attempt) { + protected Pair<String, Request> makeRequest(int attempt) { AaiCqResponse cq = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY); GenericVnf genvnf = cq.getGenericVnfByModelInvariantId(params.getTarget().getResourceID()); |