summaryrefslogtreecommitdiffstats
path: root/runtime-controlloop
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2021-08-31 15:55:59 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2021-09-01 12:03:42 +0000
commit466783f7638c9173f08a63d51af2c799c0a63598 (patch)
tree9a17bdd1b3d4895bb771bdcd29222c50c405c9a7 /runtime-controlloop
parentbd376e1dd5e8ccb1893ef244dcd9e4b1a0686150 (diff)
Verify alignment with Definition of TOSCA Control Loop Types
Issue-ID: POLICY-3612 Change-Id: I818f80cdc1db98752a7791ef4aba7377add66516 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-controlloop')
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java41
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java22
-rw-r--r--runtime-controlloop/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml29
-rw-r--r--runtime-controlloop/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml6
-rw-r--r--runtime-controlloop/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml29
5 files changed, 74 insertions, 53 deletions
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
index efd262560..41ed4e291 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
@@ -76,19 +76,19 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
}
List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
- for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry :
- toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates().entrySet()) {
+ for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate()
+ .getNodeTemplates().entrySet()) {
if (toscaInputEntry.getValue().getType().contains(CONTROL_LOOP_ELEMENT)) {
- ToscaConceptIdentifier clParticipantId;
+ ToscaConceptIdentifier clParticipantType;
try {
- clParticipantId = CODER.decode(
- toscaInputEntry.getValue().getProperties().get("participant_id").toString(),
- ToscaConceptIdentifier.class);
+ clParticipantType =
+ CODER.decode(toscaInputEntry.getValue().getProperties().get("participantType").toString(),
+ ToscaConceptIdentifier.class);
} catch (CoderException e) {
- throw new RuntimeException("cannot get ParticipantId from toscaNodeTemplate", e);
+ throw new RuntimeException("cannot get ParticipantType from toscaNodeTemplate", e);
}
- prepareParticipantDefinitionUpdate(clParticipantId, toscaInputEntry.getKey(),
- toscaInputEntry.getValue(), participantDefinitionUpdates);
+ prepareParticipantDefinitionUpdate(clParticipantType, toscaInputEntry.getKey(),
+ toscaInputEntry.getValue(), participantDefinitionUpdates);
}
}
@@ -105,38 +105,37 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
super.send(message);
}
- private void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantId, String entryKey,
- ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates) {
+ private void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantType, String entryKey,
+ ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates) {
var clDefinition = new ControlLoopElementDefinition();
- clDefinition.setClElementDefinitionId(new ToscaConceptIdentifier(
- entryKey, entryValue.getVersion()));
+ clDefinition.setClElementDefinitionId(new ToscaConceptIdentifier(entryKey, entryValue.getVersion()));
clDefinition.setControlLoopElementToscaNodeTemplate(entryValue);
List<ControlLoopElementDefinition> controlLoopElementDefinitionList = new ArrayList<>();
if (participantDefinitionUpdates.isEmpty()) {
- participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantId,
- controlLoopElementDefinitionList));
+ participantDefinitionUpdates
+ .add(getParticipantDefinition(clDefinition, clParticipantType, controlLoopElementDefinitionList));
} else {
var participantExists = false;
for (ParticipantDefinition participantDefinitionUpdate : participantDefinitionUpdates) {
- if (participantDefinitionUpdate.getParticipantId().equals(clParticipantId)) {
+ if (participantDefinitionUpdate.getParticipantType().equals(clParticipantType)) {
participantDefinitionUpdate.getControlLoopElementDefinitionList().add(clDefinition);
participantExists = true;
}
}
if (!participantExists) {
- participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantId,
- controlLoopElementDefinitionList));
+ participantDefinitionUpdates.add(
+ getParticipantDefinition(clDefinition, clParticipantType, controlLoopElementDefinitionList));
}
}
}
private ParticipantDefinition getParticipantDefinition(ControlLoopElementDefinition clDefinition,
- ToscaConceptIdentifier clParticipantId,
- List<ControlLoopElementDefinition> controlLoopElementDefinitionList) {
+ ToscaConceptIdentifier clParticipantType,
+ List<ControlLoopElementDefinition> controlLoopElementDefinitionList) {
var participantDefinition = new ParticipantDefinition();
- participantDefinition.setParticipantId(clParticipantId);
+ participantDefinition.setParticipantType(clParticipantType);
controlLoopElementDefinitionList.add(clDefinition);
participantDefinition.setControlLoopElementDefinitionList(controlLoopElementDefinitionList);
return participantDefinition;
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java
index f1a272835..4cfcf1508 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java
@@ -192,15 +192,15 @@ class SupervisionMessagesTest extends CommonRestController {
for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry :
toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates().entrySet()) {
if (toscaInputEntry.getValue().getType().contains(CONTROL_LOOP_ELEMENT)) {
- ToscaConceptIdentifier clParticipantId;
+ ToscaConceptIdentifier clParticipantType;
try {
- clParticipantId = CODER.decode(
- toscaInputEntry.getValue().getProperties().get("participant_id").toString(),
+ clParticipantType = CODER.decode(
+ toscaInputEntry.getValue().getProperties().get("participantType").toString(),
ToscaConceptIdentifier.class);
} catch (CoderException e) {
- throw new RuntimeException("cannot get ParticipantId from toscaNodeTemplate", e);
+ throw new RuntimeException("cannot get ParticipantType from toscaNodeTemplate", e);
}
- prepareParticipantDefinitionUpdate(clParticipantId, toscaInputEntry.getKey(),
+ prepareParticipantDefinitionUpdate(clParticipantType, toscaInputEntry.getKey(),
toscaInputEntry.getValue(), participantDefinitionUpdates);
}
}
@@ -215,7 +215,7 @@ class SupervisionMessagesTest extends CommonRestController {
}
}
- private void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantId, String entryKey,
+ private void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantType, String entryKey,
ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates) {
var clDefinition = new ControlLoopElementDefinition();
@@ -225,28 +225,28 @@ class SupervisionMessagesTest extends CommonRestController {
List<ControlLoopElementDefinition> controlLoopElementDefinitionList = new ArrayList<>();
if (participantDefinitionUpdates.isEmpty()) {
- participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantId,
+ participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantType,
controlLoopElementDefinitionList));
} else {
boolean participantExists = false;
for (ParticipantDefinition participantDefinitionUpdate : participantDefinitionUpdates) {
- if (participantDefinitionUpdate.getParticipantId().equals(clParticipantId)) {
+ if (participantDefinitionUpdate.getParticipantType().equals(clParticipantType)) {
participantDefinitionUpdate.getControlLoopElementDefinitionList().add(clDefinition);
participantExists = true;
}
}
if (!participantExists) {
- participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantId,
+ participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantType,
controlLoopElementDefinitionList));
}
}
}
private ParticipantDefinition getParticipantDefinition(ControlLoopElementDefinition clDefinition,
- ToscaConceptIdentifier clParticipantId,
+ ToscaConceptIdentifier clParticipantType,
List<ControlLoopElementDefinition> controlLoopElementDefinitionList) {
ParticipantDefinition participantDefinition = new ParticipantDefinition();
- participantDefinition.setParticipantId(clParticipantId);
+ participantDefinition.setParticipantType(clParticipantType);
controlLoopElementDefinitionList.add(clDefinition);
participantDefinition.setControlLoopElementDefinitionList(controlLoopElementDefinitionList);
return participantDefinition;
diff --git a/runtime-controlloop/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml b/runtime-controlloop/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml
index dc09b4623..9acff1356 100644
--- a/runtime-controlloop/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml
+++ b/runtime-controlloop/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml
@@ -24,9 +24,20 @@ node_types:
provider:
type: string
requred: false
- participant_id:
+ participantType:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
+ startPhase:
+ type: integer
+ required: false
+ constraints:
+ - greater-or-equal: 0
+ metadata:
+ common: true
+ description: A value indicating the start phase in which this control loop element will be started, the
+ first start phase is zero. Control Loop Elements are started in their start_phase order and stopped
+ in reverse start phase order. Control Loop Elements with the same start phase are started and
+ stopped simultaneously
org.onap.policy.clamp.controlloop.ControlLoop:
version: 1.0.1
derived_from: tosca.nodetypes.Root
@@ -90,7 +101,7 @@ topology_template:
description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
version: 2.3.4
dcae_blueprint_id:
@@ -103,7 +114,7 @@ topology_template:
description: Control loop element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.2.1
policy_type_id:
@@ -116,7 +127,7 @@ topology_template:
description: Control loop element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.2.1
policy_type_id:
@@ -129,7 +140,7 @@ topology_template:
description: Control loop element for CDS for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
version: 3.2.1
cds_blueprint_id:
@@ -158,7 +169,7 @@ topology_template:
description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
version: 2.3.4
dcae_blueprint_id:
@@ -171,7 +182,7 @@ topology_template:
description: Control loop element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.2.1
policy_type_id:
@@ -184,7 +195,7 @@ topology_template:
description: Control loop element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.2.1
policy_type_id:
@@ -197,7 +208,7 @@ topology_template:
description: Control loop element for CDS for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
version: 3.2.1
cds_blueprint_id:
diff --git a/runtime-controlloop/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml b/runtime-controlloop/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml
index c98ca42cc..4dd4f95ae 100644
--- a/runtime-controlloop/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml
+++ b/runtime-controlloop/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml
@@ -630,7 +630,7 @@ topology_template:
description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
version: 2.3.4
dcae_blueprint:
@@ -854,7 +854,7 @@ topology_template:
description: Control loop element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.3.1
policy_type_id:
@@ -869,7 +869,7 @@ topology_template:
description: Control loop element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.3.1
policy_type_id:
diff --git a/runtime-controlloop/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml b/runtime-controlloop/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml
index dc09b4623..9acff1356 100644
--- a/runtime-controlloop/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml
+++ b/runtime-controlloop/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml
@@ -24,9 +24,20 @@ node_types:
provider:
type: string
requred: false
- participant_id:
+ participantType:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
+ startPhase:
+ type: integer
+ required: false
+ constraints:
+ - greater-or-equal: 0
+ metadata:
+ common: true
+ description: A value indicating the start phase in which this control loop element will be started, the
+ first start phase is zero. Control Loop Elements are started in their start_phase order and stopped
+ in reverse start phase order. Control Loop Elements with the same start phase are started and
+ stopped simultaneously
org.onap.policy.clamp.controlloop.ControlLoop:
version: 1.0.1
derived_from: tosca.nodetypes.Root
@@ -90,7 +101,7 @@ topology_template:
description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
version: 2.3.4
dcae_blueprint_id:
@@ -103,7 +114,7 @@ topology_template:
description: Control loop element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.2.1
policy_type_id:
@@ -116,7 +127,7 @@ topology_template:
description: Control loop element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.2.1
policy_type_id:
@@ -129,7 +140,7 @@ topology_template:
description: Control loop element for CDS for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
version: 3.2.1
cds_blueprint_id:
@@ -158,7 +169,7 @@ topology_template:
description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
version: 2.3.4
dcae_blueprint_id:
@@ -171,7 +182,7 @@ topology_template:
description: Control loop element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.2.1
policy_type_id:
@@ -184,7 +195,7 @@ topology_template:
description: Control loop element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.policy.controlloop.PolicyControlLoopParticipant
version: 2.2.1
policy_type_id:
@@ -197,7 +208,7 @@ topology_template:
description: Control loop element for CDS for Performance Management Subscription Handling
properties:
provider: Ericsson
- participant_id:
+ participantType:
name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
version: 3.2.1
cds_blueprint_id: