From 2c094b95c86f3315e359d971fbfa0ad60d173053 Mon Sep 17 00:00:00 2001 From: Sirisha_Manchikanti Date: Tue, 3 Aug 2021 17:49:00 +0100 Subject: 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 Change-Id: Ied32ea5bb63a6b69286d03f1a7b2b86e3acad7a7 --- .../controlloop/concepts/ControlLoopInfo.java | 48 ++++++++++++++++ .../concepts/ControlLoopStatistics.java | 50 ++++++++++++++++ .../messages/dmaap/participant/ControlLoopAck.java | 6 +- .../dmaap/participant/ParticipantAckMessage.java | 13 +++++ .../dmaap/participant/ParticipantHealthCheck.java | 56 ------------------ .../participant/ParticipantResponseDetails.java | 64 --------------------- .../dmaap/participant/ParticipantStatus.java | 30 ++++++---- .../dmaap/participant/ControlLoopAckTest.java | 5 +- .../participant/ParticipantHealthCheckTest.java | 61 -------------------- .../dmaap/participant/ParticipantStatusTest.java | 66 ++++++++++++++++++++-- 10 files changed, 195 insertions(+), 204 deletions(-) create mode 100644 models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java create mode 100644 models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheck.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseDetails.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheckTest.java (limited to 'models') diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java new file mode 100644 index 000000000..bdf894125 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java @@ -0,0 +1,48 @@ +/*- + * ============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 lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +/** + * Class to represent a control loop info instance. + */ +@NoArgsConstructor +@Data +@ToString +public class ControlLoopInfo { + + private ControlLoopState state = ControlLoopState.UNINITIALISED; + + private ControlLoopStatistics controlLoopStatistics; + + /** + * Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy. + * + * @param otherElement the other element to copy from + */ + 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> controlLoopResultMap = new LinkedHashMap<>(); + private Map> 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. @@ -44,6 +45,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. * @@ -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/ParticipantHealthCheck.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheck.java deleted file mode 100644 index e472e15fe..000000000 --- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantHealthCheck.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_HEALTHCHECK 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 ParticipantHealthCheck extends ParticipantMessage { - private ParticipantState state; - - /** - * Constructor for instantiating ParticipantHealthCheck class with message name. - * - */ - public ParticipantHealthCheck() { - super(ParticipantMessageType.PARTICIPANT_HEALTH_CHECK); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantHealthCheck(ParticipantHealthCheck source) { - super(source); - - this.state = source.state; - } -} 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> + participantDefinitionUpdateMap = new LinkedHashMap<>(); + + // Map of ControlLoopInfo types indexed by ControlLoopId, one entry for each control loop + private Map 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 clElementResult = Map.of(UUID.randomUUID(), true); - final Map> controlLoopResultMap = Map.of(UUID.randomUUID(), clElementResult); + Pair clElementResult = Pair.of(true, "ControlLoopElement result"); + final Map> 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 clElementDefinitionMap = Map.of(UUID.randomUUID(), clDefinition); + Map> + 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 commonPropertiesMap = Map.of("Prop1", "PropValue"); + clDefinition.setCommonPropertiesMap(commonPropertiesMap); + return clDefinition; + } } -- cgit 1.2.3-korg