From deed677c3dc8751209d50e7d35132c929fe6800d Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 4 Aug 2020 16:27:18 -0400 Subject: Modify Actors to use properties when provided Modified the Actors to use properties when the application provides them instead of going to the event context for the data. This sometimes entailed moving code out of the Operation subclass constructor that used or validated the context data. Combined some property names and renamed others. Changed VF Count from AtomicInteger to Integer. Issue-ID: POLICY-2746 Change-Id: Ib8730538309bb77d2f4f6161e9a20a49362d8972 Signed-off-by: Jim Hahn --- .../controlloop/actor/appc/ModifyConfigOperation.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'models-interactions/model-actors/actor.appc/src/main') 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 680bd9cc7..13ddaf4a9 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 @@ -69,7 +69,19 @@ public class ModifyConfigOperation extends AppcOperation { @Override protected Request makeRequest(int attempt) { + return makeRequest(attempt, getVnfId()); + } + + protected String getVnfId() { + GenericVnf vnf = this.getProperty(OperationProperties.AAI_RESOURCE_VNF); + if (vnf != null) { + return vnf.getVnfId(); + } + AaiCqResponse cq = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY); + if (cq == null) { + throw new IllegalStateException("target vnf-id could not be determined"); + } GenericVnf genvnf = cq.getGenericVnfByModelInvariantId(params.getTarget().getResourceID()); if (genvnf == null) { @@ -77,6 +89,6 @@ public class ModifyConfigOperation extends AppcOperation { throw new IllegalArgumentException("target vnf-id could not be found"); } - return makeRequest(attempt, genvnf.getVnfId()); + return genvnf.getVnfId(); } } -- cgit