aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionDefinition.java3
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java7
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java47
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/SubState.java (renamed from models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementType.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessage.java59
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementStatus.java36
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAck.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionMigration.java3
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionPrepare.java (renamed from models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestart.java)41
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageType.java7
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantSync.java21
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java30
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementConfig.java36
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/KafkaConfig.java39
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AcInstanceStateUpdate.java3
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/SubOrder.java (renamed from models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessageType.java)11
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java27
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionDefinition.java5
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java33
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java5
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java151
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java14
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionElementRepository.java15
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java3
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java46
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/utils/StateDefinition.java4
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java24
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java18
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java15
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestartTest.java84
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java68
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java54
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java4
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolverTest.java74
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java13
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java29
-rw-r--r--models/src/test/resources/examples/acm/test-pm-subscription-handling.yaml14
38 files changed, 558 insertions, 509 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
index eb5b6dc9b..61610bb47 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
@@ -44,7 +44,7 @@ public class AutomationComposition extends ToscaEntity implements Comparable<Aut
private UUID compositionTargetId;
- private Boolean restarting;
+ private Boolean precheck;
@NonNull
private DeployState deployState = DeployState.UNDEPLOYED;
@@ -56,6 +56,9 @@ public class AutomationComposition extends ToscaEntity implements Comparable<Aut
private Integer phase;
+ @NonNull
+ private SubState subState = SubState.NONE;
+
private Map<UUID, AutomationCompositionElement> elements;
private StateChangeResult stateChangeResult;
@@ -70,11 +73,12 @@ public class AutomationComposition extends ToscaEntity implements Comparable<Aut
this.instanceId = otherAutomationComposition.instanceId;
this.compositionId = otherAutomationComposition.compositionId;
this.compositionTargetId = otherAutomationComposition.compositionTargetId;
- this.restarting = otherAutomationComposition.restarting;
+ this.precheck = otherAutomationComposition.precheck;
this.deployState = otherAutomationComposition.deployState;
this.lockState = otherAutomationComposition.lockState;
this.lastMsg = otherAutomationComposition.lastMsg;
this.phase = otherAutomationComposition.phase;
+ this.subState = otherAutomationComposition.subState;
this.elements = PfUtils.mapMap(otherAutomationComposition.elements, AutomationCompositionElement::new);
this.stateChangeResult = otherAutomationComposition.stateChangeResult;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionDefinition.java
index 987cb8832..57b6837af 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionDefinition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionDefinition.java
@@ -41,8 +41,6 @@ public class AutomationCompositionDefinition {
@NonNull
private ToscaServiceTemplate serviceTemplate;
- private Boolean restarting;
-
@NonNull
private AcTypeState state;
@@ -63,7 +61,6 @@ public class AutomationCompositionDefinition {
public AutomationCompositionDefinition(final AutomationCompositionDefinition otherAcmDefinition) {
this.compositionId = otherAcmDefinition.compositionId;
this.serviceTemplate = new ToscaServiceTemplate(otherAcmDefinition.serviceTemplate);
- this.restarting = otherAcmDefinition.restarting;
this.state = otherAcmDefinition.state;
this.lastMsg = otherAcmDefinition.lastMsg;
this.elementStateMap = PfUtils.mapMap(otherAcmDefinition.elementStateMap, NodeTemplateState::new);
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
index 5afa7e0bb..7d3acaa52 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
@@ -55,6 +55,11 @@ public class AutomationCompositionElement {
@NonNull
private LockState lockState = LockState.LOCKED;
+ @NonNull
+ private SubState subState = SubState.NONE;
+
+ private Integer stage;
+
private String operationalState;
private String useState;
private String description;
@@ -81,8 +86,10 @@ public class AutomationCompositionElement {
this.restarting = otherElement.restarting;
this.deployState = otherElement.deployState;
this.lockState = otherElement.lockState;
+ this.subState = otherElement.subState;
this.operationalState = otherElement.operationalState;
this.useState = otherElement.useState;
+ this.stage = otherElement.stage;
this.message = otherElement.message;
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java
index d6079d0e7..9c827d701 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
+ * Copyright (C) 2021-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,11 @@
package org.onap.policy.clamp.models.acm.concepts;
+import java.util.HashSet;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
@@ -50,8 +54,26 @@ public final class ParticipantUtils {
}
return DeployState.DEPLOYING.equals(automationComposition.getDeployState())
- || LockState.UNLOCKING.equals(automationComposition.getLockState()) ? minStartPhase
- : maxStartPhase;
+ || LockState.UNLOCKING.equals(automationComposition.getLockState()) ? minStartPhase : maxStartPhase;
+ }
+
+ /**
+ * Get the First Stage.
+ *
+ * @param automationComposition the automation composition
+ * @param toscaServiceTemplate the ToscaServiceTemplate
+ * @return the First stage
+ */
+ public static int getFirstStage(
+ AutomationComposition automationComposition, ToscaServiceTemplate toscaServiceTemplate) {
+ Set<Integer> minStage = new HashSet<>();
+ for (var element : automationComposition.getElements().values()) {
+ var toscaNodeTemplate = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates()
+ .get(element.getDefinition().getName());
+ var stage = ParticipantUtils.findStageSet(toscaNodeTemplate.getProperties());
+ minStage.addAll(stage);
+ }
+ return minStage.stream().min(Integer::compare).orElse(0);
}
/**
@@ -63,8 +85,25 @@ public final class ParticipantUtils {
public static int findStartPhase(Map<String, Object> properties) {
var objStartPhase = properties.get("startPhase");
if (objStartPhase != null) {
- return Integer.valueOf(objStartPhase.toString());
+ return Integer.parseInt(objStartPhase.toString());
}
return 0;
}
+
+
+ /**
+ * Finds stage from a map of properties.
+ *
+ * @param properties Map of properties
+ * @return stage
+ */
+ public static Set<Integer> findStageSet(Map<String, Object> properties) {
+ var objStage = properties.get("stage");
+ if (objStage instanceof List<?> stageSet) {
+ return stageSet.stream()
+ .map(obj -> Integer.valueOf(obj.toString()))
+ .collect(Collectors.toSet());
+ }
+ return Set.of(0);
+ }
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementType.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/SubState.java
index 4bc08a36e..5f979c50f 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementType.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/SubState.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.models.acm.messages.rest.element;
+package org.onap.policy.clamp.models.acm.concepts;
-public enum ElementType {
-
- STARTER, BRIDGE, SINK
+public enum SubState {
+ NONE,
+ MIGRATION_PRECHECKING,
+ PREPARING,
+ REVIEWING
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessage.java
deleted file mode 100644
index 13a1b735b..000000000
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessage.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022,2024 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.models.acm.messages.kafka.element;
-
-import java.time.Instant;
-import java.util.UUID;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-@Getter
-@Setter
-@ToString
-public class ElementMessage {
-
- @Setter(AccessLevel.NONE)
- private ElementMessageType messageType;
-
- private ToscaConceptIdentifier elementId;
-
- private String message;
-
- private UUID messageId = UUID.randomUUID();
-
- /**
- * Time-stamp, in milliseconds, when the message was created. Defaults to the
- * current time.
- */
- private Instant timestamp = Instant.now();
-
- /**
- * Constructor for instantiating a element message class.
- *
- * @param messageType the message type
- */
- public ElementMessage(ElementMessageType messageType) {
- this.messageType = messageType;
- }
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementStatus.java
deleted file mode 100644
index 497dca408..000000000
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementStatus.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022,2024 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.models.acm.messages.kafka.element;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-@Getter
-@Setter
-@ToString(callSuper = true)
-public class ElementStatus extends ElementMessage {
-
- public ElementStatus() {
- super(ElementMessageType.STATUS);
- }
-
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAck.java
index 2c7d51fe7..9807ff9ca 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAck.java
@@ -41,7 +41,7 @@ import org.onap.policy.models.base.PfUtils;
public class AutomationCompositionDeployAck extends ParticipantAckMessage {
private UUID automationCompositionId;
- private Integer startPhase;
+ private Integer stage;
// A map with AutomationCompositionElementID as its key, and a pair of result and message as value per
// AutomationCompositionElement.
@@ -63,7 +63,7 @@ public class AutomationCompositionDeployAck extends ParticipantAckMessage {
public AutomationCompositionDeployAck(final AutomationCompositionDeployAck source) {
super(source);
this.automationCompositionId = source.automationCompositionId;
- this.startPhase = source.startPhase;
+ this.stage = source.stage;
this.automationCompositionResultMap =
PfUtils.mapMap(source.automationCompositionResultMap, UnaryOperator.identity());
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionMigration.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionMigration.java
index fb1f1925c..2d7608afd 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionMigration.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionMigration.java
@@ -37,6 +37,9 @@ public class AutomationCompositionMigration extends ParticipantMessage {
// A list of updates to AC element properties
private List<ParticipantDeploy> participantUpdatesList = new ArrayList<>();
+ private Boolean precheck = false;
+ private Integer stage = 0;
+
public AutomationCompositionMigration() {
super(ParticipantMessageType.AUTOMATION_COMPOSITION_MIGRATION);
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestart.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionPrepare.java
index ff9755ec1..343143eed 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestart.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionPrepare.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2023-2024 Nordix Foundation.
+ * Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,38 +25,23 @@ import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.models.base.PfUtils;
@Getter
@Setter
@ToString(callSuper = true)
-public class ParticipantRestart extends ParticipantMessage {
+public class AutomationCompositionPrepare extends ParticipantMessage {
- // composition state
- private AcTypeState state;
-
- // element definition
- private List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
-
- // automation composition instances list
- private List<ParticipantRestartAc> automationcompositionList = new ArrayList<>();
+ private List<ParticipantDeploy> participantList = new ArrayList<>();
+ private boolean preDeploy = true;
/**
- * Constructor.
- */
- public ParticipantRestart() {
- super(ParticipantMessageType.PARTICIPANT_RESTART);
- }
-
- /**
- * Constructor with message type.
- * @param messageType messageType
+ * Constructor for instantiating class with message name.
+ *
*/
- public ParticipantRestart(ParticipantMessageType messageType) {
- super(messageType);
+ public AutomationCompositionPrepare() {
+ super(ParticipantMessageType.AUTOMATION_COMPOSITION_PREPARE);
}
/**
@@ -64,11 +49,9 @@ public class ParticipantRestart extends ParticipantMessage {
*
* @param source source from which to copy
*/
- public ParticipantRestart(ParticipantRestart source) {
+ public AutomationCompositionPrepare(AutomationCompositionPrepare source) {
super(source);
- this.state = source.state;
- this.participantDefinitionUpdates =
- PfUtils.mapList(source.participantDefinitionUpdates, ParticipantDefinition::new);
- this.automationcompositionList = PfUtils.mapList(source.automationcompositionList, ParticipantRestartAc::new);
+ this.preDeploy = source.preDeploy;
+ this.participantList = PfUtils.mapList(source.participantList, ParticipantDeploy::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageType.java
index e6e42e851..7e19f6f79 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageType.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageType.java
@@ -115,5 +115,10 @@ public enum ParticipantMessageType {
/**
* Used by runtime to send composition and instances to sync participant replicas.
*/
- PARTICIPANT_SYNC_MSG
+ PARTICIPANT_SYNC_MSG,
+
+ /**
+ * Used by the acm runtime to ask for a preparation check to participants.
+ */
+ AUTOMATION_COMPOSITION_PREPARE
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantSync.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantSync.java
index 962b6137c..85b715b86 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantSync.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantSync.java
@@ -20,17 +20,32 @@
package org.onap.policy.clamp.models.acm.messages.kafka.participant;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import java.util.UUID;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
+import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc;
+import org.onap.policy.models.base.PfUtils;
@Getter
@Setter
@ToString(callSuper = true)
-public class ParticipantSync extends ParticipantRestart {
+public class ParticipantSync extends ParticipantMessage {
+
+ // composition state
+ private AcTypeState state;
+
+ // element definition
+ private List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
+
+ // automation composition instances list
+ private List<ParticipantRestartAc> automationcompositionList = new ArrayList<>();
private Set<UUID> excludeReplicas = new HashSet<>();
private boolean restarting = false;
@@ -50,6 +65,10 @@ public class ParticipantSync extends ParticipantRestart {
*/
public ParticipantSync(ParticipantSync source) {
super(source);
+ this.state = source.state;
+ this.participantDefinitionUpdates =
+ PfUtils.mapList(source.participantDefinitionUpdates, ParticipantDefinition::new);
+ this.automationcompositionList = PfUtils.mapList(source.automationcompositionList, ParticipantRestartAc::new);
this.excludeReplicas = new HashSet<>(source.excludeReplicas);
this.restarting = source.restarting;
this.delete = source.delete;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java
deleted file mode 100644
index 3e39e970d..000000000
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java
+++ /dev/null
@@ -1,30 +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.models.acm.messages.rest;
-
-import lombok.Data;
-
-@Data
-public class GenericNameVersion {
-
- private String name;
-
- private String version;
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementConfig.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementConfig.java
deleted file mode 100644
index bb3670cb7..000000000
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementConfig.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022,2024 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.models.acm.messages.rest.element;
-
-import lombok.Data;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-@Data
-public class ElementConfig {
-
- private ToscaConceptIdentifier receiverId;
-
- private ElementType elementType;
-
- private Integer timerMs;
-
- private KafkaConfig topicParameterGroup;
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/KafkaConfig.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/KafkaConfig.java
deleted file mode 100644
index 35871fcbf..000000000
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/KafkaConfig.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022,2024 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.models.acm.messages.rest.element;
-
-import lombok.Data;
-
-@Data
-public class KafkaConfig {
- private String server;
-
- private String listenerTopic;
-
- private String publisherTopic;
-
- private Integer fetchTimeout;
-
- private String topicCommInfrastructure;
-
- private boolean useHttps;
-
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AcInstanceStateUpdate.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AcInstanceStateUpdate.java
index e47947a02..68c597b32 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AcInstanceStateUpdate.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AcInstanceStateUpdate.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2022,2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,4 +26,5 @@ import lombok.Data;
public class AcInstanceStateUpdate {
private DeployOrder deployOrder;
private LockOrder lockOrder;
+ private SubOrder subOrder;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessageType.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/SubOrder.java
index cb2eaae95..9cf7efaa6 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessageType.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/SubOrder.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022,2024 Nordix Foundation.
+ * Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.models.acm.messages.kafka.element;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
-public enum ElementMessageType {
- STATUS, ACK_MSG
+public enum SubOrder {
+ NONE,
+ MIGRATE_PRECHECK,
+ PREPARE,
+ REVIEW
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
index 355fcaff0..001f2e7f3 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
@@ -45,6 +45,7 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
+import org.onap.policy.clamp.models.acm.concepts.SubState;
import org.onap.policy.clamp.models.acm.utils.TimestampHelper;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
@@ -86,9 +87,6 @@ public class JpaAutomationComposition extends Validated
private String compositionTargetId;
@Column
- private Boolean restarting;
-
- @Column
@NotNull
private DeployState deployState;
@@ -97,6 +95,10 @@ public class JpaAutomationComposition extends Validated
private LockState lockState;
@Column
+ @NotNull
+ private SubState subState;
+
+ @Column
private StateChangeResult stateChangeResult;
@Column
@@ -119,7 +121,7 @@ public class JpaAutomationComposition extends Validated
*/
public JpaAutomationComposition() {
this(UUID.randomUUID().toString(), new PfConceptKey(), UUID.randomUUID().toString(), new ArrayList<>(),
- DeployState.UNDEPLOYED, LockState.NONE);
+ DeployState.UNDEPLOYED, LockState.NONE, SubState.NONE);
}
/**
@@ -131,10 +133,12 @@ public class JpaAutomationComposition extends Validated
* @param elements the elements of the automation composition in participants
* @param deployState the Deploy State
* @param lockState the Lock State
+ * @param subState the Sub State
*/
public JpaAutomationComposition(@NonNull final String instanceId, @NonNull final PfConceptKey key,
@NonNull final String compositionId, @NonNull final List<JpaAutomationCompositionElement> elements,
- @NonNull final DeployState deployState, @NonNull final LockState lockState) {
+ @NonNull final DeployState deployState, @NonNull final LockState lockState,
+ @NonNull final SubState subState) {
this.instanceId = instanceId;
this.name = key.getName();
this.version = key.getVersion();
@@ -142,6 +146,7 @@ public class JpaAutomationComposition extends Validated
this.deployState = deployState;
this.lockState = lockState;
this.elements = elements;
+ this.subState = subState;
}
/**
@@ -155,11 +160,11 @@ public class JpaAutomationComposition extends Validated
this.version = copyConcept.version;
this.compositionId = copyConcept.compositionId;
this.compositionTargetId = copyConcept.compositionTargetId;
- this.restarting = copyConcept.restarting;
this.deployState = copyConcept.deployState;
this.lockState = copyConcept.lockState;
this.lastMsg = copyConcept.lastMsg;
this.phase = copyConcept.phase;
+ this.subState = copyConcept.subState;
this.description = copyConcept.description;
this.stateChangeResult = copyConcept.stateChangeResult;
this.elements = PfUtils.mapList(copyConcept.elements, JpaAutomationCompositionElement::new);
@@ -185,11 +190,11 @@ public class JpaAutomationComposition extends Validated
if (compositionTargetId != null) {
automationComposition.setCompositionTargetId(UUID.fromString(compositionTargetId));
}
- automationComposition.setRestarting(restarting);
automationComposition.setDeployState(deployState);
automationComposition.setLockState(lockState);
automationComposition.setLastMsg(lastMsg.toString());
automationComposition.setPhase(phase);
+ automationComposition.setSubState(subState);
automationComposition.setDescription(description);
automationComposition.setStateChangeResult(stateChangeResult);
automationComposition.setElements(new LinkedHashMap<>(this.elements.size()));
@@ -225,11 +230,11 @@ public class JpaAutomationComposition extends Validated
if (automationComposition.getCompositionTargetId() != null) {
this.compositionTargetId = automationComposition.getCompositionTargetId().toString();
}
- this.restarting = automationComposition.getRestarting();
this.deployState = automationComposition.getDeployState();
this.lockState = automationComposition.getLockState();
this.lastMsg = TimestampHelper.toTimestamp(automationComposition.getLastMsg());
this.phase = automationComposition.getPhase();
+ this.subState = automationComposition.getSubState();
this.description = automationComposition.getDescription();
this.stateChangeResult = automationComposition.getStateChangeResult();
}
@@ -278,17 +283,17 @@ public class JpaAutomationComposition extends Validated
return result;
}
- result = ObjectUtils.compare(restarting, other.restarting);
+ result = ObjectUtils.compare(deployState, other.deployState);
if (result != 0) {
return result;
}
- result = ObjectUtils.compare(deployState, other.deployState);
+ result = ObjectUtils.compare(lockState, other.lockState);
if (result != 0) {
return result;
}
- result = ObjectUtils.compare(lockState, other.lockState);
+ result = ObjectUtils.compare(subState, other.subState);
if (result != 0) {
return result;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionDefinition.java
index 1cab89d5d..3d61c4ed9 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionDefinition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionDefinition.java
@@ -79,9 +79,6 @@ public class JpaAutomationCompositionDefinition extends Validated
private String version;
@Column
- private Boolean restarting;
-
- @Column
@NotNull
private AcTypeState state;
@@ -107,7 +104,6 @@ public class JpaAutomationCompositionDefinition extends Validated
public AutomationCompositionDefinition toAuthorative() {
var acmDefinition = new AutomationCompositionDefinition();
acmDefinition.setCompositionId(UUID.fromString(this.compositionId));
- acmDefinition.setRestarting(this.restarting);
acmDefinition.setState(this.state);
acmDefinition.setStateChangeResult(this.stateChangeResult);
acmDefinition.setLastMsg(this.lastMsg.toString());
@@ -122,7 +118,6 @@ public class JpaAutomationCompositionDefinition extends Validated
@Override
public void fromAuthorative(final AutomationCompositionDefinition copyConcept) {
this.compositionId = copyConcept.getCompositionId().toString();
- this.restarting = copyConcept.getRestarting();
this.state = copyConcept.getState();
this.stateChangeResult = copyConcept.getStateChangeResult();
this.lastMsg = TimestampHelper.toTimestamp(copyConcept.getLastMsg());
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
index 74426a747..e511ba1fc 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
+ * Copyright (C) 2021-2024 Nordix Foundation.
* ================================================================================
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -42,6 +42,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
+import org.onap.policy.clamp.models.acm.concepts.SubState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
@@ -94,12 +95,19 @@ public class JpaAutomationCompositionElement extends Validated
private LockState lockState;
@Column
+ @NotNull
+ private SubState subState;
+
+ @Column
private String operationalState;
@Column
private String useState;
@Column
+ private Integer stage;
+
+ @Column
private String description;
@Column
@@ -134,7 +142,7 @@ public class JpaAutomationCompositionElement extends Validated
*/
public JpaAutomationCompositionElement(@NonNull final String elementId, @NonNull final String instanceId) {
this(elementId, instanceId, new PfConceptKey(),
- DeployState.UNDEPLOYED, LockState.LOCKED);
+ DeployState.UNDEPLOYED, LockState.NONE, SubState.NONE);
}
/**
@@ -145,15 +153,18 @@ public class JpaAutomationCompositionElement extends Validated
* @param definition the TOSCA definition of the automation composition element
* @param deployState the Deploy State of the automation composition
* @param lockState the Lock State of the automation composition
+ * @param subState the Sub State of the automation composition
*/
public JpaAutomationCompositionElement(@NonNull final String elementId, @NonNull final String instanceId,
@NonNull final PfConceptKey definition,
- @NonNull final DeployState deployState, @NonNull final LockState lockState) {
+ @NonNull final DeployState deployState, @NonNull final LockState lockState,
+ @NonNull final SubState subState) {
this.elementId = elementId;
this.instanceId = instanceId;
this.definition = definition;
this.deployState = deployState;
this.lockState = lockState;
+ this.subState = subState;
}
/**
@@ -174,8 +185,10 @@ public class JpaAutomationCompositionElement extends Validated
this.restarting = copyConcept.restarting;
this.deployState = copyConcept.deployState;
this.lockState = copyConcept.lockState;
+ this.subState = copyConcept.subState;
this.operationalState = copyConcept.operationalState;
this.useState = copyConcept.useState;
+ this.stage = copyConcept.stage;
this.message = copyConcept.message;
}
@@ -201,8 +214,10 @@ public class JpaAutomationCompositionElement extends Validated
element.setRestarting(restarting);
element.setDeployState(deployState);
element.setLockState(lockState);
+ element.setSubState(subState);
element.setOperationalState(operationalState);
element.setUseState(useState);
+ element.setStage(stage);
element.setMessage(message);
return element;
@@ -218,8 +233,10 @@ public class JpaAutomationCompositionElement extends Validated
this.restarting = element.getRestarting();
this.deployState = element.getDeployState();
this.lockState = element.getLockState();
+ this.subState = element.getSubState();
this.operationalState = element.getOperationalState();
this.useState = element.getUseState();
+ this.stage = element.getStage();
this.message = element.getMessage();
}
@@ -267,11 +284,21 @@ public class JpaAutomationCompositionElement extends Validated
return result;
}
+ result = ObjectUtils.compare(subState, other.subState);
+ if (result != 0) {
+ return result;
+ }
+
result = ObjectUtils.compare(useState, other.useState);
if (result != 0) {
return result;
}
+ result = ObjectUtils.compare(stage, other.stage);
+ if (result != 0) {
+ return result;
+ }
+
result = ObjectUtils.compare(operationalState, other.operationalState);
if (result != 0) {
return result;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java
index 46b43f950..bb05c46c6 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java
@@ -138,10 +138,8 @@ public class AcDefinitionProvider {
* @param compositionId The UUID of the automation composition definition to update
* @param state the AcTypeState
* @param stateChangeResult the StateChangeResult
- * @param restarting restarting process
*/
- public void updateAcDefinitionState(UUID compositionId, AcTypeState state, StateChangeResult stateChangeResult,
- Boolean restarting) {
+ public void updateAcDefinitionState(UUID compositionId, AcTypeState state, StateChangeResult stateChangeResult) {
var jpaUpdate = acmDefinitionRepository.findById(compositionId.toString());
if (jpaUpdate.isEmpty()) {
String errorMessage = "update of Automation Composition Definition \"" + compositionId
@@ -151,7 +149,6 @@ public class AcDefinitionProvider {
var acDefinition = jpaUpdate.get();
acDefinition.setState(state);
acDefinition.setStateChangeResult(stateChangeResult);
- acDefinition.setRestarting(restarting);
acmDefinitionRepository.save(acDefinition);
acmDefinitionRepository.flush();
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
index ace246c5d..7bffdd966 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation.
+ * Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,8 +23,10 @@ package org.onap.policy.clamp.models.acm.persistence.provider;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
+import org.onap.policy.clamp.models.acm.concepts.SubState;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.SubOrder;
import org.onap.policy.clamp.models.acm.utils.StateDefinition;
import org.springframework.stereotype.Component;
@@ -39,6 +41,8 @@ public class AcInstanceStateResolver {
private static final String UPDATING = DeployState.UPDATING.name();
private static final String DELETING = DeployState.DELETING.name();
private static final String MIGRATING = DeployState.MIGRATING.name();
+ private static final String MIGRATION_PRECHECKING = SubState.MIGRATION_PRECHECKING.name();
+ private static final String SUB_STATE_NONE = SubState.NONE.name();
private static final String LOCKED = LockState.LOCKED.name();
private static final String LOCKING = LockState.LOCKING.name();
@@ -48,6 +52,7 @@ public class AcInstanceStateResolver {
private static final String DEPLOY_NONE = DeployOrder.NONE.name();
private static final String LOCK_NONE = LockOrder.NONE.name();
+ private static final String SUB_NONE = SubOrder.NONE.name();
private static final String NO_ERROR = StateChangeResult.NO_ERROR.name();
private static final String FAILED = StateChangeResult.FAILED.name();
@@ -60,55 +65,105 @@ public class AcInstanceStateResolver {
public static final String LOCK = LockOrder.LOCK.name();
public static final String UNLOCK = LockOrder.UNLOCK.name();
public static final String MIGRATE = DeployOrder.MIGRATE.name();
+ public static final String MIGRATE_PRECHECK = SubOrder.MIGRATE_PRECHECK.name();
+ public static final String PREPARE = SubOrder.PREPARE.name();
+ public static final String REVIEW = SubOrder.REVIEW.name();
+ public static final String UPDATE = DeployOrder.UPDATE.name();
public static final String NONE = "NONE";
/**
* Construct.
*/
public AcInstanceStateResolver() {
- this.graph = new StateDefinition<>(5, NONE);
-
- // no error
- this.graph.put(new String[] {DEPLOY, LOCK_NONE, UNDEPLOYED, STATE_LOCKED_NONE, NO_ERROR}, DEPLOY);
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, DEPLOYED, LOCKED, NO_ERROR}, UNDEPLOY);
- this.graph.put(new String[] {DELETE, LOCK_NONE, UNDEPLOYED, LOCK_NONE, NO_ERROR}, DELETE);
- this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, DEPLOYED, LOCKED, NO_ERROR}, UNLOCK);
- this.graph.put(new String[] {DEPLOY_NONE, LOCK, DEPLOYED, UNLOCKED, NO_ERROR}, LOCK);
- this.graph.put(new String[] {MIGRATE, LOCK_NONE, DEPLOYED, LOCKED, NO_ERROR}, MIGRATE);
-
- // failed
- this.graph.put(new String[] {DEPLOY, LOCK_NONE, UNDEPLOYING, STATE_LOCKED_NONE, FAILED}, DEPLOY);
- this.graph.put(new String[] {DEPLOY, LOCK_NONE, DEPLOYING, STATE_LOCKED_NONE, FAILED}, DEPLOY);
-
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, UNDEPLOYING, STATE_LOCKED_NONE, FAILED}, UNDEPLOY);
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, UPDATING, LOCKED, FAILED}, UNDEPLOY);
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, MIGRATING, LOCKED, FAILED}, UNDEPLOY);
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, DEPLOYING, STATE_LOCKED_NONE, FAILED}, UNDEPLOY);
-
- this.graph.put(new String[] {DELETE, LOCK_NONE, DELETING, LOCK_NONE, FAILED}, DELETE);
-
- this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, DEPLOYED, LOCKING, FAILED}, UNLOCK);
- this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, DEPLOYED, UNLOCKING, FAILED}, UNLOCK);
-
- this.graph.put(new String[] {DEPLOY_NONE, LOCK, DEPLOYED, LOCKING, FAILED}, LOCK);
- this.graph.put(new String[] {DEPLOY_NONE, LOCK, DEPLOYED, UNLOCKING, FAILED}, LOCK);
+ this.graph = new StateDefinition<>(7, NONE);
+
+ // make an order when there are no fails
+ this.graph.put(new String[] {DEPLOY, LOCK_NONE, SUB_NONE,
+ UNDEPLOYED, STATE_LOCKED_NONE, SUB_STATE_NONE, NO_ERROR}, DEPLOY);
+ this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
+ DEPLOYED, LOCKED, SUB_STATE_NONE, NO_ERROR}, UNDEPLOY);
+ this.graph.put(new String[] {DELETE, LOCK_NONE, SUB_NONE,
+ UNDEPLOYED, LOCK_NONE, SUB_STATE_NONE, NO_ERROR}, DELETE);
+ this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, SUB_NONE,
+ DEPLOYED, LOCKED, SUB_STATE_NONE, NO_ERROR}, UNLOCK);
+ this.graph.put(new String[] {DEPLOY_NONE, LOCK, SUB_NONE,
+ DEPLOYED, UNLOCKED, SUB_STATE_NONE, NO_ERROR}, LOCK);
+ this.graph.put(new String[] {MIGRATE, LOCK_NONE, SUB_NONE,
+ DEPLOYED, LOCKED, SUB_STATE_NONE, NO_ERROR}, MIGRATE);
+ this.graph.put(new String[] {UPDATE, LOCK_NONE, SUB_NONE,
+ DEPLOYED, LOCKED, SUB_STATE_NONE, NO_ERROR}, UPDATE);
+ this.graph.put(new String[] {DEPLOY_NONE, LOCK_NONE, REVIEW,
+ DEPLOYED, LOCKED, SUB_STATE_NONE, NO_ERROR}, REVIEW);
+ this.graph.put(new String[] {DEPLOY_NONE, LOCK_NONE, PREPARE,
+ UNDEPLOYED, STATE_LOCKED_NONE, SUB_STATE_NONE, NO_ERROR}, PREPARE);
+ this.graph.put(new String[] {DEPLOY_NONE, LOCK_NONE, MIGRATE_PRECHECK,
+ DEPLOYED, LOCKED, SUB_STATE_NONE, NO_ERROR}, MIGRATE_PRECHECK);
+
+ // make an order in a failed scenario
+ this.graph.put(new String[] {DEPLOY, LOCK_NONE, SUB_NONE,
+ UNDEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, FAILED}, DEPLOY);
+ this.graph.put(new String[] {DEPLOY, LOCK_NONE, SUB_NONE,
+ DEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, FAILED}, DEPLOY);
+
+ this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
+ UNDEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, FAILED}, UNDEPLOY);
+ this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
+ UPDATING, LOCKED, SUB_STATE_NONE, FAILED}, UNDEPLOY);
+ this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
+ MIGRATING, LOCKED, SUB_STATE_NONE, FAILED}, UNDEPLOY);
+ this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
+ DEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, FAILED}, UNDEPLOY);
+
+ this.graph.put(new String[] {DELETE, LOCK_NONE, SUB_NONE,
+ DELETING, LOCK_NONE, SUB_STATE_NONE, FAILED}, DELETE);
+
+ this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, SUB_NONE,
+ DEPLOYED, LOCKING, SUB_STATE_NONE, FAILED}, UNLOCK);
+ this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, SUB_NONE,
+ DEPLOYED, UNLOCKING, SUB_STATE_NONE, FAILED}, UNLOCK);
+
+ this.graph.put(new String[] {DEPLOY_NONE, LOCK, SUB_NONE, DEPLOYED, LOCKING, SUB_STATE_NONE, FAILED}, LOCK);
+ this.graph.put(new String[] {DEPLOY_NONE, LOCK, SUB_NONE, DEPLOYED, UNLOCKING, SUB_STATE_NONE, FAILED}, LOCK);
+
+ this.graph.put(new String[] {UPDATE, LOCK_NONE, SUB_NONE, UPDATING, LOCKED, SUB_STATE_NONE, FAILED}, UPDATE);
+
+ this.graph.put(new String[] {DEPLOY_NONE, LOCK_NONE, MIGRATE_PRECHECK,
+ DEPLOYED, LOCKED, MIGRATION_PRECHECKING, FAILED}, MIGRATE_PRECHECK);
// timeout
- this.graph.put(new String[] {DEPLOY, LOCK_NONE, UNDEPLOYING, STATE_LOCKED_NONE, TIMEOUT}, DEPLOY);
- this.graph.put(new String[] {DEPLOY, LOCK_NONE, DEPLOYING, STATE_LOCKED_NONE, TIMEOUT}, DEPLOY);
-
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, UNDEPLOYING, STATE_LOCKED_NONE, TIMEOUT}, UNDEPLOY);
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, UPDATING, LOCKED, TIMEOUT}, UNDEPLOY);
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, MIGRATING, LOCKED, TIMEOUT}, UNDEPLOY);
- this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, DEPLOYING, STATE_LOCKED_NONE, TIMEOUT}, UNDEPLOY);
-
- this.graph.put(new String[] {DELETE, LOCK_NONE, DELETING, LOCK_NONE, TIMEOUT}, DELETE);
-
- this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, DEPLOYED, LOCKING, TIMEOUT}, UNLOCK);
- this.graph.put(new String[] {DEPLOY_NONE, LOCK, DEPLOYED, LOCKING, TIMEOUT}, LOCK);
-
- this.graph.put(new String[] {DEPLOY_NONE, LOCK, DEPLOYED, UNLOCKING, TIMEOUT}, LOCK);
- this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, DEPLOYED, UNLOCKING, TIMEOUT}, UNLOCK);
+ this.graph.put(new String[] {DEPLOY, LOCK_NONE, SUB_NONE,
+ UNDEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, TIMEOUT}, DEPLOY);
+ this.graph.put(new String[] {DEPLOY, LOCK_NONE, SUB_NONE,
+ DEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, TIMEOUT}, DEPLOY);
+
+ this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
+ UNDEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
+ this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
+ UPDATING, LOCKED, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
+ this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
+ MIGRATING, LOCKED, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
+ this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
+ MIGRATION_PRECHECKING, LOCKED, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
+ this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, SUB_NONE,
+ DEPLOYING, STATE_LOCKED_NONE, SUB_STATE_NONE, TIMEOUT}, UNDEPLOY);
+
+ this.graph.put(new String[] {DELETE, LOCK_NONE, SUB_NONE,
+ DELETING, LOCK_NONE, SUB_STATE_NONE, TIMEOUT}, DELETE);
+
+ this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, SUB_NONE,
+ DEPLOYED, LOCKING, SUB_STATE_NONE, TIMEOUT}, UNLOCK);
+ this.graph.put(new String[] {DEPLOY_NONE, LOCK, SUB_NONE,
+ DEPLOYED, LOCKING, SUB_STATE_NONE, TIMEOUT}, LOCK);
+
+ this.graph.put(new String[] {DEPLOY_NONE, LOCK, SUB_NONE,
+ DEPLOYED, UNLOCKING, SUB_STATE_NONE, TIMEOUT}, LOCK);
+ this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, SUB_NONE,
+ DEPLOYED, UNLOCKING, SUB_STATE_NONE, TIMEOUT}, UNLOCK);
+
+ this.graph.put(new String[] {UPDATE, LOCK_NONE, SUB_NONE, UPDATING, LOCKED, SUB_STATE_NONE, TIMEOUT}, UPDATE);
+
+ this.graph.put(new String[] {DEPLOY_NONE, LOCK_NONE, MIGRATE_PRECHECK,
+ DEPLOYED, LOCKED, MIGRATION_PRECHECKING, TIMEOUT}, MIGRATE_PRECHECK);
}
/**
@@ -116,20 +171,24 @@ public class AcInstanceStateResolver {
*
* @param acDeployOrder the Deploy Ordered
* @param acLockOrder the Lock Ordered
+ * @param acSubOrder the Sub Ordered
* @param acDeployState then current Deploy State
* @param acLockState the current Lock State
+ * @param acSubState the current Sub State
* @param acStateChangeResult the current Result of the State Change
* @return the order (DEPLOY/UNDEPLOY/LOCK/UNLOCK) to send to participant or NONE if order is not consistent
*/
- public String resolve(DeployOrder acDeployOrder, LockOrder acLockOrder, DeployState acDeployState,
- LockState acLockState, StateChangeResult acStateChangeResult) {
+ public String resolve(DeployOrder acDeployOrder, LockOrder acLockOrder, SubOrder acSubOrder,
+ DeployState acDeployState, LockState acLockState, SubState acSubState, StateChangeResult acStateChangeResult) {
var deployOrder = acDeployOrder != null ? acDeployOrder : DeployOrder.NONE;
var lockOrder = acLockOrder != null ? acLockOrder : LockOrder.NONE;
+ var subOrder = acSubOrder != null ? acSubOrder : SubOrder.NONE;
var stateChangeResult = acStateChangeResult != null ? acStateChangeResult : StateChangeResult.NO_ERROR;
var deployState = acDeployState != null ? acDeployState : DeployState.UNDEPLOYED;
var lockState = acLockState != null ? acLockState : LockState.NONE;
- return this.graph.get(new String[] {deployOrder.name(), lockOrder.name(), deployState.name(), lockState.name(),
- stateChangeResult.name()});
+ var subState = acSubState != null ? acSubState : SubState.NONE;
+ return this.graph.get(new String[] {deployOrder.name(), lockOrder.name(), subOrder.name(),
+ deployState.name(), lockState.name(), subState.name(), stateChangeResult.name()});
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
index ce258094a..ab80bc277 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
@@ -35,6 +35,7 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
+import org.onap.policy.clamp.models.acm.concepts.SubState;
import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationCompositionElement;
import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionElementRepository;
@@ -172,6 +173,8 @@ public class AutomationCompositionProvider {
DeployState.UNDEPLOYING, DeployState.DELETING, DeployState.UPDATING, DeployState.MIGRATING));
jpaList.addAll(automationCompositionRepository.findByLockStateIn(
List.of(LockState.LOCKING, LockState.UNLOCKING)));
+ jpaList.addAll(automationCompositionRepository.findBySubStateIn(
+ List.of(SubState.PREPARING, SubState.MIGRATION_PRECHECKING, SubState.REVIEWING)));
return ProviderUtils.asEntityList(jpaList);
}
@@ -258,6 +261,8 @@ public class AutomationCompositionProvider {
jpaAcElement.setUseState(element.getUseState());
jpaAcElement.setDeployState(element.getDeployState());
jpaAcElement.setLockState(element.getLockState());
+ jpaAcElement.setSubState(element.getSubState());
+ jpaAcElement.setStage(element.getStage());
jpaAcElement.setRestarting(element.getRestarting());
ProviderUtils.validate(element, jpaAcElement, "AutomationCompositionElement");
@@ -265,6 +270,15 @@ public class AutomationCompositionProvider {
}
/**
+ * Delete AutomationCompositionElement.
+ *
+ * @param elementId the AutomationCompositionElement Id
+ */
+ public void deleteAutomationCompositionElement(@NonNull final UUID elementId) {
+ acElementRepository.deleteById(elementId.toString());
+ }
+
+ /**
* Validate ElementIds.
*
* @param automationComposition the AutomationComposition
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionElementRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionElementRepository.java
index 19d791e6c..d0a996e20 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionElementRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionElementRepository.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation.
+ * Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,14 +20,19 @@
package org.onap.policy.clamp.models.acm.persistence.repository;
+import jakarta.persistence.LockModeType;
import java.util.List;
import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationCompositionElement;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.QueryByExampleExecutor;
+import org.springframework.data.jpa.repository.Lock;
+import org.springframework.lang.NonNull;
-public interface AutomationCompositionElementRepository extends
- JpaRepository<JpaAutomationCompositionElement, String>,
- QueryByExampleExecutor<JpaAutomationCompositionElement> {
+public interface AutomationCompositionElementRepository extends JpaRepository<JpaAutomationCompositionElement, String> {
+
+ @NonNull
+ @Override
+ @Lock(LockModeType.PESSIMISTIC_READ)
+ JpaAutomationCompositionElement getReferenceById(@NonNull String id);
List<JpaAutomationCompositionElement> findByParticipantId(String participantId);
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java
index d61dfb41b..7a1c61f5a 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java
@@ -24,6 +24,7 @@ import java.util.Collection;
import java.util.List;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
+import org.onap.policy.clamp.models.acm.concepts.SubState;
import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@@ -36,4 +37,6 @@ public interface AutomationCompositionRepository extends JpaRepository<JpaAutoma
List<JpaAutomationComposition> findByDeployStateIn(Collection<DeployState> deployStates);
List<JpaAutomationComposition> findByLockStateIn(Collection<LockState> lockStates);
+
+ List<JpaAutomationComposition> findBySubStateIn(Collection<SubState> subStates);
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
index f90e5a807..172de34fe 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
@@ -51,6 +51,7 @@ import org.onap.policy.clamp.models.acm.concepts.NodeTemplateState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc;
+import org.onap.policy.clamp.models.acm.concepts.SubState;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder;
import org.onap.policy.clamp.models.acm.persistence.concepts.StringToMapConverter;
@@ -64,6 +65,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Utility functions used in acm-runtime and participants.
@@ -74,6 +77,8 @@ public final class AcmUtils {
public static final String ENTRY = "entry ";
private static final StringToMapConverter MAP_CONVERTER = new StringToMapConverter();
+ private static final Logger LOGGER = LoggerFactory.getLogger(AcmUtils.class);
+
/**
* Get the Policy information in the service template for the deploy message to participants.
*
@@ -288,16 +293,20 @@ public final class AcmUtils {
// @formatter:on
}
+
/**
- * Return true if DeployState and LockState are in a Transitional State.
+ * Return true if DeployState, LockState and SubState are in a Transitional State.
*
- * @return true if DeployState and LockState are in a Transitional State
+ * @param deployState the DeployState
+ * @param lockState the LockState
+ * @param subState the SubState
+ * @return true if there is a state in a Transitional State
*/
- public static boolean isInTransitionalState(DeployState deployState, LockState lockState) {
+ public static boolean isInTransitionalState(DeployState deployState, LockState lockState, SubState subState) {
return DeployState.DEPLOYING.equals(deployState) || DeployState.UNDEPLOYING.equals(deployState)
|| LockState.LOCKING.equals(lockState) || LockState.UNLOCKING.equals(lockState)
|| DeployState.DELETING.equals(deployState) || DeployState.UPDATING.equals(deployState)
- || DeployState.MIGRATING.equals(deployState);
+ || DeployState.MIGRATING.equals(deployState) || !SubState.NONE.equals(subState);
}
/**
@@ -381,9 +390,23 @@ public final class AcmUtils {
*/
public static void setCascadedState(final AutomationComposition automationComposition,
final DeployState deployState, final LockState lockState) {
+ setCascadedState(automationComposition, deployState, lockState, SubState.NONE);
+ }
+
+ /**
+ /**
+ * Set the states on the automation composition and on all its automation composition elements.
+ *
+ * @param deployState the DeployState we want the automation composition to transition to
+ * @param lockState the LockState we want the automation composition to transition to
+ * @param subState the SubState we want the automation composition to transition to
+ */
+ public static void setCascadedState(final AutomationComposition automationComposition,
+ final DeployState deployState, final LockState lockState, final SubState subState) {
automationComposition.setDeployState(deployState);
automationComposition.setLockState(lockState);
automationComposition.setLastMsg(TimestampHelper.now());
+ automationComposition.setSubState(subState);
if (MapUtils.isEmpty(automationComposition.getElements())) {
return;
@@ -392,7 +415,9 @@ public final class AcmUtils {
for (var element : automationComposition.getElements().values()) {
element.setDeployState(deployState);
element.setLockState(lockState);
+ element.setSubState(subState);
element.setMessage(null);
+ element.setStage(null);
}
}
@@ -515,6 +540,19 @@ public final class AcmUtils {
return list;
}
+ /**
+ * Validated the Message field.
+ *
+ * @param message the message
+ * @return a validated message
+ */
+ public static String validatedMessage(String message) {
+ if (message != null && message.length() > 255) {
+ LOGGER.warn("message too long {}", message);
+ return message.substring(0, 255);
+ }
+ return message;
+ }
/**
* Recursive Merge.
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/StateDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/StateDefinition.java
index b7c6a31ac..491ae101e 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/StateDefinition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/StateDefinition.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation.
+ * Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@ public class StateDefinition<V> {
if (key == null || key.contains(separator)) {
throw new PfModelRuntimeException(Status.INTERNAL_SERVER_ERROR, "wrong key " + key);
}
- sb.append(key + separator);
+ sb.append(key).append(separator);
}
return sb.toString();
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java
index 6bb7f1eb7..bac0842f1 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java
@@ -47,9 +47,31 @@ class ParticipantUtilsTest {
@Test
void testGetFirstStartPhase() throws CoderException {
var serviceTemplate = CommonTestData.getToscaServiceTemplate(TOSCA_TEMPLATE_YAML);
+ var automationComposition =
+ CODER.decode(ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON), AutomationCompositions.class)
+ .getAutomationCompositionList().get(0);
+ automationComposition.setDeployState(DeployState.DEPLOYING);
+ automationComposition.setLockState(LockState.NONE);
+ var result = ParticipantUtils.getFirstStartPhase(automationComposition, serviceTemplate);
+ assertThat(result).isZero();
+
+ automationComposition.setDeployState(DeployState.DEPLOYED);
+ automationComposition.setLockState(LockState.UNLOCKING);
+ result = ParticipantUtils.getFirstStartPhase(automationComposition, serviceTemplate);
+ assertThat(result).isZero();
+
+ automationComposition.setDeployState(DeployState.UNDEPLOYING);
+ automationComposition.setLockState(LockState.NONE);
+ result = ParticipantUtils.getFirstStartPhase(automationComposition, serviceTemplate);
+ assertThat(result).isEqualTo(1);
+ }
+
+ @Test
+ void testGetFirstStage() throws CoderException {
+ var serviceTemplate = CommonTestData.getToscaServiceTemplate(TOSCA_TEMPLATE_YAML);
var automationCompositions =
CODER.decode(ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON), AutomationCompositions.class);
- var result = ParticipantUtils.getFirstStartPhase(automationCompositions.getAutomationCompositionList().get(0),
+ var result = ParticipantUtils.getFirstStage(automationCompositions.getAutomationCompositionList().get(0),
serviceTemplate);
assertThat(result).isZero();
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java
index 72e4efb49..2535c375a 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java
@@ -32,7 +32,6 @@ import org.onap.policy.clamp.models.acm.utils.CommonTestData;
import org.onap.policy.common.utils.coder.CoderException;
class ParticipantAckMessageTest {
- private ParticipantAckMessage message;
@Test
void testCopyConstructor() throws CoderException {
@@ -40,8 +39,8 @@ class ParticipantAckMessageTest {
.isInstanceOf(NullPointerException.class);
// verify with null values
- message = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE);
- ParticipantAckMessage newmsg = new ParticipantAckMessage(message);
+ var message = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE);
+ var newmsg = new ParticipantAckMessage(message);
newmsg.setResponseTo(message.getResponseTo());
assertEquals(message.toString(), newmsg.toString());
@@ -56,14 +55,15 @@ class ParticipantAckMessageTest {
@Test
void testAppliesTo_NullParticipantId() {
- message = makeMessage();
- assertThatThrownBy(() -> message.appliesTo(UUID.randomUUID(), null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> message.appliesTo(null, UUID.randomUUID())).isInstanceOf(NullPointerException.class);
+ var message = makeMessage();
+ var participantId = CommonTestData.getRndParticipantId();
+ assertThatThrownBy(() -> message.appliesTo(participantId, null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> message.appliesTo(null, participantId)).isInstanceOf(NullPointerException.class);
}
@Test
void testAppliesTo_ParticipantIdMatches() {
- message = makeMessage();
+ var message = makeMessage();
// ParticipantId matches
assertTrue(message.appliesTo(CommonTestData.getParticipantId(), CommonTestData.getReplicaId()));
@@ -72,7 +72,7 @@ class ParticipantAckMessageTest {
@Test
void testAppliesTo_ParticipantIdNoMatch() {
- message = makeMessage();
+ var message = makeMessage();
// ParticipantId does not match
assertFalse(message.appliesTo(CommonTestData.getRndParticipantId(), CommonTestData.getReplicaId()));
@@ -80,7 +80,7 @@ class ParticipantAckMessageTest {
}
private ParticipantAckMessage makeMessage() {
- ParticipantAckMessage msg = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK);
+ var msg = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK);
msg.setParticipantId(CommonTestData.getParticipantId());
msg.setMessage("Successfull Ack");
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java
index db31d0f01..c6386a571 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java
@@ -33,7 +33,6 @@ import org.onap.policy.clamp.models.acm.utils.CommonTestData;
import org.onap.policy.common.utils.coder.CoderException;
class ParticipantMessageTest {
- private ParticipantMessage message;
@Test
void testCopyConstructor() throws CoderException {
@@ -41,7 +40,7 @@ class ParticipantMessageTest {
.isInstanceOf(NullPointerException.class);
// verify with null values
- message = new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE);
+ var message = new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE);
var newmsg = new ParticipantMessage(message);
newmsg.setMessageId(message.getMessageId());
newmsg.setTimestamp(message.getTimestamp());
@@ -59,15 +58,15 @@ class ParticipantMessageTest {
@Test
void testAppliesTo_NullParticipantId() {
- message = makeMessage();
-
- assertThatThrownBy(() -> message.appliesTo(UUID.randomUUID(), null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> message.appliesTo(null, UUID.randomUUID())).isInstanceOf(NullPointerException.class);
+ var message = makeMessage();
+ var participantId = CommonTestData.getParticipantId();
+ assertThatThrownBy(() -> message.appliesTo(participantId, null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> message.appliesTo(null, participantId)).isInstanceOf(NullPointerException.class);
}
@Test
void testAppliesTo_ParticipantIdMatches() {
- message = makeMessage();
+ var message = makeMessage();
// ParticipantId matches
assertTrue(message.appliesTo(CommonTestData.getParticipantId(), CommonTestData.getReplicaId()));
@@ -76,7 +75,7 @@ class ParticipantMessageTest {
@Test
void testAppliesTo_ParticipantIdNoMatch() {
- message = makeMessage();
+ var message = makeMessage();
assertFalse(message.appliesTo(CommonTestData.getRndParticipantId(), CommonTestData.getReplicaId()));
assertTrue(message.appliesTo(CommonTestData.getParticipantId(), CommonTestData.getReplicaId()));
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestartTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestartTest.java
deleted file mode 100644
index 95b718e68..000000000
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestartTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2023-2024 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.models.acm.messages.kafka.participant;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.models.acm.messages.kafka.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.models.acm.concepts.AcElementRestart;
-import org.onap.policy.clamp.models.acm.concepts.DeployState;
-import org.onap.policy.clamp.models.acm.concepts.LockState;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc;
-import org.onap.policy.clamp.models.acm.utils.CommonTestData;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-class ParticipantRestartTest {
-
- @Test
- void testCopyConstructor() throws CoderException {
-
- final var orig = new ParticipantRestart();
- // verify with null values
- assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ParticipantRestart(orig).toString()));
-
- orig.setMessageId(UUID.randomUUID());
- orig.setCompositionId(UUID.randomUUID());
- orig.setTimestamp(Instant.ofEpochMilli(3000));
- orig.setParticipantId(CommonTestData.getParticipantId());
-
- var participantDefinitionUpdate = new ParticipantDefinition();
- var type = new ToscaConceptIdentifier("id", "1.2.3");
- var acDefinition = CommonTestData.getAcElementDefinition(type);
- participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition));
- orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate));
-
- var acElement = new AcElementRestart();
- acElement.setId(UUID.randomUUID());
- var id = new ToscaConceptIdentifier("id", "1.2.3");
- acElement.setDefinition(id);
- acElement.setDeployState(DeployState.DEPLOYED);
- acElement.setLockState(LockState.LOCKED);
- acElement.setOperationalState("OperationalState");
- acElement.setUseState("UseState");
- acElement.setProperties(Map.of("key", "value"));
- acElement.setOutProperties(Map.of("keyOut", "valueOut"));
-
- var acRestart = new ParticipantRestartAc();
- acRestart.setAcElementList(List.of(acElement));
- acRestart.setAutomationCompositionId(UUID.randomUUID());
-
- orig.setAutomationcompositionList(List.of(acRestart));
-
- assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ParticipantRestart(orig).toString()));
-
- assertSerializable(orig, ParticipantRestart.class);
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
index a6b3c0f80..fab3dac9b 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
@@ -33,6 +33,7 @@ import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
+import org.onap.policy.clamp.models.acm.concepts.SubState;
import org.onap.policy.clamp.models.acm.utils.CommonTestData;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -47,6 +48,8 @@ class JpaAutomationCompositionElementTest {
private static final String NULL_ERROR = " is marked .*ull but is null";
private static final String ELEMENT_ID = "a95757ba-b34a-4049-a2a8-46773abcbe5e";
private static final String INSTANCE_ID = "a78757co-b34a-8949-a2a8-46773abcbe2a";
+ private static final String KEY = "key";
+ private static final String BAD_VALUE = "BadValue";
private static final PfConceptKey CONCEPT_KEY = new PfConceptKey();
@@ -54,18 +57,18 @@ class JpaAutomationCompositionElementTest {
void testJpaAutomationCompositionElementConstructor() {
assertThatThrownBy(() -> {
new JpaAutomationCompositionElement((AutomationCompositionElement) null);
- }).hasMessageMatching("authorativeConcept is marked .*ull but is null");
+ }).hasMessageMatching("authorativeConcept" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaAutomationCompositionElement((JpaAutomationCompositionElement) null);
- }).hasMessageMatching("copyConcept is marked .*ull but is null");
+ }).hasMessageMatching("copyConcept" + NULL_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationCompositionElement("key", null);
+ new JpaAutomationCompositionElement(KEY, null);
}).hasMessageMatching(NULL_INSTANCE_ID_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationCompositionElement(null, "key");
+ new JpaAutomationCompositionElement(null, KEY);
}).hasMessageMatching(NULL_ELEMENT_ID_ERROR);
assertThatThrownBy(() -> {
@@ -73,33 +76,38 @@ class JpaAutomationCompositionElementTest {
}).hasMessageMatching(NULL_ELEMENT_ID_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationCompositionElement(null, null, null, null, null);
+ new JpaAutomationCompositionElement(null, null, null, null, null, null);
}).hasMessageMatching(NULL_ELEMENT_ID_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationCompositionElement("key", null, null,
- DeployState.UNDEPLOYED, LockState.LOCKED);
+ new JpaAutomationCompositionElement(KEY, null, null,
+ DeployState.UNDEPLOYED, LockState.LOCKED, SubState.NONE);
}).hasMessageMatching(NULL_INSTANCE_ID_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationCompositionElement("key", "key", null,
- DeployState.UNDEPLOYED, LockState.LOCKED);
+ new JpaAutomationCompositionElement(KEY, KEY, null,
+ DeployState.UNDEPLOYED, LockState.LOCKED, SubState.NONE);
}).hasMessageMatching("definition" + NULL_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationCompositionElement("key", "key", CONCEPT_KEY,
- null, LockState.LOCKED);
+ new JpaAutomationCompositionElement(KEY, KEY, CONCEPT_KEY,
+ null, LockState.LOCKED, SubState.NONE);
}).hasMessageMatching("deployState" + NULL_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationCompositionElement("key", "key", CONCEPT_KEY,
- DeployState.UNDEPLOYED, null);
+ new JpaAutomationCompositionElement(KEY, KEY, CONCEPT_KEY,
+ DeployState.UNDEPLOYED, null, SubState.NONE);
}).hasMessageMatching("lockState" + NULL_ERROR);
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(KEY, KEY, CONCEPT_KEY,
+ DeployState.UNDEPLOYED, LockState.NONE, null);
+ }).hasMessageMatching("subState" + NULL_ERROR);
+
assertDoesNotThrow(() -> new JpaAutomationCompositionElement());
- assertDoesNotThrow(() -> new JpaAutomationCompositionElement("key", "key"));
- assertDoesNotThrow(() -> new JpaAutomationCompositionElement("key", "key",
- CONCEPT_KEY, DeployState.UNDEPLOYED, LockState.LOCKED));
+ assertDoesNotThrow(() -> new JpaAutomationCompositionElement(KEY, KEY));
+ assertDoesNotThrow(() -> new JpaAutomationCompositionElement(KEY, KEY,
+ new PfConceptKey(), DeployState.UNDEPLOYED, LockState.LOCKED, SubState.NONE));
}
@Test
@@ -111,7 +119,7 @@ class JpaAutomationCompositionElementTest {
assertThatThrownBy(() -> {
testJpaAcElement.fromAuthorative(null);
- }).hasMessageMatching("element is marked .*ull but is null");
+ }).hasMessageMatching("element" + NULL_ERROR);
assertThatThrownBy(() -> new JpaAutomationCompositionElement((JpaAutomationCompositionElement) null))
.isInstanceOf(NullPointerException.class);
@@ -137,7 +145,7 @@ class JpaAutomationCompositionElementTest {
var testJpaAutomationCompositionElement = createJpaAutomationCompositionElementInstance();
assertThatThrownBy(() -> testJpaAutomationCompositionElement.validate(null))
- .hasMessageMatching("fieldName is marked .*ull but is null");
+ .hasMessageMatching("fieldName" + NULL_ERROR);
assertTrue(testJpaAutomationCompositionElement.validate("").isValid());
}
@@ -164,17 +172,17 @@ class JpaAutomationCompositionElementTest {
var otherJpaAcElement =
new JpaAutomationCompositionElement(testJpaAcElement);
- testJpaAcElement.setElementId("BadValue");
+ testJpaAcElement.setElementId(BAD_VALUE);
assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
testJpaAcElement.setElementId(ELEMENT_ID);
assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
- testJpaAcElement.setInstanceId("BadValue");
+ testJpaAcElement.setInstanceId(BAD_VALUE);
assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
testJpaAcElement.setInstanceId(INSTANCE_ID);
assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
- testJpaAcElement.setDefinition(new PfConceptKey("BadValue", "0.0.1"));
+ testJpaAcElement.setDefinition(new PfConceptKey(BAD_VALUE, "0.0.1"));
assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
testJpaAcElement.setDefinition(new PfConceptKey("aceDef", "0.0.1"));
assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
@@ -194,16 +202,26 @@ class JpaAutomationCompositionElementTest {
testJpaAcElement.setLockState(LockState.LOCKED);
assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
- testJpaAcElement.setUseState("BadValue");
+ testJpaAcElement.setSubState(SubState.PREPARING);
+ assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
+ testJpaAcElement.setSubState(SubState.NONE);
+ assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
+
+ testJpaAcElement.setUseState(BAD_VALUE);
assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
testJpaAcElement.setUseState("IDLE");
assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
- testJpaAcElement.setOperationalState("BadValue");
+ testJpaAcElement.setOperationalState(BAD_VALUE);
assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
testJpaAcElement.setOperationalState("DEFAULT");
assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
+ testJpaAcElement.setStage(1);
+ assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
+ testJpaAcElement.setStage(null);
+ assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
+
testJpaAcElement.setMessage("Message");
assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
testJpaAcElement.setMessage(null);
@@ -249,7 +267,7 @@ class JpaAutomationCompositionElementTest {
var testJpaAcElement =
new JpaAutomationCompositionElement(testAce.getId().toString(), INSTANCE_ID);
testJpaAcElement.fromAuthorative(testAce);
- testJpaAcElement.setProperties(Map.of("key", "{}"));
+ testJpaAcElement.setProperties(Map.of(KEY, "{}"));
return testJpaAcElement;
}
@@ -259,7 +277,7 @@ class JpaAutomationCompositionElementTest {
automationCompositionElement.setId(UUID.fromString(ELEMENT_ID));
automationCompositionElement.setDefinition(new ToscaConceptIdentifier("aceDef", "0.0.1"));
automationCompositionElement.setParticipantId(CommonTestData.getParticipantId());
- automationCompositionElement.setProperties(Map.of("key", "{}"));
+ automationCompositionElement.setProperties(Map.of(KEY, "{}"));
automationCompositionElement.setUseState("IDLE");
automationCompositionElement.setOperationalState("DEFAULT");
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
index b56e77801..38153d488 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
@@ -37,6 +37,7 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
+import org.onap.policy.clamp.models.acm.concepts.SubState;
import org.onap.policy.clamp.models.acm.utils.TimestampHelper;
import org.onap.policy.models.base.PfConceptKey;
@@ -46,7 +47,7 @@ import org.onap.policy.models.base.PfConceptKey;
class JpaAutomationCompositionTest {
private static final String NULL_INSTANCE_ID_ERROR = "instanceId is marked .*ull but is null";
- private static final String NULL_TEXT_ERROR = " is marked .*ull but is null";
+ private static final String NULL_ERROR = " is marked .*ull but is null";
private static final String INSTANCE_ID = "709c62b3-8918-41b9-a747-d21eb79c6c20";
private static final String COMPOSITION_ID = "709c62b3-8918-41b9-a747-e21eb79c6c41";
@@ -54,44 +55,49 @@ class JpaAutomationCompositionTest {
void testJpaAutomationCompositionConstructor() {
assertThatThrownBy(() -> {
new JpaAutomationComposition((JpaAutomationComposition) null);
- }).hasMessageMatching("copyConcept is marked .*ull but is null");
+ }).hasMessageMatching("copyConcept" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaAutomationComposition((AutomationComposition) null);
- }).hasMessageMatching("authorativeConcept is marked .*ull but is null");
+ }).hasMessageMatching("authorativeConcept" + NULL_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationComposition(null, null, null, null, null, null);
+ new JpaAutomationComposition(null, null, null, null, null, null, null);
}).hasMessageMatching(NULL_INSTANCE_ID_ERROR);
assertThatThrownBy(() -> {
new JpaAutomationComposition(INSTANCE_ID, null, null, new ArrayList<>(), DeployState.UNDEPLOYED,
- LockState.LOCKED);
- }).hasMessageMatching("key" + NULL_TEXT_ERROR);
+ LockState.LOCKED, SubState.NONE);
+ }).hasMessageMatching("key" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), null, new ArrayList<>(),
- DeployState.UNDEPLOYED, LockState.LOCKED);
- }).hasMessageMatching("compositionId" + NULL_TEXT_ERROR);
+ DeployState.UNDEPLOYED, LockState.LOCKED, SubState.NONE);
+ }).hasMessageMatching("compositionId" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID, null,
- DeployState.UNDEPLOYED, LockState.LOCKED);
- }).hasMessageMatching("elements" + NULL_TEXT_ERROR);
+ DeployState.UNDEPLOYED, LockState.LOCKED, SubState.NONE);
+ }).hasMessageMatching("elements" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID, new ArrayList<>(),
- null, LockState.LOCKED);
- }).hasMessageMatching("deployState" + NULL_TEXT_ERROR);
+ null, LockState.LOCKED, SubState.NONE);
+ }).hasMessageMatching("deployState" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID, new ArrayList<>(),
- DeployState.UNDEPLOYED, null);
- }).hasMessageMatching("lockState" + NULL_TEXT_ERROR);
+ DeployState.UNDEPLOYED, null, SubState.NONE);
+ }).hasMessageMatching("lockState" + NULL_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID, new ArrayList<>(),
+ DeployState.UNDEPLOYED, LockState.NONE, null);
+ }).hasMessageMatching("subState" + NULL_ERROR);
assertDoesNotThrow(() -> new JpaAutomationComposition());
assertDoesNotThrow(() -> new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID,
- new ArrayList<>(), DeployState.UNDEPLOYED, LockState.LOCKED));
+ new ArrayList<>(), DeployState.UNDEPLOYED, LockState.LOCKED, SubState.NONE));
}
@Test
@@ -108,7 +114,7 @@ class JpaAutomationCompositionTest {
assertThatThrownBy(() -> {
jpaAutomationComposition.fromAuthorative(null);
- }).hasMessageMatching("automationComposition is marked .*ull but is null");
+ }).hasMessageMatching("automationComposition" + NULL_ERROR);
assertThatThrownBy(() -> new JpaAutomationComposition((JpaAutomationComposition) null))
.isInstanceOf(NullPointerException.class);
@@ -137,7 +143,7 @@ class JpaAutomationCompositionTest {
}
@Test
- void testJpaAutomationCompositionCompareTo() {
+ void testJpaAutomationCompositionCompareTo1() {
var jpaAutomationComposition = new JpaAutomationComposition(createAutomationCompositionInstance());
var otherJpaAutomationComposition = new JpaAutomationComposition(jpaAutomationComposition);
@@ -180,6 +186,12 @@ class JpaAutomationCompositionTest {
assertNotEquals(0, jpaAutomationComposition.compareTo(otherJpaAutomationComposition));
jpaAutomationComposition.setPhase(null);
assertEquals(0, jpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ }
+
+ @Test
+ void testJpaAutomationCompositionCompareTo2() {
+ var jpaAutomationComposition = new JpaAutomationComposition(createAutomationCompositionInstance());
+ var otherJpaAutomationComposition = new JpaAutomationComposition(jpaAutomationComposition);
jpaAutomationComposition.setDeployState(DeployState.DEPLOYED);
assertNotEquals(0, jpaAutomationComposition.compareTo(otherJpaAutomationComposition));
@@ -191,14 +203,14 @@ class JpaAutomationCompositionTest {
jpaAutomationComposition.setLockState(LockState.NONE);
assertEquals(0, jpaAutomationComposition.compareTo(otherJpaAutomationComposition));
- jpaAutomationComposition.setDescription("A description");
+ jpaAutomationComposition.setSubState(SubState.PREPARING);
assertNotEquals(0, jpaAutomationComposition.compareTo(otherJpaAutomationComposition));
- jpaAutomationComposition.setDescription(null);
+ jpaAutomationComposition.setSubState(SubState.NONE);
assertEquals(0, jpaAutomationComposition.compareTo(otherJpaAutomationComposition));
- jpaAutomationComposition.setRestarting(true);
+ jpaAutomationComposition.setDescription("A description");
assertNotEquals(0, jpaAutomationComposition.compareTo(otherJpaAutomationComposition));
- jpaAutomationComposition.setRestarting(null);
+ jpaAutomationComposition.setDescription(null);
assertEquals(0, jpaAutomationComposition.compareTo(otherJpaAutomationComposition));
jpaAutomationComposition.setStateChangeResult(StateChangeResult.NO_ERROR);
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java
index 85dadc3de..95811917d 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java
@@ -83,7 +83,7 @@ class AcDefinitionProviderTest {
.hasMessageStartingWith("\"AutomationCompositionDefinition\" INVALID, item has status INVALID");
assertThatThrownBy(() -> acDefinitionProvider.updateAcDefinitionState(compositionId, AcTypeState.PRIMED,
- StateChangeResult.NO_ERROR, false))
+ StateChangeResult.NO_ERROR))
.hasMessageStartingWith("update of Automation Composition Definition");
}
@@ -195,7 +195,7 @@ class AcDefinitionProviderTest {
when(acmDefinitionRepository.findById(acmDefinition.getCompositionId().toString()))
.thenReturn(Optional.of(jpa));
acDefinitionProvider.updateAcDefinitionState(acmDefinition.getCompositionId(), AcTypeState.PRIMED,
- StateChangeResult.NO_ERROR, false);
+ StateChangeResult.NO_ERROR);
verify(acmDefinitionRepository).save(jpa);
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolverTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolverTest.java
index 7f6cb2f0c..a807a1179 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolverTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolverTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation.
+ * Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,42 +26,78 @@ import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
+import org.onap.policy.clamp.models.acm.concepts.SubState;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.SubOrder;
class AcInstanceStateResolverTest {
@Test
void testResolve() {
var acTypeStateResolver = new AcInstanceStateResolver();
- var result = acTypeStateResolver.resolve(DeployOrder.DEPLOY, LockOrder.NONE, DeployState.UNDEPLOYED,
- LockState.NONE, StateChangeResult.NO_ERROR);
+ // deploy
+ var result = acTypeStateResolver.resolve(DeployOrder.DEPLOY, LockOrder.NONE, SubOrder.NONE,
+ DeployState.UNDEPLOYED, LockState.NONE, SubState.NONE, StateChangeResult.NO_ERROR);
assertThat(result).isEqualTo(AcInstanceStateResolver.DEPLOY);
- result = acTypeStateResolver.resolve(DeployOrder.UNDEPLOY, LockOrder.NONE, DeployState.DEPLOYED,
- LockState.LOCKED, StateChangeResult.NO_ERROR);
+
+ // undeploy
+ result = acTypeStateResolver.resolve(DeployOrder.UNDEPLOY, LockOrder.NONE, SubOrder.NONE,
+ DeployState.DEPLOYED, LockState.LOCKED, SubState.NONE, StateChangeResult.NO_ERROR);
assertThat(result).isEqualTo(AcInstanceStateResolver.UNDEPLOY);
- result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.UNLOCK, DeployState.DEPLOYED, LockState.LOCKED,
- StateChangeResult.NO_ERROR);
+
+ // unlock
+ result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.UNLOCK, SubOrder.NONE,
+ DeployState.DEPLOYED, LockState.LOCKED, SubState.NONE, StateChangeResult.NO_ERROR);
assertThat(result).isEqualTo(AcInstanceStateResolver.UNLOCK);
- result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.LOCK, DeployState.DEPLOYED, LockState.UNLOCKED,
- StateChangeResult.NO_ERROR);
+
+ // lock
+ result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.LOCK, SubOrder.NONE,
+ DeployState.DEPLOYED, LockState.UNLOCKED, SubState.NONE, StateChangeResult.NO_ERROR);
assertThat(result).isEqualTo(AcInstanceStateResolver.LOCK);
- result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.NONE, DeployState.UNDEPLOYED, LockState.NONE,
- StateChangeResult.NO_ERROR);
+ // migrate
+ result = acTypeStateResolver.resolve(DeployOrder.MIGRATE, LockOrder.NONE, SubOrder.NONE,
+ DeployState.DEPLOYED, LockState.LOCKED, SubState.NONE, StateChangeResult.NO_ERROR);
+ assertThat(result).isEqualTo(AcInstanceStateResolver.MIGRATE);
+
+ // migrate-precheck
+ result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.NONE, SubOrder.MIGRATE_PRECHECK,
+ DeployState.DEPLOYED, LockState.LOCKED, SubState.NONE, StateChangeResult.NO_ERROR);
+ assertThat(result).isEqualTo(AcInstanceStateResolver.MIGRATE_PRECHECK);
+
+ // prepare
+ result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.NONE, SubOrder.PREPARE,
+ DeployState.UNDEPLOYED, LockState.NONE, SubState.NONE, StateChangeResult.NO_ERROR);
+ assertThat(result).isEqualTo(AcInstanceStateResolver.PREPARE);
+
+ // review
+ result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.NONE, SubOrder.REVIEW,
+ DeployState.DEPLOYED, LockState.LOCKED, SubState.NONE, StateChangeResult.NO_ERROR);
+ assertThat(result).isEqualTo(AcInstanceStateResolver.REVIEW);
+ }
+
+ @Test
+ void testResolveWrongOrder() {
+ var acTypeStateResolver = new AcInstanceStateResolver();
+
+ var result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.NONE, SubOrder.NONE,
+ DeployState.UNDEPLOYED, LockState.NONE, SubState.NONE, StateChangeResult.NO_ERROR);
assertThat(result).isEqualTo(AcInstanceStateResolver.NONE);
- result = acTypeStateResolver.resolve(DeployOrder.UNDEPLOY, LockOrder.UNLOCK, DeployState.DEPLOYED,
- LockState.LOCKED, StateChangeResult.NO_ERROR);
+
+ result = acTypeStateResolver.resolve(DeployOrder.UNDEPLOY, LockOrder.UNLOCK, SubOrder.NONE,
+ DeployState.DEPLOYED, LockState.LOCKED, SubState.NONE, StateChangeResult.NO_ERROR);
assertThat(result).isEqualTo(AcInstanceStateResolver.NONE);
- result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.UNLOCK, DeployState.UNDEPLOYED, LockState.NONE,
- StateChangeResult.NO_ERROR);
+
+ result = acTypeStateResolver.resolve(DeployOrder.NONE, LockOrder.UNLOCK, SubOrder.NONE,
+ DeployState.UNDEPLOYED, LockState.NONE, SubState.NONE, StateChangeResult.NO_ERROR);
assertThat(result).isEqualTo(AcInstanceStateResolver.NONE);
- result = acTypeStateResolver.resolve(DeployOrder.UNDEPLOY, LockOrder.NONE, DeployState.DEPLOYING,
- LockState.NONE, StateChangeResult.NO_ERROR);
+
+ result = acTypeStateResolver.resolve(DeployOrder.UNDEPLOY, LockOrder.NONE, SubOrder.NONE,
+ DeployState.DEPLOYING, LockState.NONE, SubState.NONE, StateChangeResult.NO_ERROR);
assertThat(result).isEqualTo(AcInstanceStateResolver.NONE);
- result = acTypeStateResolver.resolve(null, null, null, null, null);
+ result = acTypeStateResolver.resolve(null, null, null, null, null, null, null);
assertThat(result).isEqualTo(AcInstanceStateResolver.NONE);
}
-
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java
index 515dfaa83..c2368fe10 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java
@@ -56,6 +56,7 @@ class AutomationCompositionProviderTest {
private static final String AC_IS_NULL = "automationComposition is marked non-null but is null";
private static final String ACELEMENT_IS_NULL = "element is marked non-null but is null";
+ private static final String ACELEMENT_ID_IS_NULL = "elementId is marked non-null but is null";
private static final Coder CODER = new StandardCoder();
private static final String AUTOMATION_COMPOSITION_JSON =
@@ -241,6 +242,18 @@ class AutomationCompositionProviderTest {
}
@Test
+ void testDeleteElementById() {
+ var acElementRepository = mock(AutomationCompositionElementRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(
+ mock(AutomationCompositionRepository.class), acElementRepository);
+ assertThatThrownBy(() -> automationCompositionProvider.deleteAutomationCompositionElement(null))
+ .hasMessageMatching(ACELEMENT_ID_IS_NULL);
+ var elementId = UUID.randomUUID();
+ automationCompositionProvider.deleteAutomationCompositionElement(elementId);
+ verify(acElementRepository).deleteById(elementId.toString());
+ }
+
+ @Test
void testValidateElementIds() {
var acElementRepository = mock(AutomationCompositionElementRepository.class);
var automationCompositionProvider = new AutomationCompositionProvider(
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
index f17eff398..97af64cf7 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
@@ -43,6 +43,7 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
+import org.onap.policy.clamp.models.acm.concepts.SubState;
import org.onap.policy.clamp.models.acm.document.concepts.DocToscaServiceTemplate;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder;
@@ -68,14 +69,16 @@ class AcmUtilsTest {
@Test
void testIsInTransitionalState() {
- assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.LOCKED)).isFalse();
- assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYING, LockState.NONE)).isTrue();
- assertThat(AcmUtils.isInTransitionalState(DeployState.UNDEPLOYING, LockState.NONE)).isTrue();
- assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.LOCKING)).isTrue();
- assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.UNLOCKING)).isTrue();
- assertThat(AcmUtils.isInTransitionalState(DeployState.DELETING, LockState.NONE)).isTrue();
- assertThat(AcmUtils.isInTransitionalState(DeployState.UPDATING, LockState.LOCKED)).isTrue();
- assertThat(AcmUtils.isInTransitionalState(DeployState.MIGRATING, LockState.LOCKED)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.LOCKED, SubState.NONE)).isFalse();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYING, LockState.NONE, SubState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.UNDEPLOYING, LockState.NONE, SubState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.LOCKING, SubState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.UNLOCKING, SubState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DELETING, LockState.NONE, SubState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.UPDATING, LockState.LOCKED, SubState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.MIGRATING, LockState.LOCKED, SubState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.LOCKED,
+ SubState.MIGRATION_PRECHECKING)).isTrue();
}
@Test
@@ -235,6 +238,16 @@ class AcmUtilsTest {
assertEquals(element.getOutProperties(), result.getOutProperties());
}
+ @Test
+ void testValidatedMessage() {
+ var message = "completed";
+ assertEquals(message, AcmUtils.validatedMessage(message));
+
+ var serviceTemplate = CommonTestData.getToscaServiceTemplate(TOSCA_TEMPLATE_YAML);
+ message = serviceTemplate.toString();
+ assertEquals(message.substring(0, 255), AcmUtils.validatedMessage(message));
+ }
+
private AutomationComposition getDummyAutomationComposition() {
var automationComposition = new AutomationComposition();
automationComposition.setCompositionId(UUID.randomUUID());
diff --git a/models/src/test/resources/examples/acm/test-pm-subscription-handling.yaml b/models/src/test/resources/examples/acm/test-pm-subscription-handling.yaml
index 2b0b4feff..6539a9c75 100644
--- a/models/src/test/resources/examples/acm/test-pm-subscription-handling.yaml
+++ b/models/src/test/resources/examples/acm/test-pm-subscription-handling.yaml
@@ -317,6 +317,15 @@ node_types:
provider:
type: string
required: false
+ stage:
+ type: array
+ required: false
+ items:
+ type: integer
+ constraints:
+ - greater-or-equal: 0
+ metadata:
+ common: true
startPhase:
type: integer
required: false
@@ -394,6 +403,7 @@ topology_template:
description: Participant for DCAE microservices
properties:
provider: ONAP
+ startPhase: 0
org.onap.policy.acm.PolicyAutomationCompositionParticipant:
version: 2.3.1
type: org.onap.policy.clamp.acm.Participant
@@ -401,6 +411,7 @@ topology_template:
description: Participant for DCAE microservices
properties:
provider: ONAP
+ startPhase: 0
org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant:
version: 2.2.1
type: org.onap.policy.clamp.acm.Participant
@@ -408,6 +419,7 @@ topology_template:
description: Participant for DCAE microservices
properties:
provider: ONAP
+ startPhase: 1
org.onap.domain.pmsh.PMSH_DCAEMicroservice:
version: 1.2.3
type: org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement
@@ -415,6 +427,7 @@ topology_template:
description: Automation composition element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
+ startPhase: 1
dcae_blueprint:
tosca_definitions_version: cloudify_dsl_1_3
imports:
@@ -641,6 +654,7 @@ topology_template:
version: 1.0.0
policy_id:
get_input: pmsh_monitoring_policy
+ stage: [0,1,2]
org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement:
version: 1.2.3
type: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement