diff options
Diffstat (limited to 'runtime-controlloop')
15 files changed, 313 insertions, 304 deletions
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java index 5fbd36c06..a9b45c589 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java @@ -29,7 +29,8 @@ import org.springframework.scheduling.annotation.EnableScheduling; @EnableScheduling @SpringBootApplication @ComponentScan({"org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider", - "org.onap.policy.clamp.controlloop.runtime"}) + "org.onap.policy.clamp.controlloop.runtime", + "org.onap.policy.clamp.controlloop.common.rest"}) @ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.runtime.main.parameters") public class Application { diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/CoderHttpMesageConverter.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/CoderHttpMesageConverter.java deleted file mode 100644 index cdd6ea73b..000000000 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/CoderHttpMesageConverter.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.clamp.controlloop.runtime.config; - -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.nio.charset.StandardCharsets; -import javax.ws.rs.core.Response; -import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; -import org.onap.policy.common.utils.coder.Coder; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.common.utils.coder.StandardCoder; -import org.onap.policy.common.utils.coder.StandardYamlCoder; -import org.springframework.http.HttpInputMessage; -import org.springframework.http.HttpOutputMessage; -import org.springframework.http.MediaType; -import org.springframework.http.converter.AbstractHttpMessageConverter; -import org.springframework.http.converter.HttpMessageNotReadableException; -import org.springframework.http.converter.HttpMessageNotWritableException; - -public class CoderHttpMesageConverter<T> extends AbstractHttpMessageConverter<T> { - - private Coder coder; - - public CoderHttpMesageConverter(String type) { - super(new MediaType("application", type, StandardCharsets.UTF_8)); - this.coder = "json".equals(type) ? new StandardCoder() : new StandardYamlCoder(); - } - - @Override - protected boolean supports(Class<?> clazz) { - return true; - } - - @Override - protected T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage) - throws IOException, HttpMessageNotReadableException { - try (var is = new InputStreamReader(inputMessage.getBody(), StandardCharsets.UTF_8)) { - return coder.decode(is, clazz); - } catch (CoderException e) { - throw new ControlLoopRuntimeException(Response.Status.BAD_REQUEST, e.getMessage(), e); - } - } - - @Override - protected void writeInternal(T t, HttpOutputMessage outputMessage) - throws IOException, HttpMessageNotWritableException { - try (var writer = new OutputStreamWriter(outputMessage.getBody(), StandardCharsets.UTF_8)) { - coder.encode(writer, t); - } catch (CoderException e) { - throw new ControlLoopRuntimeException(Response.Status.BAD_REQUEST, e.getMessage(), e); - } - } - -} diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java index b14c675df..d67d2e75d 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java @@ -22,6 +22,7 @@ package org.onap.policy.clamp.controlloop.runtime.config; import java.util.Arrays; import java.util.List; +import org.onap.policy.clamp.controlloop.common.rest.CoderHttpMesageConverter; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/FilterConfig.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/FilterConfig.java index d58553ae4..57bfc2e7c 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/FilterConfig.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/FilterConfig.java @@ -20,7 +20,7 @@ package org.onap.policy.clamp.controlloop.runtime.config; -import org.onap.policy.clamp.controlloop.runtime.main.web.RequestResponseLoggingFilter; +import org.onap.policy.clamp.controlloop.common.rest.RequestResponseLoggingFilter; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RequestResponseLoggingFilter.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RequestResponseLoggingFilter.java deleted file mode 100644 index 0dd00e766..000000000 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RequestResponseLoggingFilter.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. - * ================================================================================ - * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.clamp.controlloop.runtime.main.web; - -import java.io.IOException; -import java.util.UUID; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -@Component -@Order(2) -public class RequestResponseLoggingFilter implements Filter { - - private static final String VERSION_MINOR_NAME = "X-MinorVersion"; - private static final String VERSION_PATCH_NAME = "X-PatchVersion"; - private static final String VERSION_LATEST_NAME = "X-LatestVersion"; - public static final String API_VERSION = "1.0.0"; - public static final String REQUEST_ID_NAME = "X-ONAP-RequestID"; - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException { - - - HttpServletResponse res = (HttpServletResponse) response; - HttpServletRequest req = (HttpServletRequest) request; - - /* - * Disabling sonar because of ONAP requires the request ID to be copied from the request - * to the response. - */ - String requestId = req.getHeader(REQUEST_ID_NAME); - res.addHeader(REQUEST_ID_NAME, requestId != null ? requestId : UUID.randomUUID().toString()); // NOSONAR - - res.addHeader(VERSION_MINOR_NAME, "0"); - res.addHeader(VERSION_PATCH_NAME, "0"); - res.addHeader(VERSION_LATEST_NAME, API_VERSION); - - chain.doFilter(request, response); - } - -} diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java index 960cb4304..2a1f9082f 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; import lombok.AllArgsConstructor; import org.apache.commons.collections4.CollectionUtils; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; @@ -36,6 +37,7 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils; import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider; import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck; @@ -51,7 +53,10 @@ import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantDer import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantRegisterAckPublisher; import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher; import org.onap.policy.models.base.PfModelException; +import org.onap.policy.models.base.PfModelRuntimeException; +import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -75,6 +80,7 @@ public class SupervisionHandler { private final ControlLoopProvider controlLoopProvider; private final ParticipantProvider participantProvider; private final MonitoringProvider monitoringProvider; + private final PolicyModelsProvider modelsProvider; // Publishers for participant communication private final ControlLoopUpdatePublisher controlLoopUpdatePublisher; @@ -350,7 +356,7 @@ public class SupervisionHandler { case UNINITIALISED2PASSIVE: case PASSIVE: controlLoop.setState(ControlLoopState.PASSIVE2UNINITIALISED); - controlLoopStateChangePublisher.send(controlLoop); + controlLoopStateChangePublisher.send(controlLoop, getFirstStartPhase(controlLoop)); break; case PASSIVE2UNINITIALISED: @@ -384,7 +390,7 @@ public class SupervisionHandler { case RUNNING: controlLoop.setState(ControlLoopState.RUNNING2PASSIVE); - controlLoopStateChangePublisher.send(controlLoop); + controlLoopStateChangePublisher.send(controlLoop, getFirstStartPhase(controlLoop)); break; default: @@ -408,7 +414,7 @@ public class SupervisionHandler { case PASSIVE: controlLoop.setState(ControlLoopState.PASSIVE2RUNNING); - controlLoopStateChangePublisher.send(controlLoop); + controlLoopStateChangePublisher.send(controlLoop, getFirstStartPhase(controlLoop)); break; default: @@ -418,6 +424,16 @@ public class SupervisionHandler { } } + private int getFirstStartPhase(ControlLoop controlLoop) { + ToscaServiceTemplate toscaServiceTemplate = null; + try { + toscaServiceTemplate = modelsProvider.getServiceTemplateList(null, null).get(0); + } catch (PfModelException e) { + throw new PfModelRuntimeException(Status.BAD_REQUEST, "Canont load ToscaServiceTemplate from DB", e); + } + return ParticipantUtils.getFirstStartPhase(controlLoop, toscaServiceTemplate); + } + private void checkParticipant(ParticipantMessage participantMessage, ParticipantState participantState, ParticipantHealthStatus healthStatus) throws ControlLoopException, PfModelException { if (participantMessage.getParticipantId() == null) { diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java index 5147aa241..48e06010d 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java @@ -220,13 +220,19 @@ public class SupervisionScanner { var completed = true; var minSpNotCompleted = 1000; // min startPhase not completed + var maxSpNotCompleted = 0; // max startPhase not completed + var defaultMin = 1000; // min startPhase + var defaultMax = 0; // max startPhase for (ControlLoopElement element : controlLoop.getElements().values()) { + ToscaNodeTemplate toscaNodeTemplate = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates() + .get(element.getDefinition().getName()); + int startPhase = ParticipantUtils.findStartPhase(toscaNodeTemplate.getProperties()); + defaultMin = Math.min(defaultMin, startPhase); + defaultMax = Math.max(defaultMax, startPhase); if (!element.getState().equals(element.getOrderedState().asState())) { completed = false; - ToscaNodeTemplate toscaNodeTemplate = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates() - .get(element.getDefinition().getName()); - int startPhase = ParticipantUtils.findStartPhase(toscaNodeTemplate.getProperties()); minSpNotCompleted = Math.min(minSpNotCompleted, startPhase); + maxSpNotCompleted = Math.max(maxSpNotCompleted, startPhase); } } @@ -243,12 +249,20 @@ public class SupervisionScanner { LOGGER.debug("control loop scan: transition from state {} to {} not completed", controlLoop.getState(), controlLoop.getOrderedState()); - if (minSpNotCompleted != phaseMap.getOrDefault(controlLoop.getKey().asIdentifier(), 0) - && ControlLoopState.UNINITIALISED2PASSIVE.equals(controlLoop.getState())) { - phaseMap.put(controlLoop.getKey().asIdentifier(), minSpNotCompleted); - sendControlLoopMsg(controlLoop, minSpNotCompleted); + var nextSpNotCompleted = ControlLoopState.UNINITIALISED2PASSIVE.equals(controlLoop.getState()) + || ControlLoopState.PASSIVE2RUNNING.equals(controlLoop.getState()) ? minSpNotCompleted + : maxSpNotCompleted; + + var firstStartPhase = ControlLoopState.UNINITIALISED2PASSIVE.equals(controlLoop.getState()) + || ControlLoopState.PASSIVE2RUNNING.equals(controlLoop.getState()) ? defaultMin + : defaultMax; + + if (nextSpNotCompleted != phaseMap.getOrDefault(controlLoop.getKey().asIdentifier(), firstStartPhase)) { + phaseMap.put(controlLoop.getKey().asIdentifier(), nextSpNotCompleted); + sendControlLoopMsg(controlLoop, nextSpNotCompleted); } else if (counterCheck) { - handleCounter(controlLoop, minSpNotCompleted); + phaseMap.put(controlLoop.getKey().asIdentifier(), nextSpNotCompleted); + handleCounter(controlLoop, nextSpNotCompleted); } } } @@ -282,7 +296,7 @@ public class SupervisionScanner { controlLoopUpdatePublisher.send(controlLoop, startPhase); } else { LOGGER.debug("retry message ControlLoopStateChange"); - controlLoopStateChangePublisher.send(controlLoop); + controlLoopStateChangePublisher.send(controlLoop, startPhase); } } } diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangePublisher.java index 79d113c14..69d7b73d0 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangePublisher.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangePublisher.java @@ -36,12 +36,14 @@ public class ControlLoopStateChangePublisher * Send ControlLoopStateChange to Participant. * * @param controlLoop the ControlLoop + * @param startPhase the startPhase */ - public void send(ControlLoop controlLoop) { + public void send(ControlLoop controlLoop, int startPhase) { var clsc = new ControlLoopStateChange(); clsc.setControlLoopId(controlLoop.getKey().asIdentifier()); clsc.setMessageId(UUID.randomUUID()); clsc.setOrderedState(controlLoop.getOrderedState()); + clsc.setStartPhase(startPhase); super.send(clsc); } diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java index 74d987240..06fbcd649 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java @@ -27,15 +27,14 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; import lombok.AllArgsConstructor; +import org.onap.policy.clamp.controlloop.common.utils.CommonUtils; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.provider.PolicyModelsProvider; -import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; -import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -48,8 +47,6 @@ import org.springframework.stereotype.Component; public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<ControlLoopUpdate> { private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopUpdatePublisher.class); - private static final String POLICY_TYPE_ID = "policy_type_id"; - private static final String POLICY_ID = "policy_id"; private final PolicyModelsProvider modelsProvider; /** @@ -83,59 +80,12 @@ public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<Con List<ParticipantUpdates> participantUpdates = new ArrayList<>(); for (ControlLoopElement element : controlLoop.getElements().values()) { - ToscaNodeTemplate toscaNodeTemplate = toscaServiceTemplate - .getToscaTopologyTemplate().getNodeTemplates().get(element.getDefinition().getName()); - // If the ControlLoopElement has policy_type_id or policy_id, identify it as a PolicyControlLoopElement - // and pass respective PolicyTypes or Policies as part of toscaServiceTemplateFragment - if ((toscaNodeTemplate.getProperties().get(POLICY_TYPE_ID) != null) - || (toscaNodeTemplate.getProperties().get(POLICY_ID) != null)) { - // ControlLoopElement for policy framework, send policies and policyTypes to participants - if ((toscaServiceTemplate.getPolicyTypes() != null) - || (toscaServiceTemplate.getToscaTopologyTemplate().getPolicies() != null)) { - ToscaServiceTemplate toscaServiceTemplateFragment = new ToscaServiceTemplate(); - toscaServiceTemplateFragment.setPolicyTypes(toscaServiceTemplate.getPolicyTypes()); - - ToscaTopologyTemplate toscaTopologyTemplate = new ToscaTopologyTemplate(); - toscaTopologyTemplate.setPolicies(toscaServiceTemplate.getToscaTopologyTemplate().getPolicies()); - toscaServiceTemplateFragment.setToscaTopologyTemplate(toscaTopologyTemplate); - - toscaServiceTemplateFragment.setDataTypes(toscaServiceTemplate.getDataTypes()); - - element.setToscaServiceTemplateFragment(toscaServiceTemplateFragment); - } - } - prepareParticipantUpdate(element, participantUpdates); + CommonUtils.setServiceTemplatePolicyInfo(element, toscaServiceTemplate); + CommonUtils.prepareParticipantUpdate(element, participantUpdates); } controlLoopUpdateMsg.setParticipantUpdatesList(participantUpdates); LOGGER.debug("ControlLoopUpdate message sent {}", controlLoopUpdateMsg); super.send(controlLoopUpdateMsg); } - - private void prepareParticipantUpdate(ControlLoopElement clElement, - List<ParticipantUpdates> participantUpdates) { - if (participantUpdates.isEmpty()) { - participantUpdates.add(getControlLoopElementList(clElement)); - } else { - var participantExists = false; - for (ParticipantUpdates participantUpdate : participantUpdates) { - if (participantUpdate.getParticipantId().equals(clElement.getParticipantId())) { - participantUpdate.getControlLoopElementList().add(clElement); - participantExists = true; - } - } - if (!participantExists) { - participantUpdates.add(getControlLoopElementList(clElement)); - } - } - } - - private ParticipantUpdates getControlLoopElementList(ControlLoopElement clElement) { - var participantUpdate = new ParticipantUpdates(); - List<ControlLoopElement> controlLoopElementList = new ArrayList<>(); - participantUpdate.setParticipantId(clElement.getParticipantId()); - controlLoopElementList.add(clElement); - participantUpdate.setControlLoopElementList(controlLoopElementList); - return participantUpdate; - } } diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java index 5d879dc56..c6788f12c 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java @@ -27,14 +27,13 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import lombok.AllArgsConstructor; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition; +import org.onap.policy.clamp.controlloop.common.utils.CommonUtils; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils; import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeType; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.slf4j.Logger; @@ -99,10 +98,10 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par for (var toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates().entrySet()) { if (ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(), toscaServiceTemplate)) { - var clParticipantType = - ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()); - prepareParticipantDefinitionUpdate(clParticipantType, toscaInputEntry.getKey(), - toscaInputEntry.getValue(), participantDefinitionUpdates, commonPropertiesMap); + CommonUtils.prepareParticipantDefinitionUpdate( + ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()), + toscaInputEntry.getKey(), toscaInputEntry.getValue(), + participantDefinitionUpdates, commonPropertiesMap); } } @@ -113,48 +112,6 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par return true; } - private void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantType, String entryKey, - ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates, - Map<String, ToscaNodeType> commonPropertiesMap) { - - var clDefinition = new ControlLoopElementDefinition(); - clDefinition.setClElementDefinitionId(new ToscaConceptIdentifier(entryKey, entryValue.getVersion())); - clDefinition.setControlLoopElementToscaNodeTemplate(entryValue); - ToscaNodeType nodeType = commonPropertiesMap.get(entryValue.getType()); - if (nodeType != null) { - clDefinition.setCommonPropertiesMap(nodeType.getProperties()); - } - - List<ControlLoopElementDefinition> controlLoopElementDefinitionList = new ArrayList<>(); - - if (participantDefinitionUpdates.isEmpty()) { - participantDefinitionUpdates - .add(getParticipantDefinition(clDefinition, clParticipantType, controlLoopElementDefinitionList)); - } else { - var participantExists = false; - for (ParticipantDefinition participantDefinitionUpdate : participantDefinitionUpdates) { - if (participantDefinitionUpdate.getParticipantType().equals(clParticipantType)) { - participantDefinitionUpdate.getControlLoopElementDefinitionList().add(clDefinition); - participantExists = true; - } - } - if (!participantExists) { - participantDefinitionUpdates.add( - getParticipantDefinition(clDefinition, clParticipantType, controlLoopElementDefinitionList)); - } - } - } - - private ParticipantDefinition getParticipantDefinition(ControlLoopElementDefinition clDefinition, - ToscaConceptIdentifier clParticipantType, - List<ControlLoopElementDefinition> controlLoopElementDefinitionList) { - var participantDefinition = new ParticipantDefinition(); - participantDefinition.setParticipantType(clParticipantType); - controlLoopElementDefinitionList.add(clDefinition); - participantDefinition.setControlLoopElementDefinitionList(controlLoopElementDefinitionList); - return participantDefinition; - } - /** * Send ParticipantUpdate to Participant after that commissioning has been removed. */ diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java index 82f7e66d5..d8892c8b9 100644 --- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java +++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java @@ -133,7 +133,9 @@ class ControlLoopInstantiationProviderTest { var participantRegisterAckPublisher = Mockito.mock(ParticipantRegisterAckPublisher.class); var participantDeregisterAckPublisher = Mockito.mock(ParticipantDeregisterAckPublisher.class); var participantUpdatePublisher = Mockito.mock(ParticipantUpdatePublisher.class); - supervisionHandler = new SupervisionHandler(clProvider, participantProvider, monitoringProvider, + var modelsProvider = Mockito.mock(PolicyModelsProvider.class); + + supervisionHandler = new SupervisionHandler(clProvider, participantProvider, monitoringProvider, modelsProvider, controlLoopUpdatePublisher, controlLoopStateChangePublisher, participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher); } diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java index 0ad8aad43..0fcf52ab9 100644 --- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java +++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; import org.junit.jupiter.api.Test; +import org.mockito.Mockito; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; @@ -56,9 +57,12 @@ import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantReg import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.models.base.PfModelException; +import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class SupervisionHandlerTest { + private static final String TOSCA_TEMPLATE_YAML = + "src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml"; private static final String CL_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/controlloops/ControlLoops.json"; private static final ToscaConceptIdentifier identifier = new ToscaConceptIdentifier("PMSHInstance0Crud", "1.0.1"); private static final ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("ParticipantId", "1.0.0"); @@ -262,7 +266,11 @@ class SupervisionHandlerTest { when(controlLoopProvider.getControlLoop(eq(identifier))).thenReturn(controlLoop); - return new SupervisionHandler(controlLoopProvider, participantProvider, monitoringProvider, + var modelsProvider = Mockito.mock(PolicyModelsProvider.class); + when(modelsProvider.getServiceTemplateList(any(), any())) + .thenReturn(List.of(InstantiationUtils.getToscaServiceTemplate(TOSCA_TEMPLATE_YAML))); + + return new SupervisionHandler(controlLoopProvider, participantProvider, monitoringProvider, modelsProvider, controlLoopUpdatePublisher, controlLoopStateChangePublisher, participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher); diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java index 47cc6f1dc..f884e0129 100644 --- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java +++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java @@ -29,11 +29,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.List; -import java.util.Map; -import java.util.UUID; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant; @@ -47,6 +45,7 @@ import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopUpd import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantStatusReqPublisher; import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher; import org.onap.policy.clamp.controlloop.runtime.util.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @@ -56,11 +55,19 @@ class SupervisionScannerTest { private static final String TOSCA_SERVICE_TEMPLATE_YAML = "src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml"; + private static final String CONTROLLOOP_JSON = "src/test/resources/rest/controlloops/ControlLoopsSmoke.json"; + + private static PolicyModelsProvider modelsProvider = mock(PolicyModelsProvider.class); + + @BeforeAll + public static void setUpBeforeAll() throws Exception { + ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML); + when(modelsProvider.getServiceTemplateList(null, null)).thenReturn(List.of(serviceTemplate)); + } @Test - void testScannerOrderedStateEqualsToState() throws PfModelException { + void testScannerOrderedStateEqualsToState() throws PfModelException, CoderException { var controlLoopProvider = mock(ControlLoopProvider.class); - var modelsProvider = mock(PolicyModelsProvider.class); var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class); var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class); var participantProvider = mock(ParticipantProvider.class); @@ -68,8 +75,9 @@ class SupervisionScannerTest { var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class); var clRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner"); - var controlLoop = new ControlLoop(); - when(controlLoopProvider.getControlLoops(null, null)).thenReturn(List.of(controlLoop)); + var controlLoops = + InstantiationUtils.getControlLoopsFromResource(CONTROLLOOP_JSON, "Crud").getControlLoopList(); + when(controlLoopProvider.getControlLoops(null, null)).thenReturn(controlLoops); var supervisionScanner = new SupervisionScanner(controlLoopProvider, modelsProvider, controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider, @@ -80,13 +88,13 @@ class SupervisionScannerTest { } @Test - void testScannerOrderedStateDifferentToState() throws PfModelException { - var controlLoop = new ControlLoop(); - controlLoop.setState(ControlLoopState.UNINITIALISED2PASSIVE); - controlLoop.setOrderedState(ControlLoopOrderedState.UNINITIALISED); - controlLoop.setElements(Map.of(UUID.randomUUID(), new ControlLoopElement())); + void testScannerOrderedStateDifferentToState() throws PfModelException, CoderException { + var controlLoops = + InstantiationUtils.getControlLoopsFromResource(CONTROLLOOP_JSON, "Crud").getControlLoopList(); + controlLoops.get(0).setState(ControlLoopState.UNINITIALISED2PASSIVE); + controlLoops.get(0).setOrderedState(ControlLoopOrderedState.UNINITIALISED); var controlLoopProvider = mock(ControlLoopProvider.class); - when(controlLoopProvider.getControlLoops(null, null)).thenReturn(List.of(controlLoop)); + when(controlLoopProvider.getControlLoops(null, null)).thenReturn(controlLoops); var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class); var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class); @@ -95,9 +103,6 @@ class SupervisionScannerTest { var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class); var clRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner"); - var modelsProvider = mock(PolicyModelsProvider.class); - when(modelsProvider.getServiceTemplateList(null, null)).thenReturn(List.of(new ToscaServiceTemplate())); - var supervisionScanner = new SupervisionScanner(controlLoopProvider, modelsProvider, controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider, participantStatusReqPublisher, participantUpdatePublisher, clRuntimeParameterGroup); @@ -118,7 +123,6 @@ class SupervisionScannerTest { participant.setVersion("1.0.0"); when(participantProvider.getParticipants(null, null)).thenReturn(List.of(participant)); - var modelsProvider = mock(PolicyModelsProvider.class); var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class); var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class); var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class); @@ -136,19 +140,24 @@ class SupervisionScannerTest { } @Test - void testSendControlLoopMsgUpdate() throws PfModelException { - var controlLoop = new ControlLoop(); - controlLoop.setState(ControlLoopState.UNINITIALISED2PASSIVE); - controlLoop.setOrderedState(ControlLoopOrderedState.PASSIVE); - controlLoop.setElements(Map.of(UUID.randomUUID(), - createHttpElement(ControlLoopState.UNINITIALISED, ControlLoopOrderedState.PASSIVE))); + void testSendControlLoopMsgUpdate() throws PfModelException, CoderException { + var controlLoops = + InstantiationUtils.getControlLoopsFromResource(CONTROLLOOP_JSON, "Crud").getControlLoopList(); + controlLoops.get(0).setState(ControlLoopState.UNINITIALISED2PASSIVE); + controlLoops.get(0).setOrderedState(ControlLoopOrderedState.PASSIVE); + for (var element : controlLoops.get(0).getElements().values()) { + if ("org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement" + .equals(element.getDefinition().getName())) { + element.setOrderedState(ControlLoopOrderedState.PASSIVE); + element.setState(ControlLoopState.UNINITIALISED); + } else { + element.setOrderedState(ControlLoopOrderedState.PASSIVE); + element.setState(ControlLoopState.PASSIVE); + } + } var controlLoopProvider = mock(ControlLoopProvider.class); - when(controlLoopProvider.getControlLoops(null, null)).thenReturn(List.of(controlLoop)); - - ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML); - var modelsProvider = mock(PolicyModelsProvider.class); - when(modelsProvider.getServiceTemplateList(null, null)).thenReturn(List.of(serviceTemplate)); + when(controlLoopProvider.getControlLoops(null, null)).thenReturn(controlLoops); var participantProvider = mock(ParticipantProvider.class); var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class); @@ -166,19 +175,6 @@ class SupervisionScannerTest { verify(controlLoopUpdatePublisher).send(any(ControlLoop.class), anyInt()); } - private ControlLoopElement createHttpElement(ControlLoopState state, ControlLoopOrderedState orderedState) { - var element = new ControlLoopElement(); - element.setDefinition(new ToscaConceptIdentifier( - "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement", "1.2.3")); - element.setState(state); - element.setOrderedState(orderedState); - element.setParticipantId(new ToscaConceptIdentifier("HttpParticipant0", "1.0.0")); - element.setParticipantType( - new ToscaConceptIdentifier("org.onap.k8s.controlloop.HttpControlLoopParticipant", "2.3.4")); - - return element; - } - @Test void testScanParticipant() throws PfModelException { var controlLoopProvider = mock(ControlLoopProvider.class); @@ -199,7 +195,6 @@ class SupervisionScannerTest { var participantProvider = new ParticipantProvider(clRuntimeParameterGroup.getDatabaseProviderParameters()); participantProvider.updateParticipants(List.of(participant)); - var modelsProvider = mock(PolicyModelsProvider.class); var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class); var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class); var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class); diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java index 70d115e47..4dfb8a9fd 100644 --- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java +++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java @@ -22,14 +22,21 @@ package org.onap.policy.clamp.controlloop.runtime.supervision.comm; import static org.assertj.core.api.Assertions.assertThatCode; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import java.time.Instant; import java.util.Collections; +import java.util.List; import java.util.UUID; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.mockito.Mockito; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ClElementStatisticsProvider; import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider; import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider; @@ -51,6 +58,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class SupervisionMessagesTest extends CommonRestController { + private static final String NOT_ACTIVE = "Not Active!"; private static final Object lockit = new Object(); private static final CommInfrastructure INFRA = CommInfrastructure.NOOP; private static final String TOPIC = "my-topic"; @@ -77,12 +85,13 @@ class SupervisionMessagesTest extends CommonRestController { var monitoringProvider = new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, clProvider); var participantProvider = new ParticipantProvider(controlLoopParameters.getDatabaseProviderParameters()); + var modelsProvider = Mockito.mock(PolicyModelsProvider.class); var controlLoopUpdatePublisher = Mockito.mock(ControlLoopUpdatePublisher.class); var controlLoopStateChangePublisher = Mockito.mock(ControlLoopStateChangePublisher.class); var participantRegisterAckPublisher = Mockito.mock(ParticipantRegisterAckPublisher.class); var participantDeregisterAckPublisher = Mockito.mock(ParticipantDeregisterAckPublisher.class); var participantUpdatePublisher = Mockito.mock(ParticipantUpdatePublisher.class); - supervisionHandler = new SupervisionHandler(clProvider, participantProvider, monitoringProvider, + supervisionHandler = new SupervisionHandler(clProvider, participantProvider, monitoringProvider, modelsProvider, controlLoopUpdatePublisher, controlLoopStateChangePublisher, participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher); } @@ -154,6 +163,29 @@ class SupervisionMessagesTest extends CommonRestController { } } + @Test + void testSendControlLoopStateChangePublisherNotActive() { + var publisher = new ControlLoopStateChangePublisher(); + assertThatThrownBy(() -> publisher.send(getControlLoop(), 0)).hasMessage(NOT_ACTIVE); + } + + @Test + void testSendControlLoopStateChangePublisher() { + var publisher = new ControlLoopStateChangePublisher(); + var topicSink = mock(TopicSink.class); + publisher.active(List.of(topicSink)); + publisher.send(getControlLoop(), 0); + verify(topicSink).send(anyString()); + } + + private ControlLoop getControlLoop() { + var controlLoop = new ControlLoop(); + controlLoop.setName("NAME"); + controlLoop.setVersion("0.0.1"); + controlLoop.setState(ControlLoopState.UNINITIALISED); + return controlLoop; + } + private ToscaConceptIdentifier getParticipantId() { return new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0"); } diff --git a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsSmoke.json b/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsSmoke.json new file mode 100644 index 000000000..47f379b84 --- /dev/null +++ b/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsSmoke.json @@ -0,0 +1,174 @@ +{ + "controlLoopList": [ + { + "name": "PMSHInstance0", + "version": "1.0.1", + "definition": { + "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition", + "version": "1.2.3" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "PMSH control loop instance 0", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", + "definition": { + "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "DCAE Control Loop Element for the PMSH instance 0 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c21": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c22": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c23": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", + "definition": { + "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" + }, + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "CDS Control Loop Element for the PMSH instance 0 control loop" + } + } + }, + { + "name": "PMSHInstance1", + "version": "1.0.1", + "definition": { + "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition", + "version": "1.2.3" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "PMSH control loop instance 1", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c24": { + "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "DCAE Control Loop Element for the PMSH instance 1 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c25": { + "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c26": { + "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c27": { + "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" + }, + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "CDS Control Loop Element for the PMSH instance 1 control loop" + } + } + } + ] +} |