aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorSirisha_Manchikanti <sirisha.manchikanti@est.tech>2021-08-03 17:49:00 +0100
committerSirisha_Manchikanti <sirisha.manchikanti@est.tech>2021-08-04 14:35:55 +0100
commit2c094b95c86f3315e359d971fbfa0ad60d173053 (patch)
treebd4b33f1e28ad3fad8769b3a36a51e4f89a63dea /models
parent055fa4ad38a11bb5890b6e0ea280e9b96a1b2a39 (diff)
Update controlloop messages
Updated controlloop messages according to https://wiki.onap.org/display/DW/The+CLAMP+Control+Loop+Participant+Protocol Issue-ID: POLICY-3417 Signed-off-by: Sirisha_Manchikanti <sirisha.manchikanti@est.tech> Change-Id: Ied32ea5bb63a6b69286d03f1a7b2b86e3acad7a7
Diffstat (limited to 'models')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheck.java)40
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java50
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java13
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseDetails.java64
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java30
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java5
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheckTest.java61
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java66
9 files changed, 163 insertions, 172 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheck.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java
index e472e15fe..bdf894125 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheck.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java
@@ -18,39 +18,31 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
-import lombok.Getter;
-import lombok.Setter;
+import lombok.Data;
+import lombok.NoArgsConstructor;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
/**
- * Class to represent the PARTICIPANT_HEALTHCHECK message that the control loop runtime will send to
- * participants to change the state of a control loop they are running.
+ * Class to represent a control loop info instance.
*/
-@Getter
-@Setter
-@ToString(callSuper = true)
-public class ParticipantHealthCheck extends ParticipantMessage {
- private ParticipantState state;
+@NoArgsConstructor
+@Data
+@ToString
+public class ControlLoopInfo {
- /**
- * Constructor for instantiating ParticipantHealthCheck class with message name.
- *
- */
- public ParticipantHealthCheck() {
- super(ParticipantMessageType.PARTICIPANT_HEALTH_CHECK);
- }
+ private ControlLoopState state = ControlLoopState.UNINITIALISED;
+
+ private ControlLoopStatistics controlLoopStatistics;
/**
- * Constructs the object, making a deep copy.
+ * Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
*
- * @param source source from which to copy
+ * @param otherElement the other element to copy from
*/
- public ParticipantHealthCheck(ParticipantHealthCheck source) {
- super(source);
-
- this.state = source.state;
+ public ControlLoopInfo(final ControlLoopInfo otherElement) {
+ this.state = otherElement.state;
+ this.controlLoopStatistics = otherElement.controlLoopStatistics;
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java
new file mode 100644
index 000000000..685947b13
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java
@@ -0,0 +1,50 @@
+/*-
+ * ============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.controlloop.concepts;
+
+import java.time.Instant;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.NonNull;
+import lombok.ToString;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+@NoArgsConstructor
+@Data
+@ToString
+public class ControlLoopStatistics {
+
+ @NonNull
+ private ToscaConceptIdentifier controlLoopId;
+
+ @NonNull
+ private Instant timeStamp;
+
+ @NonNull
+ private ClElementStatisticsList clElementStatisticsList;
+
+ private long eventCount;
+ private long lastExecutionTime;
+ private double averageExecutionTime;
+ private long upTime;
+ private long lastEnterTime;
+ private long lastStart;
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java
index 6a72ec1f2..3411a0369 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java
@@ -28,7 +28,6 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -59,7 +58,7 @@ public class ControlLoopAck extends ParticipantAckMessage {
// A map with ControlLoopElementID as its key, and a pair of result and message as value per
// ControlLoopElement.
- private Map<UUID, Map<UUID, Boolean>> controlLoopResultMap = new LinkedHashMap<>();
+ private Map<UUID, Pair<Boolean, String>> controlLoopResultMap = new LinkedHashMap<>();
/**
* Constructor for instantiating ParticipantRegisterAck class with message name.
@@ -79,7 +78,6 @@ public class ControlLoopAck extends ParticipantAckMessage {
this.participantId = source.participantId;
this.participantType = source.participantType;
this.controlLoopId = source.controlLoopId;
- this.controlLoopResultMap = PfUtils.mapMap(source.controlLoopResultMap,
- clElementResultMap -> PfUtils.mapMap(clElementResultMap, UnaryOperator.identity()));
+ this.controlLoopResultMap = PfUtils.mapMap(source.controlLoopResultMap, UnaryOperator.identity());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java
index 1e53921dd..8b59a1801 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java
@@ -24,6 +24,7 @@ import java.util.UUID;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Class to represent participant Ack message.
@@ -45,6 +46,16 @@ public class ParticipantAckMessage {
private ParticipantMessageType messageType;
/**
+ * Participant Type, or {@code null} for messages from participants.
+ */
+ private ToscaConceptIdentifier participantType;
+
+ /**
+ * Participant ID, or {@code null} for messages from participants.
+ */
+ private ToscaConceptIdentifier participantId;
+
+ /**
* Constructor for instantiating a participant ack message class.
*
* @param messageType the message type
@@ -63,5 +74,7 @@ public class ParticipantAckMessage {
this.result = source.result;
this.message = source.message;
this.messageType = source.messageType;
+ this.participantType = source.participantType;
+ this.participantId = source.participantId;
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseDetails.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseDetails.java
deleted file mode 100644
index 4c771b405..000000000
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseDetails.java
+++ /dev/null
@@ -1,64 +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 java.util.UUID;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent participant response details.
- */
-@Getter
-@Setter
-@ToString
-@NoArgsConstructor
-public class ParticipantResponseDetails {
-
- // The responseTo field should match the original request id in the request.
- private UUID responseTo;
- private ParticipantResponseStatus responseStatus;
- private String responseMessage;
-
- /**
- * Constructs the object as a response to.
- *
- * @param triggerMessage the message to which this is a response
- */
- public ParticipantResponseDetails(ParticipantMessage triggerMessage) {
- this.responseMessage = null;
- this.responseStatus = ParticipantResponseStatus.FAIL;
- this.responseTo = triggerMessage.getMessageId();
- }
-
- /**
- * Constructs the object, making a deep copy.
- *
- * @param source source from which to copy
- */
- public ParticipantResponseDetails(ParticipantResponseDetails source) {
- this.responseMessage = source.responseMessage;
- this.responseStatus = source.responseStatus;
- this.responseTo = source.responseTo;
- }
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java
index 5b9284243..c3e630681 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java
@@ -20,13 +20,19 @@
package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.UUID;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.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.models.base.PfUtils;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Class to represent the PARTICIPANT_STATUS message that all the participants send to the control loop runtime.
@@ -35,21 +41,21 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant
@Setter
@ToString(callSuper = true)
public class ParticipantStatus extends ParticipantMessage {
- // The response should be completed if this message is a response to a request from the Control Loop Runtime
- private ParticipantResponseDetails response;
// State and health status of the participant
private ParticipantState state;
private ParticipantHealthStatus healthStatus;
- // Control Loops on the participant
- private ControlLoops controlLoops;
-
// Participant statistics
private ParticipantStatistics participantStatistics;
- // Description. May be left {@code null}.
- private String message;
+ // A map with Participant ID as its key, and a map of ControlLoopElements as value.
+ // Returned in response to ParticipantStatusReq only
+ private Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>>
+ participantDefinitionUpdateMap = new LinkedHashMap<>();
+
+ // Map of ControlLoopInfo types indexed by ControlLoopId, one entry for each control loop
+ private Map<ToscaConceptIdentifier, ControlLoopInfo> controlLoopInfoMap;
/**
* Constructor for instantiating ParticipantStatus class with message name.
@@ -69,8 +75,10 @@ public class ParticipantStatus extends ParticipantMessage {
this.state = source.state;
this.healthStatus = source.healthStatus;
- this.message = source.message;
- this.controlLoops = (source.controlLoops == null ? null : new ControlLoops(source.controlLoops));
- this.response = (source.response == null ? null : new ParticipantResponseDetails(source.response));
+ this.participantStatistics = (source.participantStatistics == null ? null : new ParticipantStatistics());
+ this.participantDefinitionUpdateMap = PfUtils.mapMap(source.participantDefinitionUpdateMap,
+ clElementDefinitionMap -> PfUtils.mapMap(clElementDefinitionMap,
+ ControlLoopElementDefinition::new));
+ this.controlLoopInfoMap = PfUtils.mapMap(source.controlLoopInfoMap, ControlLoopInfo::new);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java
index 8734a435c..d7d7e4327 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java
@@ -26,6 +26,7 @@ import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participan
import java.util.Map;
import java.util.UUID;
+import org.apache.commons.lang3.tuple.Pair;
import org.junit.jupiter.api.Test;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -48,8 +49,8 @@ class ControlLoopAckTest {
orig.setParticipantId(id);
orig.setParticipantType(id);
- Map<UUID, Boolean> clElementResult = Map.of(UUID.randomUUID(), true);
- final Map<UUID, Map<UUID, Boolean>> controlLoopResultMap = Map.of(UUID.randomUUID(), clElementResult);
+ Pair<Boolean, String> clElementResult = Pair.of(true, "ControlLoopElement result");
+ final Map<UUID, Pair<Boolean, String>> controlLoopResultMap = Map.of(UUID.randomUUID(), clElementResult);
orig.setControlLoopResultMap(controlLoopResultMap);
orig.setResponseTo(UUID.randomUUID());
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
deleted file mode 100644
index 52f1cc480..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheckTest.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 other methods.
- */
-class ParticipantHealthCheckTest {
-
- @Test
- void testCopyConstructor() {
- assertThatThrownBy(() -> new ParticipantHealthCheck(null)).isInstanceOf(NullPointerException.class);
-
- ParticipantHealthCheck orig = new ParticipantHealthCheck();
-
- // verify with null values
- assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ParticipantHealthCheck(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 ParticipantHealthCheck(orig).toString()));
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java
index 706e58b91..05cfdd78b 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java
@@ -25,10 +25,20 @@ 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.List;
+import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopStatistics;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
class ParticipantStatusTest {
@@ -43,20 +53,64 @@ class ParticipantStatusTest {
removeVariableFields(new ParticipantStatus(orig).toString()));
// verify with all values
- ToscaConceptIdentifier id = new ToscaConceptIdentifier();
- id.setName("id");
- id.setVersion("1.2.3");
+ ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
orig.setControlLoopId(id);
orig.setParticipantId(id);
+ orig.setParticipantType(id);
orig.setMessageId(UUID.randomUUID());
orig.setState(ParticipantState.ACTIVE);
+ orig.setHealthStatus(ParticipantHealthStatus.HEALTHY);
orig.setTimestamp(Instant.ofEpochMilli(3000));
- final ParticipantResponseDetails resp = new ParticipantResponseDetails();
- resp.setResponseMessage("my-response");
- orig.setResponse(resp);
+ ControlLoopInfo clInfo = getControlLoopInfo(id);
+ orig.setControlLoopInfoMap(Map.of(id, clInfo));
+
+ ControlLoopElementDefinition clDefinition = getClElementDefinition();
+ Map<UUID, ControlLoopElementDefinition> clElementDefinitionMap = Map.of(UUID.randomUUID(), clDefinition);
+ Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>>
+ participantDefinitionUpdateMap = Map.of(id, clElementDefinitionMap);
+ orig.setParticipantDefinitionUpdateMap(participantDefinitionUpdateMap);
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ParticipantStatus(orig).toString()));
}
+
+ private ControlLoopInfo getControlLoopInfo(ToscaConceptIdentifier id) {
+ ControlLoopInfo clInfo = new ControlLoopInfo();
+ clInfo.setState(ControlLoopState.PASSIVE2RUNNING);
+
+ ControlLoopStatistics clStatistics = new ControlLoopStatistics();
+ clStatistics.setControlLoopId(id);
+ clStatistics.setAverageExecutionTime(12345);
+ clStatistics.setEventCount(12345);
+ clStatistics.setLastEnterTime(12345);
+ clStatistics.setLastExecutionTime(12345);
+ clStatistics.setLastStart(12345);
+ clStatistics.setTimeStamp(Instant.ofEpochMilli(3000));
+ clStatistics.setUpTime(12345);
+ ClElementStatisticsList clElementStatisticsList = new ClElementStatisticsList();
+ ClElementStatistics clElementStatistics = new ClElementStatistics();
+ clElementStatistics.setParticipantId(new ToscaConceptIdentifier("defName", "0.0.1"));
+ clElementStatistics.setTimeStamp(Instant.now());
+ clElementStatisticsList.setClElementStatistics(List.of(clElementStatistics));
+ clStatistics.setClElementStatisticsList(clElementStatisticsList);
+
+ clInfo.setControlLoopStatistics(clStatistics);
+ return clInfo;
+ }
+
+ private ControlLoopElementDefinition getClElementDefinition() {
+ ToscaServiceTemplate toscaServiceTemplate = new ToscaServiceTemplate();
+ toscaServiceTemplate.setName("serviceTemplate");
+ toscaServiceTemplate.setDerivedFrom("parentServiceTemplate");
+ toscaServiceTemplate.setDescription("Description of serviceTemplate");
+ toscaServiceTemplate.setVersion("1.2.3");
+
+ ControlLoopElementDefinition clDefinition = new ControlLoopElementDefinition();
+ clDefinition.setId(UUID.randomUUID());
+ clDefinition.setControlLoopElementToscaServiceTemplate(toscaServiceTemplate);
+ Map<String, String> commonPropertiesMap = Map.of("Prop1", "PropValue");
+ clDefinition.setCommonPropertiesMap(commonPropertiesMap);
+ return clDefinition;
+ }
}