aboutsummaryrefslogtreecommitdiffstats
path: root/models/src/main
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/src/main
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/src/main')
-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
6 files changed, 100 insertions, 103 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);
}
}