summaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-01-25 19:55:43 +0000
committerliamfallon <liam.fallon@est.tech>2022-02-18 15:54:40 +0000
commit43098043c4ef31d9d5dead66568d7d9482a6b165 (patch)
tree6f6ea4812ff93d65e7c64e12a3ec6ab4462a64e2 /participant/participant-intermediary
parentf401b5099bcb64f3e21de608d0207dd69d8043cd (diff)
Rename TOSCA Control Loop to ACM
This commit renames the TOSCA Control Loop functionality in CLAMP to Automation Composition Management. This review is a direct renaming review and, as everything is renamed together it is large. Issue-ID: POLICY-3939 Change-Id: I28f0a6dd889bf3570a4c1365ae9e71fc58db6d6c Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'participant/participant-intermediary')
-rw-r--r--participant/participant-intermediary/pom.xml4
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java65
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java130
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java140
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionStateChangeListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java)18
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java)19
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/MessageSender.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java)6
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantAckListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantAckListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantDeregisterAckListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantDeregisterAckListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantMessagePublisher.java)38
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantRegisterAckListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantStatusReqListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusReqListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantUpdateListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java476
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivator.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java)17
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Listener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Listener.java)2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java)177
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Publisher.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Publisher.java)2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java)6
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantParameters.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantParameters.java)2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java63
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java129
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java137
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java454
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java)65
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantCommTest.java)57
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java227
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/DummyParticipantParameters.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/DummyParticipantParameters.java)6
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java)10
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandlerTest.java)44
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/CommonTestData.java)139
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java)10
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java226
-rw-r--r--participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json (renamed from participant/participant-intermediary/src/test/resources/providers/TestControlLoops.json)54
35 files changed, 1400 insertions, 1371 deletions
diff --git a/participant/participant-intermediary/pom.xml b/participant/participant-intermediary/pom.xml
index c6078360e..936d26b76 100644
--- a/participant/participant-intermediary/pom.xml
+++ b/participant/participant-intermediary/pom.xml
@@ -30,7 +30,7 @@
<artifactId>policy-clamp-participant-intermediary</artifactId>
<name>${project.artifactId}</name>
- <description>Common intermediary library for managing DMaaP participant messaging and holding participant and control
- loop state</description>
+ <description>Common intermediary library for managing DMaaP participant messaging and holding participant and
+ Automation Composition state</description>
</project>
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java
new file mode 100644
index 000000000..9affd5751
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java
@@ -0,0 +1,65 @@
+/*-
+ * ============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.acm.participant.intermediary.api;
+
+import java.util.UUID;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+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;
+
+/**
+ * This interface is implemented by participant implementations to receive updates on automation composition elements.
+ */
+public interface AutomationCompositionElementListener {
+ /**
+ * Handle a automation composition element state change.
+ *
+ * @param automationCompositionElementId the ID of the automation composition element
+ * @param currentState the current state of the automation composition element
+ * @param newState the state to which the automation composition element is changing to
+ * @throws PfModelException in case of a model exception
+ */
+ public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ UUID automationCompositionElementId, AutomationCompositionState currentState,
+ AutomationCompositionOrderedState newState) throws PfModelException;
+
+ /**
+ * Handle an update on a automation composition element.
+ *
+ * @param element the information on the automation composition element
+ * @param automationCompositionElementDefinition toscaNodeTemplate
+ * @throws PfModelException from Policy framework
+ */
+ public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
+ AutomationCompositionElement element, ToscaNodeTemplate automationCompositionElementDefinition)
+ throws PfModelException;
+
+ /**
+ * Handle automationCompositionElement statistics.
+ *
+ * @param automationCompositionElementId automationCompositionElement id
+ * @throws PfModelException in case of a model exception
+ */
+ public void handleStatistics(UUID automationCompositionElementId) throws PfModelException;
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java
new file mode 100644
index 000000000..79f5259bf
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java
@@ -0,0 +1,130 @@
+/*-
+ * ============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.acm.participant.intermediary.api;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
+
+/**
+ * This interface is used by participant implementations to use the participant intermediary.
+ */
+public interface ParticipantIntermediaryApi {
+
+ /**
+ * Register a listener for automation composition elements that are mediated by the intermediary.
+ *
+ * @param automationCompositionElementListener The automation composition element listener to register
+ */
+ void registerAutomationCompositionElementListener(
+ AutomationCompositionElementListener automationCompositionElementListener);
+
+ /**
+ * Get participants loops from the intermediary API.
+ *
+ * @param name the participant name, null for all
+ * @param version the participant version, null for all
+ * @return the participants
+ */
+ List<Participant> getParticipants(String name, String version);
+
+ /**
+ * Get common properties of a automation composition element.
+ *
+ * @param acElementDef the automation composition element definition
+ * @return the common properties
+ */
+ Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef);
+
+ /**
+ * Update the state of a participant.
+ *
+ * @param definition the definition of the participant to update the state on
+ * @param state the state of the participant
+ * @return the participant
+ */
+ Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
+
+ /**
+ * Update the statistics of a participant.
+ *
+ * @param participantStatistics the statistics of the participant
+ */
+ void updateParticipantStatistics(ParticipantStatistics participantStatistics);
+
+ /**
+ * Get automation compositions from the intermediary API.
+ *
+ * @param name the automation composition element name, null for all
+ * @param version the automation composition element version, null for all
+ * @return the automation composition elements
+ */
+ AutomationCompositions getAutomationCompositions(String name, String version);
+
+ /**
+ * Get automation composition elements from the intermediary API.
+ *
+ * @param name the automation composition element name, null for all
+ * @param version the automation composition element version, null for all
+ * @return the automation composition elements
+ */
+ Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version);
+
+ /**
+ * Get automation composition element from the intermediary API.
+ *
+ * @param id automation composition element ID
+ * @return the automation composition element
+ */
+ AutomationCompositionElement getAutomationCompositionElement(UUID id);
+
+ /**
+ * Update the state of a automation composition element.
+ *
+ * @param id the ID of the automation composition element to update the state on
+ * @param currentState the state of the automation composition element
+ * @param newState the state of the automation composition element
+ * @return AutomationCompositionElement updated automation composition element
+ */
+ AutomationCompositionElement updateAutomationCompositionElementState(ToscaConceptIdentifier automationCompositionId,
+ UUID id, AutomationCompositionOrderedState currentState, AutomationCompositionState newState,
+ ParticipantMessageType messageType);
+
+ /**
+ * Update the automation composition element statistics.
+ *
+ * @param id the ID of the automation composition element to update the state on
+ * @param elementStatistics the updated statistics
+ */
+ void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics);
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
new file mode 100644
index 000000000..1a1f8500f
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
@@ -0,0 +1,140 @@
+/*-
+ * ============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.acm.participant.intermediary.api.impl;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.AutomationCompositionHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class is api implementation used by participant intermediary.
+ */
+@Component
+public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryApi {
+
+ // The handler for the participant intermediary
+ private final ParticipantHandler participantHandler;
+
+ // The handler for the automationComposition intermediary
+ private final AutomationCompositionHandler automationCompositionHandler;
+
+ /**
+ * Constructor.
+ *
+ * @param participantHandler ParticipantHandler
+ * @param automationCompositionHandler AutomationCompositionHandler
+ */
+ public ParticipantIntermediaryApiImpl(ParticipantHandler participantHandler,
+ AutomationCompositionHandler automationCompositionHandler) {
+ this.participantHandler = participantHandler;
+ this.automationCompositionHandler = automationCompositionHandler;
+ }
+
+ @Override
+ public void registerAutomationCompositionElementListener(
+ AutomationCompositionElementListener automationCompositionElementListener) {
+ automationCompositionHandler.registerAutomationCompositionElementListener(automationCompositionElementListener);
+ }
+
+ @Override
+ public List<Participant> getParticipants(String name, String version) {
+ return List.of(participantHandler.getParticipant(name, version));
+ }
+
+ @Override
+ public Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef) {
+ return participantHandler.getAcElementDefinitionCommonProperties(acElementDef);
+ }
+
+ @Override
+ public Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state) {
+ return participantHandler.updateParticipantState(definition, state);
+ }
+
+ @Override
+ public void updateParticipantStatistics(ParticipantStatistics participantStatistics) {
+ participantHandler.updateParticipantStatistics(participantStatistics);
+ }
+
+ @Override
+ public AutomationCompositions getAutomationCompositions(String name, String version) {
+ return automationCompositionHandler.getAutomationCompositions();
+ }
+
+ @Override
+ public Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version) {
+ List<AutomationComposition> automationCompositions =
+ automationCompositionHandler.getAutomationCompositions().getAutomationCompositionList();
+
+ for (AutomationComposition automationComposition : automationCompositions) {
+ if (name.equals(automationComposition.getDefinition().getName())) {
+ return automationComposition.getElements();
+ }
+ }
+ return new LinkedHashMap<>();
+ }
+
+ @Override
+ public AutomationCompositionElement getAutomationCompositionElement(UUID id) {
+ List<AutomationComposition> automationCompositions =
+ automationCompositionHandler.getAutomationCompositions().getAutomationCompositionList();
+
+ for (AutomationComposition automationComposition : automationCompositions) {
+ AutomationCompositionElement acElement = automationComposition.getElements().get(id);
+ if (acElement != null) {
+ return acElement;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public AutomationCompositionElement updateAutomationCompositionElementState(
+ ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState currentState,
+ AutomationCompositionState newState, ParticipantMessageType messageType) {
+ return automationCompositionHandler.updateAutomationCompositionElementState(automationCompositionId, id,
+ currentState, newState);
+ }
+
+ @Override
+ public void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics) {
+ automationCompositionHandler.updateAutomationCompositionElementStatistics(id, elementStatistics);
+ }
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionStateChangeListener.java
index d24f32f2f..b9ec6a6a0 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionStateChangeListener.java
@@ -18,31 +18,31 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.springframework.stereotype.Component;
/**
* Listener for Participant State Change messages sent by CLAMP.
*/
@Component
-public class ControlLoopStateChangeListener extends ParticipantListener<ControlLoopStateChange> {
+public class AutomationCompositionStateChangeListener extends ParticipantListener<AutomationCompositionStateChange> {
/**
* Constructs the object.
*
* @param participantHandler the handler for managing the state of the participant
*/
- public ControlLoopStateChangeListener(final ParticipantHandler participantHandler) {
- super(ControlLoopStateChange.class, participantHandler,
- participantHandler::handleControlLoopStateChange);
+ public AutomationCompositionStateChangeListener(final ParticipantHandler participantHandler) {
+ super(AutomationCompositionStateChange.class, participantHandler,
+ participantHandler::handleAutomationCompositionStateChange);
}
@Override
public String getType() {
- return ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE.name();
+ return ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE.name();
}
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java
index f9dec1863..6c5dc127d 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java
@@ -18,30 +18,31 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.springframework.stereotype.Component;
/**
- * Listener for Control Loop Update messages sent by CLAMP.
+ * Listener for Automation Composition Update messages sent by ACM.
*/
@Component
-public class ControlLoopUpdateListener extends ParticipantListener<ControlLoopUpdate> {
+public class AutomationCompositionUpdateListener extends ParticipantListener<AutomationCompositionUpdate> {
/**
* Constructs the object.
*
* @param participantHandler the handler for managing the state of the participant
*/
- public ControlLoopUpdateListener(final ParticipantHandler participantHandler) {
- super(ControlLoopUpdate.class, participantHandler, participantHandler::handleControlLoopUpdate);
+ public AutomationCompositionUpdateListener(final ParticipantHandler participantHandler) {
+ super(AutomationCompositionUpdate.class, participantHandler,
+ participantHandler::handleAutomationCompositionUpdate);
}
@Override
public String getType() {
- return ParticipantMessageType.CONTROL_LOOP_UPDATE.name();
+ return ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE.name();
}
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/MessageSender.java
index e11c883b4..0810a8a8a 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/MessageSender.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
import java.io.Closeable;
import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantAckListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantAckListener.java
index 95bbb2940..c5427db6b 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantAckListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantAckListener.java
@@ -21,12 +21,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
import java.util.function.Consumer;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantAckMessage;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.Listener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.Listener;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantDeregisterAckListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantDeregisterAckListener.java
index 5440e005b..51a2d2f9d 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantDeregisterAckListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantDeregisterAckListener.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.springframework.stereotype.Component;
/**
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantListener.java
index 5326ccddc..0eaf25cca 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantListener.java
@@ -19,12 +19,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
import java.util.function.Consumer;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.Listener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.Listener;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantMessagePublisher.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
index 79d62623c..67814a4e6 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantMessagePublisher.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
@@ -19,17 +19,17 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
import java.util.List;
import javax.ws.rs.core.Response.Status;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.Publisher;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.Publisher;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
import org.slf4j.Logger;
@@ -69,7 +69,7 @@ public class ParticipantMessagePublisher implements Publisher {
*/
public void sendParticipantStatus(final ParticipantStatus participantStatus) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
topicSinkClient.send(participantStatus);
LOGGER.debug("Sent Participant Status message to CLAMP - {}", participantStatus);
@@ -82,7 +82,7 @@ public class ParticipantMessagePublisher implements Publisher {
*/
public void sendParticipantRegister(final ParticipantRegister participantRegister) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
topicSinkClient.send(participantRegister);
LOGGER.debug("Sent Participant Register message to CLAMP - {}", participantRegister);
@@ -95,7 +95,7 @@ public class ParticipantMessagePublisher implements Publisher {
*/
public void sendParticipantDeregister(final ParticipantDeregister participantDeregister) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
topicSinkClient.send(participantDeregister);
LOGGER.debug("Sent Participant Deregister message to CLAMP - {}", participantDeregister);
@@ -108,23 +108,23 @@ public class ParticipantMessagePublisher implements Publisher {
*/
public void sendParticipantUpdateAck(final ParticipantUpdateAck participantUpdateAck) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
topicSinkClient.send(participantUpdateAck);
LOGGER.debug("Sent Participant Update Ack message to CLAMP - {}", participantUpdateAck);
}
/**
- * Method to send ControlLoop Update/StateChange Ack message to runtime.
+ * Method to send AutomationComposition Update/StateChange Ack message to runtime.
*
- * @param controlLoopAck ControlLoop Update/StateChange Ack
+ * @param automationCompositionAck AutomationComposition Update/StateChange Ack
*/
- public void sendControlLoopAck(final ControlLoopAck controlLoopAck) {
+ public void sendAutomationCompositionAck(final AutomationCompositionAck automationCompositionAck) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
- topicSinkClient.send(controlLoopAck);
- LOGGER.debug("Sent ControlLoop Update/StateChange Ack to runtime - {}", controlLoopAck);
+ topicSinkClient.send(automationCompositionAck);
+ LOGGER.debug("Sent AutomationComposition Update/StateChange Ack to runtime - {}", automationCompositionAck);
}
/**
@@ -134,7 +134,7 @@ public class ParticipantMessagePublisher implements Publisher {
*/
public void sendHeartbeat(final ParticipantStatus participantStatus) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
topicSinkClient.send(participantStatus);
LOGGER.debug("Sent Participant heartbeat to CLAMP - {}", participantStatus);
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantRegisterAckListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java
index 7be460815..e29fa6f96 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantRegisterAckListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
import org.springframework.stereotype.Component;
/**
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusReqListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantStatusReqListener.java
index 9e978fe75..7af3678d7 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusReqListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantStatusReqListener.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatusReq;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
import org.springframework.stereotype.Component;
/**
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantUpdateListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java
index da45501e7..19eb5fb30 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantUpdateListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
import org.springframework.stereotype.Component;
/**
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
new file mode 100644
index 000000000..7e1fb5443
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
@@ -0,0 +1,476 @@
+/*-
+ * ============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.acm.participant.intermediary.handler;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import lombok.Getter;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+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.ToscaProperty;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+/*
+ * This class is responsible for managing the state of all automation compositions in the participant.
+ */
+@Component
+public class AutomationCompositionHandler {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionHandler.class);
+
+ private final ToscaConceptIdentifier participantType;
+ private final ToscaConceptIdentifier participantId;
+ private final ParticipantMessagePublisher publisher;
+
+ @Getter
+ private final Map<ToscaConceptIdentifier, AutomationComposition> automationCompositionMap = new LinkedHashMap<>();
+
+ @Getter
+ private final Map<UUID, AutomationCompositionElement> elementsOnThisParticipant = new LinkedHashMap<>();
+
+ @Getter
+ private List<AutomationCompositionElementListener> listeners = new ArrayList<>();
+
+ /**
+ * Constructor, set the participant ID and messageSender.
+ *
+ * @param parameters the parameters of the participant
+ * @param publisher the ParticipantMessage Publisher
+ */
+ public AutomationCompositionHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher) {
+ this.participantType = parameters.getIntermediaryParameters().getParticipantType();
+ this.participantId = parameters.getIntermediaryParameters().getParticipantId();
+ this.publisher = publisher;
+ }
+
+ public void registerAutomationCompositionElementListener(AutomationCompositionElementListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * Handle a automation composition element state change message.
+ *
+ * @param automationCompositionId the automationComposition Id
+ * @param id the automationComposition UUID
+ * @param orderedState the current state
+ * @param newState the ordered state
+ * @return automationCompositionElement the updated automation composition element
+ */
+ public AutomationCompositionElement updateAutomationCompositionElementState(
+ ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState orderedState,
+ AutomationCompositionState newState) {
+
+ if (id == null) {
+ LOGGER.warn("Cannot update Automation composition element state, id is null");
+ return null;
+ }
+
+ // Update states of AutomationCompositionElement in automationCompositionMap
+ for (var automationComposition : automationCompositionMap.values()) {
+ var element = automationComposition.getElements().get(id);
+ if (element != null) {
+ element.setOrderedState(orderedState);
+ element.setState(newState);
+ }
+ var checkOpt = automationComposition.getElements().values().stream()
+ .filter(acElement -> !newState.equals(acElement.getState())).findAny();
+ if (checkOpt.isEmpty()) {
+ automationComposition.setState(newState);
+ automationComposition.setOrderedState(orderedState);
+ }
+ }
+
+ // Update states of AutomationCompositionElement in elementsOnThisParticipant
+ var acElement = elementsOnThisParticipant.get(id);
+ if (acElement != null) {
+ var automationCompositionStateChangeAck =
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ automationCompositionStateChangeAck.setParticipantId(participantId);
+ automationCompositionStateChangeAck.setParticipantType(participantType);
+ automationCompositionStateChangeAck.setAutomationCompositionId(automationCompositionId);
+ acElement.setOrderedState(orderedState);
+ acElement.setState(newState);
+ automationCompositionStateChangeAck.getAutomationCompositionResultMap().put(acElement.getId(),
+ new AutomationCompositionElementAck(newState, true,
+ "Automation composition element {} state changed to {}\", id, newState)"));
+ LOGGER.debug("Automation composition element {} state changed to {}", id, newState);
+ automationCompositionStateChangeAck
+ .setMessage("AutomationCompositionElement state changed to {} " + newState);
+ automationCompositionStateChangeAck.setResult(true);
+ publisher.sendAutomationCompositionAck(automationCompositionStateChangeAck);
+ return acElement;
+ }
+ return null;
+ }
+
+ /**
+ * Handle a automation composition element statistics.
+ *
+ * @param id automation composition element id
+ * @param elementStatistics automation composition element Statistics
+ */
+ public void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics) {
+ var acElement = elementsOnThisParticipant.get(id);
+ if (acElement != null) {
+ elementStatistics.setParticipantId(participantId);
+ elementStatistics.setId(id);
+ acElement.setAcElementStatistics(elementStatistics);
+ }
+ }
+
+ /**
+ * Handle a automation composition state change message.
+ *
+ * @param stateChangeMsg the state change message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ public void handleAutomationCompositionStateChange(AutomationCompositionStateChange stateChangeMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ if (stateChangeMsg.getAutomationCompositionId() == null) {
+ return;
+ }
+
+ var automationComposition = automationCompositionMap.get(stateChangeMsg.getAutomationCompositionId());
+
+ if (automationComposition == null) {
+ var automationCompositionAck =
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ automationCompositionAck.setParticipantId(participantId);
+ automationCompositionAck.setParticipantType(participantType);
+ automationCompositionAck.setMessage("Automation composition " + stateChangeMsg.getAutomationCompositionId()
+ + " does not use this participant " + participantId);
+ automationCompositionAck.setResult(false);
+ automationCompositionAck.setResponseTo(stateChangeMsg.getMessageId());
+ automationCompositionAck.setAutomationCompositionId(stateChangeMsg.getAutomationCompositionId());
+ publisher.sendAutomationCompositionAck(automationCompositionAck);
+ LOGGER.debug("Automation composition {} does not use this participant",
+ stateChangeMsg.getAutomationCompositionId());
+ return;
+ }
+
+ handleState(automationComposition, stateChangeMsg.getOrderedState(), stateChangeMsg.getStartPhase(),
+ acElementDefinitions);
+ }
+
+ /**
+ * Method to handle state changes.
+ *
+ * @param automationComposition participant response
+ * @param orderedState automation composition ordered state
+ * @param startPhaseMsg startPhase from message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ private void handleState(final AutomationComposition automationComposition,
+ AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ switch (orderedState) {
+ case UNINITIALISED:
+ handleUninitialisedState(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ break;
+ case PASSIVE:
+ handlePassiveState(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ break;
+ case RUNNING:
+ handleRunningState(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ break;
+ default:
+ LOGGER.debug("StateChange message has no state, state is null {}",
+ automationComposition.getDefinition());
+ break;
+ }
+ }
+
+ /**
+ * Handle a automation composition update message.
+ *
+ * @param updateMsg the update message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+
+ if (!updateMsg.appliesTo(participantType, participantId)) {
+ return;
+ }
+
+ if (0 == updateMsg.getStartPhase()) {
+ handleAcUpdatePhase0(updateMsg, acElementDefinitions);
+ } else {
+ handleAcUpdatePhaseN(updateMsg, acElementDefinitions);
+ }
+ }
+
+ private void handleAcUpdatePhase0(AutomationCompositionUpdate updateMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ var automationComposition = automationCompositionMap.get(updateMsg.getAutomationCompositionId());
+
+ // TODO: Updates to existing AutomationCompositions are not supported yet (Addition/Removal of
+ // AutomationComposition
+ // elements to existing AutomationComposition has to be supported).
+ if (automationComposition != null) {
+ var automationCompositionUpdateAck =
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK);
+ automationCompositionUpdateAck.setParticipantId(participantId);
+ automationCompositionUpdateAck.setParticipantType(participantType);
+
+ automationCompositionUpdateAck.setMessage("Automation composition " + updateMsg.getAutomationCompositionId()
+ + " already defined on participant " + participantId);
+ automationCompositionUpdateAck.setResult(false);
+ automationCompositionUpdateAck.setResponseTo(updateMsg.getMessageId());
+ automationCompositionUpdateAck.setAutomationCompositionId(updateMsg.getAutomationCompositionId());
+ publisher.sendAutomationCompositionAck(automationCompositionUpdateAck);
+ return;
+ }
+
+ if (updateMsg.getParticipantUpdatesList().isEmpty()) {
+ LOGGER.warn("No AutomationCompositionElement updates in message {}",
+ updateMsg.getAutomationCompositionId());
+ return;
+ }
+
+ var acElements = storeElementsOnThisParticipant(updateMsg.getParticipantUpdatesList());
+
+ var acElementMap = prepareAcElementMap(acElements);
+ automationComposition = new AutomationComposition();
+ automationComposition.setDefinition(updateMsg.getAutomationCompositionId());
+ automationComposition.setElements(acElementMap);
+ automationCompositionMap.put(updateMsg.getAutomationCompositionId(), automationComposition);
+
+ handleAutomationCompositionElementUpdate(acElements, acElementDefinitions, updateMsg.getStartPhase(),
+ updateMsg.getAutomationCompositionId());
+ }
+
+ private void handleAcUpdatePhaseN(AutomationCompositionUpdate updateMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+
+ var acElementList = updateMsg.getParticipantUpdatesList().stream()
+ .flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
+ .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
+
+ handleAutomationCompositionElementUpdate(acElementList, acElementDefinitions, updateMsg.getStartPhase(),
+ updateMsg.getAutomationCompositionId());
+ }
+
+ private void handleAutomationCompositionElementUpdate(List<AutomationCompositionElement> acElements,
+ List<AutomationCompositionElementDefinition> acElementDefinitions, Integer startPhaseMsg,
+ ToscaConceptIdentifier automationCompositionId) {
+ try {
+ for (var element : acElements) {
+ var acElementNodeTemplate = getAcElementNodeTemplate(acElementDefinitions, element.getDefinition());
+ if (acElementNodeTemplate != null) {
+ int startPhase = ParticipantUtils.findStartPhase(acElementNodeTemplate.getProperties());
+ if (startPhaseMsg.equals(startPhase)) {
+ for (var acElementListener : listeners) {
+ acElementListener.automationCompositionElementUpdate(automationCompositionId, element,
+ acElementNodeTemplate);
+ }
+ }
+ }
+ }
+ } catch (PfModelException e) {
+ LOGGER.debug("Automation composition element update failed {}", automationCompositionId);
+ }
+
+ }
+
+ private ToscaNodeTemplate getAcElementNodeTemplate(
+ List<AutomationCompositionElementDefinition> acElementDefinitions, ToscaConceptIdentifier acElementDefId) {
+
+ for (var acElementDefinition : acElementDefinitions) {
+ if (acElementDefId.getName().contains(acElementDefinition.getAcElementDefinitionId().getName())) {
+ return acElementDefinition.getAutomationCompositionElementToscaNodeTemplate();
+ }
+ }
+ return null;
+ }
+
+ private List<AutomationCompositionElement> storeElementsOnThisParticipant(
+ List<ParticipantUpdates> participantUpdates) {
+ var acElementList = participantUpdates.stream()
+ .flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
+ .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
+
+ for (var element : acElementList) {
+ elementsOnThisParticipant.put(element.getId(), element);
+ }
+ return acElementList;
+ }
+
+ private Map<UUID, AutomationCompositionElement> prepareAcElementMap(List<AutomationCompositionElement> acElements) {
+ Map<UUID, AutomationCompositionElement> acElementMap = new LinkedHashMap<>();
+ for (var element : acElements) {
+ acElementMap.put(element.getId(), element);
+ }
+ return acElementMap;
+ }
+
+ /**
+ * Method to handle when the new state from participant is UNINITIALISED state.
+ *
+ * @param automationComposition participant response
+ * @param orderedState orderedState
+ * @param startPhaseMsg startPhase from message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ private void handleUninitialisedState(final AutomationComposition automationComposition,
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ handleStateChange(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ boolean isAllUninitialised = automationComposition.getElements().values().stream()
+ .filter(element -> !AutomationCompositionState.UNINITIALISED.equals(element.getState())).findAny()
+ .isEmpty();
+ if (isAllUninitialised) {
+ automationCompositionMap.remove(automationComposition.getDefinition());
+ automationComposition.getElements().values()
+ .forEach(element -> elementsOnThisParticipant.remove(element.getId()));
+ }
+ }
+
+ /**
+ * Method to handle when the new state from participant is PASSIVE state.
+ *
+ * @param automationComposition participant response
+ * @param orderedState orderedState
+ * @param startPhaseMsg startPhase from message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ private void handlePassiveState(final AutomationComposition automationComposition,
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ handleStateChange(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ }
+
+ /**
+ * Method to handle when the new state from participant is RUNNING state.
+ *
+ * @param automationComposition participant response
+ * @param orderedState orderedState
+ * @param startPhaseMsg startPhase from message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ private void handleRunningState(final AutomationComposition automationComposition,
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ handleStateChange(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ }
+
+ /**
+ * Method to update the state of automation composition elements.
+ *
+ * @param automationComposition participant status in memory
+ * @param orderedState orderedState the new ordered state the participant should have
+ * @param startPhaseMsg startPhase from message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ private void handleStateChange(AutomationComposition automationComposition,
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+
+ if (orderedState.equals(automationComposition.getOrderedState())) {
+ var automationCompositionAck =
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ automationCompositionAck.setParticipantId(participantId);
+ automationCompositionAck.setParticipantType(participantType);
+ automationCompositionAck.setMessage("Automation composition is already in state " + orderedState);
+ automationCompositionAck.setResult(false);
+ automationCompositionAck.setAutomationCompositionId(automationComposition.getDefinition());
+ publisher.sendAutomationCompositionAck(automationCompositionAck);
+ return;
+ }
+
+ automationComposition.getElements().values().stream()
+ .forEach(acElement -> automationCompositionElementStateChange(automationComposition, orderedState,
+ acElement, startPhaseMsg, acElementDefinitions));
+ }
+
+ private void automationCompositionElementStateChange(AutomationComposition automationComposition,
+ AutomationCompositionOrderedState orderedState, AutomationCompositionElement acElement, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ var acElementNodeTemplate = getAcElementNodeTemplate(acElementDefinitions, acElement.getDefinition());
+ if (acElementNodeTemplate != null) {
+ int startPhase = ParticipantUtils.findStartPhase(acElementNodeTemplate.getProperties());
+ if (startPhaseMsg.equals(startPhase)) {
+ for (var acElementListener : listeners) {
+ try {
+ acElementListener.automationCompositionElementStateChange(automationComposition.getDefinition(),
+ acElement.getId(), acElement.getState(), orderedState);
+ } catch (PfModelException e) {
+ LOGGER.debug("Automation composition element update failed {}",
+ automationComposition.getDefinition());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Get automation compositions as a {@link ConrolLoops} class.
+ *
+ * @return the automation compositions
+ */
+ public AutomationCompositions getAutomationCompositions() {
+ var automationCompositions = new AutomationCompositions();
+ automationCompositions.setAutomationCompositionList(new ArrayList<>(automationCompositionMap.values()));
+ return automationCompositions;
+ }
+
+ /**
+ * Get properties of a automation composition element.
+ *
+ * @param id the automation composition element id
+ * @return the instance properties
+ */
+ public Map<String, ToscaProperty> getAcElementInstanceProperties(UUID id) {
+ Map<String, ToscaProperty> propertiesMap = new HashMap<>();
+ for (var automationComposition : automationCompositionMap.values()) {
+ var element = automationComposition.getElements().get(id);
+ if (element != null) {
+ propertiesMap.putAll(element.getPropertiesMap());
+ }
+ }
+ return propertiesMap;
+ }
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivator.java
index e42fac46e..0144f669c 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivator.java
@@ -19,13 +19,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import lombok.Getter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
@@ -61,16 +61,15 @@ public class IntermediaryActivator extends ServiceManagerContainer implements Cl
* @param publishers list of Publishers
* @param listeners list of Listeners
*/
- public <T> IntermediaryActivator(final ParticipantParameters parameters,
- ParticipantHandler participantHandler, List<Publisher> publishers,
- List<Listener<T>> listeners) {
+ public <T> IntermediaryActivator(final ParticipantParameters parameters, ParticipantHandler participantHandler,
+ List<Publisher> publishers, List<Listener<T>> listeners) {
this.participantHandler = participantHandler;
- topicSinks = TopicEndpointManager.getManager()
- .addTopicSinks(parameters.getIntermediaryParameters().getClampControlLoopTopics().getTopicSinks());
+ topicSinks = TopicEndpointManager.getManager().addTopicSinks(
+ parameters.getIntermediaryParameters().getClampAutomationCompositionTopics().getTopicSinks());
- topicSources = TopicEndpointManager.getManager()
- .addTopicSources(parameters.getIntermediaryParameters().getClampControlLoopTopics().getTopicSources());
+ topicSources = TopicEndpointManager.getManager().addTopicSources(
+ parameters.getIntermediaryParameters().getClampAutomationCompositionTopics().getTopicSources());
msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES);
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Listener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Listener.java
index 19bad9a67..56ed55441 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Listener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Listener.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import org.onap.policy.common.endpoints.listeners.ScoListener;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
index 89a13a84b..fa02f3dcf 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import java.time.Instant;
import java.util.ArrayList;
@@ -32,33 +32,33 @@ import java.util.UUID;
import java.util.stream.Collectors;
import lombok.Getter;
import lombok.Setter;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
-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.ControlLoopElementDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-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.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantAckMessage;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatusReq;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
@@ -79,7 +79,7 @@ public class ParticipantHandler {
@Getter
private final ToscaConceptIdentifier participantId;
- private final ControlLoopHandler controlLoopHandler;
+ private final AutomationCompositionHandler automationCompositionHandler;
private final ParticipantStatistics participantStatistics;
private final ParticipantMessagePublisher publisher;
@@ -89,7 +89,7 @@ public class ParticipantHandler {
@Setter
private ParticipantHealthStatus healthStatus = ParticipantHealthStatus.UNKNOWN;
- private final List<ControlLoopElementDefinition> clElementDefsOnThisParticipant = new ArrayList<>();
+ private final List<AutomationCompositionElementDefinition> acElementDefsOnThisParticipant = new ArrayList<>();
/**
* Constructor, set the participant ID and sender.
@@ -98,11 +98,11 @@ public class ParticipantHandler {
* @param publisher the publisher for sending responses to messages
*/
public ParticipantHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher,
- ControlLoopHandler controlLoopHandler) {
+ AutomationCompositionHandler automationCompositionHandler) {
this.participantType = parameters.getIntermediaryParameters().getParticipantType();
this.participantId = parameters.getIntermediaryParameters().getParticipantId();
this.publisher = publisher;
- this.controlLoopHandler = controlLoopHandler;
+ this.automationCompositionHandler = automationCompositionHandler;
this.participantStatistics = new ParticipantStatistics();
this.participantStatistics.setParticipantId(participantId);
this.participantStatistics.setState(state);
@@ -121,42 +121,45 @@ public class ParticipantHandler {
}
/**
- * Update ControlLoopElement statistics. The control loop elements listening will be
- * notified to retrieve statistics from respective controlloop elements, and controlloopelements
+ * Update AutomationCompositionElement statistics. The automation composition elements listening will be
+ * notified to retrieve statistics from respective automation composition elements, and automation
+ * compositionelements
* data on the handler will be updated.
*
- * @param controlLoops the control loops
- * @param clElementListener control loop element listener
+ * @param automationCompositions the automation compositions
+ * @param acElementListener automation composition element listener
*/
- private void updateClElementStatistics(ControlLoops controlLoops, ControlLoopElementListener clElementListener) {
- for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
- for (ControlLoopElement element : controlLoop.getElements().values()) {
+ private void updateAcElementStatistics(AutomationCompositions automationCompositions,
+ AutomationCompositionElementListener acElementListener) {
+ for (AutomationComposition automationComposition : automationCompositions.getAutomationCompositionList()) {
+ for (AutomationCompositionElement element : automationComposition.getElements().values()) {
try {
- clElementListener.handleStatistics(element.getId());
+ acElementListener.handleStatistics(element.getId());
} catch (PfModelException e) {
- LOGGER.debug("Getting statistics for Control loop element failed for element ID {}",
- element.getId(), e);
+ LOGGER.debug("Getting statistics for automation composition element failed for element ID {}",
+ element.getId(), e);
}
}
}
}
/**
- * Handle a control loop update message.
+ * Handle a automation composition update message.
*
* @param updateMsg the update message
*/
- public void handleControlLoopUpdate(ControlLoopUpdate updateMsg) {
- controlLoopHandler.handleControlLoopUpdate(updateMsg, clElementDefsOnThisParticipant);
+ public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg) {
+ automationCompositionHandler.handleAutomationCompositionUpdate(updateMsg, acElementDefsOnThisParticipant);
}
/**
- * Handle a control loop state change message.
+ * Handle a automation composition state change message.
*
* @param stateChangeMsg the state change message
*/
- public void handleControlLoopStateChange(ControlLoopStateChange stateChangeMsg) {
- controlLoopHandler.handleControlLoopStateChange(stateChangeMsg, clElementDefsOnThisParticipant);
+ public void handleAutomationCompositionStateChange(AutomationCompositionStateChange stateChangeMsg) {
+ automationCompositionHandler.handleAutomationCompositionStateChange(stateChangeMsg,
+ acElementDefsOnThisParticipant);
}
private void handleStateChange(ParticipantState newParticipantState, ParticipantUpdateAck response) {
@@ -221,15 +224,15 @@ public class ParticipantHandler {
}
/**
- * Get common properties of a controlloopelement.
+ * Get common properties of a automation composition element.
*
- * @param clElementDef the control loop element definition
+ * @param acElementDef the automation composition element definition
* @return the common properties
*/
- public Map<String, ToscaProperty> getClElementDefinitionCommonProperties(ToscaConceptIdentifier clElementDef) {
+ public Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef) {
Map<String, ToscaProperty> commonPropertiesMap = new HashMap<>();
- clElementDefsOnThisParticipant.stream().forEach(definition -> {
- if (definition.getClElementDefinitionId().equals(clElementDef)) {
+ acElementDefsOnThisParticipant.stream().forEach(definition -> {
+ if (definition.getAcElementDefinitionId().equals(acElementDef)) {
commonPropertiesMap.putAll(definition.getCommonPropertiesMap());
}
});
@@ -257,7 +260,7 @@ public class ParticipantHandler {
}
/**
- * Method to send ParticipantRegister message to controlloop runtime.
+ * Method to send ParticipantRegister message to automation composition runtime.
*/
public void sendParticipantRegister() {
var participantRegister = new ParticipantRegister();
@@ -274,7 +277,7 @@ public class ParticipantHandler {
*/
public void handleParticipantRegisterAck(ParticipantRegisterAck participantRegisterAckMsg) {
LOGGER.debug("ParticipantRegisterAck message received as responseTo {}",
- participantRegisterAckMsg.getResponseTo());
+ participantRegisterAckMsg.getResponseTo());
statusToPassive();
publisher.sendParticipantStatus(makeHeartbeat(false));
}
@@ -291,7 +294,7 @@ public class ParticipantHandler {
}
/**
- * Method to send ParticipantDeregister message to controlloop runtime.
+ * Method to send ParticipantDeregister message to automation composition runtime.
*/
public void sendParticipantDeregister() {
var participantDeregister = new ParticipantDeregister();
@@ -308,7 +311,7 @@ public class ParticipantHandler {
*/
public void handleParticipantDeregisterAck(ParticipantDeregisterAck participantDeregisterAckMsg) {
LOGGER.debug("ParticipantDeregisterAck message received as responseTo {}",
- participantDeregisterAckMsg.getResponseTo());
+ participantDeregisterAckMsg.getResponseTo());
}
/**
@@ -318,27 +321,28 @@ public class ParticipantHandler {
*/
public void handleParticipantUpdate(ParticipantUpdate participantUpdateMsg) {
LOGGER.debug("ParticipantUpdate message received for participantId {}",
- participantUpdateMsg.getParticipantId());
+ participantUpdateMsg.getParticipantId());
if (!participantUpdateMsg.getParticipantDefinitionUpdates().isEmpty()) {
statusToPassive();
- // This message is to commission the controlloop
+ // This message is to commission the automation composition
for (ParticipantDefinition participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) {
if (participantDefinition.getParticipantType().equals(participantType)) {
- clElementDefsOnThisParticipant.addAll(participantDefinition.getControlLoopElementDefinitionList());
+ acElementDefsOnThisParticipant
+ .addAll(participantDefinition.getAutomationCompositionElementDefinitionList());
break;
}
}
} else {
- // This message is to decommission the controlloop
- clElementDefsOnThisParticipant.clear();
+ // This message is to decommission the automation composition
+ acElementDefsOnThisParticipant.clear();
this.state = ParticipantState.TERMINATED;
}
sendParticipantUpdateAck(participantUpdateMsg.getMessageId());
}
/**
- * Method to send ParticipantUpdateAck message to controlloop runtime.
+ * Method to send ParticipantUpdateAck message to automation composition runtime.
*/
public void sendParticipantUpdateAck(UUID messageId) {
var participantUpdateAck = new ParticipantUpdateAck();
@@ -359,13 +363,13 @@ public class ParticipantHandler {
}
/**
- * Method to send heartbeat to controlloop runtime.
+ * Method to send heartbeat to automation composition runtime.
*/
public ParticipantStatus makeHeartbeat(boolean responseToParticipantStatusReq) {
if (!responseToParticipantStatusReq) {
- var controlLoops = controlLoopHandler.getControlLoops();
- for (var clElementListener : controlLoopHandler.getListeners()) {
- updateClElementStatistics(controlLoops, clElementListener);
+ var automationCompositions = automationCompositionHandler.getAutomationCompositions();
+ for (var acElementListener : automationCompositionHandler.getListeners()) {
+ updateAcElementStatistics(automationCompositions, acElementListener);
}
}
this.participantStatistics.setState(state);
@@ -378,38 +382,35 @@ public class ParticipantHandler {
heartbeat.setParticipantType(participantType);
heartbeat.setHealthStatus(healthStatus);
heartbeat.setState(state);
- heartbeat.setControlLoopInfoList(getControlLoopInfoList());
+ heartbeat.setAutomationCompositionInfoList(getAutomationCompositionInfoList());
if (responseToParticipantStatusReq) {
ParticipantDefinition participantDefinition = new ParticipantDefinition();
participantDefinition.setParticipantId(participantId);
participantDefinition.setParticipantType(participantType);
- participantDefinition.setControlLoopElementDefinitionList(clElementDefsOnThisParticipant);
+ participantDefinition.setAutomationCompositionElementDefinitionList(acElementDefsOnThisParticipant);
heartbeat.setParticipantDefinitionUpdates(List.of(participantDefinition));
}
return heartbeat;
}
- private List<ControlLoopInfo> getControlLoopInfoList() {
- List<ControlLoopInfo> controlLoopInfoList = new ArrayList<>();
- for (var entry : controlLoopHandler.getControlLoopMap().entrySet()) {
- var clInfo = new ControlLoopInfo();
- clInfo.setControlLoopId(entry.getKey());
- var clStatitistics = new ControlLoopStatistics();
- clStatitistics.setControlLoopId(entry.getKey());
- var clElementStatisticsList = new ClElementStatisticsList();
- clElementStatisticsList
- .setClElementStatistics(entry.getValue().getElements().values()
- .stream()
- .map(ControlLoopElement::getClElementStatistics)
- .filter(Objects::nonNull)
- .collect(Collectors.toList()));
- clStatitistics.setClElementStatisticsList(clElementStatisticsList);
- clInfo.setControlLoopStatistics(clStatitistics);
- clInfo.setState(entry.getValue().getState());
- controlLoopInfoList.add(clInfo);
+ private List<AutomationCompositionInfo> getAutomationCompositionInfoList() {
+ List<AutomationCompositionInfo> automationCompositionInfoList = new ArrayList<>();
+ for (var entry : automationCompositionHandler.getAutomationCompositionMap().entrySet()) {
+ var acInfo = new AutomationCompositionInfo();
+ acInfo.setAutomationCompositionId(entry.getKey());
+ var acStatitistics = new AutomationCompositionStatistics();
+ acStatitistics.setAutomationCompositionId(entry.getKey());
+ var acElementStatisticsList = new AcElementStatisticsList();
+ acElementStatisticsList.setAcElementStatistics(entry.getValue().getElements().values().stream()
+ .map(AutomationCompositionElement::getAcElementStatistics).filter(Objects::nonNull)
+ .collect(Collectors.toList()));
+ acStatitistics.setAcElementStatisticsList(acElementStatisticsList);
+ acInfo.setAutomationCompositionStatistics(acStatitistics);
+ acInfo.setState(entry.getValue().getState());
+ automationCompositionInfoList.add(acInfo);
}
- return controlLoopInfoList;
+ return automationCompositionInfoList;
}
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Publisher.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Publisher.java
index 287d7c055..72aa645fd 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Publisher.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Publisher.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import java.util.List;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
index fdc451e6b..dcbfd1b2e 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.parameters;
+package org.onap.policy.clamp.acm.participant.intermediary.parameters;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
@@ -50,12 +50,12 @@ public class ParticipantIntermediaryParameters {
@Valid
private ToscaConceptIdentifier participantType;
- // The time interval for periodic reporting of status to the CLAMP control loop server
+ // The time interval for periodic reporting of status to the CLAMP ACM server
@Valid
@Positive
private long reportingTimeIntervalMs;
@NotNull
@ParameterGroupConstraint
- private TopicParameterGroup clampControlLoopTopics;
+ private TopicParameterGroup clampAutomationCompositionTopics;
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantParameters.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantParameters.java
index c350b1b95..ca9c56607 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantParameters.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantParameters.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.parameters;
+package org.onap.policy.clamp.acm.participant.intermediary.parameters;
public interface ParticipantParameters {
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java
deleted file mode 100644
index 58378fa41..000000000
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java
+++ /dev/null
@@ -1,63 +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.participant.intermediary.api;
-
-import java.util.UUID;
-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.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-
-/**
- * This interface is implemented by participant implementations to receive updates on control loop elements.
- */
-public interface ControlLoopElementListener {
- /**
- * Handle a control loop element state change.
- *
- * @param controlLoopElementId the ID of the control loop element
- * @param currentState the current state of the control loop element
- * @param newState the state to which the control loop element is changing to
- * @throws PfModelException in case of a model exception
- */
- public void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId, UUID controlLoopElementId,
- ControlLoopState currentState, ControlLoopOrderedState newState) throws PfModelException;
-
- /**
- * Handle an update on a control loop element.
- *
- * @param element the information on the control loop element
- * @param controlLoopElementDefinition toscaNodeTemplate
- * @throws PfModelException from Policy framework
- */
- public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId, ControlLoopElement element,
- ToscaNodeTemplate controlLoopElementDefinition) throws PfModelException;
-
- /**
- * Handle controlLoopElement statistics.
- *
- * @param controlLoopElementId controlLoopElement id
- * @throws PfModelException in case of a model exception
- */
- public void handleStatistics(UUID controlLoopElementId) throws PfModelException;
-}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java
deleted file mode 100644
index 0cb4963ec..000000000
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java
+++ /dev/null
@@ -1,129 +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.participant.intermediary.api;
-
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-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.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
-
-/**
- * This interface is used by participant implementations to use the participant intermediary.
- */
-public interface ParticipantIntermediaryApi {
-
- /**
- * Register a listener for control loop elements that are mediated by the intermediary.
- *
- * @param controlLoopElementListener The control loop element listener to register
- */
- void registerControlLoopElementListener(ControlLoopElementListener controlLoopElementListener);
-
- /**
- * Get participants loops from the intermediary API.
- *
- * @param name the participant name, null for all
- * @param version the participant version, null for all
- * @return the participants
- */
- List<Participant> getParticipants(String name, String version);
-
- /**
- * Get common properties of a controlloopelement.
- *
- * @param clElementDef the control loop element definition
- * @return the common properties
- */
- Map<String, ToscaProperty> getClElementDefinitionCommonProperties(ToscaConceptIdentifier clElementDef);
-
- /**
- * Update the state of a participant.
- *
- * @param definition the definition of the participant to update the state on
- * @param state the state of the participant
- * @return the participant
- */
- Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
-
- /**
- * Update the statistics of a participant.
- *
- * @param participantStatistics the statistics of the participant
- */
- void updateParticipantStatistics(ParticipantStatistics participantStatistics);
-
- /**
- * Get control loops from the intermediary API.
- *
- * @param name the control loop element name, null for all
- * @param version the control loop element version, null for all
- * @return the control loop elements
- */
- ControlLoops getControlLoops(String name, String version);
-
- /**
- * Get control loop elements from the intermediary API.
- *
- * @param name the control loop element name, null for all
- * @param version the control loop element version, null for all
- * @return the control loop elements
- */
- Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version);
-
- /**
- * Get control loop element from the intermediary API.
- *
- * @param id control loop element ID
- * @return the control loop element
- */
- ControlLoopElement getControlLoopElement(UUID id);
-
- /**
- * Update the state of a control loop element.
- *
- * @param id the ID of the control loop element to update the state on
- * @param currentState the state of the control loop element
- * @param newState the state of the control loop element
- * @return ControlLoopElement updated control loop element
- */
- ControlLoopElement updateControlLoopElementState(ToscaConceptIdentifier controlLoopId,
- UUID id, ControlLoopOrderedState currentState,
- ControlLoopState newState, ParticipantMessageType messageType);
-
- /**
- * Update the control loop element statistics.
- *
- * @param id the ID of the control loop element to update the state on
- * @param elementStatistics the updated statistics
- */
- void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics);
-}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
deleted file mode 100644
index bbafc4678..000000000
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
+++ /dev/null
@@ -1,137 +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.participant.intermediary.api.impl;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-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.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ControlLoopHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
-import org.springframework.stereotype.Component;
-
-/**
- * This class is api implementation used by participant intermediary.
- */
-@Component
-public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryApi {
-
- // The handler for the participant intermediary
- private final ParticipantHandler participantHandler;
-
- // The handler for the controlLoop intermediary
- private final ControlLoopHandler controlLoopHandler;
-
- /**
- * Constructor.
- *
- * @param participantHandler ParticipantHandler
- * @param controlLoopHandler ControlLoopHandler
- */
- public ParticipantIntermediaryApiImpl(ParticipantHandler participantHandler,
- ControlLoopHandler controlLoopHandler) {
- this.participantHandler = participantHandler;
- this.controlLoopHandler = controlLoopHandler;
- }
-
- @Override
- public void registerControlLoopElementListener(ControlLoopElementListener controlLoopElementListener) {
- controlLoopHandler.registerControlLoopElementListener(controlLoopElementListener);
- }
-
- @Override
- public List<Participant> getParticipants(String name, String version) {
- return List.of(participantHandler.getParticipant(name, version));
- }
-
- @Override
- public Map<String, ToscaProperty> getClElementDefinitionCommonProperties(ToscaConceptIdentifier clElementDef) {
- return participantHandler.getClElementDefinitionCommonProperties(clElementDef);
- }
-
- @Override
- public Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state) {
- return participantHandler.updateParticipantState(definition, state);
- }
-
- @Override
- public void updateParticipantStatistics(ParticipantStatistics participantStatistics) {
- participantHandler.updateParticipantStatistics(participantStatistics);
- }
-
- @Override
- public ControlLoops getControlLoops(String name, String version) {
- return controlLoopHandler.getControlLoops();
- }
-
- @Override
- public Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version) {
- List<ControlLoop> controlLoops = controlLoopHandler.getControlLoops().getControlLoopList();
-
- for (ControlLoop controlLoop : controlLoops) {
- if (name.equals(controlLoop.getDefinition().getName())) {
- return controlLoop.getElements();
- }
- }
- return new LinkedHashMap<>();
- }
-
- @Override
- public ControlLoopElement getControlLoopElement(UUID id) {
- List<ControlLoop> controlLoops = controlLoopHandler.getControlLoops().getControlLoopList();
-
- for (ControlLoop controlLoop : controlLoops) {
- ControlLoopElement clElement = controlLoop.getElements().get(id);
- if (clElement != null) {
- return clElement;
- }
- }
- return null;
- }
-
- @Override
- public ControlLoopElement updateControlLoopElementState(ToscaConceptIdentifier controlLoopId,
- UUID id, ControlLoopOrderedState currentState,
- ControlLoopState newState, ParticipantMessageType messageType) {
- return controlLoopHandler.updateControlLoopElementState(controlLoopId,
- id, currentState, newState);
- }
-
- @Override
- public void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics) {
- controlLoopHandler.updateControlLoopElementStatistics(id, elementStatistics);
- }
-}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
deleted file mode 100644
index 5a0f4989f..000000000
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
+++ /dev/null
@@ -1,454 +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.participant.intermediary.handler;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.stream.Collectors;
-import lombok.Getter;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-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.ControlLoopElementAck;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
-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.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
-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.ToscaProperty;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/*
- * This class is responsible for managing the state of all control loops in the participant.
- */
-@Component
-public class ControlLoopHandler {
- private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopHandler.class);
-
- private final ToscaConceptIdentifier participantType;
- private final ToscaConceptIdentifier participantId;
- private final ParticipantMessagePublisher publisher;
-
- @Getter
- private final Map<ToscaConceptIdentifier, ControlLoop> controlLoopMap = new LinkedHashMap<>();
-
- @Getter
- private final Map<UUID, ControlLoopElement> elementsOnThisParticipant = new LinkedHashMap<>();
-
- @Getter
- private List<ControlLoopElementListener> listeners = new ArrayList<>();
-
- /**
- * Constructor, set the participant ID and messageSender.
- *
- * @param parameters the parameters of the participant
- * @param publisher the ParticipantMessage Publisher
- */
- public ControlLoopHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher) {
- this.participantType = parameters.getIntermediaryParameters().getParticipantType();
- this.participantId = parameters.getIntermediaryParameters().getParticipantId();
- this.publisher = publisher;
- }
-
- public void registerControlLoopElementListener(ControlLoopElementListener listener) {
- listeners.add(listener);
- }
-
- /**
- * Handle a control loop element state change message.
- *
- * @param controlLoopId the controlLoop Id
- * @param id the controlLoop UUID
- * @param orderedState the current state
- * @param newState the ordered state
- * @return controlLoopElement the updated controlloop element
- */
- public ControlLoopElement updateControlLoopElementState(ToscaConceptIdentifier controlLoopId, UUID id,
- ControlLoopOrderedState orderedState, ControlLoopState newState) {
-
- if (id == null) {
- LOGGER.warn("Cannot update Control loop element state, id is null");
- return null;
- }
-
- // Update states of ControlLoopElement in controlLoopMap
- for (var controlLoop : controlLoopMap.values()) {
- var element = controlLoop.getElements().get(id);
- if (element != null) {
- element.setOrderedState(orderedState);
- element.setState(newState);
- }
- var checkOpt = controlLoop.getElements().values().stream()
- .filter(clElement -> !newState.equals(clElement.getState())).findAny();
- if (checkOpt.isEmpty()) {
- controlLoop.setState(newState);
- controlLoop.setOrderedState(orderedState);
- }
- }
-
- // Update states of ControlLoopElement in elementsOnThisParticipant
- var clElement = elementsOnThisParticipant.get(id);
- if (clElement != null) {
- var controlLoopStateChangeAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
- controlLoopStateChangeAck.setParticipantId(participantId);
- controlLoopStateChangeAck.setParticipantType(participantType);
- controlLoopStateChangeAck.setControlLoopId(controlLoopId);
- clElement.setOrderedState(orderedState);
- clElement.setState(newState);
- controlLoopStateChangeAck.getControlLoopResultMap().put(clElement.getId(), new ControlLoopElementAck(
- newState, true, "Control loop element {} state changed to {}\", id, newState)"));
- LOGGER.debug("Control loop element {} state changed to {}", id, newState);
- controlLoopStateChangeAck.setMessage("ControlLoopElement state changed to {} " + newState);
- controlLoopStateChangeAck.setResult(true);
- publisher.sendControlLoopAck(controlLoopStateChangeAck);
- return clElement;
- }
- return null;
- }
-
- /**
- * Handle a control loop element statistics.
- *
- * @param id controlloop element id
- * @param elementStatistics control loop element Statistics
- */
- public void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics) {
- var clElement = elementsOnThisParticipant.get(id);
- if (clElement != null) {
- elementStatistics.setParticipantId(participantId);
- elementStatistics.setId(id);
- clElement.setClElementStatistics(elementStatistics);
- }
- }
-
- /**
- * Handle a control loop state change message.
- *
- * @param stateChangeMsg the state change message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- public void handleControlLoopStateChange(ControlLoopStateChange stateChangeMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
- if (stateChangeMsg.getControlLoopId() == null) {
- return;
- }
-
- var controlLoop = controlLoopMap.get(stateChangeMsg.getControlLoopId());
-
- if (controlLoop == null) {
- var controlLoopAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
- controlLoopAck.setParticipantId(participantId);
- controlLoopAck.setParticipantType(participantType);
- controlLoopAck.setMessage("Control loop " + stateChangeMsg.getControlLoopId()
- + " does not use this participant " + participantId);
- controlLoopAck.setResult(false);
- controlLoopAck.setResponseTo(stateChangeMsg.getMessageId());
- controlLoopAck.setControlLoopId(stateChangeMsg.getControlLoopId());
- publisher.sendControlLoopAck(controlLoopAck);
- LOGGER.debug("Control loop {} does not use this participant", stateChangeMsg.getControlLoopId());
- return;
- }
-
- handleState(controlLoop, stateChangeMsg.getOrderedState(), stateChangeMsg.getStartPhase(),
- clElementDefinitions);
- }
-
- /**
- * Method to handle state changes.
- *
- * @param controlLoop participant response
- * @param orderedState controlloop ordered state
- * @param startPhaseMsg startPhase from message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- private void handleState(final ControlLoop controlLoop, ControlLoopOrderedState orderedState, Integer startPhaseMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
- switch (orderedState) {
- case UNINITIALISED:
- handleUninitialisedState(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- break;
- case PASSIVE:
- handlePassiveState(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- break;
- case RUNNING:
- handleRunningState(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- break;
- default:
- LOGGER.debug("StateChange message has no state, state is null {}", controlLoop.getDefinition());
- break;
- }
- }
-
- /**
- * Handle a control loop update message.
- *
- * @param updateMsg the update message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- public void handleControlLoopUpdate(ControlLoopUpdate updateMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
-
- if (!updateMsg.appliesTo(participantType, participantId)) {
- return;
- }
-
- if (0 == updateMsg.getStartPhase()) {
- handleClUpdatePhase0(updateMsg, clElementDefinitions);
- } else {
- handleClUpdatePhaseN(updateMsg, clElementDefinitions);
- }
- }
-
- private void handleClUpdatePhase0(ControlLoopUpdate updateMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
- var controlLoop = controlLoopMap.get(updateMsg.getControlLoopId());
-
- // TODO: Updates to existing ControlLoops are not supported yet (Addition/Removal of ControlLoop
- // elements to existing ControlLoop has to be supported).
- if (controlLoop != null) {
- var controlLoopUpdateAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_UPDATE_ACK);
- controlLoopUpdateAck.setParticipantId(participantId);
- controlLoopUpdateAck.setParticipantType(participantType);
-
- controlLoopUpdateAck.setMessage("Control loop " + updateMsg.getControlLoopId()
- + " already defined on participant " + participantId);
- controlLoopUpdateAck.setResult(false);
- controlLoopUpdateAck.setResponseTo(updateMsg.getMessageId());
- controlLoopUpdateAck.setControlLoopId(updateMsg.getControlLoopId());
- publisher.sendControlLoopAck(controlLoopUpdateAck);
- return;
- }
-
- if (updateMsg.getParticipantUpdatesList().isEmpty()) {
- LOGGER.warn("No ControlLoopElement updates in message {}", updateMsg.getControlLoopId());
- return;
- }
-
- var clElements = storeElementsOnThisParticipant(updateMsg.getParticipantUpdatesList());
-
- var clElementMap = prepareClElementMap(clElements);
- controlLoop = new ControlLoop();
- controlLoop.setDefinition(updateMsg.getControlLoopId());
- controlLoop.setElements(clElementMap);
- controlLoopMap.put(updateMsg.getControlLoopId(), controlLoop);
-
- handleControlLoopElementUpdate(clElements, clElementDefinitions, updateMsg.getStartPhase(),
- updateMsg.getControlLoopId());
- }
-
- private void handleClUpdatePhaseN(ControlLoopUpdate updateMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
-
- var clElementList = updateMsg.getParticipantUpdatesList().stream()
- .flatMap(participantUpdate -> participantUpdate.getControlLoopElementList().stream())
- .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
-
- handleControlLoopElementUpdate(clElementList, clElementDefinitions, updateMsg.getStartPhase(),
- updateMsg.getControlLoopId());
- }
-
- private void handleControlLoopElementUpdate(List<ControlLoopElement> clElements,
- List<ControlLoopElementDefinition> clElementDefinitions, Integer startPhaseMsg,
- ToscaConceptIdentifier controlLoopId) {
- try {
- for (var element : clElements) {
- var clElementNodeTemplate = getClElementNodeTemplate(clElementDefinitions, element.getDefinition());
- if (clElementNodeTemplate != null) {
- int startPhase = ParticipantUtils.findStartPhase(clElementNodeTemplate.getProperties());
- if (startPhaseMsg.equals(startPhase)) {
- for (var clElementListener : listeners) {
- clElementListener.controlLoopElementUpdate(controlLoopId, element, clElementNodeTemplate);
- }
- }
- }
- }
- } catch (PfModelException e) {
- LOGGER.debug("Control loop element update failed {}", controlLoopId);
- }
-
- }
-
- private ToscaNodeTemplate getClElementNodeTemplate(List<ControlLoopElementDefinition> clElementDefinitions,
- ToscaConceptIdentifier clElementDefId) {
-
- for (var clElementDefinition : clElementDefinitions) {
- if (clElementDefId.getName().contains(clElementDefinition.getClElementDefinitionId().getName())) {
- return clElementDefinition.getControlLoopElementToscaNodeTemplate();
- }
- }
- return null;
- }
-
- private List<ControlLoopElement> storeElementsOnThisParticipant(List<ParticipantUpdates> participantUpdates) {
- var clElementList = participantUpdates.stream()
- .flatMap(participantUpdate -> participantUpdate.getControlLoopElementList().stream())
- .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
-
- for (var element : clElementList) {
- elementsOnThisParticipant.put(element.getId(), element);
- }
- return clElementList;
- }
-
- private Map<UUID, ControlLoopElement> prepareClElementMap(List<ControlLoopElement> clElements) {
- Map<UUID, ControlLoopElement> clElementMap = new LinkedHashMap<>();
- for (var element : clElements) {
- clElementMap.put(element.getId(), element);
- }
- return clElementMap;
- }
-
- /**
- * Method to handle when the new state from participant is UNINITIALISED state.
- *
- * @param controlLoop participant response
- * @param orderedState orderedState
- * @param startPhaseMsg startPhase from message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- private void handleUninitialisedState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- Integer startPhaseMsg, List<ControlLoopElementDefinition> clElementDefinitions) {
- handleStateChange(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- boolean isAllUninitialised = controlLoop.getElements().values().stream()
- .filter(element -> !ControlLoopState.UNINITIALISED.equals(element.getState())).findAny().isEmpty();
- if (isAllUninitialised) {
- controlLoopMap.remove(controlLoop.getDefinition());
- controlLoop.getElements().values().forEach(element -> elementsOnThisParticipant.remove(element.getId()));
- }
- }
-
- /**
- * Method to handle when the new state from participant is PASSIVE state.
- *
- * @param controlLoop participant response
- * @param orderedState orderedState
- * @param startPhaseMsg startPhase from message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- private void handlePassiveState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- Integer startPhaseMsg, List<ControlLoopElementDefinition> clElementDefinitions) {
- handleStateChange(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- }
-
- /**
- * Method to handle when the new state from participant is RUNNING state.
- *
- * @param controlLoop participant response
- * @param orderedState orderedState
- * @param startPhaseMsg startPhase from message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- private void handleRunningState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- Integer startPhaseMsg, List<ControlLoopElementDefinition> clElementDefinitions) {
- handleStateChange(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- }
-
- /**
- * Method to update the state of control loop elements.
- *
- * @param controlLoop participant status in memory
- * @param orderedState orderedState the new ordered state the participant should have
- * @param startPhaseMsg startPhase from message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- private void handleStateChange(ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- Integer startPhaseMsg, List<ControlLoopElementDefinition> clElementDefinitions) {
-
- if (orderedState.equals(controlLoop.getOrderedState())) {
- var controlLoopAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
- controlLoopAck.setParticipantId(participantId);
- controlLoopAck.setParticipantType(participantType);
- controlLoopAck.setMessage("Control loop is already in state " + orderedState);
- controlLoopAck.setResult(false);
- controlLoopAck.setControlLoopId(controlLoop.getDefinition());
- publisher.sendControlLoopAck(controlLoopAck);
- return;
- }
-
- controlLoop.getElements().values().stream().forEach(clElement -> controlLoopElementStateChange(controlLoop,
- orderedState, clElement, startPhaseMsg, clElementDefinitions));
- }
-
- private void controlLoopElementStateChange(ControlLoop controlLoop, ControlLoopOrderedState orderedState,
- ControlLoopElement clElement, Integer startPhaseMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
- var clElementNodeTemplate = getClElementNodeTemplate(clElementDefinitions, clElement.getDefinition());
- if (clElementNodeTemplate != null) {
- int startPhase = ParticipantUtils.findStartPhase(clElementNodeTemplate.getProperties());
- if (startPhaseMsg.equals(startPhase)) {
- for (var clElementListener : listeners) {
- try {
- clElementListener.controlLoopElementStateChange(controlLoop.getDefinition(), clElement.getId(),
- clElement.getState(), orderedState);
- } catch (PfModelException e) {
- LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition());
- }
- }
- }
- }
- }
-
- /**
- * Get control loops as a {@link ConrolLoops} class.
- *
- * @return the control loops
- */
- public ControlLoops getControlLoops() {
- var controlLoops = new ControlLoops();
- controlLoops.setControlLoopList(new ArrayList<>(controlLoopMap.values()));
- return controlLoops;
- }
-
- /**
- * Get properties of a controlloopelement.
- *
- * @param id the control loop element id
- * @return the instance properties
- */
- public Map<String, ToscaProperty> getClElementInstanceProperties(UUID id) {
- Map<String, ToscaProperty> propertiesMap = new HashMap<>();
- for (var controlLoop : controlLoopMap.values()) {
- var element = controlLoop.getElements().get(id);
- if (element != null) {
- propertiesMap.putAll(element.getPropertiesMap());
- }
- }
- return propertiesMap;
- }
-}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java
index b08e796b7..5d9675606 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.api.impl;
+package org.onap.policy.clamp.acm.participant.intermediary.api.impl;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
@@ -29,15 +29,15 @@ import java.time.Instant;
import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-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.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -47,24 +47,24 @@ class ParticipantIntermediaryApiImplTest {
private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
private static final String ID_VERSION = "1.0.1";
- private static final String ID_NAME_E = "org.onap.domain.pmsh.PMSHControlLoopDefinition";
+ private static final String ID_NAME_E = "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition";
private static final String ID_VERSION_E = "1.0.0";
- private static final String ID_NAME_TYPE = "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant";
+ private static final String ID_NAME_TYPE = "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant";
private static final String ID_VERSION_TYPE = "2.3.4";
@Test
void mockParticipantIntermediaryApiImplTest() throws CoderException {
var uuid = UUID.randomUUID();
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
- var participantHandler = commonTestData.getParticipantHandlerControlLoops();
- var controlLoopHandler = commonTestData.setTestControlLoopHandler(id, uuid);
- var apiImpl = new ParticipantIntermediaryApiImpl(participantHandler, controlLoopHandler);
- var clElementListener = Mockito.mock(ControlLoopElementListener.class);
- apiImpl.registerControlLoopElementListener(clElementListener);
+ var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
+ var automationComposiitonHandler = commonTestData.setTestAutomationCompositionHandler(id, uuid);
+ var apiImpl = new ParticipantIntermediaryApiImpl(participantHandler, automationComposiitonHandler);
+ var acElementListener = Mockito.mock(AutomationCompositionElementListener.class);
+ apiImpl.registerAutomationCompositionElementListener(acElementListener);
- assertNotNull(apiImpl.getControlLoops(id.getName(), id.getVersion()));
- assertThat(apiImpl.getClElementDefinitionCommonProperties(id)).isEmpty();
+ assertNotNull(apiImpl.getAutomationCompositions(id.getName(), id.getVersion()));
+ assertThat(apiImpl.getAcElementDefinitionCommonProperties(id)).isEmpty();
var participantStatistics = new ParticipantStatistics();
participantStatistics.setParticipantId(id);
@@ -79,24 +79,25 @@ class ParticipantIntermediaryApiImplTest {
var participant = apiImpl.updateParticipantState(id, ParticipantState.TERMINATED);
assertEquals(ParticipantState.TERMINATED, participant.getParticipantState());
- var elements = apiImpl.getControlLoopElements(ID_NAME_E, ID_VERSION_E);
+ var elements = apiImpl.getAutomationCompositionElements(ID_NAME_E, ID_VERSION_E);
assertFalse(elements.containsKey(uuid));
- var element = apiImpl.getControlLoopElement(elements.keySet().iterator().next());
+ var element = apiImpl.getAutomationCompositionElement(elements.keySet().iterator().next());
var idType = new ToscaConceptIdentifier(ID_NAME_TYPE, ID_VERSION_TYPE);
assertEquals(idType, element.getParticipantType());
- var clElementStatistics = new ClElementStatistics();
- var controlLoopId = new ToscaConceptIdentifier("defName", "0.0.1");
- clElementStatistics.setParticipantId(controlLoopId);
- clElementStatistics.setControlLoopState(ControlLoopState.RUNNING);
- clElementStatistics.setTimeStamp(Instant.now());
-
- apiImpl.updateControlLoopElementStatistics(uuid, clElementStatistics);
- var clElement = apiImpl.updateControlLoopElementState(id, uuid, ControlLoopOrderedState.UNINITIALISED,
- ControlLoopState.PASSIVE, ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
- assertEquals(ControlLoopOrderedState.UNINITIALISED, clElement.getOrderedState());
- assertEquals(uuid, clElement.getId());
+ var acElementStatistics = new AcElementStatistics();
+ var automationCompositionId = new ToscaConceptIdentifier("defName", "0.0.1");
+ acElementStatistics.setParticipantId(automationCompositionId);
+ acElementStatistics.setState(AutomationCompositionState.RUNNING);
+ acElementStatistics.setTimeStamp(Instant.now());
+
+ apiImpl.updateAutomationCompositionElementStatistics(uuid, acElementStatistics);
+ var acElement =
+ apiImpl.updateAutomationCompositionElementState(id, uuid, AutomationCompositionOrderedState.UNINITIALISED,
+ AutomationCompositionState.PASSIVE, ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ assertEquals(AutomationCompositionOrderedState.UNINITIALISED, acElement.getOrderedState());
+ assertEquals(uuid, acElement.getId());
}
}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantCommTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
index a40a41853..26dddc9ba 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantCommTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -28,13 +28,13 @@ import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.utils.coder.CoderException;
@@ -44,31 +44,28 @@ class ParticipantCommTest {
@Test
void participantReqTest() throws CoderException {
- var participantHandler = commonTestData.getParticipantHandlerControlLoops();
+ var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
var participantRegisterAckListener = new ParticipantRegisterAckListener(participantHandler);
- assertEquals(ParticipantMessageType.PARTICIPANT_REGISTER_ACK.name(),
- participantRegisterAckListener.getType());
+ assertEquals(ParticipantMessageType.PARTICIPANT_REGISTER_ACK.name(), participantRegisterAckListener.getType());
var participantStatusReqListener = new ParticipantStatusReqListener(participantHandler);
- assertEquals(ParticipantMessageType.PARTICIPANT_STATUS_REQ.name(),
- participantStatusReqListener.getType());
+ assertEquals(ParticipantMessageType.PARTICIPANT_STATUS_REQ.name(), participantStatusReqListener.getType());
var participantDeregisterAckListener = new ParticipantDeregisterAckListener(participantHandler);
assertEquals(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK.name(),
- participantDeregisterAckListener.getType());
+ participantDeregisterAckListener.getType());
var participantUpdateListener = new ParticipantUpdateListener(participantHandler);
- assertEquals(ParticipantMessageType.PARTICIPANT_UPDATE.name(),
- participantUpdateListener.getType());
+ assertEquals(ParticipantMessageType.PARTICIPANT_UPDATE.name(), participantUpdateListener.getType());
- var controlLoopUpdateListener = new ControlLoopUpdateListener(participantHandler);
- assertEquals(ParticipantMessageType.CONTROL_LOOP_UPDATE.name(),
- controlLoopUpdateListener.getType());
+ var automationCompositionUpdateListener = new AutomationCompositionUpdateListener(participantHandler);
+ assertEquals(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE.name(),
+ automationCompositionUpdateListener.getType());
- var controlLoopStateChangeListener = new ControlLoopStateChangeListener(participantHandler);
- assertEquals(ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE.name(),
- controlLoopStateChangeListener.getType());
+ var automationCompositionStateChangeListener = new AutomationCompositionStateChangeListener(participantHandler);
+ assertEquals(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE.name(),
+ automationCompositionStateChangeListener.getType());
}
@Test
@@ -76,26 +73,26 @@ class ParticipantCommTest {
var participantMessagePublisher = new ParticipantMessagePublisher();
var participantStatus = Mockito.mock(ParticipantStatus.class);
- assertThrows(ControlLoopRuntimeException.class, () -> {
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
participantMessagePublisher.sendParticipantStatus(participantStatus);
});
- assertThrows(ControlLoopRuntimeException.class, () -> {
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
participantMessagePublisher.sendHeartbeat(participantStatus);
});
var participantRegister = Mockito.mock(ParticipantRegister.class);
- assertThrows(ControlLoopRuntimeException.class, () -> {
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
participantMessagePublisher.sendParticipantRegister(participantRegister);
});
var participantDeregister = Mockito.mock(ParticipantDeregister.class);
- assertThrows(ControlLoopRuntimeException.class, () -> {
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
participantMessagePublisher.sendParticipantDeregister(participantDeregister);
});
- var controlLoopAck = Mockito.mock(ControlLoopAck.class);
- assertThrows(ControlLoopRuntimeException.class, () -> {
- participantMessagePublisher.sendControlLoopAck(controlLoopAck);
+ var automationCompositionAck = Mockito.mock(AutomationCompositionAck.class);
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
+ participantMessagePublisher.sendAutomationCompositionAck(automationCompositionAck);
});
List<TopicSink> emptyList = Collections.emptyList();
@@ -108,7 +105,7 @@ class ParticipantCommTest {
@Test
void messageSenderTest() throws CoderException {
- var participantHandler = commonTestData.getParticipantHandlerControlLoops();
+ var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
var participantParameters = CommonTestData.getParticipantParameters();
var messageSender = new MessageSender(participantHandler, participantParameters);
messageSender.run();
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
new file mode 100644
index 000000000..5585e5190
--- /dev/null
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
@@ -0,0 +1,227 @@
+/*-
+ * ============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.acm.participant.intermediary.handler;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.mockito.Mockito.mock;
+
+import java.time.Instant;
+import java.util.List;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+@ExtendWith(SpringExtension.class)
+class AutomationCompositionHandlerTest {
+
+ private CommonTestData commonTestData = new CommonTestData();
+
+ @Test
+ void automationCompositionHandlerTest() {
+ var ach = commonTestData.getMockAutomationCompositionHandler();
+ assertNotNull(ach.getAutomationCompositions());
+
+ assertNotNull(ach.getAutomationCompositionMap());
+ assertNotNull(ach.getElementsOnThisParticipant());
+
+ var elementId1 = UUID.randomUUID();
+ var element = new AutomationCompositionElement();
+ element.setId(elementId1);
+ element.setDefinition(
+ new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "1.0.1"));
+
+ element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+
+ AutomationCompositionElementListener listener = mock(AutomationCompositionElementListener.class);
+ ach.registerAutomationCompositionElementListener(listener);
+ assertThat(ach.getListeners()).contains(listener);
+ }
+
+ @Test
+ void updateNullAutomationCompositionHandlerTest() {
+ var id = UUID.randomUUID();
+
+ var ach = commonTestData.getMockAutomationCompositionHandler();
+ assertNull(ach.updateAutomationCompositionElementState(null, null,
+ AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE));
+
+ assertNull(ach.updateAutomationCompositionElementState(null, id,
+ AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE));
+
+ var acElementStatistics = new AcElementStatistics();
+ var automationCompositionId = new ToscaConceptIdentifier("defName", "0.0.1");
+ acElementStatistics.setParticipantId(automationCompositionId);
+ acElementStatistics.setState(AutomationCompositionState.RUNNING);
+ acElementStatistics.setTimeStamp(Instant.now());
+
+ ach.updateAutomationCompositionElementStatistics(id, acElementStatistics);
+ assertNull(ach.updateAutomationCompositionElementState(automationCompositionId, id,
+ AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE));
+ }
+
+ @Test
+ void updateAutomationCompositionHandlerTest() throws CoderException {
+ var uuid = UUID.randomUUID();
+ var id = CommonTestData.getParticipantId();
+
+ var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
+ var key = ach.getElementsOnThisParticipant().keySet().iterator().next();
+ var value = ach.getElementsOnThisParticipant().get(key);
+ assertEquals(AutomationCompositionState.UNINITIALISED, value.getState());
+ ach.updateAutomationCompositionElementState(id, uuid, AutomationCompositionOrderedState.UNINITIALISED,
+ AutomationCompositionState.PASSIVE);
+ assertEquals(AutomationCompositionState.PASSIVE, value.getState());
+
+ ach.getAutomationCompositionMap().values().iterator().next().getElements().putIfAbsent(key, value);
+ ach.updateAutomationCompositionElementState(id, key, AutomationCompositionOrderedState.PASSIVE,
+ AutomationCompositionState.RUNNING);
+ assertEquals(AutomationCompositionState.RUNNING, value.getState());
+
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setParticipantId(id);
+ acElementStatistics.setState(AutomationCompositionState.RUNNING);
+ acElementStatistics.setTimeStamp(Instant.now());
+
+ assertNotEquals(uuid, value.getAcElementStatistics().getId());
+ ach.updateAutomationCompositionElementStatistics(uuid, acElementStatistics);
+ assertEquals(uuid, value.getAcElementStatistics().getId());
+
+ ach.getElementsOnThisParticipant().remove(key, value);
+ ach.getAutomationCompositionMap().values().iterator().next().getElements().clear();
+ assertNull(ach.updateAutomationCompositionElementState(id, key, AutomationCompositionOrderedState.PASSIVE,
+ AutomationCompositionState.RUNNING));
+
+ }
+
+ @Test
+ void handleAutomationCompositionUpdateExceptionTest() throws CoderException {
+ var uuid = UUID.randomUUID();
+ var id = CommonTestData.getParticipantId();
+ var stateChange = getStateChange(id, uuid, AutomationCompositionOrderedState.RUNNING);
+ var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
+ assertDoesNotThrow(
+ () -> ach.handleAutomationCompositionStateChange(mock(AutomationCompositionStateChange.class), List.of()));
+
+ ach.handleAutomationCompositionStateChange(stateChange, List.of());
+ var newid = new ToscaConceptIdentifier("id", "1.2.3");
+ stateChange.setAutomationCompositionId(newid);
+ stateChange.setParticipantId(newid);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChange, List.of()));
+
+ var acd = new AutomationCompositionElementDefinition();
+ acd.setAcElementDefinitionId(id);
+ var updateMsg = new AutomationCompositionUpdate();
+ updateMsg.setAutomationCompositionId(id);
+ updateMsg.setMessageId(uuid);
+ updateMsg.setParticipantId(id);
+ updateMsg.setStartPhase(0);
+ var acElementDefinitions = List.of(acd);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+ updateMsg.setStartPhase(1);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+ assertThat(ach.getAcElementInstanceProperties(uuid)).isEmpty();
+
+ ach.getAutomationCompositionMap().clear();
+ updateMsg.setStartPhase(0);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+
+ updateMsg.setAutomationCompositionId(new ToscaConceptIdentifier("new", "0.0.1"));
+ updateMsg.setParticipantUpdatesList(List.of(mock(ParticipantUpdates.class)));
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+
+ updateMsg.setStartPhase(1);
+ var participantUpdate = new ParticipantUpdates();
+ participantUpdate.setParticipantId(id);
+ var element = new AutomationCompositionElement();
+ element.setParticipantType(id);
+ element.setDefinition(id);
+ participantUpdate.setAutomationCompositionElementList(List.of(element));
+ updateMsg.setParticipantUpdatesList(List.of(participantUpdate));
+
+ var acd2 = new AutomationCompositionElementDefinition();
+ acd2.setAcElementDefinitionId(id);
+ acd2.setAutomationCompositionElementToscaNodeTemplate(mock(ToscaNodeTemplate.class));
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, List.of(acd2)));
+
+ }
+
+ @Test
+ void automationCompositionStateChangeUninitialisedTest() throws CoderException {
+ var uuid = UUID.randomUUID();
+ var id = CommonTestData.getParticipantId();
+
+ var stateChangeUninitialised = getStateChange(id, uuid, AutomationCompositionOrderedState.UNINITIALISED);
+
+ var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
+ ach.handleAutomationCompositionStateChange(stateChangeUninitialised, List.of());
+ var newid = new ToscaConceptIdentifier("id", "1.2.3");
+ stateChangeUninitialised.setAutomationCompositionId(newid);
+ stateChangeUninitialised.setParticipantId(newid);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChangeUninitialised, List.of()));
+ }
+
+ @Test
+ void automationCompositionStateChangePassiveTest() throws CoderException {
+ var uuid = UUID.randomUUID();
+ var id = CommonTestData.getParticipantId();
+
+ var stateChangePassive = getStateChange(id, uuid, AutomationCompositionOrderedState.PASSIVE);
+
+ var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
+ ach.handleAutomationCompositionStateChange(stateChangePassive, List.of());
+ var newid = new ToscaConceptIdentifier("id", "1.2.3");
+ stateChangePassive.setAutomationCompositionId(newid);
+ stateChangePassive.setParticipantId(newid);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChangePassive, List.of()));
+ }
+
+ private AutomationCompositionStateChange getStateChange(ToscaConceptIdentifier id, UUID uuid,
+ AutomationCompositionOrderedState state) {
+ var stateChange = new AutomationCompositionStateChange();
+ stateChange.setAutomationCompositionId(id);
+ stateChange.setParticipantId(id);
+ stateChange.setMessageId(uuid);
+ stateChange.setOrderedState(state);
+ stateChange.setCurrentState(AutomationCompositionState.UNINITIALISED);
+ stateChange.setTimestamp(Instant.ofEpochMilli(3000));
+ return stateChange;
+ }
+
+}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/DummyParticipantParameters.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/DummyParticipantParameters.java
index d60bb71bc..b82fbed6a 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/DummyParticipantParameters.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/DummyParticipantParameters.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
@Getter
@Setter
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java
index 8c400c12f..9ecf59ba4 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
@@ -34,10 +34,10 @@ import static org.mockito.Mockito.when;
import java.util.List;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatusReq;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStatusReqListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantStatusReqListener;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.coder.StandardCoderObject;
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
index d00697521..8e22784db 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -32,16 +32,16 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-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.messages.dmaap.participant.ParticipantAckMessage;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
-import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -60,17 +60,17 @@ class ParticipantHandlerTest {
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
assertEquals(id, participantHandler.getParticipantId());
assertEquals(id, participantHandler.getParticipantType());
- assertThat(participantHandler.getClElementDefinitionCommonProperties(id)).isEmpty();
+ assertThat(participantHandler.getAcElementDefinitionCommonProperties(id)).isEmpty();
}
@Test
void handleUpdateTest() {
var parameters = CommonTestData.getParticipantParameters();
- var controlLoopHander = commonTestData.getMockControlLoopHandler();
+ var automationCompositionHander = commonTestData.getMockAutomationCompositionHandler();
var publisher = new ParticipantMessagePublisher();
var emptyParticipantHandler =
- new ParticipantHandler(parameters, publisher, controlLoopHander);
+ new ParticipantHandler(parameters, publisher, automationCompositionHander);
var participantUpdateMsg = new ParticipantUpdate();
assertThatThrownBy(() ->
@@ -80,7 +80,7 @@ class ParticipantHandlerTest {
var participantHandler = commonTestData.getMockParticipantHandler();
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
- participantUpdateMsg.setControlLoopId(id);
+ participantUpdateMsg.setAutomationCompositionId(id);
participantUpdateMsg.setParticipantId(id);
participantUpdateMsg.setParticipantType(id);
participantUpdateMsg.setMessageId(UUID.randomUUID());
@@ -89,10 +89,10 @@ class ParticipantHandlerTest {
var heartbeatF = participantHandler.makeHeartbeat(false);
assertEquals(id, heartbeatF.getParticipantId());
assertEquals(ParticipantState.UNKNOWN, heartbeatF.getParticipantStatistics().getState());
- assertThat(heartbeatF.getControlLoopInfoList()).isEmpty();
+ assertThat(heartbeatF.getAutomationCompositionInfoList()).isEmpty();
participantHandler.handleParticipantUpdate(participantUpdateMsg);
- assertThat(participantHandler.getClElementDefinitionCommonProperties(id)).isEmpty();
+ assertThat(participantHandler.getAcElementDefinitionCommonProperties(id)).isEmpty();
var heartbeatT = participantHandler.makeHeartbeat(true);
assertEquals(id, heartbeatT.getParticipantId());
@@ -148,7 +148,7 @@ class ParticipantHandlerTest {
void checkAppliesTo() {
var participantHandler = commonTestData.getMockParticipantHandler();
var participantAckMsg =
- new ParticipantAckMessage(ParticipantMessageType.CONTROL_LOOP_UPDATE);
+ new ParticipantAckMessage(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
assertTrue(participantHandler.appliesTo(participantAckMsg));
var participantMsg =
@@ -162,14 +162,14 @@ class ParticipantHandlerTest {
}
@Test
- void getControlLoopInfoListTest() throws CoderException {
- var participantHandler = commonTestData.getParticipantHandlerControlLoops();
+ void getAutomationCompositionInfoListTest() throws CoderException {
+ var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
participantHandler.sendHeartbeat();
assertEquals(id, participantHandler.makeHeartbeat(false)
- .getControlLoopInfoList()
+ .getAutomationCompositionInfoList()
.get(0)
- .getControlLoopId());
+ .getAutomationCompositionId());
}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/CommonTestData.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
index 9bbf8964c..ad54d402c 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/CommonTestData.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters;
+package org.onap.policy.clamp.acm.participant.intermediary.main.parameters;
import java.io.File;
import java.time.Instant;
@@ -30,18 +30,18 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-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.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ControlLoopHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.DummyParticipantParameters;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.AutomationCompositionHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.DummyParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.utils.coder.Coder;
@@ -53,7 +53,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
* Class to hold/create all parameters for test cases.
*/
public class CommonTestData {
- public static final String PARTICIPANT_GROUP_NAME = "ControlLoopParticipantGroup";
+ public static final String PARTICIPANT_GROUP_NAME = "AutomationCompositionParticipantGroup";
public static final String DESCRIPTION = "Participant description";
public static final long TIME_INTERVAL = 2000;
public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams());
@@ -68,7 +68,7 @@ public class CommonTestData {
public ParticipantIntermediaryParameters getParticipantIntermediaryParameters() {
try {
return CODER.convert(getIntermediaryParametersMap(PARTICIPANT_GROUP_NAME),
- ParticipantIntermediaryParameters.class);
+ ParticipantIntermediaryParameters.class);
} catch (final CoderException e) {
throw new RuntimeException("cannot create ParticipantSimulatorParameters from map", e);
}
@@ -81,8 +81,7 @@ public class CommonTestData {
*/
public static DummyParticipantParameters getParticipantParameters() {
try {
- return CODER.convert(getParametersMap(PARTICIPANT_GROUP_NAME),
- DummyParticipantParameters.class);
+ return CODER.convert(getParametersMap(PARTICIPANT_GROUP_NAME), DummyParticipantParameters.class);
} catch (final CoderException e) {
throw new RuntimeException("cannot create ParticipantSimulatorParameters from map", e);
}
@@ -113,7 +112,7 @@ public class CommonTestData {
map.put("description", DESCRIPTION);
map.put("participantType", getParticipantId());
map.put("reportingTimeIntervalMs", TIME_INTERVAL);
- map.put("clampControlLoopTopics", getTopicParametersMap(false));
+ map.put("clampAutomationCompositionTopics", getTopicParametersMap(false));
return map;
}
@@ -140,7 +139,7 @@ public class CommonTestData {
*/
public static TopicParameters getTopicParams() {
final var topicParams = new TopicParameters();
- topicParams.setTopic("POLICY-CLRUNTIME-PARTICIPANT");
+ topicParams.setTopic("POLICY-ACRUNTIME-PARTICIPANT");
topicParams.setTopicCommInfrastructure("dmaap");
topicParams.setServers(Arrays.asList("localhost"));
return topicParams;
@@ -169,14 +168,12 @@ public class CommonTestData {
}
/**
- * Returns a mocked ControlLoopHandler for test cases.
+ * Returns a mocked AutomationCompositionHandler for test cases.
*
- * @return ControlLoopHandler
+ * @return AutomationCompositionHandler
*/
- public ControlLoopHandler getMockControlLoopHandler() {
- return new ControlLoopHandler(
- getParticipantParameters(),
- getParticipantMessagePublisher());
+ public AutomationCompositionHandler getMockAutomationCompositionHandler() {
+ return new AutomationCompositionHandler(getParticipantParameters(), getParticipantMessagePublisher());
}
/**
@@ -186,10 +183,10 @@ public class CommonTestData {
*/
public ParticipantHandler getMockParticipantHandler() {
var parameters = getParticipantParameters();
- var controlLoopHandler = getMockControlLoopHandler();
+ var automationCompositionHandler = getMockAutomationCompositionHandler();
var publisher = new ParticipantMessagePublisher();
publisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
- var participantHandler = new ParticipantHandler(parameters, publisher, controlLoopHandler);
+ var participantHandler = new ParticipantHandler(parameters, publisher, automationCompositionHandler);
return participantHandler;
}
@@ -200,14 +197,16 @@ public class CommonTestData {
*
* @throws CoderException if there is an error with .json file.
*/
- public ParticipantHandler getParticipantHandlerControlLoops() throws CoderException {
- var controlLoopHandler = Mockito.mock(ControlLoopHandler.class);
- Mockito.doReturn(getTestControlLoops()).when(controlLoopHandler).getControlLoops();
- Mockito.doReturn(getTestControlLoopMap()).when(controlLoopHandler).getControlLoopMap();
+ public ParticipantHandler getParticipantHandlerAutomationCompositions() throws CoderException {
+ var automationCompositionHandler = Mockito.mock(AutomationCompositionHandler.class);
+ Mockito.doReturn(getTestAutomationCompositions()).when(automationCompositionHandler)
+ .getAutomationCompositions();
+ Mockito.doReturn(getTestAutomationCompositionMap()).when(automationCompositionHandler)
+ .getAutomationCompositionMap();
var publisher = new ParticipantMessagePublisher();
publisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
var parameters = getParticipantParameters();
- var participantHandler = new ParticipantHandler(parameters, publisher, controlLoopHandler);
+ var participantHandler = new ParticipantHandler(parameters, publisher, automationCompositionHandler);
participantHandler.sendParticipantRegister();
participantHandler.handleParticipantStatusReq(null);
participantHandler.sendParticipantDeregister();
@@ -218,31 +217,31 @@ public class CommonTestData {
}
/**
- * Returns a Map of ToscaConceptIdentifier and ControlLoop for test cases.
+ * Returns a Map of ToscaConceptIdentifier and AutomationComposition for test cases.
*
- * @return controlLoopMap
+ * @return automationCompositionMap
*
* @throws CoderException if there is an error with .json file.
*/
- public Map<ToscaConceptIdentifier, ControlLoop> getTestControlLoopMap() throws CoderException {
- var controlLoops = getTestControlLoops();
- var controlLoop = controlLoops.getControlLoopList().get(1);
+ public Map<ToscaConceptIdentifier, AutomationComposition> getTestAutomationCompositionMap() throws CoderException {
+ var automationCompositions = getTestAutomationCompositions();
+ var automationComposition = automationCompositions.getAutomationCompositionList().get(1);
var id = getParticipantId();
- Map<ToscaConceptIdentifier, ControlLoop> controlLoopMap = new LinkedHashMap<>();
- controlLoopMap.put(id, controlLoop);
- return controlLoopMap;
+ Map<ToscaConceptIdentifier, AutomationComposition> automationCompositionMap = new LinkedHashMap<>();
+ automationCompositionMap.put(id, automationComposition);
+ return automationCompositionMap;
}
/**
- * Returns List of ControlLoop for test cases.
+ * Returns List of AutomationComposition for test cases.
*
- * @return ControlLoops
+ * @return AutomationCompositions
*
* @throws CoderException if there is an error with .json file.
*/
- public ControlLoops getTestControlLoops() throws CoderException {
- return new StandardCoder()
- .decode(new File("src/test/resources/providers/TestControlLoops.json"), ControlLoops.class);
+ public AutomationCompositions getTestAutomationCompositions() throws CoderException {
+ return new StandardCoder().decode(new File("src/test/resources/providers/TestAutomationCompositions.json"),
+ AutomationCompositions.class);
}
/**
@@ -251,43 +250,45 @@ public class CommonTestData {
* @param uuid UUID and id ToscaConceptIdentifier
* @return a map suitable for elementsOnThisParticipant
*/
- public Map<UUID, ControlLoopElement> setControlLoopElementTest(UUID uuid, ToscaConceptIdentifier id) {
- var clElement = new ControlLoopElement();
- clElement.setId(uuid);
- clElement.setParticipantId(id);
- clElement.setDefinition(id);
- clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
+ public Map<UUID, AutomationCompositionElement> setAutomationCompositionElementTest(UUID uuid,
+ ToscaConceptIdentifier id) {
+ var acElement = new AutomationCompositionElement();
+ acElement.setId(uuid);
+ acElement.setParticipantId(id);
+ acElement.setDefinition(id);
+ acElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setParticipantId(id);
- clElementStatistics.setControlLoopState(ControlLoopState.UNINITIALISED);
- clElementStatistics.setTimeStamp(Instant.now());
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setParticipantId(id);
+ acElementStatistics.setState(AutomationCompositionState.UNINITIALISED);
+ acElementStatistics.setTimeStamp(Instant.now());
- clElement.setClElementStatistics(clElementStatistics);
+ acElement.setAcElementStatistics(acElementStatistics);
- Map<UUID, ControlLoopElement> elementsOnThisParticipant = new LinkedHashMap<>();
- elementsOnThisParticipant.put(uuid, clElement);
+ Map<UUID, AutomationCompositionElement> elementsOnThisParticipant = new LinkedHashMap<>();
+ elementsOnThisParticipant.put(uuid, acElement);
return elementsOnThisParticipant;
}
/**
- * Returns a ControlLoopHandler with elements on the id,uuid.
+ * Returns a AutomationCompositionHandler with elements on the id,uuid.
*
* @param id ToscaConceptIdentifier and uuid UUID
- * @return a ControlLoopHander with elements
+ * @return a AutomationCompositionHander with elements
*/
- public ControlLoopHandler setTestControlLoopHandler(ToscaConceptIdentifier id, UUID uuid) throws CoderException {
- var clh = getMockControlLoopHandler();
+ public AutomationCompositionHandler setTestAutomationCompositionHandler(ToscaConceptIdentifier id, UUID uuid)
+ throws CoderException {
+ var ach = getMockAutomationCompositionHandler();
- var key = getTestControlLoopMap().keySet().iterator().next();
- var value = getTestControlLoopMap().get(key);
- clh.getControlLoopMap().put(key, value);
+ var key = getTestAutomationCompositionMap().keySet().iterator().next();
+ var value = getTestAutomationCompositionMap().get(key);
+ ach.getAutomationCompositionMap().put(key, value);
- var keyElem = setControlLoopElementTest(uuid, id).keySet().iterator().next();
- var valueElem = setControlLoopElementTest(uuid, id).get(keyElem);
- clh.getElementsOnThisParticipant().put(keyElem, valueElem);
+ var keyElem = setAutomationCompositionElementTest(uuid, id).keySet().iterator().next();
+ var valueElem = setAutomationCompositionElementTest(uuid, id).get(keyElem);
+ ach.getElementsOnThisParticipant().put(keyElem, valueElem);
- return clh;
+ return ach;
}
}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java
index d554a55b6..cc2b110f3 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters;
+package org.onap.policy.clamp.acm.participant.intermediary.main.parameters;
import static org.assertj.core.api.Assertions.assertThat;
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
/**
* Class to perform unit test of {@link ParticipantParameterGroup}.
@@ -45,7 +45,7 @@ class TestParticipantIntermediaryParameters {
void testParticipantIntermediaryParameterGroup_EmptyParameter() {
final ParticipantIntermediaryParameters participantParameters =
commonTestData.getParticipantIntermediaryParameters();
- participantParameters.setClampControlLoopTopics(null);
+ participantParameters.setClampAutomationCompositionTopics(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
@@ -53,7 +53,7 @@ class TestParticipantIntermediaryParameters {
void testParticipantIntermediaryParameters_NullTopicSinks() {
final ParticipantIntermediaryParameters participantParameters =
commonTestData.getParticipantIntermediaryParameters();
- participantParameters.getClampControlLoopTopics().setTopicSinks(null);
+ participantParameters.getClampAutomationCompositionTopics().setTopicSinks(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
@@ -61,7 +61,7 @@ class TestParticipantIntermediaryParameters {
void testParticipantIntermediaryParameters_NullTopicSources() {
final ParticipantIntermediaryParameters participantParameters =
commonTestData.getParticipantIntermediaryParameters();
- participantParameters.getClampControlLoopTopics().setTopicSources(null);
+ participantParameters.getClampAutomationCompositionTopics().setTopicSources(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java
deleted file mode 100644
index 43b43e3bf..000000000
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java
+++ /dev/null
@@ -1,226 +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.participant.intermediary.handler;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.mockito.Mockito.mock;
-
-import java.time.Instant;
-import java.util.List;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
-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.ParticipantUpdates;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-@ExtendWith(SpringExtension.class)
-class ControlLoopHandlerTest {
-
- private CommonTestData commonTestData = new CommonTestData();
-
- @Test
- void controlLoopHandlerTest() {
- var clh = commonTestData.getMockControlLoopHandler();
- assertNotNull(clh.getControlLoops());
-
- assertNotNull(clh.getControlLoopMap());
- assertNotNull(clh.getElementsOnThisParticipant());
-
- var elementId1 = UUID.randomUUID();
- var element = new ControlLoopElement();
- element.setId(elementId1);
- element.setDefinition(new ToscaConceptIdentifier(
- "org.onap.policy.controlloop.PolicyControlLoopParticipant", "1.0.1"));
-
- element.setOrderedState(ControlLoopOrderedState.PASSIVE);
-
- ControlLoopElementListener listener = mock(ControlLoopElementListener.class);
- clh.registerControlLoopElementListener(listener);
- assertThat(clh.getListeners()).contains(listener);
- }
-
- @Test
- void updateNullControlLoopHandlerTest() {
- var id = UUID.randomUUID();
-
- var clh = commonTestData.getMockControlLoopHandler();
- assertNull(clh.updateControlLoopElementState(null, null, ControlLoopOrderedState.UNINITIALISED,
- ControlLoopState.PASSIVE));
-
- assertNull(clh.updateControlLoopElementState(null, id, ControlLoopOrderedState.UNINITIALISED,
- ControlLoopState.PASSIVE));
-
- var clElementStatistics = new ClElementStatistics();
- var controlLoopId = new ToscaConceptIdentifier("defName", "0.0.1");
- clElementStatistics.setParticipantId(controlLoopId);
- clElementStatistics.setControlLoopState(ControlLoopState.RUNNING);
- clElementStatistics.setTimeStamp(Instant.now());
-
- clh.updateControlLoopElementStatistics(id, clElementStatistics);
- assertNull(clh.updateControlLoopElementState(controlLoopId, id, ControlLoopOrderedState.UNINITIALISED,
- ControlLoopState.PASSIVE));
- }
-
- @Test
- void updateControlLoopHandlerTest() throws CoderException {
- var uuid = UUID.randomUUID();
- var id = CommonTestData.getParticipantId();
-
- var clh = commonTestData.setTestControlLoopHandler(id, uuid);
- var key = clh.getElementsOnThisParticipant().keySet().iterator().next();
- var value = clh.getElementsOnThisParticipant().get(key);
- assertEquals(ControlLoopState.UNINITIALISED, value.getState());
- clh.updateControlLoopElementState(id, uuid, ControlLoopOrderedState.UNINITIALISED,
- ControlLoopState.PASSIVE);
- assertEquals(ControlLoopState.PASSIVE, value.getState());
-
- clh.getControlLoopMap().values().iterator().next().getElements().putIfAbsent(key, value);
- clh.updateControlLoopElementState(id, key, ControlLoopOrderedState.PASSIVE,
- ControlLoopState.RUNNING);
- assertEquals(ControlLoopState.RUNNING, value.getState());
-
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setParticipantId(id);
- clElementStatistics.setControlLoopState(ControlLoopState.RUNNING);
- clElementStatistics.setTimeStamp(Instant.now());
-
- assertNotEquals(uuid, value.getClElementStatistics().getId());
- clh.updateControlLoopElementStatistics(uuid, clElementStatistics);
- assertEquals(uuid, value.getClElementStatistics().getId());
-
- clh.getElementsOnThisParticipant().remove(key, value);
- clh.getControlLoopMap().values().iterator().next().getElements().clear();
- assertNull(clh.updateControlLoopElementState(id, key, ControlLoopOrderedState.PASSIVE,
- ControlLoopState.RUNNING));
-
- }
-
- @Test
- void handleControlLoopUpdateExceptionTest() throws CoderException {
- var uuid = UUID.randomUUID();
- var id = CommonTestData.getParticipantId();
- var stateChange = getStateChange(id, uuid, ControlLoopOrderedState.RUNNING);
- var clh = commonTestData.setTestControlLoopHandler(id, uuid);
- assertDoesNotThrow(() -> clh.handleControlLoopStateChange(mock(ControlLoopStateChange.class), List.of()));
-
- clh.handleControlLoopStateChange(stateChange, List.of());
- var newid = new ToscaConceptIdentifier("id", "1.2.3");
- stateChange.setControlLoopId(newid);
- stateChange.setParticipantId(newid);
- assertDoesNotThrow(() -> clh.handleControlLoopStateChange(stateChange, List.of()));
-
- var cld = new ControlLoopElementDefinition();
- cld.setClElementDefinitionId(id);
- var updateMsg = new ControlLoopUpdate();
- updateMsg.setControlLoopId(id);
- updateMsg.setMessageId(uuid);
- updateMsg.setParticipantId(id);
- updateMsg.setStartPhase(0);
- var clElementDefinitions = List.of(cld);
- assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
- updateMsg.setStartPhase(1);
- assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
- assertThat(clh.getClElementInstanceProperties(uuid)).isEmpty();
-
- clh.getControlLoopMap().clear();
- updateMsg.setStartPhase(0);
- assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
-
- updateMsg.setControlLoopId(new ToscaConceptIdentifier("new", "0.0.1"));
- updateMsg.setParticipantUpdatesList(List.of(mock(ParticipantUpdates.class)));
- assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
-
- updateMsg.setStartPhase(1);
- var participantUpdate = new ParticipantUpdates();
- participantUpdate.setParticipantId(id);
- var element = new ControlLoopElement();
- element.setParticipantType(id);
- element.setDefinition(id);
- participantUpdate.setControlLoopElementList(List.of(element));
- updateMsg.setParticipantUpdatesList(List.of(participantUpdate));
-
- var cld2 = new ControlLoopElementDefinition();
- cld2.setClElementDefinitionId(id);
- cld2.setControlLoopElementToscaNodeTemplate(mock(ToscaNodeTemplate.class));
- assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, List.of(cld2)));
-
- }
-
- @Test
- void controlLoopStateChangeUninitialisedTest() throws CoderException {
- var uuid = UUID.randomUUID();
- var id = CommonTestData.getParticipantId();
-
- var stateChangeUninitialised = getStateChange(id, uuid, ControlLoopOrderedState.UNINITIALISED);
-
- var clh = commonTestData.setTestControlLoopHandler(id, uuid);
- clh.handleControlLoopStateChange(stateChangeUninitialised, List.of());
- var newid = new ToscaConceptIdentifier("id", "1.2.3");
- stateChangeUninitialised.setControlLoopId(newid);
- stateChangeUninitialised.setParticipantId(newid);
- assertDoesNotThrow(() -> clh.handleControlLoopStateChange(stateChangeUninitialised, List.of()));
- }
-
- @Test
- void controlLoopStateChangePassiveTest() throws CoderException {
- var uuid = UUID.randomUUID();
- var id = CommonTestData.getParticipantId();
-
- var stateChangePassive = getStateChange(id, uuid, ControlLoopOrderedState.PASSIVE);
-
- var clh = commonTestData.setTestControlLoopHandler(id, uuid);
- clh.handleControlLoopStateChange(stateChangePassive, List.of());
- var newid = new ToscaConceptIdentifier("id", "1.2.3");
- stateChangePassive.setControlLoopId(newid);
- stateChangePassive.setParticipantId(newid);
- assertDoesNotThrow(() -> clh.handleControlLoopStateChange(stateChangePassive, List.of()));
- }
-
-
- private ControlLoopStateChange getStateChange(ToscaConceptIdentifier id, UUID uuid, ControlLoopOrderedState state) {
- var stateChange = new ControlLoopStateChange();
- stateChange.setControlLoopId(id);
- stateChange.setParticipantId(id);
- stateChange.setMessageId(uuid);
- stateChange.setOrderedState(state);
- stateChange.setCurrentState(ControlLoopState.UNINITIALISED);
- stateChange.setTimestamp(Instant.ofEpochMilli(3000));
- return stateChange;
- }
-
-}
diff --git a/participant/participant-intermediary/src/test/resources/providers/TestControlLoops.json b/participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json
index fedda9600..4e0f08981 100644
--- a/participant/participant-intermediary/src/test/resources/providers/TestControlLoops.json
+++ b/participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json
@@ -1,8 +1,8 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"state": "UNINITIALISED",
@@ -15,63 +15,63 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
},
"name": "PMSHInstance0",
"version": "1.0.1",
- "description": "PMSH control loop instance 0"
+ "description": "PMSH automation composition instance 0"
},
{
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"state": "UNINITIALISED",
@@ -84,59 +84,59 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 1 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 1 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition"
}
},
"name": "PMSHInstance1",
"version": "1.0.1",
- "description": "PMSH control loop instance 1"
+ "description": "PMSH automation composition instance 1"
}
]
}