diff options
author | ramverma <ram.krishna.verma@est.tech> | 2019-09-04 09:26:53 +0000 |
---|---|---|
committer | ramverma <ram.krishna.verma@est.tech> | 2019-09-04 09:26:53 +0000 |
commit | 53d14240b684df3d4f2fa8f02355effba722e514 (patch) | |
tree | 2e6a5cd13f27a1fca909ede4060a537c4dc8d362 /plugins/reception-plugins/src/main/java/org | |
parent | a790e5194cd246b286265589ed598270dd5c96fe (diff) |
Bring back the old HPA decoder & model
Bringing back the old HPA policy decoder and its related classes and
tests. The distribution framework will support both the new PAP/API and
the old policy engine in El Alto release.
Issue-ID: POLICY-1871
Change-Id: Iab911b793207a09b02e906ed6913c54bc252f64c
Signed-off-by: ramverma <ram.krishna.verma@est.tech>
Diffstat (limited to 'plugins/reception-plugins/src/main/java/org')
-rw-r--r-- | plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java index 8bbdaffe..842245c0 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java @@ -31,10 +31,10 @@ import java.util.List; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.distribution.model.Csar; +import org.onap.policy.distribution.model.OptimizationPolicy; import org.onap.policy.distribution.model.PolicyInput; import org.onap.policy.distribution.reception.decoding.PolicyDecoder; import org.onap.policy.distribution.reception.decoding.PolicyDecodingException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; import org.onap.sdc.toscaparser.api.NodeTemplate; @@ -44,15 +44,15 @@ import org.slf4j.LoggerFactory; /** * Decodes PDP-X policies from a CSAR file. */ -public class PolicyDecoderCsarPdpx implements PolicyDecoder<Csar, ToscaServiceTemplate> { +public class PolicyDecoderCsarPdpx implements PolicyDecoder<Csar, OptimizationPolicy> { private static final Logger LOGGER = LoggerFactory.getLogger(PolicyDecoderCsarPdpx.class); private final Gson gson = new GsonBuilder().serializeNulls().disableHtmlEscaping().create(); private PolicyDecoderCsarPdpxConfigurationParameterGroup decoderParameters; @Override - public Collection<ToscaServiceTemplate> decode(final Csar csar) throws PolicyDecodingException { - final List<ToscaServiceTemplate> policies = new ArrayList<>(); + public Collection<OptimizationPolicy> decode(final Csar csar) throws PolicyDecodingException { + final List<OptimizationPolicy> policies = new ArrayList<>(); final ISdcCsarHelper sdcCsarHelper = parseCsar(csar); final List<NodeTemplate> lnodeVf = sdcCsarHelper.getServiceVfList(); LOGGER.debug("the size of Vf = {}", lnodeVf.size()); @@ -63,9 +63,9 @@ public class PolicyDecoderCsarPdpx implements PolicyDecoder<Csar, ToscaServiceTe for (final NodeTemplate node : lnodeVf) { final Content content = extractFromNode.extractInfo(node); if (content != null) { - final ToscaServiceTemplate policy = new ToscaServiceTemplate(); + final OptimizationPolicy policy = new OptimizationPolicy(); final String policyName = decoderParameters.getPolicyNamePrefix() + "." + content.getIdentity(); - // policy.setOnapName(decoderParameters.getOnapName()); + policy.setOnapName(decoderParameters.getOnapName()); policy.setName(policyName); final ConfigBody configBody = new ConfigBody(); configBody.setService("hpaPolicy"); @@ -81,7 +81,7 @@ public class PolicyDecoderCsarPdpx implements PolicyDecoder<Csar, ToscaServiceTe content.getPolicyScope().add("HPA"); content.getPolicyScope().add(serviceName); configBody.setContent(content); - // policy.setConfigBody(gson.toJson(configBody)); + policy.setConfigBody(gson.toJson(configBody)); policies.add(policy); } } |