diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2021-08-31 15:55:59 +0100 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2021-09-01 12:03:42 +0000 |
commit | 466783f7638c9173f08a63d51af2c799c0a63598 (patch) | |
tree | 9a17bdd1b3d4895bb771bdcd29222c50c405c9a7 /participant/participant-impl/participant-impl-policy | |
parent | bd376e1dd5e8ccb1893ef244dcd9e4b1a0686150 (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 'participant/participant-impl/participant-impl-policy')
3 files changed, 49 insertions, 27 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java index 4c87e0875..f8b8e2cad 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java @@ -153,17 +153,17 @@ public class TestListenerUtils { if (toscaInputEntry.getValue().getType().contains(CONTROL_LOOP_ELEMENT)) { ControlLoopElement clElement = new ControlLoopElement(); clElement.setId(UUID.randomUUID()); - 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); } - clElement.setParticipantId(clParticipantId); - clElement.setParticipantType(clParticipantId); + clElement.setParticipantId(clParticipantType); + clElement.setParticipantType(clParticipantType); clElement.setDefinition(new ToscaConceptIdentifier(toscaInputEntry.getKey(), toscaInputEntry.getValue().getVersion())); @@ -234,15 +234,15 @@ public class TestListenerUtils { 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); } } @@ -252,7 +252,7 @@ public class TestListenerUtils { return participantUpdateMsg; } - private static void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantId, String entryKey, + private static void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantType, String entryKey, ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates) { var clDefinition = new ControlLoopElementDefinition(); @@ -262,28 +262,28 @@ public class TestListenerUtils { 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 static 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/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml index 4b8e3592a..2ef3c6da0 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml +++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.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 @@ -97,7 +108,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: @@ -110,7 +121,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.MonitoringPolicyControlLoopParticipant version: 2.3.1 policy_type_id: @@ -123,7 +134,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.OperationalPolicyControlLoopParticipant version: 2.2.1 policy_type_id: @@ -136,7 +147,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/participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_control_loop_tosca.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_control_loop_tosca.yaml index 8615bdbaa..33b42b7bc 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_control_loop_tosca.yaml +++ b/participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_control_loop_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.3.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.3.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: |