From 466783f7638c9173f08a63d51af2c799c0a63598 Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Tue, 31 Aug 2021 15:55:59 +0100 Subject: Verify alignment with Definition of TOSCA Control Loop Types Issue-ID: POLICY-3612 Change-Id: I818f80cdc1db98752a7791ef4aba7377add66516 Signed-off-by: FrancescoFioraEst --- .../dcae/main/rest/TestListenerUtils.java | 34 ++--- .../test/resources/parameters/TestCLParams.json | 160 --------------------- .../servicetemplates/pm_control_loop_tosca.yaml | 21 ++- 3 files changed, 33 insertions(+), 182 deletions(-) delete mode 100644 participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestCLParams.json (limited to 'participant/participant-impl/participant-impl-dcae/src/test') diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java index febdf6b08..da65f7e15 100644 --- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java +++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java @@ -143,17 +143,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())); @@ -222,15 +222,15 @@ public class TestListenerUtils { for (Map.Entry 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); } } @@ -240,7 +240,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 participantDefinitionUpdates) { var clDefinition = new ControlLoopElementDefinition(); @@ -250,28 +250,28 @@ public class TestListenerUtils { List 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 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-dcae/src/test/resources/parameters/TestCLParams.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestCLParams.json deleted file mode 100644 index 5785360c8..000000000 --- a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestCLParams.json +++ /dev/null @@ -1,160 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_3 -data_types: - onap.datatypes.ToscaConceptIdentifier: - derived_from: tosca.datatypes.Root - properties: - name: - type: string - required: true - version: - type: string - required: true -node_types: - org.onap.policy.clamp.controlloop.Participant: - version: 1.0.1 - derived_from: tosca.nodetypes.Root - properties: - provider: - type: string - requred: false - org.onap.policy.clamp.controlloop.ControlLoopElement: - version: 1.0.1 - derived_from: tosca.nodetypes.Root - properties: - provider: - type: string - requred: false - participant_id: - type: onap.datatypes.ToscaConceptIdentifier - requred: true - org.onap.policy.clamp.controlloop.ControlLoop: - version: 1.0.1 - derived_from: tosca.nodetypes.Root - properties: - provider: - type: string - requred: false - elements: - type: list - required: true - entry_schema: - type: onap.datatypes.ToscaConceptIdentifier - org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement: - version: 1.0.1 - derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement - properties: - dcae_blueprint_id: - type: onap.datatypes.ToscaConceptIdentifier - requred: true - org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement: - version: 1.0.1 - derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement - properties: - policy_type_id: - type: onap.datatypes.ToscaConceptIdentifier - requred: true - org.onap.policy.clamp.controlloop.CDSControlLoopElement: - version: 1.0.1 - derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement - properties: - cds_blueprint_id: - type: onap.datatypes.ToscaConceptIdentifier - requred: true -topology_template: - node_templates: - org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant: - version: 2.3.4 - type: org.onap.policy.clamp.controlloop.Participant - type_version: 1.0.1 - description: Participant for DCAE microservices - properties: - provider: ONAP - org.onap.policy.controlloop.MonitoringPolicyControlLoopParticipant: - version: 2.3.1 - type: org.onap.policy.clamp.controlloop.Participant - type_version: 1.0.1 - description: Participant for DCAE microservices - properties: - provider: ONAP - org.onap.policy.controlloop.OperationalPolicyControlLoopParticipant: - version: 3.2.1 - type: org.onap.policy.clamp.controlloop.Participant - type_version: 1.0.1 - description: Participant for DCAE microservices - properties: - provider: ONAP - org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant: - version: 2.2.1 - type: org.onap.policy.clamp.controlloop.Participant - type_version: 1.0.1 - description: Participant for DCAE microservices - properties: - provider: ONAP - org.onap.domain.pmsh.PMSH_DCAEMicroservice: - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement - type_version: 1.0.0 - description: Control loop element for the DCAE microservice for Performance Management Subscription Handling - properties: - provider: Ericsson - participant_id: - name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant - version: 2.3.4 - dcae_blueprint_id: - name: org.onap.dcae.blueprints.PMSHBlueprint - version: 1.0.0 - org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement: - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement - type_version: 1.0.0 - description: Control loop element for the monitoring policy for Performance Management Subscription Handling - properties: - provider: Ericsson - participant_id: - name: org.onap.policy.controlloop.MonitoringPolicyControlLoopParticipant - version: 2.3.1 - policy_type_id: - name: onap.policies.monitoring.pm-subscription-handler - version: 1.0.0 - org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement: - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement - type_version: 1.0.0 - description: Control loop element for the operational policy for Performance Management Subscription Handling - properties: - provider: Ericsson - participant_id: - name: org.onap.policy.controlloop.OperationalPolicyControlLoopParticipant - version: 2.2.1 - policy_type_id: - name: onap.policies.operational.pm-subscription-handler - version: 1.0.0 - org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement: - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.ControlLoopElement - type_version: 1.0.0 - description: Control loop element for CDS for Performance Management Subscription Handling - properties: - provider: Ericsson - participant_id: - name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant - version: 3.2.1 - cds_blueprint_id: - name: org.onap.ccsdk.cds.PMSHCdsBlueprint - version: 1.0.0 - org.onap.domain.pmsh.PMSHControlLoopDefinition: - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.ControlLoop - type_version: 1.0.0 - description: Control loop for Performance Management Subscription Handling - properties: - provider: Ericsson - elements: - - name: org.onap.domain.pmsh.PMSH_DCAEMicroservice - version: 1.2.3 - - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement - version: 1.2.3 - - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement - version: 1.2.3 - - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement - version: 1.2.3 diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml b/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml index 8615bdbaa..33b42b7bc 100644 --- a/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml +++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/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: -- cgit 1.2.3-korg