diff options
Diffstat (limited to 'participant')
11 files changed, 150 insertions, 241 deletions
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 2ceba005c..26f9cd4b9 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<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); } } @@ -239,7 +239,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(); @@ -249,28 +249,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-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: diff --git a/participant/participant-impl/participant-impl-http/src/test/resources/HttpParticipantConfig.yaml b/participant/participant-impl/participant-impl-http/src/test/resources/HttpParticipantConfig.yaml index 43d0c269c..f221bcbd7 100644 --- a/participant/participant-impl/participant-impl-http/src/test/resources/HttpParticipantConfig.yaml +++ b/participant/participant-impl/participant-impl-http/src/test/resources/HttpParticipantConfig.yaml @@ -88,9 +88,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 @@ -142,9 +153,10 @@ topology_template: description: Control loop element for the http requests of PMSH microservice properties: provider: ONAP - participant_id: + participantType: name: org.onap.controlloop.HttpControlLoopParticipant version: 2.3.4 + startPhase: 1 uninitializedToPassiveTimeout: 180 baseUrl: https://httpbin.org httpHeaders: diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/servicetemplates/KubernetesHelm.yaml b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/servicetemplates/KubernetesHelm.yaml index 69886cdb1..7d594019a 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/servicetemplates/KubernetesHelm.yaml +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/servicetemplates/KubernetesHelm.yaml @@ -41,9 +41,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 @@ -94,9 +105,10 @@ topology_template: description: Control loop element for the K8S microservice for Hello World properties: provider: ONAP - participant_id: + participantType: name: org.onap.k8s.controlloop.K8SControlLoopParticipant version: 2.3.4 + startPhase: 2 uninitializedToPassiveTimeout: 180 podStatusCheckInterval: 30 chart: @@ -115,9 +127,10 @@ topology_template: description: Control loop element for the K8S microservice for PMSH properties: provider: ONAP - participant_id: + participantType: name: org.onap.k8s.controlloop.K8SControlLoopParticipant version: 2.3.4 + startPhase: 2 uninitializedToPassiveTimeout: 180 podStatusCheckInterval: 30 chart: @@ -137,9 +150,10 @@ topology_template: description: Control loop element for the K8S microservice for local chart properties: provider: ONAP - participant_id: + participantType: name: org.onap.k8s.controlloop.K8SControlLoopParticipant version: 2.3.4 + startPhase: 2 uninitializedToPassiveTimeout: 180 podStatusCheckInterval: 30 chart: 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 52ec98ea2..a33fa0a58 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 @@ -157,17 +157,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())); @@ -264,15 +264,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); } } @@ -281,7 +281,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(); @@ -291,28 +291,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: diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java index fa87d5c24..56be0817f 100644 --- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java +++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java @@ -149,17 +149,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())); @@ -229,15 +229,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); } } @@ -246,7 +246,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(); @@ -256,28 +256,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-simulator/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml b/participant/participant-impl/participant-impl-simulator/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml index c2a68d7a2..21d20a8ee 100644 --- a/participant/participant-impl/participant-impl-simulator/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml +++ b/participant/participant-impl/participant-impl-simulator/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.PM_CDS_Blueprint version: 1.0.0 cds_blueprint_id: diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java index 56fddd6ff..072a2ebc1 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java @@ -292,7 +292,7 @@ public class ParticipantHandler { if (!participantUpdateMsg.getParticipantDefinitionUpdates().isEmpty()) { // This message is to commission the controlloop for (ParticipantDefinition participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) { - if (participantDefinition.getParticipantId().equals(participantType)) { + if (participantDefinition.getParticipantType().equals(participantType)) { clElementDefsOnThisParticipant.clear(); clElementDefsOnThisParticipant.addAll(participantDefinition.getControlLoopElementDefinitionList()); break; @@ -343,12 +343,11 @@ public class ParticipantHandler { heartbeat.setControlLoopInfoList(getControlLoopInfoList()); if (responseToParticipantStatusReq) { - List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>(); ParticipantDefinition participantDefinition = new ParticipantDefinition(); participantDefinition.setParticipantId(participantId); + participantDefinition.setParticipantType(participantType); participantDefinition.setControlLoopElementDefinitionList(clElementDefsOnThisParticipant); - participantDefinitionUpdates.add(participantDefinition); - heartbeat.setParticipantDefinitionUpdates(participantDefinitionUpdates); + heartbeat.setParticipantDefinitionUpdates(List.of(participantDefinition)); } return heartbeat; |