aboutsummaryrefslogtreecommitdiffstats
path: root/models/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'models/src/main')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java9
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java85
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java3
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java18
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java19
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReq.java51
6 files changed, 179 insertions, 6 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/ControlLoopAck.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java
new file mode 100644
index 000000000..6a72ec1f2
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java
@@ -0,0 +1,85 @@
+/*-
+ * ============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.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
+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, Map<UUID, Boolean>> 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,
+ clElementResultMap -> PfUtils.mapMap(clElementResultMap, UnaryOperator.identity()));
+ }
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java
index 180d99439..e6955b90b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java
@@ -24,6 +24,7 @@ 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 CONTROL_LOOP_STATE_CHANGE message that the control loop runtime will send to
@@ -34,6 +35,7 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
@ToString(callSuper = true)
public class ControlLoopStateChange extends ParticipantMessage {
private ControlLoopOrderedState orderedState;
+ private ControlLoopState currentState;
/**
* Constructor for instantiating ControlLoopStateChange class with message name.
@@ -52,5 +54,6 @@ public class ControlLoopStateChange extends ParticipantMessage {
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/ControlLoopUpdate.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java
index 876c370b4..865264f6d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java
@@ -20,11 +20,16 @@
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 CONTROL_LOOP_UPDATE message that the control loop runtime sends to a participant.
@@ -35,11 +40,13 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
@Setter
@ToString(callSuper = true)
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 ControlLoopUpdate class with message name.
@@ -57,7 +64,8 @@ public class ControlLoopUpdate extends ParticipantMessage {
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/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java
index 0c39392e0..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
@@ -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/ParticipantStatusReq.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReq.java
new file mode 100644
index 000000000..9242cea02
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReq.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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;
+
+/**
+ * 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 ParticipantStatusReq extends ParticipantMessage {
+
+ /**
+ * Constructor for instantiating a participant status request class.
+ */
+ public ParticipantStatusReq() {
+ super(ParticipantMessageType.PARTICIPANT_STATUS_REQ);
+ }
+
+ /**
+ * Constructs the object, making a deep copy.
+ *
+ * @param source source from which to copy
+ */
+ public ParticipantStatusReq(final ParticipantStatusReq source) {
+ super(source);
+ }
+}