summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantControlLoopStateChange.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStateChange.java56
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantControlLoopStateChangeTest.java)10
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheckTest.java2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStateChangeTest.java61
-rw-r--r--packages/policy-clamp-docker/pom.xml6
-rw-r--r--packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile8
-rw-r--r--packages/policy-clamp-docker/src/main/docker/DcaeParticipantDockerfile7
-rw-r--r--packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile3
-rw-r--r--packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile7
-rw-r--r--packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh18
-rw-r--r--packages/policy-clamp-docker/src/main/docker/dcae-participant.sh6
-rw-r--r--packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh16
-rw-r--r--packages/policy-clamp-docker/src/main/docker/policy-participant.sh6
-rw-r--r--packages/policy-clamp-tarball/src/main/package/tarball/assembly.xml13
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.json53
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml54
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/DcaeParticipantParameters.json70
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/DcaeParticipantParameters.yaml55
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml54
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.json76
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml33
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml24
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/ParticipantDcaeTest.java24
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java39
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml22
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml24
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java8
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java39
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml24
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java37
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java6
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java42
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java4
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java6
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java90
-rw-r--r--runtime-controlloop/pom.xml5
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java2
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterGroup.java3
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantParameters.java5
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantStateChangeParameters.java46
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/CommissioningController.java14
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java20
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/MonitoringQueryController.java17
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/MessageIntercept.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStateChangePublisher.java)18
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspect.java71
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java101
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java151
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangePublisher.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopStateChangePublisher.java)10
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java33
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java13
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterAckPublisher.java13
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdateAckListener.java1
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java50
-rw-r--r--runtime-controlloop/src/main/resources/application.yaml28
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java6
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java6
-rw-r--r--runtime-controlloop/src/test/resources/application_test.properties1
-rw-r--r--runtime-controlloop/src/test/resources/parameters/TestParameters.json1
61 files changed, 724 insertions, 912 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantControlLoopStateChange.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java
index 1a9a891f6..180d99439 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantControlLoopStateChange.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java
@@ -26,21 +26,21 @@ import lombok.ToString;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
/**
- * Class to represent the PARTICIPANT_CONTROL_LOOP_STATE_CHANGE message that the control loop runtime will send to
+ * Class to represent the CONTROL_LOOP_STATE_CHANGE message that the control loop runtime will send to
* participants to change the state of a control loop they are running.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ParticipantControlLoopStateChange extends ParticipantMessage {
+public class ControlLoopStateChange extends ParticipantMessage {
private ControlLoopOrderedState orderedState;
/**
- * Constructor for instantiating ParticipantControlLoopStateChange class with message name.
+ * Constructor for instantiating ControlLoopStateChange class with message name.
*
*/
- public ParticipantControlLoopStateChange() {
- super(ParticipantMessageType.PARTICIPANT_CONTROL_LOOP_STATE_CHANGE);
+ public ControlLoopStateChange() {
+ super(ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
}
/**
@@ -48,7 +48,7 @@ public class ParticipantControlLoopStateChange extends ParticipantMessage {
*
* @param source source from which to copy
*/
- public ParticipantControlLoopStateChange(ParticipantControlLoopStateChange source) {
+ public ControlLoopStateChange(ControlLoopStateChange source) {
super(source);
this.orderedState = source.orderedState;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java
index f73adf928..876c370b4 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java
@@ -29,7 +29,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
* Class to represent the CONTROL_LOOP_UPDATE message that the control loop runtime sends to a participant.
* When a participant receives this message, it creates the control loop elements contained in the message and sets them
- * to state PASSIVE. subsequent PARTICIPANT_CONTROL_LOOP_STATE_CHANGE messages are used to activate the control loops.
+ * to state PASSIVE. subsequent CONTROL_LOOP_STATE_CHANGE messages are used to activate the control loops.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java
index 22f5a1793..0c39392e0 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java
@@ -44,9 +44,9 @@ public enum ParticipantMessageType {
/**
* Used by controlloop runtime to change the state of controlloops in participants, triggers a
- * PARTICIPANT_STATUS message with result of PARTICIPANT_CONTROL_LOOP_STATE_CHANGE operation.
+ * PARTICIPANT_STATUS message with result of CONTROL_LOOP_STATE_CHANGE operation.
*/
- PARTICIPANT_CONTROL_LOOP_STATE_CHANGE,
+ CONTROL_LOOP_STATE_CHANGE,
/**
* Used by the control loop runtime to order a health check on participants, triggers a
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStateChange.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStateChange.java
deleted file mode 100644
index 5f5150077..000000000
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStateChange.java
+++ /dev/null
@@ -1,56 +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.models.messages.dmaap.participant;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-
-/**
- * Class to represent the PARTICIPANT_STATE_CHANGE message that the control loop runtime will send to participants
- * to change their state.
- */
-@Getter
-@Setter
-@ToString(callSuper = true)
-public class ParticipantStateChange extends ParticipantMessage {
- private ParticipantState state;
-
- /**
- * Constructor for instantiating ParticipantStateChange class with message name.
- *
- */
- public ParticipantStateChange() {
- super(ParticipantMessageType.PARTICIPANT_STATE_CHANGE);
- }
-
- /**
- * Constructs the object, making a deep copy.
- *
- * @param source source from which to copy
- */
- public ParticipantStateChange(ParticipantStateChange source) {
- super(source);
-
- this.state = source.state;
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantControlLoopStateChangeTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java
index c37268ac0..5b7fda0c4 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantControlLoopStateChangeTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java
@@ -33,17 +33,17 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Test the copy constructor and other methods.
*/
-class ParticipantControlLoopStateChangeTest {
+class ControlLoopStateChangeTest {
@Test
void testCopyConstructor() {
- assertThatThrownBy(() -> new ParticipantStateChange(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ControlLoopStateChange(null)).isInstanceOf(NullPointerException.class);
- ParticipantControlLoopStateChange orig = new ParticipantControlLoopStateChange();
+ ControlLoopStateChange orig = new ControlLoopStateChange();
// verify with null values
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ParticipantControlLoopStateChange(orig).toString()));
+ removeVariableFields(new ControlLoopStateChange(orig).toString()));
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier();
@@ -56,6 +56,6 @@ class ParticipantControlLoopStateChangeTest {
orig.setTimestamp(Instant.ofEpochMilli(3000));
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ParticipantControlLoopStateChange(orig).toString()));
+ removeVariableFields(new ControlLoopStateChange(orig).toString()));
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheckTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheckTest.java
index 7f595fbbb..52f1cc480 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheckTest.java
@@ -37,7 +37,7 @@ class ParticipantHealthCheckTest {
@Test
void testCopyConstructor() {
- assertThatThrownBy(() -> new ParticipantStateChange(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ParticipantHealthCheck(null)).isInstanceOf(NullPointerException.class);
ParticipantHealthCheck orig = new ParticipantHealthCheck();
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStateChangeTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStateChangeTest.java
deleted file mode 100644
index 6c73c6d3e..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStateChangeTest.java
+++ /dev/null
@@ -1,61 +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.models.messages.dmaap.participant;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
-
-import java.time.Instant;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-/**
- * Test the copy constructor and the other methods.
- */
-class ParticipantStateChangeTest {
-
- @Test
- void testCopyConstructor() {
- assertThatThrownBy(() -> new ParticipantStateChange(null)).isInstanceOf(NullPointerException.class);
-
- ParticipantStateChange orig = new ParticipantStateChange();
-
- // verify with null values
- assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ParticipantStateChange(orig).toString()));
-
- // verify with all values
- ToscaConceptIdentifier id = new ToscaConceptIdentifier();
- id.setName("id");
- id.setVersion("1.2.3");
- orig.setControlLoopId(id);
- orig.setParticipantId(id);
- orig.setMessageId(UUID.randomUUID());
- orig.setState(ParticipantState.ACTIVE);
- orig.setTimestamp(Instant.ofEpochMilli(3000));
-
- assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ParticipantStateChange(orig).toString()));
- }
-}
diff --git a/packages/policy-clamp-docker/pom.xml b/packages/policy-clamp-docker/pom.xml
index 576c95de6..16c416126 100644
--- a/packages/policy-clamp-docker/pom.xml
+++ b/packages/policy-clamp-docker/pom.xml
@@ -111,6 +111,12 @@
<outputDirectory>/lib</outputDirectory>
<outputFileNameMapping>policy-controlloop-runtime.tar.gz</outputFileNameMapping>
</dependencySet>
+ <dependencySet>
+ <includes>
+ <include>org.onap.policy.clamp:policy-clamp-runtime-controlloop</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
</dependencySets>
</inline>
</assembly>
diff --git a/packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile b/packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile
index bd5000686..3d57418e5 100644
--- a/packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile
+++ b/packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile
@@ -33,14 +33,18 @@ ENV POLICY_HOME=$POLICY_HOME/clamp
RUN mkdir -p $POLICY_LOGS $POLICY_HOME $POLICY_HOME/bin && \
chown -R policy:policy $POLICY_HOME $POLICY_LOGS && \
mkdir /packages
-COPY /maven/* /packages
+COPY /maven/lib/policy-controlloop-runtime.tar.gz /packages
+
RUN tar xvfz /packages/policy-controlloop-runtime.tar.gz --directory $POLICY_HOME && \
rm /packages/policy-controlloop-runtime.tar.gz
WORKDIR $POLICY_HOME
COPY controlloop-runtime.sh bin/.
+COPY /maven/app.jar /app
-RUN chown -R policy:policy * && chmod 755 bin/*.sh
+RUN chown -R policy:policy * && \
+ chmod 755 bin/*.sh && \
+ chown -R policy:policy /app
USER policy
WORKDIR $POLICY_HOME/bin
diff --git a/packages/policy-clamp-docker/src/main/docker/DcaeParticipantDockerfile b/packages/policy-clamp-docker/src/main/docker/DcaeParticipantDockerfile
index 368b9348a..ed09c50d3 100644
--- a/packages/policy-clamp-docker/src/main/docker/DcaeParticipantDockerfile
+++ b/packages/policy-clamp-docker/src/main/docker/DcaeParticipantDockerfile
@@ -34,15 +34,16 @@ RUN mkdir -p $POLICY_LOGS $POLICY_HOME $POLICY_HOME/bin && \
chown -R policy:policy $POLICY_HOME $POLICY_LOGS && \
mkdir /packages
COPY /maven/lib/dcae-participant.tar.gz /packages
+
RUN tar xvfz /packages/dcae-participant.tar.gz --directory $POLICY_HOME && \
- rm /packages/dcae-participant.tar.gz && \
- rm -rf $POLICY_HOME/lib
+ rm /packages/dcae-participant.tar.gz
WORKDIR $POLICY_HOME
COPY dcae-participant.sh bin/.
COPY /maven/app.jar /app
-RUN chown -R policy:policy * && chmod 755 bin/*.sh && \
+RUN chown -R policy:policy * && \
+ chmod 755 bin/*.sh && \
chown -R policy:policy /app
USER policy
diff --git a/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile b/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile
index 63209d75f..d08e14fff 100644
--- a/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile
+++ b/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile
@@ -36,8 +36,7 @@ RUN mkdir -p $POLICY_LOGS $POLICY_HOME $POLICY_HOME/bin && \
COPY /maven/lib/kubernetes-participant.tar.gz /packages
RUN tar xvfz /packages/kubernetes-participant.tar.gz --directory $POLICY_HOME && \
- rm /packages/kubernetes-participant.tar.gz && \
- rm -rf $POLICY_HOME/lib
+ rm /packages/kubernetes-participant.tar.gz
WORKDIR $POLICY_HOME
COPY kubernetes-participant.sh bin/.
diff --git a/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile b/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile
index 3c2082202..8eca34d42 100644
--- a/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile
+++ b/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile
@@ -34,15 +34,16 @@ RUN mkdir -p $POLICY_LOGS $POLICY_HOME $POLICY_HOME/bin && \
chown -R policy:policy $POLICY_HOME $POLICY_LOGS && \
mkdir /packages
COPY /maven/lib/policy-participant.tar.gz /packages
+
RUN tar xvfz /packages/policy-participant.tar.gz --directory $POLICY_HOME && \
- rm /packages/policy-participant.tar.gz && \
- rm -rf $POLICY_HOME/lib
+ rm /packages/policy-participant.tar.gz
WORKDIR $POLICY_HOME
COPY policy-participant.sh bin/.
COPY /maven/app.jar /app
-RUN chown -R policy:policy * && chmod 755 bin/*.sh && \
+RUN chown -R policy:policy * && \
+ chmod 755 bin/*.sh && \
chown -R policy:policy /app
USER policy
diff --git a/packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh b/packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh
index 8d64fa5a4..6d12e590a 100644
--- a/packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh
+++ b/packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh
@@ -32,7 +32,7 @@ else
fi
if [ -z "$CONFIG_FILE" ]; then
- CONFIG_FILE="${POLICY_HOME}/etc/ClRuntimeParameters.json"
+ CONFIG_FILE="${POLICY_HOME}/etc/ClRuntimeParameters.yaml"
fi
echo "Policy clamp config file: $CONFIG_FILE"
@@ -48,15 +48,17 @@ if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
fi
if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
- echo "overriding logback.xml"
- cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
+ echo "overriding logback xml files"
+ cp -f "${POLICY_HOME}"/etc/mounted/logback*.xml "${POLICY_HOME}"/etc/
fi
-$JAVA_HOME/bin/java -cp "${POLICY_HOME}/etc:${POLICY_HOME}/lib/*" \
- -Dlogback.configurationFile="${POLICY_HOME}/etc/logback.xml" \
- -Djavax.net.ssl.keyStore="${KEYSTORE}" \
+touch /app/app.jar
+mkdir -p "${POLICY_HOME}"/config/
+cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/ClRuntimeParameters.yaml
+
+$JAVA_HOME/bin/java -Djavax.net.ssl.keyStore="${KEYSTORE}" \
-Djavax.net.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
- org.onap.policy.clamp.controlloop.runtime.main.startstop.Main \
- -c "${CONFIG_FILE}"
+ -jar /app/app.jar \
+ --spring.config.location="${POLICY_HOME}/config/ClRuntimeParameters.yaml"
diff --git a/packages/policy-clamp-docker/src/main/docker/dcae-participant.sh b/packages/policy-clamp-docker/src/main/docker/dcae-participant.sh
index 4acb17b39..620fa42cd 100644
--- a/packages/policy-clamp-docker/src/main/docker/dcae-participant.sh
+++ b/packages/policy-clamp-docker/src/main/docker/dcae-participant.sh
@@ -32,7 +32,7 @@ else
fi
if [ -z "$CONFIG_FILE" ]; then
- CONFIG_FILE="${POLICY_HOME}/etc/DcaeParticipantParameters.json"
+ CONFIG_FILE="${POLICY_HOME}/etc/DcaeParticipantParameters.yaml"
fi
echo "Policy clamp config file: $CONFIG_FILE"
@@ -54,11 +54,11 @@ fi
touch /app/app.jar
mkdir -p "${POLICY_HOME}"/config/
-cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/
+cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/DcaeParticipantParameters.yaml
$JAVA_HOME/bin/java -Djavax.net.ssl.keyStore="${KEYSTORE}" \
-Djavax.net.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
- --participant.file="${POLICY_HOME}/config/DcaeParticipantParameters.json"
+ --spring.config.location="${POLICY_HOME}/config/DcaeParticipantParameters.yaml"
diff --git a/packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh b/packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh
index 50995de3b..cb5ae9251 100644
--- a/packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh
+++ b/packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh
@@ -25,7 +25,17 @@ TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
+if [ "$#" -eq 1 ]; then
+ CONFIG_FILE=$1
+else
+ CONFIG_FILE=${CONFIG_FILE}
+fi
+
+if [ -z "$CONFIG_FILE" ]; then
+ CONFIG_FILE="${POLICY_HOME}/etc/KubernetesParticipantParameters.yaml"
+fi
+echo "Policy clamp config file: $CONFIG_FILE"
if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
echo "overriding policy-truststore"
@@ -42,8 +52,12 @@ if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
cp -f "${POLICY_HOME}"/etc/mounted/logback*.xml "${POLICY_HOME}"/etc/
fi
+mkdir -p "${POLICY_HOME}"/config/
+cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/KubernetesParticipantParameters.yaml
+
$JAVA_HOME/bin/java -Dserver.ssl.keyStore="${KEYSTORE}" \
-Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-Dserver.ssl.trustStore="${TRUSTSTORE}" \
-Dserver.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
- -jar /app/app.jar
+ -jar /app/app.jar \
+ --spring.config.location="${POLICY_HOME}/config/KubernetesParticipantParameters.yaml"
diff --git a/packages/policy-clamp-docker/src/main/docker/policy-participant.sh b/packages/policy-clamp-docker/src/main/docker/policy-participant.sh
index 2e7a7d54b..7949fab72 100644
--- a/packages/policy-clamp-docker/src/main/docker/policy-participant.sh
+++ b/packages/policy-clamp-docker/src/main/docker/policy-participant.sh
@@ -32,7 +32,7 @@ else
fi
if [ -z "$CONFIG_FILE" ]; then
- CONFIG_FILE="${POLICY_HOME}/etc/PolicyParticipantParameters.json"
+ CONFIG_FILE="${POLICY_HOME}/etc/PolicyParticipantParameters.yaml"
fi
echo "Policy clamp config file: $CONFIG_FILE"
@@ -54,11 +54,11 @@ fi
touch /app/app.jar
mkdir -p "${POLICY_HOME}"/config/
-cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/
+cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/PolicyParticipantParameters.yaml
$JAVA_HOME/bin/java -Djavax.net.ssl.keyStore="${KEYSTORE}" \
-Djavax.net.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
- --participant.file="${POLICY_HOME}/config/PolicyParticipantParameters.json"
+ --spring.config.location="${POLICY_HOME}/config/PolicyParticipantParameters.yaml"
diff --git a/packages/policy-clamp-tarball/src/main/package/tarball/assembly.xml b/packages/policy-clamp-tarball/src/main/package/tarball/assembly.xml
index 6e8cd454a..598c0cb3d 100644
--- a/packages/policy-clamp-tarball/src/main/package/tarball/assembly.xml
+++ b/packages/policy-clamp-tarball/src/main/package/tarball/assembly.xml
@@ -24,24 +24,13 @@
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
- <dependencySets>
- <dependencySet>
- <useProjectArtifact>true</useProjectArtifact>
- <outputDirectory>${file.separator}lib</outputDirectory>
- <unpack>false</unpack>
- <scope>runtime</scope>
- <includes>
- <include>*:jar</include>
- </includes>
- </dependencySet>
- </dependencySets>
<fileSets>
<fileSet>
<directory>${project.basedir}/src/main/resources/etc
</directory>
<includes>
- <include>*.json</include>
<include>*.xml</include>
+ <include>*.yaml</include>
</includes>
<outputDirectory>${file.separator}etc</outputDirectory>
<lineEnding>unix</lineEnding>
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.json b/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.json
deleted file mode 100644
index a6a3ff0f8..000000000
--- a/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.json
+++ /dev/null
@@ -1,53 +0,0 @@
-{
- "name": "ControlLoopRuntimeGroup",
- "restServerParameters": {
- "host": "0.0.0.0",
- "port": 6969,
- "userName": "healthcheck",
- "password": "zb!XztG34",
- "https": false,
- "aaf": false
- },
- "participantParameters": {
- "heartBeatMs": 120000,
- "updateParameters": {
- "maxRetryCount": 1,
- "maxWaitMs": 30000
- },
- "stateChangeParameters": {
- "maxRetryCount": 1,
- "maxWaitMs": 30000
- }
- },
- "databaseProviderParameters": {
- "name": "PolicyProviderParameterGroup",
- "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
- "databaseDriver": "org.mariadb.jdbc.Driver",
- "databaseUrl": "jdbc:mariadb://mariadb:3306/controlloop",
- "databaseUser": "policy",
- "databasePassword": "P01icY",
- "persistenceUnit": "CommissioningMariaDb"
- },
- "topicParameterGroup": {
- "topicSources": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [ "message-router" ],
- "topicCommInfrastructure": "dmaap",
- "fetchTimeout": 15000
- }
- ],
- "topicSinks": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [ "message-router" ],
- "topicCommInfrastructure": "dmaap"
- },
- {
- "topic": "POLICY-NOTIFICATION",
- "servers": [ "message-router" ],
- "topicCommInfrastructure": "dmaap"
- }
- ]
- }
-}
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml
new file mode 100644
index 000000000..3970d15f1
--- /dev/null
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml
@@ -0,0 +1,54 @@
+spring:
+ security:
+ user:
+ name: healthcheck
+ password: zb!XztG34
+ http:
+ converters:
+ preferred-json-mapper: gson
+
+security:
+ enable-csrf: false
+
+server:
+ port: 6969
+ servlet:
+ context-path: /onap/controlloop
+ error:
+ path: /error
+
+
+runtime:
+ supervisionScannerIntervalSec: 1000
+ participantClUpdateIntervalSec: 1000
+ participantClStateChangeIntervalSec: 1000
+ participantParameters:
+ heartBeatMs: 120000
+ updateParameters:
+ maxRetryCount: 1
+ maxWaitMs: 30000
+ stateChangeParameters:
+ maxRetryCount: 1
+ maxWaitMs: 30000
+ databaseProviderParameters:
+ name: PolicyProviderParameterGroup
+ implementation: org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl
+ databaseDriver: org.mariadb.jdbc.Driver
+ databaseUrl: jdbc:mariadb://${mariadb.host:mariadb}:${mariadb.port:3306}/controlloop
+ databaseUser: policy
+ databasePassword: P01icY
+ persistenceUnit: CommissioningMariaDb
+ topicParameterGroup:
+ topicSources:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/DcaeParticipantParameters.json b/packages/policy-clamp-tarball/src/main/resources/etc/DcaeParticipantParameters.json
deleted file mode 100644
index f3ff62325..000000000
--- a/packages/policy-clamp-tarball/src/main/resources/etc/DcaeParticipantParameters.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "name": "ControlLoopParticipantDcae",
- "clampClientParameters": {
- "clientName": "Clamp",
- "hostname": "0.0.0.0",
- "port": 8443,
- "userName": "admin",
- "password": "password",
- "useHttps": true,
- "allowSelfSignedCerts": false
- },
- "consulClientParameters": {
- "clientName": "Consul",
- "hostname": "consul",
- "port": 31321,
- "userName": "admin",
- "password": "password",
- "useHttps": false
- },
- "intermediaryParameters": {
- "name": "Participant parameters",
- "reportingTimeInterval": 120000,
- "description": "Participant Description",
- "participantId": {
- "name": "DCAEParticipant0",
- "version": "1.0.0"
- },
- "participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
- "version": "2.3.4"
- },
- "clampControlLoopTopics": {
- "topicSources": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "message-router"
- ],
- "topicCommInfrastructure": "dmaap",
- "fetchTimeout": 15000
- }
- ],
- "topicSinks": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "message-router"
- ],
- "topicCommInfrastructure": "dmaap"
- },
- {
- "topic": "POLICY-NOTIFICATION",
- "servers": [
- "message-router"
- ],
- "topicCommInfrastructure": "dmaap"
- }
- ]
- }
- },
- "databaseProviderParameters": {
- "name": "PolicyProviderParameterGroup",
- "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
- "databaseDriver": "org.mariadb.jdbc.Driver",
- "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin",
- "databaseUser": "policy_user",
- "databasePassword": "policy_user",
- "persistenceUnit": "PolicyMariaDb"
- }
-}
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/DcaeParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/DcaeParticipantParameters.yaml
new file mode 100644
index 000000000..5eedb9db4
--- /dev/null
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/DcaeParticipantParameters.yaml
@@ -0,0 +1,55 @@
+
+participant:
+ name: ControlLoopParticipantDcae
+ clampClientEndPoints:
+ status: /restservices/clds/v2/loop/getstatus/
+ create: /restservices/clds/v2/loop/create/%s?templateName=%s
+ deploy: /restservices/clds/v2/loop/deploy/
+ stop: /restservices/clds/v2/loop/stop/
+ delete: /restservices/clds/v2/loop/delete/
+ undeploy: /restservices/clds/v2/loop/undeploy/
+ clampClientParameters:
+ clientName: Clamp
+ hostname: 0.0.0.0
+ port: 8443
+ userName: admin
+ password: password
+ https: true
+ aaf: false
+ consulClientEndPoints:
+ deploy: "/v1/kv/dcae-pmsh:"
+ consulClientParameters:
+ clientName: Consul
+ hostname: consul
+ port: 31321
+ userName: admin
+ password: password
+ https: false
+ aaf: false
+ intermediaryParameters:
+ name: Participant parameters
+ reportingTimeIntervalMs: 120000
+ description: Participant Description
+ participantId:
+ name: DCAEParticipant0
+ version: 1.0.0
+ participantType:
+ name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ version: 2.3.4
+ clampControlLoopTopics:
+ topicSources:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
+ checkCount: 10
+ secCount: 10
+ jsonBodyConsulPath: src/main/resources/parameters/consul.json
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
new file mode 100644
index 000000000..d91cc7394
--- /dev/null
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
@@ -0,0 +1,54 @@
+spring:
+ security:
+ user:
+ name: healthcheck
+ password: zb!XztG34
+security:
+ enable-csrf: false
+
+participant:
+ localChartDirectory: /var/helm-manager/local-charts
+ infoFileName: CHART_INFO.json
+ intermediaryParameters:
+ reportingTimeIntervalMs: 120000
+ description: Participant Description
+ participantId:
+ name: K8sParticipant0
+ version: 1.0.0
+ participantType:
+ name: org.onap.k8s.controlloop.K8SControlLoopParticipant
+ version: 2.3.4
+ clampControlLoopTopics:
+ topicSources:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
+
+management:
+ endpoints:
+ web:
+ exposure:
+ include: "loggers,logfile,health,info,metrics,threaddump,heapdump"
+server:
+ # Configuration of the HTTP/REST server. The parameters are defined and handled by the springboot framework.
+ # See springboot documentation.
+ port: 8083
+
+logging:
+ # Configuration of logging
+ level:
+ ROOT: INFO
+ org.springframework: ERROR
+ org.springframework.data: ERROR
+ org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
+ file:
+ name: /var/log/helm-manager/application.log
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.json b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.json
deleted file mode 100644
index e2eb067d9..000000000
--- a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "name":"ParticipantParameterGroup",
- "participantStatusParameters":{
- "timeIntervalMs":10000,
- "description":"Participant Status",
- "participantId":{
- "name": "PolicyParticipant0",
- "version":"1.0.0"
- },
- "participantType":{
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version":"2.3.1"
- },
- "participantDefinition":{
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version":"2.3.1"
- }
- },
- "intermediaryParameters": {
- "name": "Participant parameters",
- "reportingTimeInterval": 120000,
- "description": "Participant Description",
- "participantId": {
- "name": "PolicyParticipant0",
- "version": "1.0.0"
- },
- "participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- },
- "clampControlLoopTopics": {
- "topicSources": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "message-router"
- ],
- "topicCommInfrastructure": "dmaap",
- "fetchTimeout": 15000
- }
- ],
- "topicSinks": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "message-router"
- ],
- "topicCommInfrastructure": "dmaap"
- },
- {
- "topic": "POLICY-NOTIFICATION",
- "servers": [
- "message-router"
- ],
- "topicCommInfrastructure": "dmaap"
- },
- {
- "topic": "POLICY-NOTIFICATION",
- "servers": [
- "message-router"
- ],
- "topicCommInfrastructure": "dmaap"
- }
- ]
- }
- },
- "databaseProviderParameters": {
- "name": "PolicyProviderParameterGroup",
- "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
- "databaseDriver": "org.mariadb.jdbc.Driver",
- "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin",
- "databaseUser": "policy_user",
- "databasePassword": "policy_user",
- "persistenceUnit": "PolicyMariaDb"
- }
-}
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
new file mode 100644
index 000000000..1ea5d68c0
--- /dev/null
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
@@ -0,0 +1,33 @@
+
+participant:
+ policyApiParameters:
+ clientName: api
+ hostname: policy-api
+ port: 6969
+ userName: healthcheck
+ password: zb!XztG34
+ https: true
+ allowSelfSignedCerts: true
+ intermediaryParameters:
+ reportingTimeIntervalMs: 120000
+ description: Participant Description
+ participantId:
+ name: org.onap.PM_Policy
+ version: 1.0.0
+ participantType:
+ name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ version: 2.3.1
+ clampControlLoopTopics:
+ topicSources:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml
index 115170e2c..a873f76b3 100644
--- a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml
@@ -1,3 +1,5 @@
+server:
+ port: 8081
participant:
name: ControlLoopParticipantDcae
@@ -37,15 +39,19 @@ participant:
name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
version: 2.3.4
clampControlLoopTopics:
- topicSources[0]:
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers[0]: ${topicServer:message-router}
- topicCommInfrastructure: dmaap
- fetchTimeout: 15000
- topicSinks[0]:
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers[0]: ${topicServer:message-router}
- topicCommInfrastructure: dmaap
+ topicSources:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:localhost}
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:localhost}
+ topicCommInfrastructure: dmaap
checkCount: 10
secCount: 10
jsonBodyConsulPath: src/main/resources/parameters/consul.json
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/ParticipantDcaeTest.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/ParticipantDcaeTest.java
index 603d81860..a3fcfdd9e 100644
--- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/ParticipantDcaeTest.java
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/ParticipantDcaeTest.java
@@ -32,8 +32,8 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockserver.integration.ClientAndServer;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
+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.ParticipantControlLoopStateChange;
import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.CommonTestData;
import org.onap.policy.clamp.controlloop.participant.dcae.main.rest.TestListenerUtils;
import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopStateChangeListener;
@@ -103,23 +103,23 @@ class ParticipantDcaeTest {
}
@Test
- void testParticipantControlLoopStateChangeMessageListener() {
- ParticipantControlLoopStateChange participantControlLoopStateChangeMsg =
+ void testControlLoopStateChangeMessageListener() {
+ ControlLoopStateChange controlLoopStateChangeMsg =
TestListenerUtils.createControlLoopStateChangeMsg(ControlLoopOrderedState.UNINITIALISED);
- participantControlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.PASSIVE);
+ controlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.PASSIVE);
ControlLoopStateChangeListener clStateChangeListener = new ControlLoopStateChangeListener(participantHandler);
- clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopStateChangeMsg);
- assertEquals(ControlLoopOrderedState.PASSIVE, participantControlLoopStateChangeMsg.getOrderedState());
+ clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, controlLoopStateChangeMsg);
+ assertEquals(ControlLoopOrderedState.PASSIVE, controlLoopStateChangeMsg.getOrderedState());
- participantControlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.RUNNING);
- clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopStateChangeMsg);
- assertEquals(ControlLoopOrderedState.RUNNING, participantControlLoopStateChangeMsg.getOrderedState());
+ controlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.RUNNING);
+ clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, controlLoopStateChangeMsg);
+ assertEquals(ControlLoopOrderedState.RUNNING, controlLoopStateChangeMsg.getOrderedState());
- participantControlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.RUNNING);
- clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopStateChangeMsg);
- assertEquals(ControlLoopOrderedState.RUNNING, participantControlLoopStateChangeMsg.getOrderedState());
+ controlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.RUNNING);
+ clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, controlLoopStateChangeMsg);
+ assertEquals(ControlLoopOrderedState.RUNNING, controlLoopStateChangeMsg.getOrderedState());
}
@Test
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java
index 7f8eb0937..ddcc05ca4 100644
--- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java
@@ -30,10 +30,9 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
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.ParticipantState;
+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.ParticipantControlLoopStateChange;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -88,35 +87,15 @@ public class TestListenerUtils {
}
/**
- * Method to create ParticipantStateChange message from the arguments passed.
- *
- * @param participantState participant State
- *
- * @return ParticipantStateChange message
- */
- public static ParticipantStateChange createParticipantStateChangeMsg(final ParticipantState participantState) {
- final ParticipantStateChange participantStateChangeMsg = new ParticipantStateChange();
- ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
- participantId.setName("DCAEParticipant0");
- participantId.setVersion("1.0.0");
-
- participantStateChangeMsg.setParticipantId(participantId);
- participantStateChangeMsg.setTimestamp(Instant.now());
- participantStateChangeMsg.setState(participantState);
-
- return participantStateChangeMsg;
- }
-
- /**
* Method to create ControlLoopStateChange message from the arguments passed.
*
* @param controlLoopOrderedState controlLoopOrderedState
*
- * @return ParticipantControlLoopStateChange message
+ * @return ControlLoopStateChange message
*/
- public static ParticipantControlLoopStateChange createControlLoopStateChangeMsg(
+ public static ControlLoopStateChange createControlLoopStateChangeMsg(
final ControlLoopOrderedState controlLoopOrderedState) {
- final ParticipantControlLoopStateChange participantClStateChangeMsg = new ParticipantControlLoopStateChange();
+ final ControlLoopStateChange clStateChangeMsg = new ControlLoopStateChange();
ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier();
controlLoopId.setName("PMSHInstance0");
@@ -126,12 +105,12 @@ public class TestListenerUtils {
participantId.setName("DCAEParticipant0");
participantId.setVersion("1.0.0");
- participantClStateChangeMsg.setControlLoopId(controlLoopId);
- participantClStateChangeMsg.setParticipantId(participantId);
- participantClStateChangeMsg.setTimestamp(Instant.now());
- participantClStateChangeMsg.setOrderedState(controlLoopOrderedState);
+ clStateChangeMsg.setControlLoopId(controlLoopId);
+ clStateChangeMsg.setParticipantId(participantId);
+ clStateChangeMsg.setTimestamp(Instant.now());
+ clStateChangeMsg.setOrderedState(controlLoopOrderedState);
- return participantClStateChangeMsg;
+ return clStateChangeMsg;
}
/**
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml
index 68a1afd1a..a27c33d44 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml
@@ -19,15 +19,19 @@ participant:
name: org.onap.k8s.controlloop.K8SControlLoopParticipant
version: 2.3.4
clampControlLoopTopics:
- topicSources[0]:
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers[0]: ${topicServer:message-router}
- topicCommInfrastructure: dmaap
- fetchTimeout: 15000
- topicSinks[0]:
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers[0]: ${topicServer:message-router}
- topicCommInfrastructure: dmaap
+ topicSources:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:localhost}
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:localhost}
+ topicCommInfrastructure: dmaap
management:
endpoints:
diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
index ef158ce97..32cd28cd3 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
@@ -1,3 +1,5 @@
+server:
+ port: 8082
participant:
policyApiParameters:
@@ -18,12 +20,16 @@ participant:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.3.1
clampControlLoopTopics:
- topicSources[0]:
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers[0]: ${topicServer:message-router}
- topicCommInfrastructure: dmaap
- fetchTimeout: 15000
- topicSinks[0]:
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers[0]: ${topicServer:message-router}
- topicCommInfrastructure: dmaap
+ topicSources:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:localhost}
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:localhost}
+ topicCommInfrastructure: dmaap
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java
index a66252d2b..c0bd89696 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java
@@ -26,8 +26,8 @@ import static org.junit.Assert.assertNotNull;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
+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.ParticipantControlLoopStateChange;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopStateChangeListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopUpdateListener;
@@ -112,10 +112,10 @@ class ParticipantPolicyTest {
assertEquals("org.onap.PM_Policy", participantHandler.getParticipantId().getName());
ControlLoopStateChangeListener clStateChangeListener = new ControlLoopStateChangeListener(participantHandler);
- ParticipantControlLoopStateChange participantControlLoopStateChangeMsg =
+ ControlLoopStateChange controlLoopStateChangeMsg =
TestListenerUtils.createControlLoopStateChangeMsg(ControlLoopOrderedState.UNINITIALISED);
- participantControlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopStateChangeMsg);
+ controlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
+ clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, controlLoopStateChangeMsg);
// Verify the result of GET participants with what is stored
assertEquals("org.onap.PM_Policy", participantHandler.getParticipantId().getName());
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
index 6b1b7e30f..6f1e00143 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
@@ -35,10 +35,9 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
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.ParticipantState;
+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.ParticipantControlLoopStateChange;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.CommonTestData;
import org.onap.policy.common.utils.coder.Coder;
@@ -100,35 +99,15 @@ public class TestListenerUtils {
}
/**
- * Method to create ParticipantStateChange message from the arguments passed.
- *
- * @param participantState participant State
- *
- * @return ParticipantStateChange message
- */
- public static ParticipantStateChange createParticipantStateChangeMsg(final ParticipantState participantState) {
- final ParticipantStateChange participantStateChangeMsg = new ParticipantStateChange();
- ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
- participantId.setName("org.onap.PM_Policy");
- participantId.setVersion("0.0.0");
-
- participantStateChangeMsg.setParticipantId(participantId);
- participantStateChangeMsg.setTimestamp(Instant.now());
- participantStateChangeMsg.setState(participantState);
-
- return participantStateChangeMsg;
- }
-
- /**
* Method to create ControlLoopStateChange message from the arguments passed.
*
* @param controlLoopOrderedState controlLoopOrderedState
*
- * @return ParticipantControlLoopStateChange message
+ * @return ControlLoopStateChange message
*/
- public static ParticipantControlLoopStateChange createControlLoopStateChangeMsg(
+ public static ControlLoopStateChange createControlLoopStateChangeMsg(
final ControlLoopOrderedState controlLoopOrderedState) {
- final ParticipantControlLoopStateChange participantClStateChangeMsg = new ParticipantControlLoopStateChange();
+ final ControlLoopStateChange clStateChangeMsg = new ControlLoopStateChange();
ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier();
controlLoopId.setName("PMSHInstance0");
@@ -138,12 +117,12 @@ public class TestListenerUtils {
participantId.setName("org.onap.PM_Policy");
participantId.setVersion("0.0.0");
- participantClStateChangeMsg.setControlLoopId(controlLoopId);
- participantClStateChangeMsg.setParticipantId(participantId);
- participantClStateChangeMsg.setTimestamp(Instant.now());
- participantClStateChangeMsg.setOrderedState(controlLoopOrderedState);
+ clStateChangeMsg.setControlLoopId(controlLoopId);
+ clStateChangeMsg.setParticipantId(participantId);
+ clStateChangeMsg.setTimestamp(Instant.now());
+ clStateChangeMsg.setOrderedState(controlLoopOrderedState);
- return participantClStateChangeMsg;
+ return clStateChangeMsg;
}
/**
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
index 917c50db4..c26749b4d 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
@@ -5,7 +5,7 @@ spring:
password: zb!XztG34
server:
- port: 6969
+ port: 8084
servlet:
context-path: /onap/participantsim
error:
@@ -22,12 +22,16 @@ participant:
name: org.onap.PM_CDS_Blueprint
version: 1.0.0
clampControlLoopTopics:
- topicSources[0]:
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers[0]: ${topicServer:message-router}
- topicCommInfrastructure: dmaap
- fetchTimeout: 15000
- topicSinks[0]:
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers[0]: ${topicServer:message-router}
- topicCommInfrastructure: dmaap
+ topicSources:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:localhost}
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:localhost}
+ topicCommInfrastructure: dmaap
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java
index 2c0c450ed..81af821d6 100644
--- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java
@@ -34,9 +34,8 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
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.ParticipantState;
+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.ParticipantControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.CommonTestData;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
@@ -98,43 +97,25 @@ public class TestListenerUtils {
}
/**
- * Method to create ParticipantStateChange message from the arguments passed.
- *
- * @param participantState participant State
- *
- * @return ParticipantStateChange message
- */
- public static ParticipantStateChange createParticipantStateChangeMsg(final ParticipantState participantState) {
- final ParticipantStateChange participantStateChangeMsg = new ParticipantStateChange();
- ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_CDS_Blueprint", "1.0.0");
-
- participantStateChangeMsg.setParticipantId(participantId);
- participantStateChangeMsg.setTimestamp(Instant.now());
- participantStateChangeMsg.setState(participantState);
-
- return participantStateChangeMsg;
- }
-
- /**
* Method to create ControlLoopStateChange message from the arguments passed.
*
* @param controlLoopOrderedState controlLoopOrderedState
*
- * @return ParticipantControlLoopStateChange message
+ * @return ControlLoopStateChange message
*/
- public static ParticipantControlLoopStateChange createControlLoopStateChangeMsg(
+ public static ControlLoopStateChange createControlLoopStateChangeMsg(
final ControlLoopOrderedState controlLoopOrderedState) {
- final ParticipantControlLoopStateChange participantClStateChangeMsg = new ParticipantControlLoopStateChange();
+ final ControlLoopStateChange clStateChangeMsg = new ControlLoopStateChange();
ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_CDS_Blueprint", "1.0.0");
- participantClStateChangeMsg.setControlLoopId(controlLoopId);
- participantClStateChangeMsg.setParticipantId(participantId);
- participantClStateChangeMsg.setTimestamp(Instant.now());
- participantClStateChangeMsg.setOrderedState(controlLoopOrderedState);
+ clStateChangeMsg.setControlLoopId(controlLoopId);
+ clStateChangeMsg.setParticipantId(participantId);
+ clStateChangeMsg.setTimestamp(Instant.now());
+ clStateChangeMsg.setOrderedState(controlLoopOrderedState);
- return participantClStateChangeMsg;
+ return clStateChangeMsg;
}
/**
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/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java
index e46c6db1b..0b9110bd0 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/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java
@@ -20,7 +20,7 @@
package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
import org.springframework.stereotype.Component;
@@ -28,7 +28,7 @@ import org.springframework.stereotype.Component;
* Listener for Participant State Change messages sent by CLAMP.
*/
@Component
-public class ControlLoopStateChangeListener extends ParticipantListener<ParticipantControlLoopStateChange> {
+public class ControlLoopStateChangeListener extends ParticipantListener<ControlLoopStateChange> {
/**
* Constructs the object.
@@ -36,7 +36,7 @@ public class ControlLoopStateChangeListener extends ParticipantListener<Particip
* @param participantHandler the handler for managing the state of the participant
*/
public ControlLoopStateChangeListener(final ParticipantHandler participantHandler) {
- super(ParticipantControlLoopStateChange.class, participantHandler,
+ super(ControlLoopStateChange.class, participantHandler,
participantHandler::handleControlLoopStateChange);
}
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java
deleted file mode 100644
index ec6548a7c..000000000
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java
+++ /dev/null
@@ -1,42 +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.comm;
-
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
-import org.springframework.stereotype.Component;
-
-/**
- * Listener for Participant State Change messages sent by CLAMP.
- *
- */
-@Component
-public class ParticipantStateChangeListener extends ParticipantListener<ParticipantStateChange> {
-
- /**
- * Constructs the object.
- *
- * @param participantHandler the handler for managing the state of the participant
- */
- public ParticipantStateChangeListener(final ParticipantHandler participantHandler) {
- super(ParticipantStateChange.class, participantHandler, participantHandler::handleParticipantStateChange);
- }
-}
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
index 7ef9fa18c..e1a7e7fdf 100644
--- 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
@@ -34,8 +34,8 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
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.ControlLoopStateChange;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseDetails;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseStatus;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
@@ -130,7 +130,7 @@ public class ControlLoopHandler {
*
* @param stateChangeMsg the state change message
*/
- public void handleControlLoopStateChange(ParticipantControlLoopStateChange stateChangeMsg) {
+ public void handleControlLoopStateChange(ControlLoopStateChange stateChangeMsg) {
if (stateChangeMsg.getControlLoopId() == null) {
return;
}
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/controlloop/participant/intermediary/handler/IntermediaryActivator.java
index 38674896b..f846b2d75 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/controlloop/participant/intermediary/handler/IntermediaryActivator.java
@@ -30,7 +30,6 @@ import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLo
import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantDeregisterAckListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantHealthCheckListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantRegisterAckListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStateChangeListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantUpdateListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
@@ -120,13 +119,10 @@ public class IntermediaryActivator extends ServiceManagerContainer implements Cl
private void registerMsgDispatcher() {
MessageTypeDispatcher msgDispatcher = applicationContext.getBean(MessageTypeDispatcher.class);
- msgDispatcher.register(ParticipantMessageType.PARTICIPANT_STATE_CHANGE.name(),
- applicationContext.getBean(ParticipantStateChangeListener.class));
-
msgDispatcher.register(ParticipantMessageType.PARTICIPANT_HEALTH_CHECK.name(),
applicationContext.getBean(ParticipantHealthCheckListener.class));
- msgDispatcher.register(ParticipantMessageType.PARTICIPANT_CONTROL_LOOP_STATE_CHANGE.name(),
+ msgDispatcher.register(ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE.name(),
applicationContext.getBean(ControlLoopStateChangeListener.class));
msgDispatcher.register(ParticipantMessageType.CONTROL_LOOP_UPDATE.name(),
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/controlloop/participant/intermediary/handler/ParticipantHandler.java
index 4842c3edd..ed1da5819 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/controlloop/participant/intermediary/handler/ParticipantHandler.java
@@ -32,8 +32,8 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.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.ParticipantControlLoopStateChange;
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.ParticipantHealthCheck;
@@ -42,7 +42,6 @@ import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.Parti
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseDetails;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseStatus;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
@@ -98,46 +97,6 @@ public class ParticipantHandler implements Closeable {
}
/**
- * Method which handles a participant state change event from clamp.
- *
- * @param stateChangeMsg participant state change message
- */
- public void handleParticipantStateChange(final ParticipantStateChange stateChangeMsg) {
-
- if (!stateChangeMsg.appliesTo(participantType, participantId)) {
- return;
- }
-
- var response = new ParticipantResponseDetails(stateChangeMsg);
-
- switch (stateChangeMsg.getState()) {
- case PASSIVE:
- handlePassiveState(response);
- break;
- case ACTIVE:
- handleActiveState(response);
- break;
- case SAFE:
- handleSafeState(response);
- break;
- case TEST:
- handleTestState(response);
- break;
- case TERMINATED:
- handleTerminatedState(response);
- break;
- default:
- LOGGER.debug("StateChange message has no state, state is null {}", stateChangeMsg.getParticipantId());
- response.setResponseStatus(ParticipantResponseStatus.FAIL);
- response.setResponseMessage(
- "StateChange message has invalid state for participantId " + stateChangeMsg.getParticipantId());
- break;
- }
-
- sender.sendResponse(response);
- }
-
- /**
* Method which handles a participant health check event from clamp.
*
* @param healthCheckMsg participant health check message
@@ -164,55 +123,10 @@ public class ParticipantHandler implements Closeable {
*
* @param stateChangeMsg the state change message
*/
- public void handleControlLoopStateChange(ParticipantControlLoopStateChange stateChangeMsg) {
+ public void handleControlLoopStateChange(ControlLoopStateChange stateChangeMsg) {
controlLoopHandler.handleControlLoopStateChange(stateChangeMsg);
}
- /**
- * Method to handle when the new state from participant is active.
- *
- * @param response participant response
- */
- private void handleActiveState(final ParticipantResponseDetails response) {
- handleStateChange(ParticipantState.ACTIVE, response);
- }
-
- /**
- * Method to handle when the new state from participant is passive.
- *
- * @param response participant response
- */
- private void handlePassiveState(final ParticipantResponseDetails response) {
- handleStateChange(ParticipantState.PASSIVE, response);
- }
-
- /**
- * Method to handle when the new state from participant is safe.
- *
- * @param response participant response
- */
- private void handleSafeState(final ParticipantResponseDetails response) {
- handleStateChange(ParticipantState.SAFE, response);
- }
-
- /**
- * Method to handle when the new state from participant is TEST.
- *
- * @param response participant response
- */
- private void handleTestState(final ParticipantResponseDetails response) {
- handleStateChange(ParticipantState.TEST, response);
- }
-
- /**
- * Method to handle when the new state from participant is Terminated.
- *
- * @param response participant response
- */
- private void handleTerminatedState(final ParticipantResponseDetails response) {
- handleStateChange(ParticipantState.TERMINATED, response);
- }
-
private void handleStateChange(ParticipantState newParticipantState, ParticipantResponseDetails response) {
if (state.equals(newParticipantState)) {
response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
diff --git a/runtime-controlloop/pom.xml b/runtime-controlloop/pom.xml
index e436451ff..508f44a80 100644
--- a/runtime-controlloop/pom.xml
+++ b/runtime-controlloop/pom.xml
@@ -67,6 +67,11 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-aop</artifactId>
+ <version>${version.springboot}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java
index 28814b354..5fbd36c06 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java
@@ -24,7 +24,9 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.context.annotation.ComponentScan;
+import org.springframework.scheduling.annotation.EnableScheduling;
+@EnableScheduling
@SpringBootApplication
@ComponentScan({"org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider",
"org.onap.policy.clamp.controlloop.runtime"})
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterGroup.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterGroup.java
index f46b90294..86473caa8 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterGroup.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterGroup.java
@@ -57,9 +57,6 @@ public class ClRuntimeParameterGroup {
private long supervisionScannerIntervalSec;
@Min(value = 0)
- private long participantStateChangeIntervalSec;
-
- @Min(value = 0)
private long participantClUpdateIntervalSec;
@Min(value = 0)
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantParameters.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantParameters.java
index a4e84af0d..47a99ca29 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantParameters.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantParameters.java
@@ -49,9 +49,4 @@ public class ParticipantParameters {
@Valid
@NotNull
private ParticipantUpdateParameters updateParameters;
-
- @Valid
- @NotNull
- private ParticipantStateChangeParameters stateChangeParameters;
-
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantStateChangeParameters.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantStateChangeParameters.java
deleted file mode 100644
index a3e2eee2e..000000000
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantStateChangeParameters.java
+++ /dev/null
@@ -1,46 +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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.runtime.main.parameters;
-
-import javax.validation.constraints.Min;
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.validation.annotation.Validated;
-
-/**
- * Parameters for Participant STATE-CHANGE requests.
- */
-@Getter
-@Setter
-@Validated
-public class ParticipantStateChangeParameters {
-
- /**
- * Maximum number of times to re-send a request to a PDP.
- */
- @Min(value = 0)
- private int maxRetryCount;
-
- /**
- * Maximum time to wait, in milliseconds, for a PDP response.
- */
- @Min(value = 0)
- private long maxWaitMs;
-
-}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/CommissioningController.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/CommissioningController.java
index cc4ce16f7..8fe3c0c88 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/CommissioningController.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/CommissioningController.java
@@ -62,6 +62,8 @@ public class CommissioningController extends AbstractRestController {
private static final Logger LOGGER = LoggerFactory.getLogger(CommissioningController.class);
+ private static final String TAGS = "Clamp Control Loop Commissioning API";
+
private final CommissioningProvider provider;
/**
@@ -88,7 +90,7 @@ public class CommissioningController extends AbstractRestController {
value = "Commissions control loop definitions",
notes = "Commissions control loop definitions, returning the commissioned control loop definition IDs",
response = CommissioningResponse.class,
- tags = {"Control Loop Commissioning API"},
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -158,7 +160,7 @@ public class CommissioningController extends AbstractRestController {
@ApiOperation(value = "Delete a commissioned control loop",
notes = "Deletes a Commissioned Control Loop, returning optional error details",
response = CommissioningResponse.class,
- tags = {"Clamp Control Loop Commissioning API"},
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -233,7 +235,7 @@ public class CommissioningController extends AbstractRestController {
notes = "Queries details of the requested commissioned control loop definitions, "
+ "returning all control loop details",
response = ToscaNodeTemplate.class,
- tags = {"Clamp Control Loop Commissioning API"},
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -302,7 +304,7 @@ public class CommissioningController extends AbstractRestController {
notes = "Queries details of the requested commissioned tosca service template, "
+ "returning all tosca service template details",
response = ToscaServiceTemplate.class,
- tags = {"Clamp Control Loop Commissioning API"},
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -379,7 +381,7 @@ public class CommissioningController extends AbstractRestController {
notes = "Queries details of the requested commissioned tosca service template json schema, "
+ "returning all tosca service template json schema details",
response = ToscaServiceTemplate.class,
- tags = {"Clamp Control Loop Commissioning API"},
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -521,7 +523,7 @@ public class CommissioningController extends AbstractRestController {
notes = "Queries details of the requested commissioned control loop element definitions, "
+ "returning all control loop elements' details",
response = ToscaNodeTemplate.class,
- tags = {"Clamp Control Loop Commissioning API"},
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java
index aba585e29..5a320e8dc 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java
@@ -59,6 +59,8 @@ public class InstantiationController extends AbstractRestController {
private static final Logger LOGGER = LoggerFactory.getLogger(InstantiationController.class);
+ private static final String TAGS = "Clamp Control Loop Instantiation API";
+
// The CL provider for instantiation requests
private final ControlLoopInstantiationProvider provider;
@@ -86,7 +88,7 @@ public class InstantiationController extends AbstractRestController {
value = "Commissions control loop definitions",
notes = "Commissions control loop definitions, returning the control loop IDs",
response = InstantiationResponse.class,
- tags = {"Control Loop Instantiation API"},
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -154,9 +156,7 @@ public class InstantiationController extends AbstractRestController {
@ApiOperation(value = "Query details of the requested control loops",
notes = "Queries details of the requested control loops, returning all control loop details",
response = ControlLoops.class,
- tags = {
- "Clamp control loop Instantiation API"
- },
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -220,9 +220,7 @@ public class InstantiationController extends AbstractRestController {
value = "Updates control loop definitions",
notes = "Updates control loop definitions, returning the updated control loop definition IDs",
response = InstantiationResponse.class,
- tags = {
- "Control Loop Instantiation API"
- },
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -290,9 +288,7 @@ public class InstantiationController extends AbstractRestController {
@ApiOperation(value = "Delete a control loop",
notes = "Deletes a control loop, returning optional error details",
response = InstantiationResponse.class,
- tags = {
- "Clamp Control Loop Instantiation API"
- },
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -362,9 +358,7 @@ public class InstantiationController extends AbstractRestController {
@ApiOperation(value = "Issue a command to the requested control loops",
notes = "Issues a command to a control loop, ordering a state change on the control loop",
response = InstantiationResponse.class,
- tags = {
- "Clamp Control Loop Instantiation API"
- },
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/MonitoringQueryController.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/MonitoringQueryController.java
index 86531597a..7ac95003e 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/MonitoringQueryController.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/MonitoringQueryController.java
@@ -52,6 +52,7 @@ import org.springframework.web.bind.annotation.RestController;
public class MonitoringQueryController extends AbstractRestController {
private static final Logger LOGGER = LoggerFactory.getLogger(MonitoringQueryController.class);
+ private static final String TAGS = "Clamp Control Loop Monitoring API";
private final MonitoringProvider provider;
/**
@@ -80,9 +81,7 @@ public class MonitoringQueryController extends AbstractRestController {
@ApiOperation(value = "Query details of the requested participant stats",
notes = "Queries details of the requested participant stats, returning all participant stats",
response = ParticipantStatisticsList.class,
- tags = {
- "Clamp control loop Monitoring API"
- },
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -168,9 +167,7 @@ public class MonitoringQueryController extends AbstractRestController {
@ApiOperation(value = "Query details of all the participant stats in a control loop",
notes = "Queries details of the participant stats, returning all participant stats",
response = ClElementStatisticsList.class,
- tags = {
- "Clamp control loop Monitoring API"
- },
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -235,9 +232,7 @@ public class MonitoringQueryController extends AbstractRestController {
@ApiOperation(value = "Query details of the requested cl element stats in a control loop",
notes = "Queries details of the requested cl element stats, returning all clElement stats",
response = ClElementStatisticsList.class,
- tags = {
- "Clamp control loop Monitoring API"
- },
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -306,9 +301,7 @@ public class MonitoringQueryController extends AbstractRestController {
@ApiOperation(value = "Query details of the requested cl element stats",
notes = "Queries details of the requested cl element stats, returning all clElement stats",
response = ClElementStatisticsList.class,
- tags = {
- "Clamp control loop Monitoring API"
- },
+ tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStateChangePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/MessageIntercept.java
index b63cbdf03..c23ed833d 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStateChangePublisher.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/MessageIntercept.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * 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.
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.controlloop.runtime.supervision;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
-import org.springframework.stereotype.Component;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
-/**
- * This class is used to send ParticipantStateChange messages to participants on DMaaP.
- */
-@Component
-public class ParticipantStateChangePublisher extends AbstractParticipantPublisher<ParticipantStateChange> {
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface MessageIntercept {
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspect.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspect.java
new file mode 100644
index 000000000..293b5d5da
--- /dev/null
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspect.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.controlloop.runtime.supervision;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import lombok.RequiredArgsConstructor;
+import org.aspectj.lang.annotation.After;
+import org.aspectj.lang.annotation.Aspect;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Aspect
+@Component
+@RequiredArgsConstructor
+public class SupervisionAspect implements Closeable {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionAspect.class);
+
+ private final SupervisionScanner supervisionScanner;
+
+ private ThreadPoolExecutor executor =
+ new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>());
+
+ @Scheduled(
+ fixedRateString = "${runtime.participantParameters.heartBeatMs}",
+ initialDelayString = "${runtime.participantParameters.heartBeatMs}")
+ public void schedule() {
+ LOGGER.info("Add scheduled scanning");
+ executor.execute(() -> supervisionScanner.run(true));
+ }
+
+ /**
+ * Intercept Messages from participant and run Supervision Scan.
+ */
+ @After("@annotation(MessageIntercept)")
+ public void doCheck() {
+ if (executor.getQueue().size() < 2) {
+ LOGGER.debug("Add scanning Message");
+ executor.execute(() -> supervisionScanner.run(false));
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ executor.shutdown();
+ }
+}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
index baf0b176d..dadfe0de2 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
@@ -20,46 +20,27 @@
package org.onap.policy.clamp.controlloop.runtime.supervision;
-import java.time.Instant;
-import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
-import java.util.UUID;
import javax.ws.rs.core.Response;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
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.ParticipantMessageType;
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.ParticipantUpdate;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider;
-import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup;
import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringProvider;
+import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopStateChangePublisher;
import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopUpdatePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantControlLoopStateChangePublisher;
import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantDeregisterAckPublisher;
import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantRegisterAckPublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantStateChangePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantStatusListener;
import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher;
-import org.onap.policy.common.endpoints.event.comm.TopicSink;
-import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher;
-import org.onap.policy.common.utils.services.ServiceManager;
-import org.onap.policy.common.utils.services.ServiceManagerException;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.Logger;
@@ -85,11 +66,10 @@ public class SupervisionHandler {
private final ControlLoopProvider controlLoopProvider;
private final ParticipantProvider participantProvider;
private final MonitoringProvider monitoringProvider;
- private final CommissioningProvider commissioningProvider;
// Publishers for participant communication
private final ControlLoopUpdatePublisher controlLoopUpdatePublisher;
- private final ParticipantControlLoopStateChangePublisher controlLoopStateChangePublisher;
+ private final ControlLoopStateChangePublisher controlLoopStateChangePublisher;
private final ParticipantRegisterAckPublisher participantRegisterAckPublisher;
private final ParticipantDeregisterAckPublisher participantDeregisterAckPublisher;
private final ParticipantUpdatePublisher participantUpdatePublisher;
@@ -131,6 +111,7 @@ public class SupervisionHandler {
*
* @param participantStatusMessage the ParticipantStatus message received from a participant
*/
+ @MessageIntercept
public void handleParticipantMessage(ParticipantStatus participantStatusMessage) {
LOGGER.debug("Participant Status received {}", participantStatusMessage);
try {
@@ -152,10 +133,14 @@ public class SupervisionHandler {
*
* @param participantRegisterMessage the ParticipantRegister message received from a participant
*/
+ @MessageIntercept
public void handleParticipantMessage(ParticipantRegister participantRegisterMessage) {
LOGGER.debug("Participant Register received {}", participantRegisterMessage);
- sendParticipantAckMessage(participantRegisterMessage);
- sendParticipantUpdate(participantRegisterMessage);
+
+ participantRegisterAckPublisher.send(participantRegisterMessage.getMessageId());
+
+ participantUpdatePublisher.send(participantRegisterMessage.getParticipantId(),
+ participantRegisterMessage.getParticipantType());
}
/**
@@ -163,9 +148,10 @@ public class SupervisionHandler {
*
* @param participantDeregisterMessage the ParticipantDeregister message received from a participant
*/
+ @MessageIntercept
public void handleParticipantMessage(ParticipantDeregister participantDeregisterMessage) {
LOGGER.debug("Participant Deregister received {}", participantDeregisterMessage);
- sendParticipantAckMessage(participantDeregisterMessage);
+ participantDeregisterAckPublisher.send(participantDeregisterMessage.getMessageId());
}
/**
@@ -173,6 +159,7 @@ public class SupervisionHandler {
*
* @param participantUpdateAckMessage the ParticipantUpdateAck message received from a participant
*/
+ @MessageIntercept
public void handleParticipantMessage(ParticipantUpdateAck participantUpdateAckMessage) {
LOGGER.debug("Participant Update Ack received {}", participantUpdateAckMessage);
}
@@ -290,70 +277,6 @@ public class SupervisionHandler {
}
}
- private void sendControlLoopUpdate(ControlLoop controlLoop) throws PfModelException {
- var controlLoopUpdateMsg = new ControlLoopUpdate();
- controlLoopUpdateMsg.setControlLoopId(controlLoop.getKey().asIdentifier());
- controlLoopUpdateMsg.setControlLoop(controlLoop);
- // TODO: We should look up the correct TOSCA node template here for the control loop
- // Tiny hack implemented to return the tosca service template entry from the database and be passed onto dmaap
- controlLoopUpdateMsg.setControlLoopDefinition(commissioningProvider.getToscaServiceTemplate(null, null));
- controlLoopUpdatePublisher.send(controlLoopUpdateMsg);
- }
-
- private void sendControlLoopStateChange(ControlLoop controlLoop) {
- var clsc = new ParticipantControlLoopStateChange();
- clsc.setControlLoopId(controlLoop.getKey().asIdentifier());
- clsc.setMessageId(UUID.randomUUID());
- clsc.setOrderedState(controlLoop.getOrderedState());
- controlLoopStateChangePublisher.send(clsc);
- }
-
- private void sendParticipantUpdate(ParticipantRegister participantRegisterMessage) {
- var message = new ParticipantUpdate();
- message.setParticipantId(participantRegisterMessage.getParticipantId());
- message.setParticipantType(participantRegisterMessage.getParticipantType());
- message.setTimestamp(Instant.now());
-
- ControlLoopElementDefinition clDefinition = new ControlLoopElementDefinition();
- clDefinition.setId(UUID.randomUUID());
-
- try {
- clDefinition.setControlLoopElementToscaServiceTemplate(commissioningProvider
- .getToscaServiceTemplate(null, null));
- } catch (PfModelException pfme) {
- LOGGER.warn("Get of tosca service template failed, cannot send participantupdate", pfme);
- return;
- }
-
- Map<UUID, ControlLoopElementDefinition> controlLoopElementDefinitionMap = new LinkedHashMap<>();
- controlLoopElementDefinitionMap.put(UUID.randomUUID(), clDefinition);
-
- Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>>
- participantDefinitionUpdateMap = new LinkedHashMap<>();
- participantDefinitionUpdateMap.put(participantRegisterMessage.getParticipantId(),
- controlLoopElementDefinitionMap);
- message.setParticipantDefinitionUpdateMap(participantDefinitionUpdateMap);
-
- LOGGER.debug("Participant Update sent", message);
- participantUpdatePublisher.send(message);
- }
-
- private void sendParticipantAckMessage(ParticipantRegister participantRegisterMessage) {
- var message = new ParticipantRegisterAck();
- message.setResponseTo(participantRegisterMessage.getMessageId());
- message.setMessage("Participant Register Ack");
- message.setResult(true);
- participantRegisterAckPublisher.send(message);
- }
-
- private void sendParticipantAckMessage(ParticipantDeregister participantDeregisterMessage) {
- var message = new ParticipantDeregisterAck();
- message.setResponseTo(participantDeregisterMessage.getMessageId());
- message.setMessage("Participant Deregister Ack");
- message.setResult(true);
- participantDeregisterAckPublisher.send(message);
- }
-
private void superviseParticipant(ParticipantStatus participantStatusMessage)
throws PfModelException, ControlLoopException {
if (participantStatusMessage.getParticipantId() == null) {
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java
index 68f5830c0..b360f6703 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java
@@ -20,15 +20,21 @@
package org.onap.policy.clamp.controlloop.runtime.supervision;
-import java.io.Closeable;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import lombok.Getter;
+import lombok.Setter;
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.ControlLoopState;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup;
+import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopStateChangePublisher;
+import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopUpdatePublisher;
import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -37,35 +43,83 @@ import org.springframework.stereotype.Component;
* This class is used to scan the control loops in the database and check if they are in the correct state.
*/
@Component
-public class SupervisionScanner implements Runnable, Closeable {
+public class SupervisionScanner {
private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionScanner.class);
- private ControlLoopProvider controlLoopProvider;
- private ScheduledExecutorService timerPool;
+ @Getter
+ @Setter
+ static class HandleCounter {
+ private int maxRetryCount;
+ private long maxWaitMs;
+ private Map<ToscaConceptIdentifier, Integer> mapCounter = new HashMap<>();
+ private Set<ToscaConceptIdentifier> mapFault = new HashSet<>();
+
+ public void clear(ToscaConceptIdentifier id) {
+ mapCounter.put(id, 0);
+ mapFault.remove(id);
+ }
+
+ public void setFault(ToscaConceptIdentifier id) {
+ mapCounter.put(id, 0);
+ mapFault.add(id);
+ }
+
+ public boolean count(ToscaConceptIdentifier id) {
+ int counter = mapCounter.getOrDefault(id, 0) + 1;
+ if (counter <= maxRetryCount) {
+ mapCounter.put(id, counter);
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isFault(ToscaConceptIdentifier id) {
+ return mapFault.contains(id);
+ }
+
+ public int getCounter(ToscaConceptIdentifier id) {
+ return mapCounter.getOrDefault(id, 0);
+ }
+ }
+
+ private HandleCounter stateChange = new HandleCounter();
+
+ private final ControlLoopProvider controlLoopProvider;
+ private final ControlLoopStateChangePublisher controlLoopStateChangePublisher;
+ private final ControlLoopUpdatePublisher controlLoopUpdatePublisher;
/**
* Constructor for instantiating SupervisionScanner.
*
- * @param clRuntimeParameterGroup the parameters for the control loop runtime
* @param controlLoopProvider the provider to use to read control loops from the database
+ * @param controlLoopStateChangePublisher the ControlLoopStateChange Publisher
+ * @param clRuntimeParameterGroup the parameters for the control loop runtime
*/
public SupervisionScanner(final ControlLoopProvider controlLoopProvider,
- ClRuntimeParameterGroup clRuntimeParameterGroup) {
+ final ControlLoopStateChangePublisher controlLoopStateChangePublisher,
+ ControlLoopUpdatePublisher controlLoopUpdatePublisher,
+ final ClRuntimeParameterGroup clRuntimeParameterGroup) {
this.controlLoopProvider = controlLoopProvider;
+ this.controlLoopStateChangePublisher = controlLoopStateChangePublisher;
+ this.controlLoopUpdatePublisher = controlLoopUpdatePublisher;
- // Kick off the timer
- timerPool = makeTimerPool();
- timerPool.scheduleAtFixedRate(this, 0, clRuntimeParameterGroup.getSupervisionScannerIntervalSec(),
- TimeUnit.SECONDS);
+ stateChange.setMaxRetryCount(
+ clRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
+ stateChange.setMaxWaitMs(
+ clRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxWaitMs());
}
- @Override
- public void run() {
+ /**
+ * Run Scanning.
+ *
+ * @param counterCheck if true activate counter and retry
+ */
+ public void run(boolean counterCheck) {
LOGGER.debug("Scanning control loops in the database . . .");
try {
for (ControlLoop controlLoop : controlLoopProvider.getControlLoops(null, null)) {
- scanControlLoop(controlLoop);
+ scanControlLoop(controlLoop, counterCheck);
}
} catch (PfModelException pfme) {
LOGGER.warn("error reading control loops from database", pfme);
@@ -74,40 +128,65 @@ public class SupervisionScanner implements Runnable, Closeable {
LOGGER.debug("Control loop scan complete . . .");
}
- @Override
- public void close() {
- timerPool.shutdown();
- }
-
- private void scanControlLoop(final ControlLoop controlLoop) throws PfModelException {
+ private void scanControlLoop(final ControlLoop controlLoop, boolean counterCheck) throws PfModelException {
LOGGER.debug("scanning control loop {} . . .", controlLoop.getKey().asIdentifier());
if (controlLoop.getState().equals(controlLoop.getOrderedState().asState())) {
LOGGER.debug("control loop {} scanned, OK", controlLoop.getKey().asIdentifier());
+
+ // Clear missed report counter on Control Loop
+ clearFaultAndCounter(controlLoop);
return;
}
+ boolean completed = true;
for (ControlLoopElement element : controlLoop.getElements().values()) {
if (!element.getState().equals(element.getOrderedState().asState())) {
- LOGGER.debug("control loop scan: transitioning from state {} to {}", controlLoop.getState(),
- controlLoop.getOrderedState());
- return;
+ completed = false;
+ break;
}
}
- LOGGER.debug("control loop scan: transition from state {} to {} completed", controlLoop.getState(),
- controlLoop.getOrderedState());
+ if (completed) {
+ LOGGER.debug("control loop scan: transition from state {} to {} completed", controlLoop.getState(),
+ controlLoop.getOrderedState());
+
+ controlLoop.setState(controlLoop.getOrderedState().asState());
+ controlLoopProvider.updateControlLoop(controlLoop);
- controlLoop.setState(controlLoop.getOrderedState().asState());
- controlLoopProvider.updateControlLoop(controlLoop);
+ // Clear missed report counter on Control Loop
+ clearFaultAndCounter(controlLoop);
+ } else {
+ LOGGER.debug("control loop scan: transition from state {} to {} not completed", controlLoop.getState(),
+ controlLoop.getOrderedState());
+ if (counterCheck) {
+ handleCounter(controlLoop);
+ }
+ }
}
- /**
- * Makes a new timer pool.
- *
- * @return a new timer pool
- */
- protected ScheduledExecutorService makeTimerPool() {
- return Executors.newScheduledThreadPool(1);
+ private void clearFaultAndCounter(ControlLoop controlLoop) {
+ stateChange.clear(controlLoop.getKey().asIdentifier());
+ }
+
+ private void handleCounter(ControlLoop controlLoop) {
+ ToscaConceptIdentifier id = controlLoop.getKey().asIdentifier();
+ if (stateChange.isFault(id)) {
+ LOGGER.debug("report ControlLoop fault");
+ return;
+ }
+
+ if (stateChange.count(id)) {
+ if (ControlLoopState.UNINITIALISED2PASSIVE.equals(controlLoop.getState())) {
+ LOGGER.debug("retry message ControlLoopUpdate");
+ controlLoopUpdatePublisher.send(controlLoop);
+ } else {
+ LOGGER.debug("retry message ControlLoopStateChange");
+ controlLoopStateChangePublisher.send(controlLoop);
+ }
+ } else {
+ LOGGER.debug("report ControlLoop fault");
+ stateChange.setFault(id);
+ }
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopStateChangePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangePublisher.java
index 734ccb842..79d113c14 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopStateChangePublisher.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangePublisher.java
@@ -22,15 +22,15 @@ package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
import java.util.UUID;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
import org.springframework.stereotype.Component;
/**
- * This class is used to send ParticipantControlLoopStateChangePublisher messages to participants on DMaaP.
+ * This class is used to send ControlLoopStateChangePublisher messages to participants on DMaaP.
*/
@Component
-public class ParticipantControlLoopStateChangePublisher
- extends AbstractParticipantPublisher<ParticipantControlLoopStateChange> {
+public class ControlLoopStateChangePublisher
+ extends AbstractParticipantPublisher<ControlLoopStateChange> {
/**
* Send ControlLoopStateChange to Participant.
@@ -38,7 +38,7 @@ public class ParticipantControlLoopStateChangePublisher
* @param controlLoop the ControlLoop
*/
public void send(ControlLoop controlLoop) {
- var clsc = new ParticipantControlLoopStateChange();
+ var clsc = new ControlLoopStateChange();
clsc.setControlLoopId(controlLoop.getKey().asIdentifier());
clsc.setMessageId(UUID.randomUUID());
clsc.setOrderedState(controlLoop.getOrderedState());
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java
index e562343ff..e366ba49a 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java
@@ -20,42 +20,43 @@
package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+import lombok.AllArgsConstructor;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider;
import org.onap.policy.models.base.PfModelException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* This class is used to send ControlLoopUpdate messages to participants on DMaaP.
*/
@Component
+@AllArgsConstructor
public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<ControlLoopUpdate> {
- private final CommissioningProvider commissioningProvider;
+ private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopUpdatePublisher.class);
- /**
- * Constructor.
- *
- * @param commissioningProvider the CommissioningProvider
- */
- public ControlLoopUpdatePublisher(CommissioningProvider commissioningProvider) {
- this.commissioningProvider = commissioningProvider;
- }
+ private final CommissioningProvider commissioningProvider;
/**
* Send ControlLoopUpdate to Participant.
*
* @param controlLoop the ControlLoop
- * @throws PfModelException on errors getting the Control Loop Definition
*/
- public void send(ControlLoop controlLoop) throws PfModelException {
- var pclu = new ControlLoopUpdate();
- pclu.setControlLoopId(controlLoop.getKey().asIdentifier());
- pclu.setControlLoop(controlLoop);
+ public void send(ControlLoop controlLoop) {
+ var controlLoopUpdateMsg = new ControlLoopUpdate();
+ controlLoopUpdateMsg.setControlLoopId(controlLoop.getKey().asIdentifier());
+ controlLoopUpdateMsg.setControlLoop(controlLoop);
// TODO: We should look up the correct TOSCA node template here for the control loop
// Tiny hack implemented to return the tosca service template entry from the database and be passed onto dmaap
- pclu.setControlLoopDefinition(commissioningProvider.getToscaServiceTemplate(null, null));
- super.send(pclu);
+ try {
+ controlLoopUpdateMsg.setControlLoopDefinition(commissioningProvider.getToscaServiceTemplate(null, null));
+ } catch (PfModelException pfme) {
+ LOGGER.warn("Get of tosca service template failed, cannot send ParticipantControlLoopUpdate", pfme);
+ return;
+ }
+ super.send(controlLoopUpdateMsg);
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java
index c0fcb3e7d..e92b6ee1b 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java
@@ -20,6 +20,7 @@
package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+import java.util.UUID;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck;
import org.springframework.stereotype.Component;
@@ -29,4 +30,16 @@ import org.springframework.stereotype.Component;
@Component
public class ParticipantDeregisterAckPublisher extends AbstractParticipantAckPublisher<ParticipantDeregisterAck> {
+ /**
+ * Sent ParticipantDeregisterAck to Participant.
+ *
+ * @param responseTo the original request id in the request.
+ */
+ public void send(UUID responseTo) {
+ var message = new ParticipantDeregisterAck();
+ message.setResponseTo(responseTo);
+ message.setMessage("Participant Deregister Ack");
+ message.setResult(true);
+ super.send(message);
+ }
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterAckPublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
index 2c0c4b393..73860b5c2 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
@@ -20,6 +20,7 @@
package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+import java.util.UUID;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
import org.springframework.stereotype.Component;
@@ -29,4 +30,16 @@ import org.springframework.stereotype.Component;
@Component
public class ParticipantRegisterAckPublisher extends AbstractParticipantAckPublisher<ParticipantRegisterAck> {
+ /**
+ * Send ParticipantRegisterAck to Participant.
+ *
+ * @param responseTo the original request id in the request.
+ */
+ public void send(UUID responseTo) {
+ var message = new ParticipantRegisterAck();
+ message.setResponseTo(responseTo);
+ message.setMessage("Participant Register Ack");
+ message.setResult(true);
+ super.send(message);
+ }
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdateAckListener.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdateAckListener.java
index b8538b1f7..4eeb0a8ce 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdateAckListener.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdateAckListener.java
@@ -21,7 +21,6 @@
package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
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.ParticipantUpdateAck;
import org.onap.policy.clamp.controlloop.runtime.config.messaging.Listener;
import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
index 5af5f1f54..88cf90d02 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
@@ -20,13 +20,63 @@
package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+import java.time.Instant;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.UUID;
+import lombok.AllArgsConstructor;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* This class is used to send ParticipantUpdate messages to participants on DMaaP.
*/
@Component
+@AllArgsConstructor
public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<ParticipantUpdate> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantUpdatePublisher.class);
+
+ private final CommissioningProvider commissioningProvider;
+
+ /**
+ * Send ParticipantUpdate to Participant.
+ *
+ * @param participantId the participant Id
+ * @param participantType the participant Type
+ */
+ public void send(ToscaConceptIdentifier participantId, ToscaConceptIdentifier participantType) {
+ var message = new ParticipantUpdate();
+ message.setParticipantId(participantId);
+ message.setParticipantType(participantType);
+ message.setTimestamp(Instant.now());
+
+ var clDefinition = new ControlLoopElementDefinition();
+ clDefinition.setId(UUID.randomUUID());
+
+ try {
+ clDefinition.setControlLoopElementToscaServiceTemplate(
+ commissioningProvider.getToscaServiceTemplate(null, null));
+ } catch (PfModelException pfme) {
+ LOGGER.warn("Get of tosca service template failed, cannot send participantupdate", pfme);
+ return;
+ }
+
+ Map<UUID, ControlLoopElementDefinition> controlLoopElementDefinitionMap = new LinkedHashMap<>();
+ controlLoopElementDefinitionMap.put(UUID.randomUUID(), clDefinition);
+
+ Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>> participantDefinitionUpdateMap =
+ new LinkedHashMap<>();
+ participantDefinitionUpdateMap.put(participantId, controlLoopElementDefinitionMap);
+ message.setParticipantDefinitionUpdateMap(participantDefinitionUpdateMap);
+
+ LOGGER.debug("Participant Update sent {}", message);
+ super.send(message);
+ }
}
diff --git a/runtime-controlloop/src/main/resources/application.yaml b/runtime-controlloop/src/main/resources/application.yaml
index 3bc2749ed..d0e5500d6 100644
--- a/runtime-controlloop/src/main/resources/application.yaml
+++ b/runtime-controlloop/src/main/resources/application.yaml
@@ -20,7 +20,6 @@ server:
runtime:
supervisionScannerIntervalSec: 1000
- participantStateChangeIntervalSec: 1000
participantClUpdateIntervalSec: 1000
participantClStateChangeIntervalSec: 1000
participantParameters:
@@ -28,24 +27,25 @@ runtime:
updateParameters:
maxRetryCount: 1
maxWaitMs: 30000
- stateChangeParameters:
- maxRetryCount: 1
- maxWaitMs: 30000
databaseProviderParameters:
name: PolicyProviderParameterGroup
implementation: org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl
databaseDriver: org.mariadb.jdbc.Driver
- databaseUrl: jdbc:mariadb://${mariadb.host:mariadb}:${mariadb.port:3306}/controlloop
+ databaseUrl: jdbc:mariadb://${mariadb.host:localhost}:${mariadb.port:3306}/controlloop
databaseUser: policy
databasePassword: P01icY
persistenceUnit: CommissioningMariaDb
topicParameterGroup:
- topicSources[0]:
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers[0]: ${topicServer:message-router}
- topicCommInfrastructure: dmaap
- fetchTimeout: 15000
- topicSinks[0]:
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers[0]: ${topicServer:message-router}
- topicCommInfrastructure: dmaap
+ topicSources:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:localhost}
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks:
+ -
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers:
+ - ${topicServer:localhost}
+ topicCommInfrastructure: dmaap
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java
index 9fd1ea35f..c414ffa02 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java
@@ -43,8 +43,8 @@ import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProv
import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup;
import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringProvider;
import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopStateChangePublisher;
import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopUpdatePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantControlLoopStateChangePublisher;
import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantDeregisterAckPublisher;
import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantRegisterAckPublisher;
import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher;
@@ -114,12 +114,12 @@ class ControlLoopInstantiationProviderTest {
new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, clProvider);
var participantProvider = new ParticipantProvider(controlLoopParameters.getDatabaseProviderParameters());
var controlLoopUpdatePublisher = Mockito.mock(ControlLoopUpdatePublisher.class);
- var controlLoopStateChangePublisher = Mockito.mock(ParticipantControlLoopStateChangePublisher.class);
+ var controlLoopStateChangePublisher = Mockito.mock(ControlLoopStateChangePublisher.class);
var participantRegisterAckPublisher = Mockito.mock(ParticipantRegisterAckPublisher.class);
var participantDeregisterAckPublisher = Mockito.mock(ParticipantDeregisterAckPublisher.class);
var participantUpdatePublisher = Mockito.mock(ParticipantUpdatePublisher.class);
supervisionHandler = new SupervisionHandler(clProvider, participantProvider, monitoringProvider,
- commissioningProvider, controlLoopUpdatePublisher, controlLoopStateChangePublisher,
+ controlLoopUpdatePublisher, controlLoopStateChangePublisher,
participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher);
}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java
index ad6d7ccd6..5f00706e1 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java
@@ -91,12 +91,12 @@ class SupervisionMessagesTest extends CommonRestController {
new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, clProvider);
var participantProvider = new ParticipantProvider(controlLoopParameters.getDatabaseProviderParameters());
var controlLoopUpdatePublisher = Mockito.mock(ControlLoopUpdatePublisher.class);
- var controlLoopStateChangePublisher = Mockito.mock(ParticipantControlLoopStateChangePublisher.class);
+ var controlLoopStateChangePublisher = Mockito.mock(ControlLoopStateChangePublisher.class);
var participantRegisterAckPublisher = Mockito.mock(ParticipantRegisterAckPublisher.class);
var participantDeregisterAckPublisher = Mockito.mock(ParticipantDeregisterAckPublisher.class);
var participantUpdatePublisher = Mockito.mock(ParticipantUpdatePublisher.class);
supervisionHandler = new SupervisionHandler(clProvider, participantProvider, monitoringProvider,
- commissioningProvider, controlLoopUpdatePublisher, controlLoopStateChangePublisher,
+ controlLoopUpdatePublisher, controlLoopStateChangePublisher,
participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher);
}
@@ -196,7 +196,7 @@ class SupervisionMessagesTest extends CommonRestController {
participantUpdateMsg.setParticipantDefinitionUpdateMap(participantDefinitionUpdateMap);
synchronized (lockit) {
- ParticipantUpdatePublisher clUpdatePublisher = new ParticipantUpdatePublisher();
+ ParticipantUpdatePublisher clUpdatePublisher = new ParticipantUpdatePublisher(commissioningProvider);
clUpdatePublisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
clUpdatePublisher.send(participantUpdateMsg);
}
diff --git a/runtime-controlloop/src/test/resources/application_test.properties b/runtime-controlloop/src/test/resources/application_test.properties
index e51db25ce..ad2a4b12c 100644
--- a/runtime-controlloop/src/test/resources/application_test.properties
+++ b/runtime-controlloop/src/test/resources/application_test.properties
@@ -7,7 +7,6 @@ server.servlet.context-path=/onap/controlloop
server.error.path=/error
runtime.supervisionScannerIntervalSec=1000
-runtime.participantStateChangeIntervalSec=1000
runtime.participantClUpdateIntervalSec=1000
runtime.participantClStateChangeIntervalSec=1000
runtime.participantParameters.heartBeatMs=120000
diff --git a/runtime-controlloop/src/test/resources/parameters/TestParameters.json b/runtime-controlloop/src/test/resources/parameters/TestParameters.json
index 07c90d7b2..99fc43d21 100644
--- a/runtime-controlloop/src/test/resources/parameters/TestParameters.json
+++ b/runtime-controlloop/src/test/resources/parameters/TestParameters.json
@@ -1,7 +1,6 @@
{
"name": "ControlLoopRuntimeGroup",
"supervisionScannerIntervalSec": 1000,
- "participantStateChangeIntervalSec": 1000,
"participantClUpdateIntervalSec": 1000,
"participantClStateChangeIntervalSec": 1000,
"participantParameters": {