diff options
author | Jim Hahn <jrh3@att.com> | 2020-08-21 13:43:08 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-10-27 14:55:15 -0400 |
commit | 19ef8b24a98c09a349e6ae7309f535a0135463f6 (patch) | |
tree | d988e5a58865ae6f3a38dcb31e4f195f18e59946 /models-interactions/model-actors/actor.sdnc/src/main | |
parent | 6b29d2c19e288148171db0c0e446e18dcd46effd (diff) |
Make Actors event-agnostic
Removed event and event-context code from the Actor code. Also removed
the preprocessing steps from the Actor code, giving the application
complete control over any preprocessing.
Also fixed a bug wherein the APPC actor was treating the
AAI_RESOURCE_VNF property as a String instead of as a GenericVnf.
Issue-ID: POLICY-2746-actor
Change-Id: Ibc05fe39ffedc0bc461abf10e6a960861ac70119
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.sdnc/src/main')
3 files changed, 6 insertions, 31 deletions
diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java index d2a153641..2946a2055 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java @@ -66,18 +66,18 @@ public class BandwidthOnDemandOperation extends SdncOperation { @Override protected SdncRequest makeRequest(int attempt) { - String serviceInstance = getOptProperty(OperationProperties.ENRICHMENT_SERVICE_ID, SERVICE_ID_KEY); + String serviceInstance = getProperty(OperationProperties.ENRICHMENT_SERVICE_ID); if (StringUtils.isBlank(serviceInstance)) { throw new IllegalArgumentException("missing enrichment data, " + SERVICE_ID_KEY); } SdncHealVfModuleParameter bandwidth = new SdncHealVfModuleParameter(); bandwidth.setName(BANDWIDTH); - bandwidth.setValue(getOptProperty(OperationProperties.ENRICHMENT_BANDWIDTH, BANDWIDTH)); + bandwidth.setValue(getProperty(OperationProperties.ENRICHMENT_BANDWIDTH)); SdncHealVfModuleParameter timeStamp = new SdncHealVfModuleParameter(); timeStamp.setName(BANDWIDTH_CHANGE_TIME); - timeStamp.setValue(getOptProperty(OperationProperties.ENRICHMENT_BANDWIDTH_CHANGE_TIME, BANDWIDTH_CHANGE_TIME)); + timeStamp.setValue(getProperty(OperationProperties.ENRICHMENT_BANDWIDTH_CHANGE_TIME)); SdncHealVfModuleParametersInfo vfParametersInfo = new SdncHealVfModuleParametersInfo(); vfParametersInfo.addParameters(bandwidth); @@ -102,7 +102,7 @@ public class BandwidthOnDemandOperation extends SdncOperation { request.setUrl("/" + getPath()); SdncHealVnfInfo vnfInfo = new SdncHealVnfInfo(); - vnfInfo.setVnfId(getOptProperty(OperationProperties.ENRICHMENT_VNF_ID, VNF_ID)); + vnfInfo.setVnfId(getProperty(OperationProperties.ENRICHMENT_VNF_ID)); SdncHealVfModuleInfo vfModuleInfo = new SdncHealVfModuleInfo(); vfModuleInfo.setVfModuleId(""); diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java index 105a27601..02209bbd2 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java @@ -57,14 +57,14 @@ public class RerouteOperation extends SdncOperation { @Override protected SdncRequest makeRequest(int attempt) { - String serviceInstance = getOptProperty(OperationProperties.ENRICHMENT_SERVICE_ID, SERVICE_ID_KEY); + String serviceInstance = getProperty(OperationProperties.ENRICHMENT_SERVICE_ID); if (StringUtils.isBlank(serviceInstance)) { throw new IllegalArgumentException("missing enrichment data, " + SERVICE_ID_KEY); } SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo(); serviceInfo.setServiceInstanceId(serviceInstance); - String networkId = getOptProperty(OperationProperties.ENRICHMENT_NETWORK_ID, NETWORK_ID_KEY); + String networkId = getProperty(OperationProperties.ENRICHMENT_NETWORK_ID); if (StringUtils.isBlank(networkId)) { throw new IllegalArgumentException("missing enrichment data, " + NETWORK_ID_KEY); } diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java index defbcfbc9..d235fb2c8 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java @@ -51,14 +51,6 @@ public abstract class SdncOperation extends HttpOperation<SdncResponse> { super(params, config, SdncResponse.class, propertyNames); } - /** - * Starts the GUARD. - */ - @Override - protected CompletableFuture<OperationOutcome> startPreprocessorAsync() { - return startGuardAsync(); - } - @Override protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) { @@ -96,21 +88,4 @@ public abstract class SdncOperation extends HttpOperation<SdncResponse> { protected boolean isSuccess(Response rawResponse, SdncResponse response) { return response.getResponseOutput() != null && "200".equals(response.getResponseOutput().getResponseCode()); } - - /** - * Gets an optional property, first checking the properties, then checking the - * enrichment data. - * - * @param propName property name - * @param enrichmentName property name within the enrichment data - * @return the property's value, or {@code null} if it is not found - */ - protected String getOptProperty(String propName, String enrichmentName) { - if (containsProperty(propName)) { - // return the value, even if it's null - return getProperty(propName); - } - - return params.getContext().getEnrichment().get(enrichmentName); - } } |