summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl')
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java5
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java5
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java5
-rwxr-xr-xparticipant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java5
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java6
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java21
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java25
7 files changed, 17 insertions, 55 deletions
diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java
index a60e7b4bb..8401b934b 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java
@@ -38,7 +38,6 @@ import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationComposit
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
-import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -82,7 +81,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
acA1PmsClient.deleteService(configurationEntity.getPolicyServiceEntities());
configRequestMap.remove(automationCompositionElementId);
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
- automationCompositionElementId, DeployState.UNDEPLOYED, LockState.NONE);
+ automationCompositionElementId, DeployState.UNDEPLOYED, null, "Undeployed");
} else {
LOGGER.warn("Failed to connect with A1PMS. Service configuration is: {}", configurationEntity);
throw new A1PolicyServiceException(HttpStatus.SC_SERVICE_UNAVAILABLE, "Unable to connect with A1PMS");
@@ -108,7 +107,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
configRequestMap.put(element.getId(), configurationEntity);
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
- DeployState.DEPLOYED, LockState.LOCKED);
+ DeployState.DEPLOYED, null, "Deployed");
} else {
LOGGER.error("Failed to connect with A1PMS");
throw new A1PolicyServiceException(HttpStatus.SC_SERVICE_UNAVAILABLE,
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
index 0568d3b98..f294d47ff 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
@@ -41,7 +41,6 @@ import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationComposit
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
-import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -78,7 +77,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
@Override
public void undeploy(UUID automationCompositionId, UUID automationCompositionElementId) {
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, automationCompositionElementId,
- DeployState.UNDEPLOYED, LockState.NONE);
+ DeployState.UNDEPLOYED, null, "");
}
/**
@@ -99,7 +98,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
.collect(Collectors.toList());
if (failedResponseStatus.isEmpty()) {
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
- DeployState.DEPLOYED, LockState.LOCKED);
+ DeployState.DEPLOYED, null, "Deployed");
} else {
throw new PfModelException(Status.BAD_REQUEST, "Error on Invoking the http request: {}",
failedResponseStatus);
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
index e48fdf91c..e0d6c805f 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
@@ -37,7 +37,6 @@ import org.onap.policy.clamp.acm.participant.http.utils.CommonTestData;
import org.onap.policy.clamp.acm.participant.http.utils.ToscaUtils;
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
-import org.onap.policy.clamp.models.acm.concepts.LockState;
class AcElementHandlerTest {
@@ -57,7 +56,7 @@ class AcElementHandlerTest {
automationCompositionElementHandler.setIntermediaryApi(participantIntermediaryApi);
automationCompositionElementHandler.undeploy(instanceId, acElementId);
verify(participantIntermediaryApi).updateAutomationCompositionElementState(instanceId, acElementId,
- DeployState.UNDEPLOYED, LockState.NONE);
+ DeployState.UNDEPLOYED, null, "");
}
}
@@ -90,7 +89,7 @@ class AcElementHandlerTest {
automationCompositionElementHandler.deploy(instanceId, element, map);
verify(acHttpClient).run(any(ConfigRequest.class), anyMap());
verify(participantIntermediaryApi).updateAutomationCompositionElementState(instanceId, element.getId(),
- DeployState.DEPLOYED, LockState.LOCKED);
+ DeployState.DEPLOYED, null, "Deployed");
}
}
diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java
index a6e1c9cbc..6fdb16e53 100755
--- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java
@@ -46,7 +46,6 @@ import org.onap.policy.clamp.acm.participant.kserve.models.ConfigurationEntity;
import org.onap.policy.clamp.acm.participant.kserve.models.KserveInferenceEntity;
import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
-import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -94,7 +93,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
}
configRequestMap.remove(automationCompositionElementId);
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
- automationCompositionElementId, DeployState.UNDEPLOYED, LockState.NONE);
+ automationCompositionElementId, DeployState.UNDEPLOYED, null, "Undeployed");
} catch (IOException | ApiException exception) {
LOGGER.warn("Deletion of Inference service failed", exception);
}
@@ -131,7 +130,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
if (isAllInferenceSvcDeployed) {
configRequestMap.put(element.getId(), configurationEntity);
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
- DeployState.DEPLOYED, LockState.LOCKED);
+ DeployState.DEPLOYED, null, "Deployed");
} else {
LOGGER.error("Inference Service deployment failed");
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
index b681ba91d..2f1abe1c0 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
@@ -33,7 +33,6 @@ import javax.ws.rs.core.Response;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
-import net.bytebuddy.implementation.bytecode.Throw;
import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
@@ -42,7 +41,6 @@ import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
import org.onap.policy.clamp.acm.participant.kubernetes.service.ChartService;
import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
-import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -95,7 +93,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
try {
chartService.uninstallChart(chart);
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
- automationCompositionElementId, DeployState.UNDEPLOYED, LockState.NONE);
+ automationCompositionElementId, DeployState.UNDEPLOYED, null, "Undeployed");
chartMap.remove(automationCompositionElementId);
podStatusMap.remove(chart.getReleaseName());
} catch (ServiceException se) {
@@ -150,7 +148,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
if (!result.get().isEmpty()) {
LOGGER.info("Pod Status Validator Completed: {}", result.isDone());
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, elementId,
- DeployState.DEPLOYED, LockState.LOCKED);
+ DeployState.DEPLOYED, null, "Deployed");
}
}
}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
index d40ac3276..627f79131 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
@@ -37,7 +37,6 @@ import org.onap.policy.clamp.acm.participant.policy.client.PolicyApiHttpClient;
import org.onap.policy.clamp.acm.participant.policy.client.PolicyPapHttpClient;
import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
-import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.pdp.concepts.DeploymentSubGroup;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -75,7 +74,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
if (automationCompositionDefinition == null) {
LOGGER.debug("No policies to undeploy to {}", automationCompositionElementId);
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
- automationCompositionElementId, DeployState.UNDEPLOYED, LockState.NONE);
+ automationCompositionElementId, DeployState.UNDEPLOYED, null, "Undeployed");
return;
}
var policyList = getPolicyList(automationCompositionDefinition);
@@ -84,7 +83,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
deletePolicyData(policyTypeList, policyList);
serviceTemplateMap.remove(automationCompositionElementId);
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
- automationCompositionElementId, DeployState.UNDEPLOYED, LockState.NONE);
+ automationCompositionElementId, DeployState.UNDEPLOYED, null, "Undeployed");
}
private void deletePolicyData(List<ToscaConceptIdentifier> policyTypeList,
@@ -117,8 +116,10 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
}
if (!deployFailure) {
// Update the AC element state
+ intermediaryApi.sendAcElementInfo(automationCompositionId, automationCompositionElementId, "IDLE",
+ "ENABLED", Map.of());
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
- automationCompositionElementId, DeployState.DEPLOYED, LockState.LOCKED);
+ automationCompositionElementId, DeployState.DEPLOYED, null, "Deployed");
} else {
throw new PfModelException(Status.BAD_REQUEST, "Deploy of Policy failed.");
}
@@ -201,16 +202,4 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
return policyList;
}
-
- @Override
- public String getUseState(UUID automationCompositionId, UUID automationCompositionElementId)
- throws PfModelException {
- return "IDLE";
- }
-
- @Override
- public String getOperationalState(UUID automationCompositionId, UUID automationCompositionElementId)
- throws PfModelException {
- return "ENABLED";
- }
}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
index ecc0b88e7..d3b27ae10 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
@@ -21,7 +21,6 @@
package org.onap.policy.clamp.acm.participant.policy.main.handler;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -37,7 +36,6 @@ import org.onap.policy.clamp.acm.participant.policy.client.PolicyApiHttpClient;
import org.onap.policy.clamp.acm.participant.policy.client.PolicyPapHttpClient;
import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
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.messages.rest.instantiation.DeployOrder;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -63,7 +61,7 @@ class AutomationCompositionElementHandlerTest {
handler.undeploy(AC_ID, automationCompositionElementId);
verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
- DeployState.UNDEPLOYED, LockState.NONE);
+ DeployState.UNDEPLOYED, null, "Undeployed");
}
private AcElementDeploy getTestingAcElement() {
@@ -94,9 +92,8 @@ class AutomationCompositionElementHandlerTest {
handler.setIntermediaryApi(intermediaryApi);
handler.deploy(AC_ID, getTestingAcElement(), Map.of());
- handler.undeploy(AC_ID, automationCompositionElementId);
verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
- DeployState.UNDEPLOYED, LockState.NONE);
+ DeployState.DEPLOYED, null, "Deployed");
}
@Test
@@ -134,22 +131,4 @@ class AutomationCompositionElementHandlerTest {
assertThatThrownBy(() -> handler.deploy(AC_ID, element, Map.of()))
.hasMessageMatching("Deploy of Policy failed.");
}
-
- @Test
- void testGetOperationalState() throws PfModelException {
- var api = mock(PolicyApiHttpClient.class);
- var pap = mock(PolicyPapHttpClient.class);
- var handler = new AutomationCompositionElementHandler(api, pap);
-
- assertEquals("ENABLED", handler.getOperationalState(UUID.randomUUID(), UUID.randomUUID()));
- }
-
- @Test
- void testGetUseState() throws PfModelException {
- var api = mock(PolicyApiHttpClient.class);
- var pap = mock(PolicyPapHttpClient.class);
- var handler = new AutomationCompositionElementHandler(api, pap);
-
- assertEquals("IDLE", handler.getUseState(UUID.randomUUID(), UUID.randomUUID()));
- }
}