aboutsummaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/main
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-01-17 09:56:52 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-01-23 15:22:35 +0000
commitc5e57c1b1cd0e778ebf47edd20fd9a340471ab72 (patch)
treef567d2bc52cf070bcccb83bad0f4ab5f70d2415f /runtime-acm/src/main
parenta263a250f7185fd9ddc4b600d96452fdbf21fffb (diff)
Refactor participantId as UUID
As part of endpoint refactoring, refactor participantId as UUID in ACM. Issue-ID: POLICY-4521 Change-Id: I8ac652d9b2fadf9ce3220febb9c2c3ac0d3786cc Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/main')
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java23
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java7
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java4
-rw-r--r--runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.json15
-rw-r--r--runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.yaml12
9 files changed, 24 insertions, 49 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 099c0e740..53288d15e 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
@@ -243,7 +243,7 @@ public class AutomationCompositionInstantiationProvider {
var result = new BeanValidationResult("AutomationComposition", automationComposition);
var participantMap = participants.stream()
- .collect(Collectors.toMap(participant -> participant.getKey().asIdentifier(), Function.identity()));
+ .collect(Collectors.toMap(participant -> participant.getParticipantId(), Function.identity()));
for (var element : automationComposition.getElements().values()) {
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
index 617f75668..18a8e8a26 100644
--- 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
@@ -23,12 +23,11 @@ package org.onap.policy.clamp.acm.runtime.participants;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+import lombok.RequiredArgsConstructor;
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;
@@ -36,25 +35,20 @@ import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
+@RequiredArgsConstructor
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();
+ var participants = this.participantProvider.getParticipants();
List<ParticipantInformation> participantInformationList = new ArrayList<>();
participants.forEach(participant -> {
@@ -72,8 +66,8 @@ public class AcmParticipantProvider {
* @return The participant
*/
public ParticipantInformation getParticipantById(UUID participantId) {
- Participant participant = this.participantProvider.getParticipantById(participantId);
- ParticipantInformation participantInformation = new ParticipantInformation();
+ var participant = this.participantProvider.getParticipantById(participantId);
+ var participantInformation = new ParticipantInformation();
participantInformation.setParticipant(participant);
return participantInformation;
}
@@ -84,11 +78,10 @@ public class AcmParticipantProvider {
* @param participantId The UUID of the participant to send request to
*/
public void sendParticipantStatusRequest(UUID participantId) {
- Participant participant = this.participantProvider.getParticipantById(participantId);
- ToscaConceptIdentifier id = participant.getKey().asIdentifier();
+ var participant = this.participantProvider.getParticipantById(participantId);
LOGGER.debug("Requesting Participant Status Now ParticipantStatusReq");
- participantStatusReqPublisher.send(id);
+ participantStatusReqPublisher.send(participantId);
participant.setParticipantState(ParticipantState.OFF_LINE);
participantProvider.updateParticipant(participant);
}
@@ -98,6 +91,6 @@ public class AcmParticipantProvider {
*
*/
public void sendAllParticipantStatusRequest() {
- this.participantStatusReqPublisher.send((ToscaConceptIdentifier) null);
+ this.participantStatusReqPublisher.send((UUID) null);
}
}
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 6f0f5cc7b..f58543684 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
@@ -106,9 +106,7 @@ public class SupervisionParticipantHandler {
if (participantOpt.isEmpty()) {
ParticipantRegister registerMessage = (ParticipantRegister) participantMessage;
var participant = new Participant();
- participant.setName(registerMessage.getParticipantId().getName());
- participant.setVersion(registerMessage.getParticipantId().getVersion());
- participant.setDefinition(registerMessage.getParticipantId());
+ participant.setParticipantId(participantMessage.getParticipantId());
participant.setParticipantType(registerMessage.getParticipantType());
participant.setParticipantSupportedElementTypes(listToMap(registerMessage
.getParticipantSupportedElementType()));
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 f758c9893..0e5aab5e3 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
@@ -36,7 +36,6 @@ import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
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.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,7 +49,7 @@ public class SupervisionScanner {
private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionScanner.class);
private final HandleCounter<UUID> automationCompositionCounter = new HandleCounter<>();
- private final HandleCounter<ToscaConceptIdentifier> participantStatusCounter = new HandleCounter<>();
+ private final HandleCounter<UUID> participantStatusCounter = new HandleCounter<>();
private final Map<UUID, Integer> phaseMap = new HashMap<>();
@@ -118,7 +117,7 @@ public class SupervisionScanner {
}
private void scanParticipantStatus(Participant participant) {
- var id = participant.getKey().asIdentifier();
+ var id = participant.getParticipantId();
if (participantStatusCounter.isFault(id)) {
LOGGER.debug("report Participant fault");
return;
@@ -135,7 +134,7 @@ public class SupervisionScanner {
/**
* handle participant Status message.
*/
- public void handleParticipantStatus(ToscaConceptIdentifier id) {
+ public void handleParticipantStatus(UUID id) {
participantStatusCounter.clear(id);
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
index bd8f2b560..3cadff6ee 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
@@ -40,7 +40,7 @@ public class ParticipantRegisterAckPublisher extends AbstractParticipantAckPubli
* @param participantType the participant Type
*/
@Timed(value = "publisher.participant_register_ack", description = "PARTICIPANT_REGISTER_ACK messages published")
- public void send(UUID responseTo, ToscaConceptIdentifier participantId, ToscaConceptIdentifier participantType) {
+ public void send(UUID responseTo, UUID participantId, ToscaConceptIdentifier participantType) {
var message = new ParticipantRegisterAck();
message.setParticipantId(participantId);
message.setParticipantType(participantType);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
index d1f183ee8..db69cdaf8 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
@@ -22,8 +22,8 @@ package org.onap.policy.clamp.acm.runtime.supervision.comm;
import io.micrometer.core.annotation.Timed;
import java.time.Instant;
+import java.util.UUID;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -39,7 +39,7 @@ public class ParticipantStatusReqPublisher extends AbstractParticipantPublisher<
* @param participantId the participant Id
*/
@Timed(value = "publisher.participant_status_req", description = "PARTICIPANT_STATUS_REQ messages published")
- public void send(ToscaConceptIdentifier participantId) {
+ public void send(UUID participantId) {
ParticipantStatusReq message = new ParticipantStatusReq();
message.setParticipantId(participantId);
message.setTimestamp(Instant.now());
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
index af9023815..504ddc28c 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
@@ -68,7 +68,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
* @param participantId the ParticipantId
*/
@Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published")
- public void sendCommissioning(ToscaConceptIdentifier participantType, ToscaConceptIdentifier participantId) {
+ public void sendCommissioning(ToscaConceptIdentifier participantType, UUID participantId) {
var list = acDefinitionProvider.getAllAcDefinitions();
if (list.isEmpty()) {
LOGGER.warn("No tosca service template found, cannot send participantupdate");
@@ -88,7 +88,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
*/
@Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published")
public void sendCommissioning(AutomationCompositionDefinition acmDefinition,
- ToscaConceptIdentifier participantType, ToscaConceptIdentifier participantId) {
+ ToscaConceptIdentifier participantType, UUID participantId) {
var message = new ParticipantUpdate();
message.setCompositionId(acmDefinition.getCompositionId());
message.setParticipantType(participantType);
diff --git a/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.json b/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.json
index 55b99b28c..a1d0a999d 100644
--- a/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.json
+++ b/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.json
@@ -15,10 +15,7 @@
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "Sink Automation Composition Element for the Demo",
@@ -34,10 +31,7 @@
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "Bridge Automation Composition Element for the Demo",
@@ -53,10 +47,7 @@
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "Starter Automation Composition Element for the Demo",
diff --git a/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.yaml b/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.yaml
index 3fa6506ea..3b007fda6 100644
--- a/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.yaml
+++ b/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.yaml
@@ -11,9 +11,7 @@ automationCompositionList:
participantType:
name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
- participantId:
- name: HttpParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01
state: UNINITIALISED
orderedState: UNINITIALISED
description: Sink Automation Composition Element for the Demo
@@ -26,9 +24,7 @@ automationCompositionList:
participantType:
name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
- participantId:
- name: HttpParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01
state: UNINITIALISED
orderedState: UNINITIALISED
description: Bridge Automation Composition Element for the Demo
@@ -41,9 +37,7 @@ automationCompositionList:
participantType:
name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
- participantId:
- name: HttpParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01
state: UNINITIALISED
orderedState: UNINITIALISED
description: Starter Automation Composition Element for the Demo