summaryrefslogtreecommitdiffstats
path: root/runtime-acm/src
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-02-02 15:42:56 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-02-03 09:25:32 +0000
commit4ad78088b7d1098f5529611eff15b1d61fc66a04 (patch)
tree7babd109983b2ac320eb5890342905b6397d7766 /runtime-acm/src
parent26814a2d839be880fa56c658f0d88940d957e872 (diff)
Handle AC Element Instance Deployment and undeployment on ACM-R
Part of the implementation related to Deployment and undeployment, missing part will be implemented in POLICY-4509. push-upstream: POLICY-4506 Change-Id: Ie7ad2da6c0a3286938fc4993d70ee71caee833ba Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src')
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java123
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java6
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java19
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java2
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java74
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java140
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java12
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java5
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationComposition.json31
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json37
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json36
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json31
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json31
13 files changed, 198 insertions, 349 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
index 4949c6612..5281cb537 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
@@ -21,25 +21,20 @@
package org.onap.policy.clamp.acm.runtime.instantiation;
-import java.util.List;
import java.util.UUID;
-import java.util.function.Function;
-import java.util.stream.Collectors;
+import javax.validation.Valid;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
-import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
-import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
-import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
-import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AcInstanceStateUpdate;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.AcInstanceStateResolver;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
-import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
import org.onap.policy.clamp.models.acm.utils.AcmUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ObjectValidationResult;
@@ -55,14 +50,11 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional
@AllArgsConstructor
public class AutomationCompositionInstantiationProvider {
- private static final String AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE = "AutomationCompositionElement";
private static final String DO_NOT_MATCH = " do not match with ";
private final AutomationCompositionProvider automationCompositionProvider;
- private final SupervisionHandler supervisionHandler;
- private final ParticipantProvider participantProvider;
private final AcDefinitionProvider acDefinitionProvider;
- private static final String ENTRY = "entry ";
+ private final AcInstanceStateResolver acInstanceStateResolver;
/**
* Create automation composition.
@@ -142,10 +134,24 @@ public class AutomationCompositionInstantiationProvider {
if (acDefinitionOpt.isEmpty()) {
result.addResult(new ObjectValidationResult("ServiceTemplate", "", ValidationStatus.INVALID,
"Commissioned automation composition definition not found"));
- } else {
- result.addResult(AcmUtils.validateAutomationComposition(automationComposition,
- acDefinitionOpt.get().getServiceTemplate()));
+ return result;
}
+ if (!AcTypeState.PRIMED.equals(acDefinitionOpt.get().getState())) {
+ result.addResult(new ObjectValidationResult("ServiceTemplate", "", ValidationStatus.INVALID,
+ "Commissioned automation composition definition not primed"));
+ return result;
+ }
+ result.addResult(AcmUtils.validateAutomationComposition(automationComposition,
+ acDefinitionOpt.get().getServiceTemplate()));
+
+ if (result.isValid()) {
+ for (var element : automationComposition.getElements().values()) {
+ var name = element.getDefinition().getName();
+ var participantId = acDefinitionOpt.get().getElementStateMap().get(name).getParticipantId();
+ element.setParticipantId(participantId);
+ }
+ }
+
return result;
}
@@ -208,61 +214,42 @@ public class AutomationCompositionInstantiationProvider {
}
/**
- * Issue a command to automation compositions, setting their ordered state.
+ * Handle Composition Instance State.
*
- * @param automationComposition the AutomationComposition
- * @param command the command to issue to automation compositions
+ * @param compositionId the compositionId
+ * @param instanceId the instanceId
+ * @param acInstanceStateUpdate the AcInstanceStateUpdate
*/
- public void issueAutomationCompositionCommand(AutomationComposition automationComposition,
- InstantiationCommand command) {
-
- if (command.getOrderedState() == null) {
- throw new AutomationCompositionRuntimeException(Status.BAD_REQUEST,
- "ordered state invalid or not specified on command");
- }
-
- var participants = participantProvider.getParticipants();
- if (participants.isEmpty()) {
- throw new AutomationCompositionRuntimeException(Status.BAD_REQUEST, "No participants registered");
- }
- var validationResult = validateIssueAutomationComposition(automationComposition, participants);
- if (!validationResult.isValid()) {
- throw new AutomationCompositionRuntimeException(Response.Status.BAD_REQUEST, validationResult.getResult());
- }
-
- automationComposition.setCascadedOrderedState(command.getOrderedState());
- try {
- supervisionHandler.triggerAutomationCompositionSupervision(automationComposition);
- } catch (AutomationCompositionException e) {
- throw new AutomationCompositionRuntimeException(Response.Status.BAD_REQUEST, e.getMessage());
+ public void compositionInstanceState(UUID compositionId, UUID instanceId,
+ @Valid AcInstanceStateUpdate acInstanceStateUpdate) {
+ var automationComposition = automationCompositionProvider.getAutomationComposition(instanceId);
+ if (!compositionId.equals(automationComposition.getCompositionId())) {
+ throw new PfModelRuntimeException(Response.Status.BAD_REQUEST,
+ automationComposition.getCompositionId() + DO_NOT_MATCH + compositionId);
}
- automationCompositionProvider.updateAutomationComposition(automationComposition);
- }
-
- private BeanValidationResult validateIssueAutomationComposition(AutomationComposition automationComposition,
- List<Participant> participants) {
- var result = new BeanValidationResult("AutomationComposition", automationComposition);
-
- var participantMap = participants.stream()
- .collect(Collectors.toMap(participant -> participant.getParticipantId(), Function.identity()));
-
- for (var element : automationComposition.getElements().values()) {
-
- var subResult = new BeanValidationResult(ENTRY + element.getDefinition().getName(), element);
- var p = participantMap.get(element.getParticipantId());
- if (p == null) {
- subResult.addResult(new ObjectValidationResult(AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE,
- element.getDefinition().getName(), ValidationStatus.INVALID,
- "Participant with ID " + element.getParticipantId() + " is not registered"));
- } else if (!p.getParticipantId().equals(element.getParticipantId())) {
- subResult.addResult(new ObjectValidationResult(AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE,
- element.getDefinition().getName(), ValidationStatus.INVALID,
- "Participant with ID " + " - " + element.getParticipantId()
- + " is not registered"));
- }
- result.addResult(subResult);
+ var acDefinition = acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId());
+ var result = acInstanceStateResolver.resolve(acInstanceStateUpdate.getDeployOrder(),
+ acInstanceStateUpdate.getLockOrder(), automationComposition.getDeployState(),
+ automationComposition.getLockState());
+ switch (result) {
+ case "DEPLOY":
+ //
+ break;
+
+ case "UNDEPLOY":
+ //
+ break;
+
+ case "LOCK":
+ //
+ break;
+
+ case "UNLOCK":
+ //
+ break;
+
+ default:
+ throw new PfModelRuntimeException(Status.BAD_REQUEST, "Not valid " + acInstanceStateUpdate);
}
-
- return result;
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
index 94c111e00..afe09314f 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -116,7 +116,7 @@ public class InstantiationController extends AbstractRestController implements A
@Override
public ResponseEntity<Void> compositionInstanceState(UUID compositionId, UUID instanceId,
@Valid AcInstanceStateUpdate body, UUID requestId) {
- // TODO Auto-generated method stub
- return null;
+ provider.compositionInstanceState(compositionId, instanceId, body);
+ return ResponseEntity.accepted().build();
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
index b31a95b18..db726e09d 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
@@ -141,7 +141,6 @@ public class SupervisionHandler {
if (automationComposition.isPresent()) {
var updated = updateState(automationComposition.get(),
automationCompositionAckMessage.getAutomationCompositionResultMap().entrySet());
- updated |= setPrimed(automationComposition.get());
if (updated) {
automationCompositionProvider.updateAutomationComposition(automationComposition.get());
}
@@ -165,24 +164,6 @@ public class SupervisionHandler {
return updated;
}
- private boolean setPrimed(AutomationComposition automationComposition) {
- var acElements = automationComposition.getElements().values();
- if (acElements != null) {
- Boolean primedFlag = true;
- var checkOpt = automationComposition.getElements().values().stream()
- .filter(acElement -> (!acElement.getState().equals(AutomationCompositionState.PASSIVE)
- || !acElement.getState().equals(AutomationCompositionState.RUNNING)))
- .findAny();
- if (checkOpt.isEmpty()) {
- primedFlag = false;
- }
- automationComposition.setPrimed(primedFlag);
- return true;
- }
-
- return false;
- }
-
/**
* Supervise a automation composition, performing whatever actions need to be performed on the automation
* composition.
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
index 4a0abc180..0811a5a44 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
@@ -78,7 +78,7 @@ public class AutomationCompositionDeployPublisher extends AbstractParticipantPub
List<ParticipantDeploy> participantDeploys = new ArrayList<>();
for (var element : automationComposition.getElements().values()) {
- AcmUtils.setAcPolicyInfo(element, toscaServiceTemplate);
+ element.setToscaServiceTemplateFragment(AcmUtils.getToscaServiceTemplateFragment(toscaServiceTemplate));
AcmUtils.prepareParticipantUpdate(element, participantDeploys);
}
acDeployMsg.setParticipantUpdatesList(participantDeploys);
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
index 0a46bc6b8..019d53c0b 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
@@ -33,17 +33,13 @@ import java.util.Optional;
import java.util.UUID;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
-import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
-import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.ProviderUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
@@ -56,13 +52,13 @@ class AutomationCompositionInstantiationProviderTest {
private static final String AC_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/acm/AutomationComposition.json";
private static final String AC_INSTANTIATION_UPDATE_JSON =
"src/test/resources/rest/acm/AutomationCompositionUpdate.json";
- private static final String AC_INSTANTIATION_CHANGE_STATE_JSON = "src/test/resources/rest/acm/PassiveCommand.json";
+
private static final String AC_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON =
"src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json";
private static final String AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON =
"src/test/resources/rest/acm/AutomationCompositionNotFound.json";
private static final String DELETE_BAD_REQUEST = "Automation composition state is still %s";
- private static final String ORDERED_STATE_INVALID = "ordered state invalid or not specified on command";
+
private static final String AC_ELEMENT_NAME_NOT_FOUND =
"\"AutomationComposition\" INVALID, item has status INVALID\n"
+ " \"entry PMSHInstance0AcElementNotFound\" INVALID, item has status INVALID\n"
@@ -86,18 +82,13 @@ class AutomationCompositionInstantiationProviderTest {
@Test
void testInstantiationCrud() throws AutomationCompositionException {
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var participants = CommonTestData.createParticipants();
- when(participantProvider.getParticipants()).thenReturn(participants);
-
var acDefinitionProvider = mock(AcDefinitionProvider.class);
var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
var compositionId = acDefinition.getCompositionId();
when(acDefinitionProvider.findAcDefinition(compositionId)).thenReturn(Optional.of(acDefinition));
- var supervisionHandler = mock(SupervisionHandler.class);
var acProvider = mock(AutomationCompositionProvider.class);
- var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var instantiationProvider =
+ new AutomationCompositionInstantiationProvider(acProvider, acDefinitionProvider, null);
var automationCompositionCreate =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud");
automationCompositionCreate.setCompositionId(compositionId);
@@ -132,15 +123,6 @@ class AutomationCompositionInstantiationProviderTest {
verify(acProvider).updateAutomationComposition(automationCompositionUpdate);
- var instantiationCommand =
- InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON);
- instantiationProvider.issueAutomationCompositionCommand(automationCompositionUpdate,
- instantiationCommand);
- verify(supervisionHandler).triggerAutomationCompositionSupervision(automationCompositionUpdate);
-
- // in order to delete a automationComposition the state must be UNINITIALISED
- automationCompositionCreate.setState(AutomationCompositionState.UNINITIALISED);
-
when(acProvider.deleteAutomationComposition(automationCompositionUpdate.getInstanceId()))
.thenReturn(automationCompositionUpdate);
instantiationProvider.deleteAutomationComposition(automationCompositionCreate.getCompositionId(),
@@ -154,13 +136,11 @@ class AutomationCompositionInstantiationProviderTest {
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete");
- var participantProvider = Mockito.mock(ParticipantProvider.class);
var acProvider = mock(AutomationCompositionProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
- var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider,
+ acDefinitionProvider, null);
when(acProvider.getAutomationComposition(automationComposition.getInstanceId()))
.thenReturn(automationComposition);
@@ -185,13 +165,11 @@ class AutomationCompositionInstantiationProviderTest {
private void assertThatDeleteThrownBy(AutomationComposition automationComposition,
AutomationCompositionState state) {
automationComposition.setState(state);
- var participantProvider = Mockito.mock(ParticipantProvider.class);
var acProvider = mock(AutomationCompositionProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
- var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider,
+ acDefinitionProvider, null);
when(acProvider.getAutomationComposition(automationComposition.getInstanceId()))
.thenReturn(automationComposition);
@@ -218,11 +196,8 @@ class AutomationCompositionInstantiationProviderTest {
when(acProvider.createAutomationComposition(automationCompositionCreate))
.thenReturn(automationCompositionCreate);
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
-
- var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider,
+ acDefinitionProvider, null);
var instantiationResponse = instantiationProvider.createAutomationComposition(
automationCompositionCreate.getCompositionId(), automationCompositionCreate);
@@ -247,10 +222,8 @@ class AutomationCompositionInstantiationProviderTest {
automationComposition.setCompositionId(compositionId);
var acProvider = mock(AutomationCompositionProvider.class);
- var participantProvider = mock(ParticipantProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
- var provider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var provider = new AutomationCompositionInstantiationProvider(acProvider,
+ acDefinitionProvider, null);
assertThatThrownBy(() -> provider.createAutomationComposition(compositionId, automationComposition))
.hasMessageMatching(AC_ELEMENT_NAME_NOT_FOUND);
@@ -267,14 +240,12 @@ class AutomationCompositionInstantiationProviderTest {
var automationComposition = InstantiationUtils
.getAutomationCompositionFromResource(AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON, "AcNotFound");
- var participantProvider = Mockito.mock(ParticipantProvider.class);
var acProvider = mock(AutomationCompositionProvider.class);
when(acProvider.getAutomationComposition(automationComposition.getInstanceId()))
.thenReturn(automationComposition);
- var supervisionHandler = mock(SupervisionHandler.class);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
- var provider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var provider = new AutomationCompositionInstantiationProvider(acProvider,
+ acDefinitionProvider, null);
var compositionId = automationComposition.getCompositionId();
assertThatThrownBy(() -> provider.createAutomationComposition(compositionId, automationComposition))
@@ -290,21 +261,4 @@ class AutomationCompositionInstantiationProviderTest {
assertThatThrownBy(() -> provider.updateAutomationComposition(wrongCompositionId, automationComposition))
.hasMessageMatching(compositionId + DO_NOT_MATCH + wrongCompositionId);
}
-
- @Test
- void testIssueAutomationCompositionCommand_OrderedStateInvalid() {
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var acProvider = mock(AutomationCompositionProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
- var acDefinitionProvider = mock(AcDefinitionProvider.class);
- var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
- var automationComposition = InstantiationUtils
- .getAutomationCompositionFromResource(AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON, "AcNotFound");
- when(acProvider.getAutomationComposition(automationComposition.getInstanceId()))
- .thenReturn(automationComposition);
-
- assertThatThrownBy(() -> instantiationProvider.issueAutomationCompositionCommand(automationComposition,
- new InstantiationCommand())).hasMessageMatching(ORDERED_STATE_INVALID);
- }
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
index 38db863c3..fe0a477f9 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
@@ -30,10 +30,8 @@ import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_SERVIC
import java.util.UUID;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.policy.clamp.acm.runtime.instantiation.AutomationCompositionInstantiationProvider;
@@ -41,14 +39,13 @@ import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
import org.onap.policy.clamp.acm.runtime.main.rest.InstantiationController;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.acm.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AcInstanceStateUpdate;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
-import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository;
-import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -74,10 +71,6 @@ class InstantiationControllerTest extends CommonRestController {
private static final String INSTANTIATION_ENDPOINT = "compositions/%s/instances";
private static ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
- private UUID compositionId = UUID.randomUUID();
-
- @Autowired
- private AutomationCompositionRepository automationCompositionRepository;
@Autowired
private AcDefinitionProvider acDefinitionProvider;
@@ -85,9 +78,6 @@ class InstantiationControllerTest extends CommonRestController {
@Autowired
private AutomationCompositionInstantiationProvider instantiationProvider;
- @Autowired
- private ParticipantProvider participantProvider;
-
@LocalServerPort
private int randomServerPort;
@@ -97,25 +87,15 @@ class InstantiationControllerTest extends CommonRestController {
}
@BeforeEach
- public void populateDb() {
- createEntryInDB();
- }
-
- @BeforeEach
public void setUpPort() {
super.setHttpPrefix(randomServerPort);
}
- @AfterEach
- public void cleanDatabase() {
- deleteEntryInDB();
- }
-
- private String getInstanceEndPoint() {
+ private String getInstanceEndPoint(UUID compositionId) {
return String.format(INSTANTIATION_ENDPOINT, compositionId.toString());
}
- private String getInstanceEndPoint(UUID instanceId) {
+ private String getInstanceEndPoint(UUID compositionId, UUID instanceId) {
return String.format(INSTANTIATION_ENDPOINT, compositionId.toString()) + "/" + instanceId;
}
@@ -129,12 +109,12 @@ class InstantiationControllerTest extends CommonRestController {
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Unauthorized");
- assertUnauthorizedPost(getInstanceEndPoint(), Entity.json(automationComposition));
+ assertUnauthorizedPost(getInstanceEndPoint(UUID.randomUUID()), Entity.json(automationComposition));
}
@Test
void testQuery_Unauthorized() {
- assertUnauthorizedGet(getInstanceEndPoint());
+ assertUnauthorizedGet(getInstanceEndPoint(UUID.randomUUID()));
}
@Test
@@ -142,42 +122,45 @@ class InstantiationControllerTest extends CommonRestController {
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Unauthorized");
- assertUnauthorizedPut(getInstanceEndPoint(), Entity.json(automationComposition));
+ assertUnauthorizedPut(getInstanceEndPoint(UUID.randomUUID()), Entity.json(automationComposition));
}
@Test
void testDelete_Unauthorized() {
- assertUnauthorizedDelete(getInstanceEndPoint());
+ assertUnauthorizedDelete(getInstanceEndPoint(UUID.randomUUID()));
}
@Test
void testCreate() {
+ var compositionId = createAcDefinitionInDB("Create");
var automationCompositionFromRsc =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Create");
automationCompositionFromRsc.setCompositionId(compositionId);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint());
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId));
var resp = invocationBuilder.post(Entity.json(automationCompositionFromRsc));
assertEquals(Response.Status.CREATED.getStatusCode(), resp.getStatus());
var instResponse = resp.readEntity(InstantiationResponse.class);
InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionFromRsc);
automationCompositionFromRsc.setInstanceId(instResponse.getInstanceId());
+ automationCompositionFromRsc.getElements().values()
+ .forEach(element -> element.setParticipantId(CommonTestData.getParticipantId()));
var automationCompositionFromDb =
instantiationProvider.getAutomationComposition(compositionId, instResponse.getInstanceId());
assertNotNull(automationCompositionFromDb);
assertEquals(automationCompositionFromRsc, automationCompositionFromDb);
-
}
@Test
void testCreateBadRequest() {
+ var compositionId = createAcDefinitionInDB("CreateBadRequest");
var automationCompositionFromRsc = InstantiationUtils
.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "CreateBadRequest");
automationCompositionFromRsc.setCompositionId(compositionId);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint());
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId));
var resp = invocationBuilder.post(Entity.json(automationCompositionFromRsc));
assertEquals(Response.Status.CREATED.getStatusCode(), resp.getStatus());
@@ -191,7 +174,8 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testQuery_NoResultWithThisName() {
- var invocationBuilder = super.sendRequest(getInstanceEndPoint() + "?name=noResultWithThisName");
+ var invocationBuilder =
+ super.sendRequest(getInstanceEndPoint(UUID.randomUUID()) + "?name=noResultWithThisName");
var rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
var resp = rawresp.readEntity(AutomationCompositions.class);
@@ -200,14 +184,15 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testQuery() {
+ var compositionId = createAcDefinitionInDB("Query");
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Query");
automationComposition.setCompositionId(compositionId);
instantiationProvider.createAutomationComposition(compositionId, automationComposition);
- var invocationBuilder =
- super.sendRequest(getInstanceEndPoint() + "?name=" + automationComposition.getKey().getName());
+ var invocationBuilder = super.sendRequest(
+ getInstanceEndPoint(compositionId) + "?name=" + automationComposition.getKey().getName());
var rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
var automationCompositionsQuery = rawresp.readEntity(AutomationCompositions.class);
@@ -217,7 +202,26 @@ class InstantiationControllerTest extends CommonRestController {
}
@Test
+ void testGet() {
+ var compositionId = createAcDefinitionInDB("Get");
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Get");
+ automationComposition.setCompositionId(compositionId);
+
+ instantiationProvider.createAutomationComposition(compositionId, automationComposition);
+
+ var invocationBuilder = super.sendRequest(
+ getInstanceEndPoint(compositionId, automationComposition.getInstanceId()));
+ var rawresp = invocationBuilder.buildGet().invoke();
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ var automationCompositionGet = rawresp.readEntity(AutomationComposition.class);
+ assertNotNull(automationCompositionGet);
+ assertEquals(automationComposition, automationCompositionGet);
+ }
+
+ @Test
void testUpdate() {
+ var compositionId = createAcDefinitionInDB("Update");
var automationCompositionCreate =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Update");
automationCompositionCreate.setCompositionId(compositionId);
@@ -228,7 +232,10 @@ class InstantiationControllerTest extends CommonRestController {
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Update");
automationComposition.setCompositionId(compositionId);
automationComposition.setInstanceId(response.getInstanceId());
- var invocationBuilder = super.sendRequest(getInstanceEndPoint());
+ automationComposition.getElements().values()
+ .forEach(element -> element.setParticipantId(CommonTestData.getParticipantId()));
+
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId));
var resp = invocationBuilder.post(Entity.json(automationComposition));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
@@ -245,6 +252,7 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testDelete() {
+ var compositionId = createAcDefinitionInDB("Delete");
var automationCompositionFromRsc =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete");
automationCompositionFromRsc.setCompositionId(compositionId);
@@ -252,7 +260,7 @@ class InstantiationControllerTest extends CommonRestController {
var instResponse =
instantiationProvider.createAutomationComposition(compositionId, automationCompositionFromRsc);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint(instResponse.getInstanceId()));
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, instResponse.getInstanceId()));
var resp = invocationBuilder.delete();
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
instResponse = resp.readEntity(InstantiationResponse.class);
@@ -265,30 +273,31 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testDeleteNotFound() {
+ var compositionId = createAcDefinitionInDB("DeleteNotFound");
var automationCompositionFromRsc =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "DelNotFound");
automationCompositionFromRsc.setCompositionId(compositionId);
instantiationProvider.createAutomationComposition(compositionId, automationCompositionFromRsc);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint(UUID.randomUUID()));
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, UUID.randomUUID()));
var resp = invocationBuilder.delete();
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), resp.getStatus());
}
- @Disabled
@Test
- void testCommand_NotFound1() {
- var invocationBuilder = super.sendRequest(getInstanceEndPoint(UUID.randomUUID()));
- var resp = invocationBuilder.post(Entity.json(new AutomationComposition()));
+ void testDeploy_NotFound() {
+ var compositionId = createAcDefinitionInDB("Deploy_NotFound");
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, UUID.randomUUID()));
+ var resp = invocationBuilder.put(Entity.json(new AcInstanceStateUpdate()));
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), resp.getStatus());
}
- @Disabled
@Test
- void testCommand_NotFound2() {
+ void testDeploy_BadRequest() {
+ var compositionId = createAcDefinitionInDB("Deploy_BadRequest");
var acFromRsc =
- InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "DelNotFound");
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "BadRequest");
acFromRsc.setCompositionId(compositionId);
var instResponse = instantiationProvider.createAutomationComposition(compositionId, acFromRsc);
@@ -297,50 +306,33 @@ class InstantiationControllerTest extends CommonRestController {
command.setDeployOrder(null);
command.setLockOrder(null);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint(instResponse.getInstanceId()));
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, instResponse.getInstanceId()));
var resp = invocationBuilder.put(Entity.json(command));
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus());
}
- @Disabled
@Test
- void testCommand() throws PfModelException {
+ void testDeploy() {
+ var compositionId = createAcDefinitionInDB("Deploy");
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Command");
automationComposition.setCompositionId(compositionId);
var instResponse = instantiationProvider.createAutomationComposition(compositionId, automationComposition);
- var participants = CommonTestData.createParticipants();
- for (var participant : participants) {
- participantProvider.saveParticipant(participant);
- }
-
var instantiationUpdate = new AcInstanceStateUpdate();
+ instantiationUpdate.setDeployOrder(DeployOrder.DEPLOY);
+ instantiationUpdate.setLockOrder(null);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint(instResponse.getInstanceId()));
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, instResponse.getInstanceId()));
var resp = invocationBuilder.put(Entity.json(instantiationUpdate));
- assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- instResponse = resp.readEntity(InstantiationResponse.class);
- InstantiationUtils.assertInstantiationResponse(instResponse, automationComposition);
-
- // check passive state on DB
- var toscaConceptIdentifier = instResponse.getAffectedAutomationComposition();
- var automationCompositionsGet = instantiationProvider.getAutomationCompositions(compositionId,
- toscaConceptIdentifier.getName(), toscaConceptIdentifier.getVersion());
- assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1);
- }
-
- private synchronized void deleteEntryInDB() {
- automationCompositionRepository.deleteAll();
- var list = acDefinitionProvider.findAcDefinition(compositionId);
- if (!list.isEmpty()) {
- acDefinitionProvider.deleteAcDefintion(compositionId);
- }
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), resp.getStatus());
}
- private synchronized void createEntryInDB() {
- deleteEntryInDB();
- var acmDefinition = acDefinitionProvider.createAutomationCompositionDefinition(serviceTemplate);
- compositionId = acmDefinition.getCompositionId();
+ private UUID createAcDefinitionInDB(String name) {
+ var serviceTemplateCreate = new ToscaServiceTemplate(serviceTemplate);
+ serviceTemplateCreate.setName(name);
+ var acmDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
+ acDefinitionProvider.updateAcDefinition(acmDefinition);
+ return acmDefinition.getCompositionId();
}
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
index e54cfafa2..0fa15b62d 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
@@ -40,11 +40,13 @@ import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionD
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
@@ -214,7 +216,10 @@ class SupervisionHandlerTest {
AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED);
var automationCompositionAckMessage =
new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
- automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of());
+ var acElementDeployAck =
+ new AcElementDeployAck(AutomationCompositionState.PASSIVE, DeployState.DEPLOYED, true, "");
+ automationCompositionAckMessage.setAutomationCompositionResultMap(
+ Map.of(UUID.fromString("709c62b3-8918-41b9-a747-d21eb79c6c20"), acElementDeployAck));
automationCompositionAckMessage.setAutomationCompositionId(IDENTIFIER);
handler.handleAutomationCompositionStateChangeAckMessage(automationCompositionAckMessage);
@@ -227,7 +232,10 @@ class SupervisionHandlerTest {
var automationCompositionAckMessage =
new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY_ACK);
automationCompositionAckMessage.setParticipantId(CommonTestData.getParticipantId());
- automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of());
+ var acElementDeployAck =
+ new AcElementDeployAck(AutomationCompositionState.PASSIVE, DeployState.DEPLOYED, true, "");
+ automationCompositionAckMessage.setAutomationCompositionResultMap(
+ Map.of(UUID.fromString("709c62b3-8918-41b9-a747-d21eb79c6c20"), acElementDeployAck));
automationCompositionAckMessage.setAutomationCompositionId(IDENTIFIER);
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var handler = createSupervisionHandler(automationCompositionProvider,
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
index 702a93678..69c1302bc 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
@@ -114,6 +114,11 @@ public class CommonTestData {
acDefinition.setServiceTemplate(serviceTemplate);
var acElements = AcmUtils.extractAcElementsFromServiceTemplate(serviceTemplate);
acDefinition.setElementStateMap(AcmUtils.createElementStateMap(acElements, state));
+ if (AcTypeState.PRIMED.equals(state)) {
+ for (var element : acDefinition.getElementStateMap().values()) {
+ element.setParticipantId(getParticipantId());
+ }
+ }
return acDefinition;
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json b/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
index 77078e6eb..0e6988d9b 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
@@ -2,8 +2,8 @@
"name": "PMSHInstance0",
"version": "1.0.1",
"compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
@@ -12,13 +12,8 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Automation composition element for the K8S microservice for PMSH"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
@@ -27,13 +22,8 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.HttpParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Automation composition element for the http requests of PMSH microservice"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -42,13 +32,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.PolicyParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Automation composition element for the operational policy for Performance Management Subscription Handling"
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
index 80facb29c..34ee3f69d 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
@@ -2,8 +2,8 @@
"name": "PMSHInstance0",
"version": "1.0.1",
"compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
@@ -12,12 +12,8 @@
"name": "org.onap.domain.pmsh.DCAEMicroservice",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
@@ -26,12 +22,8 @@
"name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -40,12 +32,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
@@ -54,13 +42,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.PolicyParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json
index a17ba399a..9b3664294 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json
@@ -2,8 +2,8 @@
"name": "PMSHInstance0",
"version": "1.0.1",
"compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
@@ -12,12 +12,8 @@
"name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
@@ -26,12 +22,8 @@
"name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -40,12 +32,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
@@ -54,12 +42,8 @@
"name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
index e66f3f68d..7a226ac92 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
@@ -2,8 +2,8 @@
"name": "PMSHInstance0",
"version": "1.0.1",
"compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
@@ -12,13 +12,8 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.HttpParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Http Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -27,13 +22,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.PolicyParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
@@ -42,13 +32,8 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "K8s Automation Composition Element for the PMSH instance 0 automation composition"
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
index d0372a342..37568fb19 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
@@ -2,8 +2,8 @@
"name": "PMSHInstance0",
"version": "1.0.1",
"compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
@@ -12,13 +12,8 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Automation composition element for the K8S microservice for PMSH"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -27,13 +22,8 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.HttpParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Automation composition element for the operational policy for Performance Management Subscription Handling"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
@@ -42,13 +32,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.PolicyParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
}
}