summaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/main
diff options
context:
space:
mode:
authorsaul.gill <saul.gill@est.tech>2023-01-10 11:11:08 +0000
committersaul.gill <saul.gill@est.tech>2023-01-12 13:44:44 +0000
commitadfe6d2d2e5b11a24208b3bce5383f1c38cec61e (patch)
treea9dd70e6e6a5f759bce1936201820aadb62ff280 /runtime-acm/src/main
parent0b1764cac4b0071b66295cf14bf43b22ed3bc20d (diff)
Add participant controller in ACM
Added participant controller Altered openapi spec Added participantId Issue-ID: POLICY-4496 Change-Id: I0c0ea93dacb6927e6f16bd4638d03db6266be3bd Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'runtime-acm/src/main')
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/ParticipantController.java67
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java102
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java72
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java6
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java43
-rw-r--r--runtime-acm/src/main/resources/openapi/openapi.yaml7
6 files changed, 232 insertions, 65 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/ParticipantController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/ParticipantController.java
new file mode 100644
index 000000000..abcef7a94
--- /dev/null
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/ParticipantController.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 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.acm.runtime.main.rest;
+
+import java.util.List;
+import java.util.UUID;
+import lombok.RequiredArgsConstructor;
+import org.onap.policy.clamp.acm.runtime.main.rest.gen.ParticipantMonitoringApi;
+import org.onap.policy.clamp.acm.runtime.main.web.AbstractRestController;
+import org.onap.policy.clamp.acm.runtime.participants.AcmParticipantProvider;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantInformation;
+import org.springframework.context.annotation.Profile;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequiredArgsConstructor
+@Profile("default")
+public class ParticipantController extends AbstractRestController implements ParticipantMonitoringApi {
+
+ private final AcmParticipantProvider acmParticipantProvider;
+
+ @Override
+ public ResponseEntity<ParticipantInformation> getParticipant(UUID participantId, UUID requestId) {
+ ParticipantInformation participantInformation = acmParticipantProvider
+ .getParticipantById(participantId.toString());
+ return ResponseEntity.ok().body(participantInformation);
+ }
+
+ @Override
+ public ResponseEntity<Void> orderAllParticipantsReport(UUID requestId) {
+ acmParticipantProvider.sendAllParticipantStatusRequest();
+ return new ResponseEntity<>(HttpStatus.ACCEPTED);
+ }
+
+ @Override
+ public ResponseEntity<Void> orderParticipantReport(UUID participantId, UUID requestId) {
+ acmParticipantProvider.sendParticipantStatusRequest(participantId.toString());
+ return new ResponseEntity<>(HttpStatus.ACCEPTED);
+ }
+
+ @Override
+ public ResponseEntity<List<ParticipantInformation>> queryParticipants(String name, String version,
+ UUID requestId) {
+ List<ParticipantInformation> participantInformationList = acmParticipantProvider.getAllParticipants();
+ return ResponseEntity.ok().body(participantInformationList);
+ }
+}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java
new file mode 100644
index 000000000..e1d0423d1
--- /dev/null
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 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.acm.runtime.participants;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantStatusReqPublisher;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantInformation;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class AcmParticipantProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AcmParticipantProvider.class);
+ private final ParticipantProvider participantProvider;
+ private final ParticipantStatusReqPublisher participantStatusReqPublisher;
+
+ public AcmParticipantProvider(ParticipantProvider participantProvider,
+ ParticipantStatusReqPublisher participantStatusReqPublisher) {
+ this.participantProvider = participantProvider;
+ this.participantStatusReqPublisher = participantStatusReqPublisher;
+ }
+
+ /**
+ * Get all participants.
+ *
+ * @return A list of available participants
+ */
+ public List<ParticipantInformation> getAllParticipants() {
+ List<Participant> participants = this.participantProvider.getParticipants();
+
+ List<ParticipantInformation> participantInformationList = new ArrayList<>();
+ participants.forEach(participant -> {
+ ParticipantInformation participantInformation = new ParticipantInformation();
+ participantInformation.setParticipant(participant);
+ participantInformationList.add(participantInformation);
+ });
+ return participantInformationList;
+ }
+
+ /**
+ * Get a participant.
+ *
+ * @param participantId The UUID of the participant to get
+ * @return The participant
+ */
+ public ParticipantInformation getParticipantById(String participantId) {
+ Participant participant = this.participantProvider.getParticipantById(participantId);
+ ParticipantInformation participantInformation = new ParticipantInformation();
+ participantInformation.setParticipant(participant);
+ return participantInformation;
+ }
+
+ /**
+ * Send a participant status request.
+ *
+ * @param participantId The UUID of the participant to send request to
+ */
+ public void sendParticipantStatusRequest(String participantId) {
+ Participant participant = this.participantProvider.getParticipantById(participantId);
+ ToscaConceptIdentifier id = participant.getKey().asIdentifier();
+
+ LOGGER.debug("Requesting Participant Status Now ParticipantStatusReq");
+ participantStatusReqPublisher.send(id);
+ participant.setParticipantState(ParticipantState.OFF_LINE);
+ participantProvider.updateParticipant(participant);
+ }
+
+ /**
+ * Send status request to all participants.
+ *
+ */
+ public void sendAllParticipantStatusRequest() {
+ this.participantStatusReqPublisher.send((ToscaConceptIdentifier) null);
+ }
+}
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 c27447405..761c3800c 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
@@ -57,9 +57,9 @@ public class SupervisionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionHandler.class);
private static final String AUTOMATION_COMPOSITION_CANNOT_TRANSITION_FROM_STATE =
- "Automation composition can't transition from state ";
+ "Automation composition can't transition from state ";
private static final String AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE =
- "Automation composition is already in state ";
+ "Automation composition is already in state ";
private static final String TO_STATE = " to state ";
private static final String AND_TRANSITIONING_TO_STATE = " and transitioning to state ";
@@ -78,7 +78,7 @@ public class SupervisionHandler {
*/
public void handleSendCommissionMessage(AutomationCompositionDefinition acmDefinition) {
LOGGER.debug("Participant update message with serviveTemplate {} being sent to all participants",
- acmDefinition.getCompositionId());
+ acmDefinition.getCompositionId());
participantUpdatePublisher.sendComissioningBroadcast(acmDefinition);
}
@@ -98,8 +98,8 @@ public class SupervisionHandler {
*/
@MessageIntercept
@Timed(
- value = "listener.automation_composition_update_ack",
- description = "AUTOMATION_COMPOSITION_UPDATE_ACK messages received")
+ value = "listener.automation_composition_update_ack",
+ description = "AUTOMATION_COMPOSITION_UPDATE_ACK messages received")
public void handleAutomationCompositionUpdateAckMessage(AutomationCompositionAck automationCompositionAckMessage) {
LOGGER.debug("AutomationComposition Update Ack message received {}", automationCompositionAckMessage);
setAcElementStateInDb(automationCompositionAckMessage);
@@ -123,10 +123,10 @@ public class SupervisionHandler {
*/
@MessageIntercept
@Timed(
- value = "listener.automation_composition_statechange_ack",
- description = "AUTOMATION_COMPOSITION_STATECHANGE_ACK messages received")
+ value = "listener.automation_composition_statechange_ack",
+ description = "AUTOMATION_COMPOSITION_STATECHANGE_ACK messages received")
public void handleAutomationCompositionStateChangeAckMessage(
- AutomationCompositionAck automationCompositionAckMessage) {
+ AutomationCompositionAck automationCompositionAckMessage) {
LOGGER.debug("AutomationComposition StateChange Ack message received {}", automationCompositionAckMessage);
setAcElementStateInDb(automationCompositionAckMessage);
}
@@ -134,23 +134,23 @@ public class SupervisionHandler {
private void setAcElementStateInDb(AutomationCompositionAck automationCompositionAckMessage) {
if (automationCompositionAckMessage.getAutomationCompositionResultMap() != null) {
var automationComposition = automationCompositionProvider
- .findAutomationComposition(automationCompositionAckMessage.getAutomationCompositionId());
+ .findAutomationComposition(automationCompositionAckMessage.getAutomationCompositionId());
if (automationComposition.isPresent()) {
var updated = updateState(automationComposition.get(),
- automationCompositionAckMessage.getAutomationCompositionResultMap().entrySet());
+ automationCompositionAckMessage.getAutomationCompositionResultMap().entrySet());
updated |= setPrimed(automationComposition.get());
if (updated) {
automationCompositionProvider.updateAutomationComposition(automationComposition.get());
}
} else {
LOGGER.warn("AutomationComposition not found in database {}",
- automationCompositionAckMessage.getAutomationCompositionId());
+ automationCompositionAckMessage.getAutomationCompositionId());
}
}
}
private boolean updateState(AutomationComposition automationComposition,
- Set<Map.Entry<UUID, AutomationCompositionElementAck>> automationCompositionResultSet) {
+ Set<Map.Entry<UUID, AutomationCompositionElementAck>> automationCompositionResultSet) {
var updated = false;
for (var acElementAck : automationCompositionResultSet) {
var element = automationComposition.getElements().get(acElementAck.getKey());
@@ -167,9 +167,9 @@ public class SupervisionHandler {
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();
+ .filter(acElement -> (!acElement.getState().equals(AutomationCompositionState.PASSIVE)
+ || !acElement.getState().equals(AutomationCompositionState.RUNNING)))
+ .findAny();
if (checkOpt.isEmpty()) {
primedFlag = false;
}
@@ -188,7 +188,7 @@ public class SupervisionHandler {
* @throws AutomationCompositionException on supervision errors
*/
public void triggerAutomationCompositionSupervision(AutomationComposition automationComposition)
- throws AutomationCompositionException {
+ throws AutomationCompositionException {
switch (automationComposition.getOrderedState()) {
case UNINITIALISED:
superviseAutomationCompositionUninitialization(automationComposition);
@@ -204,8 +204,8 @@ public class SupervisionHandler {
default:
exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- "A automation composition cannot be commanded to go into state "
- + automationComposition.getOrderedState().name());
+ "A automation composition cannot be commanded to go into state "
+ + automationComposition.getOrderedState().name());
}
}
@@ -218,39 +218,39 @@ public class SupervisionHandler {
* @throws AutomationCompositionException on supervision errors
*/
private void superviseAutomationCompositionUninitialization(AutomationComposition automationComposition)
- throws AutomationCompositionException {
+ throws AutomationCompositionException {
switch (automationComposition.getState()) {
case UNINITIALISED:
exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name());
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name());
break;
case UNINITIALISED2PASSIVE:
case PASSIVE:
automationComposition.setState(AutomationCompositionState.PASSIVE2UNINITIALISED);
automationCompositionStateChangePublisher.send(automationComposition,
- getFirstStartPhase(automationComposition));
+ getFirstStartPhase(automationComposition));
break;
case PASSIVE2UNINITIALISED:
exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name()
- + AND_TRANSITIONING_TO_STATE + automationComposition.getOrderedState());
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name()
+ + AND_TRANSITIONING_TO_STATE + automationComposition.getOrderedState());
break;
default:
exceptionOccured(Response.Status.NOT_ACCEPTABLE, AUTOMATION_COMPOSITION_CANNOT_TRANSITION_FROM_STATE
- + automationComposition.getState().name() + TO_STATE + automationComposition.getOrderedState());
+ + automationComposition.getState().name() + TO_STATE + automationComposition.getOrderedState());
break;
}
}
private void superviseAutomationCompositionPassivation(AutomationComposition automationComposition)
- throws AutomationCompositionException {
+ throws AutomationCompositionException {
switch (automationComposition.getState()) {
case PASSIVE:
exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name());
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name());
break;
case UNINITIALISED:
automationComposition.setState(AutomationCompositionState.UNINITIALISED2PASSIVE);
@@ -260,46 +260,46 @@ public class SupervisionHandler {
case UNINITIALISED2PASSIVE:
case RUNNING2PASSIVE:
exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name()
- + AND_TRANSITIONING_TO_STATE + automationComposition.getOrderedState());
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name()
+ + AND_TRANSITIONING_TO_STATE + automationComposition.getOrderedState());
break;
case RUNNING:
automationComposition.setState(AutomationCompositionState.RUNNING2PASSIVE);
automationCompositionStateChangePublisher.send(automationComposition,
- getFirstStartPhase(automationComposition));
+ getFirstStartPhase(automationComposition));
break;
default:
exceptionOccured(Response.Status.NOT_ACCEPTABLE, AUTOMATION_COMPOSITION_CANNOT_TRANSITION_FROM_STATE
- + automationComposition.getState().name() + TO_STATE + automationComposition.getOrderedState());
+ + automationComposition.getState().name() + TO_STATE + automationComposition.getOrderedState());
break;
}
}
private void superviseAutomationCompositionActivation(AutomationComposition automationComposition)
- throws AutomationCompositionException {
+ throws AutomationCompositionException {
switch (automationComposition.getState()) {
case RUNNING:
exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name());
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name());
break;
case PASSIVE2RUNNING:
exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name()
- + AND_TRANSITIONING_TO_STATE + automationComposition.getOrderedState());
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name()
+ + AND_TRANSITIONING_TO_STATE + automationComposition.getOrderedState());
break;
case PASSIVE:
automationComposition.setState(AutomationCompositionState.PASSIVE2RUNNING);
automationCompositionStateChangePublisher.send(automationComposition,
- getFirstStartPhase(automationComposition));
+ getFirstStartPhase(automationComposition));
break;
default:
exceptionOccured(Response.Status.NOT_ACCEPTABLE, AUTOMATION_COMPOSITION_CANNOT_TRANSITION_FROM_STATE
- + automationComposition.getState().name() + TO_STATE + automationComposition.getOrderedState());
+ + automationComposition.getState().name() + TO_STATE + automationComposition.getOrderedState());
break;
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
index da9187d22..2c9e84ba7 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
@@ -59,7 +59,7 @@ public class SupervisionParticipantHandler {
saveParticipantStatus(participantRegisterMsg);
participantRegisterAckPublisher.send(participantRegisterMsg.getMessageId(),
- participantRegisterMsg.getParticipantId(), participantRegisterMsg.getParticipantType());
+ participantRegisterMsg.getParticipantId(), participantRegisterMsg.getParticipantType());
}
/**
@@ -76,7 +76,7 @@ public class SupervisionParticipantHandler {
if (participantOpt.isPresent()) {
var participant = participantOpt.get();
participant.setParticipantState(ParticipantState.OFF_LINE);
- participantProvider.saveParticipant(participant);
+ participantProvider.updateParticipant(participant);
}
participantDeregisterAckPublisher.send(participantDeregisterMsg.getMessageId());
@@ -110,7 +110,7 @@ public class SupervisionParticipantHandler {
var participant = participantOpt.get();
participant.setParticipantState(ParticipantState.ON_LINE);
- participantProvider.saveParticipant(participant);
+ participantProvider.updateParticipant(participant);
}
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
index e595f3bee..f758c9893 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
@@ -71,10 +71,11 @@ public class SupervisionScanner {
* @param acRuntimeParameterGroup the parameters for the automation composition runtime
*/
public SupervisionScanner(final AutomationCompositionProvider automationCompositionProvider,
- AcDefinitionProvider acDefinitionProvider,
- final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher,
- AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher,
- ParticipantProvider participantProvider, final AcRuntimeParameterGroup acRuntimeParameterGroup) {
+ AcDefinitionProvider acDefinitionProvider,
+ final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher,
+ AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher,
+ ParticipantProvider participantProvider,
+ final AcRuntimeParameterGroup acRuntimeParameterGroup) {
this.automationCompositionProvider = automationCompositionProvider;
this.acDefinitionProvider = acDefinitionProvider;
this.automationCompositionStateChangePublisher = automationCompositionStateChangePublisher;
@@ -82,12 +83,12 @@ public class SupervisionScanner {
this.participantProvider = participantProvider;
automationCompositionCounter.setMaxRetryCount(
- acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
+ acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
automationCompositionCounter
- .setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs());
+ .setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs());
participantStatusCounter.setMaxRetryCount(
- acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
+ acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
participantStatusCounter.setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs());
}
@@ -123,11 +124,11 @@ public class SupervisionScanner {
return;
}
if (participantStatusCounter.getDuration(id) > participantStatusCounter.getMaxWaitMs()
- && !participantStatusCounter.count(id)) {
+ && !participantStatusCounter.count(id)) {
LOGGER.debug("report Participant fault");
participantStatusCounter.setFault(id);
participant.setParticipantState(ParticipantState.OFF_LINE);
- participantProvider.saveParticipant(participant);
+ participantProvider.updateParticipant(participant);
}
}
@@ -139,7 +140,7 @@ public class SupervisionScanner {
}
private void scanAutomationComposition(final AutomationComposition automationComposition,
- ToscaServiceTemplate toscaServiceTemplate, boolean counterCheck) {
+ ToscaServiceTemplate toscaServiceTemplate, boolean counterCheck) {
LOGGER.debug("scanning automation composition {} . . .", automationComposition.getInstanceId());
if (automationComposition.getState().equals(automationComposition.getOrderedState().asState())) {
@@ -157,7 +158,7 @@ public class SupervisionScanner {
var defaultMax = 0; // max startPhase
for (var element : automationComposition.getElements().values()) {
var toscaNodeTemplate = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates()
- .get(element.getDefinition().getName());
+ .get(element.getDefinition().getName());
int startPhase = ParticipantUtils.findStartPhase(toscaNodeTemplate.getProperties());
defaultMin = Math.min(defaultMin, startPhase);
defaultMax = Math.max(defaultMax, startPhase);
@@ -170,7 +171,7 @@ public class SupervisionScanner {
if (completed) {
LOGGER.debug("automation composition scan: transition from state {} to {} completed",
- automationComposition.getState(), automationComposition.getOrderedState());
+ automationComposition.getState(), automationComposition.getOrderedState());
automationComposition.setState(automationComposition.getOrderedState().asState());
automationCompositionProvider.updateAutomationComposition(automationComposition);
@@ -179,19 +180,19 @@ public class SupervisionScanner {
clearFaultAndCounter(automationComposition);
} else {
LOGGER.debug("automation composition scan: transition from state {} to {} not completed",
- automationComposition.getState(), automationComposition.getOrderedState());
+ automationComposition.getState(), automationComposition.getOrderedState());
var nextSpNotCompleted =
- AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
- || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState())
- ? minSpNotCompleted
- : maxSpNotCompleted;
+ AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
+ || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState())
+ ? minSpNotCompleted
+ : maxSpNotCompleted;
var firstStartPhase =
- AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
- || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState())
- ? defaultMin
- : defaultMax;
+ AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
+ || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState())
+ ? defaultMin
+ : defaultMax;
if (nextSpNotCompleted != phaseMap.getOrDefault(automationComposition.getInstanceId(), firstStartPhase)) {
phaseMap.put(automationComposition.getInstanceId(), nextSpNotCompleted);
diff --git a/runtime-acm/src/main/resources/openapi/openapi.yaml b/runtime-acm/src/main/resources/openapi/openapi.yaml
index 655ce7eeb..f2692a900 100644
--- a/runtime-acm/src/main/resources/openapi/openapi.yaml
+++ b/runtime-acm/src/main/resources/openapi/openapi.yaml
@@ -1,5 +1,5 @@
# ============LICENSE_START=======================================================
-# Copyright (C) 2022 Nordix Foundation
+# Copyright (C) 2022-2023 Nordix Foundation
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -65,7 +65,6 @@ paths:
- name: X-onap-RequestId
in: header
description: RequestID for http transaction
- required: true
schema:
type: string
format: uuid
@@ -138,7 +137,7 @@ paths:
description: Requests all participants to immediately generate a heartbeat report with their information and status
and the information and status of all their AC Element Types and Instances. The results are published on subsequent
GET REST requests on the "participants" endpoint.
- operationId: orderAllParticiantsReport
+ operationId: orderAllParticipantsReport
parameters:
- name: X-onap-RequestId
in: header
@@ -230,7 +229,6 @@ paths:
- name: X-onap-RequestId
in: header
description: RequestID for http transaction
- required: true
schema:
type: string
format: uuid
@@ -331,7 +329,6 @@ paths:
format: uuid
- name: X-onap-RequestId
in: header
- required: true
description: RequestID for http transaction
schema:
type: string