diff options
Diffstat (limited to 'models/src/main/java')
13 files changed, 254 insertions, 139 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java index 83f062c74..b99759eb3 100644 --- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java +++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java @@ -20,12 +20,16 @@ package org.onap.policy.clamp.controlloop.models.controlloop.concepts; +import java.util.LinkedHashMap; +import java.util.Map; import java.util.UUID; +import java.util.function.UnaryOperator; import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; import lombok.ToString; import org.onap.policy.models.base.PfConceptKey; +import org.onap.policy.models.base.PfUtils; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** @@ -57,6 +61,10 @@ public class ControlLoopElement { private ClElementStatistics clElementStatistics; + // A map indexed by the property name. Each map entry is the serialized value of the property, + // which can be deserialized into an instance of the type of the property. + private Map<String, String> commonPropertiesMap = new LinkedHashMap<>(); + /** * Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy. * @@ -71,5 +79,6 @@ public class ControlLoopElement { this.orderedState = otherElement.orderedState; this.description = otherElement.description; this.clElementStatistics = otherElement.clElementStatistics; + this.commonPropertiesMap = PfUtils.mapMap(otherElement.commonPropertiesMap, UnaryOperator.identity()); } } 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/controlloop/concepts/ParticipantHealthStatus.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantHealthStatus.java index 0cf41c9cd..e7c5fecda 100644 --- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantHealthStatus.java +++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantHealthStatus.java @@ -43,5 +43,10 @@ public enum ParticipantHealthStatus { /** * The health status of the Participant is unknown. */ - UNKNOWN + UNKNOWN, + + /** + * The health status of the Participant is off line. + */ + OFF_LINE } 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 new file mode 100644 index 000000000..3411a0369 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java @@ -0,0 +1,83 @@ +/*- + * ============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.LinkedHashMap; +import java.util.Map; +import java.util.UUID; +import java.util.function.UnaryOperator; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.tuple.Pair; +import org.onap.policy.models.base.PfUtils; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; + +/** + * Class to represent the CONTROLLOOP_ACK message that a participant sends + * to control loop runtime as an acknowledgement to either ControlLoopUpdate + * or ControlLoopStateChange message. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class ControlLoopAck extends ParticipantAckMessage { + + /** + * Participant ID, or {@code null} for messages from participants. + */ + private ToscaConceptIdentifier participantId; + + /** + * Participant Type, or {@code null} for messages from participants. + */ + private ToscaConceptIdentifier participantType; + + /** + * Control loop ID, or {@code null} for messages to participants. + */ + private ToscaConceptIdentifier controlLoopId; + + // A map with ControlLoopElementID as its key, and a pair of result and message as value per + // ControlLoopElement. + private Map<UUID, Pair<Boolean, String>> controlLoopResultMap = new LinkedHashMap<>(); + + /** + * Constructor for instantiating ParticipantRegisterAck class with message name. + * + */ + public ControlLoopAck(final ParticipantMessageType messageType) { + super(messageType); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ControlLoopAck(final ControlLoopAck source) { + super(source); + this.participantId = source.participantId; + this.participantType = source.participantType; + this.controlLoopId = source.controlLoopId; + this.controlLoopResultMap = PfUtils.mapMap(source.controlLoopResultMap, UnaryOperator.identity()); + } +} 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..e6955b90b 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 @@ -24,23 +24,25 @@ import lombok.Getter; import lombok.Setter; import lombok.ToString; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; /** - * 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; + private ControlLoopState currentState; /** - * 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,9 +50,10 @@ 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; + this.currentState = source.currentState; } } diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantControlLoopUpdate.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java index ed729a64b..865264f6d 100644 --- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantControlLoopUpdate.java +++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java @@ -20,33 +20,40 @@ 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.ControlLoop; -import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; +import org.onap.policy.models.base.PfUtils; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** - * Class to represent the PARTICIPANT_CONTROL_LOOP_UPDATE message that the control loop runtime sends to a participant. + * 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 @ToString(callSuper = true) -public class ParticipantControlLoopUpdate extends ParticipantMessage { +public class ControlLoopUpdate extends ParticipantMessage { + // The control loop private ControlLoop controlLoop; - // A service template containing a complete definition of the control loop - private ToscaServiceTemplate controlLoopDefinition; + // A map with Participant ID as its key, and a map of ControlLoopElements as value. + private Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElement>> + participantUpdateMap = new LinkedHashMap<>(); /** - * Constructor for instantiating ParticipantControlLoopUpdate class with message name. + * Constructor for instantiating ControlLoopUpdate class with message name. * */ - public ParticipantControlLoopUpdate() { - super(ParticipantMessageType.PARTICIPANT_CONTROL_LOOP_UPDATE); + public ControlLoopUpdate() { + super(ParticipantMessageType.CONTROL_LOOP_UPDATE); } /** @@ -54,10 +61,11 @@ public class ParticipantControlLoopUpdate extends ParticipantMessage { * * @param source source from which to copy */ - public ParticipantControlLoopUpdate(ParticipantControlLoopUpdate source) { + public ControlLoopUpdate(ControlLoopUpdate source) { super(source); - this.controlLoop = new ControlLoop(source.controlLoop); - this.controlLoopDefinition = new ToscaServiceTemplate(source.controlLoopDefinition); + this.controlLoop = source.controlLoop; + this.participantUpdateMap = PfUtils.mapMap(source.participantUpdateMap, + clElementMap -> PfUtils.mapMap(clElementMap, ControlLoopElement::new)); } } 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/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java index 94d484620..62b8d20b0 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 @@ -38,15 +38,15 @@ public enum ParticipantMessageType { /** * Used by controlloop runtime to update the controlloops running on participants, triggers a - * PARTICIPANT_STATUS message with the result of the PARTICIPANT_CONTROL_LOOP_UPDATE operation. + * PARTICIPANT_STATUS message with the result of the CONTROL_LOOP_UPDATE operation. */ - PARTICIPANT_CONTROL_LOOP_UPDATE, + CONTROL_LOOP_UPDATE, /** * 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 @@ -83,5 +83,22 @@ public enum ParticipantMessageType { * Used by participant to acknowledge the receipt of Participant_Update message * from control loop runtime. */ - PARTICIPANT_UPDATE_ACK + PARTICIPANT_UPDATE_ACK, + + /** + * Used by participant to acknowledge the receipt of ControlLoop_Update message + * from control loop runtime. + */ + CONTROLLOOP_UPDATE_ACK, + + /** + * Used by participant to acknowledge the receipt of ControlLoop_StateChange message + * from control loop runtime. + */ + CONTROLLOOP_STATECHANGE_ACK, + + /** + * Used by control loop runtime to request for ParticipantStatus message immediately. + */ + PARTICIPANT_STATUS_REQ } diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegister.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegister.java index 7319d99db..af0149189 100644 --- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegister.java +++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegister.java @@ -23,10 +23,6 @@ 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.ControlLoops; -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; /** * Class to represent the PARTICIPANT_REGISTER message that all the participants send to control loop runtime. 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/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/ParticipantStatusReq.java index 5f5150077..9242cea02 100644 --- 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/ParticipantStatusReq.java @@ -23,24 +23,21 @@ 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. + * Class to represent the PARTICIPANT_STATUS_REQ message that controlloop runtime + * sends to participants for an immediate ParticipantStatus from participants. */ @Getter @Setter @ToString(callSuper = true) -public class ParticipantStateChange extends ParticipantMessage { - private ParticipantState state; +public class ParticipantStatusReq extends ParticipantMessage { /** - * Constructor for instantiating ParticipantStateChange class with message name. - * + * Constructor for instantiating a participant status request class. */ - public ParticipantStateChange() { - super(ParticipantMessageType.PARTICIPANT_STATE_CHANGE); + public ParticipantStatusReq() { + super(ParticipantMessageType.PARTICIPANT_STATUS_REQ); } /** @@ -48,9 +45,7 @@ public class ParticipantStateChange extends ParticipantMessage { * * @param source source from which to copy */ - public ParticipantStateChange(ParticipantStateChange source) { + public ParticipantStatusReq(final ParticipantStatusReq source) { super(source); - - this.state = source.state; } } |