diff options
author | 2021-08-10 21:51:48 +0100 | |
---|---|---|
committer | 2021-08-18 14:58:42 +0100 | |
commit | d0a1bcee60c43a736a0526d49c07c564632c4f02 (patch) | |
tree | 32d46f33307a9bb65215a1f52eb626ae7db3d1ee /participant/participant-impl/participant-impl-kubernetes/src/main | |
parent | a37bd982693785af5fc791df0baaa49dda039846 (diff) |
Updated ControlLoop component messages
Updated controlloop messages (ParticipantUpdate, ControlLoopUpdate,
ParticipantStatus) according to the following Wiki and added
implementation for the corresponding updates in runtime-controlloop and
participant components
https://wiki.onap.org/display/DW/The+CLAMP+Control+Loop+Participant+Protocol
Issue-ID: POLICY-3417
Signed-off-by: Sirisha_Manchikanti <sirisha.manchikanti@est.tech>
Change-Id: I80d96a7553a89ca47de2aa35e09df5a5c792acfa
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes/src/main')
-rw-r--r-- | participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java index 20a23ca32..3f59c0822 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java @@ -44,7 +44,6 @@ import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; -import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -122,41 +121,31 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { * Callback method to handle an update on a control loop element. * * @param element the information on the control loop element - * @param controlLoopDefinition toscaServiceTemplate + * @param nodeTemplate toscaNodeTemplate * @throws PfModelException in case of an exception */ @Override public synchronized void controlLoopElementUpdate(ControlLoopElement element, - ToscaServiceTemplate controlLoopDefinition) - throws PfModelException { - - for (Map.Entry<String, ToscaNodeTemplate> nodeTemplate : controlLoopDefinition.getToscaTopologyTemplate() - .getNodeTemplates().entrySet()) { - - // Fetching the node template of corresponding CL element - if (element.getDefinition().getName().equals(nodeTemplate.getKey()) - && nodeTemplate.getValue().getProperties().containsKey("chart")) { - @SuppressWarnings("unchecked") - Map<String, Object> chartData = - (Map<String, Object>) nodeTemplate.getValue().getProperties().get("chart"); - - LOGGER.info("Installation request received for the Helm Chart {} ", chartData); - try { - var chartInfo = CODER.decode(String.valueOf(chartData), ChartInfo.class); - var repositoryValue = chartData.get("repository"); - if (repositoryValue != null) { - chartInfo.setRepository(repositoryValue.toString()); - } - chartService.installChart(chartInfo); - chartMap.put(element.getId(), chartInfo); + ToscaNodeTemplate nodeTemplate) throws PfModelException { + @SuppressWarnings("unchecked") + Map<String, Object> chartData = + (Map<String, Object>) nodeTemplate.getProperties().get("chart"); + + LOGGER.info("Installation request received for the Helm Chart {} ", chartData); + try { + var chartInfo = CODER.convert(chartData, ChartInfo.class); + var repositoryValue = chartData.get("repository"); + if (repositoryValue != null) { + chartInfo.setRepository(repositoryValue.toString()); + } + chartService.installChart(chartInfo); + chartMap.put(element.getId(), chartInfo); - var config = CODER.convert(nodeTemplate.getValue().getProperties(), ThreadConfig.class); - checkPodStatus(chartInfo, config.uninitializedToPassiveTimeout, config.podStatusCheckInterval); + var config = CODER.convert(nodeTemplate.getProperties(), ThreadConfig.class); + checkPodStatus(chartInfo, config.uninitializedToPassiveTimeout, config.podStatusCheckInterval); - } catch (ServiceException | CoderException | IOException e) { - LOGGER.warn("Installation of Helm chart failed", e); - } - } + } catch (ServiceException | CoderException | IOException e) { + LOGGER.warn("Installation of Helm chart failed", e); } } |