aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-01-25 19:55:43 +0000
committerliamfallon <liam.fallon@est.tech>2022-02-18 15:54:40 +0000
commit43098043c4ef31d9d5dead66568d7d9482a6b165 (patch)
tree6f6ea4812ff93d65e7c64e12a3ec6ab4462a64e2
parentf401b5099bcb64f3e21de608d0207dd69d8043cd (diff)
Rename TOSCA Control Loop to ACM
This commit renames the TOSCA Control Loop functionality in CLAMP to Automation Composition Management. This review is a direct renaming review and, as everything is renamed together it is large. Issue-ID: POLICY-3939 Change-Id: I28f0a6dd889bf3570a4c1365ae9e71fc58db6d6c Signed-off-by: liamfallon <liam.fallon@est.tech>
-rw-r--r--common/src/main/java/org/onap/policy/clamp/common/acm/exception/AutomationCompositionException.java (renamed from common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java)23
-rw-r--r--common/src/main/java/org/onap/policy/clamp/common/acm/exception/AutomationCompositionRuntimeException.java (renamed from common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopRuntimeException.java)38
-rw-r--r--common/src/main/java/org/onap/policy/clamp/common/acm/rest/CoderHttpMesageConverter.java (renamed from common/src/main/java/org/onap/policy/clamp/controlloop/common/rest/CoderHttpMesageConverter.java)8
-rw-r--r--common/src/main/java/org/onap/policy/clamp/common/acm/rest/RequestResponseLoggingFilter.java (renamed from common/src/main/java/org/onap/policy/clamp/controlloop/common/rest/RequestResponseLoggingFilter.java)2
-rw-r--r--common/src/main/java/org/onap/policy/clamp/common/acm/startstop/CommonCommandLineArguments.java (renamed from common/src/main/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArguments.java)35
-rw-r--r--common/src/main/resources/tosca/ApplicationServiceDescriptorTypes.yaml74
-rw-r--r--common/src/main/resources/tosca/AutomationCompositionTOSCAServiceTemplateTypes.yaml (renamed from common/src/main/resources/tosca/ControlLoopTOSCAServiceTemplateTypes.yaml)24
-rw-r--r--common/src/main/resources/tosca/CdsAutomationCompositionElementType.yaml (renamed from common/src/main/resources/tosca/CdsControlLoopElementType.yaml)8
-rw-r--r--common/src/main/resources/tosca/DcaeControlLoopElementType.yaml51
-rw-r--r--common/src/main/resources/tosca/HttpAutomationCompositionElementType.yaml (renamed from common/src/main/resources/tosca/HttpControlLoopElementType.yaml)20
-rw-r--r--common/src/main/resources/tosca/KubernetesAutomationCompositionElementType.yaml (renamed from common/src/main/resources/tosca/KubernetesControlLoopElementType.yaml)10
-rw-r--r--common/src/main/resources/tosca/PolicyAutomationCompositionElementType.yaml (renamed from common/src/main/resources/tosca/PolicyControlLoopElementType.yaml)17
-rw-r--r--common/src/test/java/org/onap/policy/clamp/common/acm/exception/ExceptionsTest.java (renamed from common/src/test/java/org/onap/policy/clamp/controlloop/common/exception/ExceptionsTest.java)49
-rw-r--r--common/src/test/java/org/onap/policy/clamp/common/acm/rest/CoderHttpMessageConverterTest.java (renamed from common/src/test/java/org/onap/policy/clamp/controlloop/common/rest/CoderHttpMessageConverterTest.java)12
-rw-r--r--common/src/test/java/org/onap/policy/clamp/common/acm/rest/RequestResponseLoggingFilterTest.java (renamed from common/src/test/java/org/onap/policy/clamp/controlloop/common/rest/RequestResponseLoggingFilterTest.java)2
-rw-r--r--common/src/test/java/org/onap/policy/clamp/common/acm/startstop/CommonCommandLineArgumentsTest.java (renamed from common/src/test/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArgumentsTest.java)2
-rw-r--r--common/src/test/resources/asd/MyDomainASDDefintion.yaml131
-rw-r--r--common/src/test/resources/demo/Notes.txt20
-rw-r--r--common/src/test/resources/demo/config/DEMO.postman_collection.json28
-rw-r--r--common/src/test/resources/demo/config/PolicyParticipantConfig.json10
-rw-r--r--common/src/test/resources/demo/config/RuntimeConfig.json8
-rw-r--r--common/src/test/resources/examples/acm/KubernetesHelm.yaml (renamed from common/src/test/resources/examples/controlloop/KubernetesHelm.yaml)0
-rw-r--r--common/src/test/resources/examples/acm/PMSH/consul_call_body.json (renamed from common/src/test/resources/examples/controlloop/PMSH/consul_call_body.json)0
-rw-r--r--common/src/test/resources/examples/acm/PMSH/consul_url.txt (renamed from common/src/test/resources/examples/controlloop/PMSH/consul_url.txt)0
-rw-r--r--common/src/test/resources/examples/acm/PMSH/pmsh.postman2.0_collection.json (renamed from common/src/test/resources/examples/controlloop/PMSH/pmsh.postman2.0_collection.json)0
-rw-r--r--common/src/test/resources/examples/acm/PMSH/pmsh_cloudify_blueprint.yaml (renamed from common/src/test/resources/examples/controlloop/PMSH/pmsh_cloudify_blueprint.yaml)0
-rw-r--r--common/src/test/resources/examples/acm/PMSH/pmsh_monitoring_policy.json (renamed from common/src/test/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.json)0
-rw-r--r--common/src/test/resources/examples/acm/PMSH/pmsh_monitoring_policy.yaml (renamed from common/src/test/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.yaml)0
-rw-r--r--common/src/test/resources/examples/acm/PMSH/pmsh_monitoring_policy_type.yaml (renamed from common/src/test/resources/examples/controlloop/PMSH/pmsh_monitoring_policy_type.yaml)0
-rw-r--r--common/src/test/resources/examples/acm/PMSH/pmsh_operational_policy.json (renamed from common/src/test/resources/examples/controlloop/PMSH/pmsh_operational_policy.json)0
-rw-r--r--common/src/test/resources/examples/acm/PMSH/pmsh_operational_policy.yaml (renamed from common/src/test/resources/examples/controlloop/PMSH/pmsh_operational_policy.yaml)0
-rw-r--r--common/src/test/resources/examples/acm/PMSubscriptionHandling.yaml (renamed from common/src/test/resources/examples/controlloop/PMSubscriptionHandling.yaml)0
-rw-r--r--common/src/test/resources/examples/acm/PMSubscriptionHandling_GuilinFormat.yaml (renamed from common/src/test/resources/examples/controlloop/PMSubscriptionHandling_GuilinFormat.yaml)0
-rw-r--r--common/src/test/resources/examples/acm/http-participant/http.postman2.0_collection.json (renamed from common/src/test/resources/examples/controlloop/http-participant/http.postman2.0_collection.json)0
-rw-r--r--common/src/test/resources/examples/acm/k8s-participant/k8s.postman2.0_collection.json (renamed from common/src/test/resources/examples/controlloop/k8s-participant/k8s.postman2.0_collection.json)0
-rw-r--r--common/src/test/resources/examples/controlloop/original/cloop_DCAE_VES_TCA_substitution.yaml83
-rw-r--r--common/src/test/resources/examples/controlloop/original/cloop_base_types.yaml210
-rw-r--r--common/src/test/resources/examples/controlloop/original/cloop_dcae_example.yaml50
-rw-r--r--common/src/test/resources/examples/controlloop/original/cloop_dcae_types.yaml140
-rw-r--r--common/src/test/resources/examples/controlloop/original/cloop_other_types.yaml63
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopState.java63
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java279
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java104
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatistics.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatistics.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsList.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsList.java)6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java)51
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java)16
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementAck.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementAck.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java)26
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java)18
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionOrderedState.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopOrderedState.java)25
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionState.java67
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionStatistics.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositions.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoops.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantDefinition.java)11
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantHealthStatus.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantHealthStatus.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantState.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantState.java)23
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatistics.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatistics.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsList.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsList.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUpdates.java)10
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtils.java)40
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotification.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotification.java)16
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatus.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatus.java)6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java)29
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java)24
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdate.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java)24
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java)6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregister.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregister.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAck.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAck.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessage.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java104
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegister.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegister.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAck.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAck.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantResponseStatus.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseStatus.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatus.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java)25
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReq.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReq.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdate.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAck.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAck.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/GenericNameVersion.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/SimpleResponse.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/TypedSimpleResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/TypedSimpleResponse.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/commissioning/CommissioningResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/commissioning/CommissioningResponse.java)6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionOrderStateResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopOrderStateResponse.java)14
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimed.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimed.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimedResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimedResponse.java)10
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstancePropertiesResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstancePropertiesResponse.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommand.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommand.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationOrderStateResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationResponse.java)6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatistics.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatistics.java)74
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java)115
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElement.java)52
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatistics.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatistics.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProvider.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProvider.java)84
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java287
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProvider.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProvider.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProvider.java)10
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ProviderUtils.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProvider.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProvider.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AcElementStatisticsRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ClElementStatisticsRepository.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ControlLoopRepository.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepository.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImpl.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImpl.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantRepository.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantStatisticsRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantStatisticsRepository.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplateRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplateRepository.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplatesRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplatesRepository.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaServiceTemplateRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaServiceTemplateRepository.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/rest/RestUtils.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/rest/RestUtils.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java (renamed from common/src/main/java/org/onap/policy/clamp/controlloop/common/utils/CommonUtils.java)86
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementTest.java103
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java160
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java189
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java300
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java301
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java116
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java290
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotificationTest.java83
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsTest.java)44
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionConceptPojosTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopConceptPojosTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementTest.java103
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionTest.java160
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtilsTest.java)47
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotificationTest.java83
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatusTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatusTest.java)24
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/NotificationPojosTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/NotificationPojosTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java)34
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java)28
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java)46
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java)4
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java)8
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java)4
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageUtils.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantPojosTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java)8
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java)8
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java)92
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java)28
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/MessagesRestPojosTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/MessagesRestPojosTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommandTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommandTest.java)8
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAcElementStatisticsChild.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopChild.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionChild.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopElementChild.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionElementChild.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaClElementStatisticsChild.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantChild.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantChild.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantStatisticsChild.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantStatisticsChild.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatisticsTest.java189
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java315
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java310
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatisticsTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatisticsTest.java)28
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantTest.java)8
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/PojosTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/PojosTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProviderTest.java116
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java305
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProviderTest.java)12
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProviderTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProviderTest.java)12
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProviderTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProviderTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImplTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImplTest.java)35
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/rest/RestUtilsTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/rest/RestUtilsTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java (renamed from common/src/test/java/org/onap/policy/clamp/controlloop/common/utils/CommonUtilsTest.java)60
-rw-r--r--models/src/test/resources/META-INF/persistence.xml10
-rw-r--r--models/src/test/resources/examples/acm/PMSubscriptionHandling.yaml (renamed from models/src/test/resources/examples/controlloop/PMSubscriptionHandling.yaml)90
-rw-r--r--models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json (renamed from models/src/test/resources/json/ControlLoopElementNoOrderedState.json)2
-rw-r--r--models/src/test/resources/json/AutomationCompositionNoOrderedState.json (renamed from models/src/test/resources/json/ControlLoopNoOrderedState.json)4
-rw-r--r--models/src/test/resources/providers/TestAcElementStatistics.json (renamed from models/src/test/resources/providers/TestClElementStatistics.json)10
-rw-r--r--models/src/test/resources/providers/TestAutomationCompositions.json (renamed from participant/participant-intermediary/src/test/resources/providers/TestControlLoops.json)54
-rw-r--r--models/src/test/resources/providers/TestParticipant.json4
-rw-r--r--models/src/test/resources/providers/UpdateAutomationCompositions.json (renamed from models/src/test/resources/providers/UpdateControlLoops.json)28
-rw-r--r--packages/policy-clamp-docker/pom.xml23
-rw-r--r--packages/policy-clamp-docker/src/main/docker/AcmRuntimeDockerfile (renamed from packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile)12
-rw-r--r--packages/policy-clamp-docker/src/main/docker/HttpParticipantDockerfile2
-rw-r--r--packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile2
-rw-r--r--packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile2
-rw-r--r--packages/policy-clamp-docker/src/main/docker/acm-runtime.sh (renamed from packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh)6
-rw-r--r--packages/policy-clamp-tarball/pom.xml2
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml (renamed from packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml)9
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml10
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml12
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml10
-rw-r--r--participant/participant-impl/participant-impl-cds/pom.xml2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/Application.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/Application.java)12
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/ParticipantConfig.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/ParticipantConfig.java)18
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/SecurityConfig.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/SecurityConfig.java)2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/exception/HttpWebClientException.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/exception/HttpWebClientException.java)2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java)84
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigRequest.java)2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigurationEntity.java)2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/RestParams.java)2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/webclient/AcHttpClient.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/webclient/ClHttpClient.java)14
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/parameters/ParticipantHttpParameters.java)7
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml10
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java106
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java (renamed from participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/rest/ActuatorControllerTest.java)4
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java (renamed from participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/CommonActuatorController.java)4
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java (renamed from participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/CommonTestData.java)87
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/ToscaUtils.java (renamed from participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/ToscaUtils.java)12
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/webclient/AcHttpClientTest.java (renamed from participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/webclient/ClHttpClientTest.java)16
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java108
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/resources/HttpParticipantConfig.yaml48
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/resources/application_test.properties22
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/pom.xml2
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/Application.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/Application.java)12
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/ParticipantConfig.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantConfig.java)2
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/ParticipantIntermediaryConfig.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantIntermediaryConfig.java)18
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/SecurityConfig.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/SecurityConfig.java)2
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/SpringFoxConfig.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/SpringFoxConfig.java)4
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/controller/ChartController.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java)14
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/exception/ServiceException.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/exception/ServiceException.java)2
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java)105
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClient.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java)10
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidator.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/PodStatusValidator.java)12
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/ChartInfo.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/ChartInfo.java)2
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/ChartList.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/ChartList.java)2
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/HelmRepository.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/HelmRepository.java)2
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/InstallationInfo.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/InstallationInfo.java)2
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParameters.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/ParticipantK8sParameters.java)6
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartService.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java)10
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStore.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java)8
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml16
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java182
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java)12
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidatorTest.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/PodStatusValidatorTest.java)22
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/CommonTestData.java)14
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/ParticipantK8sParametersTest.java)6
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ActuatorControllerTest.java)4
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ChartControllerTest.java)12
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartServiceTest.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartServiceTest.java)10
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStoreTest.java)10
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java (renamed from participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/CommonActuatorController.java)4
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/utils/TestUtils.java)16
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java180
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/resources/application_test.properties22
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/resources/servicetemplates/KubernetesHelm.yaml58
-rw-r--r--participant/participant-impl/participant-impl-policy/pom.xml2
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/PolicyParticipantApplication.java (renamed from participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/PolicyParticipantApplication.java)9
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/AbstractHttpClient.java (renamed from participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/AbstractHttpClient.java)8
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyApiHttpClient.java (renamed from participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyApiHttpClient.java)4
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyPapHttpClient.java (renamed from participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyPapHttpClient.java)4
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/ParticipantConfig.java (renamed from participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/config/ParticipantConfig.java)18
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/SecurityConfig.java (renamed from participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/config/SecurityConfig.java)2
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java227
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParameters.java (renamed from participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java)6
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java220
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml10
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml10
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java (renamed from participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java)30
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java102
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java (renamed from participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java)9
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParametersTest.java (renamed from participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParametersTest.java)11
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/rest/ActuatorControllerTest.java (renamed from participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/rest/ActuatorControllerTest.java)4
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/CommonActuatorController.java (renamed from participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/utils/CommonActuatorController.java)4
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java321
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandlerTest.java102
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java317
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties20
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestACParams.yaml172
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml172
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml2
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml348
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Match.yaml8
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Naming.yaml102
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Optimization.yaml33
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.Common.yaml28
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml16
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Filter.yaml66
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml26
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.MinMax.yaml24
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml27
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.Common.yaml143
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Apex.yaml26
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Drools.yaml14
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-mapper.yaml50
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-subscription-handler.yaml132
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml128
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml19
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.tcagen2.yaml161
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Apex.yaml203
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Drools.yaml118
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Xacml.yaml20
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Resource.yaml25
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Service.yaml17
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml33
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.DistancePolicy.yaml58
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.HpaPolicy.yaml105
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml68
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.PciPolicy.yaml32
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.Vim_fit.yaml30
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.VnfPolicy.yaml46
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.QueryPolicy.yaml26
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml36
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_automation_composition_tosca.yaml (renamed from participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_control_loop_tosca.yaml)80
-rw-r--r--participant/participant-impl/participant-impl-simulator/pom.xml2
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/ParticipantSimulatorApplication.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/ParticipantSimulatorApplication.java)10
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/AafConfiguration.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/AafConfiguration.java)4
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/ParticipantConfig.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/ParticipantConfig.java)20
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SecurityConfig.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/SecurityConfig.java)2
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SpringFoxConfig.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/SpringFoxConfig.java)4
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/YamlConfiguration.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/YamlConfiguration.java)4
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandler.java112
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/ParticipantSimulatorParameters.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java)6
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/AbstractRestController.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/AbstractRestController.java)44
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/GlobalControllerExceptionHandler.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/GlobalControllerExceptionHandler.java)16
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantErrorController.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/ParticipantErrorController.java)6
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java)2
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/SimulationProvider.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java)61
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationElementController.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java)77
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationParticipantController.java (renamed from participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java)26
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandler.java111
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml6
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt2
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/endtoend/ParticipantSimulatorTest.java (renamed from participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/endtoend/ParticipantSimulatorTest.java)79
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandlerTest.java91
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/CommonTestData.java (renamed from participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/CommonTestData.java)8
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java (renamed from participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java)6
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/TestListenerUtils.java260
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandlerTest.java98
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java257
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/resources/application_test.properties14
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/resources/rest/servicetemplates/pm_automation_composition_tosca.yaml (renamed from participant/participant-impl/participant-impl-simulator/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml)76
-rw-r--r--participant/participant-intermediary/pom.xml4
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java65
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java130
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java140
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionStateChangeListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java)18
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java)19
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/MessageSender.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java)6
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantAckListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantAckListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantDeregisterAckListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantDeregisterAckListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantMessagePublisher.java)38
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantRegisterAckListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantStatusReqListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusReqListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantUpdateListener.java)8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java476
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivator.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java)17
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Listener.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/Listener.java)2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java)177
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Publisher.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/Publisher.java)2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java)6
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantParameters.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantParameters.java)2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java63
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java129
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java137
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java454
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java)65
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantCommTest.java)57
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java227
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/DummyParticipantParameters.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/DummyParticipantParameters.java)6
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java)10
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandlerTest.java)44
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/CommonTestData.java)139
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java (renamed from participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java)10
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java226
-rw-r--r--participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json (renamed from models/src/test/resources/providers/TestControlLoops.json)54
-rw-r--r--pom.xml5
-rw-r--r--runtime-acm/pom.xml (renamed from runtime-controlloop/pom.xml)2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/Application.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java)24
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java)139
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/AafConfiguration.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/AafConfiguration.java)13
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java)4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/FilterConfig.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/FilterConfig.java)6
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/SecurityConfig.java)2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SpringFoxConfig.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/SpringFoxConfig.java)4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/messaging/Listener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Listener.java)2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivator.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/MessageDispatcherActivator.java)16
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/messaging/Publisher.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Publisher.java)2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java637
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/AcRuntimeParameterGroup.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterGroup.java)6
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantParameters.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantParameters.java)2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantUpdateParameters.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantUpdateParameters.java)2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/CommissioningController.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/CommissioningController.java)196
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java)278
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/MonitoringQueryController.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/MonitoringQueryController.java)195
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AbstractRestController.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/AbstractRestController.java)12
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AutomationConfiguraitonAafFilter.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/ControlLoopAafFilter.java)6
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/GlobalControllerExceptionHandler.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/GlobalControllerExceptionHandler.java)16
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RuntimeErrorController.java)6
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/monitoring/MonitoringProvider.java247
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/HandleCounter.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/HandleCounter.java)2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/MessageIntercept.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/MessageIntercept.java)2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspect.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspect.java)8
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java518
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java307
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantAckPublisher.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/AbstractParticipantAckPublisher.java)10
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantPublisher.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/AbstractParticipantPublisher.java)10
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangeAckListener.java)32
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangePublisher.java)30
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdateAckListener.java)32
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java)56
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java)4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterListener.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterListener.java)10
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterAckPublisher.java)4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterListener.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterListener.java)10
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusListener.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStatusListener.java)10
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStatusReqPublisher.java)4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdateAckListener.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdateAckListener.java)10
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java (renamed from runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java)20
-rw-r--r--runtime-acm/src/main/resources/application.yaml (renamed from runtime-controlloop/src/main/resources/application.yaml)9
-rw-r--r--runtime-acm/src/main/resources/version.txt (renamed from runtime-controlloop/src/main/resources/version.txt)2
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java)84
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningControllerTest.java)32
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivatorTest.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/MessageDispatcherActivatorTest.java)12
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java394
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationUtils.java)72
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java)294
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/ActuatorControllerTest.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/rest/ActuatorControllerTest.java)4
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/monitoring/TestMonitoringProvider.java321
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/monitoring/rest/MonitoringQueryControllerTest.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/rest/MonitoringQueryControllerTest.java)116
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/HandleCounterTest.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/HandleCounterTest.java)2
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspectTest.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspectTest.java)4
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java319
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java214
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java)94
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/CommonTestData.java)46
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/rest/CommonRestController.java (renamed from runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java)4
-rw-r--r--runtime-acm/src/test/resources/application_test.properties (renamed from runtime-controlloop/src/test/resources/application_test.properties)6
-rw-r--r--runtime-acm/src/test/resources/parameters/TestParameters.json (renamed from runtime-controlloop/src/test/resources/parameters/TestParameters.json)10
-rw-r--r--runtime-acm/src/test/resources/parameters/logback-test.xml (renamed from runtime-controlloop/src/test/resources/parameters/logback-test.xml)2
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json (renamed from runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopElementsNotFound.json)54
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionVersionNotMatches.json (renamed from runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsVersionNotMatches.json)54
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json (renamed from runtime-controlloop/src/test/resources/rest/controlloops/ControlLoops.json)70
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionsNotFound.json (renamed from runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsNotFound.json)54
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionsSmoke.json (renamed from runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsSmoke.json)72
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json (renamed from runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsUpdate.json)70
-rw-r--r--runtime-acm/src/test/resources/rest/acm/PassiveCommand.json (renamed from runtime-controlloop/src/test/resources/rest/controlloops/PassiveCommand.json)2
-rw-r--r--runtime-acm/src/test/resources/rest/monitoring/TestAcElementStatistics.json (renamed from runtime-controlloop/src/test/resources/rest/monitoring/TestClElementStatistics.json)18
-rw-r--r--runtime-acm/src/test/resources/rest/monitoring/TestAcElementStatistics_Invalid.json (renamed from runtime-controlloop/src/test/resources/rest/monitoring/TestClElementStatistics_Invalid.json)6
-rw-r--r--runtime-acm/src/test/resources/rest/monitoring/TestParticipantStatistics.json (renamed from runtime-controlloop/src/test/resources/rest/monitoring/TestParticipantStatistics.json)0
-rw-r--r--runtime-acm/src/test/resources/rest/monitoring/TestParticipantStatistics_Invalid.json (renamed from runtime-controlloop/src/test/resources/rest/monitoring/TestParticipantStatistics_Invalid.json)0
-rw-r--r--runtime-acm/src/test/resources/rest/servicetemplates/PMSHMultipleACTosca.yaml232
-rw-r--r--runtime-acm/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml (renamed from runtime-controlloop/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml)138
-rw-r--r--runtime-acm/src/test/resources/rest/servicetemplates/pm_automation_composition_tosca.yaml (renamed from runtime-controlloop/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml)2
-rw-r--r--runtime-acm/src/test/resources/rest/servicetemplates/pmsh_multiple_ac_tosca.yaml (renamed from runtime-controlloop/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml)120
-rw-r--r--runtime-acm/src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml (renamed from runtime-controlloop/src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml)148
-rwxr-xr-xruntime-acm/src/test/resources/testscripts/listenOnTopic.sh (renamed from runtime-controlloop/src/test/resources/testscripts/listenOnTopic.sh)0
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java619
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java243
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java491
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java301
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java378
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java319
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java307
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java214
-rw-r--r--runtime-controlloop/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml232
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/config/AafConfiguration.java2
-rw-r--r--runtime/src/main/resources/application-noaaf.properties6
-rw-r--r--runtime/src/main/resources/application.properties6
-rw-r--r--runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml34
-rw-r--r--runtime/src/main/resources/clds/camel/routes/acm-flows.xml (renamed from runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml)92
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseItTestCase.java2
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java5
-rw-r--r--runtime/src/test/resources/application.properties6
-rw-r--r--runtime/src/test/resources/http-cache/third_party_proxy.py36
459 files changed, 11587 insertions, 14310 deletions
diff --git a/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java b/common/src/main/java/org/onap/policy/clamp/common/acm/exception/AutomationCompositionException.java
index 58b5368a9..c22aa920e 100644
--- a/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java
+++ b/common/src/main/java/org/onap/policy/clamp/common/acm/exception/AutomationCompositionException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.exception;
+package org.onap.policy.clamp.common.acm.exception;
import javax.ws.rs.core.Response;
import lombok.Getter;
@@ -28,11 +28,11 @@ import org.onap.policy.models.errors.concepts.ErrorResponseInfo;
import org.onap.policy.models.errors.concepts.ErrorResponseUtils;
/**
- * This class is a base exception from which all control loop exceptions are sub classes.
+ * This class is a base exception from which all automation composition exceptions are sub classes.
*/
@Getter
@ToString
-public class ControlLoopException extends Exception implements ErrorResponseInfo {
+public class AutomationCompositionException extends Exception implements ErrorResponseInfo {
private static final long serialVersionUID = -8507246953751956974L;
// The error response of the exception
@@ -42,23 +42,23 @@ public class ControlLoopException extends Exception implements ErrorResponseInfo
private final transient Object object;
/**
- * Instantiates a new control loop exception.
+ * Instantiates a new automation composition exception.
*
* @param statusCode the status code for the response as a HTTP status code
* @param message the message on the exception
*/
- public ControlLoopException(final Response.Status statusCode, final String message) {
+ public AutomationCompositionException(final Response.Status statusCode, final String message) {
this(statusCode, message, null);
}
/**
- * Instantiates a new control loop exception.
+ * Instantiates a new automation composition exception.
*
* @param statusCode the return code for the exception
* @param message the message on the exception
* @param object the object that the exception was thrown on
*/
- public ControlLoopException(final Response.Status statusCode, final String message, final Object object) {
+ public AutomationCompositionException(final Response.Status statusCode, final String message, final Object object) {
super(message);
errorResponse.setResponseCode(statusCode);
ErrorResponseUtils.getExceptionMessages(errorResponse, this);
@@ -66,13 +66,14 @@ public class ControlLoopException extends Exception implements ErrorResponseInfo
}
/**
- * Instantiates a new control loop exception.
+ * Instantiates a new automation composition exception.
*
* @param statusCode the return code for the exception
* @param message the message on the exception
* @param exception the exception that caused this exception
*/
- public ControlLoopException(final Response.Status statusCode, final String message, final Exception exception) {
+ public AutomationCompositionException(final Response.Status statusCode, final String message,
+ final Exception exception) {
this(statusCode, message, exception, null);
}
@@ -84,8 +85,8 @@ public class ControlLoopException extends Exception implements ErrorResponseInfo
* @param exception the exception that caused this exception
* @param object the object that the exception was thrown on
*/
- public ControlLoopException(final Response.Status statusCode, final String message, final Exception exception,
- final Object object) {
+ public AutomationCompositionException(final Response.Status statusCode, final String message,
+ final Exception exception, final Object object) {
super(message, exception);
errorResponse.setResponseCode(statusCode);
ErrorResponseUtils.getExceptionMessages(errorResponse, this);
diff --git a/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopRuntimeException.java b/common/src/main/java/org/onap/policy/clamp/common/acm/exception/AutomationCompositionRuntimeException.java
index b110a4362..2fc427db8 100644
--- a/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopRuntimeException.java
+++ b/common/src/main/java/org/onap/policy/clamp/common/acm/exception/AutomationCompositionRuntimeException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.exception;
+package org.onap.policy.clamp.common.acm.exception;
import javax.ws.rs.core.Response;
import lombok.Getter;
@@ -28,11 +28,12 @@ import org.onap.policy.models.errors.concepts.ErrorResponseInfo;
import org.onap.policy.models.errors.concepts.ErrorResponseUtils;
/**
- * This class is a base control loop run time exception from which all control loop run time exceptions are sub classes.
+ * This class is a base automation composition run time exception from which all automation composition run time
+ * exceptions are sub classes.
*/
@Getter
@ToString
-public class ControlLoopRuntimeException extends RuntimeException implements ErrorResponseInfo {
+public class AutomationCompositionRuntimeException extends RuntimeException implements ErrorResponseInfo {
private static final long serialVersionUID = -8507246953751956974L;
// The error response of the exception
@@ -42,23 +43,24 @@ public class ControlLoopRuntimeException extends RuntimeException implements Err
private final transient Object object;
/**
- * Instantiates a new control loop runtime exception.
+ * Instantiates a new automation composition runtime exception.
*
* @param statusCode the return code for the exception
* @param message the message on the exception
*/
- public ControlLoopRuntimeException(final Response.Status statusCode, final String message) {
+ public AutomationCompositionRuntimeException(final Response.Status statusCode, final String message) {
this(statusCode, message, null);
}
/**
- * Instantiates a new control loop runtime exception.
+ * Instantiates a new automation composition runtime exception.
*
* @param statusCode the return code for the exception
* @param message the message on the exception
* @param object the object that the exception was thrown on
*/
- public ControlLoopRuntimeException(final Response.Status statusCode, final String message, final Object object) {
+ public AutomationCompositionRuntimeException(final Response.Status statusCode, final String message,
+ final Object object) {
super(message);
this.object = object;
errorResponse.setResponseCode(statusCode);
@@ -66,23 +68,23 @@ public class ControlLoopRuntimeException extends RuntimeException implements Err
}
/**
- * Instantiates a new control loop runtime exception.
+ * Instantiates a new automation composition runtime exception.
*
* @param statusCode the return code for the exception
* @param message the message on the exception
- * @param exception the exception that caused this control loop exception
+ * @param exception the exception that caused this automation composition exception
*/
- public ControlLoopRuntimeException(final Response.Status statusCode, final String message,
- final Exception exception) {
+ public AutomationCompositionRuntimeException(final Response.Status statusCode, final String message,
+ final Exception exception) {
this(statusCode, message, exception, null);
}
/**
- * Instantiates a new model runtime exception from a ControlLoopException instance.
+ * Instantiates a new model runtime exception from an AutomationCompositionException instance.
*
- * @param exception the exception that caused this control loop exception
+ * @param exception the exception that caused this automation composition exception
*/
- public ControlLoopRuntimeException(final ControlLoopException exception) {
+ public AutomationCompositionRuntimeException(final AutomationCompositionException exception) {
super(exception.getMessage(), exception);
this.object = exception.getObject();
errorResponse.setResponseCode(exception.getErrorResponse().getResponseCode());
@@ -90,15 +92,15 @@ public class ControlLoopRuntimeException extends RuntimeException implements Err
}
/**
- * Instantiates a new control loop runtime exception.
+ * Instantiates a new automation composition runtime exception.
*
* @param statusCode the return code for the exception
* @param message the message on the exception
- * @param exception the exception that caused this control loop exception
+ * @param exception the exception that caused this automation composition exception
* @param object the object that the exception was thrown on
*/
- public ControlLoopRuntimeException(final Response.Status statusCode, final String message,
- final Exception exception, final Object object) {
+ public AutomationCompositionRuntimeException(final Response.Status statusCode, final String message,
+ final Exception exception, final Object object) {
super(message, exception);
this.object = object;
errorResponse.setResponseCode(statusCode);
diff --git a/common/src/main/java/org/onap/policy/clamp/controlloop/common/rest/CoderHttpMesageConverter.java b/common/src/main/java/org/onap/policy/clamp/common/acm/rest/CoderHttpMesageConverter.java
index 9eb43fd6f..f445364ad 100644
--- a/common/src/main/java/org/onap/policy/clamp/controlloop/common/rest/CoderHttpMesageConverter.java
+++ b/common/src/main/java/org/onap/policy/clamp/common/acm/rest/CoderHttpMesageConverter.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.rest;
+package org.onap.policy.clamp.common.acm.rest;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import javax.ws.rs.core.Response;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -57,7 +57,7 @@ public class CoderHttpMesageConverter<T> extends AbstractHttpMessageConverter<T>
try (var is = new InputStreamReader(inputMessage.getBody(), StandardCharsets.UTF_8)) {
return coder.decode(is, clazz);
} catch (CoderException e) {
- throw new ControlLoopRuntimeException(Response.Status.BAD_REQUEST, e.getMessage(), e);
+ throw new AutomationCompositionRuntimeException(Response.Status.BAD_REQUEST, e.getMessage(), e);
}
}
@@ -67,7 +67,7 @@ public class CoderHttpMesageConverter<T> extends AbstractHttpMessageConverter<T>
try (var writer = new OutputStreamWriter(outputMessage.getBody(), StandardCharsets.UTF_8)) {
coder.encode(writer, t);
} catch (CoderException e) {
- throw new ControlLoopRuntimeException(Response.Status.BAD_REQUEST, e.getMessage(), e);
+ throw new AutomationCompositionRuntimeException(Response.Status.BAD_REQUEST, e.getMessage(), e);
}
}
diff --git a/common/src/main/java/org/onap/policy/clamp/controlloop/common/rest/RequestResponseLoggingFilter.java b/common/src/main/java/org/onap/policy/clamp/common/acm/rest/RequestResponseLoggingFilter.java
index 915cdf0b2..4b6dce46d 100644
--- a/common/src/main/java/org/onap/policy/clamp/controlloop/common/rest/RequestResponseLoggingFilter.java
+++ b/common/src/main/java/org/onap/policy/clamp/common/acm/rest/RequestResponseLoggingFilter.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.rest;
+package org.onap.policy.clamp.common.acm.rest;
import java.io.IOException;
import java.util.UUID;
diff --git a/common/src/main/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArguments.java b/common/src/main/java/org/onap/policy/clamp/common/acm/startstop/CommonCommandLineArguments.java
index 525da259f..6f6fb6a4b 100644
--- a/common/src/main/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArguments.java
+++ b/common/src/main/java/org/onap/policy/clamp/common/acm/startstop/CommonCommandLineArguments.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.startstop;
+package org.onap.policy.clamp.common.acm.startstop;
import java.io.File;
import java.io.PrintWriter;
@@ -28,7 +28,7 @@ import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.lang3.StringUtils;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
import org.onap.policy.common.utils.resources.ResourceUtils;
/**
@@ -75,9 +75,9 @@ public class CommonCommandLineArguments {
* Validate the command line options.
*
* @param configurationFilePath the path to the configuration file
- * @throws ControlLoopException on command argument validation errors
+ * @throws AutomationCompositionException on command argument validation errors
*/
- public void validate(final String configurationFilePath) throws ControlLoopException {
+ public void validate(final String configurationFilePath) throws AutomationCompositionException {
validateReadableFile("policy participant configuration", configurationFilePath);
}
@@ -103,7 +103,7 @@ public class CommonCommandLineArguments {
final var printWriter = new PrintWriter(stringWriter);
helpFormatter.printHelp(printWriter, HELP_LINE_LENGTH, mainClassName + " [options...]", "options", options, 0,
- 0, "");
+ 0, "");
return stringWriter.toString();
}
@@ -113,33 +113,34 @@ public class CommonCommandLineArguments {
*
* @param fileTag the file tag
* @param fileName the file name
- * @throws ControlLoopException on the file name passed as a parameter
+ * @throws AutomationCompositionException on the file name passed as a parameter
*/
- private void validateReadableFile(final String fileTag, final String fileName) throws ControlLoopException {
+ private void validateReadableFile(final String fileTag, final String fileName)
+ throws AutomationCompositionException {
if (StringUtils.isEmpty(fileName)) {
- throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
- fileTag + " file was not specified as an argument");
+ throw new AutomationCompositionException(Response.Status.NOT_ACCEPTABLE,
+ fileTag + " file was not specified as an argument");
}
// The file name refers to a resource on the local file system
final var fileUrl = ResourceUtils.getUrl4Resource(fileName);
if (fileUrl == null) {
- throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
- fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist");
+ throw new AutomationCompositionException(Response.Status.NOT_ACCEPTABLE,
+ fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist");
}
final var theFile = new File(fileUrl.getPath());
if (!theFile.exists()) {
- throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
- fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist");
+ throw new AutomationCompositionException(Response.Status.NOT_ACCEPTABLE,
+ fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist");
}
if (!theFile.isFile()) {
- throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
- fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is not a normal file");
+ throw new AutomationCompositionException(Response.Status.NOT_ACCEPTABLE,
+ fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is not a normal file");
}
if (!theFile.canRead()) {
- throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
- fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is unreadable");
+ throw new AutomationCompositionException(Response.Status.NOT_ACCEPTABLE,
+ fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is unreadable");
}
}
}
diff --git a/common/src/main/resources/tosca/ApplicationServiceDescriptorTypes.yaml b/common/src/main/resources/tosca/ApplicationServiceDescriptorTypes.yaml
deleted file mode 100644
index ad16173b9..000000000
--- a/common/src/main/resources/tosca/ApplicationServiceDescriptorTypes.yaml
+++ /dev/null
@@ -1,74 +0,0 @@
-# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-tosca_definitions_version: tosca_simple_yaml_1_3
-node_types:
- org.oran.asd.DeploymentItem:
- version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.KubernetesControlLoopElement
- properties:
- deployemntItemId:
- type: onap.datatypes.ToscaConceptIdentifier
- required: true
- description: The identifier of this deployment item
- artifactId:
- type: onap.datatypes.ToscaConceptIdentifier
- required: true
- description: Reference to a DeploymentArtifact
- lifecycleParameters:
- type: string
- required: false
- description: List of parameters that can be overridden at deployment time
- (e.g. values for values.yaml in the chart this item references)
- org.oran.asd.ASD:
- version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoop
- properties:
- asdId:
- type: onap.datatypes.ToscaConceptIdentifier
- required: true
- description: The identifier of this deployment item
- asdSchemaVersion:
- type: onap.datatypes.ToscaConceptIdentifier
- required: true
- description: Reference to a DeploymentArtifact
- asdApplication:
- type: onap.datatypes.ToscaConceptIdentifier
- required: true
- description: Reference to a DeploymentArtifact
- asdApplicationInfoName:
- type: string
- required: false
- description: Human readable name for the Application service. Can change during the AS lifetime.
- asdExtCpd:
- type: string
- required: false
- description: Describes external interface(s) exposed by this AS enabling connection with a VL.
- (Similar to VnfExtCpd on VNF-D, but only describing L3 and above interfaces, since
- K8S can’t do <L3)
- enhancedClusterCapabilities:
- type: string
- required: false
- description: Describes expected capabilities of the target Kubernetes cluster to aid placement of the
- application service on a suitable cluster. Examples of capabilities are; required networking
- characteristics, Kubernetes API extensions or quantifiable node specific resources. This attribute
- can contain information complementing information provided in the referenced DeploymentArtifacts.
- Note; Modeling of enhancedClusterCapabilities is subject to standardization but is ffs. Alignment
- between O2-IMS and O2-DMS of these values is required.
-
-
-
diff --git a/common/src/main/resources/tosca/ControlLoopTOSCAServiceTemplateTypes.yaml b/common/src/main/resources/tosca/AutomationCompositionTOSCAServiceTemplateTypes.yaml
index a17cb7624..12f8cf7da 100644
--- a/common/src/main/resources/tosca/ControlLoopTOSCAServiceTemplateTypes.yaml
+++ b/common/src/main/resources/tosca/AutomationCompositionTOSCAServiceTemplateTypes.yaml
@@ -1,5 +1,5 @@
# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
+# Copyright (C) 2021-2022 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ data_types:
type: string
required: true
node_types:
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -36,13 +36,13 @@ node_types:
required: false
metadata:
common: true
- description: Specifies the organization that provides the control loop element
+ description: Specifies the organization that provides the automation composition element
participantType:
type: onap.datatypes.ToscaConceptIdentifier
required: true
metadata:
common: true
- description: The identity of the participant type that hosts this type of Control Loop Element
+ description: The identity of the participant type that hosts this type of automation composition Element
startPhase:
type: integer
required: false
@@ -50,10 +50,10 @@ node_types:
- 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
+ description: A value indicating the start phase in which this automation composition element will be started,
+ the first start phase is zero. automation composition Elements are started in their start_phase
+ order and stopped in reverse start phase order. automation composition Elements with the same start
+ phase are started and stopped simultaneously
uninitializedToPassiveTimeout:
type: integer
required: false
@@ -98,8 +98,8 @@ node_types:
default: 0
metadata:
common: true
- description: The number of milliseconds that the start of this control loop element should be delayed
- org.onap.policy.clamp.controlloop.ControlLoop:
+ description: The number of milliseconds that the start of this automation composition element should be delayed
+ org.onap.policy.clamp.acm.AutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -108,7 +108,7 @@ node_types:
required: false
metadata:
common: true
- description: Specifies the organization that provides the control loop element
+ description: Specifies the organization that provides the automation composition element
elements:
type: list
required: true
@@ -116,5 +116,5 @@ node_types:
common: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- description: Specifies a list of control loop element definitions that make up this control loop definition
+ description: Specifies a list of automation composition element definitions that make up this automation composition definition
diff --git a/common/src/main/resources/tosca/CdsControlLoopElementType.yaml b/common/src/main/resources/tosca/CdsAutomationCompositionElementType.yaml
index c2fc66a6a..de195ac84 100644
--- a/common/src/main/resources/tosca/CdsControlLoopElementType.yaml
+++ b/common/src/main/resources/tosca/CdsAutomationCompositionElementType.yaml
@@ -1,5 +1,5 @@
# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
+# Copyright (C) 2021-2022 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,11 +17,11 @@
# ============LICENSE_END=========================================================
tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
- org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ org.onap.policy.clamp.acm.CDSAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
cdsBlueprint:
type: string
required: true
- description: The CDS blueprint that this control loop element is managing.
+ description: The CDS blueprint that this automation composition element is managing.
diff --git a/common/src/main/resources/tosca/DcaeControlLoopElementType.yaml b/common/src/main/resources/tosca/DcaeControlLoopElementType.yaml
deleted file mode 100644
index acf91bb92..000000000
--- a/common/src/main/resources/tosca/DcaeControlLoopElementType.yaml
+++ /dev/null
@@ -1,51 +0,0 @@
-# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-tosca_definitions_version: tosca_simple_yaml_1_3
-
-data_types:
- org.onap.datatypes.policy.clamp.controlloop.DCAEControlLoopElementConsulInfo:
- version: 1.0.0
- derived_from: tosca.datatypes.Root
- properties:
- consulUrl:
- name: consulUrl
- type: string
- typeVersion: 0.0.0
- required: true
- description: Consul url for this entry
- consulBody:
- name: consulBody
- type: string
- typeVersion: 0.0.0
- required: true
- description: Body of Consul entry
-node_types:
- org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:
- version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
- properties:
- dcaeBlueprint:
- type: string
- required: true
- description: The DCAE blueprint for the DCAE microservice this control loop element is managing.
- consulInfo:
- type: list
- required: false
- entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.DCAEControlLoopElementConsulInfo
- description: The information to be sent to Consul for the microservice this control loop element is managing.
diff --git a/common/src/main/resources/tosca/HttpControlLoopElementType.yaml b/common/src/main/resources/tosca/HttpAutomationCompositionElementType.yaml
index fd37040c6..f1ea39d61 100644
--- a/common/src/main/resources/tosca/HttpControlLoopElementType.yaml
+++ b/common/src/main/resources/tosca/HttpAutomationCompositionElementType.yaml
@@ -1,5 +1,5 @@
# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
+# Copyright (C) 2021-2022 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
# ============LICENSE_END=========================================================
tosca_definitions_version: tosca_simple_yaml_1_3
data_types:
- org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest:
+ org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest:
version: 1.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -46,7 +46,7 @@ data_types:
constraints:
- in_range: [100, 599]
description: THe expected HTTP status code for the REST request
- org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.ConfigurationEntity:
+ org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity:
version: 1.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -54,17 +54,18 @@ data_types:
type: onap.datatypes.ToscaConceptIdentifier
typeVersion: 1.0.0
required: true
- description: The name and version of a Configuration Entity to be handled by the HTTP Control Loop Element
+ description: The name and version of a Configuration Entity to be handled by the HTTP Automation Composition
+ Element
restSequence:
type: list
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest
+ type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest
typeVersion: 1.0.0
description: A sequence of REST commands to send to the REST endpoint
node_types:
- org.onap.policy.clamp.controlloop.HttpControlLoopElement:
+ org.onap.policy.clamp.acm.HttpAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
baseUrl:
type: string
@@ -80,6 +81,7 @@ node_types:
type: map
required: true
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.ConfigurationEntity
+ type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity
typeVersion: 1.0.0
- description: The connfiguration entities the Control Loop Element is managing and their associated REST requests
+ description: The connfiguration entities the Automation Composition Element is managing and their associated
+ REST requests
diff --git a/common/src/main/resources/tosca/KubernetesControlLoopElementType.yaml b/common/src/main/resources/tosca/KubernetesAutomationCompositionElementType.yaml
index 86a8ce197..2b60b679e 100644
--- a/common/src/main/resources/tosca/KubernetesControlLoopElementType.yaml
+++ b/common/src/main/resources/tosca/KubernetesAutomationCompositionElementType.yaml
@@ -1,5 +1,5 @@
# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
+# Copyright (C) 2021-2022 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
# ============LICENSE_END=========================================================
tosca_definitions_version: tosca_simple_yaml_1_3
data_types:
- org.onap.datatypes.policy.clamp.controlloop.kubernetesControlLoopElement.Chart:
+ org.onap.datatypes.policy.clamp.acm.kubernetesAutomationCompositionElement.Chart:
version: 1.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -45,12 +45,12 @@ data_types:
type: string
description: A map of override settings for parameters in the chart
node_types:
- org.onap.policy.clamp.controlloop.KubernetesControlLoopElement:
+ org.onap.policy.clamp.acm.KubernetesAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
chart:
- type: org.onap.datatypes.policy.clamp.controlloop.kubernetesControlLoopElement.Chart
+ type: org.onap.datatypes.policy.clamp.acm.kubernetesAutomationCompositionElement.Chart
typeVersion: 1.0.0
required: true
description: The helm chart for the microservice
diff --git a/common/src/main/resources/tosca/PolicyControlLoopElementType.yaml b/common/src/main/resources/tosca/PolicyAutomationCompositionElementType.yaml
index b4631ba14..3968b3471 100644
--- a/common/src/main/resources/tosca/PolicyControlLoopElementType.yaml
+++ b/common/src/main/resources/tosca/PolicyAutomationCompositionElementType.yaml
@@ -1,5 +1,5 @@
# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
+# Copyright (C) 2021-2022 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,20 +17,20 @@
# ============LICENSE_END=========================================================
tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
- org.onap.policy.clamp.controlloop.PolicyControlLoopElement:
+ org.onap.policy.clamp.acm.PolicyAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
policyType:
type: onap.datatypes.ToscaConceptIdentifier
required: true
- description: The policy type of the policy that this control loop element is managing
+ description: The policy type of the policy that this automation composition element is managing
policyId:
type: onap.datatypes.ToscaConceptIdentifier
required: false
- description: The policy that this control loop element is managing, if the policy ID is specified, the policy
- is either already in the Policy Framework database or is specified in the "policies" part of the
- TOSCA service template of the Control Loop definition
+ description: The policy that this automation composition element is managing, if the policy ID is specified, the
+ policy is either already in the Policy Framework database or is specified in the "policies" part of
+ the TOSCA service template of the Automation Composition definition
pdpGroup:
type: string
required: false
@@ -40,4 +40,5 @@ node_types:
pdpType:
type: string
required: true
- description: The PDP type to which the policy will run on. This parameter is used when the policy is deployed to PAP. \ No newline at end of file
+ description: The PDP type to which the policy will run on. This parameter is used when the policy is deployed to
+ PAP. \ No newline at end of file
diff --git a/common/src/test/java/org/onap/policy/clamp/controlloop/common/exception/ExceptionsTest.java b/common/src/test/java/org/onap/policy/clamp/common/acm/exception/ExceptionsTest.java
index 6d39337f7..ef0472cdc 100644
--- a/common/src/test/java/org/onap/policy/clamp/controlloop/common/exception/ExceptionsTest.java
+++ b/common/src/test/java/org/onap/policy/clamp/common/acm/exception/ExceptionsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.exception;
+package org.onap.policy.clamp.common.acm.exception;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
@@ -37,45 +37,46 @@ class ExceptionsTest {
@Test
void testExceptions() {
- assertNotNull(new ControlLoopException(Response.Status.OK, MESSAGE));
- assertNotNull(new ControlLoopException(Response.Status.OK, MESSAGE, STRING_TEXT));
- assertNotNull(new ControlLoopException(Response.Status.OK, MESSAGE, new IOException()));
- assertNotNull(new ControlLoopException(Response.Status.OK, MESSAGE, new IOException(), STRING_TEXT));
+ assertNotNull(new AutomationCompositionException(Response.Status.OK, MESSAGE));
+ assertNotNull(new AutomationCompositionException(Response.Status.OK, MESSAGE, STRING_TEXT));
+ assertNotNull(new AutomationCompositionException(Response.Status.OK, MESSAGE, new IOException()));
+ assertNotNull(new AutomationCompositionException(Response.Status.OK, MESSAGE, new IOException(), STRING_TEXT));
String key = "A String";
- ControlLoopException ae =
- new ControlLoopException(Response.Status.OK, MESSAGE, new IOException("IO exception message"), key);
+ AutomationCompositionException ae = new AutomationCompositionException(Response.Status.OK, MESSAGE,
+ new IOException("IO exception message"), key);
ErrorResponse errorResponse = ae.getErrorResponse();
assertEquals("Message\nIO exception message", String.join("\n", errorResponse.getErrorDetails()));
assertEquals(key, ae.getObject());
- assertNotNull(new ControlLoopRuntimeException(Response.Status.OK, MESSAGE));
- assertNotNull(new ControlLoopRuntimeException(Response.Status.OK, MESSAGE, STRING_TEXT));
- assertNotNull(new ControlLoopRuntimeException(Response.Status.OK, MESSAGE, new IOException()));
- assertNotNull(new ControlLoopRuntimeException(Response.Status.OK, MESSAGE, new IOException(), STRING_TEXT));
+ assertNotNull(new AutomationCompositionRuntimeException(Response.Status.OK, MESSAGE));
+ assertNotNull(new AutomationCompositionRuntimeException(Response.Status.OK, MESSAGE, STRING_TEXT));
+ assertNotNull(new AutomationCompositionRuntimeException(Response.Status.OK, MESSAGE, new IOException()));
+ assertNotNull(
+ new AutomationCompositionRuntimeException(Response.Status.OK, MESSAGE, new IOException(), STRING_TEXT));
String rkey = "A String";
- ControlLoopRuntimeException re = new ControlLoopRuntimeException(Response.Status.OK, "Runtime Message",
- new IOException("IO runtime exception message"), rkey);
+ AutomationCompositionRuntimeException re = new AutomationCompositionRuntimeException(Response.Status.OK,
+ "Runtime Message", new IOException("IO runtime exception message"), rkey);
errorResponse = re.getErrorResponse();
assertEquals("Runtime Message\nIO runtime exception message",
- String.join("\n", errorResponse.getErrorDetails()));
+ String.join("\n", errorResponse.getErrorDetails()));
assertEquals(key, re.getObject());
- ControlLoopRuntimeException clre = new ControlLoopRuntimeException(ae);
- assertEquals(ae.getErrorResponse().getResponseCode(), clre.getErrorResponse().getResponseCode());
- assertEquals(ae.getMessage(), clre.getMessage());
+ AutomationCompositionRuntimeException acre = new AutomationCompositionRuntimeException(ae);
+ assertEquals(ae.getErrorResponse().getResponseCode(), acre.getErrorResponse().getResponseCode());
+ assertEquals(ae.getMessage(), acre.getMessage());
try {
try {
- throw new ControlLoopException(Status.BAD_GATEWAY, "An Exception");
- } catch (ControlLoopException cle) {
- throw new ControlLoopRuntimeException(cle);
+ throw new AutomationCompositionException(Status.BAD_GATEWAY, "An Exception");
+ } catch (AutomationCompositionException ace) {
+ throw new AutomationCompositionRuntimeException(ace);
}
- } catch (ControlLoopRuntimeException clred) {
- assertEquals(Status.BAD_GATEWAY, clred.getErrorResponse().getResponseCode());
- assertEquals("An Exception", clred.getMessage());
- assertEquals(ControlLoopException.class.getName(), clred.getCause().getClass().getName());
+ } catch (AutomationCompositionRuntimeException acred) {
+ assertEquals(Status.BAD_GATEWAY, acred.getErrorResponse().getResponseCode());
+ assertEquals("An Exception", acred.getMessage());
+ assertEquals(AutomationCompositionException.class.getName(), acred.getCause().getClass().getName());
}
assertThat(ae.toString()).contains("A String");
diff --git a/common/src/test/java/org/onap/policy/clamp/controlloop/common/rest/CoderHttpMessageConverterTest.java b/common/src/test/java/org/onap/policy/clamp/common/acm/rest/CoderHttpMessageConverterTest.java
index 58015ae3d..5c5bf3fbb 100644
--- a/common/src/test/java/org/onap/policy/clamp/controlloop/common/rest/CoderHttpMessageConverterTest.java
+++ b/common/src/test/java/org/onap/policy/clamp/common/acm/rest/CoderHttpMessageConverterTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.rest;
+package org.onap.policy.clamp.common.acm.rest;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -28,8 +28,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
-import org.onap.policy.clamp.controlloop.common.startstop.CommonCommandLineArguments;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.common.acm.startstop.CommonCommandLineArguments;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
@@ -37,7 +37,7 @@ class CoderHttpMessageConverterTest {
@Test
- void coderHttpMesageConverterTest() throws ControlLoopRuntimeException, IOException {
+ void coderHttpMesageConverterTest() throws AutomationCompositionRuntimeException, IOException {
var y = new CoderHttpMesageConverter<>("yaml");
var j = new CoderHttpMesageConverter<>("json");
@@ -46,14 +46,14 @@ class CoderHttpMessageConverterTest {
var testInputStream = new ByteArrayInputStream("testdata".getBytes());
HttpInputMessage input = Mockito.mock(HttpInputMessage.class);
Mockito.when(input.getBody()).thenReturn(testInputStream);
- assertThrows(ControlLoopRuntimeException.class, () -> {
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
y.readInternal(RequestResponseLoggingFilterTest.class, input);
});
var testOutputStream = new ByteArrayOutputStream();
HttpOutputMessage output = Mockito.mock(HttpOutputMessage.class);
Mockito.when(output.getBody()).thenReturn(testOutputStream);
- assertThrows(ControlLoopRuntimeException.class, () -> {
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
j.writeInternal(String.class, output);
});
}
diff --git a/common/src/test/java/org/onap/policy/clamp/controlloop/common/rest/RequestResponseLoggingFilterTest.java b/common/src/test/java/org/onap/policy/clamp/common/acm/rest/RequestResponseLoggingFilterTest.java
index 7621c9219..ff6e1cd34 100644
--- a/common/src/test/java/org/onap/policy/clamp/controlloop/common/rest/RequestResponseLoggingFilterTest.java
+++ b/common/src/test/java/org/onap/policy/clamp/common/acm/rest/RequestResponseLoggingFilterTest.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.rest;
+package org.onap.policy.clamp.common.acm.rest;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
diff --git a/common/src/test/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArgumentsTest.java b/common/src/test/java/org/onap/policy/clamp/common/acm/startstop/CommonCommandLineArgumentsTest.java
index 8eff21248..93b500df0 100644
--- a/common/src/test/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArgumentsTest.java
+++ b/common/src/test/java/org/onap/policy/clamp/common/acm/startstop/CommonCommandLineArgumentsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.startstop;
+package org.onap.policy.clamp.common.acm.startstop;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
diff --git a/common/src/test/resources/asd/MyDomainASDDefintion.yaml b/common/src/test/resources/asd/MyDomainASDDefintion.yaml
deleted file mode 100644
index f354ea075..000000000
--- a/common/src/test/resources/asd/MyDomainASDDefintion.yaml
+++ /dev/null
@@ -1,131 +0,0 @@
-# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-tosca_definitions_version: tosca_simple_yaml_1_3
-topology_template:
- node_templates:
- org.oran.asd.MyApplicationServiceDeploymentItem0:
- version: 1.0.0
- type: org.oran.asd.DeploymentItem
- type_version: 1.0.1
- description: The first Deployment Item in our Application Service
- properties:
- deployemntItemId: org.oran.asd.MyApplicationServiceDeploymentItem0:1.0.0
- artifactId: org.oran.asd.MyApplicationServiceDeploymentArtifact0:1.0.0
- lifecycleParameters: To be defined
- provider: Ericsson
- participantType: org.onap.policy.controlloop.participant.Kubernetes:1.0.0
- startPhase: 2
- uninitializedToPassiveTimeout: 180
- chart:
- chartId: MyApplicationServiceDeploymentItem0Chart:1.0.0
- releaseName: SomeRelease
- namespace: org.oran.asd.MyApplicationService
- org.oran.asd.MyApplicationServiceDeploymentItem1:
- version: 1.0.0
- type: org.oran.asd.DeploymentItem
- type_version: 1.0.1
- description: The second Deployment Item in our Application Service
- properties:
- deployemntItemId: org.oran.asd.MyApplicationServiceDeploymentItem1:1.0.0
- artifactId: org.oran.asd.MyApplicationServiceDeploymentArtifact1:1.0.0
- lifecycleParameters: To be defined
- provider: Ericsson
- participantType: org.onap.policy.controlloop.participant.Kubernetes:1.0.0
- startPhase: 4
- uninitializedToPassiveTimeout: 10
- chart:
- chartId: MyApplicationServiceDeploymentItem1Chart:1.0.0
- releaseName: SomeRelease
- namespace: org.oran.asd.MyApplicationService
- org.oran.asd.MyApplicationRestConfig:
- version: 1.0.0
- type: org.onap.policy.clamp.controlloop.HttpControlLoopElement
- type_version: 1.0.1
- description: The REST configuration for My Application
- properties:
- provider: Ericsson
- participantType: org.onap.policy.controlloop.participant.Http:1.0.0
- startPhase: 1
- baseUrl: https://10.10.10.10:12345/MyApplicationServiceDeploymentItem0RestEndpoint
- httpHeaders:
- "Content-Type": "application/json"
- "Accept": "application/json"
- configurationEntities:
- org.onap.policy.controlloop.gentleguidance.setDomainConfig:1.0.0:
- configurationEntityId: org.onap.policy.controlloop.gentleguidance.setDomainConfig:1.0.0
- restSequence:
- - restRequestId: org.oran.asd.myapplication.setDomainConfig.CreateConfig:1.0.0
- httpMethd: POST
- path: "gentle/create"
- body:
- gentleLevel: veryGentle
- gentleType: softAndFurry
- expectedResponse: 200
- - restRequestId: org.oran.asd.myapplication.setDomainConfig.CreateConfig:1.0.0
- httpMethd: POST
- path: "guidance/create"
- body:
- guidanceLevel: high
- guidanceType: subtle
- expectedResponse: 200
- org.oran.asd.myapplication.updateDomainConfig:1.0.0:
- configurationEntityId: org.oran.asd.myapplication.updateDomainConfig:1.0.0
- restSequence:
- - restRequestId: org.oran.asd.myapplication.updateDomainConfig.UpdateConfig:1.0.0
- httpMethd: PUT
- path: "gentle/update]"
- body:
- gentleLevel: robust
- gentleType: hardAndGritty
- expectedResponse: 200
- - restRequestId: org.oran.asd.myapplication.updateDomainConfig.UpdateConfig:1.0.0
- httpMethd: PUT
- path: "guidance/update"
- body:
- guidanceLevel: low
- guidanceType: terse
- expectedResponse: 200
- org.oran.asd.MyApplicationPolicy:
- version: 1.0.0
- type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
- type_version: 1.0.1
- description: My Application Operational Policy
- properties:
- provider: Ericsson
- participantType: org.onap.policy.controlloop.participant.Policy:1.0.0
- startPhase: 0
- policyType: onap.policies.controlloop.operational.common.Apex:1.0.0
- policyId: org.oran.asd.myapplication.ServiceControlPolicy:1.0.0
- org.org.oran.asd.MyApplicationService:
- version: 1.0.0
- type: org.oran.asd.ASD
- type_version: 1.0.1
- description: ASD Definition of the My Application Service
- properties:
- asdId: org.org.oran.asd.MyApplicationService:1.0.0
- asdSchemaVersion: 2.3.2
- provider: Ericsson
- asdApplication: org.oran.asd.MyWonderfulApplicationService:1.2.1
- asdApplicationInfoName: The wonderful ASD service that does everything imaginable
- asdExtCpd: To be defined
- enhancedCludterCapabilities: To be defined
- elements:
- - org.oran.asd.MyApplicationServiceDeploymentItem0:1.0.0
- - org.oran.asd.MyApplicationServiceDeploymentItem1:1.0.0
- - org.oran.asd.MyApplicationRestConfig:1.0.0
- - org.oran.asd.MyApplicationPolicy:1.0.0
diff --git a/common/src/test/resources/demo/Notes.txt b/common/src/test/resources/demo/Notes.txt
index f937e0969..5cd981d04 100644
--- a/common/src/test/resources/demo/Notes.txt
+++ b/common/src/test/resources/demo/Notes.txt
@@ -10,7 +10,7 @@ Go to policy/models/models-sim/policy-models-simulators
mvn exec:java -Dexec.mainClass=org.onap.policy.models.simulators.Main -Dexec.args="src/test/resources/simParameters.json"
Run CL from command line
-Go to clamp/runtime-controlloop
+Go to clamp/runtime-acm
mvn spring-boot:run -Dspring-boot.run.arguments="--topicServer=localhost --mariadb.host=localhost"
Run Participant from command line using Maven
@@ -26,15 +26,15 @@ java -jar target/policy-clamp-participant-impl-kubernetes-6.1.2-SNAPSHOT.jar
Config of DB
Prompt > mysql
-MariaDB [(none)]> create database controlloop;
+MariaDB [(none)]> create database acm;
MariaDB [(none)]> CREATE USER 'policy'@localhost IDENTIFIED BY 'P01icY';
-MariaDB [(none)]> GRANT ALL PRIVILEGES ON controlloop.* TO 'policy'@'localhost';\
+MariaDB [(none)]> GRANT ALL PRIVILEGES ON acm.* TO 'policy'@'localhost';\
MariaDB [(none)]> SHOW GRANTS for 'policy'@localhost;
+---------------------------------------------------------------------------------------------------------------+
| Grants for policy@localhost |
+---------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `policy`@`localhost` IDENTIFIED BY PASSWORD '*D0574A541C5DEDF11838FB41CA04E256FD5A04CC' |
-| GRANT ALL PRIVILEGES ON `controlloop`.* TO `policy`@`localhost` |
+| GRANT ALL PRIVILEGES ON `acm`.* TO `policy`@`localhost` |
+---------------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)
@@ -46,16 +46,16 @@ cd docker/csit
//the keystore generated: /docker/csit/config/ks.jks
Run Participant from command line using Docker
-docker run --add-host=message-router:<ip-router> -p 6969:6969 --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-cl-runtime
-docker run --add-host=message-router:<ip-router> -p 8083:8083 --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-cl-k8s-ppnt
-docker run --add-host=message-router:<ip-router> --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-cl-http-ppnt
-docker run --add-host=message-router:<ip-router> --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-cl-pf-ppnt
+docker run --add-host=message-router:<ip-router> -p 6969:6969 --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-runtime-acm
+docker run --add-host=message-router:<ip-router> -p 8083:8083 --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-ac-k8s-ppnt
+docker run --add-host=message-router:<ip-router> --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-ac-http-ppnt
+docker run --add-host=message-router:<ip-router> --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-ac-pf-ppnt
Note:
/policy-clamp-tarball/src/main/resources/etc/ssl/policy-truststore is the truststore for DMaap of oom project
Participant-k8 swagger: https://localhost:8083/onap/k8sparticipant/swagger-ui/
-CL-Runtime swagger: https://localhost:6969/onap/controlloop/swagger-ui/
+CL-Runtime swagger: https://localhost:6969/onap/acm/swagger-ui/
Run Policy API:
-mvn exec:java -Dexec.mainClass=org.onap.policy.api.main.startstop.Main -Dexec.args="-c ../../clamp-tpn/tosca-controlloop/common/src/test/resources/demo/policy-api/PolicyAPIConfig.json"
+mvn exec:java -Dexec.mainClass=org.onap.policy.api.main.startstop.Main -Dexec.args="-c common/src/test/resources/demo/config/RuntimeConfig.json"
diff --git a/common/src/test/resources/demo/config/DEMO.postman_collection.json b/common/src/test/resources/demo/config/DEMO.postman_collection.json
index 31c12bfc6..8e85422ff 100644
--- a/common/src/test/resources/demo/config/DEMO.postman_collection.json
+++ b/common/src/test/resources/demo/config/DEMO.postman_collection.json
@@ -6,7 +6,7 @@
},
"item": [
{
- "name": "Demo: Comission control loop definition Multiple Copy",
+ "name": "Demo: Comission automation composition definition Multiple Copy",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-type": true
@@ -43,7 +43,7 @@
],
"body": {
"mode": "raw",
- "raw": "tosca_definitions_version: tosca_simple_yaml_1_1_0\ndata_types:\n onap.datatypes.ToscaConceptIdentifier:\n derived_from: tosca.datatypes.Root\n properties:\n name:\n type: string\n required: true\n version:\n type: string\n required: true\n org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo:\n name: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n properties:\n consulUrl:\n name: consulUrl\n type: string\n typeVersion: 0.0.0\n description: Consul url for this entry\n required: true\n consul_body:\n name: consulBody\n type: string\n typeVersion: 0.0.0\n description: Body of Consul entry\n required: true\n onap.datatype.controlloop.Target:\n derived_from: tosca.datatypes.Root\n description: Definition for a entity in A&AI to perform a control loop operation on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - PNF\n entityIds:\n type: map\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n entry_schema:\n type: string\n onap.datatype.controlloop.Actor:\n derived_from: tosca.datatypes.Root\n description: An actor/operation/target definition\n properties:\n actor:\n type: string\n description: The actor performing the operation.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n type: string\n description: The operation the actor is performing.\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation\n required: true\n target:\n type: onap.datatype.controlloop.Target\n description: The resource the operation should be performed on.\n required: true\n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy to the actor\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n entry_schema:\n type: string\n onap.datatype.controlloop.Operation:\n derived_from: tosca.datatypes.Root\n description: An operation supported by an actor\n properties:\n id:\n type: string\n description: Unique identifier for the operation\n required: true\n description:\n type: string\n description: A user-friendly description of the intent for the operation\n required: false\n operation:\n type: onap.datatype.controlloop.Actor\n description: The definition of the operation to be performed.\n required: true\n timeout:\n type: integer\n description: The amount of time for the actor to perform the operation.\n required: true\n retries:\n type: integer\n description: The number of retries the actor should attempt to perform the operation.\n required: true\n default: 0\n success:\n type: string\n description: Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.\n required: false\n default: final_success\n failure:\n type: string\n description: Points to the operation to invoke on Actor operation failure.\n required: false\n default: final_failure\n failure_timeout:\n type: string\n description: Points to the operation to invoke when the time out for the operation occurs.\n required: false\n default: final_failure_timeout\n failure_retries:\n type: string\n description: Points to the operation to invoke when the current operation has exceeded its max retries.\n required: false\n default: final_failure_retries\n failure_exception:\n type: string\n description: Points to the operation to invoke when the current operation causes an exception.\n required: false\n default: final_failure_exception\n failure_guard:\n type: string\n description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard\n onap.datatypes.monitoring.managedObjectDNsBasic:\n constraints: []\n properties:\n DN:\n name: DN\n type: string\n typeVersion: 0.0.0\n description: Managed object distinguished name\n required: true\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.managedObjectDNsBasic\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.managedObjectDNsBasics:\n constraints: []\n properties:\n managedObjectDNsBasic:\n name: managedObjectDNsBasic\n type: map\n typeVersion: 0.0.0\n description: Managed object distinguished name object\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.managedObjectDNsBasic\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.managedObjectDNsBasics\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementGroup:\n constraints: []\n properties:\n measurementTypes:\n name: measurementTypes\n type: list\n typeVersion: 0.0.0\n description: List of measurement types\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementTypes\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n managedObjectDNsBasic:\n name: managedObjectDNsBasic\n type: list\n typeVersion: 0.0.0\n description: List of managed object distinguished names\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.managedObjectDNsBasics\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementGroup\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementGroups:\n constraints: []\n properties:\n measurementGroup:\n name: measurementGroup\n type: map\n typeVersion: 0.0.0\n description: Measurement Group\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementGroup\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementGroups\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementType:\n constraints: []\n properties:\n measurementType:\n name: measurementType\n type: string\n typeVersion: 0.0.0\n description: Measurement type\n required: true\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementType\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementTypes:\n constraints: []\n properties:\n measurementType:\n name: measurementType\n type: map\n typeVersion: 0.0.0\n description: Measurement type object\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementType\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementTypes\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.nfFilter:\n constraints: []\n properties:\n modelNames:\n name: modelNames\n type: list\n typeVersion: 0.0.0\n description: List of model names\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n modelInvariantIDs:\n name: modelInvariantIDs\n type: list\n typeVersion: 0.0.0\n description: List of model invariant IDs\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n modelVersionIDs:\n name: modelVersionIDs\n type: list\n typeVersion: 0.0.0\n description: List of model version IDs\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n nfNames:\n name: nfNames\n type: list\n typeVersion: 0.0.0\n description: List of network functions\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.nfFilter\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.subscription:\n constraints: []\n properties:\n measurementGroups:\n name: measurementGroups\n type: list\n typeVersion: 0.0.0\n description: Measurement Groups\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementGroups\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n fileBasedGP:\n name: fileBasedGP\n type: integer\n typeVersion: 0.0.0\n description: File based granularity period\n required: true\n constraints: []\n metadata: {}\n fileLocation:\n name: fileLocation\n type: string\n typeVersion: 0.0.0\n description: ROP file location\n required: true\n constraints: []\n metadata: {}\n subscriptionName:\n name: subscriptionName\n type: string\n typeVersion: 0.0.0\n description: Name of the subscription\n required: true\n constraints: []\n metadata: {}\n administrativeState:\n name: administrativeState\n type: string\n typeVersion: 0.0.0\n description: State of the subscription\n required: true\n constraints:\n - valid_values:\n - LOCKED\n - UNLOCKED\n metadata: {}\n nfFilter:\n name: nfFilter\n type: map\n typeVersion: 0.0.0\n description: Network function filter\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.nfFilter\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.subscription\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n description: a base policy type for all policies that govern monitoring provisioning\n version: 1.0.0\n name: onap.policies.Monitoring\n onap.policies.Sirisha:\n derived_from: tosca.policies.Root\n description: a base policy type for all policies that govern monitoring provisioning\n version: 1.0.0\n name: onap.policies.Sirisha\n onap.policies.monitoring.dcae-pm-subscription-handler:\n properties:\n pmsh_policy:\n name: pmsh_policy\n type: onap.datatypes.monitoring.subscription\n typeVersion: 0.0.0\n description: PMSH Policy JSON\n required: false\n constraints: []\n metadata: {}\n name: onap.policies.monitoring.dcae-pm-subscription-handler\n version: 1.0.0\n derived_from: onap.policies.Monitoring\n metadata: {}\n onap.policies.controlloop.operational.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n name: onap.policies.controlloop.operational.Common\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n properties:\n id:\n type: string\n description: The unique control loop id.\n required: true\n timeout:\n type: integer\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n abatement:\n type: boolean\n description: Whether an abatement event message will be expected for the control loop from DCAE.\n required: true\n default: false\n trigger:\n type: string\n description: Initial operation to execute upon receiving an Onset event message for the Control Loop.\n required: true\n operations:\n type: list\n description: List of operations to be performed when Control Loop is triggered.\n required: true\n entry_schema:\n type: onap.datatype.controlloop.Operation\n onap.policies.controlloop.operational.common.Apex:\n derived_from: onap.policies.controlloop.operational.Common\n type_version: 1.0.0\n version: 1.0.0\n name: onap.policies.controlloop.operational.common.Apex\n description: Operational policies for Apex PDP\n properties:\n engineServiceParameters:\n type: string\n description: The engine parameters like name, instanceCount, policy implementation, parameters etc.\n required: true\n eventInputParameters:\n type: string\n description: The event input parameters.\n required: true\n eventOutputParameters:\n type: string\n description: The event output parameters.\n required: true\n javaProperties:\n type: string\n description: Name/value pairs of properties to be set for APEX if needed.\n required: false\nnode_types:\n org.onap.policy.clamp.controlloop.Participant:\n version: 1.0.1\n derived_from: tosca.nodetypes.Root\n properties:\n provider:\n type: string\n requred: false\n org.onap.policy.clamp.controlloop.ControlLoopElement:\n version: 1.0.1\n derived_from: tosca.nodetypes.Root\n properties:\n provider:\n type: string\n required: false\n metadata:\n common: true\n description: Specifies the organization that provides the control loop element\n participantType:\n type: onap.datatypes.ToscaConceptIdentifier\n required: true\n metadata:\n common: true\n description: The identity of the participant type that hosts this type of Control Loop Element\n startPhase:\n type: integer\n required: false\n constraints:\n - greater-or-equal: 0\n metadata:\n common: true\n description: A value indicating the start phase in which this control loop element will be started, the\n first start phase is zero. Control Loop Elements are started in their start_phase order and stopped\n in reverse start phase order. Control Loop Elements with the same start phase are started and\n stopped simultaneously\n uninitializedToPassiveTimeout:\n type: integer\n required: false\n constraints:\n - greater-or-equal: 0\n default: 60\n metadata:\n common: true\n description: The maximum time in seconds to wait for a state chage from uninitialized to passive\n passiveToRunningTimeout:\n type: integer\n required: false\n constraints:\n - greater-or-equal: 0\n default: 60\n metadata:\n common: true\n description: The maximum time in seconds to wait for a state chage from passive to running\n runningToPassiveTimeout:\n type: integer\n required: false\n constraints:\n - greater-or-equal: 0\n default: 60\n metadata:\n common: true\n description: The maximum time in seconds to wait for a state chage from running to passive\n passiveToUninitializedTimeout:\n type: integer\n required: false\n constraints:\n - greater-or-equal: 0\n default: 60\n metadata:\n common: true\n description: The maximum time in seconds to wait for a state chage from passive to uninitialized\n\n org.onap.policy.clamp.controlloop.ControlLoop:\n version: 1.0.1\n derived_from: tosca.nodetypes.Root\n properties:\n provider:\n type: string\n requred: false\n elements:\n type: list\n required: true\n entry_schema:\n type: onap.datatypes.ToscaConceptIdentifier\n org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:\n version: 1.0.1\n derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement\n properties:\n dcae_blueprint_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: false\n dcae_blueprint:\n type: onap.dcae.cloudify_blueprint\n requred: false\n consul_info:\n type: list\n required: false\n entry_schema:\n type: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo\n org.onap.policy.clamp.controlloop.PolicyControlLoopElement:\n version: 1.0.1\n derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement\n properties:\n policy_type_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: true\n policy_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: false\n org.onap.policy.clamp.controlloop.CDSControlLoopElement:\n version: 1.0.1\n derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement\n properties:\n cds_blueprint_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: true\ntopology_template:\n inputs:\n pmsh_monitoring_policy:\n type: onap.datatypes.ToscaConceptIdentifier\n description: The ID of the PMSH monitoring policy to use\n default:\n name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n version: 1.0.0\n pmsh_operational_policy:\n type: onap.datatypes.ToscaConceptIdentifier\n description: The ID of the PMSH operational policy to use\n default:\n name: operational.apex.pmcontrol\n version: 1.0.0\n node_templates:\n org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:\n version: 2.3.4\n type: org.onap.policy.clamp.controlloop.Participant\n type_version: 1.0.1\n description: Participant for DCAE microservices\n properties:\n provider: ONAP\n org.onap.policy.controlloop.PolicyControlLoopParticipant:\n version: 2.3.1\n type: org.onap.policy.clamp.controlloop.Participant\n type_version: 1.0.1\n description: Participant for DCAE microservices\n properties:\n provider: ONAP\n org.onap.domain.pmsh.PMSH_DCAEMicroservice:\n version: 1.2.3\n type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement\n type_version: 1.0.0\n description: Control loop element for the DCAE microservice for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n participantType:\n name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant\n version: 2.3.4\n startPhase: 0\n dcae_blueprint:\n tosca_definitions_version: cloudify_dsl_1_3\n imports:\n - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\n - plugin:k8splugin?version=3.7.0\n - plugin:pgaas?version=1.3.0\n - plugin:clamppolicyplugin?version=1.1.0\n inputs:\n tag_version:\n type: string\n description: Docker image to be used\n default: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pmsh:1.1.2\n replicas:\n type: integer\n description: Number of instances\n default: 1\n operational_policy_name:\n type: string\n default: operational.apex.pmcontrol\n control_loop_name:\n type: string\n default: pmsh-control-loop\n pmsh_publish_topic_name:\n type: string\n default: unauthenticated.DCAE_CL_OUTPUT\n policy_feedback_topic_name:\n type: string\n default: unauthenticated.PMSH_CL_INPUT\n aai_notification_topic_name:\n type: string\n default: AAI-EVENT\n publisher_client_role:\n type: string\n description: Client role to request secure access to topic\n default: org.onap.dcae.pmPublisher\n subscriber_client_role:\n type: string\n description: Client role to request secure access to topic\n default: org.onap.dcae.pmSubscriber\n dcae_location:\n type: string\n description: DCAE location for the subscriber, used to set up routing\n default: san-francisco\n cpu_limit:\n type: string\n default: 1000m\n cpu_request:\n type: string\n default: 1000m\n memory_limit:\n type: string\n default: 1024Mi\n memory_request:\n type: string\n default: 1024Mi\n pgaas_cluster_name:\n type: string\n default: dcae-pg-primary.onap\n enable_tls:\n type: boolean\n default: true\n protocol:\n type: string\n description: PMSH protocol. If enable_tls is false, set to http\n default: https\n policy_model_id:\n type: string\n default: onap.policies.monitoring.dcae-pm-subscription-handler\n policy_id:\n type: string\n default: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n node_templates:\n pgaasvm:\n type: dcae.nodes.pgaas.database\n properties:\n writerfqdn:\n get_input: pgaas_cluster_name\n name: pmsh\n pmsh:\n type: dcae.nodes.ContainerizedServiceComponentUsingDmaap\n interfaces:\n cloudify.interfaces.lifecycle:\n create:\n inputs:\n ports:\n - '8443:0'\n envs:\n PMSH_PG_URL:\n get_attribute:\n - pgaasvm\n - admin\n - host\n PMSH_PG_PASSWORD:\n get_attribute:\n - pgaasvm\n - admin\n - password\n PMSH_PG_USERNAME:\n get_attribute:\n - pgaasvm\n - admin\n - user\n PMSH_DB_NAME:\n get_attribute:\n - pgaasvm\n - admin\n - database\n relationships:\n - target: pmsh-policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: dcae-pmsh\n service_component_name_override: dcae-pmsh\n application_config:\n enable_tls:\n get_input: enable_tls\n aaf_identity: dcae@dcae.onap.org\n aaf_password: demo123456!\n operational_policy_name:\n get_input: operational_policy_name\n control_loop_name:\n get_input: control_loop_name\n cert_path: /opt/app/pmsh/etc/certs/cert.pem\n key_path: /opt/app/pmsh/etc/certs/key.pem\n ca_cert_path: /opt/app/pmsh/etc/certs/cacert.pem\n streams_publishes:\n policy_pm_publisher:\n type: message_router\n dmaap_info:\n topic_url:\n concat:\n - http://message-router:3904/events/\n - get_input: pmsh_publish_topic_name\n streams_subscribes:\n policy_pm_subscriber:\n type: message_router\n dmaap_info:\n topic_url:\n concat:\n - http://message-router:3904/events/\n - get_input: policy_feedback_topic_name\n aai_subscriber:\n type: message_router\n dmaap_info:\n topic_url:\n concat:\n - http://message-router:3904/events/\n - get_input: aai_notification_topic_name\n resource_config:\n limits:\n cpu:\n get_input: cpu_limit\n memory:\n get_input: memory_limit\n requests:\n cpu:\n get_input: cpu_request\n memory:\n get_input: memory_request\n docker_config:\n healthcheck:\n endpoint: /healthcheck\n interval: 15s\n timeout: 1s\n type:\n get_input: protocol\n image:\n get_input: tag_version\n replicas:\n get_input: replicas\n log_info:\n log_directory: /var/log/ONAP/dcaegen2/services/pmsh\n tls_info:\n cert_directory: /opt/app/pmsh/etc/certs\n use_tls:\n get_input: enable_tls\n pmsh-policy:\n type: clamp.nodes.policy\n properties:\n policy_model_id:\n get_input: policy_model_id\n policy_id:\n get_input: policy_id\n consul_info:\n - consulUrl: http://consul:31321/v1/kv/dcae-pmsh:policy\n consulBody:\n subscription:\n subscriptionName: subscriptiona\n administrativeState: UNLOCKED\n fileBasedGP: 15\n fileLocation: /pm/pm.xml\n nfFilter:\n nfNames:\n - ^pnf1.*\n modelInvariantIDs:\n - 5845y423-g654-6fju-po78-8n53154532k6\n - 7129e420-d396-4efb-af02-6b83499b12f8\n modelVersionIDs:\n - e80a6ae3-cafd-4d24-850d-e14c084a5ca9\n measurementGroups:\n - measurementGroup:\n measurementTypes:\n - measurementType: countera\n - measurementType: counterb\n managedObjectDNsBasic:\n - DN: dna\n - DN: dnb\n - measurementGroup:\n measurementTypes:\n - measurementType: counterc\n - measurementType: counterd\n managedObjectDNsBasic:\n - DN: dnc\n - DN: dnd\n org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:\n version: 1.2.3\n type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement\n type_version: 1.0.0\n description: Control loop element for the monitoring policy for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n participantType:\n name: org.onap.policy.controlloop.PolicyControlLoopParticipant\n version: 2.3.1\n startPhase: 0\n policy_type_id:\n name: onap.policies.monitoring.pm-subscription-handler\n version: 1.0.0\n policy_id:\n get_input: pmsh_monitoring_policy\n org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:\n version: 1.2.3\n type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement\n type_version: 1.0.0\n description: Control loop element for the operational policy for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n participantType:\n name: org.onap.policy.controlloop.PolicyControlLoopParticipant\n version: 2.3.1\n startPhase: 0\n policy_type_id:\n name: onap.policies.operational.pm-subscription-handler\n version: 1.0.0\n policy_id:\n get_input: pmsh_operational_policy\n org.onap.domain.pmsh.PMSHControlLoopDefinition:\n version: 1.2.3\n type: org.onap.policy.clamp.controlloop.ControlLoop\n type_version: 1.0.0\n description: Control loop for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n elements:\n - name: org.onap.domain.pmsh.PMSH_DCAEMicroservice\n version: 1.2.3\n - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement\n version: 1.2.3\n - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement\n version: 1.2.3\n policies:\n - MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test:\n type: onap.policies.monitoring.dcae-pm-subscription-handler\n type_version: 1.0.0\n name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n version: 1.0.0\n metadata:\n policy-id: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n policy-version: 1.0.0\n properties:\n pmsh_policy:\n fileBasedGP: 15\n fileLocation: /pm/pm.xml\n subscriptionName: subscriptiona\n administrativeState: UNLOCKED\n nfFilter:\n onap.datatypes.monitoring.nfFilter:\n modelVersionIDs:\n - e80a6ae3-cafd-4d24-850d-e14c084a5ca9\n modelInvariantIDs:\n - 5845y423-g654-6fju-po78-8n53154532k6\n - 7129e420-d396-4efb-af02-6b83499b12f8\n modelNames: []\n nfNames:\n - '\"^pnf1.*\"'\n measurementGroups:\n - measurementGroup:\n onap.datatypes.monitoring.measurementGroup:\n measurementTypes:\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: countera\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: counterb\n managedObjectDNsBasic:\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dna\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dnb\n - measurementGroup:\n onap.datatypes.monitoring.measurementGroup:\n measurementTypes:\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: counterc\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: counterd\n managedObjectDNsBasic:\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dnc\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dnd\n - operational.apex.pmcontrol:\n type: onap.policies.controlloop.operational.common.Apex\n type_version: 1.0.0\n version: 1.0.0\n metadata:\n policy-id: operational.apex.pmcontrol\n policy-version: 1\n properties:\n engineServiceParameters:\n name: MyApexEngine\n version: 0.0.1\n id: 45\n instanceCount: 2\n deploymentPort: 12561\n policy_type_impl:\n apexPolicyModel:\n key:\n name: PMControlPolicy\n version: 0.0.1\n keyInformation:\n key:\n name: PMControlPolicy_KeyInfo\n version: 0.0.1\n keyInfoMap:\n entry:\n - key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n value:\n key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n UUID: 6e5fa19b-14df-37e3-a4ae-8c537e861a82\n description: Generated description for concept referred to by key \"CDSActionIdentifiersType:0.0.1\"\n - key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n UUID: 14b29e38-ac75-3273-aa4e-8583c0aa7dad\n description: Generated description for concept referred to by key \"CDSCreateResponseEvent:0.0.1\"\n - key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n UUID: 04573f8f-e772-30a5-b1d9-d7318d4a1e13\n description: Generated description for concept referred to by key \"CDSCreateResponsePayloadType:0.0.1\"\n - key:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n UUID: e126c965-fc09-3bfe-8f55-70f380a4a49c\n description: Generated description for concept referred to by key \"CDSCreateResponsePolicy:0.0.1\"\n - key:\n name: CDSCreateResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseTask\n version: 0.0.1\n UUID: 6165ee82-afd2-3aab-a517-f00b3f2461d2\n description: Generated description for concept referred to by key \"CDSCreateResponseTask:0.0.1\"\n - key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n UUID: 8350ac5e-c157-38b9-9614-a0f93a830e60\n description: Generated description for concept referred to by key \"CDSCreateSubscriptionPayloadType:0.0.1\"\n - key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n UUID: cfa325ba-226b-3a31-9183-ec43e2b6e9a2\n description: Generated description for concept referred to by key \"CDSCreateSubscriptionRequestEvent:0.0.1\"\n - key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n UUID: 8be9c0fa-7437-3841-aff2-b3cec6ae3bd8\n description: Generated description for concept referred to by key \"CDSDeleteResponseEvent:0.0.1\"\n - key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n UUID: 3fbfe0c9-152e-34d3-a504-09cd13c058d0\n description: Generated description for concept referred to by key \"CDSDeleteResponsePayloadType:0.0.1\"\n - key:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n UUID: a780251c-edd5-3132-b865-04313246b43c\n description: Generated description for concept referred to by key \"CDSDeleteResponsePolicy:0.0.1\"\n - key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n UUID: afce4555-3aa3-3521-a7d8-ee8cdf0d3efc\n description: Generated description for concept referred to by key \"CDSDeleteResponseTask:0.0.1\"\n - key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n UUID: 12658406-9147-3c9d-a38c-5ad5e30b092b\n description: Generated description for concept referred to by key \"CDSDeleteSubscriptionPayloadType:0.0.1\"\n - key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n UUID: 24380c95-9289-36e6-8cbf-0edefa15ccd9\n description: Generated description for concept referred to by key \"CDSDeleteSubscriptionRequestEvent:0.0.1\"\n - key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n UUID: 35590ac0-062c-39f1-8786-b4ff716e30b1\n description: Generated description for concept referred to by key \"CDSRequestCommonHeaderType:0.0.1\"\n - key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n UUID: dd7e1805-885a-350b-aaf9-ed541321ae3c\n description: Generated description for concept referred to by key \"CDSResponseCommonHeaderType:0.0.1\"\n - key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n UUID: 7986e21b-32f7-302e-9554-31f21b673493\n description: Generated description for concept referred to by key \"CDSResponseStatusEvent:0.0.1\"\n - key:\n name: CDSResponseStatusType\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusType\n version: 0.0.1\n UUID: 92b8a2cf-344e-3ce1-8cc0-2b7d3cb695fa\n description: Generated description for concept referred to by key \"CDSResponseStatusType:0.0.1\"\n - key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n UUID: 92162397-1a8e-3a3f-a469-d2af7700af4a\n description: Generated description for concept referred to by key \"CreateSubscriptionPayloadEvent:0.0.1\"\n - key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n UUID: bc0c69f0-52ed-38ea-b468-ae4a6fd1730d\n description: Generated description for concept referred to by key \"CreateSubscriptionPayloadTask:0.0.1\"\n - key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n UUID: 89cb75e9-f06c-30d3-b4ff-698d45f63869\n description: Generated description for concept referred to by key \"CreateSubscriptionRequestTask:0.0.1\"\n - key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n UUID: 994fa441-04ab-33bb-832d-1cd12ab5d074\n description: Generated description for concept referred to by key \"DeleteSubscriptionPayloadEvent:0.0.1\"\n - key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n UUID: 0f519117-5fea-3e4b-941f-8f778100465f\n description: Generated description for concept referred to by key \"DeleteSubscriptionPayloadTask:0.0.1\"\n - key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n UUID: acb772fe-d442-39e3-98f9-b1080caf4150\n description: Generated description for concept referred to by key \"DeleteSubscriptionRequestTask:0.0.1\"\n - key:\n name: MRResponseEvent\n version: 0.0.1\n value:\n key:\n name: MRResponseEvent\n version: 0.0.1\n UUID: 13c747a3-6bae-3bcf-9c80-b152e01dc194\n description: Generated description for concept referred to by key \"MRResponseEvent:0.0.1\"\n - key:\n name: PMControlPolicy\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy\n version: 0.0.1\n UUID: acf1e55c-7bc5-3bd5-975a-0ca54afcd8a4\n description: Generated description for concept referred to by key \"PMControlPolicy:0.0.1\"\n - key:\n name: PMControlPolicy_Albums\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Albums\n version: 0.0.1\n UUID: b38ad204-c2c8-32f4-9b5a-dda0aeb0145b\n description: Generated description for concept referred to by key \"PMControlPolicy_Albums:0.0.1\"\n - key:\n name: PMControlPolicy_Events\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Events\n version: 0.0.1\n UUID: be3871a0-c42a-3113-a066-82d192840eca\n description: Generated description for concept referred to by key \"PMControlPolicy_Events:0.0.1\"\n - key:\n name: PMControlPolicy_KeyInfo\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_KeyInfo\n version: 0.0.1\n UUID: ced37634-28a4-3178-b7f6-2980794927b0\n description: Generated description for concept referred to by key \"PMControlPolicy_KeyInfo:0.0.1\"\n - key:\n name: PMControlPolicy_Policies\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Policies\n version: 0.0.1\n UUID: be3d180d-ef9c-3a75-8e9c-84271a038bed\n description: Generated description for concept referred to by key \"PMControlPolicy_Policies:0.0.1\"\n - key:\n name: PMControlPolicy_Schemas\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Schemas\n version: 0.0.1\n UUID: e61973f1-189c-39e5-82f6-0d3afe298a20\n description: Generated description for concept referred to by key \"PMControlPolicy_Schemas:0.0.1\"\n - key:\n name: PMControlPolicy_Tasks\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Tasks\n version: 0.0.1\n UUID: 5658adb3-2962-30a3-a241-fae75bb8eb4a\n description: Generated description for concept referred to by key \"PMControlPolicy_Tasks:0.0.1\"\n - key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n UUID: c2bd6f0d-6854-317a-9be2-97c08338428c\n description: Generated description for concept referred to by key \"PMSubscriptionAlbum:0.0.1\"\n - key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n UUID: 992b7819-9f69-3aa0-bb0f-6e45ea15ce05\n description: Generated description for concept referred to by key \"PMSubscriptionOutputEvent:0.0.1\"\n - key:\n name: PMSubscriptionType\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionType\n version: 0.0.1\n UUID: 73c1c397-4fc3-357f-93b6-a8ad707fbaae\n description: Generated description for concept referred to by key \"PMSubscriptionType:0.0.1\"\n - key:\n name: ReceiveEventPolicy\n version: 0.0.1\n value:\n key:\n name: ReceiveEventPolicy\n version: 0.0.1\n UUID: 568b7345-9de1-36d3-b6a3-9b857e6809a1\n description: Generated description for concept referred to by key \"ReceiveEventPolicy:0.0.1\"\n - key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n value:\n key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n UUID: f596afc8-100c-35eb-92c8-352355ea457d\n description: Generated description for concept referred to by key \"ReceiveSubscriptionTask:0.0.1\"\n - key:\n name: SimpleIntType\n version: 0.0.1\n value:\n key:\n name: SimpleIntType\n version: 0.0.1\n UUID: 153791fd-ae0a-36a7-88a5-309a7936415d\n description: Generated description for concept referred to by key \"SimpleIntType:0.0.1\"\n - key:\n name: SimpleStringType\n version: 0.0.1\n value:\n key:\n name: SimpleStringType\n version: 0.0.1\n UUID: 8a4957cf-9493-3a76-8c22-a208e23259af\n description: Generated description for concept referred to by key \"SimpleStringType:0.0.1\"\n - key:\n name: SubscriptionStatusType\n version: 0.0.1\n value:\n key:\n name: SubscriptionStatusType\n version: 0.0.1\n UUID: 597643b1-9db1-31ce-85d0-e1c63c43b30b\n description: Generated description for concept referred to by key \"SubscriptionStatusType:0.0.1\"\n - key:\n name: SubscriptionType\n version: 0.0.1\n value:\n key:\n name: SubscriptionType\n version: 0.0.1\n UUID: 184547bb-7d64-3cb2-a273-d7185102c5ce\n description: Generated description for concept referred to by key \"SubscriptionType:0.0.1\"\n - key:\n name: UUIDType\n version: 0.0.1\n value:\n key:\n name: UUIDType\n version: 0.0.1\n UUID: 6a8cc68e-dfc8-3403-9c6d-071c886b319c\n description: Generated description for concept referred to by key \"UUIDType:0.0.1\"\n - key:\n name: pmsh-operational-policy\n version: 0.0.1\n value:\n key:\n name: pmsh-operational-policy\n version: 0.0.1\n UUID: fdf2c9ff-6422-3ea6-b6b6-49b12116265d\n description: Generated description for concept referred to by key \"pmsh-operational-policy:0.0.1\"\n policies:\n key:\n name: PMControlPolicy_Policies\n version: 0.0.1\n policyMap:\n entry:\n - key:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n value:\n policyKey:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n template: Freestyle\n state:\n entry:\n - key: CDSCreateResponseState\n value:\n stateKey:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CDSCreateResponseState\n trigger:\n name: CDSCreateResponseEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: ResponseOutput\n value:\n key:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSCreateResponseState\n localName: ResponseOutput\n outgoingEvent:\n name: CDSResponseStatusEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference: []\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CDSCreateResponseTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CDSCreateResponseTask\n version: 0.0.1\n value:\n key:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSCreateResponseState\n localName: CDSCreateResponsePolicy\n outputType: DIRECT\n output:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSCreateResponseState\n localName: ResponseOutput\n firstState: CDSCreateResponseState\n - key:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n value:\n policyKey:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n template: Freestyle\n state:\n entry:\n - key: CDSDeleteResponseState\n value:\n stateKey:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CDSDeleteResponseState\n trigger:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: ResponseOutput\n value:\n key:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSDeleteResponseState\n localName: ResponseOutput\n outgoingEvent:\n name: CDSResponseStatusEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference: []\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CDSDeleteResponseTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n value:\n key:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSDeleteResponseState\n localName: CDSDeleteResponsePolicy\n outputType: DIRECT\n output:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSDeleteResponseState\n localName: ResponseOutput\n firstState: CDSDeleteResponseState\n - key:\n name: ReceiveEventPolicy\n version: 0.0.1\n value:\n policyKey:\n name: ReceiveEventPolicy\n version: 0.0.1\n template: Freestyle\n state:\n entry:\n - key: CreateOrDeleteState\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateOrDeleteState\n trigger:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: CreateSubscriptionPayload\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: CreateSubscriptionPayload\n outgoingEvent:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n nextState:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateSubscription\n - key: DeleteSubscriptionPayload\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: DeleteSubscriptionPayload\n outgoingEvent:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n nextState:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: DeleteSubscription\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: TaskSelectionLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n var changeType = pmSubscriptionInfo.get(\"changeType\").toString()\n\n executor.logger.info(\"Change Type is \" + changeType)\n\n if (\"CREATE\".equals(changeType)) {\n executor.logger.info(\"Choosing to create a subscription\")\n executor.subject.getTaskKey(\"CreateSubscriptionPayloadTask\").copyTo(executor.selectedTask);\n }\n else if (\"DELETE\".equals(changeType)) {\n executor.logger.info(\"Choosing to delete a subscription\")\n executor.subject.getTaskKey(\"DeleteSubscriptionPayloadTask\").copyTo(executor.selectedTask);\n }\n\n //var returnValue = executor.isTrue;\n true;\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: CreateSubscriptionPayload\n - key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: DeleteSubscriptionPayload\n - key: CreateSubscription\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateSubscription\n trigger:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: IssueCreateSubscriptionRequestOutput\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateSubscription\n localName: IssueCreateSubscriptionRequestOutput\n outgoingEvent:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateSubscription\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateSubscription\n localName: IssueCreateSubscriptionRequestOutput\n - key: DeleteSubscription\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: DeleteSubscription\n trigger:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: IssueDeleteSubscriptionRequestOutput\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: DeleteSubscription\n localName: IssueDeleteSubscriptionRequestOutput\n outgoingEvent:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: DeleteSubscription\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: DeleteSubscription\n localName: IssueDeleteSubscriptionRequestOutput\n - key: ReceiveSubscriptionState\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: ReceiveSubscriptionState\n trigger:\n name: pmsh-operational-policy\n version: 0.0.1\n stateOutputs:\n entry:\n - key: ReceivePMSubscriptionOutput\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: ReceiveSubscriptionState\n localName: ReceivePMSubscriptionOutput\n outgoingEvent:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n nextState:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateOrDeleteState\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: ReceiveSubscriptionState\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: ReceiveSubscriptionState\n localName: ReceivePMSubscriptionOutput\n firstState: ReceiveSubscriptionState\n tasks:\n key:\n name: PMControlPolicy_Tasks\n version: 0.0.1\n taskMap:\n entry:\n - key:\n name: CDSCreateResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseTask\n version: 0.0.1\n inputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: SubscriptionStatusType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var commonHeader = executor.inFields.get(\"commonHeader\")\n var response = executor.inFields.get(\"payload\")\n var albumID = commonHeader.get(\"requestId\")\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(albumID.toString());\n var responseStatus = executor.subject.getOutFieldSchemaHelper(\"status\").createNewInstance();\n\n responseStatus.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n responseStatus.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n responseStatus.put(\"changeType\", pmSubscriptionInfo.get(\"changeType\"))\n\n var status = response.get(pmSubscriptionInfo.get(\"changeType\").toLowerCase() + \"_DasH_subscription_DasH_response\").get(\"odl_DasH_response\").get(\"status\")\n\n executor.logger.info(\"RESPONSE STATUS = \" + status)\n\n if(status == \"success\") {\n responseStatus.put(\"message\", \"success\")\n } else {\n responseStatus.put(\"message\", \"failed\")\n }\n\n executor.outFields.put(\"status\", responseStatus)\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n inputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: SubscriptionStatusType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var commonHeader = executor.inFields.get(\"commonHeader\")\n var response = executor.inFields.get(\"payload\")\n var albumID = commonHeader.get(\"requestId\")\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(albumID.toString());\n var responseStatus = executor.subject.getOutFieldSchemaHelper(\"status\").createNewInstance();\n\n responseStatus.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n responseStatus.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n responseStatus.put(\"changeType\", pmSubscriptionInfo.get(\"changeType\"))\n\n var status = response.get(pmSubscriptionInfo.get(\"changeType\").toLowerCase() + \"_DasH_subscription_DasH_response\").get(\"odl_DasH_response\").get(\"status\")\n\n executor.logger.info(\"RESPONSE STATUS = \" + status)\n\n if(status == \"success\") {\n responseStatus.put(\"message\", \"success\")\n } else {\n responseStatus.put(\"message\", \"failed\")\n }\n\n executor.outFields.put(\"status\", responseStatus)\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n\n var payloadProperties = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(changeType + \"_DasH_subscription_DasH_properties_record\");\n\n payloadProperties.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n payloadProperties.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n payloadProperties.put(\"administrativeState\", pmSubscriptionInfo.get(\"subscription\").get(\"administrativeState\"))\n payloadProperties.put(\"fileBasedGP\", pmSubscriptionInfo.get(\"subscription\").get(\"fileBasedGP\").toString())\n payloadProperties.put(\"fileLocation\", pmSubscriptionInfo.get(\"subscription\").get(\"fileLocation\"))\n payloadProperties.put(\"measurementGroups\", pmSubscriptionInfo.get(\"subscription\").get(\"measurementGroups\"))\n\n var payloadEntry = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(\"CDSRequestPayloadEntry\");\n payloadEntry.put(changeType + \"_DasH_subscription_DasH_properties\", payloadProperties)\n\n var payload = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewInstance();\n payload.put(changeType + \"_DasH_subscription_DasH_request\", payloadEntry);\n\n executor.outFields.put(\"albumID\", executor.inFields.get(\"albumID\"))\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n var blueprintName = pmSubscriptionInfo.get(\"blueprintName\").toLowerCase()\n var blueprintVersion = pmSubscriptionInfo.get(\"blueprintVersion\").toLowerCase()\n var payload = executor.inFields.get(\"payload\")\n var actionName = changeType + \"-subscription\"\n\n var commonHeader = executor.subject.getOutFieldSchemaHelper(\"commonHeader\").createNewInstance();\n commonHeader.put(\"originatorId\", \"sdnc\");\n commonHeader.put(\"requestId\", executor.inFields.get(\"albumID\").toString());\n commonHeader.put(\"subRequestId\", \"sub-123456-1000\");\n\n var actionIdentifiers = executor.subject.getOutFieldSchemaHelper(\"actionIdentifiers\").createNewInstance();\n actionIdentifiers.put(\"actionName\", actionName);\n actionIdentifiers.put(\"blueprintName\", blueprintName);\n actionIdentifiers.put(\"blueprintVersion\", blueprintVersion);\n actionIdentifiers.put(\"mode\", \"sync\");\n\n executor.outFields.put(\"commonHeader\", commonHeader);\n executor.outFields.put(\"actionIdentifiers\", actionIdentifiers);\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n\n var payloadProperties = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(changeType + \"_DasH_subscription_DasH_properties_record\");\n\n payloadProperties.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n payloadProperties.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n payloadProperties.put(\"administrativeState\", pmSubscriptionInfo.get(\"subscription\").get(\"administrativeState\"))\n payloadProperties.put(\"fileBasedGP\", pmSubscriptionInfo.get(\"subscription\").get(\"fileBasedGP\").toString())\n payloadProperties.put(\"fileLocation\", pmSubscriptionInfo.get(\"subscription\").get(\"fileLocation\"))\n payloadProperties.put(\"measurementGroups\", pmSubscriptionInfo.get(\"subscription\").get(\"measurementGroups\"))\n\n var payloadEntry = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(\"CDSRequestPayloadEntry\");\n payloadEntry.put(changeType + \"_DasH_subscription_DasH_properties\", payloadProperties)\n\n var payload = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewInstance();\n payload.put(changeType + \"_DasH_subscription_DasH_request\", payloadEntry);\n\n executor.outFields.put(\"albumID\", executor.inFields.get(\"albumID\"))\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n var blueprintName = pmSubscriptionInfo.get(\"blueprintName\").toLowerCase()\n var blueprintVersion = pmSubscriptionInfo.get(\"blueprintVersion\").toLowerCase()\n var payload = executor.inFields.get(\"payload\")\n var actionName = changeType + \"-subscription\"\n\n var commonHeader = executor.subject.getOutFieldSchemaHelper(\"commonHeader\").createNewInstance();\n commonHeader.put(\"originatorId\", \"sdnc\");\n commonHeader.put(\"requestId\", executor.inFields.get(\"albumID\").toString());\n commonHeader.put(\"subRequestId\", \"sub-123456-1000\");\n\n var actionIdentifiers = executor.subject.getOutFieldSchemaHelper(\"actionIdentifiers\").createNewInstance();\n actionIdentifiers.put(\"actionName\", actionName);\n actionIdentifiers.put(\"blueprintName\", blueprintName);\n actionIdentifiers.put(\"blueprintVersion\", blueprintVersion);\n actionIdentifiers.put(\"mode\", \"sync\");\n\n executor.outFields.put(\"commonHeader\", commonHeader);\n executor.outFields.put(\"actionIdentifiers\", actionIdentifiers);\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n value:\n key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n inputFields:\n entry:\n - key: blueprintName\n value:\n key: blueprintName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: blueprintVersion\n value:\n key: blueprintVersion\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: changeType\n value:\n key: changeType\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: closedLoopControlName\n value:\n key: closedLoopControlName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: nfName\n value:\n key: nfName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: policyName\n value:\n key: policyName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: subscription\n value:\n key: subscription\n fieldSchemaKey:\n name: SubscriptionType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n var uuidType = java.util.UUID;\n\n executor.logger.info(executor.subject.id);\n\n //albumID will be used to fetch info from our album later\n var albumID = uuidType.randomUUID();\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").getSchemaHelper().createNewInstance();\n var returnValue = true;\n\n if(executor.inFields.get(\"policyName\") != null) {\n executor.logger.info(\"nfName in receive sub event \" + executor.inFields.get(\"nfName\"));\n\n var changeType = executor.inFields.get(\"changeType\")\n var nfName = executor.inFields.get(\"nfName\")\n var policyName = executor.inFields.get(\"policyName\")\n var closedLoopControlName = executor.inFields.get(\"closedLoopControlName\")\n var subscription = executor.inFields.get(\"subscription\")\n var blueprintName = executor.inFields.get(\"blueprintName\")\n var blueprintVersion = executor.inFields.get(\"blueprintVersion\")\n\n pmSubscriptionInfo.put(\"nfName\", executor.inFields.get(\"nfName\"));\n pmSubscriptionInfo.put(\"changeType\", executor.inFields.get(\"changeType\"))\n pmSubscriptionInfo.put(\"policyName\", executor.inFields.get(\"policyName\"))\n pmSubscriptionInfo.put(\"closedLoopControlName\", executor.inFields.get(\"closedLoopControlName\"))\n pmSubscriptionInfo.put(\"subscription\", subscription)\n pmSubscriptionInfo.put(\"blueprintName\", blueprintName)\n pmSubscriptionInfo.put(\"blueprintVersion\", blueprintVersion)\n\n\n executor.getContextAlbum(\"PMSubscriptionAlbum\").put(albumID.toString(), pmSubscriptionInfo);\n\n executor.outFields.put(\"albumID\", albumID)\n } else {\n executor.message = \"Received invalid event\"\n returnValue = false;\n }\n\n returnValue;\n events:\n key:\n name: PMControlPolicy_Events\n version: 0.0.1\n eventMap:\n entry:\n - key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: CDS\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n - key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: CDS\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n - key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: DCAE\n parameter:\n entry:\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: SubscriptionStatusType\n version: 0.0.1\n optional: false\n - key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: MRResponseEvent\n version: 0.0.1\n value:\n key:\n name: MRResponseEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: DCAE\n target: APEX\n parameter:\n entry:\n - key: count\n value:\n key: count\n fieldSchemaKey:\n name: SimpleIntType\n version: 0.0.1\n optional: false\n - key: serverTimeMs\n value:\n key: serverTimeMs\n fieldSchemaKey:\n name: SimpleIntType\n version: 0.0.1\n optional: false\n - key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key:\n name: pmsh-operational-policy\n version: 0.0.1\n value:\n key:\n name: pmsh-operational-policy\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: DCAE\n target: APEX\n parameter:\n entry:\n - key: blueprintName\n value:\n key: blueprintName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: blueprintVersion\n value:\n key: blueprintVersion\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: changeType\n value:\n key: changeType\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: closedLoopControlName\n value:\n key: closedLoopControlName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: nfName\n value:\n key: nfName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: policyName\n value:\n key: policyName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: subscription\n value:\n key: subscription\n fieldSchemaKey:\n name: SubscriptionType\n version: 0.0.1\n optional: false\n albums:\n key:\n name: PMControlPolicy_Albums\n version: 0.0.1\n albums:\n entry:\n - key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n scope: policy\n isWritable: true\n itemSchema:\n name: PMSubscriptionType\n version: 0.0.1\n schemas:\n key:\n name: PMControlPolicy_Schemas\n version: 0.0.1\n schemas:\n entry:\n - key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n value:\n key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ActionIdentifiers_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"actionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"blueprintName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"blueprintVersion\",\n \"type\": \"string\"\n },\n {\n \"name\": \"mode\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"name\": \"CreateResponsePayloadEntry\",\n \"type\": \"record\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"create_DasH_subscription_DasH_response\",\n \"type\": {\n \"name\": \"create_DasH_subscription_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"odl_DasH_response\",\n \"type\": {\n \"name\": \"odl_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"status\",\n \"type\": \"string\"\n }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n - key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"map\",\n \"values\": {\n \"type\": \"record\",\n \"name\": \"CDSRequestPayloadEntry\",\n \"fields\": [\n {\n \"name\": \"create_DasH_subscription_DasH_properties\",\n \"type\": {\n \"name\": \"create_DasH_subscription_DasH_properties_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"administrativeState\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileBasedGP\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileLocation\",\n \"type\": \"string\"\n },\n {\n \"name\": \"measurementGroups\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementGroups_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementGroup\",\n \"type\": {\n \"name\": \"measurementGroup\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementTypes\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementTypes_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementType\",\n \"type\": \"string\"\n }\n ]\n }\n }\n },\n {\n \"name\": \"managedObjectDNsBasic\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"managedObjectDNsBasic_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"DN\",\n \"type\": \"string\"\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n - key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"name\": \"DeleteResponsePayloadEntry\",\n \"type\": \"record\",\n \"namespace\": \"com.acme.avro\",\n \"fields\": [\n {\n \"name\": \"delete_DasH_subscription_DasH_response\",\n \"type\": {\n \"name\": \"delete_DasH_subscription_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"odl_DasH_response\",\n \"type\": {\n \"name\": \"odl_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"status\",\n \"type\": \"string\"\n }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n - key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"map\",\n \"values\": {\n \"type\": \"record\",\n \"name\": \"CDSRequestPayloadEntry\",\n \"fields\": [\n {\n \"name\": \"delete_DasH_subscription_DasH_properties\",\n \"type\": {\n \"name\": \"delete_DasH_subscription_DasH_properties_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"administrativeState\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileBasedGP\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileLocation\",\n \"type\": \"string\"\n },\n {\n \"name\": \"measurementGroups\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementGroups_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementGroup\",\n \"type\": {\n \"name\": \"measurementGroup\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementTypes\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementTypes_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementType\",\n \"type\": \"string\"\n }\n ]\n }\n }\n },\n {\n \"name\": \"managedObjectDNsBasic\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"managedObjectDNsBasic_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"DN\",\n \"type\": \"string\"\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n - key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"RequestCommonHeader_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"originatorId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subRequestId\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ResponseCommonHeader_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"originatorId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subRequestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"timestamp\",\n \"type\": \"string\"\n },\n {\n \"name\": \"flags\",\n \"type\": [\"null\", \"string\"]\n }\n ]\n }\n - key:\n name: CDSResponseStatusType\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ResponseStatus_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"code\",\n \"type\": \"int\"\n },\n {\n \"name\": \"eventType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"timestamp\",\n \"type\": \"string\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: PMSubscriptionType\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: \"{\\n\\t\\\"name\\\": \\\"PMSubscription\\\",\\n\\t\\\"type\\\": \\\"record\\\",\\n\\t\\\"namespace\\\": \\\"\\\n org.onap.policy.apex.onap.pmcontrol\\\",\\n\\t\\\"fields\\\": [\\n {\\n \\\"name\\\": \\\"nfName\\\"\\\n ,\\n \\\"type\\\": \\\"string\\\"\\n },\\n\\t {\\n\\t\\t\\t\\\"name\\\": \\\"changeType\\\",\\n\\t\\t\\t\\\"\\\n type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"closedLoopControlName\\\",\\n\\t\\t\\t\\\"type\\\": \\\"\\\n string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"policyName\\\",\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t\\\n {\\n\\t\\t \\\"name\\\": \\\"blueprintName\\\",\\n\\t\\t \\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t \\\"name\\\"\\\n : \\\"blueprintVersion\\\",\\n\\t\\t \\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"subscription\\\"\\\n ,\\n\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\\"name\\\": \\\"subscription\\\",\\n\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\\n \\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"subscriptionName\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\\n \\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"administrativeState\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\\n \\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"fileBasedGP\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"int\\\"\\\n \\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"fileLocation\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\\n \\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementGroups\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\\n \\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Groups_Type\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\"\\\n : \\\"measurementGroup\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Group_Type\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\\"name\\\": \\\"measurementTypes\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"\\\n name\\\": \\\"Measurement_Types_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementType\\\",\\n\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"managedObjectDNsBasic\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\\"name\\\": \\\"Managed_Object_Dns_Basic_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"DN\\\",\\n\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t]\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t]\\n\\t\\t\\t}\\n\\t\\\n \\t}\\n\\t]\\n}\"\n - key:\n name: SimpleIntType\n version: 0.0.1\n value:\n key:\n name: SimpleIntType\n version: 0.0.1\n schemaFlavour: Java\n schemaDefinition: java.lang.Integer\n - key:\n name: SimpleStringType\n version: 0.0.1\n value:\n key:\n name: SimpleStringType\n version: 0.0.1\n schemaFlavour: Java\n schemaDefinition: java.lang.String\n - key:\n name: SubscriptionStatusType\n version: 0.0.1\n value:\n key:\n name: SubscriptionStatusType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ActivateSubscriptionStatus_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"changeType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: SubscriptionType\n version: 0.0.1\n value:\n key:\n name: SubscriptionType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: \"{\\n\\t\\\"name\\\": \\\"subscription\\\",\\n\\t\\\"type\\\": \\\"record\\\",\\n\\t\\\"fields\\\": [{\\n\\t\\t\\\n \\t\\\"name\\\": \\\"subscriptionName\\\",\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"administrativeState\\\"\\\n ,\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"fileBasedGP\\\",\\n\\t\\t\\t\\\"type\\\": \\\"\\\n int\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"fileLocation\\\",\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t\\\n {\\n\\t\\t\\t\\\"name\\\": \\\"measurementGroups\\\",\\n\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\\n \\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Groups_Type\\\",\\n\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\\n \\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementGroup\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\\n \\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Group_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementTypes\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\"\\\n : {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\\"name\\\": \\\"Measurement_Types_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementType\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n }\\n\\t\\t\\t\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"managedObjectDNsBasic\\\",\\n\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\"\\\n : {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Managed_Object_Dns_Basic_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"\\\n type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"DN\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t]\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t}\\n\\t\\\n \\t\\t}\\n\\t\\t}\\n\\t]\\n}\"\n - key:\n name: UUIDType\n version: 0.0.1\n value:\n key:\n name: UUIDType\n version: 0.0.1\n schemaFlavour: Java\n schemaDefinition: java.util.UUID\n engineParameters:\n executorParameters:\n JAVASCRIPT:\n parameterClassName: org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters\n contextParameters:\n parameterClassName: org.onap.policy.apex.context.parameters.ContextParameters\n schemaParameters:\n Avro:\n parameterClassName: org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters\n Java:\n parameterClassName: org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters\n jsonAdapters:\n Instant:\n adaptedClass: java.time.Instant\n adaptorClass: org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter\n eventInputParameters:\n DCAEConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTCLIENT\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters\n parameters:\n consumerPollTime: '50'\n url: https://message-router:3905/events/unauthenticated.DCAE_CL_OUTPUT/cg1/sg1\n eventProtocolParameters:\n eventProtocol: JSON\n parameters:\n nameAlias: policyName\n eventName: pmsh-operational-policy\n eventNameFilter: pmsh-operational-policy\n CDSRequestConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n parameters:\n url: http://10.10.10.184:30254/api/v1/execution-service/process\n httpMethod: POST\n restRequestTimeout: 2000\n httpHeaders:\n - - Authorization\n - Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==\n eventProtocolParameters:\n eventProtocol: JSON\n eventName: CDSCreateResponseEvent\n eventNameFilter: CDSCreateResponseEvent\n requestorMode: true\n requestorPeer: CDSRequestProducer\n requestorTimeout: 500\n CDSDeleteRequestConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n parameters:\n url: http://10.10.10.184:30254/api/v1/execution-service/process\n httpMethod: POST\n restRequestTimeout: 2000\n httpHeaders:\n - - Authorization\n - Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==\n eventProtocolParameters:\n eventProtocol: JSON\n eventName: CDSDeleteResponseEvent\n eventNameFilter: CDSDeleteResponseEvent\n requestorMode: true\n requestorPeer: CDSDeleteRequestProducer\n requestorTimeout: 500\n CDSReplyConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n parameters:\n url: https://message-router:3905/events/unauthenticated.PMSH_CL_INPUT\n httpMethod: POST\n restRequestTimeout: 2000\n eventProtocolParameters:\n eventProtocol: JSON\n eventName: MRResponseEvent\n eventNameFilter: MRResponseEvent\n requestorMode: true\n requestorPeer: CDSReplyProducer\n requestorTimeout: 500\n eventOutputParameters:\n logOutputter:\n carrierTechnologyParameters:\n carrierTechnology: FILE\n parameters:\n fileName: /tmp/outputevents.log\n eventProtocolParameters:\n eventProtocol: JSON\n StdOutOutputter:\n carrierTechnologyParameters:\n carrierTechnology: FILE\n parameters:\n standardIo: true\n eventProtocolParameters:\n eventProtocol: JSON\n CDSRequestProducer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n eventProtocolParameters:\n eventProtocol: JSON\n eventNameFilter: CDSCreateSubscriptionRequestEvent\n requestorMode: true\n requestorPeer: CDSRequestConsumer\n requestorTimeout: 500\n CDSDeleteRequestProducer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n eventProtocolParameters:\n eventProtocol: JSON\n eventNameFilter: CDSDeleteSubscriptionRequestEvent\n requestorMode: true\n requestorPeer: CDSDeleteRequestConsumer\n requestorTimeout: 500\n CDSReplyProducer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n eventProtocolParameters:\n eventProtocol: JSON\n eventNameFilter: CDSResponseStatusEvent\n requestorMode: true\n requestorPeer: CDSReplyConsumer\n requestorTimeout: 500",
+ "raw": "tosca_definitions_version: tosca_simple_yaml_1_1_0\ndata_types:\n onap.datatypes.ToscaConceptIdentifier:\n derived_from: tosca.datatypes.Root\n properties:\n name:\n type: string\n required: true\n version:\n type: string\n required: true\n org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceControlLoopElementConsulInfo:\n name: org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceControlLoopElementConsulInfo\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n properties:\n consulUrl:\n name: consulUrl\n type: string\n typeVersion: 0.0.0\n description: Consul url for this entry\n required: true\n consul_body:\n name: consulBody\n type: string\n typeVersion: 0.0.0\n description: Body of Consul entry\n required: true\n onap.datatype.acm.Target:\n derived_from: tosca.datatypes.Root\n description: Definition for a entity in A&AI to perform a automation composition operation on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - PNF\n entityIds:\n type: map\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n entry_schema:\n type: string\n onap.datatype.acm.Actor:\n derived_from: tosca.datatypes.Root\n description: An actor/operation/target definition\n properties:\n actor:\n type: string\n description: The actor performing the operation.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n type: string\n description: The operation the actor is performing.\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation\n required: true\n target:\n type: onap.datatype.acm.Target\n description: The resource the operation should be performed on.\n required: true\n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy to the actor\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n entry_schema:\n type: string\n onap.datatype.acm.Operation:\n derived_from: tosca.datatypes.Root\n description: An operation supported by an actor\n properties:\n id:\n type: string\n description: Unique identifier for the operation\n required: true\n description:\n type: string\n description: A user-friendly description of the intent for the operation\n required: false\n operation:\n type: onap.datatype.acm.Actor\n description: The definition of the operation to be performed.\n required: true\n timeout:\n type: integer\n description: The amount of time for the actor to perform the operation.\n required: true\n retries:\n type: integer\n description: The number of retries the actor should attempt to perform the operation.\n required: true\n default: 0\n success:\n type: string\n description: Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.\n required: false\n default: final_success\n failure:\n type: string\n description: Points to the operation to invoke on Actor operation failure.\n required: false\n default: final_failure\n failure_timeout:\n type: string\n description: Points to the operation to invoke when the time out for the operation occurs.\n required: false\n default: final_failure_timeout\n failure_retries:\n type: string\n description: Points to the operation to invoke when the current operation has exceeded its max retries.\n required: false\n default: final_failure_retries\n failure_exception:\n type: string\n description: Points to the operation to invoke when the current operation causes an exception.\n required: false\n default: final_failure_exception\n failure_guard:\n type: string\n description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard\n onap.datatypes.monitoring.managedObjectDNsBasic:\n constraints: []\n properties:\n DN:\n name: DN\n type: string\n typeVersion: 0.0.0\n description: Managed object distinguished name\n required: true\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.managedObjectDNsBasic\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.managedObjectDNsBasics:\n constraints: []\n properties:\n managedObjectDNsBasic:\n name: managedObjectDNsBasic\n type: map\n typeVersion: 0.0.0\n description: Managed object distinguished name object\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.managedObjectDNsBasic\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.managedObjectDNsBasics\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementGroup:\n constraints: []\n properties:\n measurementTypes:\n name: measurementTypes\n type: list\n typeVersion: 0.0.0\n description: List of measurement types\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementTypes\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n managedObjectDNsBasic:\n name: managedObjectDNsBasic\n type: list\n typeVersion: 0.0.0\n description: List of managed object distinguished names\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.managedObjectDNsBasics\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementGroup\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementGroups:\n constraints: []\n properties:\n measurementGroup:\n name: measurementGroup\n type: map\n typeVersion: 0.0.0\n description: Measurement Group\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementGroup\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementGroups\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementType:\n constraints: []\n properties:\n measurementType:\n name: measurementType\n type: string\n typeVersion: 0.0.0\n description: Measurement type\n required: true\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementType\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementTypes:\n constraints: []\n properties:\n measurementType:\n name: measurementType\n type: map\n typeVersion: 0.0.0\n description: Measurement type object\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementType\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementTypes\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.nfFilter:\n constraints: []\n properties:\n modelNames:\n name: modelNames\n type: list\n typeVersion: 0.0.0\n description: List of model names\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n modelInvariantIDs:\n name: modelInvariantIDs\n type: list\n typeVersion: 0.0.0\n description: List of model invariant IDs\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n modelVersionIDs:\n name: modelVersionIDs\n type: list\n typeVersion: 0.0.0\n description: List of model version IDs\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n nfNames:\n name: nfNames\n type: list\n typeVersion: 0.0.0\n description: List of network functions\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.nfFilter\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.subscription:\n constraints: []\n properties:\n measurementGroups:\n name: measurementGroups\n type: list\n typeVersion: 0.0.0\n description: Measurement Groups\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementGroups\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n fileBasedGP:\n name: fileBasedGP\n type: integer\n typeVersion: 0.0.0\n description: File based granularity period\n required: true\n constraints: []\n metadata: {}\n fileLocation:\n name: fileLocation\n type: string\n typeVersion: 0.0.0\n description: ROP file location\n required: true\n constraints: []\n metadata: {}\n subscriptionName:\n name: subscriptionName\n type: string\n typeVersion: 0.0.0\n description: Name of the subscription\n required: true\n constraints: []\n metadata: {}\n administrativeState:\n name: administrativeState\n type: string\n typeVersion: 0.0.0\n description: State of the subscription\n required: true\n constraints:\n - valid_values:\n - LOCKED\n - UNLOCKED\n metadata: {}\n nfFilter:\n name: nfFilter\n type: map\n typeVersion: 0.0.0\n description: Network function filter\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.nfFilter\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.subscription\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n description: a base policy type for all policies that govern monitoring provisioning\n version: 1.0.0\n name: onap.policies.Monitoring\n onap.policies.Sirisha:\n derived_from: tosca.policies.Root\n description: a base policy type for all policies that govern monitoring provisioning\n version: 1.0.0\n name: onap.policies.Sirisha\n onap.policies.monitoring.dcae-pm-subscription-handler:\n properties:\n pmsh_policy:\n name: pmsh_policy\n type: onap.datatypes.monitoring.subscription\n typeVersion: 0.0.0\n description: PMSH Policy JSON\n required: false\n constraints: []\n metadata: {}\n name: onap.policies.monitoring.dcae-pm-subscription-handler\n version: 1.0.0\n derived_from: onap.policies.Monitoring\n metadata: {}\n onap.policies.acm.operational.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n name: onap.policies.acm.operational.Common\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n properties:\n id:\n type: string\n description: The unique automation composition id.\n required: true\n timeout:\n type: integer\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n abatement:\n type: boolean\n description: Whether an abatement event message will be expected for the automation composition from DCAE.\n required: true\n default: false\n trigger:\n type: string\n description: Initial operation to execute upon receiving an Onset event message for the Control Loop.\n required: true\n operations:\n type: list\n description: List of operations to be performed when Control Loop is triggered.\n required: true\n entry_schema:\n type: onap.datatype.acm.Operation\n onap.policies.acm.operational.common.Apex:\n derived_from: onap.policies.acm.operational.Common\n type_version: 1.0.0\n version: 1.0.0\n name: onap.policies.acm.operational.common.Apex\n description: Operational policies for Apex PDP\n properties:\n engineServiceParameters:\n type: string\n description: The engine parameters like name, instanceCount, policy implementation, parameters etc.\n required: true\n eventInputParameters:\n type: string\n description: The event input parameters.\n required: true\n eventOutputParameters:\n type: string\n description: The event output parameters.\n required: true\n javaProperties:\n type: string\n description: Name/value pairs of properties to be set for APEX if needed.\n required: false\nnode_types:\n org.onap.policy.clamp.acm.Participant:\n version: 1.0.1\n derived_from: tosca.nodetypes.Root\n properties:\n provider:\n type: string\n requred: false\n org.onap.policy.clamp.acm.ControlLoopElement:\n version: 1.0.1\n derived_from: tosca.nodetypes.Root\n properties:\n provider:\n type: string\n required: false\n metadata:\n common: true\n description: Specifies the organization that provides the automation composition element\n participantType:\n type: onap.datatypes.ToscaConceptIdentifier\n required: true\n metadata:\n common: true\n description: The identity of the participant type that hosts this type of Control Loop Element\n startPhase:\n type: integer\n required: false\n constraints:\n - greater-or-equal: 0\n metadata:\n common: true\n description: A value indicating the start phase in which this automation composition element will be started, the\n first start phase is zero. Control Loop Elements are started in their start_phase order and stopped\n in reverse start phase order. Control Loop Elements with the same start phase are started and\n stopped simultaneously\n uninitializedToPassiveTimeout:\n type: integer\n required: false\n constraints:\n - greater-or-equal: 0\n default: 60\n metadata:\n common: true\n description: The maximum time in seconds to wait for a state chage from uninitialized to passive\n passiveToRunningTimeout:\n type: integer\n required: false\n constraints:\n - greater-or-equal: 0\n default: 60\n metadata:\n common: true\n description: The maximum time in seconds to wait for a state chage from passive to running\n runningToPassiveTimeout:\n type: integer\n required: false\n constraints:\n - greater-or-equal: 0\n default: 60\n metadata:\n common: true\n description: The maximum time in seconds to wait for a state chage from running to passive\n passiveToUninitializedTimeout:\n type: integer\n required: false\n constraints:\n - greater-or-equal: 0\n default: 60\n metadata:\n common: true\n description: The maximum time in seconds to wait for a state chage from passive to uninitialized\n\n org.onap.policy.clamp.acm.ControlLoop:\n version: 1.0.1\n derived_from: tosca.nodetypes.Root\n properties:\n provider:\n type: string\n requred: false\n elements:\n type: list\n required: true\n entry_schema:\n type: onap.datatypes.ToscaConceptIdentifier\n org.onap.policy.clamp.acm.DCAEMicroserviceControlLoopElement:\n version: 1.0.1\n derived_from: org.onap.policy.clamp.acm.ControlLoopElement\n properties:\n dcae_blueprint_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: false\n dcae_blueprint:\n type: onap.dcae.cloudify_blueprint\n requred: false\n consul_info:\n type: list\n required: false\n entry_schema:\n type: org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceControlLoopElementConsulInfo\n org.onap.policy.clamp.acm.PolicyControlLoopElement:\n version: 1.0.1\n derived_from: org.onap.policy.clamp.acm.ControlLoopElement\n properties:\n policy_type_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: true\n policy_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: false\n org.onap.policy.clamp.acm.CDSControlLoopElement:\n version: 1.0.1\n derived_from: org.onap.policy.clamp.acm.ControlLoopElement\n properties:\n cds_blueprint_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: true\ntopology_template:\n inputs:\n pmsh_monitoring_policy:\n type: onap.datatypes.ToscaConceptIdentifier\n description: The ID of the PMSH monitoring policy to use\n default:\n name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n version: 1.0.0\n pmsh_operational_policy:\n type: onap.datatypes.ToscaConceptIdentifier\n description: The ID of the PMSH operational policy to use\n default:\n name: operational.apex.pmcontrol\n version: 1.0.0\n node_templates:\n org.onap.dcae.acm.DCAEMicroserviceControlLoopParticipant:\n version: 2.3.4\n type: org.onap.policy.clamp.acm.Participant\n type_version: 1.0.1\n description: Participant for DCAE microservices\n properties:\n provider: ONAP\n org.onap.policy.acm.PolicyControlLoopParticipant:\n version: 2.3.1\n type: org.onap.policy.clamp.acm.Participant\n type_version: 1.0.1\n description: Participant for DCAE microservices\n properties:\n provider: ONAP\n org.onap.domain.pmsh.PMSH_DCAEMicroservice:\n version: 1.2.3\n type: org.onap.policy.clamp.acm.DCAEMicroserviceControlLoopElement\n type_version: 1.0.0\n description: Control loop element for the DCAE microservice for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n participantType:\n name: org.onap.dcae.acm.DCAEMicroserviceControlLoopParticipant\n version: 2.3.4\n startPhase: 0\n dcae_blueprint:\n tosca_definitions_version: cloudify_dsl_1_3\n imports:\n - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\n - plugin:k8splugin?version=3.7.0\n - plugin:pgaas?version=1.3.0\n - plugin:clamppolicyplugin?version=1.1.0\n inputs:\n tag_version:\n type: string\n description: Docker image to be used\n default: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pmsh:1.1.2\n replicas:\n type: integer\n description: Number of instances\n default: 1\n operational_policy_name:\n type: string\n default: operational.apex.pmcontrol\n control_loop_name:\n type: string\n default: pmsh-control-loop\n pmsh_publish_topic_name:\n type: string\n default: unauthenticated.DCAE_CL_OUTPUT\n policy_feedback_topic_name:\n type: string\n default: unauthenticated.PMSH_CL_INPUT\n aai_notification_topic_name:\n type: string\n default: AAI-EVENT\n publisher_client_role:\n type: string\n description: Client role to request secure access to topic\n default: org.onap.dcae.pmPublisher\n subscriber_client_role:\n type: string\n description: Client role to request secure access to topic\n default: org.onap.dcae.pmSubscriber\n dcae_location:\n type: string\n description: DCAE location for the subscriber, used to set up routing\n default: san-francisco\n cpu_limit:\n type: string\n default: 1000m\n cpu_request:\n type: string\n default: 1000m\n memory_limit:\n type: string\n default: 1024Mi\n memory_request:\n type: string\n default: 1024Mi\n pgaas_cluster_name:\n type: string\n default: dcae-pg-primary.onap\n enable_tls:\n type: boolean\n default: true\n protocol:\n type: string\n description: PMSH protocol. If enable_tls is false, set to http\n default: https\n policy_model_id:\n type: string\n default: onap.policies.monitoring.dcae-pm-subscription-handler\n policy_id:\n type: string\n default: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n node_templates:\n pgaasvm:\n type: dcae.nodes.pgaas.database\n properties:\n writerfqdn:\n get_input: pgaas_cluster_name\n name: pmsh\n pmsh:\n type: dcae.nodes.ContainerizedServiceComponentUsingDmaap\n interfaces:\n cloudify.interfaces.lifecycle:\n create:\n inputs:\n ports:\n - '8443:0'\n envs:\n PMSH_PG_URL:\n get_attribute:\n - pgaasvm\n - admin\n - host\n PMSH_PG_PASSWORD:\n get_attribute:\n - pgaasvm\n - admin\n - password\n PMSH_PG_USERNAME:\n get_attribute:\n - pgaasvm\n - admin\n - user\n PMSH_DB_NAME:\n get_attribute:\n - pgaasvm\n - admin\n - database\n relationships:\n - target: pmsh-policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: dcae-pmsh\n service_component_name_override: dcae-pmsh\n application_config:\n enable_tls:\n get_input: enable_tls\n aaf_identity: dcae@dcae.onap.org\n aaf_password: demo123456!\n operational_policy_name:\n get_input: operational_policy_name\n control_loop_name:\n get_input: control_loop_name\n cert_path: /opt/app/pmsh/etc/certs/cert.pem\n key_path: /opt/app/pmsh/etc/certs/key.pem\n ca_cert_path: /opt/app/pmsh/etc/certs/cacert.pem\n streams_publishes:\n policy_pm_publisher:\n type: message_router\n dmaap_info:\n topic_url:\n concat:\n - http://message-router:3904/events/\n - get_input: pmsh_publish_topic_name\n streams_subscribes:\n policy_pm_subscriber:\n type: message_router\n dmaap_info:\n topic_url:\n concat:\n - http://message-router:3904/events/\n - get_input: policy_feedback_topic_name\n aai_subscriber:\n type: message_router\n dmaap_info:\n topic_url:\n concat:\n - http://message-router:3904/events/\n - get_input: aai_notification_topic_name\n resource_config:\n limits:\n cpu:\n get_input: cpu_limit\n memory:\n get_input: memory_limit\n requests:\n cpu:\n get_input: cpu_request\n memory:\n get_input: memory_request\n docker_config:\n healthcheck:\n endpoint: /healthcheck\n interval: 15s\n timeout: 1s\n type:\n get_input: protocol\n image:\n get_input: tag_version\n replicas:\n get_input: replicas\n log_info:\n log_directory: /var/log/ONAP/dcaegen2/services/pmsh\n tls_info:\n cert_directory: /opt/app/pmsh/etc/certs\n use_tls:\n get_input: enable_tls\n pmsh-policy:\n type: clamp.nodes.policy\n properties:\n policy_model_id:\n get_input: policy_model_id\n policy_id:\n get_input: policy_id\n consul_info:\n - consulUrl: http://consul:31321/v1/kv/dcae-pmsh:policy\n consulBody:\n subscription:\n subscriptionName: subscriptiona\n administrativeState: UNLOCKED\n fileBasedGP: 15\n fileLocation: /pm/pm.xml\n nfFilter:\n nfNames:\n - ^pnf1.*\n modelInvariantIDs:\n - 5845y423-g654-6fju-po78-8n53154532k6\n - 7129e420-d396-4efb-af02-6b83499b12f8\n modelVersionIDs:\n - e80a6ae3-cafd-4d24-850d-e14c084a5ca9\n measurementGroups:\n - measurementGroup:\n measurementTypes:\n - measurementType: countera\n - measurementType: counterb\n managedObjectDNsBasic:\n - DN: dna\n - DN: dnb\n - measurementGroup:\n measurementTypes:\n - measurementType: counterc\n - measurementType: counterd\n managedObjectDNsBasic:\n - DN: dnc\n - DN: dnd\n org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:\n version: 1.2.3\n type: org.onap.policy.clamp.acm.PolicyControlLoopElement\n type_version: 1.0.0\n description: Control loop element for the monitoring policy for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n participantType:\n name: org.onap.policy.acm.PolicyControlLoopParticipant\n version: 2.3.1\n startPhase: 0\n policy_type_id:\n name: onap.policies.monitoring.pm-subscription-handler\n version: 1.0.0\n policy_id:\n get_input: pmsh_monitoring_policy\n org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:\n version: 1.2.3\n type: org.onap.policy.clamp.acm.PolicyControlLoopElement\n type_version: 1.0.0\n description: Control loop element for the operational policy for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n participantType:\n name: org.onap.policy.acm.PolicyControlLoopParticipant\n version: 2.3.1\n startPhase: 0\n policy_type_id:\n name: onap.policies.operational.pm-subscription-handler\n version: 1.0.0\n policy_id:\n get_input: pmsh_operational_policy\n org.onap.domain.pmsh.PMSHControlLoopDefinition:\n version: 1.2.3\n type: org.onap.policy.clamp.acm.ControlLoop\n type_version: 1.0.0\n description: Control loop for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n elements:\n - name: org.onap.domain.pmsh.PMSH_DCAEMicroservice\n version: 1.2.3\n - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement\n version: 1.2.3\n - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement\n version: 1.2.3\n policies:\n - MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test:\n type: onap.policies.monitoring.dcae-pm-subscription-handler\n type_version: 1.0.0\n name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n version: 1.0.0\n metadata:\n policy-id: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n policy-version: 1.0.0\n properties:\n pmsh_policy:\n fileBasedGP: 15\n fileLocation: /pm/pm.xml\n subscriptionName: subscriptiona\n administrativeState: UNLOCKED\n nfFilter:\n onap.datatypes.monitoring.nfFilter:\n modelVersionIDs:\n - e80a6ae3-cafd-4d24-850d-e14c084a5ca9\n modelInvariantIDs:\n - 5845y423-g654-6fju-po78-8n53154532k6\n - 7129e420-d396-4efb-af02-6b83499b12f8\n modelNames: []\n nfNames:\n - '\"^pnf1.*\"'\n measurementGroups:\n - measurementGroup:\n onap.datatypes.monitoring.measurementGroup:\n measurementTypes:\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: countera\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: counterb\n managedObjectDNsBasic:\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dna\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dnb\n - measurementGroup:\n onap.datatypes.monitoring.measurementGroup:\n measurementTypes:\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: counterc\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: counterd\n managedObjectDNsBasic:\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dnc\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dnd\n - operational.apex.pmcontrol:\n type: onap.policies.acm.operational.common.Apex\n type_version: 1.0.0\n version: 1.0.0\n metadata:\n policy-id: operational.apex.pmcontrol\n policy-version: 1\n properties:\n engineServiceParameters:\n name: MyApexEngine\n version: 0.0.1\n id: 45\n instanceCount: 2\n deploymentPort: 12561\n policy_type_impl:\n apexPolicyModel:\n key:\n name: PMControlPolicy\n version: 0.0.1\n keyInformation:\n key:\n name: PMControlPolicy_KeyInfo\n version: 0.0.1\n keyInfoMap:\n entry:\n - key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n value:\n key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n UUID: 6e5fa19b-14df-37e3-a4ae-8c537e861a82\n description: Generated description for concept referred to by key \"CDSActionIdentifiersType:0.0.1\"\n - key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n UUID: 14b29e38-ac75-3273-aa4e-8583c0aa7dad\n description: Generated description for concept referred to by key \"CDSCreateResponseEvent:0.0.1\"\n - key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n UUID: 04573f8f-e772-30a5-b1d9-d7318d4a1e13\n description: Generated description for concept referred to by key \"CDSCreateResponsePayloadType:0.0.1\"\n - key:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n UUID: e126c965-fc09-3bfe-8f55-70f380a4a49c\n description: Generated description for concept referred to by key \"CDSCreateResponsePolicy:0.0.1\"\n - key:\n name: CDSCreateResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseTask\n version: 0.0.1\n UUID: 6165ee82-afd2-3aab-a517-f00b3f2461d2\n description: Generated description for concept referred to by key \"CDSCreateResponseTask:0.0.1\"\n - key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n UUID: 8350ac5e-c157-38b9-9614-a0f93a830e60\n description: Generated description for concept referred to by key \"CDSCreateSubscriptionPayloadType:0.0.1\"\n - key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n UUID: cfa325ba-226b-3a31-9183-ec43e2b6e9a2\n description: Generated description for concept referred to by key \"CDSCreateSubscriptionRequestEvent:0.0.1\"\n - key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n UUID: 8be9c0fa-7437-3841-aff2-b3cec6ae3bd8\n description: Generated description for concept referred to by key \"CDSDeleteResponseEvent:0.0.1\"\n - key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n UUID: 3fbfe0c9-152e-34d3-a504-09cd13c058d0\n description: Generated description for concept referred to by key \"CDSDeleteResponsePayloadType:0.0.1\"\n - key:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n UUID: a780251c-edd5-3132-b865-04313246b43c\n description: Generated description for concept referred to by key \"CDSDeleteResponsePolicy:0.0.1\"\n - key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n UUID: afce4555-3aa3-3521-a7d8-ee8cdf0d3efc\n description: Generated description for concept referred to by key \"CDSDeleteResponseTask:0.0.1\"\n - key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n UUID: 12658406-9147-3c9d-a38c-5ad5e30b092b\n description: Generated description for concept referred to by key \"CDSDeleteSubscriptionPayloadType:0.0.1\"\n - key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n UUID: 24380c95-9289-36e6-8cbf-0edefa15ccd9\n description: Generated description for concept referred to by key \"CDSDeleteSubscriptionRequestEvent:0.0.1\"\n - key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n UUID: 35590ac0-062c-39f1-8786-b4ff716e30b1\n description: Generated description for concept referred to by key \"CDSRequestCommonHeaderType:0.0.1\"\n - key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n UUID: dd7e1805-885a-350b-aaf9-ed541321ae3c\n description: Generated description for concept referred to by key \"CDSResponseCommonHeaderType:0.0.1\"\n - key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n UUID: 7986e21b-32f7-302e-9554-31f21b673493\n description: Generated description for concept referred to by key \"CDSResponseStatusEvent:0.0.1\"\n - key:\n name: CDSResponseStatusType\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusType\n version: 0.0.1\n UUID: 92b8a2cf-344e-3ce1-8cc0-2b7d3cb695fa\n description: Generated description for concept referred to by key \"CDSResponseStatusType:0.0.1\"\n - key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n UUID: 92162397-1a8e-3a3f-a469-d2af7700af4a\n description: Generated description for concept referred to by key \"CreateSubscriptionPayloadEvent:0.0.1\"\n - key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n UUID: bc0c69f0-52ed-38ea-b468-ae4a6fd1730d\n description: Generated description for concept referred to by key \"CreateSubscriptionPayloadTask:0.0.1\"\n - key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n UUID: 89cb75e9-f06c-30d3-b4ff-698d45f63869\n description: Generated description for concept referred to by key \"CreateSubscriptionRequestTask:0.0.1\"\n - key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n UUID: 994fa441-04ab-33bb-832d-1cd12ab5d074\n description: Generated description for concept referred to by key \"DeleteSubscriptionPayloadEvent:0.0.1\"\n - key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n UUID: 0f519117-5fea-3e4b-941f-8f778100465f\n description: Generated description for concept referred to by key \"DeleteSubscriptionPayloadTask:0.0.1\"\n - key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n UUID: acb772fe-d442-39e3-98f9-b1080caf4150\n description: Generated description for concept referred to by key \"DeleteSubscriptionRequestTask:0.0.1\"\n - key:\n name: MRResponseEvent\n version: 0.0.1\n value:\n key:\n name: MRResponseEvent\n version: 0.0.1\n UUID: 13c747a3-6bae-3bcf-9c80-b152e01dc194\n description: Generated description for concept referred to by key \"MRResponseEvent:0.0.1\"\n - key:\n name: PMControlPolicy\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy\n version: 0.0.1\n UUID: acf1e55c-7bc5-3bd5-975a-0ca54afcd8a4\n description: Generated description for concept referred to by key \"PMControlPolicy:0.0.1\"\n - key:\n name: PMControlPolicy_Albums\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Albums\n version: 0.0.1\n UUID: b38ad204-c2c8-32f4-9b5a-dda0aeb0145b\n description: Generated description for concept referred to by key \"PMControlPolicy_Albums:0.0.1\"\n - key:\n name: PMControlPolicy_Events\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Events\n version: 0.0.1\n UUID: be3871a0-c42a-3113-a066-82d192840eca\n description: Generated description for concept referred to by key \"PMControlPolicy_Events:0.0.1\"\n - key:\n name: PMControlPolicy_KeyInfo\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_KeyInfo\n version: 0.0.1\n UUID: ced37634-28a4-3178-b7f6-2980794927b0\n description: Generated description for concept referred to by key \"PMControlPolicy_KeyInfo:0.0.1\"\n - key:\n name: PMControlPolicy_Policies\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Policies\n version: 0.0.1\n UUID: be3d180d-ef9c-3a75-8e9c-84271a038bed\n description: Generated description for concept referred to by key \"PMControlPolicy_Policies:0.0.1\"\n - key:\n name: PMControlPolicy_Schemas\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Schemas\n version: 0.0.1\n UUID: e61973f1-189c-39e5-82f6-0d3afe298a20\n description: Generated description for concept referred to by key \"PMControlPolicy_Schemas:0.0.1\"\n - key:\n name: PMControlPolicy_Tasks\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Tasks\n version: 0.0.1\n UUID: 5658adb3-2962-30a3-a241-fae75bb8eb4a\n description: Generated description for concept referred to by key \"PMControlPolicy_Tasks:0.0.1\"\n - key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n UUID: c2bd6f0d-6854-317a-9be2-97c08338428c\n description: Generated description for concept referred to by key \"PMSubscriptionAlbum:0.0.1\"\n - key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n UUID: 992b7819-9f69-3aa0-bb0f-6e45ea15ce05\n description: Generated description for concept referred to by key \"PMSubscriptionOutputEvent:0.0.1\"\n - key:\n name: PMSubscriptionType\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionType\n version: 0.0.1\n UUID: 73c1c397-4fc3-357f-93b6-a8ad707fbaae\n description: Generated description for concept referred to by key \"PMSubscriptionType:0.0.1\"\n - key:\n name: ReceiveEventPolicy\n version: 0.0.1\n value:\n key:\n name: ReceiveEventPolicy\n version: 0.0.1\n UUID: 568b7345-9de1-36d3-b6a3-9b857e6809a1\n description: Generated description for concept referred to by key \"ReceiveEventPolicy:0.0.1\"\n - key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n value:\n key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n UUID: f596afc8-100c-35eb-92c8-352355ea457d\n description: Generated description for concept referred to by key \"ReceiveSubscriptionTask:0.0.1\"\n - key:\n name: SimpleIntType\n version: 0.0.1\n value:\n key:\n name: SimpleIntType\n version: 0.0.1\n UUID: 153791fd-ae0a-36a7-88a5-309a7936415d\n description: Generated description for concept referred to by key \"SimpleIntType:0.0.1\"\n - key:\n name: SimpleStringType\n version: 0.0.1\n value:\n key:\n name: SimpleStringType\n version: 0.0.1\n UUID: 8a4957cf-9493-3a76-8c22-a208e23259af\n description: Generated description for concept referred to by key \"SimpleStringType:0.0.1\"\n - key:\n name: SubscriptionStatusType\n version: 0.0.1\n value:\n key:\n name: SubscriptionStatusType\n version: 0.0.1\n UUID: 597643b1-9db1-31ce-85d0-e1c63c43b30b\n description: Generated description for concept referred to by key \"SubscriptionStatusType:0.0.1\"\n - key:\n name: SubscriptionType\n version: 0.0.1\n value:\n key:\n name: SubscriptionType\n version: 0.0.1\n UUID: 184547bb-7d64-3cb2-a273-d7185102c5ce\n description: Generated description for concept referred to by key \"SubscriptionType:0.0.1\"\n - key:\n name: UUIDType\n version: 0.0.1\n value:\n key:\n name: UUIDType\n version: 0.0.1\n UUID: 6a8cc68e-dfc8-3403-9c6d-071c886b319c\n description: Generated description for concept referred to by key \"UUIDType:0.0.1\"\n - key:\n name: pmsh-operational-policy\n version: 0.0.1\n value:\n key:\n name: pmsh-operational-policy\n version: 0.0.1\n UUID: fdf2c9ff-6422-3ea6-b6b6-49b12116265d\n description: Generated description for concept referred to by key \"pmsh-operational-policy:0.0.1\"\n policies:\n key:\n name: PMControlPolicy_Policies\n version: 0.0.1\n policyMap:\n entry:\n - key:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n value:\n policyKey:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n template: Freestyle\n state:\n entry:\n - key: CDSCreateResponseState\n value:\n stateKey:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CDSCreateResponseState\n trigger:\n name: CDSCreateResponseEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: ResponseOutput\n value:\n key:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSCreateResponseState\n localName: ResponseOutput\n outgoingEvent:\n name: CDSResponseStatusEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference: []\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CDSCreateResponseTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CDSCreateResponseTask\n version: 0.0.1\n value:\n key:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSCreateResponseState\n localName: CDSCreateResponsePolicy\n outputType: DIRECT\n output:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSCreateResponseState\n localName: ResponseOutput\n firstState: CDSCreateResponseState\n - key:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n value:\n policyKey:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n template: Freestyle\n state:\n entry:\n - key: CDSDeleteResponseState\n value:\n stateKey:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CDSDeleteResponseState\n trigger:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: ResponseOutput\n value:\n key:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSDeleteResponseState\n localName: ResponseOutput\n outgoingEvent:\n name: CDSResponseStatusEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference: []\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CDSDeleteResponseTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n value:\n key:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSDeleteResponseState\n localName: CDSDeleteResponsePolicy\n outputType: DIRECT\n output:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSDeleteResponseState\n localName: ResponseOutput\n firstState: CDSDeleteResponseState\n - key:\n name: ReceiveEventPolicy\n version: 0.0.1\n value:\n policyKey:\n name: ReceiveEventPolicy\n version: 0.0.1\n template: Freestyle\n state:\n entry:\n - key: CreateOrDeleteState\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateOrDeleteState\n trigger:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: CreateSubscriptionPayload\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: CreateSubscriptionPayload\n outgoingEvent:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n nextState:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateSubscription\n - key: DeleteSubscriptionPayload\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: DeleteSubscriptionPayload\n outgoingEvent:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n nextState:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: DeleteSubscription\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: TaskSelectionLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n var changeType = pmSubscriptionInfo.get(\"changeType\").toString()\n\n executor.logger.info(\"Change Type is \" + changeType)\n\n if (\"CREATE\".equals(changeType)) {\n executor.logger.info(\"Choosing to create a subscription\")\n executor.subject.getTaskKey(\"CreateSubscriptionPayloadTask\").copyTo(executor.selectedTask);\n }\n else if (\"DELETE\".equals(changeType)) {\n executor.logger.info(\"Choosing to delete a subscription\")\n executor.subject.getTaskKey(\"DeleteSubscriptionPayloadTask\").copyTo(executor.selectedTask);\n }\n\n //var returnValue = executor.isTrue;\n true;\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: CreateSubscriptionPayload\n - key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: DeleteSubscriptionPayload\n - key: CreateSubscription\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateSubscription\n trigger:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: IssueCreateSubscriptionRequestOutput\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateSubscription\n localName: IssueCreateSubscriptionRequestOutput\n outgoingEvent:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateSubscription\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateSubscription\n localName: IssueCreateSubscriptionRequestOutput\n - key: DeleteSubscription\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: DeleteSubscription\n trigger:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: IssueDeleteSubscriptionRequestOutput\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: DeleteSubscription\n localName: IssueDeleteSubscriptionRequestOutput\n outgoingEvent:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: DeleteSubscription\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: DeleteSubscription\n localName: IssueDeleteSubscriptionRequestOutput\n - key: ReceiveSubscriptionState\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: ReceiveSubscriptionState\n trigger:\n name: pmsh-operational-policy\n version: 0.0.1\n stateOutputs:\n entry:\n - key: ReceivePMSubscriptionOutput\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: ReceiveSubscriptionState\n localName: ReceivePMSubscriptionOutput\n outgoingEvent:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n nextState:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateOrDeleteState\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: ReceiveSubscriptionState\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: ReceiveSubscriptionState\n localName: ReceivePMSubscriptionOutput\n firstState: ReceiveSubscriptionState\n tasks:\n key:\n name: PMControlPolicy_Tasks\n version: 0.0.1\n taskMap:\n entry:\n - key:\n name: CDSCreateResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseTask\n version: 0.0.1\n inputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: SubscriptionStatusType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var commonHeader = executor.inFields.get(\"commonHeader\")\n var response = executor.inFields.get(\"payload\")\n var albumID = commonHeader.get(\"requestId\")\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(albumID.toString());\n var responseStatus = executor.subject.getOutFieldSchemaHelper(\"status\").createNewInstance();\n\n responseStatus.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n responseStatus.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n responseStatus.put(\"changeType\", pmSubscriptionInfo.get(\"changeType\"))\n\n var status = response.get(pmSubscriptionInfo.get(\"changeType\").toLowerCase() + \"_DasH_subscription_DasH_response\").get(\"odl_DasH_response\").get(\"status\")\n\n executor.logger.info(\"RESPONSE STATUS = \" + status)\n\n if(status == \"success\") {\n responseStatus.put(\"message\", \"success\")\n } else {\n responseStatus.put(\"message\", \"failed\")\n }\n\n executor.outFields.put(\"status\", responseStatus)\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n inputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: SubscriptionStatusType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var commonHeader = executor.inFields.get(\"commonHeader\")\n var response = executor.inFields.get(\"payload\")\n var albumID = commonHeader.get(\"requestId\")\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(albumID.toString());\n var responseStatus = executor.subject.getOutFieldSchemaHelper(\"status\").createNewInstance();\n\n responseStatus.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n responseStatus.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n responseStatus.put(\"changeType\", pmSubscriptionInfo.get(\"changeType\"))\n\n var status = response.get(pmSubscriptionInfo.get(\"changeType\").toLowerCase() + \"_DasH_subscription_DasH_response\").get(\"odl_DasH_response\").get(\"status\")\n\n executor.logger.info(\"RESPONSE STATUS = \" + status)\n\n if(status == \"success\") {\n responseStatus.put(\"message\", \"success\")\n } else {\n responseStatus.put(\"message\", \"failed\")\n }\n\n executor.outFields.put(\"status\", responseStatus)\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n\n var payloadProperties = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(changeType + \"_DasH_subscription_DasH_properties_record\");\n\n payloadProperties.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n payloadProperties.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n payloadProperties.put(\"administrativeState\", pmSubscriptionInfo.get(\"subscription\").get(\"administrativeState\"))\n payloadProperties.put(\"fileBasedGP\", pmSubscriptionInfo.get(\"subscription\").get(\"fileBasedGP\").toString())\n payloadProperties.put(\"fileLocation\", pmSubscriptionInfo.get(\"subscription\").get(\"fileLocation\"))\n payloadProperties.put(\"measurementGroups\", pmSubscriptionInfo.get(\"subscription\").get(\"measurementGroups\"))\n\n var payloadEntry = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(\"CDSRequestPayloadEntry\");\n payloadEntry.put(changeType + \"_DasH_subscription_DasH_properties\", payloadProperties)\n\n var payload = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewInstance();\n payload.put(changeType + \"_DasH_subscription_DasH_request\", payloadEntry);\n\n executor.outFields.put(\"albumID\", executor.inFields.get(\"albumID\"))\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n var blueprintName = pmSubscriptionInfo.get(\"blueprintName\").toLowerCase()\n var blueprintVersion = pmSubscriptionInfo.get(\"blueprintVersion\").toLowerCase()\n var payload = executor.inFields.get(\"payload\")\n var actionName = changeType + \"-subscription\"\n\n var commonHeader = executor.subject.getOutFieldSchemaHelper(\"commonHeader\").createNewInstance();\n commonHeader.put(\"originatorId\", \"sdnc\");\n commonHeader.put(\"requestId\", executor.inFields.get(\"albumID\").toString());\n commonHeader.put(\"subRequestId\", \"sub-123456-1000\");\n\n var actionIdentifiers = executor.subject.getOutFieldSchemaHelper(\"actionIdentifiers\").createNewInstance();\n actionIdentifiers.put(\"actionName\", actionName);\n actionIdentifiers.put(\"blueprintName\", blueprintName);\n actionIdentifiers.put(\"blueprintVersion\", blueprintVersion);\n actionIdentifiers.put(\"mode\", \"sync\");\n\n executor.outFields.put(\"commonHeader\", commonHeader);\n executor.outFields.put(\"actionIdentifiers\", actionIdentifiers);\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n\n var payloadProperties = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(changeType + \"_DasH_subscription_DasH_properties_record\");\n\n payloadProperties.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n payloadProperties.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n payloadProperties.put(\"administrativeState\", pmSubscriptionInfo.get(\"subscription\").get(\"administrativeState\"))\n payloadProperties.put(\"fileBasedGP\", pmSubscriptionInfo.get(\"subscription\").get(\"fileBasedGP\").toString())\n payloadProperties.put(\"fileLocation\", pmSubscriptionInfo.get(\"subscription\").get(\"fileLocation\"))\n payloadProperties.put(\"measurementGroups\", pmSubscriptionInfo.get(\"subscription\").get(\"measurementGroups\"))\n\n var payloadEntry = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(\"CDSRequestPayloadEntry\");\n payloadEntry.put(changeType + \"_DasH_subscription_DasH_properties\", payloadProperties)\n\n var payload = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewInstance();\n payload.put(changeType + \"_DasH_subscription_DasH_request\", payloadEntry);\n\n executor.outFields.put(\"albumID\", executor.inFields.get(\"albumID\"))\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n var blueprintName = pmSubscriptionInfo.get(\"blueprintName\").toLowerCase()\n var blueprintVersion = pmSubscriptionInfo.get(\"blueprintVersion\").toLowerCase()\n var payload = executor.inFields.get(\"payload\")\n var actionName = changeType + \"-subscription\"\n\n var commonHeader = executor.subject.getOutFieldSchemaHelper(\"commonHeader\").createNewInstance();\n commonHeader.put(\"originatorId\", \"sdnc\");\n commonHeader.put(\"requestId\", executor.inFields.get(\"albumID\").toString());\n commonHeader.put(\"subRequestId\", \"sub-123456-1000\");\n\n var actionIdentifiers = executor.subject.getOutFieldSchemaHelper(\"actionIdentifiers\").createNewInstance();\n actionIdentifiers.put(\"actionName\", actionName);\n actionIdentifiers.put(\"blueprintName\", blueprintName);\n actionIdentifiers.put(\"blueprintVersion\", blueprintVersion);\n actionIdentifiers.put(\"mode\", \"sync\");\n\n executor.outFields.put(\"commonHeader\", commonHeader);\n executor.outFields.put(\"actionIdentifiers\", actionIdentifiers);\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n value:\n key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n inputFields:\n entry:\n - key: blueprintName\n value:\n key: blueprintName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: blueprintVersion\n value:\n key: blueprintVersion\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: changeType\n value:\n key: changeType\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: closedLoopControlName\n value:\n key: closedLoopControlName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: nfName\n value:\n key: nfName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: policyName\n value:\n key: policyName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: subscription\n value:\n key: subscription\n fieldSchemaKey:\n name: SubscriptionType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n var uuidType = java.util.UUID;\n\n executor.logger.info(executor.subject.id);\n\n //albumID will be used to fetch info from our album later\n var albumID = uuidType.randomUUID();\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").getSchemaHelper().createNewInstance();\n var returnValue = true;\n\n if(executor.inFields.get(\"policyName\") != null) {\n executor.logger.info(\"nfName in receive sub event \" + executor.inFields.get(\"nfName\"));\n\n var changeType = executor.inFields.get(\"changeType\")\n var nfName = executor.inFields.get(\"nfName\")\n var policyName = executor.inFields.get(\"policyName\")\n var closedLoopControlName = executor.inFields.get(\"closedLoopControlName\")\n var subscription = executor.inFields.get(\"subscription\")\n var blueprintName = executor.inFields.get(\"blueprintName\")\n var blueprintVersion = executor.inFields.get(\"blueprintVersion\")\n\n pmSubscriptionInfo.put(\"nfName\", executor.inFields.get(\"nfName\"));\n pmSubscriptionInfo.put(\"changeType\", executor.inFields.get(\"changeType\"))\n pmSubscriptionInfo.put(\"policyName\", executor.inFields.get(\"policyName\"))\n pmSubscriptionInfo.put(\"closedLoopControlName\", executor.inFields.get(\"closedLoopControlName\"))\n pmSubscriptionInfo.put(\"subscription\", subscription)\n pmSubscriptionInfo.put(\"blueprintName\", blueprintName)\n pmSubscriptionInfo.put(\"blueprintVersion\", blueprintVersion)\n\n\n executor.getContextAlbum(\"PMSubscriptionAlbum\").put(albumID.toString(), pmSubscriptionInfo);\n\n executor.outFields.put(\"albumID\", albumID)\n } else {\n executor.message = \"Received invalid event\"\n returnValue = false;\n }\n\n returnValue;\n events:\n key:\n name: PMControlPolicy_Events\n version: 0.0.1\n eventMap:\n entry:\n - key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: CDS\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n - key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: CDS\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n - key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: DCAE\n parameter:\n entry:\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: SubscriptionStatusType\n version: 0.0.1\n optional: false\n - key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: MRResponseEvent\n version: 0.0.1\n value:\n key:\n name: MRResponseEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: DCAE\n target: APEX\n parameter:\n entry:\n - key: count\n value:\n key: count\n fieldSchemaKey:\n name: SimpleIntType\n version: 0.0.1\n optional: false\n - key: serverTimeMs\n value:\n key: serverTimeMs\n fieldSchemaKey:\n name: SimpleIntType\n version: 0.0.1\n optional: false\n - key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key:\n name: pmsh-operational-policy\n version: 0.0.1\n value:\n key:\n name: pmsh-operational-policy\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: DCAE\n target: APEX\n parameter:\n entry:\n - key: blueprintName\n value:\n key: blueprintName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: blueprintVersion\n value:\n key: blueprintVersion\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: changeType\n value:\n key: changeType\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: closedLoopControlName\n value:\n key: closedLoopControlName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: nfName\n value:\n key: nfName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: policyName\n value:\n key: policyName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: subscription\n value:\n key: subscription\n fieldSchemaKey:\n name: SubscriptionType\n version: 0.0.1\n optional: false\n albums:\n key:\n name: PMControlPolicy_Albums\n version: 0.0.1\n albums:\n entry:\n - key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n scope: policy\n isWritable: true\n itemSchema:\n name: PMSubscriptionType\n version: 0.0.1\n schemas:\n key:\n name: PMControlPolicy_Schemas\n version: 0.0.1\n schemas:\n entry:\n - key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n value:\n key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ActionIdentifiers_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"actionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"blueprintName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"blueprintVersion\",\n \"type\": \"string\"\n },\n {\n \"name\": \"mode\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"name\": \"CreateResponsePayloadEntry\",\n \"type\": \"record\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"create_DasH_subscription_DasH_response\",\n \"type\": {\n \"name\": \"create_DasH_subscription_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"odl_DasH_response\",\n \"type\": {\n \"name\": \"odl_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"status\",\n \"type\": \"string\"\n }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n - key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"map\",\n \"values\": {\n \"type\": \"record\",\n \"name\": \"CDSRequestPayloadEntry\",\n \"fields\": [\n {\n \"name\": \"create_DasH_subscription_DasH_properties\",\n \"type\": {\n \"name\": \"create_DasH_subscription_DasH_properties_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"administrativeState\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileBasedGP\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileLocation\",\n \"type\": \"string\"\n },\n {\n \"name\": \"measurementGroups\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementGroups_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementGroup\",\n \"type\": {\n \"name\": \"measurementGroup\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementTypes\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementTypes_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementType\",\n \"type\": \"string\"\n }\n ]\n }\n }\n },\n {\n \"name\": \"managedObjectDNsBasic\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"managedObjectDNsBasic_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"DN\",\n \"type\": \"string\"\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n - key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"name\": \"DeleteResponsePayloadEntry\",\n \"type\": \"record\",\n \"namespace\": \"com.acme.avro\",\n \"fields\": [\n {\n \"name\": \"delete_DasH_subscription_DasH_response\",\n \"type\": {\n \"name\": \"delete_DasH_subscription_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"odl_DasH_response\",\n \"type\": {\n \"name\": \"odl_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"status\",\n \"type\": \"string\"\n }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n - key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"map\",\n \"values\": {\n \"type\": \"record\",\n \"name\": \"CDSRequestPayloadEntry\",\n \"fields\": [\n {\n \"name\": \"delete_DasH_subscription_DasH_properties\",\n \"type\": {\n \"name\": \"delete_DasH_subscription_DasH_properties_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"administrativeState\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileBasedGP\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileLocation\",\n \"type\": \"string\"\n },\n {\n \"name\": \"measurementGroups\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementGroups_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementGroup\",\n \"type\": {\n \"name\": \"measurementGroup\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementTypes\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementTypes_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementType\",\n \"type\": \"string\"\n }\n ]\n }\n }\n },\n {\n \"name\": \"managedObjectDNsBasic\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"managedObjectDNsBasic_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"DN\",\n \"type\": \"string\"\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n - key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"RequestCommonHeader_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"originatorId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subRequestId\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ResponseCommonHeader_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"originatorId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subRequestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"timestamp\",\n \"type\": \"string\"\n },\n {\n \"name\": \"flags\",\n \"type\": [\"null\", \"string\"]\n }\n ]\n }\n - key:\n name: CDSResponseStatusType\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ResponseStatus_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"code\",\n \"type\": \"int\"\n },\n {\n \"name\": \"eventType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"timestamp\",\n \"type\": \"string\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: PMSubscriptionType\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: \"{\\n\\t\\\"name\\\": \\\"PMSubscription\\\",\\n\\t\\\"type\\\": \\\"record\\\",\\n\\t\\\"namespace\\\": \\\"\\\n org.onap.policy.apex.onap.pmcontrol\\\",\\n\\t\\\"fields\\\": [\\n {\\n \\\"name\\\": \\\"nfName\\\"\\\n ,\\n \\\"type\\\": \\\"string\\\"\\n },\\n\\t {\\n\\t\\t\\t\\\"name\\\": \\\"changeType\\\",\\n\\t\\t\\t\\\"\\\n type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"closedLoopControlName\\\",\\n\\t\\t\\t\\\"type\\\": \\\"\\\n string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"policyName\\\",\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t\\\n {\\n\\t\\t \\\"name\\\": \\\"blueprintName\\\",\\n\\t\\t \\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t \\\"name\\\"\\\n : \\\"blueprintVersion\\\",\\n\\t\\t \\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"subscription\\\"\\\n ,\\n\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\\"name\\\": \\\"subscription\\\",\\n\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\\n \\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"subscriptionName\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\\n \\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"administrativeState\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\\n \\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"fileBasedGP\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"int\\\"\\\n \\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"fileLocation\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\\n \\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementGroups\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\\n \\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Groups_Type\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\"\\\n : \\\"measurementGroup\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Group_Type\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\\"name\\\": \\\"measurementTypes\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"\\\n name\\\": \\\"Measurement_Types_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementType\\\",\\n\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"managedObjectDNsBasic\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\\"name\\\": \\\"Managed_Object_Dns_Basic_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"DN\\\",\\n\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t]\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t]\\n\\t\\t\\t}\\n\\t\\\n \\t}\\n\\t]\\n}\"\n - key:\n name: SimpleIntType\n version: 0.0.1\n value:\n key:\n name: SimpleIntType\n version: 0.0.1\n schemaFlavour: Java\n schemaDefinition: java.lang.Integer\n - key:\n name: SimpleStringType\n version: 0.0.1\n value:\n key:\n name: SimpleStringType\n version: 0.0.1\n schemaFlavour: Java\n schemaDefinition: java.lang.String\n - key:\n name: SubscriptionStatusType\n version: 0.0.1\n value:\n key:\n name: SubscriptionStatusType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ActivateSubscriptionStatus_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"changeType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: SubscriptionType\n version: 0.0.1\n value:\n key:\n name: SubscriptionType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: \"{\\n\\t\\\"name\\\": \\\"subscription\\\",\\n\\t\\\"type\\\": \\\"record\\\",\\n\\t\\\"fields\\\": [{\\n\\t\\t\\\n \\t\\\"name\\\": \\\"subscriptionName\\\",\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"administrativeState\\\"\\\n ,\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"fileBasedGP\\\",\\n\\t\\t\\t\\\"type\\\": \\\"\\\n int\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"fileLocation\\\",\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t\\\n {\\n\\t\\t\\t\\\"name\\\": \\\"measurementGroups\\\",\\n\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\\n \\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Groups_Type\\\",\\n\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\\n \\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementGroup\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\\n \\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Group_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementTypes\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\"\\\n : {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\\"name\\\": \\\"Measurement_Types_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementType\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n }\\n\\t\\t\\t\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"managedObjectDNsBasic\\\",\\n\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\"\\\n : {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Managed_Object_Dns_Basic_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"\\\n type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"DN\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t]\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t}\\n\\t\\\n \\t\\t}\\n\\t\\t}\\n\\t]\\n}\"\n - key:\n name: UUIDType\n version: 0.0.1\n value:\n key:\n name: UUIDType\n version: 0.0.1\n schemaFlavour: Java\n schemaDefinition: java.util.UUID\n engineParameters:\n executorParameters:\n JAVASCRIPT:\n parameterClassName: org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters\n contextParameters:\n parameterClassName: org.onap.policy.apex.context.parameters.ContextParameters\n schemaParameters:\n Avro:\n parameterClassName: org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters\n Java:\n parameterClassName: org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters\n jsonAdapters:\n Instant:\n adaptedClass: java.time.Instant\n adaptorClass: org.onap.policy.acm.util.Serialization$GsonInstantAdapter\n eventInputParameters:\n DCAEConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTCLIENT\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters\n parameters:\n consumerPollTime: '50'\n url: https://message-router:3905/events/unauthenticated.DCAE_CL_OUTPUT/cg1/sg1\n eventProtocolParameters:\n eventProtocol: JSON\n parameters:\n nameAlias: policyName\n eventName: pmsh-operational-policy\n eventNameFilter: pmsh-operational-policy\n CDSRequestConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n parameters:\n url: http://10.10.10.184:30254/api/v1/execution-service/process\n httpMethod: POST\n restRequestTimeout: 2000\n httpHeaders:\n - - Authorization\n - Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==\n eventProtocolParameters:\n eventProtocol: JSON\n eventName: CDSCreateResponseEvent\n eventNameFilter: CDSCreateResponseEvent\n requestorMode: true\n requestorPeer: CDSRequestProducer\n requestorTimeout: 500\n CDSDeleteRequestConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n parameters:\n url: http://10.10.10.184:30254/api/v1/execution-service/process\n httpMethod: POST\n restRequestTimeout: 2000\n httpHeaders:\n - - Authorization\n - Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==\n eventProtocolParameters:\n eventProtocol: JSON\n eventName: CDSDeleteResponseEvent\n eventNameFilter: CDSDeleteResponseEvent\n requestorMode: true\n requestorPeer: CDSDeleteRequestProducer\n requestorTimeout: 500\n CDSReplyConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n parameters:\n url: https://message-router:3905/events/unauthenticated.PMSH_CL_INPUT\n httpMethod: POST\n restRequestTimeout: 2000\n eventProtocolParameters:\n eventProtocol: JSON\n eventName: MRResponseEvent\n eventNameFilter: MRResponseEvent\n requestorMode: true\n requestorPeer: CDSReplyProducer\n requestorTimeout: 500\n eventOutputParameters:\n logOutputter:\n carrierTechnologyParameters:\n carrierTechnology: FILE\n parameters:\n fileName: /tmp/outputevents.log\n eventProtocolParameters:\n eventProtocol: JSON\n StdOutOutputter:\n carrierTechnologyParameters:\n carrierTechnology: FILE\n parameters:\n standardIo: true\n eventProtocolParameters:\n eventProtocol: JSON\n CDSRequestProducer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n eventProtocolParameters:\n eventProtocol: JSON\n eventNameFilter: CDSCreateSubscriptionRequestEvent\n requestorMode: true\n requestorPeer: CDSRequestConsumer\n requestorTimeout: 500\n CDSDeleteRequestProducer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n eventProtocolParameters:\n eventProtocol: JSON\n eventNameFilter: CDSDeleteSubscriptionRequestEvent\n requestorMode: true\n requestorPeer: CDSDeleteRequestConsumer\n requestorTimeout: 500\n CDSReplyProducer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n eventProtocolParameters:\n eventProtocol: JSON\n eventNameFilter: CDSResponseStatusEvent\n requestorMode: true\n requestorPeer: CDSReplyConsumer\n requestorTimeout: 500",
"options": {
"raw": {
"language": "text"
@@ -51,14 +51,14 @@
}
},
"url": {
- "raw": "localhost:6969/onap/controlloop/v2/commission",
+ "raw": "localhost:6969/onap.acm.v2/commission",
"host": [
"localhost"
],
"port": "6969",
"path": [
"onap",
- "controlloop",
+ "acm",
"v2",
"commission"
]
@@ -67,7 +67,7 @@
"response": []
},
{
- "name": "Demo: Instantiation control loop definition (Full tosca try)",
+ "name": "Demo: Instantiation automation composition definition (Full tosca try)",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-type": true
@@ -104,7 +104,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"controlLoopList\": [\n {\n \"name\": \"PMSHInstance0\",\n \"version\": \"1.0.1\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSHControlLoopDefinition\",\n \"version\": \"1.2.3\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"PMSH control loop instance 0\",\n \"elements\": {\n \"709c62b3-8918-41b9-a747-d21eb79c6c20\": {\n \"id\": \"709c62b3-8918-41b9-a747-d21eb79c6c20\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSH_DCAEMicroservice\",\n \"version\": \"1.2.3\"\n },\n \"participantType\": {\n \"name\": \"org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant\",\n \"version\": \"2.3.4\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"DCAE Control Loop Element for the PMSH instance 0 control loop\"\n },\n \"709c62b3-8918-41b9-a747-d21eb79c6c21\": {\n \"id\": \"709c62b3-8918-41b9-a747-d21eb79c6c21\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement\",\n \"version\": \"1.2.3\"\n },\n \"participantType\": {\n \"name\": \"org.onap.policy.controlloop.PolicyControlLoopParticipant\",\n \"version\": \"2.3.1\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"Monitoring Policy Control Loop Element for the PMSH instance 0 control loop\"\n },\n \"709c62b3-8918-41b9-a747-d21eb79c6c22\": {\n \"id\": \"709c62b3-8918-41b9-a747-d21eb79c6c22\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement\",\n \"version\": \"1.2.3\"\n },\n \"participantType\": {\n \"name\": \"org.onap.policy.controlloop.PolicyControlLoopParticipant\",\n \"version\": \"2.3.1\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"Operational Policy Control Loop Element for the PMSH instance 0 control loop\"\n }\n }\n }\n ]\n}",
+ "raw": "{\n \"controlLoopList\": [\n {\n \"name\": \"PMSHInstance0\",\n \"version\": \"1.0.1\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSHControlLoopDefinition\",\n \"version\": \"1.2.3\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"PMSH automation composition instance 0\",\n \"elements\": {\n \"709c62b3-8918-41b9-a747-d21eb79c6c20\": {\n \"id\": \"709c62b3-8918-41b9-a747-d21eb79c6c20\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSH_DCAEMicroservice\",\n \"version\": \"1.2.3\"\n },\n \"participantType\": {\n \"name\": \"org.onap.dcae.acm.DCAEMicroserviceControlLoopParticipant\",\n \"version\": \"2.3.4\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"DCAE Control Loop Element for the PMSH instance 0 automation composition\"\n },\n \"709c62b3-8918-41b9-a747-d21eb79c6c21\": {\n \"id\": \"709c62b3-8918-41b9-a747-d21eb79c6c21\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement\",\n \"version\": \"1.2.3\"\n },\n \"participantType\": {\n \"name\": \"org.onap.policy.acm.PolicyControlLoopParticipant\",\n \"version\": \"2.3.1\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"Monitoring Policy Control Loop Element for the PMSH instance 0 automation composition\"\n },\n \"709c62b3-8918-41b9-a747-d21eb79c6c22\": {\n \"id\": \"709c62b3-8918-41b9-a747-d21eb79c6c22\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement\",\n \"version\": \"1.2.3\"\n },\n \"participantType\": {\n \"name\": \"org.onap.policy.acm.PolicyControlLoopParticipant\",\n \"version\": \"2.3.1\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"Operational Policy Control Loop Element for the PMSH instance 0 automation composition\"\n }\n }\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
@@ -112,14 +112,14 @@
}
},
"url": {
- "raw": "localhost:6969/onap/controlloop/v2/instantiation",
+ "raw": "localhost:6969/onap.acm.v2/instantiation",
"host": [
"localhost"
],
"port": "6969",
"path": [
"onap",
- "controlloop",
+ "acm",
"v2",
"instantiation"
]
@@ -128,7 +128,7 @@
"response": []
},
{
- "name": "Demo: Instantiation control loop definition Command",
+ "name": "Demo: Instantiation automation composition definition Command",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-type": true
@@ -173,14 +173,14 @@
}
},
"url": {
- "raw": "localhost:6969/onap/controlloop/v2/instantiation/command",
+ "raw": "localhost:6969/onap.acm.v2/instantiation/command",
"host": [
"localhost"
],
"port": "6969",
"path": [
"onap",
- "controlloop",
+ "acm",
"v2",
"instantiation",
"command"
@@ -263,7 +263,7 @@
"response": []
},
{
- "name": "Demo: Get instantiated control loops",
+ "name": "Demo: Get instantiated automation compositions",
"request": {
"auth": {
"type": "basic",
@@ -283,14 +283,14 @@
"method": "GET",
"header": [],
"url": {
- "raw": "localhost:6969/onap/controlloop/v2/instantiation",
+ "raw": "localhost:6969/onap.acm.v2/instantiation",
"host": [
"localhost"
],
"port": "6969",
"path": [
"onap",
- "controlloop",
+ "acm",
"v2",
"instantiation"
]
diff --git a/common/src/test/resources/demo/config/PolicyParticipantConfig.json b/common/src/test/resources/demo/config/PolicyParticipantConfig.json
index f02fbdd23..12b261fcd 100644
--- a/common/src/test/resources/demo/config/PolicyParticipantConfig.json
+++ b/common/src/test/resources/demo/config/PolicyParticipantConfig.json
@@ -1,21 +1,21 @@
{
- "name": "ControlLoopParticipantGroup",
+ "name": "AutomationCompositionParticipantGroup",
"intermediaryParameters": {
"name": "Participant parameters",
"reportingTimeInterval": 120000,
"description": "Participant Description",
"participantType":{
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version":"2.3.1"
},
"participantId": {
"name": "org.onap.PM_Policy",
"version": "1.0.0"
},
- "clampControlLoopTopics": {
+ "automationCompositionTopics": {
"topicSources": [
{
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "topic": "POLICY-ACRUNTIME-PARTICIPANT",
"servers": [
"localhost"
],
@@ -25,7 +25,7 @@
],
"topicSinks": [
{
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "topic": "POLICY-ACRUNTIME-PARTICIPANT",
"servers": [
"localhost"
],
diff --git a/common/src/test/resources/demo/config/RuntimeConfig.json b/common/src/test/resources/demo/config/RuntimeConfig.json
index fd8948ab7..7424568cc 100644
--- a/common/src/test/resources/demo/config/RuntimeConfig.json
+++ b/common/src/test/resources/demo/config/RuntimeConfig.json
@@ -1,5 +1,5 @@
{
- "name": "ControlLoopRuntimeGroup",
+ "name": "AutomationCompositionRuntimeGroup",
"restServerParameters": {
"host": "0.0.0.0",
"port": 6969,
@@ -23,7 +23,7 @@
"name": "PolicyProviderParameterGroup",
"implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
"databaseDriver": "org.mariadb.jdbc.Driver",
- "databaseUrl": "jdbc:mariadb://localhost:3306/controlloop",
+ "databaseUrl": "jdbc:mariadb://localhost:3306/acm",
"databaseUser": "policy",
"databasePassword": "P01icY",
"persistenceUnit": "CommissioningMariaDb"
@@ -31,7 +31,7 @@
"topicParameterGroup": {
"topicSources": [
{
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "topic": "POLICY-ACRUNTIME-PARTICIPANT",
"servers": [
"localhost"
],
@@ -41,7 +41,7 @@
],
"topicSinks": [
{
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "topic": "POLICY-ACRUNTIME-PARTICIPANT",
"servers": [
"localhost"
],
diff --git a/common/src/test/resources/examples/controlloop/KubernetesHelm.yaml b/common/src/test/resources/examples/acm/KubernetesHelm.yaml
index 9b0f449d3..9b0f449d3 100644
--- a/common/src/test/resources/examples/controlloop/KubernetesHelm.yaml
+++ b/common/src/test/resources/examples/acm/KubernetesHelm.yaml
diff --git a/common/src/test/resources/examples/controlloop/PMSH/consul_call_body.json b/common/src/test/resources/examples/acm/PMSH/consul_call_body.json
index 9118e9a6f..9118e9a6f 100644
--- a/common/src/test/resources/examples/controlloop/PMSH/consul_call_body.json
+++ b/common/src/test/resources/examples/acm/PMSH/consul_call_body.json
diff --git a/common/src/test/resources/examples/controlloop/PMSH/consul_url.txt b/common/src/test/resources/examples/acm/PMSH/consul_url.txt
index 2a2e77e86..2a2e77e86 100644
--- a/common/src/test/resources/examples/controlloop/PMSH/consul_url.txt
+++ b/common/src/test/resources/examples/acm/PMSH/consul_url.txt
diff --git a/common/src/test/resources/examples/controlloop/PMSH/pmsh.postman2.0_collection.json b/common/src/test/resources/examples/acm/PMSH/pmsh.postman2.0_collection.json
index 6efddc256..6efddc256 100644
--- a/common/src/test/resources/examples/controlloop/PMSH/pmsh.postman2.0_collection.json
+++ b/common/src/test/resources/examples/acm/PMSH/pmsh.postman2.0_collection.json
diff --git a/common/src/test/resources/examples/controlloop/PMSH/pmsh_cloudify_blueprint.yaml b/common/src/test/resources/examples/acm/PMSH/pmsh_cloudify_blueprint.yaml
index 7cdc6d5b9..7cdc6d5b9 100644
--- a/common/src/test/resources/examples/controlloop/PMSH/pmsh_cloudify_blueprint.yaml
+++ b/common/src/test/resources/examples/acm/PMSH/pmsh_cloudify_blueprint.yaml
diff --git a/common/src/test/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.json b/common/src/test/resources/examples/acm/PMSH/pmsh_monitoring_policy.json
index 5b64b5b6f..5b64b5b6f 100644
--- a/common/src/test/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.json
+++ b/common/src/test/resources/examples/acm/PMSH/pmsh_monitoring_policy.json
diff --git a/common/src/test/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.yaml b/common/src/test/resources/examples/acm/PMSH/pmsh_monitoring_policy.yaml
index 6021f36bc..6021f36bc 100644
--- a/common/src/test/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.yaml
+++ b/common/src/test/resources/examples/acm/PMSH/pmsh_monitoring_policy.yaml
diff --git a/common/src/test/resources/examples/controlloop/PMSH/pmsh_monitoring_policy_type.yaml b/common/src/test/resources/examples/acm/PMSH/pmsh_monitoring_policy_type.yaml
index e282bf5ba..e282bf5ba 100644
--- a/common/src/test/resources/examples/controlloop/PMSH/pmsh_monitoring_policy_type.yaml
+++ b/common/src/test/resources/examples/acm/PMSH/pmsh_monitoring_policy_type.yaml
diff --git a/common/src/test/resources/examples/controlloop/PMSH/pmsh_operational_policy.json b/common/src/test/resources/examples/acm/PMSH/pmsh_operational_policy.json
index 6bd681d71..6bd681d71 100644
--- a/common/src/test/resources/examples/controlloop/PMSH/pmsh_operational_policy.json
+++ b/common/src/test/resources/examples/acm/PMSH/pmsh_operational_policy.json
diff --git a/common/src/test/resources/examples/controlloop/PMSH/pmsh_operational_policy.yaml b/common/src/test/resources/examples/acm/PMSH/pmsh_operational_policy.yaml
index faf579012..faf579012 100644
--- a/common/src/test/resources/examples/controlloop/PMSH/pmsh_operational_policy.yaml
+++ b/common/src/test/resources/examples/acm/PMSH/pmsh_operational_policy.yaml
diff --git a/common/src/test/resources/examples/controlloop/PMSubscriptionHandling.yaml b/common/src/test/resources/examples/acm/PMSubscriptionHandling.yaml
index 8e8f3cd39..8e8f3cd39 100644
--- a/common/src/test/resources/examples/controlloop/PMSubscriptionHandling.yaml
+++ b/common/src/test/resources/examples/acm/PMSubscriptionHandling.yaml
diff --git a/common/src/test/resources/examples/controlloop/PMSubscriptionHandling_GuilinFormat.yaml b/common/src/test/resources/examples/acm/PMSubscriptionHandling_GuilinFormat.yaml
index 51e369696..51e369696 100644
--- a/common/src/test/resources/examples/controlloop/PMSubscriptionHandling_GuilinFormat.yaml
+++ b/common/src/test/resources/examples/acm/PMSubscriptionHandling_GuilinFormat.yaml
diff --git a/common/src/test/resources/examples/controlloop/http-participant/http.postman2.0_collection.json b/common/src/test/resources/examples/acm/http-participant/http.postman2.0_collection.json
index 798b0edd6..798b0edd6 100644
--- a/common/src/test/resources/examples/controlloop/http-participant/http.postman2.0_collection.json
+++ b/common/src/test/resources/examples/acm/http-participant/http.postman2.0_collection.json
diff --git a/common/src/test/resources/examples/controlloop/k8s-participant/k8s.postman2.0_collection.json b/common/src/test/resources/examples/acm/k8s-participant/k8s.postman2.0_collection.json
index e83bc2594..e83bc2594 100644
--- a/common/src/test/resources/examples/controlloop/k8s-participant/k8s.postman2.0_collection.json
+++ b/common/src/test/resources/examples/acm/k8s-participant/k8s.postman2.0_collection.json
diff --git a/common/src/test/resources/examples/controlloop/original/cloop_DCAE_VES_TCA_substitution.yaml b/common/src/test/resources/examples/controlloop/original/cloop_DCAE_VES_TCA_substitution.yaml
deleted file mode 100644
index 96ea133c2..000000000
--- a/common/src/test/resources/examples/controlloop/original/cloop_DCAE_VES_TCA_substitution.yaml
+++ /dev/null
@@ -1,83 +0,0 @@
-# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-
-tosca_definitions_version: tosca_simple_yaml_1_3
-
-imports:
- - cloop_base_types.yaml
- - cloop_dcae_types.yaml
-
-topology_template:
- inputs:
- some_property_input:
- type: string
-
- substitution_mappings:
- node_type: org.onap.DCAE_VES_TCA
- properties:
- some_property: { get_input: some_property_input }
- capabilities:
- VES-5.28.4-publisher: [ node1_VES_Collector, VES-5.28.4-publisher ]
- VES-7.30.1-publisher: [ node1_VES_Collector, VES-7.30.1-publisher ]
- TCA-handle-out-publisher: [ node2_TCA_GEN_2, TCA-handle-out-publisher ]
- VES_specification-subscriber: [ node2_TCA_GEN_2, VES_specification-subscriber ]
-
- node_templates:
- ################################################################################
- #alt1: without relay
-
- node1_VES_Collector:
- type: org.onap.VESCollector
-
- node2_TCA_GEN_2:
- type: org.onap.TCA_GEN_2
- requirements:
- - receive:
- capability: VES-5.28.4-publisher
- node: node1_VES_Collector
- relationship:
- type: org.onap.PropagateEvent
- properties:
- config-keys: [ ves-measurement ]
-
-
- ################################################################################
- #alt2: with relay
-
- node1_VES_Collector:
- type: org.onap.VESCollector
-
- node2_TCA_GEN_2:
- type: org.onap.TCA_GEN_2
-
- node3_Relay:
- type: org.onap.EventRelay
- properties:
- event_format: "VES_specification"
- event_format_version: "5.28.4"
- supported_carrier_protocols: [{ DMAAP_message_router: DMAAP_message_router }]
- supported_data_formats: [{ JSON: JSON }]
- requirements:
- - receive:
- node: node1_VES_Collector
- properties:
- config_keys: [ ves-measurement ]
- - send:
- node: node2_TCA_GEN_2
- properties:
- config_keys: [ ves-measurement ]
diff --git a/common/src/test/resources/examples/controlloop/original/cloop_base_types.yaml b/common/src/test/resources/examples/controlloop/original/cloop_base_types.yaml
deleted file mode 100644
index 4f29e5635..000000000
--- a/common/src/test/resources/examples/controlloop/original/cloop_base_types.yaml
+++ /dev/null
@@ -1,210 +0,0 @@
-# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-
-tosca_definitions_version: tosca_simple_yaml_1_2
-
-capability_types:
- #producer capability type
- org.onap.EventProducer:
- derived_from: tosca.capabilities.Root
- properties:
- carrier_protocol_type:
- type: string
- required: true
- constraints:
- valid_values: [ DMAAP_message_router, REST ]
- #all valid values should be added here
- data_format:
- type: string
- required: true
- constraints:
- valid_values: [ JSON, YAML, JMS ]
- #all valid values should be added here
- event_format:
- type: string
- required: true
- #examples for event_format: Ves_specification, etc.
- event_format_version:
- type: string
- #examples for event_format_version: 5.28.4, 7.30.1, etc.
- config_keys:
- type: list
- required: false
- entry_schema:
- type: string
- constraints:
- #valid_values: [ ]
- #all valid values should be added here
- #if not specified, events of any config key may be generated
- #examples for config_key: ves-measurement, ves-syslog, tca_handle_out, etc.
-
-
- #consumer capability type
- org.onap.EventConsumer:
- derived_from: tosca.capabilities.Root
- properties:
- carrier_protocol_type:
- type: string
- required: true
- constraints:
- valid_values: [ DMAAP_message_router, REST ]
- #all valid values should be added here
- data_format:
- type: string
- required: true
- constraints:
- valid_values: [ JSON, YAML, JMS ]
- #all valid values should be added here
- event_format:
- type: string
- required: true
- #examples for event_format: Ves_specification, LinkUp, VnfConfigured, etc.
- event_format_version:
- type: string
- #examples for event_format_version: 5.28.4, 7.30.1, etc.
- config_keys:
- type: list
- required: false
- entry_schema:
- type: string
- constraints:
- #valid_values: [ ]
- #all valid values should be added here
- #if not specified, events of any config key may be generated
- #examples for config_key: ves-measurement, ves-syslog, tca_handle_out, etc.
-
-
-relationship_types:
- #the relationship type used on requirements to org.onap.EventProducer and org.onap.EventConsumer capabilities
- org.onap.PropagateEvent:
- derived_from: tosca.relationships.Root
- properties:
- config_keys:
- type: list
- required: false
- description: >
- Filters events by specific config_keys to be transferred by this relationship.
- That is, any event with a specific config_key found in the list is transferred.
- If list is not defined or is empty, events with all config_keys are transferred.
- entry_schema: string
-
-
-
-node_types:
- #base app node type
- org.onap.APP:
- derived_from: tosca.nodes.Root
- properties:
- application_name:
- type: string
- description: Human readable name for the application Product
- required: false
- provider:
- type: string
- description: Provider of the application and of the descriptor
- required: true
- application_version:
- type: string
- description: Software version of the application
- required: true
- blueprint_id:
- type: string
- description: A reference to the app blueprint
- monitoring_policy:
- type: string
- required: false
- description: A reference to the monitoring policy
- requirements:
- - receive:
- capability: org.onap.EventProducer
- relationship: org.onap.PropagateEvent
- occurrences: [0, UNBOUNDED]
- - send:
- capability: org.onap.EventConsumer
- relationship: org.onap.PropagateEvent
- occurrences: [0, UNBOUNDED]
-
- #the event relay node type
- org.onap.EventRelay:
- derived_from: tosca.nodes.Root
- properties:
- event_format:
- type: string
- required: true
- #examples for event_format: Ves_specification, etc.
- event_format_version:
- type: string
- required: true
- #examples for event_format_version: 5.28.4, 7.30.1, etc.
- config_keys:
- type: list
- required: false
- entry_schema:
- type: string
- constraints:
- #valid_values: [ ]
- #all valid values should be added here
- #if not specified, events of any config key is relayed
- #examples for config_key: ves-measurement, ves-syslog, tca_handle_out, etc.
- supported_carrier_protocols:
- type: map
- required: true
- description: >
- A map describing supported carrier protocols and translations. The
- tuples define what protocol combinations are supported on the producer
- and consumer side: e.g. { REST: REST, DMAAP: REST, DMAAP: DMAAP}
- key_schema:
- type: string
- constraints:
- valid_values: [ DMAAP_message_router, REST ]
- #all valid values should be added here
- entry_schema:
- type: string
- constraints:
- valid_values: [ DMAAP_message_router, REST ]
- #all valid values should be added here
- supported_data_formats:
- type: map
- required: true
- description: >
- Is a map describing supported data formats and translation. The tuples
- define what protocol combinations are supported on the producer and
- consumer side: e.g. { JSON: JSON, JMS: JSON, YAML:YAML }
- key_schema:
- type: string
- constraints:
- valid_values: [ JSON, JMS, YAML, etc ]
- #all valid values should be added here
- entry_schema:
- type: string
- constraints:
- valid_values: [ JSON, JMS, YAML, etc ]
- #all valid values should be added here
- requirements:
- - receive:
- capability: org.onap.EventProducer
- relationship: org.onap.PropagateEvent
- occurrences: [1, UNBOUNDED]
- - send:
- capability: org.onap.EventConsumer
- relationship: org.onap.PropagateEvent
- occurrences: [1, UNBOUNDED]
-
-
-
-
diff --git a/common/src/test/resources/examples/controlloop/original/cloop_dcae_example.yaml b/common/src/test/resources/examples/controlloop/original/cloop_dcae_example.yaml
deleted file mode 100644
index 4629f6f75..000000000
--- a/common/src/test/resources/examples/controlloop/original/cloop_dcae_example.yaml
+++ /dev/null
@@ -1,50 +0,0 @@
-# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-
-tosca_definitions_version: tosca_simple_yaml_1_3
-
-imports:
- - cloop_base_types.yaml
- - cloop_dcae_types.yaml
- - cloop_other_types.yaml
-
-topology_template:
- node_templates:
-
- node1_DCAE_VES_TCA:
- type: org.onap.DCAE_VES_TCA
- directives:
- - substitute
-
- node2_PolicyFramework:
- type: org.onap.ApexPolicyFramework
- requirements:
- - receive:
- capability: TCA-handle-out-publisher
- node: node1_DCAE_VES_TCA
- relationship:
- properties:
- config_keys: [ ves-measurement ]
- - send:
- capability: SelfService
- node: org.onap.CDS
- relationship:
- properties:
- config_keys: [ ves-measurement ]
-
- #if this closed loop to subscribe to other events via the VesCollector, should we not add that?
diff --git a/common/src/test/resources/examples/controlloop/original/cloop_dcae_types.yaml b/common/src/test/resources/examples/controlloop/original/cloop_dcae_types.yaml
deleted file mode 100644
index 5f96cd5df..000000000
--- a/common/src/test/resources/examples/controlloop/original/cloop_dcae_types.yaml
+++ /dev/null
@@ -1,140 +0,0 @@
-# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-
-tosca_definitions_version: tosca_simple_yaml_1_3
-
-imports:
- - cloop_types.yaml
-
-node_types:
-
- #node type for VES_Collector
- org.onap.VES_Collector:
- derived_from: org.onap.APP
- capabilities:
- VES-5.28.4-publisher:
- type: org.onap.EventProducer
- occurrences: [ 0, UNBOUNDED ]
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "VES_specification"
- event_format_version: "5.28.4"
- config_keys:
- - "ves-fault"
- - "ves-measurement"
- - "ves-syslog"
- - "ves-heartbeat"
- - "ves-other"
- - "ves-mobileflow"
- - "ves-statechange"
- - "ves-thresholdCrossingAlert"
- - "ves-voicequality"
- - "ves-sipsignaling"
- VES-7.30.1-publisher:
- type: org.onap.EventProducer
- occurrences: [ 0, UNBOUNDED ]
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "VES_specification"
- event_format_version: "7.30.1"
- config_keys:
- - "ves-fault"
- - "ves-pnfRegistration"
- - "ves-notification"
- - "ves-perf3gpp"
-
- #node type for TCA_GEN_2
- org.onap.TCA_GEN_2:
- derived_from: org.onap.APP
- capabilities:
- TCA-handle-out-publisher:
- type: org.onap.EventProducer
- occurrences: [ 0, UNBOUNDED ]
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "DCAE_CL_Output"
- event_format_version: "1.0.1"
- config_keys: [ "tca_handle_out" ]
- VES_specification-subscriber:
- type: org.onap.EventConsumer
- occurrences: [ 0, UNBOUNDED ]
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "VES_specification"
- event_format_version: "5.28.4"
- config_keys: [ "tca_handle_in" ]
-
-
-
- #node type for the composed VES_Collector and TCA_GEN_2
- org.onap.DCAE_VES_TCA:
- derived_from: org.onap.APP
- capabilities:
- VES-5.28.4-publisher:
- type: org.onap.EventProducer
- occurrences: [ 0, UNBOUNDED ]
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "VES_specification"
- event_format_version: "5.28.4"
- config_keys:
- - "ves-fault"
- - "ves-measurement"
- - "ves-syslog"
- - "ves-heartbeat"
- - "ves-other"
- - "ves-mobileflow"
- - "ves-statechange"
- - "ves-thresholdCrossingAlert"
- - "ves-voicequality"
- - "ves-sipsignaling"
- VES-7.30.1-publisher:
- type: org.onap.EventProducer
- occurrences: [ 0, UNBOUNDED ]
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "VES_specification"
- event_format_version: "7.30.1"
- config_keys:
- - "ves-pnfRegistration"
- - "ves-notification"
- - "ves-perf3gpp"
- TCA-handle-out-publisher:
- type: org.onap.EventProducer
- occurrences: [ 0, UNBOUNDED ]
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "DCAE_CL_Output"
- event_format_version: "1.0.1"
- config_keys: [ "tca_handle_out" ]
- VES_specification-subscriber:
- type: org.onap.EventConsumer
- occurrences: [ 0, UNBOUNDED ]
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "VES_specification"
- event_format_version: "5.28.4"
- config_keys: [ "tca_handle_in" ]
diff --git a/common/src/test/resources/examples/controlloop/original/cloop_other_types.yaml b/common/src/test/resources/examples/controlloop/original/cloop_other_types.yaml
deleted file mode 100644
index d743f499f..000000000
--- a/common/src/test/resources/examples/controlloop/original/cloop_other_types.yaml
+++ /dev/null
@@ -1,63 +0,0 @@
-# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-
-tosca_definitions_version: tosca_simple_yaml_1_2
-
-imports:
- - cloop_base_types.yaml
-
-node_types:
- #node type for Policy
- org.onap.PolicyFramework:
- derived_from: org.onap.APP
-
- #node type for Apex Policy
- org.onap.ApexPolicyFramework:
- derived_from: org.onap.PolicyFramework
-
- #node type for CDS
- org.onap.CDS:
- derived_from: org.onap.APP
- capabilities:
- #consumer capability for CDS for events of type ResourceAndTemplate management API
- ResourceAndTemplateManagement:
- type: org.onap.EventConsumer
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "ResourceAndTemplate"
- event_format_version: "x.xx.x"
- occurrences: [ 0, UNBOUNDED ]
- #consumer capability for CDS for events of type SelfService API
- SelfService:
- type: org.onap.EventConsumer
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "SelfService"
- event_format_version: "x.xx.x"
- occurrences: [ 0, UNBOUNDED ]
- #producer capability for CDS for events of type PNFControl
- PNFcontrolEventsProducer:
- type: org.onap.EventProducer
- properties:
- carrier_protocol_type: "DMAAP_message_router"
- data_format: "JSON"
- event_format: "PNFcontrol"
- event_format_version: "x.xx.x"
- occurrences: [ 0, UNBOUNDED ]
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopState.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopState.java
deleted file mode 100644
index ff0d553af..000000000
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopState.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
-
-public enum ControlLoopState {
- /**
- * The control loop or control loop element is not initialised on participants, it does not exist on participants.
- */
- UNINITIALISED,
- /**
- * The control loop or control loop element is changing from unitialised to passive, it is being initialised onto
- * participants.
- */
- UNINITIALISED2PASSIVE,
- /**
- * The control loop or control loop element is initialised on the participants but is passive, that is, it is not
- * handling control loop messages yet.
- */
- PASSIVE,
- /**
- * The control loop or control loop element is changing from passive to running, the participants are preparing to
- * execute control loops.
- */
- PASSIVE2RUNNING,
- /** The control loop or control loop element is running and is executing control loops. */
- RUNNING,
- /**
- * The control loop or control loop element is completing execution of current control loops but will not start
- * running any more control loops and will become passive.
- */
- RUNNING2PASSIVE,
- /**
- * The control loop or control loop element is changing from passive to unitialised, the control loop is being
- * removed from participants.
- */
- PASSIVE2UNINITIALISED;
-
- public boolean equalsControlLoopOrderedState(final ControlLoopOrderedState controlLoopOrderedState) {
- return this.name().equals(controlLoopOrderedState.name());
- }
-
- public ControlLoopOrderedState asOrderedState() {
- return ControlLoopOrderedState.valueOf(this.name());
- }
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
deleted file mode 100644
index a1b1045eb..000000000
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import javax.persistence.EntityNotFoundException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import lombok.AllArgsConstructor;
-import lombok.NonNull;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ControlLoopRepository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaNodeTemplateRepository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaNodeTemplatesRepository;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
-import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
-import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * This class provides information on control loop concepts in the database to callers.
- */
-@Service
-@Transactional
-@AllArgsConstructor
-public class ControlLoopProvider {
-
- private final ControlLoopRepository controlLoopRepository;
- private final ToscaNodeTemplateRepository toscaNodeTemplateRepository;
- private final ToscaNodeTemplatesRepository toscaNodeTemplatesRepository;
-
- /**
- * Get Control Loop.
- *
- * @param controlLoopId the ID of the control loop to get
- * @return the control loop found
- * @throws PfModelException on errors getting the control loop
- */
- @Transactional(readOnly = true)
- public ControlLoop getControlLoop(final ToscaConceptIdentifier controlLoopId) throws PfModelException {
- try {
- return controlLoopRepository.getById(controlLoopId.asConceptKey()).toAuthorative();
- } catch (EntityNotFoundException e) {
- throw new PfModelException(Status.NOT_FOUND, "ControlLoop not found", e);
- }
- }
-
- /**
- * Find Control Loop by controlLoopId.
- *
- * @param name the name of the control loop to get, null to get all control loops
- * @param version the version of the control loop to get, null to get all control loops
- * @return the control loop found
- * @throws PfModelException on errors getting the control loop
- */
- @Transactional(readOnly = true)
- public Optional<ControlLoop> findControlLoop(@NonNull final String name, @NonNull final String version)
- throws PfModelException {
- return findControlLoop(new PfConceptKey(name, version));
- }
-
- /**
- * Find Control Loop by controlLoopId.
- *
- * @param controlLoopId the ID of the control loop to get
- * @return the control loop found
- * @throws PfModelException on errors getting the control loop
- */
- @Transactional(readOnly = true)
- public Optional<ControlLoop> findControlLoop(final ToscaConceptIdentifier controlLoopId) throws PfModelException {
- return findControlLoop(controlLoopId.asConceptKey());
- }
-
- private Optional<ControlLoop> findControlLoop(@NonNull final PfConceptKey key) throws PfModelException {
- try {
- return controlLoopRepository.findById(key).map(JpaControlLoop::toAuthorative);
- } catch (IllegalArgumentException e) {
- throw new PfModelException(Status.BAD_REQUEST, "Not valid parameter", e);
- }
- }
-
- /**
- * Save Control Loop.
- *
- * @param controlLoop the control loop to update
- * @return the updated control loop
- * @throws PfModelException on errors updating the control loop
- */
- public ControlLoop saveControlLoop(final ControlLoop controlLoop) throws PfModelException {
- try {
- var result = controlLoopRepository
- .save(ProviderUtils.getJpaAndValidate(controlLoop, JpaControlLoop::new, "control loop"));
-
- // Return the saved participant
- return result.toAuthorative();
- } catch (IllegalArgumentException e) {
- throw new PfModelException(Status.BAD_REQUEST, "Error in save controlLoop", e);
- }
- }
-
- /**
- * Get All Control Loops.
- *
- * @return all control loops found
- * @throws PfModelException on errors getting control loops
- */
- @Transactional(readOnly = true)
- public List<ControlLoop> getControlLoops() throws PfModelException {
-
- return ProviderUtils.asEntityList(controlLoopRepository.findAll());
- }
-
- /**
- * Get Control Loops.
- *
- * @param name the name of the control loop to get, null to get all control loops
- * @param version the version of the control loop to get, null to get all control loops
- * @return the control loops found
- * @throws PfModelException on errors getting control loops
- */
- @Transactional(readOnly = true)
- public List<ControlLoop> getControlLoops(final String name, final String version) throws PfModelException {
-
- return ProviderUtils.asEntityList(controlLoopRepository.getFiltered(JpaControlLoop.class, name, version));
- }
-
- /**
- * Saves control loops.
- *
- * @param controlLoops a specification of the control loops to create
- * @return the control loops created
- * @throws PfModelException on errors creating control loops
- */
- public List<ControlLoop> saveControlLoops(@NonNull final List<ControlLoop> controlLoops) throws PfModelException {
- try {
- var result = controlLoopRepository
- .saveAll(ProviderUtils.getJpaAndValidateList(controlLoops, JpaControlLoop::new, "control loops"));
-
- // Return the saved participant
- return ProviderUtils.asEntityList(result);
- } catch (IllegalArgumentException e) {
- throw new PfModelException(Status.BAD_REQUEST, "Error in save ControlLoops", e);
- }
- }
-
- /**
- * Saves Instance Properties to the database.
- *
- * @param serviceTemplate the service template
- * @return a Map of tosca node templates
- */
- public Map<String, ToscaNodeTemplate> saveInstanceProperties(ToscaServiceTemplate serviceTemplate) {
- Map<String, ToscaNodeTemplate> savedNodeTemplates = new HashMap<>();
-
- var jpaToscaNodeTemplates = new JpaToscaNodeTemplates();
- jpaToscaNodeTemplates.fromAuthorative(List.of(serviceTemplate.getToscaTopologyTemplate().getNodeTemplates()));
-
- toscaNodeTemplatesRepository.save(jpaToscaNodeTemplates);
- serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().forEach(savedNodeTemplates::put);
-
- return savedNodeTemplates;
- }
-
- /**
- * Delete a control loop.
- *
- * @param name the name of the control loop to delete
- * @param version the version of the control loop to delete
- * @return the control loop deleted
- * @throws PfModelException on errors deleting the control loop
- */
- public ControlLoop deleteControlLoop(@NonNull final String name, @NonNull final String version)
- throws PfModelException {
-
- var controlLoopKey = new PfConceptKey(name, version);
- var jpaDeleteControlLoop = controlLoopRepository.findById(controlLoopKey);
-
- if (jpaDeleteControlLoop.isEmpty()) {
- String errorMessage =
- "delete of control loop \"" + controlLoopKey.getId() + "\" failed, control loop does not exist";
- throw new PfModelException(Response.Status.BAD_REQUEST, errorMessage);
- }
-
- controlLoopRepository.deleteById(controlLoopKey);
-
- return jpaDeleteControlLoop.get().toAuthorative();
- }
-
- /**
- * Deletes Instance Properties on the database.
- *
- * @param filteredToscaNodeTemplateMap filtered node templates map to delete
- * @param filteredToscaNodeTemplateList filtered node template list to delete
- */
- public void deleteInstanceProperties(Map<String, ToscaNodeTemplate> filteredToscaNodeTemplateMap,
- List<ToscaNodeTemplate> filteredToscaNodeTemplateList) {
-
- var jpaToscaNodeTemplates = new JpaToscaNodeTemplates();
- jpaToscaNodeTemplates.fromAuthorative(List.of(filteredToscaNodeTemplateMap));
-
- toscaNodeTemplatesRepository.save(jpaToscaNodeTemplates);
-
- filteredToscaNodeTemplateList.forEach(template -> {
- var jpaToscaNodeTemplate = new JpaToscaNodeTemplate(template);
-
- toscaNodeTemplateRepository.delete(jpaToscaNodeTemplate);
- });
- }
-
- /**
- * Get All Node Templates.
- *
- * @return the list of node templates found
- * @throws PfModelException on errors getting node templates
- */
- @Transactional(readOnly = true)
- public List<ToscaNodeTemplate> getAllNodeTemplates() {
- return ProviderUtils.asEntityList(toscaNodeTemplateRepository.findAll());
- }
-
- /**
- * Get Node Templates.
- *
- * @param name the name of the node template to get, null to get all node templates
- * @param version the version of the node template to get, null to get all node templates
- * @return the node templates found
- * @throws PfModelException on errors getting node templates
- */
- @Transactional(readOnly = true)
- public List<ToscaNodeTemplate> getNodeTemplates(final String name, final String version) {
- return ProviderUtils
- .asEntityList(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, name, version));
- }
-
- /**
- * Get filtered node templates.
- *
- * @param filter the filter for the node templates to get
- * @return the node templates found
- * @throws PfModelException on errors getting node templates
- */
- @Transactional(readOnly = true)
- public List<ToscaNodeTemplate> getFilteredNodeTemplates(
- @NonNull final ToscaTypedEntityFilter<ToscaNodeTemplate> filter) {
-
- return filter.filter(ProviderUtils.asEntityList(toscaNodeTemplateRepository
- .getFiltered(JpaToscaNodeTemplate.class, filter.getName(), filter.getVersion())));
- }
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java
deleted file mode 100644
index 62b8d20b0..000000000
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
-
-/**
- * Class to hold the possible values for the type of participant messages.
- */
-public enum ParticipantMessageType {
-
- /**
- * Used by participants to report status to the control loop runtime.
- */
- PARTICIPANT_STATUS,
-
- /**
- * Used by the controlloop runtime to change the state of participants, triggers a
- * PARTICIPANT_STATUS message with the result of the PARTICIPANT_STATE_CHANGE operation.
- */
- PARTICIPANT_STATE_CHANGE,
-
- /**
- * Used by controlloop runtime to update the controlloops running on participants, triggers a
- * PARTICIPANT_STATUS message with the result of the CONTROL_LOOP_UPDATE operation.
- */
- CONTROL_LOOP_UPDATE,
-
- /**
- * Used by controlloop runtime to change the state of controlloops in participants, triggers a
- * PARTICIPANT_STATUS message with result of CONTROL_LOOP_STATE_CHANGE operation.
- */
- CONTROL_LOOP_STATE_CHANGE,
-
- /**
- * Used by the control loop runtime to order a health check on participants, triggers a
- * PARTICIPANT_STATUS message with the result of the PARTICIPANT_HEALTH_CHECK operation.
- */
- PARTICIPANT_HEALTH_CHECK,
-
- /**
- * Used by participant to register itself with control loop runtime.
- */
- PARTICIPANT_REGISTER,
-
- /**
- * Used by control loop runtime to respond to participant registration.
- */
- PARTICIPANT_REGISTER_ACK,
-
- /**
- * Used by participant to deregister itself with control loop runtime.
- */
- PARTICIPANT_DEREGISTER,
-
- /**
- * Used by control loop runtime to respond to participant deregistration.
- */
- PARTICIPANT_DEREGISTER_ACK,
-
- /**
- * Used by control loop runtime to send ToscaServiceTemplate to participant.
- */
- PARTICIPANT_UPDATE,
-
- /**
- * Used by participant to acknowledge the receipt of Participant_Update message
- * from control loop runtime.
- */
- PARTICIPANT_UPDATE_ACK,
-
- /**
- * Used by participant to acknowledge the receipt of ControlLoop_Update message
- * from control loop runtime.
- */
- CONTROLLOOP_UPDATE_ACK,
-
- /**
- * Used by participant to acknowledge the receipt of ControlLoop_StateChange message
- * from control loop runtime.
- */
- CONTROLLOOP_STATECHANGE_ACK,
-
- /**
- * Used by control loop runtime to request for ParticipantStatus message immediately.
- */
- PARTICIPANT_STATUS_REQ
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatistics.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatistics.java
index 4ef9bdcd9..d1b1e31e8 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatistics.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatistics.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.io.Serializable;
import java.time.Instant;
@@ -32,7 +32,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@NoArgsConstructor
@Data
@ToString
-public class ClElementStatistics implements Serializable {
+public class AcElementStatistics implements Serializable {
private static final long serialVersionUID = 3284285693112271055L;
@@ -46,8 +46,8 @@ public class ClElementStatistics implements Serializable {
private Instant timeStamp;
@NonNull
- private ControlLoopState controlLoopState;
+ private AutomationCompositionState state;
- private long clElementUptime;
+ private long acElementUptime;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsList.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsList.java
index 166f1e48f..3b8feb5f6 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsList.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsList.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.List;
import lombok.Getter;
@@ -28,6 +28,6 @@ import lombok.ToString;
@Getter
@Setter
@ToString
-public class ClElementStatisticsList {
- private List<ClElementStatistics> clElementStatistics;
+public class AcElementStatisticsList {
+ private List<AcElementStatistics> acElementStatistics;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
index cf22b7228..f6134782b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.List;
import java.util.Map;
@@ -35,22 +35,22 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
- * Class to represent a control loop instance.
+ * Class to represent an automation composition instance.
*/
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = true)
-public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop> {
+public class AutomationComposition extends ToscaEntity implements Comparable<AutomationComposition> {
@NonNull
private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
@NonNull
- private ControlLoopState state = ControlLoopState.UNINITIALISED;
+ private AutomationCompositionState state = AutomationCompositionState.UNINITIALISED;
@NonNull
- private ControlLoopOrderedState orderedState = ControlLoopOrderedState.UNINITIALISED;
+ private AutomationCompositionOrderedState orderedState = AutomationCompositionOrderedState.UNINITIALISED;
- private Map<UUID, ControlLoopElement> elements;
+ private Map<UUID, AutomationCompositionElement> elements;
@NonNull
private Boolean primed = false;
@@ -68,28 +68,28 @@ public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop>
/**
* Copy contructor, does a deep copy.
*
- * @param otherControlLoop the other element to copy from
+ * @param otherAutomationComposition the other element to copy from
*/
- public ControlLoop(final ControlLoop otherControlLoop) {
- super(otherControlLoop);
- this.definition = new ToscaConceptIdentifier(otherControlLoop.definition);
- this.state = otherControlLoop.state;
- this.orderedState = otherControlLoop.orderedState;
- this.elements = PfUtils.mapMap(otherControlLoop.elements, ControlLoopElement::new);
- this.primed = otherControlLoop.primed;
+ public AutomationComposition(final AutomationComposition otherAutomationComposition) {
+ super(otherAutomationComposition);
+ this.definition = new ToscaConceptIdentifier(otherAutomationComposition.definition);
+ this.state = otherAutomationComposition.state;
+ this.orderedState = otherAutomationComposition.orderedState;
+ this.elements = PfUtils.mapMap(otherAutomationComposition.elements, AutomationCompositionElement::new);
+ this.primed = otherAutomationComposition.primed;
}
@Override
- public int compareTo(final ControlLoop other) {
+ public int compareTo(final AutomationComposition other) {
return compareNameVersion(this, other);
}
/**
- * Set the ordered state on the control loop and on all its control loop elements.
+ * Set the ordered state on the automation composition and on all its automation composition elements.
*
- * @param orderedState the state we want the control loop to transition to
+ * @param orderedState the state we want the automation composition to transition to
*/
- public void setCascadedOrderedState(final ControlLoopOrderedState orderedState) {
+ public void setCascadedOrderedState(final AutomationCompositionOrderedState orderedState) {
this.orderedState = orderedState;
if (MapUtils.isEmpty(elements)) {
@@ -100,17 +100,18 @@ public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop>
}
/**
- * Get a list of control loop element statistics.
+ * Get a list of automation composition element statistics.
*
- * @param controlLoop the control loop
- * @return List of ClElementStatistics
+ * @param automationComposition the automation composition
+ * @return List of AcElementStatistics
*/
- public List<ClElementStatistics> getControlLoopElementStatisticsList(final ControlLoop controlLoop) {
- if (MapUtils.isEmpty(controlLoop.elements)) {
+ public List<AcElementStatistics> getAutomationCompositionElementStatisticsList(
+ final AutomationComposition automationComposition) {
+ if (MapUtils.isEmpty(automationComposition.elements)) {
return List.of();
}
- return controlLoop.elements.values().stream().map(ControlLoopElement::getClElementStatistics)
- .collect(Collectors.toList());
+ return automationComposition.elements.values().stream()
+ .map(AutomationCompositionElement::getAcElementStatistics).collect(Collectors.toList());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
index c7d85e4b6..046b77f76 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -35,12 +35,12 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
- * Class to represent a control loop instance.
+ * Class to represent a automation composition instance.
*/
@NoArgsConstructor
@Data
@ToString
-public class ControlLoopElement {
+public class AutomationCompositionElement {
@NonNull
private UUID id = UUID.randomUUID();
@@ -54,16 +54,16 @@ public class ControlLoopElement {
private ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
@NonNull
- private ControlLoopState state = ControlLoopState.UNINITIALISED;
+ private AutomationCompositionState state = AutomationCompositionState.UNINITIALISED;
@NonNull
- private ControlLoopOrderedState orderedState = ControlLoopOrderedState.UNINITIALISED;
+ private AutomationCompositionOrderedState orderedState = AutomationCompositionOrderedState.UNINITIALISED;
private ToscaServiceTemplate toscaServiceTemplateFragment;
private String description;
- private ClElementStatistics clElementStatistics;
+ private AcElementStatistics acElementStatistics;
// A map indexed by the property name. Each map entry is the serialized value of the property,
// which can be deserialized into an instance of the type of the property.
@@ -74,7 +74,7 @@ public class ControlLoopElement {
*
* @param otherElement the other element to copy from
*/
- public ControlLoopElement(final ControlLoopElement otherElement) {
+ public AutomationCompositionElement(final AutomationCompositionElement otherElement) {
this.id = otherElement.id;
this.definition = new ToscaConceptIdentifier(otherElement.definition);
this.participantType = new ToscaConceptIdentifier(otherElement.participantType);
@@ -83,7 +83,7 @@ public class ControlLoopElement {
this.orderedState = otherElement.orderedState;
this.toscaServiceTemplateFragment = otherElement.toscaServiceTemplateFragment;
this.description = otherElement.description;
- this.clElementStatistics = otherElement.clElementStatistics;
+ this.acElementStatistics = otherElement.acElementStatistics;
this.propertiesMap = PfUtils.mapMap(otherElement.propertiesMap, UnaryOperator.identity());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementAck.java
index 61b90c9e9..b100f28c0 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementAck.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -29,10 +29,10 @@ import lombok.ToString;
@Setter
@AllArgsConstructor
@ToString
-public class ControlLoopElementAck {
+public class AutomationCompositionElementAck {
- // State of the controlLoopElement
- private ControlLoopState state;
+ // State of the AutomationCompositionElement
+ private AutomationCompositionState state;
// Result: Success/Fail.
private Boolean result;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java
index ae50b40ce..aebee0e2c 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -33,18 +33,18 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
/**
- * Class to represent a control loop element definition instance.
+ * Class to represent an automation composition element definition instance.
*/
@Getter
@NoArgsConstructor
@Data
@ToString
-public class ControlLoopElementDefinition {
+public class AutomationCompositionElementDefinition {
- private ToscaConceptIdentifier clElementDefinitionId;
+ private ToscaConceptIdentifier acElementDefinitionId;
- // The definition of the Control Loop Element in TOSCA
- private ToscaNodeTemplate controlLoopElementToscaNodeTemplate;
+ // The definition of the Automation Composition Element in TOSCA
+ private ToscaNodeTemplate automationCompositionElementToscaNodeTemplate;
// A map indexed by the property name. Each map entry is the serialized value of the property,
// which can be deserialized into an instance of the type of the property.
@@ -53,12 +53,12 @@ public class ControlLoopElementDefinition {
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
*
- * @param clElementDefinition the controlloop element definition to copy from
+ * @param acElementDefinition the automation composition element definition to copy from
*/
- public ControlLoopElementDefinition(final ControlLoopElementDefinition clElementDefinition) {
- this.clElementDefinitionId = clElementDefinition.clElementDefinitionId;
- this.controlLoopElementToscaNodeTemplate =
- new ToscaNodeTemplate(clElementDefinition.controlLoopElementToscaNodeTemplate);
- this.commonPropertiesMap = PfUtils.mapMap(clElementDefinition.commonPropertiesMap, UnaryOperator.identity());
+ public AutomationCompositionElementDefinition(final AutomationCompositionElementDefinition acElementDefinition) {
+ this.acElementDefinitionId = acElementDefinition.acElementDefinitionId;
+ this.automationCompositionElementToscaNodeTemplate =
+ new ToscaNodeTemplate(acElementDefinition.automationCompositionElementToscaNodeTemplate);
+ this.commonPropertiesMap = PfUtils.mapMap(acElementDefinition.commonPropertiesMap, UnaryOperator.identity());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java
index 0c33606db..dba8f553c 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -26,27 +26,27 @@ import lombok.ToString;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent a control loop info instance.
+ * Class to represent a automation composition info instance.
*/
@NoArgsConstructor
@Data
@ToString
-public class ControlLoopInfo {
+public class AutomationCompositionInfo {
- private ToscaConceptIdentifier controlLoopId;
+ private ToscaConceptIdentifier automationCompositionId;
- private ControlLoopState state = ControlLoopState.UNINITIALISED;
+ private AutomationCompositionState state = AutomationCompositionState.UNINITIALISED;
- private ControlLoopStatistics controlLoopStatistics;
+ private AutomationCompositionStatistics automationCompositionStatistics;
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
*
* @param otherElement the other element to copy from
*/
- public ControlLoopInfo(final ControlLoopInfo otherElement) {
- this.controlLoopId = otherElement.controlLoopId;
+ public AutomationCompositionInfo(final AutomationCompositionInfo otherElement) {
+ this.automationCompositionId = otherElement.automationCompositionId;
this.state = otherElement.state;
- this.controlLoopStatistics = otherElement.controlLoopStatistics;
+ this.automationCompositionStatistics = otherElement.automationCompositionStatistics;
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopOrderedState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionOrderedState.java
index 91f90275e..3be5ffa2f 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopOrderedState.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionOrderedState.java
@@ -18,27 +18,30 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
-public enum ControlLoopOrderedState {
+public enum AutomationCompositionOrderedState {
/**
- * The control loop or control loop element should become uninitialised on participants, it should not exist on
- * participants.
+ * The automation composition or automation composition element should become uninitialised on participants, it
+ * should not exist on participants.
*/
UNINITIALISED,
/**
- * The control loop or control loop element should initialised on the participants and be passive, that is, it is
- * not handling control loop messages yet.
+ * The automation composition or automation composition element should initialised on the participants and be
+ * passive, that is, it is not handling automation composition messages yet.
*/
PASSIVE,
- /** The control loop or control loop element should running and is executing control loops. */
+ /**
+ * The automation composition or automation composition element should running and is executing automation
+ * compositions.
+ */
RUNNING;
- public boolean equalsControlLoopState(final ControlLoopState controlLoopState) {
- return this.name().equals(controlLoopState.name());
+ public boolean equalsAutomationCompositionState(final AutomationCompositionState automationCompositionState) {
+ return this.name().equals(automationCompositionState.name());
}
- public ControlLoopState asState() {
- return ControlLoopState.valueOf(this.name());
+ public AutomationCompositionState asState() {
+ return AutomationCompositionState.valueOf(this.name());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionState.java
new file mode 100644
index 000000000..aa6fcfd1d
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionState.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.concepts;
+
+public enum AutomationCompositionState {
+ /**
+ * The automation composition or automation composition element is not initialised on participants, it does not
+ * exist on participants.
+ */
+ UNINITIALISED,
+ /**
+ * The automation composition or automation composition element is changing from unitialised to passive, it is being
+ * initialised onto participants.
+ */
+ UNINITIALISED2PASSIVE,
+ /**
+ * The automation composition or automation composition element is initialised on the participants but is passive,
+ * that is, it is not handling automation composition messages yet.
+ */
+ PASSIVE,
+ /**
+ * The automation composition or automation composition element is changing from passive to running, the
+ * participants are preparing to execute automation compositions.
+ */
+ PASSIVE2RUNNING,
+ /**
+ * The automation composition or automation composition element is running and is executing automation compositions.
+ */
+ RUNNING,
+ /**
+ * The automation composition or automation composition element is completing execution of current automation
+ * compositions but will not start running any more automation compositions and will become passive.
+ */
+ RUNNING2PASSIVE,
+ /**
+ * The automation composition or automation composition element is changing from passive to unitialised, the
+ * automation composition is being removed from participants.
+ */
+ PASSIVE2UNINITIALISED;
+
+ public boolean equalsAutomationCompositionOrderedState(
+ final AutomationCompositionOrderedState automationCompositionOrderedState) {
+ return this.name().equals(automationCompositionOrderedState.name());
+ }
+
+ public AutomationCompositionOrderedState asOrderedState() {
+ return AutomationCompositionOrderedState.valueOf(this.name());
+ }
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionStatistics.java
index 685947b13..8f73328ad 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionStatistics.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.time.Instant;
import lombok.Data;
@@ -30,16 +30,16 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@NoArgsConstructor
@Data
@ToString
-public class ControlLoopStatistics {
+public class AutomationCompositionStatistics {
@NonNull
- private ToscaConceptIdentifier controlLoopId;
+ private ToscaConceptIdentifier automationCompositionId;
@NonNull
private Instant timeStamp;
@NonNull
- private ClElementStatisticsList clElementStatisticsList;
+ private AcElementStatisticsList acElementStatisticsList;
private long eventCount;
private long lastExecutionTime;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoops.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositions.java
index 4ab406f3b..1802f814c 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoops.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositions.java
@@ -16,7 +16,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.ArrayList;
import java.util.List;
@@ -34,15 +34,15 @@ import org.onap.policy.models.base.PfUtils;
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
-public class ControlLoops {
- private List<ControlLoop> controlLoopList = new ArrayList<>();
+public class AutomationCompositions {
+ private List<AutomationComposition> automationCompositionList = new ArrayList<>();
/**
* Copy constructor, does a deep copy.
*
- * @param otherControlLoops the other element to copy from
+ * @param otherAutomationCompositions the other element to copy from
*/
- public ControlLoops(final ControlLoops otherControlLoops) {
- this.controlLoopList = PfUtils.mapList(controlLoopList, ControlLoop::new);
+ public AutomationCompositions(final AutomationCompositions otherAutomationCompositions) {
+ this.automationCompositionList = PfUtils.mapList(automationCompositionList, AutomationComposition::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java
index 198cf1a16..1a8fbc409 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java
index 336b309ce..949a7c47d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantDefinition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.ArrayList;
import java.util.List;
@@ -42,8 +42,8 @@ public class ParticipantDefinition {
private ToscaConceptIdentifier participantType;
- // List of ControlLoopElementDefinition values for a particular participant
- private List<ControlLoopElementDefinition> controlLoopElementDefinitionList = new ArrayList<>();
+ // List of AutomationCompositionElementDefinition values for a particular participant
+ private List<AutomationCompositionElementDefinition> automationCompositionElementDefinitionList = new ArrayList<>();
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
@@ -53,7 +53,8 @@ public class ParticipantDefinition {
public ParticipantDefinition(final ParticipantDefinition participantDefinition) {
this.participantId = participantDefinition.participantId;
this.participantType = participantDefinition.participantType;
- this.controlLoopElementDefinitionList = PfUtils.mapList(
- participantDefinition.controlLoopElementDefinitionList, ControlLoopElementDefinition::new);
+ this.automationCompositionElementDefinitionList =
+ PfUtils.mapList(participantDefinition.automationCompositionElementDefinitionList,
+ AutomationCompositionElementDefinition::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantHealthStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantHealthStatus.java
index e7c5fecda..f8cc0a852 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantHealthStatus.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantHealthStatus.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
/**
* Class to hold the possible values for health status of Participant.
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantState.java
index 1af32660d..4ab42c697 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantState.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantState.java
@@ -18,44 +18,43 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
/**
* Class to hold the possible values for mode of participant.
*/
public enum ParticipantState {
-
/**
- * Control Loop execution is unknown.
+ * Participant state is unknown.
*/
UNKNOWN,
/**
- * Control Loop execution is always rejected.
+ * Participant is passive, automation composition element execution is always rejected.
*/
PASSIVE,
/**
- * Control Loop execution execution proceeds, but changes to domain state or context are not carried out. The
- * participant returns an indication that it is running in SAFE mode together with the action it would have
- * performed if it was operating in ACTIVE mode.
+ * Automation composition element execution execution proceeds, but changes to domain state or context are not
+ * carried out. The participant returns an indication that it is running in SAFE mode together with the action it
+ * would have performed if it was operating in ACTIVE mode.
*/
SAFE,
/**
- * Control Loop execution execution proceeds and changes to domain and state are carried out in a test environment.
- * The participant returns an indication that it is running in TEST mode together with the action it has performed
- * on the test environment.
+ * Automation composition element execution execution proceeds and changes to domain and state are carried out in a
+ * test environment. The participant returns an indication that it is running in TEST mode together with the action
+ * it has performed on the test environment.
*/
TEST,
/**
- * Control Loop execution execution is executed in the live environment by the participant.
+ * Automation composition element execution is executed in the live environment by the participant.
*/
ACTIVE,
/**
- * Control Loop execution execution is terminated and not available.
+ * Automation composition element execution has been terminated.
*/
TERMINATED
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatistics.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatistics.java
index 3a7b21fa1..4d3b96db7 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatistics.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatistics.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.io.Serializable;
import java.time.Instant;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsList.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsList.java
index a69f96f85..4abdf4a63 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsList.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsList.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.List;
import lombok.Getter;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUpdates.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java
index ea851b8c5..1872a6144 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUpdates.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.ArrayList;
import java.util.List;
@@ -40,8 +40,8 @@ public class ParticipantUpdates {
private ToscaConceptIdentifier participantId;
- // List of ControlLoopElement values for a particular participant
- private List<ControlLoopElement> controlLoopElementList = new ArrayList<>();
+ // List of AutomationCompositionElement values for a particular participant
+ private List<AutomationCompositionElement> automationCompositionElementList = new ArrayList<>();
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
@@ -50,7 +50,7 @@ public class ParticipantUpdates {
*/
public ParticipantUpdates(final ParticipantUpdates participantUpdates) {
this.participantId = participantUpdates.participantId;
- this.controlLoopElementList = PfUtils.mapList(
- participantUpdates.controlLoopElementList, ControlLoopElement::new);
+ this.automationCompositionElementList = PfUtils.mapList(
+ participantUpdates.automationCompositionElementList, AutomationCompositionElement::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java
index c05311892..9d26ce406 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.Map;
import javax.ws.rs.core.Response;
@@ -36,7 +36,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
public final class ParticipantUtils {
private static final Coder CODER = new StandardCoder();
- private static final String CONTROL_LOOP_ELEMENT = "org.onap.policy.clamp.controlloop.ControlLoopElement";
+ private static final String AUTOMATION_COMPOSITION_ELEMENT =
+ "org.onap.policy.clamp.acm.AutomationCompositionElement";
/**
* Finds participantType from a map of properties.
@@ -57,27 +58,30 @@ public final class ParticipantUtils {
}
/**
- * Get the First StartPhase
- * it depend of the state of the Control Loop
- * and also from the all startPhase defined into the ToscaServiceTemplate.
- * @param controlLoop the ControlLoop
+ * Get the First StartPhase.
+ *
+ * <p>This depends on the state of the automation composition and also on all start phases defined in the
+ * ToscaServiceTemplate.
+ *
+ * @param automationComposition the automation composition
* @param toscaServiceTemplate the ToscaServiceTemplate
* @return the First StartPhase
*/
- public static int getFirstStartPhase(ControlLoop controlLoop, ToscaServiceTemplate toscaServiceTemplate) {
+ public static int getFirstStartPhase(
+ AutomationComposition automationComposition, ToscaServiceTemplate toscaServiceTemplate) {
var minStartPhase = 1000;
var maxStartPhase = 0;
- for (var element : controlLoop.getElements().values()) {
+ for (var element : automationComposition.getElements().values()) {
ToscaNodeTemplate toscaNodeTemplate = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates()
- .get(element.getDefinition().getName());
+ .get(element.getDefinition().getName());
int startPhase = ParticipantUtils.findStartPhase(toscaNodeTemplate.getProperties());
minStartPhase = Math.min(minStartPhase, startPhase);
maxStartPhase = Math.max(maxStartPhase, startPhase);
}
- return ControlLoopState.UNINITIALISED2PASSIVE.equals(controlLoop.getState())
- || ControlLoopState.PASSIVE2RUNNING.equals(controlLoop.getState()) ? minStartPhase
- : maxStartPhase;
+ return AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
+ || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState()) ? minStartPhase
+ : maxStartPhase;
}
/**
@@ -95,22 +99,22 @@ public final class ParticipantUtils {
}
/**
- * Checks If NodeTemplate Is ControlLoopElement.
+ * Checks if a NodeTemplate is an AutomationCompositionElement.
*
* @param nodeTemplate the ToscaNodeTemplate
* @param toscaServiceTemplate the ToscaServiceTemplate
- * @return true if NodeTemplate Is ControlLoopElement
+ * @return true if the NodeTemplate is an AutomationCompositionElement
*/
- public static boolean checkIfNodeTemplateIsControlLoopElement(ToscaNodeTemplate nodeTemplate,
- ToscaServiceTemplate toscaServiceTemplate) {
- if (nodeTemplate.getType().contains(CONTROL_LOOP_ELEMENT)) {
+ public static boolean checkIfNodeTemplateIsAutomationCompositionElement(ToscaNodeTemplate nodeTemplate,
+ ToscaServiceTemplate toscaServiceTemplate) {
+ if (nodeTemplate.getType().contains(AUTOMATION_COMPOSITION_ELEMENT)) {
return true;
} else {
var nodeType = toscaServiceTemplate.getNodeTypes().get(nodeTemplate.getType());
if (nodeType != null) {
var derivedFrom = nodeType.getDerivedFrom();
if (derivedFrom != null) {
- return derivedFrom.contains(CONTROL_LOOP_ELEMENT);
+ return derivedFrom.contains(AUTOMATION_COMPOSITION_ELEMENT);
}
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotification.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotification.java
index c6bbd81d6..4b898633a 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotification.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotification.java
@@ -16,7 +16,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.notification;
+package org.onap.policy.clamp.models.acm.messages.dmaap.notification;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
@@ -29,23 +29,23 @@ import org.apache.commons.collections4.CollectionUtils;
@Data
@NoArgsConstructor
@AllArgsConstructor
-public class ControlLoopNotification {
+public class AutomationCompositionNotification {
/**
- * Status of control loops that are being added to participants.
+ * Status of automation compositions that are being added to participants.
*/
- @SerializedName("deployed-control-loops")
- private List<ControlLoopStatus> added = new ArrayList<>();
+ @SerializedName("deployed-automation-compositions")
+ private List<AutomationCompositionStatus> added = new ArrayList<>();
/**
* Status of policies that are being deleted from PDPs.
*/
- @SerializedName("undeployed-control-loops")
- private List<ControlLoopStatus> deleted = new ArrayList<>();
+ @SerializedName("undeployed-automation-compositions")
+ private List<AutomationCompositionStatus> deleted = new ArrayList<>();
/**
- * Determines if the notification is empty (i.e., has no added or delete control loop
+ * Determines if the notification is empty (i.e., has no added or delete automation composition
* notifications).
*
* @return {@code true} if the notification is empty, {@code false} otherwise
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatus.java
index 033843e75..f65c6217b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatus.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatus.java
@@ -16,7 +16,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.notification;
+package org.onap.policy.clamp.models.acm.messages.dmaap.notification;
import com.google.gson.annotations.SerializedName;
import java.util.UUID;
@@ -28,8 +28,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@Data
@NoArgsConstructor
@AllArgsConstructor
-public class ControlLoopStatus {
- @SerializedName("control-loop-id")
+public class AutomationCompositionStatus {
+ @SerializedName("automation-composition-id")
private UUID id;
private ToscaConceptIdentifier definition;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java
index cdbfea4e2..c0a21d61a 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -27,32 +27,32 @@ import java.util.function.UnaryOperator;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementAck;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent the CONTROLLOOP_ACK message that a participant sends
- * to control loop runtime as an acknowledgement to either ControlLoopUpdate
- * or ControlLoopStateChange message.
+ * Class to represent the AUTOMATION_COMPOSITION_ACK message that a participant sends
+ * to automation composition runtime as an acknowledgement to either AUTOMATION_COMPOSITION_UPDATE
+ * or AUTOMATION_COMPOSITION_STATE_CHANGE message.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ControlLoopAck extends ParticipantAckMessage {
+public class AutomationCompositionAck extends ParticipantAckMessage {
- private ToscaConceptIdentifier controlLoopId;
+ private ToscaConceptIdentifier automationCompositionId;
private Integer startPhase;
- // A map with ControlLoopElementID as its key, and a pair of result and message as value per
- // ControlLoopElement.
- private Map<UUID, ControlLoopElementAck> controlLoopResultMap = new LinkedHashMap<>();
+ // A map with AutomationCompositionElementID as its key, and a pair of result and message as value per
+ // AutomationCompositionElement.
+ private Map<UUID, AutomationCompositionElementAck> automationCompositionResultMap = new LinkedHashMap<>();
/**
* Constructor for instantiating ParticipantRegisterAck class with message name.
*
*/
- public ControlLoopAck(final ParticipantMessageType messageType) {
+ public AutomationCompositionAck(final ParticipantMessageType messageType) {
super(messageType);
}
@@ -61,9 +61,10 @@ public class ControlLoopAck extends ParticipantAckMessage {
*
* @param source source from which to copy
*/
- public ControlLoopAck(final ControlLoopAck source) {
+ public AutomationCompositionAck(final AutomationCompositionAck source) {
super(source);
- this.controlLoopId = source.controlLoopId;
- this.controlLoopResultMap = PfUtils.mapMap(source.controlLoopResultMap, UnaryOperator.identity());
+ this.automationCompositionId = source.automationCompositionId;
+ this.automationCompositionResultMap =
+ PfUtils.mapMap(source.automationCompositionResultMap, UnaryOperator.identity());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java
index e3b7049e1..f8daa36a9 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java
@@ -18,32 +18,32 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
/**
- * Class to represent the CONTROL_LOOP_STATE_CHANGE message that the control loop runtime will send to
- * participants to change the state of a control loop they are running.
+ * Class to represent the AUTOMATION_COMPOSITION_STATE_CHANGE message that the automation composition runtime will send
+ * to participants to change the state of an automation composition they are running.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ControlLoopStateChange extends ParticipantMessage {
- private ControlLoopOrderedState orderedState;
- private ControlLoopState currentState;
+public class AutomationCompositionStateChange extends ParticipantMessage {
+ private AutomationCompositionOrderedState orderedState;
+ private AutomationCompositionState currentState;
private Integer startPhase;
/**
- * Constructor for instantiating ControlLoopStateChange class with message name.
+ * Constructor for instantiating class with message name.
*
*/
- public ControlLoopStateChange() {
- super(ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ public AutomationCompositionStateChange() {
+ super(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
}
/**
@@ -51,7 +51,7 @@ public class ControlLoopStateChange extends ParticipantMessage {
*
* @param source source from which to copy
*/
- public ControlLoopStateChange(ControlLoopStateChange source) {
+ public AutomationCompositionStateChange(AutomationCompositionStateChange source) {
super(source);
this.orderedState = source.orderedState;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdate.java
index f8a47c7c9..55fcc7462 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdate.java
@@ -18,36 +18,37 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
import org.onap.policy.models.base.PfUtils;
/**
- * Class to represent the CONTROL_LOOP_UPDATE message that the control loop runtime sends to a participant.
- * When a participant receives this message, it creates the control loop elements contained in the message and sets them
- * to state PASSIVE. subsequent CONTROL_LOOP_STATE_CHANGE messages are used to activate the control loops.
+ * Class to represent the AUTOMATION_COMPOSITION_UPDATE message that the automation composition runtime sends to a
+ * participant. When a participant receives this message, it creates the automation composition elements contained in
+ * the message and sets them to state PASSIVE. subsequent AUTOMATION_COMPOSITION_STATE_CHANGE messages are used to
+ * activate the automation compositions.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ControlLoopUpdate extends ParticipantMessage {
+public class AutomationCompositionUpdate extends ParticipantMessage {
// A list of ParticipantUpdates instances which carries details of an updated participant.
private List<ParticipantUpdates> participantUpdatesList = new ArrayList<>();
private Integer startPhase = 0;
/**
- * Constructor for instantiating ControlLoopUpdate class with message name.
+ * Constructor for instantiating class with message name.
*
*/
- public ControlLoopUpdate() {
- super(ParticipantMessageType.CONTROL_LOOP_UPDATE);
+ public AutomationCompositionUpdate() {
+ super(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
}
/**
@@ -55,10 +56,9 @@ public class ControlLoopUpdate extends ParticipantMessage {
*
* @param source source from which to copy
*/
- public ControlLoopUpdate(ControlLoopUpdate source) {
+ public AutomationCompositionUpdate(AutomationCompositionUpdate source) {
super(source);
- this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList,
- ParticipantUpdates::new);
+ this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList, ParticipantUpdates::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java
index 8a1be69bd..8b33d3172 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.util.UUID;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -104,7 +104,7 @@ public class ParticipantAckMessage {
return false;
}
- // Broadcast message to all control loop elements on this participant
+ // Broadcast message to all automation composition elements on this participant
if (this.participantId == null) {
return true;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregister.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregister.java
index 7705e3d0c..2e7ed8c52 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregister.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregister.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_DEREGISTER message that all the participants send to control loop runtime.
+ * Class to represent the PARTICIPANT_DEREGISTER message that all the participants send to the ACM runtime.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAck.java
index 69406beb7..afa987d65 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAck.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_DEREGISTER_ACK message that control loop runtime sends to the participant.
+ * Class to represent the PARTICIPANT_DEREGISTER_ACK message that the ACM runtime sends to the participant.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java
index f98a88c3b..c358376b2 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessage.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.time.Instant;
import java.util.UUID;
@@ -30,7 +30,7 @@ import lombok.ToString;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent the base class for various messages that will be exchanged between the control loop runtime and
+ * Class to represent the base class for various messages that will be exchanged between the ACM runtime and
* participants.
*/
@Getter
@@ -58,9 +58,9 @@ public class ParticipantMessage {
private ToscaConceptIdentifier participantId;
/**
- * Control loop ID, or {@code null} for messages to participants.
+ * Automation Composition ID, or {@code null} for messages to participants.
*/
- private ToscaConceptIdentifier controlLoopId;
+ private ToscaConceptIdentifier automationCompositionId;
/**
* Constructor for instantiating a participant message class.
@@ -80,7 +80,7 @@ public class ParticipantMessage {
this.messageType = source.messageType;
this.participantType = source.participantType;
this.participantId = source.participantId;
- this.controlLoopId = source.controlLoopId;
+ this.automationCompositionId = source.automationCompositionId;
}
/**
@@ -101,7 +101,7 @@ public class ParticipantMessage {
return false;
}
- // Broadcast message to all control loop elements on this participant
+ // Broadcast message to all automation composition elements on this participant
if (this.participantId == null) {
return true;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java
new file mode 100644
index 000000000..4f6bcdbf3
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
+
+/**
+ * Class to hold the possible values for the type of participant messages.
+ */
+public enum ParticipantMessageType {
+
+ /**
+ * Used by participants to report status to the automation composition runtime.
+ */
+ PARTICIPANT_STATUS,
+
+ /**
+ * Used by the acm runtime to change the state of participants, triggers a
+ * PARTICIPANT_STATUS message with the result of the PARTICIPANT_STATE_CHANGE operation.
+ */
+ PARTICIPANT_STATE_CHANGE,
+
+ /**
+ * Used by acm runtime to update the automation compositions running on participants, triggers a
+ * PARTICIPANT_STATUS message with the result of the AUTOMATION_COMPOSITION_UPDATE operation.
+ */
+ AUTOMATION_COMPOSITION_UPDATE,
+
+ /**
+ * Used by acm runtime to change the state of automation compositions in participants, triggers a
+ * PARTICIPANT_STATUS message with result of AUTOMATION_COMPOSITION_STATE_CHANGE operation.
+ */
+ AUTOMATION_COMPOSITION_STATE_CHANGE,
+
+ /**
+ * Used by the automation composition runtime to order a health check on participants, triggers a
+ * PARTICIPANT_STATUS message with the result of the PARTICIPANT_HEALTH_CHECK operation.
+ */
+ PARTICIPANT_HEALTH_CHECK,
+
+ /**
+ * Used by participant to register itself with automation composition runtime.
+ */
+ PARTICIPANT_REGISTER,
+
+ /**
+ * Used by automation composition runtime to respond to participant registration.
+ */
+ PARTICIPANT_REGISTER_ACK,
+
+ /**
+ * Used by participant to deregister itself with automation composition runtime.
+ */
+ PARTICIPANT_DEREGISTER,
+
+ /**
+ * Used by automation composition runtime to respond to participant deregistration.
+ */
+ PARTICIPANT_DEREGISTER_ACK,
+
+ /**
+ * Used by automation composition runtime to send ToscaServiceTemplate to participant.
+ */
+ PARTICIPANT_UPDATE,
+
+ /**
+ * Used by participant to acknowledge the receipt of PARTICIPANT_UPDATE message
+ * from automation composition runtime.
+ */
+ PARTICIPANT_UPDATE_ACK,
+
+ /**
+ * Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_UPDATE message
+ * from automation composition runtime.
+ */
+ AUTOMATION_COMPOSITION_UPDATE_ACK,
+
+ /**
+ * Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_STATE_CHANGE message
+ * from automation composition runtime.
+ */
+ AUTOMATION_COMPOSITION_STATECHANGE_ACK,
+
+ /**
+ * Used by automation composition runtime to request for PARTICIPANT_STATUS message immediately.
+ */
+ PARTICIPANT_STATUS_REQ
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegister.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegister.java
index af0149189..7b315dbe0 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegister.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegister.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_REGISTER message that all the participants send to control loop runtime.
+ * Class to represent the PARTICIPANT_REGISTER message that all the participants send to the ACM runtime.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAck.java
index 28d51be93..60858be4c 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAck.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_REGISTER_ACK message that control loop runtime sends to registered participant.
+ * Class to represent the PARTICIPANT_REGISTER_ACK message that the ACM runtime sends to a registered participant.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantResponseStatus.java
index f014529b3..cb0307742 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseStatus.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantResponseStatus.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
/**
* Class to hold the possible values for participant response status.
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatus.java
index 8600b4b5b..32b95e11b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatus.java
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
import org.onap.policy.models.base.PfUtils;
/**
- * Class to represent the PARTICIPANT_STATUS message that all the participants send to the control loop runtime.
+ * Class to represent the PARTICIPANT_STATUS message that all the participants send to the ACM runtime.
*/
@Getter
@Setter
@@ -49,8 +49,8 @@ public class ParticipantStatus extends ParticipantMessage {
// A list of ParticipantDefinition updates, returned in response to ParticipantStatusReq only
private List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
- // List of ControlLoopInfo types with ControlLoopId, its state and statistics
- private List<ControlLoopInfo> controlLoopInfoList = new ArrayList<>();
+ // List of AutomationCompositionInfo types with AutomationCompositionId, its state and statistics
+ private List<AutomationCompositionInfo> automationCompositionInfoList = new ArrayList<>();
/**
* Constructor for instantiating ParticipantStatus class with message name.
@@ -71,8 +71,9 @@ public class ParticipantStatus extends ParticipantMessage {
this.state = source.state;
this.healthStatus = source.healthStatus;
this.participantStatistics = (source.participantStatistics == null ? null : new ParticipantStatistics());
- this.participantDefinitionUpdates = PfUtils.mapList(source.participantDefinitionUpdates,
- ParticipantDefinition::new);
- this.controlLoopInfoList = PfUtils.mapList(source.controlLoopInfoList, ControlLoopInfo::new);
+ this.participantDefinitionUpdates =
+ PfUtils.mapList(source.participantDefinitionUpdates, ParticipantDefinition::new);
+ this.automationCompositionInfoList =
+ PfUtils.mapList(source.automationCompositionInfoList, AutomationCompositionInfo::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReq.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReq.java
index 9242cea02..82260ee67 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReq.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReq.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_STATUS_REQ message that controlloop runtime
+ * Class to represent the PARTICIPANT_STATUS_REQ message that the ACM runtime
* sends to participants for an immediate ParticipantStatus from participants.
*/
@Getter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdate.java
index 72db7d97e..36842a8cf 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdate.java
@@ -19,19 +19,19 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.models.base.PfUtils;
/**
- * Class to represent the PARTICIPANT_UPDATE message that the control loop runtime sends to a participant.
- * ControlLoop Runtime sends Control Loop Element Definitions and Common Parameter Values to Participants.
+ * Class to represent the PARTICIPANT_UPDATE message that the ACM runtime sends to a participant.
+ * the ACM Runtime sends automation composition element Definitions and Common Parameter Values to Participants.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAck.java
index d38fa4bb2..2c3a68e22 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAck.java
@@ -20,14 +20,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_UPDATE_ACK message that registered participant sends to controlloop runtime.
+ * Class to represent the PARTICIPANT_UPDATE_ACK message that registered participant sends to the ACM runtime.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/GenericNameVersion.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java
index a48af9223..3e39e970d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/GenericNameVersion.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java
@@ -17,7 +17,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest;
+package org.onap.policy.clamp.models.acm.messages.rest;
import lombok.Data;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/SimpleResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java
index 2bd09c632..1668652b7 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/SimpleResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java
@@ -16,7 +16,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest;
+package org.onap.policy.clamp.models.acm.messages.rest;
import lombok.Getter;
import lombok.Setter;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/TypedSimpleResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/TypedSimpleResponse.java
index 199ac8ee1..871eb3bc2 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/TypedSimpleResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/TypedSimpleResponse.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest;
+package org.onap.policy.clamp.models.acm.messages.rest;
import lombok.Getter;
import lombok.Setter;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/commissioning/CommissioningResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/commissioning/CommissioningResponse.java
index 6363db8d2..42ce79843 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/commissioning/CommissioningResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/commissioning/CommissioningResponse.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.commissioning;
+package org.onap.policy.clamp.models.acm.messages.rest.commissioning;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -34,5 +34,5 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@Setter
@ToString(callSuper = true)
public class CommissioningResponse extends SimpleResponse {
- private List<ToscaConceptIdentifier> affectedControlLoopDefinitions;
+ private List<ToscaConceptIdentifier> affectedAutomationCompositionDefinitions;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopOrderStateResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionOrderStateResponse.java
index dcc63a538..a87433d4c 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopOrderStateResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionOrderStateResponse.java
@@ -17,16 +17,16 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.messages.rest.GenericNameVersion;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.messages.rest.GenericNameVersion;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
/**
@@ -35,9 +35,9 @@ import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
@Getter
@Setter
@ToString(callSuper = true)
-public class ControlLoopOrderStateResponse extends SimpleResponse {
+public class AutomationCompositionOrderStateResponse extends SimpleResponse {
- private ControlLoopOrderedState orderedState = ControlLoopOrderedState.UNINITIALISED;
+ private AutomationCompositionOrderedState orderedState = AutomationCompositionOrderedState.UNINITIALISED;
- private List<GenericNameVersion> controlLoopIdentifierList = new ArrayList<>();
+ private List<GenericNameVersion> automationCompositionIdentifierList = new ArrayList<>();
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimed.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimed.java
index d6e670060..34556653b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimed.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimed.java
@@ -17,12 +17,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import lombok.Data;
@Data
-public class ControlLoopPrimed {
+public class AutomationCompositionPrimed {
private String name;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimedResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimedResponse.java
index 4d2dfaf01..fa3e8fad7 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimedResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimedResponse.java
@@ -17,23 +17,23 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
/**
- * Response to provide all primed controlLoops.
+ * Response to provide all primed automation compositions.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ControlLoopPrimedResponse extends SimpleResponse {
+public class AutomationCompositionPrimedResponse extends SimpleResponse {
- private List<ControlLoopPrimed> primedControlLoopsList = new ArrayList<>();
+ private List<AutomationCompositionPrimed> primedAutomationCompositionsList = new ArrayList<>();
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstancePropertiesResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstancePropertiesResponse.java
index d8974d6e3..0341d5dae 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstancePropertiesResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstancePropertiesResponse.java
@@ -17,14 +17,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommand.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommand.java
index 71b7ab92c..a3fb70e15 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommand.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommand.java
@@ -18,18 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import java.util.List;
import lombok.Data;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@Data
public class InstantiationCommand {
- // The state to which the control loops are to be set
- private ControlLoopOrderedState orderedState;
+ // The state to which the automation compositions are to be set
+ private AutomationCompositionOrderedState orderedState;
- // The list of control loops on which the command is to be issued
- private List<ToscaConceptIdentifier> controlLoopIdentifierList;
+ // The list of automation compositions on which the command is to be issued
+ private List<ToscaConceptIdentifier> automationCompositionIdentifierList;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationOrderStateResponse.java
index 1ddce7840..e6bdaee9d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationOrderStateResponse.java
@@ -19,13 +19,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
/**
* Response to instantiation OrderState.
@@ -35,5 +35,5 @@ import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
@ToString(callSuper = true)
public class InstantiationOrderStateResponse extends SimpleResponse {
- private ControlLoopOrderedState orderedState;
+ private AutomationCompositionOrderedState orderedState;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationResponse.java
index d932f29ac..e7c346498 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationResponse.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -34,5 +34,5 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@Setter
@ToString(callSuper = true)
public class InstantiationResponse extends SimpleResponse {
- private List<ToscaConceptIdentifier> affectedControlLoops;
+ private List<ToscaConceptIdentifier> affectedAutomationCompositions;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatistics.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatistics.java
index 956f1db02..4a046052e 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatistics.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatistics.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import java.io.Serializable;
import java.util.List;
@@ -37,8 +37,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.builder.CompareToBuilder;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
@@ -49,17 +49,17 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent a controlloop element statistics in the database.
+ * Class to represent automation composition element statistics in the database.
*
* @author Ramesh Murugan Iyer (ramesh.murugan.iyer@est.tech)
*/
@Entity
-@Table(name = "ClElementStatistics")
+@Table(name = "AcElementStatistics")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
-public class JpaClElementStatistics extends PfConcept implements PfAuthorative<ClElementStatistics>, Serializable {
+public class JpaAcElementStatistics extends PfConcept implements PfAuthorative<AcElementStatistics>, Serializable {
private static final long serialVersionUID = 621426717868738629L;
@@ -79,36 +79,36 @@ public class JpaClElementStatistics extends PfConcept implements PfAuthorative<C
@Column
@NotNull
- private ControlLoopState state;
+ private AutomationCompositionState state;
@Column
- private long clElementUptime;
+ private long acElementUptime;
/**
- * The Default Constructor creates a {@link JpaClElementStatistics} object with a null key.
+ * The Default Constructor creates a {@link JpaAcElementStatistics} object with a null key.
*/
- public JpaClElementStatistics() {
+ public JpaAcElementStatistics() {
this(new PfReferenceTimestampKey());
}
/**
- * The Key Constructor creates a {@link JpaClElementStatistics} object with the given Reference Timestamp key.
+ * The Key Constructor creates a {@link JpaAcElementStatistics} object with the given Reference Timestamp key.
*
* @param key the key
*/
- public JpaClElementStatistics(@NonNull final PfReferenceTimestampKey key) {
- this(key, new PfConceptKey(), ControlLoopState.PASSIVE, 0L);
+ public JpaAcElementStatistics(@NonNull final PfReferenceTimestampKey key) {
+ this(key, new PfConceptKey(), AutomationCompositionState.PASSIVE, 0L);
}
/**
- * The Key Constructor creates a {@link JpaClElementStatistics} object with all mandatory fields.
+ * The Key Constructor creates a {@link JpaAcElementStatistics} object with all mandatory fields.
*
* @param key the key
- * @param participantId the TOSCA definition of the control loop element
+ * @param participantId the TOSCA definition of the automation composition element
*/
- public JpaClElementStatistics(@NonNull final PfReferenceTimestampKey key,
+ public JpaAcElementStatistics(@NonNull final PfReferenceTimestampKey key,
@NonNull final PfConceptKey participantId) {
this.key = key;
this.participantId = participantId;
@@ -119,12 +119,12 @@ public class JpaClElementStatistics extends PfConcept implements PfAuthorative<C
*
* @param copyConcept the concept to copy from
*/
- public JpaClElementStatistics(@NonNull final JpaClElementStatistics copyConcept) {
+ public JpaAcElementStatistics(@NonNull final JpaAcElementStatistics copyConcept) {
super(copyConcept);
this.key = new PfReferenceTimestampKey(copyConcept.key);
this.participantId = new PfConceptKey(copyConcept.participantId);
this.state = copyConcept.state;
- this.clElementUptime = copyConcept.clElementUptime;
+ this.acElementUptime = copyConcept.acElementUptime;
}
@@ -133,36 +133,36 @@ public class JpaClElementStatistics extends PfConcept implements PfAuthorative<C
*
* @param authorativeConcept the authorative concept to copy from
*/
- public JpaClElementStatistics(@NonNull final ClElementStatistics authorativeConcept) {
+ public JpaAcElementStatistics(@NonNull final AcElementStatistics authorativeConcept) {
this.fromAuthorative(authorativeConcept);
}
@Override
- public ClElementStatistics toAuthorative() {
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setId(UUID.fromString(getKey().getReferenceKey().getLocalName()));
- clElementStatistics.setTimeStamp(key.getInstant());
- clElementStatistics.setParticipantId(new ToscaConceptIdentifier(participantId));
- clElementStatistics.setControlLoopState(state);
- clElementStatistics.setClElementUptime(clElementUptime);
-
- return clElementStatistics;
+ public AcElementStatistics toAuthorative() {
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setId(UUID.fromString(getKey().getReferenceKey().getLocalName()));
+ acElementStatistics.setTimeStamp(key.getInstant());
+ acElementStatistics.setParticipantId(new ToscaConceptIdentifier(participantId));
+ acElementStatistics.setState(state);
+ acElementStatistics.setAcElementUptime(acElementUptime);
+
+ return acElementStatistics;
}
@Override
- public void fromAuthorative(@NonNull ClElementStatistics clElementStatistics) {
+ public void fromAuthorative(@NonNull AcElementStatistics acElementStatistics) {
// @formatter:off
if (this.key == null || this.getKey().isNullKey()) {
- this.setKey(new PfReferenceTimestampKey(clElementStatistics.getParticipantId().getName(),
- clElementStatistics.getParticipantId().getVersion(), clElementStatistics.getId().toString(),
- clElementStatistics.getTimeStamp()));
+ this.setKey(new PfReferenceTimestampKey(acElementStatistics.getParticipantId().getName(),
+ acElementStatistics.getParticipantId().getVersion(), acElementStatistics.getId().toString(),
+ acElementStatistics.getTimeStamp()));
}
// @formatter:on
- this.setParticipantId(clElementStatistics.getParticipantId().asConceptKey());
- this.setState(clElementStatistics.getControlLoopState());
- this.setClElementUptime(clElementStatistics.getClElementUptime());
+ this.setParticipantId(acElementStatistics.getParticipantId().asConceptKey());
+ this.setState(acElementStatistics.getState());
+ this.setAcElementUptime(acElementStatistics.getAcElementUptime());
}
@Override
@@ -189,8 +189,8 @@ public class JpaClElementStatistics extends PfConcept implements PfAuthorative<C
return getClass().getName().compareTo(otherConcept.getClass().getName());
}
- final JpaClElementStatistics other = (JpaClElementStatistics) otherConcept;
+ final JpaAcElementStatistics other = (JpaAcElementStatistics) otherConcept;
return new CompareToBuilder().append(this.key, other.key).append(this.state, other.state)
- .append(this.clElementUptime, other.clElementUptime).toComparison();
+ .append(this.acElementUptime, other.acElementUptime).toComparison();
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
index adc300607..e5c44d0a2 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import java.util.LinkedHashMap;
import java.util.List;
@@ -39,10 +39,10 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
@@ -55,16 +55,16 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent a control loop in the database.
+ * Class to represent a automation composition in the database.
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
@Entity
-@Table(name = "ControlLoop")
+@Table(name = "AutomationComposition")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLoop> {
+public class JpaAutomationComposition extends PfConcept implements PfAuthorative<AutomationComposition> {
private static final long serialVersionUID = -4725410933242154805L;
@EmbeddedId
@@ -82,11 +82,11 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
@Column
@NotNull
- private ControlLoopState state;
+ private AutomationCompositionState state;
@Column
@NotNull
- private ControlLoopOrderedState orderedState;
+ private AutomationCompositionOrderedState orderedState;
@Column
private String description;
@@ -96,34 +96,36 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@NotNull
- private Map<@NotNull UUID, @NotNull @Valid JpaControlLoopElement> elements;
+ private Map<@NotNull UUID, @NotNull @Valid JpaAutomationCompositionElement> elements;
+ // @formatter:on
/**
- * The Default Constructor creates a {@link JpaControlLoop} object with a null key.
+ * The Default Constructor creates a {@link JpaAutomationComposition} object with a null key.
*/
- public JpaControlLoop() {
+ public JpaAutomationComposition() {
this(new PfConceptKey());
}
/**
- * The Key Constructor creates a {@link JpaControlLoop} object with the given concept key.
+ * The Key Constructor creates a {@link JpaAutomationComposition} object with the given concept key.
*
* @param key the key
*/
- public JpaControlLoop(@NonNull final PfConceptKey key) {
- this(key, new PfConceptKey(), ControlLoopState.UNINITIALISED, new LinkedHashMap<>());
+ public JpaAutomationComposition(@NonNull final PfConceptKey key) {
+ this(key, new PfConceptKey(), AutomationCompositionState.UNINITIALISED, new LinkedHashMap<>());
}
/**
- * The Key Constructor creates a {@link JpaControlLoop} object with all mandatory fields.
+ * The Key Constructor creates a {@link JpaAutomationComposition} object with all mandatory fields.
*
* @param key the key
- * @param definition the TOSCA definition of the control loop
- * @param state the state of the control loop
- * @param elements the elements of the control looop in participants
+ * @param definition the TOSCA definition of the automation composition
+ * @param state the state of the automation composition
+ * @param elements the elements of the automation composition in participants
*/
- public JpaControlLoop(@NonNull final PfConceptKey key, @NonNull final PfConceptKey definition,
- @NonNull final ControlLoopState state, @NonNull final Map<UUID, JpaControlLoopElement> elements) {
+ public JpaAutomationComposition(@NonNull final PfConceptKey key, @NonNull final PfConceptKey definition,
+ @NonNull final AutomationCompositionState state,
+ @NonNull final Map<UUID, JpaAutomationCompositionElement> elements) {
this.key = key;
this.definition = definition;
this.state = state;
@@ -135,14 +137,15 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
*
* @param copyConcept the concept to copy from
*/
- public JpaControlLoop(@NonNull final JpaControlLoop copyConcept) {
+ public JpaAutomationComposition(@NonNull final JpaAutomationComposition copyConcept) {
super(copyConcept);
this.key = new PfConceptKey(copyConcept.key);
this.definition = new PfConceptKey(copyConcept.definition);
this.state = copyConcept.state;
this.orderedState = copyConcept.orderedState;
this.description = copyConcept.description;
- this.elements = PfUtils.mapMap(copyConcept.elements, JpaControlLoopElement::new, new LinkedHashMap<>(0));
+ this.elements =
+ PfUtils.mapMap(copyConcept.elements, JpaAutomationCompositionElement::new, new LinkedHashMap<>(0));
this.primed = copyConcept.primed;
}
@@ -151,44 +154,46 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
*
* @param authorativeConcept the authorative concept to copy from
*/
- public JpaControlLoop(@NonNull final ControlLoop authorativeConcept) {
+ public JpaAutomationComposition(@NonNull final AutomationComposition authorativeConcept) {
this.fromAuthorative(authorativeConcept);
}
@Override
- public ControlLoop toAuthorative() {
- var controlLoop = new ControlLoop();
-
- controlLoop.setName(getKey().getName());
- controlLoop.setVersion(getKey().getVersion());
- controlLoop.setDefinition(new ToscaConceptIdentifier(definition));
- controlLoop.setState(state);
- controlLoop.setOrderedState(orderedState != null ? orderedState : state.asOrderedState());
- controlLoop.setDescription(description);
- controlLoop.setElements(PfUtils.mapMap(elements, JpaControlLoopElement::toAuthorative, new LinkedHashMap<>(0)));
- controlLoop.setPrimed(primed);
-
- return controlLoop;
+ public AutomationComposition toAuthorative() {
+ var automationComposition = new AutomationComposition();
+
+ automationComposition.setName(getKey().getName());
+ automationComposition.setVersion(getKey().getVersion());
+ automationComposition.setDefinition(new ToscaConceptIdentifier(definition));
+ automationComposition.setState(state);
+ automationComposition.setOrderedState(orderedState != null ? orderedState : state.asOrderedState());
+ automationComposition.setDescription(description);
+ automationComposition.setElements(
+ PfUtils.mapMap(elements, JpaAutomationCompositionElement::toAuthorative, new LinkedHashMap<>(0)));
+ automationComposition.setPrimed(primed);
+
+ return automationComposition;
}
@Override
- public void fromAuthorative(@NonNull final ControlLoop controlLoop) {
+ public void fromAuthorative(@NonNull final AutomationComposition automationComposition) {
if (this.key == null || this.getKey().isNullKey()) {
- this.setKey(new PfConceptKey(controlLoop.getName(), controlLoop.getVersion()));
+ this.setKey(new PfConceptKey(automationComposition.getName(), automationComposition.getVersion()));
}
- this.definition = controlLoop.getDefinition().asConceptKey();
- this.state = controlLoop.getState();
- this.orderedState = controlLoop.getOrderedState();
- this.description = controlLoop.getDescription();
- this.primed = controlLoop.getPrimed();
-
- this.elements = new LinkedHashMap<>(controlLoop.getElements().size());
- for (Entry<UUID, ControlLoopElement> elementEntry : controlLoop.getElements().entrySet()) {
- var jpaControlLoopElement = new JpaControlLoopElement();
- jpaControlLoopElement.setKey(new PfReferenceKey(getKey(), elementEntry.getValue().getId().toString()));
- jpaControlLoopElement.fromAuthorative(elementEntry.getValue());
- this.elements.put(elementEntry.getKey(), jpaControlLoopElement);
+ this.definition = automationComposition.getDefinition().asConceptKey();
+ this.state = automationComposition.getState();
+ this.orderedState = automationComposition.getOrderedState();
+ this.description = automationComposition.getDescription();
+ this.primed = automationComposition.getPrimed();
+
+ this.elements = new LinkedHashMap<>(automationComposition.getElements().size());
+ for (Entry<UUID, AutomationCompositionElement> elementEntry : automationComposition.getElements().entrySet()) {
+ var jpaAutomationCompositionElement = new JpaAutomationCompositionElement();
+ jpaAutomationCompositionElement
+ .setKey(new PfReferenceKey(getKey(), elementEntry.getValue().getId().toString()));
+ jpaAutomationCompositionElement.fromAuthorative(elementEntry.getValue());
+ this.elements.put(elementEntry.getKey(), jpaAutomationCompositionElement);
}
}
@@ -198,7 +203,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
keyList.add(definition);
- for (JpaControlLoopElement element : elements.values()) {
+ for (JpaAutomationCompositionElement element : elements.values()) {
keyList.addAll(element.getKeys());
}
@@ -211,7 +216,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
definition.clean();
description = (description == null ? null : description.trim());
- for (JpaControlLoopElement element : elements.values()) {
+ for (JpaAutomationCompositionElement element : elements.values()) {
element.clean();
}
}
@@ -228,7 +233,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
return this.getClass().getName().compareTo(otherConcept.getClass().getName());
}
- final JpaControlLoop other = (JpaControlLoop) otherConcept;
+ final JpaAutomationComposition other = (JpaAutomationComposition) otherConcept;
int result = key.compareTo(other.key);
if (result != 0) {
return result;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
index 22773e064..08d8ee06b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import java.util.List;
import java.util.UUID;
@@ -35,9 +35,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
@@ -48,16 +48,16 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent a participant control loop element in the database.
+ * Class to represent a participant automation composition element in the database.
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
@Entity
-@Table(name = "ControlLoopElement")
+@Table(name = "AutomationCompositionElement")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class JpaControlLoopElement extends PfConcept implements PfAuthorative<ControlLoopElement> {
+public class JpaAutomationCompositionElement extends PfConcept implements PfAuthorative<AutomationCompositionElement> {
private static final long serialVersionUID = -1791732273187890213L;
@EmbeddedId
@@ -86,41 +86,41 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co
@Column
@NotNull
- private ControlLoopState state;
+ private AutomationCompositionState state;
@Column
@NotNull
- private ControlLoopOrderedState orderedState;
+ private AutomationCompositionOrderedState orderedState;
@Column
private String description;
/**
- * The Default Constructor creates a {@link JpaControlLoopElement} object with a null key.
+ * The Default Constructor creates a {@link JpaAutomationCompositionElement} object with a null key.
*/
- public JpaControlLoopElement() {
+ public JpaAutomationCompositionElement() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link JpaControlLoopElement} object with the given concept key.
+ * The Key Constructor creates a {@link JpaAutomationCompositionElement} object with the given concept key.
*
* @param key the key
*/
- public JpaControlLoopElement(@NonNull final PfReferenceKey key) {
- this(key, new PfConceptKey(), new PfConceptKey(), ControlLoopState.UNINITIALISED);
+ public JpaAutomationCompositionElement(@NonNull final PfReferenceKey key) {
+ this(key, new PfConceptKey(), new PfConceptKey(), AutomationCompositionState.UNINITIALISED);
}
/**
- * The Key Constructor creates a {@link JpaControlLoopElement} object with all mandatory fields.
+ * The Key Constructor creates a {@link JpaAutomationCompositionElement} object with all mandatory fields.
*
* @param key the key
- * @param definition the TOSCA definition of the control loop element
- * @param participantType the TOSCA definition of the participant running the control loop element
- * @param state the state of the control loop
+ * @param definition the TOSCA definition of the automation composition element
+ * @param participantType the TOSCA definition of the participant running the automation composition element
+ * @param state the state of the automation composition
*/
- public JpaControlLoopElement(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey definition,
- @NonNull final PfConceptKey participantType, @NonNull final ControlLoopState state) {
+ public JpaAutomationCompositionElement(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey definition,
+ @NonNull final PfConceptKey participantType, @NonNull final AutomationCompositionState state) {
this.key = key;
this.definition = definition;
this.participantType = participantType;
@@ -132,7 +132,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co
*
* @param copyConcept the concept to copy from
*/
- public JpaControlLoopElement(@NonNull final JpaControlLoopElement copyConcept) {
+ public JpaAutomationCompositionElement(@NonNull final JpaAutomationCompositionElement copyConcept) {
super(copyConcept);
this.key = new PfReferenceKey(copyConcept.key);
this.definition = new PfConceptKey(copyConcept.definition);
@@ -148,13 +148,13 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co
*
* @param authorativeConcept the authorative concept to copy from
*/
- public JpaControlLoopElement(@NonNull final ControlLoopElement authorativeConcept) {
+ public JpaAutomationCompositionElement(@NonNull final AutomationCompositionElement authorativeConcept) {
this.fromAuthorative(authorativeConcept);
}
@Override
- public ControlLoopElement toAuthorative() {
- var element = new ControlLoopElement();
+ public AutomationCompositionElement toAuthorative() {
+ var element = new AutomationCompositionElement();
element.setId(UUID.fromString(getKey().getLocalName()));
element.setDefinition(new ToscaConceptIdentifier(definition));
@@ -168,7 +168,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co
}
@Override
- public void fromAuthorative(@NonNull final ControlLoopElement element) {
+ public void fromAuthorative(@NonNull final AutomationCompositionElement element) {
if (this.key == null || this.getKey().isNullKey()) {
this.setKey(new PfReferenceKey());
getKey().setLocalName(element.getId().toString());
@@ -217,7 +217,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co
return this.getClass().getName().compareTo(otherConcept.getClass().getName());
}
- final JpaControlLoopElement other = (JpaControlLoopElement) otherConcept;
+ final JpaAutomationCompositionElement other = (JpaAutomationCompositionElement) otherConcept;
int result = key.compareTo(other.key);
if (result != 0) {
return result;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java
index c8c26a8de..143499c0d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import java.io.Serializable;
import java.util.List;
@@ -33,9 +33,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatistics.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatistics.java
index 2e5188abe..a076433bb 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatistics.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatistics.java
@@ -21,7 +21,7 @@
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import java.io.Serializable;
import java.util.List;
@@ -37,9 +37,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.builder.CompareToBuilder;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
@@ -50,7 +50,7 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent a control loop statistics in the database.
+ * Class to represent a participant statistics in the database.
*
* @author Ramesh Murugan Iyer (ramesh.murugan.iyer@est.tech)
*/
@@ -124,7 +124,7 @@ public class JpaParticipantStatistics extends PfConcept implements PfAuthorative
* The Key Constructor creates a {@link JpaParticipantStatistics} object with all mandatory fields.
*
* @param key the key
- * @param participantId the TOSCA definition of the control loop participant
+ * @param participantId the TOSCA definition of the participant
*/
public JpaParticipantStatistics(@NonNull final PfTimestampKey key, @NonNull final PfConceptKey participantId) {
this.key = key;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProvider.java
index 3a7fa9c87..59ddcc2ea 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import java.time.Instant;
import java.util.List;
@@ -27,9 +27,9 @@ import java.util.stream.Collectors;
import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
import lombok.NonNull;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ClElementStatisticsRepository;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAcElementStatistics;
+import org.onap.policy.clamp.models.acm.persistence.repository.AcElementStatisticsRepository;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfReferenceTimestampKey;
import org.onap.policy.models.dao.PfFilterParameters;
@@ -37,87 +37,89 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
- * This class provides the provision of information on control loop element statistics in the database to callers.
+ * This class provides the provision of information on automation composition element statistics in the database to
+ * callers.
*
* @author Ramesh Murugan Iyer (ramesh.murugan.iyer@est.tech)
*/
@Service
@Transactional
@AllArgsConstructor
-public class ClElementStatisticsProvider {
+public class AcElementStatisticsProvider {
- private ClElementStatisticsRepository clElementStatisticsRepository;
+ private AcElementStatisticsRepository acElementStatisticsRepository;
/**
- * Creates control loop element statistics.
+ * Creates automation composition element statistics.
*
- * @param clElementStatisticsList a specification of the CL element statistics to create
- * @return the clElement statistics created
+ * @param acElementStatisticsList a specification of the statistics to create
+ * @return the Element statistics created
* @throws PfModelException on initiation errors
*/
- public List<ClElementStatistics> createClElementStatistics(
- @NonNull final List<ClElementStatistics> clElementStatisticsList) throws PfModelException {
+ public List<AcElementStatistics> createAcElementStatistics(
+ @NonNull final List<AcElementStatistics> acElementStatisticsList) throws PfModelException {
try {
- var jpaClElementStatisticsList = ProviderUtils.getJpaAndValidateList(clElementStatisticsList,
- JpaClElementStatistics::new, "control loop element statistics");
+ var jpaAcElementStatisticsList = ProviderUtils.getJpaAndValidateList(acElementStatisticsList,
+ JpaAcElementStatistics::new, "automation composition element statistics");
- var jpaClElementStatisticsSaved = clElementStatisticsRepository.saveAll(jpaClElementStatisticsList);
+ var jpaAcElementStatisticsSaved = acElementStatisticsRepository.saveAll(jpaAcElementStatisticsList);
- // Return the saved control loop element statistics
- return asClElementStatisticsList(jpaClElementStatisticsSaved);
+ // Return the saved automation composition element statistics
+ return asAcElementStatisticsList(jpaAcElementStatisticsSaved);
} catch (IllegalArgumentException e) {
- throw new PfModelException(Status.BAD_REQUEST, "Error in save control loop element statistics", e);
+ throw new PfModelException(Status.BAD_REQUEST, "Error in save automation composition element statistics",
+ e);
}
}
/**
- * Convert JPA clElement statistics list to clElement statistics list.
+ * Convert JPA acElement statistics list to acElement statistics list.
*
- * @param jpaClElementStatistics the list to convert
- * @return the clElement statistics list
+ * @param jpaAcElementStatistics the list to convert
+ * @return the acElement statistics list
*/
- private List<ClElementStatistics> asClElementStatisticsList(List<JpaClElementStatistics> jpaClElementStatistics) {
- return jpaClElementStatistics.stream().map(JpaClElementStatistics::toAuthorative).collect(Collectors.toList());
+ private List<AcElementStatistics> asAcElementStatisticsList(List<JpaAcElementStatistics> jpaAcElementStatistics) {
+ return jpaAcElementStatistics.stream().map(JpaAcElementStatistics::toAuthorative).collect(Collectors.toList());
}
/**
- * Get clElement statistics.
+ * Get acElement statistics.
*
* @param name the name of the participant
* @param version version of the participant
- * @param id of the control loop element
+ * @param id of the automation composition element
* @param timestamp timestamp of the statistics
- * @return the clElement statistics found
+ * @return the acElement statistics found
*/
@Transactional(readOnly = true)
- public List<ClElementStatistics> getClElementStatistics(final String name, final String version, final String id,
- final Instant timestamp) {
+ public List<AcElementStatistics> getAcElementStatistics(final String name, final String version, final String id,
+ final Instant timestamp) {
if (name != null && version != null && timestamp != null && id != null) {
- return asClElementStatisticsList(clElementStatisticsRepository
- .findAllById(List.of(new PfReferenceTimestampKey(name, version, id, timestamp))));
+ return asAcElementStatisticsList(acElementStatisticsRepository
+ .findAllById(List.of(new PfReferenceTimestampKey(name, version, id, timestamp))));
} else if (name != null) {
- return getFilteredClElementStatistics(name, version, null, null, null, "DESC", 0);
+ return getFilteredAcElementStatistics(name, version, null, null, null, "DESC", 0);
}
- return asClElementStatisticsList(clElementStatisticsRepository.findAll());
+ return asAcElementStatisticsList(acElementStatisticsRepository.findAll());
}
/**
- * Get filtered clElement statistics.
+ * Get filtered acElement statistics.
*
- * @param name the clElement name for the statistics to get
- * @param version the clElement version for the statistics to get
+ * @param name the acElement name for the statistics to get
+ * @param version the acElement version for the statistics to get
* @param startTimeStamp startTimeStamp to filter statistics
* @param endTimeStamp endTimeStamp to filter statistics
* @param sortOrder sortOrder to query database
* @param getRecordNum Total query count from database
* @param filterMap the filters to apply to the get operation
- * @return the clElement statistics found
+ * @return the acElement statistics found
*/
@Transactional(readOnly = true)
- public List<ClElementStatistics> getFilteredClElementStatistics(final String name, final String version,
- final Instant startTimeStamp, final Instant endTimeStamp, Map<String, Object> filterMap,
- final String sortOrder, final int getRecordNum) {
+ public List<AcElementStatistics> getFilteredAcElementStatistics(final String name, final String version,
+ final Instant startTimeStamp, final Instant endTimeStamp, Map<String, Object> filterMap, final String sortOrder,
+ final int getRecordNum) {
// @formatter:off
PfFilterParameters filterParams = PfFilterParameters
@@ -131,7 +133,7 @@ public class ClElementStatisticsProvider {
.recordNum(getRecordNum)
.build();
// @formatter:on
- return asClElementStatisticsList(
- clElementStatisticsRepository.getFiltered(JpaClElementStatistics.class, filterParams));
+ return asAcElementStatisticsList(
+ acElementStatisticsRepository.getFiltered(JpaAcElementStatistics.class, filterParams));
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
new file mode 100644
index 000000000..760613026
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
@@ -0,0 +1,287 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.provider;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import javax.persistence.EntityNotFoundException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import lombok.AllArgsConstructor;
+import lombok.NonNull;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
+import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaNodeTemplateRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaNodeTemplatesRepository;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * This class provides information on automation composition concepts in the database to callers.
+ */
+@Service
+@Transactional
+@AllArgsConstructor
+public class AutomationCompositionProvider {
+
+ private final AutomationCompositionRepository automationCompositionRepository;
+ private final ToscaNodeTemplateRepository toscaNodeTemplateRepository;
+ private final ToscaNodeTemplatesRepository toscaNodeTemplatesRepository;
+
+ /**
+ * Get automation composition.
+ *
+ * @param automationCompositionId the ID of the automation composition to get
+ * @return the automation composition found
+ * @throws PfModelException on errors getting the automation composition
+ */
+ @Transactional(readOnly = true)
+ public AutomationComposition getAutomationComposition(final ToscaConceptIdentifier automationCompositionId)
+ throws PfModelException {
+ try {
+ return automationCompositionRepository.getById(automationCompositionId.asConceptKey()).toAuthorative();
+ } catch (EntityNotFoundException e) {
+ throw new PfModelException(Status.NOT_FOUND, "AutomationComposition not found", e);
+ }
+ }
+
+ /**
+ * Find automation composition by automationCompositionId.
+ *
+ * @param name the name of the automation composition to get, null to get all automation compositions
+ * @param version the version of the automation composition to get, null to get all automation compositions
+ * @return the automation composition found
+ * @throws PfModelException on errors getting the automation composition
+ */
+ @Transactional(readOnly = true)
+ public Optional<AutomationComposition> findAutomationComposition(@NonNull final String name,
+ @NonNull final String version) throws PfModelException {
+ return findAutomationComposition(new PfConceptKey(name, version));
+ }
+
+ /**
+ * Find automation composition by automationCompositionId.
+ *
+ * @param automationCompositionId the ID of the automation composition to get
+ * @return the automation composition found
+ * @throws PfModelException on errors getting the automation composition
+ */
+ @Transactional(readOnly = true)
+ public Optional<AutomationComposition> findAutomationComposition(
+ final ToscaConceptIdentifier automationCompositionId) throws PfModelException {
+ return findAutomationComposition(automationCompositionId.asConceptKey());
+ }
+
+ private Optional<AutomationComposition> findAutomationComposition(@NonNull final PfConceptKey key)
+ throws PfModelException {
+ try {
+ return automationCompositionRepository.findById(key).map(JpaAutomationComposition::toAuthorative);
+ } catch (IllegalArgumentException e) {
+ throw new PfModelException(Status.BAD_REQUEST, "Not valid parameter", e);
+ }
+ }
+
+ /**
+ * Save automation composition.
+ *
+ * @param automationComposition the automation composition to update
+ * @return the updated automation composition
+ * @throws PfModelException on errors updating the automation composition
+ */
+ public AutomationComposition saveAutomationComposition(final AutomationComposition automationComposition)
+ throws PfModelException {
+ try {
+ var result = automationCompositionRepository.save(ProviderUtils.getJpaAndValidate(automationComposition,
+ JpaAutomationComposition::new, "automation composition"));
+
+ // Return the saved participant
+ return result.toAuthorative();
+ } catch (IllegalArgumentException e) {
+ throw new PfModelException(Status.BAD_REQUEST, "Error in save automationComposition", e);
+ }
+ }
+
+ /**
+ * Get all automation compositions.
+ *
+ * @return all automation compositions found
+ * @throws PfModelException on errors getting automation compositions
+ */
+ @Transactional(readOnly = true)
+ public List<AutomationComposition> getAutomationCompositions() throws PfModelException {
+
+ return ProviderUtils.asEntityList(automationCompositionRepository.findAll());
+ }
+
+ /**
+ * Get automation compositions.
+ *
+ * @param name the name of the automation composition to get, null to get all automation compositions
+ * @param version the version of the automation composition to get, null to get all automation compositions
+ * @return the automation compositions found
+ * @throws PfModelException on errors getting automation compositions
+ */
+ @Transactional(readOnly = true)
+ public List<AutomationComposition> getAutomationCompositions(final String name, final String version)
+ throws PfModelException {
+
+ return ProviderUtils
+ .asEntityList(automationCompositionRepository.getFiltered(JpaAutomationComposition.class, name, version));
+ }
+
+ /**
+ * Saves automation compositions.
+ *
+ * @param automationCompositions a specification of the automation compositions to create
+ * @return the automation compositions created
+ * @throws PfModelException on errors creating automation compositions
+ */
+ public List<AutomationComposition> saveAutomationCompositions(
+ @NonNull final List<AutomationComposition> automationCompositions) throws PfModelException {
+ try {
+ var result =
+ automationCompositionRepository.saveAll(ProviderUtils.getJpaAndValidateList(automationCompositions,
+ JpaAutomationComposition::new, "automation compositions"));
+
+ // Return the saved participant
+ return ProviderUtils.asEntityList(result);
+ } catch (IllegalArgumentException e) {
+ throw new PfModelException(Status.BAD_REQUEST, "Error in save AutomationCompositions", e);
+ }
+ }
+
+ /**
+ * Saves Instance Properties to the database.
+ *
+ * @param serviceTemplate the service template
+ * @return a Map of tosca node templates
+ */
+ public Map<String, ToscaNodeTemplate> saveInstanceProperties(ToscaServiceTemplate serviceTemplate) {
+ Map<String, ToscaNodeTemplate> savedNodeTemplates = new HashMap<>();
+
+ var jpaToscaNodeTemplates = new JpaToscaNodeTemplates();
+ jpaToscaNodeTemplates.fromAuthorative(List.of(serviceTemplate.getToscaTopologyTemplate().getNodeTemplates()));
+
+ toscaNodeTemplatesRepository.save(jpaToscaNodeTemplates);
+ serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().forEach(savedNodeTemplates::put);
+
+ return savedNodeTemplates;
+ }
+
+ /**
+ * Delete a automation composition.
+ *
+ * @param name the name of the automation composition to delete
+ * @param version the version of the automation composition to delete
+ * @return the automation composition deleted
+ * @throws PfModelException on errors deleting the automation composition
+ */
+ public AutomationComposition deleteAutomationComposition(@NonNull final String name, @NonNull final String version)
+ throws PfModelException {
+
+ var automationCompositionKey = new PfConceptKey(name, version);
+ var jpaDeleteAutomationComposition = automationCompositionRepository.findById(automationCompositionKey);
+
+ if (jpaDeleteAutomationComposition.isEmpty()) {
+ String errorMessage = "delete of automation composition \"" + automationCompositionKey.getId()
+ + "\" failed, automation composition does not exist";
+ throw new PfModelException(Response.Status.BAD_REQUEST, errorMessage);
+ }
+
+ automationCompositionRepository.deleteById(automationCompositionKey);
+
+ return jpaDeleteAutomationComposition.get().toAuthorative();
+ }
+
+ /**
+ * Deletes Instance Properties on the database.
+ *
+ * @param filteredToscaNodeTemplateMap filtered node templates map to delete
+ * @param filteredToscaNodeTemplateList filtered node template list to delete
+ */
+ public void deleteInstanceProperties(Map<String, ToscaNodeTemplate> filteredToscaNodeTemplateMap,
+ List<ToscaNodeTemplate> filteredToscaNodeTemplateList) {
+
+ var jpaToscaNodeTemplates = new JpaToscaNodeTemplates();
+ jpaToscaNodeTemplates.fromAuthorative(List.of(filteredToscaNodeTemplateMap));
+
+ toscaNodeTemplatesRepository.save(jpaToscaNodeTemplates);
+
+ filteredToscaNodeTemplateList.forEach(template -> {
+ var jpaToscaNodeTemplate = new JpaToscaNodeTemplate(template);
+
+ toscaNodeTemplateRepository.delete(jpaToscaNodeTemplate);
+ });
+ }
+
+ /**
+ * Get All Node Templates.
+ *
+ * @return the list of node templates found
+ * @throws PfModelException on errors getting node templates
+ */
+ @Transactional(readOnly = true)
+ public List<ToscaNodeTemplate> getAllNodeTemplates() {
+ return ProviderUtils.asEntityList(toscaNodeTemplateRepository.findAll());
+ }
+
+ /**
+ * Get Node Templates.
+ *
+ * @param name the name of the node template to get, null to get all node templates
+ * @param version the version of the node template to get, null to get all node templates
+ * @return the node templates found
+ * @throws PfModelException on errors getting node templates
+ */
+ @Transactional(readOnly = true)
+ public List<ToscaNodeTemplate> getNodeTemplates(final String name, final String version) {
+ return ProviderUtils
+ .asEntityList(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, name, version));
+ }
+
+ /**
+ * Get filtered node templates.
+ *
+ * @param filter the filter for the node templates to get
+ * @return the node templates found
+ * @throws PfModelException on errors getting node templates
+ */
+ @Transactional(readOnly = true)
+ public List<ToscaNodeTemplate> getFilteredNodeTemplates(
+ @NonNull final ToscaTypedEntityFilter<ToscaNodeTemplate> filter) {
+
+ return filter.filter(ProviderUtils.asEntityList(toscaNodeTemplateRepository
+ .getFiltered(JpaToscaNodeTemplate.class, filter.getName(), filter.getVersion())));
+ }
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
index 0c001c11c..1f9e07f8e 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
@@ -18,16 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import java.util.List;
import java.util.Optional;
import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
import lombok.NonNull;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipant;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ParticipantRepository;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant;
+import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantRepository;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProvider.java
index bb4f3a5dd..a5a0ce176 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import java.time.Instant;
import java.util.List;
@@ -27,9 +27,9 @@ import java.util.stream.Collectors;
import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
import lombok.NonNull;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ParticipantStatisticsRepository;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipantStatistics;
+import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantStatisticsRepository;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfTimestampKey;
import org.onap.policy.models.dao.PfFilterParameters;
@@ -103,7 +103,7 @@ public class ParticipantStatisticsProvider {
/**
* Creates Participant statistics.
*
- * @param participantStatisticsList a specification of the CL statistics to create
+ * @param participantStatisticsList a specification of the statistics to create
* @return the participant statistics created
* @throws PfModelException on errors creating participant statistics
*/
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ProviderUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java
index 3b0400b4f..9510e5919 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ProviderUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import java.util.ArrayList;
import java.util.List;
@@ -80,7 +80,7 @@ public final class ProviderUtils {
}
/**
- * Convert JPA control loop list to an authorative control loop list.
+ * Convert JPA automation composition list to an authorative automation composition list.
*
* @param <T> the type of TOSCA entity
* @param <J> the type of JPA TOSCA entity
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProvider.java
index 8ff0dd102..0de5f480a 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import java.util.HashMap;
import java.util.List;
@@ -26,7 +26,7 @@ import java.util.Map;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import lombok.RequiredArgsConstructor;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaServiceTemplateRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaServiceTemplateRepository;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
@@ -83,19 +83,19 @@ public class ServiceTemplateProvider {
}
/**
- * Get the requested control loop definitions.
+ * Get the requested automation composition definitions.
*
* @param name the name of the definition to get, null for all definitions
* @param version the version of the definition to get, null for all definitions
- * @return the control loop definitions
- * @throws PfModelException on errors getting control loop definitions
+ * @return the automation composition definitions
+ * @throws PfModelException on errors getting automation composition definitions
*/
@Transactional(readOnly = true)
public ToscaServiceTemplate getToscaServiceTemplate(String name, String version) throws PfModelException {
var serviceTemplateKey = new PfConceptKey(name, version);
var jpaServiceTemplates = serviceTemplateRepository.findById(serviceTemplateKey);
if (jpaServiceTemplates.isEmpty()) {
- throw new PfModelException(Status.NOT_FOUND, "Control Loop definitions not found");
+ throw new PfModelException(Status.NOT_FOUND, "Automation composition definitions not found");
}
return jpaServiceTemplates.get().toAuthorative();
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ClElementStatisticsRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AcElementStatisticsRepository.java
index 1e07a4fe6..13001114f 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ClElementStatisticsRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AcElementStatisticsRepository.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAcElementStatistics;
import org.onap.policy.models.base.PfReferenceTimestampKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
-public interface ClElementStatisticsRepository
- extends JpaRepository<JpaClElementStatistics, PfReferenceTimestampKey>, FilterRepository {
+public interface AcElementStatisticsRepository
+ extends JpaRepository<JpaAcElementStatistics, PfReferenceTimestampKey>, FilterRepository {
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ControlLoopRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java
index 1a5fd5a56..8eeb77e0d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ControlLoopRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
import org.onap.policy.models.base.PfConceptKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
-public interface ControlLoopRepository extends JpaRepository<JpaControlLoop, PfConceptKey>, FilterRepository {
-
+public interface AutomationCompositionRepository
+ extends JpaRepository<JpaAutomationComposition, PfConceptKey>, FilterRepository {
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepository.java
index ce1f3d8c3..cdedc5eb5 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepository.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import java.util.List;
import org.onap.policy.models.base.PfConcept;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImpl.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImpl.java
index 0dc8fc373..d7e81d4da 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImpl.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImpl.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import java.util.List;
import javax.persistence.EntityManager;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java
index 671d23bbe..2279a75cc 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipant;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant;
import org.onap.policy.models.base.PfConceptKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantStatisticsRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantStatisticsRepository.java
index 6fecd6143..9cba62a70 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantStatisticsRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantStatisticsRepository.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipantStatistics;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipantStatistics;
import org.onap.policy.models.base.PfTimestampKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplateRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplateRepository.java
index a8f830fed..20d0f0f7e 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplateRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplateRepository.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplatesRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplatesRepository.java
index 7bd7d1013..f0ab40bf7 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplatesRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplatesRepository.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaServiceTemplateRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaServiceTemplateRepository.java
index a5d5fe766..b9190d0a7 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaServiceTemplateRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaServiceTemplateRepository.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/rest/RestUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/rest/RestUtils.java
index 6c12c2de7..ac19d2a27 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/rest/RestUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/rest/RestUtils.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.rest;
+package org.onap.policy.clamp.models.acm.rest;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
import org.onap.policy.models.errors.concepts.ErrorResponseInfo;
import org.springframework.http.ResponseEntity;
diff --git a/common/src/main/java/org/onap/policy/clamp/controlloop/common/utils/CommonUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
index 4ebd0aaa8..394579aa6 100644
--- a/common/src/main/java/org/onap/policy/clamp/controlloop/common/utils/CommonUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.utils;
+package org.onap.policy.clamp.models.acm.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeType;
@@ -34,55 +34,55 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
/**
- * Utility functions used in controlloop-runtime and participants.
+ * Utility functions used in acm-runtime and participants.
*
*/
-public class CommonUtils {
+public class AcmUtils {
- private CommonUtils() {
+ private AcmUtils() {
throw new IllegalStateException("Utility class");
}
/**
* Prepare participant updates map.
*
- * @param clElement controlloop element
+ * @param acElement automation composition element
* @param participantUpdates list of participantUpdates
*/
- public static void prepareParticipantUpdate(ControlLoopElement clElement,
+ public static void prepareParticipantUpdate(AutomationCompositionElement acElement,
List<ParticipantUpdates> participantUpdates) {
if (participantUpdates.isEmpty()) {
- participantUpdates.add(getControlLoopElementList(clElement));
+ participantUpdates.add(getAutomationCompositionElementList(acElement));
return;
}
var participantExists = false;
for (ParticipantUpdates participantUpdate : participantUpdates) {
- if (participantUpdate.getParticipantId().equals(clElement.getParticipantId())) {
- participantUpdate.setControlLoopElementList(List.of(clElement));
+ if (participantUpdate.getParticipantId().equals(acElement.getParticipantId())) {
+ participantUpdate.setAutomationCompositionElementList(List.of(acElement));
participantExists = true;
}
}
if (!participantExists) {
- participantUpdates.add(getControlLoopElementList(clElement));
+ participantUpdates.add(getAutomationCompositionElementList(acElement));
}
}
- private static ParticipantUpdates getControlLoopElementList(ControlLoopElement clElement) {
+ private static ParticipantUpdates getAutomationCompositionElementList(AutomationCompositionElement acElement) {
var participantUpdate = new ParticipantUpdates();
- participantUpdate.setParticipantId(clElement.getParticipantId());
- participantUpdate.setControlLoopElementList(List.of(clElement));
+ participantUpdate.setParticipantId(acElement.getParticipantId());
+ participantUpdate.setAutomationCompositionElementList(List.of(acElement));
return participantUpdate;
}
/**
- * Set the Policy information in the service template for the controlloopelement.
+ * Set the Policy information in the service template for the automation composition element.
*
- * @param clElement controlloop element
+ * @param acElement automation composition element
* @param toscaServiceTemplate ToscaServiceTemplate
*/
- public static void setServiceTemplatePolicyInfo(ControlLoopElement clElement,
- ToscaServiceTemplate toscaServiceTemplate) {
+ public static void setServiceTemplatePolicyInfo(AutomationCompositionElement acElement,
+ ToscaServiceTemplate toscaServiceTemplate) {
// Pass respective PolicyTypes or Policies as part of toscaServiceTemplateFragment
if (toscaServiceTemplate.getPolicyTypes() == null
&& toscaServiceTemplate.getToscaTopologyTemplate().getPolicies() == null) {
@@ -94,59 +94,59 @@ public class CommonUtils {
toscaTopologyTemplate.setPolicies(toscaServiceTemplate.getToscaTopologyTemplate().getPolicies());
toscaServiceTemplateFragment.setToscaTopologyTemplate(toscaTopologyTemplate);
toscaServiceTemplateFragment.setDataTypes(toscaServiceTemplate.getDataTypes());
- clElement.setToscaServiceTemplateFragment(toscaServiceTemplateFragment);
+ acElement.setToscaServiceTemplateFragment(toscaServiceTemplateFragment);
}
/**
* Prepare ParticipantDefinitionUpdate to set in the message.
*
- * @param clParticipantType controlloop element
+ * @param acParticipantType participant type
* @param entryKey key for the entry
* @param entryValue value relates to toscaNodeTemplate
* @param participantDefinitionUpdates list of participantDefinitionUpdates
* @param commonPropertiesMap common properties map
*/
- public static void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantType, String entryKey,
- ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates,
- Map<String, ToscaNodeType> commonPropertiesMap) {
+ public static void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier acParticipantType, String entryKey,
+ ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates,
+ Map<String, ToscaNodeType> commonPropertiesMap) {
- var clDefinition = new ControlLoopElementDefinition();
- clDefinition.setClElementDefinitionId(new ToscaConceptIdentifier(entryKey, entryValue.getVersion()));
- clDefinition.setControlLoopElementToscaNodeTemplate(entryValue);
+ var acDefinition = new AutomationCompositionElementDefinition();
+ acDefinition.setAcElementDefinitionId(new ToscaConceptIdentifier(entryKey, entryValue.getVersion()));
+ acDefinition.setAutomationCompositionElementToscaNodeTemplate(entryValue);
if (commonPropertiesMap != null) {
ToscaNodeType nodeType = commonPropertiesMap.get(entryValue.getType());
if (nodeType != null) {
- clDefinition.setCommonPropertiesMap(nodeType.getProperties());
+ acDefinition.setCommonPropertiesMap(nodeType.getProperties());
}
}
- List<ControlLoopElementDefinition> controlLoopElementDefinitionList = new ArrayList<>();
+ List<AutomationCompositionElementDefinition> automationCompositionElementDefinitionList = new ArrayList<>();
if (participantDefinitionUpdates.isEmpty()) {
- participantDefinitionUpdates
- .add(getParticipantDefinition(clDefinition, clParticipantType, controlLoopElementDefinitionList));
+ participantDefinitionUpdates.add(
+ getParticipantDefinition(acDefinition, acParticipantType, automationCompositionElementDefinitionList));
} else {
var participantExists = false;
for (ParticipantDefinition participantDefinitionUpdate : participantDefinitionUpdates) {
- if (participantDefinitionUpdate.getParticipantType().equals(clParticipantType)) {
- participantDefinitionUpdate.getControlLoopElementDefinitionList().add(clDefinition);
+ if (participantDefinitionUpdate.getParticipantType().equals(acParticipantType)) {
+ participantDefinitionUpdate.getAutomationCompositionElementDefinitionList().add(acDefinition);
participantExists = true;
}
}
if (!participantExists) {
- participantDefinitionUpdates.add(
- getParticipantDefinition(clDefinition, clParticipantType, controlLoopElementDefinitionList));
+ participantDefinitionUpdates.add(getParticipantDefinition(acDefinition, acParticipantType,
+ automationCompositionElementDefinitionList));
}
}
}
- private static ParticipantDefinition getParticipantDefinition(ControlLoopElementDefinition clDefinition,
- ToscaConceptIdentifier clParticipantType,
- List<ControlLoopElementDefinition> controlLoopElementDefinitionList) {
+ private static ParticipantDefinition getParticipantDefinition(AutomationCompositionElementDefinition acDefinition,
+ ToscaConceptIdentifier acParticipantType,
+ List<AutomationCompositionElementDefinition> automationCompositionElementDefinitionList) {
var participantDefinition = new ParticipantDefinition();
- participantDefinition.setParticipantType(clParticipantType);
- controlLoopElementDefinitionList.add(clDefinition);
- participantDefinition.setControlLoopElementDefinitionList(controlLoopElementDefinitionList);
+ participantDefinition.setParticipantType(acParticipantType);
+ automationCompositionElementDefinitionList.add(acDefinition);
+ participantDefinition.setAutomationCompositionElementDefinitionList(automationCompositionElementDefinitionList);
return participantDefinition;
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementTest.java
deleted file mode 100644
index ed579febb..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-class ControlLoopElementTest {
- @Test
- void testControlLoopElement() {
- var cle0 = new ControlLoopElement();
- var cle1 = new ControlLoopElement(cle0);
- assertEquals(cle0, cle1);
-
- cle1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
- cle1.setDescription("Description");
- cle1.setId(UUID.randomUUID());
- cle1.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- cle1.setParticipantId(new ToscaConceptIdentifier("id", "1.2.3"));
- cle1.setState(ControlLoopState.UNINITIALISED);
-
- var cle2 = new ControlLoopElement(cle1);
- assertEquals(cle1, cle2);
- }
-
- @Test
- void testControlLoopState() {
- var cle0 = new ControlLoopElement();
-
- assertTrue(
- cle0.getOrderedState()
- .equalsControlLoopState(ControlLoopState.UNINITIALISED));
-
- assertTrue(
- cle0.getOrderedState().asState()
- .equalsControlLoopOrderedState(ControlLoopOrderedState.UNINITIALISED));
- }
-
- @Test
- void testControlLoopElementLombok() {
- assertNotNull(new ControlLoopElement());
- var cle0 = new ControlLoopElement();
-
- assertThat(cle0.toString()).contains("ControlLoopElement(");
- assertThat(cle0.hashCode()).isNotZero();
- assertEquals(true, cle0.equals(cle0));
- assertEquals(false, cle0.equals(null));
-
- var cle1 = new ControlLoopElement();
-
- cle1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
- cle1.setDescription("Description");
- cle1.setId(UUID.randomUUID());
- cle1.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- cle1.setParticipantId(new ToscaConceptIdentifier("id", "1.2.3"));
- cle1.setState(ControlLoopState.UNINITIALISED);
-
- assertThat(cle1.toString()).contains("ControlLoopElement(");
- assertEquals(false, cle1.hashCode() == 0);
- assertEquals(false, cle1.equals(cle0));
- assertEquals(false, cle1.equals(null));
-
- assertNotEquals(cle1, cle0);
-
- var cle2 = new ControlLoopElement();
-
- // @formatter:off
- assertThatThrownBy(() -> cle2.setDefinition(null)). isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cle2.setId(null)). isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cle2.setOrderedState(null)). isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cle2.setParticipantId(null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cle2.setState(null)). isInstanceOf(NullPointerException.class);
- // @formatter:on
-
- assertNotEquals(cle2, cle0);
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java
deleted file mode 100644
index d9c518b53..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.time.Instant;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.models.base.PfKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-class ControlLoopTest {
- @Test
- void testControlLoop() {
- var cl0 = new ControlLoop();
- cl0.setDefinition(new ToscaConceptIdentifier("dfName", "1.2.3"));
- assertEquals("dfName", cl0.getType());
- assertEquals("1.2.3", cl0.getTypeVersion());
-
- var cl1 = new ControlLoop(cl0);
- assertEquals(cl0, cl1);
-
- assertEquals(0, cl0.compareTo(cl1));
- }
-
- @Test
- void testControlLoopLombok() {
- assertNotNull(new ControlLoop());
- var cl0 = new ControlLoop();
- cl0.setElements(new LinkedHashMap<>());
-
- assertThat(cl0.toString()).contains("ControlLoop(");
- assertThat(cl0.hashCode()).isNotZero();
- assertEquals(true, cl0.equals(cl0));
- assertEquals(false, cl0.equals(null));
-
- var cl1 = new ControlLoop();
-
- cl1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
- cl1.setDescription("Description");
- cl1.setElements(new LinkedHashMap<>());
- cl1.setName("Name");
- cl1.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- cl1.setState(ControlLoopState.UNINITIALISED);
- cl1.setVersion("0.0.1");
-
- assertThat(cl1.toString()).contains("ControlLoop(");
- assertEquals(false, cl1.hashCode() == 0);
- assertEquals(false, cl1.equals(cl0));
- assertEquals(false, cl1.equals(null));
-
- assertNotEquals(cl1, cl0);
-
- var cl2 = new ControlLoop();
- cl2.setElements(new LinkedHashMap<>());
-
- // @formatter:off
- assertThatThrownBy(() -> cl2.setDefinition(null)). isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cl2.setOrderedState(null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cl2.setState(null)). isInstanceOf(NullPointerException.class);
- // @formatter:on
-
- assertEquals(cl2, cl0);
-
- cl1.setCascadedOrderedState(ControlLoopOrderedState.PASSIVE);
- assertEquals(ControlLoopOrderedState.PASSIVE, cl1.getOrderedState());
-
- cl1.getElements().put(UUID.randomUUID(), new ControlLoopElement());
- cl1.setCascadedOrderedState(ControlLoopOrderedState.RUNNING);
- assertEquals(ControlLoopOrderedState.RUNNING, cl1.getOrderedState());
- assertEquals(ControlLoopOrderedState.RUNNING, cl1.getElements().values().iterator().next().getOrderedState());
-
- assertNull(cl0.getElements().get(UUID.randomUUID()));
- assertNull(cl1.getElements().get(UUID.randomUUID()));
-
- assertEquals(PfKey.NULL_KEY_NAME, cl0.getDefinition().getName());
-
- }
-
- @Test
- void testControlLoopElementStatisticsList() {
- var cl = new ControlLoop();
- List<ClElementStatistics> emptylist = cl.getControlLoopElementStatisticsList(cl);
- assertEquals(List.of(), emptylist);
-
- var cl1 = getControlLoopTest();
- List<ClElementStatistics> list = cl1.getControlLoopElementStatisticsList(cl1);
- assertNotNull(list);
- assertEquals(2, list.size());
- assertEquals(ControlLoopState.UNINITIALISED, list.get(0).getControlLoopState());
- }
-
- private ControlLoop getControlLoopTest() {
- var cl = new ControlLoop();
- cl.setDefinition(new ToscaConceptIdentifier("defName", "1.2.3"));
- cl.setDescription("Description");
- cl.setElements(new LinkedHashMap<>());
- cl.setName("Name");
- cl.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- cl.setState(ControlLoopState.UNINITIALISED);
- cl.setVersion("0.0.1");
-
- var uuid = UUID.randomUUID();
- var id = new ToscaConceptIdentifier(
- "org.onap.policy.controlloop.PolicyControlLoopParticipant", "1.0.1");
- var clElement = getControlLoopElementTest(uuid, id);
-
- var uuid2 = UUID.randomUUID();
- var id2 = new ToscaConceptIdentifier(
- "org.onap.policy.controlloop.PolicyControlLoopParticipantIntermediary", "0.0.1");
- var clElement2 = getControlLoopElementTest(uuid2, id2);
-
- cl.getElements().put(uuid, clElement);
- cl.getElements().put(uuid2, clElement2);
- return cl;
- }
-
- private ControlLoopElement getControlLoopElementTest(UUID uuid, ToscaConceptIdentifier id) {
- var clElement = new ControlLoopElement();
- clElement.setId(uuid);
- clElement.setParticipantId(id);
- clElement.setDefinition(id);
- clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
-
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setParticipantId(id);
- clElementStatistics.setControlLoopState(ControlLoopState.UNINITIALISED);
- clElementStatistics.setTimeStamp(Instant.now());
-
- clElement.setClElementStatistics(clElementStatistics);
-
- return clElement;
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java
deleted file mode 100644
index 0e6fb8383..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.time.Instant;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfReferenceTimestampKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-/**
- * Test the {@link JpaClElementStatistics} class.
- */
-class JpaClElementStatisticsTest {
-
- private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
-
- @Test
- void testJpaClElementStatisticsConstructor() {
- assertThatThrownBy(() -> {
- new JpaClElementStatistics((JpaClElementStatistics) null);
- }).hasMessageMatching("copyConcept is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaClElementStatistics((PfReferenceTimestampKey) null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaClElementStatistics(null, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaClElementStatistics(null, new PfConceptKey());
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaClElementStatistics(new PfReferenceTimestampKey(), null);
- }).hasMessageMatching("participantId is marked .*ull but is null");
-
- assertNotNull(new JpaClElementStatistics());
- assertNotNull(new JpaClElementStatistics((new PfReferenceTimestampKey())));
- assertNotNull(new JpaClElementStatistics(new PfReferenceTimestampKey(), new PfConceptKey()));
- }
-
- @Test
- void testJpaClElementStatistics() {
- JpaClElementStatistics testJpaClElementStatistics = createJpaClElementStatisticsInstance();
-
- ClElementStatistics cles = createClElementStatisticsInstance();
- assertEquals(cles, testJpaClElementStatistics.toAuthorative());
-
- assertThatThrownBy(() -> {
- testJpaClElementStatistics.fromAuthorative(null);
- }).hasMessageMatching("clElementStatistics is marked .*ull but is null");
-
- assertThatThrownBy(() -> new JpaClElementStatistics((JpaClElementStatistics) null))
- .isInstanceOf(NullPointerException.class);
-
- JpaClElementStatistics testJpaClElementStatisticsFa = new JpaClElementStatistics();
- testJpaClElementStatisticsFa.setKey(null);
- testJpaClElementStatisticsFa.fromAuthorative(cles);
- assertEquals(testJpaClElementStatistics, testJpaClElementStatisticsFa);
- testJpaClElementStatisticsFa.setKey(PfReferenceTimestampKey.getNullKey());
- testJpaClElementStatisticsFa.fromAuthorative(cles);
- assertEquals(testJpaClElementStatistics, testJpaClElementStatisticsFa);
- testJpaClElementStatisticsFa.setKey(new PfReferenceTimestampKey("elementName", "0.0.1",
- "a95757ba-b34a-4049-a2a8-46773abcbe5e", Instant.ofEpochSecond(123456L)));
- testJpaClElementStatisticsFa.fromAuthorative(cles);
- assertEquals(testJpaClElementStatistics, testJpaClElementStatisticsFa);
-
- testJpaClElementStatisticsFa = new JpaClElementStatistics(cles);
- assertEquals(testJpaClElementStatistics, testJpaClElementStatisticsFa);
-
- assertEquals(1, testJpaClElementStatistics.getKeys().size());
-
- assertEquals("elementName", testJpaClElementStatistics.getKey().getReferenceKey().getParentKeyName());
-
- testJpaClElementStatistics.clean();
- assertEquals("elementName", testJpaClElementStatistics.getKey().getReferenceKey().getParentKeyName());
-
- JpaClElementStatistics testJpaClElementStatistics2 = new JpaClElementStatistics(testJpaClElementStatistics);
- assertEquals(testJpaClElementStatistics, testJpaClElementStatistics2);
- }
-
- @Test
- void testJpaClElementStatisticsValidation() {
- JpaClElementStatistics testJpaClElementStatistics = createJpaClElementStatisticsInstance();
-
- assertThatThrownBy(() -> {
- testJpaClElementStatistics.validate(null);
- }).hasMessageMatching("fieldName is marked .*ull but is null");
-
- assertTrue(testJpaClElementStatistics.validate("").isValid());
- }
-
- @Test
- void testJpaClElementStatisticsCompareTo() {
- JpaClElementStatistics testJpaClElementStatistics = createJpaClElementStatisticsInstance();
-
- JpaClElementStatistics otherJpaClElementStatistics = new JpaClElementStatistics(testJpaClElementStatistics);
- assertEquals(0, testJpaClElementStatistics.compareTo(otherJpaClElementStatistics));
- assertEquals(-1, testJpaClElementStatistics.compareTo(null));
- assertEquals(0, testJpaClElementStatistics.compareTo(testJpaClElementStatistics));
- assertNotEquals(0, testJpaClElementStatistics.compareTo(new DummyJpaClElementStatisticsChild()));
-
- testJpaClElementStatistics.setState(ControlLoopState.PASSIVE);
- assertNotEquals(0, testJpaClElementStatistics.compareTo(otherJpaClElementStatistics));
- testJpaClElementStatistics.setState(ControlLoopState.UNINITIALISED);
- assertEquals(0, testJpaClElementStatistics.compareTo(otherJpaClElementStatistics));
-
- assertEquals(testJpaClElementStatistics, new JpaClElementStatistics(testJpaClElementStatistics));
- }
-
- @Test
- void testJpaClElementStatisticsLombok() {
- assertNotNull(new Participant());
- JpaClElementStatistics cles0 = new JpaClElementStatistics();
-
- assertThat(cles0.toString()).contains("JpaClElementStatistics(");
- assertThat(cles0.hashCode()).isNotZero();
- assertEquals(true, cles0.equals(cles0));
- assertEquals(false, cles0.equals(null));
-
-
- JpaClElementStatistics cles11 = new JpaClElementStatistics();
-
- cles11.setState(ControlLoopState.UNINITIALISED);
-
- assertThat(cles11.toString()).contains("JpaClElementStatistics(");
- assertEquals(false, cles11.hashCode() == 0);
- assertEquals(false, cles11.equals(cles0));
- assertEquals(false, cles11.equals(null));
-
- assertNotEquals(cles11, cles0);
-
- JpaClElementStatistics cles2 = new JpaClElementStatistics();
- assertEquals(cles2, cles0);
- }
-
- private JpaClElementStatistics createJpaClElementStatisticsInstance() {
- ClElementStatistics testCles = createClElementStatisticsInstance();
- JpaClElementStatistics testJpaClElementStatistics = new JpaClElementStatistics();
- testJpaClElementStatistics.setKey(null);
- testJpaClElementStatistics.fromAuthorative(testCles);
- testJpaClElementStatistics.setKey(PfReferenceTimestampKey.getNullKey());
- testJpaClElementStatistics.fromAuthorative(testCles);
-
- return testJpaClElementStatistics;
- }
-
- private ClElementStatistics createClElementStatisticsInstance() {
- ClElementStatistics clElementStatistics = new ClElementStatistics();
- clElementStatistics.setParticipantId(new ToscaConceptIdentifier("elementName", "0.0.1"));
- clElementStatistics.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e"));
- clElementStatistics.setTimeStamp(Instant.ofEpochSecond(123456L));
- clElementStatistics.setControlLoopState(ControlLoopState.UNINITIALISED);
-
- return clElementStatistics;
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java
deleted file mode 100644
index 63c5ea3ab..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfKey;
-import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-/**
- * Test the {@link JpaControlLoopElement} class.
- */
-class JpaControlLoopElementTest {
-
- private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
-
- @Test
- void testJpaControlLoopElementConstructor() {
- assertThatThrownBy(() -> {
- new JpaControlLoopElement((JpaControlLoopElement) null);
- }).hasMessageMatching("copyConcept is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement((PfReferenceKey) null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, null, null, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, null, null, ControlLoopState.UNINITIALISED);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, null, new PfConceptKey("participant", "0.0.1"), null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, null, new PfConceptKey("participant", "0.0.1"),
- ControlLoopState.UNINITIALISED);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, new PfConceptKey(), null, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, new PfConceptKey(), null, ControlLoopState.UNINITIALISED);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, new PfConceptKey(), new PfConceptKey("participant", "0.0.1"), null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, new PfConceptKey(), new PfConceptKey("participant", "0.0.1"),
- ControlLoopState.UNINITIALISED);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), null, null, null);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), null, null, ControlLoopState.UNINITIALISED);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), null, new PfConceptKey("participant", "0.0.1"), null);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), null, new PfConceptKey("participant", "0.0.1"),
- ControlLoopState.UNINITIALISED);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(), null, null);
- }).hasMessageMatching("participantType is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(), null, ControlLoopState.UNINITIALISED);
- }).hasMessageMatching("participantType is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(),
- new PfConceptKey("participant", "0.0.1"), null);
- }).hasMessageMatching("state is marked .*ull but is null");
-
- assertNotNull(new JpaControlLoopElement());
- assertNotNull(new JpaControlLoopElement((new PfReferenceKey())));
- assertNotNull(new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(),
- new PfConceptKey("participant", "0.0.1"), ControlLoopState.UNINITIALISED));
- }
-
- @Test
- void testJpaControlLoopElement() {
- JpaControlLoopElement testJpaControlLoopElement = createJpaControlLoopElementInstance();
-
- ControlLoopElement cle = createControlLoopElementInstance();
- assertEquals(cle, testJpaControlLoopElement.toAuthorative());
-
- assertThatThrownBy(() -> {
- testJpaControlLoopElement.fromAuthorative(null);
- }).hasMessageMatching("element is marked .*ull but is null");
-
- assertThatThrownBy(() -> new JpaControlLoopElement((JpaControlLoopElement) null))
- .isInstanceOf(NullPointerException.class);
-
- JpaControlLoopElement testJpaControlLoopElementFa = new JpaControlLoopElement();
- testJpaControlLoopElementFa.setKey(null);
- testJpaControlLoopElementFa.fromAuthorative(cle);
- assertEquals(testJpaControlLoopElement, testJpaControlLoopElementFa);
- testJpaControlLoopElementFa.setKey(PfReferenceKey.getNullKey());
- testJpaControlLoopElementFa.fromAuthorative(cle);
- assertEquals(testJpaControlLoopElement, testJpaControlLoopElementFa);
- testJpaControlLoopElementFa.setKey(new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION,
- "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
- testJpaControlLoopElementFa.fromAuthorative(cle);
- assertEquals(testJpaControlLoopElement, testJpaControlLoopElementFa);
-
- assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e", testJpaControlLoopElement.getKey().getLocalName());
- assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
- new JpaControlLoopElement(createControlLoopElementInstance()).getKey().getLocalName());
- assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
- ((PfReferenceKey) new JpaControlLoopElement(createControlLoopElementInstance()).getKeys().get(0))
- .getLocalName());
-
- testJpaControlLoopElement.clean();
- assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e", testJpaControlLoopElement.getKey().getLocalName());
-
- testJpaControlLoopElement.setDescription(" A Message ");
- testJpaControlLoopElement.clean();
- assertEquals("A Message", testJpaControlLoopElement.getDescription());
-
- JpaControlLoopElement testJpaControlLoopElement2 = new JpaControlLoopElement(testJpaControlLoopElement);
- assertEquals(testJpaControlLoopElement, testJpaControlLoopElement2);
- }
-
- @Test
- void testJpaControlLoopElementOrderedState() throws CoderException {
- ControlLoopElement testControlLoopElement = createControlLoopElementInstance();
- JpaControlLoopElement testJpaControlLoopElement = createJpaControlLoopElementInstance();
-
- testJpaControlLoopElement.setOrderedState(null);
- assertEquals(testControlLoopElement, testJpaControlLoopElement.toAuthorative());
- testJpaControlLoopElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
-
- ControlLoopElement noOrderedStateCle = new StandardCoder().decode(
- new File("src/test/resources/json/ControlLoopElementNoOrderedState.json"), ControlLoopElement.class);
-
- JpaControlLoopElement noOrderedStateJpaCle = new JpaControlLoopElement(noOrderedStateCle);
- assertNull(noOrderedStateJpaCle.getOrderedState());
- noOrderedStateCle.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- noOrderedStateJpaCle = new JpaControlLoopElement(noOrderedStateCle);
- assertEquals(testJpaControlLoopElement, noOrderedStateJpaCle);
- }
-
- @Test
- void testJpaControlLoopElementValidation() {
- JpaControlLoopElement testJpaControlLoopElement = createJpaControlLoopElementInstance();
-
- assertThatThrownBy(() -> {
- testJpaControlLoopElement.validate(null);
- }).hasMessageMatching("fieldName is marked .*ull but is null");
-
- assertTrue(testJpaControlLoopElement.validate("").isValid());
- }
-
- @Test
- void testJpaControlLoopElementCompareTo() {
- JpaControlLoopElement testJpaControlLoopElement = createJpaControlLoopElementInstance();
-
- JpaControlLoopElement otherJpaControlLoopElement = new JpaControlLoopElement(testJpaControlLoopElement);
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- assertEquals(-1, testJpaControlLoopElement.compareTo(null));
- assertEquals(0, testJpaControlLoopElement.compareTo(testJpaControlLoopElement));
- assertNotEquals(0, testJpaControlLoopElement.compareTo(new DummyJpaControlLoopElementChild()));
-
- testJpaControlLoopElement
- .setKey(new PfReferenceKey("BadValue", "0.0.1", "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setKey(new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION,
- "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- testJpaControlLoopElement.setDefinition(new PfConceptKey("BadValue", "0.0.1"));
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setDefinition(new PfConceptKey("cleDef", "0.0.1"));
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- testJpaControlLoopElement.setDescription("Description");
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setDescription(null);
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- testJpaControlLoopElement.setOrderedState(ControlLoopOrderedState.PASSIVE);
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- testJpaControlLoopElement.setState(ControlLoopState.PASSIVE);
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setState(ControlLoopState.UNINITIALISED);
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- testJpaControlLoopElement.setParticipantType(new PfConceptKey("dummy", "0.0.1"));
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setParticipantType(new PfConceptKey("participantType", "0.0.1"));
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- assertEquals(testJpaControlLoopElement, new JpaControlLoopElement(testJpaControlLoopElement));
- }
-
- @Test
- void testJpaControlLoopElementLombok() {
- assertNotNull(new Participant());
- JpaControlLoopElement cle0 = new JpaControlLoopElement();
-
- assertThat(cle0.toString()).contains("JpaControlLoopElement(");
- assertThat(cle0.hashCode()).isNotZero();
- assertEquals(true, cle0.equals(cle0));
- assertEquals(false, cle0.equals(null));
-
-
- JpaControlLoopElement cle1 = new JpaControlLoopElement();
-
- cle1.setDefinition(new PfConceptKey("defName", "0.0.1"));
- cle1.setDescription("Description");
- cle1.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- cle1.setState(ControlLoopState.UNINITIALISED);
- cle1.setParticipantId(new PfConceptKey("participant", "0.0.1"));
-
- assertThat(cle1.toString()).contains("ControlLoopElement(");
- assertEquals(false, cle1.hashCode() == 0);
- assertEquals(false, cle1.equals(cle0));
- assertEquals(false, cle1.equals(null));
-
- assertNotEquals(cle1, cle0);
-
- JpaControlLoopElement cle2 = new JpaControlLoopElement();
- assertEquals(cle2, cle0);
- }
-
- private JpaControlLoopElement createJpaControlLoopElementInstance() {
- ControlLoopElement testCle = createControlLoopElementInstance();
- JpaControlLoopElement testJpaControlLoopElement = new JpaControlLoopElement();
- testJpaControlLoopElement.setKey(null);
- testJpaControlLoopElement.fromAuthorative(testCle);
- testJpaControlLoopElement.setKey(PfReferenceKey.getNullKey());
- testJpaControlLoopElement.fromAuthorative(testCle);
-
- return testJpaControlLoopElement;
- }
-
- private ControlLoopElement createControlLoopElementInstance() {
- ControlLoopElement controlLoopElement = new ControlLoopElement();
- controlLoopElement.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e"));
- controlLoopElement.setDefinition(new ToscaConceptIdentifier("cleDef", "0.0.1"));
- controlLoopElement.setParticipantType(new ToscaConceptIdentifier("participantType", "0.0.1"));
-
- return controlLoopElement;
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java
deleted file mode 100644
index d705c49b5..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.LinkedHashMap;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-/**
- * Test the {@link JpaControlLoopTest} class.
- */
-class JpaControlLoopTest {
-
- private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
-
- @Test
- void testJpaControlLoopConstructor() {
- assertThatThrownBy(() -> {
- new JpaControlLoop((JpaControlLoop) null);
- }).hasMessageMatching("copyConcept is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop((PfConceptKey) null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, null, null, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, null, null, new LinkedHashMap<>());
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, null, ControlLoopState.UNINITIALISED, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, null, ControlLoopState.UNINITIALISED, new LinkedHashMap<>());
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, new PfConceptKey(), null, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, new PfConceptKey(), null, new LinkedHashMap<>());
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, new PfConceptKey(), ControlLoopState.UNINITIALISED, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, new PfConceptKey(), ControlLoopState.UNINITIALISED, new LinkedHashMap<>());
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), null, null, null);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), null, null, new LinkedHashMap<>());
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), null, ControlLoopState.UNINITIALISED, null);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), null, ControlLoopState.UNINITIALISED, new LinkedHashMap<>());
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), null, null);
- }).hasMessageMatching("state is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), null, new LinkedHashMap<>());
- }).hasMessageMatching("state is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), ControlLoopState.UNINITIALISED, null);
- }).hasMessageMatching("elements is marked .*ull but is null");
-
- assertNotNull(new JpaControlLoop());
- assertNotNull(new JpaControlLoop((new PfConceptKey())));
- assertNotNull(new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), ControlLoopState.UNINITIALISED,
- new LinkedHashMap<>()));
- }
-
- @Test
- void testJpaControlLoop() {
- JpaControlLoop testJpaControlLoop = createJpaControlLoopInstance();
-
- ControlLoop participant = createControlLoopInstance();
- assertEquals(participant, testJpaControlLoop.toAuthorative());
-
- assertThatThrownBy(() -> {
- testJpaControlLoop.fromAuthorative(null);
- }).hasMessageMatching("controlLoop is marked .*ull but is null");
-
- assertThatThrownBy(() -> new JpaControlLoop((JpaControlLoop) null)).isInstanceOf(NullPointerException.class);
-
- JpaControlLoop testJpaControlLoopFa = new JpaControlLoop();
- testJpaControlLoopFa.setKey(null);
- testJpaControlLoopFa.fromAuthorative(participant);
- assertEquals(testJpaControlLoop, testJpaControlLoopFa);
- testJpaControlLoopFa.setKey(PfConceptKey.getNullKey());
- testJpaControlLoopFa.fromAuthorative(participant);
- assertEquals(testJpaControlLoop, testJpaControlLoopFa);
- testJpaControlLoopFa.setKey(new PfConceptKey("control-loop", "0.0.1"));
- testJpaControlLoopFa.fromAuthorative(participant);
- assertEquals(testJpaControlLoop, testJpaControlLoopFa);
-
- assertEquals("control-loop", testJpaControlLoop.getKey().getName());
- assertEquals("control-loop", new JpaControlLoop(createControlLoopInstance()).getKey().getName());
- assertEquals("control-loop",
- ((PfConceptKey) new JpaControlLoop(createControlLoopInstance()).getKeys().get(0)).getName());
-
- testJpaControlLoop.clean();
- assertEquals("control-loop", testJpaControlLoop.getKey().getName());
-
- testJpaControlLoop.setDescription(" A Message ");
- testJpaControlLoop.clean();
- assertEquals("A Message", testJpaControlLoop.getDescription());
-
- JpaControlLoop testJpaControlLoop2 = new JpaControlLoop(testJpaControlLoop);
- assertEquals(testJpaControlLoop, testJpaControlLoop2);
- }
-
- @Test
- void testJpaControlLoopElementOrderedState() throws CoderException {
- ControlLoop testControlLoop = createControlLoopInstance();
- JpaControlLoop testJpaControlLoop = createJpaControlLoopInstance();
-
- testJpaControlLoop.setOrderedState(null);
- assertEquals(testControlLoop, testJpaControlLoop.toAuthorative());
- testJpaControlLoop.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
-
- ControlLoop noOrderedStateCl = new StandardCoder()
- .decode(new File("src/test/resources/json/ControlLoopNoOrderedState.json"), ControlLoop.class);
-
- JpaControlLoop noOrderedStateJpaCl = new JpaControlLoop(noOrderedStateCl);
- assertNull(noOrderedStateJpaCl.getOrderedState());
- noOrderedStateCl.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- noOrderedStateJpaCl = new JpaControlLoop(noOrderedStateCl);
- assertEquals(testJpaControlLoop, noOrderedStateJpaCl);
-
- ControlLoops controlLoopsWithElements = new StandardCoder()
- .decode(new File("src/test/resources/providers/TestControlLoops.json"), ControlLoops.class);
-
- JpaControlLoop jpaControlLoopWithElements =
- new JpaControlLoop(controlLoopsWithElements.getControlLoopList().get(0));
- assertEquals(4, jpaControlLoopWithElements.getElements().size());
- assertEquals(18, jpaControlLoopWithElements.getKeys().size());
- assertThatCode(() -> jpaControlLoopWithElements.clean()).doesNotThrowAnyException();
-
- assertEquals(controlLoopsWithElements.getControlLoopList().get(0), jpaControlLoopWithElements.toAuthorative());
- }
-
- @Test
- void testJpaControlLoopValidation() {
- JpaControlLoop testJpaControlLoop = createJpaControlLoopInstance();
-
- assertThatThrownBy(() -> {
- testJpaControlLoop.validate(null);
- }).hasMessageMatching("fieldName is marked .*ull but is null");
-
- assertTrue(testJpaControlLoop.validate("").isValid());
- }
-
- @Test
- void testJpaControlLoopCompareTo() {
- JpaControlLoop testJpaControlLoop = createJpaControlLoopInstance();
-
- JpaControlLoop otherJpaControlLoop = new JpaControlLoop(testJpaControlLoop);
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- assertEquals(-1, testJpaControlLoop.compareTo(null));
- assertEquals(0, testJpaControlLoop.compareTo(testJpaControlLoop));
- assertNotEquals(0, testJpaControlLoop.compareTo(new DummyJpaControlLoopChild()));
-
- testJpaControlLoop.setKey(new PfConceptKey("BadValue", "0.0.1"));
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setKey(new PfConceptKey("control-loop", "0.0.1"));
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- testJpaControlLoop.setDefinition(new PfConceptKey("BadValue", "0.0.1"));
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setDefinition(new PfConceptKey("controlLoopDefinitionName", "0.0.1"));
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- testJpaControlLoop.setState(ControlLoopState.PASSIVE);
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setState(ControlLoopState.UNINITIALISED);
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- testJpaControlLoop.setOrderedState(ControlLoopOrderedState.PASSIVE);
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- testJpaControlLoop.setDescription("A description");
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setDescription(null);
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- testJpaControlLoop.setPrimed(true);
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setPrimed(false);
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- assertEquals(testJpaControlLoop, new JpaControlLoop(testJpaControlLoop));
- }
-
- @Test
- void testJpaControlLoopLombok() {
- assertNotNull(new ControlLoop());
- JpaControlLoop cl0 = new JpaControlLoop();
-
- assertThat(cl0.toString()).contains("JpaControlLoop(");
- assertThat(cl0.hashCode()).isNotZero();
- assertEquals(true, cl0.equals(cl0));
- assertEquals(false, cl0.equals(null));
-
-
- JpaControlLoop cl1 = new JpaControlLoop();
-
- cl1.setDefinition(new PfConceptKey("defName", "0.0.1"));
- cl1.setDescription("Description");
- cl1.setElements(new LinkedHashMap<>());
- cl1.setKey(new PfConceptKey("participant", "0.0.1"));
- cl1.setState(ControlLoopState.UNINITIALISED);
-
- assertThat(cl1.toString()).contains("ControlLoop(");
- assertEquals(false, cl1.hashCode() == 0);
- assertEquals(false, cl1.equals(cl0));
- assertEquals(false, cl1.equals(null));
-
- assertNotEquals(cl1, cl0);
-
- JpaControlLoop cl2 = new JpaControlLoop();
- assertEquals(cl2, cl0);
- }
-
- private JpaControlLoop createJpaControlLoopInstance() {
- ControlLoop testControlLoop = createControlLoopInstance();
- JpaControlLoop testJpaControlLoop = new JpaControlLoop();
- testJpaControlLoop.setKey(null);
- testJpaControlLoop.fromAuthorative(testControlLoop);
- testJpaControlLoop.setKey(PfConceptKey.getNullKey());
- testJpaControlLoop.fromAuthorative(testControlLoop);
-
- return testJpaControlLoop;
- }
-
- private ControlLoop createControlLoopInstance() {
- ControlLoop testControlLoop = new ControlLoop();
- testControlLoop.setName("control-loop");
- testControlLoop.setVersion("0.0.1");
- testControlLoop.setDefinition(new ToscaConceptIdentifier("controlLoopDefinitionName", "0.0.1"));
- testControlLoop.setElements(new LinkedHashMap<>());
-
- return testControlLoop;
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java
deleted file mode 100644
index 82ce8d789..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyList;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.time.Instant;
-import java.util.List;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ClElementStatisticsRepository;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-class ClElementStatisticsProviderTest {
- private static final String LIST_IS_NULL = ".*. is marked .*ull but is null";
- private static final Coder CODER = new StandardCoder();
- private static final String CL_ELEMENT_STATS_JSON = "src/test/resources/providers/TestClElementStatistics.json";
-
- private ClElementStatisticsProvider clElementStatisticsProvider;
- private ClElementStatisticsList inputClElementStats;
- private String originalJson = ResourceUtils.getResourceAsString(CL_ELEMENT_STATS_JSON);
-
- /**
- * Set up test ClElement statistics provider.
- *
- * @throws Exception on errors
- */
- @BeforeEach
- void beforeSetupDao() throws Exception {
-
- inputClElementStats = CODER.decode(originalJson, ClElementStatisticsList.class);
- var clElementStatisticsRepository = mock(ClElementStatisticsRepository.class);
-
- var jpaClElementStatisticsList =
- ProviderUtils.getJpaAndValidateList(inputClElementStats.getClElementStatistics(),
- JpaClElementStatistics::new, "control loop element statistics");
-
- for (var clElementStat : jpaClElementStatisticsList) {
- when(clElementStatisticsRepository.getById(eq(clElementStat.getKey()))).thenReturn(clElementStat);
- when(clElementStatisticsRepository.findAllById(eq(List.of(clElementStat.getKey()))))
- .thenReturn(List.of(clElementStat));
- }
-
- when(clElementStatisticsRepository.saveAll(anyList())).thenReturn(jpaClElementStatisticsList);
-
- when(clElementStatisticsRepository.getFiltered(eq(JpaClElementStatistics.class), any()))
- .thenReturn(List.of(jpaClElementStatisticsList.get(0)));
-
- clElementStatisticsProvider = new ClElementStatisticsProvider(clElementStatisticsRepository);
- }
-
- @Test
- void testClElementStatisticsCreate() throws Exception {
- assertThatThrownBy(() -> {
- clElementStatisticsProvider.createClElementStatistics(null);
- }).hasMessageMatching(LIST_IS_NULL);
-
- ClElementStatisticsList createdClElementStats = new ClElementStatisticsList();
- createdClElementStats.setClElementStatistics(
- clElementStatisticsProvider.createClElementStatistics(inputClElementStats.getClElementStatistics()));
-
- assertEquals(inputClElementStats.toString().replaceAll("\\s+", ""),
- createdClElementStats.toString().replaceAll("\\s+", ""));
- }
-
- @Test
- void testGetClElementStatistics() throws Exception {
-
- List<ClElementStatistics> getResponse;
-
- // Return empty list when no data present in db
- getResponse = clElementStatisticsProvider.getClElementStatistics(null, null, null, null);
- assertThat(getResponse).isEmpty();
-
- clElementStatisticsProvider.createClElementStatistics(inputClElementStats.getClElementStatistics());
- ToscaConceptIdentifier identifier = inputClElementStats.getClElementStatistics().get(0).getParticipantId();
- Instant instant = inputClElementStats.getClElementStatistics().get(0).getTimeStamp();
- String id = inputClElementStats.getClElementStatistics().get(0).getId().toString();
- assertEquals(1, clElementStatisticsProvider
- .getClElementStatistics(identifier.getName(), identifier.getVersion(), id, instant).size());
-
- assertEquals(1, clElementStatisticsProvider
- .getFilteredClElementStatistics("name2", "1.0.1", null, null, null, "DESC", 1).size());
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java
deleted file mode 100644
index 4b8617b3d..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.List;
-import java.util.Optional;
-import javax.persistence.EntityNotFoundException;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ControlLoopRepository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaNodeTemplateRepository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaNodeTemplatesRepository;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.common.utils.coder.YamlJsonTranslator;
-import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
-import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
-
-class ControlLoopProviderTest {
-
- private static final String LIST_IS_NULL = "controlLoops is marked .*ull but is null";
- private static final String OBJECT_IS_NULL = "controlLoop is marked non-null but is null";
-
- private static final String ID_NAME = "PMSHInstance1";
- private static final String ID_VERSION = "1.0.1";
- private static final String ID_NAME_NOT_EXTST = "not_exist";
- private static final String ID_NAME_NOT_VALID = "not_valid";
-
- private static final Coder CODER = new StandardCoder();
- private static final String CONTROL_LOOP_JSON = "src/test/resources/providers/TestControlLoops.json";
- private static final String TOSCA_TEMPLATE_YAML = "examples/controlloop/PMSubscriptionHandling.yaml";
-
- private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
-
- private ControlLoops inputControlLoops;
- private List<JpaControlLoop> inputControlLoopsJpa;
- private String originalJson = ResourceUtils.getResourceAsString(CONTROL_LOOP_JSON);
-
- @BeforeEach
- void beforeSetupDao() throws Exception {
- inputControlLoops = CODER.decode(originalJson, ControlLoops.class);
- inputControlLoopsJpa = ProviderUtils.getJpaAndValidateList(inputControlLoops.getControlLoopList(),
- JpaControlLoop::new, "control loops");
- }
-
- @Test
- void testControlLoopsSave() throws Exception {
- var controlLoopRepository = mock(ControlLoopRepository.class);
- var controlLoopProvider = new ControlLoopProvider(controlLoopRepository,
- mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
-
- assertThatThrownBy(() -> {
- controlLoopProvider.saveControlLoops(null);
- }).hasMessageMatching(LIST_IS_NULL);
-
- when(controlLoopRepository.saveAll(inputControlLoopsJpa)).thenReturn(inputControlLoopsJpa);
-
- var createdControlLoops = new ControlLoops();
- createdControlLoops
- .setControlLoopList(controlLoopProvider.saveControlLoops(inputControlLoops.getControlLoopList()));
-
- assertEquals(inputControlLoops, createdControlLoops);
-
- when(controlLoopRepository.saveAll(any())).thenThrow(IllegalArgumentException.class);
-
- assertThatThrownBy(() -> {
- controlLoopProvider.saveControlLoops(inputControlLoops.getControlLoopList());
- }).hasMessageMatching("Error in save ControlLoops");
- }
-
- @Test
- void testControlLoopSave() throws Exception {
- var controlLoopRepository = mock(ControlLoopRepository.class);
- var controlLoopProvider = new ControlLoopProvider(controlLoopRepository,
- mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
-
- assertThatThrownBy(() -> {
- controlLoopProvider.saveControlLoop(null);
- }).hasMessageMatching(OBJECT_IS_NULL);
-
- when(controlLoopRepository.save(inputControlLoopsJpa.get(0))).thenReturn(inputControlLoopsJpa.get(0));
-
- var createdControlLoop = controlLoopProvider.saveControlLoop(inputControlLoops.getControlLoopList().get(0));
-
- assertEquals(inputControlLoops.getControlLoopList().get(0), createdControlLoop);
-
- when(controlLoopRepository.save(any())).thenThrow(IllegalArgumentException.class);
-
- assertThatThrownBy(() -> {
- controlLoopProvider.saveControlLoop(inputControlLoops.getControlLoopList().get(0));
- }).hasMessageMatching("Error in save controlLoop");
- }
-
- @Test
- void testGetControlLoops() throws Exception {
- var controlLoopRepository = mock(ControlLoopRepository.class);
- var controlLoopProvider = new ControlLoopProvider(controlLoopRepository,
- mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
-
- // Return empty list when no data present in db
- List<ControlLoop> getResponse = controlLoopProvider.getControlLoops();
- assertThat(getResponse).isEmpty();
-
- controlLoopProvider.saveControlLoops(inputControlLoops.getControlLoopList());
-
- var controlLoop0 = inputControlLoops.getControlLoopList().get(1);
- var name = controlLoop0.getName();
- var version = controlLoop0.getVersion();
- var controlLoop1 = inputControlLoops.getControlLoopList().get(1);
-
- when(controlLoopRepository.getFiltered(eq(JpaControlLoop.class), any(), any()))
- .thenReturn(List.of(new JpaControlLoop(controlLoop0), new JpaControlLoop(controlLoop1)));
- when(controlLoopRepository.findById(controlLoop0.getKey().asIdentifier().asConceptKey()))
- .thenReturn(Optional.of(new JpaControlLoop(controlLoop0)));
- when(controlLoopRepository.getById(controlLoop0.getKey().asIdentifier().asConceptKey()))
- .thenReturn(new JpaControlLoop(controlLoop0));
- when(controlLoopRepository.getFiltered(JpaControlLoop.class, name, version))
- .thenReturn(List.of(new JpaControlLoop(controlLoop0)));
- when(controlLoopRepository.findById(controlLoop1.getKey().asIdentifier().asConceptKey()))
- .thenReturn(Optional.of(new JpaControlLoop(controlLoop1)));
-
- assertEquals(1, controlLoopProvider.getControlLoops(name, version).size());
-
- var cl = controlLoopProvider.findControlLoop(new ToscaConceptIdentifier(ID_NAME, ID_VERSION)).get();
- assertEquals(inputControlLoops.getControlLoopList().get(1), cl);
-
- cl = controlLoopProvider.getControlLoop(new ToscaConceptIdentifier(ID_NAME, ID_VERSION));
- assertEquals(inputControlLoops.getControlLoopList().get(1), cl);
-
- when(controlLoopRepository.getById(any())).thenThrow(EntityNotFoundException.class);
-
- assertThatThrownBy(() -> {
- controlLoopProvider.getControlLoop(new ToscaConceptIdentifier(ID_NAME_NOT_EXTST, ID_VERSION));
- }).hasMessageMatching("ControlLoop not found");
-
- cl = controlLoopProvider.findControlLoop(ID_NAME, ID_VERSION).get();
- assertEquals(inputControlLoops.getControlLoopList().get(1), cl);
-
- assertThat(controlLoopProvider.findControlLoop(new ToscaConceptIdentifier(ID_NAME_NOT_EXTST, ID_VERSION)))
- .isEmpty();
-
- when(controlLoopRepository.findById(any())).thenThrow(IllegalArgumentException.class);
-
- assertThatThrownBy(() -> {
- controlLoopProvider.findControlLoop(ID_NAME_NOT_VALID, ID_VERSION);
- }).hasMessageMatching("Not valid parameter");
- }
-
- @Test
- void testDeleteControlLoop() throws Exception {
- var controlLoopRepository = mock(ControlLoopRepository.class);
- var controlLoopProvider = new ControlLoopProvider(controlLoopRepository,
- mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
-
- assertThatThrownBy(() -> {
- controlLoopProvider.deleteControlLoop(ID_NAME_NOT_EXTST, ID_VERSION);
- }).hasMessageMatching(".*.failed, control loop does not exist");
-
- var controlLoop = inputControlLoops.getControlLoopList().get(0);
- var name = controlLoop.getName();
- var version = controlLoop.getVersion();
-
- when(controlLoopRepository.findById(new PfConceptKey(name, version)))
- .thenReturn(Optional.of(inputControlLoopsJpa.get(0)));
-
- ControlLoop deletedCl = controlLoopProvider.deleteControlLoop(name, version);
- assertEquals(controlLoop, deletedCl);
- }
-
- @Test
- void testDeleteAllInstanceProperties() throws Exception {
- var controlLoopProvider = new ControlLoopProvider(mock(ControlLoopRepository.class),
- mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
- var toscaServiceTemplate = testControlLoopRead();
- controlLoopProvider.deleteInstanceProperties(controlLoopProvider.saveInstanceProperties(toscaServiceTemplate),
- controlLoopProvider.getAllNodeTemplates());
- assertThat(controlLoopProvider.getControlLoops()).isEmpty();
- }
-
- @Test
- void testSaveAndDeleteInstanceProperties() throws Exception {
- var toscaNodeTemplatesRepository = mock(ToscaNodeTemplatesRepository.class);
- var toscaNodeTemplateRepository = mock(ToscaNodeTemplateRepository.class);
- var controlLoopProvider = new ControlLoopProvider(mock(ControlLoopRepository.class),
- toscaNodeTemplateRepository, toscaNodeTemplatesRepository);
- var toscaServiceTest = testControlLoopRead();
-
- controlLoopProvider.saveInstanceProperties(toscaServiceTest);
- verify(toscaNodeTemplatesRepository).save(any());
-
- var name = "org.onap.policy.controlloop.PolicyControlLoopParticipant";
- var version = "2.3.1";
- var elem = toscaServiceTest.getToscaTopologyTemplate().getNodeTemplates().get(name);
- when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, name, version))
- .thenReturn(List.of(new JpaToscaNodeTemplate(elem)));
-
- var filtered = controlLoopProvider.getNodeTemplates(name, version);
- verify(toscaNodeTemplateRepository).getFiltered(JpaToscaNodeTemplate.class, name, version);
-
- controlLoopProvider.deleteInstanceProperties(controlLoopProvider.saveInstanceProperties(toscaServiceTest),
- filtered);
-
- verify(toscaNodeTemplateRepository).delete(any());
- }
-
- @Test
- void testGetNodeTemplates() throws Exception {
- var toscaNodeTemplateRepository = mock(ToscaNodeTemplateRepository.class);
- var controlLoopProvider = new ControlLoopProvider(mock(ControlLoopRepository.class),
- toscaNodeTemplateRepository, mock(ToscaNodeTemplatesRepository.class));
-
- var toscaNodeTemplate0 = new JpaToscaNodeTemplate(new PfConceptKey(ID_NAME, ID_VERSION));
- var toscaNodeTemplate1 = new JpaToscaNodeTemplate(new PfConceptKey("PMSHInstance2", ID_VERSION));
-
- when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, null, null))
- .thenReturn(List.of(toscaNodeTemplate0, toscaNodeTemplate1));
- when(toscaNodeTemplateRepository.findAll()).thenReturn(List.of(toscaNodeTemplate0, toscaNodeTemplate1));
- when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, ID_NAME, ID_VERSION))
- .thenReturn(List.of(toscaNodeTemplate0));
-
- // Getting all nodes
- var listNodes = controlLoopProvider.getAllNodeTemplates();
- assertNotNull(listNodes);
- assertThat(listNodes).hasSize(2);
-
- listNodes = controlLoopProvider.getNodeTemplates(ID_NAME, ID_VERSION);
- assertNotNull(listNodes);
- assertThat(listNodes).hasSize(1);
-
- listNodes = controlLoopProvider.getAllNodeTemplates();
- assertNotNull(listNodes);
- assertThat(listNodes).hasSize(2);
-
- var nodeTemplateFilter =
- ToscaTypedEntityFilter.<ToscaNodeTemplate>builder().name(ID_NAME).version(ID_VERSION).build();
-
- listNodes = controlLoopProvider.getFilteredNodeTemplates(nodeTemplateFilter);
- assertNotNull(listNodes);
- assertThat(listNodes).hasSize(1);
-
- assertThatThrownBy(() -> {
- controlLoopProvider.getFilteredNodeTemplates(null);
- }).hasMessageMatching("filter is marked non-null but is null");
- }
-
- private static ToscaServiceTemplate testControlLoopRead() {
- return testControlLoopYamlSerialization(TOSCA_TEMPLATE_YAML);
- }
-
- private static ToscaServiceTemplate testControlLoopYamlSerialization(String controlLoopFilePath) {
- var controlLoopString = ResourceUtils.getResourceAsString(controlLoopFilePath);
- return yamlTranslator.fromYaml(controlLoopString, ToscaServiceTemplate.class);
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotificationTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotificationTest.java
deleted file mode 100644
index bf2e2fa0a..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotificationTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.notification;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.jupiter.api.Test;
-
-class ControlLoopNotificationTest {
-
- @Test
- void testControlLoopNotification() {
- ControlLoopNotification cln0 = new ControlLoopNotification();
-
- List<ControlLoopStatus> addedList = new ArrayList<>();
- addedList.add(new ControlLoopStatus());
-
- List<ControlLoopStatus> deletedList = new ArrayList<>();
- deletedList.add(new ControlLoopStatus());
-
- assertEquals(true, cln0.isEmpty());
-
- cln0.setAdded(addedList);
- assertEquals(false, cln0.isEmpty());
- cln0.setAdded(null);
- assertEquals(true, cln0.isEmpty());
-
- cln0.setDeleted(deletedList);
- assertEquals(false, cln0.isEmpty());
- cln0.setDeleted(null);
- assertEquals(true, cln0.isEmpty());
-
- cln0.setAdded(addedList);
- cln0.setDeleted(deletedList);
- assertEquals(false, cln0.isEmpty());
- cln0.setAdded(null);
- cln0.setDeleted(null);
- assertEquals(true, cln0.isEmpty());
- }
-
- @Test
- void testControlLoopNotificationLombok() {
- assertNotNull(new ControlLoopNotification());
- assertNotNull(new ControlLoopNotification(new ArrayList<>(), new ArrayList<>()));
-
- ControlLoopNotification cln0 = new ControlLoopNotification();
-
- assertThat(cln0.toString()).contains("ControlLoopNotification(");
- assertEquals(false, cln0.hashCode() == 0);
- assertEquals(true, cln0.equals(cln0));
- assertEquals(false, cln0.equals(null));
-
-
- ControlLoopNotification cln1 = new ControlLoopNotification();
-
- assertThat(cln1.toString()).contains("ControlLoopNotification(");
- assertEquals(false, cln1.hashCode() == 0);
- assertEquals(true, cln1.equals(cln0));
- assertEquals(false, cln1.equals(null));
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsTest.java
index 3bb0050c8..ee79b27b7 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -31,37 +31,37 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-class ClElementStatisticsTest {
+class AcElementStatisticsTest {
@Test
- void testClElementStatisticsLombok() {
- assertNotNull(new ClElementStatistics());
- ClElementStatistics cles0 = new ClElementStatistics();
+ void testAcElementStatisticsLombok() {
+ assertNotNull(new AcElementStatistics());
+ AcElementStatistics aces0 = new AcElementStatistics();
- assertThat(cles0.toString()).contains("ClElementStatistics(");
- assertThat(cles0.hashCode()).isNotZero();
- assertEquals(true, cles0.equals(cles0));
- assertEquals(false, cles0.equals(null));
+ assertThat(aces0.toString()).contains("AcElementStatistics(");
+ assertThat(aces0.hashCode()).isNotZero();
+ assertEquals(true, aces0.equals(aces0));
+ assertEquals(false, aces0.equals(null));
- ClElementStatistics cles1 = new ClElementStatistics();
- cles1.setParticipantId(new ToscaConceptIdentifier("defName", "0.0.1"));
- cles1.setTimeStamp(Instant.now());
+ AcElementStatistics aces1 = new AcElementStatistics();
+ aces1.setParticipantId(new ToscaConceptIdentifier("defName", "0.0.1"));
+ aces1.setTimeStamp(Instant.now());
- assertThat(cles1.toString()).contains("ClElementStatistics(");
- assertEquals(false, cles1.hashCode() == 0);
- assertEquals(false, cles1.equals(cles0));
- assertEquals(false, cles1.equals(null));
+ assertThat(aces1.toString()).contains("AcElementStatistics(");
+ assertEquals(false, aces1.hashCode() == 0);
+ assertEquals(false, aces1.equals(aces0));
+ assertEquals(false, aces1.equals(null));
- assertNotEquals(cles1, cles0);
+ assertNotEquals(aces1, aces0);
- ClElementStatistics cles2 = new ClElementStatistics();
- cles2.setId(UUID.randomUUID());
+ AcElementStatistics aces2 = new AcElementStatistics();
+ aces2.setId(UUID.randomUUID());
// @formatter:off
- assertThatThrownBy(() -> cles2.setParticipantId(null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cles2.setTimeStamp(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> aces2.setParticipantId(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> aces2.setTimeStamp(null)).isInstanceOf(NullPointerException.class);
// @formatter:on
- assertNotEquals(cles2, cles0);
+ assertNotEquals(aces2, aces0);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopConceptPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionConceptPojosTest.java
index daade4d52..1d45e5919 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopConceptPojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionConceptPojosTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
@@ -37,12 +37,12 @@ import org.onap.policy.common.utils.test.ToStringTester;
/**
* Class to perform unit tests of all pojos.
*/
-class ControlLoopConceptPojosTest {
+class AutomationCompositionConceptPojosTest {
@Test
void testPojos() {
List<PojoClass> pojoClasses =
- PojoClassFactory.getPojoClasses(ControlLoopConceptPojosTest.class.getPackageName());
+ PojoClassFactory.getPojoClasses(AutomationCompositionConceptPojosTest.class.getPackageName());
// @formatter:off
final Validator validator = ValidatorBuilder
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementTest.java
new file mode 100644
index 000000000..4e739db52
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementTest.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+class AutomationCompositionElementTest {
+ @Test
+ void testAutomationCompositionElement() {
+ var ace0 = new AutomationCompositionElement();
+ var ace1 = new AutomationCompositionElement(ace0);
+ assertEquals(ace0, ace1);
+
+ ace1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
+ ace1.setDescription("Description");
+ ace1.setId(UUID.randomUUID());
+ ace1.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ ace1.setParticipantId(new ToscaConceptIdentifier("id", "1.2.3"));
+ ace1.setState(AutomationCompositionState.UNINITIALISED);
+
+ var ace2 = new AutomationCompositionElement(ace1);
+ assertEquals(ace1, ace2);
+ }
+
+ @Test
+ void testAutomationCompositionState() {
+ var ace0 = new AutomationCompositionElement();
+
+ assertTrue(
+ ace0.getOrderedState()
+ .equalsAutomationCompositionState(AutomationCompositionState.UNINITIALISED));
+
+ assertTrue(
+ ace0.getOrderedState().asState()
+ .equalsAutomationCompositionOrderedState(AutomationCompositionOrderedState.UNINITIALISED));
+ }
+
+ @Test
+ void testAutomationCompositionElementLombok() {
+ assertNotNull(new AutomationCompositionElement());
+ var ace0 = new AutomationCompositionElement();
+
+ assertThat(ace0.toString()).contains("AutomationCompositionElement(");
+ assertThat(ace0.hashCode()).isNotZero();
+ assertEquals(true, ace0.equals(ace0));
+ assertEquals(false, ace0.equals(null));
+
+ var ace1 = new AutomationCompositionElement();
+
+ ace1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
+ ace1.setDescription("Description");
+ ace1.setId(UUID.randomUUID());
+ ace1.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ ace1.setParticipantId(new ToscaConceptIdentifier("id", "1.2.3"));
+ ace1.setState(AutomationCompositionState.UNINITIALISED);
+
+ assertThat(ace1.toString()).contains("AutomationCompositionElement(");
+ assertEquals(false, ace1.hashCode() == 0);
+ assertEquals(false, ace1.equals(ace0));
+ assertEquals(false, ace1.equals(null));
+
+ assertNotEquals(ace1, ace0);
+
+ var ace2 = new AutomationCompositionElement();
+
+ // @formatter:off
+ assertThatThrownBy(() -> ace2.setDefinition(null)). isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ace2.setId(null)). isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ace2.setOrderedState(null)). isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ace2.setParticipantId(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ace2.setState(null)). isInstanceOf(NullPointerException.class);
+ // @formatter:on
+
+ assertNotEquals(ace2, ace0);
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionTest.java
new file mode 100644
index 000000000..ad8a1bbea
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionTest.java
@@ -0,0 +1,160 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.time.Instant;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.models.base.PfKey;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+class AutomationCompositionTest {
+ @Test
+ void testAutomationComposition() {
+ var ac0 = new AutomationComposition();
+ ac0.setDefinition(new ToscaConceptIdentifier("dfName", "1.2.3"));
+ assertEquals("dfName", ac0.getType());
+ assertEquals("1.2.3", ac0.getTypeVersion());
+
+ var ac1 = new AutomationComposition(ac0);
+ assertEquals(ac0, ac1);
+
+ assertEquals(0, ac0.compareTo(ac1));
+ }
+
+ @Test
+ void testAutomationCompositionLombok() {
+ assertNotNull(new AutomationComposition());
+ var ac0 = new AutomationComposition();
+ ac0.setElements(new LinkedHashMap<>());
+
+ assertThat(ac0.toString()).contains("AutomationComposition(");
+ assertThat(ac0.hashCode()).isNotZero();
+ assertEquals(true, ac0.equals(ac0));
+ assertEquals(false, ac0.equals(null));
+
+ var ac1 = new AutomationComposition();
+
+ ac1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
+ ac1.setDescription("Description");
+ ac1.setElements(new LinkedHashMap<>());
+ ac1.setName("Name");
+ ac1.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ ac1.setState(AutomationCompositionState.UNINITIALISED);
+ ac1.setVersion("0.0.1");
+
+ assertThat(ac1.toString()).contains("AutomationComposition(");
+ assertEquals(false, ac1.hashCode() == 0);
+ assertEquals(false, ac1.equals(ac0));
+ assertEquals(false, ac1.equals(null));
+
+ assertNotEquals(ac1, ac0);
+
+ var ac2 = new AutomationComposition();
+ ac2.setElements(new LinkedHashMap<>());
+
+ // @formatter:off
+ assertThatThrownBy(() -> ac2.setDefinition(null)). isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ac2.setOrderedState(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ac2.setState(null)). isInstanceOf(NullPointerException.class);
+ // @formatter:on
+
+ assertEquals(ac2, ac0);
+
+ ac1.setCascadedOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ assertEquals(AutomationCompositionOrderedState.PASSIVE, ac1.getOrderedState());
+
+ ac1.getElements().put(UUID.randomUUID(), new AutomationCompositionElement());
+ ac1.setCascadedOrderedState(AutomationCompositionOrderedState.RUNNING);
+ assertEquals(AutomationCompositionOrderedState.RUNNING, ac1.getOrderedState());
+ assertEquals(AutomationCompositionOrderedState.RUNNING,
+ ac1.getElements().values().iterator().next().getOrderedState());
+
+ assertNull(ac0.getElements().get(UUID.randomUUID()));
+ assertNull(ac1.getElements().get(UUID.randomUUID()));
+
+ assertEquals(PfKey.NULL_KEY_NAME, ac0.getDefinition().getName());
+
+ }
+
+ @Test
+ void testAutomationCompositionElementStatisticsList() {
+ var ac = new AutomationComposition();
+ List<AcElementStatistics> emptylist = ac.getAutomationCompositionElementStatisticsList(ac);
+ assertEquals(List.of(), emptylist);
+
+ var ac1 = getAutomationCompositionTest();
+ List<AcElementStatistics> list = ac1.getAutomationCompositionElementStatisticsList(ac1);
+ assertNotNull(list);
+ assertEquals(2, list.size());
+ assertEquals(AutomationCompositionState.UNINITIALISED, list.get(0).getState());
+ }
+
+ private AutomationComposition getAutomationCompositionTest() {
+ var ac = new AutomationComposition();
+ ac.setDefinition(new ToscaConceptIdentifier("defName", "1.2.3"));
+ ac.setDescription("Description");
+ ac.setElements(new LinkedHashMap<>());
+ ac.setName("Name");
+ ac.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ ac.setState(AutomationCompositionState.UNINITIALISED);
+ ac.setVersion("0.0.1");
+
+ var uuid = UUID.randomUUID();
+ var id = new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "1.0.1");
+ var acElement = getAutomationCompositionElementTest(uuid, id);
+
+ var uuid2 = UUID.randomUUID();
+ var id2 = new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipantIntermediary",
+ "0.0.1");
+ var acElement2 = getAutomationCompositionElementTest(uuid2, id2);
+
+ ac.getElements().put(uuid, acElement);
+ ac.getElements().put(uuid2, acElement2);
+ return ac;
+ }
+
+ private AutomationCompositionElement getAutomationCompositionElementTest(UUID uuid, ToscaConceptIdentifier id) {
+ var acElement = new AutomationCompositionElement();
+ acElement.setId(uuid);
+ acElement.setParticipantId(id);
+ acElement.setDefinition(id);
+ acElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setParticipantId(id);
+ acElementStatistics.setState(AutomationCompositionState.UNINITIALISED);
+ acElementStatistics.setTimeStamp(Instant.now());
+
+ acElement.setAcElementStatistics(acElementStatistics);
+
+ return acElement;
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsTest.java
index f55f624bf..de9b884d3 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java
index 5c429b96c..164c7c1a0 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java
index 3fb8b6d7f..5252221a8 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtilsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import static org.assertj.core.api.Assertions.assertThat;
@@ -36,12 +36,14 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
class ParticipantUtilsTest {
private static final Coder CODER = new StandardCoder();
- private static final String TOSCA_TEMPLATE_YAML = "examples/controlloop/PMSubscriptionHandling.yaml";
- private static final String CONTROL_LOOP_JSON = "src/test/resources/providers/TestControlLoops.json";
- private static final String CONTROL_LOOP_ELEMENT = "org.onap.policy.clamp.controlloop.ControlLoopElement";
- private static final String POLICY_CONTROL_LOOP_ELEMENT =
- "org.onap.policy.clamp.controlloop.PolicyControlLoopElement";
- private static final String PARTICIPANT_CONTROL_LOOP_ELEMENT = "org.onap.policy.clamp.controlloop.Participant";
+ private static final String TOSCA_TEMPLATE_YAML = "examples/acm/PMSubscriptionHandling.yaml";
+ private static final String AUTOMATION_COMPOSITION_JSON =
+ "src/test/resources/providers/TestAutomationCompositions.json";
+ private static final String AUTOMATION_COMPOSITION_ELEMENT =
+ "org.onap.policy.clamp.acm.AutomationCompositionElement";
+ private static final String POLICY_AUTOMATION_COMPOSITION_ELEMENT =
+ "org.onap.policy.clamp.acm.PolicyAutomationCompositionElement";
+ private static final String PARTICIPANT_AUTOMATION_COMPOSITION_ELEMENT = "org.onap.policy.clamp.acm.Participant";
private static final StandardYamlCoder YAML_TRANSLATOR = new StandardYamlCoder();
@Test
@@ -60,25 +62,30 @@ class ParticipantUtilsTest {
@Test
void testGetFirstStartPhase() throws CoderException {
- var serviceTemplate = YAML_TRANSLATOR.decode(ResourceUtils.getResourceAsStream(TOSCA_TEMPLATE_YAML),
- ToscaServiceTemplate.class);
- var controlLoops = CODER.decode(ResourceUtils.getResourceAsString(CONTROL_LOOP_JSON), ControlLoops.class);
- var result = ParticipantUtils.getFirstStartPhase(controlLoops.getControlLoopList().get(0), serviceTemplate);
+ var serviceTemplate =
+ YAML_TRANSLATOR.decode(ResourceUtils.getResourceAsStream(TOSCA_TEMPLATE_YAML), ToscaServiceTemplate.class);
+ var automationCompositions =
+ CODER.decode(ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON), AutomationCompositions.class);
+ var result = ParticipantUtils.getFirstStartPhase(automationCompositions.getAutomationCompositionList().get(0),
+ serviceTemplate);
assertThat(result).isZero();
}
@Test
- void testCheckIfNodeTemplateIsControlLoopElement() throws CoderException {
- var serviceTemplate = YAML_TRANSLATOR.decode(ResourceUtils.getResourceAsStream(TOSCA_TEMPLATE_YAML),
- ToscaServiceTemplate.class);
+ void testCheckIfNodeTemplateIsAutomationCompositionElement() throws CoderException {
+ var serviceTemplate =
+ YAML_TRANSLATOR.decode(ResourceUtils.getResourceAsStream(TOSCA_TEMPLATE_YAML), ToscaServiceTemplate.class);
var nodeTemplate = new ToscaNodeTemplate();
- nodeTemplate.setType(CONTROL_LOOP_ELEMENT);
- assertThat(ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(nodeTemplate, serviceTemplate)).isTrue();
+ nodeTemplate.setType(AUTOMATION_COMPOSITION_ELEMENT);
+ assertThat(ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(nodeTemplate, serviceTemplate))
+ .isTrue();
- nodeTemplate.setType(POLICY_CONTROL_LOOP_ELEMENT);
- assertThat(ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(nodeTemplate, serviceTemplate)).isTrue();
+ nodeTemplate.setType(POLICY_AUTOMATION_COMPOSITION_ELEMENT);
+ assertThat(ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(nodeTemplate, serviceTemplate))
+ .isTrue();
- nodeTemplate.setType(PARTICIPANT_CONTROL_LOOP_ELEMENT);
- assertThat(ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(nodeTemplate, serviceTemplate)).isFalse();
+ nodeTemplate.setType(PARTICIPANT_AUTOMATION_COMPOSITION_ELEMENT);
+ assertThat(ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(nodeTemplate, serviceTemplate))
+ .isFalse();
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotificationTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotificationTest.java
new file mode 100644
index 000000000..49bb719ac
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotificationTest.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.messages.dmaap.notification;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.jupiter.api.Test;
+
+class AutomationCompositionNotificationTest {
+
+ @Test
+ void testAutomationCompositionNotification() {
+ AutomationCompositionNotification acn0 = new AutomationCompositionNotification();
+
+ List<AutomationCompositionStatus> addedList = new ArrayList<>();
+ addedList.add(new AutomationCompositionStatus());
+
+ List<AutomationCompositionStatus> deletedList = new ArrayList<>();
+ deletedList.add(new AutomationCompositionStatus());
+
+ assertEquals(true, acn0.isEmpty());
+
+ acn0.setAdded(addedList);
+ assertEquals(false, acn0.isEmpty());
+ acn0.setAdded(null);
+ assertEquals(true, acn0.isEmpty());
+
+ acn0.setDeleted(deletedList);
+ assertEquals(false, acn0.isEmpty());
+ acn0.setDeleted(null);
+ assertEquals(true, acn0.isEmpty());
+
+ acn0.setAdded(addedList);
+ acn0.setDeleted(deletedList);
+ assertEquals(false, acn0.isEmpty());
+ acn0.setAdded(null);
+ acn0.setDeleted(null);
+ assertEquals(true, acn0.isEmpty());
+ }
+
+ @Test
+ void testAutomationCompositionNotificationLombok() {
+ assertNotNull(new AutomationCompositionNotification());
+ assertNotNull(new AutomationCompositionNotification(new ArrayList<>(), new ArrayList<>()));
+
+ AutomationCompositionNotification acn0 = new AutomationCompositionNotification();
+
+ assertThat(acn0.toString()).contains("AutomationCompositionNotification(");
+ assertEquals(false, acn0.hashCode() == 0);
+ assertEquals(true, acn0.equals(acn0));
+ assertEquals(false, acn0.equals(null));
+
+
+ AutomationCompositionNotification acn1 = new AutomationCompositionNotification();
+
+ assertThat(acn1.toString()).contains("AutomationCompositionNotification(");
+ assertEquals(false, acn1.hashCode() == 0);
+ assertEquals(true, acn1.equals(acn0));
+ assertEquals(false, acn1.equals(null));
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatusTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatusTest.java
index cca5e8554..028566888 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatusTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatusTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.notification;
+package org.onap.policy.clamp.models.acm.messages.dmaap.notification;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
@@ -28,21 +28,21 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-class ControlLoopStatusTest {
+class AutomationCompositionStatusTest {
@Test
- void testControlLoopStatusLombok() {
- assertNotNull(new ControlLoopStatus());
- assertNotNull(new ControlLoopStatus(UUID.randomUUID(), new ToscaConceptIdentifier()));
+ void testAutomationCompositionStatusLombok() {
+ assertNotNull(new AutomationCompositionStatus());
+ assertNotNull(new AutomationCompositionStatus(UUID.randomUUID(), new ToscaConceptIdentifier()));
- ControlLoopStatus cln0 = new ControlLoopStatus();
+ AutomationCompositionStatus acn0 = new AutomationCompositionStatus();
- assertThat(cln0.toString()).contains("ControlLoopStatus(");
- assertEquals(false, cln0.hashCode() == 0);
- assertEquals(true, cln0.equals(cln0));
- assertEquals(false, cln0.equals(null));
+ assertThat(acn0.toString()).contains("AutomationCompositionStatus(");
+ assertEquals(false, acn0.hashCode() == 0);
+ assertEquals(true, acn0.equals(acn0));
+ assertEquals(false, acn0.equals(null));
- ControlLoopStatus cln1 = new ControlLoopStatus();
- assertEquals(true, cln1.equals(cln0));
+ AutomationCompositionStatus acn1 = new AutomationCompositionStatus();
+ assertEquals(true, acn1.equals(acn0));
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/NotificationPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/NotificationPojosTest.java
index 1a89a1b3e..494252acc 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/NotificationPojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/NotificationPojosTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.notification;
+package org.onap.policy.clamp.models.acm.messages.dmaap.notification;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java
index f312c4863..383a55115 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java
@@ -18,51 +18,51 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementAck;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-class ControlLoopAckTest {
+class AutomationCompositionAckTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new ControlLoopAck((ControlLoopAck) null))
+ assertThatThrownBy(() -> new AutomationCompositionAck((AutomationCompositionAck) null))
.isInstanceOf(NullPointerException.class);
- final var orig = new ControlLoopAck(ParticipantMessageType.CONTROL_LOOP_UPDATE);
+ final var orig = new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
// verify with null values
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ControlLoopAck(orig).toString()));
+ removeVariableFields(new AutomationCompositionAck(orig).toString()));
// verify with all values
var id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
orig.setParticipantType(id);
- var clElementResult = new ControlLoopElementAck(ControlLoopState.UNINITIALISED,
- true, "ControlLoopElement result");
- final var controlLoopResultMap = Map.of(UUID.randomUUID(), clElementResult);
- orig.setControlLoopResultMap(controlLoopResultMap);
+ var acElementResult = new AutomationCompositionElementAck(AutomationCompositionState.UNINITIALISED,
+ true, "AutomationCompositionElement result");
+ final var automationCompositionResultMap = Map.of(UUID.randomUUID(), acElementResult);
+ orig.setAutomationCompositionResultMap(automationCompositionResultMap);
orig.setResponseTo(UUID.randomUUID());
orig.setResult(true);
- orig.setMessage("Successfully processed ControlLoopUpdate message");
+ orig.setMessage("Successfully processed AutomationCompositionUpdate message");
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ControlLoopAck(orig).toString()));
+ removeVariableFields(new AutomationCompositionAck(orig).toString()));
- assertSerializable(orig, ControlLoopAck.class);
+ assertSerializable(orig, AutomationCompositionAck.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java
index 1bf155e9a..6c48afad2 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java
@@ -18,48 +18,48 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Test the copy constructor and other methods.
*/
-class ControlLoopStateChangeTest {
+class AutomationCompositionStateChangeTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new ControlLoopStateChange(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new AutomationCompositionStateChange(null)).isInstanceOf(NullPointerException.class);
- ControlLoopStateChange orig = new ControlLoopStateChange();
+ AutomationCompositionStateChange orig = new AutomationCompositionStateChange();
// verify with null values
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ControlLoopStateChange(orig).toString()));
+ removeVariableFields(new AutomationCompositionStateChange(orig).toString()));
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
orig.setMessageId(UUID.randomUUID());
- orig.setOrderedState(ControlLoopOrderedState.RUNNING);
- orig.setCurrentState(ControlLoopState.PASSIVE);
+ orig.setOrderedState(AutomationCompositionOrderedState.RUNNING);
+ orig.setCurrentState(AutomationCompositionState.PASSIVE);
orig.setTimestamp(Instant.ofEpochMilli(3000));
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ControlLoopStateChange(orig).toString()));
+ removeVariableFields(new AutomationCompositionStateChange(orig).toString()));
- assertSerializable(orig, ControlLoopStateChange.class);
+ assertSerializable(orig, AutomationCompositionStateChange.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java
index ce56d582a..809256d40 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
@@ -41,42 +41,42 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
/**
* Test the copy constructor.
*/
-class ControlLoopUpdateTest {
+class AutomationCompositionUpdateTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new ControlLoopUpdate(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new AutomationCompositionUpdate(null)).isInstanceOf(NullPointerException.class);
- ControlLoopUpdate orig = new ControlLoopUpdate();
+ AutomationCompositionUpdate orig = new AutomationCompositionUpdate();
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(null);
orig.setMessageId(UUID.randomUUID());
orig.setTimestamp(Instant.ofEpochMilli(3000));
- ControlLoopElement clElement = new ControlLoopElement();
- clElement.setId(UUID.randomUUID());
- clElement.setDefinition(id);
- clElement.setDescription("Description");
- clElement.setOrderedState(ControlLoopOrderedState.PASSIVE);
- clElement.setState(ControlLoopState.PASSIVE);
- clElement.setParticipantId(id);
- clElement.setParticipantType(id);
+ AutomationCompositionElement acElement = new AutomationCompositionElement();
+ acElement.setId(UUID.randomUUID());
+ acElement.setDefinition(id);
+ acElement.setDescription("Description");
+ acElement.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ acElement.setState(AutomationCompositionState.PASSIVE);
+ acElement.setParticipantId(id);
+ acElement.setParticipantType(id);
ToscaProperty property = new ToscaProperty();
property.setName("test");
property.setType("testType");
Map<String, ToscaProperty> propertiesMap = Map.of("Prop1", property);
- clElement.setPropertiesMap(propertiesMap);
+ acElement.setPropertiesMap(propertiesMap);
ParticipantUpdates participantUpdates = new ParticipantUpdates();
participantUpdates.setParticipantId(id);
- participantUpdates.setControlLoopElementList(List.of(clElement));
+ participantUpdates.setAutomationCompositionElementList(List.of(acElement));
orig.setParticipantUpdatesList(List.of(participantUpdates));
- ControlLoopUpdate other = new ControlLoopUpdate(orig);
+ AutomationCompositionUpdate other = new AutomationCompositionUpdate(orig);
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
- assertSerializable(orig, ControlLoopUpdate.class);
+ assertSerializable(orig, AutomationCompositionUpdate.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java
index df82ab071..89a34e33d 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import java.util.UUID;
import org.junit.jupiter.api.Test;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAckTest.java
index f1ae5f709..59a6d826b 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAckTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.UUID;
import org.junit.jupiter.api.Test;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java
index 89546890a..873257696 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
@@ -47,7 +47,7 @@ class ParticipantDeregisterTest {
ToscaConceptIdentifier id = new ToscaConceptIdentifier();
id.setName("id");
id.setVersion("1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
orig.setParticipantType(id);
orig.setMessageId(UUID.randomUUID());
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java
index 58d3afebc..fa16d145d 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import java.time.Instant;
import java.util.UUID;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageUtils.java
index 78c278f98..4ff4f3b35 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageUtils.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.junit.Assert.assertEquals;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java
index e67fbc143..ce23a821f 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantPojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
@@ -46,8 +46,8 @@ class ParticipantPojosTest {
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantMessageTest.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantAckMessage.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantAckMessageTest.class));
- pojoClasses.remove(PojoClassFactory.getPojoClass(ControlLoopAck.class));
- pojoClasses.remove(PojoClassFactory.getPojoClass(ControlLoopAckTest.class));
+ pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionAck.class));
+ pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionAckTest.class));
// @formatter:off
final Validator validator = ValidatorBuilder
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAckTest.java
index 886933aba..10200d86f 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAckTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.UUID;
import org.junit.jupiter.api.Test;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java
index e86d9e885..d08acda47 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
@@ -47,7 +47,7 @@ class ParticipantRegisterTest {
ToscaConceptIdentifier id = new ToscaConceptIdentifier();
id.setName("id");
id.setVersion("1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
orig.setParticipantType(id);
orig.setMessageId(UUID.randomUUID());
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java
index 98c127107..92025a707 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
@@ -43,7 +43,7 @@ class ParticipantStatusReqTest {
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
orig.setParticipantId(id);
- orig.setControlLoopId(null);
+ orig.setAutomationCompositionId(null);
orig.setParticipantType(null);
orig.setMessageId(UUID.randomUUID());
orig.setTimestamp(Instant.ofEpochMilli(3000));
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java
index b2bce05cc..a33c12f2e 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java
@@ -18,27 +18,27 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionStatistics;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
@@ -58,7 +58,7 @@ class ParticipantStatusTest {
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
ToscaConceptIdentifier type = new ToscaConceptIdentifier("type", "2.3.4");
orig.setParticipantType(type);
@@ -67,14 +67,14 @@ class ParticipantStatusTest {
orig.setHealthStatus(ParticipantHealthStatus.HEALTHY);
orig.setTimestamp(Instant.ofEpochMilli(3000));
- ControlLoopInfo clInfo = getControlLoopInfo(id);
- orig.setControlLoopInfoList(List.of(clInfo));
+ AutomationCompositionInfo acInfo = getAutomationCompositionInfo(id);
+ orig.setAutomationCompositionInfoList(List.of(acInfo));
ParticipantDefinition participantDefinitionUpdate = new ParticipantDefinition();
participantDefinitionUpdate.setParticipantId(id);
participantDefinitionUpdate.setParticipantType(type);
- ControlLoopElementDefinition clDefinition = getClElementDefinition(id);
- participantDefinitionUpdate.setControlLoopElementDefinitionList(List.of(clDefinition));
+ AutomationCompositionElementDefinition acDefinition = getAcElementDefinition(id);
+ participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition));
orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate));
assertEquals(removeVariableFields(orig.toString()),
@@ -83,47 +83,47 @@ class ParticipantStatusTest {
assertSerializable(orig, ParticipantStatus.class);
}
- private ControlLoopInfo getControlLoopInfo(ToscaConceptIdentifier id) {
- ControlLoopInfo clInfo = new ControlLoopInfo();
- clInfo.setState(ControlLoopState.PASSIVE2RUNNING);
- clInfo.setControlLoopId(id);
-
- ControlLoopStatistics clStatistics = new ControlLoopStatistics();
- clStatistics.setControlLoopId(id);
- clStatistics.setAverageExecutionTime(12345);
- clStatistics.setEventCount(12345);
- clStatistics.setLastEnterTime(12345);
- clStatistics.setLastExecutionTime(12345);
- clStatistics.setLastStart(12345);
- clStatistics.setTimeStamp(Instant.ofEpochMilli(3000));
- clStatistics.setUpTime(12345);
- ClElementStatisticsList clElementStatisticsList = new ClElementStatisticsList();
- ClElementStatistics clElementStatistics = new ClElementStatistics();
- clElementStatistics.setParticipantId(new ToscaConceptIdentifier("defName", "0.0.1"));
- clElementStatistics.setTimeStamp(Instant.now());
- clElementStatisticsList.setClElementStatistics(List.of(clElementStatistics));
- clStatistics.setClElementStatisticsList(clElementStatisticsList);
-
- clInfo.setControlLoopStatistics(clStatistics);
- return clInfo;
+ private AutomationCompositionInfo getAutomationCompositionInfo(ToscaConceptIdentifier id) {
+ AutomationCompositionInfo acInfo = new AutomationCompositionInfo();
+ acInfo.setState(AutomationCompositionState.PASSIVE2RUNNING);
+ acInfo.setAutomationCompositionId(id);
+
+ AutomationCompositionStatistics acStatistics = new AutomationCompositionStatistics();
+ acStatistics.setAutomationCompositionId(id);
+ acStatistics.setAverageExecutionTime(12345);
+ acStatistics.setEventCount(12345);
+ acStatistics.setLastEnterTime(12345);
+ acStatistics.setLastExecutionTime(12345);
+ acStatistics.setLastStart(12345);
+ acStatistics.setTimeStamp(Instant.ofEpochMilli(3000));
+ acStatistics.setUpTime(12345);
+ AcElementStatisticsList acElementStatisticsList = new AcElementStatisticsList();
+ AcElementStatistics acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setParticipantId(new ToscaConceptIdentifier("defName", "0.0.1"));
+ acElementStatistics.setTimeStamp(Instant.now());
+ acElementStatisticsList.setAcElementStatistics(List.of(acElementStatistics));
+ acStatistics.setAcElementStatisticsList(acElementStatisticsList);
+
+ acInfo.setAutomationCompositionStatistics(acStatistics);
+ return acInfo;
}
- private ControlLoopElementDefinition getClElementDefinition(ToscaConceptIdentifier id) {
+ private AutomationCompositionElementDefinition getAcElementDefinition(ToscaConceptIdentifier id) {
ToscaNodeTemplate toscaNodeTemplate = new ToscaNodeTemplate();
toscaNodeTemplate.setName("nodeTemplate");
toscaNodeTemplate.setDerivedFrom("parentNodeTemplate");
toscaNodeTemplate.setDescription("Description of nodeTemplate");
toscaNodeTemplate.setVersion("1.2.3");
- ControlLoopElementDefinition clDefinition = new ControlLoopElementDefinition();
- clDefinition.setClElementDefinitionId(id);
- clDefinition.setControlLoopElementToscaNodeTemplate(toscaNodeTemplate);
+ AutomationCompositionElementDefinition acDefinition = new AutomationCompositionElementDefinition();
+ acDefinition.setAcElementDefinitionId(id);
+ acDefinition.setAutomationCompositionElementToscaNodeTemplate(toscaNodeTemplate);
ToscaProperty property = new ToscaProperty();
property.setName("test");
property.setType("testType");
Map<String, ToscaProperty> commonPropertiesMap = Map.of("Prop1", property);
- clDefinition.setCommonPropertiesMap(commonPropertiesMap);
- return clDefinition;
+ acDefinition.setCommonPropertiesMap(commonPropertiesMap);
+ return acDefinition;
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAckTest.java
index d2a191018..9f011a383 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAckTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.UUID;
import org.junit.jupiter.api.Test;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java
index d7023d0c1..f8aaffe11 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java
@@ -18,20 +18,20 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
@@ -49,7 +49,7 @@ class ParticipantUpdateTest {
ParticipantUpdate orig = new ParticipantUpdate();
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
orig.setParticipantType(id);
orig.setMessageId(UUID.randomUUID());
@@ -69,8 +69,8 @@ class ParticipantUpdateTest {
ParticipantDefinition participantDefinitionUpdate = new ParticipantDefinition();
participantDefinitionUpdate.setParticipantType(id);
- ControlLoopElementDefinition clDefinition = getClElementDefinition(id);
- participantDefinitionUpdate.setControlLoopElementDefinitionList(List.of(clDefinition));
+ AutomationCompositionElementDefinition acDefinition = getAcElementDefinition(id);
+ participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition));
orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate));
ParticipantUpdate other = new ParticipantUpdate(orig);
@@ -80,22 +80,22 @@ class ParticipantUpdateTest {
assertSerializable(orig, ParticipantUpdate.class);
}
- private ControlLoopElementDefinition getClElementDefinition(ToscaConceptIdentifier id) {
+ private AutomationCompositionElementDefinition getAcElementDefinition(ToscaConceptIdentifier id) {
ToscaNodeTemplate toscaNodeTemplate = new ToscaNodeTemplate();
toscaNodeTemplate.setName("nodeTemplate");
toscaNodeTemplate.setDerivedFrom("parentNodeTemplate");
toscaNodeTemplate.setDescription("Description of nodeTemplate");
toscaNodeTemplate.setVersion("1.2.3");
- ControlLoopElementDefinition clDefinition = new ControlLoopElementDefinition();
- clDefinition.setClElementDefinitionId(id);
- clDefinition.setControlLoopElementToscaNodeTemplate(toscaNodeTemplate);
+ AutomationCompositionElementDefinition acDefinition = new AutomationCompositionElementDefinition();
+ acDefinition.setAcElementDefinitionId(id);
+ acDefinition.setAutomationCompositionElementToscaNodeTemplate(toscaNodeTemplate);
ToscaProperty property = new ToscaProperty();
property.setName("test");
property.setType("testType");
Map<String, ToscaProperty> commonPropertiesMap = Map.of("Prop1", property);
- clDefinition.setCommonPropertiesMap(commonPropertiesMap);
- return clDefinition;
+ acDefinition.setCommonPropertiesMap(commonPropertiesMap);
+ return acDefinition;
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/MessagesRestPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/MessagesRestPojosTest.java
index 435cce8ef..4503be783 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/MessagesRestPojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/MessagesRestPojosTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest;
+package org.onap.policy.clamp.models.acm.messages.rest;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommandTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommandTest.java
index c9902753f..348359743 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommandTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommandTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertNotNull;
import java.util.ArrayList;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
class InstantiationCommandTest {
@Test
@@ -43,8 +43,8 @@ class InstantiationCommandTest {
InstantiationCommand ic1 = new InstantiationCommand();
- ic1.setControlLoopIdentifierList(new ArrayList<>());
- ic1.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
+ ic1.setAutomationCompositionIdentifierList(new ArrayList<>());
+ ic1.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
assertThat(ic1.toString()).contains("InstantiationCommand(");
assertEquals(false, ic1.hashCode() == 0);
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopChild.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAcElementStatisticsChild.java
index 10150cf59..ebbaf1d42 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopChild.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAcElementStatisticsChild.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
/**
- * Test class for {@link JpaControlLoop} comparisons.
+ * Test class for {@link JpaAcElementStatistics} comparisons.
*/
-class DummyJpaControlLoopChild extends JpaControlLoop {
+class DummyJpaAcElementStatisticsChild extends JpaAcElementStatistics {
private static final long serialVersionUID = -5101743610779424064L;
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopElementChild.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionChild.java
index 4bacb9255..c7f4351c7 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopElementChild.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionChild.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
/**
- * Test class for {@link JpaControlLoopElement} comparisons.
+ * Test class for {@link JpaAutomationComposition} comparisons.
*/
-class DummyJpaControlLoopElementChild extends JpaControlLoopElement {
+class DummyJpaAutomationCompositionChild extends JpaAutomationComposition {
private static final long serialVersionUID = -5101743610779424064L;
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaClElementStatisticsChild.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionElementChild.java
index 94b0b13c7..86723d98f 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaClElementStatisticsChild.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionElementChild.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
/**
- * Test class for {@link JpaClElementStatistics} comparisons.
+ * Test class for {@link JpaAutomationCompositionElement} comparisons.
*/
-class DummyJpaClElementStatisticsChild extends JpaClElementStatistics {
+class DummyJpaAutomationCompositionElementChild extends JpaAutomationCompositionElement {
private static final long serialVersionUID = -5101743610779424064L;
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantChild.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantChild.java
index 68dcc319b..6b34cc44e 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantChild.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantChild.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
/**
* Test class for {@link JpaParticipant} comparisons.
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantStatisticsChild.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantStatisticsChild.java
index 2c1f04ea1..95082cac7 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantStatisticsChild.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantStatisticsChild.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
/**
* Test class for {@link JpaParticipantStatistics} comparisons.
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatisticsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatisticsTest.java
new file mode 100644
index 000000000..4cf7b8af0
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatisticsTest.java
@@ -0,0 +1,189 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.time.Instant;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfReferenceTimestampKey;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+/**
+ * Test the {@link JpaAcElementStatistics} class.
+ */
+class JpaAcElementStatisticsTest {
+
+ private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
+
+ @Test
+ void testJpaAcElementStatisticsConstructor() {
+ assertThatThrownBy(() -> {
+ new JpaAcElementStatistics((JpaAcElementStatistics) null);
+ }).hasMessageMatching("copyConcept is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAcElementStatistics((PfReferenceTimestampKey) null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAcElementStatistics(null, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAcElementStatistics(null, new PfConceptKey());
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAcElementStatistics(new PfReferenceTimestampKey(), null);
+ }).hasMessageMatching("participantId is marked .*ull but is null");
+
+ assertNotNull(new JpaAcElementStatistics());
+ assertNotNull(new JpaAcElementStatistics((new PfReferenceTimestampKey())));
+ assertNotNull(new JpaAcElementStatistics(new PfReferenceTimestampKey(), new PfConceptKey()));
+ }
+
+ @Test
+ void testJpaAcElementStatistics() {
+ JpaAcElementStatistics testJpaAcElementStatistics = createJpaAcElementStatisticsInstance();
+
+ AcElementStatistics aces = createAcElementStatisticsInstance();
+ assertEquals(aces, testJpaAcElementStatistics.toAuthorative());
+
+ assertThatThrownBy(() -> {
+ testJpaAcElementStatistics.fromAuthorative(null);
+ }).hasMessageMatching("acElementStatistics is marked .*ull but is null");
+
+ assertThatThrownBy(() -> new JpaAcElementStatistics((JpaAcElementStatistics) null))
+ .isInstanceOf(NullPointerException.class);
+
+ JpaAcElementStatistics testJpaAcElementStatisticsFa = new JpaAcElementStatistics();
+ testJpaAcElementStatisticsFa.setKey(null);
+ testJpaAcElementStatisticsFa.fromAuthorative(aces);
+ assertEquals(testJpaAcElementStatistics, testJpaAcElementStatisticsFa);
+ testJpaAcElementStatisticsFa.setKey(PfReferenceTimestampKey.getNullKey());
+ testJpaAcElementStatisticsFa.fromAuthorative(aces);
+ assertEquals(testJpaAcElementStatistics, testJpaAcElementStatisticsFa);
+ testJpaAcElementStatisticsFa.setKey(new PfReferenceTimestampKey("elementName", "0.0.1",
+ "a95757ba-b34a-4049-a2a8-46773abcbe5e", Instant.ofEpochSecond(123456L)));
+ testJpaAcElementStatisticsFa.fromAuthorative(aces);
+ assertEquals(testJpaAcElementStatistics, testJpaAcElementStatisticsFa);
+
+ testJpaAcElementStatisticsFa = new JpaAcElementStatistics(aces);
+ assertEquals(testJpaAcElementStatistics, testJpaAcElementStatisticsFa);
+
+ assertEquals(1, testJpaAcElementStatistics.getKeys().size());
+
+ assertEquals("elementName", testJpaAcElementStatistics.getKey().getReferenceKey().getParentKeyName());
+
+ testJpaAcElementStatistics.clean();
+ assertEquals("elementName", testJpaAcElementStatistics.getKey().getReferenceKey().getParentKeyName());
+
+ JpaAcElementStatistics testJpaAcElementStatistics2 = new JpaAcElementStatistics(testJpaAcElementStatistics);
+ assertEquals(testJpaAcElementStatistics, testJpaAcElementStatistics2);
+ }
+
+ @Test
+ void testJpaAcElementStatisticsValidation() {
+ JpaAcElementStatistics testJpaAcElementStatistics = createJpaAcElementStatisticsInstance();
+
+ assertThatThrownBy(() -> {
+ testJpaAcElementStatistics.validate(null);
+ }).hasMessageMatching("fieldName is marked .*ull but is null");
+
+ assertTrue(testJpaAcElementStatistics.validate("").isValid());
+ }
+
+ @Test
+ void testJpaAcElementStatisticsCompareTo() {
+ JpaAcElementStatistics testJpaAcElementStatistics = createJpaAcElementStatisticsInstance();
+
+ JpaAcElementStatistics otherJpaAcElementStatistics = new JpaAcElementStatistics(testJpaAcElementStatistics);
+ assertEquals(0, testJpaAcElementStatistics.compareTo(otherJpaAcElementStatistics));
+ assertEquals(-1, testJpaAcElementStatistics.compareTo(null));
+ assertEquals(0, testJpaAcElementStatistics.compareTo(testJpaAcElementStatistics));
+ assertNotEquals(0, testJpaAcElementStatistics.compareTo(new DummyJpaAcElementStatisticsChild()));
+
+ testJpaAcElementStatistics.setState(AutomationCompositionState.PASSIVE);
+ assertNotEquals(0, testJpaAcElementStatistics.compareTo(otherJpaAcElementStatistics));
+ testJpaAcElementStatistics.setState(AutomationCompositionState.UNINITIALISED);
+ assertEquals(0, testJpaAcElementStatistics.compareTo(otherJpaAcElementStatistics));
+
+ assertEquals(testJpaAcElementStatistics, new JpaAcElementStatistics(testJpaAcElementStatistics));
+ }
+
+ @Test
+ void testJpaAcElementStatisticsLombok() {
+ assertNotNull(new Participant());
+ JpaAcElementStatistics aces0 = new JpaAcElementStatistics();
+
+ assertThat(aces0.toString()).contains("JpaAcElementStatistics(");
+ assertThat(aces0.hashCode()).isNotZero();
+ assertEquals(true, aces0.equals(aces0));
+ assertEquals(false, aces0.equals(null));
+
+
+ JpaAcElementStatistics aces11 = new JpaAcElementStatistics();
+
+ aces11.setState(AutomationCompositionState.UNINITIALISED);
+
+ assertThat(aces11.toString()).contains("JpaAcElementStatistics(");
+ assertEquals(false, aces11.hashCode() == 0);
+ assertEquals(false, aces11.equals(aces0));
+ assertEquals(false, aces11.equals(null));
+
+ assertNotEquals(aces11, aces0);
+
+ JpaAcElementStatistics aces2 = new JpaAcElementStatistics();
+ assertEquals(aces2, aces0);
+ }
+
+ private JpaAcElementStatistics createJpaAcElementStatisticsInstance() {
+ AcElementStatistics testAces = createAcElementStatisticsInstance();
+ JpaAcElementStatistics testJpaAcElementStatistics = new JpaAcElementStatistics();
+ testJpaAcElementStatistics.setKey(null);
+ testJpaAcElementStatistics.fromAuthorative(testAces);
+ testJpaAcElementStatistics.setKey(PfReferenceTimestampKey.getNullKey());
+ testJpaAcElementStatistics.fromAuthorative(testAces);
+
+ return testJpaAcElementStatistics;
+ }
+
+ private AcElementStatistics createAcElementStatisticsInstance() {
+ AcElementStatistics acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setParticipantId(new ToscaConceptIdentifier("elementName", "0.0.1"));
+ acElementStatistics.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e"));
+ acElementStatistics.setTimeStamp(Instant.ofEpochSecond(123456L));
+ acElementStatistics.setState(AutomationCompositionState.UNINITIALISED);
+
+ return acElementStatistics;
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
new file mode 100644
index 000000000..f4257bdd2
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
@@ -0,0 +1,315 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfKey;
+import org.onap.policy.models.base.PfReferenceKey;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+/**
+ * Test the {@link JpaAutomationCompositionElement} class.
+ */
+class JpaAutomationCompositionElementTest {
+
+ private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
+
+ @Test
+ void testJpaAutomationCompositionElementConstructor() {
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement((JpaAutomationCompositionElement) null);
+ }).hasMessageMatching("copyConcept is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement((PfReferenceKey) null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, null, null, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, null, null, AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, null, new PfConceptKey("participant", "0.0.1"), null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, null, new PfConceptKey("participant", "0.0.1"),
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, new PfConceptKey(), null, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, new PfConceptKey(), null,
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, new PfConceptKey(), new PfConceptKey("participant", "0.0.1"),
+ null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, new PfConceptKey(), new PfConceptKey("participant", "0.0.1"),
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), null, null, null);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), null, null,
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), null, new PfConceptKey("participant", "0.0.1"),
+ null);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), null, new PfConceptKey("participant", "0.0.1"),
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(), null, null);
+ }).hasMessageMatching("participantType is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(), null,
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching("participantType is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(),
+ new PfConceptKey("participant", "0.0.1"), null);
+ }).hasMessageMatching("state is marked .*ull but is null");
+
+ assertNotNull(new JpaAutomationCompositionElement());
+ assertNotNull(new JpaAutomationCompositionElement((new PfReferenceKey())));
+ assertNotNull(new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(),
+ new PfConceptKey("participant", "0.0.1"), AutomationCompositionState.UNINITIALISED));
+ }
+
+ @Test
+ void testJpaAutomationCompositionElement() {
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement =
+ createJpaAutomationCompositionElementInstance();
+
+ AutomationCompositionElement ace = createAutomationCompositionElementInstance();
+ assertEquals(ace, testJpaAutomationCompositionElement.toAuthorative());
+
+ assertThatThrownBy(() -> {
+ testJpaAutomationCompositionElement.fromAuthorative(null);
+ }).hasMessageMatching("element is marked .*ull but is null");
+
+ assertThatThrownBy(() -> new JpaAutomationCompositionElement((JpaAutomationCompositionElement) null))
+ .isInstanceOf(NullPointerException.class);
+
+ JpaAutomationCompositionElement testJpaAutomationCompositionElementFa = new JpaAutomationCompositionElement();
+ testJpaAutomationCompositionElementFa.setKey(null);
+ testJpaAutomationCompositionElementFa.fromAuthorative(ace);
+ assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElementFa);
+ testJpaAutomationCompositionElementFa.setKey(PfReferenceKey.getNullKey());
+ testJpaAutomationCompositionElementFa.fromAuthorative(ace);
+ assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElementFa);
+ testJpaAutomationCompositionElementFa.setKey(
+ new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION, "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
+ testJpaAutomationCompositionElementFa.fromAuthorative(ace);
+ assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElementFa);
+
+ assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
+ testJpaAutomationCompositionElement.getKey().getLocalName());
+ assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
+ new JpaAutomationCompositionElement(createAutomationCompositionElementInstance()).getKey().getLocalName());
+ assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
+ ((PfReferenceKey) new JpaAutomationCompositionElement(createAutomationCompositionElementInstance())
+ .getKeys().get(0)).getLocalName());
+
+ testJpaAutomationCompositionElement.clean();
+ assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
+ testJpaAutomationCompositionElement.getKey().getLocalName());
+
+ testJpaAutomationCompositionElement.setDescription(" A Message ");
+ testJpaAutomationCompositionElement.clean();
+ assertEquals("A Message", testJpaAutomationCompositionElement.getDescription());
+
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement2 =
+ new JpaAutomationCompositionElement(testJpaAutomationCompositionElement);
+ assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElement2);
+ }
+
+ @Test
+ void testJpaAutomationCompositionElementOrderedState() throws CoderException {
+ AutomationCompositionElement testAutomationCompositionElement = createAutomationCompositionElementInstance();
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement =
+ createJpaAutomationCompositionElementInstance();
+
+ testJpaAutomationCompositionElement.setOrderedState(null);
+ assertEquals(testAutomationCompositionElement, testJpaAutomationCompositionElement.toAuthorative());
+ testJpaAutomationCompositionElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+
+ AutomationCompositionElement noOrderedStateAce = new StandardCoder().decode(
+ new File("src/test/resources/json/AutomationCompositionElementNoOrderedState.json"),
+ AutomationCompositionElement.class);
+
+ JpaAutomationCompositionElement noOrderedStateJpaAce = new JpaAutomationCompositionElement(noOrderedStateAce);
+ assertNull(noOrderedStateJpaAce.getOrderedState());
+ noOrderedStateAce.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ noOrderedStateJpaAce = new JpaAutomationCompositionElement(noOrderedStateAce);
+ assertEquals(testJpaAutomationCompositionElement, noOrderedStateJpaAce);
+ }
+
+ @Test
+ void testJpaAutomationCompositionElementValidation() {
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement =
+ createJpaAutomationCompositionElementInstance();
+
+ assertThatThrownBy(() -> {
+ testJpaAutomationCompositionElement.validate(null);
+ }).hasMessageMatching("fieldName is marked .*ull but is null");
+
+ assertTrue(testJpaAutomationCompositionElement.validate("").isValid());
+ }
+
+ @Test
+ void testJpaAutomationCompositionElementCompareTo() {
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement =
+ createJpaAutomationCompositionElementInstance();
+
+ JpaAutomationCompositionElement otherJpaAutomationCompositionElement =
+ new JpaAutomationCompositionElement(testJpaAutomationCompositionElement);
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ assertEquals(-1, testJpaAutomationCompositionElement.compareTo(null));
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(testJpaAutomationCompositionElement));
+ assertNotEquals(0,
+ testJpaAutomationCompositionElement.compareTo(new DummyJpaAutomationCompositionElementChild()));
+
+ testJpaAutomationCompositionElement
+ .setKey(new PfReferenceKey("BadValue", "0.0.1", "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setKey(
+ new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION, "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setDefinition(new PfConceptKey("BadValue", "0.0.1"));
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setDefinition(new PfConceptKey("aceDef", "0.0.1"));
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setDescription("Description");
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setDescription(null);
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setState(AutomationCompositionState.PASSIVE);
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setState(AutomationCompositionState.UNINITIALISED);
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setParticipantType(new PfConceptKey("dummy", "0.0.1"));
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setParticipantType(new PfConceptKey("participantType", "0.0.1"));
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ assertEquals(testJpaAutomationCompositionElement,
+ new JpaAutomationCompositionElement(testJpaAutomationCompositionElement));
+ }
+
+ @Test
+ void testJpaAutomationCompositionElementLombok() {
+ assertNotNull(new Participant());
+ JpaAutomationCompositionElement ace0 = new JpaAutomationCompositionElement();
+
+ assertThat(ace0.toString()).contains("JpaAutomationCompositionElement(");
+ assertThat(ace0.hashCode()).isNotZero();
+ assertEquals(true, ace0.equals(ace0));
+ assertEquals(false, ace0.equals(null));
+
+ JpaAutomationCompositionElement ace1 = new JpaAutomationCompositionElement();
+
+ ace1.setDefinition(new PfConceptKey("defName", "0.0.1"));
+ ace1.setDescription("Description");
+ ace1.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ ace1.setState(AutomationCompositionState.UNINITIALISED);
+ ace1.setParticipantId(new PfConceptKey("participant", "0.0.1"));
+
+ assertThat(ace1.toString()).contains("AutomationCompositionElement(");
+ assertEquals(false, ace1.hashCode() == 0);
+ assertEquals(false, ace1.equals(ace0));
+ assertEquals(false, ace1.equals(null));
+
+ assertNotEquals(ace1, ace0);
+
+ JpaAutomationCompositionElement ace2 = new JpaAutomationCompositionElement();
+ assertEquals(ace2, ace0);
+ }
+
+ private JpaAutomationCompositionElement createJpaAutomationCompositionElementInstance() {
+ AutomationCompositionElement testAce = createAutomationCompositionElementInstance();
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement = new JpaAutomationCompositionElement();
+ testJpaAutomationCompositionElement.setKey(null);
+ testJpaAutomationCompositionElement.fromAuthorative(testAce);
+ testJpaAutomationCompositionElement.setKey(PfReferenceKey.getNullKey());
+ testJpaAutomationCompositionElement.fromAuthorative(testAce);
+
+ return testJpaAutomationCompositionElement;
+ }
+
+ private AutomationCompositionElement createAutomationCompositionElementInstance() {
+ AutomationCompositionElement automationCompositionElement = new AutomationCompositionElement();
+ automationCompositionElement.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e"));
+ automationCompositionElement.setDefinition(new ToscaConceptIdentifier("aceDef", "0.0.1"));
+ automationCompositionElement.setParticipantType(new ToscaConceptIdentifier("participantType", "0.0.1"));
+
+ return automationCompositionElement;
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
new file mode 100644
index 000000000..a016d1202
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
@@ -0,0 +1,310 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.LinkedHashMap;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+/**
+ * Test the {@link JpaAutomationCompositionTest} class.
+ */
+class JpaAutomationCompositionTest {
+
+ private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
+
+ @Test
+ void testJpaAutomationCompositionConstructor() {
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition((JpaAutomationComposition) null);
+ }).hasMessageMatching("copyConcept is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition((PfConceptKey) null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, null, null, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, null, null, new LinkedHashMap<>());
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, null, AutomationCompositionState.UNINITIALISED, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, null, AutomationCompositionState.UNINITIALISED, new LinkedHashMap<>());
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, new PfConceptKey(), null, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, new PfConceptKey(), null, new LinkedHashMap<>());
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, new PfConceptKey(), AutomationCompositionState.UNINITIALISED, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, new PfConceptKey(), AutomationCompositionState.UNINITIALISED,
+ new LinkedHashMap<>());
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), null, null, null);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), null, null, new LinkedHashMap<>());
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), null, AutomationCompositionState.UNINITIALISED, null);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), null, AutomationCompositionState.UNINITIALISED,
+ new LinkedHashMap<>());
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), new PfConceptKey(), null, null);
+ }).hasMessageMatching("state is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), new PfConceptKey(), null, new LinkedHashMap<>());
+ }).hasMessageMatching("state is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), new PfConceptKey(),
+ AutomationCompositionState.UNINITIALISED, null);
+ }).hasMessageMatching("elements is marked .*ull but is null");
+
+ assertNotNull(new JpaAutomationComposition());
+ assertNotNull(new JpaAutomationComposition((new PfConceptKey())));
+ assertNotNull(new JpaAutomationComposition(new PfConceptKey(), new PfConceptKey(),
+ AutomationCompositionState.UNINITIALISED, new LinkedHashMap<>()));
+ }
+
+ @Test
+ void testJpaAutomationComposition() {
+ JpaAutomationComposition testJpaAutomationComposition = createJpaAutomationCompositionInstance();
+
+ AutomationComposition participant = createAutomationCompositionInstance();
+ assertEquals(participant, testJpaAutomationComposition.toAuthorative());
+
+ assertThatThrownBy(() -> {
+ testJpaAutomationComposition.fromAuthorative(null);
+ }).hasMessageMatching("automationComposition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> new JpaAutomationComposition((JpaAutomationComposition) null))
+ .isInstanceOf(NullPointerException.class);
+
+ JpaAutomationComposition testJpaAutomationCompositionFa = new JpaAutomationComposition();
+ testJpaAutomationCompositionFa.setKey(null);
+ testJpaAutomationCompositionFa.fromAuthorative(participant);
+ assertEquals(testJpaAutomationComposition, testJpaAutomationCompositionFa);
+ testJpaAutomationCompositionFa.setKey(PfConceptKey.getNullKey());
+ testJpaAutomationCompositionFa.fromAuthorative(participant);
+ assertEquals(testJpaAutomationComposition, testJpaAutomationCompositionFa);
+ testJpaAutomationCompositionFa.setKey(new PfConceptKey("automation-composition", "0.0.1"));
+ testJpaAutomationCompositionFa.fromAuthorative(participant);
+ assertEquals(testJpaAutomationComposition, testJpaAutomationCompositionFa);
+
+ assertEquals("automation-composition", testJpaAutomationComposition.getKey().getName());
+ assertEquals("automation-composition",
+ new JpaAutomationComposition(createAutomationCompositionInstance()).getKey().getName());
+ assertEquals("automation-composition",
+ ((PfConceptKey) new JpaAutomationComposition(createAutomationCompositionInstance()).getKeys().get(0))
+ .getName());
+
+ testJpaAutomationComposition.clean();
+ assertEquals("automation-composition", testJpaAutomationComposition.getKey().getName());
+
+ testJpaAutomationComposition.setDescription(" A Message ");
+ testJpaAutomationComposition.clean();
+ assertEquals("A Message", testJpaAutomationComposition.getDescription());
+
+ JpaAutomationComposition testJpaAutomationComposition2 =
+ new JpaAutomationComposition(testJpaAutomationComposition);
+ assertEquals(testJpaAutomationComposition, testJpaAutomationComposition2);
+ }
+
+ @Test
+ void testJpaAutomationCompositionElementOrderedState() throws CoderException {
+ AutomationComposition testAutomationComposition = createAutomationCompositionInstance();
+ JpaAutomationComposition testJpaAutomationComposition = createJpaAutomationCompositionInstance();
+
+ testJpaAutomationComposition.setOrderedState(null);
+ assertEquals(testAutomationComposition, testJpaAutomationComposition.toAuthorative());
+ testJpaAutomationComposition.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+
+ AutomationComposition noOrderedStateAc = new StandardCoder().decode(
+ new File("src/test/resources/json/AutomationCompositionNoOrderedState.json"), AutomationComposition.class);
+
+ JpaAutomationComposition noOrderedStateJpaAc = new JpaAutomationComposition(noOrderedStateAc);
+ assertNull(noOrderedStateJpaAc.getOrderedState());
+ noOrderedStateAc.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ noOrderedStateJpaAc = new JpaAutomationComposition(noOrderedStateAc);
+ assertEquals(testJpaAutomationComposition, noOrderedStateJpaAc);
+
+ AutomationCompositions automationCompositionsWithElements = new StandardCoder().decode(
+ new File("src/test/resources/providers/TestAutomationCompositions.json"), AutomationCompositions.class);
+
+ JpaAutomationComposition jpaAutomationCompositionWithElements =
+ new JpaAutomationComposition(automationCompositionsWithElements.getAutomationCompositionList().get(0));
+ assertEquals(4, jpaAutomationCompositionWithElements.getElements().size());
+ assertEquals(18, jpaAutomationCompositionWithElements.getKeys().size());
+ assertThatCode(() -> jpaAutomationCompositionWithElements.clean()).doesNotThrowAnyException();
+
+ assertEquals(automationCompositionsWithElements.getAutomationCompositionList().get(0),
+ jpaAutomationCompositionWithElements.toAuthorative());
+ }
+
+ @Test
+ void testJpaAutomationCompositionValidation() {
+ JpaAutomationComposition testJpaAutomationComposition = createJpaAutomationCompositionInstance();
+
+ assertThatThrownBy(() -> {
+ testJpaAutomationComposition.validate(null);
+ }).hasMessageMatching("fieldName is marked .*ull but is null");
+
+ assertTrue(testJpaAutomationComposition.validate("").isValid());
+ }
+
+ @Test
+ void testJpaAutomationCompositionCompareTo() {
+ JpaAutomationComposition testJpaAutomationComposition = createJpaAutomationCompositionInstance();
+
+ JpaAutomationComposition otherJpaAutomationComposition =
+ new JpaAutomationComposition(testJpaAutomationComposition);
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ assertEquals(-1, testJpaAutomationComposition.compareTo(null));
+ assertEquals(0, testJpaAutomationComposition.compareTo(testJpaAutomationComposition));
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(new DummyJpaAutomationCompositionChild()));
+
+ testJpaAutomationComposition.setKey(new PfConceptKey("BadValue", "0.0.1"));
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setKey(new PfConceptKey("automation-composition", "0.0.1"));
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ testJpaAutomationComposition.setDefinition(new PfConceptKey("BadValue", "0.0.1"));
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setDefinition(new PfConceptKey("automationCompositionDefinitionName", "0.0.1"));
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ testJpaAutomationComposition.setState(AutomationCompositionState.PASSIVE);
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setState(AutomationCompositionState.UNINITIALISED);
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ testJpaAutomationComposition.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ testJpaAutomationComposition.setDescription("A description");
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setDescription(null);
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ testJpaAutomationComposition.setPrimed(true);
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setPrimed(false);
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ assertEquals(testJpaAutomationComposition, new JpaAutomationComposition(testJpaAutomationComposition));
+ }
+
+ @Test
+ void testJpaAutomationCompositionLombok() {
+ assertNotNull(new AutomationComposition());
+ JpaAutomationComposition ac0 = new JpaAutomationComposition();
+
+ assertThat(ac0.toString()).contains("JpaAutomationComposition(");
+ assertThat(ac0.hashCode()).isNotZero();
+ assertEquals(true, ac0.equals(ac0));
+ assertEquals(false, ac0.equals(null));
+
+ JpaAutomationComposition ac1 = new JpaAutomationComposition();
+
+ ac1.setDefinition(new PfConceptKey("defName", "0.0.1"));
+ ac1.setDescription("Description");
+ ac1.setElements(new LinkedHashMap<>());
+ ac1.setKey(new PfConceptKey("participant", "0.0.1"));
+ ac1.setState(AutomationCompositionState.UNINITIALISED);
+
+ assertThat(ac1.toString()).contains("AutomationComposition(");
+ assertEquals(false, ac1.hashCode() == 0);
+ assertEquals(false, ac1.equals(ac0));
+ assertEquals(false, ac1.equals(null));
+
+ assertNotEquals(ac1, ac0);
+
+ JpaAutomationComposition ac2 = new JpaAutomationComposition();
+ assertEquals(ac2, ac0);
+ }
+
+ private JpaAutomationComposition createJpaAutomationCompositionInstance() {
+ AutomationComposition testAutomationComposition = createAutomationCompositionInstance();
+ JpaAutomationComposition testJpaAutomationComposition = new JpaAutomationComposition();
+ testJpaAutomationComposition.setKey(null);
+ testJpaAutomationComposition.fromAuthorative(testAutomationComposition);
+ testJpaAutomationComposition.setKey(PfConceptKey.getNullKey());
+ testJpaAutomationComposition.fromAuthorative(testAutomationComposition);
+
+ return testJpaAutomationComposition;
+ }
+
+ private AutomationComposition createAutomationCompositionInstance() {
+ AutomationComposition testAutomationComposition = new AutomationComposition();
+ testAutomationComposition.setName("automation-composition");
+ testAutomationComposition.setVersion("0.0.1");
+ testAutomationComposition
+ .setDefinition(new ToscaConceptIdentifier("automationCompositionDefinitionName", "0.0.1"));
+ testAutomationComposition.setElements(new LinkedHashMap<>());
+
+ return testAutomationComposition;
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatisticsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatisticsTest.java
index aff365515..284d13374 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatisticsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatisticsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -29,10 +29,10 @@ import static org.junit.Assert.assertTrue;
import java.time.Instant;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfTimestampKey;
@@ -76,8 +76,8 @@ class JpaParticipantStatisticsTest {
void testJpaParticipantStatistics() {
JpaParticipantStatistics testJpaParticipantStatistics = createJpaParticipantStatisticsInstance();
- ParticipantStatistics cles = createParticipantStatisticsInstance();
- assertEquals(cles, testJpaParticipantStatistics.toAuthorative());
+ ParticipantStatistics aces = createParticipantStatisticsInstance();
+ assertEquals(aces, testJpaParticipantStatistics.toAuthorative());
assertThatThrownBy(() -> {
testJpaParticipantStatistics.fromAuthorative(null);
@@ -88,17 +88,17 @@ class JpaParticipantStatisticsTest {
JpaParticipantStatistics testJpaParticipantStatisticsFa = new JpaParticipantStatistics();
testJpaParticipantStatisticsFa.setKey(null);
- testJpaParticipantStatisticsFa.fromAuthorative(cles);
+ testJpaParticipantStatisticsFa.fromAuthorative(aces);
assertEquals(testJpaParticipantStatistics, testJpaParticipantStatisticsFa);
testJpaParticipantStatisticsFa.setKey(PfTimestampKey.getNullKey());
- testJpaParticipantStatisticsFa.fromAuthorative(cles);
+ testJpaParticipantStatisticsFa.fromAuthorative(aces);
assertEquals(testJpaParticipantStatistics, testJpaParticipantStatisticsFa);
testJpaParticipantStatisticsFa
.setKey(new PfTimestampKey("participantName", "0.0.1", Instant.ofEpochMilli(123456L)));
- testJpaParticipantStatisticsFa.fromAuthorative(cles);
+ testJpaParticipantStatisticsFa.fromAuthorative(aces);
assertEquals(testJpaParticipantStatistics, testJpaParticipantStatisticsFa);
- testJpaParticipantStatisticsFa = new JpaParticipantStatistics(cles);
+ testJpaParticipantStatisticsFa = new JpaParticipantStatistics(aces);
assertEquals(testJpaParticipantStatistics, testJpaParticipantStatisticsFa);
assertEquals(2, testJpaParticipantStatistics.getKeys().size());
@@ -171,12 +171,12 @@ class JpaParticipantStatisticsTest {
}
private JpaParticipantStatistics createJpaParticipantStatisticsInstance() {
- ParticipantStatistics testCles = createParticipantStatisticsInstance();
+ ParticipantStatistics testAces = createParticipantStatisticsInstance();
JpaParticipantStatistics testJpaParticipantStatistics = new JpaParticipantStatistics();
testJpaParticipantStatistics.setKey(null);
- testJpaParticipantStatistics.fromAuthorative(testCles);
+ testJpaParticipantStatistics.fromAuthorative(testAces);
testJpaParticipantStatistics.setKey(PfTimestampKey.getNullKey());
- testJpaParticipantStatistics.fromAuthorative(testCles);
+ testJpaParticipantStatistics.fromAuthorative(testAces);
return testJpaParticipantStatistics;
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java
index 087292354..776aafa2e 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -28,9 +28,9 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/PojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/PojosTest.java
index c877f9696..1f40fae5f 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/PojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/PojosTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProviderTest.java
new file mode 100644
index 000000000..15d1d845d
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProviderTest.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.provider;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.time.Instant;
+import java.util.List;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAcElementStatistics;
+import org.onap.policy.clamp.models.acm.persistence.repository.AcElementStatisticsRepository;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+class AcElementStatisticsProviderTest {
+ private static final String LIST_IS_NULL = ".*. is marked .*ull but is null";
+ private static final Coder CODER = new StandardCoder();
+ private static final String AC_ELEMENT_STATS_JSON = "src/test/resources/providers/TestAcElementStatistics.json";
+
+ private AcElementStatisticsProvider acElementStatisticsProvider;
+ private AcElementStatisticsList inputAcElementStats;
+ private String originalJson = ResourceUtils.getResourceAsString(AC_ELEMENT_STATS_JSON);
+
+ /**
+ * Set up test AcElement statistics provider.
+ *
+ * @throws Exception on errors
+ */
+ @BeforeEach
+ void beforeSetupDao() throws Exception {
+
+ inputAcElementStats = CODER.decode(originalJson, AcElementStatisticsList.class);
+ var acElementStatisticsRepository = mock(AcElementStatisticsRepository.class);
+
+ var jpaAcElementStatisticsList =
+ ProviderUtils.getJpaAndValidateList(inputAcElementStats.getAcElementStatistics(),
+ JpaAcElementStatistics::new, "automation composition element statistics");
+
+ for (var acElementStat : jpaAcElementStatisticsList) {
+ when(acElementStatisticsRepository.getById(eq(acElementStat.getKey()))).thenReturn(acElementStat);
+ when(acElementStatisticsRepository.findAllById(eq(List.of(acElementStat.getKey()))))
+ .thenReturn(List.of(acElementStat));
+ }
+
+ when(acElementStatisticsRepository.saveAll(anyList())).thenReturn(jpaAcElementStatisticsList);
+
+ when(acElementStatisticsRepository.getFiltered(eq(JpaAcElementStatistics.class), any()))
+ .thenReturn(List.of(jpaAcElementStatisticsList.get(0)));
+
+ acElementStatisticsProvider = new AcElementStatisticsProvider(acElementStatisticsRepository);
+ }
+
+ @Test
+ void testAcElementStatisticsCreate() throws Exception {
+ assertThatThrownBy(() -> {
+ acElementStatisticsProvider.createAcElementStatistics(null);
+ }).hasMessageMatching(LIST_IS_NULL);
+
+ AcElementStatisticsList createdAcElementStats = new AcElementStatisticsList();
+ createdAcElementStats.setAcElementStatistics(
+ acElementStatisticsProvider.createAcElementStatistics(inputAcElementStats.getAcElementStatistics()));
+
+ assertEquals(inputAcElementStats.toString().replaceAll("\\s+", ""),
+ createdAcElementStats.toString().replaceAll("\\s+", ""));
+ }
+
+ @Test
+ void testGetAcElementStatistics() throws Exception {
+
+ List<AcElementStatistics> getResponse;
+
+ // Return empty list when no data present in db
+ getResponse = acElementStatisticsProvider.getAcElementStatistics(null, null, null, null);
+ assertThat(getResponse).isEmpty();
+
+ acElementStatisticsProvider.createAcElementStatistics(inputAcElementStats.getAcElementStatistics());
+ ToscaConceptIdentifier identifier = inputAcElementStats.getAcElementStatistics().get(0).getParticipantId();
+ Instant instant = inputAcElementStats.getAcElementStatistics().get(0).getTimeStamp();
+ String id = inputAcElementStats.getAcElementStatistics().get(0).getId().toString();
+ assertEquals(1, acElementStatisticsProvider
+ .getAcElementStatistics(identifier.getName(), identifier.getVersion(), id, instant).size());
+
+ assertEquals(1, acElementStatisticsProvider
+ .getFilteredAcElementStatistics("name2", "1.0.1", null, null, null, "DESC", 1).size());
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java
new file mode 100644
index 000000000..0a367eed8
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java
@@ -0,0 +1,305 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.provider;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+import java.util.Optional;
+import javax.persistence.EntityNotFoundException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
+import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaNodeTemplateRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaNodeTemplatesRepository;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.coder.YamlJsonTranslator;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
+
+class AutomationCompositionProviderTest {
+
+ private static final String LIST_IS_NULL = "automationCompositions is marked .*ull but is null";
+ private static final String OBJECT_IS_NULL = "automationComposition is marked non-null but is null";
+
+ private static final String ID_NAME = "PMSHInstance1";
+ private static final String ID_VERSION = "1.0.1";
+ private static final String ID_NAME_NOT_EXTST = "not_exist";
+ private static final String ID_NAME_NOT_VALID = "not_valid";
+
+ private static final Coder CODER = new StandardCoder();
+ private static final String AUTOMATION_COMPOSITION_JSON =
+ "src/test/resources/providers/TestAutomationCompositions.json";
+ private static final String TOSCA_TEMPLATE_YAML = "examples/acm/PMSubscriptionHandling.yaml";
+
+ private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
+
+ private AutomationCompositions inputAutomationCompositions;
+ private List<JpaAutomationComposition> inputAutomationCompositionsJpa;
+ private String originalJson = ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON);
+
+ @BeforeEach
+ void beforeSetupDao() throws Exception {
+ inputAutomationCompositions = CODER.decode(originalJson, AutomationCompositions.class);
+ inputAutomationCompositionsJpa =
+ ProviderUtils.getJpaAndValidateList(inputAutomationCompositions.getAutomationCompositionList(),
+ JpaAutomationComposition::new, "automation compositions");
+ }
+
+ @Test
+ void testAutomationCompositionsSave() throws Exception {
+ var automationCompositionRepository = mock(AutomationCompositionRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository,
+ mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider.saveAutomationCompositions(null);
+ }).hasMessageMatching(LIST_IS_NULL);
+
+ when(automationCompositionRepository.saveAll(inputAutomationCompositionsJpa))
+ .thenReturn(inputAutomationCompositionsJpa);
+
+ var createdAutomationCompositions = new AutomationCompositions();
+ createdAutomationCompositions.setAutomationCompositionList(automationCompositionProvider
+ .saveAutomationCompositions(inputAutomationCompositions.getAutomationCompositionList()));
+
+ assertEquals(inputAutomationCompositions, createdAutomationCompositions);
+
+ when(automationCompositionRepository.saveAll(any())).thenThrow(IllegalArgumentException.class);
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider
+ .saveAutomationCompositions(inputAutomationCompositions.getAutomationCompositionList());
+ }).hasMessageMatching("Error in save AutomationCompositions");
+ }
+
+ @Test
+ void testAutomationCompositionSave() throws Exception {
+ var automationCompositionRepository = mock(AutomationCompositionRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository,
+ mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider.saveAutomationComposition(null);
+ }).hasMessageMatching(OBJECT_IS_NULL);
+
+ when(automationCompositionRepository.save(inputAutomationCompositionsJpa.get(0)))
+ .thenReturn(inputAutomationCompositionsJpa.get(0));
+
+ var createdAutomationComposition = automationCompositionProvider
+ .saveAutomationComposition(inputAutomationCompositions.getAutomationCompositionList().get(0));
+
+ assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(0), createdAutomationComposition);
+
+ when(automationCompositionRepository.save(any())).thenThrow(IllegalArgumentException.class);
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider
+ .saveAutomationComposition(inputAutomationCompositions.getAutomationCompositionList().get(0));
+ }).hasMessageMatching("Error in save automationComposition");
+ }
+
+ @Test
+ void testGetAutomationCompositions() throws Exception {
+ var automationCompositionRepository = mock(AutomationCompositionRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository,
+ mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
+
+ // Return empty list when no data present in db
+ List<AutomationComposition> getResponse = automationCompositionProvider.getAutomationCompositions();
+ assertThat(getResponse).isEmpty();
+
+ automationCompositionProvider
+ .saveAutomationCompositions(inputAutomationCompositions.getAutomationCompositionList());
+
+ var automationComposition0 = inputAutomationCompositions.getAutomationCompositionList().get(1);
+ var name = automationComposition0.getName();
+ var version = automationComposition0.getVersion();
+ var automationComposition1 = inputAutomationCompositions.getAutomationCompositionList().get(1);
+
+ when(automationCompositionRepository.getFiltered(eq(JpaAutomationComposition.class), any(), any()))
+ .thenReturn(List.of(new JpaAutomationComposition(automationComposition0),
+ new JpaAutomationComposition(automationComposition1)));
+ when(automationCompositionRepository.findById(automationComposition0.getKey().asIdentifier().asConceptKey()))
+ .thenReturn(Optional.of(new JpaAutomationComposition(automationComposition0)));
+ when(automationCompositionRepository.getById(automationComposition0.getKey().asIdentifier().asConceptKey()))
+ .thenReturn(new JpaAutomationComposition(automationComposition0));
+ when(automationCompositionRepository.getFiltered(JpaAutomationComposition.class, name, version))
+ .thenReturn(List.of(new JpaAutomationComposition(automationComposition0)));
+ when(automationCompositionRepository.findById(automationComposition1.getKey().asIdentifier().asConceptKey()))
+ .thenReturn(Optional.of(new JpaAutomationComposition(automationComposition1)));
+
+ assertEquals(1, automationCompositionProvider.getAutomationCompositions(name, version).size());
+
+ var ac = automationCompositionProvider
+ .findAutomationComposition(new ToscaConceptIdentifier(ID_NAME, ID_VERSION)).get();
+ assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(1), ac);
+
+ ac = automationCompositionProvider.getAutomationComposition(new ToscaConceptIdentifier(ID_NAME, ID_VERSION));
+ assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(1), ac);
+
+ when(automationCompositionRepository.getById(any())).thenThrow(EntityNotFoundException.class);
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider
+ .getAutomationComposition(new ToscaConceptIdentifier(ID_NAME_NOT_EXTST, ID_VERSION));
+ }).hasMessageMatching("AutomationComposition not found");
+
+ ac = automationCompositionProvider.findAutomationComposition(ID_NAME, ID_VERSION).get();
+ assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(1), ac);
+
+ assertThat(automationCompositionProvider
+ .findAutomationComposition(new ToscaConceptIdentifier(ID_NAME_NOT_EXTST, ID_VERSION))).isEmpty();
+
+ when(automationCompositionRepository.findById(any())).thenThrow(IllegalArgumentException.class);
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider.findAutomationComposition(ID_NAME_NOT_VALID, ID_VERSION);
+ }).hasMessageMatching("Not valid parameter");
+ }
+
+ @Test
+ void testDeleteAutomationComposition() throws Exception {
+ var automationCompositionRepository = mock(AutomationCompositionRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository,
+ mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider.deleteAutomationComposition(ID_NAME_NOT_EXTST, ID_VERSION);
+ }).hasMessageMatching(".*.failed, automation composition does not exist");
+
+ var automationComposition = inputAutomationCompositions.getAutomationCompositionList().get(0);
+ var name = automationComposition.getName();
+ var version = automationComposition.getVersion();
+
+ when(automationCompositionRepository.findById(new PfConceptKey(name, version)))
+ .thenReturn(Optional.of(inputAutomationCompositionsJpa.get(0)));
+
+ AutomationComposition deletedAc = automationCompositionProvider.deleteAutomationComposition(name, version);
+ assertEquals(automationComposition, deletedAc);
+ }
+
+ @Test
+ void testDeleteAllInstanceProperties() throws Exception {
+ var automationCompositionProvider =
+ new AutomationCompositionProvider(mock(AutomationCompositionRepository.class),
+ mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
+ var toscaServiceTemplate = testAutomationCompositionRead();
+ automationCompositionProvider.deleteInstanceProperties(
+ automationCompositionProvider.saveInstanceProperties(toscaServiceTemplate),
+ automationCompositionProvider.getAllNodeTemplates());
+ assertThat(automationCompositionProvider.getAutomationCompositions()).isEmpty();
+ }
+
+ @Test
+ void testSaveAndDeleteInstanceProperties() throws Exception {
+ var toscaNodeTemplatesRepository = mock(ToscaNodeTemplatesRepository.class);
+ var toscaNodeTemplateRepository = mock(ToscaNodeTemplateRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(
+ mock(AutomationCompositionRepository.class), toscaNodeTemplateRepository, toscaNodeTemplatesRepository);
+ var toscaServiceTest = testAutomationCompositionRead();
+
+ automationCompositionProvider.saveInstanceProperties(toscaServiceTest);
+ verify(toscaNodeTemplatesRepository).save(any());
+
+ var name = "org.onap.policy.acm.PolicyAutomationCompositionParticipant";
+ var version = "2.3.1";
+ var elem = toscaServiceTest.getToscaTopologyTemplate().getNodeTemplates().get(name);
+ when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, name, version))
+ .thenReturn(List.of(new JpaToscaNodeTemplate(elem)));
+
+ var filtered = automationCompositionProvider.getNodeTemplates(name, version);
+ verify(toscaNodeTemplateRepository).getFiltered(JpaToscaNodeTemplate.class, name, version);
+
+ automationCompositionProvider
+ .deleteInstanceProperties(automationCompositionProvider.saveInstanceProperties(toscaServiceTest), filtered);
+
+ verify(toscaNodeTemplateRepository).delete(any());
+ }
+
+ @Test
+ void testGetNodeTemplates() throws Exception {
+ var toscaNodeTemplateRepository = mock(ToscaNodeTemplateRepository.class);
+ var automationCompositionProvider =
+ new AutomationCompositionProvider(mock(AutomationCompositionRepository.class), toscaNodeTemplateRepository,
+ mock(ToscaNodeTemplatesRepository.class));
+
+ var toscaNodeTemplate0 = new JpaToscaNodeTemplate(new PfConceptKey(ID_NAME, ID_VERSION));
+ var toscaNodeTemplate1 = new JpaToscaNodeTemplate(new PfConceptKey("PMSHInstance2", ID_VERSION));
+
+ when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, null, null))
+ .thenReturn(List.of(toscaNodeTemplate0, toscaNodeTemplate1));
+ when(toscaNodeTemplateRepository.findAll()).thenReturn(List.of(toscaNodeTemplate0, toscaNodeTemplate1));
+ when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, ID_NAME, ID_VERSION))
+ .thenReturn(List.of(toscaNodeTemplate0));
+
+ // Getting all nodes
+ var listNodes = automationCompositionProvider.getAllNodeTemplates();
+ assertNotNull(listNodes);
+ assertThat(listNodes).hasSize(2);
+
+ listNodes = automationCompositionProvider.getNodeTemplates(ID_NAME, ID_VERSION);
+ assertNotNull(listNodes);
+ assertThat(listNodes).hasSize(1);
+
+ listNodes = automationCompositionProvider.getAllNodeTemplates();
+ assertNotNull(listNodes);
+ assertThat(listNodes).hasSize(2);
+
+ var nodeTemplateFilter =
+ ToscaTypedEntityFilter.<ToscaNodeTemplate>builder().name(ID_NAME).version(ID_VERSION).build();
+
+ listNodes = automationCompositionProvider.getFilteredNodeTemplates(nodeTemplateFilter);
+ assertNotNull(listNodes);
+ assertThat(listNodes).hasSize(1);
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider.getFilteredNodeTemplates(null);
+ }).hasMessageMatching("filter is marked non-null but is null");
+ }
+
+ private static ToscaServiceTemplate testAutomationCompositionRead() {
+ return testAutomationCompositionYamlSerialization(TOSCA_TEMPLATE_YAML);
+ }
+
+ private static ToscaServiceTemplate testAutomationCompositionYamlSerialization(
+ String automationCompositionFilePath) {
+ var automationCompositionString = ResourceUtils.getResourceAsString(automationCompositionFilePath);
+ return yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class);
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
index 9b48735f6..f537e2cd7 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -33,9 +33,9 @@ import java.util.List;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipant;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ParticipantRepository;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant;
+import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantRepository;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -84,7 +84,7 @@ class ParticipantProviderTest {
}
@Test
- void testGetControlLoops() throws Exception {
+ void testGetAutomationCompositions() throws Exception {
var participantRepository = mock(ParticipantRepository.class);
var participantProvider = new ParticipantProvider(participantRepository);
@@ -119,7 +119,7 @@ class ParticipantProviderTest {
.thenReturn(jpaParticipantList);
final ToscaTypedEntityFilter<Participant> filter = ToscaTypedEntityFilter.<Participant>builder()
- .type("org.onap.domain.pmsh.PMSHControlLoopDefinition").build();
+ .type("org.onap.domain.pmsh.PMSHAutomationCompositionDefinition").build();
assertEquals(1, participantProvider.getFilteredParticipants(filter).size());
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProviderTest.java
index 16f4958a9..3c6b1eb83 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProviderTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -33,10 +33,10 @@ import java.time.Instant;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ParticipantStatisticsRepository;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatisticsList;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipantStatistics;
+import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantStatisticsRepository;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -89,7 +89,7 @@ class ParticipantStatisticsProviderTest {
}
@Test
- void testGetControlLoops() throws Exception {
+ void testGetAutomationCompositions() throws Exception {
// Return empty list when no data present in db
List<ParticipantStatistics> getResponse =
participantStatisticsProvider.getParticipantStatistics(null, null, null);
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProviderTest.java
index 523a4fb88..4d998717e 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProviderTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -32,7 +32,7 @@ import java.util.List;
import java.util.Optional;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaServiceTemplateRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaServiceTemplateRepository;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardYamlCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -117,7 +117,7 @@ class ServiceTemplateProviderTest {
var serviceTemplateProvider = new ServiceTemplateProvider(serviceTemplateRepository);
assertThatThrownBy(() -> serviceTemplateProvider.getToscaServiceTemplate("Name", "1.0.0"))
- .hasMessage("Control Loop definitions not found");
+ .hasMessage("Automation composition definitions not found");
}
@Test
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImplTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImplTest.java
index 8b5357457..7210a6afd 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImplTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImplTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import static org.assertj.core.api.Assertions.assertThat;
@@ -26,9 +26,9 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ProviderUtils;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
+import org.onap.policy.clamp.models.acm.persistence.provider.ProviderUtils;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -38,11 +38,12 @@ import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.provider.impl.ModelsProvider;
class FilterRepositoryImplTest {
- private static final String CONTROL_LOOP_JSON = "src/test/resources/providers/TestControlLoops.json";
+ private static final String AUTOMATION_COMPOSITION_JSON =
+ "src/test/resources/providers/TestAutomationCompositions.json";
private static final Coder CODER = new StandardCoder();
private static final AtomicInteger dbNameCounter = new AtomicInteger();
- private static final String originalJson = ResourceUtils.getResourceAsString(CONTROL_LOOP_JSON);
- private static List<JpaControlLoop> jpaControlLoops;
+ private static final String originalJson = ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON);
+ private static List<JpaAutomationComposition> jpaAutomationCompositions;
private PfDao pfDao;
@BeforeEach
@@ -51,17 +52,18 @@ class FilterRepositoryImplTest {
parameters.setDatabaseDriver("org.h2.Driver");
parameters.setName("PolicyProviderParameterGroup");
parameters.setImplementation("org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl");
- parameters.setDatabaseUrl("jdbc:h2:mem:controlLoopProviderTestDb" + dbNameCounter.getAndDecrement());
+ parameters.setDatabaseUrl("jdbc:h2:mem:automationCompositionProviderTestDb" + dbNameCounter.getAndDecrement());
parameters.setDatabaseUser("policy");
parameters.setDatabasePassword("P01icY");
parameters.setPersistenceUnit("ToscaConceptTest");
pfDao = ModelsProvider.init(parameters);
- var inputControlLoops = CODER.decode(originalJson, ControlLoops.class);
- jpaControlLoops = ProviderUtils.getJpaAndValidateList(inputControlLoops.getControlLoopList(),
- JpaControlLoop::new, "ControlLoops");
+ var inputAutomationCompositions = CODER.decode(originalJson, AutomationCompositions.class);
+ jpaAutomationCompositions =
+ ProviderUtils.getJpaAndValidateList(inputAutomationCompositions.getAutomationCompositionList(),
+ JpaAutomationComposition::new, "AutomationCompositions");
- pfDao.createCollection(jpaControlLoops);
+ pfDao.createCollection(jpaAutomationCompositions);
}
@Test
@@ -77,10 +79,11 @@ class FilterRepositoryImplTest {
return pfDao;
}
};
- var result = filterRepositoryImpl.getFiltered(JpaControlLoop.class, null, null);
+ var result = filterRepositoryImpl.getFiltered(JpaAutomationComposition.class, null, null);
assertThat(result).hasSize(2);
- result = filterRepositoryImpl.getFiltered(JpaControlLoop.class, jpaControlLoops.get(0).getName(), null);
+ result = filterRepositoryImpl.getFiltered(JpaAutomationComposition.class,
+ jpaAutomationCompositions.get(0).getName(), null);
assertThat(result).hasSize(1);
}
@@ -96,11 +99,11 @@ class FilterRepositoryImplTest {
// @formatter:off
PfFilterParameters filterParams = PfFilterParameters
.builder()
- .name(jpaControlLoops.get(0).getName())
+ .name(jpaAutomationCompositions.get(0).getName())
.build();
// @formatter:on
- var result = filterRepositoryImpl.getFiltered(JpaControlLoop.class, filterParams);
+ var result = filterRepositoryImpl.getFiltered(JpaAutomationComposition.class, filterParams);
assertThat(result).hasSize(1);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/rest/RestUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/rest/RestUtilsTest.java
index 4dedae200..a62f78ba2 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/rest/RestUtilsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/rest/RestUtilsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.rest;
+package org.onap.policy.clamp.models.acm.rest;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/common/src/test/java/org/onap/policy/clamp/controlloop/common/utils/CommonUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
index 52e86cf61..a5434240a 100644
--- a/common/src/test/java/org/onap/policy/clamp/controlloop/common/utils/CommonUtilsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.common.utils;
+package org.onap.policy.clamp.models.acm.utils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
@@ -29,10 +29,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
@@ -41,37 +41,37 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
-class CommonUtilsTest {
+class AcmUtilsTest {
private ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.0.0");
- private ToscaConceptIdentifier idNode = new ToscaConceptIdentifier(
- "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", "0.0.0");
+ private ToscaConceptIdentifier idNode =
+ new ToscaConceptIdentifier("org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", "0.0.0");
@Test
void testCommonUtilsParticipantUpdate() {
- var clElement = new ControlLoopElement();
+ var acElement = new AutomationCompositionElement();
List<ParticipantUpdates> participantUpdates = new ArrayList<>();
assertThat(participantUpdates).isEmpty();
- CommonUtils.prepareParticipantUpdate(clElement, participantUpdates);
+ AcmUtils.prepareParticipantUpdate(acElement, participantUpdates);
assertThat(participantUpdates).isNotEmpty();
- assertEquals(clElement, participantUpdates.get(0).getControlLoopElementList().get(0));
+ assertEquals(acElement, participantUpdates.get(0).getAutomationCompositionElementList().get(0));
- CommonUtils.prepareParticipantUpdate(clElement, participantUpdates);
+ AcmUtils.prepareParticipantUpdate(acElement, participantUpdates);
assertNotEquals(id, participantUpdates.get(0).getParticipantId());
- clElement.setParticipantId(id);
- clElement.setParticipantType(id);
- CommonUtils.prepareParticipantUpdate(clElement, participantUpdates);
+ acElement.setParticipantId(id);
+ acElement.setParticipantType(id);
+ AcmUtils.prepareParticipantUpdate(acElement, participantUpdates);
assertEquals(id, participantUpdates.get(1).getParticipantId());
}
@Test
void testCommonUtilsServiceTemplate() {
- var clElement = new ControlLoopElement();
+ var acElement = new AutomationCompositionElement();
var toscaServiceTemplate = getDummyToscaServiceTemplate();
- CommonUtils.setServiceTemplatePolicyInfo(clElement, toscaServiceTemplate);
- assertEquals(getDummyToscaDataTypeMap(), clElement.getToscaServiceTemplateFragment().getDataTypes());
+ AcmUtils.setServiceTemplatePolicyInfo(acElement, toscaServiceTemplate);
+ assertEquals(getDummyToscaDataTypeMap(), acElement.getToscaServiceTemplateFragment().getDataTypes());
}
@Test
@@ -85,9 +85,8 @@ class CommonUtilsTest {
assertEquals(id, participantDefinitionUpdates.get(0).getParticipantType());
checkParticipantDefinitionUpdate(toscaServiceTemplate, participantDefinitionUpdates);
- assertEquals(idNode, participantDefinitionUpdates.get(0)
- .getControlLoopElementDefinitionList().get(0)
- .getClElementDefinitionId());
+ assertEquals(idNode, participantDefinitionUpdates.get(0).getAutomationCompositionElementDefinitionList().get(0)
+ .getAcElementDefinitionId());
}
private ToscaServiceTemplate getDummyToscaServiceTemplate() {
@@ -130,21 +129,20 @@ class CommonUtilsTest {
private Map<String, ToscaNodeTemplate> getDummyNodeTemplates() {
Map<String, ToscaNodeTemplate> nodeTemplates = new HashMap<>();
var nodeTemplate = new ToscaNodeTemplate();
- nodeTemplate.setType("org.onap.policy.clamp.controlloop.ControlLoopElement");
- nodeTemplates.put("org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", nodeTemplate);
+ nodeTemplate.setType("org.onap.policy.clamp.acm.AutomationCompositionElement");
+ nodeTemplates.put("org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", nodeTemplate);
return nodeTemplates;
}
- private void checkParticipantDefinitionUpdate(
- ToscaServiceTemplate toscaServiceTemplate,
- List<ParticipantDefinition> participantDefinitionUpdates) {
+ private void checkParticipantDefinitionUpdate(ToscaServiceTemplate toscaServiceTemplate,
+ List<ParticipantDefinition> participantDefinitionUpdates) {
for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate()
- .getNodeTemplates().entrySet()) {
- if (ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(),
- toscaServiceTemplate)) {
- CommonUtils.prepareParticipantDefinitionUpdate(id, toscaInputEntry.getKey(),
- toscaInputEntry.getValue(), participantDefinitionUpdates, null);
+ .getNodeTemplates().entrySet()) {
+ if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(),
+ toscaServiceTemplate)) {
+ AcmUtils.prepareParticipantDefinitionUpdate(id, toscaInputEntry.getKey(), toscaInputEntry.getValue(),
+ participantDefinitionUpdates, null);
}
}
}
diff --git a/models/src/test/resources/META-INF/persistence.xml b/models/src/test/resources/META-INF/persistence.xml
index 54495a2fe..9bd136229 100644
--- a/models/src/test/resources/META-INF/persistence.xml
+++ b/models/src/test/resources/META-INF/persistence.xml
@@ -52,11 +52,11 @@
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTrigger</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoopElement</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipant</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipantStatistics</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics</class>
+ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition</class>
+ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationCompositionElement</class>
+ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant</class>
+ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipantStatistics</class>
+ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaClElementStatistics</class>
<properties>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
diff --git a/models/src/test/resources/examples/controlloop/PMSubscriptionHandling.yaml b/models/src/test/resources/examples/acm/PMSubscriptionHandling.yaml
index 8e8f3cd39..c8796ac49 100644
--- a/models/src/test/resources/examples/controlloop/PMSubscriptionHandling.yaml
+++ b/models/src/test/resources/examples/acm/PMSubscriptionHandling.yaml
@@ -26,8 +26,8 @@ data_types:
version:
type: string
required: true
- org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo:
- name: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo
+ org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElementConsulInfo:
+ name: org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElementConsulInfo
version: 0.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -303,14 +303,14 @@ policy_types:
derived_from: onap.policies.Monitoring
metadata: {}
node_types:
- org.onap.policy.clamp.controlloop.Participant:
+ org.onap.policy.clamp.acm.Participant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
required: false
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -327,11 +327,11 @@ node_types:
- 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:
+ description: A value indicating the start phase in which this automation composition element will be started,
+ the first start phase is zero. Automation composition elements are started in their start_phase
+ order and stopped in reverse start phase order. Automation composition elements with the same start
+ phase are started and stopped simultaneously
+ org.onap.policy.clamp.acm.AutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -343,9 +343,9 @@ node_types:
required: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:
+ org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
dcae_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -357,10 +357,10 @@ node_types:
type: list
required: false
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo
- org.onap.policy.clamp.controlloop.PolicyControlLoopElement:
+ type: org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElementConsulInfo
+ org.onap.policy.clamp.acm.PolicyAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
policy_type_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -368,9 +368,9 @@ node_types:
policy_id:
type: onap.datatypes.ToscaConceptIdentifier
required: false
- org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ org.onap.policy.clamp.acm.CDSAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
cds_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -390,36 +390,36 @@ topology_template:
name: operational.apex.pmcontrol
version: 1.0.0
node_templates:
- org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:
+ org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.policy.controlloop.PolicyControlLoopParticipant:
+ org.onap.policy.acm.PolicyAutomationCompositionParticipant:
version: 2.3.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant:
+ org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant:
version: 2.2.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.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: org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ description: Automation composition element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ name: org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant
version: 2.3.4
dcae_blueprint:
tosca_definitions_version: cloudify_dsl_1_3
@@ -635,64 +635,64 @@ topology_template:
managedObjectDNsBasic:
- DN: dnc
- DN: dnd
- org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ description: Automation composition element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.3.1
policy_type_id:
name: onap.policies.monitoring.pm-subscription-handler
version: 1.0.0
policy_id:
get_input: pmsh_monitoring_policy
- org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the operational policy for Performance Management Subscription Handling
+ description: Automation composition element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.2.1
policy_type_id:
name: onap.policies.operational.pm-subscription-handler
version: 1.0.0
policy_id:
get_input: pmsh_operational_policy
- org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement:
+ org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.CDSControlLoopElement
+ type: org.onap.policy.clamp.acm.CDSAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for CDS for Performance Management Subscription Handling
+ description: Automation composition element for CDS for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
+ name: org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant
version: 3.2.1
cds_blueprint_id:
name: org.onap.ccsdk.cds.PMSHCdsBlueprint
version: 1.0.0
- org.onap.domain.pmsh.PMSHControlLoopDefinition:
+ org.onap.domain.pmsh.PMSHAutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acm.AutomationComposition
type_version: 1.0.0
- description: Control loop for Performance Management Subscription Handling
+ description: Automation composition 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
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement
version: 1.2.3
policies:
- MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test:
@@ -753,7 +753,7 @@ topology_template:
onap.datatypes.monitoring.managedObjectDNsBasic:
DN: dnd
- operational.apex.pmcontrol:
- type: onap.policies.controlloop.operational.common.Apex
+ type: onap.policies.acm.operational.common.Apex
type_version: 1.0.0
version: 1.0.0
metadata:
@@ -3212,7 +3212,7 @@ topology_template:
jsonAdapters:
Instant:
adaptedClass: java.time.Instant
- adaptorClass: org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter
+ adaptorClass: org.onap.policy.acm.util.Serialization$GsonInstantAdapter
eventInputParameters:
DCAEConsumer:
carrierTechnologyParameters:
diff --git a/models/src/test/resources/json/ControlLoopElementNoOrderedState.json b/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json
index 33a63e604..872499abf 100644
--- a/models/src/test/resources/json/ControlLoopElementNoOrderedState.json
+++ b/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json
@@ -1,7 +1,7 @@
{
"id": "a95757ba-b34a-4049-a2a8-46773abcbe5e",
"definition": {
- "name": "cleDef",
+ "name": "aceDef",
"version": "0.0.1"
},
"participantType": {
diff --git a/models/src/test/resources/json/ControlLoopNoOrderedState.json b/models/src/test/resources/json/AutomationCompositionNoOrderedState.json
index 6bff97580..d61a61117 100644
--- a/models/src/test/resources/json/ControlLoopNoOrderedState.json
+++ b/models/src/test/resources/json/AutomationCompositionNoOrderedState.json
@@ -1,12 +1,12 @@
{
"definition": {
- "name": "controlLoopDefinitionName",
+ "name": "automationCompositionDefinitionName",
"version": "0.0.1"
},
"state": "UNINITIALISED",
"orderedState": null,
"elements": [
],
- "name": "control-loop",
+ "name": "automation-composition",
"version": "0.0.1"
}
diff --git a/models/src/test/resources/providers/TestClElementStatistics.json b/models/src/test/resources/providers/TestAcElementStatistics.json
index ae19e560d..cceb91d14 100644
--- a/models/src/test/resources/providers/TestClElementStatistics.json
+++ b/models/src/test/resources/providers/TestAcElementStatistics.json
@@ -1,5 +1,5 @@
{
- "clElementStatistics":[
+ "acElementStatistics":[
{
"participantId":{
"name":"name1",
@@ -7,8 +7,8 @@
},
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
"timeStamp": "2021-01-10T13:45:00.000Z",
- "controlLoopState": "UNINITIALISED",
- "clElementUptime":250
+ "state": "UNINITIALISED",
+ "acElementUptime":250
},
{
"participantId":{
@@ -17,8 +17,8 @@
},
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"timeStamp": "2021-01-10T14:25:00.000Z",
- "controlLoopState": "UNINITIALISED",
- "clElementUptime":330
+ "state": "UNINITIALISED",
+ "acElementUptime":330
}
]
}
diff --git a/participant/participant-intermediary/src/test/resources/providers/TestControlLoops.json b/models/src/test/resources/providers/TestAutomationCompositions.json
index fedda9600..906785244 100644
--- a/participant/participant-intermediary/src/test/resources/providers/TestControlLoops.json
+++ b/models/src/test/resources/providers/TestAutomationCompositions.json
@@ -1,8 +1,8 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"state": "UNINITIALISED",
@@ -15,63 +15,63 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE automation composition element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS automation composition element for the PMSH instance 0 automation composition"
}
},
"name": "PMSHInstance0",
"version": "1.0.1",
- "description": "PMSH control loop instance 0"
+ "description": "PMSH automation composition instance 0"
},
{
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"state": "UNINITIALISED",
@@ -84,59 +84,59 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 1 control loop"
+ "description": "DCAE automation composition element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Monitoring Policy element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Operational Policy element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 1 control loop"
+ "description": "CDS element for the PMSH instance 1 automation composition"
}
},
"name": "PMSHInstance1",
"version": "1.0.1",
- "description": "PMSH control loop instance 1"
+ "description": "PMSH automation composition instance 1"
}
]
}
diff --git a/models/src/test/resources/providers/TestParticipant.json b/models/src/test/resources/providers/TestParticipant.json
index 4722ead9b..7e4f9540f 100644
--- a/models/src/test/resources/providers/TestParticipant.json
+++ b/models/src/test/resources/providers/TestParticipant.json
@@ -2,14 +2,14 @@
"name": "dummy_participant1",
"version": "1.0.1",
"definition":{
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"participantState": "PASSIVE",
"healthStatus": "HEALTHY",
"description": "A dummy PMSH participant1",
"participantType":{
- "name": "org.onap.domain.pmsh.PolicyControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PolicyAutomationCompositionDefinition",
"version": "1.0.0"
}
}
diff --git a/models/src/test/resources/providers/UpdateControlLoops.json b/models/src/test/resources/providers/UpdateAutomationCompositions.json
index 2d6bd0753..f118ea799 100644
--- a/models/src/test/resources/providers/UpdateControlLoops.json
+++ b/models/src/test/resources/providers/UpdateAutomationCompositions.json
@@ -1,15 +1,15 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"name": "PMSHInstance0",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"state": "RUNNING",
"orderedState": "RUNNING",
- "description": "PMSH control loop instance 0",
+ "description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
@@ -18,54 +18,54 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "RUNNING",
"orderedState": "RUNNING",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "RUNNING",
"orderedState": "RUNNING",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "1.0.0"
},
"state": "RUNNING",
"orderedState": "RUNNING",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "RUNNING",
"orderedState": "RUNNING",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS element for the PMSH instance 0 automation composition"
}
}
}
diff --git a/packages/policy-clamp-docker/pom.xml b/packages/policy-clamp-docker/pom.xml
index 08511e03f..6415d2d79 100644
--- a/packages/policy-clamp-docker/pom.xml
+++ b/packages/policy-clamp-docker/pom.xml
@@ -92,10 +92,10 @@
<images>
<image>
- <name>onap/policy-clamp-cl-runtime</name>
+ <name>onap/policy-clamp-runtime-acm</name>
<build>
<cleanup>try</cleanup>
- <dockerFile>ClRuntimeDockerfile</dockerFile>
+ <dockerFile>AcmRuntimeDockerfile</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -109,11 +109,11 @@
<include>org.onap.policy.clamp:policy-clamp-tarball</include>
</includes>
<outputDirectory>/lib</outputDirectory>
- <outputFileNameMapping>policy-controlloop-runtime.tar.gz</outputFileNameMapping>
+ <outputFileNameMapping>policy-clamp-runtime-acm.tar.gz</outputFileNameMapping>
</dependencySet>
<dependencySet>
<includes>
- <include>org.onap.policy.clamp:policy-clamp-runtime-controlloop</include>
+ <include>org.onap.policy.clamp:policy-clamp-runtime-acm</include>
</includes>
<outputFileNameMapping>app.jar</outputFileNameMapping>
</dependencySet>
@@ -123,8 +123,8 @@
</build>
</image>
<image>
- <name>onap/policy-clamp-cl-pf-ppnt</name>
- <alias>onap-policy-clamp-cl-pf-ppnt</alias>
+ <name>onap/policy-clamp-ac-pf-ppnt</name>
+ <alias>onap-policy-clamp-ac-pf-ppnt</alias>
<build>
<cleanup>try</cleanup>
<dockerFile>PolicyParticipantDockerfile</dockerFile>
@@ -155,8 +155,8 @@
</build>
</image>
<image>
- <name>onap/policy-clamp-cl-k8s-ppnt</name>
- <alias>onap-policy-clamp-cl-k8s-ppnt</alias>
+ <name>onap/policy-clamp-ac-k8s-ppnt</name>
+ <alias>onap-policy-clamp-ac-k8s-ppnt</alias>
<build>
<cleanup>try</cleanup>
<dockerFile>KubernetesParticipantDockerfile</dockerFile>
@@ -187,8 +187,8 @@
</build>
</image>
<image>
- <name>onap/policy-clamp-cl-http-ppnt</name>
- <alias>onap-policy-clamp-cl-http-ppnt</alias>
+ <name>onap/policy-clamp-ac-http-ppnt</name>
+ <alias>onap-policy-clamp-ac-http-ppnt</alias>
<build>
<cleanup>try</cleanup>
<dockerFile>HttpParticipantDockerfile</dockerFile>
@@ -248,9 +248,6 @@
<goal>build</goal>
<goal>push</goal>
</goals>
- <configuration>
- <image>onap/policy-clamp</image>
- </configuration>
</execution>
</executions>
</plugin>
diff --git a/packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile b/packages/policy-clamp-docker/src/main/docker/AcmRuntimeDockerfile
index b66fddcc4..021a58676 100644
--- a/packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile
+++ b/packages/policy-clamp-docker/src/main/docker/AcmRuntimeDockerfile
@@ -19,7 +19,7 @@
#-------------------------------------------------------------------------------
#
-# Docker file to build an image that runs CLAMP on Java 11 or better in alpine
+# Docker file to build an image that runs the CLAMP ACM runtime on Java 11 or better in alpine
#
FROM onap/policy-jre-alpine:2.4.0
@@ -33,13 +33,13 @@ ENV POLICY_HOME=$POLICY_HOME/clamp
RUN mkdir -p $POLICY_LOGS $POLICY_HOME $POLICY_HOME/bin && \
chown -R policy:policy $POLICY_HOME $POLICY_LOGS && \
mkdir /packages
-COPY /maven/lib/policy-controlloop-runtime.tar.gz /packages
+COPY /maven/lib/policy-clamp-runtime-acm.tar.gz /packages
-RUN tar xvfz /packages/policy-controlloop-runtime.tar.gz --directory $POLICY_HOME && \
- rm /packages/policy-controlloop-runtime.tar.gz
+RUN tar xvfz /packages/policy-clamp-runtime-acm.tar.gz --directory $POLICY_HOME && \
+ rm /packages/policy-clamp-runtime-acm.tar.gz
WORKDIR $POLICY_HOME
-COPY controlloop-runtime.sh bin/.
+COPY acm-runtime.sh bin/.
COPY /maven/app.jar /app
RUN chown -R policy:policy * && \
@@ -50,4 +50,4 @@ EXPOSE 6969
USER policy
WORKDIR $POLICY_HOME/bin
-ENTRYPOINT [ "./controlloop-runtime.sh" ]
+ENTRYPOINT [ "./acm-runtime.sh" ]
diff --git a/packages/policy-clamp-docker/src/main/docker/HttpParticipantDockerfile b/packages/policy-clamp-docker/src/main/docker/HttpParticipantDockerfile
index 2497f5d3b..b6f2c44eb 100644
--- a/packages/policy-clamp-docker/src/main/docker/HttpParticipantDockerfile
+++ b/packages/policy-clamp-docker/src/main/docker/HttpParticipantDockerfile
@@ -19,7 +19,7 @@
#-------------------------------------------------------------------------------
#
-# Docker file to build an image that runs CLAMP on Java 11 or better in alpine
+# Docker file to build an image that runs the CLAMP ACM HTTP Participant on Java 11 or better in alpine
#
FROM onap/policy-jre-alpine:2.4.0
diff --git a/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile b/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile
index e7fc89021..688e68d09 100644
--- a/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile
+++ b/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile
@@ -19,7 +19,7 @@
#-------------------------------------------------------------------------------
#
-# Docker file to build an image that runs CLAMP on Java 11 or better in alpine
+# Docker file to build an image that runs the CLAMP ACM K8S Participant on Java 11 or better in alpine
#
FROM onap/policy-jre-alpine:2.4.0
diff --git a/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile b/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile
index a0d003292..50d4210bf 100644
--- a/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile
+++ b/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile
@@ -19,7 +19,7 @@
#-------------------------------------------------------------------------------
#
-# Docker file to build an image that runs CLAMP on Java 11 or better in alpine
+# Docker file to build an image that runs the CLAMP ACM Policy Framework Participant on Java 11 or better in alpine
#
FROM onap/policy-jre-alpine:2.4.0
diff --git a/packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh b/packages/policy-clamp-docker/src/main/docker/acm-runtime.sh
index c428fd553..84550de82 100644
--- a/packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh
+++ b/packages/policy-clamp-docker/src/main/docker/acm-runtime.sh
@@ -32,7 +32,7 @@ else
fi
if [ -z "$CONFIG_FILE" ]; then
- CONFIG_FILE="${POLICY_HOME}/etc/ClRuntimeParameters.yaml"
+ CONFIG_FILE="${POLICY_HOME}/etc/AcRuntimeParameters.yaml"
fi
echo "Policy clamp config file: $CONFIG_FILE"
@@ -54,7 +54,7 @@ fi
touch /app/app.jar
mkdir -p "${POLICY_HOME}"/config/
-cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/ClRuntimeParameters.yaml
+cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/AcRuntimeParameters.yaml
$JAVA_HOME/bin/java -Dserver.ssl.enabled="true" \
-Dserver.ssl.keyStore="${KEYSTORE}" \
@@ -68,4 +68,4 @@ $JAVA_HOME/bin/java -Dserver.ssl.enabled="true" \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
-jar /app/app.jar \
- --spring.config.location="${POLICY_HOME}/config/ClRuntimeParameters.yaml"
+ --spring.config.location="${POLICY_HOME}/config/AcRuntimeParameters.yaml"
diff --git a/packages/policy-clamp-tarball/pom.xml b/packages/policy-clamp-tarball/pom.xml
index 6b4a370fc..36aab6b92 100644
--- a/packages/policy-clamp-tarball/pom.xml
+++ b/packages/policy-clamp-tarball/pom.xml
@@ -34,7 +34,7 @@
<dependencies>
<dependency>
<groupId>org.onap.policy.clamp</groupId>
- <artifactId>policy-clamp-runtime-controlloop</artifactId>
+ <artifactId>policy-clamp-runtime-acm</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml
index 462448921..f17d3eb6e 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml
@@ -7,7 +7,7 @@ spring:
converters:
preferred-json-mapper: gson
datasource:
- url: jdbc:mariadb://${mariadb.host:mariadb}:${mariadb.port:3306}/controlloop
+ url: jdbc:mariadb://${mariadb.host:mariadb}:${mariadb.port:3306}/clamp-acm
driverClassName: org.mariadb.jdbc.Driver
username: policy_user
password: policy_user
@@ -33,11 +33,10 @@ security:
server:
port: 6969
servlet:
- context-path: /onap/controlloop
+ context-path: /onap/policy/clamp/acm
error:
path: /error
-
runtime:
participantParameters:
heartBeatMs: 20000
@@ -48,7 +47,7 @@ runtime:
topicParameterGroup:
topicSources:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
@@ -56,7 +55,7 @@ runtime:
useHttps: true
topicSinks:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml
index b13059a69..529b095a1 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml
@@ -13,18 +13,18 @@ participant:
name: HttpParticipant0
version: 1.0.0
participantType:
- name: org.onap.k8s.controlloop.HttpControlLoopParticipant
+ name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
- clampControlLoopTopics:
+ clampAutomationCompositionTopics:
topicSources:
- - topic: POLICY-CLRUNTIME-PARTICIPANT
+ - topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
useHttps: true
topicSinks:
- - topic: POLICY-CLRUNTIME-PARTICIPANT
+ - topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
@@ -37,4 +37,4 @@ management:
server:
port: 8084
servlet:
- context-path: /onap/httpparticipant
+ context-path: /onap/policy/clamp/acm/httpparticipant
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
index 0d94e2e94..c6acf4052 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
@@ -16,12 +16,12 @@ participant:
name: K8sParticipant0
version: 1.0.0
participantType:
- name: org.onap.k8s.controlloop.K8SControlLoopParticipant
+ name: org.onap.policy.clamp.acm.KubernetesParticipant
version: 2.3.4
- clampControlLoopTopics:
+ clampAutomationCompositionTopics:
topicSources:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
@@ -29,7 +29,7 @@ participant:
useHttps: true
topicSinks:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
@@ -43,7 +43,7 @@ management:
server:
port: 8083
servlet:
- context-path: /onap/k8sparticipant
+ context-path: /onap/policy/clamp/acm/k8sparticipant
logging:
# Configuration of logging
@@ -52,7 +52,7 @@ logging:
org.springframework: ERROR
org.springframework.data: ERROR
org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
- org.onap.policy.clamp.controlloop.participant.kubernetes: INFO
+ org.onap.policy.clamp.acm.participant.kubernetes: INFO
file:
name: /var/log/onap/policy/clamp/application.log
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
index 14660a9ff..1cb4e6dc7 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
@@ -30,12 +30,12 @@ participant:
name: org.onap.PM_Policy
version: 1.0.0
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.clamp.acm.PolicyParticipant
version: 2.3.1
- clampControlLoopTopics:
+ clampAutomationCompositionTopics:
topicSources:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
@@ -43,7 +43,7 @@ participant:
useHttps: true
topicSinks:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
@@ -56,4 +56,4 @@ management:
server:
port: 8085
servlet:
- context-path: /onap/policyparticipant
+ context-path: /onap/policy/clamp/acm/policyparticipant
diff --git a/participant/participant-impl/participant-impl-cds/pom.xml b/participant/participant-impl/participant-impl-cds/pom.xml
index 0f806a602..0b85867c3 100644
--- a/participant/participant-impl/participant-impl-cds/pom.xml
+++ b/participant/participant-impl/participant-impl-cds/pom.xml
@@ -30,5 +30,5 @@
<artifactId>policy-clamp-participant-impl-cds</artifactId>
<name>${project.artifactId}</name>
- <description>CDS participant, that allows CDS to partake in control loops</description>
+ <description>CDS participant, that allows CDS to partake in automation compositions</description>
</project>
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/Application.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/Application.java
index 4f8096502..2f26a8659 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/Application.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/Application.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http;
+package org.onap.policy.clamp.acm.participant.http;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -29,10 +29,14 @@ import org.springframework.context.annotation.ComponentScan;
* Starter.
*
*/
+// @formatter:off
@SpringBootApplication
-@ComponentScan({"org.onap.policy.clamp.controlloop.participant.http",
- "org.onap.policy.clamp.controlloop.participant.intermediary"})
-@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.http.parameters")
+@ComponentScan({
+ "org.onap.policy.clamp.acm.participant.http",
+ "org.onap.policy.clamp.acm.participant.intermediary"
+})
+@ConfigurationPropertiesScan("org.onap.policy.clamp.acm.participant.http.parameters")
+//@formatter:on
public class Application {
/**
* Main class.
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/ParticipantConfig.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/ParticipantConfig.java
index ce013a765..e2b5d1718 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/ParticipantConfig.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/ParticipantConfig.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.config;
+package org.onap.policy.clamp.acm.participant.http.config;
-import org.onap.policy.clamp.controlloop.participant.http.main.handler.ControlLoopElementHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.http.main.handler.AutomationCompositionElementHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@@ -29,15 +29,15 @@ import org.springframework.context.annotation.Configuration;
public class ParticipantConfig {
/**
- * Register ControlLoopElementListener.
+ * Register AutomationCompositionElementListener.
*
* @param intermediaryApi the ParticipantIntermediaryApi
- * @param clElementHandler the ControlLoop Element Handler
+ * @param acElementHandler the AutomationComposition Element Handler
*/
@Autowired
- public void registerControlLoopElementListener(ParticipantIntermediaryApi intermediaryApi,
- ControlLoopElementHandler clElementHandler) {
- intermediaryApi.registerControlLoopElementListener(clElementHandler);
- clElementHandler.setIntermediaryApi(intermediaryApi);
+ public void registerAutomationCompositionElementListener(ParticipantIntermediaryApi intermediaryApi,
+ AutomationCompositionElementHandler acElementHandler) {
+ intermediaryApi.registerAutomationCompositionElementListener(acElementHandler);
+ acElementHandler.setIntermediaryApi(intermediaryApi);
}
}
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/SecurityConfig.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/SecurityConfig.java
index 499bbe153..25a945e7e 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/SecurityConfig.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/SecurityConfig.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.config;
+package org.onap.policy.clamp.acm.participant.http.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/exception/HttpWebClientException.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/exception/HttpWebClientException.java
index 6b27700c4..8978e88ec 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/exception/HttpWebClientException.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/exception/HttpWebClientException.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.exception;
+package org.onap.policy.clamp.acm.participant.http.main.exception;
import org.springframework.web.reactive.function.client.WebClientResponseException;
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
index 69d8c750a..89c98400e 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.handler;
+package org.onap.policy.clamp.acm.participant.http.main.handler;
import java.io.Closeable;
import java.io.IOException;
@@ -38,14 +38,14 @@ import javax.validation.Validation;
import javax.validation.ValidationException;
import lombok.Setter;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest;
-import org.onap.policy.clamp.controlloop.participant.http.main.webclient.ClHttpClient;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigRequest;
+import org.onap.policy.clamp.acm.participant.http.main.webclient.AcHttpClient;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -58,59 +58,60 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
/**
- * This class handles implementation of controlLoopElement updates.
+ * This class handles implementation of automationCompositionElement updates.
*/
@Component
-public class ControlLoopElementHandler implements ControlLoopElementListener, Closeable {
+public class AutomationCompositionElementHandler implements AutomationCompositionElementListener, Closeable {
private static final Coder CODER = new StandardCoder();
private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
+ private final ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
- private Map<ToscaConceptIdentifier, Pair<Integer, String>> restResponseMap = new ConcurrentHashMap<>();
+ private final Map<ToscaConceptIdentifier, Pair<Integer, String>> restResponseMap = new ConcurrentHashMap<>();
@Setter
private ParticipantIntermediaryApi intermediaryApi;
/**
- * Handle controlLoopElement statistics.
+ * Handle automationCompositionElement statistics.
*
- * @param controlLoopElementId controlloop element id
+ * @param automationCompositionElementId automation composition element id
*/
@Override
- public void handleStatistics(UUID controlLoopElementId) throws PfModelException {
+ public void handleStatistics(UUID automationCompositionElementId) {
// Implementation not needed for http participant
}
/**
- * Handle a control loop element state change.
+ * Handle a automation composition element state change.
*
- * @param controlLoopElementId the ID of the control loop element
- * @param currentState the current state of the control loop element
- * @param newState the state to which the control loop element is changing to
+ * @param automationCompositionElementId the ID of the automation composition element
+ * @param currentState the current state of the automation composition element
+ * @param newState the state to which the automation composition element is changing to
* @throws PfModelException in case of a model exception
*/
@Override
- public void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId, UUID controlLoopElementId,
- ControlLoopState currentState, ControlLoopOrderedState newState) throws PfModelException {
+ public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ UUID automationCompositionElementId, AutomationCompositionState currentState,
+ AutomationCompositionOrderedState newState) {
switch (newState) {
case UNINITIALISED:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.UNINITIALISED,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.UNINITIALISED,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
break;
case PASSIVE:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
break;
case RUNNING:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.RUNNING,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.RUNNING,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
break;
default:
LOGGER.warn("Cannot transition from state {} to state {}", currentState, newState);
@@ -119,27 +120,27 @@ public class ControlLoopElementHandler implements ControlLoopElementListener, Cl
}
/**
- * Callback method to handle an update on a control loop element.
+ * Callback method to handle an update on a automation composition element.
*
- * @param element the information on the control loop element
+ * @param element the information on the automation composition element
* @param nodeTemplate toscaNodeTemplate
*/
@Override
- public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId, ControlLoopElement element,
- ToscaNodeTemplate nodeTemplate) {
+ public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
+ AutomationCompositionElement element, ToscaNodeTemplate nodeTemplate) {
try {
var configRequest = CODER.convert(nodeTemplate.getProperties(), ConfigRequest.class);
- Set<ConstraintViolation<ConfigRequest>> violations = Validation.buildDefaultValidatorFactory()
- .getValidator().validate(configRequest);
+ Set<ConstraintViolation<ConfigRequest>> violations =
+ Validation.buildDefaultValidatorFactory().getValidator().validate(configRequest);
if (violations.isEmpty()) {
invokeHttpClient(configRequest);
List<Pair<Integer, String>> failedResponseStatus = restResponseMap.values().stream()
.filter(response -> !HttpStatus.valueOf(response.getKey())
.is2xxSuccessful()).collect(Collectors.toList());
if (failedResponseStatus.isEmpty()) {
- intermediaryApi.updateControlLoopElementState(controlLoopId, element.getId(),
- ControlLoopOrderedState.PASSIVE, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
+ AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
} else {
LOGGER.error("Error on Invoking the http request: {}", failedResponseStatus);
}
@@ -154,11 +155,12 @@ public class ControlLoopElementHandler implements ControlLoopElementListener, Cl
/**
* Invoke a runnable thread to execute http requests.
+ *
* @param configRequest ConfigRequest
*/
public void invokeHttpClient(ConfigRequest configRequest) throws ExecutionException, InterruptedException {
// Invoke runnable thread to execute https requests of all config entities
- Future<Map> result = executor.submit(new ClHttpClient(configRequest, restResponseMap), restResponseMap);
+ Future<Map> result = executor.submit(new AcHttpClient(configRequest, restResponseMap), restResponseMap);
if (!result.get().isEmpty()) {
LOGGER.debug("Http Request Completed: {}", result.isDone());
}
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigRequest.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java
index 87cab88a7..c630b3c7c 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigRequest.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.models;
+package org.onap.policy.clamp.acm.participant.http.main.models;
import java.util.List;
import java.util.Map;
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigurationEntity.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java
index 8703a9d21..6ac2edb56 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigurationEntity.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.models;
+package org.onap.policy.clamp.acm.participant.http.main.models;
import java.util.List;
import javax.validation.Valid;
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/RestParams.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java
index fc4e02897..717131f5a 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/RestParams.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.models;
+package org.onap.policy.clamp.acm.participant.http.main.models;
import java.util.Map;
import javax.validation.constraints.Max;
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/webclient/ClHttpClient.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/webclient/AcHttpClient.java
index 0e0ea557e..563daecd9 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/webclient/ClHttpClient.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/webclient/AcHttpClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.webclient;
+package org.onap.policy.clamp.acm.participant.http.main.webclient;
import java.lang.invoke.MethodHandles;
import java.time.Duration;
@@ -26,10 +26,10 @@ import java.util.Map;
import java.util.Objects;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.clamp.controlloop.participant.http.main.exception.HttpWebClientException;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigurationEntity;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.RestParams;
+import org.onap.policy.clamp.acm.participant.http.main.exception.HttpWebClientException;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigRequest;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigurationEntity;
+import org.onap.policy.clamp.acm.participant.http.main.models.RestParams;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,7 +40,7 @@ import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.util.UriComponentsBuilder;
import reactor.core.publisher.Mono;
-public class ClHttpClient implements Runnable {
+public class AcHttpClient implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -51,7 +51,7 @@ public class ClHttpClient implements Runnable {
/**
* Constructor.
*/
- public ClHttpClient(ConfigRequest configRequest, Map<ToscaConceptIdentifier, Pair<Integer, String>> responseMap) {
+ public AcHttpClient(ConfigRequest configRequest, Map<ToscaConceptIdentifier, Pair<Integer, String>> responseMap) {
this.configRequest = configRequest;
this.responseMap = responseMap;
}
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/parameters/ParticipantHttpParameters.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java
index 62bbd7593..c0f3c6a7a 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/parameters/ParticipantHttpParameters.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java
@@ -19,14 +19,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.parameters;
+package org.onap.policy.clamp.acm.participant.http.parameters;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
@@ -43,5 +43,4 @@ public class ParticipantHttpParameters implements ParticipantParameters {
@NotNull
@Valid
private ParticipantIntermediaryParameters intermediaryParameters;
-
}
diff --git a/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml
index df0ad7df3..8a3d0fbf2 100644
--- a/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml
@@ -13,17 +13,17 @@ participant:
name: HttpParticipant0
version: 1.0.0
participantType:
- name: org.onap.k8s.controlloop.HttpControlLoopParticipant
+ name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
- clampControlLoopTopics:
+ clampAutomationCompositionTopics:
topicSources:
- - topic: POLICY-CLRUNTIME-PARTICIPANT
+ - topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
topicSinks:
- - topic: POLICY-CLRUNTIME-PARTICIPANT
+ - topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
@@ -35,4 +35,4 @@ management:
server:
port: 8084
servlet:
- context-path: /onap/httpparticipant
+ context-path: /onap/policy/clamp/acm/httpparticipant
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
new file mode 100644
index 000000000..fbb689448
--- /dev/null
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.http.handler;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doNothing;
+
+import java.io.IOException;
+import java.util.Map;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.onap.policy.clamp.acm.participant.http.main.handler.AutomationCompositionElementHandler;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigRequest;
+import org.onap.policy.clamp.acm.participant.http.utils.CommonTestData;
+import org.onap.policy.clamp.acm.participant.http.utils.ToscaUtils;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+@ExtendWith(SpringExtension.class)
+class AcElementHandlerTest {
+
+ @InjectMocks
+ @Spy
+ private AutomationCompositionElementHandler automationCompositionElementHandler =
+ new AutomationCompositionElementHandler();
+
+ @Mock
+ private ParticipantIntermediaryApi participantIntermediaryApi;
+
+ private CommonTestData commonTestData = new CommonTestData();
+
+ private static ToscaServiceTemplate serviceTemplate;
+ private static final String HTTP_AUTOMATION_COMPOSITION_ELEMENT =
+ "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement";
+
+ @BeforeAll
+ static void init() throws CoderException {
+ serviceTemplate = ToscaUtils.readAutomationCompositionFromTosca();
+ }
+
+ @Test
+ void test_automationCompositionElementeStateChange() throws IOException {
+ var automationCompositionId = commonTestData.getAutomationCompositionId();
+ var element = commonTestData.getAutomationCompositionElement();
+ var automationCompositionElementId = element.getId();
+
+ var config = Mockito.mock(ConfigRequest.class);
+ assertDoesNotThrow(() -> automationCompositionElementHandler.invokeHttpClient(config));
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.PASSIVE));
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.UNINITIALISED));
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.RUNNING));
+
+ automationCompositionElementHandler.close();
+ }
+
+ @Test
+ void test_AutomationCompositionElementUpdate() throws Exception {
+ doNothing().when(automationCompositionElementHandler).invokeHttpClient(any());
+ AutomationCompositionElement element = commonTestData.getAutomationCompositionElement();
+
+ Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementUpdate(
+ commonTestData.getAutomationCompositionId(), element,
+ nodeTemplatesMap.get(HTTP_AUTOMATION_COMPOSITION_ELEMENT)));
+ }
+}
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java
index 8efff8f6a..f0a465fa2 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/rest/ActuatorControllerTest.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.rest;
+package org.onap.policy.clamp.acm.participant.http.rest;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -27,7 +27,7 @@ import javax.ws.rs.core.Response;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.participant.http.utils.CommonActuatorController;
+import org.onap.policy.clamp.acm.participant.http.utils.CommonActuatorController;
import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java
index ec6e30918..cfe3ec2c3 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/CommonActuatorController.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.main.utils;
+package org.onap.policy.clamp.acm.participant.http.utils;
import static org.junit.Assert.assertEquals;
@@ -40,7 +40,7 @@ import org.onap.policy.common.utils.network.NetworkUtil;
public class CommonActuatorController {
public static final String SELF = NetworkUtil.getHostname();
- public static final String CONTEXT_PATH = "onap/policyparticipant";
+ public static final String CONTEXT_PATH = "onap/policy/clamp/acm/httpparticipant";
public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/";
private static String httpPrefix;
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/CommonTestData.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java
index 1f92a86e0..010d29a66 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java
@@ -19,36 +19,38 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.utils;
+package org.onap.policy.clamp.acm.participant.http.utils;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigurationEntity;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.RestParams;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigurationEntity;
+import org.onap.policy.clamp.acm.participant.http.main.models.RestParams;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
public class CommonTestData {
- private static final String TEST_KEY_NAME = "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement";
-
+ private static final String TEST_KEY_NAME =
+ "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement";
/**
- * Get a controlLoop Element.
- * @return controlLoopElement object
+ * Get a automationComposition Element.
+ *
+ * @return automationCompositionElement object
*/
- public ControlLoopElement getControlLoopElement() {
- ControlLoopElement element = new ControlLoopElement();
+ public AutomationCompositionElement getAutomationCompositionElement() {
+ AutomationCompositionElement element = new AutomationCompositionElement();
element.setId(UUID.randomUUID());
element.setDefinition(new ToscaConceptIdentifier(TEST_KEY_NAME, "1.0.1"));
- element.setOrderedState(ControlLoopOrderedState.PASSIVE);
+ element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
return element;
}
/**
* Get query params.
+ *
* @return Map of query params
*/
public Map<String, String> getQueryParams() {
@@ -57,6 +59,7 @@ public class CommonTestData {
/**
* Get path params.
+ *
* @return Map of path params
*/
public Map<String, Object> getPathParams() {
@@ -65,88 +68,70 @@ public class CommonTestData {
/**
* Rest params with GET request.
+ *
* @return RestParams obj
*/
public RestParams restParamsWithGet() {
- return new RestParams(
- new ToscaConceptIdentifier("getRequest", "1.0"),
- "GET",
- "get",
- 200,
- null,
- getQueryParams(),
- null
- );
+ return new RestParams(new ToscaConceptIdentifier("getRequest", "1.0"), "GET", "get", 200, null,
+ getQueryParams(), null);
}
/**
* Rest params with POST request.
+ *
* @return RestParams obj
*/
public RestParams restParamsWithPost() {
- return new RestParams(
- new ToscaConceptIdentifier("postRequest", "1.0"),
- "POST",
- "post",
- 200,
- null,
- getQueryParams(),
- "Test body"
- );
+ return new RestParams(new ToscaConceptIdentifier("postRequest", "1.0"), "POST", "post", 200, null,
+ getQueryParams(), "Test body");
}
/**
* Rest params with POST request.
+ *
* @return RestParams obj
*/
public RestParams restParamsWithInvalidPost() {
- return new RestParams(
- new ToscaConceptIdentifier("postRequest", "1.0"),
- "POST",
- "post/{id}/{name}",
- 200,
- getPathParams(),
- getQueryParams(),
- "Test body"
- );
+ return new RestParams(new ToscaConceptIdentifier("postRequest", "1.0"), "POST", "post/{id}/{name}", 200,
+ getPathParams(), getQueryParams(), "Test body");
}
/**
* Get invalid configuration entity.
+ *
* @return ConfigurationEntity obj
*/
public ConfigurationEntity getInvalidConfigurationEntity() {
- return new ConfigurationEntity(
- new ToscaConceptIdentifier("config1", "1.0.1"),
- List.of(restParamsWithGet(), restParamsWithInvalidPost())
- );
+ return new ConfigurationEntity(new ToscaConceptIdentifier("config1", "1.0.1"),
+ List.of(restParamsWithGet(), restParamsWithInvalidPost()));
}
/**
* Get configuration entity.
+ *
* @return ConfigurationEntity obj
*/
public ConfigurationEntity getConfigurationEntity() {
- return new ConfigurationEntity(
- new ToscaConceptIdentifier("config1", "1.0.1"),
- List.of(restParamsWithGet(), restParamsWithPost())
- );
+ return new ConfigurationEntity(new ToscaConceptIdentifier("config1", "1.0.1"),
+ List.of(restParamsWithGet(), restParamsWithPost()));
}
/**
- * Get controlloop id.
- * @return ToscaConceptIdentifier controlLoopId
+ * Get automation composition id.
+ *
+ * @return ToscaConceptIdentifier automationCompositionId
*/
- public ToscaConceptIdentifier getControlLoopId() {
+ public ToscaConceptIdentifier getAutomationCompositionId() {
return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
}
/**
* Get headers for config request.
+ *
* @return Map of headers
*/
public Map<String, String> getHeaders() {
- return Map.of("Content-Type", "application/json", "Accept", "application/json");
+ return Map.of("Content-Type", "application/json", "Accept", "application/json");
}
}
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/ToscaUtils.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/ToscaUtils.java
index fdba28c0e..9e46212bf 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/ToscaUtils.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/ToscaUtils.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.utils;
+package org.onap.policy.clamp.acm.participant.http.utils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@@ -40,12 +40,12 @@ public final class ToscaUtils {
* Read a service template yaml.
* @return ToscaServiceTemplate
*/
- public static ToscaServiceTemplate readControlLoopFromTosca() {
- return serializeControlLoopYaml(TOSCA_TEMPLATE_YAML);
+ public static ToscaServiceTemplate readAutomationCompositionFromTosca() {
+ return serializeAutomationCompositionYaml(TOSCA_TEMPLATE_YAML);
}
- private static ToscaServiceTemplate serializeControlLoopYaml(String controlLoopFilePath) {
- String controlLoopString = ResourceUtils.getResourceAsString(controlLoopFilePath);
- return yamlTranslator.fromYaml(controlLoopString, ToscaServiceTemplate.class);
+ private static ToscaServiceTemplate serializeAutomationCompositionYaml(String automationCompositionFilePath) {
+ String automationCompositionString = ResourceUtils.getResourceAsString(automationCompositionFilePath);
+ return yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class);
}
}
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/webclient/ClHttpClientTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/webclient/AcHttpClientTest.java
index e3ff9dbba..44ef50848 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/webclient/ClHttpClientTest.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/webclient/AcHttpClientTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.webclient;
+package org.onap.policy.clamp.acm.participant.http.webclient;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
@@ -38,16 +38,16 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockserver.integration.ClientAndServer;
import org.mockserver.model.Parameter;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigurationEntity;
-import org.onap.policy.clamp.controlloop.participant.http.main.webclient.ClHttpClient;
-import org.onap.policy.clamp.controlloop.participant.http.utils.CommonTestData;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigRequest;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigurationEntity;
+import org.onap.policy.clamp.acm.participant.http.main.webclient.AcHttpClient;
+import org.onap.policy.clamp.acm.participant.http.utils.CommonTestData;
import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
-class ClHttpClientTest {
+class AcHttpClientTest {
private static CommonTestData commonTestData;
@@ -99,7 +99,7 @@ class ClHttpClientTest {
ConfigRequest configRequest = new ConfigRequest(testMockUrl + ":" + mockServerPort, headers,
List.of(configurationEntity), 10);
- ClHttpClient client = new ClHttpClient(configRequest, responseMap);
+ AcHttpClient client = new AcHttpClient(configRequest, responseMap);
assertDoesNotThrow(client::run);
assertThat(responseMap).hasSize(2).containsKey(commonTestData
.restParamsWithGet().getRestRequestId());
@@ -118,7 +118,7 @@ class ClHttpClientTest {
ConfigRequest configRequest = new ConfigRequest(testMockUrl + ":" + mockServerPort, headers,
List.of(configurationEntity), 10);
- ClHttpClient client = new ClHttpClient(configRequest, responseMap);
+ AcHttpClient client = new AcHttpClient(configRequest, responseMap);
assertDoesNotThrow(client::run);
assertThat(responseMap).hasSize(2).containsKey(commonTestData
.restParamsWithGet().getRestRequestId());
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java
deleted file mode 100644
index 08f008ef3..000000000
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.http.handler;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.Spy;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.participant.http.main.handler.ControlLoopElementHandler;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest;
-import org.onap.policy.clamp.controlloop.participant.http.utils.CommonTestData;
-import org.onap.policy.clamp.controlloop.participant.http.utils.ToscaUtils;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-
-@ExtendWith(SpringExtension.class)
-class ClElementHandlerTest {
-
- @InjectMocks
- @Spy
- private ControlLoopElementHandler controlLoopElementHandler = new ControlLoopElementHandler();
-
- @Mock
- private ParticipantIntermediaryApi participantIntermediaryApi;
-
- private CommonTestData commonTestData = new CommonTestData();
-
- private static ToscaServiceTemplate serviceTemplate;
- private static final String HTTP_CONTROL_LOOP_ELEMENT =
- "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement";
-
- @BeforeAll
- static void init() throws CoderException {
- serviceTemplate = ToscaUtils.readControlLoopFromTosca();
- }
-
- @Test
- void test_controlLoopElementeStateChange() throws IOException {
- var controlLoopId = commonTestData.getControlLoopId();
- var element = commonTestData.getControlLoopElement();
- var controlLoopElementId = element.getId();
-
- var config = Mockito.mock(ConfigRequest.class);
- assertDoesNotThrow(() -> controlLoopElementHandler.invokeHttpClient(config));
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.PASSIVE));
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.UNINITIALISED));
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.RUNNING));
-
- controlLoopElementHandler.close();
- }
-
- @Test
- void test_ControlLoopElementUpdate() throws ExecutionException, InterruptedException {
- doNothing().when(controlLoopElementHandler).invokeHttpClient(any());
- ControlLoopElement element = commonTestData.getControlLoopElement();
-
- Map<String, ToscaNodeTemplate> nodeTemplatesMap =
- serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementUpdate(commonTestData.getControlLoopId(), element,
- nodeTemplatesMap.get(HTTP_CONTROL_LOOP_ELEMENT)));
- }
-}
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 f221bcbd7..57c6e40d1 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
@@ -27,7 +27,7 @@ data_types:
type: string
required: true
- org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest:
+ org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest:
version: 1.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -56,7 +56,7 @@ data_types:
constraints:
- in_range: [100, 599]
description: THe expected HTTP status code for the REST request
- org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.ConfigurationEntity:
+ org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity:
version: 1.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -64,24 +64,24 @@ data_types:
type: onap.datatypes.ToscaConceptIdentifier
typeVersion: 1.0.0
required: true
- description: The name and version of a Configuration Entity to be handled by the HTTP Control Loop Element
+ description: The name and version of a Configuration Entity to be handled by the HTTP Automation Composition Element
restSequence:
type: list
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest
+ type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest
typeVersion: 1.0.0
description: A sequence of REST commands to send to the REST endpoint
node_types:
- org.onap.policy.clamp.controlloop.Participant:
+ org.onap.policy.clamp.acm.Participant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
requred: false
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -98,11 +98,11 @@ node_types:
- 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
+ description: A value indicating the start phase in which this automation composition element will be started, the
+ first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped
+ in reverse start phase order. Automation Composition Elements with the same start phase are started and
stopped simultaneously
- org.onap.policy.clamp.controlloop.ControlLoop:
+ org.onap.policy.clamp.acm.AutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -114,9 +114,9 @@ node_types:
required: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- org.onap.policy.clamp.controlloop.HttpControlLoopElement:
+ org.onap.policy.clamp.acm.HttpAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
baseUrl:
type: string
@@ -132,29 +132,29 @@ node_types:
type: map
required: true
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.ConfigurationEntity
+ type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity
typeVersion: 1.0.0
- description: The connfiguration entities the Control Loop Element is managing and their associated REST requests
+ description: The connfiguration entities the Automation Composition Element is managing and their associated REST requests
topology_template:
node_templates:
- org.onap.k8s.controlloop.HttpControlLoopParticipant:
+ org.onap.k8s.acm.HttpAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for Http requests
properties:
provider: ONAP
- org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement:
+ org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement:
# Http config for PMSH.
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.HttpControlLoopElement
+ type: org.onap.policy.clamp.acm.HttpAutomationCompositionElement
type_version: 1.0.1
- description: Control loop element for the http requests of PMSH microservice
+ description: Automation composition element for the http requests of PMSH microservice
properties:
provider: ONAP
participantType:
- name: org.onap.controlloop.HttpControlLoopParticipant
+ name: org.onap.acm.HttpAutomationCompositionParticipant
version: 2.3.4
startPhase: 1
uninitializedToPassiveTimeout: 180
@@ -208,13 +208,13 @@ topology_template:
expectedResponse: 200
- org.onap.domain.sample.GenericK8s_ControlLoopDefinition:
+ org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acm.AutomationComposition
type_version: 1.0.0
- description: Control loop for HTTP request
+ description: Automation composition for HTTP request
properties:
provider: ONAP
elements:
- - name: org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement
+ - name: org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement
version: 1.2.3
diff --git a/participant/participant-impl/participant-impl-http/src/test/resources/application_test.properties b/participant/participant-impl/participant-impl-http/src/test/resources/application_test.properties
index 698a965b8..e9f3b37cb 100644
--- a/participant/participant-impl/participant-impl-http/src/test/resources/application_test.properties
+++ b/participant/participant-impl/participant-impl-http/src/test/resources/application_test.properties
@@ -1,24 +1,24 @@
spring.security.user.name=participantUser
spring.security.user.password=zb!XztG34
-server.servlet.context-path=/onap/httpparticipant
+server.servlet.context-path=/onap/policy/clamp/acm/httpparticipant
server.error.path=/error
server.http-port=8084
-participant.name=ControlLoopParticipant Http Test
+participant.name=AutomationCompositionParticipant Http Test
participant.intermediaryParameters.name=Participant parameters
participant.intermediaryParameters.reportingTimeInterval=120000
participant.intermediaryParameters.description=Participant Description
participant.intermediaryParameters.participantId.name=HttpParticipant0
participant.intermediaryParameters.participantId.version=1.0.0
-participant.intermediaryParameters.participantType.name=org.onap.k8s.controlloop.HttpControlLoopParticipant
+participant.intermediaryParameters.participantType.name=org.onap.clamp.acm.HttpParticipant
participant.intermediaryParameters.participantType.version=2.3.4
-participant.intermediaryParameters.clampControlLoopTopics.name=ControlLoop Topics
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topic=POLICY-CLRUNTIME-PARTICIPANT
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].servers[0]=localhost
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topicCommInfrastructure=dmaap
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].fetchTimeout=15000
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topic=POLICY-CLRUNTIME-PARTICIPANT
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].servers[0]=localhost
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampAutomationCompositionTopics.name=AutomationComposition Topics
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topic=POLICY-ACRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].servers[0]=localhost
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].fetchTimeout=15000
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topic=POLICY-ACRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].servers[0]=localhost
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topicCommInfrastructure=dmaap
management.endpoints.web.exposure.include=health,metrics,prometheus
diff --git a/participant/participant-impl/participant-impl-kubernetes/pom.xml b/participant/participant-impl/participant-impl-kubernetes/pom.xml
index 6bbf01757..e92021b92 100644
--- a/participant/participant-impl/participant-impl-kubernetes/pom.xml
+++ b/participant/participant-impl/participant-impl-kubernetes/pom.xml
@@ -30,7 +30,7 @@
<artifactId>policy-clamp-participant-impl-kubernetes</artifactId>
<name>${project.artifactId}</name>
- <description>Kubernetes participant, that allows k8s pods to partake in control loops</description>
+ <description>Kubernetes participant, that allows k8s pods to partake in automation compositions</description>
<!-- Dependency added here to take precedence over Mockito-core in parent pom-->
<dependencies>
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/Application.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/Application.java
index 5d9d203fe..6908b2760 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/Application.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/Application.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes;
+package org.onap.policy.clamp.acm.participant.kubernetes;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -29,10 +29,14 @@ import org.springframework.context.annotation.ComponentScan;
* Starter.
*
*/
+// @formatter:off
@SpringBootApplication
-@ComponentScan({"org.onap.policy.clamp.controlloop.participant.kubernetes",
- "org.onap.policy.clamp.controlloop.participant.intermediary"})
-@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.kubernetes.parameters")
+@ComponentScan({
+ "org.onap.policy.clamp.acm.participant.kubernetes",
+ "org.onap.policy.clamp.acm.participant.intermediary"
+})
+@ConfigurationPropertiesScan("org.onap.policy.clamp.acm.participant.kubernetes.parameters")
+//@formatter:on
public class Application {
/**
* Main class.
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantConfig.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/ParticipantConfig.java
index 54627d557..428819be9 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantConfig.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/ParticipantConfig.java
@@ -18,7 +18,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.configurations;
+package org.onap.policy.clamp.acm.participant.kubernetes.configurations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantIntermediaryConfig.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/ParticipantIntermediaryConfig.java
index bfbed66b7..878b43f48 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantIntermediaryConfig.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/ParticipantIntermediaryConfig.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.configurations;
+package org.onap.policy.clamp.acm.participant.kubernetes.configurations;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.handler.ControlLoopElementHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.kubernetes.handler.AutomationCompositionElementHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@@ -29,15 +29,15 @@ import org.springframework.context.annotation.Configuration;
public class ParticipantIntermediaryConfig {
/**
- * Register ControlLoopElementListener.
+ * Register AutomationCompositionElementListener.
*
* @param intermediaryApi the ParticipantIntermediaryApi
- * @param clElementHandler the ControlLoop Element Handler
+ * @param acElementHandler the AutomationComposition Element Handler
*/
@Autowired
- public void registerControlLoopElementListener(ParticipantIntermediaryApi intermediaryApi,
- ControlLoopElementHandler clElementHandler) {
- intermediaryApi.registerControlLoopElementListener(clElementHandler);
- clElementHandler.setIntermediaryApi(intermediaryApi);
+ public void registerAutomationCompositionElementListener(ParticipantIntermediaryApi intermediaryApi,
+ AutomationCompositionElementHandler acElementHandler) {
+ intermediaryApi.registerAutomationCompositionElementListener(acElementHandler);
+ acElementHandler.setIntermediaryApi(intermediaryApi);
}
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/SecurityConfig.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/SecurityConfig.java
index 6b4fb0a75..da5762b43 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/SecurityConfig.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/SecurityConfig.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.configurations;
+package org.onap.policy.clamp.acm.participant.kubernetes.configurations;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/SpringFoxConfig.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/SpringFoxConfig.java
index 09a497705..cfa98bd65 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/SpringFoxConfig.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/SpringFoxConfig.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.configurations;
+package org.onap.policy.clamp.acm.participant.kubernetes.configurations;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.controller.ChartController;
+import org.onap.policy.clamp.acm.participant.kubernetes.controller.ChartController;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/controller/ChartController.java
index e2ccda4d5..19ab4bbab 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/controller/ChartController.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.controller;
+package org.onap.policy.clamp.acm.participant.kubernetes.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -24,12 +24,12 @@ import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import java.io.IOException;
import java.util.ArrayList;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartList;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.HelmRepository;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.InstallationInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.service.ChartService;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartList;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.HelmRepository;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.InstallationInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.service.ChartService;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/exception/ServiceException.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/exception/ServiceException.java
index 9a825cf75..6414f2fa9 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/exception/ServiceException.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/exception/ServiceException.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.exception;
+package org.onap.policy.clamp.acm.participant.kubernetes.exception;
public class ServiceException extends Exception {
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
index a8a746254..753608686 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.handler;
+package org.onap.policy.clamp.acm.participant.kubernetes.handler;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
@@ -34,17 +34,17 @@ import java.util.concurrent.Future;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.helm.PodStatusValidator;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.service.ChartService;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.helm.PodStatusValidator;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.service.ChartService;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -57,10 +57,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
- * This class handles implementation of controlLoopElement updates.
+ * This class handles implementation of automationCompositionElement updates.
*/
@Component
-public class ControlLoopElementHandler implements ControlLoopElementListener {
+public class AutomationCompositionElementHandler implements AutomationCompositionElementListener {
private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
@@ -76,7 +76,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
@Setter
private ParticipantIntermediaryApi intermediaryApi;
- // Map of CLElement Id and installed Helm charts
+ // Map of acElement Id and installed Helm charts
@Getter(AccessLevel.PACKAGE)
private final Map<UUID, ChartInfo> chartMap = new HashMap<>();
@@ -87,26 +87,27 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
}
/**
- * Callback method to handle a control loop element state change.
+ * Callback method to handle a automation composition element state change.
*
- * @param controlLoopElementId the ID of the control loop element
- * @param currentState the current state of the control loop element
- * @param newState the state to which the control loop element is changing to
+ * @param automationCompositionElementId the ID of the automation composition element
+ * @param currentState the current state of the automation composition element
+ * @param newState the state to which the automation composition element is changing to
*/
@Override
- public synchronized void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId,
- UUID controlLoopElementId, ControlLoopState currentState, ControlLoopOrderedState newState) {
+ public synchronized void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ UUID automationCompositionElementId, AutomationCompositionState currentState,
+ AutomationCompositionOrderedState newState) {
switch (newState) {
case UNINITIALISED:
- ChartInfo chart = chartMap.get(controlLoopElementId);
+ ChartInfo chart = chartMap.get(automationCompositionElementId);
if (chart != null) {
LOGGER.info("Helm deployment to be deleted {} ", chart.getReleaseName());
try {
chartService.uninstallChart(chart);
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.UNINITIALISED,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- chartMap.remove(controlLoopElementId);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.UNINITIALISED,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
+ chartMap.remove(automationCompositionElementId);
podStatusMap.remove(chart.getReleaseName());
} catch (ServiceException se) {
LOGGER.warn("Deletion of Helm deployment failed", se);
@@ -114,14 +115,14 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
}
break;
case PASSIVE:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
break;
case RUNNING:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.RUNNING,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.RUNNING,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
break;
default:
LOGGER.warn("Cannot transition from state {} to state {}", currentState, newState);
@@ -129,29 +130,27 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
}
}
-
/**
- * Callback method to handle an update on a control loop element.
+ * Callback method to handle an update on a automation composition element.
*
- * @param element the information on the control loop element
+ * @param element the information on the automation composition element
* @param nodeTemplate toscaNodeTemplate
* @throws PfModelException in case of an exception
*/
@Override
- public synchronized void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId,
- ControlLoopElement element, ToscaNodeTemplate nodeTemplate) throws PfModelException {
+ public synchronized void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
+ AutomationCompositionElement element, ToscaNodeTemplate nodeTemplate) throws PfModelException {
@SuppressWarnings("unchecked")
- Map<String, Object> chartData =
- (Map<String, Object>) nodeTemplate.getProperties().get("chart");
+ Map<String, Object> chartData = (Map<String, Object>) nodeTemplate.getProperties().get("chart");
LOGGER.info("Installation request received for the Helm Chart {} ", chartData);
try {
- var chartInfo = CODER.convert(chartData, ChartInfo.class);
+ var chartInfo = CODER.convert(chartData, ChartInfo.class);
chartService.installChart(chartInfo);
chartMap.put(element.getId(), chartInfo);
var config = CODER.convert(nodeTemplate.getProperties(), ThreadConfig.class);
- checkPodStatus(controlLoopId, element.getId(), chartInfo, config.uninitializedToPassiveTimeout,
+ checkPodStatus(automationCompositionId, element.getId(), chartInfo, config.uninitializedToPassiveTimeout,
config.podStatusCheckInterval);
} catch (ServiceException | CoderException | IOException | ExecutionException
@@ -162,6 +161,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
/**
* Invoke a new thread to check the status of deployed pods.
+ *
* @param chart ChartInfo
*/
public void checkPodStatus(ToscaConceptIdentifier controlLoopId, UUID elementId,
@@ -171,26 +171,27 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
podStatusCheckInterval), "Done");
if (!result.get().isEmpty()) {
LOGGER.info("Pod Status Validator Completed: {}", result.isDone());
- intermediaryApi.updateControlLoopElementState(controlLoopId, elementId,
- ControlLoopOrderedState.PASSIVE, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(controlLoopId, elementId,
+ AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
}
}
/**
* Overridden method.
*
- * @param controlLoopElementId controlLoopElement id
+ * @param automationCompositionElementId automationCompositionElement id
* @throws PfModelException in case of error
*/
@Override
- public synchronized void handleStatistics(UUID controlLoopElementId) throws PfModelException {
- var clElement = intermediaryApi.getControlLoopElement(controlLoopElementId);
- if (clElement != null) {
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setControlLoopState(clElement.getState());
- clElementStatistics.setTimeStamp(Instant.now());
- intermediaryApi.updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics);
+ public synchronized void handleStatistics(UUID automationCompositionElementId) throws PfModelException {
+ var acElement = intermediaryApi.getAutomationCompositionElement(automationCompositionElementId);
+ if (acElement != null) {
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setState(acElement.getState());
+ acElementStatistics.setTimeStamp(Instant.now());
+ intermediaryApi.updateAutomationCompositionElementStatistics(automationCompositionElementId,
+ acElementStatistics);
}
}
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClient.java
index 6133c7ebd..87199688e 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClient.java
@@ -18,7 +18,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.helm;
+package org.onap.policy.clamp.acm.participant.kubernetes.helm;
import java.io.File;
import java.io.IOException;
@@ -28,10 +28,10 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.HelmRepository;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.service.ChartStore;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.HelmRepository;
+import org.onap.policy.clamp.acm.participant.kubernetes.service.ChartStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/PodStatusValidator.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidator.java
index d55fd6658..f8b08a6be 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/PodStatusValidator.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidator.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.helm;
+package org.onap.policy.clamp.acm.participant.kubernetes.helm;
import java.io.BufferedReader;
import java.io.IOException;
@@ -27,9 +27,9 @@ import java.util.HashMap;
import java.util.Map;
import lombok.SneakyThrows;
import org.apache.commons.io.IOUtils;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.handler.ControlLoopElementHandler;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.handler.AutomationCompositionElementHandler;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -77,12 +77,12 @@ public class PodStatusValidator implements Runnable {
if (! isVerified) {
logger.info("Waiting for the pods to be active for the chart {}", chart.getChartId().getName());
podStatusMap.forEach((key, value) -> logger.info("Pod: {} , state: {}", key, value));
- ControlLoopElementHandler.getPodStatusMap().put(chart.getReleaseName(), podStatusMap);
+ AutomationCompositionElementHandler.getPodStatusMap().put(chart.getReleaseName(), podStatusMap);
// Recheck status of pods in specific intervals.
Thread.sleep(statusCheckInterval * 1000L);
} else {
logger.info("All pods are in running state for the helm chart {}", chart.getChartId().getName());
- ControlLoopElementHandler.getPodStatusMap().put(chart.getReleaseName(), podStatusMap);
+ AutomationCompositionElementHandler.getPodStatusMap().put(chart.getReleaseName(), podStatusMap);
}
} catch (ServiceException | IOException e) {
throw new ServiceException("Error verifying the status of the pod. Exiting", e);
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/ChartInfo.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/ChartInfo.java
index 5cbc203ec..b925e782d 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/ChartInfo.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/ChartInfo.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.models;
+package org.onap.policy.clamp.acm.participant.kubernetes.models;
import java.util.Map;
import lombok.Data;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/ChartList.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/ChartList.java
index 7f46bbde5..951bdaa1b 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/ChartList.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/ChartList.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.models;
+package org.onap.policy.clamp.acm.participant.kubernetes.models;
import java.util.List;
import lombok.Builder;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/HelmRepository.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/HelmRepository.java
index a495c7b5c..2e25e42a6 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/HelmRepository.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/HelmRepository.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.models;
+package org.onap.policy.clamp.acm.participant.kubernetes.models;
import lombok.Builder;
import lombok.Data;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/InstallationInfo.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/InstallationInfo.java
index b21e93a01..6ef6865cb 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/models/InstallationInfo.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/models/InstallationInfo.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.models;
+package org.onap.policy.clamp.acm.participant.kubernetes.models;
import lombok.Getter;
import org.immutables.gson.Gson;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/ParticipantK8sParameters.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParameters.java
index 3b2b3732b..b95756ec5 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/ParticipantK8sParameters.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParameters.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.parameters;
+package org.onap.policy.clamp.acm.participant.kubernetes.parameters;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartService.java
index a07fca596..344d161b7 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartService.java
@@ -16,15 +16,15 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.service;
+package org.onap.policy.clamp.acm.participant.kubernetes.service;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.Collection;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.helm.HelmClient;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.HelmRepository;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.helm.HelmClient;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.HelmRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStore.java
index ed53d0352..52c1b1f04 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStore.java
@@ -18,7 +18,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.service;
+package org.onap.policy.clamp.acm.participant.kubernetes.service;
import java.io.File;
import java.io.FileOutputStream;
@@ -37,9 +37,9 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import lombok.AccessLevel;
import lombok.Getter;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.parameters.ParticipantK8sParameters;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.parameters.ParticipantK8sParameters;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml
index b266fe337..3be0fb2c0 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml
@@ -13,22 +13,22 @@ participant:
reportingTimeIntervalMs: 120000
description: Participant Description
participantId:
- name: K8sParticipant0
- version: 1.0.0
+ name: org.onap.policy.clamp.acm.KubernetesParticipant
+ version: 2.3.4
participantType:
- name: org.onap.k8s.controlloop.K8sControlLoopParticipant
+ name: org.onap.k8s.acm.K8SAutomationCompositionParticipant
version: 2.3.4
- clampControlLoopTopics:
+ clampAutomationCompositionTopics:
topicSources:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:localhost}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
topicSinks:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:localhost}
topicCommInfrastructure: dmaap
@@ -41,7 +41,7 @@ management:
server:
port: 8083
servlet:
- context-path: /onap/k8sparticipant
+ context-path: /onap/policy/clamp/acm/k8sparticipant
logging:
# Configuration of logging
@@ -50,7 +50,7 @@ logging:
org.springframework: ERROR
org.springframework.data: ERROR
org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
- org.onap.policy.clamp.controlloop.participant.kubernetes: INFO
+ org.onap.policy.clamp.acm.participant.kubernetes: INFO
file:
name: /var/log/onap/policy/clamp/application.log
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
new file mode 100644
index 000000000..dc74afc1a
--- /dev/null
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
@@ -0,0 +1,182 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.kubernetes.handler;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartList;
+import org.onap.policy.clamp.acm.participant.kubernetes.parameters.CommonTestData;
+import org.onap.policy.clamp.acm.participant.kubernetes.service.ChartService;
+import org.onap.policy.clamp.acm.participant.kubernetes.utils.TestUtils;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+@ExtendWith(SpringExtension.class)
+class AutomationCompositionElementHandlerTest {
+
+ private static final Coder CODER = new StandardCoder();
+ private static final String CHART_INFO_YAML = "src/test/resources/ChartList.json";
+ private static final String KEY_NAME =
+ "org.onap.domain.database.HelloWorld_K8SMicroserviceAutomationCompositionElement";
+ private static List<ChartInfo> charts;
+ private static ToscaServiceTemplate toscaServiceTemplate;
+ private static final String K8S_AUTOMATION_COMPOSITION_ELEMENT =
+ "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement";
+ private CommonTestData commonTestData = new CommonTestData();
+
+ @InjectMocks
+ @Spy
+ private AutomationCompositionElementHandler automationCompositionElementHandler =
+ new AutomationCompositionElementHandler();
+
+ @Mock
+ private ChartService chartService;
+
+ @Mock
+ private ParticipantIntermediaryApi participantIntermediaryApi;
+
+ @Mock
+ private ExecutorService executor;
+ @Mock
+ private Future<String> result;
+
+ @BeforeAll
+ static void init() throws CoderException {
+ charts = CODER.decode(new File(CHART_INFO_YAML), ChartList.class).getCharts();
+ toscaServiceTemplate = TestUtils.testAutomationCompositionRead();
+ }
+
+ @Test
+ void test_AutomationCompositionElementStateChange() throws ServiceException {
+ UUID automationCompositionElementId1 = UUID.randomUUID();
+ UUID automationCompositionElementId2 = UUID.randomUUID();
+
+ automationCompositionElementHandler.getChartMap().put(automationCompositionElementId1, charts.get(0));
+ automationCompositionElementHandler.getChartMap().put(automationCompositionElementId2, charts.get(1));
+
+ doNothing().when(chartService).uninstallChart(charts.get(0));
+
+ automationCompositionElementHandler.automationCompositionElementStateChange(
+ commonTestData.getAutomationCompositionId(), automationCompositionElementId1,
+ AutomationCompositionState.PASSIVE, AutomationCompositionOrderedState.UNINITIALISED);
+
+ doThrow(new ServiceException("Error uninstalling the chart")).when(chartService).uninstallChart(charts.get(0));
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
+ commonTestData.getAutomationCompositionId(), automationCompositionElementId1,
+ AutomationCompositionState.PASSIVE, AutomationCompositionOrderedState.PASSIVE));
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
+ commonTestData.getAutomationCompositionId(), automationCompositionElementId1,
+ AutomationCompositionState.PASSIVE, AutomationCompositionOrderedState.UNINITIALISED));
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
+ commonTestData.getAutomationCompositionId(), automationCompositionElementId1,
+ AutomationCompositionState.PASSIVE, AutomationCompositionOrderedState.RUNNING));
+
+ }
+
+ @Test
+ void test_AutomationCompositionElementUpdate() throws PfModelException, IOException, ServiceException,
+ ExecutionException, InterruptedException {
+ doNothing().when(automationCompositionElementHandler).checkPodStatus(any(), any(), any(), anyInt(), anyInt());
+ UUID elementId1 = UUID.randomUUID();
+ AutomationCompositionElement element = new AutomationCompositionElement();
+ element.setId(elementId1);
+ element.setDefinition(new ToscaConceptIdentifier(KEY_NAME, "1.0.1"));
+ element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+
+ Map<String, ToscaNodeTemplate> nodeTemplatesMap =
+ toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ automationCompositionElementHandler.automationCompositionElementUpdate(
+ commonTestData.getAutomationCompositionId(), element,
+ nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT));
+
+ assertThat(automationCompositionElementHandler.getChartMap()).hasSize(1).containsKey(elementId1);
+
+ doThrow(new ServiceException("Error installing the chart")).when(chartService).installChart(Mockito.any());
+
+ UUID elementId2 = UUID.randomUUID();
+ element.setId(elementId2);
+ automationCompositionElementHandler.automationCompositionElementUpdate(
+ commonTestData.getAutomationCompositionId(), element,
+ nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT));
+
+ assertThat(automationCompositionElementHandler.getChartMap().containsKey(elementId2)).isFalse();
+ }
+
+ @Test
+ void test_handleStatistics() throws PfModelException {
+ UUID elementId1 = UUID.randomUUID();
+ automationCompositionElementHandler.getChartMap().put(elementId1, charts.get(0));
+ when(participantIntermediaryApi.getAutomationCompositionElement(elementId1))
+ .thenReturn(new AutomationCompositionElement());
+ assertDoesNotThrow(() -> automationCompositionElementHandler.handleStatistics(elementId1));
+ }
+
+ @Test
+ void test_checkPodStatus() throws ExecutionException, InterruptedException {
+ doReturn(result).when(executor).submit(any(Runnable.class), any());
+ doReturn("Done").when(result).get();
+ doReturn(true).when(result).isDone();
+ var chartInfo = charts.get(0);
+ ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier();
+ AutomationCompositionElement element = new AutomationCompositionElement();
+ assertDoesNotThrow(
+ () -> automationCompositionElementHandler.checkPodStatus(controlLoopId, element.getId(), chartInfo,
+ 1, 1));
+ }
+}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java
index 335dbcb21..7f1943c97 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.helm;
+package org.onap.policy.clamp.acm.participant.kubernetes.helm;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -44,11 +44,11 @@ import org.mockito.Mock;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.Spy;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartList;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.HelmRepository;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.service.ChartStore;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartList;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.HelmRepository;
+import org.onap.policy.clamp.acm.participant.kubernetes.service.ChartStore;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/PodStatusValidatorTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidatorTest.java
index 18c32d474..89b077044 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/PodStatusValidatorTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidatorTest.java
@@ -19,9 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.helm;
-
-
+package org.onap.policy.clamp.acm.participant.kubernetes.helm;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -39,10 +37,10 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.MockedStatic;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.handler.ControlLoopElementHandler;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartList;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.handler.AutomationCompositionElementHandler;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartList;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -74,7 +72,7 @@ class PodStatusValidatorTest {
@AfterEach
void clearPodStatusMap() {
- ControlLoopElementHandler.getPodStatusMap().clear();
+ AutomationCompositionElementHandler.getPodStatusMap().clear();
}
@AfterAll
@@ -89,9 +87,9 @@ class PodStatusValidatorTest {
mockedClient.when(() -> HelmClient.executeCommand(any()))
.thenReturn(runningPod);
assertDoesNotThrow(() -> podStatusValidator.run());
- assertThat(ControlLoopElementHandler.getPodStatusMap()).hasSize(1);
- assertThat(ControlLoopElementHandler.getPodStatusMap()).containsKey(charts.get(0).getReleaseName());
- assertThat(ControlLoopElementHandler.getPodStatusMap())
+ assertThat(AutomationCompositionElementHandler.getPodStatusMap()).hasSize(1);
+ assertThat(AutomationCompositionElementHandler.getPodStatusMap()).containsKey(charts.get(0).getReleaseName());
+ assertThat(AutomationCompositionElementHandler.getPodStatusMap())
.containsValue(Map.of("HelloWorld-54777df9f8-qpzqr", "Running"));
}
@@ -103,7 +101,7 @@ class PodStatusValidatorTest {
.thenReturn(invalidPod);
assertThatThrownBy(() -> podStatusValidator.run())
.isInstanceOf(ServiceException.class).hasMessage("Error verifying the status of the pod. Exiting");
- assertThat(ControlLoopElementHandler.getPodStatusMap()).isEmpty();
+ assertThat(AutomationCompositionElementHandler.getPodStatusMap()).isEmpty();
}
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
index f6ec401b8..13f8edc15 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.parameters;
+package org.onap.policy.clamp.acm.participant.kubernetes.parameters;
import java.util.Arrays;
import java.util.List;
@@ -33,7 +33,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
public class CommonTestData {
- public static final String PARTICIPANT_GROUP_NAME = "ControlLoopParticipantGroup";
+ public static final String PARTICIPANT_GROUP_NAME = "AutomationCompositionParticipantGroup";
public static final String DESCRIPTION = "Participant description";
public static final long TIME_INTERVAL = 2000;
public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams());
@@ -104,7 +104,7 @@ public class CommonTestData {
map.put("description", DESCRIPTION);
map.put("participantId", getParticipantId());
map.put("participantType", getParticipantId());
- map.put("clampControlLoopTopics", getTopicParametersMap(false));
+ map.put("clampAutomationCompositionTopics", getTopicParametersMap(false));
}
return map;
@@ -145,17 +145,17 @@ public class CommonTestData {
*/
public static TopicParameters getTopicParams() {
final TopicParameters topicParams = new TopicParameters();
- topicParams.setTopic("POLICY-CLRUNTIME-PARTICIPANT");
+ topicParams.setTopic("POLICY-ACRUNTIME-PARTICIPANT");
topicParams.setTopicCommInfrastructure("dmaap");
topicParams.setServers(Arrays.asList("localhost"));
return topicParams;
}
/**
- * Get controlloop id.
- * @return ToscaConceptIdentifier controlLoopId
+ * Get automation composition id.
+ * @return ToscaConceptIdentifier automationCompositionId
*/
- public ToscaConceptIdentifier getControlLoopId() {
+ public ToscaConceptIdentifier getAutomationCompositionId() {
return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
}
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/ParticipantK8sParametersTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java
index f22fc711e..09ea74afe 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/ParticipantK8sParametersTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.parameters;
+package org.onap.policy.clamp.acm.participant.kubernetes.parameters;
import static org.assertj.core.api.Assertions.assertThat;
@@ -43,14 +43,14 @@ class ParticipantK8sParametersTest {
@Test
void testParticipantK8sParameters_NullTopicSinks() {
final ParticipantK8sParameters participantParameters = commonTestData.getParticipantK8sParameters();
- participantParameters.getIntermediaryParameters().getClampControlLoopTopics().setTopicSinks(null);
+ participantParameters.getIntermediaryParameters().getClampAutomationCompositionTopics().setTopicSinks(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
@Test
void testParticipantK8sParameters_NullTopicSources() {
final ParticipantK8sParameters participantParameters = commonTestData.getParticipantK8sParameters();
- participantParameters.getIntermediaryParameters().getClampControlLoopTopics().setTopicSources(null);
+ participantParameters.getIntermediaryParameters().getClampAutomationCompositionTopics().setTopicSources(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java
index 1442e9f1f..8d05d2bf6 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ActuatorControllerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.rest;
+package org.onap.policy.clamp.acm.participant.kubernetes.rest;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -27,7 +27,7 @@ import javax.ws.rs.core.Response;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.utils.CommonActuatorController;
+import org.onap.policy.clamp.acm.participant.kubernetes.utils.CommonActuatorController;
import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ChartControllerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
index 8048b19ce..73c5c98a1 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ChartControllerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.rest;
+package org.onap.policy.clamp.acm.participant.kubernetes.rest;
import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Mockito.doNothing;
@@ -38,11 +38,11 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.controller.ChartController;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartList;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.parameters.ParticipantK8sParameters;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.service.ChartService;
+import org.onap.policy.clamp.acm.participant.kubernetes.controller.ChartController;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartList;
+import org.onap.policy.clamp.acm.participant.kubernetes.parameters.ParticipantK8sParameters;
+import org.onap.policy.clamp.acm.participant.kubernetes.service.ChartService;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartServiceTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartServiceTest.java
index f1c8d19df..f5b6093d3 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartServiceTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartServiceTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.service;
+package org.onap.policy.clamp.acm.participant.kubernetes.service;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -42,10 +42,10 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.helm.HelmClient;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartList;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.helm.HelmClient;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartList;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStoreTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java
index 54f1cc528..180861bae 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStoreTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.service;
+package org.onap.policy.clamp.acm.participant.kubernetes.service;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -40,10 +40,10 @@ import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartList;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.parameters.ParticipantK8sParameters;
+import org.onap.policy.clamp.acm.participant.kubernetes.exception.ServiceException;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartInfo;
+import org.onap.policy.clamp.acm.participant.kubernetes.models.ChartList;
+import org.onap.policy.clamp.acm.participant.kubernetes.parameters.ParticipantK8sParameters;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java
index 5ebce8126..e5a5be9fa 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/CommonActuatorController.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.utils;
+package org.onap.policy.clamp.acm.participant.kubernetes.utils;
import static org.junit.Assert.assertEquals;
@@ -40,7 +40,7 @@ import org.onap.policy.common.utils.network.NetworkUtil;
public class CommonActuatorController {
public static final String SELF = NetworkUtil.getHostname();
- public static final String CONTEXT_PATH = "onap/httpparticipant";
+ public static final String CONTEXT_PATH = "onap/policy/clamp/acm/k8sparticipant";
public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/";
private static String httpPrefix;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/utils/TestUtils.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java
index af514f8aa..8f4969a9b 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/utils/TestUtils.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.utils;
+package org.onap.policy.clamp.acm.participant.kubernetes.utils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@@ -33,15 +33,15 @@ public final class TestUtils {
private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
private static final String TOSCA_TEMPLATE_YAML = "src/test/resources/servicetemplates/KubernetesHelm.yaml";
-
- public static ToscaServiceTemplate testControlLoopRead() {
- return testControlLoopYamlSerialization(TOSCA_TEMPLATE_YAML);
+ public static ToscaServiceTemplate testAutomationCompositionRead() {
+ return testAutomationCompositionYamlSerialization(TOSCA_TEMPLATE_YAML);
}
-
- private static ToscaServiceTemplate testControlLoopYamlSerialization(String controlLoopFilePath) {
- String controlLoopString = ResourceUtils.getResourceAsString(controlLoopFilePath);
- ToscaServiceTemplate serviceTemplate = yamlTranslator.fromYaml(controlLoopString, ToscaServiceTemplate.class);
+ private static ToscaServiceTemplate testAutomationCompositionYamlSerialization(
+ String automationCompositionFilePath) {
+ String automationCompositionString = ResourceUtils.getResourceAsString(automationCompositionFilePath);
+ ToscaServiceTemplate serviceTemplate =
+ yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class);
return serviceTemplate;
}
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java
deleted file mode 100644
index 805404b90..000000000
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.kubernetes.handler;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.when;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.Spy;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartList;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.parameters.CommonTestData;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.service.ChartService;
-import org.onap.policy.clamp.controlloop.participant.kubernetes.utils.TestUtils;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-
-@ExtendWith(SpringExtension.class)
-class ControlLoopElementHandlerTest {
-
- private static final Coder CODER = new StandardCoder();
- private static final String CHART_INFO_YAML = "src/test/resources/ChartList.json";
- private static final String KEY_NAME = "org.onap.domain.database.HelloWorld_K8SMicroserviceControlLoopElement";
- private static List<ChartInfo> charts;
- private static ToscaServiceTemplate toscaServiceTemplate;
- private static final String K8S_CONTROL_LOOP_ELEMENT =
- "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement";
- private CommonTestData commonTestData = new CommonTestData();
-
- @InjectMocks
- @Spy
- private ControlLoopElementHandler controlLoopElementHandler = new ControlLoopElementHandler();
-
- @Mock
- private ChartService chartService;
-
- @Mock
- private ParticipantIntermediaryApi participantIntermediaryApi;
-
- @Mock
- private ExecutorService executor;
-
- @Mock
- private Future<String> result;
-
- @BeforeAll
- static void init() throws CoderException {
- charts = CODER.decode(new File(CHART_INFO_YAML), ChartList.class).getCharts();
- toscaServiceTemplate = TestUtils.testControlLoopRead();
- }
-
-
- @Test
- void test_ControlLoopElementStateChange() throws ServiceException {
- UUID controlLoopElementId1 = UUID.randomUUID();
- UUID controlLoopElementId2 = UUID.randomUUID();
-
- controlLoopElementHandler.getChartMap().put(controlLoopElementId1, charts.get(0));
- controlLoopElementHandler.getChartMap().put(controlLoopElementId2, charts.get(1));
-
- doNothing().when(chartService).uninstallChart(charts.get(0));
-
- controlLoopElementHandler.controlLoopElementStateChange(commonTestData.getControlLoopId(),
- controlLoopElementId1, ControlLoopState.PASSIVE, ControlLoopOrderedState.UNINITIALISED);
-
- doThrow(new ServiceException("Error uninstalling the chart")).when(chartService)
- .uninstallChart(charts.get(0));
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(commonTestData.getControlLoopId(), controlLoopElementId1,
- ControlLoopState.PASSIVE, ControlLoopOrderedState.PASSIVE));
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(commonTestData.getControlLoopId(), controlLoopElementId1,
- ControlLoopState.PASSIVE, ControlLoopOrderedState.UNINITIALISED));
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(commonTestData.getControlLoopId(), controlLoopElementId1,
- ControlLoopState.PASSIVE, ControlLoopOrderedState.RUNNING));
-
- }
-
- @Test
- void test_ControlLoopElementUpdate() throws PfModelException, IOException, ServiceException,
- ExecutionException, InterruptedException {
- doNothing().when(controlLoopElementHandler).checkPodStatus(any(), any(), any(), anyInt(), anyInt());
- UUID elementId1 = UUID.randomUUID();
- ControlLoopElement element = new ControlLoopElement();
- element.setId(elementId1);
- element.setDefinition(new ToscaConceptIdentifier(KEY_NAME, "1.0.1"));
- element.setOrderedState(ControlLoopOrderedState.PASSIVE);
-
- Map<String, ToscaNodeTemplate> nodeTemplatesMap =
- toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- controlLoopElementHandler.controlLoopElementUpdate(commonTestData.getControlLoopId(), element,
- nodeTemplatesMap.get(K8S_CONTROL_LOOP_ELEMENT));
-
- assertThat(controlLoopElementHandler.getChartMap()).hasSize(1).containsKey(elementId1);
-
- doThrow(new ServiceException("Error installing the chart")).when(chartService)
- .installChart(Mockito.any());
-
- UUID elementId2 = UUID.randomUUID();
- element.setId(elementId2);
- controlLoopElementHandler.controlLoopElementUpdate(commonTestData.getControlLoopId(), element,
- nodeTemplatesMap.get(K8S_CONTROL_LOOP_ELEMENT));
-
- assertThat(controlLoopElementHandler.getChartMap().containsKey(elementId2)).isFalse();
- }
-
- @Test
- void test_handleStatistics() throws PfModelException {
- UUID elementId1 = UUID.randomUUID();
- controlLoopElementHandler.getChartMap().put(elementId1, charts.get(0));
- when(participantIntermediaryApi.getControlLoopElement(elementId1)).thenReturn(new ControlLoopElement());
- assertDoesNotThrow(() -> controlLoopElementHandler.handleStatistics(elementId1));
- }
-
- @Test
- void test_checkPodStatus() throws ExecutionException, InterruptedException {
- doReturn(result).when(executor).submit(any(Runnable.class), any());
- doReturn("Done").when(result).get();
- doReturn(true).when(result).isDone();
- var chartInfo = charts.get(0);
- ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier();
- ControlLoopElement element = new ControlLoopElement();
- assertDoesNotThrow(() -> controlLoopElementHandler.checkPodStatus(controlLoopId, element.getId(), chartInfo,
- 1, 1));
- }
-}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application_test.properties b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application_test.properties
index b5b209fd1..243512166 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application_test.properties
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application_test.properties
@@ -1,24 +1,24 @@
spring.security.user.name=participantUser
spring.security.user.password=zb!XztG34
-server.servlet.context-path=/onap/k8sparticipant
+server.servlet.context-path=/onap/policy/clamp/acm/k8sparticipant
server.error.path=/error
server.http-port=8083
-participant.name=ControlLoopParticipant Kubernetes Test
+participant.name=AutomationCompositionParticipant Kubernetes Test
participant.intermediaryParameters.name=Participant parameters
participant.intermediaryParameters.reportingTimeInterval=120000
participant.intermediaryParameters.description=Participant Description
participant.intermediaryParameters.participantId.name=K8sParticipant0
participant.intermediaryParameters.participantId.version=1.0.0
-participant.intermediaryParameters.participantType.name=org.onap.k8s.controlloop.K8SControlLoopParticipant
+participant.intermediaryParameters.participantType.name=org.onap.k8s.acm.K8SAutomationCompositionParticipant
participant.intermediaryParameters.participantType.version=2.3.4
-participant.intermediaryParameters.clampControlLoopTopics.name=ControlLoop Topics
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topic=POLICY-CLRUNTIME-PARTICIPANT
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].servers[0]=localhost
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topicCommInfrastructure=dmaap
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].fetchTimeout=15000
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topic=POLICY-CLRUNTIME-PARTICIPANT
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].servers[0]=localhost
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampAutomationCompositionTopics.name=AutomationComposition Topics
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topic=POLICY-ACRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].servers[0]=localhost
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].fetchTimeout=15000
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topic=POLICY-ACRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].servers[0]=localhost
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topicCommInfrastructure=dmaap
management.endpoints.web.exposure.include=health,metrics,prometheus
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 7d594019a..f5eb6233f 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
@@ -27,14 +27,14 @@ data_types:
type: string
required: true
node_types:
- org.onap.policy.clamp.controlloop.Participant:
+ org.onap.policy.clamp.acm.Participant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
requred: false
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -51,11 +51,11 @@ node_types:
- 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:
+ description: A value indicating the start phase in which this automation composition element will be started,
+ the first start phase is zero. Automation Composition Elements are started in their start_phase
+ order and stopped in reverse start phase order. Automation Composition Elements with the same start
+ phase are started and stopped simultaneously
+ org.onap.policy.clamp.acm.AutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -67,9 +67,9 @@ node_types:
required: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement:
+ org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
chart:
type: string
@@ -89,24 +89,24 @@ node_types:
requred: true
topology_template:
node_templates:
- org.onap.k8s.controlloop.K8SControlLoopParticipant:
+ org.onap.k8s.acm.K8SAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for K8S
properties:
provider: ONAP
- org.onap.domain.database.HelloWorld_K8SMicroserviceControlLoopElement:
+ org.onap.domain.database.HelloWorld_K8SMicroserviceAutomationCompositionElement:
# Chart from any chart repository configured on helm client.
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement
+ type: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the K8S microservice for Hello World
+ description: Automation composition element for the K8S microservice for Hello World
properties:
provider: ONAP
participantType:
- name: org.onap.k8s.controlloop.K8SControlLoopParticipant
+ name: org.onap.k8s.acm.K8SAutomationCompositionParticipant
version: 2.3.4
startPhase: 2
uninitializedToPassiveTimeout: 180
@@ -119,16 +119,16 @@ topology_template:
namespace: onap
repository: chartMuseum
- org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement:
+ org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement:
# Chart from local file system
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement
+ type: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the K8S microservice for PMSH
+ description: Automation composition element for the K8S microservice for PMSH
properties:
provider: ONAP
participantType:
- name: org.onap.k8s.controlloop.K8SControlLoopParticipant
+ name: org.onap.k8s.acm.K8SAutomationCompositionParticipant
version: 2.3.4
startPhase: 2
uninitializedToPassiveTimeout: 180
@@ -142,16 +142,16 @@ topology_template:
overrideParams:
global.masterPassword: test
- org.onap.domain.database.Local_K8SMicroserviceControlLoopElement:
+ org.onap.domain.database.Local_K8SMicroserviceAutomationCompositionElement:
# Chart installation without passing repository name
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement
+ type: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the K8S microservice for local chart
+ description: Automation composition element for the K8S microservice for local chart
properties:
provider: ONAP
participantType:
- name: org.onap.k8s.controlloop.K8SControlLoopParticipant
+ name: org.onap.k8s.acm.K8SAutomationCompositionParticipant
version: 2.3.4
startPhase: 2
uninitializedToPassiveTimeout: 180
@@ -163,17 +163,17 @@ topology_template:
releaseName: nginxms
namespace: onap
- org.onap.domain.sample.GenericK8s_ControlLoopDefinition:
+ org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acm.AutomationComposition
type_version: 1.0.0
- description: Control loop for Hello World
+ description: Automation composition for Hello World
properties:
provider: ONAP
elements:
- - name: org.onap.domain.database.HelloWorld_K8SMicroserviceControlLoopElement
+ - name: org.onap.domain.database.HelloWorld_K8SMicroserviceAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement
+ - name: org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.database.Local_K8SMicroserviceControlLoopElement
+ - name: org.onap.domain.database.Local_K8SMicroserviceAutomationCompositionElement
version: 1.2.3
diff --git a/participant/participant-impl/participant-impl-policy/pom.xml b/participant/participant-impl/participant-impl-policy/pom.xml
index fce29acae..052e959dc 100644
--- a/participant/participant-impl/participant-impl-policy/pom.xml
+++ b/participant/participant-impl/participant-impl-policy/pom.xml
@@ -30,7 +30,7 @@
<artifactId>policy-clamp-participant-impl-policy</artifactId>
<name>${project.artifactId}</name>
- <description>Policy participant, that allows Policy to partake in control loops</description>
+ <description>Policy participant, that allows Policy to partake in automation compositions</description>
<build>
<plugins>
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/PolicyParticipantApplication.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/PolicyParticipantApplication.java
index 4869b7c2f..0ba2aa2ea 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/PolicyParticipantApplication.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/PolicyParticipantApplication.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy;
+package org.onap.policy.clamp.acm.participant.policy;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -31,9 +31,10 @@ import org.springframework.context.annotation.ComponentScan;
*/
@SpringBootApplication
@ComponentScan({
- "org.onap.policy.clamp.controlloop.participant.policy",
- "org.onap.policy.clamp.controlloop.participant.intermediary"})
-@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.policy.main.parameters")
+ "org.onap.policy.clamp.acm.participant.policy",
+ "org.onap.policy.clamp.acm.participant.intermediary"
+})
+@ConfigurationPropertiesScan("org.onap.policy.clamp.acm.participant.policy.main.parameters")
public class PolicyParticipantApplication {
public static void main(String[] args) {
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/AbstractHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/AbstractHttpClient.java
index 2579585e5..4920d6550 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/AbstractHttpClient.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/AbstractHttpClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.client;
+package org.onap.policy.clamp.acm.participant.policy.client;
import java.io.Closeable;
import java.io.IOException;
@@ -29,7 +29,7 @@ import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
@@ -45,13 +45,13 @@ public abstract class AbstractHttpClient implements Closeable {
* Constructor.
*
* @param policyParticipantParameters the parameters for the policy participant
- * @throws ControlLoopRuntimeException on client start errors
+ * @throws AutomationCompositionRuntimeException on client start errors
*/
protected AbstractHttpClient(BusTopicParams policyParticipantParameters) {
try {
httpclient = HttpClientFactoryInstance.getClientFactory().build(policyParticipantParameters);
} catch (final Exception e) {
- throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR, " Client failed to start", e);
+ throw new AutomationCompositionRuntimeException(Status.INTERNAL_SERVER_ERROR, " Client failed to start", e);
}
}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyApiHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyApiHttpClient.java
index 38a79f7f6..a86576eed 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyApiHttpClient.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyApiHttpClient.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.client;
+package org.onap.policy.clamp.acm.participant.policy.client;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters;
+import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.stereotype.Component;
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyPapHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyPapHttpClient.java
index f835c6e04..584170ae4 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyPapHttpClient.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyPapHttpClient.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.client;
+package org.onap.policy.clamp.acm.participant.policy.client;
import java.util.LinkedList;
import java.util.List;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters;
+import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters;
import org.onap.policy.models.pdp.concepts.DeploymentGroup;
import org.onap.policy.models.pdp.concepts.DeploymentGroups;
import org.onap.policy.models.pdp.concepts.DeploymentSubGroup;
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/config/ParticipantConfig.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/ParticipantConfig.java
index 7b49a9a6b..7f9ad243d 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/config/ParticipantConfig.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/ParticipantConfig.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.config;
+package org.onap.policy.clamp.acm.participant.policy.config;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.policy.main.handler.ControlLoopElementHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.policy.main.handler.AutomationCompositionElementHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@@ -29,15 +29,15 @@ import org.springframework.context.annotation.Configuration;
public class ParticipantConfig {
/**
- * Register ControlLoopElementListener.
+ * Register AutomationCompositionElementListener.
*
* @param intermediaryApi the ParticipantIntermediaryApi
- * @param clElementHandler the ControlLoop Element Handler
+ * @param acElementHandler the Aotumation Composition Element Handler
*/
@Autowired
- public void registerControlLoopElementListener(ParticipantIntermediaryApi intermediaryApi,
- ControlLoopElementHandler clElementHandler) {
- intermediaryApi.registerControlLoopElementListener(clElementHandler);
- clElementHandler.setIntermediaryApi(intermediaryApi);
+ public void registerAutomationCompositionElementListener(ParticipantIntermediaryApi intermediaryApi,
+ AutomationCompositionElementHandler acElementHandler) {
+ intermediaryApi.registerAutomationCompositionElementListener(acElementHandler);
+ acElementHandler.setIntermediaryApi(intermediaryApi);
}
}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/config/SecurityConfig.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/SecurityConfig.java
index 4ee8c41b0..d7ce925e2 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/config/SecurityConfig.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/SecurityConfig.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.config;
+package org.onap.policy.clamp.acm.participant.policy.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
new file mode 100644
index 000000000..42d7526f8
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
@@ -0,0 +1,227 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021,2022 Nordix Foundation.
+ * ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.policy.main.handler;
+
+import java.time.Instant;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.UUID;
+import lombok.Setter;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.policy.client.PolicyApiHttpClient;
+import org.onap.policy.clamp.acm.participant.policy.client.PolicyPapHttpClient;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.pdp.concepts.DeploymentSubGroup;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class handles implementation of automationCompositionElement updates.
+ */
+@Component
+public class AutomationCompositionElementHandler implements AutomationCompositionElementListener {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionElementHandler.class);
+ private final Map<String, String> policyTypeMap = new LinkedHashMap<>();
+ private final Map<String, String> policyMap = new LinkedHashMap<>();
+
+ private final PolicyApiHttpClient apiHttpClient;
+ private final PolicyPapHttpClient papHttpClient;
+
+ @Setter
+ private ParticipantIntermediaryApi intermediaryApi;
+
+ /**
+ * constructor.
+ *
+ * @param apiHttpClient the Policy Api Http Client
+ * @param papHttpClient the Policy Pap Http Client
+ */
+ public AutomationCompositionElementHandler(PolicyApiHttpClient apiHttpClient, PolicyPapHttpClient papHttpClient) {
+ this.papHttpClient = papHttpClient;
+ this.apiHttpClient = apiHttpClient;
+ }
+
+ /**
+ * Callback method to handle a automation composition element state change.
+ *
+ * @param automationCompositionId the ID of the automation composition
+ * @param automationCompositionElementId the ID of the automation composition element
+ * @param currentState the current state of the automation composition element
+ * @param orderedState the state to which the automation composition element is changing to
+ */
+ @Override
+ public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ UUID automationCompositionElementId,
+ AutomationCompositionState currentState,
+ AutomationCompositionOrderedState orderedState) {
+ switch (orderedState) {
+ case UNINITIALISED:
+ try {
+ undeployPolicies(automationCompositionElementId);
+ deletePolicyData(automationCompositionId, automationCompositionElementId, orderedState);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, orderedState, AutomationCompositionState.UNINITIALISED,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
+ } catch (PfModelRuntimeException e) {
+ LOGGER.debug("Undeploying/Deleting policy failed {}", automationCompositionElementId, e);
+ }
+ break;
+ case PASSIVE:
+ try {
+ undeployPolicies(automationCompositionElementId);
+ } catch (PfModelRuntimeException e) {
+ LOGGER.debug("Undeploying policies failed - no policies to undeploy {}",
+ automationCompositionElementId);
+ }
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, orderedState, AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
+ break;
+ case RUNNING:
+ LOGGER.info("Running state is not supported");
+ break;
+ default:
+ LOGGER.debug("Unknown orderedstate {}", orderedState);
+ break;
+ }
+ }
+
+ private void deletePolicyData(ToscaConceptIdentifier automationCompositionId,
+ UUID automationCompositionElementId, AutomationCompositionOrderedState newState) {
+ // Delete all policies of this automationComposition from policy framework
+ for (Entry<String, String> policy : policyMap.entrySet()) {
+ apiHttpClient.deletePolicy(policy.getKey(), policy.getValue());
+ }
+ policyMap.clear();
+ // Delete all policy types of this automation composition from policy framework
+ for (Entry<String, String> policyType : policyTypeMap.entrySet()) {
+ apiHttpClient.deletePolicyType(policyType.getKey(), policyType.getValue());
+ }
+ policyTypeMap.clear();
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.UNINITIALISED,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
+ }
+
+ private void deployPolicies(ToscaConceptIdentifier automationCompositionId, UUID automationCompositionElementId,
+ AutomationCompositionOrderedState newState) {
+ // Deploy all policies of this automationComposition from Policy Framework
+ if (!policyMap.entrySet().isEmpty()) {
+ for (Entry<String, String> policy : policyMap.entrySet()) {
+ papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(),
+ DeploymentSubGroup.Action.POST);
+ }
+ LOGGER.debug("Policies deployed to {} successfully", automationCompositionElementId);
+ } else {
+ LOGGER.debug("No policies to deploy to {}", automationCompositionElementId);
+ }
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
+ }
+
+ private void undeployPolicies(UUID automationCompositionElementId) {
+ // Undeploy all policies of this automation composition from Policy Framework
+ if (!policyMap.entrySet().isEmpty()) {
+ for (Entry<String, String> policy : policyMap.entrySet()) {
+ papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(),
+ DeploymentSubGroup.Action.DELETE);
+ }
+ LOGGER.debug("Undeployed policies from {} successfully", automationCompositionElementId);
+ } else {
+ LOGGER.debug("No policies are deployed to {}", automationCompositionElementId);
+ }
+ }
+
+ /**
+ * Callback method to handle an update on a automation composition element.
+ *
+ * @param element the information on the automation composition element
+ * @param acElementDefinition toscaNodeTemplate
+ * @throws PfModelException in case of an exception
+ */
+ @Override
+ public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
+ AutomationCompositionElement element,
+ ToscaNodeTemplate acElementDefinition)
+ throws PfModelException {
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
+ element.getOrderedState(),
+ AutomationCompositionState.PASSIVE, ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
+ ToscaServiceTemplate automationCompositionDefinition = element.getToscaServiceTemplateFragment();
+ if (automationCompositionDefinition.getToscaTopologyTemplate() != null) {
+ if (automationCompositionDefinition.getPolicyTypes() != null) {
+ for (ToscaPolicyType policyType : automationCompositionDefinition.getPolicyTypes().values()) {
+ policyTypeMap.put(policyType.getName(), policyType.getVersion());
+ }
+ LOGGER.debug("Found Policy Types in automation composition definition: {} , Creating Policy Types",
+ automationCompositionDefinition.getName());
+ apiHttpClient.createPolicyType(automationCompositionDefinition);
+ }
+ if (automationCompositionDefinition.getToscaTopologyTemplate().getPolicies() != null) {
+ for (Map<String, ToscaPolicy> gotPolicyMap : automationCompositionDefinition.getToscaTopologyTemplate()
+ .getPolicies()) {
+ for (ToscaPolicy policy : gotPolicyMap.values()) {
+ policyMap.put(policy.getName(), policy.getVersion());
+ }
+ }
+ LOGGER.debug("Found Policies in automation composition definition: {} , Creating Policies",
+ automationCompositionDefinition.getName());
+ apiHttpClient.createPolicy(automationCompositionDefinition);
+ }
+ }
+ deployPolicies(automationCompositionId, element.getId(), element.getOrderedState());
+ }
+
+ /**
+ * Handle automationCompositionElement statistics.
+ *
+ * @param automationCompositionElementId automation composition element id
+ */
+ @Override
+ public void handleStatistics(UUID automationCompositionElementId) {
+ var acElement = intermediaryApi.getAutomationCompositionElement(automationCompositionElementId);
+ if (acElement != null) {
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setState(acElement.getState());
+ acElementStatistics.setTimeStamp(Instant.now());
+ intermediaryApi.updateAutomationCompositionElementStatistics(automationCompositionElementId,
+ acElementStatistics);
+ }
+ }
+} \ No newline at end of file
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParameters.java
index 8e1de36b9..a57198126 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParameters.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.main.parameters;
+package org.onap.policy.clamp.acm.participant.policy.main.parameters;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.onap.policy.common.endpoints.parameters.RestClientParameters;
import org.onap.policy.common.parameters.validation.ParameterGroupConstraint;
import org.springframework.boot.context.properties.ConfigurationProperties;
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
deleted file mode 100644
index 663d6d5e9..000000000
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
- * ================================================================================
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.policy.main.handler;
-
-import java.time.Instant;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.UUID;
-import lombok.Setter;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyApiHttpClient;
-import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyPapHttpClient;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.pdp.concepts.DeploymentSubGroup;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * This class handles implementation of controlLoopElement updates.
- */
-@Component
-public class ControlLoopElementHandler implements ControlLoopElementListener {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopElementHandler.class);
- private final Map<String, String> policyTypeMap = new LinkedHashMap<>();
- private final Map<String, String> policyMap = new LinkedHashMap<>();
-
- private final PolicyApiHttpClient apiHttpClient;
- private final PolicyPapHttpClient papHttpClient;
-
- @Setter
- private ParticipantIntermediaryApi intermediaryApi;
-
- /**
- * constructor.
- *
- * @param apiHttpClient the Policy Api Http Client
- * @param papHttpClient the Policy Pap Http Client
- */
- public ControlLoopElementHandler(PolicyApiHttpClient apiHttpClient, PolicyPapHttpClient papHttpClient) {
- this.papHttpClient = papHttpClient;
- this.apiHttpClient = apiHttpClient;
- }
-
- /**
- * Callback method to handle a control loop element state change.
- *
- * @param controlLoopId the ID of the control loop
- * @param controlLoopElementId the ID of the control loop element
- * @param currentState the current state of the control loop element
- * @param orderedState the state to which the control loop element is changing to
- */
- @Override
- public void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId,
- UUID controlLoopElementId, ControlLoopState currentState,
- ControlLoopOrderedState orderedState) {
- switch (orderedState) {
- case UNINITIALISED:
- try {
- undeployPolicies(controlLoopElementId);
- deletePolicyData(controlLoopId, controlLoopElementId, orderedState);
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, orderedState, ControlLoopState.UNINITIALISED,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- } catch (PfModelRuntimeException e) {
- LOGGER.debug("Undeploying/Deleting policy failed {}", controlLoopElementId, e);
- }
- break;
- case PASSIVE:
- try {
- undeployPolicies(controlLoopElementId);
- } catch (PfModelRuntimeException e) {
- LOGGER.debug("Undeploying policies failed - no policies to undeploy {}", controlLoopElementId);
- }
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, orderedState, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- break;
- case RUNNING:
- LOGGER.info("Running state is not supported");
- break;
- default:
- LOGGER.debug("Unknown orderedstate {}", orderedState);
- break;
- }
- }
-
- private void deletePolicyData(ToscaConceptIdentifier controlLoopId,
- UUID controlLoopElementId, ControlLoopOrderedState newState) {
- // Delete all policies of this controlLoop from policy framework
- for (Entry<String, String> policy : policyMap.entrySet()) {
- apiHttpClient.deletePolicy(policy.getKey(), policy.getValue());
- }
- policyMap.clear();
- // Delete all policy types of this control loop from policy framework
- for (Entry<String, String> policyType : policyTypeMap.entrySet()) {
- apiHttpClient.deletePolicyType(policyType.getKey(), policyType.getValue());
- }
- policyTypeMap.clear();
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.UNINITIALISED,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- }
-
- private void deployPolicies(ToscaConceptIdentifier controlLoopId, UUID controlLoopElementId,
- ControlLoopOrderedState newState) {
- // Deploy all policies of this controlLoop from Policy Framework
- if (policyMap.entrySet() != null) {
- for (Entry<String, String> policy : policyMap.entrySet()) {
- papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(),
- DeploymentSubGroup.Action.POST);
- }
- LOGGER.debug("Policies deployed to {} successfully", controlLoopElementId);
- } else {
- LOGGER.debug("No policies to deploy to {}", controlLoopElementId);
- }
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- }
-
- private void undeployPolicies(UUID controlLoopElementId) {
- // Undeploy all policies of this controlloop from Policy Framework
- if (policyMap.entrySet() != null) {
- for (Entry<String, String> policy : policyMap.entrySet()) {
- papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(),
- DeploymentSubGroup.Action.DELETE);
- }
- LOGGER.debug("Undeployed policies from {} successfully", controlLoopElementId);
- } else {
- LOGGER.debug("No policies are deployed to {}", controlLoopElementId);
- }
- }
-
- /**
- * Callback method to handle an update on a control loop element.
- *
- * @param element the information on the control loop element
- * @param clElementDefinition toscaNodeTemplate
- * @throws PfModelException in case of an exception
- */
- @Override
- public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId, ControlLoopElement element,
- ToscaNodeTemplate clElementDefinition)
- throws PfModelException {
- ToscaServiceTemplate controlLoopDefinition = element.getToscaServiceTemplateFragment();
- if (controlLoopDefinition.getToscaTopologyTemplate() != null) {
- if (controlLoopDefinition.getPolicyTypes() != null) {
- for (ToscaPolicyType policyType : controlLoopDefinition.getPolicyTypes().values()) {
- policyTypeMap.put(policyType.getName(), policyType.getVersion());
- }
- LOGGER.debug("Found Policy Types in control loop definition: {} , Creating Policy Types",
- controlLoopDefinition.getName());
- apiHttpClient.createPolicyType(controlLoopDefinition);
- }
- if (controlLoopDefinition.getToscaTopologyTemplate().getPolicies() != null) {
- for (Map<String, ToscaPolicy> foundPolicyMap : controlLoopDefinition.getToscaTopologyTemplate()
- .getPolicies()) {
- for (ToscaPolicy policy : foundPolicyMap.values()) {
- policyMap.put(policy.getName(), policy.getVersion());
- }
- }
- LOGGER.debug("Found Policies in control loop definition: {} , Creating Policies",
- controlLoopDefinition.getName());
- apiHttpClient.createPolicy(controlLoopDefinition);
- }
- }
- deployPolicies(controlLoopId, element.getId(), element.getOrderedState());
- }
-
- /**
- * Handle controlLoopElement statistics.
- *
- * @param controlLoopElementId controlloop element id
- */
- @Override
- public void handleStatistics(UUID controlLoopElementId) throws PfModelException {
- var clElement = intermediaryApi.getControlLoopElement(controlLoopElementId);
- if (clElement != null) {
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setControlLoopState(clElement.getState());
- clElementStatistics.setTimeStamp(Instant.now());
- intermediaryApi.updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics);
- }
- }
-} \ No newline at end of file
diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml b/participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml
index 46db712b6..383bc7418 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml
+++ b/participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml
@@ -52,11 +52,11 @@
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTrigger</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoopElement</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipant</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipantStatistics</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics</class>
+ <class>org.onap.policy.clamp.acm.models.acm.persistence.concepts.JpaAutomationComposition</class>
+ <class>org.onap.policy.clamp.acm.models.acm.persistence.concepts.JpaAutomationCompositionElement</class>
+ <class>org.onap.policy.clamp.acm.models.acm.persistence.concepts.JpaParticipant</class>
+ <class>org.onap.policy.clamp.acm.models.acm.persistence.concepts.JpaParticipantStatistics</class>
+ <class>org.onap.policy.clamp.acm.models.acm.persistence.concepts.JpaAcElementStatistics</class>
<properties>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
index 2aa33c1c4..c3338a993 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
@@ -30,19 +30,19 @@ participant:
name: org.onap.PM_Policy
version: 1.0.0
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.clamp.acm.PolicyParticipant
version: 2.3.1
- clampControlLoopTopics:
+ clampAutomationCompositionTopics:
topicSources:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:localhost}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
topicSinks:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:localhost}
topicCommInfrastructure: dmaap
@@ -54,4 +54,4 @@ management:
server:
port: 8085
servlet:
- context-path: /onap/policyparticipant
+ context-path: /onap/policy/clamp/acm/policyparticipant
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java
index ce368eba1..c17d2c53d 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.endtoend;
+package org.onap.policy.clamp.acm.participant.policy.endtoend;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
@@ -30,19 +30,19 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantDeregisterAckListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantRegisterAckListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantUpdateListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.clamp.controlloop.participant.policy.main.utils.TestListenerUtils;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantDeregisterAckListener;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantRegisterAckListener;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantUpdateListener;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.policy.main.utils.TestListenerUtils;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -169,6 +169,6 @@ class ParticipantMessagesTest {
}
private ToscaConceptIdentifier getParticipantType() {
- return new ToscaConceptIdentifier("org.onap.policy.controlloop.PolicyControlLoopParticipant", "2.3.1");
+ return new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1");
}
}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
new file mode 100644
index 000000000..0d114db8d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.policy.main.handler;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.mockito.Mockito.when;
+
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.policy.client.PolicyApiHttpClient;
+import org.onap.policy.clamp.acm.participant.policy.client.PolicyPapHttpClient;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+
+class AutomationCompositionElementHandlerTest {
+
+ private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
+ private static final String ID_VERSION = "1.0.1";
+ private static final UUID automationCompositionElementId = UUID.randomUUID();
+ private static final ToscaConceptIdentifier automationCompositionId =
+ new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
+
+ @Test
+ void testHandlerExceptions() {
+ AutomationCompositionElementHandler handler = getTestingHandler();
+
+ assertDoesNotThrow(() -> handler
+ .automationCompositionElementStateChange(automationCompositionId,
+ automationCompositionElementId,
+ AutomationCompositionState.UNINITIALISED,
+ AutomationCompositionOrderedState.PASSIVE));
+
+ assertDoesNotThrow(() -> handler
+ .automationCompositionElementStateChange(automationCompositionId,
+ automationCompositionElementId,
+ AutomationCompositionState.RUNNING,
+ AutomationCompositionOrderedState.UNINITIALISED));
+
+ assertDoesNotThrow(() -> handler
+ .automationCompositionElementStateChange(automationCompositionId,
+ automationCompositionElementId,
+ AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.RUNNING));
+ var element = getTestingAcElement();
+ var acElementDefinition = Mockito.mock(ToscaNodeTemplate.class);
+
+ assertDoesNotThrow(() -> handler
+ .automationCompositionElementUpdate(automationCompositionId, element, acElementDefinition));
+
+ assertDoesNotThrow(() -> handler
+ .handleStatistics(automationCompositionElementId));
+ }
+
+ AutomationCompositionElementHandler getTestingHandler() {
+ var api = Mockito.mock(PolicyApiHttpClient.class);
+ var pap = Mockito.mock(PolicyPapHttpClient.class);
+ var handler = new AutomationCompositionElementHandler(api, pap);
+ var intermediaryApi = Mockito.mock(ParticipantIntermediaryApi.class);
+ var element = getTestingAcElement();
+ when(intermediaryApi.getAutomationCompositionElement(automationCompositionElementId)).thenReturn(element);
+ handler.setIntermediaryApi(intermediaryApi);
+ return handler;
+ }
+
+ AutomationCompositionElement getTestingAcElement() {
+ var element = new AutomationCompositionElement();
+ element.setDefinition(automationCompositionId);
+ element.setDescription("Description");
+ element.setId(automationCompositionElementId);
+ element.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ element.setParticipantId(automationCompositionId);
+ element.setState(AutomationCompositionState.UNINITIALISED);
+ var template = Mockito.mock(ToscaServiceTemplate.class);
+ element.setToscaServiceTemplateFragment(template);
+ return element;
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java
index e965370cc..b5cd9d442 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java
@@ -18,12 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.main.parameters;
+package org.onap.policy.clamp.acm.participant.policy.main.parameters;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
@@ -34,7 +35,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
* Class to hold/create all parameters for test cases.
*/
public class CommonTestData {
- public static final String PARTICIPANT_GROUP_NAME = "ControlLoopParticipantGroup";
+ public static final String PARTICIPANT_GROUP_NAME = "AutomationCompositionParticipantGroup";
public static final String DESCRIPTION = "Participant description";
public static final long TIME_INTERVAL = 2000;
public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams());
@@ -123,7 +124,7 @@ public class CommonTestData {
map.put("description", DESCRIPTION);
map.put("participantId", getParticipantId());
map.put("participantType", getParticipantId());
- map.put("clampControlLoopTopics", getTopicParametersMap(false));
+ map.put("clampAutomationCompositionTopics", getTopicParametersMap(false));
}
return map;
@@ -151,7 +152,7 @@ public class CommonTestData {
*/
public static TopicParameters getTopicParams() {
final TopicParameters topicParams = new TopicParameters();
- topicParams.setTopic("POLICY-CLRUNTIME-PARTICIPANT");
+ topicParams.setTopic("POLICY-ACRUNTIME-PARTICIPANT");
topicParams.setTopicCommInfrastructure("dmaap");
topicParams.setServers(Arrays.asList("localhost"));
return topicParams;
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParametersTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParametersTest.java
index 74e7cb1bc..89b2bce58 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParametersTest.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParametersTest.java
@@ -18,17 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.main.parameters;
+package org.onap.policy.clamp.acm.participant.policy.main.parameters;
import static org.assertj.core.api.Assertions.assertThat;
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters;
class ParticipantPolicyParametersTest {
- private CommonTestData commonTestData = new CommonTestData();
- private ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
+ private final CommonTestData commonTestData = new CommonTestData();
+ private final ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
@Test
void testParticipantPolicyParameters() {
@@ -39,14 +40,14 @@ class ParticipantPolicyParametersTest {
@Test
void testParticipantPolicyParameters_NullTopicSinks() {
final ParticipantPolicyParameters participantParameters = commonTestData.getParticipantPolicyParameters();
- participantParameters.getIntermediaryParameters().getClampControlLoopTopics().setTopicSinks(null);
+ participantParameters.getIntermediaryParameters().getClampAutomationCompositionTopics().setTopicSinks(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
@Test
void testParticipantPolicyParameters_NullTopicSources() {
final ParticipantPolicyParameters participantParameters = commonTestData.getParticipantPolicyParameters();
- participantParameters.getIntermediaryParameters().getClampControlLoopTopics().setTopicSources(null);
+ participantParameters.getIntermediaryParameters().getClampAutomationCompositionTopics().setTopicSources(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/rest/ActuatorControllerTest.java
index 9cc16e287..8543bf98a 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/rest/ActuatorControllerTest.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/rest/ActuatorControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.policy.main.rest;
+package org.onap.policy.clamp.acm.participant.policy.main.rest;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -27,7 +27,7 @@ import javax.ws.rs.core.Response;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.participant.policy.main.utils.CommonActuatorController;
+import org.onap.policy.clamp.acm.participant.policy.main.utils.CommonActuatorController;
import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/CommonActuatorController.java
index 35ffbb5e9..689977e3c 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/utils/CommonActuatorController.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/CommonActuatorController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.kubernetes.utils;
+package org.onap.policy.clamp.acm.participant.policy.main.utils;
import static org.junit.Assert.assertEquals;
@@ -40,7 +40,7 @@ import org.onap.policy.common.utils.network.NetworkUtil;
public class CommonActuatorController {
public static final String SELF = NetworkUtil.getHostname();
- public static final String CONTEXT_PATH = "onap/k8sparticipant";
+ public static final String CONTEXT_PATH = "onap/policy/clamp/acm/policyparticipant";
public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/";
private static String httpPrefix;
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java
new file mode 100644
index 000000000..a29831d56
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java
@@ -0,0 +1,321 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.policy.main.utils;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.utils.AcmUtils;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.coder.YamlJsonTranslator;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class TestListenerUtils {
+
+ private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
+ private static final Coder CODER = new StandardCoder();
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestListenerUtils.class);
+
+ /**
+ * Method to create a automationComposition from a yaml file.
+ *
+ * @return AutomationComposition automation composition
+ */
+ public static AutomationComposition createAutomationComposition() {
+ AutomationComposition automationComposition = new AutomationComposition();
+ Map<UUID, AutomationCompositionElement> elements = new LinkedHashMap<>();
+ ToscaServiceTemplate toscaServiceTemplate = testAutomationCompositionRead();
+ Map<String, ToscaNodeTemplate> nodeTemplatesMap =
+ toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) {
+ AutomationCompositionElement acElement = new AutomationCompositionElement();
+ acElement.setId(UUID.randomUUID());
+
+ ToscaConceptIdentifier acElementParticipantId = new ToscaConceptIdentifier();
+ acElementParticipantId.setName(toscaInputEntry.getKey());
+ acElementParticipantId.setVersion(toscaInputEntry.getValue().getVersion());
+ acElement.setParticipantId(acElementParticipantId);
+
+ acElement.setDefinition(acElementParticipantId);
+ acElement.setState(AutomationCompositionState.UNINITIALISED);
+ acElement.setDescription(toscaInputEntry.getValue().getDescription());
+ acElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ elements.put(acElement.getId(), acElement);
+ }
+ automationComposition.setElements(elements);
+ automationComposition.setName("PMSHInstance0");
+ automationComposition.setVersion("1.0.0");
+
+ ToscaConceptIdentifier definition = new ToscaConceptIdentifier();
+ definition.setName("PMSHInstance0");
+ definition.setVersion("1.0.0");
+ automationComposition.setDefinition(definition);
+
+ return automationComposition;
+ }
+
+ /**
+ * Method to create AutomationCompositionStateChange message from the arguments passed.
+ *
+ * @param automationCompositionOrderedState automationCompositionOrderedState
+ * @return AutomationCompositionStateChange message
+ */
+ public static AutomationCompositionStateChange createAutomationCompositionStateChangeMsg(
+ final AutomationCompositionOrderedState automationCompositionOrderedState) {
+ final AutomationCompositionStateChange acStateChangeMsg = new AutomationCompositionStateChange();
+
+ ToscaConceptIdentifier automationCompositionId = new ToscaConceptIdentifier();
+ automationCompositionId.setName("PMSHInstance0");
+ automationCompositionId.setVersion("1.0.0");
+
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
+ participantId.setName("org.onap.PM_Policy");
+ participantId.setVersion("0.0.0");
+
+ acStateChangeMsg.setAutomationCompositionId(automationCompositionId);
+ acStateChangeMsg.setParticipantId(participantId);
+ acStateChangeMsg.setTimestamp(Instant.now());
+ acStateChangeMsg.setOrderedState(automationCompositionOrderedState);
+
+ return acStateChangeMsg;
+ }
+
+ /**
+ * Method to create AutomationCompositionUpdateMsg.
+ *
+ * @return AutomationCompositionUpdate message
+ */
+ public static AutomationCompositionUpdate createAutomationCompositionUpdateMsg() {
+ final AutomationCompositionUpdate acUpdateMsg = new AutomationCompositionUpdate();
+ ToscaConceptIdentifier automationCompositionId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "0.0.0");
+
+ acUpdateMsg.setAutomationCompositionId(automationCompositionId);
+ acUpdateMsg.setParticipantId(participantId);
+ acUpdateMsg.setMessageId(UUID.randomUUID());
+ acUpdateMsg.setTimestamp(Instant.now());
+
+ Map<UUID, AutomationCompositionElement> elements = new LinkedHashMap<>();
+ ToscaServiceTemplate toscaServiceTemplate = testAutomationCompositionRead();
+ TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate);
+ Map<String, ToscaNodeTemplate> nodeTemplatesMap =
+ toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) {
+ if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(),
+ toscaServiceTemplate)) {
+ AutomationCompositionElement acElement = new AutomationCompositionElement();
+ acElement.setId(UUID.randomUUID());
+ var acParticipantType =
+ ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties());
+
+ acElement.setParticipantId(acParticipantType);
+ acElement.setParticipantType(acParticipantType);
+
+ acElement.setDefinition(
+ new ToscaConceptIdentifier(toscaInputEntry.getKey(), toscaInputEntry.getValue().getVersion()));
+ acElement.setState(AutomationCompositionState.UNINITIALISED);
+ acElement.setDescription(toscaInputEntry.getValue().getDescription());
+ acElement.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ elements.put(acElement.getId(), acElement);
+ }
+ }
+
+ List<ParticipantUpdates> participantUpdates = new ArrayList<>();
+ for (AutomationCompositionElement element : elements.values()) {
+ AcmUtils.setServiceTemplatePolicyInfo(element, toscaServiceTemplate);
+ AcmUtils.prepareParticipantUpdate(element, participantUpdates);
+ }
+ acUpdateMsg.setParticipantUpdatesList(participantUpdates);
+ return acUpdateMsg;
+ }
+
+ /**
+ * Method to create participantUpdateMsg.
+ *
+ * @return ParticipantUpdate message
+ */
+ public static ParticipantUpdate createParticipantUpdateMsg() {
+ final ParticipantUpdate participantUpdateMsg = new ParticipantUpdate();
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0");
+ ToscaConceptIdentifier participantType =
+ new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1");
+
+ participantUpdateMsg.setParticipantId(participantId);
+ participantUpdateMsg.setTimestamp(Instant.now());
+ participantUpdateMsg.setParticipantType(participantType);
+ participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000));
+ participantUpdateMsg.setMessageId(UUID.randomUUID());
+
+ ToscaServiceTemplate toscaServiceTemplate = testAutomationCompositionRead();
+ // Add policies to the toscaServiceTemplate
+ TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate);
+
+ List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
+ for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate()
+ .getNodeTemplates().entrySet()) {
+ if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(),
+ toscaServiceTemplate)) {
+ AcmUtils.prepareParticipantDefinitionUpdate(
+ ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()),
+ toscaInputEntry.getKey(), toscaInputEntry.getValue(),
+ participantDefinitionUpdates, null);
+ }
+ }
+
+ participantUpdateMsg.setParticipantDefinitionUpdates(participantDefinitionUpdates);
+ return participantUpdateMsg;
+ }
+
+ /**
+ * Method to create AutomationCompositionUpdate using the arguments passed.
+ *
+ * @param jsonFilePath the path of the automation composition content
+ * @return AutomationCompositionUpdate message
+ * @throws CoderException exception while reading the file to object
+ */
+ public static AutomationCompositionUpdate createParticipantAcUpdateMsgFromJson(String jsonFilePath)
+ throws CoderException {
+ AutomationCompositionUpdate automationCompositionUpdateMsg =
+ CODER.decode(new File(jsonFilePath), AutomationCompositionUpdate.class);
+ return automationCompositionUpdateMsg;
+ }
+
+ private static ToscaServiceTemplate testAutomationCompositionRead() {
+ Set<String> automationCompositionDirectoryContents =
+ ResourceUtils.getDirectoryContents("src/test/resources/utils/servicetemplates");
+
+ boolean atLeastOneAutomationCompositionTested = false;
+ ToscaServiceTemplate toscaServiceTemplate = null;
+
+ for (String automationCompositionFilePath : automationCompositionDirectoryContents) {
+ if (!automationCompositionFilePath.endsWith(".yaml")) {
+ continue;
+ }
+ atLeastOneAutomationCompositionTested = true;
+ toscaServiceTemplate = testAutomationCompositionYamlSerialization(automationCompositionFilePath);
+ }
+
+ // Add policy_types to the toscaServiceTemplate
+ addPolicyTypesToToscaServiceTemplate(toscaServiceTemplate);
+
+ assertTrue(atLeastOneAutomationCompositionTested);
+ return toscaServiceTemplate;
+ }
+
+ private static void addPolicyTypesToToscaServiceTemplate(ToscaServiceTemplate toscaServiceTemplate) {
+ Set<String> policyTypeDirectoryContents = ResourceUtils.getDirectoryContents("policytypes");
+
+ for (String policyTypeFilePath : policyTypeDirectoryContents) {
+ String policyTypeString = ResourceUtils.getResourceAsString(policyTypeFilePath);
+
+ ToscaServiceTemplate foundPolicyTypeSt =
+ yamlTranslator.fromYaml(policyTypeString, ToscaServiceTemplate.class);
+
+ toscaServiceTemplate.setDerivedFrom(foundPolicyTypeSt.getDerivedFrom());
+ toscaServiceTemplate.setDescription(foundPolicyTypeSt.getDescription());
+ toscaServiceTemplate.setMetadata(foundPolicyTypeSt.getMetadata());
+ toscaServiceTemplate.setName(foundPolicyTypeSt.getName());
+ toscaServiceTemplate.setToscaDefinitionsVersion(foundPolicyTypeSt.getToscaDefinitionsVersion());
+ toscaServiceTemplate.setVersion(foundPolicyTypeSt.getVersion());
+
+ if (foundPolicyTypeSt.getDataTypes() != null) {
+ if (toscaServiceTemplate.getDataTypes() == null) {
+ toscaServiceTemplate.setDataTypes(foundPolicyTypeSt.getDataTypes());
+ } else {
+ toscaServiceTemplate.getDataTypes().putAll(foundPolicyTypeSt.getDataTypes());
+ }
+ }
+
+ if (toscaServiceTemplate.getPolicyTypes() == null) {
+ toscaServiceTemplate.setPolicyTypes(foundPolicyTypeSt.getPolicyTypes());
+ } else {
+ toscaServiceTemplate.getPolicyTypes().putAll(foundPolicyTypeSt.getPolicyTypes());
+ }
+ }
+ }
+
+ /**
+ * Method to add polcies to the toscaServiceTemplate.
+ *
+ * @param toscaServiceTemplate to add policies
+ */
+ public static void addPoliciesToToscaServiceTemplate(ToscaServiceTemplate toscaServiceTemplate) {
+ Set<String> policiesDirectoryContents = ResourceUtils.getDirectoryContents("policies");
+
+ for (String policiesFilePath : policiesDirectoryContents) {
+ if (!policiesFilePath.endsWith("yaml")) {
+ continue;
+ }
+
+ String policiesString = ResourceUtils.getResourceAsString(policiesFilePath);
+
+ ToscaServiceTemplate foundPoliciesSt =
+ yamlTranslator.fromYaml(policiesString, ToscaServiceTemplate.class);
+ toscaServiceTemplate.getToscaTopologyTemplate()
+ .setPolicies(foundPoliciesSt.getToscaTopologyTemplate().getPolicies());
+ }
+ }
+
+ private static ToscaServiceTemplate testAutomationCompositionYamlSerialization(
+ String automationCompositionFilePath) {
+ try {
+ String automationCompositionString = ResourceUtils.getResourceAsString(automationCompositionFilePath);
+ if (automationCompositionString == null) {
+ throw new FileNotFoundException(automationCompositionFilePath);
+ }
+
+ ToscaServiceTemplate serviceTemplate =
+ yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class);
+ return serviceTemplate;
+ } catch (FileNotFoundException e) {
+ LOGGER.error("cannot find YAML file", automationCompositionFilePath);
+ throw new IllegalArgumentException(e);
+ }
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandlerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandlerTest.java
deleted file mode 100644
index b5c5e19cb..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandlerTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.policy.main.handler;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.mockito.Mockito.when;
-
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyApiHttpClient;
-import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyPapHttpClient;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-
-class ControlLoopElementHandlerTest {
-
- private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
- private static final String ID_VERSION = "1.0.1";
- private static final UUID controlLoopElementId = UUID.randomUUID();
- private static final ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
-
- @Test
- void testHandlerExceptions() throws PfModelException {
- ControlLoopElementHandler handler = getTestingHandler();
-
- assertDoesNotThrow(() -> handler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId,
- ControlLoopState.UNINITIALISED,
- ControlLoopOrderedState.PASSIVE));
-
- assertDoesNotThrow(() -> handler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId,
- ControlLoopState.RUNNING,
- ControlLoopOrderedState.UNINITIALISED));
-
- assertDoesNotThrow(() -> handler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId,
- ControlLoopState.PASSIVE,
- ControlLoopOrderedState.RUNNING));
- var element = getTestingClElement();
- var clElementDefinition = Mockito.mock(ToscaNodeTemplate.class);
-
- assertDoesNotThrow(() -> handler
- .controlLoopElementUpdate(controlLoopId, element, clElementDefinition));
-
- assertDoesNotThrow(() -> handler
- .handleStatistics(controlLoopElementId));
- }
-
- ControlLoopElementHandler getTestingHandler() {
- var api = Mockito.mock(PolicyApiHttpClient.class);
- var pap = Mockito.mock(PolicyPapHttpClient.class);
- var handler = new ControlLoopElementHandler(api, pap);
- var intermediaryApi = Mockito.mock(ParticipantIntermediaryApi.class);
- var element = getTestingClElement();
- when(intermediaryApi.getControlLoopElement(controlLoopElementId)).thenReturn(element);
- handler.setIntermediaryApi(intermediaryApi);
- return handler;
- }
-
- ControlLoopElement getTestingClElement() {
- var element = new ControlLoopElement();
- element.setDefinition(controlLoopId);
- element.setDescription("Description");
- element.setId(controlLoopElementId);
- element.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- element.setParticipantId(controlLoopId);
- element.setState(ControlLoopState.UNINITIALISED);
- var template = Mockito.mock(ToscaServiceTemplate.class);
- element.setToscaServiceTemplateFragment(template);
- return element;
- }
-
-}
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
deleted file mode 100644
index d517ef61e..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.policy.main.utils;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.onap.policy.clamp.controlloop.common.utils.CommonUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.CommonTestData;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.common.utils.coder.YamlJsonTranslator;
-import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class TestListenerUtils {
-
- private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
- private static final Coder CODER = new StandardCoder();
- static CommonTestData commonTestData = new CommonTestData();
- private static final Logger LOGGER = LoggerFactory.getLogger(TestListenerUtils.class);
-
- /**
- * Method to create a controlLoop from a yaml file.
- *
- * @return ControlLoop controlloop
- */
- public static ControlLoop createControlLoop() {
- ControlLoop controlLoop = new ControlLoop();
- Map<UUID, ControlLoopElement> elements = new LinkedHashMap<>();
- ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead();
- Map<String, ToscaNodeTemplate> nodeTemplatesMap =
- toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) {
- ControlLoopElement clElement = new ControlLoopElement();
- clElement.setId(UUID.randomUUID());
-
- ToscaConceptIdentifier clElementParticipantId = new ToscaConceptIdentifier();
- clElementParticipantId.setName(toscaInputEntry.getKey());
- clElementParticipantId.setVersion(toscaInputEntry.getValue().getVersion());
- clElement.setParticipantId(clElementParticipantId);
-
- clElement.setDefinition(clElementParticipantId);
- clElement.setState(ControlLoopState.UNINITIALISED);
- clElement.setDescription(toscaInputEntry.getValue().getDescription());
- clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- elements.put(clElement.getId(), clElement);
- }
- controlLoop.setElements(elements);
- controlLoop.setName("PMSHInstance0");
- controlLoop.setVersion("1.0.0");
-
- ToscaConceptIdentifier definition = new ToscaConceptIdentifier();
- definition.setName("PMSHInstance0");
- definition.setVersion("1.0.0");
- controlLoop.setDefinition(definition);
-
- return controlLoop;
- }
-
- /**
- * Method to create ControlLoopStateChange message from the arguments passed.
- *
- * @param controlLoopOrderedState controlLoopOrderedState
- *
- * @return ControlLoopStateChange message
- */
- public static ControlLoopStateChange createControlLoopStateChangeMsg(
- final ControlLoopOrderedState controlLoopOrderedState) {
- final ControlLoopStateChange clStateChangeMsg = new ControlLoopStateChange();
-
- ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier();
- controlLoopId.setName("PMSHInstance0");
- controlLoopId.setVersion("1.0.0");
-
- ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
- participantId.setName("org.onap.PM_Policy");
- participantId.setVersion("0.0.0");
-
- clStateChangeMsg.setControlLoopId(controlLoopId);
- clStateChangeMsg.setParticipantId(participantId);
- clStateChangeMsg.setTimestamp(Instant.now());
- clStateChangeMsg.setOrderedState(controlLoopOrderedState);
-
- return clStateChangeMsg;
- }
-
- /**
- * Method to create ControlLoopUpdateMsg.
- *
- * @return ControlLoopUpdate message
- */
- public static ControlLoopUpdate createControlLoopUpdateMsg() {
- final ControlLoopUpdate clUpdateMsg = new ControlLoopUpdate();
- ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
- ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "0.0.0");
-
- clUpdateMsg.setControlLoopId(controlLoopId);
- clUpdateMsg.setParticipantId(participantId);
- clUpdateMsg.setMessageId(UUID.randomUUID());
- clUpdateMsg.setTimestamp(Instant.now());
-
- Map<UUID, ControlLoopElement> elements = new LinkedHashMap<>();
- ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead();
- TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate);
- Map<String, ToscaNodeTemplate> nodeTemplatesMap =
- toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) {
- if (ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(),
- toscaServiceTemplate)) {
- ControlLoopElement clElement = new ControlLoopElement();
- clElement.setId(UUID.randomUUID());
- var clParticipantType =
- ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties());
-
- clElement.setParticipantId(clParticipantType);
- clElement.setParticipantType(clParticipantType);
-
- clElement.setDefinition(
- new ToscaConceptIdentifier(toscaInputEntry.getKey(), toscaInputEntry.getValue().getVersion()));
- clElement.setState(ControlLoopState.UNINITIALISED);
- clElement.setDescription(toscaInputEntry.getValue().getDescription());
- clElement.setOrderedState(ControlLoopOrderedState.PASSIVE);
- elements.put(clElement.getId(), clElement);
- }
- }
-
- List<ParticipantUpdates> participantUpdates = new ArrayList<>();
- for (ControlLoopElement element : elements.values()) {
- CommonUtils.setServiceTemplatePolicyInfo(element, toscaServiceTemplate);
- CommonUtils.prepareParticipantUpdate(element, participantUpdates);
- }
- clUpdateMsg.setParticipantUpdatesList(participantUpdates);
- return clUpdateMsg;
- }
-
- /**
- * Method to create participantUpdateMsg.
- *
- * @return ParticipantUpdate message
- */
- public static ParticipantUpdate createParticipantUpdateMsg() {
- final ParticipantUpdate participantUpdateMsg = new ParticipantUpdate();
- ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0");
- ToscaConceptIdentifier participantType =
- new ToscaConceptIdentifier("org.onap.policy.controlloop.PolicyControlLoopParticipant", "2.3.1");
-
- participantUpdateMsg.setParticipantId(participantId);
- participantUpdateMsg.setTimestamp(Instant.now());
- participantUpdateMsg.setParticipantType(participantType);
- participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000));
- participantUpdateMsg.setMessageId(UUID.randomUUID());
-
- ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead();
- // Add policies to the toscaServiceTemplate
- TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate);
-
- List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
- for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate()
- .getNodeTemplates().entrySet()) {
- if (ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(),
- toscaServiceTemplate)) {
- CommonUtils.prepareParticipantDefinitionUpdate(
- ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()),
- toscaInputEntry.getKey(), toscaInputEntry.getValue(),
- participantDefinitionUpdates, null);
- }
- }
-
- participantUpdateMsg.setParticipantDefinitionUpdates(participantDefinitionUpdates);
- return participantUpdateMsg;
- }
-
- /**
- * Method to create ControlLoopUpdate using the arguments passed.
- *
- * @param jsonFilePath the path of the controlloop content
- *
- * @return ControlLoopUpdate message
- * @throws CoderException exception while reading the file to object
- */
- public static ControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath) throws CoderException {
- ControlLoopUpdate controlLoopUpdateMsg = CODER.decode(new File(jsonFilePath), ControlLoopUpdate.class);
- return controlLoopUpdateMsg;
- }
-
- private static ToscaServiceTemplate testControlLoopRead() {
- Set<String> controlLoopDirectoryContents =
- ResourceUtils.getDirectoryContents("src/test/resources/utils/servicetemplates");
-
- boolean atLeastOneControlLoopTested = false;
- ToscaServiceTemplate toscaServiceTemplate = null;
-
- for (String controlLoopFilePath : controlLoopDirectoryContents) {
- if (!controlLoopFilePath.endsWith(".yaml")) {
- continue;
- }
- atLeastOneControlLoopTested = true;
- toscaServiceTemplate = testControlLoopYamlSerialization(controlLoopFilePath);
- }
-
- // Add policy_types to the toscaServiceTemplate
- addPolicyTypesToToscaServiceTemplate(toscaServiceTemplate);
-
- assertTrue(atLeastOneControlLoopTested);
- return toscaServiceTemplate;
- }
-
- private static void addPolicyTypesToToscaServiceTemplate(ToscaServiceTemplate toscaServiceTemplate) {
- Set<String> policyTypeDirectoryContents = ResourceUtils.getDirectoryContents("policytypes");
-
- for (String policyTypeFilePath : policyTypeDirectoryContents) {
- String policyTypeString = ResourceUtils.getResourceAsString(policyTypeFilePath);
-
- ToscaServiceTemplate foundPolicyTypeSt =
- yamlTranslator.fromYaml(policyTypeString, ToscaServiceTemplate.class);
-
- toscaServiceTemplate.setDerivedFrom(foundPolicyTypeSt.getDerivedFrom());
- toscaServiceTemplate.setDescription(foundPolicyTypeSt.getDescription());
- toscaServiceTemplate.setMetadata(foundPolicyTypeSt.getMetadata());
- toscaServiceTemplate.setName(foundPolicyTypeSt.getName());
- toscaServiceTemplate.setToscaDefinitionsVersion(foundPolicyTypeSt.getToscaDefinitionsVersion());
- toscaServiceTemplate.setVersion(foundPolicyTypeSt.getVersion());
-
- if (foundPolicyTypeSt.getDataTypes() != null) {
- if (toscaServiceTemplate.getDataTypes() == null) {
- toscaServiceTemplate.setDataTypes(foundPolicyTypeSt.getDataTypes());
- } else {
- toscaServiceTemplate.getDataTypes().putAll(foundPolicyTypeSt.getDataTypes());
- }
- }
-
- if (toscaServiceTemplate.getPolicyTypes() == null) {
- toscaServiceTemplate.setPolicyTypes(foundPolicyTypeSt.getPolicyTypes());
- } else {
- toscaServiceTemplate.getPolicyTypes().putAll(foundPolicyTypeSt.getPolicyTypes());
- }
- }
- }
-
- /**
- * Method to add polcies to the toscaServiceTemplate.
- *
- * @param toscaServiceTemplate to add policies
- */
- public static void addPoliciesToToscaServiceTemplate(ToscaServiceTemplate toscaServiceTemplate) {
- Set<String> policiesDirectoryContents = ResourceUtils.getDirectoryContents("policies");
-
- for (String policiesFilePath : policiesDirectoryContents) {
- String policiesString = ResourceUtils.getResourceAsString(policiesFilePath);
-
- ToscaServiceTemplate foundPoliciesSt = yamlTranslator.fromYaml(policiesString, ToscaServiceTemplate.class);
- toscaServiceTemplate.getToscaTopologyTemplate()
- .setPolicies(foundPoliciesSt.getToscaTopologyTemplate().getPolicies());
- }
- }
-
- private static ToscaServiceTemplate testControlLoopYamlSerialization(String controlLoopFilePath) {
- try {
- String controlLoopString = ResourceUtils.getResourceAsString(controlLoopFilePath);
- if (controlLoopString == null) {
- throw new FileNotFoundException(controlLoopFilePath);
- }
-
- ToscaServiceTemplate serviceTemplate =
- yamlTranslator.fromYaml(controlLoopString, ToscaServiceTemplate.class);
- return serviceTemplate;
- } catch (FileNotFoundException e) {
- LOGGER.error("cannot find YAML file", controlLoopFilePath);
- throw new IllegalArgumentException(e);
- }
- }
-}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties b/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties
index 49781407d..932d9f2c3 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties
@@ -1,6 +1,6 @@
spring.security.user.name=participantUser
spring.security.user.password=zb!XztG34
-server.servlet.context-path=/onap/policyparticipant
+server.servlet.context-path=/onap/policy/clamp/acm/policyparticipant
server.error.path=/error
server.http-port=8085
@@ -15,14 +15,14 @@ participant.intermediaryParameters.reportingTimeInterval: 120000
participant.intermediaryParameters.description: Participant Description
participant.intermediaryParameters.participantId.name: org.onap.PM_Policy
participant.intermediaryParameters.participantId.version: 1.0.0
-participant.intermediaryParameters.participantType.name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+participant.intermediaryParameters.participantType.name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
participant.intermediaryParameters.participantType.version: 2.3.1
-participant.intermediaryParameters.clampControlLoopTopics.name=ControlLoop Topics
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topic=POLICY-CLRUNTIME-PARTICIPANT
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].servers[0]=localhost
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topicCommInfrastructure=dmaap
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].fetchTimeout=15000
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topic=POLICY-CLRUNTIME-PARTICIPANT
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].servers[0]=localhost
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampAutomationCompositionTopics.name=Automation Composition Topics
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topic=POLICY-ACRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].servers[0]=localhost
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].fetchTimeout=15000
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topic=POLICY-ACRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].servers[0]=localhost
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topicCommInfrastructure=dmaap
management.endpoints.web.exposure.include=health,metrics,prometheus
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestACParams.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestACParams.yaml
new file mode 100644
index 000000000..3e5782cdc
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestACParams.yaml
@@ -0,0 +1,172 @@
+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.acm.Participant:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ 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 automation composition element will be started,
+ the first start phase is zero. Automation Composition Elements are started in their start_phase
+ order and stopped in reverse start phase order. Automation Composition Elements with the same start phase are
+ started and stopped simultaneously
+ org.onap.policy.clamp.acm.AutomationComposition:
+ 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.acm.DCAEMicroserviceAutomationCompositionElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
+ properties:
+ dcae_blueprint_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
+ properties:
+ policy_type_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.acm.CDSAutomationCompositionElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
+ properties:
+ cds_blueprint_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+topology_template:
+ node_templates:
+ org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant:
+ version: 2.3.4
+ type: org.onap.policy.clamp.acm.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.policy.acm.MonitoringPolicyAutomationCompositionParticipant:
+ version: 2.3.1
+ type: org.onap.policy.clamp.acm.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.policy.acm.OperationalPolicyAutomationCompositionParticipant:
+ version: 3.2.1
+ type: org.onap.policy.clamp.acm.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant:
+ version: 2.2.1
+ type: org.onap.policy.clamp.acm.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.acm.DCAEMicroserviceAutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element, DCAE microservice for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant
+ version: 2.3.4
+ dcae_blueprint_id:
+ name: org.onap.dcae.blueprints.PMSHBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element, monitoring policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.policy.acm.MonitoringPolicyAutomationCompositionParticipant
+ version: 2.3.1
+ policy_type_id:
+ name: onap.policies.monitoring.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element, operational policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.policy.acm.OperationalPolicyAutomationCompositionParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.operational.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.AutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element for CDS for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant
+ version: 3.2.1
+ cds_blueprint_id:
+ name: org.onap.ccsdk.cds.PMSHCdsBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSHAutomationCompositionDefinition:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.AutomationComposition
+ type_version: 1.0.0
+ description: Automation composition 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_MonitoringPolicyAutomationCompositionElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement
+ version: 1.2.3
+
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
deleted file mode 100644
index 2ef3c6da0..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml
+++ /dev/null
@@ -1,172 +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
- 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
- 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
- participantType:
- 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
- participantType:
- 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
- participantType:
- 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
- participantType:
- 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-policy/src/test/resources/parameters/logback-test.xml b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml
index cf6b89eb9..0f1d28be7 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml
@@ -36,7 +36,7 @@
<appender-ref ref="STDOUT" />
</root>
- <logger name="org.onap.policy.clamp.controlloop.participant" level="trace" additivity="false">
+ <logger name="org.onap.policy.clamp.acm.participant" level="trace" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
</configuration>
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml
deleted file mode 100644
index 126e8e6e2..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml
+++ /dev/null
@@ -1,348 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-topology_template:
- policies:
- -
- OSDF_CASABLANCA.Affinity_Default:
- type: onap.policies.optimization.resource.AffinityPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.Affinity_Default
- metadata:
- policy-id: OSDF_CASABLANCA.Affinity_Default
- policy-version: 1
- properties:
- scope: []
- services: []
- resources: []
- geography: []
- identity: affinity_vCPE
- applicableResources: any
- affinityProperties:
- qualifier: same
- category: complex
- -
- OSDF_CASABLANCA.Affinity_Default_US:
- type: onap.policies.optimization.resource.AffinityPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.Affinity_Default_US
- metadata:
- policy-id: OSDF_CASABLANCA.Affinity_Default_US
- policy-version: 1
- properties:
- scope: []
- services: []
- resources: []
- geography: [US]
- identity: affinity_vCPE
- applicableResources: any
- affinityProperties:
- qualifier: same
- category: complex
- -
- OSDF_CASABLANCA.Affinity_Default_vCPE_US_0:
- type: onap.policies.optimization.resource.AffinityPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.Affinity_Default_vCPE_US_0
- metadata:
- policy-id: OSDF_CASABLANCA.Affinity_Default_vCPE_US_0
- policy-version: 1
- properties:
- scope: []
- services: [vCPE]
- resources: []
- geography: [US]
- identity: affinity_vCPE
- applicableResources: any
- affinityProperties:
- qualifier: different
- category: complex
- -
- OSDF_CASABLANCA.Affinity_vCPE_US_Gold_1:
- type: onap.policies.optimization.resource.AffinityPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.Affinity_vCPE_US_Gold_1
- metadata:
- policy-id: OSDF_CASABLANCA.Affinity_vCPE_1
- policy-version: 1
- properties:
- scope: [gold]
- services: [vCPE]
- resources: [vGMuxInfra, vG]
- geography: [US, INTERNATIONAL]
- identity: affinity_vCPE
- applicableResources: any
- affinityProperties:
- qualifier: same
- category: availabilityZone
- -
- OSDF_CASABLANCA.Affinity_vCPE_US_Platinum_1:
- type: onap.policies.optimization.resource.AffinityPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.Affinity_vCPE_US_Platinum_1
- metadata:
- policy-id: OSDF_CASABLANCA.Affinity_vCPE_1
- policy-version: 1
- properties:
- scope: [platinum]
- services: [vCPE]
- resources: [vGMuxInfra, vG]
- geography: [US, INTERNATIONAL]
- identity: affinity_vCPE
- applicableResources: any
- affinityProperties:
- qualifier: different
- category: availabilityZone
- -
- OSDF_CASABLANCA.Capacity_vG_1:
- type: onap.policies.optimization.resource.Vim_fit
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.Capacity_vG_1
- metadata:
- policy-id: OSDF_CASABLANCA.Capacity_vG_1
- policy-version: 1
- properties:
- scope: []
- services: [vCPE]
- resources: [vG]
- geography: [US, INTERNATIONAL]
- identity: capacity_vG
- applicableResources: any
- capacityProperty:
- controller: multicloud
- request: "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
- -
- OSDF_CASABLANCA.Capacity_vG_2:
- type: onap.policies.optimization.resource.Vim_fit
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.Capacity_vG_2
- metadata:
- policy-id: OSDF_CASABLANCA.Capacity_vG_2
- policy-version: 1
- properties:
- scope: []
- services: [vCPE]
- resources: [vG]
- geography: [US, INTERNATIONAL]
- identity: capacity_vG
- applicableResources: any
- capacityProperty:
- controller: multicloud
- request: "{\"vCPU\": 15, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"MB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
- -
- OSDF_CASABLANCA.Distance_vG_1:
- type: onap.policies.optimization.resource.DistancePolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.Distance_vG_1
- metadata:
- policy-id: OSDF_CASABLANCA.Distance_vG_1
- policy-version: 1
- properties:
- scope: [platinum]
- services: [vCPE]
- resources: [vG]
- geography: [US, INTERNATIONAL]
- identity: distance-vG
- applicableResources: any
- distanceProperties:
- locationInfo: customer_loc
- distance:
- value: 1500
- operator: "<"
- unit: km
- -
- OSDF_CASABLANCA.hpa_policy_Default:
- type: onap.policies.optimization.resource.HpaPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.hpa_policy_Default
- metadata:
- policy-id: OSDF_CASABLANCA.hpa_policy_Default
- policy-version: 1
- properties:
- scope: []
- services: []
- resources: []
- geography: []
- identity: hpa-vG
- flavorFeatures:
- -
- id: vg_1
- type: vnfc
- directives:
- - type: flavor_directives
- attributes:
- - attribute_name: flavor_label_vm_01
- attribute_value: ""
- flavorProperties:
- -
- hpa-feature: basicCapabilities
- mandatory: True
- architecture: generic
- directives: []
- hpa-feature-attributes:
- - hpa-attribute-key: numVirtualCpu
- hpa-attribute-value: 8
- operator: ['>=']
- unit: ""
- - hpa-attribute-key: virtualMemSize
- hpa-attribute-value: 6
- operator: ['<=']
- unit: ""
- -
- hpa-feature: ovsDpdk
- mandatory: False
- architecture: generic
- directives: []
- hpa-feature-attributes:
- - hpa-attribute-key: dataProcessingAccelerationLibrary
- hpa-attribute-value: ovsDpdk_version
- operator: [=]
- unit: ""
- -
- OSDF_CASABLANCA.hpa_policy_vG_1:
- type: onap.policies.optimization.resource.HpaPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.hpa_policy_vG_1
- metadata:
- policy-id: OSDF_CASABLANCA.hpa_policy_vG_1
- policy-version: 1
- properties:
- scope: []
- services: [vCPE, vOtherService]
- resources: [vG]
- geography: []
- identity: hpa-vG
- flavorFeatures:
- -
- id: vg_1
- type: vnfc
- directives:
- - type: flavor_directives
- attributes:
- - attribute_name: flavor_label_vm_01
- attribute_value: ""
- flavorProperties:
- -
- hpa-feature: basicCapabilities
- mandatory: True
- architecture: generic
- directives: []
- hpa-feature-attributes:
- - hpa-attribute-key: numVirtualCpu
- hpa-attribute-value: 6
- operator: ['>=']
- unit: ""
- - hpa-attribute-key: virtualMemSize
- hpa-attribute-value: 4
- operator: ['<=']
- unit: ""
- -
- hpa-feature: ovsDpdk
- mandatory: False
- architecture: generic
- directives: []
- hpa-feature-attributes:
- - hpa-attribute-key: dataProcessingAccelerationLibrary
- hpa-attribute-value: ovsDpdk_version
- operator: [=]
- unit: ""
- -
- OSDF_CASABLANCA.queryPolicy_vCPE:
- type: onap.policies.optimization.service.QueryPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.queryPolicy_vCPE
- metadata:
- policy-id: OSDF_CASABLANCA.queryPolicy_vCPE
- policy-version: 1
- properties:
- scope: []
- services: [vCPE]
- geography: [US, INTERNATIONAL]
- identity: vCPE_Query_Policy
- queryProperties:
- -
- attribute: locationId
- attribute_location: customerLocation
- value: ""
- -
- attribute: id
- attribute_location: "vpnInfo.vpnId"
- value: ""
- -
- attribute: upstreamBW
- attribute_location: "vpnInfo.upstreamBW"
- value: ""
- -
- attribute: customerLatitude
- attribute_location: customerLatitude
- value: 1.1
- -
- attribute: customerLongitude
- attribute_location: customerLongitude
- value: 2.2
- -
- OSDF_CASABLANCA.SubscriberPolicy_v1:
- type: onap.policies.optimization.service.SubscriberPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.SubscriberPolicy_v1
- metadata:
- policy-id: OSDF_CASABLANCA.SubscriberPolicy_v1
- policy-version: 1
- properties:
- scope: []
- services: [vCPE]
- identity: subscriber_vCPE
- subscriberProperties:
- subscriberName: [subscriber_x, subscriber_y]
- subscriberRole: [platinum]
- provStatus: [CAPPED]
- -
- OSDF_CASABLANCA.SubscriberPolicy_v2:
- type: onap.policies.optimization.service.SubscriberPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.SubscriberPolicy_v2
- metadata:
- policy-id: OSDF_CASABLANCA.SubscriberPolicy_v2
- policy-version: 1
- properties:
- scope: []
- services: [vCPE]
- identity: subscriber_vCPE
- subscriberProperties:
- subscriberName: [subscriber_a, subscriber_b]
- subscriberRole: [gold]
- provStatus: [CAPPED]
- -
- OSDF_CASABLANCA.vnfPolicy_vG:
- type: onap.policies.optimization.resource.VnfPolicy
- version: 1.0.0
- type_version: 1.0.0
- name: OSDF_CASABLANCA.vnfPolicy_vG
- metadata:
- policy-id: OSDF_CASABLANCA.vnfPolicy_vG
- policy-version: 1
- properties:
- scope: []
- services: [vCPE]
- resources: [vG]
- geography: [US, INTERNATIONAL]
- identity: vnf_vG
- applicableResources: any
- vnfProperties:
- -
- inventoryProvider: aai
- serviceType: ""
- inventoryType: cloudRegionId
- customerId: ""
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Match.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Match.yaml
deleted file mode 100644
index 88b870580..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Match.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Match:
- derived_from: tosca.policies.Root
- version: 1.0.0
- name: onap.policies.Match
- description: Base Policy Type for matchable Policies
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Naming.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Naming.yaml
deleted file mode 100644
index bde730cd7..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Naming.yaml
+++ /dev/null
@@ -1,102 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Naming:
- derived_from: tosca.policies.Root
- version: 1.0.0
- name: onap.policies.Naming
- description: Virtual policy node for naming
- properties:
- policy-instance-name:
- type: string
- naming-models:
- type: list
- entry_schema:
- type: policy.data.naming-model-entity
-data_types:
- policy.data.naming-model-entity:
- derived_from: tosca.datatypes.Root
- properties:
- nfRole:
- type: string
- required: false
- metadata:
- matchable: true
- naming-type:
- type: string
- required: true
- metadata:
- matchable: true
- naming-recipe:
- type: string
- required: true
- name-operation:
- type: string
- required: false
- naming-properties:
- type: list
- required: true
- entry_schema:
- type: policy.data.naming-property
- policy.data.naming-property:
- derived_from: tosca.datatypes.Root
- properties:
- property-name:
- type: string
- required: true
- metadata:
- matchable: true
- property-value:
- type: string
- required: false
- property-operation:
- type: string
- required: false
- source-system:
- type: string
- required: false
- source-endpoint:
- type: string
- required: false
- increment-sequence:
- type: policy.data.increment-sequence
- required: false
- policy.data.increment-sequence:
- derived_from: tosca.datatypes.Root
- properties:
- scope:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - CLOUD_REGION_ID
- - LOCATION_CLLI
- - VNF
- - VM
- - VFMODULE
- - PRECEEDING
- - TRAILING
- - ENTIRETY
- sequence-type:
- type: string
- require: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - numeric
- - alpha-numeric
- start-value:
- type: string
- required: true
- max:
- type: string
- required: false
- increment:
- type: string
- required: true
- length:
- type: string
- required: true
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Optimization.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Optimization.yaml
deleted file mode 100644
index 7fe0e59de..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Optimization.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Optimization:
- derived_from: tosca.policies.Root
- version: 1.0.0
- name: onap.policies.Optimization
- description: The base policy type for all policies that govern optimization
- properties:
- scope:
- description: Scope for the policy - could be for a specific release.
- type: list
- metadata:
- matchable: true
- required: true
- entry_schema:
- type: string
- geography:
- description: One or more geographic regions
- type: list
- metadata:
- matchable: true
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - US
- - International
- identity:
- description: Used internally for identification
- type: string
- required: true
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.Common.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.Common.yaml
deleted file mode 100644
index 3dc979220..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.Common.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.guard.Common:
- derived_from: tosca.policies.Root
- version: 1.0.0
- name: onap.policies.controlloop.guard.Common
- description: |
- This is the base Policy Type for Guard policies that guard the execution of Operational
- Policies.
- properties:
- actor:
- type: string
- description: Specifies the Actor the guard applies to.
- required: true
- operation:
- type: string
- description: Specified the operation that the actor is performing the guard applies to.
- required: true
- timeRange:
- type: tosca.datatypes.TimeInterval
- description: |
- An optional range of time during the day the guard policy is valid for.
- required: false
- id:
- type: string
- description: The Control Loop id this applies to.
- required: false
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml
deleted file mode 100644
index f2b67e18f..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.guard.common.Blacklist:
- derived_from: onap.policies.controlloop.guard.Common
- type_version: 1.0.0
- version: 1.0.0
- name: onap.policies.controlloop.guard.common.Blacklist
- description: Supports blacklist of entity id's from performing control loop actions on.
- properties:
- blacklist:
- type: list
- description: List of entity id's not allowed to have control loop operations on.
- required: true
- entry_schema:
- type: string
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Filter.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Filter.yaml
deleted file mode 100644
index ea8e92aaf..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Filter.yaml
+++ /dev/null
@@ -1,66 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.guard.common.Filter:
- derived_from: onap.policies.controlloop.guard.Common
- type_version: 1.0.0
- version: 1.0.0
- name: onap.policies.controlloop.guard.common.Filter
- description: Supports filtering of A&AI entities such as vnf-id, type, service, geographic region, etc.
- properties:
- algorithm:
- type: string
- description: Designates the precendence of blacklist vs whitelist
- required: true
- default: blacklist-overrides
- constraints:
- - valid_values: ["blacklist-overrides", "whitelist-overrides"]
- filters:
- type: list
- description: List of filters to be applied.
- required: true
- entry_schema:
- type: onap.datatypes.guard.filter
-data_types:
- onap.datatypes.guard.filter:
- derived_from: tosca.nodes.Root
- properties:
- field:
- type: string
- description: Name of the field to perform the filter on using the A&AI <node>.<property> syntax.
- required: true
- constraints:
- - valid_values:
- - generic-vnf.vnf-name
- - generic-vnf.vnf-id
- - generic-vnf.vnf-type
- - generic-vnf.nf-naming-code
- - vserver.vserver-id
- - cloud-region.cloud-region-id
- filter:
- type: string
- description: The filter value itself. For example, "RegionOne" "vFWCL*"
- required: true
- function:
- type: string
- description: The function applied to the filter.
- required: true
- constraints:
- - valid_values:
- - string-equal
- - string-equal-ignore-case
- - string-regexp-match
- - string-contains
- - string-greater-than
- - string-greater-than-or-equal
- - string-less-than
- - string-less-than-or-equal
- - string-starts-with
- - string-ends-with
- blacklist:
- type: boolean
- description: |
- Indicates if the filter should be treated as a blacklist (true)
- or whitelist (false).
- required: true
- default: true
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml
deleted file mode 100644
index 3e31ec218..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.guard.common.FrequencyLimiter:
- derived_from: onap.policies.controlloop.guard.Common
- type_version: 1.0.0
- version: 1.0.0
- name: onap.policies.controlloop.guard.common.FrequencyLimiter
- description: Supports limiting the frequency of actions being taken by a Actor.
- properties:
- timeWindow:
- type: integer
- description: The time window to count the actions against.
- required: true
- timeUnits:
- type: string
- description: The units of time the window is counting.
- required: true
- constraints:
- - valid_values: ["second", "minute", "hour", "day", "week", "month", "year"]
- limit:
- type: integer
- description: The limit
- required: true
- constraints:
- - greater_than: 0
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.MinMax.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.MinMax.yaml
deleted file mode 100644
index 8f93572bf..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.MinMax.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.guard.common.MinMax:
- derived_from: onap.policies.controlloop.guard.Common
- type_version: 1.0.0
- version: 1.0.0
- name: onap.policies.controlloop.guard.common.MinMax
- description: |
- Supports Min/Max number of entity for scaling operations. Although min and max fields are marked as not
- required, you need to have at least one or the other.
- properties:
- target:
- type: string
- required: true
- description: The target entity that has scaling restricted
- min:
- type: integer
- required: false
- description: The minimum instances of this entity
- max:
- type: integer
- required: false
- description: The maximum instances of this entity
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml
deleted file mode 100644
index eaeee605d..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.Guard:
- derived_from: tosca.policies.Root
- version: 1.0.0
- name: onap.policies.controlloop.Guard
- description: Guard Policies for Control Loop Operational Policies
- onap.policies.controlloop.guard.Coordination:
- derived_from: onap.policies.controlloop.Guard
- version: 1.0.0
- name: onap.policies.controlloop.guard.Coordination
- description: Guard Policies for Control Loop Coordination
- onap.policies.controlloop.guard.coordination.FirstBlocksSecond:
- derived_from: onap.policies.controlloop.guard.Coordination
- version: 1.0.0
- name: onap.policies.controlloop.guard.coordination.FirstBlocksSecond
- description: Supports one Control Loop blocking another
- properties:
- controlLoop:
- type: list
- description: Specific Control Loops to which to apply this guard
- required: true
- constraint:
- length: 2
- entry_schema:
- type: string
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.Common.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.Common.yaml
deleted file mode 100644
index 9b3b057b8..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.Common.yaml
+++ /dev/null
@@ -1,143 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.operational.Common:
- derived_from: tosca.policies.Root
- version: 1.0.0
- name: onap.policies.controlloop.operational.Common
- description: |
- Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant
- Policy Types. This does NOT support the legacy Policy YAML policy type.
- properties:
- id:
- type: string
- description: The unique control loop id.
- required: true
- timeout:
- type: integer
- description: |
- Overall timeout for executing all the operations. This timeout should equal or exceed the total
- timeout for each operation listed.
- required: true
- abatement:
- type: boolean
- description: Whether an abatement event message will be expected for the control loop from DCAE.
- required: true
- default: false
- trigger:
- type: string
- description: Initial operation to execute upon receiving an Onset event message for the Control Loop.
- required: true
- operations:
- type: list
- description: List of operations to be performed when Control Loop is triggered.
- required: true
- entry_schema:
- type: onap.datatype.controlloop.Operation
-
-data_types:
- onap.datatype.controlloop.Target:
- derived_from: tosca.datatypes.Root
- description: Definition for a entity in A&AI to perform a control loop operation on
- properties:
- targetType:
- type: string
- description: Category for the target type
- required: true
- constraints:
- - valid_values: [VNF, VM, VFMODULE, PNF]
- entityIds:
- type: map
- description: |
- Map of values that identify the resource. If none are provided, it is assumed that the
- entity that generated the ONSET event will be the target.
- required: false
- metadata:
- clamp_possible_values: ClampExecution:CSAR_RESOURCES
- entry_schema:
- type: string
-
- onap.datatype.controlloop.Actor:
- derived_from: tosca.datatypes.Root
- description: An actor/operation/target definition
- properties:
- actor:
- type: string
- description: The actor performing the operation.
- required: true
- metadata:
- clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor
- operation:
- type: string
- description: The operation the actor is performing.
- metadata:
- clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation
- required: true
- target:
- type: onap.datatype.controlloop.Target
- description: The resource the operation should be performed on.
- required: true
- payload:
- type: map
- description: Name/value pairs of payload information passed by Policy to the actor
- required: false
- metadata:
- clamp_possible_values: ClampExecution:CDS/payload
- entry_schema:
- type: string
-
- onap.datatype.controlloop.Operation:
- derived_from: tosca.datatypes.Root
- description: An operation supported by an actor
- properties:
- id:
- type: string
- description: Unique identifier for the operation
- required: true
- description:
- type: string
- description: A user-friendly description of the intent for the operation
- required: false
- operation:
- type: onap.datatype.controlloop.Actor
- description: The definition of the operation to be performed.
- required: true
- timeout:
- type: integer
- description: The amount of time for the actor to perform the operation.
- required: true
- retries:
- type: integer
- description: The number of retries the actor should attempt to perform the operation.
- required: true
- default: 0
- success:
- type: string
- description: Points to the operation to invoke on success. A value of "final_success" indicates and end to the operation.
- required: false
- default: final_success
- failure:
- type: string
- description: Points to the operation to invoke on Actor operation failure.
- required: false
- default: final_failure
- failure_timeout:
- type: string
- description: Points to the operation to invoke when the time out for the operation occurs.
- required: false
- default: final_failure_timeout
- failure_retries:
- type: string
- description: Points to the operation to invoke when the current operation has exceeded its max retries.
- required: false
- default: final_failure_retries
- failure_exception:
- type: string
- description: Points to the operation to invoke when the current operation causes an exception.
- required: false
- default: final_failure_exception
- failure_guard:
- type: string
- description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.
- required: false
- default: final_failure_guard
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Apex.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Apex.yaml
deleted file mode 100644
index a0c5b2456..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Apex.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.operational.common.Apex:
- derived_from: onap.policies.controlloop.operational.Common
- type_version: 1.0.0
- version: 1.0.0
- name: onap.policies.controlloop.operational.common.Apex
- description: Operational policies for Apex PDP
- properties:
- engineServiceParameters:
- type: string
- description: The engine parameters like name, instanceCount, policy implementation, parameters etc.
- required: true
- eventInputParameters:
- type: string
- description: The event input parameters.
- required: true
- eventOutputParameters:
- type: string
- description: The event output parameters.
- required: true
- javaProperties:
- type: string
- description: Name/value pairs of properties to be set for APEX if needed.
- required: false
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Drools.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Drools.yaml
deleted file mode 100644
index 69d73db58..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Drools.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.operational.common.Drools:
- derived_from: onap.policies.controlloop.operational.Common
- type_version: 1.0.0
- version: 1.0.0
- name: onap.policies.controlloop.operational.common.Drools
- description: Operational policies for Drools PDP
- properties:
- controllerName:
- type: string
- description: Drools controller properties
- required: false
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-mapper.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-mapper.yaml
deleted file mode 100644
index c50392eca..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-mapper.yaml
+++ /dev/null
@@ -1,50 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- version: 1.0.0
- name: onap.policies.Monitoring
- description: a base policy type for all policies that govern monitoring provisioning
- onap.policies.monitoring.dcae-pm-mapper:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- pm-mapper-filter:
- type: map
- description: PM mapper filter on measInfo, measInfoId, measType, instanceId
- entry_schema:
- type: onap.datatypes.monitoring.pm-mapper-filter
-data_types:
- onap.datatypes.monitoring.pm-mapper-filter:
- derived_from: tosca.datatypes.Root
- properties:
- filters:
- type: list
- description: Filter configuration
- #default: []
- required: true
- entry_schema:
- type: onap.datatypes.monitoring.filters
- onap.datatypes.monitoring.filters:
- derived_from: tosca.datatypes.Root
- properties:
- pmDefVsn:
- type: string
- description: PM Dictionary version
- required: true
- nfType:
- type: string
- description: NF type
- required: true
- vendor:
- type: string
- description: Vendor name
- required: true
- measTypes:
- type: list
- description: Measurement types to collect
- #default: []
- required: true
- entry_schema:
- type: string
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-subscription-handler.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-subscription-handler.yaml
deleted file mode 100644
index 8ac9b7484..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-subscription-handler.yaml
+++ /dev/null
@@ -1,132 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- version: 1.0.0
- name: onap.policies.Monitoring
- description: a base policy type for all policies that govern monitoring provisioning
- onap.policies.monitoring.dcae-pm-subscription-handler:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- subscription:
- type: map
- description: PM Subscription Handler Subscription
- entry_schema:
- type: onap.datatypes.monitoring.subscription
-data_types:
- onap.datatypes.monitoring.subscription:
- derived_from: tosca.datatypes.Root
- properties:
- subscriptionName:
- type: string
- description: Name of the subscription
- required: true
- administrativeState:
- type: string
- description: State of the subscription
- required: true
- constraints:
- - valid_values:
- - LOCKED
- - UNLOCKED
- fileBasedGP:
- type: integer
- description: File based granularity period
- required: true
- fileLocation:
- type: string
- description: ROP file location
- required: true
- nfTypeModelInvariantId:
- type: string
- description: Network function invariant ID
- required: true
- nfFilter:
- type: map
- description: Network function filter
- required: true
- entry_schema:
- type: onap.datatypes.monitoring.nfFilter
- measurementGroups:
- type: list
- description: Measurement Groups
- required: true
- entry_schema:
- type: onap.datatypes.monitoring.measurementGroups
- onap.datatypes.monitoring.nfFilter:
- derived_from: tosca.datatypes.Root
- properties:
- nfNames:
- type: list
- description: List of network functions
- required: true
- #default: []
- entry_schema:
- type: string
- swVersions:
- type: list
- description: List of software versions
- required: true
- #default: []
- entry_schema:
- type: string
- onap.datatypes.monitoring.measurementGroups:
- derived_from: tosca.datatypes.Root
- properties:
- measurementGroup:
- type: map
- description: Measurement Group
- required: true
- entry_schema:
- type: onap.datatypes.monitoring.measurementGroup
- onap.datatypes.monitoring.measurementGroup:
- derived_from: tosca.datatypes.Root
- properties:
- measurementTypes:
- type: list
- description: List of measurement types
- required: true
- #default: []
- entry_schema:
- type: onap.datatypes.monitoring.measurementTypes
- managedObjectDNsBasic:
- type: list
- description: List of managed object distinguished names
- required: true
- #default: []
- entry_schema:
- type: onap.datatypes.monitoring.managedObjectDNsBasics
- onap.datatypes.monitoring.measurementTypes:
- derived_from: tosca.datatypes.Root
- properties:
- measurementType:
- type: map
- description: Measurement type object
- required: true
- entry_schema:
- type: onap.datatypes.monitoring.measurementType
- onap.datatypes.monitoring.measurementType:
- derived_from: tosca.datatypes.Root
- properties:
- measurementType:
- type: string
- description: Measurement type
- required: true
- onap.datatypes.monitoring.managedObjectDNsBasics:
- derived_from: tosca.datatypes.Root
- properties:
- managedObjectDNsBasic:
- type: map
- description: Managed object distinguished name object
- required: true
- entry_schema:
- type: onap.datatypes.monitoring.managedObjectDNsBasic
- onap.datatypes.monitoring.managedObjectDNsBasic:
- derived_from: tosca.datatypes.Root
- properties:
- DN:
- type: string
- description: Managed object distinguished name
- required: true
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml
deleted file mode 100644
index 58e60e98d..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml
+++ /dev/null
@@ -1,128 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- version: 1.0.0
- name: onap.policies.Monitoring
- description: a base policy type for all policies that govern monitoring provisioning
- onap.policies.monitoring.dcae-restconfcollector:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- rcc_policy:
- type: list
- description: RCC Policy JSON
- entry_schema:
- type: onap.datatypes.monitoring.rcc_policy
-data_types:
- onap.datatypes.monitoring.rcc_policy:
- derived_from: tosca.datatypes.Root
- properties:
- controller_name:
- type: string
- description: Name of controller
- required: true
- controller_restapiUrl:
- type: string
- description: Controller's ip and port
- required: true
- controller_restapiUser:
- type: string
- description: Controller's username
- required: true
- controller_restapiPassword:
- type: string
- description: Controller's password
- required: true
- controller_accessTokenUrl:
- type: string
- description: URL to get access token
- required: true
- controller_accessTokenFile:
- type: string
- description: Access token file path
- required: true
- controller_accessTokenMethod:
- type: string
- description: Access token method POST/GET/PUT etc
- required: true
- constraints:
- - valid_values:
- - post
- - get
- - put
- controller_subsMethod:
- type: string
- description: Subscription method POST/GET/PUT etc
- required: true
- default: post
- constraints:
- - valid_values:
- - post
- - get
- - put
- controller_subscriptionUrl:
- type: string
- description: URL to establish subscription
- required: true
- controller_disableSsl:
- type: boolean
- description: Option to disable ssl
- required: true
- default: true
- event_details:
- type: list
- description: event details
- required: true
- entry_schema:
- type: onap.datatypes.monitoring.rcc_event_details
- onap.datatypes.monitoring.rcc_event_details:
- derived_from: tosca.datatypes.Root
- properties:
- event_name:
- type: string
- description: event name
- required: true
- event_description:
- type: string
- description: description of event
- required: false
- event_sseventUrlEmbed:
- type: boolean
- description: Whether SSE url is embedded in subscription response
- required: true
- default: true
- event_sseventsField:
- type: string
- description: Field name to access SSE url in subscription response
- required: true
- event_sseventsUrl:
- type: string
- description: Explicit SSE url
- required: true
- event_subscriptionTemplate:
- type: string
- description: Subscription template file path
- required: true
- event_unSubscriptionTemplate:
- type: string
- description: Unsubscription template file path
- required: false
- event_ruleId:
- type: integer
- description: Rule Id
- required: false
- modifyData:
- type: boolean
- description: Whether to modify the received SSE event
- required: true
- default: false
- modifyMethod:
- type: string
- description: The java method name to modify data
- required: false
- userData:
- type: string
- description: The user specific data
- required: false
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml
deleted file mode 100644
index 408e8cd00..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- description: a base policy type for all policies that govern monitoring provisioning
- version: 1.0.0
- name: onap.policies.Monitoring
- onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- name: onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server
- properties:
- buscontroller_feed_publishing_endpoint:
- type: string
- description: DMAAP Bus Controller feed endpoint
- datafile.policy:
- type: string
- description: datafile Policy JSON as string
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.tcagen2.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.tcagen2.yaml
deleted file mode 100644
index 04026b323..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.tcagen2.yaml
+++ /dev/null
@@ -1,161 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- version: 1.0.0
- name: onap.policies.Monitoring
- description: a base policy type for all policies that govern monitoring provisioning
- onap.policies.monitoring.tcagen2:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- name: onap.policies.monitoring.tcagen2
- properties:
- tca.policy:
- type: onap.datatypes.monitoring.tca_policy
- description: TCA Policy JSON
- required: true
-data_types:
- onap.datatypes.monitoring.metricsPerEventName:
- derived_from: tosca.datatypes.Root
- properties:
- controlLoopSchemaType:
- type: string
- required: true
- description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
- constraints:
- - valid_values:
- - VM
- - VNF
- eventName:
- type: string
- required: true
- description: Event name to which thresholds need to be applied
- policyName:
- type: string
- required: true
- description: TCA Policy Scope Name
- policyScope:
- type: string
- required: true
- description: TCA Policy Scope
- policyVersion:
- type: string
- required: true
- description: TCA Policy Scope Version
- thresholds:
- type: list
- required: true
- description: Thresholds associated with eventName
- entry_schema:
- type: onap.datatypes.monitoring.thresholds
- onap.datatypes.monitoring.tca_policy:
- derived_from: tosca.datatypes.Root
- properties:
- domain:
- type: string
- required: true
- description: Domain name to which TCA needs to be applied
- default: measurementsForVfScaling
- constraints:
- - equal: measurementsForVfScaling
- metricsPerEventName:
- type: list
- required: true
- description: Contains eventName and threshold details that need to be applied to given eventName
- entry_schema:
- type: onap.datatypes.monitoring.metricsPerEventName
- onap.datatypes.monitoring.thresholds:
- derived_from: tosca.datatypes.Root
- properties:
- closedLoopControlName:
- type: string
- required: true
- description: Closed Loop Control Name associated with the threshold
- closedLoopEventStatus:
- type: string
- required: true
- description: Closed Loop Event Status of the threshold
- constraints:
- - valid_values:
- - ONSET
- - ABATED
- direction:
- type: string
- required: true
- description: Direction of the threshold
- constraints:
- - valid_values:
- - LESS
- - LESS_OR_EQUAL
- - GREATER
- - GREATER_OR_EQUAL
- - EQUAL
- fieldPath:
- type: string
- required: true
- description: Json field Path as per CEF message which needs to be analyzed for TCA
- constraints:
- - valid_values:
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
- - $.event.measurementsForVfScalingFields.meanRequestLatency
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
- - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
- severity:
- type: string
- required: true
- description: Threshold Event Severity
- constraints:
- - valid_values:
- - CRITICAL
- - MAJOR
- - MINOR
- - WARNING
- - NORMAL
- thresholdValue:
- type: integer
- required: true
- description: Threshold value for the field Path inside CEF message
- version:
- type: string
- required: true
- description: Version number associated with the threshold
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Apex.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Apex.yaml
deleted file mode 100644
index d2a7632f3..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Apex.yaml
+++ /dev/null
@@ -1,203 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Native:
- derived_from: tosca.policies.Root
- description: a base policy type for all native PDP policies
- version: 1.0.0
- name: onap.policies.Native
- onap.policies.native.Apex:
- derived_from: onap.policies.Native
- description: a policy type for native apex policies
- version: 1.0.0
- name: onap.policies.native.Apex
- properties:
- engine_service:
- type: onap.datatypes.native.apex.EngineService
- description: APEX Engine Service Parameters
- inputs:
- type: map
- description: Inputs for handling events coming into the APEX engine
- entry_schema:
- type: onap.datatypes.native.apex.EventHandler
- outputs:
- type: map
- description: Outputs for handling events going out of the APEX engine
- entry_schema:
- type: onap.datatypes.native.apex.EventHandler
- environment:
- type: list
- description: Envioronmental parameters for the APEX engine
- entry_schema:
- type: onap.datatypes.native.apex.Environment
-
-data_types:
- onap.datatypes.native.apex.EngineService:
- derived_from: tosca.datatypes.Root
- properties:
- name:
- type: string
- description: Specifies the engine name
- required: false
- default: "ApexEngineService"
- version:
- type: string
- description: Specifies the engine version in double dotted format
- required: false
- default: "1.0.0"
- id:
- type: integer
- description: Specifies the engine id
- required: true
- instance_count:
- type: integer
- description: Specifies the number of engine threads that should be run
- required: true
- deployment_port:
- type: integer
- description: Specifies the port to connect to for engine administration
- required: false
- default: 1
- policy_model_file_name:
- type: string
- description: The name of the file from which to read the APEX policy model
- required: false
- policy_type_impl:
- type: string
- description: The policy type implementation from which to read the APEX policy model
- required: false
- periodic_event_period:
- type: string
- description: The time interval in milliseconds for the periodic scanning event, 0 means don't scan
- required: false
- engine:
- type: onap.datatypes.native.apex.engineservice.Engine
- description: The parameters for all engines in the APEX engine service
- required: true
- onap.datatypes.native.apex.EventHandler:
- derived_from: tosca.datatypes.Root
- properties:
- name:
- type: string
- description: Specifies the event handler name, if not specified this is set to the key name
- required: false
- carrier_technology:
- type: onap.datatypes.native.apex.CarrierTechnology
- description: Specifies the carrier technology of the event handler (such as REST/Web Socket/Kafka)
- required: true
- event_protocol:
- type: onap.datatypes.native.apex.EventProtocol
- description: Specifies the event protocol of events for the event handler (such as Yaml/JSON/XML/POJO)
- required: true
- event_name:
- type: string
- description: Specifies the event name for events on this event handler, if not specified, the event name is read from or written to the event being received or sent
- required: false
- event_name_filter:
- type: string
- description: Specifies a filter as a regular expression, events that do not match the filter are dropped, the default is to let all events through
- required: false
- synchronous_mode:
- type: boolean
- description: Specifies the event handler is syncronous (receive event and send response)
- required: false
- default: false
- synchronous_peer:
- type: string
- description: The peer event handler (output for input or input for output) of this event handler in synchronous mode, this parameter is mandatory if the event handler is in synchronous mode
- required: false
- synchronous_timeout:
- type: integer
- description: The timeout in milliseconds for responses to be issued by APEX torequests, this parameter is mandatory if the event handler is in synchronous mode
- required: false
- requestor_mode:
- type: boolean
- description: Specifies the event handler is in requestor mode (send event and wait for response mode)
- required: false
- default: false
- requestor_peer:
- type: string
- description: The peer event handler (output for input or input for output) of this event handler in requestor mode, this parameter is mandatory if the event handler is in requestor mode
- required: false
- requestor_timeout:
- type: integer
- description: The timeout in milliseconds for wait for responses to requests, this parameter is mandatory if the event handler is in requestor mode
- required: false
- onap.datatypes.native.apex.CarrierTechnology:
- derived_from: tosca.datatypes.Root
- properties:
- label:
- type: string
- description: The label (name) of the carrier technology (such as REST, Kafka, WebSocket)
- required: true
- plugin_parameter_class_name:
- type: string
- description: The class name of the class that overrides default handling of event input or output for this carrier technology, defaults to the supplied input or output class
- required: false
- onap.datatypes.native.apex.EventProtocol:
- derived_from: tosca.datatypes.Root
- properties:
- label:
- type: string
- description: The label (name) of the event protocol (such as Yaml, JSON, XML, or POJO)
- required: true
- event_protocol_plugin_class:
- type: string
- description: The class name of the class that overrides default handling of the event protocol for this carrier technology, defaults to the supplied event protocol class
- required: false
- onap.datatypes.native.apex.Environment:
- derived_from: tosca.datatypes.Root
- properties:
- name:
- type: string
- description: The name of the environment variable
- required: true
- value:
- type: string
- description: The value of the environment variable
- required: true
- onap.datatypes.native.apex.engineservice.Engine:
- derived_from: tosca.datatypes.Root
- properties:
- context:
- type: onap.datatypes.native.apex.engineservice.engine.Context
- description: The properties for handling context in APEX engines, defaults to using Java maps for context
- required: false
- executors:
- type: map
- description: The plugins for policy executors used in engines such as javascript, MVEL, Jython
- required: true
- entry_schema:
- description: The plugin class path for this policy executor
- type: string
- onap.datatypes.native.apex.engineservice.engine.Context:
- derived_from: tosca.datatypes.Root
- properties:
- distributor:
- type: onap.datatypes.native.apex.Plugin
- description: The plugin to be used for distributing context between APEX PDPs at runtime
- required: false
- schemas:
- type: map
- description: The plugins for context schemas available in APEX PDPs such as Java and Avro
- required: false
- entry_schema:
- type: onap.datatypes.native.apex.Plugin
- locking:
- type: onap.datatypes.native.apex.Plugin
- description: The plugin to be used for locking context in and between APEX PDPs at runtime
- required: false
- persistence:
- type: onap.datatypes.native.apex.Plugin
- description: The plugin to be used for persisting context for APEX PDPs at runtime
- required: false
- onap.datatypes.native.apex.Plugin:
- derived_from: tosca.datatypes.Root
- properties:
- name:
- type: string
- description: The name of the executor such as Javascript, Jython or MVEL
- required: true
- plugin_class_name:
- type: string
- description: The class path of the plugin class for this executor
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Drools.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Drools.yaml
deleted file mode 100644
index 0ae96dbc2..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Drools.yaml
+++ /dev/null
@@ -1,118 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Native:
- derived_from: tosca.policies.Root
- description: a base policy type for all native PDP policies
- version: 1.0.0
- name: onap.policies.Native
- onap.policies.native.Drools:
- derived_from: onap.policies.Native
- description: a base policy type for all native PDP policies
- version: 1.0.0
- name: onap.policies.native.Drools
- onap.policies.native.drools.Controller:
- derived_from: onap.policies.native.Drools
- description: a policy type for a drools controller configuration
- version: 1.0.0
- name: onap.policies.native.drools.Controller
- properties:
- controllerName:
- type: string
- required: true
- description: the drools controller name
- sourceTopics:
- type: list
- required: false
- description: source topics and applicable events
- entry_schema:
- type: onap.datatypes.dmaap.topic
- sinkTopics:
- type: list
- required: false
- description: sink topics and applicable events
- entry_schema:
- type: onap.datatypes.dmaap.topic
- customConfig:
- type: map
- required: false
- description: any use case specific configurations relevant to the drools controller
- entry_schema:
- type: string
- onap.policies.native.drools.Artifact:
- derived_from: onap.policies.native.Drools
- description: a policy type for native drools artifact policies
- version: 1.0.0
- name: onap.policies.native.drools.Artifact
- properties:
- rulesArtifact:
- type: onap.datatypes.native.rules_artifact
- required: true
- description: the GAV information of the maven artifact
- controller:
- type: onap.datatypes.drools.controller.relation
- required: true
- description: the drools controller to which the current native policy is assigned
-
-data_types:
- onap.datatypes.dmaap.topic:
- derived_from: tosca.datatypes.Root
- properties:
- topicName:
- type: string
- required: true
- description: the dmaap topic name
- events:
- type: list
- required: true
- description: events used by this topic
- entry_schema:
- type: onap.datatypes.dmaap.events
- onap.datatypes.dmaap.events:
- derived_from: tosca.datatypes.Root
- properties:
- eventClass:
- type: string
- required: true
- description: the event canonical class for serialization
- eventFilter:
- type: string
- required: false
- description: the JSONPath based condition to filter out the events to serialize
- customSerialization:
- type: onap.datatypes.dmaap.custom_serialization
- required: false
- description: overrides the default serialization/deserialization mechanisms with custom ones
- onap.datatypes.dmaap.custom_serialization:
- derived_from: tosca.datatypes.Root
- properties:
- customSerializerClass:
- type: string
- required: true
- description: the class that contains the JSON parser serializer/deserializer.
- jsonParser:
- type: string
- required: true
- description: static field in customSerialized class with the json parser (currently only gson supported)
- onap.datatypes.native.rules_artifact:
- derived_from: tosca.datatypes.Root
- properties:
- groupId:
- type: string
- required: true
- description: the groupId of the maven artifact
- artifactId:
- type: string
- required: true
- description: the artifactId of the maven artifact
- version:
- type: string
- required: true
- description: the version of the maven artifact
- onap.datatypes.drools.controller.relation:
- derived_from: tosca.datatypes.Root
- properties:
- name:
- type: string
- required: true
- description: the name of drools controller policy
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Xacml.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Xacml.yaml
deleted file mode 100644
index eb25cdb91..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Xacml.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.Native:
- derived_from: tosca.policies.Root
- description: a base policy type for all native PDP policies
- version: 1.0.0
- name: onap.policies.Native
- onap.policies.native.Xacml:
- derived_from: onap.policies.Native
- description: a policy type for native xacml policies
- version: 1.0.0
- name: onap.policies.native.Xacml
- properties:
- policy:
- type: string
- required: true
- description: The XML XACML 3.0 PolicySet or Policy
- metadata:
- encoding: Base64
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Resource.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Resource.yaml
deleted file mode 100644
index 6b3a2460d..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Resource.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.Resource:
- derived_from: onap.policies.Optimization
- version: 1.0.0
- name: onap.policies.optimization.Resource
- description: The base policy type for all policies that govern optimization for a Resource in a Service.
- properties:
- services:
- description: One or more services that the policy applies to.
- type: list
- metadata:
- matchable: true
- required: true
- entry_schema:
- type: string
- resources:
- description: One or more VNF resources that the policy applies to.
- type: list
- metadata:
- matchable: true
- required: true
- entry_schema:
- type: string
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Service.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Service.yaml
deleted file mode 100644
index 8b37a67e7..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Service.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.Service:
- derived_from: onap.policies.Optimization
- version: 1.0.0
- name: onap.policies.optimization.Service
- description: The base policy type for all policies that govern optimization for a Service.
- properties:
- services:
- description: One or more services that the policy applies to.
- type: list
- metadata:
- matchable: true
- required: true
- entry_schema:
- type: string
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml
deleted file mode 100644
index bb6adb0aa..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.resource.AffinityPolicy:
- derived_from: onap.policies.optimization.Resource
- version: 1.0.0
- name: onap.policies.optimization.resource.AffinityPolicy
- properties:
- applicableResources:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - any
- - all
- affinityProperties:
- type: policy.data.affinityProperties_properties
- required: true
-data_types:
- policy.data.affinityProperties_properties:
- derived_from: tosca.nodes.Root
- properties:
- qualifier:
- type: string
- constraints:
- - valid_values:
- - same
- - different
- category:
- type: string
- required: true
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.DistancePolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.DistancePolicy.yaml
deleted file mode 100644
index f41dcfd6f..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.DistancePolicy.yaml
+++ /dev/null
@@ -1,58 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.resource.DistancePolicy:
- derived_from: onap.policies.optimization.Resource
- version: 1.0.0
- name: onap.policies.optimization.resource.DistancePolicy
- properties:
- applicableResources:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - any
- - all
- distanceProperties:
- type: policy.data.distanceProperties_properties
- required: true
-data_types:
- policy.data.distanceProperties_properties:
- derived_from: tosca.nodes.Root
- properties:
- locationInfo:
- type: string
- required: true
- distance:
- type: policy.data.distance_properties
- required: true
- entry_schema:
- type: policy.data.distance_properties
- policy.data.distance_properties:
- derived_from: tosca.nodes.Root
- properties:
- value:
- type: string
- required: true
- operator:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - <
- - <=
- - '>'
- - '>='
- - =
- unit:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - km
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.HpaPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.HpaPolicy.yaml
deleted file mode 100644
index dfe30774b..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.HpaPolicy.yaml
+++ /dev/null
@@ -1,105 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.resource.HpaPolicy:
- derived_from: onap.policies.optimization.Resource
- version: 1.0.0
- name: onap.policies.optimization.resource.HpaPolicy
- properties:
- flavorFeatures:
- type: list
- required: true
- entry_schema:
- type: policy.data.flavorFeatures_properties
-data_types:
- policy.data.flavorFeatures_properties:
- derived_from: tosca.nodes.Root
- properties:
- id:
- type: string
- required: true
- type:
- type: string
- required: true
- directives:
- type: list
- required: true
- entry_schema:
- type: policy.data.directives_properties
- flavorProperties:
- type: list
- required: true
- entry_schema:
- type: policy.data.flavorProperties_properties
- policy.data.directives_properties:
- derived_from: tosca.nodes.Root
- properties:
- type:
- type: string
- attributes:
- type: list
- entry_schema:
- type: policy.data.directives_attributes_properties
- policy.data.directives_attributes_properties:
- derived_from: tosca.nodes.Root
- properties:
- attribute_name:
- type: string
- attribute_value:
- type: string
- policy.data.flavorProperties_properties:
- derived_from: tosca.nodes.Root
- properties:
- hpa-feature:
- type: string
- required: true
- mandatory:
- type: string
- required: true
- score:
- type: string
- required: false
- architecture:
- type: string
- required: true
- hpa-version:
- type: string
- required: true
- directives:
- type: list
- required: true
- entry_schema:
- type: policy.data.directives_properties
- hpa-feature-attributes:
- type: list
- required: true
- entry_schema:
- type: policy.data.hpa-feature-attributes_properties
- policy.data.hpa-feature-attributes_properties:
- derived_from: tosca.nodes.Root
- properties:
- hpa-attribute-key:
- type: string
- required: true
- hpa-attribute-value:
- type: string
- required: true
- operator:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - <
- - <=
- - '>'
- - '>='
- - =
- - '!='
- - any
- - all
- - subset
- unit:
- type: string
- required: false
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml
deleted file mode 100644
index b0f77d67e..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml
+++ /dev/null
@@ -1,68 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.resource.OptimizationPolicy:
- derived_from: onap.policies.optimization.Resource
- version: 1.0.0
- name: onap.policies.optimization.resource.OptimizationPolicy
- properties:
- objective:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - minimize
- - maximize
- objectiveParameter:
- type: policy.data.objectiveParameter_properties
- required: true
-data_types:
- policy.data.objectiveParameter_properties:
- derived_from: tosca.nodes.Root
- properties:
- parameterAttributes:
- type: list
- required: true
- entry_schema:
- type: policy.data.parameterAttributes_properties
- operator:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - '*'
- - +
- - '-'
- - /
- - '%'
- policy.data.parameterAttributes_properties:
- derived_from: tosca.nodes.Root
- properties:
- resources:
- type: string
- required: true
- customerLocationInfo:
- type: string
- required: true
- parameter:
- type: string
- required: true
- weight:
- type: string
- required: true
- operator:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - '*'
- - +
- - '-'
- - /
- - '%'
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.PciPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.PciPolicy.yaml
deleted file mode 100644
index e636582df..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.PciPolicy.yaml
+++ /dev/null
@@ -1,32 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.resource.PciPolicy:
- derived_from: onap.policies.optimization.Resource
- version: 1.0.0
- name: onap.policies.optimization.resource.PciPolicy
- properties:
- pciProperties:
- type: list
- required: false
- entry_schema:
- type: policy.data.pciProperties_properties
-data_types:
- policy.data.pciProperties_properties:
- derived_from: tosca.nodes.Root
- properties:
- algoCategory:
- type: string
- required: false
- pciOptmizationAlgoName:
- type: string
- required: false
- pciOptimizationNwConstraint:
- type: string
- required: false
- pciOptimizationPriority:
- type: string
- required: false
- pciOptimizationTimeConstraint:
- type: string
- required: false
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.Vim_fit.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.Vim_fit.yaml
deleted file mode 100644
index cb387dda1..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.Vim_fit.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.resource.Vim_fit:
- derived_from: onap.policies.optimization.Resource
- version: 1.0.0
- name: onap.policies.optimization.resource.Vim_fit
- properties:
- applicableResources:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - any
- - all
- capacityProperties:
- type: policy.data.capacityProperties_properties
- required: true
-data_types:
- policy.data.capacityProperties_properties:
- derived_from: tosca.nodes.Root
- properties:
- controller:
- type: string
- required: true
- request:
- type: string
- required: true
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.VnfPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.VnfPolicy.yaml
deleted file mode 100644
index 30b8b7212..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.VnfPolicy.yaml
+++ /dev/null
@@ -1,46 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.resource.VnfPolicy:
- derived_from: onap.policies.optimization.Resource
- version: 1.0.0
- name: onap.policies.optimization.resource.VnfPolicy
- properties:
- applicableResources:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - any
- - all
- vnfProperties:
- type: list
- required: true
- entry_schema:
- type: policy.data.vnfProperties_properties
-data_types:
- policy.data.vnfProperties_properties:
- derived_from: tosca.nodes.Root
- properties:
- inventoryProvider:
- type: string
- required: true
- serviceType:
- type: string
- required: true
- inventoryType:
- type: list
- required: true
- entry_schema:
- type: string
- constraints:
- - valid_values:
- - serviceInstanceId
- - vnfName
- - cloudRegionId
- - vimId
- customerId:
- type: string
- required: true
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.QueryPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.QueryPolicy.yaml
deleted file mode 100644
index 2ff263b24..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.QueryPolicy.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.service.QueryPolicy:
- derived_from: onap.policies.optimization.Service
- version: 1.0.0
- name: onap.policies.optimization.service.QueryPolicy
- properties:
- queryProperties:
- type: list
- required: true
- entry_schema:
- type: policy.data.queryProperties_properties
-data_types:
- policy.data.queryProperties_properties:
- derived_from: tosca.nodes.Root
- properties:
- attribute:
- type: string
- required: true
- value:
- type: string
- required: true
- attribute_location:
- type: string
- required: true
-
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml
deleted file mode 100644
index 81dea2c3c..000000000
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.optimization.service.SubscriberPolicy:
- derived_from: onap.policies.optimization.Service
- version: 1.0.0
- name: onap.policies.optimization.service.SubscriberPolicy
- properties:
- subscriberProperties:
- type: policy.data.subscriberProperties_properties
- required: true
-data_types:
- policy.data.subscriberProperties_properties:
- derived_from: tosca.nodes.Root
- properties:
- subscriberName:
- type: list
- required: true
- metadata:
- contextProvider: true
- entry_schema:
- type: string
- subscriberRole:
- type: list
- required: true
- metadata:
- contextMatchable: scope
- entry_schema:
- type: string
- provStatus:
- type: list
- required: true
- metadata:
- contextAttribute: true
- entry_schema:
- type: string
-
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_automation_composition_tosca.yaml
index 33b42b7bc..3d14cf572 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_automation_composition_tosca.yaml
@@ -10,14 +10,14 @@ data_types:
type: string
required: true
node_types:
- org.onap.policy.clamp.controlloop.Participant:
+ org.onap.policy.clamp.acmParticipant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
requred: false
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acmAutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -34,11 +34,11 @@ node_types:
- 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:
+ description: A value indicating the start phase in which this automation composition element will be started,
+ the first start phase is zero. Automation Composition Elements are started in their start_phase
+ order and stopped in reverse start phase order. Automation Composition Elements with the same start
+ phase are started and stopped simultaneously
+ org.onap.policy.clamp.acmAutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -50,115 +50,115 @@ node_types:
required: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:
+ org.onap.policy.clamp.acmDCAEMicroserviceAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acmAutomationCompositionElement
properties:
dcae_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
- org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement:
+ org.onap.policy.clamp.acmPolicyTypeAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acmAutomationCompositionElement
properties:
policy_type_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
- org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ org.onap.policy.clamp.acmCDSAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acmAutomationCompositionElement
properties:
cds_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
topology_template:
node_templates:
- org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:
+ org.onap.dcae.acmDCAEMicroserviceAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acmParticipant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.policy.controlloop.PolicyControlLoopParticipant:
+ org.onap.policy.acmPolicyAutomationCompositionParticipant:
version: 2.3.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acmParticipant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant:
+ org.onap.ccsdk.cds.acmCdsAutomationCompositionParticipant:
version: 2.2.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acmParticipant
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: org.onap.policy.clamp.acmDCAEMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ description: Automation composition element for DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ name: org.onap.dcae.acmDCAEMicroserviceAutomationCompositionParticipant
version: 2.3.4
dcae_blueprint_id:
name: org.onap.dcae.blueprints.PMSHBlueprint
version: 1.0.0
- org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type: org.onap.policy.clamp.acmPolicyTypeAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ description: Automation composition element for monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acmPolicyAutomationCompositionParticipant
version: 2.3.1
policy_type_id:
name: onap.policies.monitoring.pm-subscription-handler
version: 1.0.0
- org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type: org.onap.policy.clamp.acmPolicyTypeAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the operational policy for Performance Management Subscription Handling
+ description: Automation composition element, operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acmPolicyAutomationCompositionParticipant
version: 2.3.1
policy_type_id:
name: onap.policies.operational.pm-subscription-handler
version: 1.0.0
- org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement:
+ org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoopElement
+ type: org.onap.policy.clamp.acmAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for CDS for Performance Management Subscription Handling
+ description: Automation composition element for CDS for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
+ name: org.onap.ccsdk.cds.acmCdsAutomationCompositionParticipant
version: 3.2.1
cds_blueprint_id:
name: org.onap.ccsdk.cds.PMSHCdsBlueprint
version: 1.0.0
- org.onap.domain.pmsh.PMSHControlLoopDefinition:
+ org.onap.domain.pmsh.PMSHAutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acmAutomationComposition
type_version: 1.0.0
- description: Control loop for Performance Management Subscription Handling
+ description: Automation composition 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
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement
version: 1.2.3
diff --git a/participant/participant-impl/participant-impl-simulator/pom.xml b/participant/participant-impl/participant-impl-simulator/pom.xml
index c19e45ee0..5673cb7c8 100644
--- a/participant/participant-impl/participant-impl-simulator/pom.xml
+++ b/participant/participant-impl/participant-impl-simulator/pom.xml
@@ -31,7 +31,7 @@
<artifactId>policy-clamp-participant-impl-simulator</artifactId>
<name>${project.artifactId}</name>
- <description>Participant simulator, used to test control loops</description>
+ <description>Participant simulator, used to test automation compositions</description>
<build>
<plugins>
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/ParticipantSimulatorApplication.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/ParticipantSimulatorApplication.java
index 5e72d9479..ea94795fb 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/ParticipantSimulatorApplication.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/ParticipantSimulatorApplication.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator;
+package org.onap.policy.clamp.acm.participant.simulator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -31,11 +31,11 @@ import org.springframework.context.annotation.ComponentScan;
*/
// @formatter:off
@SpringBootApplication
-@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.simulator.main.parameters")
+@ConfigurationPropertiesScan("org.onap.policy.clamp.acm.participant.simulator.main.parameters")
@ComponentScan({
- "org.onap.policy.clamp.controlloop.participant.simulator",
- "org.onap.policy.clamp.controlloop.participant.intermediary",
- "org.onap.policy.clamp.controlloop.common.rest"
+ "org.onap.policy.clamp.acm.participant.simulator",
+ "org.onap.policy.clamp.acm.participant.intermediary",
+ "org.onap.policy.clamp.acm.common.rest"
})
//@formatter:on
public class ParticipantSimulatorApplication {
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/AafConfiguration.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/AafConfiguration.java
index c8922a1f5..101e7fac2 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/AafConfiguration.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/AafConfiguration.java
@@ -21,10 +21,10 @@
*
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.config;
+package org.onap.policy.clamp.acm.participant.simulator.config;
import javax.servlet.Filter;
-import org.onap.policy.clamp.controlloop.participant.simulator.main.rest.ParticipantSimulatorAafFilter;
+import org.onap.policy.clamp.acm.participant.simulator.main.rest.ParticipantSimulatorAafFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/ParticipantConfig.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/ParticipantConfig.java
index f2079edf5..92ced99d7 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/ParticipantConfig.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/ParticipantConfig.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.config;
+package org.onap.policy.clamp.acm.participant.simulator.config;
-import org.onap.policy.clamp.controlloop.common.rest.RequestResponseLoggingFilter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.simulator.main.handler.ControlLoopElementHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.simulator.main.handler.AutomationCompositionElementHandler;
+import org.onap.policy.clamp.common.acm.rest.RequestResponseLoggingFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
@@ -47,15 +47,15 @@ public class ParticipantConfig {
}
/**
- * Register ControlLoopElementListener.
+ * Register AutomationCompositionElementListener.
*
* @param intermediaryApi the ParticipantIntermediaryApi
- * @param clElementHandler the ControlLoop Element Handler
+ * @param acElementHandler the AutomationComposition Element Handler
*/
@Autowired
- public void registerControlLoopElementListener(ParticipantIntermediaryApi intermediaryApi,
- ControlLoopElementHandler clElementHandler) {
- intermediaryApi.registerControlLoopElementListener(clElementHandler);
- clElementHandler.setIntermediaryApi(intermediaryApi);
+ public void registerAutomationCompositionElementListener(ParticipantIntermediaryApi intermediaryApi,
+ AutomationCompositionElementHandler acElementHandler) {
+ intermediaryApi.registerAutomationCompositionElementListener(acElementHandler);
+ acElementHandler.setIntermediaryApi(intermediaryApi);
}
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/SecurityConfig.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SecurityConfig.java
index cdfd5eac3..c41c6e1b3 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/SecurityConfig.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SecurityConfig.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.config;
+package org.onap.policy.clamp.acm.participant.simulator.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/SpringFoxConfig.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SpringFoxConfig.java
index bf776140b..d9909818f 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/SpringFoxConfig.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SpringFoxConfig.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.config;
+package org.onap.policy.clamp.acm.participant.simulator.config;
-import org.onap.policy.clamp.controlloop.participant.simulator.simulation.rest.SimulationElementController;
+import org.onap.policy.clamp.acm.participant.simulator.simulation.rest.SimulationElementController;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/YamlConfiguration.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/YamlConfiguration.java
index 28dd2f9bc..718697786 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/YamlConfiguration.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/YamlConfiguration.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.config;
+package org.onap.policy.clamp.acm.participant.simulator.config;
import java.util.List;
-import org.onap.policy.clamp.controlloop.common.rest.CoderHttpMesageConverter;
+import org.onap.policy.clamp.common.acm.rest.CoderHttpMesageConverter;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandler.java
new file mode 100644
index 000000000..9e30c8809
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandler.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.simulator.main.handler;
+
+import java.time.Instant;
+import java.util.UUID;
+import lombok.Setter;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class handles implementation of automationCompositionElement updates.
+ */
+@Component
+public class AutomationCompositionElementHandler implements AutomationCompositionElementListener {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionElementHandler.class);
+
+ @Setter
+ private ParticipantIntermediaryApi intermediaryApi;
+
+ /**
+ * Callback method to handle a automation composition element state change.
+ *
+ * @param automationCompositionElementId the ID of the automation composition element
+ * @param currentState the current state of the automation composition element
+ * @param newState the state to which the automation composition element is changing to
+ * @throws PfModelException in case of an exception
+ */
+ @Override
+ public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ UUID automationCompositionElementId, AutomationCompositionState currentState,
+ AutomationCompositionOrderedState newState) throws PfModelException {
+ switch (newState) {
+ case UNINITIALISED:
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.UNINITIALISED,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
+ break;
+ case PASSIVE:
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
+ break;
+ case RUNNING:
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.RUNNING,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
+ break;
+ default:
+ LOGGER.debug("Unknown orderedstate {}", newState);
+ break;
+ }
+ }
+
+ /**
+ * Callback method to handle an update on a automation composition element.
+ *
+ * @param element the information on the automation composition element
+ * @param acElementDefinition toscaNodeTemplate
+ * @throws PfModelException in case of an exception
+ */
+ @Override
+ public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
+ AutomationCompositionElement element, ToscaNodeTemplate acElementDefinition) throws PfModelException {
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
+ element.getOrderedState(), AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
+ }
+
+ @Override
+ public void handleStatistics(UUID automationCompositionElementId) throws PfModelException {
+ var acElement = intermediaryApi.getAutomationCompositionElement(automationCompositionElementId);
+ if (acElement != null) {
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setState(acElement.getState());
+ acElementStatistics.setTimeStamp(Instant.now());
+ intermediaryApi.updateAutomationCompositionElementStatistics(automationCompositionElementId,
+ acElementStatistics);
+ }
+ }
+
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/ParticipantSimulatorParameters.java
index 99579006c..8549e4c7b 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/ParticipantSimulatorParameters.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.main.parameters;
+package org.onap.policy.clamp.acm.participant.simulator.main.parameters;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/AbstractRestController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/AbstractRestController.java
index 5a6dbfa81..4db07c953 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/AbstractRestController.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/AbstractRestController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.main.rest;
+package org.onap.policy.clamp.acm.participant.simulator.main.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.BasicAuthDefinition;
@@ -27,26 +27,38 @@ import io.swagger.annotations.SecurityDefinition;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Tag;
import java.net.HttpURLConnection;
+import java.util.UUID;
import javax.ws.rs.core.MediaType;
import lombok.AccessLevel;
import lombok.Getter;
-import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationProvider;
+import org.onap.policy.clamp.acm.participant.simulator.simulation.SimulationProvider;
+import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Common superclass to provide REST endpoints for the participant simulator.
*/
// @formatter:off
-@RequestMapping(value = "/v2", produces = {MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML})
+@RequestMapping(
+ value = "/v2",
+ produces = {
+ MediaType.APPLICATION_JSON,
+ AbstractRestController.APPLICATION_YAML
+ }
+)
@Api(value = "Participant Simulator API")
@SwaggerDefinition(
- info = @Info(description =
- "Participant Simulator", version = "v1.0",
- title = "Participant Simulator"),
+ info = @Info(
+ description = "Participant Simulator",
+ version = "v1.0",
+ title = "Participant Simulator"
+ ),
consumes = {MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML},
produces = {MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML},
schemes = {SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS},
- tags = {@Tag(name = "participantsim", description = "Participant Simulator")},
+ tags = {
+ @Tag(name = "participantsim", description = "Participant Simulator")
+ },
securityDefinition = @SecurityDefinition(basicAuthDefinitions = {@BasicAuthDefinition(key = "basicAuth")}))
// @formatter:on
public abstract class AbstractRestController {
@@ -86,8 +98,8 @@ public abstract class AbstractRestController {
public static final String AUTHORIZATION_ERROR_MESSAGE = "Authorization Error";
public static final String SERVER_ERROR_MESSAGE = "Internal Server Error";
- @Getter(AccessLevel.PROTECTED)
// The provider for simulation requests
+ @Getter(AccessLevel.PROTECTED)
private SimulationProvider simulationProvider;
/**
@@ -99,4 +111,20 @@ public abstract class AbstractRestController {
this.simulationProvider = simulationProvider;
}
+ /**
+ * Get the common headers for responses.
+ *
+ * @param requestId the request ID
+ *
+ * @return the headers
+ */
+ protected HttpHeaders getCommonHeaders(UUID requestId) {
+ HttpHeaders commonHeaders = new HttpHeaders();
+ commonHeaders.add(VERSION_MINOR_NAME, API_VERSION.split("\\.")[1]);
+ commonHeaders.add(VERSION_PATCH_NAME, API_VERSION.split("\\.")[2]);
+ commonHeaders.add(VERSION_LATEST_NAME, API_VERSION);
+ commonHeaders.add(REQUEST_ID_NAME, (requestId != null ? requestId.toString() : null));
+
+ return commonHeaders;
+ }
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/GlobalControllerExceptionHandler.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/GlobalControllerExceptionHandler.java
index 8648c253e..69714137f 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/GlobalControllerExceptionHandler.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/GlobalControllerExceptionHandler.java
@@ -20,11 +20,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.main.rest;
+package org.onap.policy.clamp.acm.participant.simulator.main.rest;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
-import org.onap.policy.clamp.controlloop.models.rest.RestUtils;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.rest.RestUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@@ -33,13 +33,13 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
public class GlobalControllerExceptionHandler {
/**
- * Handle ControlLoopException.
+ * Handle AutomationCompositionException.
*
- * @param ex ControlLoopException
+ * @param ex AutomationCompositionException
* @return ResponseEntity
*/
- @ExceptionHandler(ControlLoopException.class)
- public ResponseEntity<SimpleResponse> handleBadRequest(ControlLoopException ex) {
+ @ExceptionHandler(AutomationCompositionException.class)
+ public ResponseEntity<SimpleResponse> handleBadRequest(AutomationCompositionException ex) {
return RestUtils.toSimpleResponse(ex);
}
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/ParticipantErrorController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantErrorController.java
index 75546196a..e32c57254 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/ParticipantErrorController.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantErrorController.java
@@ -20,13 +20,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.main.rest;
+package org.onap.policy.clamp.acm.participant.simulator.main.rest;
import java.util.Map;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.TypedSimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.error.ErrorAttributeOptions;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java
index f200f975a..3008d2d17 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.main.rest;
+package org.onap.policy.clamp.acm.participant.simulator.main.rest;
import org.onap.policy.common.endpoints.http.server.aaf.AafGranularAuthFilter;
import org.onap.policy.common.utils.resources.MessageConstants;
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/SimulationProvider.java
index 688f7df6b..73ae80e29 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/SimulationProvider.java
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.simulation;
+package org.onap.policy.clamp.acm.participant.simulator.simulation;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.rest.TypedSimpleResponse;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
import org.springframework.stereotype.Service;
/**
- * This provider class simulation of participants and control loop elements.
+ * This provider class simulation of participants and automation composition elements.
*/
@Service
public class SimulationProvider {
@@ -42,6 +42,7 @@ public class SimulationProvider {
/**
* Create a participant simulation provider.
+ *
* @param intermediaryApi the intermediary to use for talking to the CLAMP runtime
*/
public SimulationProvider(ParticipantIntermediaryApi intermediaryApi) {
@@ -49,38 +50,40 @@ public class SimulationProvider {
}
/**
- * Get the control loops.
+ * Get the automation compositions.
*
- * @param name the controlLoop, null to get all
- * @param version the controlLoop, null to get all
- * @return the control loops
- * @throws ControlLoopException on errors getting the control loops
+ * @param name the automationComposition, null to get all
+ * @param version the automationComposition, null to get all
+ * @return the automation compositions
+ * @throws AutomationCompositionException on errors getting the automation compositions
*/
- public ControlLoops getControlLoops(String name, String version) throws ControlLoopException {
- return intermediaryApi.getControlLoops(name, version);
+ public AutomationCompositions getAutomationCompositions(String name, String version)
+ throws AutomationCompositionException {
+ return intermediaryApi.getAutomationCompositions(name, version);
}
/**
- * Get the simulated control loop elements.
+ * Get the simulated automation composition elements.
*
- * @param name the controlLoopElement, null to get all
- * @param version the controlLoopElement, null to get all
- * @return the control loop elements
+ * @param name the automationCompositionElement, null to get all
+ * @param version the automationCompositionElement, null to get all
+ * @return the automation composition elements
*/
- public Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version) {
- return intermediaryApi.getControlLoopElements(name, version);
+ public Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version) {
+ return intermediaryApi.getAutomationCompositionElements(name, version);
}
/**
- * Update the given control loop element in the simulator.
+ * Update the given automation composition element in the simulator.
*
- * @param element the control loop element to update
+ * @param element the automation composition element to update
* @return response simple response returned
*/
- public TypedSimpleResponse<ControlLoopElement> updateControlLoopElement(ControlLoopElement element) {
- TypedSimpleResponse<ControlLoopElement> response = new TypedSimpleResponse<>();
- response.setResponse(intermediaryApi.updateControlLoopElementState(null, element.getId(),
- element.getOrderedState(), element.getState(), ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE));
+ public TypedSimpleResponse<AutomationCompositionElement> updateAutomationCompositionElement(
+ AutomationCompositionElement element) {
+ TypedSimpleResponse<AutomationCompositionElement> response = new TypedSimpleResponse<>();
+ response.setResponse(intermediaryApi.updateAutomationCompositionElementState(null, element.getId(),
+ element.getOrderedState(), element.getState(), ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE));
return response;
}
@@ -104,7 +107,7 @@ public class SimulationProvider {
public TypedSimpleResponse<Participant> updateParticipant(Participant participant) {
TypedSimpleResponse<Participant> response = new TypedSimpleResponse<>();
response.setResponse(
- intermediaryApi.updateParticipantState(participant.getDefinition(), participant.getParticipantState()));
+ intermediaryApi.updateParticipantState(participant.getDefinition(), participant.getParticipantState()));
return response;
}
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationElementController.java
index e0569cf0f..277638220 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationElementController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.simulation.rest;
+package org.onap.policy.clamp.acm.participant.simulator.simulation.rest;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -30,11 +30,11 @@ import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.ResponseHeader;
import java.util.Map;
import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.messages.rest.TypedSimpleResponse;
-import org.onap.policy.clamp.controlloop.participant.simulator.main.rest.AbstractRestController;
-import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationProvider;
+import org.onap.policy.clamp.acm.participant.simulator.main.rest.AbstractRestController;
+import org.onap.policy.clamp.acm.participant.simulator.simulation.SimulationProvider;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -44,7 +44,7 @@ import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;
/**
- * Class to provide REST end points for participant simulator to query/update details of controlLoopElements.
+ * Class to provide REST end points for participant simulator to query/update details of automationCompositionElements.
*/
@RestController
public class SimulationElementController extends AbstractRestController {
@@ -59,22 +59,22 @@ public class SimulationElementController extends AbstractRestController {
}
/**
- * Queries details of all control loop element within the simulator.
+ * Queries details of all automation composition element within the simulator.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the Control Loop element to get, null to get all
- * @param version the version of the Control Loop element to get, null to get all
- * @return the control loop elements
+ * @param name the name of the Automation Composition element to get, null to get all
+ * @param version the version of the Automation Composition element to get, null to get all
+ * @return the automation composition elements
*/
// @formatter:off
@GetMapping("/elements/{name}/{version}")
@ApiOperation(
- value = "Query details of the requested simulated control loop elements",
- notes = "Queries details of the requested simulated control loop elements, "
- + "returning all control loop element details",
- response = ControlLoops.class,
+ value = "Query details of the requested simulated automation composition elements",
+ notes = "Queries details of the requested simulated automation composition elements, "
+ + "returning all automation composition element details",
+ response = AutomationCompositions.class,
tags = {
- "Clamp Control Loop Participant Simulator API"
+ "Clamp Automation Composition Participant Simulator API"
},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@@ -106,33 +106,35 @@ public class SimulationElementController extends AbstractRestController {
}
)
// @formatter:on
- public ResponseEntity<Map<UUID, ControlLoopElement>> elements(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control loop element name", required = true) @PathVariable("name") String name,
- @ApiParam(
- value = "Control loop element version",
- required = true) @PathVariable("version") String version) {
+ public ResponseEntity<Map<UUID, AutomationCompositionElement>> elements(
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition element name", required = true) @PathVariable("name") String name,
+ @ApiParam(
+ value = "Automation composition element version",
+ required = true) @PathVariable("version") String version) {
- return ResponseEntity.ok().body(getSimulationProvider().getControlLoopElements(name, version));
+ return ResponseEntity
+ .ok()
+ .headers(super.getCommonHeaders(requestId))
+ .body(getSimulationProvider().getAutomationCompositionElements(name, version));
}
/**
- * Updates a control loop element in the simulator.
+ * Updates a automation composition element in the simulator.
*
* @param requestId request ID used in ONAP logging
- * @param body the body of a control loop element
+ * @param body the body of a automation composition element
* @return a response
*/
// @formatter:off
@PutMapping("/elements")
@ApiOperation(
- value = "Updates simulated control loop elements",
- notes = "Updates simulated control loop elements, returning the updated control loop definition IDs",
+ value = "Updates simulated automation composition elements",
+ notes = "Updates simulated automation composition elements, "
+ + "returning the updated automation composition definition IDs",
response = TypedSimpleResponse.class,
tags = {
- "Clamp Control Loop Participant Simulator API"
+ "Clamp Automation Composition Participant Simulator API"
},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@@ -172,12 +174,15 @@ public class SimulationElementController extends AbstractRestController {
}
)
// @formatter:on
- public ResponseEntity<TypedSimpleResponse<ControlLoopElement>> update(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Body of a control loop element", required = true) @RequestBody ControlLoopElement body) {
+ public ResponseEntity<TypedSimpleResponse<AutomationCompositionElement>> update(
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(
+ value = "Body of a automation composition element",
+ required = true) @RequestBody AutomationCompositionElement body) {
- return ResponseEntity.ok().body(getSimulationProvider().updateControlLoopElement(body));
+ return ResponseEntity
+ .ok()
+ .headers(super.getCommonHeaders(requestId))
+ .body(getSimulationProvider().updateAutomationCompositionElement(body));
}
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationParticipantController.java
index 25ae4ac22..02e56aa6e 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationParticipantController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.simulation.rest;
+package org.onap.policy.clamp.acm.participant.simulator.simulation.rest;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -30,10 +30,10 @@ import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.ResponseHeader;
import java.util.List;
import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.messages.rest.TypedSimpleResponse;
-import org.onap.policy.clamp.controlloop.participant.simulator.main.rest.AbstractRestController;
-import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationProvider;
+import org.onap.policy.clamp.acm.participant.simulator.main.rest.AbstractRestController;
+import org.onap.policy.clamp.acm.participant.simulator.simulation.SimulationProvider;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -72,7 +72,7 @@ public class SimulationParticipantController extends AbstractRestController {
+ "returning all participant details",
response = List.class,
tags = {
- "Clamp Control Loop Participant Simulator API"
+ "Clamp Automation Composition Participant Simulator API"
},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@@ -109,7 +109,10 @@ public class SimulationParticipantController extends AbstractRestController {
@ApiParam(value = "Participant name", required = true) @PathVariable("name") String name,
@ApiParam(value = "Participant version", required = true) @PathVariable("version") String version) {
- return ResponseEntity.ok().body(getSimulationProvider().getParticipants(name, version));
+ return ResponseEntity
+ .ok()
+ .headers(super.getCommonHeaders(requestId))
+ .body(getSimulationProvider().getParticipants(name, version));
}
/**
@@ -123,10 +126,10 @@ public class SimulationParticipantController extends AbstractRestController {
@PutMapping("/participants")
@ApiOperation(
value = "Updates simulated participants",
- notes = "Updates simulated participants, returning the updated control loop definition IDs",
+ notes = "Updates simulated participants, returning the updated automation composition definition IDs",
response = TypedSimpleResponse.class,
tags = {
- "Clamp Control Loop Participant Simulator API"
+ "Clamp Automation Composition Participant Simulator API"
},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@@ -170,6 +173,9 @@ public class SimulationParticipantController extends AbstractRestController {
@RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
@ApiParam(value = "Body of a participant", required = true) @RequestBody Participant body) {
- return ResponseEntity.ok().body(getSimulationProvider().updateParticipant(body));
+ return ResponseEntity
+ .ok()
+ .headers(super.getCommonHeaders(requestId))
+ .body(getSimulationProvider().updateParticipant(body));
}
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandler.java
deleted file mode 100644
index fd46faf97..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandler.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.simulator.main.handler;
-
-import java.time.Instant;
-import java.util.UUID;
-import lombok.Setter;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * This class handles implementation of controlLoopElement updates.
- */
-@Component
-public class ControlLoopElementHandler implements ControlLoopElementListener {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopElementHandler.class);
-
- @Setter
- private ParticipantIntermediaryApi intermediaryApi;
-
- /**
- * Callback method to handle a control loop element state change.
- *
- * @param controlLoopElementId the ID of the control loop element
- * @param currentState the current state of the control loop element
- * @param newState the state to which the control loop element is changing to
- * @throws PfModelException in case of an exception
- */
- @Override
- public void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId,
- UUID controlLoopElementId, ControlLoopState currentState,
- ControlLoopOrderedState newState) throws PfModelException {
- switch (newState) {
- case UNINITIALISED:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.UNINITIALISED,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- break;
- case PASSIVE:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- break;
- case RUNNING:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.RUNNING,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- break;
- default:
- LOGGER.debug("Unknown orderedstate {}", newState);
- break;
- }
- }
-
- /**
- * Callback method to handle an update on a control loop element.
- *
- * @param element the information on the control loop element
- * @param clElementDefinition toscaNodeTemplate
- * @throws PfModelException in case of an exception
- */
- @Override
- public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId, ControlLoopElement element,
- ToscaNodeTemplate clElementDefinition)
- throws PfModelException {
- intermediaryApi.updateControlLoopElementState(controlLoopId, element.getId(), element.getOrderedState(),
- ControlLoopState.PASSIVE, ParticipantMessageType.CONTROL_LOOP_UPDATE);
- }
-
- @Override
- public void handleStatistics(UUID controlLoopElementId) throws PfModelException {
- var clElement = intermediaryApi.getControlLoopElement(controlLoopElementId);
- if (clElement != null) {
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setControlLoopState(clElement.getState());
- clElementStatistics.setTimeStamp(Instant.now());
- intermediaryApi.updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics);
- }
- }
-
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
index d750d46d2..e20f0ebf5 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
@@ -21,17 +21,17 @@ participant:
participantType:
name: org.onap.PM_CDS_Blueprint
version: 1.0.0
- clampControlLoopTopics:
+ clampAutomationCompositionTopics:
topicSources:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:localhost}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
topicSinks:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:localhost}
topicCommInfrastructure: dmaap
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt b/participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt
index dbd67585f..5fcdcab5a 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt
+++ b/participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt
@@ -1,4 +1,4 @@
-ONAP Tosca defined control loop Participant
+ONAP Tosca defined automation composition Participant
Version: ${project.version}
Built (UTC): ${maven.build.timestamp}
ONAP https://wiki.onap.org
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/endtoend/ParticipantSimulatorTest.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/endtoend/ParticipantSimulatorTest.java
index 14f51269a..de6855d03 100644
--- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/endtoend/ParticipantSimulatorTest.java
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/endtoend/ParticipantSimulatorTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.endtoend;
+package org.onap.policy.clamp.acm.participant.simulator.endtoend;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -41,19 +41,19 @@ import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.rest.TypedSimpleResponse;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopUpdateListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.CommonTestData;
-import org.onap.policy.clamp.controlloop.participant.simulator.main.rest.AbstractRestController;
-import org.onap.policy.clamp.controlloop.participant.simulator.main.rest.TestListenerUtils;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.AutomationCompositionUpdateListener;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.simulator.main.parameters.CommonTestData;
+import org.onap.policy.clamp.acm.participant.simulator.main.rest.AbstractRestController;
+import org.onap.policy.clamp.acm.participant.simulator.main.rest.TestListenerUtils;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.gson.GsonMessageBodyHandler;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -97,10 +97,12 @@ class ParticipantSimulatorTest {
synchronized (lockit) {
if (!check) {
check = true;
- ControlLoopUpdateListener clUpdateListener = new ControlLoopUpdateListener(participantHandler);
+ AutomationCompositionUpdateListener acUpdateListener =
+ new AutomationCompositionUpdateListener(participantHandler);
- ControlLoopUpdate controlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg();
- clUpdateListener.onTopicEvent(INFRA, TOPIC, null, controlLoopUpdateMsg);
+ AutomationCompositionUpdate automationCompositionUpdateMsg =
+ TestListenerUtils.createAutomationCompositionUpdateMsg();
+ acUpdateListener.onTopicEvent(INFRA, TOPIC, null, automationCompositionUpdateMsg);
}
}
@@ -193,8 +195,8 @@ class ParticipantSimulatorTest {
// GET REST call for querying the participants
Response response = performGet(
- PARTICIPANTS_ENDPOINT + "/" + participant.getKey().getName() + "/" + participant.getKey().getVersion(),
- uuid);
+ PARTICIPANTS_ENDPOINT + "/" + participant.getKey().getName() + "/" + participant.getKey().getVersion(),
+ uuid);
checkResponseEntity(response, 200, uuid);
Participant[] returnValue = response.readEntity(Participant[].class);
@@ -219,18 +221,18 @@ class ParticipantSimulatorTest {
}
@Test
- void testQueryControlLoopElements() throws Exception {
+ void testQueryAutomationCompositionElements() throws Exception {
setUp();
UUID uuid = UUID.randomUUID();
ToscaConceptIdentifier participantId = CommonTestData.getParticipantId();
- // GET REST call for querying the controlLoop elements
+ // GET REST call for querying the automationComposition elements
Response response =
- performGet(ELEMENTS_ENDPOINT + "/" + participantId.getName() + "/" + participantId.getVersion(), uuid);
+ performGet(ELEMENTS_ENDPOINT + "/" + participantId.getName() + "/" + participantId.getVersion(), uuid);
checkResponseEntity(response, 200, uuid);
Map<?, ?> returnValue = response.readEntity(Map.class);
- // Verify the result of GET controlloop elements with what is stored
+ // Verify the result of GET automation composition elements with what is stored
assertThat(returnValue).isEmpty();
}
@@ -242,7 +244,7 @@ class ParticipantSimulatorTest {
void testUpdateParticipant() throws Exception {
setUp();
List<Participant> participants = participantIntermediaryApi.getParticipants(
- CommonTestData.getParticipantId().getName(), CommonTestData.getParticipantId().getVersion());
+ CommonTestData.getParticipantId().getName(), CommonTestData.getParticipantId().getVersion());
assertEquals(ParticipantState.UNKNOWN, participants.get(0).getParticipantState());
// Change the state of the participant to PASSIVE from UNKNOWN
participants.get(0).setParticipantState(ParticipantState.PASSIVE);
@@ -253,7 +255,7 @@ class ParticipantSimulatorTest {
checkResponseEntity(response, 200, uuid);
TypedSimpleResponse<Participant> resp =
- response.readEntity(new GenericType<TypedSimpleResponse<Participant>>() {});
+ response.readEntity(new GenericType<TypedSimpleResponse<Participant>>() {});
assertNotNull(resp.getResponse());
// Verify the response and state returned by PUT REST call for updating participants
assertEquals(participants.get(0).getDefinition(), resp.getResponse().getDefinition());
@@ -261,25 +263,26 @@ class ParticipantSimulatorTest {
}
@Test
- void testUpdateControlLoopElement() throws Exception {
+ void testUpdateAutomationCompositionElement() throws Exception {
setUp();
- ControlLoop controlLoop = TestListenerUtils.createControlLoop();
- Map<UUID, ControlLoopElement> controlLoopElements = participantIntermediaryApi.getControlLoopElements(
- controlLoop.getDefinition().getName(), controlLoop.getDefinition().getVersion());
+ AutomationComposition automationComposition = TestListenerUtils.createAutomationComposition();
+ Map<UUID, AutomationCompositionElement> automationCompositionElements =
+ participantIntermediaryApi.getAutomationCompositionElements(automationComposition.getDefinition().getName(),
+ automationComposition.getDefinition().getVersion());
- UUID uuid = controlLoopElements.keySet().iterator().next();
- ControlLoopElement controlLoopElement = controlLoopElements.get(uuid);
+ UUID uuid = automationCompositionElements.keySet().iterator().next();
+ AutomationCompositionElement automationCompositionElement = automationCompositionElements.get(uuid);
- controlLoopElement.setOrderedState(ControlLoopOrderedState.PASSIVE);
- // PUT REST call for updating ControlLoopElement
- Response response = performPut(ELEMENTS_ENDPOINT, Entity.json(controlLoopElement), uuid);
+ automationCompositionElement.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ // PUT REST call for updating AutomationCompositionElement
+ Response response = performPut(ELEMENTS_ENDPOINT, Entity.json(automationCompositionElement), uuid);
checkResponseEntity(response, 200, uuid);
- TypedSimpleResponse<ControlLoopElement> resp =
- response.readEntity(new GenericType<TypedSimpleResponse<ControlLoopElement>>() {});
+ TypedSimpleResponse<AutomationCompositionElement> resp =
+ response.readEntity(new GenericType<TypedSimpleResponse<AutomationCompositionElement>>() {});
assertNotNull(resp.getResponse());
// Verify the response and state returned by PUT REST call for updating participants
- assertEquals(controlLoopElement.getDefinition(), resp.getResponse().getDefinition());
- assertEquals(ControlLoopOrderedState.PASSIVE, resp.getResponse().getOrderedState());
+ assertEquals(automationCompositionElement.getDefinition(), resp.getResponse().getDefinition());
+ assertEquals(AutomationCompositionOrderedState.PASSIVE, resp.getResponse().getOrderedState());
}
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandlerTest.java
new file mode 100644
index 000000000..360485efa
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandlerTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.simulator.main.handler;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.mockito.Mockito.when;
+
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+
+class AutomationCompositionElementHandlerTest {
+
+ private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
+ private static final String ID_VERSION = "1.0.1";
+ private static final UUID automationCompositionElementId = UUID.randomUUID();
+ private static final ToscaConceptIdentifier automationCompositionId =
+ new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
+
+ @Test
+ void testSimulatorHandlerExceptions() throws PfModelException {
+ AutomationCompositionElementHandler handler = getTestingHandler();
+
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(automationCompositionId,
+ automationCompositionElementId, AutomationCompositionState.UNINITIALISED,
+ AutomationCompositionOrderedState.PASSIVE));
+
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(automationCompositionId,
+ automationCompositionElementId, AutomationCompositionState.RUNNING,
+ AutomationCompositionOrderedState.UNINITIALISED));
+
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(automationCompositionId,
+ automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.RUNNING));
+ var element = getTestingAcElement();
+ var acElementDefinition = Mockito.mock(ToscaNodeTemplate.class);
+
+ assertDoesNotThrow(
+ () -> handler.automationCompositionElementUpdate(automationCompositionId, element, acElementDefinition));
+
+ assertDoesNotThrow(() -> handler.handleStatistics(automationCompositionElementId));
+ }
+
+ AutomationCompositionElementHandler getTestingHandler() {
+ var handler = new AutomationCompositionElementHandler();
+ var intermediaryApi = Mockito.mock(ParticipantIntermediaryApi.class);
+ var element = getTestingAcElement();
+ when(intermediaryApi.getAutomationCompositionElement(automationCompositionElementId)).thenReturn(element);
+ handler.setIntermediaryApi(intermediaryApi);
+ return handler;
+ }
+
+ AutomationCompositionElement getTestingAcElement() {
+ var element = new AutomationCompositionElement();
+ element.setDefinition(automationCompositionId);
+ element.setDescription("Description");
+ element.setId(automationCompositionElementId);
+ element.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ element.setParticipantId(automationCompositionId);
+ element.setState(AutomationCompositionState.UNINITIALISED);
+ var template = Mockito.mock(ToscaServiceTemplate.class);
+ element.setToscaServiceTemplateFragment(template);
+ return element;
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/CommonTestData.java
index 9c41c8bcb..6af454a42 100644
--- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/CommonTestData.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.main.parameters;
+package org.onap.policy.clamp.acm.participant.simulator.main.parameters;
import java.util.Arrays;
import java.util.List;
@@ -34,7 +34,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
* Class to hold/create all parameters for test cases.
*/
public class CommonTestData {
- public static final String PARTICIPANT_GROUP_NAME = "ControlLoopParticipantGroup";
+ public static final String PARTICIPANT_GROUP_NAME = "AutomationCompositionParticipantGroup";
public static final String DESCRIPTION = "Participant description";
public static final long TIME_INTERVAL = 2000;
public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams());
@@ -83,7 +83,7 @@ public class CommonTestData {
map.put("description", DESCRIPTION);
map.put("participantId", getParticipantId());
map.put("participantType", getParticipantId());
- map.put("clampControlLoopTopics", getTopicParametersMap(false));
+ map.put("clampAutomationCompositionTopics", getTopicParametersMap(false));
}
return map;
@@ -111,7 +111,7 @@ public class CommonTestData {
*/
public static TopicParameters getTopicParams() {
final TopicParameters topicParams = new TopicParameters();
- topicParams.setTopic("POLICY-CLRUNTIME-PARTICIPANT");
+ topicParams.setTopic("POLICY-ACRUNTIME-PARTICIPANT");
topicParams.setTopicCommInfrastructure("dmaap");
topicParams.setServers(Arrays.asList("localhost"));
return topicParams;
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java
index 3c1d1c2a3..c763d09a3 100644
--- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.simulator.main.parameters;
+package org.onap.policy.clamp.acm.participant.simulator.main.parameters;
import static org.assertj.core.api.Assertions.assertThat;
@@ -49,14 +49,14 @@ class TestParticipantSimulatorParameters {
@Test
void testParticipantPolicyParameters_NullTopicSinks() {
final ParticipantSimulatorParameters participantParameters = commonTestData.getParticipantSimulatorParameters();
- participantParameters.getIntermediaryParameters().getClampControlLoopTopics().setTopicSinks(null);
+ participantParameters.getIntermediaryParameters().getClampAutomationCompositionTopics().setTopicSinks(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
@Test
void testParticipantPolicyParameters_NullTopicSources() {
final ParticipantSimulatorParameters participantParameters = commonTestData.getParticipantSimulatorParameters();
- participantParameters.getIntermediaryParameters().getClampControlLoopTopics().setTopicSources(null);
+ participantParameters.getIntermediaryParameters().getClampAutomationCompositionTopics().setTopicSources(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/TestListenerUtils.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/TestListenerUtils.java
new file mode 100644
index 000000000..f43400259
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/TestListenerUtils.java
@@ -0,0 +1,260 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.simulator.main.rest;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.onap.policy.clamp.acm.participant.simulator.main.parameters.CommonTestData;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.utils.AcmUtils;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.coder.YamlJsonTranslator;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class TestListenerUtils {
+
+ private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
+ private static final Coder CODER = new StandardCoder();
+ static CommonTestData commonTestData = new CommonTestData();
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestListenerUtils.class);
+
+ /**
+ * Method to create a automationComposition from a yaml file.
+ *
+ * @return AutomationComposition automation composition
+ */
+ public static AutomationComposition createAutomationComposition() {
+ AutomationComposition automationComposition = new AutomationComposition();
+ Map<UUID, AutomationCompositionElement> elements = new LinkedHashMap<>();
+ ToscaServiceTemplate toscaServiceTemplate = testAutomationCompositionRead();
+ Map<String, ToscaNodeTemplate> nodeTemplatesMap =
+ toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) {
+ AutomationCompositionElement acElement = new AutomationCompositionElement();
+ acElement.setId(UUID.randomUUID());
+
+ ToscaConceptIdentifier acElementParticipantId = new ToscaConceptIdentifier();
+ acElementParticipantId.setName(toscaInputEntry.getKey());
+ acElementParticipantId.setVersion(toscaInputEntry.getValue().getVersion());
+ acElement.setParticipantId(acElementParticipantId);
+ acElement.setParticipantType(acElementParticipantId);
+
+ acElement.setDefinition(acElementParticipantId);
+ acElement.setState(AutomationCompositionState.UNINITIALISED);
+ acElement.setDescription(toscaInputEntry.getValue().getDescription());
+ acElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ elements.put(acElement.getId(), acElement);
+ }
+ automationComposition.setElements(elements);
+ automationComposition.setName("PMSHInstance0");
+ automationComposition.setVersion("1.0.0");
+
+ ToscaConceptIdentifier definition = new ToscaConceptIdentifier();
+ definition.setName("PMSHInstance0");
+ definition.setVersion("1.0.0");
+ automationComposition.setDefinition(definition);
+
+ return automationComposition;
+ }
+
+ /**
+ * Method to create AutomationCompositionStateChange message from the arguments passed.
+ *
+ * @param automationCompositionOrderedState automationCompositionOrderedState
+ *
+ * @return AutomationCompositionStateChange message
+ */
+ public static AutomationCompositionStateChange createAutomationCompositionStateChangeMsg(
+ final AutomationCompositionOrderedState automationCompositionOrderedState) {
+ final AutomationCompositionStateChange acStateChangeMsg = new AutomationCompositionStateChange();
+
+ ToscaConceptIdentifier automationCompositionId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_CDS_Blueprint", "1.0.0");
+
+ acStateChangeMsg.setAutomationCompositionId(automationCompositionId);
+ acStateChangeMsg.setParticipantId(participantId);
+ acStateChangeMsg.setTimestamp(Instant.now());
+ acStateChangeMsg.setOrderedState(automationCompositionOrderedState);
+
+ return acStateChangeMsg;
+ }
+
+ /**
+ * Method to create AutomationCompositionUpdateMsg.
+ *
+ * @return AutomationCompositionUpdate message
+ */
+ public static AutomationCompositionUpdate createAutomationCompositionUpdateMsg() {
+ final AutomationCompositionUpdate acUpdateMsg = new AutomationCompositionUpdate();
+ ToscaConceptIdentifier automationCompositionId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "0.0.0");
+
+ acUpdateMsg.setAutomationCompositionId(automationCompositionId);
+ acUpdateMsg.setParticipantId(participantId);
+ acUpdateMsg.setMessageId(UUID.randomUUID());
+ acUpdateMsg.setTimestamp(Instant.now());
+
+ Map<UUID, AutomationCompositionElement> elements = new LinkedHashMap<>();
+ ToscaServiceTemplate toscaServiceTemplate = testAutomationCompositionRead();
+ Map<String, ToscaNodeTemplate> nodeTemplatesMap =
+ toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) {
+ if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(),
+ toscaServiceTemplate)) {
+ AutomationCompositionElement acElement = new AutomationCompositionElement();
+ acElement.setId(UUID.randomUUID());
+ var acParticipantType =
+ ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties());
+
+ acElement.setParticipantId(acParticipantType);
+ acElement.setParticipantType(acParticipantType);
+
+ acElement.setDefinition(
+ new ToscaConceptIdentifier(toscaInputEntry.getKey(), toscaInputEntry.getValue().getVersion()));
+ acElement.setState(AutomationCompositionState.UNINITIALISED);
+ acElement.setDescription(toscaInputEntry.getValue().getDescription());
+ acElement.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ elements.put(acElement.getId(), acElement);
+ }
+ }
+
+ List<ParticipantUpdates> participantUpdates = new ArrayList<>();
+ for (AutomationCompositionElement element : elements.values()) {
+ AcmUtils.prepareParticipantUpdate(element, participantUpdates);
+ }
+ acUpdateMsg.setParticipantUpdatesList(participantUpdates);
+ return acUpdateMsg;
+ }
+
+ /**
+ * Method to create participantUpdateMsg.
+ *
+ * @return ParticipantUpdate message
+ */
+ public static ParticipantUpdate createParticipantUpdateMsg() {
+ final ParticipantUpdate participantUpdateMsg = new ParticipantUpdate();
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0");
+ ToscaConceptIdentifier participantType =
+ new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1");
+
+ participantUpdateMsg.setParticipantId(participantId);
+ participantUpdateMsg.setTimestamp(Instant.now());
+ participantUpdateMsg.setParticipantType(participantType);
+ participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000));
+ participantUpdateMsg.setMessageId(UUID.randomUUID());
+
+ ToscaServiceTemplate toscaServiceTemplate = testAutomationCompositionRead();
+ // Add policies to the toscaServiceTemplate
+ List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
+ for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate()
+ .getNodeTemplates().entrySet()) {
+ if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(),
+ toscaServiceTemplate)) {
+ var acParticipantType =
+ ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties());
+ AcmUtils.prepareParticipantDefinitionUpdate(acParticipantType, toscaInputEntry.getKey(),
+ toscaInputEntry.getValue(), participantDefinitionUpdates, null);
+ }
+ }
+
+ participantUpdateMsg.setParticipantDefinitionUpdates(participantDefinitionUpdates);
+ return participantUpdateMsg;
+ }
+
+ /**
+ * Method to create AutomationCompositionUpdate using the arguments passed.
+ *
+ * @param jsonFilePath the path of the automation composition content
+ *
+ * @return AutomationCompositionUpdate message
+ * @throws CoderException exception while reading the file to object
+ */
+ public static AutomationCompositionUpdate createParticipantAcUpdateMsgFromJson(String jsonFilePath)
+ throws CoderException {
+ AutomationCompositionUpdate automationCompositionUpdateMsg =
+ CODER.decode(new File(jsonFilePath), AutomationCompositionUpdate.class);
+ return automationCompositionUpdateMsg;
+ }
+
+ private static ToscaServiceTemplate testAutomationCompositionRead() {
+ Set<String> automationCompositionDirectoryContents =
+ ResourceUtils.getDirectoryContents("src/test/resources/rest/servicetemplates");
+
+ boolean atLeastOneAutomationCompositionTested = false;
+ ToscaServiceTemplate toscaServiceTemplate = null;
+
+ for (String automationCompositionFilePath : automationCompositionDirectoryContents) {
+ if (!automationCompositionFilePath.endsWith(".yaml")) {
+ continue;
+ }
+ atLeastOneAutomationCompositionTested = true;
+ toscaServiceTemplate = testAutomationCompositionYamlSerialization(automationCompositionFilePath);
+ }
+
+ assertTrue(atLeastOneAutomationCompositionTested);
+ return toscaServiceTemplate;
+ }
+
+ private static ToscaServiceTemplate testAutomationCompositionYamlSerialization(
+ String automationCompositionFilePath) {
+ try {
+ String automationCompositionString = ResourceUtils.getResourceAsString(automationCompositionFilePath);
+ if (automationCompositionString == null) {
+ throw new FileNotFoundException(automationCompositionFilePath);
+ }
+
+ ToscaServiceTemplate serviceTemplate =
+ yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class);
+ return serviceTemplate;
+ } catch (FileNotFoundException e) {
+ LOGGER.error("cannot find YAML file", automationCompositionFilePath);
+ throw new IllegalArgumentException(e);
+ }
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandlerTest.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandlerTest.java
deleted file mode 100644
index b38adbc5c..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandlerTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.simulator.main.handler;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.mockito.Mockito.when;
-
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-
-class ControlLoopElementHandlerTest {
-
- private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
- private static final String ID_VERSION = "1.0.1";
- private static final UUID controlLoopElementId = UUID.randomUUID();
- private static final ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
-
- @Test
- void testSimulatorHandlerExceptions() throws PfModelException {
- ControlLoopElementHandler handler = getTestingHandler();
-
- assertDoesNotThrow(() -> handler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId,
- ControlLoopState.UNINITIALISED,
- ControlLoopOrderedState.PASSIVE));
-
- assertDoesNotThrow(() -> handler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId,
- ControlLoopState.RUNNING,
- ControlLoopOrderedState.UNINITIALISED));
-
- assertDoesNotThrow(() -> handler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId,
- ControlLoopState.PASSIVE,
- ControlLoopOrderedState.RUNNING));
- var element = getTestingClElement();
- var clElementDefinition = Mockito.mock(ToscaNodeTemplate.class);
-
- assertDoesNotThrow(() -> handler
- .controlLoopElementUpdate(controlLoopId, element, clElementDefinition));
-
- assertDoesNotThrow(() -> handler
- .handleStatistics(controlLoopElementId));
- }
-
- ControlLoopElementHandler getTestingHandler() {
- var handler = new ControlLoopElementHandler();
- var intermediaryApi = Mockito.mock(ParticipantIntermediaryApi.class);
- var element = getTestingClElement();
- when(intermediaryApi.getControlLoopElement(controlLoopElementId)).thenReturn(element);
- handler.setIntermediaryApi(intermediaryApi);
- return handler;
- }
-
- ControlLoopElement getTestingClElement() {
- var element = new ControlLoopElement();
- element.setDefinition(controlLoopId);
- element.setDescription("Description");
- element.setId(controlLoopElementId);
- element.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- element.setParticipantId(controlLoopId);
- element.setState(ControlLoopState.UNINITIALISED);
- var template = Mockito.mock(ToscaServiceTemplate.class);
- element.setToscaServiceTemplateFragment(template);
- return element;
- }
-
-}
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
deleted file mode 100644
index 9f6a31e28..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.simulator.main.rest;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.onap.policy.clamp.controlloop.common.utils.CommonUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.CommonTestData;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.common.utils.coder.YamlJsonTranslator;
-import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class TestListenerUtils {
-
- private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
- private static final Coder CODER = new StandardCoder();
- static CommonTestData commonTestData = new CommonTestData();
- private static final Logger LOGGER = LoggerFactory.getLogger(TestListenerUtils.class);
-
- /**
- * Method to create a controlLoop from a yaml file.
- *
- * @return ControlLoop controlloop
- */
- public static ControlLoop createControlLoop() {
- ControlLoop controlLoop = new ControlLoop();
- Map<UUID, ControlLoopElement> elements = new LinkedHashMap<>();
- ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead();
- Map<String, ToscaNodeTemplate> nodeTemplatesMap =
- toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) {
- ControlLoopElement clElement = new ControlLoopElement();
- clElement.setId(UUID.randomUUID());
-
- ToscaConceptIdentifier clElementParticipantId = new ToscaConceptIdentifier();
- clElementParticipantId.setName(toscaInputEntry.getKey());
- clElementParticipantId.setVersion(toscaInputEntry.getValue().getVersion());
- clElement.setParticipantId(clElementParticipantId);
- clElement.setParticipantType(clElementParticipantId);
-
- clElement.setDefinition(clElementParticipantId);
- clElement.setState(ControlLoopState.UNINITIALISED);
- clElement.setDescription(toscaInputEntry.getValue().getDescription());
- clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- elements.put(clElement.getId(), clElement);
- }
- controlLoop.setElements(elements);
- controlLoop.setName("PMSHInstance0");
- controlLoop.setVersion("1.0.0");
-
- ToscaConceptIdentifier definition = new ToscaConceptIdentifier();
- definition.setName("PMSHInstance0");
- definition.setVersion("1.0.0");
- controlLoop.setDefinition(definition);
-
- return controlLoop;
- }
-
- /**
- * Method to create ControlLoopStateChange message from the arguments passed.
- *
- * @param controlLoopOrderedState controlLoopOrderedState
- *
- * @return ControlLoopStateChange message
- */
- public static ControlLoopStateChange createControlLoopStateChangeMsg(
- final ControlLoopOrderedState controlLoopOrderedState) {
- final ControlLoopStateChange clStateChangeMsg = new ControlLoopStateChange();
-
- ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
- ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_CDS_Blueprint", "1.0.0");
-
- clStateChangeMsg.setControlLoopId(controlLoopId);
- clStateChangeMsg.setParticipantId(participantId);
- clStateChangeMsg.setTimestamp(Instant.now());
- clStateChangeMsg.setOrderedState(controlLoopOrderedState);
-
- return clStateChangeMsg;
- }
-
- /**
- * Method to create ControlLoopUpdateMsg.
- *
- * @return ControlLoopUpdate message
- */
- public static ControlLoopUpdate createControlLoopUpdateMsg() {
- final ControlLoopUpdate clUpdateMsg = new ControlLoopUpdate();
- ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
- ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "0.0.0");
-
- clUpdateMsg.setControlLoopId(controlLoopId);
- clUpdateMsg.setParticipantId(participantId);
- clUpdateMsg.setMessageId(UUID.randomUUID());
- clUpdateMsg.setTimestamp(Instant.now());
-
- Map<UUID, ControlLoopElement> elements = new LinkedHashMap<>();
- ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead();
- Map<String, ToscaNodeTemplate> nodeTemplatesMap =
- toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) {
- if (ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(),
- toscaServiceTemplate)) {
- ControlLoopElement clElement = new ControlLoopElement();
- clElement.setId(UUID.randomUUID());
- var clParticipantType =
- ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties());
-
- clElement.setParticipantId(clParticipantType);
- clElement.setParticipantType(clParticipantType);
-
- clElement.setDefinition(
- new ToscaConceptIdentifier(toscaInputEntry.getKey(), toscaInputEntry.getValue().getVersion()));
- clElement.setState(ControlLoopState.UNINITIALISED);
- clElement.setDescription(toscaInputEntry.getValue().getDescription());
- clElement.setOrderedState(ControlLoopOrderedState.PASSIVE);
- elements.put(clElement.getId(), clElement);
- }
- }
-
- List<ParticipantUpdates> participantUpdates = new ArrayList<>();
- for (ControlLoopElement element : elements.values()) {
- CommonUtils.prepareParticipantUpdate(element, participantUpdates);
- }
- clUpdateMsg.setParticipantUpdatesList(participantUpdates);
- return clUpdateMsg;
- }
-
- /**
- * Method to create participantUpdateMsg.
- *
- * @return ParticipantUpdate message
- */
- public static ParticipantUpdate createParticipantUpdateMsg() {
- final ParticipantUpdate participantUpdateMsg = new ParticipantUpdate();
- ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0");
- ToscaConceptIdentifier participantType =
- new ToscaConceptIdentifier("org.onap.policy.controlloop.PolicyControlLoopParticipant", "2.3.1");
-
- participantUpdateMsg.setParticipantId(participantId);
- participantUpdateMsg.setTimestamp(Instant.now());
- participantUpdateMsg.setParticipantType(participantType);
- participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000));
- participantUpdateMsg.setMessageId(UUID.randomUUID());
-
- ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead();
- // Add policies to the toscaServiceTemplate
- List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
- for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate()
- .getNodeTemplates().entrySet()) {
- if (ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(),
- toscaServiceTemplate)) {
- var clParticipantType =
- ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties());
- CommonUtils.prepareParticipantDefinitionUpdate(clParticipantType, toscaInputEntry.getKey(),
- toscaInputEntry.getValue(), participantDefinitionUpdates, null);
- }
- }
-
- participantUpdateMsg.setParticipantDefinitionUpdates(participantDefinitionUpdates);
- return participantUpdateMsg;
- }
-
- /**
- * Method to create ControlLoopUpdate using the arguments passed.
- *
- * @param jsonFilePath the path of the controlloop content
- *
- * @return ControlLoopUpdate message
- * @throws CoderException exception while reading the file to object
- */
- public static ControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath) throws CoderException {
- ControlLoopUpdate controlLoopUpdateMsg = CODER.decode(new File(jsonFilePath), ControlLoopUpdate.class);
- return controlLoopUpdateMsg;
- }
-
- private static ToscaServiceTemplate testControlLoopRead() {
- Set<String> controlLoopDirectoryContents =
- ResourceUtils.getDirectoryContents("src/test/resources/rest/servicetemplates");
-
- boolean atLeastOneControlLoopTested = false;
- ToscaServiceTemplate toscaServiceTemplate = null;
-
- for (String controlLoopFilePath : controlLoopDirectoryContents) {
- if (!controlLoopFilePath.endsWith(".yaml")) {
- continue;
- }
- atLeastOneControlLoopTested = true;
- toscaServiceTemplate = testControlLoopYamlSerialization(controlLoopFilePath);
- }
-
- assertTrue(atLeastOneControlLoopTested);
- return toscaServiceTemplate;
- }
-
- private static ToscaServiceTemplate testControlLoopYamlSerialization(String controlLoopFilePath) {
- try {
- String controlLoopString = ResourceUtils.getResourceAsString(controlLoopFilePath);
- if (controlLoopString == null) {
- throw new FileNotFoundException(controlLoopFilePath);
- }
-
- ToscaServiceTemplate serviceTemplate =
- yamlTranslator.fromYaml(controlLoopString, ToscaServiceTemplate.class);
- return serviceTemplate;
- } catch (FileNotFoundException e) {
- LOGGER.error("cannot find YAML file", controlLoopFilePath);
- throw new IllegalArgumentException(e);
- }
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/resources/application_test.properties b/participant/participant-impl/participant-impl-simulator/src/test/resources/application_test.properties
index a4a1f99e5..ccc54581e 100644
--- a/participant/participant-impl/participant-impl-simulator/src/test/resources/application_test.properties
+++ b/participant/participant-impl/participant-impl-simulator/src/test/resources/application_test.properties
@@ -16,10 +16,10 @@ participant.intermediaryParameters.participantId.name=org.onap.PM_CDS_Blueprint
participant.intermediaryParameters.participantId.version=1.0.0
participant.intermediaryParameters.participantType.name=org.onap.PM_CDS_Blueprint
participant.intermediaryParameters.participantType.version=1.0.0
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topic=POLICY-CLRUNTIME-PARTICIPANT
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].servers[0]=localhost
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topicCommInfrastructure=dmaap
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].fetchTimeout=15000
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topic=POLICY-CLRUNTIME-PARTICIPANT
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].servers[0]=localhost
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topic=POLICY-ACRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].servers[0]=localhost
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].fetchTimeout=15000
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topic=POLICY-ACRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].servers[0]=localhost
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topicCommInfrastructure=dmaap
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_automation_composition_tosca.yaml
index 21d20a8ee..6e34c7cce 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_automation_composition_tosca.yaml
@@ -10,14 +10,14 @@ data_types:
type: string
required: true
node_types:
- org.onap.policy.clamp.controlloop.Participant:
+ org.onap.policy.clamp.acm.Participant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
requred: false
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -34,11 +34,11 @@ node_types:
- 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
+ description: A value indicating the start phase in which this automation composition element will be started, the
+ first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped
+ in reverse start phase order. Automation Composition Elements with the same start phase are started and
stopped simultaneously
- org.onap.policy.clamp.controlloop.ControlLoop:
+ org.onap.policy.clamp.acm.AutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -50,94 +50,94 @@ node_types:
required: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:
+ org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
dcae_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
- org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement:
+ org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
policy_type_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
- org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ org.onap.policy.clamp.acm.CDSAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
cds_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
topology_template:
node_templates:
- org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:
+ org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.policy.controlloop.PolicyControlLoopParticipant:
+ org.onap.policy.acm.PolicyAutomationCompositionParticipant:
version: 2.3.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant:
+ org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant:
version: 2.2.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.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: org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ description: Automation composition element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ name: org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant
version: 2.3.4
dcae_blueprint_id:
name: org.onap.dcae.blueprints.PMSHBlueprint
version: 1.0.0
- org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ description: Automation composition element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.3.1
policy_type_id:
name: onap.policies.monitoring.pm-subscription-handler
version: 1.0.0
- org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the operational policy for Performance Management Subscription Handling
+ description: Automation composition element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.3.1
policy_type_id:
name: onap.policies.operational.pm-subscription-handler
version: 1.0.0
- org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement:
+ org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoopElement
+ type: org.onap.policy.clamp.acm.AutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for CDS for Performance Management Subscription Handling
+ description: Automation composition element for CDS for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
@@ -146,19 +146,19 @@ topology_template:
cds_blueprint_id:
name: org.onap.ccsdk.cds.PMSHCdsBlueprint
version: 1.0.0
- org.onap.domain.pmsh.PMSHControlLoopDefinition:
+ org.onap.domain.pmsh.PMSHAutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acm.AutomationComposition
type_version: 1.0.0
- description: Control loop for Performance Management Subscription Handling
+ description: Automation composition 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
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement
version: 1.2.3
diff --git a/participant/participant-intermediary/pom.xml b/participant/participant-intermediary/pom.xml
index c6078360e..936d26b76 100644
--- a/participant/participant-intermediary/pom.xml
+++ b/participant/participant-intermediary/pom.xml
@@ -30,7 +30,7 @@
<artifactId>policy-clamp-participant-intermediary</artifactId>
<name>${project.artifactId}</name>
- <description>Common intermediary library for managing DMaaP participant messaging and holding participant and control
- loop state</description>
+ <description>Common intermediary library for managing DMaaP participant messaging and holding participant and
+ Automation Composition state</description>
</project>
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java
new file mode 100644
index 000000000..9affd5751
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.intermediary.api;
+
+import java.util.UUID;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+
+/**
+ * This interface is implemented by participant implementations to receive updates on automation composition elements.
+ */
+public interface AutomationCompositionElementListener {
+ /**
+ * Handle a automation composition element state change.
+ *
+ * @param automationCompositionElementId the ID of the automation composition element
+ * @param currentState the current state of the automation composition element
+ * @param newState the state to which the automation composition element is changing to
+ * @throws PfModelException in case of a model exception
+ */
+ public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ UUID automationCompositionElementId, AutomationCompositionState currentState,
+ AutomationCompositionOrderedState newState) throws PfModelException;
+
+ /**
+ * Handle an update on a automation composition element.
+ *
+ * @param element the information on the automation composition element
+ * @param automationCompositionElementDefinition toscaNodeTemplate
+ * @throws PfModelException from Policy framework
+ */
+ public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
+ AutomationCompositionElement element, ToscaNodeTemplate automationCompositionElementDefinition)
+ throws PfModelException;
+
+ /**
+ * Handle automationCompositionElement statistics.
+ *
+ * @param automationCompositionElementId automationCompositionElement id
+ * @throws PfModelException in case of a model exception
+ */
+ public void handleStatistics(UUID automationCompositionElementId) throws PfModelException;
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java
new file mode 100644
index 000000000..79f5259bf
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java
@@ -0,0 +1,130 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.intermediary.api;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
+
+/**
+ * This interface is used by participant implementations to use the participant intermediary.
+ */
+public interface ParticipantIntermediaryApi {
+
+ /**
+ * Register a listener for automation composition elements that are mediated by the intermediary.
+ *
+ * @param automationCompositionElementListener The automation composition element listener to register
+ */
+ void registerAutomationCompositionElementListener(
+ AutomationCompositionElementListener automationCompositionElementListener);
+
+ /**
+ * Get participants loops from the intermediary API.
+ *
+ * @param name the participant name, null for all
+ * @param version the participant version, null for all
+ * @return the participants
+ */
+ List<Participant> getParticipants(String name, String version);
+
+ /**
+ * Get common properties of a automation composition element.
+ *
+ * @param acElementDef the automation composition element definition
+ * @return the common properties
+ */
+ Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef);
+
+ /**
+ * Update the state of a participant.
+ *
+ * @param definition the definition of the participant to update the state on
+ * @param state the state of the participant
+ * @return the participant
+ */
+ Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
+
+ /**
+ * Update the statistics of a participant.
+ *
+ * @param participantStatistics the statistics of the participant
+ */
+ void updateParticipantStatistics(ParticipantStatistics participantStatistics);
+
+ /**
+ * Get automation compositions from the intermediary API.
+ *
+ * @param name the automation composition element name, null for all
+ * @param version the automation composition element version, null for all
+ * @return the automation composition elements
+ */
+ AutomationCompositions getAutomationCompositions(String name, String version);
+
+ /**
+ * Get automation composition elements from the intermediary API.
+ *
+ * @param name the automation composition element name, null for all
+ * @param version the automation composition element version, null for all
+ * @return the automation composition elements
+ */
+ Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version);
+
+ /**
+ * Get automation composition element from the intermediary API.
+ *
+ * @param id automation composition element ID
+ * @return the automation composition element
+ */
+ AutomationCompositionElement getAutomationCompositionElement(UUID id);
+
+ /**
+ * Update the state of a automation composition element.
+ *
+ * @param id the ID of the automation composition element to update the state on
+ * @param currentState the state of the automation composition element
+ * @param newState the state of the automation composition element
+ * @return AutomationCompositionElement updated automation composition element
+ */
+ AutomationCompositionElement updateAutomationCompositionElementState(ToscaConceptIdentifier automationCompositionId,
+ UUID id, AutomationCompositionOrderedState currentState, AutomationCompositionState newState,
+ ParticipantMessageType messageType);
+
+ /**
+ * Update the automation composition element statistics.
+ *
+ * @param id the ID of the automation composition element to update the state on
+ * @param elementStatistics the updated statistics
+ */
+ void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics);
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
new file mode 100644
index 000000000..1a1f8500f
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.intermediary.api.impl;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.AutomationCompositionHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class is api implementation used by participant intermediary.
+ */
+@Component
+public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryApi {
+
+ // The handler for the participant intermediary
+ private final ParticipantHandler participantHandler;
+
+ // The handler for the automationComposition intermediary
+ private final AutomationCompositionHandler automationCompositionHandler;
+
+ /**
+ * Constructor.
+ *
+ * @param participantHandler ParticipantHandler
+ * @param automationCompositionHandler AutomationCompositionHandler
+ */
+ public ParticipantIntermediaryApiImpl(ParticipantHandler participantHandler,
+ AutomationCompositionHandler automationCompositionHandler) {
+ this.participantHandler = participantHandler;
+ this.automationCompositionHandler = automationCompositionHandler;
+ }
+
+ @Override
+ public void registerAutomationCompositionElementListener(
+ AutomationCompositionElementListener automationCompositionElementListener) {
+ automationCompositionHandler.registerAutomationCompositionElementListener(automationCompositionElementListener);
+ }
+
+ @Override
+ public List<Participant> getParticipants(String name, String version) {
+ return List.of(participantHandler.getParticipant(name, version));
+ }
+
+ @Override
+ public Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef) {
+ return participantHandler.getAcElementDefinitionCommonProperties(acElementDef);
+ }
+
+ @Override
+ public Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state) {
+ return participantHandler.updateParticipantState(definition, state);
+ }
+
+ @Override
+ public void updateParticipantStatistics(ParticipantStatistics participantStatistics) {
+ participantHandler.updateParticipantStatistics(participantStatistics);
+ }
+
+ @Override
+ public AutomationCompositions getAutomationCompositions(String name, String version) {
+ return automationCompositionHandler.getAutomationCompositions();
+ }
+
+ @Override
+ public Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version) {
+ List<AutomationComposition> automationCompositions =
+ automationCompositionHandler.getAutomationCompositions().getAutomationCompositionList();
+
+ for (AutomationComposition automationComposition : automationCompositions) {
+ if (name.equals(automationComposition.getDefinition().getName())) {
+ return automationComposition.getElements();
+ }
+ }
+ return new LinkedHashMap<>();
+ }
+
+ @Override
+ public AutomationCompositionElement getAutomationCompositionElement(UUID id) {
+ List<AutomationComposition> automationCompositions =
+ automationCompositionHandler.getAutomationCompositions().getAutomationCompositionList();
+
+ for (AutomationComposition automationComposition : automationCompositions) {
+ AutomationCompositionElement acElement = automationComposition.getElements().get(id);
+ if (acElement != null) {
+ return acElement;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public AutomationCompositionElement updateAutomationCompositionElementState(
+ ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState currentState,
+ AutomationCompositionState newState, ParticipantMessageType messageType) {
+ return automationCompositionHandler.updateAutomationCompositionElementState(automationCompositionId, id,
+ currentState, newState);
+ }
+
+ @Override
+ public void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics) {
+ automationCompositionHandler.updateAutomationCompositionElementStatistics(id, elementStatistics);
+ }
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionStateChangeListener.java
index d24f32f2f..b9ec6a6a0 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionStateChangeListener.java
@@ -18,31 +18,31 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.springframework.stereotype.Component;
/**
* Listener for Participant State Change messages sent by CLAMP.
*/
@Component
-public class ControlLoopStateChangeListener extends ParticipantListener<ControlLoopStateChange> {
+public class AutomationCompositionStateChangeListener extends ParticipantListener<AutomationCompositionStateChange> {
/**
* Constructs the object.
*
* @param participantHandler the handler for managing the state of the participant
*/
- public ControlLoopStateChangeListener(final ParticipantHandler participantHandler) {
- super(ControlLoopStateChange.class, participantHandler,
- participantHandler::handleControlLoopStateChange);
+ public AutomationCompositionStateChangeListener(final ParticipantHandler participantHandler) {
+ super(AutomationCompositionStateChange.class, participantHandler,
+ participantHandler::handleAutomationCompositionStateChange);
}
@Override
public String getType() {
- return ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE.name();
+ return ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE.name();
}
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java
index f9dec1863..6c5dc127d 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java
@@ -18,30 +18,31 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.springframework.stereotype.Component;
/**
- * Listener for Control Loop Update messages sent by CLAMP.
+ * Listener for Automation Composition Update messages sent by ACM.
*/
@Component
-public class ControlLoopUpdateListener extends ParticipantListener<ControlLoopUpdate> {
+public class AutomationCompositionUpdateListener extends ParticipantListener<AutomationCompositionUpdate> {
/**
* Constructs the object.
*
* @param participantHandler the handler for managing the state of the participant
*/
- public ControlLoopUpdateListener(final ParticipantHandler participantHandler) {
- super(ControlLoopUpdate.class, participantHandler, participantHandler::handleControlLoopUpdate);
+ public AutomationCompositionUpdateListener(final ParticipantHandler participantHandler) {
+ super(AutomationCompositionUpdate.class, participantHandler,
+ participantHandler::handleAutomationCompositionUpdate);
}
@Override
public String getType() {
- return ParticipantMessageType.CONTROL_LOOP_UPDATE.name();
+ return ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE.name();
}
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/MessageSender.java
index e11c883b4..0810a8a8a 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/MessageSender.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
import java.io.Closeable;
import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantAckListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantAckListener.java
index 95bbb2940..c5427db6b 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantAckListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantAckListener.java
@@ -21,12 +21,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
import java.util.function.Consumer;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantAckMessage;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.Listener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.Listener;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantDeregisterAckListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantDeregisterAckListener.java
index 5440e005b..51a2d2f9d 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantDeregisterAckListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantDeregisterAckListener.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.springframework.stereotype.Component;
/**
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantListener.java
index 5326ccddc..0eaf25cca 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantListener.java
@@ -19,12 +19,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
import java.util.function.Consumer;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.Listener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.Listener;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantMessagePublisher.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
index 79d62623c..67814a4e6 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantMessagePublisher.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
@@ -19,17 +19,17 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
import java.util.List;
import javax.ws.rs.core.Response.Status;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.Publisher;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.Publisher;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
import org.slf4j.Logger;
@@ -69,7 +69,7 @@ public class ParticipantMessagePublisher implements Publisher {
*/
public void sendParticipantStatus(final ParticipantStatus participantStatus) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
topicSinkClient.send(participantStatus);
LOGGER.debug("Sent Participant Status message to CLAMP - {}", participantStatus);
@@ -82,7 +82,7 @@ public class ParticipantMessagePublisher implements Publisher {
*/
public void sendParticipantRegister(final ParticipantRegister participantRegister) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
topicSinkClient.send(participantRegister);
LOGGER.debug("Sent Participant Register message to CLAMP - {}", participantRegister);
@@ -95,7 +95,7 @@ public class ParticipantMessagePublisher implements Publisher {
*/
public void sendParticipantDeregister(final ParticipantDeregister participantDeregister) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
topicSinkClient.send(participantDeregister);
LOGGER.debug("Sent Participant Deregister message to CLAMP - {}", participantDeregister);
@@ -108,23 +108,23 @@ public class ParticipantMessagePublisher implements Publisher {
*/
public void sendParticipantUpdateAck(final ParticipantUpdateAck participantUpdateAck) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
topicSinkClient.send(participantUpdateAck);
LOGGER.debug("Sent Participant Update Ack message to CLAMP - {}", participantUpdateAck);
}
/**
- * Method to send ControlLoop Update/StateChange Ack message to runtime.
+ * Method to send AutomationComposition Update/StateChange Ack message to runtime.
*
- * @param controlLoopAck ControlLoop Update/StateChange Ack
+ * @param automationCompositionAck AutomationComposition Update/StateChange Ack
*/
- public void sendControlLoopAck(final ControlLoopAck controlLoopAck) {
+ public void sendAutomationCompositionAck(final AutomationCompositionAck automationCompositionAck) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
- topicSinkClient.send(controlLoopAck);
- LOGGER.debug("Sent ControlLoop Update/StateChange Ack to runtime - {}", controlLoopAck);
+ topicSinkClient.send(automationCompositionAck);
+ LOGGER.debug("Sent AutomationComposition Update/StateChange Ack to runtime - {}", automationCompositionAck);
}
/**
@@ -134,7 +134,7 @@ public class ParticipantMessagePublisher implements Publisher {
*/
public void sendHeartbeat(final ParticipantStatus participantStatus) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
topicSinkClient.send(participantStatus);
LOGGER.debug("Sent Participant heartbeat to CLAMP - {}", participantStatus);
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantRegisterAckListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java
index 7be460815..e29fa6f96 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantRegisterAckListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
import org.springframework.stereotype.Component;
/**
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusReqListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantStatusReqListener.java
index 9e978fe75..7af3678d7 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusReqListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantStatusReqListener.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatusReq;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
import org.springframework.stereotype.Component;
/**
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantUpdateListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java
index da45501e7..19eb5fb30 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantUpdateListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
import org.springframework.stereotype.Component;
/**
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
new file mode 100644
index 000000000..7e1fb5443
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
@@ -0,0 +1,476 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import lombok.Getter;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+/*
+ * This class is responsible for managing the state of all automation compositions in the participant.
+ */
+@Component
+public class AutomationCompositionHandler {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionHandler.class);
+
+ private final ToscaConceptIdentifier participantType;
+ private final ToscaConceptIdentifier participantId;
+ private final ParticipantMessagePublisher publisher;
+
+ @Getter
+ private final Map<ToscaConceptIdentifier, AutomationComposition> automationCompositionMap = new LinkedHashMap<>();
+
+ @Getter
+ private final Map<UUID, AutomationCompositionElement> elementsOnThisParticipant = new LinkedHashMap<>();
+
+ @Getter
+ private List<AutomationCompositionElementListener> listeners = new ArrayList<>();
+
+ /**
+ * Constructor, set the participant ID and messageSender.
+ *
+ * @param parameters the parameters of the participant
+ * @param publisher the ParticipantMessage Publisher
+ */
+ public AutomationCompositionHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher) {
+ this.participantType = parameters.getIntermediaryParameters().getParticipantType();
+ this.participantId = parameters.getIntermediaryParameters().getParticipantId();
+ this.publisher = publisher;
+ }
+
+ public void registerAutomationCompositionElementListener(AutomationCompositionElementListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * Handle a automation composition element state change message.
+ *
+ * @param automationCompositionId the automationComposition Id
+ * @param id the automationComposition UUID
+ * @param orderedState the current state
+ * @param newState the ordered state
+ * @return automationCompositionElement the updated automation composition element
+ */
+ public AutomationCompositionElement updateAutomationCompositionElementState(
+ ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState orderedState,
+ AutomationCompositionState newState) {
+
+ if (id == null) {
+ LOGGER.warn("Cannot update Automation composition element state, id is null");
+ return null;
+ }
+
+ // Update states of AutomationCompositionElement in automationCompositionMap
+ for (var automationComposition : automationCompositionMap.values()) {
+ var element = automationComposition.getElements().get(id);
+ if (element != null) {
+ element.setOrderedState(orderedState);
+ element.setState(newState);
+ }
+ var checkOpt = automationComposition.getElements().values().stream()
+ .filter(acElement -> !newState.equals(acElement.getState())).findAny();
+ if (checkOpt.isEmpty()) {
+ automationComposition.setState(newState);
+ automationComposition.setOrderedState(orderedState);
+ }
+ }
+
+ // Update states of AutomationCompositionElement in elementsOnThisParticipant
+ var acElement = elementsOnThisParticipant.get(id);
+ if (acElement != null) {
+ var automationCompositionStateChangeAck =
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ automationCompositionStateChangeAck.setParticipantId(participantId);
+ automationCompositionStateChangeAck.setParticipantType(participantType);
+ automationCompositionStateChangeAck.setAutomationCompositionId(automationCompositionId);
+ acElement.setOrderedState(orderedState);
+ acElement.setState(newState);
+ automationCompositionStateChangeAck.getAutomationCompositionResultMap().put(acElement.getId(),
+ new AutomationCompositionElementAck(newState, true,
+ "Automation composition element {} state changed to {}\", id, newState)"));
+ LOGGER.debug("Automation composition element {} state changed to {}", id, newState);
+ automationCompositionStateChangeAck
+ .setMessage("AutomationCompositionElement state changed to {} " + newState);
+ automationCompositionStateChangeAck.setResult(true);
+ publisher.sendAutomationCompositionAck(automationCompositionStateChangeAck);
+ return acElement;
+ }
+ return null;
+ }
+
+ /**
+ * Handle a automation composition element statistics.
+ *
+ * @param id automation composition element id
+ * @param elementStatistics automation composition element Statistics
+ */
+ public void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics) {
+ var acElement = elementsOnThisParticipant.get(id);
+ if (acElement != null) {
+ elementStatistics.setParticipantId(participantId);
+ elementStatistics.setId(id);
+ acElement.setAcElementStatistics(elementStatistics);
+ }
+ }
+
+ /**
+ * Handle a automation composition state change message.
+ *
+ * @param stateChangeMsg the state change message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ public void handleAutomationCompositionStateChange(AutomationCompositionStateChange stateChangeMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ if (stateChangeMsg.getAutomationCompositionId() == null) {
+ return;
+ }
+
+ var automationComposition = automationCompositionMap.get(stateChangeMsg.getAutomationCompositionId());
+
+ if (automationComposition == null) {
+ var automationCompositionAck =
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ automationCompositionAck.setParticipantId(participantId);
+ automationCompositionAck.setParticipantType(participantType);
+ automationCompositionAck.setMessage("Automation composition " + stateChangeMsg.getAutomationCompositionId()
+ + " does not use this participant " + participantId);
+ automationCompositionAck.setResult(false);
+ automationCompositionAck.setResponseTo(stateChangeMsg.getMessageId());
+ automationCompositionAck.setAutomationCompositionId(stateChangeMsg.getAutomationCompositionId());
+ publisher.sendAutomationCompositionAck(automationCompositionAck);
+ LOGGER.debug("Automation composition {} does not use this participant",
+ stateChangeMsg.getAutomationCompositionId());
+ return;
+ }
+
+ handleState(automationComposition, stateChangeMsg.getOrderedState(), stateChangeMsg.getStartPhase(),
+ acElementDefinitions);
+ }
+
+ /**
+ * Method to handle state changes.
+ *
+ * @param automationComposition participant response
+ * @param orderedState automation composition ordered state
+ * @param startPhaseMsg startPhase from message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ private void handleState(final AutomationComposition automationComposition,
+ AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ switch (orderedState) {
+ case UNINITIALISED:
+ handleUninitialisedState(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ break;
+ case PASSIVE:
+ handlePassiveState(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ break;
+ case RUNNING:
+ handleRunningState(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ break;
+ default:
+ LOGGER.debug("StateChange message has no state, state is null {}",
+ automationComposition.getDefinition());
+ break;
+ }
+ }
+
+ /**
+ * Handle a automation composition update message.
+ *
+ * @param updateMsg the update message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+
+ if (!updateMsg.appliesTo(participantType, participantId)) {
+ return;
+ }
+
+ if (0 == updateMsg.getStartPhase()) {
+ handleAcUpdatePhase0(updateMsg, acElementDefinitions);
+ } else {
+ handleAcUpdatePhaseN(updateMsg, acElementDefinitions);
+ }
+ }
+
+ private void handleAcUpdatePhase0(AutomationCompositionUpdate updateMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ var automationComposition = automationCompositionMap.get(updateMsg.getAutomationCompositionId());
+
+ // TODO: Updates to existing AutomationCompositions are not supported yet (Addition/Removal of
+ // AutomationComposition
+ // elements to existing AutomationComposition has to be supported).
+ if (automationComposition != null) {
+ var automationCompositionUpdateAck =
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK);
+ automationCompositionUpdateAck.setParticipantId(participantId);
+ automationCompositionUpdateAck.setParticipantType(participantType);
+
+ automationCompositionUpdateAck.setMessage("Automation composition " + updateMsg.getAutomationCompositionId()
+ + " already defined on participant " + participantId);
+ automationCompositionUpdateAck.setResult(false);
+ automationCompositionUpdateAck.setResponseTo(updateMsg.getMessageId());
+ automationCompositionUpdateAck.setAutomationCompositionId(updateMsg.getAutomationCompositionId());
+ publisher.sendAutomationCompositionAck(automationCompositionUpdateAck);
+ return;
+ }
+
+ if (updateMsg.getParticipantUpdatesList().isEmpty()) {
+ LOGGER.warn("No AutomationCompositionElement updates in message {}",
+ updateMsg.getAutomationCompositionId());
+ return;
+ }
+
+ var acElements = storeElementsOnThisParticipant(updateMsg.getParticipantUpdatesList());
+
+ var acElementMap = prepareAcElementMap(acElements);
+ automationComposition = new AutomationComposition();
+ automationComposition.setDefinition(updateMsg.getAutomationCompositionId());
+ automationComposition.setElements(acElementMap);
+ automationCompositionMap.put(updateMsg.getAutomationCompositionId(), automationComposition);
+
+ handleAutomationCompositionElementUpdate(acElements, acElementDefinitions, updateMsg.getStartPhase(),
+ updateMsg.getAutomationCompositionId());
+ }
+
+ private void handleAcUpdatePhaseN(AutomationCompositionUpdate updateMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+
+ var acElementList = updateMsg.getParticipantUpdatesList().stream()
+ .flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
+ .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
+
+ handleAutomationCompositionElementUpdate(acElementList, acElementDefinitions, updateMsg.getStartPhase(),
+ updateMsg.getAutomationCompositionId());
+ }
+
+ private void handleAutomationCompositionElementUpdate(List<AutomationCompositionElement> acElements,
+ List<AutomationCompositionElementDefinition> acElementDefinitions, Integer startPhaseMsg,
+ ToscaConceptIdentifier automationCompositionId) {
+ try {
+ for (var element : acElements) {
+ var acElementNodeTemplate = getAcElementNodeTemplate(acElementDefinitions, element.getDefinition());
+ if (acElementNodeTemplate != null) {
+ int startPhase = ParticipantUtils.findStartPhase(acElementNodeTemplate.getProperties());
+ if (startPhaseMsg.equals(startPhase)) {
+ for (var acElementListener : listeners) {
+ acElementListener.automationCompositionElementUpdate(automationCompositionId, element,
+ acElementNodeTemplate);
+ }
+ }
+ }
+ }
+ } catch (PfModelException e) {
+ LOGGER.debug("Automation composition element update failed {}", automationCompositionId);
+ }
+
+ }
+
+ private ToscaNodeTemplate getAcElementNodeTemplate(
+ List<AutomationCompositionElementDefinition> acElementDefinitions, ToscaConceptIdentifier acElementDefId) {
+
+ for (var acElementDefinition : acElementDefinitions) {
+ if (acElementDefId.getName().contains(acElementDefinition.getAcElementDefinitionId().getName())) {
+ return acElementDefinition.getAutomationCompositionElementToscaNodeTemplate();
+ }
+ }
+ return null;
+ }
+
+ private List<AutomationCompositionElement> storeElementsOnThisParticipant(
+ List<ParticipantUpdates> participantUpdates) {
+ var acElementList = participantUpdates.stream()
+ .flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
+ .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
+
+ for (var element : acElementList) {
+ elementsOnThisParticipant.put(element.getId(), element);
+ }
+ return acElementList;
+ }
+
+ private Map<UUID, AutomationCompositionElement> prepareAcElementMap(List<AutomationCompositionElement> acElements) {
+ Map<UUID, AutomationCompositionElement> acElementMap = new LinkedHashMap<>();
+ for (var element : acElements) {
+ acElementMap.put(element.getId(), element);
+ }
+ return acElementMap;
+ }
+
+ /**
+ * Method to handle when the new state from participant is UNINITIALISED state.
+ *
+ * @param automationComposition participant response
+ * @param orderedState orderedState
+ * @param startPhaseMsg startPhase from message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ private void handleUninitialisedState(final AutomationComposition automationComposition,
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ handleStateChange(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ boolean isAllUninitialised = automationComposition.getElements().values().stream()
+ .filter(element -> !AutomationCompositionState.UNINITIALISED.equals(element.getState())).findAny()
+ .isEmpty();
+ if (isAllUninitialised) {
+ automationCompositionMap.remove(automationComposition.getDefinition());
+ automationComposition.getElements().values()
+ .forEach(element -> elementsOnThisParticipant.remove(element.getId()));
+ }
+ }
+
+ /**
+ * Method to handle when the new state from participant is PASSIVE state.
+ *
+ * @param automationComposition participant response
+ * @param orderedState orderedState
+ * @param startPhaseMsg startPhase from message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ private void handlePassiveState(final AutomationComposition automationComposition,
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ handleStateChange(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ }
+
+ /**
+ * Method to handle when the new state from participant is RUNNING state.
+ *
+ * @param automationComposition participant response
+ * @param orderedState orderedState
+ * @param startPhaseMsg startPhase from message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ private void handleRunningState(final AutomationComposition automationComposition,
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ handleStateChange(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
+ }
+
+ /**
+ * Method to update the state of automation composition elements.
+ *
+ * @param automationComposition participant status in memory
+ * @param orderedState orderedState the new ordered state the participant should have
+ * @param startPhaseMsg startPhase from message
+ * @param acElementDefinitions the list of AutomationCompositionElementDefinition
+ */
+ private void handleStateChange(AutomationComposition automationComposition,
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+
+ if (orderedState.equals(automationComposition.getOrderedState())) {
+ var automationCompositionAck =
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ automationCompositionAck.setParticipantId(participantId);
+ automationCompositionAck.setParticipantType(participantType);
+ automationCompositionAck.setMessage("Automation composition is already in state " + orderedState);
+ automationCompositionAck.setResult(false);
+ automationCompositionAck.setAutomationCompositionId(automationComposition.getDefinition());
+ publisher.sendAutomationCompositionAck(automationCompositionAck);
+ return;
+ }
+
+ automationComposition.getElements().values().stream()
+ .forEach(acElement -> automationCompositionElementStateChange(automationComposition, orderedState,
+ acElement, startPhaseMsg, acElementDefinitions));
+ }
+
+ private void automationCompositionElementStateChange(AutomationComposition automationComposition,
+ AutomationCompositionOrderedState orderedState, AutomationCompositionElement acElement, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ var acElementNodeTemplate = getAcElementNodeTemplate(acElementDefinitions, acElement.getDefinition());
+ if (acElementNodeTemplate != null) {
+ int startPhase = ParticipantUtils.findStartPhase(acElementNodeTemplate.getProperties());
+ if (startPhaseMsg.equals(startPhase)) {
+ for (var acElementListener : listeners) {
+ try {
+ acElementListener.automationCompositionElementStateChange(automationComposition.getDefinition(),
+ acElement.getId(), acElement.getState(), orderedState);
+ } catch (PfModelException e) {
+ LOGGER.debug("Automation composition element update failed {}",
+ automationComposition.getDefinition());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Get automation compositions as a {@link ConrolLoops} class.
+ *
+ * @return the automation compositions
+ */
+ public AutomationCompositions getAutomationCompositions() {
+ var automationCompositions = new AutomationCompositions();
+ automationCompositions.setAutomationCompositionList(new ArrayList<>(automationCompositionMap.values()));
+ return automationCompositions;
+ }
+
+ /**
+ * Get properties of a automation composition element.
+ *
+ * @param id the automation composition element id
+ * @return the instance properties
+ */
+ public Map<String, ToscaProperty> getAcElementInstanceProperties(UUID id) {
+ Map<String, ToscaProperty> propertiesMap = new HashMap<>();
+ for (var automationComposition : automationCompositionMap.values()) {
+ var element = automationComposition.getElements().get(id);
+ if (element != null) {
+ propertiesMap.putAll(element.getPropertiesMap());
+ }
+ }
+ return propertiesMap;
+ }
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivator.java
index e42fac46e..0144f669c 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivator.java
@@ -19,13 +19,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import lombok.Getter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
@@ -61,16 +61,15 @@ public class IntermediaryActivator extends ServiceManagerContainer implements Cl
* @param publishers list of Publishers
* @param listeners list of Listeners
*/
- public <T> IntermediaryActivator(final ParticipantParameters parameters,
- ParticipantHandler participantHandler, List<Publisher> publishers,
- List<Listener<T>> listeners) {
+ public <T> IntermediaryActivator(final ParticipantParameters parameters, ParticipantHandler participantHandler,
+ List<Publisher> publishers, List<Listener<T>> listeners) {
this.participantHandler = participantHandler;
- topicSinks = TopicEndpointManager.getManager()
- .addTopicSinks(parameters.getIntermediaryParameters().getClampControlLoopTopics().getTopicSinks());
+ topicSinks = TopicEndpointManager.getManager().addTopicSinks(
+ parameters.getIntermediaryParameters().getClampAutomationCompositionTopics().getTopicSinks());
- topicSources = TopicEndpointManager.getManager()
- .addTopicSources(parameters.getIntermediaryParameters().getClampControlLoopTopics().getTopicSources());
+ topicSources = TopicEndpointManager.getManager().addTopicSources(
+ parameters.getIntermediaryParameters().getClampAutomationCompositionTopics().getTopicSources());
msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES);
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/Listener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Listener.java
index 0afbf1c4c..56ed55441 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/Listener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Listener.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.config.messaging;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import org.onap.policy.common.endpoints.listeners.ScoListener;
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/acm/participant/intermediary/handler/ParticipantHandler.java
index 89a13a84b..fa02f3dcf 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/acm/participant/intermediary/handler/ParticipantHandler.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import java.time.Instant;
import java.util.ArrayList;
@@ -32,33 +32,33 @@ import java.util.UUID;
import java.util.stream.Collectors;
import lombok.Getter;
import lombok.Setter;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantAckMessage;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatusReq;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
@@ -79,7 +79,7 @@ public class ParticipantHandler {
@Getter
private final ToscaConceptIdentifier participantId;
- private final ControlLoopHandler controlLoopHandler;
+ private final AutomationCompositionHandler automationCompositionHandler;
private final ParticipantStatistics participantStatistics;
private final ParticipantMessagePublisher publisher;
@@ -89,7 +89,7 @@ public class ParticipantHandler {
@Setter
private ParticipantHealthStatus healthStatus = ParticipantHealthStatus.UNKNOWN;
- private final List<ControlLoopElementDefinition> clElementDefsOnThisParticipant = new ArrayList<>();
+ private final List<AutomationCompositionElementDefinition> acElementDefsOnThisParticipant = new ArrayList<>();
/**
* Constructor, set the participant ID and sender.
@@ -98,11 +98,11 @@ public class ParticipantHandler {
* @param publisher the publisher for sending responses to messages
*/
public ParticipantHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher,
- ControlLoopHandler controlLoopHandler) {
+ AutomationCompositionHandler automationCompositionHandler) {
this.participantType = parameters.getIntermediaryParameters().getParticipantType();
this.participantId = parameters.getIntermediaryParameters().getParticipantId();
this.publisher = publisher;
- this.controlLoopHandler = controlLoopHandler;
+ this.automationCompositionHandler = automationCompositionHandler;
this.participantStatistics = new ParticipantStatistics();
this.participantStatistics.setParticipantId(participantId);
this.participantStatistics.setState(state);
@@ -121,42 +121,45 @@ public class ParticipantHandler {
}
/**
- * Update ControlLoopElement statistics. The control loop elements listening will be
- * notified to retrieve statistics from respective controlloop elements, and controlloopelements
+ * Update AutomationCompositionElement statistics. The automation composition elements listening will be
+ * notified to retrieve statistics from respective automation composition elements, and automation
+ * compositionelements
* data on the handler will be updated.
*
- * @param controlLoops the control loops
- * @param clElementListener control loop element listener
+ * @param automationCompositions the automation compositions
+ * @param acElementListener automation composition element listener
*/
- private void updateClElementStatistics(ControlLoops controlLoops, ControlLoopElementListener clElementListener) {
- for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
- for (ControlLoopElement element : controlLoop.getElements().values()) {
+ private void updateAcElementStatistics(AutomationCompositions automationCompositions,
+ AutomationCompositionElementListener acElementListener) {
+ for (AutomationComposition automationComposition : automationCompositions.getAutomationCompositionList()) {
+ for (AutomationCompositionElement element : automationComposition.getElements().values()) {
try {
- clElementListener.handleStatistics(element.getId());
+ acElementListener.handleStatistics(element.getId());
} catch (PfModelException e) {
- LOGGER.debug("Getting statistics for Control loop element failed for element ID {}",
- element.getId(), e);
+ LOGGER.debug("Getting statistics for automation composition element failed for element ID {}",
+ element.getId(), e);
}
}
}
}
/**
- * Handle a control loop update message.
+ * Handle a automation composition update message.
*
* @param updateMsg the update message
*/
- public void handleControlLoopUpdate(ControlLoopUpdate updateMsg) {
- controlLoopHandler.handleControlLoopUpdate(updateMsg, clElementDefsOnThisParticipant);
+ public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg) {
+ automationCompositionHandler.handleAutomationCompositionUpdate(updateMsg, acElementDefsOnThisParticipant);
}
/**
- * Handle a control loop state change message.
+ * Handle a automation composition state change message.
*
* @param stateChangeMsg the state change message
*/
- public void handleControlLoopStateChange(ControlLoopStateChange stateChangeMsg) {
- controlLoopHandler.handleControlLoopStateChange(stateChangeMsg, clElementDefsOnThisParticipant);
+ public void handleAutomationCompositionStateChange(AutomationCompositionStateChange stateChangeMsg) {
+ automationCompositionHandler.handleAutomationCompositionStateChange(stateChangeMsg,
+ acElementDefsOnThisParticipant);
}
private void handleStateChange(ParticipantState newParticipantState, ParticipantUpdateAck response) {
@@ -221,15 +224,15 @@ public class ParticipantHandler {
}
/**
- * Get common properties of a controlloopelement.
+ * Get common properties of a automation composition element.
*
- * @param clElementDef the control loop element definition
+ * @param acElementDef the automation composition element definition
* @return the common properties
*/
- public Map<String, ToscaProperty> getClElementDefinitionCommonProperties(ToscaConceptIdentifier clElementDef) {
+ public Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef) {
Map<String, ToscaProperty> commonPropertiesMap = new HashMap<>();
- clElementDefsOnThisParticipant.stream().forEach(definition -> {
- if (definition.getClElementDefinitionId().equals(clElementDef)) {
+ acElementDefsOnThisParticipant.stream().forEach(definition -> {
+ if (definition.getAcElementDefinitionId().equals(acElementDef)) {
commonPropertiesMap.putAll(definition.getCommonPropertiesMap());
}
});
@@ -257,7 +260,7 @@ public class ParticipantHandler {
}
/**
- * Method to send ParticipantRegister message to controlloop runtime.
+ * Method to send ParticipantRegister message to automation composition runtime.
*/
public void sendParticipantRegister() {
var participantRegister = new ParticipantRegister();
@@ -274,7 +277,7 @@ public class ParticipantHandler {
*/
public void handleParticipantRegisterAck(ParticipantRegisterAck participantRegisterAckMsg) {
LOGGER.debug("ParticipantRegisterAck message received as responseTo {}",
- participantRegisterAckMsg.getResponseTo());
+ participantRegisterAckMsg.getResponseTo());
statusToPassive();
publisher.sendParticipantStatus(makeHeartbeat(false));
}
@@ -291,7 +294,7 @@ public class ParticipantHandler {
}
/**
- * Method to send ParticipantDeregister message to controlloop runtime.
+ * Method to send ParticipantDeregister message to automation composition runtime.
*/
public void sendParticipantDeregister() {
var participantDeregister = new ParticipantDeregister();
@@ -308,7 +311,7 @@ public class ParticipantHandler {
*/
public void handleParticipantDeregisterAck(ParticipantDeregisterAck participantDeregisterAckMsg) {
LOGGER.debug("ParticipantDeregisterAck message received as responseTo {}",
- participantDeregisterAckMsg.getResponseTo());
+ participantDeregisterAckMsg.getResponseTo());
}
/**
@@ -318,27 +321,28 @@ public class ParticipantHandler {
*/
public void handleParticipantUpdate(ParticipantUpdate participantUpdateMsg) {
LOGGER.debug("ParticipantUpdate message received for participantId {}",
- participantUpdateMsg.getParticipantId());
+ participantUpdateMsg.getParticipantId());
if (!participantUpdateMsg.getParticipantDefinitionUpdates().isEmpty()) {
statusToPassive();
- // This message is to commission the controlloop
+ // This message is to commission the automation composition
for (ParticipantDefinition participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) {
if (participantDefinition.getParticipantType().equals(participantType)) {
- clElementDefsOnThisParticipant.addAll(participantDefinition.getControlLoopElementDefinitionList());
+ acElementDefsOnThisParticipant
+ .addAll(participantDefinition.getAutomationCompositionElementDefinitionList());
break;
}
}
} else {
- // This message is to decommission the controlloop
- clElementDefsOnThisParticipant.clear();
+ // This message is to decommission the automation composition
+ acElementDefsOnThisParticipant.clear();
this.state = ParticipantState.TERMINATED;
}
sendParticipantUpdateAck(participantUpdateMsg.getMessageId());
}
/**
- * Method to send ParticipantUpdateAck message to controlloop runtime.
+ * Method to send ParticipantUpdateAck message to automation composition runtime.
*/
public void sendParticipantUpdateAck(UUID messageId) {
var participantUpdateAck = new ParticipantUpdateAck();
@@ -359,13 +363,13 @@ public class ParticipantHandler {
}
/**
- * Method to send heartbeat to controlloop runtime.
+ * Method to send heartbeat to automation composition runtime.
*/
public ParticipantStatus makeHeartbeat(boolean responseToParticipantStatusReq) {
if (!responseToParticipantStatusReq) {
- var controlLoops = controlLoopHandler.getControlLoops();
- for (var clElementListener : controlLoopHandler.getListeners()) {
- updateClElementStatistics(controlLoops, clElementListener);
+ var automationCompositions = automationCompositionHandler.getAutomationCompositions();
+ for (var acElementListener : automationCompositionHandler.getListeners()) {
+ updateAcElementStatistics(automationCompositions, acElementListener);
}
}
this.participantStatistics.setState(state);
@@ -378,38 +382,35 @@ public class ParticipantHandler {
heartbeat.setParticipantType(participantType);
heartbeat.setHealthStatus(healthStatus);
heartbeat.setState(state);
- heartbeat.setControlLoopInfoList(getControlLoopInfoList());
+ heartbeat.setAutomationCompositionInfoList(getAutomationCompositionInfoList());
if (responseToParticipantStatusReq) {
ParticipantDefinition participantDefinition = new ParticipantDefinition();
participantDefinition.setParticipantId(participantId);
participantDefinition.setParticipantType(participantType);
- participantDefinition.setControlLoopElementDefinitionList(clElementDefsOnThisParticipant);
+ participantDefinition.setAutomationCompositionElementDefinitionList(acElementDefsOnThisParticipant);
heartbeat.setParticipantDefinitionUpdates(List.of(participantDefinition));
}
return heartbeat;
}
- private List<ControlLoopInfo> getControlLoopInfoList() {
- List<ControlLoopInfo> controlLoopInfoList = new ArrayList<>();
- for (var entry : controlLoopHandler.getControlLoopMap().entrySet()) {
- var clInfo = new ControlLoopInfo();
- clInfo.setControlLoopId(entry.getKey());
- var clStatitistics = new ControlLoopStatistics();
- clStatitistics.setControlLoopId(entry.getKey());
- var clElementStatisticsList = new ClElementStatisticsList();
- clElementStatisticsList
- .setClElementStatistics(entry.getValue().getElements().values()
- .stream()
- .map(ControlLoopElement::getClElementStatistics)
- .filter(Objects::nonNull)
- .collect(Collectors.toList()));
- clStatitistics.setClElementStatisticsList(clElementStatisticsList);
- clInfo.setControlLoopStatistics(clStatitistics);
- clInfo.setState(entry.getValue().getState());
- controlLoopInfoList.add(clInfo);
+ private List<AutomationCompositionInfo> getAutomationCompositionInfoList() {
+ List<AutomationCompositionInfo> automationCompositionInfoList = new ArrayList<>();
+ for (var entry : automationCompositionHandler.getAutomationCompositionMap().entrySet()) {
+ var acInfo = new AutomationCompositionInfo();
+ acInfo.setAutomationCompositionId(entry.getKey());
+ var acStatitistics = new AutomationCompositionStatistics();
+ acStatitistics.setAutomationCompositionId(entry.getKey());
+ var acElementStatisticsList = new AcElementStatisticsList();
+ acElementStatisticsList.setAcElementStatistics(entry.getValue().getElements().values().stream()
+ .map(AutomationCompositionElement::getAcElementStatistics).filter(Objects::nonNull)
+ .collect(Collectors.toList()));
+ acStatitistics.setAcElementStatisticsList(acElementStatisticsList);
+ acInfo.setAutomationCompositionStatistics(acStatitistics);
+ acInfo.setState(entry.getValue().getState());
+ automationCompositionInfoList.add(acInfo);
}
- return controlLoopInfoList;
+ return automationCompositionInfoList;
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/Publisher.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Publisher.java
index 3cd4dff85..72aa645fd 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/Publisher.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/Publisher.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.config.messaging;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import java.util.List;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
index fdc451e6b..dcbfd1b2e 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.parameters;
+package org.onap.policy.clamp.acm.participant.intermediary.parameters;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
@@ -50,12 +50,12 @@ public class ParticipantIntermediaryParameters {
@Valid
private ToscaConceptIdentifier participantType;
- // The time interval for periodic reporting of status to the CLAMP control loop server
+ // The time interval for periodic reporting of status to the CLAMP ACM server
@Valid
@Positive
private long reportingTimeIntervalMs;
@NotNull
@ParameterGroupConstraint
- private TopicParameterGroup clampControlLoopTopics;
+ private TopicParameterGroup clampAutomationCompositionTopics;
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantParameters.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantParameters.java
index c350b1b95..ca9c56607 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantParameters.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantParameters.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.parameters;
+package org.onap.policy.clamp.acm.participant.intermediary.parameters;
public interface ParticipantParameters {
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java
deleted file mode 100644
index 58378fa41..000000000
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.intermediary.api;
-
-import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-
-/**
- * This interface is implemented by participant implementations to receive updates on control loop elements.
- */
-public interface ControlLoopElementListener {
- /**
- * Handle a control loop element state change.
- *
- * @param controlLoopElementId the ID of the control loop element
- * @param currentState the current state of the control loop element
- * @param newState the state to which the control loop element is changing to
- * @throws PfModelException in case of a model exception
- */
- public void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId, UUID controlLoopElementId,
- ControlLoopState currentState, ControlLoopOrderedState newState) throws PfModelException;
-
- /**
- * Handle an update on a control loop element.
- *
- * @param element the information on the control loop element
- * @param controlLoopElementDefinition toscaNodeTemplate
- * @throws PfModelException from Policy framework
- */
- public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId, ControlLoopElement element,
- ToscaNodeTemplate controlLoopElementDefinition) throws PfModelException;
-
- /**
- * Handle controlLoopElement statistics.
- *
- * @param controlLoopElementId controlLoopElement id
- * @throws PfModelException in case of a model exception
- */
- public void handleStatistics(UUID controlLoopElementId) throws PfModelException;
-}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java
deleted file mode 100644
index 0cb4963ec..000000000
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.intermediary.api;
-
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
-
-/**
- * This interface is used by participant implementations to use the participant intermediary.
- */
-public interface ParticipantIntermediaryApi {
-
- /**
- * Register a listener for control loop elements that are mediated by the intermediary.
- *
- * @param controlLoopElementListener The control loop element listener to register
- */
- void registerControlLoopElementListener(ControlLoopElementListener controlLoopElementListener);
-
- /**
- * Get participants loops from the intermediary API.
- *
- * @param name the participant name, null for all
- * @param version the participant version, null for all
- * @return the participants
- */
- List<Participant> getParticipants(String name, String version);
-
- /**
- * Get common properties of a controlloopelement.
- *
- * @param clElementDef the control loop element definition
- * @return the common properties
- */
- Map<String, ToscaProperty> getClElementDefinitionCommonProperties(ToscaConceptIdentifier clElementDef);
-
- /**
- * Update the state of a participant.
- *
- * @param definition the definition of the participant to update the state on
- * @param state the state of the participant
- * @return the participant
- */
- Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
-
- /**
- * Update the statistics of a participant.
- *
- * @param participantStatistics the statistics of the participant
- */
- void updateParticipantStatistics(ParticipantStatistics participantStatistics);
-
- /**
- * Get control loops from the intermediary API.
- *
- * @param name the control loop element name, null for all
- * @param version the control loop element version, null for all
- * @return the control loop elements
- */
- ControlLoops getControlLoops(String name, String version);
-
- /**
- * Get control loop elements from the intermediary API.
- *
- * @param name the control loop element name, null for all
- * @param version the control loop element version, null for all
- * @return the control loop elements
- */
- Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version);
-
- /**
- * Get control loop element from the intermediary API.
- *
- * @param id control loop element ID
- * @return the control loop element
- */
- ControlLoopElement getControlLoopElement(UUID id);
-
- /**
- * Update the state of a control loop element.
- *
- * @param id the ID of the control loop element to update the state on
- * @param currentState the state of the control loop element
- * @param newState the state of the control loop element
- * @return ControlLoopElement updated control loop element
- */
- ControlLoopElement updateControlLoopElementState(ToscaConceptIdentifier controlLoopId,
- UUID id, ControlLoopOrderedState currentState,
- ControlLoopState newState, ParticipantMessageType messageType);
-
- /**
- * Update the control loop element statistics.
- *
- * @param id the ID of the control loop element to update the state on
- * @param elementStatistics the updated statistics
- */
- void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics);
-}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
deleted file mode 100644
index bbafc4678..000000000
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.intermediary.api.impl;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ControlLoopHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
-import org.springframework.stereotype.Component;
-
-/**
- * This class is api implementation used by participant intermediary.
- */
-@Component
-public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryApi {
-
- // The handler for the participant intermediary
- private final ParticipantHandler participantHandler;
-
- // The handler for the controlLoop intermediary
- private final ControlLoopHandler controlLoopHandler;
-
- /**
- * Constructor.
- *
- * @param participantHandler ParticipantHandler
- * @param controlLoopHandler ControlLoopHandler
- */
- public ParticipantIntermediaryApiImpl(ParticipantHandler participantHandler,
- ControlLoopHandler controlLoopHandler) {
- this.participantHandler = participantHandler;
- this.controlLoopHandler = controlLoopHandler;
- }
-
- @Override
- public void registerControlLoopElementListener(ControlLoopElementListener controlLoopElementListener) {
- controlLoopHandler.registerControlLoopElementListener(controlLoopElementListener);
- }
-
- @Override
- public List<Participant> getParticipants(String name, String version) {
- return List.of(participantHandler.getParticipant(name, version));
- }
-
- @Override
- public Map<String, ToscaProperty> getClElementDefinitionCommonProperties(ToscaConceptIdentifier clElementDef) {
- return participantHandler.getClElementDefinitionCommonProperties(clElementDef);
- }
-
- @Override
- public Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state) {
- return participantHandler.updateParticipantState(definition, state);
- }
-
- @Override
- public void updateParticipantStatistics(ParticipantStatistics participantStatistics) {
- participantHandler.updateParticipantStatistics(participantStatistics);
- }
-
- @Override
- public ControlLoops getControlLoops(String name, String version) {
- return controlLoopHandler.getControlLoops();
- }
-
- @Override
- public Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version) {
- List<ControlLoop> controlLoops = controlLoopHandler.getControlLoops().getControlLoopList();
-
- for (ControlLoop controlLoop : controlLoops) {
- if (name.equals(controlLoop.getDefinition().getName())) {
- return controlLoop.getElements();
- }
- }
- return new LinkedHashMap<>();
- }
-
- @Override
- public ControlLoopElement getControlLoopElement(UUID id) {
- List<ControlLoop> controlLoops = controlLoopHandler.getControlLoops().getControlLoopList();
-
- for (ControlLoop controlLoop : controlLoops) {
- ControlLoopElement clElement = controlLoop.getElements().get(id);
- if (clElement != null) {
- return clElement;
- }
- }
- return null;
- }
-
- @Override
- public ControlLoopElement updateControlLoopElementState(ToscaConceptIdentifier controlLoopId,
- UUID id, ControlLoopOrderedState currentState,
- ControlLoopState newState, ParticipantMessageType messageType) {
- return controlLoopHandler.updateControlLoopElementState(controlLoopId,
- id, currentState, newState);
- }
-
- @Override
- public void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics) {
- controlLoopHandler.updateControlLoopElementStatistics(id, elementStatistics);
- }
-}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
deleted file mode 100644
index 5a0f4989f..000000000
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
+++ /dev/null
@@ -1,454 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.stream.Collectors;
-import lombok.Getter;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementAck;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/*
- * This class is responsible for managing the state of all control loops in the participant.
- */
-@Component
-public class ControlLoopHandler {
- private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopHandler.class);
-
- private final ToscaConceptIdentifier participantType;
- private final ToscaConceptIdentifier participantId;
- private final ParticipantMessagePublisher publisher;
-
- @Getter
- private final Map<ToscaConceptIdentifier, ControlLoop> controlLoopMap = new LinkedHashMap<>();
-
- @Getter
- private final Map<UUID, ControlLoopElement> elementsOnThisParticipant = new LinkedHashMap<>();
-
- @Getter
- private List<ControlLoopElementListener> listeners = new ArrayList<>();
-
- /**
- * Constructor, set the participant ID and messageSender.
- *
- * @param parameters the parameters of the participant
- * @param publisher the ParticipantMessage Publisher
- */
- public ControlLoopHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher) {
- this.participantType = parameters.getIntermediaryParameters().getParticipantType();
- this.participantId = parameters.getIntermediaryParameters().getParticipantId();
- this.publisher = publisher;
- }
-
- public void registerControlLoopElementListener(ControlLoopElementListener listener) {
- listeners.add(listener);
- }
-
- /**
- * Handle a control loop element state change message.
- *
- * @param controlLoopId the controlLoop Id
- * @param id the controlLoop UUID
- * @param orderedState the current state
- * @param newState the ordered state
- * @return controlLoopElement the updated controlloop element
- */
- public ControlLoopElement updateControlLoopElementState(ToscaConceptIdentifier controlLoopId, UUID id,
- ControlLoopOrderedState orderedState, ControlLoopState newState) {
-
- if (id == null) {
- LOGGER.warn("Cannot update Control loop element state, id is null");
- return null;
- }
-
- // Update states of ControlLoopElement in controlLoopMap
- for (var controlLoop : controlLoopMap.values()) {
- var element = controlLoop.getElements().get(id);
- if (element != null) {
- element.setOrderedState(orderedState);
- element.setState(newState);
- }
- var checkOpt = controlLoop.getElements().values().stream()
- .filter(clElement -> !newState.equals(clElement.getState())).findAny();
- if (checkOpt.isEmpty()) {
- controlLoop.setState(newState);
- controlLoop.setOrderedState(orderedState);
- }
- }
-
- // Update states of ControlLoopElement in elementsOnThisParticipant
- var clElement = elementsOnThisParticipant.get(id);
- if (clElement != null) {
- var controlLoopStateChangeAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
- controlLoopStateChangeAck.setParticipantId(participantId);
- controlLoopStateChangeAck.setParticipantType(participantType);
- controlLoopStateChangeAck.setControlLoopId(controlLoopId);
- clElement.setOrderedState(orderedState);
- clElement.setState(newState);
- controlLoopStateChangeAck.getControlLoopResultMap().put(clElement.getId(), new ControlLoopElementAck(
- newState, true, "Control loop element {} state changed to {}\", id, newState)"));
- LOGGER.debug("Control loop element {} state changed to {}", id, newState);
- controlLoopStateChangeAck.setMessage("ControlLoopElement state changed to {} " + newState);
- controlLoopStateChangeAck.setResult(true);
- publisher.sendControlLoopAck(controlLoopStateChangeAck);
- return clElement;
- }
- return null;
- }
-
- /**
- * Handle a control loop element statistics.
- *
- * @param id controlloop element id
- * @param elementStatistics control loop element Statistics
- */
- public void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics) {
- var clElement = elementsOnThisParticipant.get(id);
- if (clElement != null) {
- elementStatistics.setParticipantId(participantId);
- elementStatistics.setId(id);
- clElement.setClElementStatistics(elementStatistics);
- }
- }
-
- /**
- * Handle a control loop state change message.
- *
- * @param stateChangeMsg the state change message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- public void handleControlLoopStateChange(ControlLoopStateChange stateChangeMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
- if (stateChangeMsg.getControlLoopId() == null) {
- return;
- }
-
- var controlLoop = controlLoopMap.get(stateChangeMsg.getControlLoopId());
-
- if (controlLoop == null) {
- var controlLoopAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
- controlLoopAck.setParticipantId(participantId);
- controlLoopAck.setParticipantType(participantType);
- controlLoopAck.setMessage("Control loop " + stateChangeMsg.getControlLoopId()
- + " does not use this participant " + participantId);
- controlLoopAck.setResult(false);
- controlLoopAck.setResponseTo(stateChangeMsg.getMessageId());
- controlLoopAck.setControlLoopId(stateChangeMsg.getControlLoopId());
- publisher.sendControlLoopAck(controlLoopAck);
- LOGGER.debug("Control loop {} does not use this participant", stateChangeMsg.getControlLoopId());
- return;
- }
-
- handleState(controlLoop, stateChangeMsg.getOrderedState(), stateChangeMsg.getStartPhase(),
- clElementDefinitions);
- }
-
- /**
- * Method to handle state changes.
- *
- * @param controlLoop participant response
- * @param orderedState controlloop ordered state
- * @param startPhaseMsg startPhase from message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- private void handleState(final ControlLoop controlLoop, ControlLoopOrderedState orderedState, Integer startPhaseMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
- switch (orderedState) {
- case UNINITIALISED:
- handleUninitialisedState(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- break;
- case PASSIVE:
- handlePassiveState(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- break;
- case RUNNING:
- handleRunningState(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- break;
- default:
- LOGGER.debug("StateChange message has no state, state is null {}", controlLoop.getDefinition());
- break;
- }
- }
-
- /**
- * Handle a control loop update message.
- *
- * @param updateMsg the update message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- public void handleControlLoopUpdate(ControlLoopUpdate updateMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
-
- if (!updateMsg.appliesTo(participantType, participantId)) {
- return;
- }
-
- if (0 == updateMsg.getStartPhase()) {
- handleClUpdatePhase0(updateMsg, clElementDefinitions);
- } else {
- handleClUpdatePhaseN(updateMsg, clElementDefinitions);
- }
- }
-
- private void handleClUpdatePhase0(ControlLoopUpdate updateMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
- var controlLoop = controlLoopMap.get(updateMsg.getControlLoopId());
-
- // TODO: Updates to existing ControlLoops are not supported yet (Addition/Removal of ControlLoop
- // elements to existing ControlLoop has to be supported).
- if (controlLoop != null) {
- var controlLoopUpdateAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_UPDATE_ACK);
- controlLoopUpdateAck.setParticipantId(participantId);
- controlLoopUpdateAck.setParticipantType(participantType);
-
- controlLoopUpdateAck.setMessage("Control loop " + updateMsg.getControlLoopId()
- + " already defined on participant " + participantId);
- controlLoopUpdateAck.setResult(false);
- controlLoopUpdateAck.setResponseTo(updateMsg.getMessageId());
- controlLoopUpdateAck.setControlLoopId(updateMsg.getControlLoopId());
- publisher.sendControlLoopAck(controlLoopUpdateAck);
- return;
- }
-
- if (updateMsg.getParticipantUpdatesList().isEmpty()) {
- LOGGER.warn("No ControlLoopElement updates in message {}", updateMsg.getControlLoopId());
- return;
- }
-
- var clElements = storeElementsOnThisParticipant(updateMsg.getParticipantUpdatesList());
-
- var clElementMap = prepareClElementMap(clElements);
- controlLoop = new ControlLoop();
- controlLoop.setDefinition(updateMsg.getControlLoopId());
- controlLoop.setElements(clElementMap);
- controlLoopMap.put(updateMsg.getControlLoopId(), controlLoop);
-
- handleControlLoopElementUpdate(clElements, clElementDefinitions, updateMsg.getStartPhase(),
- updateMsg.getControlLoopId());
- }
-
- private void handleClUpdatePhaseN(ControlLoopUpdate updateMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
-
- var clElementList = updateMsg.getParticipantUpdatesList().stream()
- .flatMap(participantUpdate -> participantUpdate.getControlLoopElementList().stream())
- .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
-
- handleControlLoopElementUpdate(clElementList, clElementDefinitions, updateMsg.getStartPhase(),
- updateMsg.getControlLoopId());
- }
-
- private void handleControlLoopElementUpdate(List<ControlLoopElement> clElements,
- List<ControlLoopElementDefinition> clElementDefinitions, Integer startPhaseMsg,
- ToscaConceptIdentifier controlLoopId) {
- try {
- for (var element : clElements) {
- var clElementNodeTemplate = getClElementNodeTemplate(clElementDefinitions, element.getDefinition());
- if (clElementNodeTemplate != null) {
- int startPhase = ParticipantUtils.findStartPhase(clElementNodeTemplate.getProperties());
- if (startPhaseMsg.equals(startPhase)) {
- for (var clElementListener : listeners) {
- clElementListener.controlLoopElementUpdate(controlLoopId, element, clElementNodeTemplate);
- }
- }
- }
- }
- } catch (PfModelException e) {
- LOGGER.debug("Control loop element update failed {}", controlLoopId);
- }
-
- }
-
- private ToscaNodeTemplate getClElementNodeTemplate(List<ControlLoopElementDefinition> clElementDefinitions,
- ToscaConceptIdentifier clElementDefId) {
-
- for (var clElementDefinition : clElementDefinitions) {
- if (clElementDefId.getName().contains(clElementDefinition.getClElementDefinitionId().getName())) {
- return clElementDefinition.getControlLoopElementToscaNodeTemplate();
- }
- }
- return null;
- }
-
- private List<ControlLoopElement> storeElementsOnThisParticipant(List<ParticipantUpdates> participantUpdates) {
- var clElementList = participantUpdates.stream()
- .flatMap(participantUpdate -> participantUpdate.getControlLoopElementList().stream())
- .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
-
- for (var element : clElementList) {
- elementsOnThisParticipant.put(element.getId(), element);
- }
- return clElementList;
- }
-
- private Map<UUID, ControlLoopElement> prepareClElementMap(List<ControlLoopElement> clElements) {
- Map<UUID, ControlLoopElement> clElementMap = new LinkedHashMap<>();
- for (var element : clElements) {
- clElementMap.put(element.getId(), element);
- }
- return clElementMap;
- }
-
- /**
- * Method to handle when the new state from participant is UNINITIALISED state.
- *
- * @param controlLoop participant response
- * @param orderedState orderedState
- * @param startPhaseMsg startPhase from message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- private void handleUninitialisedState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- Integer startPhaseMsg, List<ControlLoopElementDefinition> clElementDefinitions) {
- handleStateChange(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- boolean isAllUninitialised = controlLoop.getElements().values().stream()
- .filter(element -> !ControlLoopState.UNINITIALISED.equals(element.getState())).findAny().isEmpty();
- if (isAllUninitialised) {
- controlLoopMap.remove(controlLoop.getDefinition());
- controlLoop.getElements().values().forEach(element -> elementsOnThisParticipant.remove(element.getId()));
- }
- }
-
- /**
- * Method to handle when the new state from participant is PASSIVE state.
- *
- * @param controlLoop participant response
- * @param orderedState orderedState
- * @param startPhaseMsg startPhase from message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- private void handlePassiveState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- Integer startPhaseMsg, List<ControlLoopElementDefinition> clElementDefinitions) {
- handleStateChange(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- }
-
- /**
- * Method to handle when the new state from participant is RUNNING state.
- *
- * @param controlLoop participant response
- * @param orderedState orderedState
- * @param startPhaseMsg startPhase from message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- private void handleRunningState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- Integer startPhaseMsg, List<ControlLoopElementDefinition> clElementDefinitions) {
- handleStateChange(controlLoop, orderedState, startPhaseMsg, clElementDefinitions);
- }
-
- /**
- * Method to update the state of control loop elements.
- *
- * @param controlLoop participant status in memory
- * @param orderedState orderedState the new ordered state the participant should have
- * @param startPhaseMsg startPhase from message
- * @param clElementDefinitions the list of ControlLoopElementDefinition
- */
- private void handleStateChange(ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- Integer startPhaseMsg, List<ControlLoopElementDefinition> clElementDefinitions) {
-
- if (orderedState.equals(controlLoop.getOrderedState())) {
- var controlLoopAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
- controlLoopAck.setParticipantId(participantId);
- controlLoopAck.setParticipantType(participantType);
- controlLoopAck.setMessage("Control loop is already in state " + orderedState);
- controlLoopAck.setResult(false);
- controlLoopAck.setControlLoopId(controlLoop.getDefinition());
- publisher.sendControlLoopAck(controlLoopAck);
- return;
- }
-
- controlLoop.getElements().values().stream().forEach(clElement -> controlLoopElementStateChange(controlLoop,
- orderedState, clElement, startPhaseMsg, clElementDefinitions));
- }
-
- private void controlLoopElementStateChange(ControlLoop controlLoop, ControlLoopOrderedState orderedState,
- ControlLoopElement clElement, Integer startPhaseMsg,
- List<ControlLoopElementDefinition> clElementDefinitions) {
- var clElementNodeTemplate = getClElementNodeTemplate(clElementDefinitions, clElement.getDefinition());
- if (clElementNodeTemplate != null) {
- int startPhase = ParticipantUtils.findStartPhase(clElementNodeTemplate.getProperties());
- if (startPhaseMsg.equals(startPhase)) {
- for (var clElementListener : listeners) {
- try {
- clElementListener.controlLoopElementStateChange(controlLoop.getDefinition(), clElement.getId(),
- clElement.getState(), orderedState);
- } catch (PfModelException e) {
- LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition());
- }
- }
- }
- }
- }
-
- /**
- * Get control loops as a {@link ConrolLoops} class.
- *
- * @return the control loops
- */
- public ControlLoops getControlLoops() {
- var controlLoops = new ControlLoops();
- controlLoops.setControlLoopList(new ArrayList<>(controlLoopMap.values()));
- return controlLoops;
- }
-
- /**
- * Get properties of a controlloopelement.
- *
- * @param id the control loop element id
- * @return the instance properties
- */
- public Map<String, ToscaProperty> getClElementInstanceProperties(UUID id) {
- Map<String, ToscaProperty> propertiesMap = new HashMap<>();
- for (var controlLoop : controlLoopMap.values()) {
- var element = controlLoop.getElements().get(id);
- if (element != null) {
- propertiesMap.putAll(element.getPropertiesMap());
- }
- }
- return propertiesMap;
- }
-}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java
index b08e796b7..5d9675606 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.api.impl;
+package org.onap.policy.clamp.acm.participant.intermediary.api.impl;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
@@ -29,15 +29,15 @@ import java.time.Instant;
import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -47,24 +47,24 @@ class ParticipantIntermediaryApiImplTest {
private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
private static final String ID_VERSION = "1.0.1";
- private static final String ID_NAME_E = "org.onap.domain.pmsh.PMSHControlLoopDefinition";
+ private static final String ID_NAME_E = "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition";
private static final String ID_VERSION_E = "1.0.0";
- private static final String ID_NAME_TYPE = "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant";
+ private static final String ID_NAME_TYPE = "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant";
private static final String ID_VERSION_TYPE = "2.3.4";
@Test
void mockParticipantIntermediaryApiImplTest() throws CoderException {
var uuid = UUID.randomUUID();
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
- var participantHandler = commonTestData.getParticipantHandlerControlLoops();
- var controlLoopHandler = commonTestData.setTestControlLoopHandler(id, uuid);
- var apiImpl = new ParticipantIntermediaryApiImpl(participantHandler, controlLoopHandler);
- var clElementListener = Mockito.mock(ControlLoopElementListener.class);
- apiImpl.registerControlLoopElementListener(clElementListener);
+ var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
+ var automationComposiitonHandler = commonTestData.setTestAutomationCompositionHandler(id, uuid);
+ var apiImpl = new ParticipantIntermediaryApiImpl(participantHandler, automationComposiitonHandler);
+ var acElementListener = Mockito.mock(AutomationCompositionElementListener.class);
+ apiImpl.registerAutomationCompositionElementListener(acElementListener);
- assertNotNull(apiImpl.getControlLoops(id.getName(), id.getVersion()));
- assertThat(apiImpl.getClElementDefinitionCommonProperties(id)).isEmpty();
+ assertNotNull(apiImpl.getAutomationCompositions(id.getName(), id.getVersion()));
+ assertThat(apiImpl.getAcElementDefinitionCommonProperties(id)).isEmpty();
var participantStatistics = new ParticipantStatistics();
participantStatistics.setParticipantId(id);
@@ -79,24 +79,25 @@ class ParticipantIntermediaryApiImplTest {
var participant = apiImpl.updateParticipantState(id, ParticipantState.TERMINATED);
assertEquals(ParticipantState.TERMINATED, participant.getParticipantState());
- var elements = apiImpl.getControlLoopElements(ID_NAME_E, ID_VERSION_E);
+ var elements = apiImpl.getAutomationCompositionElements(ID_NAME_E, ID_VERSION_E);
assertFalse(elements.containsKey(uuid));
- var element = apiImpl.getControlLoopElement(elements.keySet().iterator().next());
+ var element = apiImpl.getAutomationCompositionElement(elements.keySet().iterator().next());
var idType = new ToscaConceptIdentifier(ID_NAME_TYPE, ID_VERSION_TYPE);
assertEquals(idType, element.getParticipantType());
- var clElementStatistics = new ClElementStatistics();
- var controlLoopId = new ToscaConceptIdentifier("defName", "0.0.1");
- clElementStatistics.setParticipantId(controlLoopId);
- clElementStatistics.setControlLoopState(ControlLoopState.RUNNING);
- clElementStatistics.setTimeStamp(Instant.now());
-
- apiImpl.updateControlLoopElementStatistics(uuid, clElementStatistics);
- var clElement = apiImpl.updateControlLoopElementState(id, uuid, ControlLoopOrderedState.UNINITIALISED,
- ControlLoopState.PASSIVE, ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
- assertEquals(ControlLoopOrderedState.UNINITIALISED, clElement.getOrderedState());
- assertEquals(uuid, clElement.getId());
+ var acElementStatistics = new AcElementStatistics();
+ var automationCompositionId = new ToscaConceptIdentifier("defName", "0.0.1");
+ acElementStatistics.setParticipantId(automationCompositionId);
+ acElementStatistics.setState(AutomationCompositionState.RUNNING);
+ acElementStatistics.setTimeStamp(Instant.now());
+
+ apiImpl.updateAutomationCompositionElementStatistics(uuid, acElementStatistics);
+ var acElement =
+ apiImpl.updateAutomationCompositionElementState(id, uuid, AutomationCompositionOrderedState.UNINITIALISED,
+ AutomationCompositionState.PASSIVE, ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ assertEquals(AutomationCompositionOrderedState.UNINITIALISED, acElement.getOrderedState());
+ assertEquals(uuid, acElement.getId());
}
}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantCommTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
index a40a41853..26dddc9ba 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantCommTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.comm;
+package org.onap.policy.clamp.acm.participant.intermediary.comm;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -28,13 +28,13 @@ import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.utils.coder.CoderException;
@@ -44,31 +44,28 @@ class ParticipantCommTest {
@Test
void participantReqTest() throws CoderException {
- var participantHandler = commonTestData.getParticipantHandlerControlLoops();
+ var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
var participantRegisterAckListener = new ParticipantRegisterAckListener(participantHandler);
- assertEquals(ParticipantMessageType.PARTICIPANT_REGISTER_ACK.name(),
- participantRegisterAckListener.getType());
+ assertEquals(ParticipantMessageType.PARTICIPANT_REGISTER_ACK.name(), participantRegisterAckListener.getType());
var participantStatusReqListener = new ParticipantStatusReqListener(participantHandler);
- assertEquals(ParticipantMessageType.PARTICIPANT_STATUS_REQ.name(),
- participantStatusReqListener.getType());
+ assertEquals(ParticipantMessageType.PARTICIPANT_STATUS_REQ.name(), participantStatusReqListener.getType());
var participantDeregisterAckListener = new ParticipantDeregisterAckListener(participantHandler);
assertEquals(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK.name(),
- participantDeregisterAckListener.getType());
+ participantDeregisterAckListener.getType());
var participantUpdateListener = new ParticipantUpdateListener(participantHandler);
- assertEquals(ParticipantMessageType.PARTICIPANT_UPDATE.name(),
- participantUpdateListener.getType());
+ assertEquals(ParticipantMessageType.PARTICIPANT_UPDATE.name(), participantUpdateListener.getType());
- var controlLoopUpdateListener = new ControlLoopUpdateListener(participantHandler);
- assertEquals(ParticipantMessageType.CONTROL_LOOP_UPDATE.name(),
- controlLoopUpdateListener.getType());
+ var automationCompositionUpdateListener = new AutomationCompositionUpdateListener(participantHandler);
+ assertEquals(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE.name(),
+ automationCompositionUpdateListener.getType());
- var controlLoopStateChangeListener = new ControlLoopStateChangeListener(participantHandler);
- assertEquals(ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE.name(),
- controlLoopStateChangeListener.getType());
+ var automationCompositionStateChangeListener = new AutomationCompositionStateChangeListener(participantHandler);
+ assertEquals(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE.name(),
+ automationCompositionStateChangeListener.getType());
}
@Test
@@ -76,26 +73,26 @@ class ParticipantCommTest {
var participantMessagePublisher = new ParticipantMessagePublisher();
var participantStatus = Mockito.mock(ParticipantStatus.class);
- assertThrows(ControlLoopRuntimeException.class, () -> {
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
participantMessagePublisher.sendParticipantStatus(participantStatus);
});
- assertThrows(ControlLoopRuntimeException.class, () -> {
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
participantMessagePublisher.sendHeartbeat(participantStatus);
});
var participantRegister = Mockito.mock(ParticipantRegister.class);
- assertThrows(ControlLoopRuntimeException.class, () -> {
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
participantMessagePublisher.sendParticipantRegister(participantRegister);
});
var participantDeregister = Mockito.mock(ParticipantDeregister.class);
- assertThrows(ControlLoopRuntimeException.class, () -> {
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
participantMessagePublisher.sendParticipantDeregister(participantDeregister);
});
- var controlLoopAck = Mockito.mock(ControlLoopAck.class);
- assertThrows(ControlLoopRuntimeException.class, () -> {
- participantMessagePublisher.sendControlLoopAck(controlLoopAck);
+ var automationCompositionAck = Mockito.mock(AutomationCompositionAck.class);
+ assertThrows(AutomationCompositionRuntimeException.class, () -> {
+ participantMessagePublisher.sendAutomationCompositionAck(automationCompositionAck);
});
List<TopicSink> emptyList = Collections.emptyList();
@@ -108,7 +105,7 @@ class ParticipantCommTest {
@Test
void messageSenderTest() throws CoderException {
- var participantHandler = commonTestData.getParticipantHandlerControlLoops();
+ var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
var participantParameters = CommonTestData.getParticipantParameters();
var messageSender = new MessageSender(participantHandler, participantParameters);
messageSender.run();
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
new file mode 100644
index 000000000..5585e5190
--- /dev/null
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
@@ -0,0 +1,227 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.mockito.Mockito.mock;
+
+import java.time.Instant;
+import java.util.List;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+@ExtendWith(SpringExtension.class)
+class AutomationCompositionHandlerTest {
+
+ private CommonTestData commonTestData = new CommonTestData();
+
+ @Test
+ void automationCompositionHandlerTest() {
+ var ach = commonTestData.getMockAutomationCompositionHandler();
+ assertNotNull(ach.getAutomationCompositions());
+
+ assertNotNull(ach.getAutomationCompositionMap());
+ assertNotNull(ach.getElementsOnThisParticipant());
+
+ var elementId1 = UUID.randomUUID();
+ var element = new AutomationCompositionElement();
+ element.setId(elementId1);
+ element.setDefinition(
+ new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "1.0.1"));
+
+ element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+
+ AutomationCompositionElementListener listener = mock(AutomationCompositionElementListener.class);
+ ach.registerAutomationCompositionElementListener(listener);
+ assertThat(ach.getListeners()).contains(listener);
+ }
+
+ @Test
+ void updateNullAutomationCompositionHandlerTest() {
+ var id = UUID.randomUUID();
+
+ var ach = commonTestData.getMockAutomationCompositionHandler();
+ assertNull(ach.updateAutomationCompositionElementState(null, null,
+ AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE));
+
+ assertNull(ach.updateAutomationCompositionElementState(null, id,
+ AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE));
+
+ var acElementStatistics = new AcElementStatistics();
+ var automationCompositionId = new ToscaConceptIdentifier("defName", "0.0.1");
+ acElementStatistics.setParticipantId(automationCompositionId);
+ acElementStatistics.setState(AutomationCompositionState.RUNNING);
+ acElementStatistics.setTimeStamp(Instant.now());
+
+ ach.updateAutomationCompositionElementStatistics(id, acElementStatistics);
+ assertNull(ach.updateAutomationCompositionElementState(automationCompositionId, id,
+ AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE));
+ }
+
+ @Test
+ void updateAutomationCompositionHandlerTest() throws CoderException {
+ var uuid = UUID.randomUUID();
+ var id = CommonTestData.getParticipantId();
+
+ var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
+ var key = ach.getElementsOnThisParticipant().keySet().iterator().next();
+ var value = ach.getElementsOnThisParticipant().get(key);
+ assertEquals(AutomationCompositionState.UNINITIALISED, value.getState());
+ ach.updateAutomationCompositionElementState(id, uuid, AutomationCompositionOrderedState.UNINITIALISED,
+ AutomationCompositionState.PASSIVE);
+ assertEquals(AutomationCompositionState.PASSIVE, value.getState());
+
+ ach.getAutomationCompositionMap().values().iterator().next().getElements().putIfAbsent(key, value);
+ ach.updateAutomationCompositionElementState(id, key, AutomationCompositionOrderedState.PASSIVE,
+ AutomationCompositionState.RUNNING);
+ assertEquals(AutomationCompositionState.RUNNING, value.getState());
+
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setParticipantId(id);
+ acElementStatistics.setState(AutomationCompositionState.RUNNING);
+ acElementStatistics.setTimeStamp(Instant.now());
+
+ assertNotEquals(uuid, value.getAcElementStatistics().getId());
+ ach.updateAutomationCompositionElementStatistics(uuid, acElementStatistics);
+ assertEquals(uuid, value.getAcElementStatistics().getId());
+
+ ach.getElementsOnThisParticipant().remove(key, value);
+ ach.getAutomationCompositionMap().values().iterator().next().getElements().clear();
+ assertNull(ach.updateAutomationCompositionElementState(id, key, AutomationCompositionOrderedState.PASSIVE,
+ AutomationCompositionState.RUNNING));
+
+ }
+
+ @Test
+ void handleAutomationCompositionUpdateExceptionTest() throws CoderException {
+ var uuid = UUID.randomUUID();
+ var id = CommonTestData.getParticipantId();
+ var stateChange = getStateChange(id, uuid, AutomationCompositionOrderedState.RUNNING);
+ var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
+ assertDoesNotThrow(
+ () -> ach.handleAutomationCompositionStateChange(mock(AutomationCompositionStateChange.class), List.of()));
+
+ ach.handleAutomationCompositionStateChange(stateChange, List.of());
+ var newid = new ToscaConceptIdentifier("id", "1.2.3");
+ stateChange.setAutomationCompositionId(newid);
+ stateChange.setParticipantId(newid);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChange, List.of()));
+
+ var acd = new AutomationCompositionElementDefinition();
+ acd.setAcElementDefinitionId(id);
+ var updateMsg = new AutomationCompositionUpdate();
+ updateMsg.setAutomationCompositionId(id);
+ updateMsg.setMessageId(uuid);
+ updateMsg.setParticipantId(id);
+ updateMsg.setStartPhase(0);
+ var acElementDefinitions = List.of(acd);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+ updateMsg.setStartPhase(1);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+ assertThat(ach.getAcElementInstanceProperties(uuid)).isEmpty();
+
+ ach.getAutomationCompositionMap().clear();
+ updateMsg.setStartPhase(0);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+
+ updateMsg.setAutomationCompositionId(new ToscaConceptIdentifier("new", "0.0.1"));
+ updateMsg.setParticipantUpdatesList(List.of(mock(ParticipantUpdates.class)));
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+
+ updateMsg.setStartPhase(1);
+ var participantUpdate = new ParticipantUpdates();
+ participantUpdate.setParticipantId(id);
+ var element = new AutomationCompositionElement();
+ element.setParticipantType(id);
+ element.setDefinition(id);
+ participantUpdate.setAutomationCompositionElementList(List.of(element));
+ updateMsg.setParticipantUpdatesList(List.of(participantUpdate));
+
+ var acd2 = new AutomationCompositionElementDefinition();
+ acd2.setAcElementDefinitionId(id);
+ acd2.setAutomationCompositionElementToscaNodeTemplate(mock(ToscaNodeTemplate.class));
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, List.of(acd2)));
+
+ }
+
+ @Test
+ void automationCompositionStateChangeUninitialisedTest() throws CoderException {
+ var uuid = UUID.randomUUID();
+ var id = CommonTestData.getParticipantId();
+
+ var stateChangeUninitialised = getStateChange(id, uuid, AutomationCompositionOrderedState.UNINITIALISED);
+
+ var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
+ ach.handleAutomationCompositionStateChange(stateChangeUninitialised, List.of());
+ var newid = new ToscaConceptIdentifier("id", "1.2.3");
+ stateChangeUninitialised.setAutomationCompositionId(newid);
+ stateChangeUninitialised.setParticipantId(newid);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChangeUninitialised, List.of()));
+ }
+
+ @Test
+ void automationCompositionStateChangePassiveTest() throws CoderException {
+ var uuid = UUID.randomUUID();
+ var id = CommonTestData.getParticipantId();
+
+ var stateChangePassive = getStateChange(id, uuid, AutomationCompositionOrderedState.PASSIVE);
+
+ var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
+ ach.handleAutomationCompositionStateChange(stateChangePassive, List.of());
+ var newid = new ToscaConceptIdentifier("id", "1.2.3");
+ stateChangePassive.setAutomationCompositionId(newid);
+ stateChangePassive.setParticipantId(newid);
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChangePassive, List.of()));
+ }
+
+ private AutomationCompositionStateChange getStateChange(ToscaConceptIdentifier id, UUID uuid,
+ AutomationCompositionOrderedState state) {
+ var stateChange = new AutomationCompositionStateChange();
+ stateChange.setAutomationCompositionId(id);
+ stateChange.setParticipantId(id);
+ stateChange.setMessageId(uuid);
+ stateChange.setOrderedState(state);
+ stateChange.setCurrentState(AutomationCompositionState.UNINITIALISED);
+ stateChange.setTimestamp(Instant.ofEpochMilli(3000));
+ return stateChange;
+ }
+
+}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/DummyParticipantParameters.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/DummyParticipantParameters.java
index d60bb71bc..b82fbed6a 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/DummyParticipantParameters.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/DummyParticipantParameters.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
@Getter
@Setter
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java
index 8c400c12f..9ecf59ba4 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
@@ -34,10 +34,10 @@ import static org.mockito.Mockito.when;
import java.util.List;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatusReq;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStatusReqListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantStatusReqListener;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.coder.StandardCoderObject;
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
index d00697521..8e22784db 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.participant.intermediary.handler;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -32,16 +32,16 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantAckMessage;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
-import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -60,17 +60,17 @@ class ParticipantHandlerTest {
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
assertEquals(id, participantHandler.getParticipantId());
assertEquals(id, participantHandler.getParticipantType());
- assertThat(participantHandler.getClElementDefinitionCommonProperties(id)).isEmpty();
+ assertThat(participantHandler.getAcElementDefinitionCommonProperties(id)).isEmpty();
}
@Test
void handleUpdateTest() {
var parameters = CommonTestData.getParticipantParameters();
- var controlLoopHander = commonTestData.getMockControlLoopHandler();
+ var automationCompositionHander = commonTestData.getMockAutomationCompositionHandler();
var publisher = new ParticipantMessagePublisher();
var emptyParticipantHandler =
- new ParticipantHandler(parameters, publisher, controlLoopHander);
+ new ParticipantHandler(parameters, publisher, automationCompositionHander);
var participantUpdateMsg = new ParticipantUpdate();
assertThatThrownBy(() ->
@@ -80,7 +80,7 @@ class ParticipantHandlerTest {
var participantHandler = commonTestData.getMockParticipantHandler();
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
- participantUpdateMsg.setControlLoopId(id);
+ participantUpdateMsg.setAutomationCompositionId(id);
participantUpdateMsg.setParticipantId(id);
participantUpdateMsg.setParticipantType(id);
participantUpdateMsg.setMessageId(UUID.randomUUID());
@@ -89,10 +89,10 @@ class ParticipantHandlerTest {
var heartbeatF = participantHandler.makeHeartbeat(false);
assertEquals(id, heartbeatF.getParticipantId());
assertEquals(ParticipantState.UNKNOWN, heartbeatF.getParticipantStatistics().getState());
- assertThat(heartbeatF.getControlLoopInfoList()).isEmpty();
+ assertThat(heartbeatF.getAutomationCompositionInfoList()).isEmpty();
participantHandler.handleParticipantUpdate(participantUpdateMsg);
- assertThat(participantHandler.getClElementDefinitionCommonProperties(id)).isEmpty();
+ assertThat(participantHandler.getAcElementDefinitionCommonProperties(id)).isEmpty();
var heartbeatT = participantHandler.makeHeartbeat(true);
assertEquals(id, heartbeatT.getParticipantId());
@@ -148,7 +148,7 @@ class ParticipantHandlerTest {
void checkAppliesTo() {
var participantHandler = commonTestData.getMockParticipantHandler();
var participantAckMsg =
- new ParticipantAckMessage(ParticipantMessageType.CONTROL_LOOP_UPDATE);
+ new ParticipantAckMessage(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
assertTrue(participantHandler.appliesTo(participantAckMsg));
var participantMsg =
@@ -162,14 +162,14 @@ class ParticipantHandlerTest {
}
@Test
- void getControlLoopInfoListTest() throws CoderException {
- var participantHandler = commonTestData.getParticipantHandlerControlLoops();
+ void getAutomationCompositionInfoListTest() throws CoderException {
+ var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
participantHandler.sendHeartbeat();
assertEquals(id, participantHandler.makeHeartbeat(false)
- .getControlLoopInfoList()
+ .getAutomationCompositionInfoList()
.get(0)
- .getControlLoopId());
+ .getAutomationCompositionId());
}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/CommonTestData.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
index 9bbf8964c..ad54d402c 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/CommonTestData.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters;
+package org.onap.policy.clamp.acm.participant.intermediary.main.parameters;
import java.io.File;
import java.time.Instant;
@@ -30,18 +30,18 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ControlLoopHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.DummyParticipantParameters;
-import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.AutomationCompositionHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.DummyParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.utils.coder.Coder;
@@ -53,7 +53,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
* Class to hold/create all parameters for test cases.
*/
public class CommonTestData {
- public static final String PARTICIPANT_GROUP_NAME = "ControlLoopParticipantGroup";
+ public static final String PARTICIPANT_GROUP_NAME = "AutomationCompositionParticipantGroup";
public static final String DESCRIPTION = "Participant description";
public static final long TIME_INTERVAL = 2000;
public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams());
@@ -68,7 +68,7 @@ public class CommonTestData {
public ParticipantIntermediaryParameters getParticipantIntermediaryParameters() {
try {
return CODER.convert(getIntermediaryParametersMap(PARTICIPANT_GROUP_NAME),
- ParticipantIntermediaryParameters.class);
+ ParticipantIntermediaryParameters.class);
} catch (final CoderException e) {
throw new RuntimeException("cannot create ParticipantSimulatorParameters from map", e);
}
@@ -81,8 +81,7 @@ public class CommonTestData {
*/
public static DummyParticipantParameters getParticipantParameters() {
try {
- return CODER.convert(getParametersMap(PARTICIPANT_GROUP_NAME),
- DummyParticipantParameters.class);
+ return CODER.convert(getParametersMap(PARTICIPANT_GROUP_NAME), DummyParticipantParameters.class);
} catch (final CoderException e) {
throw new RuntimeException("cannot create ParticipantSimulatorParameters from map", e);
}
@@ -113,7 +112,7 @@ public class CommonTestData {
map.put("description", DESCRIPTION);
map.put("participantType", getParticipantId());
map.put("reportingTimeIntervalMs", TIME_INTERVAL);
- map.put("clampControlLoopTopics", getTopicParametersMap(false));
+ map.put("clampAutomationCompositionTopics", getTopicParametersMap(false));
return map;
}
@@ -140,7 +139,7 @@ public class CommonTestData {
*/
public static TopicParameters getTopicParams() {
final var topicParams = new TopicParameters();
- topicParams.setTopic("POLICY-CLRUNTIME-PARTICIPANT");
+ topicParams.setTopic("POLICY-ACRUNTIME-PARTICIPANT");
topicParams.setTopicCommInfrastructure("dmaap");
topicParams.setServers(Arrays.asList("localhost"));
return topicParams;
@@ -169,14 +168,12 @@ public class CommonTestData {
}
/**
- * Returns a mocked ControlLoopHandler for test cases.
+ * Returns a mocked AutomationCompositionHandler for test cases.
*
- * @return ControlLoopHandler
+ * @return AutomationCompositionHandler
*/
- public ControlLoopHandler getMockControlLoopHandler() {
- return new ControlLoopHandler(
- getParticipantParameters(),
- getParticipantMessagePublisher());
+ public AutomationCompositionHandler getMockAutomationCompositionHandler() {
+ return new AutomationCompositionHandler(getParticipantParameters(), getParticipantMessagePublisher());
}
/**
@@ -186,10 +183,10 @@ public class CommonTestData {
*/
public ParticipantHandler getMockParticipantHandler() {
var parameters = getParticipantParameters();
- var controlLoopHandler = getMockControlLoopHandler();
+ var automationCompositionHandler = getMockAutomationCompositionHandler();
var publisher = new ParticipantMessagePublisher();
publisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
- var participantHandler = new ParticipantHandler(parameters, publisher, controlLoopHandler);
+ var participantHandler = new ParticipantHandler(parameters, publisher, automationCompositionHandler);
return participantHandler;
}
@@ -200,14 +197,16 @@ public class CommonTestData {
*
* @throws CoderException if there is an error with .json file.
*/
- public ParticipantHandler getParticipantHandlerControlLoops() throws CoderException {
- var controlLoopHandler = Mockito.mock(ControlLoopHandler.class);
- Mockito.doReturn(getTestControlLoops()).when(controlLoopHandler).getControlLoops();
- Mockito.doReturn(getTestControlLoopMap()).when(controlLoopHandler).getControlLoopMap();
+ public ParticipantHandler getParticipantHandlerAutomationCompositions() throws CoderException {
+ var automationCompositionHandler = Mockito.mock(AutomationCompositionHandler.class);
+ Mockito.doReturn(getTestAutomationCompositions()).when(automationCompositionHandler)
+ .getAutomationCompositions();
+ Mockito.doReturn(getTestAutomationCompositionMap()).when(automationCompositionHandler)
+ .getAutomationCompositionMap();
var publisher = new ParticipantMessagePublisher();
publisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
var parameters = getParticipantParameters();
- var participantHandler = new ParticipantHandler(parameters, publisher, controlLoopHandler);
+ var participantHandler = new ParticipantHandler(parameters, publisher, automationCompositionHandler);
participantHandler.sendParticipantRegister();
participantHandler.handleParticipantStatusReq(null);
participantHandler.sendParticipantDeregister();
@@ -218,31 +217,31 @@ public class CommonTestData {
}
/**
- * Returns a Map of ToscaConceptIdentifier and ControlLoop for test cases.
+ * Returns a Map of ToscaConceptIdentifier and AutomationComposition for test cases.
*
- * @return controlLoopMap
+ * @return automationCompositionMap
*
* @throws CoderException if there is an error with .json file.
*/
- public Map<ToscaConceptIdentifier, ControlLoop> getTestControlLoopMap() throws CoderException {
- var controlLoops = getTestControlLoops();
- var controlLoop = controlLoops.getControlLoopList().get(1);
+ public Map<ToscaConceptIdentifier, AutomationComposition> getTestAutomationCompositionMap() throws CoderException {
+ var automationCompositions = getTestAutomationCompositions();
+ var automationComposition = automationCompositions.getAutomationCompositionList().get(1);
var id = getParticipantId();
- Map<ToscaConceptIdentifier, ControlLoop> controlLoopMap = new LinkedHashMap<>();
- controlLoopMap.put(id, controlLoop);
- return controlLoopMap;
+ Map<ToscaConceptIdentifier, AutomationComposition> automationCompositionMap = new LinkedHashMap<>();
+ automationCompositionMap.put(id, automationComposition);
+ return automationCompositionMap;
}
/**
- * Returns List of ControlLoop for test cases.
+ * Returns List of AutomationComposition for test cases.
*
- * @return ControlLoops
+ * @return AutomationCompositions
*
* @throws CoderException if there is an error with .json file.
*/
- public ControlLoops getTestControlLoops() throws CoderException {
- return new StandardCoder()
- .decode(new File("src/test/resources/providers/TestControlLoops.json"), ControlLoops.class);
+ public AutomationCompositions getTestAutomationCompositions() throws CoderException {
+ return new StandardCoder().decode(new File("src/test/resources/providers/TestAutomationCompositions.json"),
+ AutomationCompositions.class);
}
/**
@@ -251,43 +250,45 @@ public class CommonTestData {
* @param uuid UUID and id ToscaConceptIdentifier
* @return a map suitable for elementsOnThisParticipant
*/
- public Map<UUID, ControlLoopElement> setControlLoopElementTest(UUID uuid, ToscaConceptIdentifier id) {
- var clElement = new ControlLoopElement();
- clElement.setId(uuid);
- clElement.setParticipantId(id);
- clElement.setDefinition(id);
- clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
+ public Map<UUID, AutomationCompositionElement> setAutomationCompositionElementTest(UUID uuid,
+ ToscaConceptIdentifier id) {
+ var acElement = new AutomationCompositionElement();
+ acElement.setId(uuid);
+ acElement.setParticipantId(id);
+ acElement.setDefinition(id);
+ acElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setParticipantId(id);
- clElementStatistics.setControlLoopState(ControlLoopState.UNINITIALISED);
- clElementStatistics.setTimeStamp(Instant.now());
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setParticipantId(id);
+ acElementStatistics.setState(AutomationCompositionState.UNINITIALISED);
+ acElementStatistics.setTimeStamp(Instant.now());
- clElement.setClElementStatistics(clElementStatistics);
+ acElement.setAcElementStatistics(acElementStatistics);
- Map<UUID, ControlLoopElement> elementsOnThisParticipant = new LinkedHashMap<>();
- elementsOnThisParticipant.put(uuid, clElement);
+ Map<UUID, AutomationCompositionElement> elementsOnThisParticipant = new LinkedHashMap<>();
+ elementsOnThisParticipant.put(uuid, acElement);
return elementsOnThisParticipant;
}
/**
- * Returns a ControlLoopHandler with elements on the id,uuid.
+ * Returns a AutomationCompositionHandler with elements on the id,uuid.
*
* @param id ToscaConceptIdentifier and uuid UUID
- * @return a ControlLoopHander with elements
+ * @return a AutomationCompositionHander with elements
*/
- public ControlLoopHandler setTestControlLoopHandler(ToscaConceptIdentifier id, UUID uuid) throws CoderException {
- var clh = getMockControlLoopHandler();
+ public AutomationCompositionHandler setTestAutomationCompositionHandler(ToscaConceptIdentifier id, UUID uuid)
+ throws CoderException {
+ var ach = getMockAutomationCompositionHandler();
- var key = getTestControlLoopMap().keySet().iterator().next();
- var value = getTestControlLoopMap().get(key);
- clh.getControlLoopMap().put(key, value);
+ var key = getTestAutomationCompositionMap().keySet().iterator().next();
+ var value = getTestAutomationCompositionMap().get(key);
+ ach.getAutomationCompositionMap().put(key, value);
- var keyElem = setControlLoopElementTest(uuid, id).keySet().iterator().next();
- var valueElem = setControlLoopElementTest(uuid, id).get(keyElem);
- clh.getElementsOnThisParticipant().put(keyElem, valueElem);
+ var keyElem = setAutomationCompositionElementTest(uuid, id).keySet().iterator().next();
+ var valueElem = setAutomationCompositionElementTest(uuid, id).get(keyElem);
+ ach.getElementsOnThisParticipant().put(keyElem, valueElem);
- return clh;
+ return ach;
}
}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java
index d554a55b6..cc2b110f3 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/TestParticipantIntermediaryParameters.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters;
+package org.onap.policy.clamp.acm.participant.intermediary.main.parameters;
import static org.assertj.core.api.Assertions.assertThat;
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
/**
* Class to perform unit test of {@link ParticipantParameterGroup}.
@@ -45,7 +45,7 @@ class TestParticipantIntermediaryParameters {
void testParticipantIntermediaryParameterGroup_EmptyParameter() {
final ParticipantIntermediaryParameters participantParameters =
commonTestData.getParticipantIntermediaryParameters();
- participantParameters.setClampControlLoopTopics(null);
+ participantParameters.setClampAutomationCompositionTopics(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
@@ -53,7 +53,7 @@ class TestParticipantIntermediaryParameters {
void testParticipantIntermediaryParameters_NullTopicSinks() {
final ParticipantIntermediaryParameters participantParameters =
commonTestData.getParticipantIntermediaryParameters();
- participantParameters.getClampControlLoopTopics().setTopicSinks(null);
+ participantParameters.getClampAutomationCompositionTopics().setTopicSinks(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
@@ -61,7 +61,7 @@ class TestParticipantIntermediaryParameters {
void testParticipantIntermediaryParameters_NullTopicSources() {
final ParticipantIntermediaryParameters participantParameters =
commonTestData.getParticipantIntermediaryParameters();
- participantParameters.getClampControlLoopTopics().setTopicSources(null);
+ participantParameters.getClampAutomationCompositionTopics().setTopicSources(null);
assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
}
}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java
deleted file mode 100644
index 43b43e3bf..000000000
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.mockito.Mockito.mock;
-
-import java.time.Instant;
-import java.util.List;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-@ExtendWith(SpringExtension.class)
-class ControlLoopHandlerTest {
-
- private CommonTestData commonTestData = new CommonTestData();
-
- @Test
- void controlLoopHandlerTest() {
- var clh = commonTestData.getMockControlLoopHandler();
- assertNotNull(clh.getControlLoops());
-
- assertNotNull(clh.getControlLoopMap());
- assertNotNull(clh.getElementsOnThisParticipant());
-
- var elementId1 = UUID.randomUUID();
- var element = new ControlLoopElement();
- element.setId(elementId1);
- element.setDefinition(new ToscaConceptIdentifier(
- "org.onap.policy.controlloop.PolicyControlLoopParticipant", "1.0.1"));
-
- element.setOrderedState(ControlLoopOrderedState.PASSIVE);
-
- ControlLoopElementListener listener = mock(ControlLoopElementListener.class);
- clh.registerControlLoopElementListener(listener);
- assertThat(clh.getListeners()).contains(listener);
- }
-
- @Test
- void updateNullControlLoopHandlerTest() {
- var id = UUID.randomUUID();
-
- var clh = commonTestData.getMockControlLoopHandler();
- assertNull(clh.updateControlLoopElementState(null, null, ControlLoopOrderedState.UNINITIALISED,
- ControlLoopState.PASSIVE));
-
- assertNull(clh.updateControlLoopElementState(null, id, ControlLoopOrderedState.UNINITIALISED,
- ControlLoopState.PASSIVE));
-
- var clElementStatistics = new ClElementStatistics();
- var controlLoopId = new ToscaConceptIdentifier("defName", "0.0.1");
- clElementStatistics.setParticipantId(controlLoopId);
- clElementStatistics.setControlLoopState(ControlLoopState.RUNNING);
- clElementStatistics.setTimeStamp(Instant.now());
-
- clh.updateControlLoopElementStatistics(id, clElementStatistics);
- assertNull(clh.updateControlLoopElementState(controlLoopId, id, ControlLoopOrderedState.UNINITIALISED,
- ControlLoopState.PASSIVE));
- }
-
- @Test
- void updateControlLoopHandlerTest() throws CoderException {
- var uuid = UUID.randomUUID();
- var id = CommonTestData.getParticipantId();
-
- var clh = commonTestData.setTestControlLoopHandler(id, uuid);
- var key = clh.getElementsOnThisParticipant().keySet().iterator().next();
- var value = clh.getElementsOnThisParticipant().get(key);
- assertEquals(ControlLoopState.UNINITIALISED, value.getState());
- clh.updateControlLoopElementState(id, uuid, ControlLoopOrderedState.UNINITIALISED,
- ControlLoopState.PASSIVE);
- assertEquals(ControlLoopState.PASSIVE, value.getState());
-
- clh.getControlLoopMap().values().iterator().next().getElements().putIfAbsent(key, value);
- clh.updateControlLoopElementState(id, key, ControlLoopOrderedState.PASSIVE,
- ControlLoopState.RUNNING);
- assertEquals(ControlLoopState.RUNNING, value.getState());
-
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setParticipantId(id);
- clElementStatistics.setControlLoopState(ControlLoopState.RUNNING);
- clElementStatistics.setTimeStamp(Instant.now());
-
- assertNotEquals(uuid, value.getClElementStatistics().getId());
- clh.updateControlLoopElementStatistics(uuid, clElementStatistics);
- assertEquals(uuid, value.getClElementStatistics().getId());
-
- clh.getElementsOnThisParticipant().remove(key, value);
- clh.getControlLoopMap().values().iterator().next().getElements().clear();
- assertNull(clh.updateControlLoopElementState(id, key, ControlLoopOrderedState.PASSIVE,
- ControlLoopState.RUNNING));
-
- }
-
- @Test
- void handleControlLoopUpdateExceptionTest() throws CoderException {
- var uuid = UUID.randomUUID();
- var id = CommonTestData.getParticipantId();
- var stateChange = getStateChange(id, uuid, ControlLoopOrderedState.RUNNING);
- var clh = commonTestData.setTestControlLoopHandler(id, uuid);
- assertDoesNotThrow(() -> clh.handleControlLoopStateChange(mock(ControlLoopStateChange.class), List.of()));
-
- clh.handleControlLoopStateChange(stateChange, List.of());
- var newid = new ToscaConceptIdentifier("id", "1.2.3");
- stateChange.setControlLoopId(newid);
- stateChange.setParticipantId(newid);
- assertDoesNotThrow(() -> clh.handleControlLoopStateChange(stateChange, List.of()));
-
- var cld = new ControlLoopElementDefinition();
- cld.setClElementDefinitionId(id);
- var updateMsg = new ControlLoopUpdate();
- updateMsg.setControlLoopId(id);
- updateMsg.setMessageId(uuid);
- updateMsg.setParticipantId(id);
- updateMsg.setStartPhase(0);
- var clElementDefinitions = List.of(cld);
- assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
- updateMsg.setStartPhase(1);
- assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
- assertThat(clh.getClElementInstanceProperties(uuid)).isEmpty();
-
- clh.getControlLoopMap().clear();
- updateMsg.setStartPhase(0);
- assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
-
- updateMsg.setControlLoopId(new ToscaConceptIdentifier("new", "0.0.1"));
- updateMsg.setParticipantUpdatesList(List.of(mock(ParticipantUpdates.class)));
- assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
-
- updateMsg.setStartPhase(1);
- var participantUpdate = new ParticipantUpdates();
- participantUpdate.setParticipantId(id);
- var element = new ControlLoopElement();
- element.setParticipantType(id);
- element.setDefinition(id);
- participantUpdate.setControlLoopElementList(List.of(element));
- updateMsg.setParticipantUpdatesList(List.of(participantUpdate));
-
- var cld2 = new ControlLoopElementDefinition();
- cld2.setClElementDefinitionId(id);
- cld2.setControlLoopElementToscaNodeTemplate(mock(ToscaNodeTemplate.class));
- assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, List.of(cld2)));
-
- }
-
- @Test
- void controlLoopStateChangeUninitialisedTest() throws CoderException {
- var uuid = UUID.randomUUID();
- var id = CommonTestData.getParticipantId();
-
- var stateChangeUninitialised = getStateChange(id, uuid, ControlLoopOrderedState.UNINITIALISED);
-
- var clh = commonTestData.setTestControlLoopHandler(id, uuid);
- clh.handleControlLoopStateChange(stateChangeUninitialised, List.of());
- var newid = new ToscaConceptIdentifier("id", "1.2.3");
- stateChangeUninitialised.setControlLoopId(newid);
- stateChangeUninitialised.setParticipantId(newid);
- assertDoesNotThrow(() -> clh.handleControlLoopStateChange(stateChangeUninitialised, List.of()));
- }
-
- @Test
- void controlLoopStateChangePassiveTest() throws CoderException {
- var uuid = UUID.randomUUID();
- var id = CommonTestData.getParticipantId();
-
- var stateChangePassive = getStateChange(id, uuid, ControlLoopOrderedState.PASSIVE);
-
- var clh = commonTestData.setTestControlLoopHandler(id, uuid);
- clh.handleControlLoopStateChange(stateChangePassive, List.of());
- var newid = new ToscaConceptIdentifier("id", "1.2.3");
- stateChangePassive.setControlLoopId(newid);
- stateChangePassive.setParticipantId(newid);
- assertDoesNotThrow(() -> clh.handleControlLoopStateChange(stateChangePassive, List.of()));
- }
-
-
- private ControlLoopStateChange getStateChange(ToscaConceptIdentifier id, UUID uuid, ControlLoopOrderedState state) {
- var stateChange = new ControlLoopStateChange();
- stateChange.setControlLoopId(id);
- stateChange.setParticipantId(id);
- stateChange.setMessageId(uuid);
- stateChange.setOrderedState(state);
- stateChange.setCurrentState(ControlLoopState.UNINITIALISED);
- stateChange.setTimestamp(Instant.ofEpochMilli(3000));
- return stateChange;
- }
-
-}
diff --git a/models/src/test/resources/providers/TestControlLoops.json b/participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json
index fedda9600..4e0f08981 100644
--- a/models/src/test/resources/providers/TestControlLoops.json
+++ b/participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json
@@ -1,8 +1,8 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"state": "UNINITIALISED",
@@ -15,63 +15,63 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
},
"name": "PMSHInstance0",
"version": "1.0.1",
- "description": "PMSH control loop instance 0"
+ "description": "PMSH automation composition instance 0"
},
{
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"state": "UNINITIALISED",
@@ -84,59 +84,59 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 1 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 1 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition"
}
},
"name": "PMSHInstance1",
"version": "1.0.1",
- "description": "PMSH control loop instance 1"
+ "description": "PMSH automation composition instance 1"
}
]
}
diff --git a/pom.xml b/pom.xml
index 713cf5ecf..d6df94623 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,8 @@
- policy-clamp-common: Common code for all Policy/CLAMP modules
- policy-clamp-models: POJOs and other model code for REST and DMaaP messages and for persistence
- policy-clamp-runtime: The runtime server for CLAMP
- - policy-clamp-participant: Modules for CLAMP control loop participants
+ - policy-clamp-runtime-acm: The runtime server for Automation Composition Management
+ - policy-clamp-participant: Modules for CLAMP automation composition participants
o policy-clamp-participant-intermediary: A common JAR that handles participant state and DMaaP handling
o policy-clamp-participant-impl-cds: A standard participant for interworking with CDS
o policy-clamp-participant-impl-kubernetes: A standard participant for Kubernetes microservices
@@ -60,7 +61,7 @@
<module>models</module>
<module>packages</module>
<module>runtime</module>
- <module>runtime-controlloop</module>
+ <module>runtime-acm</module>
<module>participant</module>
</modules>
diff --git a/runtime-controlloop/pom.xml b/runtime-acm/pom.xml
index be5597fa1..7712d8235 100644
--- a/runtime-controlloop/pom.xml
+++ b/runtime-acm/pom.xml
@@ -30,7 +30,7 @@
<version>6.2.1-SNAPSHOT</version>
</parent>
- <artifactId>policy-clamp-runtime-controlloop</artifactId>
+ <artifactId>policy-clamp-runtime-acm</artifactId>
<name>${project.artifactId}</name>
<dependencies>
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/Application.java
index 44a661e55..d9298b15e 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/Application.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/Application.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime;
+package org.onap.policy.clamp.acm.runtime;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -28,15 +28,23 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
+// @formatter:off
@EnableScheduling
@SpringBootApplication
-@EnableJpaRepositories({"org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository"})
-@ComponentScan({"org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider",
- "org.onap.policy.clamp.controlloop.runtime",
- "org.onap.policy.clamp.controlloop.common.rest"})
-@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.runtime.main.parameters")
-@EntityScan({"org.onap.policy.models.tosca.simple.concepts",
- "org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts"})
+@EnableJpaRepositories({
+ "org.onap.policy.clamp.models.acm.persistence.repository"
+})
+@ComponentScan({
+ "org.onap.policy.clamp.models.acm.persistence.provider",
+ "org.onap.policy.clamp.acm.runtime",
+ "org.onap.policy.clamp.common.acm.rest"
+})
+@ConfigurationPropertiesScan("org.onap.policy.clamp.acm.runtime.main.parameters")
+@EntityScan({
+ "org.onap.policy.models.tosca.simple.concepts",
+ "org.onap.policy.clamp.models.acm.persistence.concepts"
+})
+//@formatter:on
public class Application {
public static void main(String[] args) {
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
index 382823b19..dfb9d151b 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.commissioning;
+package org.onap.policy.clamp.acm.runtime.commissioning;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -34,12 +34,12 @@ import java.util.stream.Collectors;
import javax.ws.rs.core.Response.Status;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.models.messages.rest.commissioning.CommissioningResponse;
-import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.messages.rest.commissioning.CommissioningResponse;
+import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -56,17 +56,17 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
- * This class provides the create, read and delete actions on Commissioning of Control Loop concepts in the database to
- * the callers.
+ * This class provides the create, read and delete actions on Commissioning of automation composition concepts in the
+ * database to the callers.
*/
@Service
@Transactional
public class CommissioningProvider {
- public static final String CONTROL_LOOP_NODE_TYPE = "org.onap.policy.clamp.controlloop.ControlLoop";
+ public static final String AUTOMATION_COMPOSITION_NODE_TYPE = "org.onap.policy.clamp.acm.AutomationComposition";
private static final String INSTANCE_TEXT = "_Instance";
private final ServiceTemplateProvider serviceTemplateProvider;
- private final ControlLoopProvider clProvider;
+ private final AutomationCompositionProvider acProvider;
private final ObjectMapper mapper = new ObjectMapper();
private final ParticipantProvider participantProvider;
private final SupervisionHandler supervisionHandler;
@@ -75,31 +75,33 @@ public class CommissioningProvider {
* Create a commissioning provider.
*
* @param serviceTemplateProvider the ServiceTemplate Provider
- * @param clProvider the ControlLoop Provider
+ * @param acProvider the AutomationComposition Provider
* @param supervisionHandler the Supervision Handler
* @param participantProvider the Participant Provider
*/
- public CommissioningProvider(ServiceTemplateProvider serviceTemplateProvider, ControlLoopProvider clProvider,
- SupervisionHandler supervisionHandler, ParticipantProvider participantProvider) {
+ public CommissioningProvider(ServiceTemplateProvider serviceTemplateProvider,
+ AutomationCompositionProvider acProvider, SupervisionHandler supervisionHandler,
+ ParticipantProvider participantProvider) {
this.serviceTemplateProvider = serviceTemplateProvider;
- this.clProvider = clProvider;
+ this.acProvider = acProvider;
this.supervisionHandler = supervisionHandler;
this.participantProvider = participantProvider;
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
}
/**
- * Create control loops from a service template.
+ * Create automation compositions from a service template.
*
* @param serviceTemplate the service template
* @return the result of the commissioning operation
* @throws PfModelException on creation errors
*/
- public CommissioningResponse createControlLoopDefinitions(ToscaServiceTemplate serviceTemplate)
- throws PfModelException {
+ public CommissioningResponse createAutomationCompositionDefinitions(ToscaServiceTemplate serviceTemplate)
+ throws PfModelException {
if (verifyIfInstancePropertiesExists()) {
- throw new PfModelException(Status.BAD_REQUEST, "Delete instances, to commission control loop definitions");
+ throw new PfModelException(Status.BAD_REQUEST,
+ "Delete instances, to commission automation composition definitions");
}
serviceTemplate = serviceTemplateProvider.createServiceTemplate(serviceTemplate);
List<Participant> participantList = participantProvider.getParticipants();
@@ -108,7 +110,8 @@ public class CommissioningProvider {
}
var response = new CommissioningResponse();
// @formatter:off
- response.setAffectedControlLoopDefinitions(serviceTemplate.getToscaTopologyTemplate().getNodeTemplates()
+ response.setAffectedAutomationCompositionDefinitions(
+ serviceTemplate.getToscaTopologyTemplate().getNodeTemplates()
.values()
.stream()
.map(template -> template.getKey().asIdentifier())
@@ -119,17 +122,19 @@ public class CommissioningProvider {
}
/**
- * Delete the control loop definition with the given name and version.
+ * Delete the automation composition definition with the given name and version.
*
- * @param name the name of the control loop definition to delete
- * @param version the version of the control loop to delete
+ * @param name the name of the automation composition definition to delete
+ * @param version the version of the automation composition to delete
* @return the result of the deletion
* @throws PfModelException on deletion errors
*/
- public CommissioningResponse deleteControlLoopDefinition(String name, String version) throws PfModelException {
+ public CommissioningResponse deleteAutomationCompositionDefinition(String name, String version)
+ throws PfModelException {
if (verifyIfInstancePropertiesExists()) {
- throw new PfModelException(Status.BAD_REQUEST, "Delete instances, to commission control loop definitions");
+ throw new PfModelException(Status.BAD_REQUEST,
+ "Delete instances, to commission automation composition definitions");
}
List<Participant> participantList = participantProvider.getParticipants();
if (!participantList.isEmpty()) {
@@ -137,73 +142,74 @@ public class CommissioningProvider {
}
serviceTemplateProvider.deleteServiceTemplate(name, version);
var response = new CommissioningResponse();
- response.setAffectedControlLoopDefinitions(List.of(new ToscaConceptIdentifier(name, version)));
+ response.setAffectedAutomationCompositionDefinitions(List.of(new ToscaConceptIdentifier(name, version)));
return response;
}
/**
- * Get control loop node templates.
+ * Get automation composition node templates.
*
- * @param clName the name of the control loop, null for all
- * @param clVersion the version of the control loop, null for all
- * @return list of control loop node templates
- * @throws PfModelException on errors getting control loop definitions
+ * @param acName the name of the automation composition, null for all
+ * @param acVersion the version of the automation composition, null for all
+ * @return list of automation composition node templates
+ * @throws PfModelException on errors getting automation composition definitions
*/
@Transactional(readOnly = true)
- public List<ToscaNodeTemplate> getControlLoopDefinitions(String clName, String clVersion) throws PfModelException {
+ public List<ToscaNodeTemplate> getAutomationCompositionDefinitions(String acName, String acVersion)
+ throws PfModelException {
// @formatter:off
ToscaTypedEntityFilter<ToscaNodeTemplate> nodeTemplateFilter = ToscaTypedEntityFilter
.<ToscaNodeTemplate>builder()
- .name(clName)
- .version(clVersion)
- .type(CONTROL_LOOP_NODE_TYPE)
+ .name(acName)
+ .version(acVersion)
+ .type(AUTOMATION_COMPOSITION_NODE_TYPE)
.build();
// @formatter:on
- return clProvider.getFilteredNodeTemplates(nodeTemplateFilter);
+ return acProvider.getFilteredNodeTemplates(nodeTemplateFilter);
}
/**
- * Get the control loop elements from a control loop node template.
+ * Get the automation composition elements from a automation composition node template.
*
- * @param controlLoopNodeTemplate the control loop node template
- * @return a list of the control loop element node templates in a control loop node template
- * @throws PfModelException on errors get control loop element node templates
+ * @param automationCompositionNodeTemplate the automation composition node template
+ * @return a list of the automation composition element node templates in a automation composition node template
+ * @throws PfModelException on errors get automation composition element node templates
*/
@Transactional(readOnly = true)
- public List<ToscaNodeTemplate> getControlLoopElementDefinitions(ToscaNodeTemplate controlLoopNodeTemplate)
- throws PfModelException {
- if (!CONTROL_LOOP_NODE_TYPE.equals(controlLoopNodeTemplate.getType())) {
+ public List<ToscaNodeTemplate> getAutomationCompositionElementDefinitions(
+ ToscaNodeTemplate automationCompositionNodeTemplate) throws PfModelException {
+ if (!AUTOMATION_COMPOSITION_NODE_TYPE.equals(automationCompositionNodeTemplate.getType())) {
return Collections.emptyList();
}
- if (MapUtils.isEmpty(controlLoopNodeTemplate.getProperties())) {
+ if (MapUtils.isEmpty(automationCompositionNodeTemplate.getProperties())) {
return Collections.emptyList();
}
@SuppressWarnings("unchecked")
- List<Map<String, String>> controlLoopElements =
- (List<Map<String, String>>) controlLoopNodeTemplate.getProperties().get("elements");
+ List<Map<String, String>> automationCompositionElements =
+ (List<Map<String, String>>) automationCompositionNodeTemplate.getProperties().get("elements");
- if (CollectionUtils.isEmpty(controlLoopElements)) {
+ if (CollectionUtils.isEmpty(automationCompositionElements)) {
return Collections.emptyList();
}
- List<ToscaNodeTemplate> controlLoopElementList = new ArrayList<>();
+ List<ToscaNodeTemplate> automationCompositionElementList = new ArrayList<>();
// @formatter:off
- controlLoopElementList.addAll(
- controlLoopElements
+ automationCompositionElementList.addAll(
+ automationCompositionElements
.stream()
- .map(elementMap -> clProvider.getNodeTemplates(elementMap.get("name"),
+ .map(elementMap -> acProvider.getNodeTemplates(elementMap.get("name"),
elementMap.get("version")))
.flatMap(List::stream)
.collect(Collectors.toList())
);
// @formatter:on
- return controlLoopElementList;
+ return automationCompositionElementList;
}
/**
@@ -217,32 +223,32 @@ public class CommissioningProvider {
*/
@Transactional(readOnly = true)
public Map<String, ToscaNodeTemplate> getNodeTemplatesWithCommonOrInstanceProperties(boolean common, String name,
- String version) throws PfModelException {
+ String version) throws PfModelException {
if (common && verifyIfInstancePropertiesExists()) {
throw new PfModelException(Status.BAD_REQUEST,
- "Cannot create or edit common properties, delete all the instantiations first");
+ "Cannot create or edit common properties, delete all the instantiations first");
}
var serviceTemplateList = serviceTemplateProvider.getServiceTemplateList(name, version);
var commonOrInstanceNodeTypeProps =
- serviceTemplateProvider.getCommonOrInstancePropertiesFromNodeTypes(common, serviceTemplateList.get(0));
+ serviceTemplateProvider.getCommonOrInstancePropertiesFromNodeTypes(common, serviceTemplateList.get(0));
var serviceTemplates = new ToscaServiceTemplates();
serviceTemplates.setServiceTemplates(filterToscaNodeTemplateInstance(serviceTemplateList));
return serviceTemplateProvider.getDerivedCommonOrInstanceNodeTemplates(
- serviceTemplates.getServiceTemplates().get(0).getToscaTopologyTemplate().getNodeTemplates(),
- commonOrInstanceNodeTypeProps);
+ serviceTemplates.getServiceTemplates().get(0).getToscaTopologyTemplate().getNodeTemplates(),
+ commonOrInstanceNodeTypeProps);
}
/**
- * Get the requested control loop definitions.
+ * Get the requested automation composition definitions.
*
* @param name the name of the definition to get, null for all definitions
* @param version the version of the definition to get, null for all definitions
- * @return the control loop definitions
- * @throws PfModelException on errors getting control loop definitions
+ * @return the automation composition definitions
+ * @throws PfModelException on errors getting automation composition definitions
*/
@Transactional(readOnly = true)
public ToscaServiceTemplate getToscaServiceTemplate(String name, String version) throws PfModelException {
@@ -250,10 +256,10 @@ public class CommissioningProvider {
}
/**
- * Get All the requested control loop definitions.
+ * Get All the requested automation composition definitions.
*
- * @return the control loop definitions
- * @throws PfModelException on errors getting control loop definitions
+ * @return the automation composition definitions
+ * @throws PfModelException on errors getting automation composition definitions
*/
@Transactional(readOnly = true)
public List<ToscaServiceTemplate> getAllToscaServiceTemplate() throws PfModelException {
@@ -328,8 +334,7 @@ public class CommissioningProvider {
break;
case "node_templates":
mapper.acceptJsonFormatVisitor(
- mapper.getTypeFactory().constructCollectionType(List.class, ToscaNodeTemplate.class),
- visitor);
+ mapper.getTypeFactory().constructCollectionType(List.class, ToscaNodeTemplate.class), visitor);
break;
default:
mapper.acceptJsonFormatVisitor(mapper.constructType(ToscaServiceTemplate.class), visitor);
@@ -371,8 +376,8 @@ public class CommissioningProvider {
* @return true if exists instance properties
*/
private boolean verifyIfInstancePropertiesExists() {
- return clProvider.getAllNodeTemplates().stream()
- .anyMatch(nodeTemplate -> nodeTemplate.getKey().getName().contains(INSTANCE_TEXT));
+ return acProvider.getAllNodeTemplates().stream()
+ .anyMatch(nodeTemplate -> nodeTemplate.getKey().getName().contains(INSTANCE_TEXT));
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/AafConfiguration.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/AafConfiguration.java
index 4483fbd1b..b1f408048 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/AafConfiguration.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/AafConfiguration.java
@@ -1,9 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
- * reserved.
+ * Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +18,10 @@
*
*/
-package org.onap.policy.clamp.controlloop.runtime.config;
+package org.onap.policy.clamp.acm.runtime.config;
import javax.servlet.Filter;
-import org.onap.policy.clamp.controlloop.runtime.main.web.ControlLoopAafFilter;
+import org.onap.policy.clamp.acm.runtime.main.web.AutomationConfiguraitonAafFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@@ -34,13 +31,13 @@ import org.springframework.context.annotation.Profile;
public class AafConfiguration {
/**
- * Method to return Aaf filter.
+ * Method to return AAF filter.
*
* @return Filter
*/
@Bean
public Filter aafFilter() {
- return new ControlLoopAafFilter();
+ return new AutomationConfiguraitonAafFilter();
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java
index d67d2e75d..f51497266 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.config;
+package org.onap.policy.clamp.acm.runtime.config;
import java.util.Arrays;
import java.util.List;
-import org.onap.policy.clamp.controlloop.common.rest.CoderHttpMesageConverter;
+import org.onap.policy.clamp.common.acm.rest.CoderHttpMesageConverter;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/FilterConfig.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/FilterConfig.java
index 57bfc2e7c..4dcd94c25 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/FilterConfig.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/FilterConfig.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.config;
+package org.onap.policy.clamp.acm.runtime.config;
-import org.onap.policy.clamp.controlloop.common.rest.RequestResponseLoggingFilter;
+import org.onap.policy.clamp.common.acm.rest.RequestResponseLoggingFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -38,7 +38,7 @@ public class FilterConfig {
FilterRegistrationBean<RequestResponseLoggingFilter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(new RequestResponseLoggingFilter());
- registrationBean.addUrlPatterns("/onap/controlloop/v2/*");
+ registrationBean.addUrlPatterns("/onap/policy/clamp/acm/v2/*");
return registrationBean;
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/SecurityConfig.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java
index 846944ea2..ade7c56b3 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/SecurityConfig.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.config;
+package org.onap.policy.clamp.acm.runtime.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/SpringFoxConfig.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SpringFoxConfig.java
index d8c703397..94c8bce06 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/SpringFoxConfig.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SpringFoxConfig.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.config;
+package org.onap.policy.clamp.acm.runtime.config;
-import org.onap.policy.clamp.controlloop.runtime.main.rest.MonitoringQueryController;
+import org.onap.policy.clamp.acm.runtime.main.rest.MonitoringQueryController;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Listener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/messaging/Listener.java
index 19bad9a67..23240ab8a 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Listener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/messaging/Listener.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.runtime.config.messaging;
import org.onap.policy.common.endpoints.listeners.ScoListener;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/MessageDispatcherActivator.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivator.java
index 284094bc4..0d9de205e 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/MessageDispatcherActivator.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivator.java
@@ -19,14 +19,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.config.messaging;
+package org.onap.policy.clamp.acm.runtime.config.messaging;
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import lombok.Getter;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
-import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup;
+import org.onap.policy.clamp.acm.runtime.main.parameters.AcRuntimeParameterGroup;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
@@ -52,18 +52,18 @@ public class MessageDispatcherActivator extends ServiceManagerContainer implemen
/**
* Constructor.
*
- * @param clRuntimeParameterGroup the parameters for the control loop runtime service
+ * @param acRuntimeParameterGroup the parameters for the automation composition runtime service
* @param publishers list of Publishers
* @param listeners list of Listeners
- * @throws ControlLoopRuntimeException if the activator does not start
+ * @throws AutomationCompositionRuntimeException if the activator does not start
*/
- public <T> MessageDispatcherActivator(final ClRuntimeParameterGroup clRuntimeParameterGroup,
+ public <T> MessageDispatcherActivator(final AcRuntimeParameterGroup acRuntimeParameterGroup,
List<Publisher> publishers, List<Listener<T>> listeners) {
topicSinks = TopicEndpointManager.getManager()
- .addTopicSinks(clRuntimeParameterGroup.getTopicParameterGroup().getTopicSinks());
+ .addTopicSinks(acRuntimeParameterGroup.getTopicParameterGroup().getTopicSinks());
topicSources = TopicEndpointManager.getManager()
- .addTopicSources(clRuntimeParameterGroup.getTopicParameterGroup().getTopicSources());
+ .addTopicSources(acRuntimeParameterGroup.getTopicParameterGroup().getTopicSources());
msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES);
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Publisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/messaging/Publisher.java
index 287d7c055..a7acc47b3 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/Publisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/messaging/Publisher.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
+package org.onap.policy.clamp.acm.runtime.config.messaging;
import java.util.List;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
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
new file mode 100644
index 000000000..39d84026b
--- /dev/null
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
@@ -0,0 +1,637 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.instantiation;
+
+import com.google.gson.Gson;
+import com.google.gson.internal.LinkedTreeMap;
+import com.google.gson.reflect.TypeToken;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.function.Function;
+import java.util.function.UnaryOperator;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import lombok.AllArgsConstructor;
+import org.onap.policy.clamp.acm.runtime.commissioning.CommissioningProvider;
+import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.messages.rest.GenericNameVersion;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AutomationCompositionOrderStateResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AutomationCompositionPrimed;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AutomationCompositionPrimedResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstancePropertiesResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
+import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.common.parameters.ObjectValidationResult;
+import org.onap.policy.common.parameters.ValidationResult;
+import org.onap.policy.common.parameters.ValidationStatus;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNameVersion;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * This class is dedicated to the Instantiation of Commissioned automation composition.
+ */
+@Service
+@Transactional
+@AllArgsConstructor
+public class AutomationCompositionInstantiationProvider {
+ private static final String AUTOMATION_COMPOSITION_NODE_TYPE = "org.onap.policy.clamp.acm.AutomationComposition";
+ private static final String AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE = "AutomationCompositionElement";
+ private static final String PARTICIPANT_ID_PROPERTY_KEY = "participant_id";
+ private static final String PARTICIPANT_TYPE_PROPERTY_KEY = "participantType";
+ private static final String AC_ELEMENT_NAME = "name";
+ private static final String AC_ELEMENT_VERSION = "version";
+ private static final String INSTANCE_TEXT = "_Instance";
+
+ private static final Gson GSON = new Gson();
+
+ private final AutomationCompositionProvider automationCompositionProvider;
+ private final CommissioningProvider commissioningProvider;
+ private final SupervisionHandler supervisionHandler;
+ private final ParticipantProvider participantProvider;
+ private static final String ENTRY = "entry ";
+
+ /**
+ * Creates Instance Properties and automation composition.
+ *
+ * @param serviceTemplate the service template
+ * @return the result of the instantiation operation
+ * @throws PfModelException on creation errors
+ */
+ public InstancePropertiesResponse createInstanceProperties(ToscaServiceTemplate serviceTemplate)
+ throws PfModelException {
+
+ String instanceName = generateSequentialInstanceName();
+ AutomationComposition automationComposition = new AutomationComposition();
+ Map<UUID, AutomationCompositionElement> automationCompositionElements = new HashMap<>();
+
+ ToscaServiceTemplate toscaServiceTemplate = commissioningProvider.getAllToscaServiceTemplate().get(0);
+
+ Map<String, ToscaNodeTemplate> persistedNodeTemplateMap =
+ toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+
+ Map<String, ToscaNodeTemplate> nodeTemplates = deepCloneNodeTemplate(serviceTemplate);
+
+ nodeTemplates.forEach((key, template) -> {
+ ToscaNodeTemplate newNodeTemplate = new ToscaNodeTemplate();
+ String name = key + instanceName;
+ String version = template.getVersion();
+ String description = template.getDescription() + instanceName;
+ newNodeTemplate.setName(name);
+ newNodeTemplate.setVersion(version);
+ newNodeTemplate.setDescription(description);
+ newNodeTemplate.setProperties(new HashMap<>(template.getProperties()));
+ newNodeTemplate.setType(template.getType());
+ newNodeTemplate.setTypeVersion(template.getTypeVersion());
+ newNodeTemplate.setMetadata(template.getMetadata());
+
+ crateNewAutomationCompositionInstance(instanceName, automationComposition, automationCompositionElements,
+ template, newNodeTemplate);
+
+ persistedNodeTemplateMap.put(name, newNodeTemplate);
+ });
+
+ AutomationCompositions automationCompositions = new AutomationCompositions();
+
+ serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().putAll(persistedNodeTemplateMap);
+
+ automationComposition.setElements(automationCompositionElements);
+ automationCompositions.getAutomationCompositionList().add(automationComposition);
+
+ return saveInstancePropertiesAndAutomationComposition(serviceTemplate, automationCompositions);
+ }
+
+ /**
+ * Deletes Instance Properties.
+ *
+ * @param name the name of the automation composition to delete
+ * @param version the version of the automation composition to delete
+ * @return the result of the deletion
+ * @throws PfModelException on deletion errors
+ */
+ public InstantiationResponse deleteInstanceProperties(String name, String version) throws PfModelException {
+
+ String instanceName = getInstancePropertyName(name, version);
+
+ Map<String, ToscaNodeTemplate> filteredToscaNodeTemplateMap = new HashMap<>();
+
+ ToscaServiceTemplate toscaServiceTemplate = commissioningProvider.getAllToscaServiceTemplate().get(0);
+
+ toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates().forEach((key, nodeTemplate) -> {
+ if (!nodeTemplate.getName().contains(instanceName)) {
+ filteredToscaNodeTemplateMap.put(key, nodeTemplate);
+ }
+ });
+
+ List<ToscaNodeTemplate> filteredToscaNodeTemplateList =
+ toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates().values().stream()
+ .filter(nodeTemplate -> nodeTemplate.getName().contains(instanceName)).collect(Collectors.toList());
+
+ InstantiationResponse response = this.deleteAutomationComposition(name, version);
+
+ automationCompositionProvider.deleteInstanceProperties(filteredToscaNodeTemplateMap,
+ filteredToscaNodeTemplateList);
+
+ return response;
+ }
+
+ /**
+ * Create automation compositions.
+ *
+ * @param automationCompositions the automation composition
+ * @return the result of the instantiation operation
+ * @throws PfModelException on creation errors
+ */
+ public InstantiationResponse createAutomationCompositions(AutomationCompositions automationCompositions)
+ throws PfModelException {
+ for (AutomationComposition automationComposition : automationCompositions.getAutomationCompositionList()) {
+ var checkAutomationCompositionOpt =
+ automationCompositionProvider.findAutomationComposition(automationComposition.getKey().asIdentifier());
+ if (checkAutomationCompositionOpt.isPresent()) {
+ throw new PfModelException(Response.Status.BAD_REQUEST,
+ automationComposition.getKey().asIdentifier() + " already defined");
+ }
+ }
+ BeanValidationResult validationResult = validateAutomationCompositions(automationCompositions);
+ if (!validationResult.isValid()) {
+ throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
+ }
+ automationCompositionProvider.saveAutomationCompositions(automationCompositions.getAutomationCompositionList());
+
+ var response = new InstantiationResponse();
+ response.setAffectedAutomationCompositions(automationCompositions.getAutomationCompositionList().stream()
+ .map(ac -> ac.getKey().asIdentifier()).collect(Collectors.toList()));
+
+ return response;
+ }
+
+ /**
+ * Update automation compositions.
+ *
+ * @param automationCompositions the automation composition
+ * @return the result of the instantiation operation
+ * @throws PfModelException on update errors
+ */
+ public InstantiationResponse updateAutomationCompositions(AutomationCompositions automationCompositions)
+ throws PfModelException {
+ BeanValidationResult validationResult = validateAutomationCompositions(automationCompositions);
+ if (!validationResult.isValid()) {
+ throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
+ }
+ automationCompositionProvider.saveAutomationCompositions(automationCompositions.getAutomationCompositionList());
+
+ var response = new InstantiationResponse();
+ response.setAffectedAutomationCompositions(automationCompositions.getAutomationCompositionList().stream()
+ .map(ac -> ac.getKey().asIdentifier()).collect(Collectors.toList()));
+
+ return response;
+ }
+
+ /**
+ * Validate AutomationCompositions.
+ *
+ * @param automationCompositions AutomationCompositions to validate
+ * @return the result of validation
+ * @throws PfModelException if automationCompositions is not valid
+ */
+ private BeanValidationResult validateAutomationCompositions(AutomationCompositions automationCompositions)
+ throws PfModelException {
+
+ var result = new BeanValidationResult("AutomationCompositions", automationCompositions);
+
+ for (AutomationComposition automationComposition : automationCompositions.getAutomationCompositionList()) {
+ var subResult = new BeanValidationResult(ENTRY + automationComposition.getDefinition().getName(),
+ automationComposition);
+
+ List<ToscaNodeTemplate> toscaNodeTemplates = commissioningProvider.getAutomationCompositionDefinitions(
+ automationComposition.getDefinition().getName(), automationComposition.getDefinition().getVersion());
+
+ if (toscaNodeTemplates.isEmpty()) {
+ subResult.addResult(
+ new ObjectValidationResult("AutomationComposition", automationComposition.getDefinition().getName(),
+ ValidationStatus.INVALID, "Commissioned automation composition definition not found"));
+ } else if (toscaNodeTemplates.size() > 1) {
+ subResult.addResult(
+ new ObjectValidationResult("AutomationComposition", automationComposition.getDefinition().getName(),
+ ValidationStatus.INVALID, "Commissioned automation composition definition not valid"));
+ } else {
+
+ List<ToscaNodeTemplate> acElementDefinitions =
+ commissioningProvider.getAutomationCompositionElementDefinitions(toscaNodeTemplates.get(0));
+
+ // @formatter:off
+ Map<String, ToscaConceptIdentifier> definitions = acElementDefinitions
+ .stream()
+ .map(nodeTemplate -> nodeTemplate.getKey().asIdentifier())
+ .collect(Collectors.toMap(ToscaConceptIdentifier::getName, UnaryOperator.identity()));
+ // @formatter:on
+
+ for (AutomationCompositionElement element : automationComposition.getElements().values()) {
+ subResult.addResult(validateDefinition(definitions, element.getDefinition()));
+ }
+ }
+ result.addResult(subResult);
+ }
+ return result;
+ }
+
+ /**
+ * Validate ToscaConceptIdentifier, checking if exist in ToscaConceptIdentifiers map.
+ *
+ * @param definitions map of all ToscaConceptIdentifiers
+ * @param definition ToscaConceptIdentifier to validate
+ * @return the validation result
+ */
+ private ValidationResult validateDefinition(Map<String, ToscaConceptIdentifier> definitions,
+ ToscaConceptIdentifier definition) {
+ var result = new BeanValidationResult(ENTRY + definition.getName(), definition);
+ ToscaConceptIdentifier identifier = definitions.get(definition.getName());
+ if (identifier == null) {
+ result.setResult(ValidationStatus.INVALID, "Not found");
+ } else if (!identifier.equals(definition)) {
+ result.setResult(ValidationStatus.INVALID, "Version not matching");
+ }
+ return (result.isClean() ? null : result);
+ }
+
+ /**
+ * Delete the automation composition with the given name and version.
+ *
+ * @param name the name of the automation composition to delete
+ * @param version the version of the automation composition to delete
+ * @return the result of the deletion
+ * @throws PfModelException on deletion errors
+ */
+ public InstantiationResponse deleteAutomationComposition(String name, String version) throws PfModelException {
+ var automationCompositionOpt = automationCompositionProvider.findAutomationComposition(name, version);
+ if (automationCompositionOpt.isEmpty()) {
+ throw new PfModelException(Response.Status.NOT_FOUND, "Automation composition not found");
+ }
+ var automationComposition = automationCompositionOpt.get();
+ if (!AutomationCompositionState.UNINITIALISED.equals(automationComposition.getState())) {
+ throw new PfModelException(Response.Status.BAD_REQUEST,
+ "Automation composition state is still " + automationComposition.getState());
+ }
+ var response = new InstantiationResponse();
+ response.setAffectedAutomationCompositions(
+ List.of(automationCompositionProvider.deleteAutomationComposition(name, version).getKey().asIdentifier()));
+ return response;
+ }
+
+ /**
+ * Get the requested automation compositions.
+ *
+ * @param name the name of the automation composition to get, null for all automation compositions
+ * @param version the version of the automation composition to get, null for all automation compositions
+ * @return the automation compositions
+ * @throws PfModelException on errors getting automation compositions
+ */
+ @Transactional(readOnly = true)
+ public AutomationCompositions getAutomationCompositions(String name, String version) throws PfModelException {
+ var automationCompositions = new AutomationCompositions();
+ automationCompositions
+ .setAutomationCompositionList(automationCompositionProvider.getAutomationCompositions(name, version));
+
+ return automationCompositions;
+ }
+
+ /**
+ * Issue a command to automation compositions, setting their ordered state.
+ *
+ * @param command the command to issue to automation compositions
+ * @return the result of the initiation command
+ * @throws PfModelException on errors setting the ordered state on the automation compositions
+ * @throws AutomationCompositionException on ordered state invalid
+ */
+ public InstantiationResponse issueAutomationCompositionCommand(InstantiationCommand command)
+ throws AutomationCompositionException, PfModelException {
+
+ if (command.getOrderedState() == null) {
+ throw new AutomationCompositionException(Status.BAD_REQUEST,
+ "ordered state invalid or not specified on command");
+ }
+
+ var participants = participantProvider.getParticipants();
+ if (participants.isEmpty()) {
+ throw new AutomationCompositionException(Status.BAD_REQUEST, "No participants registered");
+ }
+ var validationResult = new BeanValidationResult("InstantiationCommand", command);
+ List<AutomationComposition> automationCompositions =
+ new ArrayList<>(command.getAutomationCompositionIdentifierList().size());
+ for (ToscaConceptIdentifier id : command.getAutomationCompositionIdentifierList()) {
+ var automationCompositionOpt = automationCompositionProvider.findAutomationComposition(id);
+ if (automationCompositionOpt.isEmpty()) {
+ validationResult.addResult("ToscaConceptIdentifier", id, ValidationStatus.INVALID,
+ "AutomationComposition with id " + id + " not found");
+ } else {
+ var automationComposition = automationCompositionOpt.get();
+ automationComposition.setCascadedOrderedState(command.getOrderedState());
+ automationCompositions.add(automationComposition);
+ }
+ }
+ if (validationResult.isValid()) {
+ validationResult = validateIssueAutomationCompositions(automationCompositions, participants);
+ }
+ if (!validationResult.isValid()) {
+ throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
+ }
+ automationCompositionProvider.saveAutomationCompositions(automationCompositions);
+
+ supervisionHandler.triggerAutomationCompositionSupervision(command.getAutomationCompositionIdentifierList());
+ var response = new InstantiationResponse();
+ response.setAffectedAutomationCompositions(command.getAutomationCompositionIdentifierList());
+
+ return response;
+ }
+
+ private BeanValidationResult validateIssueAutomationCompositions(List<AutomationComposition> automationCompositions,
+ List<Participant> participants) {
+ var result = new BeanValidationResult("AutomationCompositions", automationCompositions);
+
+ Map<ToscaConceptIdentifier, Participant> participantMap = participants.stream()
+ .collect(Collectors.toMap(participant -> participant.getKey().asIdentifier(), Function.identity()));
+
+ for (AutomationComposition automationComposition : automationCompositions) {
+
+ for (var element : automationComposition.getElements().values()) {
+
+ var subResult = new BeanValidationResult(ENTRY + element.getDefinition().getName(), element);
+ Participant p = participantMap.get(element.getParticipantId());
+ if (p == null) {
+ subResult.addResult(new ObjectValidationResult(AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE,
+ element.getDefinition().getName(), ValidationStatus.INVALID,
+ "Participant with ID " + element.getParticipantId() + " is not registered"));
+ } else if (!p.getParticipantType().equals(element.getParticipantType())) {
+ subResult.addResult(new ObjectValidationResult(AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE,
+ element.getDefinition().getName(), ValidationStatus.INVALID,
+ "Participant with ID " + element.getParticipantType() + " - " + element.getParticipantId()
+ + " is not registered"));
+ }
+ result.addResult(subResult);
+ }
+
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets a list of automation compositions with it's ordered state.
+ *
+ * @param name the name of the automation composition to get, null for all automation compositions
+ * @param version the version of the automation composition to get, null for all automation compositions
+ * @return a list of Instantiation Command
+ * @throws PfModelException on errors getting automation compositions
+ */
+ @Transactional(readOnly = true)
+ public AutomationCompositionOrderStateResponse getInstantiationOrderState(String name, String version)
+ throws PfModelException {
+
+ List<AutomationComposition> automationCompositions =
+ automationCompositionProvider.getAutomationCompositions(name, version);
+
+ var response = new AutomationCompositionOrderStateResponse();
+
+ automationCompositions.forEach(automationComposition -> {
+ var genericNameVersion = new GenericNameVersion();
+ genericNameVersion.setName(automationComposition.getName());
+ genericNameVersion.setVersion(automationComposition.getVersion());
+ response.getAutomationCompositionIdentifierList().add(genericNameVersion);
+ });
+
+ return response;
+ }
+
+ /**
+ * Saves Instance Properties and automation composition.
+ * Gets a list of automation compositions which are primed or de-primed.
+ *
+ * @param name the name of the automation composition to get, null for all automation compositions
+ * @param version the version of the automation composition to get, null for all automation compositions
+ * @return a list of Instantiation Command
+ * @throws PfModelException on errors getting automation compositions
+ */
+ @Transactional(readOnly = true)
+ public AutomationCompositionPrimedResponse getAutomationCompositionPriming(String name, String version)
+ throws PfModelException {
+
+ List<AutomationComposition> automationCompositions =
+ automationCompositionProvider.getAutomationCompositions(name, version);
+
+ var response = new AutomationCompositionPrimedResponse();
+
+ automationCompositions.forEach(automationComposition -> {
+ var primed = new AutomationCompositionPrimed();
+ primed.setName(automationComposition.getName());
+ primed.setVersion(automationComposition.getVersion());
+ primed.setPrimed(automationComposition.getPrimed());
+ response.getPrimedAutomationCompositionsList().add(primed);
+ });
+
+ return response;
+ }
+
+ /**
+ * Creates instance element name.
+ *
+ * @param serviceTemplate the service template
+ * @param automationCompositions a list of automation compositions
+ * @return the result of the instance properties and instantiation operation
+ * @throws PfModelException on creation errors
+ */
+ private InstancePropertiesResponse saveInstancePropertiesAndAutomationComposition(
+ ToscaServiceTemplate serviceTemplate, AutomationCompositions automationCompositions) throws PfModelException {
+
+ for (var automationComposition : automationCompositions.getAutomationCompositionList()) {
+ var checkAutomationCompositionOpt =
+ automationCompositionProvider.findAutomationComposition(automationComposition.getKey().asIdentifier());
+ if (checkAutomationCompositionOpt.isPresent()) {
+ throw new PfModelException(Response.Status.BAD_REQUEST, "Automation composition with id "
+ + automationComposition.getKey().asIdentifier() + " already defined");
+ }
+ }
+ Map<String, ToscaNodeTemplate> toscaSavedNodeTemplate =
+ automationCompositionProvider.saveInstanceProperties(serviceTemplate);
+ automationCompositionProvider.saveAutomationCompositions(automationCompositions.getAutomationCompositionList());
+ List<ToscaConceptIdentifier> affectedAutomationCompositions = automationCompositions
+ .getAutomationCompositionList().stream().map(ac -> ac.getKey().asIdentifier()).collect(Collectors.toList());
+
+ List<ToscaConceptIdentifier> toscaAffectedProperties = toscaSavedNodeTemplate.values().stream()
+ .map(template -> template.getKey().asIdentifier()).collect(Collectors.toList());
+
+ var response = new InstancePropertiesResponse();
+ response.setAffectedInstanceProperties(Stream.of(affectedAutomationCompositions, toscaAffectedProperties)
+ .flatMap(Collection::stream).collect(Collectors.toList()));
+
+ return response;
+ }
+
+ /**
+ * Crates a new automation composition instance.
+ *
+ * @param instanceName automation composition Instance name
+ * @param automationComposition empty automation composition
+ * @param automationCompositionElements new automation composition Element map
+ * @param template original Cloned Tosca Node Template
+ * @param newNodeTemplate new Tosca Node Template
+ */
+ private void crateNewAutomationCompositionInstance(String instanceName, AutomationComposition automationComposition,
+ Map<UUID, AutomationCompositionElement> automationCompositionElements, ToscaNodeTemplate template,
+ ToscaNodeTemplate newNodeTemplate) {
+ if (template.getType().equals(AUTOMATION_COMPOSITION_NODE_TYPE)) {
+ automationComposition.setDefinition(getAutomationCompositionDefinition(newNodeTemplate));
+ }
+
+ if (template.getType().contains(AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE)) {
+ AutomationCompositionElement automationCompositionElement =
+ getAutomationCompositionElement(newNodeTemplate);
+ automationCompositionElements.put(automationCompositionElement.getId(), automationCompositionElement);
+ }
+
+ automationComposition.setName("PMSH" + instanceName);
+ automationComposition.setVersion(template.getVersion());
+ automationComposition.setDescription("PMSH automation composition " + instanceName);
+ automationComposition.setState(AutomationCompositionState.UNINITIALISED);
+ automationComposition.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ }
+
+ /**
+ * Get's the instance property name of the automation composition.
+ *
+ * @param name the name of the automation composition to get, null for all automation compositions
+ * @param version the version of the automation composition to get, null for all automation compositions
+ * @return the instance name of the automation composition instance properties
+ * @throws PfModelException on errors getting automation compositions
+ */
+ private String getInstancePropertyName(String name, String version) throws PfModelException {
+ List<String> toscaDefinitionsNames =
+ automationCompositionProvider.getAutomationCompositions(name, version).stream()
+ .map(AutomationComposition::getDefinition).map(ToscaNameVersion::getName).collect(Collectors.toList());
+
+ return toscaDefinitionsNames.stream().reduce("", (s1, s2) -> {
+
+ if (s2.contains(INSTANCE_TEXT)) {
+ String[] instances = s2.split(INSTANCE_TEXT);
+
+ return INSTANCE_TEXT + instances[1];
+ }
+
+ return s1;
+ });
+ }
+
+ /**
+ * Generates Instance Name in sequential order and return it to append to the Node Template Name.
+ *
+ * @return instanceName
+ */
+ private String generateSequentialInstanceName() {
+ List<ToscaNodeTemplate> nodeTemplates = automationCompositionProvider.getAllNodeTemplates();
+
+ int instanceNumber = nodeTemplates.stream().map(ToscaNodeTemplate::getName)
+ .filter(name -> name.contains(INSTANCE_TEXT)).map(n -> {
+ String[] defNameArr = n.split(INSTANCE_TEXT);
+
+ return Integer.parseInt(defNameArr[1]);
+ }).reduce(0, Math::max);
+
+ return INSTANCE_TEXT + (instanceNumber + 1);
+ }
+
+ /**
+ * Retrieves automation composition Definition.
+ *
+ * @param template tosca node template
+ * @return automation composition definition
+ */
+ private ToscaConceptIdentifier getAutomationCompositionDefinition(ToscaNodeTemplate template) {
+ ToscaConceptIdentifier definition = new ToscaConceptIdentifier();
+ definition.setName(template.getName());
+ definition.setVersion(template.getVersion());
+ return definition;
+ }
+
+ /**
+ * Retrieves automation composition Element.
+ *
+ * @param template tosca node template
+ * @return a automation composition element
+ */
+ @SuppressWarnings("unchecked")
+ private AutomationCompositionElement getAutomationCompositionElement(ToscaNodeTemplate template) {
+ AutomationCompositionElement automationCompositionElement = new AutomationCompositionElement();
+ ToscaConceptIdentifier definition = new ToscaConceptIdentifier();
+ definition.setName(template.getName());
+ definition.setVersion(template.getVersion());
+ automationCompositionElement.setDefinition(definition);
+ LinkedTreeMap<String, Object> participantId =
+ (LinkedTreeMap<String, Object>) template.getProperties().get(PARTICIPANT_ID_PROPERTY_KEY);
+ if (participantId != null) {
+ ToscaConceptIdentifier participantIdProperty = new ToscaConceptIdentifier();
+ participantIdProperty.setName(String.valueOf(participantId.get(AC_ELEMENT_NAME)));
+ participantIdProperty.setVersion(String.valueOf(participantId.get(AC_ELEMENT_VERSION)));
+ automationCompositionElement.setParticipantId(participantIdProperty);
+ }
+ LinkedTreeMap<String, Object> participantType =
+ (LinkedTreeMap<String, Object>) template.getProperties().get(PARTICIPANT_TYPE_PROPERTY_KEY);
+ if (participantType != null) {
+ ToscaConceptIdentifier participantTypeProperty = new ToscaConceptIdentifier();
+ participantTypeProperty.setName(String.valueOf(participantType.get(AC_ELEMENT_NAME)));
+ participantTypeProperty.setVersion(participantType.get(AC_ELEMENT_VERSION).toString());
+ automationCompositionElement.setParticipantType(participantTypeProperty);
+ }
+ return automationCompositionElement;
+ }
+
+ /**
+ * Deep clones ToscaNodeTemplate.
+ *
+ * @param serviceTemplate ToscaServiceTemplate
+ * @return a cloned Hash Map of ToscaNodeTemplate
+ */
+ private Map<String, ToscaNodeTemplate> deepCloneNodeTemplate(ToscaServiceTemplate serviceTemplate) {
+ String jsonString = GSON.toJson(serviceTemplate.getToscaTopologyTemplate().getNodeTemplates());
+ Type type = new TypeToken<HashMap<String, ToscaNodeTemplate>>() {}.getType();
+ return GSON.fromJson(jsonString, type);
+ }
+}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterGroup.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/AcRuntimeParameterGroup.java
index 047bca2b1..563da1268 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterGroup.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/AcRuntimeParameterGroup.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.parameters;
+package org.onap.policy.clamp.acm.runtime.main.parameters;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
@@ -30,14 +30,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
/**
- * Class to hold all parameters needed for the Control Loop runtime component.
+ * Class to hold all parameters needed for the ACM runtime component.
*
*/
@Validated
@Getter
@Setter
@ConfigurationProperties(prefix = "runtime")
-public class ClRuntimeParameterGroup {
+public class AcRuntimeParameterGroup {
@Valid
@NotNull
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantParameters.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantParameters.java
index e3e34878f..248824f11 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantParameters.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantParameters.java
@@ -16,7 +16,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.parameters;
+package org.onap.policy.clamp.acm.runtime.main.parameters;
import javax.validation.Valid;
import javax.validation.constraints.Min;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantUpdateParameters.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantUpdateParameters.java
index c0b0480de..5ffaf39c0 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantUpdateParameters.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantUpdateParameters.java
@@ -16,7 +16,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.parameters;
+package org.onap.policy.clamp.acm.runtime.main.parameters;
import javax.validation.constraints.Min;
import lombok.Getter;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/CommissioningController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/CommissioningController.java
index fcb5aed97..0fd8661b4 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/CommissioningController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/CommissioningController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.rest;
+package org.onap.policy.clamp.acm.runtime.main.rest;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -33,10 +33,10 @@ import java.util.Map;
import java.util.UUID;
import javax.ws.rs.core.Response.Status;
import lombok.RequiredArgsConstructor;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.clamp.controlloop.models.messages.rest.commissioning.CommissioningResponse;
-import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider;
-import org.onap.policy.clamp.controlloop.runtime.main.web.AbstractRestController;
+import org.onap.policy.clamp.acm.runtime.commissioning.CommissioningProvider;
+import org.onap.policy.clamp.acm.runtime.main.web.AbstractRestController;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.messages.rest.commissioning.CommissioningResponse;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
@@ -51,31 +51,31 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
- * Class to provide REST end points for creating, deleting, querying commissioned control loops.
+ * Class to provide REST end points for creating, deleting, querying commissioned automation compositions.
*/
@RestController
@RequiredArgsConstructor
public class CommissioningController extends AbstractRestController {
- private static final String TAGS = "Clamp Control Loop Commissioning API";
+ private static final String TAGS = "Clamp Automation Composition Commissioning API";
private final CommissioningProvider provider;
/**
- * Creates a control loop definition.
+ * Creates a automation composition definition.
*
* @param requestId request ID used in ONAP logging
- * @param body the body of control loop following TOSCA definition
+ * @param body the body of automation composition following TOSCA definition
* @return a response
- * @throws PfModelException on errors creating a control loop definition
+ * @throws PfModelException on errors creating a automation composition definition
*/
// @formatter:off
@PostMapping(value = "/commission",
consumes = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML},
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
@ApiOperation(
- value = "Commissions control loop definitions",
- notes = "Commissions control loop definitions, returning the commissioned control loop definition IDs",
+ value = "Commissions automation composition definitions",
+ notes = "Commissions automation composition definitions, returning commissioned definition IDs",
response = CommissioningResponse.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
@@ -117,29 +117,29 @@ public class CommissioningController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<CommissioningResponse> create(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Entity Body of Control Loop", required = true) @RequestBody ToscaServiceTemplate body)
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(
+ value = "Entity Body of Automation Composition",
+ required = true) @RequestBody ToscaServiceTemplate body)
throws PfModelException {
- return ResponseEntity.ok().body(provider.createControlLoopDefinitions(body));
+ return ResponseEntity.ok().body(provider.createAutomationCompositionDefinitions(body));
}
/**
- * Deletes a control loop definition.
+ * Deletes a automation composition definition.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop definition to delete
- * @param version the version of the control loop definition to delete
+ * @param name the name of the automation composition definition to delete
+ * @param version the version of the automation composition definition to delete
* @return a response
- * @throws PfModelException on errors deleting a control loop definition
+ * @throws PfModelException on errors deleting a automation composition definition
*/
// @formatter:off
@DeleteMapping(value = "/commission",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Delete a commissioned control loop",
- notes = "Deletes a Commissioned Control Loop, returning optional error details",
+ @ApiOperation(value = "Delete a commissioned automation composition",
+ notes = "Deletes a Commissioned Automation Composition, returning optional error details",
response = CommissioningResponse.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
@@ -180,34 +180,32 @@ public class CommissioningController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<CommissioningResponse> delete(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop definition name", required = true) @RequestParam(
- value = "name") String name,
- @ApiParam(
- value = "Control Loop definition version",
- required = true) @RequestParam("version") String version)
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition definition name", required = true) @RequestParam(
+ value = "name") String name,
+ @ApiParam(
+ value = "Automation composition definition version",
+ required = true) @RequestParam("version") String version)
throws PfModelException {
- return ResponseEntity.ok().body(provider.deleteControlLoopDefinition(name, version));
+ return ResponseEntity.ok().body(provider.deleteAutomationCompositionDefinition(name, version));
}
/**
- * Queries details of all or specific control loop definitions.
+ * Queries details of all or specific automation composition definitions.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop definition to get, null for all definitions
- * @param version the version of the control loop definition to get, null for all definitions
- * @return the control loop definitions
- * @throws PfModelException on errors getting details of all or specific control loop definitions
+ * @param name the name of the automation composition definition to get, null for all definitions
+ * @param version the version of the automation composition definition to get, null for all definitions
+ * @return the automation composition definitions
+ * @throws PfModelException on errors getting details of all or specific automation composition definitions
*/
// @formatter:off
@GetMapping(value = "/commission",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of the requested commissioned control loop definitions",
- notes = "Queries details of the requested commissioned control loop definitions, "
- + "returning all control loop details",
+ @ApiOperation(value = "Query details of the requested commissioned automation composition definitions",
+ notes = "Queries details of the requested commissioned automation composition definitions, "
+ + "returning all automation composition details",
response = ToscaNodeTemplate.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
@@ -241,18 +239,16 @@ public class CommissioningController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<List<ToscaNodeTemplate>> query(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop definition name", required = false) @RequestParam(
- value = "name",
- required = false) String name,
- @ApiParam(value = "Control Loop definition version", required = false) @RequestParam(
- value = "version",
- required = false) String version)
- throws PfModelException {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition definition name", required = false) @RequestParam(
+ value = "name",
+ required = false) String name,
+ @ApiParam(value = "Automation composition definition version", required = false) @RequestParam(
+ value = "version",
+ required = false) String version)
+ throws PfModelException {
- return ResponseEntity.ok().body(provider.getControlLoopDefinitions(name, version));
+ return ResponseEntity.ok().body(provider.getAutomationCompositionDefinitions(name, version));
}
/**
@@ -303,16 +299,14 @@ public class CommissioningController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<String> queryToscaServiceTemplate(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Tosca service template name", required = false) @RequestParam(
- value = "name",
- required = false) String name,
- @ApiParam(value = "Tosca service template version", required = false) @RequestParam(
- value = "version",
- required = false) String version)
- throws PfModelException {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Tosca service template name", required = false) @RequestParam(
+ value = "name",
+ required = false) String name,
+ @ApiParam(value = "Tosca service template version", required = false) @RequestParam(
+ value = "version",
+ required = false) String version)
+ throws PfModelException {
return ResponseEntity.ok().body(provider.getToscaServiceTemplateReduced(name, version));
}
@@ -364,14 +358,11 @@ public class CommissioningController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<String> queryToscaServiceTemplateJsonSchema(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Section of Template schema is desired for", required = false) @RequestParam(
- value = "section",
- required = false,
- defaultValue = "all") String section)
- throws PfModelException {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(
+ value = "Section of Template schema is desired for",
+ required = false) @RequestParam(value = "section", required = false, defaultValue = "all") String section)
+ throws PfModelException {
return ResponseEntity.ok().body(provider.getToscaServiceTemplateSchema(section));
}
@@ -385,7 +376,7 @@ public class CommissioningController extends AbstractRestController {
* @param version the version of the tosca service template to get
* @return the specified tosca service template or section Json Schema
* @throws PfModelException on errors getting the Common or Instance Properties
- * @throws ControlLoopException on error getting the Common or Instance Properties
+ * @throws AutomationCompositionException on error getting the Common or Instance Properties
*/
// @formatter:off
@GetMapping(value = "/commission/getCommonOrInstanceProperties",
@@ -394,7 +385,7 @@ public class CommissioningController extends AbstractRestController {
notes = "Queries details of the requested commissioned tosca service template json common"
+ "or instance properties, returning all tosca service template common or instance property details",
response = ToscaServiceTemplate.class,
- tags = {"Clamp Control Loop Commissioning API"},
+ tags = {"Clamp Automation Composition Commissioning API"},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@ResponseHeader(
@@ -426,39 +417,36 @@ public class CommissioningController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<Map<String, ToscaNodeTemplate>> queryToscaServiceCommonOrInstanceProperties(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Flag, true for common properties, false for instance", required = false) @RequestParam(
- value = "common",
- defaultValue = "false",
- required = false) boolean common,
- @ApiParam(value = "Tosca service template name", required = false) @RequestParam(
- value = "name",
- required = false) String name,
- @ApiParam(value = "Tosca service template version", required = false) @RequestParam(
- value = "version",
- required = false) String version)
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(
+ value = "Flag, true for common properties, false for instance",
+ required = false) @RequestParam(value = "common", defaultValue = "false", required = false) boolean common,
+ @ApiParam(value = "Tosca service template name", required = false) @RequestParam(
+ value = "name",
+ required = false) String name,
+ @ApiParam(value = "Tosca service template version", required = false) @RequestParam(
+ value = "version",
+ required = false) String version)
throws PfModelException {
return ResponseEntity.ok().body(provider.getNodeTemplatesWithCommonOrInstanceProperties(common, name, version));
}
/**
- * Queries the elements of a specific control loop.
+ * Queries the elements of a specific automation composition.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop definition to get
- * @param version the version of the control loop definition to get
- * @return the control loop element definitions
- * @throws PfModelException on errors getting the elements of a specific control loop
+ * @param name the name of the automation composition definition to get
+ * @param version the version of the automation composition definition to get
+ * @return the automation composition element definitions
+ * @throws PfModelException on errors getting the elements of a specific automation composition
*/
// @formatter:off
@GetMapping(value = "/commission/elements",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of the requested commissioned control loop element definitions",
- notes = "Queries details of the requested commissioned control loop element definitions, "
- + "returning all control loop elements' details",
+ @ApiOperation(value = "Query details of the requested commissioned automation composition element definitions",
+ notes = "Queries details of the requested commissioned automation composition element definitions, "
+ + "returning all automation composition elements' details",
response = ToscaNodeTemplate.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
@@ -492,24 +480,22 @@ public class CommissioningController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<List<ToscaNodeTemplate>> queryElements(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop definition name", required = false) @RequestParam(
- value = "name",
- required = false) String name,
- @ApiParam(value = "Control Loop definition version", required = false) @RequestParam(
- value = "version",
- required = false) String version)
- throws PfModelException {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition definition name", required = false) @RequestParam(
+ value = "name",
+ required = false) String name,
+ @ApiParam(value = "Automation composition definition version", required = false) @RequestParam(
+ value = "version",
+ required = false) String version)
+ throws PfModelException {
- List<ToscaNodeTemplate> nodeTemplate = provider.getControlLoopDefinitions(name, version);
+ List<ToscaNodeTemplate> nodeTemplate = provider.getAutomationCompositionDefinitions(name, version);
// Prevent ambiguous queries with multiple returns
if (nodeTemplate.size() > 1) {
- throw new PfModelException(Status.NOT_ACCEPTABLE, "Multiple ControlLoops are not supported");
+ throw new PfModelException(Status.NOT_ACCEPTABLE, "Multiple automation compositions are not supported");
}
- List<ToscaNodeTemplate> response = provider.getControlLoopElementDefinitions(nodeTemplate.get(0));
+ List<ToscaNodeTemplate> response = provider.getAutomationCompositionElementDefinitions(nodeTemplate.get(0));
return ResponseEntity.ok().body(response);
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
index d229e68cb..dc56c77e7 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.rest;
+package org.onap.policy.clamp.acm.runtime.main.rest;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -31,15 +31,15 @@ import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.ResponseHeader;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopOrderStateResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopPrimedResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstancePropertiesResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
-import org.onap.policy.clamp.controlloop.runtime.instantiation.ControlLoopInstantiationProvider;
-import org.onap.policy.clamp.controlloop.runtime.main.web.AbstractRestController;
+import org.onap.policy.clamp.acm.runtime.instantiation.AutomationCompositionInstantiationProvider;
+import org.onap.policy.clamp.acm.runtime.main.web.AbstractRestController;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AutomationCompositionOrderStateResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AutomationCompositionPrimedResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstancePropertiesResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.http.MediaType;
@@ -54,32 +54,32 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
- * Class to provide REST end points for creating, deleting, query and commanding a control loop definition.
+ * Class to provide REST end points for creating, deleting, query and commanding a automation composition definition.
*/
@RestController
@RequiredArgsConstructor
public class InstantiationController extends AbstractRestController {
- private static final String TAGS = "Clamp Control Loop Instantiation API";
+ private static final String TAGS = "Clamp Automation Composition Instantiation API";
- // The CL provider for instantiation requests
- private final ControlLoopInstantiationProvider provider;
+ // The Automation Composition provider for instantiation requests
+ private final AutomationCompositionInstantiationProvider provider;
/**
- * Creates a control loop.
+ * Creates a automation composition.
*
* @param requestId request ID used in ONAP logging
- * @param controlLoops the control loops
+ * @param automationCompositions the automation compositions
* @return a response
- * @throws PfModelException on errors creating a control loop
+ * @throws PfModelException on errors creating a automation composition
*/
// @formatter:off
@PostMapping(value = "/instantiation",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML},
consumes = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
@ApiOperation(
- value = "Commissions control loop definitions",
- notes = "Commissions control loop definitions, returning the control loop IDs",
+ value = "Commissions automation composition definitions",
+ notes = "Commissions automation composition definitions, returning the automation composition IDs",
response = InstantiationResponse.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
@@ -121,20 +121,20 @@ public class InstantiationController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<InstantiationResponse> create(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Entity Body of Control Loop", required = true) @RequestBody ControlLoops controlLoops)
- throws PfModelException {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(
+ value = "Entity Body of automation composition",
+ required = true) @RequestBody AutomationCompositions automationCompositions)
+ throws PfModelException {
- return ResponseEntity.ok().body(provider.createControlLoops(controlLoops));
+ return ResponseEntity.ok().body(provider.createAutomationCompositions(automationCompositions));
}
/**
* Saves instance properties.
*
* @param requestId request ID used in ONAP logging
- * @param body the body of control loop following TOSCA definition
+ * @param body the body of automation composition following TOSCA definition
* @return a response
*/
// @formatter:off
@@ -185,29 +185,27 @@ public class InstantiationController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<InstancePropertiesResponse> createInstanceProperties(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Body of instance properties", required = true) @RequestBody ToscaServiceTemplate body)
- throws PfModelException {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Body of instance properties", required = true) @RequestBody ToscaServiceTemplate body)
+ throws PfModelException {
return ResponseEntity.ok().body(provider.createInstanceProperties(body));
}
/**
- * Deletes a control loop definition and instance properties.
+ * Deletes a automation composition definition and instance properties.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop to delete
- * @param version the version of the control loop to delete
+ * @param name the name of the automation composition to delete
+ * @param version the version of the automation composition to delete
* @return a response
- * @throws PfModelException on errors deleting of control loop and instance properties
+ * @throws PfModelException on errors deleting of automation composition and instance properties
*/
// @formatter:off
@DeleteMapping(value = "/instanceProperties",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Delete a control loop and instance properties",
- notes = "Deletes a control loop and instance properties, returning optional error details",
+ @ApiOperation(value = "Delete a automation composition and instance properties",
+ notes = "Deletes a automation composition and instance properties, returning optional error details",
response = InstantiationResponse.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
@@ -249,33 +247,31 @@ public class InstantiationController extends AbstractRestController {
// @formatter:on
public ResponseEntity<InstantiationResponse> deleteInstanceProperties(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop definition name", required = true) @RequestParam("name") String name,
- @ApiParam(value = "Control Loop definition version") @RequestParam(
- value = "version",
- required = true) String version)
- throws PfModelException {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition definition name", required = true) @RequestParam("name") String name,
+ @ApiParam(value = "Automation composition definition version") @RequestParam(
+ value = "version",
+ required = true) String version)
+ throws PfModelException {
return ResponseEntity.ok().body(provider.deleteInstanceProperties(name, version));
}
/**
- * Queries details of all control loops.
+ * Queries details of all automation compositions.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop to get, null for all control loops
- * @param version the version of the control loop to get, null for all control loops
- * @return the control loops
- * @throws PfModelException on errors getting commissioning of control loop
+ * @param name the name of the automation composition to get, null for all automation compositions
+ * @param version the version of the automation composition to get, null for all automation compositions
+ * @return the automation compositions
+ * @throws PfModelException on errors getting commissioning of automation composition
*/
// @formatter:off
@GetMapping(value = "/instantiation",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of the requested control loops",
- notes = "Queries details of the requested control loops, returning all control loop details",
- response = ControlLoops.class,
+ @ApiOperation(value = "Query details of the requested automation compositions",
+ notes = "Queries details of the requested automation compositions, returning all composition details",
+ response = AutomationCompositions.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@@ -307,36 +303,34 @@ public class InstantiationController extends AbstractRestController {
}
)
// @formatter:on
- public ResponseEntity<ControlLoops> query(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop definition name", required = false) @RequestParam(
- value = "name",
- required = false) String name,
- @ApiParam(value = "Control Loop definition version", required = false) @RequestParam(
- value = "version",
- required = false) String version)
- throws PfModelException {
+ public ResponseEntity<AutomationCompositions> query(
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition definition name", required = false) @RequestParam(
+ value = "name",
+ required = false) String name,
+ @ApiParam(value = "Automation composition definition version", required = false) @RequestParam(
+ value = "version",
+ required = false) String version)
+ throws PfModelException {
- return ResponseEntity.ok().body(provider.getControlLoops(name, version));
+ return ResponseEntity.ok().body(provider.getAutomationCompositions(name, version));
}
/**
- * Updates a control loop.
+ * Updates a automation composition.
*
* @param requestId request ID used in ONAP logging
- * @param controlLoops the control loops
+ * @param automationCompositions the automation compositions
* @return a response
- * @throws PfModelException on errors updating of control loops
+ * @throws PfModelException on errors updating of automation compositions
*/
// @formatter:off
@PutMapping(value = "/instantiation",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML},
consumes = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
@ApiOperation(
- value = "Updates control loop definitions",
- notes = "Updates control loop definitions, returning the updated control loop definition IDs",
+ value = "Updates automation composition definitions",
+ notes = "Updates automation composition definitions, returning the updated composition definition IDs",
response = InstantiationResponse.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
@@ -378,29 +372,29 @@ public class InstantiationController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<InstantiationResponse> update(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Entity Body of Control Loop", required = true) @RequestBody ControlLoops controlLoops)
- throws PfModelException {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(
+ value = "Entity Body of Automation Composition",
+ required = true) @RequestBody AutomationCompositions automationCompositions)
+ throws PfModelException {
- return ResponseEntity.ok().body(provider.updateControlLoops(controlLoops));
+ return ResponseEntity.ok().body(provider.updateAutomationCompositions(automationCompositions));
}
/**
- * Deletes a control loop definition.
+ * Deletes a automation composition definition.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop to delete
- * @param version the version of the control loop to delete
+ * @param name the name of the automation composition to delete
+ * @param version the version of the automation composition to delete
* @return a response
- * @throws PfModelException on errors deleting of control loop
+ * @throws PfModelException on errors deleting of automation composition
*/
// @formatter:off
@DeleteMapping(value = "/instantiation",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Delete a control loop",
- notes = "Deletes a control loop, returning optional error details",
+ @ApiOperation(value = "Delete a automation composition",
+ notes = "Deletes a automation composition, returning optional error details",
response = InstantiationResponse.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
@@ -442,33 +436,31 @@ public class InstantiationController extends AbstractRestController {
// @formatter:on
public ResponseEntity<InstantiationResponse> delete(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop definition name", required = true) @RequestParam("name") String name,
- @ApiParam(value = "Control Loop definition version") @RequestParam(
- value = "version",
- required = true) String version)
- throws PfModelException {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition definition name", required = true) @RequestParam("name") String name,
+ @ApiParam(value = "Automation composition definition version") @RequestParam(
+ value = "version",
+ required = true) String version)
+ throws PfModelException {
- return ResponseEntity.ok().body(provider.deleteControlLoop(name, version));
+ return ResponseEntity.ok().body(provider.deleteAutomationComposition(name, version));
}
/**
- * Issues control loop commands to control loops.
+ * Issues automation composition commands to automation compositions.
*
* @param requestId request ID used in ONAP logging
- * @param command the command to issue to control loops
- * @return the control loop definitions
+ * @param command the command to issue to automation compositions
+ * @return the automation composition definitions
* @throws PfModelException on errors issuing a command
- * @throws ControlLoopException on errors issuing a command
+ * @throws AutomationCompositionException on errors issuing a command
*/
// @formatter:off
@PutMapping(value = "/instantiation/command",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML},
consumes = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Issue a command to the requested control loops",
- notes = "Issues a command to a control loop, ordering a state change on the control loop",
+ @ApiOperation(value = "Issue a command to the requested automation compositions",
+ notes = "Issues a command to an automation composition, ordering a state change on the composition",
response = InstantiationResponse.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
@@ -501,33 +493,31 @@ public class InstantiationController extends AbstractRestController {
}
)
// @formatter:on
- public ResponseEntity<InstantiationResponse> issueControlLoopCommand(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(
- value = "Entity Body of control loop command",
- required = true) @RequestBody InstantiationCommand command)
- throws ControlLoopException, PfModelException {
+ public ResponseEntity<InstantiationResponse> issueAutomationCompositionCommand(
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(
+ value = "Entity Body of automation composition command",
+ required = true) @RequestBody InstantiationCommand command)
+ throws AutomationCompositionException, PfModelException {
- return ResponseEntity.accepted().body(provider.issueControlLoopCommand(command));
+ return ResponseEntity.accepted().body(provider.issueAutomationCompositionCommand(command));
}
/**
- * Queries details of all control loops.
+ * Queries details of all automation compositions.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop to get, null for all control loops
- * @param version the version of the control loop to get, null for all control loops
- * @return the control loops
- * @throws PfModelException on errors getting commissioning of control loop
+ * @param name the name of the automation composition to get, null for all automation compositions
+ * @param version the version of the automation composition to get, null for all automation compositions
+ * @return the automation compositions
+ * @throws PfModelException on errors getting commissioning of automation composition
*/
// @formatter:off
@GetMapping(value = "/instantiationState",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of the requested control loops",
- notes = "Queries details of the requested control loops, returning all control loop details",
- response = ControlLoops.class,
+ @ApiOperation(value = "Query details of the requested automation compositions",
+ notes = "Queries details of requested automation compositions, returning all automation composition details",
+ response = AutomationCompositions.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@@ -559,36 +549,34 @@ public class InstantiationController extends AbstractRestController {
}
)
// @formatter:on
- public ResponseEntity<ControlLoopOrderStateResponse> getInstantiationOrderState(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop name", required = false) @RequestParam(
- value = "name",
- required = false) String name,
- @ApiParam(value = "Control Loop version", required = false) @RequestParam(
- value = "version",
- required = false) String version)
- throws PfModelException {
+ public ResponseEntity<AutomationCompositionOrderStateResponse> getInstantiationOrderState(
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition name", required = false) @RequestParam(
+ value = "name",
+ required = false) String name,
+ @ApiParam(value = "Automation composition version", required = false) @RequestParam(
+ value = "version",
+ required = false) String version)
+ throws PfModelException {
return ResponseEntity.ok().body(provider.getInstantiationOrderState(name, version));
}
/**
- * Queries Primed/De-Primed status of a control loop.
+ * Queries Primed/De-Primed status of a automation composition.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop to get, null for all control loops
- * @param version the version of the control loop to get, null for all control loops
- * @return the control loops
- * @throws PfModelException on errors getting priming of control loop
+ * @param name the name of the automation composition to get, null for all automation compositions
+ * @param version the version of the automation composition to get, null for all automation compositions
+ * @return the automation compositions
+ * @throws PfModelException on errors getting priming of automation composition
*/
// @formatter:off
- @GetMapping(value = "/controlLoopPriming",
+ @GetMapping(value = "/automationCompositionPriming",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query priming details of the requested control loops",
- notes = "Queries priming details of the requested control loops, returning primed/deprimed control loops",
- response = ControlLoopPrimedResponse.class,
+ @ApiOperation(value = "Query priming details of the requested automation compositions",
+ notes = "Queries priming details of requested automation compositions, returning primed/deprimed compositions",
+ response = AutomationCompositionPrimedResponse.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@@ -620,18 +608,16 @@ public class InstantiationController extends AbstractRestController {
}
)
// @formatter:on
- public ResponseEntity<ControlLoopPrimedResponse> getControlLoopPriming(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop definition name", required = false) @RequestParam(
- value = "name",
- required = false) String name,
- @ApiParam(value = "Control Loop definition version", required = false) @RequestParam(
- value = "version",
- required = false) String version)
- throws PfModelException {
+ public ResponseEntity<AutomationCompositionPrimedResponse> getAutomationCompositionPriming(
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition definition name", required = false) @RequestParam(
+ value = "name",
+ required = false) String name,
+ @ApiParam(value = "Automation composition definition version", required = false) @RequestParam(
+ value = "version",
+ required = false) String version)
+ throws PfModelException {
- return ResponseEntity.ok().body(provider.getControlLoopPriming(name, version));
+ return ResponseEntity.ok().body(provider.getAutomationCompositionPriming(name, version));
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/MonitoringQueryController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/MonitoringQueryController.java
index c4ce5bb05..30c1d5dc9 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/MonitoringQueryController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/MonitoringQueryController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.rest;
+package org.onap.policy.clamp.acm.runtime.main.rest;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -31,10 +31,10 @@ import io.swagger.annotations.ResponseHeader;
import java.time.Instant;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatisticsList;
-import org.onap.policy.clamp.controlloop.runtime.main.web.AbstractRestController;
-import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringProvider;
+import org.onap.policy.clamp.acm.runtime.main.web.AbstractRestController;
+import org.onap.policy.clamp.acm.runtime.monitoring.MonitoringProvider;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatisticsList;
import org.onap.policy.models.base.PfModelException;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -44,17 +44,17 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
- * This class handles REST endpoints for CL Statistics monitoring.
+ * This class handles REST endpoints for ACM Statistics monitoring.
*/
@RestController
@RequiredArgsConstructor
public class MonitoringQueryController extends AbstractRestController {
- private static final String TAGS = "Clamp Control Loop Monitoring API";
+ private static final String TAGS = "Clamp Automation Composition Monitoring API";
private final MonitoringProvider provider;
/**
- * Queries details of control loop participants statistics.
+ * Queries details of automation composition participants statistics.
*
* @param requestId request ID used in ONAP logging
* @param name the name of the participant to get, null for all participants statistics
@@ -102,25 +102,23 @@ public class MonitoringQueryController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<ParticipantStatisticsList> queryParticipantStatistics(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop participant name") @RequestParam(
- value = "name",
- required = false) final String name,
- @ApiParam(value = "Control Loop participant version", required = false) @RequestParam(
- value = "version",
- required = false) final String version,
- @ApiParam(value = "Record count", required = false) @RequestParam(
- value = "recordCount",
- required = false,
- defaultValue = "0") final int recordCount,
- @ApiParam(value = "start time", required = false) @RequestParam(
- value = "startTime",
- required = false) final String startTime,
- @ApiParam(value = "end time", required = false) @RequestParam(
- value = "endTime",
- required = false) final String endTime) {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition participant name") @RequestParam(
+ value = "name",
+ required = false) final String name,
+ @ApiParam(value = "Automation composition participant version", required = false) @RequestParam(
+ value = "version",
+ required = false) final String version,
+ @ApiParam(value = "Record count", required = false) @RequestParam(
+ value = "recordCount",
+ required = false,
+ defaultValue = "0") final int recordCount,
+ @ApiParam(value = "start time", required = false) @RequestParam(
+ value = "startTime",
+ required = false) final String startTime,
+ @ApiParam(value = "end time", required = false) @RequestParam(
+ value = "endTime",
+ required = false) final String endTime) {
Instant startTimestamp = null;
Instant endTimestamp = null;
@@ -132,23 +130,23 @@ public class MonitoringQueryController extends AbstractRestController {
endTimestamp = Instant.parse(endTime);
}
return ResponseEntity.ok().body(
- provider.fetchFilteredParticipantStatistics(name, version, recordCount, startTimestamp, endTimestamp));
+ provider.fetchFilteredParticipantStatistics(name, version, recordCount, startTimestamp, endTimestamp));
}
/**
- * Queries details of all participant statistics per control loop.
+ * Queries details of all participant statistics per automation composition.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop
- * @param version version of the control loop
- * @return the control loop element statistics
+ * @param name the name of the automation composition
+ * @param version version of the automation composition
+ * @return the automation composition element statistics
*/
// @formatter:off
- @GetMapping(value = "/monitoring/participants/controlloop",
+ @GetMapping(value = "/monitoring/participants/automationcomposition",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of all the participant stats in a control loop",
+ @ApiOperation(value = "Query details of all the participant stats in a automation composition",
notes = "Queries details of the participant stats, returning all participant stats",
- response = ClElementStatisticsList.class,
+ response = AcElementStatisticsList.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@@ -179,34 +177,32 @@ public class MonitoringQueryController extends AbstractRestController {
}
)
// @formatter:on
- public ResponseEntity<ParticipantStatisticsList> queryParticipantStatisticsPerControlLoop(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop name", required = true) @RequestParam(
- value = "name",
- required = false) final String name,
- @ApiParam(value = "Control Loop version", required = true) @RequestParam(
- value = "version",
- required = false) final String version) {
+ public ResponseEntity<ParticipantStatisticsList> queryParticipantStatisticsPerAutomationComposition(
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition name", required = true) @RequestParam(
+ value = "name",
+ required = false) final String name,
+ @ApiParam(value = "Automation composition version", required = true) @RequestParam(
+ value = "version",
+ required = false) final String version) {
- return ResponseEntity.ok().body(provider.fetchParticipantStatsPerControlLoop(name, version));
+ return ResponseEntity.ok().body(provider.fetchParticipantStatsPerAutomationComposition(name, version));
}
/**
- * Queries details of all control loop element statistics per control loop.
+ * Queries details of all automation composition element statistics per automation composition.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop
- * @param version version of the control loop
- * @return the control loop element statistics
+ * @param name the name of the automation composition
+ * @param version version of the automation composition
+ * @return the automation composition element statistics
*/
// @formatter:off
- @GetMapping(value = "/monitoring/clelements/controlloop",
+ @GetMapping(value = "/monitoring/acelements/automationcomposition",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of the requested cl element stats in a control loop",
- notes = "Queries details of the requested cl element stats, returning all clElement stats",
- response = ClElementStatisticsList.class,
+ @ApiOperation(value = "Query details of the requested acElement stats in a automation composition",
+ notes = "Queries details of the requested acElement stats, returning all acElement stats",
+ response = AcElementStatisticsList.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@@ -237,39 +233,38 @@ public class MonitoringQueryController extends AbstractRestController {
}
)
// @formatter:on
- public ResponseEntity<ClElementStatisticsList> queryElementStatisticsPerControlLoop(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Control Loop name", required = true) @RequestParam(
- value = "name",
- required = false) final String name,
- @ApiParam(value = "Control Loop version", required = true) @RequestParam(
- value = "version",
- required = false) final String version) {
+ public ResponseEntity<AcElementStatisticsList> queryElementStatisticsPerAutomationComposition(
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Automation composition name", required = true) @RequestParam(
+ value = "name",
+ required = false) final String name,
+ @ApiParam(value = "Automation composition version", required = true) @RequestParam(
+ value = "version",
+ required = false) final String version) {
- return ResponseEntity.ok().body(provider.fetchClElementStatsPerControlLoop(name, version));
+ return ResponseEntity.ok().body(provider.fetchAcElementStatsPerAutomationComposition(name, version));
}
/**
- * Queries details of all control loop element statistics per control loop.
+ * Queries details of all automation composition element statistics per automation composition.
*
* @param requestId request ID used in ONAP logging
- * @param name the name of the control loop
- * @param version version of the control loop
- * @param id Id of the control loop element
+ * @param name the name of the automation composition
+ * @param version version of the automation composition
+ * @param id Id of the automation composition element
* @param recordCount the record count to be fetched
* @param startTime the time from which to get statistics
* @param endTime the time to which to get statistics
- * @return the control loop element statistics
- * @throws PfModelException on errors getting details of all control loop element statistics per control loop
+ * @return the automation composition element statistics
+ * @throws PfModelException on errors getting details of all automation composition element statistics per
+ * automation composition
*/
// @formatter:off
- @GetMapping(value = "/monitoring/clelement",
+ @GetMapping(value = "/monitoring/acelement",
produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of the requested cl element stats",
- notes = "Queries details of the requested cl element stats, returning all clElement stats",
- response = ClElementStatisticsList.class,
+ @ApiOperation(value = "Query details of the requested acElement stats",
+ notes = "Queries details of the requested acElement stats, returning all acElement stats",
+ response = AcElementStatisticsList.class,
tags = {TAGS},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
@@ -300,30 +295,28 @@ public class MonitoringQueryController extends AbstractRestController {
}
)
// @formatter:on
- public ResponseEntity<ClElementStatisticsList> queryElementStatistics(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Participant name", required = true) @RequestParam(
- value = "name",
- required = false) final String name,
- @ApiParam(value = "Participant version", required = true) @RequestParam(
- value = "version",
- required = false) final String version,
- @ApiParam(value = "Record count", required = false) @RequestParam(
- value = "recordCount",
- required = false,
- defaultValue = "0") final int recordCount,
- @ApiParam(value = "Control Loop element id", required = false) @RequestParam(
- value = "id",
- required = false) final String id,
- @ApiParam(value = "start time", required = false) @RequestParam(
- value = "startTime",
- required = false) final String startTime,
- @ApiParam(value = "end time", required = false) @RequestParam(
- value = "endTime",
- required = false) final String endTime)
- throws PfModelException {
+ public ResponseEntity<AcElementStatisticsList> queryElementStatistics(
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Participant name", required = true) @RequestParam(
+ value = "name",
+ required = false) final String name,
+ @ApiParam(value = "Participant version", required = true) @RequestParam(
+ value = "version",
+ required = false) final String version,
+ @ApiParam(value = "Record count", required = false) @RequestParam(
+ value = "recordCount",
+ required = false,
+ defaultValue = "0") final int recordCount,
+ @ApiParam(value = "Automation composition element id", required = false) @RequestParam(
+ value = "id",
+ required = false) final String id,
+ @ApiParam(value = "start time", required = false) @RequestParam(
+ value = "startTime",
+ required = false) final String startTime,
+ @ApiParam(value = "end time", required = false) @RequestParam(
+ value = "endTime",
+ required = false) final String endTime)
+ throws PfModelException {
Instant startTimestamp = null;
Instant endTimestamp = null;
@@ -334,8 +327,8 @@ public class MonitoringQueryController extends AbstractRestController {
if (endTime != null) {
endTimestamp = Instant.parse(endTime);
}
- return ResponseEntity.ok().body(provider.fetchFilteredClElementStatistics(name, version, id, startTimestamp,
- endTimestamp, recordCount));
+ return ResponseEntity.ok().body(
+ provider.fetchFilteredAcElementStatistics(name, version, id, startTimestamp, endTimestamp, recordCount));
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/AbstractRestController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AbstractRestController.java
index 7d279ba67..7907de7be 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/AbstractRestController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AbstractRestController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.web;
+package org.onap.policy.clamp.acm.runtime.main.web;
import io.swagger.annotations.Api;
import io.swagger.annotations.BasicAuthDefinition;
@@ -35,15 +35,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
*/
// @formatter:off
@RequestMapping(value = "/v2", produces = {MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML})
-@Api(value = "Control Loop Commissioning API")
+@Api(value = "Automation Composition Commissioning API")
@SwaggerDefinition(
info = @Info(description =
- "Control Loop Service", version = "v1.0",
- title = "Control Loop"),
+ "Automation Composition Service", version = "v1.0",
+ title = "Automation Composition"),
consumes = {MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML},
produces = {MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML},
schemes = {SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS},
- tags = {@Tag(name = "controlloop", description = "Control Loop Service")},
+ tags = {@Tag(name = "automationcomposition", description = "Automation Composition Service")},
securityDefinition = @SecurityDefinition(basicAuthDefinitions = {@BasicAuthDefinition(key = "basicAuth")}))
// @formatter:on
public abstract class AbstractRestController {
@@ -55,7 +55,7 @@ public abstract class AbstractRestController {
public static final String API_VERSION = "1.0.0";
public static final String LAST_MOD_NAME = "last-mod-release";
- public static final String LAST_MOD_RELEASE = "Dublin";
+ public static final String LAST_MOD_RELEASE = "Istanbul";
public static final String VERSION_MINOR_NAME = "X-MinorVersion";
public static final String VERSION_MINOR_DESCRIPTION =
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/ControlLoopAafFilter.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AutomationConfiguraitonAafFilter.java
index 739a691c9..ed49e3b44 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/ControlLoopAafFilter.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AutomationConfiguraitonAafFilter.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.web;
+package org.onap.policy.clamp.acm.runtime.main.web;
import org.onap.policy.common.endpoints.http.server.aaf.AafGranularAuthFilter;
import org.onap.policy.common.utils.resources.MessageConstants;
/**
- * Class to manage AAF filters for the control loop runtime component.
+ * Class to manage AAF filters for the automation composition runtime component.
*/
-public class ControlLoopAafFilter extends AafGranularAuthFilter {
+public class AutomationConfiguraitonAafFilter extends AafGranularAuthFilter {
public static final String AAF_NODETYPE = MessageConstants.POLICY_CLAMP;
public static final String AAF_ROOT_PERMISSION = DEFAULT_NAMESPACE + "." + AAF_NODETYPE;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/GlobalControllerExceptionHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/GlobalControllerExceptionHandler.java
index fd493fd89..fef358bb1 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/GlobalControllerExceptionHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/GlobalControllerExceptionHandler.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.web;
+package org.onap.policy.clamp.acm.runtime.main.web;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
-import org.onap.policy.clamp.controlloop.models.rest.RestUtils;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.rest.RestUtils;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.springframework.http.ResponseEntity;
@@ -33,13 +33,13 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
public class GlobalControllerExceptionHandler {
/**
- * Handle ControlLoopException.
+ * Handle AutomationCompositionException.
*
- * @param ex ControlLoopException
+ * @param ex AutomationCompositionException
* @return ResponseEntity
*/
- @ExceptionHandler(ControlLoopException.class)
- public ResponseEntity<SimpleResponse> handleBadRequest(ControlLoopException ex) {
+ @ExceptionHandler(AutomationCompositionException.class)
+ public ResponseEntity<SimpleResponse> handleBadRequest(AutomationCompositionException ex) {
return RestUtils.toSimpleResponse(ex);
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RuntimeErrorController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java
index ac2dba355..5eecb92dd 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RuntimeErrorController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java
@@ -20,14 +20,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.web;
+package org.onap.policy.clamp.acm.runtime.main.web;
import io.swagger.v3.oas.annotations.Hidden;
import java.util.Map;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.TypedSimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/monitoring/MonitoringProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/monitoring/MonitoringProvider.java
new file mode 100644
index 000000000..2950ad9da
--- /dev/null
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/monitoring/MonitoringProvider.java
@@ -0,0 +1,247 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.monitoring;
+
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import lombok.AllArgsConstructor;
+import lombok.NonNull;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatisticsList;
+import org.onap.policy.clamp.models.acm.persistence.provider.AcElementStatisticsProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantStatisticsProvider;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * This class provides information about statistics data of Automation Composition elements and Participants in database
+ * to callers.
+ */
+@Service
+@Transactional
+@AllArgsConstructor
+public class MonitoringProvider {
+
+ private static final String DESC_ORDER = "DESC";
+ private final ParticipantStatisticsProvider participantStatisticsProvider;
+ private final AcElementStatisticsProvider acElementStatisticsProvider;
+ private final AutomationCompositionProvider automationCompositionProvider;
+
+ /**
+ * Create participant statistics.
+ *
+ * @param participantStatistics the participant statistics
+ * @return the result of create operation
+ * @throws PfModelException on creation errors
+ */
+ public ParticipantStatisticsList createParticipantStatistics(List<ParticipantStatistics> participantStatistics)
+ throws PfModelException {
+ var participantStatisticsList = new ParticipantStatisticsList();
+ participantStatisticsList
+ .setStatisticsList(participantStatisticsProvider.createParticipantStatistics(participantStatistics));
+
+ return participantStatisticsList;
+ }
+
+ /**
+ * Create AcElement statistics.
+ *
+ * @param acElementStatisticsList the AcElement statistics
+ * @return the result of create operation
+ * @throws PfModelException on creation errors
+ */
+ public AcElementStatisticsList createAcElementStatistics(List<AcElementStatistics> acElementStatisticsList)
+ throws PfModelException {
+ var elementStatisticsList = new AcElementStatisticsList();
+ elementStatisticsList
+ .setAcElementStatistics(acElementStatisticsProvider.createAcElementStatistics(acElementStatisticsList));
+
+ return elementStatisticsList;
+ }
+
+ /**
+ * Get participant statistics based on specific filters.
+ *
+ * @param name the name of the participant statistics to get, null to get all statistics
+ * @param version the version of the participant statistics to get, null to get all statistics
+ * @param recordCount number of records to be fetched.
+ * @param startTime start of the timestamp, from statistics to be filtered
+ * @param endTime end of the timestamp up to which statistics to be filtered
+ * @return the participant found
+ */
+ @Transactional(readOnly = true)
+ public ParticipantStatisticsList fetchFilteredParticipantStatistics(@NonNull final String name,
+ final String version, int recordCount, Instant startTime, Instant endTime) {
+ var participantStatisticsList = new ParticipantStatisticsList();
+
+ // Additional parameters can be added in filterMap for filtering data.
+ Map<String, Object> filterMap = null;
+ participantStatisticsList.setStatisticsList(participantStatisticsProvider.getFilteredParticipantStatistics(name,
+ version, startTime, endTime, filterMap, DESC_ORDER, recordCount));
+
+ return participantStatisticsList;
+ }
+
+ /**
+ * Get all participant statistics records found for a specific automation composition.
+ *
+ * @param automationCompositionName name of the automation composition
+ * @param automationCompositionVersion version of the automation composition
+ * @return All the participant statistics found
+ * @throws PfModelRuntimeException on errors getting participant statistics
+ */
+ @Transactional(readOnly = true)
+ public ParticipantStatisticsList fetchParticipantStatsPerAutomationComposition(
+ @NonNull final String automationCompositionName, @NonNull final String automationCompositionVersion) {
+ var statisticsList = new ParticipantStatisticsList();
+ List<ParticipantStatistics> participantStatistics = new ArrayList<>();
+ try {
+ // Fetch all participantIds for a specific automation composition
+ List<ToscaConceptIdentifier> participantIds =
+ getAllParticipantIdsPerAutomationComposition(automationCompositionName, automationCompositionVersion);
+ for (ToscaConceptIdentifier id : participantIds) {
+ participantStatistics.addAll(participantStatisticsProvider
+ .getFilteredParticipantStatistics(id.getName(), id.getVersion(), null, null, null, DESC_ORDER, 0));
+ }
+ statisticsList.setStatisticsList(participantStatistics);
+ } catch (PfModelException e) {
+ throw new PfModelRuntimeException(e);
+ }
+ return statisticsList;
+ }
+
+ /**
+ * Get AcElement statistics based on specific filters.
+ *
+ * @param name the name of the AcElement statistics to get, null to get all statistics
+ * @param version the version of the AcElement statistics to get, null to get all statistics
+ * @param id UUID of the automation composition element
+ * @param startTime start of the timestamp, from statistics to be filtered
+ * @param endTime end of the timestamp up to which statistics to be filtered
+ * @param recordCount number of records to be fetched.
+ * @return the participant found
+ * @throws PfModelException on errors getting automation composition statistics
+ */
+ @Transactional(readOnly = true)
+ public AcElementStatisticsList fetchFilteredAcElementStatistics(@NonNull final String name, final String version,
+ final String id, Instant startTime, Instant endTime, int recordCount) throws PfModelException {
+ var acElementStatisticsList = new AcElementStatisticsList();
+ Map<String, Object> filterMap = new HashMap<>();
+ // Adding UUID in filter if present
+ if (id != null) {
+ filterMap.put("localName", id);
+ }
+ acElementStatisticsList.setAcElementStatistics(acElementStatisticsProvider.getFilteredAcElementStatistics(name,
+ version, startTime, endTime, filterMap, DESC_ORDER, recordCount));
+
+ return acElementStatisticsList;
+ }
+
+ /**
+ * Get AcElement statistics per automation composition.
+ *
+ * @param name the name of the automation composition
+ * @param version the version of the automation composition
+ * @return the AcElement statistics found
+ * @throws PfModelRuntimeException on errors getting automation composition statistics
+ */
+ @Transactional(readOnly = true)
+ public AcElementStatisticsList fetchAcElementStatsPerAutomationComposition(@NonNull final String name,
+ @NonNull final String version) {
+ var acElementStatisticsList = new AcElementStatisticsList();
+ List<AcElementStatistics> acElementStats = new ArrayList<>();
+ try {
+ List<AutomationCompositionElement> acElements = new ArrayList<>();
+ // Fetch all automation composition elements for the automation composition
+ var automationCompositionOpt =
+ automationCompositionProvider.findAutomationComposition(new ToscaConceptIdentifier(name, version));
+ if (automationCompositionOpt.isPresent()) {
+ acElements.addAll(automationCompositionOpt.get().getElements().values());
+ // Collect automation composition element statistics for each acElement.
+ for (AutomationCompositionElement acElement : acElements) {
+ acElementStats.addAll(fetchFilteredAcElementStatistics(acElement.getParticipantId().getName(),
+ acElement.getParticipantId().getVersion(), acElement.getId().toString(), null, null, 0)
+ .getAcElementStatistics());
+ }
+ }
+ acElementStatisticsList.setAcElementStatistics(acElementStats);
+ } catch (PfModelException e) {
+ throw new PfModelRuntimeException(e);
+ }
+ return acElementStatisticsList;
+ }
+
+ /**
+ * If required, REST end point can be defined for this method to fetch associated participant Ids
+ * for a automation composition.
+ *
+ * @param name the name of the automation composition
+ * @param version the version of the automation composition
+ * @return List of participant Id
+ * @throws PfModelException on errors
+ */
+ @Transactional(readOnly = true)
+ public List<ToscaConceptIdentifier> getAllParticipantIdsPerAutomationComposition(String name, String version)
+ throws PfModelException {
+ List<ToscaConceptIdentifier> participantIds = new ArrayList<>();
+ var automationCompositionOpt =
+ automationCompositionProvider.findAutomationComposition(new ToscaConceptIdentifier(name, version));
+ if (automationCompositionOpt.isPresent()) {
+ for (AutomationCompositionElement acElement : automationCompositionOpt.get().getElements().values()) {
+ participantIds.add(acElement.getParticipantId());
+ }
+ }
+ return participantIds;
+ }
+
+ /**
+ * If required, REST end point can be defined for this method to fetch associated automation composition element Ids
+ * for a automation composition.
+ *
+ * @param name the name of the automation composition
+ * @param version the version of the automation composition
+ * @return Map of automation composition Id and participant details
+ * @throws PfModelException on errors
+ */
+ @Transactional(readOnly = true)
+ public Map<String, ToscaConceptIdentifier> getAllAcElementsIdPerAutomationComposition(String name, String version)
+ throws PfModelException {
+ Map<String, ToscaConceptIdentifier> acElementId = new HashMap<>();
+ var automationCompositionOpt =
+ automationCompositionProvider.findAutomationComposition(new ToscaConceptIdentifier(name, version));
+ if (automationCompositionOpt.isPresent()) {
+ for (AutomationCompositionElement acElement : automationCompositionOpt.get().getElements().values()) {
+ acElementId.put(acElement.getId().toString(), acElement.getParticipantId());
+ }
+ }
+ return acElementId;
+ }
+}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/HandleCounter.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/HandleCounter.java
index 7e070d700..9949f3c89 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/HandleCounter.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/HandleCounter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision;
+package org.onap.policy.clamp.acm.runtime.supervision;
import java.time.Instant;
import java.util.HashMap;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/MessageIntercept.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/MessageIntercept.java
index c23ed833d..5b861ce96 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/MessageIntercept.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/MessageIntercept.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision;
+package org.onap.policy.clamp.acm.runtime.supervision;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspect.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspect.java
index d975ec6bc..ea851da81 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspect.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspect.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision;
+package org.onap.policy.clamp.acm.runtime.supervision;
import java.io.Closeable;
import java.io.IOException;
@@ -31,9 +31,9 @@ import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
new file mode 100644
index 000000000..055acb28f
--- /dev/null
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
@@ -0,0 +1,518 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.supervision;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import lombok.AllArgsConstructor;
+import org.apache.commons.collections4.CollectionUtils;
+import org.onap.policy.clamp.acm.runtime.monitoring.MonitoringProvider;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantDeregisterAckPublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantRegisterAckPublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantUpdatePublisher;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
+import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
+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;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class handles supervision of automation composition instances, so only one object of this type should be built
+ * at a time.
+ *
+ * <p/>
+ * It is effectively a singleton that is started at system start.
+ */
+@Component
+@AllArgsConstructor
+public class SupervisionHandler {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionHandler.class);
+
+ private static final String AUTOMATION_COMPOSITION_CANNOT_TRANSITION_FROM_STATE =
+ "Automation composition can't transition from state ";
+ private static final String AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE =
+ "Automation composition is already in state ";
+ private static final String TO_STATE = " to state ";
+ private static final String AND_TRANSITIONING_TO_STATE = " and transitioning to state ";
+
+ private final AutomationCompositionProvider automationCompositionProvider;
+ private final ParticipantProvider participantProvider;
+ private final MonitoringProvider monitoringProvider;
+ private final ServiceTemplateProvider serviceTemplateProvider;
+
+ // Publishers for participant communication
+ private final AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher;
+ private final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher;
+ private final ParticipantRegisterAckPublisher participantRegisterAckPublisher;
+ private final ParticipantDeregisterAckPublisher participantDeregisterAckPublisher;
+ private final ParticipantUpdatePublisher participantUpdatePublisher;
+
+ /**
+ * Supervision trigger called when a command is issued on automation compositions.
+ *
+ * <p/>
+ * Causes supervision to start or continue supervision on the automation compositions in question.
+ *
+ * @param automationCompositionIdentifierList the automation compositions for which the supervision command has been
+ * issued
+ * @throws AutomationCompositionException on supervision triggering exceptions
+ */
+ public void triggerAutomationCompositionSupervision(
+ List<ToscaConceptIdentifier> automationCompositionIdentifierList) throws AutomationCompositionException {
+
+ LOGGER.debug("triggering automation composition supervision on automation compositions {}",
+ automationCompositionIdentifierList);
+
+ if (CollectionUtils.isEmpty(automationCompositionIdentifierList)) {
+ // This is just to force throwing of the exception in certain circumstances.
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE,
+ "The list of automation compositions for supervision is empty");
+ }
+
+ for (ToscaConceptIdentifier automationCompositionId : automationCompositionIdentifierList) {
+ try {
+ var automationComposition =
+ automationCompositionProvider.getAutomationComposition(automationCompositionId);
+
+ superviseAutomationComposition(automationComposition);
+
+ automationCompositionProvider.saveAutomationComposition(automationComposition);
+ } catch (PfModelException pfme) {
+ throw new AutomationCompositionException(pfme.getErrorResponse().getResponseCode(), pfme.getMessage(),
+ pfme);
+ }
+ }
+ }
+
+ /**
+ * Handle a ParticipantStatus message from a participant.
+ *
+ * @param participantStatusMessage the ParticipantStatus message received from a participant
+ */
+ @MessageIntercept
+ public void handleParticipantMessage(ParticipantStatus participantStatusMessage) {
+ LOGGER.debug("Participant Status received {}", participantStatusMessage);
+ try {
+ superviseParticipant(participantStatusMessage);
+ } catch (PfModelException | AutomationCompositionException svExc) {
+ LOGGER.warn("error supervising participant {}", participantStatusMessage.getParticipantId(), svExc);
+ return;
+ }
+
+ try {
+ superviseAutomationCompositions(participantStatusMessage);
+ } catch (PfModelException | AutomationCompositionException svExc) {
+ LOGGER.warn("error supervising participant {}", participantStatusMessage.getParticipantId(), svExc);
+ }
+ }
+
+ /**
+ * Handle a ParticipantRegister message from a participant.
+ *
+ * @param participantRegisterMessage the ParticipantRegister message received from a participant
+ */
+ @MessageIntercept
+ public boolean handleParticipantMessage(ParticipantRegister participantRegisterMessage) {
+ LOGGER.debug("Participant Register received {}", participantRegisterMessage);
+ try {
+ checkParticipant(participantRegisterMessage, ParticipantState.UNKNOWN, ParticipantHealthStatus.UNKNOWN);
+ } catch (PfModelException | AutomationCompositionException svExc) {
+ LOGGER.warn("error saving participant {}", participantRegisterMessage.getParticipantId(), svExc);
+ }
+
+ var isCommissioning = participantUpdatePublisher.sendCommissioning(null, null,
+ participantRegisterMessage.getParticipantId(), participantRegisterMessage.getParticipantType());
+
+ participantRegisterAckPublisher.send(participantRegisterMessage.getMessageId(),
+ participantRegisterMessage.getParticipantId(), participantRegisterMessage.getParticipantType());
+ return isCommissioning;
+ }
+
+ /**
+ * Handle a ParticipantDeregister message from a participant.
+ *
+ * @param participantDeregisterMessage the ParticipantDeregister message received from a participant
+ */
+ @MessageIntercept
+ public void handleParticipantMessage(ParticipantDeregister participantDeregisterMessage) {
+ LOGGER.debug("Participant Deregister received {}", participantDeregisterMessage);
+ try {
+ var participantOpt =
+ participantProvider.findParticipant(participantDeregisterMessage.getParticipantId().getName(),
+ participantDeregisterMessage.getParticipantId().getVersion());
+
+ if (participantOpt.isPresent()) {
+ var participant = participantOpt.get();
+ participant.setParticipantState(ParticipantState.TERMINATED);
+ participant.setHealthStatus(ParticipantHealthStatus.OFF_LINE);
+ participantProvider.saveParticipant(participant);
+ }
+ } catch (PfModelException pfme) {
+ LOGGER.warn("Model exception occured with participant id {}",
+ participantDeregisterMessage.getParticipantId());
+ }
+
+ participantDeregisterAckPublisher.send(participantDeregisterMessage.getMessageId());
+ }
+
+ /**
+ * Handle a ParticipantUpdateAck message from a participant.
+ *
+ * @param participantUpdateAckMessage the ParticipantUpdateAck message received from a participant
+ */
+ @MessageIntercept
+ public void handleParticipantMessage(ParticipantUpdateAck participantUpdateAckMessage) {
+ LOGGER.debug("Participant Update Ack received {}", participantUpdateAckMessage);
+ try {
+ var participantOpt =
+ participantProvider.findParticipant(participantUpdateAckMessage.getParticipantId().getName(),
+ participantUpdateAckMessage.getParticipantId().getVersion());
+
+ if (participantOpt.isPresent()) {
+ var participant = participantOpt.get();
+ participant.setParticipantState(participantUpdateAckMessage.getState());
+ participantProvider.saveParticipant(participant);
+ } else {
+ LOGGER.warn("Participant not found in database {}", participantUpdateAckMessage.getParticipantId());
+ }
+ } catch (PfModelException pfme) {
+ LOGGER.warn("Model exception occured with participant id {}",
+ participantUpdateAckMessage.getParticipantId());
+ }
+ }
+
+ /**
+ * Send commissioning update message to dmaap.
+ *
+ * @param name the ToscaServiceTemplate name
+ * @param version the ToscaServiceTemplate version
+ */
+ public void handleSendCommissionMessage(String name, String version) {
+ LOGGER.debug("Participant update message with serviveTemplate {} {} being sent to all participants", name,
+ version);
+ participantUpdatePublisher.sendComissioningBroadcast(name, version);
+ }
+
+ /**
+ * Send decommissioning update message to dmaap.
+ *
+ */
+ public void handleSendDeCommissionMessage() {
+ LOGGER.debug("Participant update message being sent");
+ participantUpdatePublisher.sendDecomisioning();
+ }
+
+ /**
+ * Handle a AutomationComposition update acknowledge message from a participant.
+ *
+ * @param automationCompositionAckMessage the AutomationCompositionAck message received from a participant
+ */
+ @MessageIntercept
+ public void handleAutomationCompositionUpdateAckMessage(AutomationCompositionAck automationCompositionAckMessage) {
+ LOGGER.debug("AutomationComposition Update Ack message received {}", automationCompositionAckMessage);
+ setAcElementStateInDb(automationCompositionAckMessage);
+ }
+
+ /**
+ * Handle a AutomationComposition statechange acknowledge message from a participant.
+ *
+ * @param automationCompositionAckMessage the AutomationCompositionAck message received from a participant
+ */
+ @MessageIntercept
+ public void handleAutomationCompositionStateChangeAckMessage(
+ AutomationCompositionAck automationCompositionAckMessage) {
+ LOGGER.debug("AutomationComposition StateChange Ack message received {}", automationCompositionAckMessage);
+ setAcElementStateInDb(automationCompositionAckMessage);
+ }
+
+ private void setAcElementStateInDb(AutomationCompositionAck automationCompositionAckMessage) {
+ if (automationCompositionAckMessage.getAutomationCompositionResultMap() != null) {
+ try {
+ var automationComposition = automationCompositionProvider
+ .getAutomationComposition(automationCompositionAckMessage.getAutomationCompositionId());
+ if (automationComposition != null) {
+ var updated = updateState(automationComposition,
+ automationCompositionAckMessage.getAutomationCompositionResultMap().entrySet());
+ updated |= setPrimed(automationComposition);
+ if (updated) {
+ automationCompositionProvider.saveAutomationComposition(automationComposition);
+ }
+ } else {
+ LOGGER.warn("AutomationComposition not found in database {}",
+ automationCompositionAckMessage.getAutomationCompositionId());
+ }
+ } catch (PfModelException pfme) {
+ LOGGER.warn("Model exception occured with AutomationComposition Id {}",
+ automationCompositionAckMessage.getAutomationCompositionId());
+ }
+ }
+ }
+
+ private boolean updateState(AutomationComposition automationComposition,
+ Set<Map.Entry<UUID, AutomationCompositionElementAck>> automationCompositionResultSet) {
+ var updated = false;
+ for (var acElementAck : automationCompositionResultSet) {
+ var element = automationComposition.getElements().get(acElementAck.getKey());
+ if (element != null) {
+ element.setState(acElementAck.getValue().getState());
+ updated = true;
+ }
+ }
+ return updated;
+ }
+
+ private boolean setPrimed(AutomationComposition automationComposition) {
+ var acElements = automationComposition.getElements().values();
+ if (acElements != null) {
+ Boolean primedFlag = true;
+ var checkOpt = automationComposition.getElements().values().stream()
+ .filter(acElement -> (!acElement.getState().equals(AutomationCompositionState.PASSIVE)
+ || !acElement.getState().equals(AutomationCompositionState.RUNNING)))
+ .findAny();
+ if (checkOpt.isEmpty()) {
+ primedFlag = false;
+ }
+ automationComposition.setPrimed(primedFlag);
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Supervise a automation composition, performing whatever actions need to be performed on the automation
+ * composition.
+ *
+ * @param automationComposition the automation composition to supervises
+ * @throws AutomationCompositionException on supervision errors
+ */
+ private void superviseAutomationComposition(AutomationComposition automationComposition)
+ throws AutomationCompositionException {
+ switch (automationComposition.getOrderedState()) {
+ case UNINITIALISED:
+ superviseAutomationCompositionUninitialization(automationComposition);
+ break;
+
+ case PASSIVE:
+ superviseAutomationCompositionPassivation(automationComposition);
+ break;
+
+ case RUNNING:
+ superviseAutomationCompositionActivation(automationComposition);
+ break;
+
+ default:
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE,
+ "A automation composition cannot be commanded to go into state "
+ + automationComposition.getOrderedState().name());
+ }
+ }
+
+ /**
+ * Supervise a automation composition uninitialisation, performing whatever actions need to be performed on the
+ * automation composition,
+ * automation composition ordered state is UNINITIALIZED.
+ *
+ * @param automationComposition the automation composition to supervises
+ * @throws AutomationCompositionException on supervision errors
+ */
+ private void superviseAutomationCompositionUninitialization(AutomationComposition automationComposition)
+ throws AutomationCompositionException {
+ switch (automationComposition.getState()) {
+ case UNINITIALISED:
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE,
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name());
+ break;
+
+ case UNINITIALISED2PASSIVE:
+ case PASSIVE:
+ automationComposition.setState(AutomationCompositionState.PASSIVE2UNINITIALISED);
+ automationCompositionStateChangePublisher.send(automationComposition,
+ getFirstStartPhase(automationComposition));
+ break;
+
+ case PASSIVE2UNINITIALISED:
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE,
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name()
+ + AND_TRANSITIONING_TO_STATE + automationComposition.getOrderedState());
+ break;
+
+ default:
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE, AUTOMATION_COMPOSITION_CANNOT_TRANSITION_FROM_STATE
+ + automationComposition.getState().name() + TO_STATE + automationComposition.getOrderedState());
+ break;
+ }
+ }
+
+ private void superviseAutomationCompositionPassivation(AutomationComposition automationComposition)
+ throws AutomationCompositionException {
+ switch (automationComposition.getState()) {
+ case PASSIVE:
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE,
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name());
+ break;
+ case UNINITIALISED:
+ automationComposition.setState(AutomationCompositionState.UNINITIALISED2PASSIVE);
+ automationCompositionUpdatePublisher.send(automationComposition);
+ break;
+
+ case UNINITIALISED2PASSIVE:
+ case RUNNING2PASSIVE:
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE,
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name()
+ + AND_TRANSITIONING_TO_STATE + automationComposition.getOrderedState());
+ break;
+
+ case RUNNING:
+ automationComposition.setState(AutomationCompositionState.RUNNING2PASSIVE);
+ automationCompositionStateChangePublisher.send(automationComposition,
+ getFirstStartPhase(automationComposition));
+ break;
+
+ default:
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE, AUTOMATION_COMPOSITION_CANNOT_TRANSITION_FROM_STATE
+ + automationComposition.getState().name() + TO_STATE + automationComposition.getOrderedState());
+ break;
+ }
+ }
+
+ private void superviseAutomationCompositionActivation(AutomationComposition automationComposition)
+ throws AutomationCompositionException {
+ switch (automationComposition.getState()) {
+ case RUNNING:
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE,
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name());
+ break;
+
+ case PASSIVE2RUNNING:
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE,
+ AUTOMATION_COMPOSITION_IS_ALREADY_IN_STATE + automationComposition.getState().name()
+ + AND_TRANSITIONING_TO_STATE + automationComposition.getOrderedState());
+ break;
+
+ case PASSIVE:
+ automationComposition.setState(AutomationCompositionState.PASSIVE2RUNNING);
+ automationCompositionStateChangePublisher.send(automationComposition,
+ getFirstStartPhase(automationComposition));
+ break;
+
+ default:
+ exceptionOccured(Response.Status.NOT_ACCEPTABLE, AUTOMATION_COMPOSITION_CANNOT_TRANSITION_FROM_STATE
+ + automationComposition.getState().name() + TO_STATE + automationComposition.getOrderedState());
+ break;
+ }
+ }
+
+ private int getFirstStartPhase(AutomationComposition automationComposition) {
+ ToscaServiceTemplate toscaServiceTemplate = null;
+ try {
+ toscaServiceTemplate = serviceTemplateProvider.getAllServiceTemplates().get(0);
+ } catch (PfModelException e) {
+ throw new PfModelRuntimeException(Status.BAD_REQUEST, "Canont load ToscaServiceTemplate from DB", e);
+ }
+ return ParticipantUtils.getFirstStartPhase(automationComposition, toscaServiceTemplate);
+ }
+
+ private void checkParticipant(ParticipantMessage participantMessage, ParticipantState participantState,
+ ParticipantHealthStatus healthStatus) throws AutomationCompositionException, PfModelException {
+ if (participantMessage.getParticipantId() == null) {
+ exceptionOccured(Response.Status.NOT_FOUND, "Participant ID on PARTICIPANT_STATUS message is null");
+ }
+ var participantOpt = participantProvider.findParticipant(participantMessage.getParticipantId().getName(),
+ participantMessage.getParticipantId().getVersion());
+
+ if (participantOpt.isEmpty()) {
+ var participant = new Participant();
+ participant.setName(participantMessage.getParticipantId().getName());
+ participant.setVersion(participantMessage.getParticipantId().getVersion());
+ participant.setDefinition(participantMessage.getParticipantId());
+ participant.setParticipantType(participantMessage.getParticipantType());
+ participant.setParticipantState(participantState);
+ participant.setHealthStatus(healthStatus);
+
+ participantProvider.saveParticipant(participant);
+ } else {
+ var participant = participantOpt.get();
+ participant.setParticipantState(participantState);
+ participant.setHealthStatus(healthStatus);
+
+ participantProvider.saveParticipant(participant);
+ }
+ }
+
+ private void superviseParticipant(ParticipantStatus participantStatusMessage)
+ throws PfModelException, AutomationCompositionException {
+
+ checkParticipant(participantStatusMessage, participantStatusMessage.getState(),
+ participantStatusMessage.getHealthStatus());
+
+ monitoringProvider.createParticipantStatistics(List.of(participantStatusMessage.getParticipantStatistics()));
+ }
+
+ private void superviseAutomationCompositions(ParticipantStatus participantStatusMessage)
+ throws PfModelException, AutomationCompositionException {
+ if (participantStatusMessage.getAutomationCompositionInfoList() != null) {
+ for (AutomationCompositionInfo acEntry : participantStatusMessage.getAutomationCompositionInfoList()) {
+ var dbAutomationComposition = automationCompositionProvider
+ .getAutomationComposition(new ToscaConceptIdentifier(acEntry.getAutomationCompositionId()));
+ if (dbAutomationComposition == null) {
+ exceptionOccured(Response.Status.NOT_FOUND,
+ "PARTICIPANT_STATUS automation composition not found in database: "
+ + acEntry.getAutomationCompositionId());
+ }
+ dbAutomationComposition.setState(acEntry.getState());
+ monitoringProvider.createAcElementStatistics(
+ acEntry.getAutomationCompositionStatistics().getAcElementStatisticsList().getAcElementStatistics());
+ }
+ }
+ }
+
+ private void exceptionOccured(Response.Status status, String reason) throws AutomationCompositionException {
+ throw new AutomationCompositionException(status, reason);
+ }
+}
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
new file mode 100644
index 000000000..ce7195d93
--- /dev/null
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
@@ -0,0 +1,307 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.supervision;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.lang3.tuple.Pair;
+import org.onap.policy.clamp.acm.runtime.main.parameters.AcRuntimeParameterGroup;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantStatusReqPublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantUpdatePublisher;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
+import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class is used to scan the automation compositions in the database and check if they are in the correct state.
+ */
+@Component
+public class SupervisionScanner {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionScanner.class);
+
+ private final HandleCounter<ToscaConceptIdentifier> automationCompositionCounter = new HandleCounter<>();
+ private final HandleCounter<ToscaConceptIdentifier> participantStatusCounter = new HandleCounter<>();
+ private final HandleCounter<Pair<ToscaConceptIdentifier, ToscaConceptIdentifier>> participantUpdateCounter =
+ new HandleCounter<>();
+
+ private final Map<ToscaConceptIdentifier, Integer> phaseMap = new HashMap<>();
+
+ private final AutomationCompositionProvider automationCompositionProvider;
+ private final ServiceTemplateProvider serviceTemplateProvider;
+ private final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher;
+ private final AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher;
+ private final ParticipantProvider participantProvider;
+ private final ParticipantStatusReqPublisher participantStatusReqPublisher;
+ private final ParticipantUpdatePublisher participantUpdatePublisher;
+
+ /**
+ * Constructor for instantiating SupervisionScanner.
+ *
+ * @param automationCompositionProvider the provider to use to read automation compositions from the database
+ * @param serviceTemplateProvider the Policy Models Provider
+ * @param automationCompositionStateChangePublisher the AutomationComposition StateChange Publisher
+ * @param automationCompositionUpdatePublisher the AutomationCompositionUpdate Publisher
+ * @param participantProvider the Participant Provider
+ * @param participantStatusReqPublisher the Participant StatusReq Publisher
+ * @param participantUpdatePublisher the Participant Update Publisher
+ * @param acRuntimeParameterGroup the parameters for the automation composition runtime
+ */
+ public SupervisionScanner(final AutomationCompositionProvider automationCompositionProvider,
+ ServiceTemplateProvider serviceTemplateProvider,
+ final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher,
+ AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher,
+ ParticipantProvider participantProvider, ParticipantStatusReqPublisher participantStatusReqPublisher,
+ ParticipantUpdatePublisher participantUpdatePublisher, final AcRuntimeParameterGroup acRuntimeParameterGroup) {
+ this.automationCompositionProvider = automationCompositionProvider;
+ this.serviceTemplateProvider = serviceTemplateProvider;
+ this.automationCompositionStateChangePublisher = automationCompositionStateChangePublisher;
+ this.automationCompositionUpdatePublisher = automationCompositionUpdatePublisher;
+ this.participantProvider = participantProvider;
+ this.participantStatusReqPublisher = participantStatusReqPublisher;
+ this.participantUpdatePublisher = participantUpdatePublisher;
+
+ automationCompositionCounter.setMaxRetryCount(
+ acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
+ automationCompositionCounter
+ .setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs());
+
+ participantUpdateCounter.setMaxRetryCount(
+ acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
+ participantUpdateCounter
+ .setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxWaitMs());
+
+ participantStatusCounter.setMaxRetryCount(
+ acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
+ participantStatusCounter.setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs());
+ }
+
+ /**
+ * Run Scanning.
+ *
+ * @param counterCheck if true activate counter and retry
+ */
+ public void run(boolean counterCheck) {
+ LOGGER.debug("Scanning automation compositions in the database . . .");
+
+ if (counterCheck) {
+ try {
+ for (var participant : participantProvider.getParticipants()) {
+ scanParticipantStatus(participant);
+ }
+ } catch (PfModelException pfme) {
+ LOGGER.warn("error reading participant from database", pfme);
+ return;
+ }
+ }
+
+ try {
+ var list = serviceTemplateProvider.getAllServiceTemplates();
+ if (list != null && !list.isEmpty()) {
+ ToscaServiceTemplate toscaServiceTemplate = list.get(0);
+
+ for (AutomationComposition automationComposition : automationCompositionProvider
+ .getAutomationCompositions()) {
+ scanAutomationComposition(automationComposition, toscaServiceTemplate, counterCheck);
+ }
+ }
+ } catch (PfModelException pfme) {
+ LOGGER.warn("error reading automation compositions from database", pfme);
+ }
+
+ if (counterCheck) {
+ scanParticipantUpdate();
+ }
+
+ LOGGER.debug("Automation composition scan complete . . .");
+ }
+
+ private void scanParticipantUpdate() {
+ LOGGER.debug("Scanning participants to update . . .");
+
+ for (var id : participantUpdateCounter.keySet()) {
+ if (participantUpdateCounter.isFault(id)) {
+ LOGGER.debug("report Participant Update fault");
+
+ } else if (participantUpdateCounter.getDuration(id) > participantUpdateCounter.getMaxWaitMs()) {
+
+ if (participantUpdateCounter.count(id)) {
+ LOGGER.debug("retry message ParticipantUpdate");
+ participantUpdatePublisher.sendCommissioning(null, null, id.getLeft(), id.getRight());
+ } else {
+ LOGGER.debug("report Participant Update fault");
+ participantUpdateCounter.setFault(id);
+ }
+ }
+ }
+
+ LOGGER.debug("Participants to update scan complete . . .");
+ }
+
+ private void scanParticipantStatus(Participant participant) throws PfModelException {
+ ToscaConceptIdentifier id = participant.getKey().asIdentifier();
+ if (participantStatusCounter.isFault(id)) {
+ LOGGER.debug("report Participant fault");
+ return;
+ }
+ if (participantStatusCounter.getDuration(id) > participantStatusCounter.getMaxWaitMs()) {
+ if (participantStatusCounter.count(id)) {
+ LOGGER.debug("retry message ParticipantStatusReq");
+ participantStatusReqPublisher.send(id);
+ participant.setHealthStatus(ParticipantHealthStatus.NOT_HEALTHY);
+ } else {
+ LOGGER.debug("report Participant fault");
+ participantStatusCounter.setFault(id);
+ participant.setHealthStatus(ParticipantHealthStatus.OFF_LINE);
+ }
+ participantProvider.saveParticipant(participant);
+ }
+ }
+
+ /**
+ * handle participant Status message.
+ */
+ public void handleParticipantStatus(ToscaConceptIdentifier id) {
+ participantStatusCounter.clear(id);
+ }
+
+ public void handleParticipantRegister(Pair<ToscaConceptIdentifier, ToscaConceptIdentifier> id) {
+ participantUpdateCounter.clear(id);
+ }
+
+ public void handleParticipantUpdateAck(Pair<ToscaConceptIdentifier, ToscaConceptIdentifier> id) {
+ participantUpdateCounter.remove(id);
+ }
+
+ private void scanAutomationComposition(final AutomationComposition automationComposition,
+ ToscaServiceTemplate toscaServiceTemplate, boolean counterCheck) throws PfModelException {
+ LOGGER.debug("scanning automation composition {} . . .", automationComposition.getKey().asIdentifier());
+
+ if (automationComposition.getState().equals(automationComposition.getOrderedState().asState())) {
+ LOGGER.debug("automation composition {} scanned, OK", automationComposition.getKey().asIdentifier());
+
+ // Clear missed report counter on automation composition
+ clearFaultAndCounter(automationComposition);
+ return;
+ }
+
+ var completed = true;
+ var minSpNotCompleted = 1000; // min startPhase not completed
+ var maxSpNotCompleted = 0; // max startPhase not completed
+ var defaultMin = 1000; // min startPhase
+ var defaultMax = 0; // max startPhase
+ for (AutomationCompositionElement element : automationComposition.getElements().values()) {
+ ToscaNodeTemplate toscaNodeTemplate = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates()
+ .get(element.getDefinition().getName());
+ int startPhase = ParticipantUtils.findStartPhase(toscaNodeTemplate.getProperties());
+ defaultMin = Math.min(defaultMin, startPhase);
+ defaultMax = Math.max(defaultMax, startPhase);
+ if (!element.getState().equals(element.getOrderedState().asState())) {
+ completed = false;
+ minSpNotCompleted = Math.min(minSpNotCompleted, startPhase);
+ maxSpNotCompleted = Math.max(maxSpNotCompleted, startPhase);
+ }
+ }
+
+ if (completed) {
+ LOGGER.debug("automation composition scan: transition from state {} to {} completed",
+ automationComposition.getState(), automationComposition.getOrderedState());
+
+ automationComposition.setState(automationComposition.getOrderedState().asState());
+ automationCompositionProvider.saveAutomationComposition(automationComposition);
+
+ // Clear missed report counter on automation composition
+ clearFaultAndCounter(automationComposition);
+ } else {
+ LOGGER.debug("automation composition scan: transition from state {} to {} not completed",
+ automationComposition.getState(), automationComposition.getOrderedState());
+
+ var nextSpNotCompleted =
+ AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
+ || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState())
+ ? minSpNotCompleted
+ : maxSpNotCompleted;
+
+ var firstStartPhase =
+ AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
+ || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState()) ? defaultMin
+ : defaultMax;
+
+ if (nextSpNotCompleted != phaseMap.getOrDefault(automationComposition.getKey().asIdentifier(),
+ firstStartPhase)) {
+ phaseMap.put(automationComposition.getKey().asIdentifier(), nextSpNotCompleted);
+ sendAutomationCompositionMsg(automationComposition, nextSpNotCompleted);
+ } else if (counterCheck) {
+ phaseMap.put(automationComposition.getKey().asIdentifier(), nextSpNotCompleted);
+ handleCounter(automationComposition, nextSpNotCompleted);
+ }
+ }
+ }
+
+ private void clearFaultAndCounter(AutomationComposition automationComposition) {
+ automationCompositionCounter.clear(automationComposition.getKey().asIdentifier());
+ phaseMap.clear();
+ }
+
+ private void handleCounter(AutomationComposition automationComposition, int startPhase) {
+ ToscaConceptIdentifier id = automationComposition.getKey().asIdentifier();
+ if (automationCompositionCounter.isFault(id)) {
+ LOGGER.debug("report AutomationComposition fault");
+ return;
+ }
+
+ if (automationCompositionCounter.getDuration(id) > automationCompositionCounter.getMaxWaitMs()) {
+ if (automationCompositionCounter.count(id)) {
+ phaseMap.put(id, startPhase);
+ sendAutomationCompositionMsg(automationComposition, startPhase);
+ } else {
+ LOGGER.debug("report AutomationComposition fault");
+ automationCompositionCounter.setFault(id);
+ }
+ }
+ }
+
+ private void sendAutomationCompositionMsg(AutomationComposition automationComposition, int startPhase) {
+ if (AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())) {
+ LOGGER.debug("retry message AutomationCompositionUpdate");
+ automationCompositionUpdatePublisher.send(automationComposition, startPhase);
+ } else {
+ LOGGER.debug("retry message AutomationCompositionStateChange");
+ automationCompositionStateChangePublisher.send(automationComposition, startPhase);
+ }
+ }
+}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/AbstractParticipantAckPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantAckPublisher.java
index 4b4ca9915..22284a4eb 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/AbstractParticipantAckPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantAckPublisher.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
import java.util.List;
import javax.ws.rs.core.Response.Status;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantAckMessage;
-import org.onap.policy.clamp.controlloop.runtime.config.messaging.Publisher;
+import org.onap.policy.clamp.acm.runtime.config.messaging.Publisher;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
@@ -40,7 +40,7 @@ public abstract class AbstractParticipantAckPublisher<E extends ParticipantAckMe
*/
public void send(final E participantMessage) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, "Not Active!");
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, "Not Active!");
}
topicSinkClient.send(participantMessage);
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/AbstractParticipantPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantPublisher.java
index 3c87b05b4..054eaf7b5 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/AbstractParticipantPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantPublisher.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
import java.util.List;
import javax.ws.rs.core.Response.Status;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage;
-import org.onap.policy.clamp.controlloop.runtime.config.messaging.Publisher;
+import org.onap.policy.clamp.acm.runtime.config.messaging.Publisher;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
@@ -40,7 +40,7 @@ public abstract class AbstractParticipantPublisher<E extends ParticipantMessage>
*/
public void send(final E participantMessage) {
if (!active) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, "Not Active!");
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, "Not Active!");
}
topicSinkClient.send(participantMessage);
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangeAckListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java
index c40095bef..dd07be680 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangeAckListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java
@@ -19,12 +19,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.runtime.config.messaging.Listener;
-import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.acm.runtime.config.messaging.Listener;
+import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
@@ -33,36 +33,38 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
- * Listener for ControlLoopStateChangeAck messages sent by participants.
+ * Listener for AutomationCompositionStateChangeAck messages sent by participants.
*/
@Component
-public class ControlLoopStateChangeAckListener extends ScoListener<ControlLoopAck> implements Listener<ControlLoopAck> {
- private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopStateChangeAckListener.class);
+public class AutomationCompositionStateChangeAckListener extends ScoListener<AutomationCompositionAck>
+ implements Listener<AutomationCompositionAck> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionStateChangeAckListener.class);
private final SupervisionHandler supervisionHandler;
/**
* Constructs the object.
*/
- public ControlLoopStateChangeAckListener(SupervisionHandler supervisionHandler) {
- super(ControlLoopAck.class);
+ public AutomationCompositionStateChangeAckListener(SupervisionHandler supervisionHandler) {
+ super(AutomationCompositionAck.class);
this.supervisionHandler = supervisionHandler;
}
@Override
public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
- final ControlLoopAck controlLoopStateChangeAckMessage) {
- LOGGER.debug("ControlLoopStateChangeAck received from participant - {}", controlLoopStateChangeAckMessage);
- supervisionHandler.handleControlLoopStateChangeAckMessage(controlLoopStateChangeAckMessage);
+ final AutomationCompositionAck automationCompositionStateChangeAckMessage) {
+ LOGGER.debug("AutomationCompositionStateChangeAck received from participant - {}",
+ automationCompositionStateChangeAckMessage);
+ supervisionHandler.handleAutomationCompositionStateChangeAckMessage(automationCompositionStateChangeAckMessage);
}
@Override
- public ScoListener<ControlLoopAck> getScoListener() {
+ public ScoListener<AutomationCompositionAck> getScoListener() {
return this;
}
@Override
public String getType() {
- return ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK.name();
+ return ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK.name();
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java
index 69d7b73d0..4e0d12bf6 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopStateChangePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java
@@ -18,33 +18,33 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
import org.springframework.stereotype.Component;
/**
- * This class is used to send ControlLoopStateChangePublisher messages to participants on DMaaP.
+ * This class is used to send AutomationCompositionStateChangePublisher messages to participants on DMaaP.
*/
@Component
-public class ControlLoopStateChangePublisher
- extends AbstractParticipantPublisher<ControlLoopStateChange> {
+public class AutomationCompositionStateChangePublisher
+ extends AbstractParticipantPublisher<AutomationCompositionStateChange> {
/**
- * Send ControlLoopStateChange to Participant.
+ * Send AutomationCompositionStateChange to Participant.
*
- * @param controlLoop the ControlLoop
+ * @param automationComposition the AutomationComposition
* @param startPhase the startPhase
*/
- public void send(ControlLoop controlLoop, int startPhase) {
- var clsc = new ControlLoopStateChange();
- clsc.setControlLoopId(controlLoop.getKey().asIdentifier());
- clsc.setMessageId(UUID.randomUUID());
- clsc.setOrderedState(controlLoop.getOrderedState());
- clsc.setStartPhase(startPhase);
+ public void send(AutomationComposition automationComposition, int startPhase) {
+ var acsc = new AutomationCompositionStateChange();
+ acsc.setAutomationCompositionId(automationComposition.getKey().asIdentifier());
+ acsc.setMessageId(UUID.randomUUID());
+ acsc.setOrderedState(automationComposition.getOrderedState());
+ acsc.setStartPhase(startPhase);
- super.send(clsc);
+ super.send(acsc);
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdateAckListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java
index b8b5126ad..7a1d5294c 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdateAckListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java
@@ -19,12 +19,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.runtime.config.messaging.Listener;
-import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.acm.runtime.config.messaging.Listener;
+import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
@@ -33,36 +33,38 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
- * Listener for ControlLoopUpdateAck messages sent by participants.
+ * Listener for AutomationCompositionUpdateAck messages sent by participants.
*/
@Component
-public class ControlLoopUpdateAckListener extends ScoListener<ControlLoopAck> implements Listener<ControlLoopAck> {
- private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopUpdateAckListener.class);
+public class AutomationCompositionUpdateAckListener extends ScoListener<AutomationCompositionAck>
+ implements Listener<AutomationCompositionAck> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionUpdateAckListener.class);
private final SupervisionHandler supervisionHandler;
/**
* Constructs the object.
*/
- public ControlLoopUpdateAckListener(SupervisionHandler supervisionHandler) {
- super(ControlLoopAck.class);
+ public AutomationCompositionUpdateAckListener(SupervisionHandler supervisionHandler) {
+ super(AutomationCompositionAck.class);
this.supervisionHandler = supervisionHandler;
}
@Override
public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
- final ControlLoopAck controlLoopUpdateAckMessage) {
- LOGGER.debug("ControlLoopUpdateAck message received from participant - {}", controlLoopUpdateAckMessage);
- supervisionHandler.handleControlLoopUpdateAckMessage(controlLoopUpdateAckMessage);
+ final AutomationCompositionAck automationCompositionUpdateAckMessage) {
+ LOGGER.debug("AutomationCompositionUpdateAck message received from participant - {}",
+ automationCompositionUpdateAckMessage);
+ supervisionHandler.handleAutomationCompositionUpdateAckMessage(automationCompositionUpdateAckMessage);
}
@Override
- public ScoListener<ControlLoopAck> getScoListener() {
+ public ScoListener<AutomationCompositionAck> getScoListener() {
return this;
}
@Override
public String getType() {
- return ParticipantMessageType.CONTROLLOOP_UPDATE_ACK.name();
+ return ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK.name();
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
index 24f60eafc..ac5a998b4 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
@@ -20,19 +20,19 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import lombok.AllArgsConstructor;
-import org.onap.policy.clamp.controlloop.common.utils.CommonUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
+import org.onap.policy.clamp.models.acm.utils.AcmUtils;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
@@ -40,36 +40,36 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
- * This class is used to send ControlLoopUpdate messages to participants on DMaaP.
+ * This class is used to send AutomationCompositionUpdate messages to participants on DMaaP.
*/
@Component
@AllArgsConstructor
-public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<ControlLoopUpdate> {
+public class AutomationCompositionUpdatePublisher extends AbstractParticipantPublisher<AutomationCompositionUpdate> {
- private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopUpdatePublisher.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionUpdatePublisher.class);
private final ServiceTemplateProvider serviceTemplateProvider;
/**
- * Send ControlLoopUpdate to Participant.
+ * Send AutomationCompositionUpdate to Participant.
*
- * @param controlLoop the ControlLoop
+ * @param automationComposition the AutomationComposition
*/
- public void send(ControlLoop controlLoop) {
- send(controlLoop, 0);
+ public void send(AutomationComposition automationComposition) {
+ send(automationComposition, 0);
}
/**
- * Send ControlLoopUpdate to Participant.
+ * Send AutomationCompositionUpdate to Participant.
*
- * @param controlLoop the ControlLoop
+ * @param automationComposition the AutomationComposition
* @param startPhase the Start Phase
*/
- public void send(ControlLoop controlLoop, int startPhase) {
- var controlLoopUpdateMsg = new ControlLoopUpdate();
- controlLoopUpdateMsg.setStartPhase(startPhase);
- controlLoopUpdateMsg.setControlLoopId(controlLoop.getKey().asIdentifier());
- controlLoopUpdateMsg.setMessageId(UUID.randomUUID());
- controlLoopUpdateMsg.setTimestamp(Instant.now());
+ public void send(AutomationComposition automationComposition, int startPhase) {
+ var automationCompositionUpdateMsg = new AutomationCompositionUpdate();
+ automationCompositionUpdateMsg.setStartPhase(startPhase);
+ automationCompositionUpdateMsg.setAutomationCompositionId(automationComposition.getKey().asIdentifier());
+ automationCompositionUpdateMsg.setMessageId(UUID.randomUUID());
+ automationCompositionUpdateMsg.setTimestamp(Instant.now());
ToscaServiceTemplate toscaServiceTemplate;
try {
toscaServiceTemplate = serviceTemplateProvider.getAllServiceTemplates().get(0);
@@ -79,13 +79,13 @@ public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<Con
}
List<ParticipantUpdates> participantUpdates = new ArrayList<>();
- for (ControlLoopElement element : controlLoop.getElements().values()) {
- CommonUtils.setServiceTemplatePolicyInfo(element, toscaServiceTemplate);
- CommonUtils.prepareParticipantUpdate(element, participantUpdates);
+ for (AutomationCompositionElement element : automationComposition.getElements().values()) {
+ AcmUtils.setServiceTemplatePolicyInfo(element, toscaServiceTemplate);
+ AcmUtils.prepareParticipantUpdate(element, participantUpdates);
}
- controlLoopUpdateMsg.setParticipantUpdatesList(participantUpdates);
+ automationCompositionUpdateMsg.setParticipantUpdatesList(participantUpdates);
- LOGGER.debug("ControlLoopUpdate message sent {}", controlLoopUpdateMsg);
- super.send(controlLoopUpdateMsg);
+ LOGGER.debug("AutomationCompositionUpdate message sent {}", automationCompositionUpdateMsg);
+ super.send(automationCompositionUpdateMsg);
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java
index e92b6ee1b..34881b557 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
import org.springframework.stereotype.Component;
/**
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterListener.java
index b8b209bac..eec21235f 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantDeregisterListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterListener.java
@@ -19,12 +19,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.runtime.config.messaging.Listener;
-import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.acm.runtime.config.messaging.Listener;
+import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterAckPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
index 8cbaec8b1..8344837c1 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.springframework.stereotype.Component;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterListener.java
index fdf0bf3f7..852340000 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantRegisterListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterListener.java
@@ -19,12 +19,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.runtime.config.messaging.Listener;
-import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.acm.runtime.config.messaging.Listener;
+import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStatusListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusListener.java
index 43a07e220..4ae1a1a2d 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStatusListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusListener.java
@@ -19,12 +19,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.runtime.config.messaging.Listener;
-import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.acm.runtime.config.messaging.Listener;
+import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStatusReqPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
index 69d598285..0de8ff063 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStatusReqPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
import java.time.Instant;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatusReq;
+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;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdateAckListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdateAckListener.java
index fcfa80a9f..d75de775b 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdateAckListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdateAckListener.java
@@ -19,12 +19,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.runtime.config.messaging.Listener;
-import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.acm.runtime.config.messaging.Listener;
+import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
index c6788f12c..47a66c10e 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
@@ -20,18 +20,18 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import lombok.AllArgsConstructor;
-import org.onap.policy.clamp.controlloop.common.utils.CommonUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
+import org.onap.policy.clamp.models.acm.utils.AcmUtils;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeType;
@@ -96,16 +96,16 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
for (var toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates().entrySet()) {
- if (ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(),
+ if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(),
toscaServiceTemplate)) {
- CommonUtils.prepareParticipantDefinitionUpdate(
+ AcmUtils.prepareParticipantDefinitionUpdate(
ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()),
toscaInputEntry.getKey(), toscaInputEntry.getValue(),
participantDefinitionUpdates, commonPropertiesMap);
}
}
- // Commission the controlloop but sending participantdefinitions to participants
+ // Commission the automation composition but sending participantdefinitions to participants
message.setParticipantDefinitionUpdates(participantDefinitionUpdates);
LOGGER.debug("Participant Update sent {}", message);
super.send(message);
@@ -118,7 +118,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
public void sendDecomisioning() {
var message = new ParticipantUpdate();
message.setTimestamp(Instant.now());
- // DeCommission the controlloop but deleting participantdefinitions on participants
+ // DeCommission the automation composition but deleting participantdefinitions on participants
message.setParticipantDefinitionUpdates(null);
LOGGER.debug("Participant Update sent {}", message);
diff --git a/runtime-controlloop/src/main/resources/application.yaml b/runtime-acm/src/main/resources/application.yaml
index 3a3ada563..9f60211c8 100644
--- a/runtime-controlloop/src/main/resources/application.yaml
+++ b/runtime-acm/src/main/resources/application.yaml
@@ -7,7 +7,7 @@ spring:
converters:
preferred-json-mapper: gson
datasource:
- url: jdbc:mariadb://${mariadb.host:localhost}:${mariadb.port:3306}/controlloop
+ url: jdbc:mariadb://${mariadb.host:localhost}:${mariadb.port:3306}/clamp-acm
driverClassName: org.mariadb.jdbc.Driver
username: policy
password: P01icY
@@ -33,11 +33,10 @@ security:
server:
port: 6969
servlet:
- context-path: /onap/controlloop
+ context-path: /onap/policy/clamp/acm
error:
path: /error
-
runtime:
participantParameters:
heartBeatMs: 20000
@@ -48,14 +47,14 @@ runtime:
topicParameterGroup:
topicSources:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:localhost}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
topicSinks:
-
- topic: POLICY-CLRUNTIME-PARTICIPANT
+ topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:localhost}
topicCommInfrastructure: dmaap
diff --git a/runtime-controlloop/src/main/resources/version.txt b/runtime-acm/src/main/resources/version.txt
index e11449e5b..46ff2c3a7 100644
--- a/runtime-controlloop/src/main/resources/version.txt
+++ b/runtime-acm/src/main/resources/version.txt
@@ -1,4 +1,4 @@
-ONAP Tosca defined control loop
+ONAP Tosca defined automation composition
Version: ${project.version}
Built (UTC): ${maven.build.timestamp}
ONAP https://wiki.onap.org
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java
index 843985e7d..35731d0e0 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.commissioning;
+package org.onap.policy.clamp.acm.runtime.commissioning;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
@@ -34,10 +34,10 @@ import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.runtime.instantiation.InstantiationUtils;
+import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
+import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityType;
@@ -52,65 +52,65 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
class CommissioningProviderTest {
private static final String TOSCA_SERVICE_TEMPLATE_YAML =
- "src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml";
+ "src/test/resources/rest/servicetemplates/pmsh_multiple_ac_tosca.yaml";
private static final String COMMON_TOSCA_SERVICE_TEMPLATE_YAML =
- "src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml";
+ "src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml";
private static final Coder CODER = new StandardCoder();
private final ObjectMapper mapper = new ObjectMapper();
/**
- * Test the fetching of control loop definitions (ToscaServiceTemplates).
+ * Test the fetching of automation composition definitions (ToscaServiceTemplates).
*
* @throws Exception .
*/
@Test
- void testGetControlLoopDefinitions() throws Exception {
- var clProvider = mock(ControlLoopProvider.class);
+ void testGetAutomationCompositionDefinitions() throws Exception {
+ var acProvider = mock(AutomationCompositionProvider.class);
var participantProvider = mock(ParticipantProvider.class);
var serviceTemplateProvider = mock(ServiceTemplateProvider.class);
CommissioningProvider provider =
- new CommissioningProvider(serviceTemplateProvider, clProvider, null, participantProvider);
+ new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider);
- List<ToscaNodeTemplate> listOfTemplates = provider.getControlLoopDefinitions(null, null);
+ List<ToscaNodeTemplate> listOfTemplates = provider.getAutomationCompositionDefinitions(null, null);
assertThat(listOfTemplates).isEmpty();
- when(clProvider.getFilteredNodeTemplates(any()))
- .thenReturn(List.of(new ToscaNodeTemplate(), new ToscaNodeTemplate()));
- listOfTemplates = provider.getControlLoopDefinitions(null, null);
+ when(acProvider.getFilteredNodeTemplates(any()))
+ .thenReturn(List.of(new ToscaNodeTemplate(), new ToscaNodeTemplate()));
+ listOfTemplates = provider.getAutomationCompositionDefinitions(null, null);
assertThat(listOfTemplates).hasSize(2);
}
/**
- * Test the creation of control loop definitions (ToscaServiceTemplates).
+ * Test the creation of automation composition definitions (ToscaServiceTemplates).
*
* @throws Exception .
*/
@Test
- void testCreateControlLoopDefinitions() throws Exception {
+ void testCreateAutomationCompositionDefinitions() throws Exception {
var serviceTemplateProvider = mock(ServiceTemplateProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
var participantProvider = mock(ParticipantProvider.class);
CommissioningProvider provider =
- new CommissioningProvider(serviceTemplateProvider, clProvider, null, participantProvider);
+ new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider);
- List<ToscaNodeTemplate> listOfTemplates = provider.getControlLoopDefinitions(null, null);
+ List<ToscaNodeTemplate> listOfTemplates = provider.getAutomationCompositionDefinitions(null, null);
assertThat(listOfTemplates).isEmpty();
ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
when(serviceTemplateProvider.createServiceTemplate(serviceTemplate)).thenReturn(serviceTemplate);
// Response should return the number of node templates present in the service template
- List<ToscaConceptIdentifier> affectedDefinitions =
- provider.createControlLoopDefinitions(serviceTemplate).getAffectedControlLoopDefinitions();
+ List<ToscaConceptIdentifier> affectedDefinitions = provider
+ .createAutomationCompositionDefinitions(serviceTemplate).getAffectedAutomationCompositionDefinitions();
assertThat(affectedDefinitions).hasSize(13);
- when(clProvider.getFilteredNodeTemplates(any()))
- .thenReturn(List.of(new ToscaNodeTemplate(), new ToscaNodeTemplate()));
+ when(acProvider.getFilteredNodeTemplates(any()))
+ .thenReturn(List.of(new ToscaNodeTemplate(), new ToscaNodeTemplate()));
- listOfTemplates = provider.getControlLoopDefinitions(null, null);
+ listOfTemplates = provider.getAutomationCompositionDefinitions(null, null);
assertThat(listOfTemplates).hasSize(2);
}
@@ -122,16 +122,16 @@ class CommissioningProviderTest {
@Test
void testGetToscaServiceTemplate() throws Exception {
var serviceTemplateProvider = mock(ServiceTemplateProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
var participantProvider = mock(ParticipantProvider.class);
CommissioningProvider provider =
- new CommissioningProvider(serviceTemplateProvider, clProvider, null, participantProvider);
+ new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider);
ToscaServiceTemplate serviceTemplate =
- InstantiationUtils.getToscaServiceTemplate(COMMON_TOSCA_SERVICE_TEMPLATE_YAML);
+ InstantiationUtils.getToscaServiceTemplate(COMMON_TOSCA_SERVICE_TEMPLATE_YAML);
when(serviceTemplateProvider.createServiceTemplate(serviceTemplate)).thenReturn(serviceTemplate);
- provider.createControlLoopDefinitions(serviceTemplate);
+ provider.createAutomationCompositionDefinitions(serviceTemplate);
verify(serviceTemplateProvider).createServiceTemplate(serviceTemplate);
when(serviceTemplateProvider.getToscaServiceTemplate(eq(null), eq(null))).thenReturn(serviceTemplate);
@@ -140,7 +140,7 @@ class CommissioningProviderTest {
assertThat(returnedServiceTemplate).isNotNull();
Map<String, ToscaNodeTemplate> nodeTemplates =
- returnedServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ returnedServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
assertThat(nodeTemplates).hasSize(8);
}
@@ -153,16 +153,16 @@ class CommissioningProviderTest {
@Test
void testGetToscaServiceTemplateReduced() throws Exception {
var serviceTemplateProvider = mock(ServiceTemplateProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
var participantProvider = mock(ParticipantProvider.class);
CommissioningProvider provider =
- new CommissioningProvider(serviceTemplateProvider, clProvider, null, participantProvider);
+ new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider);
ToscaServiceTemplate serviceTemplate =
- InstantiationUtils.getToscaServiceTemplate(COMMON_TOSCA_SERVICE_TEMPLATE_YAML);
+ InstantiationUtils.getToscaServiceTemplate(COMMON_TOSCA_SERVICE_TEMPLATE_YAML);
when(serviceTemplateProvider.createServiceTemplate(serviceTemplate)).thenReturn(serviceTemplate);
- provider.createControlLoopDefinitions(serviceTemplate);
+ provider.createAutomationCompositionDefinitions(serviceTemplate);
when(serviceTemplateProvider.getServiceTemplateList(any(), any())).thenReturn(List.of(serviceTemplate));
@@ -182,23 +182,23 @@ class CommissioningProviderTest {
@Test
void testGetToscaServiceTemplateSchema() throws Exception {
var serviceTemplateProvider = mock(ServiceTemplateProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
var participantProvider = mock(ParticipantProvider.class);
CommissioningProvider provider =
- new CommissioningProvider(serviceTemplateProvider, clProvider, null, participantProvider);
+ new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider);
ToscaServiceTemplate serviceTemplate =
- InstantiationUtils.getToscaServiceTemplate(COMMON_TOSCA_SERVICE_TEMPLATE_YAML);
+ InstantiationUtils.getToscaServiceTemplate(COMMON_TOSCA_SERVICE_TEMPLATE_YAML);
when(serviceTemplateProvider.createServiceTemplate(serviceTemplate)).thenReturn(serviceTemplate);
- provider.createControlLoopDefinitions(serviceTemplate);
+ provider.createAutomationCompositionDefinitions(serviceTemplate);
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
Map<String, Class<?>> sections = Map.of("all", ToscaServiceTemplate.class, "data_types", ToscaDataType.class,
- "capability_types", ToscaCapabilityType.class, "node_types", ToscaNodeType.class, "relationship_types",
- ToscaRelationshipType.class, "policy_types", ToscaPolicyType.class, "topology_template",
- ToscaTopologyTemplate.class, "node_templates", List.class);
+ "capability_types", ToscaCapabilityType.class, "node_types", ToscaNodeType.class, "relationship_types",
+ ToscaRelationshipType.class, "policy_types", ToscaPolicyType.class, "topology_template",
+ ToscaTopologyTemplate.class, "node_templates", List.class);
for (Map.Entry<String, Class<?>> entry : sections.entrySet()) {
String returnedServiceTemplateSchema = provider.getToscaServiceTemplateSchema(entry.getKey());
@@ -208,7 +208,7 @@ class CommissioningProviderTest {
if (entry.getKey().equals("node_templates")) {
mapper.acceptJsonFormatVisitor(
- mapper.getTypeFactory().constructCollectionType(List.class, ToscaNodeTemplate.class), visitor);
+ mapper.getTypeFactory().constructCollectionType(List.class, ToscaNodeTemplate.class), visitor);
} else {
mapper.acceptJsonFormatVisitor(mapper.constructType(entry.getValue()), visitor);
}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java
index e4a121439..2a49e04c1 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningControllerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.commissioning.rest;
+package org.onap.policy.clamp.acm.runtime.commissioning.rest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -39,10 +39,10 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.models.messages.rest.commissioning.CommissioningResponse;
-import org.onap.policy.clamp.controlloop.runtime.instantiation.InstantiationUtils;
-import org.onap.policy.clamp.controlloop.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
+import org.onap.policy.clamp.acm.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.models.acm.messages.rest.commissioning.CommissioningResponse;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -59,9 +59,9 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
class CommissioningControllerTest extends CommonRestController {
private static final String TOSCA_SERVICE_TEMPLATE_YAML =
- "src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml";
+ "src/test/resources/rest/servicetemplates/pmsh_multiple_ac_tosca.yaml";
private static final String COMMON_TOSCA_SERVICE_TEMPLATE_YAML =
- "src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml";
+ "src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml";
private static final String COMMISSIONING_ENDPOINT = "commission";
private static ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
@@ -83,7 +83,7 @@ class CommissioningControllerTest extends CommonRestController {
serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
commonPropertiesServiceTemplate =
- InstantiationUtils.getToscaServiceTemplate(COMMON_TOSCA_SERVICE_TEMPLATE_YAML);
+ InstantiationUtils.getToscaServiceTemplate(COMMON_TOSCA_SERVICE_TEMPLATE_YAML);
}
@BeforeEach
@@ -154,7 +154,7 @@ class CommissioningControllerTest extends CommonRestController {
createFullEntryInDbWithCommonProps();
Invocation.Builder invocationBuilder =
- super.sendRequest(COMMISSIONING_ENDPOINT + "/toscaServiceTemplateSchema");
+ super.sendRequest(COMMISSIONING_ENDPOINT + "/toscaServiceTemplateSchema");
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
String schema = rawresp.readEntity(String.class);
@@ -167,7 +167,7 @@ class CommissioningControllerTest extends CommonRestController {
createFullEntryInDbWithCommonProps();
Invocation.Builder invocationBuilder = super.sendRequest(COMMISSIONING_ENDPOINT
- + "/getCommonOrInstanceProperties" + "?common=true&name=ToscaServiceTemplateSimple&version=1.0.0");
+ + "/getCommonOrInstanceProperties" + "?common=true&name=ToscaServiceTemplateSimple&version=1.0.0");
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
@@ -187,7 +187,7 @@ class CommissioningControllerTest extends CommonRestController {
assertThat(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).isEqualTo(resp.getStatus());
CommissioningResponse commissioningResponse = resp.readEntity(CommissioningResponse.class);
assertThat(commissioningResponse.getErrorDetails()).isNotNull();
- assertThat(commissioningResponse.getAffectedControlLoopDefinitions()).isNull();
+ assertThat(commissioningResponse.getAffectedAutomationCompositionDefinitions()).isNull();
}
@Test
@@ -200,10 +200,10 @@ class CommissioningControllerTest extends CommonRestController {
assertNotNull(commissioningResponse);
assertNull(commissioningResponse.getErrorDetails());
// Response should return the number of node templates present in the service template
- assertThat(commissioningResponse.getAffectedControlLoopDefinitions()).hasSize(13);
+ assertThat(commissioningResponse.getAffectedAutomationCompositionDefinitions()).hasSize(13);
for (String nodeTemplateName : serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().keySet()) {
- assertTrue(commissioningResponse.getAffectedControlLoopDefinitions().stream()
- .anyMatch(ac -> ac.getName().equals(nodeTemplateName)));
+ assertTrue(commissioningResponse.getAffectedAutomationCompositionDefinitions().stream()
+ .anyMatch(ac -> ac.getName().equals(nodeTemplateName)));
}
}
@@ -249,7 +249,7 @@ class CommissioningControllerTest extends CommonRestController {
createEntryInDB();
Invocation.Builder invocationBuilder = super.sendRequest(
- COMMISSIONING_ENDPOINT + "/elements" + "?name=org.onap.domain.pmsh.PMSHControlLoopDefinition");
+ COMMISSIONING_ENDPOINT + "/elements" + "?name=org.onap.domain.pmsh.PMSHAutomationCompositionDefinition");
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
List<?> entityList = rawresp.readEntity(List.class);
@@ -274,7 +274,7 @@ class CommissioningControllerTest extends CommonRestController {
var serviceTemplateCreated = createEntryInDB();
Invocation.Builder invocationBuilder = super.sendRequest(COMMISSIONING_ENDPOINT + "?name="
- + serviceTemplateCreated.getName() + "&version=" + serviceTemplateCreated.getVersion());
+ + serviceTemplateCreated.getName() + "&version=" + serviceTemplateCreated.getVersion());
// Call delete with no info
Response resp = invocationBuilder.delete();
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/MessageDispatcherActivatorTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivatorTest.java
index 8dbc710dd..dd070fc0b 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/MessageDispatcherActivatorTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivatorTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.config.messaging;
+package org.onap.policy.clamp.acm.runtime.config.messaging;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -34,10 +34,10 @@ import static org.mockito.Mockito.when;
import java.util.List;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantStatusListener;
-import org.onap.policy.clamp.controlloop.runtime.util.CommonTestData;
+import org.onap.policy.clamp.acm.runtime.main.parameters.AcRuntimeParameterGroup;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantStatusListener;
+import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.coder.StandardCoderObject;
@@ -55,7 +55,7 @@ class MessageDispatcherActivatorTest {
@Test
void testStartAndStop() throws Exception {
- ClRuntimeParameterGroup parameterGroup = CommonTestData.geParameterGroup("dbtest");
+ AcRuntimeParameterGroup parameterGroup = CommonTestData.geParameterGroup("dbtest");
var publisherFirst = spy(mock(Publisher.class));
var publisherSecond = spy(mock(Publisher.class));
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
new file mode 100644
index 000000000..30ed89eac
--- /dev/null
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
@@ -0,0 +1,394 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.instantiation;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.onap.policy.clamp.acm.runtime.commissioning.CommissioningProvider;
+import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
+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.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+
+/**
+ * Class to perform unit test of {@link AutomationCompositionInstantiationProvider}}.
+ *
+ */
+class AutomationCompositionInstantiationProviderTest {
+ private static final String ID_NAME = "PMSH_Instance1";
+ private static final String ID_VERSION = "1.2.3";
+ private static final String AC_INSTANTIATION_CREATE_JSON =
+ "src/test/resources/rest/acm/AutomationCompositions.json";
+ private static final String AC_INSTANTIATION_UPDATE_JSON =
+ "src/test/resources/rest/acm/AutomationCompositionsUpdate.json";
+ private static final String AC_INSTANTIATION_CHANGE_STATE_JSON = "src/test/resources/rest/acm/PassiveCommand.json";
+ private static final String AC_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON =
+ "src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json";
+ private static final String AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON =
+ "src/test/resources/rest/acm/AutomationCompositionsNotFound.json";
+ private static final String TOSCA_TEMPLATE_YAML =
+ "src/test/resources/rest/servicetemplates/pmsh_multiple_ac_tosca.yaml";
+ private static final String AUTOMATION_COMPOSITION_NOT_FOUND = "Automation composition not found";
+ private static final String DELETE_BAD_REQUEST = "Automation composition state is still %s";
+ private static final String ORDERED_STATE_INVALID = "ordered state invalid or not specified on command";
+ private static final String AC_ELEMENT_NAME_NOT_FOUND =
+ "\"AutomationCompositions\" INVALID, item has status INVALID\n"
+ + " \"entry org.onap.domain.pmsh.PMSHAutomationCompositionDefinition\" INVALID, item has status INVALID\n"
+ + " \"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not found\n"
+ + " \"entry org.onap.domain.pmsh.PMSHAutomationCompositionDefinition\" INVALID, item has status INVALID\n"
+ + " \"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not found\n";
+
+ private static final String AC_DEFINITION_NOT_FOUND =
+ "\"AutomationCompositions\" INVALID, item has status INVALID\n"
+ + " \"entry org.onap.domain.PMSHAutomationCompositionDefinition\" INVALID, item has status INVALID\n"
+ + " item \"AutomationComposition\" value \"org.onap.domain.PMSHAutomationCompositionDefinition\""
+ + " INVALID, Commissioned automation composition definition not found\n"
+ + " \"entry org.onap.domain.PMSHAutomationCompositionDefinition\" INVALID, item has status INVALID\n"
+ + " item \"AutomationComposition\" value \"org.onap.domain.PMSHAutomationCompositionDefinition\""
+ + " INVALID, Commissioned automation composition definition not found\n";
+
+ private static ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
+
+ @BeforeAll
+ public static void setUpBeforeClass() throws Exception {
+ serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_TEMPLATE_YAML);
+ }
+
+ @Test
+ void testIntanceResponses() throws Exception {
+ var participantProvider = Mockito.mock(ParticipantProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
+ var supervisionHandler = mock(SupervisionHandler.class);
+ var commissioningProvider = mock(CommissioningProvider.class);
+
+ when(commissioningProvider.getAllToscaServiceTemplate()).thenReturn(List.of(serviceTemplate));
+ when(commissioningProvider.getToscaServiceTemplate(ID_NAME, ID_VERSION)).thenReturn(serviceTemplate);
+
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, commissioningProvider,
+ supervisionHandler, participantProvider);
+ var instancePropertyList = instantiationProvider.createInstanceProperties(serviceTemplate);
+ assertNull(instancePropertyList.getErrorDetails());
+ var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
+ assertEquals(id, instancePropertyList.getAffectedInstanceProperties().get(0));
+
+ AutomationCompositions automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud");
+ var automationComposition = automationCompositions.getAutomationCompositionList().get(0);
+ automationComposition.setName(ID_NAME);
+ automationComposition.setVersion(ID_VERSION);
+ when(acProvider.getAutomationCompositions(ID_NAME, ID_VERSION)).thenReturn(List.of(automationComposition));
+
+ var instanceOrderState = instantiationProvider.getInstantiationOrderState(ID_NAME, ID_VERSION);
+ assertEquals(AutomationCompositionOrderedState.UNINITIALISED, instanceOrderState.getOrderedState());
+ assertEquals(ID_NAME, instanceOrderState.getAutomationCompositionIdentifierList().get(0).getName());
+
+ when(acProvider.findAutomationComposition(ID_NAME, ID_VERSION)).thenReturn(Optional.of(automationComposition));
+ when(acProvider.deleteAutomationComposition(ID_NAME, ID_VERSION)).thenReturn(automationComposition);
+
+ var instanceResponse = instantiationProvider.deleteInstanceProperties(ID_NAME, ID_VERSION);
+ assertEquals(ID_NAME, instanceResponse.getAffectedAutomationCompositions().get(0).getName());
+
+ }
+
+ @Test
+ void testInstantiationCrud() throws Exception {
+ var participantProvider = Mockito.mock(ParticipantProvider.class);
+ var participants = CommonTestData.createParticipants();
+ when(participantProvider.getParticipants()).thenReturn(participants);
+
+ var commissioningProvider = mock(CommissioningProvider.class);
+ var toscaNodeTemplate1 = new ToscaNodeTemplate();
+ toscaNodeTemplate1.setName("org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement");
+ toscaNodeTemplate1.setVersion("1.2.3");
+ when(commissioningProvider.getAutomationCompositionDefinitions(anyString(), anyString()))
+ .thenReturn(List.of(toscaNodeTemplate1));
+
+ var toscaNodeTemplate2 = new ToscaNodeTemplate();
+ toscaNodeTemplate2.setName("org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement");
+ toscaNodeTemplate2.setVersion("1.2.3");
+ var toscaNodeTemplate3 = new ToscaNodeTemplate();
+ toscaNodeTemplate3.setName("org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement");
+ toscaNodeTemplate3.setVersion("1.2.3");
+ var toscaNodeTemplate4 = new ToscaNodeTemplate();
+ toscaNodeTemplate4.setName("org.onap.domain.pmsh.PMSH_DCAEMicroservice");
+ toscaNodeTemplate4.setVersion("1.2.3");
+
+ when(commissioningProvider.getAutomationCompositionElementDefinitions(toscaNodeTemplate1))
+ .thenReturn(List.of(toscaNodeTemplate1, toscaNodeTemplate2, toscaNodeTemplate3, toscaNodeTemplate4));
+
+ var supervisionHandler = mock(SupervisionHandler.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, commissioningProvider,
+ supervisionHandler, participantProvider);
+ AutomationCompositions automationCompositionsCreate =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud");
+ InstantiationResponse instantiationResponse =
+ instantiationProvider.createAutomationCompositions(automationCompositionsCreate);
+ InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionsCreate);
+
+ verify(acProvider).saveAutomationCompositions(automationCompositionsCreate.getAutomationCompositionList());
+
+ for (var automationComposition : automationCompositionsCreate.getAutomationCompositionList()) {
+ when(acProvider.getAutomationCompositions(automationComposition.getName(),
+ automationComposition.getVersion())).thenReturn(List.of(automationComposition));
+
+ AutomationCompositions automationCompositionsGet = instantiationProvider
+ .getAutomationCompositions(automationComposition.getName(), automationComposition.getVersion());
+ assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1);
+ assertThat(automationComposition)
+ .isEqualTo(automationCompositionsGet.getAutomationCompositionList().get(0));
+ }
+
+ AutomationCompositions automationCompositionsUpdate =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Crud");
+
+ instantiationResponse = instantiationProvider.updateAutomationCompositions(automationCompositionsUpdate);
+ InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionsUpdate);
+
+ verify(acProvider).saveAutomationCompositions(automationCompositionsUpdate.getAutomationCompositionList());
+
+ for (var automationComposition : automationCompositionsUpdate.getAutomationCompositionList()) {
+ when(acProvider.findAutomationComposition(automationComposition.getKey().asIdentifier()))
+ .thenReturn(Optional.of(automationComposition));
+ when(acProvider.findAutomationComposition(automationComposition.getName(),
+ automationComposition.getVersion())).thenReturn(Optional.of(automationComposition));
+ when(acProvider.deleteAutomationComposition(automationComposition.getName(),
+ automationComposition.getVersion())).thenReturn(automationComposition);
+ }
+
+ InstantiationCommand instantiationCommand =
+ InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Crud");
+ instantiationResponse = instantiationProvider.issueAutomationCompositionCommand(instantiationCommand);
+ InstantiationUtils.assertInstantiationResponse(instantiationResponse, instantiationCommand);
+
+ verify(supervisionHandler)
+ .triggerAutomationCompositionSupervision(instantiationCommand.getAutomationCompositionIdentifierList());
+
+ // in order to delete a automationComposition the state must be UNINITIALISED
+ automationCompositionsCreate.getAutomationCompositionList()
+ .forEach(ac -> ac.setState(AutomationCompositionState.UNINITIALISED));
+ instantiationProvider.updateAutomationCompositions(automationCompositionsCreate);
+
+ for (AutomationComposition automationComposition : automationCompositionsCreate
+ .getAutomationCompositionList()) {
+ instantiationProvider.deleteAutomationComposition(automationComposition.getName(),
+ automationComposition.getVersion());
+
+ verify(acProvider).deleteAutomationComposition(automationComposition.getName(),
+ automationComposition.getVersion());
+ }
+ }
+
+ @Test
+ void testInstantiationDelete() throws Exception {
+
+ AutomationCompositions automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete");
+
+ AutomationComposition automationComposition0 = automationCompositions.getAutomationCompositionList().get(0);
+ var participantProvider = Mockito.mock(ParticipantProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
+ var supervisionHandler = mock(SupervisionHandler.class);
+ var commissioningProvider = mock(CommissioningProvider.class);
+
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, commissioningProvider,
+ supervisionHandler, participantProvider);
+
+ assertThatThrownBy(() -> instantiationProvider.deleteAutomationComposition(automationComposition0.getName(),
+ automationComposition0.getVersion())).hasMessageMatching(AUTOMATION_COMPOSITION_NOT_FOUND);
+
+ for (AutomationCompositionState state : AutomationCompositionState.values()) {
+ if (!AutomationCompositionState.UNINITIALISED.equals(state)) {
+ assertThatDeleteThrownBy(automationCompositions, state);
+ }
+ }
+ automationComposition0.setState(AutomationCompositionState.UNINITIALISED);
+
+ for (AutomationComposition automationComposition : automationCompositions.getAutomationCompositionList()) {
+ when(acProvider.findAutomationComposition(automationComposition.getName(),
+ automationComposition.getVersion())).thenReturn(Optional.of(automationComposition));
+ when(acProvider.deleteAutomationComposition(automationComposition.getName(),
+ automationComposition.getVersion())).thenReturn(automationComposition);
+
+ instantiationProvider.deleteAutomationComposition(automationComposition.getName(),
+ automationComposition.getVersion());
+ }
+ }
+
+ private void assertThatDeleteThrownBy(AutomationCompositions automationCompositions,
+ AutomationCompositionState state) throws Exception {
+ AutomationComposition automationComposition = automationCompositions.getAutomationCompositionList().get(0);
+ automationComposition.setState(state);
+ var participantProvider = Mockito.mock(ParticipantProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
+ var supervisionHandler = mock(SupervisionHandler.class);
+ var commissioningProvider = mock(CommissioningProvider.class);
+
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, commissioningProvider,
+ supervisionHandler, participantProvider);
+
+ when(acProvider.findAutomationComposition(automationComposition.getName(), automationComposition.getVersion()))
+ .thenReturn(Optional.of(automationComposition));
+
+ assertThatThrownBy(() -> instantiationProvider.deleteAutomationComposition(automationComposition.getName(),
+ automationComposition.getVersion())).hasMessageMatching(String.format(DELETE_BAD_REQUEST, state));
+ }
+
+ @Test
+ void testCreateAutomationCompositions_NoDuplicates() throws Exception {
+ var commissioningProvider = mock(CommissioningProvider.class);
+
+ var toscaNodeTemplate1 = new ToscaNodeTemplate();
+ toscaNodeTemplate1.setName("org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement");
+ toscaNodeTemplate1.setVersion("1.2.3");
+ when(commissioningProvider.getAutomationCompositionDefinitions(anyString(), anyString()))
+ .thenReturn(List.of(toscaNodeTemplate1));
+
+ var toscaNodeTemplate2 = new ToscaNodeTemplate();
+ toscaNodeTemplate2.setName("org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement");
+ toscaNodeTemplate2.setVersion("1.2.3");
+ var toscaNodeTemplate3 = new ToscaNodeTemplate();
+ toscaNodeTemplate3.setName("org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement");
+ toscaNodeTemplate3.setVersion("1.2.3");
+ var toscaNodeTemplate4 = new ToscaNodeTemplate();
+ toscaNodeTemplate4.setName("org.onap.domain.pmsh.PMSH_DCAEMicroservice");
+ toscaNodeTemplate4.setVersion("1.2.3");
+
+ when(commissioningProvider.getAutomationCompositionElementDefinitions(toscaNodeTemplate1))
+ .thenReturn(List.of(toscaNodeTemplate1, toscaNodeTemplate2, toscaNodeTemplate3, toscaNodeTemplate4));
+
+ AutomationCompositions automationCompositionsCreate =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "NoDuplicates");
+
+ var acProvider = mock(AutomationCompositionProvider.class);
+ var participantProvider = Mockito.mock(ParticipantProvider.class);
+ var supervisionHandler = mock(SupervisionHandler.class);
+
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, commissioningProvider,
+ supervisionHandler, participantProvider);
+
+ InstantiationResponse instantiationResponse =
+ instantiationProvider.createAutomationCompositions(automationCompositionsCreate);
+ InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionsCreate);
+
+ when(acProvider.findAutomationComposition(
+ automationCompositionsCreate.getAutomationCompositionList().get(0).getKey().asIdentifier()))
+ .thenReturn(Optional.of(automationCompositionsCreate.getAutomationCompositionList().get(0)));
+
+ assertThatThrownBy(() -> instantiationProvider.createAutomationCompositions(automationCompositionsCreate))
+ .hasMessageMatching(
+ automationCompositionsCreate.getAutomationCompositionList().get(0).getKey().asIdentifier()
+ + " already defined");
+ }
+
+ @Test
+ void testCreateAutomationCompositions_CommissionedAcElementNotFound() throws Exception {
+ var toscaNodeTemplate1 = new ToscaNodeTemplate();
+ toscaNodeTemplate1.setName("org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement");
+ toscaNodeTemplate1.setVersion("1.2.3");
+
+ var toscaNodeTemplate2 = new ToscaNodeTemplate();
+ toscaNodeTemplate2.setName("org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement");
+ toscaNodeTemplate2.setVersion("1.2.3");
+ var toscaNodeTemplate3 = new ToscaNodeTemplate();
+ toscaNodeTemplate3.setName("org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement");
+ toscaNodeTemplate3.setVersion("1.2.3");
+ var commissioningProvider = mock(CommissioningProvider.class);
+ AutomationCompositions automationCompositions = InstantiationUtils.getAutomationCompositionsFromResource(
+ AC_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON, "AcElementNotFound");
+
+ when(commissioningProvider.getAutomationCompositionDefinitions(
+ automationCompositions.getAutomationCompositionList().get(0).getDefinition().getName(),
+ automationCompositions.getAutomationCompositionList().get(0).getDefinition().getVersion()))
+ .thenReturn(List.of(toscaNodeTemplate1));
+
+ when(commissioningProvider.getAutomationCompositionElementDefinitions(toscaNodeTemplate1))
+ .thenReturn(List.of(toscaNodeTemplate1, toscaNodeTemplate2, toscaNodeTemplate3));
+
+ var acProvider = mock(AutomationCompositionProvider.class);
+ var participantProvider = mock(ParticipantProvider.class);
+ var supervisionHandler = mock(SupervisionHandler.class);
+ var provider = new AutomationCompositionInstantiationProvider(acProvider, commissioningProvider,
+ supervisionHandler, participantProvider);
+
+ assertThatThrownBy(() -> provider.createAutomationCompositions(automationCompositions))
+ .hasMessageMatching(AC_ELEMENT_NAME_NOT_FOUND);
+
+ assertThatThrownBy(() -> provider.updateAutomationCompositions(automationCompositions))
+ .hasMessageMatching(AC_ELEMENT_NAME_NOT_FOUND);
+ }
+
+ @Test
+ void testCreateAutomationCompositions_CommissionedAcNotFound() throws Exception {
+ AutomationCompositions automationCompositions = InstantiationUtils
+ .getAutomationCompositionsFromResource(AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON, "AcNotFound");
+
+ var participantProvider = Mockito.mock(ParticipantProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
+ var supervisionHandler = mock(SupervisionHandler.class);
+ var commissioningProvider = mock(CommissioningProvider.class);
+ var provider = new AutomationCompositionInstantiationProvider(acProvider, commissioningProvider,
+ supervisionHandler, participantProvider);
+
+ assertThatThrownBy(() -> provider.createAutomationCompositions(automationCompositions))
+ .hasMessageMatching(AC_DEFINITION_NOT_FOUND);
+
+ assertThatThrownBy(() -> provider.updateAutomationCompositions(automationCompositions))
+ .hasMessageMatching(AC_DEFINITION_NOT_FOUND);
+ }
+
+ @Test
+ void testIssueAutomationCompositionCommand_OrderedStateInvalid()
+ throws AutomationCompositionRuntimeException, IOException {
+ var participantProvider = Mockito.mock(ParticipantProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
+ var supervisionHandler = mock(SupervisionHandler.class);
+ var commissioningProvider = mock(CommissioningProvider.class);
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, commissioningProvider,
+ supervisionHandler, participantProvider);
+ assertThatThrownBy(() -> instantiationProvider.issueAutomationCompositionCommand(new InstantiationCommand()))
+ .hasMessageMatching(ORDERED_STATE_INVALID);
+ }
+}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationUtils.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java
index 5aa68657c..759685ad9 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationUtils.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.instantiation;
+package org.onap.policy.clamp.acm.runtime.instantiation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -26,10 +26,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -47,81 +47,87 @@ public class InstantiationUtils {
private static final StandardYamlCoder YAML_TRANSLATOR = new StandardYamlCoder();
/**
- * Gets the ControlLoops from Resource.
+ * Gets the AutomationCompositions from Resource.
*
* @param path path of the resource
- * @param suffix suffix to add to all names in ControlLoops
- * @return the ControlLoops from Resource
+ * @param suffix suffix to add to all names in AutomationCompositions
+ * @return the AutomationCompositions from Resource
* @throws CoderException if an error occurs
*/
- public static ControlLoops getControlLoopsFromResource(final String path, final String suffix)
- throws CoderException {
- ControlLoops controlLoops = CODER.decode(new File(path), ControlLoops.class);
+ public static AutomationCompositions getAutomationCompositionsFromResource(final String path, final String suffix)
+ throws CoderException {
+ AutomationCompositions automationCompositions = CODER.decode(new File(path), AutomationCompositions.class);
// add suffix to all names
- controlLoops.getControlLoopList().forEach(controlLoop -> controlLoop.setName(controlLoop.getName() + suffix));
- return controlLoops;
+ automationCompositions.getAutomationCompositionList()
+ .forEach(automationComposition -> automationComposition.setName(automationComposition.getName() + suffix));
+ return automationCompositions;
}
/**
* Gets InstantiationCommand from Resource.
*
* @param path path of the resource
- * @param suffix suffix to add to all names in ControlLoops
+ * @param suffix suffix to add to all names in AutomationCompositions
* @return the InstantiationCommand
* @throws CoderException if an error occurs
*/
public static InstantiationCommand getInstantiationCommandFromResource(final String path, final String suffix)
- throws CoderException {
+ throws CoderException {
InstantiationCommand instantiationCommand = CODER.decode(new File(path), InstantiationCommand.class);
// add suffix to all names
- instantiationCommand.getControlLoopIdentifierList().forEach(cl -> cl.setName(cl.getName() + suffix));
+ instantiationCommand.getAutomationCompositionIdentifierList().forEach(ac -> ac.setName(ac.getName() + suffix));
return instantiationCommand;
}
/**
- * Assert that Instantiation Response contains proper ControlLoops.
+ * Assert that Instantiation Response contains proper AutomationCompositions.
*
* @param response InstantiationResponse
- * @param controlLoops ControlLoops
+ * @param automationCompositions AutomationCompositions
*/
- public static void assertInstantiationResponse(InstantiationResponse response, ControlLoops controlLoops) {
+ public static void assertInstantiationResponse(InstantiationResponse response,
+ AutomationCompositions automationCompositions) {
assertThat(response).isNotNull();
assertThat(response.getErrorDetails()).isNull();
- assertThat(response.getAffectedControlLoops().size()).isEqualTo(controlLoops.getControlLoopList().size());
- for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
- assertTrue(response.getAffectedControlLoops().stream()
- .filter(ac -> ac.equals(controlLoop.getKey().asIdentifier())).findAny().isPresent());
+ assertThat(response.getAffectedAutomationCompositions().size())
+ .isEqualTo(automationCompositions.getAutomationCompositionList().size());
+ for (AutomationComposition automationComposition : automationCompositions.getAutomationCompositionList()) {
+ assertTrue(response.getAffectedAutomationCompositions().stream()
+ .filter(ac -> ac.equals(automationComposition.getKey().asIdentifier())).findAny().isPresent());
}
}
/**
- * Assert that Instantiation Response contains proper ControlLoops.
+ * Assert that Instantiation Response contains proper AutomationCompositions.
*
* @param response InstantiationResponse
* @param command InstantiationCommand
*/
public static void assertInstantiationResponse(InstantiationResponse response, InstantiationCommand command) {
assertThat(response).isNotNull();
- assertEquals(response.getAffectedControlLoops().size(), command.getControlLoopIdentifierList().size());
- for (ToscaConceptIdentifier toscaConceptIdentifier : command.getControlLoopIdentifierList()) {
- assertTrue(response.getAffectedControlLoops().stream()
- .filter(ac -> ac.compareTo(toscaConceptIdentifier) == 0).findAny().isPresent());
+ assertEquals(response.getAffectedAutomationCompositions().size(),
+ command.getAutomationCompositionIdentifierList().size());
+ for (ToscaConceptIdentifier toscaConceptIdentifier : command.getAutomationCompositionIdentifierList()) {
+ assertTrue(response.getAffectedAutomationCompositions().stream()
+ .filter(ac -> ac.compareTo(toscaConceptIdentifier) == 0).findAny().isPresent());
}
}
/**
- * Assert that Instantiation Response contains ControlLoop equals to controlLoop.
+ * Assert that Instantiation Response contains AutomationComposition equals to automationComposition.
*
* @param response InstantiationResponse
- * @param controlLoop ControlLoop
+ * @param automationComposition AutomationComposition
*/
- public static void assertInstantiationResponse(InstantiationResponse response, ControlLoop controlLoop) {
+ public static void assertInstantiationResponse(InstantiationResponse response,
+ AutomationComposition automationComposition) {
assertThat(response).isNotNull();
assertThat(response.getErrorDetails()).isNull();
- assertEquals(1, response.getAffectedControlLoops().size());
- assertEquals(0, response.getAffectedControlLoops().get(0).compareTo(controlLoop.getKey().asIdentifier()));
+ assertEquals(1, response.getAffectedAutomationCompositions().size());
+ assertEquals(0, response.getAffectedAutomationCompositions().get(0)
+ .compareTo(automationComposition.getKey().asIdentifier()));
}
/**
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
index 9cc0195d9..2ad15bd48 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.instantiation.rest;
+package org.onap.policy.clamp.acm.runtime.instantiation.rest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -34,22 +34,22 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ControlLoopRepository;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopOrderStateResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopPrimedResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstancePropertiesResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
-import org.onap.policy.clamp.controlloop.runtime.instantiation.ControlLoopInstantiationProvider;
-import org.onap.policy.clamp.controlloop.runtime.instantiation.InstantiationUtils;
-import org.onap.policy.clamp.controlloop.runtime.main.rest.InstantiationController;
-import org.onap.policy.clamp.controlloop.runtime.util.CommonTestData;
-import org.onap.policy.clamp.controlloop.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.acm.runtime.instantiation.AutomationCompositionInstantiationProvider;
+import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
+import org.onap.policy.clamp.acm.runtime.main.rest.InstantiationController;
+import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
+import org.onap.policy.clamp.acm.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AutomationCompositionOrderStateResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AutomationCompositionPrimedResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstancePropertiesResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
+import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -71,33 +71,33 @@ class InstantiationControllerTest extends CommonRestController {
private static final String ID_NAME = "PMSH_Instance1";
private static final String ID_VERSION = "1.2.3";
- private static final String CL_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/controlloops/ControlLoops.json";
+ private static final String AC_INSTANTIATION_CREATE_JSON =
+ "src/test/resources/rest/acm/AutomationCompositions.json";
- private static final String CL_INSTANTIATION_UPDATE_JSON =
- "src/test/resources/rest/controlloops/ControlLoopsUpdate.json";
+ private static final String AC_INSTANTIATION_UPDATE_JSON =
+ "src/test/resources/rest/acm/AutomationCompositionsUpdate.json";
- private static final String CL_INSTANTIATION_CHANGE_STATE_JSON =
- "src/test/resources/rest/controlloops/PassiveCommand.json";
+ private static final String AC_INSTANTIATION_CHANGE_STATE_JSON = "src/test/resources/rest/acm/PassiveCommand.json";
private static final String TOSCA_TEMPLATE_YAML =
- "src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml";
+ "src/test/resources/rest/servicetemplates/pmsh_multiple_ac_tosca.yaml";
private static final String INSTANTIATION_ENDPOINT = "instantiation";
private static final String INSTANTIATION_COMMAND_ENDPOINT = "instantiation/command";
- private static final String PRIMING_ENDPOINT = "controlLoopPriming";
+ private static final String PRIMING_ENDPOINT = "automationCompositionPriming";
private static final String INSTANTIATION_PROPERTIES = "instanceProperties";
private static final String INSTANTIATION_STATE = "instantiationState";
private static ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
@Autowired
- private ControlLoopRepository controlLoopRepository;
+ private AutomationCompositionRepository automationCompositionRepository;
@Autowired
private ServiceTemplateProvider serviceTemplateProvider;
@Autowired
- private ControlLoopInstantiationProvider instantiationProvider;
+ private AutomationCompositionInstantiationProvider instantiationProvider;
@Autowired
private ParticipantProvider participantProvider;
@@ -132,10 +132,10 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testCreate_Unauthorized() throws Exception {
- ControlLoops controlLoops =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Unauthorized");
+ AutomationCompositions automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Unauthorized");
- assertUnauthorizedPost(INSTANTIATION_ENDPOINT, Entity.json(controlLoops));
+ assertUnauthorizedPost(INSTANTIATION_ENDPOINT, Entity.json(automationCompositions));
}
@Test
@@ -145,10 +145,10 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testUpdate_Unauthorized() throws Exception {
- ControlLoops controlLoops =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_UPDATE_JSON, "Unauthorized");
+ AutomationCompositions automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Unauthorized");
- assertUnauthorizedPut(INSTANTIATION_ENDPOINT, Entity.json(controlLoops));
+ assertUnauthorizedPut(INSTANTIATION_ENDPOINT, Entity.json(automationCompositions));
}
@Test
@@ -158,8 +158,8 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testCommand_Unauthorized() throws Exception {
- InstantiationCommand instantiationCommand = InstantiationUtils
- .getInstantiationCommandFromResource(CL_INSTANTIATION_CHANGE_STATE_JSON, "Unauthorized");
+ InstantiationCommand instantiationCommand =
+ InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Unauthorized");
assertUnauthorizedPut(INSTANTIATION_COMMAND_ENDPOINT, Entity.json(instantiationCommand));
}
@@ -167,48 +167,51 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testCreate() throws Exception {
- ControlLoops controlLoopsFromRsc =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Create");
+ AutomationCompositions automationCompositionsFromRsc =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Create");
Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT);
- Response resp = invocationBuilder.post(Entity.json(controlLoopsFromRsc));
+ Response resp = invocationBuilder.post(Entity.json(automationCompositionsFromRsc));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class);
- InstantiationUtils.assertInstantiationResponse(instResponse, controlLoopsFromRsc);
+ InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionsFromRsc);
- for (ControlLoop controlLoopFromRsc : controlLoopsFromRsc.getControlLoopList()) {
- ControlLoops controlLoopsFromDb = instantiationProvider
- .getControlLoops(controlLoopFromRsc.getKey().getName(), controlLoopFromRsc.getKey().getVersion());
+ for (AutomationComposition automationCompositionFromRsc : automationCompositionsFromRsc
+ .getAutomationCompositionList()) {
+ AutomationCompositions automationCompositionsFromDb = instantiationProvider.getAutomationCompositions(
+ automationCompositionFromRsc.getKey().getName(), automationCompositionFromRsc.getKey().getVersion());
- assertNotNull(controlLoopsFromDb);
- assertThat(controlLoopsFromDb.getControlLoopList()).hasSize(1);
- assertEquals(controlLoopFromRsc, controlLoopsFromDb.getControlLoopList().get(0));
+ assertNotNull(automationCompositionsFromDb);
+ assertThat(automationCompositionsFromDb.getAutomationCompositionList()).hasSize(1);
+ assertEquals(automationCompositionFromRsc,
+ automationCompositionsFromDb.getAutomationCompositionList().get(0));
}
invocationBuilder =
- super.sendRequest(PRIMING_ENDPOINT + "?name=" + "PMSHInstance0Create" + "&version=" + "1.0.1");
+ super.sendRequest(PRIMING_ENDPOINT + "?name=" + "PMSHInstance0Create" + "&version=" + "1.0.1");
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
- ControlLoopPrimedResponse primResponse = rawresp.readEntity(ControlLoopPrimedResponse.class);
- assertEquals(false, primResponse.getPrimedControlLoopsList().get(0).isPrimed());
+ AutomationCompositionPrimedResponse primResponse =
+ rawresp.readEntity(AutomationCompositionPrimedResponse.class);
+ assertEquals(false, primResponse.getPrimedAutomationCompositionsList().get(0).isPrimed());
}
@Test
void testCreateBadRequest() throws Exception {
- ControlLoops controlLoopsFromRsc =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "CreateBadRequest");
+ AutomationCompositions automationCompositionsFromRsc =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "CreateBadRequest");
Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT);
- Response resp = invocationBuilder.post(Entity.json(controlLoopsFromRsc));
+ Response resp = invocationBuilder.post(Entity.json(automationCompositionsFromRsc));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- // testing Bad Request: CL already defined
- resp = invocationBuilder.post(Entity.json(controlLoopsFromRsc));
+ // testing Bad Request: AC already defined
+ resp = invocationBuilder.post(Entity.json(automationCompositionsFromRsc));
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus());
InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class);
assertNotNull(instResponse.getErrorDetails());
- assertNull(instResponse.getAffectedControlLoops());
+ assertNull(instResponse.getAffectedAutomationCompositions());
}
@Test
@@ -216,98 +219,107 @@ class InstantiationControllerTest extends CommonRestController {
Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT + "?name=noResultWithThisName");
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
- ControlLoops resp = rawresp.readEntity(ControlLoops.class);
- assertThat(resp.getControlLoopList()).isEmpty();
+ AutomationCompositions resp = rawresp.readEntity(AutomationCompositions.class);
+ assertThat(resp.getAutomationCompositionList()).isEmpty();
}
@Test
void testQuery() throws Exception {
- var controlLoops = InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Query");
- instantiationProvider.createControlLoops(controlLoops);
+ var automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Query");
+ instantiationProvider.createAutomationCompositions(automationCompositions);
- for (ControlLoop controlLoopFromRsc : controlLoops.getControlLoopList()) {
+ for (AutomationComposition automationCompositionFromRsc : automationCompositions
+ .getAutomationCompositionList()) {
Invocation.Builder invocationBuilder =
- super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + controlLoopFromRsc.getKey().getName());
+ super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName());
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
- ControlLoops controlLoopsQuery = rawresp.readEntity(ControlLoops.class);
- assertNotNull(controlLoopsQuery);
- assertThat(controlLoopsQuery.getControlLoopList()).hasSize(1);
- assertEquals(controlLoopFromRsc, controlLoopsQuery.getControlLoopList().get(0));
+ AutomationCompositions automationCompositionsQuery = rawresp.readEntity(AutomationCompositions.class);
+ assertNotNull(automationCompositionsQuery);
+ assertThat(automationCompositionsQuery.getAutomationCompositionList()).hasSize(1);
+ assertEquals(automationCompositionFromRsc,
+ automationCompositionsQuery.getAutomationCompositionList().get(0));
}
}
@Test
void testUpdate() throws Exception {
- ControlLoops controlLoopsCreate =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Update");
+ AutomationCompositions automationCompositionsCreate =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Update");
- var controlLoops = InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_UPDATE_JSON, "Update");
- instantiationProvider.createControlLoops(controlLoopsCreate);
+ var automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Update");
+ instantiationProvider.createAutomationCompositions(automationCompositionsCreate);
Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT);
- Response resp = invocationBuilder.put(Entity.json(controlLoops));
+ Response resp = invocationBuilder.put(Entity.json(automationCompositions));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class);
- InstantiationUtils.assertInstantiationResponse(instResponse, controlLoops);
+ InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositions);
- for (ControlLoop controlLoopUpdate : controlLoops.getControlLoopList()) {
- ControlLoops controlLoopsFromDb = instantiationProvider
- .getControlLoops(controlLoopUpdate.getKey().getName(), controlLoopUpdate.getKey().getVersion());
+ for (AutomationComposition automationCompositionUpdate : automationCompositions
+ .getAutomationCompositionList()) {
+ AutomationCompositions automationCompositionsFromDb = instantiationProvider.getAutomationCompositions(
+ automationCompositionUpdate.getKey().getName(), automationCompositionUpdate.getKey().getVersion());
- assertNotNull(controlLoopsFromDb);
- assertThat(controlLoopsFromDb.getControlLoopList()).hasSize(1);
- assertEquals(controlLoopUpdate, controlLoopsFromDb.getControlLoopList().get(0));
+ assertNotNull(automationCompositionsFromDb);
+ assertThat(automationCompositionsFromDb.getAutomationCompositionList()).hasSize(1);
+ assertEquals(automationCompositionUpdate,
+ automationCompositionsFromDb.getAutomationCompositionList().get(0));
}
}
@Test
void testDelete_NoResultWithThisName() throws Exception {
Invocation.Builder invocationBuilder =
- super.sendRequest(INSTANTIATION_ENDPOINT + "?name=noResultWithThisName&version=1.0.1");
+ super.sendRequest(INSTANTIATION_ENDPOINT + "?name=noResultWithThisName&version=1.0.1");
Response resp = invocationBuilder.delete();
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), resp.getStatus());
InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class);
assertNotNull(instResponse.getErrorDetails());
- assertNull(instResponse.getAffectedControlLoops());
+ assertNull(instResponse.getAffectedAutomationCompositions());
}
@Test
void testDelete() throws Exception {
- ControlLoops controlLoopsFromRsc =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Delete");
+ AutomationCompositions automationCompositionsFromRsc =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete");
- instantiationProvider.createControlLoops(controlLoopsFromRsc);
+ instantiationProvider.createAutomationCompositions(automationCompositionsFromRsc);
- for (ControlLoop controlLoopFromRsc : controlLoopsFromRsc.getControlLoopList()) {
- Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT + "?name="
- + controlLoopFromRsc.getKey().getName() + "&version=" + controlLoopFromRsc.getKey().getVersion());
+ for (AutomationComposition automationCompositionFromRsc : automationCompositionsFromRsc
+ .getAutomationCompositionList()) {
+ Invocation.Builder invocationBuilder =
+ super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName()
+ + "&version=" + automationCompositionFromRsc.getKey().getVersion());
Response resp = invocationBuilder.delete();
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class);
- InstantiationUtils.assertInstantiationResponse(instResponse, controlLoopFromRsc);
+ InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionFromRsc);
- ControlLoops controlLoopsFromDb = instantiationProvider
- .getControlLoops(controlLoopFromRsc.getKey().getName(), controlLoopFromRsc.getKey().getVersion());
- assertThat(controlLoopsFromDb.getControlLoopList()).isEmpty();
+ AutomationCompositions automationCompositionsFromDb = instantiationProvider.getAutomationCompositions(
+ automationCompositionFromRsc.getKey().getName(), automationCompositionFromRsc.getKey().getVersion());
+ assertThat(automationCompositionsFromDb.getAutomationCompositionList()).isEmpty();
}
}
@Test
void testDeleteBadRequest() throws Exception {
- ControlLoops controlLoopsFromRsc =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "DelBadRequest");
+ AutomationCompositions automationCompositionsFromRsc =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "DelBadRequest");
- instantiationProvider.createControlLoops(controlLoopsFromRsc);
+ instantiationProvider.createAutomationCompositions(automationCompositionsFromRsc);
- for (ControlLoop controlLoopFromRsc : controlLoopsFromRsc.getControlLoopList()) {
- Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT + "?name="
- + controlLoopFromRsc.getKey().getName());
+ for (AutomationComposition automationCompositionFromRsc : automationCompositionsFromRsc
+ .getAutomationCompositionList()) {
+ Invocation.Builder invocationBuilder =
+ super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName());
Response resp = invocationBuilder.delete();
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus());
}
@@ -326,8 +338,8 @@ class InstantiationControllerTest extends CommonRestController {
invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT);
resp = invocationBuilder.get();
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- var controlLoopsGet = resp.readEntity(ControlLoops.class);
- assertThat(controlLoopsGet.getControlLoopList()).hasSize(1);
+ var automationCompositionsGet = resp.readEntity(AutomationCompositions.class);
+ assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1);
}
@Test
@@ -340,9 +352,10 @@ class InstantiationControllerTest extends CommonRestController {
resp = invocationBuilder.delete();
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
var instanceResponse = resp.readEntity(InstantiationResponse.class);
- assertEquals(ID_NAME, instanceResponse.getAffectedControlLoops().get(0).getName());
- ControlLoops controlLoopsGet = instantiationProvider.getControlLoops(ID_NAME, ID_VERSION);
- assertThat(controlLoopsGet.getControlLoopList()).isEmpty();
+ assertEquals(ID_NAME, instanceResponse.getAffectedAutomationCompositions().get(0).getName());
+ AutomationCompositions automationCompositionsGet =
+ instantiationProvider.getAutomationCompositions(ID_NAME, ID_VERSION);
+ assertThat(automationCompositionsGet.getAutomationCompositionList()).isEmpty();
}
@Test
@@ -362,8 +375,9 @@ class InstantiationControllerTest extends CommonRestController {
Response resp = invocationBuilder.post(Entity.json(serviceTemplate));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- var controlLoops = InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Command");
- instantiationProvider.createControlLoops(controlLoops);
+ var automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Command");
+ instantiationProvider.createAutomationCompositions(automationCompositions);
var participants = CommonTestData.createParticipants();
for (var participant : participants) {
@@ -371,7 +385,7 @@ class InstantiationControllerTest extends CommonRestController {
}
InstantiationCommand command =
- InstantiationUtils.getInstantiationCommandFromResource(CL_INSTANTIATION_CHANGE_STATE_JSON, "Command");
+ InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Command");
invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT);
resp = invocationBuilder.put(Entity.json(command));
@@ -380,14 +394,15 @@ class InstantiationControllerTest extends CommonRestController {
InstantiationUtils.assertInstantiationResponse(instResponse, command);
// check passive state on DB and delete properties
- for (ToscaConceptIdentifier toscaConceptIdentifier : command.getControlLoopIdentifierList()) {
- ControlLoops controlLoopsGet = instantiationProvider.getControlLoops(toscaConceptIdentifier.getName(),
- toscaConceptIdentifier.getVersion());
- assertThat(controlLoopsGet.getControlLoopList()).hasSize(1);
- assertEquals(command.getOrderedState(), controlLoopsGet.getControlLoopList().get(0).getOrderedState());
-
- invocationBuilder = super.sendRequest(INSTANTIATION_PROPERTIES + "?name="
- + toscaConceptIdentifier.getName() + "&version=" + toscaConceptIdentifier.getVersion());
+ for (ToscaConceptIdentifier toscaConceptIdentifier : command.getAutomationCompositionIdentifierList()) {
+ AutomationCompositions automationCompositionsGet = instantiationProvider
+ .getAutomationCompositions(toscaConceptIdentifier.getName(), toscaConceptIdentifier.getVersion());
+ assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1);
+ assertEquals(command.getOrderedState(),
+ automationCompositionsGet.getAutomationCompositionList().get(0).getOrderedState());
+
+ invocationBuilder = super.sendRequest(INSTANTIATION_PROPERTIES + "?name=" + toscaConceptIdentifier.getName()
+ + "&version=" + toscaConceptIdentifier.getVersion());
resp = invocationBuilder.delete();
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus());
}
@@ -403,7 +418,7 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testCommand_NotFound2() throws Exception {
InstantiationCommand command =
- InstantiationUtils.getInstantiationCommandFromResource(CL_INSTANTIATION_CHANGE_STATE_JSON, "Command");
+ InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Command");
command.setOrderedState(null);
Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT);
@@ -413,8 +428,9 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testCommand() throws Exception {
- var controlLoops = InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Command");
- instantiationProvider.createControlLoops(controlLoops);
+ var automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Command");
+ instantiationProvider.createAutomationCompositions(automationCompositions);
var participants = CommonTestData.createParticipants();
for (var participant : participants) {
@@ -422,7 +438,7 @@ class InstantiationControllerTest extends CommonRestController {
}
InstantiationCommand command =
- InstantiationUtils.getInstantiationCommandFromResource(CL_INSTANTIATION_CHANGE_STATE_JSON, "Command");
+ InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Command");
Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT);
Response resp = invocationBuilder.put(Entity.json(command));
@@ -431,11 +447,12 @@ class InstantiationControllerTest extends CommonRestController {
InstantiationUtils.assertInstantiationResponse(instResponse, command);
// check passive state on DB
- for (ToscaConceptIdentifier toscaConceptIdentifier : command.getControlLoopIdentifierList()) {
- ControlLoops controlLoopsGet = instantiationProvider.getControlLoops(toscaConceptIdentifier.getName(),
- toscaConceptIdentifier.getVersion());
- assertThat(controlLoopsGet.getControlLoopList()).hasSize(1);
- assertEquals(command.getOrderedState(), controlLoopsGet.getControlLoopList().get(0).getOrderedState());
+ for (ToscaConceptIdentifier toscaConceptIdentifier : command.getAutomationCompositionIdentifierList()) {
+ AutomationCompositions automationCompositionsGet = instantiationProvider
+ .getAutomationCompositions(toscaConceptIdentifier.getName(), toscaConceptIdentifier.getVersion());
+ assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1);
+ assertEquals(command.getOrderedState(),
+ automationCompositionsGet.getAutomationCompositionList().get(0).getOrderedState());
}
}
@@ -452,19 +469,20 @@ class InstantiationControllerTest extends CommonRestController {
invocationBuilder = super.sendRequest(INSTANTIATION_STATE + "?name=" + ID_NAME + "&version=" + ID_VERSION);
resp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- var instanceOrderState = resp.readEntity(ControlLoopOrderStateResponse.class);
- assertEquals(ControlLoopOrderedState.UNINITIALISED, instanceOrderState.getOrderedState());
- assertEquals(ID_NAME, instanceOrderState.getControlLoopIdentifierList().get(0).getName());
- ControlLoops controlLoopsGet = instantiationProvider.getControlLoops(ID_NAME, ID_VERSION);
- assertThat(controlLoopsGet.getControlLoopList()).hasSize(1);
+ var instanceOrderState = resp.readEntity(AutomationCompositionOrderStateResponse.class);
+ assertEquals(AutomationCompositionOrderedState.UNINITIALISED, instanceOrderState.getOrderedState());
+ assertEquals(ID_NAME, instanceOrderState.getAutomationCompositionIdentifierList().get(0).getName());
+ AutomationCompositions automationCompositionsGet =
+ instantiationProvider.getAutomationCompositions(ID_NAME, ID_VERSION);
+ assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1);
invocationBuilder = super.sendRequest(INSTANTIATION_PROPERTIES + "?name=" + ID_NAME + "&version=" + ID_VERSION);
resp = invocationBuilder.delete();
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
var instanceResponse = resp.readEntity(InstantiationResponse.class);
- assertEquals(ID_NAME, instanceResponse.getAffectedControlLoops().get(0).getName());
- controlLoopsGet = instantiationProvider.getControlLoops(ID_NAME, ID_VERSION);
- assertThat(controlLoopsGet.getControlLoopList()).isEmpty();
+ assertEquals(ID_NAME, instanceResponse.getAffectedAutomationCompositions().get(0).getName());
+ automationCompositionsGet = instantiationProvider.getAutomationCompositions(ID_NAME, ID_VERSION);
+ assertThat(automationCompositionsGet.getAutomationCompositionList()).isEmpty();
}
@Test
@@ -473,18 +491,17 @@ class InstantiationControllerTest extends CommonRestController {
Response resp = invocationBuilder.post(Entity.json(serviceTemplate));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- var controlLoops = InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON,
- "CommandPassive");
- instantiationProvider.createControlLoops(controlLoops);
+ var automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "CommandPassive");
+ instantiationProvider.createAutomationCompositions(automationCompositions);
var participants = CommonTestData.createParticipants();
for (var participant : participants) {
participantProvider.saveParticipant(participant);
}
- InstantiationCommand command =
- InstantiationUtils.getInstantiationCommandFromResource(CL_INSTANTIATION_CHANGE_STATE_JSON,
- "CommandPassive");
+ InstantiationCommand command = InstantiationUtils
+ .getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "CommandPassive");
invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT);
resp = invocationBuilder.put(Entity.json(command));
@@ -499,13 +516,12 @@ class InstantiationControllerTest extends CommonRestController {
Response resp = invocationBuilder.post(Entity.json(serviceTemplate));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- var controlLoops = InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON,
- "CommandPassive");
- instantiationProvider.createControlLoops(controlLoops);
+ var automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "CommandPassive");
+ instantiationProvider.createAutomationCompositions(automationCompositions);
- InstantiationCommand command =
- InstantiationUtils.getInstantiationCommandFromResource(CL_INSTANTIATION_CHANGE_STATE_JSON,
- "CommandPassive");
+ InstantiationCommand command = InstantiationUtils
+ .getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "CommandPassive");
invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT);
resp = invocationBuilder.put(Entity.json(command));
@@ -513,7 +529,7 @@ class InstantiationControllerTest extends CommonRestController {
}
private synchronized void deleteEntryInDB() throws Exception {
- controlLoopRepository.deleteAll();
+ automationCompositionRepository.deleteAll();
var list = serviceTemplateProvider.getAllServiceTemplates();
if (!list.isEmpty()) {
serviceTemplateProvider.deleteServiceTemplate(list.get(0).getName(), list.get(0).getVersion());
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/rest/ActuatorControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/ActuatorControllerTest.java
index 433e914ae..553a4721b 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/rest/ActuatorControllerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/ActuatorControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.main.rest;
+package org.onap.policy.clamp.acm.runtime.main.rest;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -27,7 +27,7 @@ import javax.ws.rs.core.Response;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.acm.runtime.util.rest.CommonRestController;
import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/monitoring/TestMonitoringProvider.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/monitoring/TestMonitoringProvider.java
new file mode 100644
index 000000000..aabc254c1
--- /dev/null
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/monitoring/TestMonitoringProvider.java
@@ -0,0 +1,321 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.monitoring;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.time.Instant;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import javax.ws.rs.core.Response;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatisticsList;
+import org.onap.policy.clamp.models.acm.persistence.provider.AcElementStatisticsProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantStatisticsProvider;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+class TestMonitoringProvider {
+
+ private static final String AC_PARTICIPANT_STATISTICS_JSON =
+ "src/test/resources/rest/monitoring/TestParticipantStatistics.json";
+ private static final String INVALID_PARTICIPANT_JSON_INPUT =
+ "src/test/resources/rest/monitoring/TestParticipantStatistics_Invalid.json";
+ private static final String AC_ELEMENT_STATISTICS_JSON =
+ "src/test/resources/rest/monitoring/TestAcElementStatistics.json";
+ private static final String INVALID_AC_ELEMENT_JSON_INPUT =
+ "src/test/resources/rest/monitoring/TestAcElementStatistics_Invalid.json";
+ private static final Coder CODER = new StandardCoder();
+
+ private static final String STAT_LIST_IS_NULL = ".*StatisticsList is marked .*ull but is null";
+ private static final String PARTICIPANT_STAT_LIST_IS_NULL =
+ "participantStatisticsList is marked .*null but is null";
+ private static final String NAME_IS_NULL = "name is marked .*null but is null";
+ private static final String AC_LIST_IS_NULL = "acElementStatisticsList is marked .*null but is null";
+ private static final String ID_VERSION1 = "1.001";
+ private static final String ID_VERSION2 = "1.002";
+ private static final String ID_NAME1 = "name1";
+ private static final String ID_NAME2 = "name2";
+ private static final String SORT_DESC = "DESC";
+ private static final String ID_NAME3 = "testACName";
+ private static final String ID_INVALID_NAME = "invalidACName";
+ private static ParticipantStatisticsList inputParticipantStatistics;
+ private static ParticipantStatisticsList invalidParticipantInput;
+ private static AcElementStatisticsList inputAcElementStatistics;
+ private static AcElementStatisticsList invalidAcElementInput;
+
+ @BeforeAll
+ public static void beforeSetupStatistics() throws CoderException {
+ // Reading input json for statistics data
+ inputParticipantStatistics =
+ CODER.decode(new File(AC_PARTICIPANT_STATISTICS_JSON), ParticipantStatisticsList.class);
+ invalidParticipantInput =
+ CODER.decode(new File(INVALID_PARTICIPANT_JSON_INPUT), ParticipantStatisticsList.class);
+ inputAcElementStatistics = CODER.decode(new File(AC_ELEMENT_STATISTICS_JSON), AcElementStatisticsList.class);
+ invalidAcElementInput = CODER.decode(new File(INVALID_AC_ELEMENT_JSON_INPUT), AcElementStatisticsList.class);
+ }
+
+ @Test
+ void testCreateParticipantStatistics() throws Exception {
+ var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
+ var acElementStatisticsProvider = mock(AcElementStatisticsProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
+ MonitoringProvider provider =
+ new MonitoringProvider(participantStatisticsProvider, acElementStatisticsProvider, acProvider);
+
+ when(participantStatisticsProvider.createParticipantStatistics(any()))
+ .thenReturn(inputParticipantStatistics.getStatisticsList());
+
+ when(participantStatisticsProvider.createParticipantStatistics(eq(null)))
+ .thenThrow(new PfModelRuntimeException(Response.Status.BAD_REQUEST, PARTICIPANT_STAT_LIST_IS_NULL));
+
+ // Creating statistics data in db with null input
+
+ assertThatThrownBy(() -> {
+ provider.createParticipantStatistics(null);
+ }).hasMessageMatching(STAT_LIST_IS_NULL);
+
+ assertThatThrownBy(() -> {
+ provider.createParticipantStatistics(invalidParticipantInput.getStatisticsList());
+ }).hasMessageMatching(PARTICIPANT_STAT_LIST_IS_NULL);
+
+ // Creating statistics data from input json
+ ParticipantStatisticsList createResponse =
+ provider.createParticipantStatistics(inputParticipantStatistics.getStatisticsList());
+
+ assertThat(createResponse.getStatisticsList()).hasSize(3);
+ assertEquals(createResponse.getStatisticsList().toString().replaceAll("\\s+", ""),
+ inputParticipantStatistics.getStatisticsList().toString().replaceAll("\\s+", ""));
+ }
+
+ @Test
+ void testGetParticipantStatistics() throws Exception {
+ var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
+ when(participantStatisticsProvider.getFilteredParticipantStatistics(eq(ID_NAME1), any(), any(), any(), eq(null),
+ eq(SORT_DESC), eq(0))).thenReturn(List.of(inputParticipantStatistics.getStatisticsList().get(0)));
+
+ when(participantStatisticsProvider.getFilteredParticipantStatistics(eq(ID_NAME1), any(),
+ eq(Instant.parse("2021-01-11T12:00:00.000Z")), eq(Instant.parse("2021-01-11T16:00:00.000Z")), eq(null),
+ eq(SORT_DESC), eq(0))).thenReturn(List.of());
+
+ when(participantStatisticsProvider.getFilteredParticipantStatistics(eq(ID_NAME2), any(), any(), any(), eq(null),
+ eq(SORT_DESC), eq(1))).thenReturn(List.of(inputParticipantStatistics.getStatisticsList().get(2)));
+
+ var acProvider = mock(AutomationCompositionProvider.class);
+ var acElementStatisticsProvider = mock(AcElementStatisticsProvider.class);
+ MonitoringProvider provider =
+ new MonitoringProvider(participantStatisticsProvider, acElementStatisticsProvider, acProvider);
+ provider.createParticipantStatistics(inputParticipantStatistics.getStatisticsList());
+
+ assertThatThrownBy(() -> {
+ provider.fetchFilteredParticipantStatistics(null, null, 0, null, null);
+ }).hasMessageMatching(NAME_IS_NULL);
+
+ // Fetch specific statistics record with name, version and record count
+ ParticipantStatisticsList getResponse =
+ provider.fetchFilteredParticipantStatistics(ID_NAME2, ID_VERSION1, 1, null, null);
+ assertThat(getResponse.getStatisticsList()).hasSize(1);
+ assertEquals(getResponse.getStatisticsList().get(0).toString().replaceAll("\\s+", ""),
+ inputParticipantStatistics.getStatisticsList().get(2).toString().replaceAll("\\s+", ""));
+
+ // Fetch statistics using timestamp
+ getResponse = provider.fetchFilteredParticipantStatistics(ID_NAME1, ID_VERSION1, 0, null,
+ Instant.parse("2021-01-10T15:00:00.000Z"));
+ assertThat(getResponse.getStatisticsList()).hasSize(1);
+
+ getResponse = provider.fetchFilteredParticipantStatistics(ID_NAME1, ID_VERSION1, 0,
+ Instant.parse("2021-01-11T12:00:00.000Z"), Instant.parse("2021-01-11T16:00:00.000Z"));
+
+ assertThat(getResponse.getStatisticsList()).isEmpty();
+ }
+
+ @Test
+ void testCreateAcElementStatistics() throws Exception {
+ var acElementStatisticsProvider = mock(AcElementStatisticsProvider.class);
+ when(acElementStatisticsProvider.createAcElementStatistics(any()))
+ .thenReturn(inputAcElementStatistics.getAcElementStatistics());
+
+ when(acElementStatisticsProvider.createAcElementStatistics(eq(null)))
+ .thenThrow(new PfModelRuntimeException(Response.Status.BAD_REQUEST, AC_LIST_IS_NULL));
+
+ var acProvider = mock(AutomationCompositionProvider.class);
+
+ var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
+ MonitoringProvider provider =
+ new MonitoringProvider(participantStatisticsProvider, acElementStatisticsProvider, acProvider);
+ // Creating statistics data in db with null input
+ assertThatThrownBy(() -> {
+ provider.createAcElementStatistics(null);
+ }).hasMessageMatching(STAT_LIST_IS_NULL);
+
+ assertThatThrownBy(() -> {
+ provider.createAcElementStatistics(invalidAcElementInput.getAcElementStatistics());
+ }).hasMessageMatching(AC_LIST_IS_NULL);
+
+ // Creating acElement statistics data from input json
+ AcElementStatisticsList createResponse =
+ provider.createAcElementStatistics(inputAcElementStatistics.getAcElementStatistics());
+
+ assertThat(createResponse.getAcElementStatistics()).hasSize(4);
+ assertEquals(createResponse.getAcElementStatistics().toString().replaceAll("\\s+", ""),
+ inputAcElementStatistics.getAcElementStatistics().toString().replaceAll("\\s+", ""));
+ }
+
+ @Test
+ void testGetAcElementStatistics() throws Exception {
+ var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
+ var acElementStatisticsProvider = mock(AcElementStatisticsProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
+
+ when(acElementStatisticsProvider.getFilteredAcElementStatistics(eq(ID_NAME1), any(), any(), any(), anyMap(),
+ eq(SORT_DESC), eq(0)))
+ .thenReturn(List.of(inputAcElementStatistics.getAcElementStatistics().get(0),
+ inputAcElementStatistics.getAcElementStatistics().get(1)));
+
+ when(acElementStatisticsProvider.getFilteredAcElementStatistics(eq(ID_NAME1), any(), any(), any(), anyMap(),
+ eq(SORT_DESC), eq(0)))
+ .thenReturn(List.of(inputAcElementStatistics.getAcElementStatistics().get(0),
+ inputAcElementStatistics.getAcElementStatistics().get(1)));
+
+ MonitoringProvider provider =
+ new MonitoringProvider(participantStatisticsProvider, acElementStatisticsProvider, acProvider);
+ assertThatThrownBy(() -> {
+ provider.fetchFilteredAcElementStatistics(null, null, null, null, null, 0);
+ }).hasMessageMatching(NAME_IS_NULL);
+
+ provider.createAcElementStatistics(inputAcElementStatistics.getAcElementStatistics());
+
+ AcElementStatisticsList getResponse =
+ provider.fetchFilteredAcElementStatistics(ID_NAME1, null, null, null, null, 0);
+
+ assertThat(getResponse.getAcElementStatistics()).hasSize(2);
+ assertEquals(getResponse.getAcElementStatistics().get(0).toString().replaceAll("\\s+", ""),
+ inputAcElementStatistics.getAcElementStatistics().get(0).toString().replaceAll("\\s+", ""));
+
+ // Fetch specific statistics record with name, id and record count
+ getResponse = provider.fetchFilteredAcElementStatistics(ID_NAME1, ID_VERSION1,
+ "709c62b3-8918-41b9-a747-d21eb79c6c20", null, null, 0);
+ assertThat(getResponse.getAcElementStatistics()).hasSize(2);
+
+ // Fetch statistics using timestamp
+ getResponse = provider.fetchFilteredAcElementStatistics(ID_NAME1, ID_VERSION1, null,
+ Instant.parse("2021-01-10T13:45:00.000Z"), null, 0);
+ assertThat(getResponse.getAcElementStatistics()).hasSize(2);
+ }
+
+ @Test
+ void testGetParticipantStatsPerAc() throws Exception {
+ var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
+ var acElementStatisticsProvider = mock(AcElementStatisticsProvider.class);
+ var mockAcProvider = Mockito.mock(AutomationCompositionProvider.class);
+ var provider =
+ new MonitoringProvider(participantStatisticsProvider, acElementStatisticsProvider, mockAcProvider);
+
+ provider.createParticipantStatistics(inputParticipantStatistics.getStatisticsList());
+
+ var automationComposition = new AutomationComposition();
+ var element = new AutomationCompositionElement();
+ element.setParticipantId(new ToscaConceptIdentifier(ID_NAME1, ID_VERSION1));
+ automationComposition.setElements(Map.of(UUID.randomUUID(), element));
+ when(mockAcProvider.findAutomationComposition(new ToscaConceptIdentifier(ID_NAME2, ID_VERSION1)))
+ .thenReturn(Optional.of(automationComposition));
+
+ when(participantStatisticsProvider.getFilteredParticipantStatistics(eq(ID_NAME1), eq(ID_VERSION1), any(), any(),
+ eq(null), eq(SORT_DESC), eq(0)))
+ .thenReturn(List.of(inputParticipantStatistics.getStatisticsList().get(0),
+ inputParticipantStatistics.getStatisticsList().get(1)));
+
+ ParticipantStatisticsList getResponse =
+ provider.fetchParticipantStatsPerAutomationComposition(ID_NAME2, ID_VERSION1);
+ assertThat(getResponse.getStatisticsList()).hasSize(2);
+ assertEquals(getResponse.getStatisticsList().get(0).toString().replaceAll("\\s+", ""),
+ inputParticipantStatistics.getStatisticsList().get(0).toString().replaceAll("\\s+", ""));
+ assertThat(
+ provider.fetchParticipantStatsPerAutomationComposition(ID_INVALID_NAME, ID_VERSION2).getStatisticsList())
+ .isEmpty();
+ }
+
+ @Test
+ void testAcElementStatsPerAc() throws Exception {
+ // Setup a dummy automation composition data
+ var mockAcElement = new AutomationCompositionElement();
+ mockAcElement.setId(inputAcElementStatistics.getAcElementStatistics().get(0).getId());
+ mockAcElement.setParticipantId(new ToscaConceptIdentifier(
+ inputAcElementStatistics.getAcElementStatistics().get(0).getParticipantId().getName(),
+ inputAcElementStatistics.getAcElementStatistics().get(0).getParticipantId().getVersion()));
+ var mockAc = new AutomationComposition();
+ mockAc.setElements(new LinkedHashMap<>());
+ mockAc.getElements().put(mockAcElement.getId(), mockAcElement);
+
+ var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
+ var acElementStatisticsProvider = mock(AcElementStatisticsProvider.class);
+ var mockAcProvider = Mockito.mock(AutomationCompositionProvider.class);
+ var monitoringProvider =
+ new MonitoringProvider(participantStatisticsProvider, acElementStatisticsProvider, mockAcProvider);
+
+ // Mock automation composition data to be returned for the given AC Id
+ when(mockAcProvider.findAutomationComposition(new ToscaConceptIdentifier(ID_NAME3, ID_VERSION1)))
+ .thenReturn(Optional.of(mockAc));
+
+ when(acElementStatisticsProvider.getFilteredAcElementStatistics(eq(ID_NAME1), eq(ID_VERSION1), any(), any(),
+ anyMap(), eq(SORT_DESC), eq(0)))
+ .thenReturn(List.of(inputAcElementStatistics.getAcElementStatistics().get(0),
+ inputAcElementStatistics.getAcElementStatistics().get(1)));
+
+ monitoringProvider.createAcElementStatistics(inputAcElementStatistics.getAcElementStatistics());
+
+ AcElementStatisticsList getResponse =
+ monitoringProvider.fetchAcElementStatsPerAutomationComposition(ID_NAME3, ID_VERSION1);
+
+ assertThat(getResponse.getAcElementStatistics()).hasSize(2);
+ assertEquals(getResponse.getAcElementStatistics().get(1).toString().replaceAll("\\s+", ""),
+ inputAcElementStatistics.getAcElementStatistics().get(1).toString().replaceAll("\\s+", ""));
+
+ assertThat(monitoringProvider.fetchAcElementStatsPerAutomationComposition(ID_INVALID_NAME, ID_VERSION2)
+ .getAcElementStatistics()).isEmpty();
+
+ Map<String, ToscaConceptIdentifier> acElementIds =
+ monitoringProvider.getAllAcElementsIdPerAutomationComposition(ID_NAME3, ID_VERSION1);
+ assertThat(acElementIds)
+ .containsKey(inputAcElementStatistics.getAcElementStatistics().get(0).getId().toString());
+ }
+}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/rest/MonitoringQueryControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/monitoring/rest/MonitoringQueryControllerTest.java
index eaf824623..7630e42d2 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/rest/MonitoringQueryControllerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/monitoring/rest/MonitoringQueryControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.monitoring.rest;
+package org.onap.policy.clamp.acm.runtime.monitoring.rest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -32,10 +32,10 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatisticsList;
-import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringProvider;
-import org.onap.policy.clamp.controlloop.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.acm.runtime.monitoring.MonitoringProvider;
+import org.onap.policy.clamp.acm.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatisticsList;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.springframework.beans.factory.annotation.Autowired;
@@ -50,23 +50,23 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
@TestPropertySource(locations = {"classpath:application_test.properties"})
class MonitoringQueryControllerTest extends CommonRestController {
- private static final String CL_PARTICIPANT_STATISTICS_JSON =
+ private static final String AC_PARTICIPANT_STATISTICS_JSON =
"src/test/resources/rest/monitoring/TestParticipantStatistics.json";
- private static final String CL_ELEMENT_STATISTICS_JSON =
- "src/test/resources/rest/monitoring/TestClElementStatistics.json";
+ private static final String AC_ELEMENT_STATISTICS_JSON =
+ "src/test/resources/rest/monitoring/TestAcElementStatistics.json";
private static final Coder CODER = new StandardCoder();
private static ParticipantStatisticsList inputParticipantStatistics;
- private static ClElementStatisticsList inputClElementStatistics;
+ private static AcElementStatisticsList inputAcElementStatistics;
private static ParticipantStatisticsList participantStatisticsList;
- private static ClElementStatisticsList clElementStatisticsList;
+ private static AcElementStatisticsList acElementStatisticsList;
- private static final String CLELEMENT_STATS_ENDPOINT = "monitoring/clelement";
+ private static final String AC_ELEMENT_STATS_ENDPOINT = "monitoring/acelement";
private static final String PARTICIPANT_STATS_ENDPOINT = "monitoring/participant";
- private static final String PARTICIPANT_STATS_PER_CL_ENDPOINT = "monitoring/participants/controlloop";
- private static final String CLELEMENT_STATS_PER_CL_ENDPOINT = "monitoring/clelements/controlloop";
+ private static final String PARTICIPANT_STATS_PER_AC_ENDPOINT = "monitoring/participants/automationcomposition";
+ private static final String AC_ELEMENT_STATS_PER_AC_ENDPOINT = "monitoring/acelements/automationcomposition";
@Autowired
private MonitoringProvider monitoringProvider;
@@ -83,8 +83,8 @@ class MonitoringQueryControllerTest extends CommonRestController {
public static void setUpBeforeAll() throws Exception {
inputParticipantStatistics =
- CODER.decode(new File(CL_PARTICIPANT_STATISTICS_JSON), ParticipantStatisticsList.class);
- inputClElementStatistics = CODER.decode(new File(CL_ELEMENT_STATISTICS_JSON), ClElementStatisticsList.class);
+ CODER.decode(new File(AC_PARTICIPANT_STATISTICS_JSON), ParticipantStatisticsList.class);
+ inputAcElementStatistics = CODER.decode(new File(AC_ELEMENT_STATISTICS_JSON), AcElementStatisticsList.class);
}
@BeforeEach
@@ -94,78 +94,78 @@ class MonitoringQueryControllerTest extends CommonRestController {
// Insert Participant statistics to DB
participantStatisticsList =
monitoringProvider.createParticipantStatistics(inputParticipantStatistics.getStatisticsList());
- // Insert CL Element statistics to DB
- clElementStatisticsList =
- monitoringProvider.createClElementStatistics(inputClElementStatistics.getClElementStatistics());
+ // Insert AC Element statistics to DB
+ acElementStatisticsList =
+ monitoringProvider.createAcElementStatistics(inputAcElementStatistics.getAcElementStatistics());
}
@Test
- void testQuery_Unauthorized_for_ClElementStats() throws Exception {
- assertUnauthorizedGet(CLELEMENT_STATS_ENDPOINT);
+ void testQuery_Unauthorized_for_AcElementStats() throws Exception {
+ assertUnauthorizedGet(AC_ELEMENT_STATS_ENDPOINT);
}
@Test
- void testQuery_Unauthorized_for_ClParticipantStats() throws Exception {
+ void testQuery_Unauthorized_for_AcParticipantStats() throws Exception {
assertUnauthorizedGet(PARTICIPANT_STATS_ENDPOINT);
}
@Test
- void testQuery_Unauthorized_for_ParticipantStatsPerCl() throws Exception {
- assertUnauthorizedGet(PARTICIPANT_STATS_PER_CL_ENDPOINT);
+ void testQuery_Unauthorized_for_ParticipantStatsPerAc() throws Exception {
+ assertUnauthorizedGet(PARTICIPANT_STATS_PER_AC_ENDPOINT);
}
@Test
- void testQuery_Unauthorized_for_ClElementStatsPerCl() throws Exception {
- assertUnauthorizedGet(CLELEMENT_STATS_PER_CL_ENDPOINT);
+ void testQuery_Unauthorized_for_AcElementStatsPerAc() throws Exception {
+ assertUnauthorizedGet(AC_ELEMENT_STATS_PER_AC_ENDPOINT);
}
@Test
- void testSwagger_ClStats() throws Exception {
- super.testSwagger(CLELEMENT_STATS_ENDPOINT);
+ void testSwagger_AcStats() throws Exception {
+ super.testSwagger(AC_ELEMENT_STATS_ENDPOINT);
super.testSwagger(PARTICIPANT_STATS_ENDPOINT);
- super.testSwagger(CLELEMENT_STATS_PER_CL_ENDPOINT);
- super.testSwagger(PARTICIPANT_STATS_PER_CL_ENDPOINT);
+ super.testSwagger(AC_ELEMENT_STATS_PER_AC_ENDPOINT);
+ super.testSwagger(PARTICIPANT_STATS_PER_AC_ENDPOINT);
}
@Test
- void testClElementStatisticsEndpoint() throws Exception {
+ void testAcElementStatisticsEndpoint() throws Exception {
// Filter statistics only based on participant Id and UUID
- Invocation.Builder invokeRequest1 = super.sendRequest(CLELEMENT_STATS_ENDPOINT + "?name="
- + clElementStatisticsList.getClElementStatistics().get(0).getParticipantId().getName() + "&version="
- + clElementStatisticsList.getClElementStatistics().get(0).getParticipantId().getVersion() + "&id="
- + clElementStatisticsList.getClElementStatistics().get(0).getId().toString());
+ Invocation.Builder invokeRequest1 = super.sendRequest(AC_ELEMENT_STATS_ENDPOINT + "?name="
+ + acElementStatisticsList.getAcElementStatistics().get(0).getParticipantId().getName() + "&version="
+ + acElementStatisticsList.getAcElementStatistics().get(0).getParticipantId().getVersion() + "&id="
+ + acElementStatisticsList.getAcElementStatistics().get(0).getId().toString());
Response response1 = invokeRequest1.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), response1.getStatus());
- ClElementStatisticsList result1 = response1.readEntity(ClElementStatisticsList.class);
+ AcElementStatisticsList result1 = response1.readEntity(AcElementStatisticsList.class);
assertNotNull(result1);
- assertThat(result1.getClElementStatistics()).hasSize(2);
+ assertThat(result1.getAcElementStatistics()).hasSize(2);
- var clElementStat0 = clElementStatisticsList.getClElementStatistics().get(0);
- for (var clElement : result1.getClElementStatistics()) {
- assertEquals(clElement.getParticipantId().asConceptKey(), clElementStat0.getParticipantId().asConceptKey());
- assertEquals(clElement.getId(), clElementStat0.getId());
+ var acElementStat0 = acElementStatisticsList.getAcElementStatistics().get(0);
+ for (var acElement : result1.getAcElementStatistics()) {
+ assertEquals(acElement.getParticipantId().asConceptKey(), acElementStat0.getParticipantId().asConceptKey());
+ assertEquals(acElement.getId(), acElementStat0.getId());
}
// Filter statistics based on timestamp
- Invocation.Builder invokeRequest2 = super.sendRequest(CLELEMENT_STATS_ENDPOINT + "?name="
- + clElementStatisticsList.getClElementStatistics().get(1).getParticipantId().getName() + "&version="
- + clElementStatisticsList.getClElementStatistics().get(1).getParticipantId().getVersion()
+ Invocation.Builder invokeRequest2 = super.sendRequest(AC_ELEMENT_STATS_ENDPOINT + "?name="
+ + acElementStatisticsList.getAcElementStatistics().get(1).getParticipantId().getName() + "&version="
+ + acElementStatisticsList.getAcElementStatistics().get(1).getParticipantId().getVersion()
+ "&startTime=" + Instant.parse("2021-01-10T13:00:00.000Z") + "&endTime="
+ Instant.parse("2021-01-10T14:00:00.000Z"));
Response response2 = invokeRequest2.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), response2.getStatus());
- ClElementStatisticsList result2 = response2.readEntity(ClElementStatisticsList.class);
+ AcElementStatisticsList result2 = response2.readEntity(AcElementStatisticsList.class);
assertNotNull(result2);
- assertThat(result2.getClElementStatistics()).hasSize(1);
- assertEquals(result2.getClElementStatistics().get(0), clElementStat0);
+ assertThat(result2.getAcElementStatistics()).hasSize(1);
+ assertEquals(result2.getAcElementStatistics().get(0), acElementStat0);
}
@Test
- void testClElementStats_BadRequest() throws Exception {
- Invocation.Builder invokeRequest1 = super.sendRequest(CLELEMENT_STATS_ENDPOINT + "?version=1.0.0");
+ void testAcElementStats_BadRequest() throws Exception {
+ Invocation.Builder invokeRequest1 = super.sendRequest(AC_ELEMENT_STATS_ENDPOINT + "?version=1.0.0");
Response response1 = invokeRequest1.buildGet().invoke();
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response1.getStatus());
}
@@ -207,9 +207,9 @@ class MonitoringQueryControllerTest extends CommonRestController {
}
@Test
- void testParticipantStatsPerClEndpoint() throws Exception {
+ void testParticipantStatsPerAcEndpoint() throws Exception {
Invocation.Builder invokeRequest1 =
- super.sendRequest(PARTICIPANT_STATS_PER_CL_ENDPOINT + "?name=dummyName&version=1.001");
+ super.sendRequest(PARTICIPANT_STATS_PER_AC_ENDPOINT + "?name=dummyName&version=1.001");
Response response1 = invokeRequest1.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), response1.getStatus());
ParticipantStatisticsList result1 = response1.readEntity(ParticipantStatisticsList.class);
@@ -217,25 +217,25 @@ class MonitoringQueryControllerTest extends CommonRestController {
}
@Test
- void testParticipantStatsPerCl_BadRequest() throws Exception {
- Invocation.Builder invokeRequest1 = super.sendRequest(PARTICIPANT_STATS_PER_CL_ENDPOINT);
+ void testParticipantStatsPerAc_BadRequest() throws Exception {
+ Invocation.Builder invokeRequest1 = super.sendRequest(PARTICIPANT_STATS_PER_AC_ENDPOINT);
Response response1 = invokeRequest1.buildGet().invoke();
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response1.getStatus());
}
@Test
- void testClElementStatisticsPerClEndpoint() throws Exception {
+ void testAcElementStatisticsPerAcEndpoint() throws Exception {
Invocation.Builder invokeRequest1 =
- super.sendRequest(CLELEMENT_STATS_PER_CL_ENDPOINT + "?name=dummyName&version=1.001");
+ super.sendRequest(AC_ELEMENT_STATS_PER_AC_ENDPOINT + "?name=dummyName&version=1.001");
Response response1 = invokeRequest1.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), response1.getStatus());
- ClElementStatisticsList result1 = response1.readEntity(ClElementStatisticsList.class);
- assertThat(result1.getClElementStatistics()).isEmpty();
+ AcElementStatisticsList result1 = response1.readEntity(AcElementStatisticsList.class);
+ assertThat(result1.getAcElementStatistics()).isEmpty();
}
@Test
- void testClElementStatsPerCl_BadRequest() throws Exception {
- Invocation.Builder invokeRequest1 = super.sendRequest(CLELEMENT_STATS_PER_CL_ENDPOINT);
+ void testAcElementStatsPerAc_BadRequest() throws Exception {
+ Invocation.Builder invokeRequest1 = super.sendRequest(AC_ELEMENT_STATS_PER_AC_ENDPOINT);
Response response1 = invokeRequest1.buildGet().invoke();
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response1.getStatus());
}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/HandleCounterTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/HandleCounterTest.java
index 51f3b4a32..a6474c9e3 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/HandleCounterTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/HandleCounterTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision;
+package org.onap.policy.clamp.acm.runtime.supervision;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspectTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspectTest.java
index f5ab9f28d..487d41139 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspectTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspectTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision;
+package org.onap.policy.clamp.acm.runtime.supervision;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -27,7 +27,7 @@ import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class SupervisionAspectTest {
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
new file mode 100644
index 000000000..99e509c0e
--- /dev/null
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
@@ -0,0 +1,319 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.supervision;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
+import org.onap.policy.clamp.acm.runtime.monitoring.MonitoringProvider;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantDeregisterAckPublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantRegisterAckPublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantUpdatePublisher;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
+import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+class SupervisionHandlerTest {
+ private static final String TOSCA_TEMPLATE_YAML =
+ "src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml";
+ private static final String AC_INSTANTIATION_CREATE_JSON =
+ "src/test/resources/rest/acm/AutomationCompositions.json";
+ private static final ToscaConceptIdentifier identifier = new ToscaConceptIdentifier("PMSHInstance0Crud", "1.0.1");
+ private static final ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("ParticipantId", "1.0.0");
+ private static final ToscaConceptIdentifier participantType =
+ new ToscaConceptIdentifier("ParticipantType", "1.0.0");
+
+ @Test
+ void testTriggerAutomationCompositionSupervisionEmpty()
+ throws AutomationCompositionException, PfModelException, CoderException {
+ var handler =
+ createSupervisionHandler(mock(AutomationCompositionProvider.class), mock(ParticipantProvider.class),
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class),
+ mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE);
+
+ assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(List.of()))
+ .hasMessageMatching("The list of automation compositions for supervision is empty");
+ }
+
+ @Test
+ void testTriggerAutomationCompositionSupervision()
+ throws AutomationCompositionException, PfModelException, CoderException {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var handler = createSupervisionHandler(automationCompositionProvider, mock(ParticipantProvider.class),
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), automationCompositionUpdatePublisher,
+ mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE);
+
+ handler.triggerAutomationCompositionSupervision(List.of(identifier));
+
+ verify(automationCompositionUpdatePublisher).send(any(AutomationComposition.class));
+ verify(automationCompositionProvider).saveAutomationComposition(any(AutomationComposition.class));
+ }
+
+ @Test
+ void testTriggerAutomationCompositionUninitialised()
+ throws AutomationCompositionException, PfModelException, CoderException {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var handler = createSupervisionHandler(automationCompositionProvider, mock(ParticipantProvider.class),
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), automationCompositionUpdatePublisher,
+ mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.UNINITIALISED);
+
+ assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(List.of(identifier)))
+ .hasMessageMatching("Automation composition is already in state UNINITIALISED");
+ }
+
+ @Test
+ void testTriggerAutomationCompositionRunning()
+ throws AutomationCompositionException, PfModelException, CoderException {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var handler = createSupervisionHandler(automationCompositionProvider, mock(ParticipantProvider.class),
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), automationCompositionUpdatePublisher,
+ mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.RUNNING);
+
+ assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(List.of(identifier)))
+ .hasMessageMatching("Automation composition can't transition from state UNINITIALISED to state RUNNING");
+ }
+
+ @Test
+ void testHandleAutomationCompositionStateChangeAckMessage() throws PfModelException, CoderException {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var handler = createSupervisionHandler(automationCompositionProvider, mock(ParticipantProvider.class),
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class),
+ mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE);
+ var automationCompositionAckMessage =
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of());
+ automationCompositionAckMessage.setAutomationCompositionId(identifier);
+
+ handler.handleAutomationCompositionStateChangeAckMessage(automationCompositionAckMessage);
+
+ verify(automationCompositionProvider).saveAutomationComposition(any(AutomationComposition.class));
+ }
+
+ @Test
+ void testHandleAutomationCompositionUpdateAckMessage() throws PfModelException, CoderException {
+ var automationCompositionAckMessage =
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK);
+ automationCompositionAckMessage.setParticipantId(participantId);
+ automationCompositionAckMessage.setParticipantType(participantType);
+ automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of());
+ automationCompositionAckMessage.setAutomationCompositionId(identifier);
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var handler = createSupervisionHandler(automationCompositionProvider, mock(ParticipantProvider.class),
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class),
+ mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE);
+
+ handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage);
+
+ verify(automationCompositionProvider).saveAutomationComposition(any(AutomationComposition.class));
+ }
+
+ @Test
+ void testHandleParticipantDeregister() throws PfModelException, CoderException {
+ var participant = new Participant();
+ participant.setName(participantId.getName());
+ participant.setVersion(participantId.getVersion());
+ participant.setParticipantType(participantType);
+
+ var participantProvider = mock(ParticipantProvider.class);
+ when(participantProvider.findParticipant(participantId.getName(), participantId.getVersion()))
+ .thenReturn(Optional.of(participant));
+
+ var participantDeregisterMessage = new ParticipantDeregister();
+ participantDeregisterMessage.setMessageId(UUID.randomUUID());
+ participantDeregisterMessage.setParticipantId(participantId);
+ participantDeregisterMessage.setParticipantType(participantType);
+ var participantDeregisterAckPublisher = mock(ParticipantDeregisterAckPublisher.class);
+ var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), participantProvider,
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ participantDeregisterAckPublisher, mock(AutomationCompositionUpdatePublisher.class),
+ mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE);
+
+ handler.handleParticipantMessage(participantDeregisterMessage);
+
+ verify(participantProvider).saveParticipant(any());
+ verify(participantDeregisterAckPublisher).send(participantDeregisterMessage.getMessageId());
+ }
+
+ @Test
+ void testHandleParticipantRegister() throws PfModelException, CoderException {
+ var participant = new Participant();
+ participant.setName(participantId.getName());
+ participant.setVersion(participantId.getVersion());
+ participant.setParticipantType(participantType);
+
+ var participantRegisterMessage = new ParticipantRegister();
+ participantRegisterMessage.setMessageId(UUID.randomUUID());
+ participantRegisterMessage.setParticipantId(participantId);
+ participantRegisterMessage.setParticipantType(participantType);
+ var participantProvider = mock(ParticipantProvider.class);
+ var participantRegisterAckPublisher = mock(ParticipantRegisterAckPublisher.class);
+ var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), participantProvider,
+ mock(MonitoringProvider.class), participantRegisterAckPublisher,
+ mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class),
+ mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE);
+
+ handler.handleParticipantMessage(participantRegisterMessage);
+
+ verify(participantProvider).saveParticipant(any());
+ verify(participantRegisterAckPublisher).send(participantRegisterMessage.getMessageId(), participantId,
+ participantType);
+ }
+
+ @Test
+ void testParticipantUpdateAck() throws PfModelException, CoderException {
+ var participant = new Participant();
+ participant.setName(participantId.getName());
+ participant.setVersion(participantId.getVersion());
+ participant.setParticipantType(participantType);
+
+ var participantProvider = mock(ParticipantProvider.class);
+ when(participantProvider.findParticipant(participantId.getName(), participantId.getVersion()))
+ .thenReturn(Optional.of(participant));
+
+ var participantUpdateAckMessage = new ParticipantUpdateAck();
+ participantUpdateAckMessage.setParticipantId(participantId);
+ participantUpdateAckMessage.setParticipantType(participantType);
+ participantUpdateAckMessage.setState(ParticipantState.PASSIVE);
+ var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), participantProvider,
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class),
+ mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE);
+
+ handler.handleParticipantMessage(participantUpdateAckMessage);
+
+ verify(participantProvider).saveParticipant(any());
+ }
+
+ @Test
+ void testHandleParticipantStatus() throws PfModelException, CoderException {
+ var participantStatusMessage = new ParticipantStatus();
+ participantStatusMessage.setParticipantId(participantId);
+ participantStatusMessage.setParticipantType(participantType);
+ participantStatusMessage.setState(ParticipantState.PASSIVE);
+ participantStatusMessage.setHealthStatus(ParticipantHealthStatus.HEALTHY);
+ participantStatusMessage.setParticipantStatistics(new ParticipantStatistics());
+
+ var participantProvider = mock(ParticipantProvider.class);
+ var monitoringProvider = mock(MonitoringProvider.class);
+ var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), participantProvider,
+ monitoringProvider, mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class),
+ mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE);
+ handler.handleParticipantMessage(participantStatusMessage);
+
+ verify(participantProvider).saveParticipant(any());
+ verify(monitoringProvider).createParticipantStatistics(anyList());
+ }
+
+ @Test
+ void testHandleSendCommissionMessage() throws PfModelException, CoderException {
+ var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
+ var handler =
+ createSupervisionHandler(mock(AutomationCompositionProvider.class), mock(ParticipantProvider.class),
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class),
+ participantUpdatePublisher, AutomationCompositionOrderedState.PASSIVE);
+ handler.handleSendCommissionMessage(participantId.getName(), participantId.getVersion());
+
+ verify(participantUpdatePublisher).sendComissioningBroadcast(participantId.getName(),
+ participantId.getVersion());
+ }
+
+ @Test
+ void testHandleSendDeCommissionMessage() throws PfModelException, CoderException {
+ var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
+ var handler =
+ createSupervisionHandler(mock(AutomationCompositionProvider.class), mock(ParticipantProvider.class),
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class),
+ participantUpdatePublisher, AutomationCompositionOrderedState.PASSIVE);
+ handler.handleSendDeCommissionMessage();
+
+ verify(participantUpdatePublisher).sendDecomisioning();
+ }
+
+ private SupervisionHandler createSupervisionHandler(AutomationCompositionProvider automationCompositionProvider,
+ ParticipantProvider participantProvider, MonitoringProvider monitoringProvider,
+ ParticipantRegisterAckPublisher participantRegisterAckPublisher,
+ ParticipantDeregisterAckPublisher participantDeregisterAckPublisher,
+ AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher,
+ ParticipantUpdatePublisher participantUpdatePublisher, AutomationCompositionOrderedState orderedState)
+ throws PfModelException, CoderException {
+ var automationCompositionsCreate =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud");
+
+ var automationComposition = automationCompositionsCreate.getAutomationCompositionList().get(0);
+ automationComposition.setOrderedState(orderedState);
+
+ when(automationCompositionProvider.findAutomationComposition(identifier))
+ .thenReturn(Optional.of(automationComposition));
+ when(automationCompositionProvider.getAutomationComposition(identifier)).thenReturn(automationComposition);
+
+ var serviceTemplateProvider = Mockito.mock(ServiceTemplateProvider.class);
+ when(serviceTemplateProvider.getServiceTemplateList(any(), any()))
+ .thenReturn(List.of(InstantiationUtils.getToscaServiceTemplate(TOSCA_TEMPLATE_YAML)));
+
+ var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
+
+ return new SupervisionHandler(automationCompositionProvider, participantProvider, monitoringProvider,
+ serviceTemplateProvider, automationCompositionUpdatePublisher, automationCompositionStateChangePublisher,
+ participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher);
+
+ }
+}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
new file mode 100644
index 000000000..cd1a49b46
--- /dev/null
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
@@ -0,0 +1,214 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.supervision;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantStatusReqPublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantUpdatePublisher;
+import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+
+class SupervisionScannerTest {
+
+ private static final String TOSCA_SERVICE_TEMPLATE_YAML =
+ "src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml";
+ private static final String AC_JSON = "src/test/resources/rest/acm/AutomationCompositionsSmoke.json";
+
+ private static ServiceTemplateProvider serviceTemplateProvider = mock(ServiceTemplateProvider.class);
+
+ @BeforeAll
+ public static void setUpBeforeAll() throws Exception {
+ ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
+ when(serviceTemplateProvider.getAllServiceTemplates()).thenReturn(List.of(serviceTemplate));
+ }
+
+ @Test
+ void testScannerOrderedStateEqualsToState() throws PfModelException, CoderException {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
+ var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var participantProvider = mock(ParticipantProvider.class);
+ var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class);
+ var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
+ var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
+
+ var automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud").getAutomationCompositionList();
+ when(automationCompositionProvider.getAutomationCompositions()).thenReturn(automationCompositions);
+
+ var supervisionScanner = new SupervisionScanner(automationCompositionProvider, serviceTemplateProvider,
+ automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
+ supervisionScanner.run(false);
+
+ verify(automationCompositionProvider, times(0)).saveAutomationComposition(any(AutomationComposition.class));
+ }
+
+ @Test
+ void testScannerOrderedStateDifferentToState() throws PfModelException, CoderException {
+ var automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud").getAutomationCompositionList();
+ automationCompositions.get(0).setState(AutomationCompositionState.UNINITIALISED2PASSIVE);
+ automationCompositions.get(0).setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ when(automationCompositionProvider.getAutomationCompositions()).thenReturn(automationCompositions);
+
+ var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
+ var participantProvider = mock(ParticipantProvider.class);
+ var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class);
+ var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
+ var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
+
+ var supervisionScanner = new SupervisionScanner(automationCompositionProvider, serviceTemplateProvider,
+ automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
+ supervisionScanner.run(false);
+
+ verify(automationCompositionProvider, times(1)).saveAutomationComposition(any(AutomationComposition.class));
+ }
+
+ @Test
+ void testScanner() throws PfModelException {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var automationComposition = new AutomationComposition();
+ when(automationCompositionProvider.getAutomationCompositions()).thenReturn(List.of(automationComposition));
+
+ var participantProvider = mock(ParticipantProvider.class);
+ var participant = new Participant();
+ participant.setName("Participant0");
+ participant.setVersion("1.0.0");
+ when(participantProvider.getParticipants(null, null)).thenReturn(List.of(participant));
+
+ var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class);
+ var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
+ var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
+ var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
+
+ var supervisionScanner = new SupervisionScanner(automationCompositionProvider, serviceTemplateProvider,
+ automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
+
+ supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier());
+ supervisionScanner.run(true);
+ verify(automationCompositionProvider, times(0)).saveAutomationComposition(any(AutomationComposition.class));
+ verify(participantStatusReqPublisher, times(0)).send(any(ToscaConceptIdentifier.class));
+ }
+
+ @Test
+ void testSendAutomationCompositionMsgUpdate() throws PfModelException, CoderException {
+ var automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud").getAutomationCompositionList();
+ automationCompositions.get(0).setState(AutomationCompositionState.UNINITIALISED2PASSIVE);
+ automationCompositions.get(0).setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ for (var element : automationCompositions.get(0).getElements().values()) {
+ if ("org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement"
+ .equals(element.getDefinition().getName())) {
+ element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ element.setState(AutomationCompositionState.UNINITIALISED);
+ } else {
+ element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ element.setState(AutomationCompositionState.PASSIVE);
+ }
+ }
+
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ when(automationCompositionProvider.getAutomationCompositions()).thenReturn(automationCompositions);
+
+ var participantProvider = mock(ParticipantProvider.class);
+ var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class);
+ var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
+ var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
+ var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
+
+ var supervisionScanner = new SupervisionScanner(automationCompositionProvider, serviceTemplateProvider,
+ automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
+
+ supervisionScanner.run(false);
+
+ verify(automationCompositionUpdatePublisher).send(any(AutomationComposition.class), anyInt());
+ }
+
+ @Test
+ void testScanParticipant() throws PfModelException {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var automationComposition = new AutomationComposition();
+ when(automationCompositionProvider.getAutomationCompositions()).thenReturn(List.of(automationComposition));
+
+ var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanParticipant");
+ acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().setMaxWaitMs(-1);
+ acRuntimeParameterGroup.getParticipantParameters().setMaxStatusWaitMs(-1);
+
+ var participant = new Participant();
+ participant.setName("Participant0");
+ participant.setVersion("1.0.0");
+ participant.setHealthStatus(ParticipantHealthStatus.HEALTHY);
+ participant.setParticipantState(ParticipantState.ACTIVE);
+ participant.setDefinition(new ToscaConceptIdentifier("unknown", "0.0.0"));
+ participant.setParticipantType(new ToscaConceptIdentifier("ParticipantType1", "1.0.0"));
+ var participantProvider = mock(ParticipantProvider.class);
+ when(participantProvider.getParticipants()).thenReturn(List.of(participant));
+
+ var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class);
+ var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
+ var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
+
+ var supervisionScanner = new SupervisionScanner(automationCompositionProvider, serviceTemplateProvider,
+ automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
+
+ supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier());
+ supervisionScanner.run(true);
+ verify(participantStatusReqPublisher).send(any(ToscaConceptIdentifier.class));
+ verify(participantProvider).saveParticipant(any());
+
+ supervisionScanner.run(true);
+ verify(participantProvider, times(2)).saveParticipant(any());
+ }
+}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
index a465aa254..6545fe395 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.supervision.comm;
+package org.onap.policy.clamp.acm.runtime.supervision.comm;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -35,20 +35,20 @@ import java.util.UUID;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ClElementStatisticsProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantStatisticsProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringProvider;
-import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
-import org.onap.policy.clamp.controlloop.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.acm.runtime.monitoring.MonitoringProvider;
+import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
+import org.onap.policy.clamp.acm.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
+import org.onap.policy.clamp.models.acm.persistence.provider.AcElementStatisticsProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantStatisticsProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.models.base.PfModelException;
@@ -69,21 +69,21 @@ class SupervisionMessagesTest extends CommonRestController {
*/
@BeforeAll
public static void setupDbProviderParameters() throws PfModelException {
- var clProvider = mock(ControlLoopProvider.class);
+ var acProvider = mock(AutomationCompositionProvider.class);
var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
- var clElementStatisticsProvider = mock(ClElementStatisticsProvider.class);
+ var acElementStatisticsProvider = mock(AcElementStatisticsProvider.class);
var monitoringProvider =
- new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, clProvider);
+ new MonitoringProvider(participantStatisticsProvider, acElementStatisticsProvider, acProvider);
var participantProvider = mock(ParticipantProvider.class);
var serviceTemplateProvider = Mockito.mock(ServiceTemplateProvider.class);
- var controlLoopUpdatePublisher = Mockito.mock(ControlLoopUpdatePublisher.class);
- var controlLoopStateChangePublisher = Mockito.mock(ControlLoopStateChangePublisher.class);
+ var automationCompositionUpdatePublisher = Mockito.mock(AutomationCompositionUpdatePublisher.class);
+ var automationCompositionStateChangePublisher = Mockito.mock(AutomationCompositionStateChangePublisher.class);
var participantRegisterAckPublisher = Mockito.mock(ParticipantRegisterAckPublisher.class);
var participantDeregisterAckPublisher = Mockito.mock(ParticipantDeregisterAckPublisher.class);
var participantUpdatePublisher = Mockito.mock(ParticipantUpdatePublisher.class);
- supervisionHandler = new SupervisionHandler(clProvider, participantProvider, monitoringProvider,
- serviceTemplateProvider, controlLoopUpdatePublisher, controlLoopStateChangePublisher,
- participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher);
+ supervisionHandler = new SupervisionHandler(acProvider, participantProvider, monitoringProvider,
+ serviceTemplateProvider, automationCompositionUpdatePublisher, automationCompositionStateChangePublisher,
+ participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher);
}
@Test
@@ -94,9 +94,9 @@ class SupervisionMessagesTest extends CommonRestController {
participantRegisterAckMsg.setResult(true);
synchronized (lockit) {
- ParticipantRegisterAckPublisher clRegisterAckPublisher = new ParticipantRegisterAckPublisher();
- clRegisterAckPublisher.active(List.of(Mockito.mock(TopicSink.class)));
- assertThatCode(() -> clRegisterAckPublisher.send(participantRegisterAckMsg)).doesNotThrowAnyException();
+ ParticipantRegisterAckPublisher acRegisterAckPublisher = new ParticipantRegisterAckPublisher();
+ acRegisterAckPublisher.active(List.of(Mockito.mock(TopicSink.class)));
+ assertThatCode(() -> acRegisterAckPublisher.send(participantRegisterAckMsg)).doesNotThrowAnyException();
}
}
@@ -109,10 +109,10 @@ class SupervisionMessagesTest extends CommonRestController {
synchronized (lockit) {
ParticipantDeregisterListener participantDeregisterListener =
- new ParticipantDeregisterListener(supervisionHandler);
+ new ParticipantDeregisterListener(supervisionHandler);
assertThatCode(
- () -> participantDeregisterListener.onTopicEvent(INFRA, TOPIC, null, participantDeregisterMsg))
- .doesNotThrowAnyException();
+ () -> participantDeregisterListener.onTopicEvent(INFRA, TOPIC, null, participantDeregisterMsg))
+ .doesNotThrowAnyException();
}
}
@@ -124,9 +124,9 @@ class SupervisionMessagesTest extends CommonRestController {
participantDeregisterAckMsg.setResult(true);
synchronized (lockit) {
- ParticipantDeregisterAckPublisher clDeregisterAckPublisher = new ParticipantDeregisterAckPublisher();
- clDeregisterAckPublisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
- assertThatCode(() -> clDeregisterAckPublisher.send(participantDeregisterAckMsg)).doesNotThrowAnyException();
+ ParticipantDeregisterAckPublisher acDeregisterAckPublisher = new ParticipantDeregisterAckPublisher();
+ acDeregisterAckPublisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
+ assertThatCode(() -> acDeregisterAckPublisher.send(participantDeregisterAckMsg)).doesNotThrowAnyException();
}
}
@@ -141,24 +141,24 @@ class SupervisionMessagesTest extends CommonRestController {
synchronized (lockit) {
ParticipantUpdateAckListener participantUpdateAckListener =
- new ParticipantUpdateAckListener(supervisionHandler);
+ new ParticipantUpdateAckListener(supervisionHandler);
assertThatCode(() -> participantUpdateAckListener.onTopicEvent(INFRA, TOPIC, null, participantUpdateAckMsg))
- .doesNotThrowAnyException();
+ .doesNotThrowAnyException();
}
}
@Test
- void testSendControlLoopStateChangePublisherNotActive() {
- var publisher = new ControlLoopStateChangePublisher();
- assertThatThrownBy(() -> publisher.send(getControlLoop(), 0)).hasMessage(NOT_ACTIVE);
+ void testSendAutomationCompositionStateChangePublisherNotActive() {
+ var publisher = new AutomationCompositionStateChangePublisher();
+ assertThatThrownBy(() -> publisher.send(getAutomationComposition(), 0)).hasMessage(NOT_ACTIVE);
}
@Test
- void testSendControlLoopStateChangePublisher() {
- var publisher = new ControlLoopStateChangePublisher();
+ void testSendAutomationCompositionStateChangePublisher() {
+ var publisher = new AutomationCompositionStateChangePublisher();
var topicSink = mock(TopicSink.class);
publisher.active(List.of(topicSink));
- publisher.send(getControlLoop(), 0);
+ publisher.send(getAutomationComposition(), 0);
verify(topicSink).send(anyString());
}
@@ -207,12 +207,12 @@ class SupervisionMessagesTest extends CommonRestController {
verify(topicSink).send(anyString());
}
- private ControlLoop getControlLoop() {
- var controlLoop = new ControlLoop();
- controlLoop.setName("NAME");
- controlLoop.setVersion("0.0.1");
- controlLoop.setState(ControlLoopState.UNINITIALISED);
- return controlLoop;
+ private AutomationComposition getAutomationComposition() {
+ var automationComposition = new AutomationComposition();
+ automationComposition.setName("NAME");
+ automationComposition.setVersion("0.0.1");
+ automationComposition.setState(AutomationCompositionState.UNINITIALISED);
+ return automationComposition;
}
private ToscaConceptIdentifier getParticipantId() {
@@ -220,6 +220,6 @@ class SupervisionMessagesTest extends CommonRestController {
}
private ToscaConceptIdentifier getParticipantType() {
- return new ToscaConceptIdentifier("org.onap.policy.controlloop.PolicyControlLoopParticipant", "2.3.1");
+ return new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1");
}
}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/CommonTestData.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
index 13d30e401..33a00c21b 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/CommonTestData.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.util;
+package org.onap.policy.clamp.acm.runtime.util;
import java.util.List;
import javax.ws.rs.core.Response.Status;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup;
+import org.onap.policy.clamp.acm.runtime.main.parameters.AcRuntimeParameterGroup;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -44,30 +44,31 @@ public class CommonTestData {
private static final Coder CODER = new StandardCoder();
/**
- * Gets the standard Control Loop parameters.
+ * Gets the standard automation composition parameters.
*
* @param dbName the database name
- * @return the standard Control Loop parameters
- * @throws ControlLoopRuntimeException on errors reading the control loop parameters
+ * @return the standard automation composition parameters
+ * @throws AutomationCompositionRuntimeException on errors reading the automation composition parameters
*/
- public static ClRuntimeParameterGroup geParameterGroup(final String dbName) {
+ public static AcRuntimeParameterGroup geParameterGroup(final String dbName) {
try {
- return CODER.convert(getParameterGroupAsString(dbName), ClRuntimeParameterGroup.class);
+ return CODER.convert(getParameterGroupAsString(dbName), AcRuntimeParameterGroup.class);
} catch (CoderException e) {
- throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, "cannot read Control Loop parameters", e);
+ throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE,
+ "cannot read automation composition parameters", e);
}
}
/**
- * Gets the standard Control Loop parameters, as a String.
+ * Gets the standard automation composition parameters, as a String.
*
* @param dbName the database name
- * @return the standard Control Loop parameters as string
+ * @return the standard automation composition parameters as string
*/
public static String getParameterGroupAsString(final String dbName) {
return ResourceUtils.getResourceAsString("src/test/resources/parameters/TestParameters.json")
- .replace("${dbName}", "jdbc:h2:mem:" + dbName);
+ .replace("${dbName}", "jdbc:h2:mem:" + dbName);
}
/**
@@ -77,7 +78,7 @@ public class CommonTestData {
* @return a new PolicyModelsProvider
*/
public static PolicyModelsProvider getPolicyModelsProvider(
- PolicyModelsProviderParameters databaseProviderParameters) {
+ PolicyModelsProviderParameters databaseProviderParameters) {
try {
return new PolicyModelsProviderFactory().createPolicyModelsProvider(databaseProviderParameters);
} catch (PfModelException e) {
@@ -92,15 +93,16 @@ public class CommonTestData {
*/
public static List<Participant> createParticipants() {
var participant1 = createParticipant(
- new ToscaConceptIdentifier("org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", "2.3.4"),
- new ToscaConceptIdentifier("org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
- "2.3.4"));
+ new ToscaConceptIdentifier("org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
+ "2.3.4"),
+ new ToscaConceptIdentifier("org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
+ "2.3.4"));
var participant2 = createParticipant(
- new ToscaConceptIdentifier("org.onap.policy.controlloop.PolicyControlLoopParticipant", "2.3.1"),
- new ToscaConceptIdentifier("org.onap.policy.controlloop.PolicyControlLoopParticipant", "2.3.1"));
+ new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1"),
+ new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1"));
var participant3 = createParticipant(
- new ToscaConceptIdentifier("org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", "2.2.1"),
- new ToscaConceptIdentifier("org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", "2.2.1"));
+ new ToscaConceptIdentifier("org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", "2.2.1"),
+ new ToscaConceptIdentifier("org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", "2.2.1"));
return List.of(participant1, participant2, participant3);
}
@@ -112,7 +114,7 @@ public class CommonTestData {
* @return a new Participant
*/
public static Participant createParticipant(ToscaConceptIdentifier participantType,
- ToscaConceptIdentifier participantId) {
+ ToscaConceptIdentifier participantId) {
var participant = new Participant();
participant.setDefinition(participantId);
participant.setParticipantType(participantType);
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/rest/CommonRestController.java
index 70b0608d6..0fc0a6e9f 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/rest/CommonRestController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.runtime.util.rest;
+package org.onap.policy.clamp.acm.runtime.util.rest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
@@ -42,7 +42,7 @@ import org.onap.policy.common.utils.network.NetworkUtil;
public class CommonRestController {
public static final String SELF = NetworkUtil.getHostname();
- public static final String CONTEXT_PATH = "onap/controlloop";
+ public static final String CONTEXT_PATH = "onap/automationcomposition";
public static final String ENDPOINT_PREFIX = CONTEXT_PATH + "/v2/";
public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/";
diff --git a/runtime-controlloop/src/test/resources/application_test.properties b/runtime-acm/src/test/resources/application_test.properties
index 52c372d5e..a9060e65c 100644
--- a/runtime-controlloop/src/test/resources/application_test.properties
+++ b/runtime-acm/src/test/resources/application_test.properties
@@ -19,18 +19,18 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.HSQLDialect
spring.jpa.properties.hibernate.format_sql=true
server.port=6969
-server.servlet.context-path=/onap/controlloop
+server.servlet.context-path=/onap/automationcomposition
server.error.path=/error
runtime.participantParameters.heartBeatMs=20000
runtime.participantParameters.maxStatusWaitMs=100000
runtime.participantParameters.updateParameters.maxRetryCount=3
runtime.participantParameters.updateParameters.maxWaitMs=20000
-runtime.topicParameterGroup.topicSources[0].topic=POLICY-CLRUNTIME-PARTICIPANT
+runtime.topicParameterGroup.topicSources[0].topic=POLICY-ACRUNTIME-PARTICIPANT
runtime.topicParameterGroup.topicSources[0].servers[0]=localhost
runtime.topicParameterGroup.topicSources[0].topicCommInfrastructure=dmaap
runtime.topicParameterGroup.topicSources[0].fetchTimeout=15000
-runtime.topicParameterGroup.topicSinks[0].topic=POLICY-CLRUNTIME-PARTICIPANT
+runtime.topicParameterGroup.topicSinks[0].topic=POLICY-ACRUNTIME-PARTICIPANT
runtime.topicParameterGroup.topicSinks[0].servers[0]=localhost
runtime.topicParameterGroup.topicSinks[0].topicCommInfrastructure=dmaap
diff --git a/runtime-controlloop/src/test/resources/parameters/TestParameters.json b/runtime-acm/src/test/resources/parameters/TestParameters.json
index 6d16f4853..c44e92e4d 100644
--- a/runtime-controlloop/src/test/resources/parameters/TestParameters.json
+++ b/runtime-acm/src/test/resources/parameters/TestParameters.json
@@ -1,8 +1,8 @@
{
- "name": "ControlLoopRuntimeGroup",
+ "name": "AutomationCompositionRuntimeGroup",
"supervisionScannerIntervalSec": 1000,
- "participantClUpdateIntervalSec": 1000,
- "participantClStateChangeIntervalSec": 1000,
+ "participantAcUpdateIntervalSec": 1000,
+ "participantAcStateChangeIntervalSec": 1000,
"participantParameters": {
"heartBeatMs": 120000,
"maxStatusWaitMs": 100000,
@@ -23,7 +23,7 @@
"topicParameterGroup": {
"topicSources": [
{
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "topic": "POLICY-ACRUNTIME-PARTICIPANT",
"servers": [
"localhost"
],
@@ -33,7 +33,7 @@
],
"topicSinks": [
{
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "topic": "POLICY-ACRUNTIME-PARTICIPANT",
"servers": [
"localhost"
],
diff --git a/runtime-controlloop/src/test/resources/parameters/logback-test.xml b/runtime-acm/src/test/resources/parameters/logback-test.xml
index e00c36baa..ad1e35624 100644
--- a/runtime-controlloop/src/test/resources/parameters/logback-test.xml
+++ b/runtime-acm/src/test/resources/parameters/logback-test.xml
@@ -36,7 +36,7 @@
<appender-ref ref="STDOUT" />
</root>
- <logger name="org.onap.policy.clamp.controlloop.runtime" level="trace" additivity="false">
+ <logger name="org.onap.policy.clamp.acm.runtime" level="trace" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
</configuration>
diff --git a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopElementsNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
index faea7cd48..7e1107c0a 100644
--- a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopElementsNotFound.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
@@ -1,15 +1,15 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"name": "PMSHInstance0",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 0",
+ "description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
@@ -18,54 +18,54 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
},
@@ -73,12 +73,12 @@
"name": "PMSHInstance1",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 1",
+ "description": "PMSH automation composition instance 1",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c24": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c24",
@@ -87,54 +87,54 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 1 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 1 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition"
}
}
}
diff --git a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsVersionNotMatches.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionVersionNotMatches.json
index 76131afc1..d29444a09 100644
--- a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsVersionNotMatches.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionVersionNotMatches.json
@@ -1,15 +1,15 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"name": "PMSHInstance0",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 0",
+ "description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
@@ -18,54 +18,54 @@
"version": "1.0.0"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
},
@@ -73,12 +73,12 @@
"name": "PMSHInstance1",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 1",
+ "description": "PMSH automation composition instance 1",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c24": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c24",
@@ -87,54 +87,54 @@
"version": "1.0.0"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 1 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 1 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition"
}
}
}
diff --git a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoops.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json
index 64443ff62..f368cd69d 100644
--- a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoops.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json
@@ -1,15 +1,15 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"name": "PMSHInstance0",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 0",
+ "description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
@@ -18,70 +18,70 @@
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
},
@@ -89,12 +89,12 @@
"name": "PMSHInstance1",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 1",
+ "description": "PMSH automation composition instance 1",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c24": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c24",
@@ -103,70 +103,70 @@
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 1 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 1 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition"
}
}
}
diff --git a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsNotFound.json
index 9e9767472..5a859fbca 100644
--- a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsNotFound.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsNotFound.json
@@ -1,15 +1,15 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"name": "PMSHInstance0",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 0",
+ "description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
@@ -18,54 +18,54 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
},
@@ -73,12 +73,12 @@
"name": "PMSHInstance1",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 1",
+ "description": "PMSH automation composition instance 1",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c24": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c24",
@@ -87,54 +87,54 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 1 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 1 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition"
}
}
}
diff --git a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsSmoke.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsSmoke.json
index 47f379b84..72bdead66 100644
--- a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsSmoke.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsSmoke.json
@@ -1,87 +1,87 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"name": "PMSHInstance0",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 0",
+ "description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
"definition": {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
},
@@ -89,12 +89,12 @@
"name": "PMSHInstance1",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 1",
+ "description": "PMSH automation composition instance 1",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c24": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c24",
@@ -103,70 +103,70 @@
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 1 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 1 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition"
}
}
}
diff --git a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsUpdate.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json
index b09e46fe7..f0c45b5b2 100644
--- a/runtime-controlloop/src/test/resources/rest/controlloops/ControlLoopsUpdate.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json
@@ -1,15 +1,15 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"name": "PMSHInstance0",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 1",
+ "description": "PMSH automation composition instance 1",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
@@ -18,70 +18,70 @@
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c24": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c24",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
},
@@ -89,12 +89,12 @@
"name": "PMSHInstance1",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 1",
+ "description": "PMSH automation composition instance 1",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
@@ -103,70 +103,70 @@
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 1 control loop"
+ "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c28": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c28",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 1 control loop"
+ "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition"
}
}
}
diff --git a/runtime-controlloop/src/test/resources/rest/controlloops/PassiveCommand.json b/runtime-acm/src/test/resources/rest/acm/PassiveCommand.json
index 9c87e43b6..5bb9eb336 100644
--- a/runtime-controlloop/src/test/resources/rest/controlloops/PassiveCommand.json
+++ b/runtime-acm/src/test/resources/rest/acm/PassiveCommand.json
@@ -1,6 +1,6 @@
{
"orderedState": "PASSIVE",
- "controlLoopIdentifierList": [
+ "automationCompositionIdentifierList": [
{
"name": "PMSHInstance0",
"version": "1.0.1"
diff --git a/runtime-controlloop/src/test/resources/rest/monitoring/TestClElementStatistics.json b/runtime-acm/src/test/resources/rest/monitoring/TestAcElementStatistics.json
index 21a048ff0..c63c3ea1d 100644
--- a/runtime-controlloop/src/test/resources/rest/monitoring/TestClElementStatistics.json
+++ b/runtime-acm/src/test/resources/rest/monitoring/TestAcElementStatistics.json
@@ -1,5 +1,5 @@
{
- "clElementStatistics":[
+ "acElementStatistics":[
{
"participantId":{
"name":"name1",
@@ -7,8 +7,8 @@
},
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
"timeStamp": "2021-01-10T13:45:00.000Z",
- "controlLoopState": "UNINITIALISED",
- "clElementUptime":250
+ "state": "UNINITIALISED",
+ "acElementUptime":250
},
{
"participantId":{
@@ -17,8 +17,8 @@
},
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
"timeStamp": "2021-01-10T15:45:00.000Z",
- "controlLoopState": "UNINITIALISED",
- "clElementUptime":450
+ "state": "UNINITIALISED",
+ "acElementUptime":450
},
{
"participantId":{
@@ -27,8 +27,8 @@
},
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"timeStamp": "2021-01-10T14:25:00.000Z",
- "controlLoopState": "UNINITIALISED",
- "clElementUptime":330
+ "state": "UNINITIALISED",
+ "acElementUptime":330
},
{
"participantId":{
@@ -37,8 +37,8 @@
},
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"timeStamp": "2021-01-10T16:35:00.000Z",
- "controlLoopState": "UNINITIALISED",
- "clElementUptime":650
+ "state": "UNINITIALISED",
+ "acElementUptime":650
}
]
} \ No newline at end of file
diff --git a/runtime-controlloop/src/test/resources/rest/monitoring/TestClElementStatistics_Invalid.json b/runtime-acm/src/test/resources/rest/monitoring/TestAcElementStatistics_Invalid.json
index 2cf2619bf..59af47828 100644
--- a/runtime-controlloop/src/test/resources/rest/monitoring/TestClElementStatistics_Invalid.json
+++ b/runtime-acm/src/test/resources/rest/monitoring/TestAcElementStatistics_Invalid.json
@@ -1,13 +1,13 @@
{
- "clElementStatisticsList":[
+ "acElementStatisticsList":[
{
"participantId":{
"name":"name1",
"version":"1.001"
},
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
- "controlLoopState": "UNINITIALISED",
- "clElementUptime":250
+ "state": "UNINITIALISED",
+ "acElementUptime":250
}
]
} \ No newline at end of file
diff --git a/runtime-controlloop/src/test/resources/rest/monitoring/TestParticipantStatistics.json b/runtime-acm/src/test/resources/rest/monitoring/TestParticipantStatistics.json
index acd88e24b..acd88e24b 100644
--- a/runtime-controlloop/src/test/resources/rest/monitoring/TestParticipantStatistics.json
+++ b/runtime-acm/src/test/resources/rest/monitoring/TestParticipantStatistics.json
diff --git a/runtime-controlloop/src/test/resources/rest/monitoring/TestParticipantStatistics_Invalid.json b/runtime-acm/src/test/resources/rest/monitoring/TestParticipantStatistics_Invalid.json
index 7281822f0..7281822f0 100644
--- a/runtime-controlloop/src/test/resources/rest/monitoring/TestParticipantStatistics_Invalid.json
+++ b/runtime-acm/src/test/resources/rest/monitoring/TestParticipantStatistics_Invalid.json
diff --git a/runtime-acm/src/test/resources/rest/servicetemplates/PMSHMultipleACTosca.yaml b/runtime-acm/src/test/resources/rest/servicetemplates/PMSHMultipleACTosca.yaml
new file mode 100644
index 000000000..4cbebc413
--- /dev/null
+++ b/runtime-acm/src/test/resources/rest/servicetemplates/PMSHMultipleACTosca.yaml
@@ -0,0 +1,232 @@
+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.acm.Participant:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ 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 automation composition element will be started, the
+ first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped
+ in reverse start phase order. Automation Composition Elements with the same start phase are started and
+ stopped simultaneously
+ org.onap.policy.clamp.acm.AutomationComposition:
+ 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.acm.DCAEMicroserviceAutomationCompositionElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
+ properties:
+ dcae_blueprint_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
+ properties:
+ policy_type_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.acm.CDSAutomationCompositionElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
+ properties:
+ cds_blueprint_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+topology_template:
+ node_templates:
+ org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant:
+ version: 2.3.4
+ type: org.onap.policy.clamp.acm.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.policy.acm.PolicyAutomationCompositionParticipant:
+ version: 2.2.1
+ type: org.onap.policy.clamp.acm.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant:
+ version: 2.2.1
+ type: org.onap.policy.clamp.acm.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.acm.DCAEMicroserviceAutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element for the DCAE microservice for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant
+ version: 2.3.4
+ dcae_blueprint_id:
+ name: org.onap.dcae.blueprints.PMSHBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element for the monitoring policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.monitoring.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element for the operational policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.operational.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.AutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element for CDS for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant
+ version: 3.2.1
+ cds_blueprint_id:
+ name: org.onap.ccsdk.cds.PMSHCdsBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSHAutomationCompositionDefinition:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.AutomationComposition
+ type_version: 1.0.0
+ description: Automation composition 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_MonitoringPolicyAutomationCompositionElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement
+ version: 1.2.3
+ org.onap.domain.pmsh.PMSD_DCAEMicroservice:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element for the DCAE microservice for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant
+ version: 2.3.4
+ dcae_blueprint_id:
+ name: org.onap.dcae.blueprints.PMSDBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSD_MonitoringPolicyAutomationCompositionElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element for the monitoring policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.monitoring.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSD_OperationalPolicyAutomationCompositionElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element for the operational policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.operational.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSD_CDS_AutomationCompositionElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.AutomationCompositionElement
+ type_version: 1.0.0
+ description: Automation composition element for CDS for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participantType:
+ name: org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant
+ version: 3.2.1
+ cds_blueprint_id:
+ name: org.onap.ccsdk.cds.PMSDCdsBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSDAutomationCompositionDefinition:
+ version: 1.2.3
+ type: org.onap.policy.clamp.acm.AutomationComposition
+ type_version: 1.0.0
+ description: Automation composition for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ elements:
+ - name: org.onap.domain.pmsh.PMSD_DCAEMicroservice
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSD_MonitoringPolicyAutomationCompositionElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSD_OperationalPolicyAutomationCompositionElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSD_CDS_AutomationCompositionElement
+ version: 1.2.3
diff --git a/runtime-controlloop/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml b/runtime-acm/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml
index 4dd4f95ae..30d53b4aa 100644
--- a/runtime-controlloop/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml
+++ b/runtime-acm/src/test/resources/rest/servicetemplates/full-tosca-with-common-properties.yaml
@@ -9,8 +9,8 @@ data_types:
version:
type: string
required: true
- org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo:
- name: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo
+ org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElementConsulInfo:
+ name: org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElementConsulInfo
version: 0.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -26,7 +26,7 @@ data_types:
typeVersion: 0.0.0
description: Body of Consul entry
required: true
- onap.datatype.controlloop.Target:
+ onap.datatype.acm.Target:
derived_from: tosca.datatypes.Root
description: Definition for a entity in A&AI to perform a control loop operation on
properties:
@@ -50,7 +50,7 @@ data_types:
clamp_possible_values: ClampExecution:CSAR_RESOURCES
entry_schema:
type: string
- onap.datatype.controlloop.Actor:
+ onap.datatype.acm.Actor:
derived_from: tosca.datatypes.Root
description: An actor/operation/target definition
properties:
@@ -67,7 +67,7 @@ data_types:
clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation
required: true
target:
- type: onap.datatype.controlloop.Target
+ type: onap.datatype.acm.Target
description: The resource the operation should be performed on.
required: true
payload:
@@ -78,7 +78,7 @@ data_types:
clamp_possible_values: ClampExecution:CDS/payload
entry_schema:
type: string
- onap.datatype.controlloop.Operation:
+ onap.datatype.acm.Operation:
derived_from: tosca.datatypes.Root
description: An operation supported by an actor
properties:
@@ -91,7 +91,7 @@ data_types:
description: A user-friendly description of the intent for the operation
required: false
operation:
- type: onap.datatype.controlloop.Actor
+ type: onap.datatype.acm.Actor
description: The definition of the operation to be performed.
required: true
timeout:
@@ -397,17 +397,17 @@ policy_types:
version: 1.0.0
derived_from: onap.policies.Monitoring
metadata: {}
- onap.policies.controlloop.operational.Common:
+ onap.policies.acm.operational.Common:
derived_from: tosca.policies.Root
version: 1.0.0
- name: onap.policies.controlloop.operational.Common
+ name: onap.policies.acm.operational.Common
description: |
- Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant
+ Operational Policy for Automation Composition execution. Originated in Frankfurt to support TOSCA Compliant
Policy Types. This does NOT support the legacy Policy YAML policy type.
properties:
id:
type: string
- description: The unique control loop id.
+ description: The unique automation composition id.
required: true
timeout:
type: integer
@@ -417,24 +417,24 @@ policy_types:
required: true
abatement:
type: boolean
- description: Whether an abatement event message will be expected for the control loop from DCAE.
+ description: Whether an abatement event message will be expected for the automation composition from DCAE.
required: true
default: false
trigger:
type: string
- description: Initial operation to execute upon receiving an Onset event message for the Control Loop.
+ description: Initial operation to execute upon receiving an Onset event message for the Automation Composition.
required: true
operations:
type: list
- description: List of operations to be performed when Control Loop is triggered.
+ description: List of operations to be performed when Automation Composition is triggered.
required: true
entry_schema:
- type: onap.datatype.controlloop.Operation
- onap.policies.controlloop.operational.common.Apex:
- derived_from: onap.policies.controlloop.operational.Common
+ type: onap.datatype.acm.Operation
+ onap.policies.acm.operational.common.Apex:
+ derived_from: onap.policies.acm.operational.Common
type_version: 1.0.0
version: 1.0.0
- name: onap.policies.controlloop.operational.common.Apex
+ name: onap.policies.acm.operational.common.Apex
description: Operational policies for Apex PDP
properties:
engineServiceParameters:
@@ -454,14 +454,14 @@ policy_types:
description: Name/value pairs of properties to be set for APEX if needed.
required: false
node_types:
- org.onap.policy.clamp.controlloop.Participant:
+ org.onap.policy.clamp.acm.Participant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
requred: false
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -470,13 +470,13 @@ node_types:
required: false
metadata:
common: true
- description: Specifies the organization that provides the control loop element
+ description: Specifies the organization that provides the automation composition element
participantType:
type: onap.datatypes.ToscaConceptIdentifier
required: true
metadata:
common: true
- description: The identity of the participant type that hosts this type of Control Loop Element
+ description: The identity of the participant type that hosts this type of Automation Composition Element
startPhase:
type: integer
required: false
@@ -484,9 +484,9 @@ node_types:
- 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
+ description: A value indicating the start phase in which this automation composition element will be started, the
+ first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped
+ in reverse start phase order. Automation Composition Elements with the same start phase are started and
stopped simultaneously
uninitializedToPassiveTimeout:
type: integer
@@ -524,7 +524,7 @@ node_types:
metadata:
common: true
description: The maximum time in seconds to wait for a state chage from passive to uninitialized
- org.onap.policy.clamp.controlloop.ControlLoop:
+ org.onap.policy.clamp.acm.AutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -533,7 +533,7 @@ node_types:
required: false
metadata:
common: true
- description: Specifies the organization that provides the control loop element
+ description: Specifies the organization that provides the automation composition element
elements:
type: list
required: true
@@ -541,10 +541,10 @@ node_types:
common: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- description: Specifies a list of control loop element definitions that make up this control loop definition
- org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:
+ description: Specifies a list of automation composition element definitions that make up this automation composition definition
+ org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
dcae_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -556,10 +556,10 @@ node_types:
type: list
required: false
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo
- org.onap.policy.clamp.controlloop.PolicyControlLoopElement:
+ type: org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElementConsulInfo
+ org.onap.policy.clamp.acm.PolicyAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
policy_type_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -567,9 +567,9 @@ node_types:
policy_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: false
- org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement:
+ org.onap.policy.clamp.acm.DerivedPolicyAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement
properties:
policy_type_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -577,9 +577,9 @@ node_types:
policy_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: false
- org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement:
+ org.onap.policy.clamp.acm.DerivedDerivedPolicyAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.DerivedPolicyAutomationCompositionElement
properties:
policy_type_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -587,9 +587,9 @@ node_types:
policy_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: false
- org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ org.onap.policy.clamp.acm.CDSAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
cds_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -609,29 +609,29 @@ topology_template:
name: operational.apex.pmcontrol
version: 1.0.0
node_templates:
- org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:
+ org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.policy.controlloop.PolicyControlLoopParticipant:
+ org.onap.policy.acm.PolicyAutomationCompositionParticipant:
version: 2.3.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.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: org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ description: Automation composition element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ name: org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant
version: 2.3.4
dcae_blueprint:
tosca_definitions_version: cloudify_dsl_1_3
@@ -847,73 +847,73 @@ topology_template:
managedObjectDNsBasic:
- DN: dnc
- DN: dnd
- org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ description: Automation composition element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.3.1
policy_type_id:
name: onap.policies.monitoring.pm-subscription-handler
version: 1.0.0
policy_id:
get_input: pmsh_monitoring_policy
- org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the operational policy for Performance Management Subscription Handling
+ description: Automation composition element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.3.1
policy_type_id:
name: onap.policies.operational.pm-subscription-handler
version: 1.0.0
policy_id:
get_input: pmsh_operational_policy
- org.onap.domain.pmsh.DerivedPolicyControlLoopElement:
+ org.onap.domain.pmsh.DerivedPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement
+ type: org.onap.policy.clamp.acm.DerivedPolicyAutomationCompositionElement
type_version: 1.0.0
- description: Control loop for Performance Management Subscription Handling
+ description: Automation composition 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
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement
version: 1.2.3
- org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement:
+ org.onap.domain.pmsh.DerivedDerivedPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement
+ type: org.onap.policy.clamp.acm.DerivedDerivedPolicyAutomationCompositionElement
type_version: 1.0.0
- description: Control loop for Performance Management Subscription Handling
+ description: Automation composition for Performance Management Subscription Handling
properties:
provider: Ericsson Software Technologies
elements:
- name: org.onap.domain.pmsh.PMSH_DerivedTestMicroservice
version: 1.2.3
- org.onap.domain.pmsh.PMSHControlLoopDefinition:
+ org.onap.domain.pmsh.PMSHAutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acm.AutomationComposition
type_version: 1.0.0
- description: Control loop for Performance Management Subscription Handling
+ description: Automation composition 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
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement
version: 1.2.3
policies:
- MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test:
@@ -974,7 +974,7 @@ topology_template:
onap.datatypes.monitoring.managedObjectDNsBasic:
DN: dnd
- operational.apex.pmcontrol:
- type: onap.policies.controlloop.operational.common.Apex
+ type: onap.policies.acm.operational.common.Apex
type_version: 1.0.0
version: 1.0.0
metadata:
@@ -3433,7 +3433,7 @@ topology_template:
jsonAdapters:
Instant:
adaptedClass: java.time.Instant
- adaptorClass: org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter
+ adaptorClass: org.onap.policy.acm.util.Serialization$GsonInstantAdapter
eventInputParameters:
DCAEConsumer:
carrierTechnologyParameters:
diff --git a/runtime-controlloop/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml b/runtime-acm/src/test/resources/rest/servicetemplates/pm_automation_composition_tosca.yaml
index 01f825fc9..77fcac35e 100644
--- a/runtime-controlloop/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml
+++ b/runtime-acm/src/test/resources/rest/servicetemplates/pm_automation_composition_tosca.yaml
@@ -444,7 +444,7 @@ topology_template:
org.onap.controlloop0:
type: org.onap.APP
properties:
- application_name: Test Control Loop
+ application_name: Test Automation Composition
provider: Ericsson
application_version: 1.0.0
status: NOT_DEPLOYED
diff --git a/runtime-controlloop/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml b/runtime-acm/src/test/resources/rest/servicetemplates/pmsh_multiple_ac_tosca.yaml
index 9c440b42b..1d3825f75 100644
--- a/runtime-controlloop/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml
+++ b/runtime-acm/src/test/resources/rest/servicetemplates/pmsh_multiple_ac_tosca.yaml
@@ -10,14 +10,14 @@ data_types:
type: string
required: true
node_types:
- org.onap.policy.clamp.controlloop.Participant:
+ org.onap.policy.clamp.acm.Participant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
requred: false
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -34,11 +34,11 @@ node_types:
- 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
+ description: A value indicating the start phase in which this automation composition element will be started, the
+ first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped
+ in reverse start phase order. Automation Composition Elements with the same start phase are started and
stopped simultaneously
- org.onap.policy.clamp.controlloop.ControlLoop:
+ org.onap.policy.clamp.acm.AutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -50,140 +50,140 @@ node_types:
required: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:
+ org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
dcae_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
- org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement:
+ org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
policy_type_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
- org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ org.onap.policy.clamp.acm.CDSAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
cds_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
topology_template:
node_templates:
- org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:
+ org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.policy.controlloop.PolicyControlLoopParticipant:
+ org.onap.policy.acm.PolicyAutomationCompositionParticipant:
version: 2.2.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant:
+ org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant:
version: 2.2.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.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: org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ description: Automation composition element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ name: org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant
version: 2.3.4
dcae_blueprint_id:
name: org.onap.dcae.blueprints.PMSHBlueprint
version: 1.0.0
- org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ description: Automation composition element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.2.1
policy_type_id:
name: onap.policies.monitoring.pm-subscription-handler
version: 1.0.0
- org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the operational policy for Performance Management Subscription Handling
+ description: Automation composition element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
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:
+ org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoopElement
+ type: org.onap.policy.clamp.acm.AutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for CDS for Performance Management Subscription Handling
+ description: Automation composition element for CDS for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
+ name: org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant
version: 3.2.1
cds_blueprint_id:
name: org.onap.ccsdk.cds.PMSHCdsBlueprint
version: 1.0.0
- org.onap.domain.pmsh.PMSHControlLoopDefinition:
+ org.onap.domain.pmsh.PMSHAutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acm.AutomationComposition
type_version: 1.0.0
- description: Control loop for Performance Management Subscription Handling
+ description: Automation composition 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
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement
version: 1.2.3
org.onap.domain.pmsh.PMSD_DCAEMicroservice:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement
+ type: org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ description: Automation composition element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ name: org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant
version: 2.3.4
dcae_blueprint_id:
name: org.onap.dcae.blueprints.PMSDBlueprint
version: 1.0.0
- org.onap.domain.pmsh.PMSD_MonitoringPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSD_MonitoringPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ description: Automation composition element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.2.1
policy_type_id:
name: onap.policies.monitoring.pm-subscription-handler
@@ -191,15 +191,15 @@ topology_template:
policy_id:
name: onap.policies.monitoring.pm-subscription-handler
version: 1.0.0
- org.onap.domain.pmsh.PMSD_OperationalPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSD_OperationalPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the operational policy for Performance Management Subscription Handling
+ description: Automation composition element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.2.1
policy_type_id:
name: onap.policies.operational.pm-subscription-handler
@@ -207,32 +207,32 @@ topology_template:
policy_id:
name: onap.policies.monitoring.pm-subscription-handler
version: 1.0.0
- org.onap.domain.pmsh.PMSD_CDS_ControlLoopElement:
+ org.onap.domain.pmsh.PMSD_CDS_AutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoopElement
+ type: org.onap.policy.clamp.acm.AutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for CDS for Performance Management Subscription Handling
+ description: Automation composition element for CDS for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
+ name: org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant
version: 3.2.1
cds_blueprint_id:
name: org.onap.ccsdk.cds.PMSDCdsBlueprint
version: 1.0.0
- org.onap.domain.pmsh.PMSDControlLoopDefinition:
+ org.onap.domain.pmsh.PMSDAutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acm.AutomationComposition
type_version: 1.0.0
- description: Control loop for Performance Management Subscription Handling
+ description: Automation composition for Performance Management Subscription Handling
properties:
provider: Ericsson
elements:
- name: org.onap.domain.pmsh.PMSD_DCAEMicroservice
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSD_MonitoringPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSD_MonitoringPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSD_OperationalPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSD_OperationalPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSD_CDS_ControlLoopElement
+ - name: org.onap.domain.pmsh.PMSD_CDS_AutomationCompositionElement
version: 1.2.3
diff --git a/runtime-controlloop/src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml b/runtime-acm/src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml
index 9d1b7be64..f5590a1b5 100644
--- a/runtime-controlloop/src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml
+++ b/runtime-acm/src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml
@@ -9,7 +9,7 @@ data_types:
version:
type: string
required: true
- onap.datatype.controlloop.Target:
+ onap.datatype.acm.Target:
derived_from: tosca.datatypes.Root
description: Definition for a entity in A&AI to perform a control loop operation on
properties:
@@ -33,7 +33,7 @@ data_types:
clamp_possible_values: ClampExecution:CSAR_RESOURCES
entry_schema:
type: string
- onap.datatype.controlloop.Actor:
+ onap.datatype.acm.Actor:
derived_from: tosca.datatypes.Root
description: An actor/operation/target definition
properties:
@@ -50,7 +50,7 @@ data_types:
clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation
required: true
target:
- type: onap.datatype.controlloop.Target
+ type: onap.datatype.acm.Target
description: The resource the operation should be performed on.
required: true
payload:
@@ -61,7 +61,7 @@ data_types:
clamp_possible_values: ClampExecution:CDS/payload
entry_schema:
type: string
- onap.datatype.controlloop.Operation:
+ onap.datatype.acm.Operation:
derived_from: tosca.datatypes.Root
description: An operation supported by an actor
properties:
@@ -74,7 +74,7 @@ data_types:
description: A user-friendly description of the intent for the operation
required: false
operation:
- type: onap.datatype.controlloop.Actor
+ type: onap.datatype.acm.Actor
description: The definition of the operation to be performed.
required: true
timeout:
@@ -355,7 +355,7 @@ data_types:
version: 0.0.0
derived_from: tosca.datatypes.Root
metadata: {}
- org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest:
+ org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest:
version: 1.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -383,7 +383,7 @@ data_types:
required: true
constraints: []
description: THe expected HTTP status code for the REST request
- org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.ConfigurationEntity:
+ org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity:
version: 1.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -391,11 +391,11 @@ data_types:
type: onap.datatypes.ToscaConceptIdentifier
typeVersion: 1.0.0
required: true
- description: The name and version of a Configuration Entity to be handled by the HTTP Control Loop Element
+ description: The name and version of a Configuration Entity to be handled by the HTTP Automation Composition Element
restSequence:
type: list
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest
+ type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest
typeVersion: 1.0.0
description: A sequence of REST commands to send to the REST endpoint
policy_types:
@@ -423,12 +423,12 @@ policy_types:
version: 1.0.0
derived_from: onap.policies.Monitoring
metadata: {}
- onap.policies.controlloop.operational.Common:
+ onap.policies.acm.operational.Common:
derived_from: tosca.policies.Root
version: 1.0.0
- name: onap.policies.controlloop.operational.Common
+ name: onap.policies.acm.operational.Common
description: |
- Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant
+ Operational Policy for Automation Composition execution. Originated in Frankfurt to support TOSCA Compliant
Policy Types. This does NOT support the legacy Policy YAML policy type.
properties:
id:
@@ -448,19 +448,19 @@ policy_types:
default: false
trigger:
type: string
- description: Initial operation to execute upon receiving an Onset event message for the Control Loop.
+ description: Initial operation to execute upon receiving an Onset event message for the Automation Composition.
required: true
operations:
type: list
- description: List of operations to be performed when Control Loop is triggered.
+ description: List of operations to be performed when Automation Composition is triggered.
required: true
entry_schema:
- type: onap.datatype.controlloop.Operation
- onap.policies.controlloop.operational.common.Apex:
- derived_from: onap.policies.controlloop.operational.Common
+ type: onap.datatype.acm.Operation
+ onap.policies.acm.operational.common.Apex:
+ derived_from: onap.policies.acm.operational.Common
type_version: 1.0.0
version: 1.0.0
- name: onap.policies.controlloop.operational.common.Apex
+ name: onap.policies.acm.operational.common.Apex
description: Operational policies for Apex PDP
properties:
engineServiceParameters:
@@ -480,14 +480,14 @@ policy_types:
description: Name/value pairs of properties to be set for APEX if needed.
required: false
node_types:
- org.onap.policy.clamp.controlloop.Participant:
+ org.onap.policy.clamp.acm.Participant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
requred: false
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -496,7 +496,7 @@ node_types:
required: false
metadata:
common: true
- description: Specifies the organization that provides the control loop element
+ description: Specifies the organization that provides the automation composition element
participant_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
@@ -507,7 +507,7 @@ node_types:
required: true
metadata:
common: true
- description: The identity of the participant type that hosts this type of Control Loop Element
+ description: The identity of the participant type that hosts this type of Automation Composition Element
startPhase:
type: integer
required: false
@@ -515,9 +515,9 @@ node_types:
- 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
+ description: A value indicating the start phase in which this automation composition element will be started, the
+ first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped
+ in reverse start phase order. Automation Composition Elements with the same start phase are started and
stopped simultaneously
uninitializedToPassiveTimeout:
type: integer
@@ -555,7 +555,7 @@ node_types:
metadata:
common: true
description: The maximum time in seconds to wait for a state chage from passive to uninitialized
- org.onap.policy.clamp.controlloop.ControlLoop:
+ org.onap.policy.clamp.acm.AutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -564,7 +564,7 @@ node_types:
required: false
metadata:
common: true
- description: Specifies the organization that provides the control loop element
+ description: Specifies the organization that provides the automation composition element
elements:
type: list
required: true
@@ -572,10 +572,10 @@ node_types:
common: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- description: Specifies a list of control loop element definitions that make up this control loop definition
- org.onap.policy.clamp.controlloop.PolicyControlLoopElement:
+ description: Specifies a list of automation composition element definitions that make up this automation composition definition
+ org.onap.policy.clamp.acm.PolicyAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
policy_type_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -583,16 +583,16 @@ node_types:
policy_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: false
- org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ org.onap.policy.clamp.acm.CDSAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
cds_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
- org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement:
+ org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
chart:
type: string
@@ -610,9 +610,9 @@ node_types:
values:
type: string
requred: true
- org.onap.policy.clamp.controlloop.HttpControlLoopElement:
+ org.onap.policy.clamp.acm.HttpAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
baseUrl:
type: string
@@ -628,9 +628,9 @@ node_types:
type: map
required: true
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.ConfigurationEntity
+ type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity
typeVersion: 1.0.0
- description: The connfiguration entities the Control Loop Element is managing and their associated REST requests
+ description: The connfiguration entities the Automation Composition Element is managing and their associated REST requests
topology_template:
inputs:
@@ -647,69 +647,69 @@ topology_template:
name: operational.apex.pmcontrol
version: 1.0.0
node_templates:
- org.onap.policy.controlloop.PolicyControlLoopParticipant:
+ org.onap.policy.acm.PolicyAutomationCompositionParticipant:
version: 2.3.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ description: Automation composition element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participant_id:
name: org.onap.PM_Policy
version: 1.0.0
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.3.1
policy_type_id:
name: onap.policies.monitoring.pm-subscription-handler
version: 1.0.0
policy_id:
get_input: pmsh_monitoring_policy
- org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the operational policy for Performance Management Subscription Handling
+ description: Automation composition element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participant_id:
name: org.onap.PM_Policy
version: 1.0.0
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.3.1
policy_type_id:
name: onap.policies.operational.pm-subscription-handler
version: 1.0.0
policy_id:
get_input: pmsh_operational_policy
- org.onap.k8s.controlloop.K8SControlLoopParticipant:
+ org.onap.k8s.acm.K8SAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for K8S
properties:
provider: ONAP
- org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement:
+ org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement:
# Chart from new repository
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement
+ type: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the K8S microservice for PMSH
+ description: Automation composition element for the K8S microservice for PMSH
properties:
provider: ONAP
participant_id:
name: K8sParticipant0
version: 1.0.0
participantType:
- name: org.onap.k8s.controlloop.K8SControlLoopParticipant
+ name: org.onap.k8s.acm.K8SAutomationCompositionParticipant
version: 2.3.4
chart:
chartId:
@@ -727,19 +727,19 @@ topology_template:
overrideParams:
global.masterPassword: test
- org.onap.domain.database.Local_K8SMicroserviceControlLoopElement:
+ org.onap.domain.database.Local_K8SMicroserviceAutomationCompositionElement:
# Chart installation without passing repository info
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement
+ type: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the K8S microservice for local chart
+ description: Automation composition element for the K8S microservice for local chart
properties:
provider: ONAP
participant_id:
name: K8sParticipant0
version: 1.0.0
participantType:
- name: org.onap.k8s.controlloop.K8SControlLoopParticipant
+ name: org.onap.k8s.acm.K8SAutomationCompositionParticipant
version: 2.3.4
chart:
chartId:
@@ -747,26 +747,26 @@ topology_template:
version: 0.9.1
releaseName: nginxms
namespace: test
- org.onap.controlloop.HttpControlLoopParticipant:
+ org.onap.acm.HttpAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for Http requests
properties:
provider: ONAP
- org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement:
+ org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement:
# Consul http config for PMSH.
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.HttpControlLoopElement
+ type: org.onap.policy.clamp.acm.HttpAutomationCompositionElement
type_version: 1.0.1
- description: Control loop element for the http requests of PMSH microservice
+ description: Automation composition element for the http requests of PMSH microservice
properties:
provider: ONAP
participant_id:
name: HttpParticipant0
version: 1.0.0
participantType:
- name: org.onap.k8s.controlloop.HttpControlLoopParticipant
+ name: org.onap.k8s.acm.HttpAutomationCompositionParticipant
version: 2.3.4
uninitializedToPassiveTimeout: 180
startPhase: 1
@@ -896,27 +896,27 @@ topology_template:
}
}'
expectedResponse: 200
- org.onap.domain.sample.GenericK8s_ControlLoopDefinition:
+ org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acm.AutomationComposition
type_version: 1.0.0
- description: Control loop for Hello World
+ description: Automation composition for Hello World
properties:
provider: ONAP
elements:
- - name: org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement
+ - name: org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.database.Local_K8SMicroserviceControlLoopElement
+ - name: org.onap.domain.database.Local_K8SMicroserviceAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement
+ - name: org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement
version: 1.2.3
policies:
- operational.apex.pmcontrol:
- type: onap.policies.controlloop.operational.common.Apex
+ type: onap.policies.acm.operational.common.Apex
type_version: 1.0.0
version: 1.0.0
metadata:
@@ -3375,7 +3375,7 @@ topology_template:
jsonAdapters:
Instant:
adaptedClass: java.time.Instant
- adaptorClass: org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter
+ adaptorClass: org.onap.policy.acm.util.Serialization$GsonInstantAdapter
eventInputParameters:
DCAEConsumer:
carrierTechnologyParameters:
diff --git a/runtime-controlloop/src/test/resources/testscripts/listenOnTopic.sh b/runtime-acm/src/test/resources/testscripts/listenOnTopic.sh
index 5e661777b..5e661777b 100755
--- a/runtime-controlloop/src/test/resources/testscripts/listenOnTopic.sh
+++ b/runtime-acm/src/test/resources/testscripts/listenOnTopic.sh
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java
deleted file mode 100644
index 1bff2d747..000000000
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java
+++ /dev/null
@@ -1,619 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.runtime.instantiation;
-
-import com.google.gson.Gson;
-import com.google.gson.internal.LinkedTreeMap;
-import com.google.gson.reflect.TypeToken;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.function.Function;
-import java.util.function.UnaryOperator;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import lombok.AllArgsConstructor;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.messages.rest.GenericNameVersion;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopOrderStateResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopPrimed;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopPrimedResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstancePropertiesResponse;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
-import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider;
-import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
-import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.ObjectValidationResult;
-import org.onap.policy.common.parameters.ValidationResult;
-import org.onap.policy.common.parameters.ValidationStatus;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNameVersion;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * This class is dedicated to the Instantiation of Commissioned control loop.
- */
-@Service
-@Transactional
-@AllArgsConstructor
-public class ControlLoopInstantiationProvider {
- private static final String CONTROL_LOOP_NODE_TYPE = "org.onap.policy.clamp.controlloop.ControlLoop";
- private static final String CONTROL_LOOP_NODE_ELEMENT_TYPE = "ControlLoopElement";
- private static final String PARTICIPANT_ID_PROPERTY_KEY = "participant_id";
- private static final String PARTICIPANT_TYPE_PROPERTY_KEY = "participantType";
- private static final String CL_ELEMENT_NAME = "name";
- private static final String CL_ELEMENT_VERSION = "version";
- private static final String INSTANCE_TEXT = "_Instance";
-
- private static final Gson GSON = new Gson();
-
- private final ControlLoopProvider controlLoopProvider;
- private final CommissioningProvider commissioningProvider;
- private final SupervisionHandler supervisionHandler;
- private final ParticipantProvider participantProvider;
- private static final String ENTRY = "entry ";
-
- /**
- * Creates Instance Properties and Control Loop.
- *
- * @param serviceTemplate the service template
- * @return the result of the instantiation operation
- * @throws PfModelException on creation errors
- */
- public InstancePropertiesResponse createInstanceProperties(ToscaServiceTemplate serviceTemplate)
- throws PfModelException {
-
- String instanceName = generateSequentialInstanceName();
- ControlLoop controlLoop = new ControlLoop();
- Map<UUID, ControlLoopElement> controlLoopElements = new HashMap<>();
-
- ToscaServiceTemplate toscaServiceTemplate = commissioningProvider.getAllToscaServiceTemplate().get(0);
-
- Map<String, ToscaNodeTemplate> persistedNodeTemplateMap =
- toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
-
- Map<String, ToscaNodeTemplate> nodeTemplates = deepCloneNodeTemplate(serviceTemplate);
-
- nodeTemplates.forEach((key, template) -> {
- ToscaNodeTemplate newNodeTemplate = new ToscaNodeTemplate();
- String name = key + instanceName;
- String version = template.getVersion();
- String description = template.getDescription() + instanceName;
- newNodeTemplate.setName(name);
- newNodeTemplate.setVersion(version);
- newNodeTemplate.setDescription(description);
- newNodeTemplate.setProperties(new HashMap<>(template.getProperties()));
- newNodeTemplate.setType(template.getType());
- newNodeTemplate.setTypeVersion(template.getTypeVersion());
- newNodeTemplate.setMetadata(template.getMetadata());
-
- crateNewControlLoopInstance(instanceName, controlLoop, controlLoopElements, template, newNodeTemplate);
-
- persistedNodeTemplateMap.put(name, newNodeTemplate);
- });
-
- ControlLoops controlLoops = new ControlLoops();
-
- serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().putAll(persistedNodeTemplateMap);
-
- controlLoop.setElements(controlLoopElements);
- controlLoops.getControlLoopList().add(controlLoop);
-
- return saveInstancePropertiesAndControlLoop(serviceTemplate, controlLoops);
- }
-
- /**
- * Deletes Instance Properties.
- *
- * @param name the name of the control loop to delete
- * @param version the version of the control loop to delete
- * @return the result of the deletion
- * @throws PfModelException on deletion errors
- */
- public InstantiationResponse deleteInstanceProperties(String name, String version) throws PfModelException {
-
- String instanceName = getInstancePropertyName(name, version);
-
- Map<String, ToscaNodeTemplate> filteredToscaNodeTemplateMap = new HashMap<>();
-
- ToscaServiceTemplate toscaServiceTemplate = commissioningProvider.getAllToscaServiceTemplate().get(0);
-
- toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates().forEach((key, nodeTemplate) -> {
- if (!nodeTemplate.getName().contains(instanceName)) {
- filteredToscaNodeTemplateMap.put(key, nodeTemplate);
- }
- });
-
- List<ToscaNodeTemplate> filteredToscaNodeTemplateList = toscaServiceTemplate.getToscaTopologyTemplate()
- .getNodeTemplates().values().stream()
- .filter(nodeTemplate -> nodeTemplate.getName().contains(instanceName)).collect(Collectors.toList());
-
- InstantiationResponse response = this.deleteControlLoop(name, version);
-
- controlLoopProvider.deleteInstanceProperties(filteredToscaNodeTemplateMap, filteredToscaNodeTemplateList);
-
- return response;
- }
-
- /**
- * Create control loops.
- *
- * @param controlLoops the control loop
- * @return the result of the instantiation operation
- * @throws PfModelException on creation errors
- */
- public InstantiationResponse createControlLoops(ControlLoops controlLoops) throws PfModelException {
- for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
- var checkControlLoopOpt = controlLoopProvider.findControlLoop(controlLoop.getKey().asIdentifier());
- if (checkControlLoopOpt.isPresent()) {
- throw new PfModelException(Response.Status.BAD_REQUEST,
- controlLoop.getKey().asIdentifier() + " already defined");
- }
- }
- BeanValidationResult validationResult = validateControlLoops(controlLoops);
- if (!validationResult.isValid()) {
- throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
- }
- controlLoopProvider.saveControlLoops(controlLoops.getControlLoopList());
-
- var response = new InstantiationResponse();
- response.setAffectedControlLoops(controlLoops.getControlLoopList().stream()
- .map(cl -> cl.getKey().asIdentifier()).collect(Collectors.toList()));
-
- return response;
- }
-
- /**
- * Update control loops.
- *
- * @param controlLoops the control loop
- * @return the result of the instantiation operation
- * @throws PfModelException on update errors
- */
- public InstantiationResponse updateControlLoops(ControlLoops controlLoops) throws PfModelException {
- BeanValidationResult validationResult = validateControlLoops(controlLoops);
- if (!validationResult.isValid()) {
- throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
- }
- controlLoopProvider.saveControlLoops(controlLoops.getControlLoopList());
-
- var response = new InstantiationResponse();
- response.setAffectedControlLoops(controlLoops.getControlLoopList().stream()
- .map(cl -> cl.getKey().asIdentifier()).collect(Collectors.toList()));
-
- return response;
- }
-
- /**
- * Validate ControlLoops.
- *
- * @param controlLoops ControlLoops to validate
- * @return the result of validation
- * @throws PfModelException if controlLoops is not valid
- */
- private BeanValidationResult validateControlLoops(ControlLoops controlLoops) throws PfModelException {
-
- var result = new BeanValidationResult("ControlLoops", controlLoops);
-
- for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
- var subResult = new BeanValidationResult(ENTRY + controlLoop.getDefinition().getName(), controlLoop);
-
- List<ToscaNodeTemplate> toscaNodeTemplates = commissioningProvider.getControlLoopDefinitions(
- controlLoop.getDefinition().getName(), controlLoop.getDefinition().getVersion());
-
- if (toscaNodeTemplates.isEmpty()) {
- subResult.addResult(new ObjectValidationResult("ControlLoop", controlLoop.getDefinition().getName(),
- ValidationStatus.INVALID, "Commissioned control loop definition not FOUND"));
- } else if (toscaNodeTemplates.size() > 1) {
- subResult.addResult(new ObjectValidationResult("ControlLoop", controlLoop.getDefinition().getName(),
- ValidationStatus.INVALID, "Commissioned control loop definition not VALID"));
- } else {
-
- List<ToscaNodeTemplate> clElementDefinitions =
- commissioningProvider.getControlLoopElementDefinitions(toscaNodeTemplates.get(0));
-
- // @formatter:off
- Map<String, ToscaConceptIdentifier> definitions = clElementDefinitions
- .stream()
- .map(nodeTemplate -> nodeTemplate.getKey().asIdentifier())
- .collect(Collectors.toMap(ToscaConceptIdentifier::getName, UnaryOperator.identity()));
- // @formatter:on
-
- for (ControlLoopElement element : controlLoop.getElements().values()) {
- subResult.addResult(validateDefinition(definitions, element.getDefinition()));
- }
- }
- result.addResult(subResult);
- }
- return result;
- }
-
- /**
- * Validate ToscaConceptIdentifier, checking if exist in ToscaConceptIdentifiers map.
- *
- * @param definitions map of all ToscaConceptIdentifiers
- * @param definition ToscaConceptIdentifier to validate
- * @return the validation result
- */
- private ValidationResult validateDefinition(Map<String, ToscaConceptIdentifier> definitions,
- ToscaConceptIdentifier definition) {
- var result = new BeanValidationResult(ENTRY + definition.getName(), definition);
- ToscaConceptIdentifier identifier = definitions.get(definition.getName());
- if (identifier == null) {
- result.setResult(ValidationStatus.INVALID, "Not FOUND");
- } else if (!identifier.equals(definition)) {
- result.setResult(ValidationStatus.INVALID, "Version not matching");
- }
- return (result.isClean() ? null : result);
- }
-
- /**
- * Delete the control loop with the given name and version.
- *
- * @param name the name of the control loop to delete
- * @param version the version of the control loop to delete
- * @return the result of the deletion
- * @throws PfModelException on deletion errors
- */
- public InstantiationResponse deleteControlLoop(String name, String version) throws PfModelException {
- var controlLoopOpt = controlLoopProvider.findControlLoop(name, version);
- if (controlLoopOpt.isEmpty()) {
- throw new PfModelException(Response.Status.NOT_FOUND, "Control Loop not found");
- }
- var controlLoop = controlLoopOpt.get();
- if (!ControlLoopState.UNINITIALISED.equals(controlLoop.getState())) {
- throw new PfModelException(Response.Status.BAD_REQUEST,
- "Control Loop State is still " + controlLoop.getState());
- }
- var response = new InstantiationResponse();
- response.setAffectedControlLoops(
- List.of(controlLoopProvider.deleteControlLoop(name, version).getKey().asIdentifier()));
- return response;
- }
-
- /**
- * Get the requested control loops.
- *
- * @param name the name of the control loop to get, null for all control loops
- * @param version the version of the control loop to get, null for all control loops
- * @return the control loops
- * @throws PfModelException on errors getting control loops
- */
- @Transactional(readOnly = true)
- public ControlLoops getControlLoops(String name, String version) throws PfModelException {
- var controlLoops = new ControlLoops();
- controlLoops.setControlLoopList(controlLoopProvider.getControlLoops(name, version));
-
- return controlLoops;
- }
-
- /**
- * Issue a command to control loops, setting their ordered state.
- *
- * @param command the command to issue to control loops
- * @return the result of the initiation command
- * @throws PfModelException on errors setting the ordered state on the control loops
- * @throws ControlLoopException on ordered state invalid
- */
- public InstantiationResponse issueControlLoopCommand(InstantiationCommand command)
- throws ControlLoopException, PfModelException {
-
- if (command.getOrderedState() == null) {
- throw new ControlLoopException(Status.BAD_REQUEST, "ordered state invalid or not specified on command");
- }
-
- var participants = participantProvider.getParticipants();
- if (participants.isEmpty()) {
- throw new ControlLoopException(Status.BAD_REQUEST, "No participants registered");
- }
- var validationResult = new BeanValidationResult("InstantiationCommand", command);
- List<ControlLoop> controlLoops = new ArrayList<>(command.getControlLoopIdentifierList().size());
- for (ToscaConceptIdentifier id : command.getControlLoopIdentifierList()) {
- var controlLoopOpt = controlLoopProvider.findControlLoop(id);
- if (controlLoopOpt.isEmpty()) {
- validationResult.addResult("ToscaConceptIdentifier", id, ValidationStatus.INVALID,
- "ControlLoop with id " + id + " not found");
- } else {
- var controlLoop = controlLoopOpt.get();
- controlLoop.setCascadedOrderedState(command.getOrderedState());
- controlLoops.add(controlLoop);
- }
- }
- if (validationResult.isValid()) {
- validationResult = validateIssueControlLoops(controlLoops, participants);
- }
- if (!validationResult.isValid()) {
- throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
- }
- controlLoopProvider.saveControlLoops(controlLoops);
-
- supervisionHandler.triggerControlLoopSupervision(command.getControlLoopIdentifierList());
- var response = new InstantiationResponse();
- response.setAffectedControlLoops(command.getControlLoopIdentifierList());
-
- return response;
- }
-
- private BeanValidationResult validateIssueControlLoops(List<ControlLoop> controlLoops,
- List<Participant> participants) {
- var result = new BeanValidationResult("ControlLoops", controlLoops);
-
- Map<ToscaConceptIdentifier, Participant> participantMap = participants.stream()
- .collect(Collectors.toMap(participant -> participant.getKey().asIdentifier(), Function.identity()));
-
- for (ControlLoop controlLoop : controlLoops) {
-
- for (var element : controlLoop.getElements().values()) {
-
- var subResult = new BeanValidationResult(ENTRY + element.getDefinition().getName(), element);
- Participant p = participantMap.get(element.getParticipantId());
- if (p == null) {
- subResult.addResult(new ObjectValidationResult(CONTROL_LOOP_NODE_ELEMENT_TYPE,
- element.getDefinition().getName(), ValidationStatus.INVALID,
- "Participant with ID " + element.getParticipantId() + " is not registered"));
- } else if (!p.getParticipantType().equals(element.getParticipantType())) {
- subResult.addResult(new ObjectValidationResult(CONTROL_LOOP_NODE_ELEMENT_TYPE,
- element.getDefinition().getName(), ValidationStatus.INVALID,
- "Participant with ID " + element.getParticipantType() + " - " + element.getParticipantId()
- + " is not registered"));
- }
- result.addResult(subResult);
- }
-
- }
-
- return result;
- }
-
- /**
- * Gets a list of control loops with it's ordered state.
- *
- * @param name the name of the control loop to get, null for all control loops
- * @param version the version of the control loop to get, null for all control loops
- * @return a list of Instantiation Command
- * @throws PfModelException on errors getting control loops
- */
- @Transactional(readOnly = true)
- public ControlLoopOrderStateResponse getInstantiationOrderState(String name, String version)
- throws PfModelException {
-
- List<ControlLoop> controlLoops = controlLoopProvider.getControlLoops(name, version);
-
- var response = new ControlLoopOrderStateResponse();
-
- controlLoops.forEach(controlLoop -> {
- var genericNameVersion = new GenericNameVersion();
- genericNameVersion.setName(controlLoop.getName());
- genericNameVersion.setVersion(controlLoop.getVersion());
- response.getControlLoopIdentifierList().add(genericNameVersion);
- });
-
- return response;
- }
-
- /**
- * Saves Instance Properties and Control Loop.
- * Gets a list of control loops which are primed or de-primed.
- *
- * @param name the name of the control loop to get, null for all control loops
- * @param version the version of the control loop to get, null for all control loops
- * @return a list of Instantiation Command
- * @throws PfModelException on errors getting control loops
- */
- @Transactional(readOnly = true)
- public ControlLoopPrimedResponse getControlLoopPriming(String name, String version) throws PfModelException {
-
- List<ControlLoop> controlLoops = controlLoopProvider.getControlLoops(name, version);
-
- var response = new ControlLoopPrimedResponse();
-
- controlLoops.forEach(controlLoop -> {
- var primed = new ControlLoopPrimed();
- primed.setName(controlLoop.getName());
- primed.setVersion(controlLoop.getVersion());
- primed.setPrimed(controlLoop.getPrimed());
- response.getPrimedControlLoopsList().add(primed);
- });
-
- return response;
- }
-
- /**
- * Creates instance element name.
- *
- * @param serviceTemplate the service template
- * @param controlLoops a list of control loops
- * @return the result of the instance properties and instantiation operation
- * @throws PfModelException on creation errors
- */
- private InstancePropertiesResponse saveInstancePropertiesAndControlLoop(ToscaServiceTemplate serviceTemplate,
- ControlLoops controlLoops) throws PfModelException {
-
- for (var controlLoop : controlLoops.getControlLoopList()) {
- var checkControlLoopOpt = controlLoopProvider.findControlLoop(controlLoop.getKey().asIdentifier());
- if (checkControlLoopOpt.isPresent()) {
- throw new PfModelException(Response.Status.BAD_REQUEST,
- "Control loop with id " + controlLoop.getKey().asIdentifier() + " already defined");
- }
- }
- Map<String, ToscaNodeTemplate> toscaSavedNodeTemplate =
- controlLoopProvider.saveInstanceProperties(serviceTemplate);
- controlLoopProvider.saveControlLoops(controlLoops.getControlLoopList());
- List<ToscaConceptIdentifier> affectedControlLoops = controlLoops.getControlLoopList().stream()
- .map(cl -> cl.getKey().asIdentifier()).collect(Collectors.toList());
-
- List<ToscaConceptIdentifier> toscaAffectedProperties = toscaSavedNodeTemplate.values().stream()
- .map(template -> template.getKey().asIdentifier()).collect(Collectors.toList());
-
- var response = new InstancePropertiesResponse();
- response.setAffectedInstanceProperties(Stream.of(affectedControlLoops, toscaAffectedProperties)
- .flatMap(Collection::stream).collect(Collectors.toList()));
-
- return response;
- }
-
- /**
- * Crates a new Control Loop instance.
- *
- * @param instanceName Control Loop Instance name
- * @param controlLoop empty Control Loop
- * @param controlLoopElements new Control Loop Element map
- * @param template original Cloned Tosca Node Template
- * @param newNodeTemplate new Tosca Node Template
- */
- private void crateNewControlLoopInstance(String instanceName, ControlLoop controlLoop,
- Map<UUID, ControlLoopElement> controlLoopElements, ToscaNodeTemplate template,
- ToscaNodeTemplate newNodeTemplate) {
- if (template.getType().equals(CONTROL_LOOP_NODE_TYPE)) {
- controlLoop.setDefinition(getControlLoopDefinition(newNodeTemplate));
- }
-
- if (template.getType().contains(CONTROL_LOOP_NODE_ELEMENT_TYPE)) {
- ControlLoopElement controlLoopElement = getControlLoopElement(newNodeTemplate);
- controlLoopElements.put(controlLoopElement.getId(), controlLoopElement);
- }
-
- controlLoop.setName("PMSH" + instanceName);
- controlLoop.setVersion(template.getVersion());
- controlLoop.setDescription("PMSH control loop " + instanceName);
- controlLoop.setState(ControlLoopState.UNINITIALISED);
- controlLoop.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- }
-
- /**
- * Get's the instance property name of the control loop.
- *
- * @param name the name of the control loop to get, null for all control loops
- * @param version the version of the control loop to get, null for all control loops
- * @return the instance name of the control loop instance properties
- * @throws PfModelException on errors getting control loops
- */
- private String getInstancePropertyName(String name, String version) throws PfModelException {
- List<String> toscaDefinitionsNames = controlLoopProvider.getControlLoops(name, version).stream()
- .map(ControlLoop::getDefinition).map(ToscaNameVersion::getName).collect(Collectors.toList());
-
- return toscaDefinitionsNames.stream().reduce("", (s1, s2) -> {
-
- if (s2.contains(INSTANCE_TEXT)) {
- String[] instances = s2.split(INSTANCE_TEXT);
-
- return INSTANCE_TEXT + instances[1];
- }
-
- return s1;
- });
- }
-
- /**
- * Generates Instance Name in sequential order and return it to append to the Node Template Name.
- *
- * @return instanceName
- */
- private String generateSequentialInstanceName() {
- List<ToscaNodeTemplate> nodeTemplates = controlLoopProvider.getAllNodeTemplates();
-
- int instanceNumber = nodeTemplates.stream().map(ToscaNodeTemplate::getName)
- .filter(name -> name.contains(INSTANCE_TEXT)).map(n -> {
- String[] defNameArr = n.split(INSTANCE_TEXT);
-
- return Integer.parseInt(defNameArr[1]);
- }).reduce(0, Math::max);
-
- return INSTANCE_TEXT + (instanceNumber + 1);
- }
-
- /**
- * Retrieves Control Loop Definition.
- *
- * @param template tosca node template
- * @return control loop definition
- */
- private ToscaConceptIdentifier getControlLoopDefinition(ToscaNodeTemplate template) {
- ToscaConceptIdentifier definition = new ToscaConceptIdentifier();
- definition.setName(template.getName());
- definition.setVersion(template.getVersion());
- return definition;
- }
-
- /**
- * Retrieves Control Loop Element.
- *
- * @param template tosca node template
- * @return a control loop element
- */
- @SuppressWarnings("unchecked")
- private ControlLoopElement getControlLoopElement(ToscaNodeTemplate template) {
- ControlLoopElement controlLoopElement = new ControlLoopElement();
- ToscaConceptIdentifier definition = new ToscaConceptIdentifier();
- definition.setName(template.getName());
- definition.setVersion(template.getVersion());
- controlLoopElement.setDefinition(definition);
- LinkedTreeMap<String, Object> participantId =
- (LinkedTreeMap<String, Object>) template.getProperties().get(PARTICIPANT_ID_PROPERTY_KEY);
- if (participantId != null) {
- ToscaConceptIdentifier participantIdProperty = new ToscaConceptIdentifier();
- participantIdProperty.setName(String.valueOf(participantId.get(CL_ELEMENT_NAME)));
- participantIdProperty.setVersion(String.valueOf(participantId.get(CL_ELEMENT_VERSION)));
- controlLoopElement.setParticipantId(participantIdProperty);
- }
- LinkedTreeMap<String, Object> participantType =
- (LinkedTreeMap<String, Object>) template.getProperties().get(PARTICIPANT_TYPE_PROPERTY_KEY);
- if (participantType != null) {
- ToscaConceptIdentifier participantTypeProperty = new ToscaConceptIdentifier();
- participantTypeProperty.setName(String.valueOf(participantType.get(CL_ELEMENT_NAME)));
- participantTypeProperty.setVersion(participantType.get(CL_ELEMENT_VERSION).toString());
- controlLoopElement.setParticipantType(participantTypeProperty);
- }
- return controlLoopElement;
- }
-
- /**
- * Deep clones ToscaNodeTemplate.
- *
- * @param serviceTemplate ToscaServiceTemplate
- * @return a cloned Hash Map of ToscaNodeTemplate
- */
- private Map<String, ToscaNodeTemplate> deepCloneNodeTemplate(ToscaServiceTemplate serviceTemplate) {
- String jsonString = GSON.toJson(serviceTemplate.getToscaTopologyTemplate().getNodeTemplates());
- Type type = new TypeToken<HashMap<String, ToscaNodeTemplate>>() {}.getType();
- return GSON.fromJson(jsonString, type);
- }
-}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java
deleted file mode 100644
index 2ec438bea..000000000
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.runtime.monitoring;
-
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import lombok.AllArgsConstructor;
-import lombok.NonNull;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ClElementStatisticsProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantStatisticsProvider;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * This class provides information about statistics data of CL elements and CL Participants in database to callers.
- */
-@Service
-@Transactional
-@AllArgsConstructor
-public class MonitoringProvider {
-
- private static final String DESC_ORDER = "DESC";
- private final ParticipantStatisticsProvider participantStatisticsProvider;
- private final ClElementStatisticsProvider clElementStatisticsProvider;
- private final ControlLoopProvider controlLoopProvider;
-
- /**
- * Create participant statistics.
- *
- * @param participantStatistics the participant statistics
- * @return the result of create operation
- * @throws PfModelException on creation errors
- */
- public ParticipantStatisticsList createParticipantStatistics(List<ParticipantStatistics> participantStatistics)
- throws PfModelException {
- var participantStatisticsList = new ParticipantStatisticsList();
- participantStatisticsList
- .setStatisticsList(participantStatisticsProvider.createParticipantStatistics(participantStatistics));
-
- return participantStatisticsList;
- }
-
- /**
- * Create clElement statistics.
- *
- * @param clElementStatisticsList the clElement statistics
- * @return the result of create operation
- * @throws PfModelException on creation errors
- */
- public ClElementStatisticsList createClElementStatistics(List<ClElementStatistics> clElementStatisticsList)
- throws PfModelException {
- var elementStatisticsList = new ClElementStatisticsList();
- elementStatisticsList
- .setClElementStatistics(clElementStatisticsProvider.createClElementStatistics(clElementStatisticsList));
-
- return elementStatisticsList;
- }
-
- /**
- * Get participant statistics based on specific filters.
- *
- * @param name the name of the participant statistics to get, null to get all statistics
- * @param version the version of the participant statistics to get, null to get all statistics
- * @param recordCount number of records to be fetched.
- * @param startTime start of the timestamp, from statistics to be filtered
- * @param endTime end of the timestamp up to which statistics to be filtered
- * @return the participant found
- */
- @Transactional(readOnly = true)
- public ParticipantStatisticsList fetchFilteredParticipantStatistics(@NonNull final String name,
- final String version, int recordCount, Instant startTime, Instant endTime) {
- var participantStatisticsList = new ParticipantStatisticsList();
-
- // Additional parameters can be added in filterMap for filtering data.
- Map<String, Object> filterMap = null;
- participantStatisticsList.setStatisticsList(participantStatisticsProvider.getFilteredParticipantStatistics(name,
- version, startTime, endTime, filterMap, DESC_ORDER, recordCount));
-
- return participantStatisticsList;
- }
-
- /**
- * Get all participant statistics records found for a specific control loop. *
- *
- * @param controlLoopName name of the control loop
- * @param controlLoopVersion version of the control loop
- * @return All the participant statistics found
- * @throws PfModelRuntimeException on errors getting participant statistics
- */
- @Transactional(readOnly = true)
- public ParticipantStatisticsList fetchParticipantStatsPerControlLoop(@NonNull final String controlLoopName,
- @NonNull final String controlLoopVersion) {
- var statisticsList = new ParticipantStatisticsList();
- List<ParticipantStatistics> participantStatistics = new ArrayList<>();
- try {
- // Fetch all participantIds for a specific control loop
- List<ToscaConceptIdentifier> participantIds =
- getAllParticipantIdsPerControlLoop(controlLoopName, controlLoopVersion);
- for (ToscaConceptIdentifier id : participantIds) {
- participantStatistics.addAll(participantStatisticsProvider.getFilteredParticipantStatistics(
- id.getName(), id.getVersion(), null, null, null, DESC_ORDER, 0));
- }
- statisticsList.setStatisticsList(participantStatistics);
- } catch (PfModelException e) {
- throw new PfModelRuntimeException(e);
- }
- return statisticsList;
- }
-
- /**
- * Get clElement statistics based on specific filters.
- *
- * @param name the name of the clElement statistics to get, null to get all statistics
- * @param version the version of the clElement statistics to get, null to get all statistics
- * @param id UUID of the control loop element
- * @param startTime start of the timestamp, from statistics to be filtered
- * @param endTime end of the timestamp up to which statistics to be filtered
- * @param recordCount number of records to be fetched.
- * @return the participant found
- * @throws PfModelException on errors getting control loop statistics
- */
- @Transactional(readOnly = true)
- public ClElementStatisticsList fetchFilteredClElementStatistics(@NonNull final String name, final String version,
- final String id, Instant startTime, Instant endTime, int recordCount) throws PfModelException {
- var clElementStatisticsList = new ClElementStatisticsList();
- Map<String, Object> filterMap = new HashMap<>();
- // Adding UUID in filter if present
- if (id != null) {
- filterMap.put("localName", id);
- }
- clElementStatisticsList.setClElementStatistics(clElementStatisticsProvider.getFilteredClElementStatistics(name,
- version, startTime, endTime, filterMap, DESC_ORDER, recordCount));
-
- return clElementStatisticsList;
- }
-
- /**
- * Get clElement statistics per control loop.
- *
- * @param name the name of the control loop
- * @param version the version of the control loop
- * @return the clElement statistics found
- * @throws PfModelRuntimeException on errors getting control loop statistics
- */
- @Transactional(readOnly = true)
- public ClElementStatisticsList fetchClElementStatsPerControlLoop(@NonNull final String name,
- @NonNull final String version) {
- var clElementStatisticsList = new ClElementStatisticsList();
- List<ClElementStatistics> clElementStats = new ArrayList<>();
- try {
- List<ControlLoopElement> clElements = new ArrayList<>();
- // Fetch all control loop elements for the control loop
- var controlLoopOpt = controlLoopProvider.findControlLoop(new ToscaConceptIdentifier(name, version));
- if (controlLoopOpt.isPresent()) {
- clElements.addAll(controlLoopOpt.get().getElements().values());
- // Collect control loop element statistics for each cl element.
- for (ControlLoopElement clElement : clElements) {
- clElementStats.addAll(fetchFilteredClElementStatistics(clElement.getParticipantId().getName(),
- clElement.getParticipantId().getVersion(), clElement.getId().toString(), null, null, 0)
- .getClElementStatistics());
- }
- }
- clElementStatisticsList.setClElementStatistics(clElementStats);
- } catch (PfModelException e) {
- throw new PfModelRuntimeException(e);
- }
- return clElementStatisticsList;
- }
-
- /**
- * If required, REST end point can be defined for this method to fetch associated participant Ids
- * for a control loop.
- *
- * @param name the name of the control loop
- * @param version the version of the control loop
- * @return List of participant Id
- * @throws PfModelException on errors
- */
- @Transactional(readOnly = true)
- public List<ToscaConceptIdentifier> getAllParticipantIdsPerControlLoop(String name, String version)
- throws PfModelException {
- List<ToscaConceptIdentifier> participantIds = new ArrayList<>();
- var controlLoopOpt = controlLoopProvider.findControlLoop(new ToscaConceptIdentifier(name, version));
- if (controlLoopOpt.isPresent()) {
- for (ControlLoopElement clElement : controlLoopOpt.get().getElements().values()) {
- participantIds.add(clElement.getParticipantId());
- }
- }
- return participantIds;
- }
-
- /**
- * If required, REST end point can be defined for this method to fetch associated control loop element Ids
- * for a control loop.
- *
- * @param name the name of the control loop
- * @param version the version of the control loop
- * @return Map of control loop Id and participant details
- * @throws PfModelException on errors
- */
- @Transactional(readOnly = true)
- public Map<String, ToscaConceptIdentifier> getAllClElementsIdPerControlLoop(String name, String version)
- throws PfModelException {
- Map<String, ToscaConceptIdentifier> clElementId = new HashMap<>();
- var controlLoopOpt = controlLoopProvider.findControlLoop(new ToscaConceptIdentifier(name, version));
- if (controlLoopOpt.isPresent()) {
- for (ControlLoopElement clElement : controlLoopOpt.get().getElements().values()) {
- clElementId.put(clElement.getId().toString(), clElement.getParticipantId());
- }
- }
- return clElementId;
- }
-}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
deleted file mode 100644
index 6af2788e6..000000000
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
+++ /dev/null
@@ -1,491 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.runtime.supervision;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import lombok.AllArgsConstructor;
-import org.apache.commons.collections4.CollectionUtils;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementAck;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringProvider;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopStateChangePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopUpdatePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantDeregisterAckPublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantRegisterAckPublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.base.PfModelRuntimeException;
-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;
-import org.springframework.stereotype.Component;
-
-/**
- * This class handles supervision of control loop instances, so only one object of this type should be built at a time.
- *
- * <p/>
- * It is effectively a singleton that is started at system start.
- */
-@Component
-@AllArgsConstructor
-public class SupervisionHandler {
- private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionHandler.class);
-
- private static final String CONTROL_LOOP_CANNOT_TRANSITION_FROM_STATE = "Control loop can't transition from state ";
- private static final String CONTROL_LOOP_IS_ALREADY_IN_STATE = "Control loop is already in state ";
- private static final String TO_STATE = " to state ";
- private static final String AND_TRANSITIONING_TO_STATE = " and transitioning to state ";
-
- private final ControlLoopProvider controlLoopProvider;
- private final ParticipantProvider participantProvider;
- private final MonitoringProvider monitoringProvider;
- private final ServiceTemplateProvider serviceTemplateProvider;
-
- // Publishers for participant communication
- private final ControlLoopUpdatePublisher controlLoopUpdatePublisher;
- private final ControlLoopStateChangePublisher controlLoopStateChangePublisher;
- private final ParticipantRegisterAckPublisher participantRegisterAckPublisher;
- private final ParticipantDeregisterAckPublisher participantDeregisterAckPublisher;
- private final ParticipantUpdatePublisher participantUpdatePublisher;
-
- /**
- * Supervision trigger called when a command is issued on control loops.
- *
- * <p/>
- * Causes supervision to start or continue supervision on the control loops in question.
- *
- * @param controlLoopIdentifierList the control loops for which the supervision command has been issued
- * @throws ControlLoopException on supervision triggering exceptions
- */
- public void triggerControlLoopSupervision(List<ToscaConceptIdentifier> controlLoopIdentifierList)
- throws ControlLoopException {
-
- LOGGER.debug("triggering control loop supervision on control loops {}", controlLoopIdentifierList);
-
- if (CollectionUtils.isEmpty(controlLoopIdentifierList)) {
- // This is just to force throwing of the exception in certain circumstances.
- exceptionOccured(Response.Status.NOT_ACCEPTABLE, "The list of control loops for supervision is empty");
- }
-
- for (ToscaConceptIdentifier controlLoopId : controlLoopIdentifierList) {
- try {
- var controlLoop = controlLoopProvider.getControlLoop(controlLoopId);
-
- superviseControlLoop(controlLoop);
-
- controlLoopProvider.saveControlLoop(controlLoop);
- } catch (PfModelException pfme) {
- throw new ControlLoopException(pfme.getErrorResponse().getResponseCode(), pfme.getMessage(), pfme);
- }
- }
- }
-
- /**
- * Handle a ParticipantStatus message from a participant.
- *
- * @param participantStatusMessage the ParticipantStatus message received from a participant
- */
- @MessageIntercept
- public void handleParticipantMessage(ParticipantStatus participantStatusMessage) {
- LOGGER.debug("Participant Status received {}", participantStatusMessage);
- try {
- superviseParticipant(participantStatusMessage);
- } catch (PfModelException | ControlLoopException svExc) {
- LOGGER.warn("error supervising participant {}", participantStatusMessage.getParticipantId(), svExc);
- return;
- }
-
- try {
- superviseControlLoops(participantStatusMessage);
- } catch (PfModelException | ControlLoopException svExc) {
- LOGGER.warn("error supervising participant {}", participantStatusMessage.getParticipantId(), svExc);
- }
- }
-
- /**
- * Handle a ParticipantRegister message from a participant.
- *
- * @param participantRegisterMessage the ParticipantRegister message received from a participant
- */
- @MessageIntercept
- public boolean handleParticipantMessage(ParticipantRegister participantRegisterMessage) {
- LOGGER.debug("Participant Register received {}", participantRegisterMessage);
- try {
- checkParticipant(participantRegisterMessage, ParticipantState.UNKNOWN, ParticipantHealthStatus.UNKNOWN);
- } catch (PfModelException | ControlLoopException svExc) {
- LOGGER.warn("error saving participant {}", participantRegisterMessage.getParticipantId(), svExc);
- }
-
- var isCommissioning = participantUpdatePublisher.sendCommissioning(null, null,
- participantRegisterMessage.getParticipantId(), participantRegisterMessage.getParticipantType());
-
- participantRegisterAckPublisher.send(participantRegisterMessage.getMessageId(),
- participantRegisterMessage.getParticipantId(), participantRegisterMessage.getParticipantType());
- return isCommissioning;
- }
-
- /**
- * Handle a ParticipantDeregister message from a participant.
- *
- * @param participantDeregisterMessage the ParticipantDeregister message received from a participant
- */
- @MessageIntercept
- public void handleParticipantMessage(ParticipantDeregister participantDeregisterMessage) {
- LOGGER.debug("Participant Deregister received {}", participantDeregisterMessage);
- try {
- var participantOpt =
- participantProvider.findParticipant(participantDeregisterMessage.getParticipantId().getName(),
- participantDeregisterMessage.getParticipantId().getVersion());
-
- if (participantOpt.isPresent()) {
- var participant = participantOpt.get();
- participant.setParticipantState(ParticipantState.TERMINATED);
- participant.setHealthStatus(ParticipantHealthStatus.OFF_LINE);
- participantProvider.saveParticipant(participant);
- }
- } catch (PfModelException pfme) {
- LOGGER.warn("Model exception occured with participant id {}",
- participantDeregisterMessage.getParticipantId());
- }
-
- participantDeregisterAckPublisher.send(participantDeregisterMessage.getMessageId());
- }
-
- /**
- * Handle a ParticipantUpdateAck message from a participant.
- *
- * @param participantUpdateAckMessage the ParticipantUpdateAck message received from a participant
- */
- @MessageIntercept
- public void handleParticipantMessage(ParticipantUpdateAck participantUpdateAckMessage) {
- LOGGER.debug("Participant Update Ack received {}", participantUpdateAckMessage);
- try {
- var participantOpt =
- participantProvider.findParticipant(participantUpdateAckMessage.getParticipantId().getName(),
- participantUpdateAckMessage.getParticipantId().getVersion());
-
- if (participantOpt.isPresent()) {
- var participant = participantOpt.get();
- participant.setParticipantState(participantUpdateAckMessage.getState());
- participantProvider.saveParticipant(participant);
- } else {
- LOGGER.warn("Participant not found in database {}", participantUpdateAckMessage.getParticipantId());
- }
- } catch (PfModelException pfme) {
- LOGGER.warn("Model exception occured with participant id {}",
- participantUpdateAckMessage.getParticipantId());
- }
- }
-
- /**
- * Send commissioning update message to dmaap.
- *
- * @param name the ToscaServiceTemplate name
- * @param version the ToscaServiceTemplate version
- */
- public void handleSendCommissionMessage(String name, String version) {
- LOGGER.debug("Participant update message with serviveTemplate {} {} being sent to all participants", name,
- version);
- participantUpdatePublisher.sendComissioningBroadcast(name, version);
- }
-
- /**
- * Send decommissioning update message to dmaap.
- *
- */
- public void handleSendDeCommissionMessage() {
- LOGGER.debug("Participant update message being sent");
- participantUpdatePublisher.sendDecomisioning();
- }
-
- /**
- * Handle a ControlLoop update acknowledge message from a participant.
- *
- * @param controlLoopAckMessage the ControlLoopAck message received from a participant
- */
- @MessageIntercept
- public void handleControlLoopUpdateAckMessage(ControlLoopAck controlLoopAckMessage) {
- LOGGER.debug("ControlLoop Update Ack message received {}", controlLoopAckMessage);
- setClElementStateInDb(controlLoopAckMessage);
- }
-
- /**
- * Handle a ControlLoop statechange acknowledge message from a participant.
- *
- * @param controlLoopAckMessage the ControlLoopAck message received from a participant
- */
- @MessageIntercept
- public void handleControlLoopStateChangeAckMessage(ControlLoopAck controlLoopAckMessage) {
- LOGGER.debug("ControlLoop StateChange Ack message received {}", controlLoopAckMessage);
- setClElementStateInDb(controlLoopAckMessage);
- }
-
- private void setClElementStateInDb(ControlLoopAck controlLoopAckMessage) {
- if (controlLoopAckMessage.getControlLoopResultMap() != null) {
- try {
- var controlLoop = controlLoopProvider.getControlLoop(controlLoopAckMessage.getControlLoopId());
- if (controlLoop != null) {
- var updated = updateState(controlLoop, controlLoopAckMessage.getControlLoopResultMap().entrySet());
- updated |= setPrimed(controlLoop);
- if (updated) {
- controlLoopProvider.saveControlLoop(controlLoop);
- }
- } else {
- LOGGER.warn("ControlLoop not found in database {}", controlLoopAckMessage.getControlLoopId());
- }
- } catch (PfModelException pfme) {
- LOGGER.warn("Model exception occured with ControlLoop Id {}", controlLoopAckMessage.getControlLoopId());
- }
- }
- }
-
- private boolean updateState(ControlLoop controlLoop,
- Set<Map.Entry<UUID, ControlLoopElementAck>> controlLoopResultSet) {
- var updated = false;
- for (var clElementAck : controlLoopResultSet) {
- var element = controlLoop.getElements().get(clElementAck.getKey());
- if (element != null) {
- element.setState(clElementAck.getValue().getState());
- updated = true;
- }
- }
- return updated;
- }
-
- private boolean setPrimed(ControlLoop controlLoop) {
- var clElements = controlLoop.getElements().values();
- if (clElements != null) {
- Boolean primedFlag = true;
- var checkOpt = controlLoop.getElements().values().stream()
- .filter(clElement -> (!clElement.getState().equals(ControlLoopState.PASSIVE)
- || !clElement.getState().equals(ControlLoopState.RUNNING)))
- .findAny();
- if (checkOpt.isEmpty()) {
- primedFlag = false;
- }
- controlLoop.setPrimed(primedFlag);
- return true;
- }
-
- return false;
- }
-
- /**
- * Supervise a control loop, performing whatever actions need to be performed on the control loop.
- *
- * @param controlLoop the control loop to supervises
- * @throws ControlLoopException on supervision errors
- */
- private void superviseControlLoop(ControlLoop controlLoop) throws ControlLoopException {
- switch (controlLoop.getOrderedState()) {
- case UNINITIALISED:
- superviseControlLoopUninitialization(controlLoop);
- break;
-
- case PASSIVE:
- superviseControlLoopPassivation(controlLoop);
- break;
-
- case RUNNING:
- superviseControlLoopActivation(controlLoop);
- break;
-
- default:
- exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- "A control loop cannot be commanded to go into state " + controlLoop.getOrderedState().name());
- }
- }
-
- /**
- * Supervise a control loop uninitialisation, performing whatever actions need to be performed on the control loop,
- * control loop ordered state is UNINITIALIZED.
- *
- * @param controlLoop the control loop to supervises
- * @throws ControlLoopException on supervision errors
- */
- private void superviseControlLoopUninitialization(ControlLoop controlLoop) throws ControlLoopException {
- switch (controlLoop.getState()) {
- case UNINITIALISED:
- exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- CONTROL_LOOP_IS_ALREADY_IN_STATE + controlLoop.getState().name());
- break;
-
- case UNINITIALISED2PASSIVE:
- case PASSIVE:
- controlLoop.setState(ControlLoopState.PASSIVE2UNINITIALISED);
- controlLoopStateChangePublisher.send(controlLoop, getFirstStartPhase(controlLoop));
- break;
-
- case PASSIVE2UNINITIALISED:
- exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_IS_ALREADY_IN_STATE
- + controlLoop.getState().name() + AND_TRANSITIONING_TO_STATE + controlLoop.getOrderedState());
- break;
-
- default:
- exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_CANNOT_TRANSITION_FROM_STATE
- + controlLoop.getState().name() + TO_STATE + controlLoop.getOrderedState());
- break;
- }
- }
-
- private void superviseControlLoopPassivation(ControlLoop controlLoop) throws ControlLoopException {
- switch (controlLoop.getState()) {
- case PASSIVE:
- exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- CONTROL_LOOP_IS_ALREADY_IN_STATE + controlLoop.getState().name());
- break;
- case UNINITIALISED:
- controlLoop.setState(ControlLoopState.UNINITIALISED2PASSIVE);
- controlLoopUpdatePublisher.send(controlLoop);
- break;
-
- case UNINITIALISED2PASSIVE:
- case RUNNING2PASSIVE:
- exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_IS_ALREADY_IN_STATE
- + controlLoop.getState().name() + AND_TRANSITIONING_TO_STATE + controlLoop.getOrderedState());
- break;
-
- case RUNNING:
- controlLoop.setState(ControlLoopState.RUNNING2PASSIVE);
- controlLoopStateChangePublisher.send(controlLoop, getFirstStartPhase(controlLoop));
- break;
-
- default:
- exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_CANNOT_TRANSITION_FROM_STATE
- + controlLoop.getState().name() + TO_STATE + controlLoop.getOrderedState());
- break;
- }
- }
-
- private void superviseControlLoopActivation(ControlLoop controlLoop) throws ControlLoopException {
- switch (controlLoop.getState()) {
- case RUNNING:
- exceptionOccured(Response.Status.NOT_ACCEPTABLE,
- CONTROL_LOOP_IS_ALREADY_IN_STATE + controlLoop.getState().name());
- break;
-
- case PASSIVE2RUNNING:
- exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_IS_ALREADY_IN_STATE
- + controlLoop.getState().name() + AND_TRANSITIONING_TO_STATE + controlLoop.getOrderedState());
- break;
-
- case PASSIVE:
- controlLoop.setState(ControlLoopState.PASSIVE2RUNNING);
- controlLoopStateChangePublisher.send(controlLoop, getFirstStartPhase(controlLoop));
- break;
-
- default:
- exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_CANNOT_TRANSITION_FROM_STATE
- + controlLoop.getState().name() + TO_STATE + controlLoop.getOrderedState());
- break;
- }
- }
-
- private int getFirstStartPhase(ControlLoop controlLoop) {
- ToscaServiceTemplate toscaServiceTemplate = null;
- try {
- toscaServiceTemplate = serviceTemplateProvider.getAllServiceTemplates().get(0);
- } catch (PfModelException e) {
- throw new PfModelRuntimeException(Status.BAD_REQUEST, "Canont load ToscaServiceTemplate from DB", e);
- }
- return ParticipantUtils.getFirstStartPhase(controlLoop, toscaServiceTemplate);
- }
-
- private void checkParticipant(ParticipantMessage participantMessage, ParticipantState participantState,
- ParticipantHealthStatus healthStatus) throws ControlLoopException, PfModelException {
- if (participantMessage.getParticipantId() == null) {
- exceptionOccured(Response.Status.NOT_FOUND, "Participant ID on PARTICIPANT_STATUS message is null");
- }
- var participantOpt = participantProvider.findParticipant(participantMessage.getParticipantId().getName(),
- participantMessage.getParticipantId().getVersion());
-
- if (participantOpt.isEmpty()) {
- var participant = new Participant();
- participant.setName(participantMessage.getParticipantId().getName());
- participant.setVersion(participantMessage.getParticipantId().getVersion());
- participant.setDefinition(participantMessage.getParticipantId());
- participant.setParticipantType(participantMessage.getParticipantType());
- participant.setParticipantState(participantState);
- participant.setHealthStatus(healthStatus);
-
- participantProvider.saveParticipant(participant);
- } else {
- var participant = participantOpt.get();
- participant.setParticipantState(participantState);
- participant.setHealthStatus(healthStatus);
-
- participantProvider.saveParticipant(participant);
- }
- }
-
- private void superviseParticipant(ParticipantStatus participantStatusMessage)
- throws PfModelException, ControlLoopException {
-
- checkParticipant(participantStatusMessage, participantStatusMessage.getState(),
- participantStatusMessage.getHealthStatus());
-
- monitoringProvider.createParticipantStatistics(List.of(participantStatusMessage.getParticipantStatistics()));
- }
-
- private void superviseControlLoops(ParticipantStatus participantStatusMessage)
- throws PfModelException, ControlLoopException {
- if (participantStatusMessage.getControlLoopInfoList() != null) {
- for (ControlLoopInfo clEntry : participantStatusMessage.getControlLoopInfoList()) {
- var dbControlLoop =
- controlLoopProvider.getControlLoop(new ToscaConceptIdentifier(clEntry.getControlLoopId()));
- if (dbControlLoop == null) {
- exceptionOccured(Response.Status.NOT_FOUND,
- "PARTICIPANT_STATUS control loop not found in database: " + clEntry.getControlLoopId());
- }
- dbControlLoop.setState(clEntry.getState());
- monitoringProvider.createClElementStatistics(
- clEntry.getControlLoopStatistics().getClElementStatisticsList().getClElementStatistics());
- }
- }
- }
-
- private void exceptionOccured(Response.Status status, String reason) throws ControlLoopException {
- throw new ControlLoopException(status, reason);
- }
-}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java
deleted file mode 100644
index 01e035b87..000000000
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.runtime.supervision;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopStateChangePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopUpdatePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantStatusReqPublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * This class is used to scan the control loops in the database and check if they are in the correct state.
- */
-@Component
-public class SupervisionScanner {
- private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionScanner.class);
-
- private final HandleCounter<ToscaConceptIdentifier> controlLoopCounter = new HandleCounter<>();
- private final HandleCounter<ToscaConceptIdentifier> participantStatusCounter = new HandleCounter<>();
- private final HandleCounter<Pair<ToscaConceptIdentifier, ToscaConceptIdentifier>> participantUpdateCounter =
- new HandleCounter<>();
-
- private final Map<ToscaConceptIdentifier, Integer> phaseMap = new HashMap<>();
-
- private final ControlLoopProvider controlLoopProvider;
- private final ServiceTemplateProvider serviceTemplateProvider;
- private final ControlLoopStateChangePublisher controlLoopStateChangePublisher;
- private final ControlLoopUpdatePublisher controlLoopUpdatePublisher;
- private final ParticipantProvider participantProvider;
- private final ParticipantStatusReqPublisher participantStatusReqPublisher;
- private final ParticipantUpdatePublisher participantUpdatePublisher;
-
- /**
- * Constructor for instantiating SupervisionScanner.
- *
- * @param controlLoopProvider the provider to use to read control loops from the database
- * @param serviceTemplateProvider the Policy Models Provider
- * @param controlLoopStateChangePublisher the ControlLoop StateChange Publisher
- * @param controlLoopUpdatePublisher the ControlLoopUpdate Publisher
- * @param participantProvider the Participant Provider
- * @param participantStatusReqPublisher the Participant StatusReq Publisher
- * @param participantUpdatePublisher the Participant Update Publisher
- * @param clRuntimeParameterGroup the parameters for the control loop runtime
- */
- public SupervisionScanner(final ControlLoopProvider controlLoopProvider,
- ServiceTemplateProvider serviceTemplateProvider,
- final ControlLoopStateChangePublisher controlLoopStateChangePublisher,
- ControlLoopUpdatePublisher controlLoopUpdatePublisher, ParticipantProvider participantProvider,
- ParticipantStatusReqPublisher participantStatusReqPublisher,
- ParticipantUpdatePublisher participantUpdatePublisher,
- final ClRuntimeParameterGroup clRuntimeParameterGroup) {
- this.controlLoopProvider = controlLoopProvider;
- this.serviceTemplateProvider = serviceTemplateProvider;
- this.controlLoopStateChangePublisher = controlLoopStateChangePublisher;
- this.controlLoopUpdatePublisher = controlLoopUpdatePublisher;
- this.participantProvider = participantProvider;
- this.participantStatusReqPublisher = participantStatusReqPublisher;
- this.participantUpdatePublisher = participantUpdatePublisher;
-
- controlLoopCounter.setMaxRetryCount(
- clRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
- controlLoopCounter.setMaxWaitMs(clRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs());
-
- participantUpdateCounter.setMaxRetryCount(
- clRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
- participantUpdateCounter
- .setMaxWaitMs(clRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxWaitMs());
-
- participantStatusCounter.setMaxRetryCount(
- clRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
- participantStatusCounter.setMaxWaitMs(clRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs());
- }
-
- /**
- * Run Scanning.
- *
- * @param counterCheck if true activate counter and retry
- */
- public void run(boolean counterCheck) {
- LOGGER.debug("Scanning control loops in the database . . .");
-
- if (counterCheck) {
- try {
- for (var participant : participantProvider.getParticipants()) {
- scanParticipantStatus(participant);
- }
- } catch (PfModelException pfme) {
- LOGGER.warn("error reading participant from database", pfme);
- return;
- }
- }
-
- try {
- var list = serviceTemplateProvider.getAllServiceTemplates();
- if (list != null && !list.isEmpty()) {
- ToscaServiceTemplate toscaServiceTemplate = list.get(0);
-
- for (ControlLoop controlLoop : controlLoopProvider.getControlLoops()) {
- scanControlLoop(controlLoop, toscaServiceTemplate, counterCheck);
- }
- }
- } catch (PfModelException pfme) {
- LOGGER.warn("error reading control loops from database", pfme);
- }
-
- if (counterCheck) {
- scanParticipantUpdate();
- }
-
- LOGGER.debug("Control loop scan complete . . .");
- }
-
- private void scanParticipantUpdate() {
- LOGGER.debug("Scanning participants to update . . .");
-
- for (var id : participantUpdateCounter.keySet()) {
- if (participantUpdateCounter.isFault(id)) {
- LOGGER.debug("report Participant Update fault");
-
- } else if (participantUpdateCounter.getDuration(id) > participantUpdateCounter.getMaxWaitMs()) {
-
- if (participantUpdateCounter.count(id)) {
- LOGGER.debug("retry message ParticipantUpdate");
- participantUpdatePublisher.sendCommissioning(null, null, id.getLeft(), id.getRight());
- } else {
- LOGGER.debug("report Participant Update fault");
- participantUpdateCounter.setFault(id);
- }
- }
- }
-
- LOGGER.debug("Participants to update scan complete . . .");
- }
-
- private void scanParticipantStatus(Participant participant) throws PfModelException {
- ToscaConceptIdentifier id = participant.getKey().asIdentifier();
- if (participantStatusCounter.isFault(id)) {
- LOGGER.debug("report Participant fault");
- return;
- }
- if (participantStatusCounter.getDuration(id) > participantStatusCounter.getMaxWaitMs()) {
- if (participantStatusCounter.count(id)) {
- LOGGER.debug("retry message ParticipantStatusReq");
- participantStatusReqPublisher.send(id);
- participant.setHealthStatus(ParticipantHealthStatus.NOT_HEALTHY);
- } else {
- LOGGER.debug("report Participant fault");
- participantStatusCounter.setFault(id);
- participant.setHealthStatus(ParticipantHealthStatus.OFF_LINE);
- }
- participantProvider.saveParticipant(participant);
- }
- }
-
- /**
- * handle participant Status message.
- */
- public void handleParticipantStatus(ToscaConceptIdentifier id) {
- participantStatusCounter.clear(id);
- }
-
- public void handleParticipantRegister(Pair<ToscaConceptIdentifier, ToscaConceptIdentifier> id) {
- participantUpdateCounter.clear(id);
- }
-
- public void handleParticipantUpdateAck(Pair<ToscaConceptIdentifier, ToscaConceptIdentifier> id) {
- participantUpdateCounter.remove(id);
- }
-
- private void scanControlLoop(final ControlLoop controlLoop, ToscaServiceTemplate toscaServiceTemplate,
- boolean counterCheck) throws PfModelException {
- LOGGER.debug("scanning control loop {} . . .", controlLoop.getKey().asIdentifier());
-
- if (controlLoop.getState().equals(controlLoop.getOrderedState().asState())) {
- LOGGER.debug("control loop {} scanned, OK", controlLoop.getKey().asIdentifier());
-
- // Clear missed report counter on Control Loop
- clearFaultAndCounter(controlLoop);
- return;
- }
-
- var completed = true;
- var minSpNotCompleted = 1000; // min startPhase not completed
- var maxSpNotCompleted = 0; // max startPhase not completed
- var defaultMin = 1000; // min startPhase
- var defaultMax = 0; // max startPhase
- for (ControlLoopElement element : controlLoop.getElements().values()) {
- ToscaNodeTemplate toscaNodeTemplate = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates()
- .get(element.getDefinition().getName());
- int startPhase = ParticipantUtils.findStartPhase(toscaNodeTemplate.getProperties());
- defaultMin = Math.min(defaultMin, startPhase);
- defaultMax = Math.max(defaultMax, startPhase);
- if (!element.getState().equals(element.getOrderedState().asState())) {
- completed = false;
- minSpNotCompleted = Math.min(minSpNotCompleted, startPhase);
- maxSpNotCompleted = Math.max(maxSpNotCompleted, startPhase);
- }
- }
-
- if (completed) {
- LOGGER.debug("control loop scan: transition from state {} to {} completed", controlLoop.getState(),
- controlLoop.getOrderedState());
-
- controlLoop.setState(controlLoop.getOrderedState().asState());
- controlLoopProvider.saveControlLoop(controlLoop);
-
- // Clear missed report counter on Control Loop
- clearFaultAndCounter(controlLoop);
- } else {
- LOGGER.debug("control loop scan: transition from state {} to {} not completed", controlLoop.getState(),
- controlLoop.getOrderedState());
-
- var nextSpNotCompleted = ControlLoopState.UNINITIALISED2PASSIVE.equals(controlLoop.getState())
- || ControlLoopState.PASSIVE2RUNNING.equals(controlLoop.getState()) ? minSpNotCompleted
- : maxSpNotCompleted;
-
- var firstStartPhase = ControlLoopState.UNINITIALISED2PASSIVE.equals(controlLoop.getState())
- || ControlLoopState.PASSIVE2RUNNING.equals(controlLoop.getState()) ? defaultMin : defaultMax;
-
- if (nextSpNotCompleted != phaseMap.getOrDefault(controlLoop.getKey().asIdentifier(), firstStartPhase)) {
- phaseMap.put(controlLoop.getKey().asIdentifier(), nextSpNotCompleted);
- sendControlLoopMsg(controlLoop, nextSpNotCompleted);
- } else if (counterCheck) {
- phaseMap.put(controlLoop.getKey().asIdentifier(), nextSpNotCompleted);
- handleCounter(controlLoop, nextSpNotCompleted);
- }
- }
- }
-
- private void clearFaultAndCounter(ControlLoop controlLoop) {
- controlLoopCounter.clear(controlLoop.getKey().asIdentifier());
- phaseMap.clear();
- }
-
- private void handleCounter(ControlLoop controlLoop, int startPhase) {
- ToscaConceptIdentifier id = controlLoop.getKey().asIdentifier();
- if (controlLoopCounter.isFault(id)) {
- LOGGER.debug("report ControlLoop fault");
- return;
- }
-
- if (controlLoopCounter.getDuration(id) > controlLoopCounter.getMaxWaitMs()) {
- if (controlLoopCounter.count(id)) {
- phaseMap.put(id, startPhase);
- sendControlLoopMsg(controlLoop, startPhase);
- } else {
- LOGGER.debug("report ControlLoop fault");
- controlLoopCounter.setFault(id);
- }
- }
- }
-
- private void sendControlLoopMsg(ControlLoop controlLoop, int startPhase) {
- if (ControlLoopState.UNINITIALISED2PASSIVE.equals(controlLoop.getState())) {
- LOGGER.debug("retry message ControlLoopUpdate");
- controlLoopUpdatePublisher.send(controlLoop, startPhase);
- } else {
- LOGGER.debug("retry message ControlLoopStateChange");
- controlLoopStateChangePublisher.send(controlLoop, startPhase);
- }
- }
-}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java
deleted file mode 100644
index ba1cc0813..000000000
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.runtime.instantiation;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Optional;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
-import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider;
-import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler;
-import org.onap.policy.clamp.controlloop.runtime.util.CommonTestData;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-
-/**
- * Class to perform unit test of {@link ControlLoopInstantiationProvider}}.
- *
- */
-class ControlLoopInstantiationProviderTest {
- private static final String ID_NAME = "PMSH_Instance1";
- private static final String ID_VERSION = "1.2.3";
- private static final String CL_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/controlloops/ControlLoops.json";
- private static final String CL_INSTANTIATION_UPDATE_JSON =
- "src/test/resources/rest/controlloops/ControlLoopsUpdate.json";
- private static final String CL_INSTANTIATION_CHANGE_STATE_JSON =
- "src/test/resources/rest/controlloops/PassiveCommand.json";
- private static final String CL_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON =
- "src/test/resources/rest/controlloops/ControlLoopElementsNotFound.json";
- private static final String CL_INSTANTIATION_CONTROLLOOP_DEFINITION_NOT_FOUND_JSON =
- "src/test/resources/rest/controlloops/ControlLoopsNotFound.json";
- private static final String TOSCA_TEMPLATE_YAML =
- "src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml";
- private static final String CONTROL_LOOP_NOT_FOUND = "Control Loop not found";
- private static final String DELETE_BAD_REQUEST = "Control Loop State is still %s";
- private static final String ORDERED_STATE_INVALID = "ordered state invalid or not specified on command";
- private static final String CONTROLLOOP_ELEMENT_NAME_NOT_FOUND =
- "\"ControlLoops\" INVALID, item has status INVALID\n"
- + " \"entry org.onap.domain.pmsh.PMSHControlLoopDefinition\" INVALID, item has status INVALID\n"
- + " \"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not FOUND\n"
- + " \"entry org.onap.domain.pmsh.PMSHControlLoopDefinition\" INVALID, item has status INVALID\n"
- + " \"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not FOUND\n";
-
- private static final String CONTROLLOOP_DEFINITION_NOT_FOUND = "\"ControlLoops\" INVALID, item has status INVALID\n"
- + " \"entry org.onap.domain.PMSHControlLoopDefinition\" INVALID, item has status INVALID\n"
- + " item \"ControlLoop\" value \"org.onap.domain.PMSHControlLoopDefinition\" INVALID,"
- + " Commissioned control loop definition not FOUND\n"
- + " \"entry org.onap.domain.PMSHControlLoopDefinition\" INVALID, item has status INVALID\n"
- + " item \"ControlLoop\" value \"org.onap.domain.PMSHControlLoopDefinition\" INVALID,"
- + " Commissioned control loop definition not FOUND\n";
-
- private static ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
-
- @BeforeAll
- public static void setUpBeforeClass() throws Exception {
- serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_TEMPLATE_YAML);
- }
-
- @Test
- void testIntanceResponses() throws Exception {
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
- var commissioningProvider = mock(CommissioningProvider.class);
-
- when(commissioningProvider.getAllToscaServiceTemplate()).thenReturn(List.of(serviceTemplate));
- when(commissioningProvider.getToscaServiceTemplate(ID_NAME, ID_VERSION)).thenReturn(serviceTemplate);
-
- var instantiationProvider = new ControlLoopInstantiationProvider(clProvider, commissioningProvider,
- supervisionHandler, participantProvider);
- var instancePropertyList = instantiationProvider.createInstanceProperties(serviceTemplate);
- assertNull(instancePropertyList.getErrorDetails());
- var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
- assertEquals(id, instancePropertyList.getAffectedInstanceProperties().get(0));
-
- ControlLoops controlLoops =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Crud");
- var controlLoop = controlLoops.getControlLoopList().get(0);
- controlLoop.setName(ID_NAME);
- controlLoop.setVersion(ID_VERSION);
- when(clProvider.getControlLoops(ID_NAME, ID_VERSION)).thenReturn(List.of(controlLoop));
-
- var instanceOrderState = instantiationProvider.getInstantiationOrderState(ID_NAME, ID_VERSION);
- assertEquals(ControlLoopOrderedState.UNINITIALISED, instanceOrderState.getOrderedState());
- assertEquals(ID_NAME, instanceOrderState.getControlLoopIdentifierList().get(0).getName());
-
- when(clProvider.findControlLoop(ID_NAME, ID_VERSION)).thenReturn(Optional.of(controlLoop));
- when(clProvider.deleteControlLoop(ID_NAME, ID_VERSION)).thenReturn(controlLoop);
-
- var instanceResponse = instantiationProvider.deleteInstanceProperties(ID_NAME, ID_VERSION);
- assertEquals(ID_NAME, instanceResponse.getAffectedControlLoops().get(0).getName());
-
- }
-
- @Test
- void testInstantiationCrud() throws Exception {
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var participants = CommonTestData.createParticipants();
- when(participantProvider.getParticipants()).thenReturn(participants);
-
- var commissioningProvider = mock(CommissioningProvider.class);
- var toscaNodeTemplate1 = new ToscaNodeTemplate();
- toscaNodeTemplate1.setName("org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement");
- toscaNodeTemplate1.setVersion("1.2.3");
- when(commissioningProvider.getControlLoopDefinitions(anyString(), anyString()))
- .thenReturn(List.of(toscaNodeTemplate1));
-
- var toscaNodeTemplate2 = new ToscaNodeTemplate();
- toscaNodeTemplate2.setName("org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement");
- toscaNodeTemplate2.setVersion("1.2.3");
- var toscaNodeTemplate3 = new ToscaNodeTemplate();
- toscaNodeTemplate3.setName("org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement");
- toscaNodeTemplate3.setVersion("1.2.3");
- var toscaNodeTemplate4 = new ToscaNodeTemplate();
- toscaNodeTemplate4.setName("org.onap.domain.pmsh.PMSH_DCAEMicroservice");
- toscaNodeTemplate4.setVersion("1.2.3");
-
- when(commissioningProvider.getControlLoopElementDefinitions(toscaNodeTemplate1))
- .thenReturn(List.of(toscaNodeTemplate1, toscaNodeTemplate2, toscaNodeTemplate3, toscaNodeTemplate4));
-
- var supervisionHandler = mock(SupervisionHandler.class);
- var clProvider = mock(ControlLoopProvider.class);
- var instantiationProvider = new ControlLoopInstantiationProvider(clProvider, commissioningProvider,
- supervisionHandler, participantProvider);
- ControlLoops controlLoopsCreate =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Crud");
- InstantiationResponse instantiationResponse = instantiationProvider.createControlLoops(controlLoopsCreate);
- InstantiationUtils.assertInstantiationResponse(instantiationResponse, controlLoopsCreate);
-
- verify(clProvider).saveControlLoops(controlLoopsCreate.getControlLoopList());
-
- for (var controlLoop : controlLoopsCreate.getControlLoopList()) {
- when(clProvider.getControlLoops(controlLoop.getName(), controlLoop.getVersion()))
- .thenReturn(List.of(controlLoop));
-
- ControlLoops controlLoopsGet =
- instantiationProvider.getControlLoops(controlLoop.getName(), controlLoop.getVersion());
- assertThat(controlLoopsGet.getControlLoopList()).hasSize(1);
- assertThat(controlLoop).isEqualTo(controlLoopsGet.getControlLoopList().get(0));
- }
-
- ControlLoops controlLoopsUpdate =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_UPDATE_JSON, "Crud");
-
- instantiationResponse = instantiationProvider.updateControlLoops(controlLoopsUpdate);
- InstantiationUtils.assertInstantiationResponse(instantiationResponse, controlLoopsUpdate);
-
- verify(clProvider).saveControlLoops(controlLoopsUpdate.getControlLoopList());
-
- for (var controlLoop : controlLoopsUpdate.getControlLoopList()) {
- when(clProvider.findControlLoop(controlLoop.getKey().asIdentifier())).thenReturn(Optional.of(controlLoop));
- when(clProvider.findControlLoop(controlLoop.getName(), controlLoop.getVersion()))
- .thenReturn(Optional.of(controlLoop));
- when(clProvider.deleteControlLoop(controlLoop.getName(), controlLoop.getVersion())).thenReturn(controlLoop);
- }
-
- InstantiationCommand instantiationCommand =
- InstantiationUtils.getInstantiationCommandFromResource(CL_INSTANTIATION_CHANGE_STATE_JSON, "Crud");
- instantiationResponse = instantiationProvider.issueControlLoopCommand(instantiationCommand);
- InstantiationUtils.assertInstantiationResponse(instantiationResponse, instantiationCommand);
-
- verify(supervisionHandler).triggerControlLoopSupervision(instantiationCommand.getControlLoopIdentifierList());
-
- // in order to delete a controlLoop the state must be UNINITIALISED
- controlLoopsCreate.getControlLoopList().forEach(cl -> cl.setState(ControlLoopState.UNINITIALISED));
- instantiationProvider.updateControlLoops(controlLoopsCreate);
-
- for (ControlLoop controlLoop : controlLoopsCreate.getControlLoopList()) {
- instantiationProvider.deleteControlLoop(controlLoop.getName(), controlLoop.getVersion());
-
- verify(clProvider).deleteControlLoop(controlLoop.getName(), controlLoop.getVersion());
- }
- }
-
- @Test
- void testInstantiationDelete() throws Exception {
-
- ControlLoops controlLoops =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Delete");
-
- ControlLoop controlLoop0 = controlLoops.getControlLoopList().get(0);
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
- var commissioningProvider = mock(CommissioningProvider.class);
-
- var instantiationProvider = new ControlLoopInstantiationProvider(clProvider, commissioningProvider,
- supervisionHandler, participantProvider);
-
- assertThatThrownBy(
- () -> instantiationProvider.deleteControlLoop(controlLoop0.getName(), controlLoop0.getVersion()))
- .hasMessageMatching(CONTROL_LOOP_NOT_FOUND);
-
- for (ControlLoopState state : ControlLoopState.values()) {
- if (!ControlLoopState.UNINITIALISED.equals(state)) {
- assertThatDeleteThrownBy(controlLoops, state);
- }
- }
- controlLoop0.setState(ControlLoopState.UNINITIALISED);
-
- for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
- when(clProvider.findControlLoop(controlLoop.getName(), controlLoop.getVersion()))
- .thenReturn(Optional.of(controlLoop));
- when(clProvider.deleteControlLoop(controlLoop.getName(), controlLoop.getVersion())).thenReturn(controlLoop);
-
- instantiationProvider.deleteControlLoop(controlLoop.getName(), controlLoop.getVersion());
- }
- }
-
- private void assertThatDeleteThrownBy(ControlLoops controlLoops, ControlLoopState state) throws Exception {
- ControlLoop controlLoop = controlLoops.getControlLoopList().get(0);
- controlLoop.setState(state);
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
- var commissioningProvider = mock(CommissioningProvider.class);
-
- var instantiationProvider = new ControlLoopInstantiationProvider(clProvider, commissioningProvider,
- supervisionHandler, participantProvider);
-
- when(clProvider.findControlLoop(controlLoop.getName(), controlLoop.getVersion()))
- .thenReturn(Optional.of(controlLoop));
-
- assertThatThrownBy(
- () -> instantiationProvider.deleteControlLoop(controlLoop.getName(), controlLoop.getVersion()))
- .hasMessageMatching(String.format(DELETE_BAD_REQUEST, state));
- }
-
- @Test
- void testCreateControlLoops_NoDuplicates() throws Exception {
- var commissioningProvider = mock(CommissioningProvider.class);
-
- var toscaNodeTemplate1 = new ToscaNodeTemplate();
- toscaNodeTemplate1.setName("org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement");
- toscaNodeTemplate1.setVersion("1.2.3");
- when(commissioningProvider.getControlLoopDefinitions(anyString(), anyString()))
- .thenReturn(List.of(toscaNodeTemplate1));
-
- var toscaNodeTemplate2 = new ToscaNodeTemplate();
- toscaNodeTemplate2.setName("org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement");
- toscaNodeTemplate2.setVersion("1.2.3");
- var toscaNodeTemplate3 = new ToscaNodeTemplate();
- toscaNodeTemplate3.setName("org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement");
- toscaNodeTemplate3.setVersion("1.2.3");
- var toscaNodeTemplate4 = new ToscaNodeTemplate();
- toscaNodeTemplate4.setName("org.onap.domain.pmsh.PMSH_DCAEMicroservice");
- toscaNodeTemplate4.setVersion("1.2.3");
-
- when(commissioningProvider.getControlLoopElementDefinitions(toscaNodeTemplate1))
- .thenReturn(List.of(toscaNodeTemplate1, toscaNodeTemplate2, toscaNodeTemplate3, toscaNodeTemplate4));
-
- ControlLoops controlLoopsCreate =
- InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "NoDuplicates");
-
- var clProvider = mock(ControlLoopProvider.class);
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
-
- var instantiationProvider = new ControlLoopInstantiationProvider(clProvider, commissioningProvider,
- supervisionHandler, participantProvider);
-
- InstantiationResponse instantiationResponse = instantiationProvider.createControlLoops(controlLoopsCreate);
- InstantiationUtils.assertInstantiationResponse(instantiationResponse, controlLoopsCreate);
-
- when(clProvider.findControlLoop(controlLoopsCreate.getControlLoopList().get(0).getKey().asIdentifier()))
- .thenReturn(Optional.of(controlLoopsCreate.getControlLoopList().get(0)));
-
- assertThatThrownBy(() -> instantiationProvider.createControlLoops(controlLoopsCreate)).hasMessageMatching(
- controlLoopsCreate.getControlLoopList().get(0).getKey().asIdentifier() + " already defined");
- }
-
- @Test
- void testCreateControlLoops_CommissionedClElementNotFound() throws Exception {
- var toscaNodeTemplate1 = new ToscaNodeTemplate();
- toscaNodeTemplate1.setName("org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement");
- toscaNodeTemplate1.setVersion("1.2.3");
-
- var toscaNodeTemplate2 = new ToscaNodeTemplate();
- toscaNodeTemplate2.setName("org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement");
- toscaNodeTemplate2.setVersion("1.2.3");
- var toscaNodeTemplate3 = new ToscaNodeTemplate();
- toscaNodeTemplate3.setName("org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement");
- toscaNodeTemplate3.setVersion("1.2.3");
- var commissioningProvider = mock(CommissioningProvider.class);
- ControlLoops controlLoops = InstantiationUtils
- .getControlLoopsFromResource(CL_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON, "ClElementNotFound");
-
- when(commissioningProvider.getControlLoopDefinitions(
- controlLoops.getControlLoopList().get(0).getDefinition().getName(),
- controlLoops.getControlLoopList().get(0).getDefinition().getVersion()))
- .thenReturn(List.of(toscaNodeTemplate1));
-
- when(commissioningProvider.getControlLoopElementDefinitions(toscaNodeTemplate1))
- .thenReturn(List.of(toscaNodeTemplate1, toscaNodeTemplate2, toscaNodeTemplate3));
-
- var clProvider = mock(ControlLoopProvider.class);
- var participantProvider = mock(ParticipantProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
- var provider = new ControlLoopInstantiationProvider(clProvider, commissioningProvider, supervisionHandler,
- participantProvider);
-
- assertThatThrownBy(() -> provider.createControlLoops(controlLoops))
- .hasMessageMatching(CONTROLLOOP_ELEMENT_NAME_NOT_FOUND);
-
- assertThatThrownBy(() -> provider.updateControlLoops(controlLoops))
- .hasMessageMatching(CONTROLLOOP_ELEMENT_NAME_NOT_FOUND);
- }
-
- @Test
- void testCreateControlLoops_CommissionedClNotFound() throws Exception {
- ControlLoops controlLoops = InstantiationUtils
- .getControlLoopsFromResource(CL_INSTANTIATION_CONTROLLOOP_DEFINITION_NOT_FOUND_JSON, "ClNotFound");
-
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
- var commissioningProvider = mock(CommissioningProvider.class);
- var provider = new ControlLoopInstantiationProvider(clProvider, commissioningProvider, supervisionHandler,
- participantProvider);
-
- assertThatThrownBy(() -> provider.createControlLoops(controlLoops))
- .hasMessageMatching(CONTROLLOOP_DEFINITION_NOT_FOUND);
-
- assertThatThrownBy(() -> provider.updateControlLoops(controlLoops))
- .hasMessageMatching(CONTROLLOOP_DEFINITION_NOT_FOUND);
- }
-
- @Test
- void testIssueControlLoopCommand_OrderedStateInvalid() throws ControlLoopRuntimeException, IOException {
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
- var commissioningProvider = mock(CommissioningProvider.class);
- var instantiationProvider = new ControlLoopInstantiationProvider(clProvider, commissioningProvider,
- supervisionHandler, participantProvider);
- assertThatThrownBy(() -> instantiationProvider.issueControlLoopCommand(new InstantiationCommand()))
- .hasMessageMatching(ORDERED_STATE_INVALID);
- }
-}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java
deleted file mode 100644
index cbc4c7104..000000000
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.runtime.monitoring;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyMap;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.io.File;
-import java.time.Instant;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.UUID;
-import javax.ws.rs.core.Response;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ClElementStatisticsProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantStatisticsProvider;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-class TestMonitoringProvider {
-
- private static final String CL_PARTICIPANT_STATISTICS_JSON =
- "src/test/resources/rest/monitoring/TestParticipantStatistics.json";
- private static final String INVALID_PARTICIPANT_JSON_INPUT =
- "src/test/resources/rest/monitoring/TestParticipantStatistics_Invalid.json";
- private static final String CL_ELEMENT_STATISTICS_JSON =
- "src/test/resources/rest/monitoring/TestClElementStatistics.json";
- private static final String INVALID_CL_ELEMENT_JSON_INPUT =
- "src/test/resources/rest/monitoring/TestClElementStatistics_Invalid.json";
- private static final Coder CODER = new StandardCoder();
-
- private static final String STAT_LIST_IS_NULL = ".*StatisticsList is marked .*ull but is null";
- private static final String PARTICIPANT_STAT_LIST_IS_NULL =
- "participantStatisticsList is marked .*null but is null";
- private static final String NAME_IS_NULL = "name is marked .*null but is null";
- private static final String CL_LIST_IS_NULL = "clElementStatisticsList is marked .*null but is null";
- private static final String ID_VERSION1 = "1.001";
- private static final String ID_VERSION2 = "1.002";
- private static final String ID_NAME1 = "name1";
- private static final String ID_NAME2 = "name2";
- private static final String SORT_DESC = "DESC";
- private static final String ID_NAME3 = "testCLName";
- private static final String ID_INVALID_NAME = "invalidCLName";
- private static ParticipantStatisticsList inputParticipantStatistics;
- private static ParticipantStatisticsList invalidParticipantInput;
- private static ClElementStatisticsList inputClElementStatistics;
- private static ClElementStatisticsList invalidClElementInput;
-
- @BeforeAll
- public static void beforeSetupStatistics() throws CoderException {
- // Reading input json for statistics data
- inputParticipantStatistics =
- CODER.decode(new File(CL_PARTICIPANT_STATISTICS_JSON), ParticipantStatisticsList.class);
- invalidParticipantInput =
- CODER.decode(new File(INVALID_PARTICIPANT_JSON_INPUT), ParticipantStatisticsList.class);
- inputClElementStatistics = CODER.decode(new File(CL_ELEMENT_STATISTICS_JSON), ClElementStatisticsList.class);
- invalidClElementInput = CODER.decode(new File(INVALID_CL_ELEMENT_JSON_INPUT), ClElementStatisticsList.class);
- }
-
- @Test
- void testCreateParticipantStatistics() throws Exception {
- var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
- var clElementStatisticsProvider = mock(ClElementStatisticsProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
- MonitoringProvider provider =
- new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, clProvider);
-
- when(participantStatisticsProvider.createParticipantStatistics(any()))
- .thenReturn(inputParticipantStatistics.getStatisticsList());
-
- when(participantStatisticsProvider.createParticipantStatistics(eq(null)))
- .thenThrow(new PfModelRuntimeException(Response.Status.BAD_REQUEST, PARTICIPANT_STAT_LIST_IS_NULL));
-
- // Creating statistics data in db with null input
-
- assertThatThrownBy(() -> {
- provider.createParticipantStatistics(null);
- }).hasMessageMatching(STAT_LIST_IS_NULL);
-
- assertThatThrownBy(() -> {
- provider.createParticipantStatistics(invalidParticipantInput.getStatisticsList());
- }).hasMessageMatching(PARTICIPANT_STAT_LIST_IS_NULL);
-
- // Creating statistics data from input json
- ParticipantStatisticsList createResponse =
- provider.createParticipantStatistics(inputParticipantStatistics.getStatisticsList());
-
- assertThat(createResponse.getStatisticsList()).hasSize(3);
- assertEquals(createResponse.getStatisticsList().toString().replaceAll("\\s+", ""),
- inputParticipantStatistics.getStatisticsList().toString().replaceAll("\\s+", ""));
- }
-
- @Test
- void testGetParticipantStatistics() throws Exception {
- var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
- when(participantStatisticsProvider.getFilteredParticipantStatistics(eq(ID_NAME1), any(), any(), any(), eq(null),
- eq(SORT_DESC), eq(0))).thenReturn(List.of(inputParticipantStatistics.getStatisticsList().get(0)));
-
- when(participantStatisticsProvider.getFilteredParticipantStatistics(eq(ID_NAME1), any(),
- eq(Instant.parse("2021-01-11T12:00:00.000Z")), eq(Instant.parse("2021-01-11T16:00:00.000Z")), eq(null),
- eq(SORT_DESC), eq(0))).thenReturn(List.of());
-
- when(participantStatisticsProvider.getFilteredParticipantStatistics(eq(ID_NAME2), any(), any(), any(), eq(null),
- eq(SORT_DESC), eq(1))).thenReturn(List.of(inputParticipantStatistics.getStatisticsList().get(2)));
-
- var clProvider = mock(ControlLoopProvider.class);
- var clElementStatisticsProvider = mock(ClElementStatisticsProvider.class);
- MonitoringProvider provider =
- new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, clProvider);
- provider.createParticipantStatistics(inputParticipantStatistics.getStatisticsList());
-
- assertThatThrownBy(() -> {
- provider.fetchFilteredParticipantStatistics(null, null, 0, null, null);
- }).hasMessageMatching(NAME_IS_NULL);
-
- // Fetch specific statistics record with name, version and record count
- ParticipantStatisticsList getResponse =
- provider.fetchFilteredParticipantStatistics(ID_NAME2, ID_VERSION1, 1, null, null);
- assertThat(getResponse.getStatisticsList()).hasSize(1);
- assertEquals(getResponse.getStatisticsList().get(0).toString().replaceAll("\\s+", ""),
- inputParticipantStatistics.getStatisticsList().get(2).toString().replaceAll("\\s+", ""));
-
- // Fetch statistics using timestamp
- getResponse = provider.fetchFilteredParticipantStatistics(ID_NAME1, ID_VERSION1, 0, null,
- Instant.parse("2021-01-10T15:00:00.000Z"));
- assertThat(getResponse.getStatisticsList()).hasSize(1);
-
- getResponse = provider.fetchFilteredParticipantStatistics(ID_NAME1, ID_VERSION1, 0,
- Instant.parse("2021-01-11T12:00:00.000Z"), Instant.parse("2021-01-11T16:00:00.000Z"));
-
- assertThat(getResponse.getStatisticsList()).isEmpty();
- }
-
- @Test
- void testCreateClElementStatistics() throws Exception {
- var clElementStatisticsProvider = mock(ClElementStatisticsProvider.class);
- when(clElementStatisticsProvider.createClElementStatistics(any()))
- .thenReturn(inputClElementStatistics.getClElementStatistics());
-
- when(clElementStatisticsProvider.createClElementStatistics(eq(null)))
- .thenThrow(new PfModelRuntimeException(Response.Status.BAD_REQUEST, CL_LIST_IS_NULL));
-
- var clProvider = mock(ControlLoopProvider.class);
-
- var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
- MonitoringProvider provider =
- new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, clProvider);
- // Creating statistics data in db with null input
- assertThatThrownBy(() -> {
- provider.createClElementStatistics(null);
- }).hasMessageMatching(STAT_LIST_IS_NULL);
-
- assertThatThrownBy(() -> {
- provider.createClElementStatistics(invalidClElementInput.getClElementStatistics());
- }).hasMessageMatching(CL_LIST_IS_NULL);
-
- // Creating clElement statistics data from input json
- ClElementStatisticsList createResponse =
- provider.createClElementStatistics(inputClElementStatistics.getClElementStatistics());
-
- assertThat(createResponse.getClElementStatistics()).hasSize(4);
- assertEquals(createResponse.getClElementStatistics().toString().replaceAll("\\s+", ""),
- inputClElementStatistics.getClElementStatistics().toString().replaceAll("\\s+", ""));
- }
-
- @Test
- void testGetClElementStatistics() throws Exception {
- var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
- var clElementStatisticsProvider = mock(ClElementStatisticsProvider.class);
- var clProvider = mock(ControlLoopProvider.class);
-
- when(clElementStatisticsProvider.getFilteredClElementStatistics(eq(ID_NAME1), any(), any(), any(), anyMap(),
- eq(SORT_DESC), eq(0)))
- .thenReturn(List.of(inputClElementStatistics.getClElementStatistics().get(0),
- inputClElementStatistics.getClElementStatistics().get(1)));
-
- when(clElementStatisticsProvider.getFilteredClElementStatistics(eq(ID_NAME1), any(), any(), any(), anyMap(),
- eq(SORT_DESC), eq(0)))
- .thenReturn(List.of(inputClElementStatistics.getClElementStatistics().get(0),
- inputClElementStatistics.getClElementStatistics().get(1)));
-
- MonitoringProvider provider =
- new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, clProvider);
- assertThatThrownBy(() -> {
- provider.fetchFilteredClElementStatistics(null, null, null, null, null, 0);
- }).hasMessageMatching(NAME_IS_NULL);
-
- provider.createClElementStatistics(inputClElementStatistics.getClElementStatistics());
-
- ClElementStatisticsList getResponse =
- provider.fetchFilteredClElementStatistics(ID_NAME1, null, null, null, null, 0);
-
- assertThat(getResponse.getClElementStatistics()).hasSize(2);
- assertEquals(getResponse.getClElementStatistics().get(0).toString().replaceAll("\\s+", ""),
- inputClElementStatistics.getClElementStatistics().get(0).toString().replaceAll("\\s+", ""));
-
- // Fetch specific statistics record with name, id and record count
- getResponse = provider.fetchFilteredClElementStatistics(ID_NAME1, ID_VERSION1,
- "709c62b3-8918-41b9-a747-d21eb79c6c20", null, null, 0);
- assertThat(getResponse.getClElementStatistics()).hasSize(2);
-
- // Fetch statistics using timestamp
- getResponse = provider.fetchFilteredClElementStatistics(ID_NAME1, ID_VERSION1, null,
- Instant.parse("2021-01-10T13:45:00.000Z"), null, 0);
- assertThat(getResponse.getClElementStatistics()).hasSize(2);
- }
-
- @Test
- void testGetParticipantStatsPerCL() throws Exception {
- var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
- var clElementStatisticsProvider = mock(ClElementStatisticsProvider.class);
- var mockClProvider = Mockito.mock(ControlLoopProvider.class);
- var provider =
- new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, mockClProvider);
-
- provider.createParticipantStatistics(inputParticipantStatistics.getStatisticsList());
-
- var controlLoop = new ControlLoop();
- var element = new ControlLoopElement();
- element.setParticipantId(new ToscaConceptIdentifier(ID_NAME1, ID_VERSION1));
- controlLoop.setElements(Map.of(UUID.randomUUID(), element));
- when(mockClProvider.findControlLoop(new ToscaConceptIdentifier(ID_NAME2, ID_VERSION1)))
- .thenReturn(Optional.of(controlLoop));
-
- when(participantStatisticsProvider.getFilteredParticipantStatistics(eq(ID_NAME1), eq(ID_VERSION1), any(), any(),
- eq(null), eq(SORT_DESC), eq(0)))
- .thenReturn(List.of(inputParticipantStatistics.getStatisticsList().get(0),
- inputParticipantStatistics.getStatisticsList().get(1)));
-
- ParticipantStatisticsList getResponse = provider.fetchParticipantStatsPerControlLoop(ID_NAME2, ID_VERSION1);
- assertThat(getResponse.getStatisticsList()).hasSize(2);
- assertEquals(getResponse.getStatisticsList().get(0).toString().replaceAll("\\s+", ""),
- inputParticipantStatistics.getStatisticsList().get(0).toString().replaceAll("\\s+", ""));
- assertThat(provider.fetchParticipantStatsPerControlLoop(ID_INVALID_NAME, ID_VERSION2).getStatisticsList())
- .isEmpty();
- }
-
- @Test
- void testClElementStatsPerCL() throws Exception {
- // Setup a dummy Control loop data
- var mockClElement = new ControlLoopElement();
- mockClElement.setId(inputClElementStatistics.getClElementStatistics().get(0).getId());
- mockClElement.setParticipantId(new ToscaConceptIdentifier(
- inputClElementStatistics.getClElementStatistics().get(0).getParticipantId().getName(),
- inputClElementStatistics.getClElementStatistics().get(0).getParticipantId().getVersion()));
- var mockCL = new ControlLoop();
- mockCL.setElements(new LinkedHashMap<>());
- mockCL.getElements().put(mockClElement.getId(), mockClElement);
-
- var participantStatisticsProvider = mock(ParticipantStatisticsProvider.class);
- var clElementStatisticsProvider = mock(ClElementStatisticsProvider.class);
- var mockClProvider = Mockito.mock(ControlLoopProvider.class);
- var monitoringProvider =
- new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, mockClProvider);
-
- // Mock controlloop data to be returned for the given CL Id
- when(mockClProvider.findControlLoop(new ToscaConceptIdentifier(ID_NAME3, ID_VERSION1)))
- .thenReturn(Optional.of(mockCL));
-
- when(clElementStatisticsProvider.getFilteredClElementStatistics(eq(ID_NAME1), eq(ID_VERSION1), any(), any(),
- anyMap(), eq(SORT_DESC), eq(0)))
- .thenReturn(List.of(inputClElementStatistics.getClElementStatistics().get(0),
- inputClElementStatistics.getClElementStatistics().get(1)));
-
- monitoringProvider.createClElementStatistics(inputClElementStatistics.getClElementStatistics());
-
- ClElementStatisticsList getResponse =
- monitoringProvider.fetchClElementStatsPerControlLoop(ID_NAME3, ID_VERSION1);
-
- assertThat(getResponse.getClElementStatistics()).hasSize(2);
- assertEquals(getResponse.getClElementStatistics().get(1).toString().replaceAll("\\s+", ""),
- inputClElementStatistics.getClElementStatistics().get(1).toString().replaceAll("\\s+", ""));
-
- assertThat(monitoringProvider.fetchClElementStatsPerControlLoop(ID_INVALID_NAME, ID_VERSION2)
- .getClElementStatistics()).isEmpty();
-
- Map<String, ToscaConceptIdentifier> clElementIds =
- monitoringProvider.getAllClElementsIdPerControlLoop(ID_NAME3, ID_VERSION1);
- assertThat(clElementIds)
- .containsKey(inputClElementStatistics.getClElementStatistics().get(0).getId().toString());
- }
-}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java
deleted file mode 100644
index 21a826743..000000000
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.runtime.supervision;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyList;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.runtime.instantiation.InstantiationUtils;
-import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringProvider;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopStateChangePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopUpdatePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantDeregisterAckPublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantRegisterAckPublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-class SupervisionHandlerTest {
- private static final String TOSCA_TEMPLATE_YAML =
- "src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml";
- private static final String CL_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/controlloops/ControlLoops.json";
- private static final ToscaConceptIdentifier identifier = new ToscaConceptIdentifier("PMSHInstance0Crud", "1.0.1");
- private static final ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("ParticipantId", "1.0.0");
- private static final ToscaConceptIdentifier participantType =
- new ToscaConceptIdentifier("ParticipantType", "1.0.0");
-
- @Test
- void testTriggerControlLoopSupervisionEmpty() throws ControlLoopException, PfModelException, CoderException {
- var handler = createSupervisionHandler(mock(ControlLoopProvider.class), mock(ParticipantProvider.class),
- mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
- mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
-
- assertThatThrownBy(() -> handler.triggerControlLoopSupervision(List.of()))
- .hasMessageMatching("The list of control loops for supervision is empty");
- }
-
- @Test
- void testTriggerControlLoopSupervision() throws ControlLoopException, PfModelException, CoderException {
- var controlLoopProvider = mock(ControlLoopProvider.class);
- var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class);
- var handler = createSupervisionHandler(controlLoopProvider, mock(ParticipantProvider.class),
- mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
- mock(ParticipantDeregisterAckPublisher.class), controlLoopUpdatePublisher,
- mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
-
- handler.triggerControlLoopSupervision(List.of(identifier));
-
- verify(controlLoopUpdatePublisher).send(any(ControlLoop.class));
- verify(controlLoopProvider).saveControlLoop(any(ControlLoop.class));
- }
-
- @Test
- void testTriggerControlLoopUninitialised() throws ControlLoopException, PfModelException, CoderException {
- var controlLoopProvider = mock(ControlLoopProvider.class);
- var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class);
- var handler = createSupervisionHandler(controlLoopProvider, mock(ParticipantProvider.class),
- mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
- mock(ParticipantDeregisterAckPublisher.class), controlLoopUpdatePublisher,
- mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.UNINITIALISED);
-
- assertThatThrownBy(() -> handler.triggerControlLoopSupervision(List.of(identifier)))
- .hasMessageMatching("Control loop is already in state UNINITIALISED");
- }
-
- @Test
- void testTriggerControlLoopRunning() throws ControlLoopException, PfModelException, CoderException {
- var controlLoopProvider = mock(ControlLoopProvider.class);
- var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class);
- var handler = createSupervisionHandler(controlLoopProvider, mock(ParticipantProvider.class),
- mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
- mock(ParticipantDeregisterAckPublisher.class), controlLoopUpdatePublisher,
- mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.RUNNING);
-
- assertThatThrownBy(() -> handler.triggerControlLoopSupervision(List.of(identifier)))
- .hasMessageMatching("Control loop can't transition from state UNINITIALISED to state RUNNING");
- }
-
- @Test
- void testHandleControlLoopStateChangeAckMessage() throws PfModelException, CoderException {
- var controlLoopProvider = mock(ControlLoopProvider.class);
- var handler = createSupervisionHandler(controlLoopProvider, mock(ParticipantProvider.class),
- mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
- mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
- var controlLoopAckMessage = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
- controlLoopAckMessage.setControlLoopResultMap(Map.of());
- controlLoopAckMessage.setControlLoopId(identifier);
-
- handler.handleControlLoopStateChangeAckMessage(controlLoopAckMessage);
-
- verify(controlLoopProvider).saveControlLoop(any(ControlLoop.class));
- }
-
- @Test
- void testHandleControlLoopUpdateAckMessage() throws PfModelException, CoderException {
- var controlLoopAckMessage = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_UPDATE_ACK);
- controlLoopAckMessage.setParticipantId(participantId);
- controlLoopAckMessage.setParticipantType(participantType);
- controlLoopAckMessage.setControlLoopResultMap(Map.of());
- controlLoopAckMessage.setControlLoopId(identifier);
- var controlLoopProvider = mock(ControlLoopProvider.class);
- var handler = createSupervisionHandler(controlLoopProvider, mock(ParticipantProvider.class),
- mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
- mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
-
- handler.handleControlLoopUpdateAckMessage(controlLoopAckMessage);
-
- verify(controlLoopProvider).saveControlLoop(any(ControlLoop.class));
- }
-
- @Test
- void testHandleParticipantDeregister() throws PfModelException, CoderException {
- var participant = new Participant();
- participant.setName(participantId.getName());
- participant.setVersion(participantId.getVersion());
- participant.setParticipantType(participantType);
-
- var participantProvider = mock(ParticipantProvider.class);
- when(participantProvider.findParticipant(participantId.getName(), participantId.getVersion()))
- .thenReturn(Optional.of(participant));
-
- var participantDeregisterMessage = new ParticipantDeregister();
- participantDeregisterMessage.setMessageId(UUID.randomUUID());
- participantDeregisterMessage.setParticipantId(participantId);
- participantDeregisterMessage.setParticipantType(participantType);
- var participantDeregisterAckPublisher = mock(ParticipantDeregisterAckPublisher.class);
- var handler = createSupervisionHandler(mock(ControlLoopProvider.class), participantProvider,
- mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
- participantDeregisterAckPublisher, mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
-
- handler.handleParticipantMessage(participantDeregisterMessage);
-
- verify(participantProvider).saveParticipant(any());
- verify(participantDeregisterAckPublisher).send(participantDeregisterMessage.getMessageId());
- }
-
- @Test
- void testHandleParticipantRegister() throws PfModelException, CoderException {
- var participant = new Participant();
- participant.setName(participantId.getName());
- participant.setVersion(participantId.getVersion());
- participant.setParticipantType(participantType);
-
- var participantRegisterMessage = new ParticipantRegister();
- participantRegisterMessage.setMessageId(UUID.randomUUID());
- participantRegisterMessage.setParticipantId(participantId);
- participantRegisterMessage.setParticipantType(participantType);
- var participantProvider = mock(ParticipantProvider.class);
- var participantRegisterAckPublisher = mock(ParticipantRegisterAckPublisher.class);
- var handler = createSupervisionHandler(mock(ControlLoopProvider.class), participantProvider,
- mock(MonitoringProvider.class), participantRegisterAckPublisher,
- mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
-
- handler.handleParticipantMessage(participantRegisterMessage);
-
- verify(participantProvider).saveParticipant(any());
- verify(participantRegisterAckPublisher).send(participantRegisterMessage.getMessageId(), participantId,
- participantType);
- }
-
- @Test
- void testParticipantUpdateAck() throws PfModelException, CoderException {
- var participant = new Participant();
- participant.setName(participantId.getName());
- participant.setVersion(participantId.getVersion());
- participant.setParticipantType(participantType);
-
- var participantProvider = mock(ParticipantProvider.class);
- when(participantProvider.findParticipant(participantId.getName(), participantId.getVersion()))
- .thenReturn(Optional.of(participant));
-
- var participantUpdateAckMessage = new ParticipantUpdateAck();
- participantUpdateAckMessage.setParticipantId(participantId);
- participantUpdateAckMessage.setParticipantType(participantType);
- participantUpdateAckMessage.setState(ParticipantState.PASSIVE);
- var handler = createSupervisionHandler(mock(ControlLoopProvider.class), participantProvider,
- mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
- mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
-
- handler.handleParticipantMessage(participantUpdateAckMessage);
-
- verify(participantProvider).saveParticipant(any());
- }
-
- @Test
- void testHandleParticipantStatus() throws PfModelException, CoderException {
- var participantStatusMessage = new ParticipantStatus();
- participantStatusMessage.setParticipantId(participantId);
- participantStatusMessage.setParticipantType(participantType);
- participantStatusMessage.setState(ParticipantState.PASSIVE);
- participantStatusMessage.setHealthStatus(ParticipantHealthStatus.HEALTHY);
- participantStatusMessage.setParticipantStatistics(new ParticipantStatistics());
-
- var participantProvider = mock(ParticipantProvider.class);
- var monitoringProvider = mock(MonitoringProvider.class);
- var handler = createSupervisionHandler(mock(ControlLoopProvider.class), participantProvider, monitoringProvider,
- mock(ParticipantRegisterAckPublisher.class), mock(ParticipantDeregisterAckPublisher.class),
- mock(ControlLoopUpdatePublisher.class), mock(ParticipantUpdatePublisher.class),
- ControlLoopOrderedState.PASSIVE);
- handler.handleParticipantMessage(participantStatusMessage);
-
- verify(participantProvider).saveParticipant(any());
- verify(monitoringProvider).createParticipantStatistics(anyList());
- }
-
- @Test
- void testHandleSendCommissionMessage() throws PfModelException, CoderException {
- var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
- var handler = createSupervisionHandler(mock(ControlLoopProvider.class), mock(ParticipantProvider.class),
- mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
- mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- participantUpdatePublisher, ControlLoopOrderedState.PASSIVE);
- handler.handleSendCommissionMessage(participantId.getName(), participantId.getVersion());
-
- verify(participantUpdatePublisher).sendComissioningBroadcast(participantId.getName(),
- participantId.getVersion());
- }
-
- @Test
- void testHandleSendDeCommissionMessage() throws PfModelException, CoderException {
- var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
- var handler = createSupervisionHandler(mock(ControlLoopProvider.class), mock(ParticipantProvider.class),
- mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
- mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- participantUpdatePublisher, ControlLoopOrderedState.PASSIVE);
- handler.handleSendDeCommissionMessage();
-
- verify(participantUpdatePublisher).sendDecomisioning();
- }
-
- private SupervisionHandler createSupervisionHandler(ControlLoopProvider controlLoopProvider,
- ParticipantProvider participantProvider, MonitoringProvider monitoringProvider,
- ParticipantRegisterAckPublisher participantRegisterAckPublisher,
- ParticipantDeregisterAckPublisher participantDeregisterAckPublisher,
- ControlLoopUpdatePublisher controlLoopUpdatePublisher,
- ParticipantUpdatePublisher participantUpdatePublisher,
- ControlLoopOrderedState orderedState) throws PfModelException, CoderException {
- var controlLoopsCreate = InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Crud");
-
- var controlLoop = controlLoopsCreate.getControlLoopList().get(0);
- controlLoop.setOrderedState(orderedState);
-
- when(controlLoopProvider.findControlLoop(identifier)).thenReturn(Optional.of(controlLoop));
- when(controlLoopProvider.getControlLoop(identifier)).thenReturn(controlLoop);
-
- var serviceTemplateProvider = Mockito.mock(ServiceTemplateProvider.class);
- when(serviceTemplateProvider.getServiceTemplateList(any(), any()))
- .thenReturn(List.of(InstantiationUtils.getToscaServiceTemplate(TOSCA_TEMPLATE_YAML)));
-
- var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class);
-
- return new SupervisionHandler(controlLoopProvider, participantProvider, monitoringProvider,
- serviceTemplateProvider, controlLoopUpdatePublisher, controlLoopStateChangePublisher,
- participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher);
-
- }
-}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java
deleted file mode 100644
index b7a3fe005..000000000
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.runtime.supervision;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.List;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ServiceTemplateProvider;
-import org.onap.policy.clamp.controlloop.runtime.instantiation.InstantiationUtils;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopStateChangePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopUpdatePublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantStatusReqPublisher;
-import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher;
-import org.onap.policy.clamp.controlloop.runtime.util.CommonTestData;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-
-class SupervisionScannerTest {
-
- private static final String TOSCA_SERVICE_TEMPLATE_YAML =
- "src/test/resources/rest/servicetemplates/tosca-for-smoke-testing.yaml";
- private static final String CONTROLLOOP_JSON = "src/test/resources/rest/controlloops/ControlLoopsSmoke.json";
-
- private static ServiceTemplateProvider serviceTemplateProvider = mock(ServiceTemplateProvider.class);
-
- @BeforeAll
- public static void setUpBeforeAll() throws Exception {
- ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
- when(serviceTemplateProvider.getAllServiceTemplates()).thenReturn(List.of(serviceTemplate));
- }
-
- @Test
- void testScannerOrderedStateEqualsToState() throws PfModelException, CoderException {
- var controlLoopProvider = mock(ControlLoopProvider.class);
- var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class);
- var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class);
- var participantProvider = mock(ParticipantProvider.class);
- var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class);
- var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
- var clRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
-
- var controlLoops =
- InstantiationUtils.getControlLoopsFromResource(CONTROLLOOP_JSON, "Crud").getControlLoopList();
- when(controlLoopProvider.getControlLoops()).thenReturn(controlLoops);
-
- var supervisionScanner = new SupervisionScanner(controlLoopProvider, serviceTemplateProvider,
- controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider,
- participantStatusReqPublisher, participantUpdatePublisher, clRuntimeParameterGroup);
- supervisionScanner.run(false);
-
- verify(controlLoopProvider, times(0)).saveControlLoop(any(ControlLoop.class));
- }
-
- @Test
- void testScannerOrderedStateDifferentToState() throws PfModelException, CoderException {
- var controlLoops =
- InstantiationUtils.getControlLoopsFromResource(CONTROLLOOP_JSON, "Crud").getControlLoopList();
- controlLoops.get(0).setState(ControlLoopState.UNINITIALISED2PASSIVE);
- controlLoops.get(0).setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- var controlLoopProvider = mock(ControlLoopProvider.class);
- when(controlLoopProvider.getControlLoops()).thenReturn(controlLoops);
-
- var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class);
- var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class);
- var participantProvider = mock(ParticipantProvider.class);
- var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class);
- var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
- var clRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
-
- var supervisionScanner = new SupervisionScanner(controlLoopProvider, serviceTemplateProvider,
- controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider,
- participantStatusReqPublisher, participantUpdatePublisher, clRuntimeParameterGroup);
- supervisionScanner.run(false);
-
- verify(controlLoopProvider, times(1)).saveControlLoop(any(ControlLoop.class));
- }
-
- @Test
- void testScanner() throws PfModelException {
- var controlLoopProvider = mock(ControlLoopProvider.class);
- var controlLoop = new ControlLoop();
- when(controlLoopProvider.getControlLoops()).thenReturn(List.of(controlLoop));
-
- var participantProvider = mock(ParticipantProvider.class);
- var participant = new Participant();
- participant.setName("Participant0");
- participant.setVersion("1.0.0");
- when(participantProvider.getParticipants(null, null)).thenReturn(List.of(participant));
-
- var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class);
- var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class);
- var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class);
- var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
- var clRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
-
- var supervisionScanner = new SupervisionScanner(controlLoopProvider, serviceTemplateProvider,
- controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider,
- participantStatusReqPublisher, participantUpdatePublisher, clRuntimeParameterGroup);
-
- supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier());
- supervisionScanner.run(true);
- verify(controlLoopProvider, times(0)).saveControlLoop(any(ControlLoop.class));
- verify(participantStatusReqPublisher, times(0)).send(any(ToscaConceptIdentifier.class));
- }
-
- @Test
- void testSendControlLoopMsgUpdate() throws PfModelException, CoderException {
- var controlLoops =
- InstantiationUtils.getControlLoopsFromResource(CONTROLLOOP_JSON, "Crud").getControlLoopList();
- controlLoops.get(0).setState(ControlLoopState.UNINITIALISED2PASSIVE);
- controlLoops.get(0).setOrderedState(ControlLoopOrderedState.PASSIVE);
- for (var element : controlLoops.get(0).getElements().values()) {
- if ("org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement"
- .equals(element.getDefinition().getName())) {
- element.setOrderedState(ControlLoopOrderedState.PASSIVE);
- element.setState(ControlLoopState.UNINITIALISED);
- } else {
- element.setOrderedState(ControlLoopOrderedState.PASSIVE);
- element.setState(ControlLoopState.PASSIVE);
- }
- }
-
- var controlLoopProvider = mock(ControlLoopProvider.class);
- when(controlLoopProvider.getControlLoops()).thenReturn(controlLoops);
-
- var participantProvider = mock(ParticipantProvider.class);
- var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class);
- var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class);
- var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class);
- var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
- var clRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
-
- var supervisionScanner = new SupervisionScanner(controlLoopProvider, serviceTemplateProvider,
- controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider,
- participantStatusReqPublisher, participantUpdatePublisher, clRuntimeParameterGroup);
-
- supervisionScanner.run(false);
-
- verify(controlLoopUpdatePublisher).send(any(ControlLoop.class), anyInt());
- }
-
- @Test
- void testScanParticipant() throws PfModelException {
- var controlLoopProvider = mock(ControlLoopProvider.class);
- var controlLoop = new ControlLoop();
- when(controlLoopProvider.getControlLoops()).thenReturn(List.of(controlLoop));
-
- var clRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanParticipant");
- clRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().setMaxWaitMs(-1);
- clRuntimeParameterGroup.getParticipantParameters().setMaxStatusWaitMs(-1);
-
- var participant = new Participant();
- participant.setName("Participant0");
- participant.setVersion("1.0.0");
- participant.setHealthStatus(ParticipantHealthStatus.HEALTHY);
- participant.setParticipantState(ParticipantState.ACTIVE);
- participant.setDefinition(new ToscaConceptIdentifier("unknown", "0.0.0"));
- participant.setParticipantType(new ToscaConceptIdentifier("ParticipantType1", "1.0.0"));
- var participantProvider = mock(ParticipantProvider.class);
- when(participantProvider.getParticipants()).thenReturn(List.of(participant));
-
- var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class);
- var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class);
- var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class);
- var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
-
- var supervisionScanner = new SupervisionScanner(controlLoopProvider, serviceTemplateProvider,
- controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider,
- participantStatusReqPublisher, participantUpdatePublisher, clRuntimeParameterGroup);
-
- supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier());
- supervisionScanner.run(true);
- verify(participantStatusReqPublisher).send(any(ToscaConceptIdentifier.class));
- verify(participantProvider).saveParticipant(any());
-
- supervisionScanner.run(true);
- verify(participantProvider, times(2)).saveParticipant(any());
- }
-}
diff --git a/runtime-controlloop/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml b/runtime-controlloop/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml
deleted file mode 100644
index 9acff1356..000000000
--- a/runtime-controlloop/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml
+++ /dev/null
@@ -1,232 +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
- 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
- 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.PolicyControlLoopParticipant:
- 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.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
- participantType:
- 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
- participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
- version: 2.2.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
- participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
- 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
- participantType:
- 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
- org.onap.domain.pmsh.PMSD_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
- participantType:
- name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
- version: 2.3.4
- dcae_blueprint_id:
- name: org.onap.dcae.blueprints.PMSDBlueprint
- version: 1.0.0
- org.onap.domain.pmsh.PMSD_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
- participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
- version: 2.2.1
- policy_type_id:
- name: onap.policies.monitoring.pm-subscription-handler
- version: 1.0.0
- org.onap.domain.pmsh.PMSD_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
- participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
- version: 2.2.1
- policy_type_id:
- name: onap.policies.operational.pm-subscription-handler
- version: 1.0.0
- org.onap.domain.pmsh.PMSD_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
- participantType:
- name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
- version: 3.2.1
- cds_blueprint_id:
- name: org.onap.ccsdk.cds.PMSDCdsBlueprint
- version: 1.0.0
- org.onap.domain.pmsh.PMSDControlLoopDefinition:
- 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.PMSD_DCAEMicroservice
- version: 1.2.3
- - name: org.onap.domain.pmsh.PMSD_MonitoringPolicyControlLoopElement
- version: 1.2.3
- - name: org.onap.domain.pmsh.PMSD_OperationalPolicyControlLoopElement
- version: 1.2.3
- - name: org.onap.domain.pmsh.PMSD_CDS_ControlLoopElement
- version: 1.2.3
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/config/AafConfiguration.java b/runtime/src/main/java/org/onap/policy/clamp/clds/config/AafConfiguration.java
index e8502b72a..bdefdfe6d 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/config/AafConfiguration.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/config/AafConfiguration.java
@@ -61,7 +61,7 @@ public class AafConfiguration {
registration.addUrlPatterns("/restservices/clds/v2/policyToscaModels/*");
registration.addUrlPatterns("/restservices/clds/v2/policies/*");
registration.addUrlPatterns("/restservices/clds/v2/loop/*");
- registration.addUrlPatterns("/restservices/clds/v2/toscaControlLoop/*");
+ registration.addUrlPatterns("/restservices/clds/v2/acm/*");
registration.setName("cadiFilter");
registration.setOrder(0);
return registration;
diff --git a/runtime/src/main/resources/application-noaaf.properties b/runtime/src/main/resources/application-noaaf.properties
index 9f13a314c..22f9774e1 100644
--- a/runtime/src/main/resources/application-noaaf.properties
+++ b/runtime/src/main/resources/application-noaaf.properties
@@ -193,6 +193,6 @@ clamp.config.cds.userName=ccsdkapps
clamp.config.cds.password=ccsdkapps
# Configuration settings for ControlLoop Runtime Rest API
-clamp.config.controlloop.runtime.url=http://localhost:6969
-clamp.config.controlloop.runtime.userName=runtimeUser
-clamp.config.controlloop.runtime.password=zb!XztG34
+clamp.config.acm.runtime.url=http://localhost:6969
+clamp.config.acm.runtime.userName=runtimeUser
+clamp.config.acm.runtime.password=zb!XztG34
diff --git a/runtime/src/main/resources/application.properties b/runtime/src/main/resources/application.properties
index 21b37c69f..054b88972 100644
--- a/runtime/src/main/resources/application.properties
+++ b/runtime/src/main/resources/application.properties
@@ -203,6 +203,6 @@ clamp.config.cds.userName=ccsdkapps
clamp.config.cds.password=ccsdkapps
# Configuration settings for ControlLoop Runtime Rest API
-clamp.config.controlloop.runtime.url=http://localhost:6969
-clamp.config.controlloop.runtime.userName=runtimeUser
-clamp.config.controlloop.runtime.password=zb!XztG34
+clamp.config.acm.runtime.url=http://localhost:6969
+clamp.config.acm.runtime.userName=runtimeUser
+clamp.config.acm.runtime.password=zb!XztG34
diff --git a/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index 8c9824ef7..8ad20a844 100644
--- a/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -1476,7 +1476,7 @@
</route>
</post>
- <get uri="/v2/toscaControlLoop/getToscaTemplate" outType="java.lang.String" bindingMode="off"
+ <get uri="/v2/acm/getToscaTemplate" outType="java.lang.String" bindingMode="off"
produces="application/json">
<route>
<removeHeaders pattern="*"
@@ -1515,7 +1515,7 @@
</route>
</get>
- <post uri="/v2/toscaControlLoop/commissionToscaTemplate"
+ <post uri="/v2/acm/commissionToscaTemplate"
type="java.lang.String"
consumes="plain/text"
outType="java.lang.String"
@@ -1558,7 +1558,7 @@
</route>
</post>
- <delete uri="/v2/toscaControlLoop/decommissionToscaTemplate"
+ <delete uri="/v2/acm/decommissionToscaTemplate"
type="java.lang.String"
consumes="plain/text"
outType="java.lang.String"
@@ -1602,7 +1602,7 @@
</route>
</delete>
- <delete uri="/v2/toscaControlLoop/deleteToscaInstantiation"
+ <delete uri="/v2/acm/deleteToscaInstantiation"
type="java.lang.String"
consumes="plain/text"
outType="java.lang.String"
@@ -1646,7 +1646,7 @@
</route>
</delete>
- <get uri="/v2/toscaControlLoop/getToscaInstantiation" outType="java.lang.String" bindingMode="off" produces="application/json">
+ <get uri="/v2/acm/getToscaInstantiation" outType="java.lang.String" bindingMode="off" produces="application/json">
<route>
<removeHeaders pattern="*"/>
<doTry>
@@ -1679,7 +1679,7 @@
</doTry>
</route>
</get>
- <get uri="/v2/toscaControlLoop/getInstantiationOrderState" outType="java.lang.String" bindingMode="off" produces="application/json">
+ <get uri="/v2/acm/getInstantiationOrderState" outType="java.lang.String" bindingMode="off" produces="application/json">
<route>
<removeHeaders pattern="*"
excludePattern="name|version|requestId"/>
@@ -1713,7 +1713,7 @@
</doTry>
</route>
</get>
- <get uri="/v2/toscaControlLoop/getJsonSchema" outType="java.lang.String" bindingMode="off" produces="application/json">
+ <get uri="/v2/acm/getJsonSchema" outType="java.lang.String" bindingMode="off" produces="application/json">
<route>
<removeHeaders pattern="*"
excludePattern="section"/>
@@ -1748,7 +1748,7 @@
</route>
</get>
- <get uri="/v2/toscaControlLoop/getElementDefinitions" outType="java.lang.String" bindingMode="off" produces="application/json">
+ <get uri="/v2/acm/getElementDefinitions" outType="java.lang.String" bindingMode="off" produces="application/json">
<route>
<removeHeaders pattern="*"
excludePattern="name|version|requestId"/>
@@ -1783,7 +1783,7 @@
</route>
</get>
- <get uri="/v2/toscaControlLoop/getControlLoopDefinitions" outType="java.lang.String" bindingMode="off" produces="application/json">
+ <get uri="/v2/acm/getAutomationCompositionDefinitions" outType="java.lang.String" bindingMode="off" produces="application/json">
<route>
<removeHeaders pattern="*"
excludePattern="name|version|requestId"/>
@@ -1796,7 +1796,7 @@
<setProperty name="raiseHttpExceptionFlag">
<simple resultType="java.lang.Boolean">true</simple>
</setProperty>
- <to uri="direct:get-control-loop-definitions"/>
+ <to uri="direct:get-acm-definitions"/>
<to uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=endLog()"/>
<doCatch>
<exception>java.lang.Exception</exception>
@@ -1806,19 +1806,19 @@
<to
uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=errorLog()"/>
<log loggingLevel="ERROR"
- message="GET Control Loop Definitions request failed: ${exception.stacktrace}"/>
+ message="GET Automation Composition Definitions request failed: ${exception.stacktrace}"/>
<setHeader name="CamelHttpResponseCode">
<constant>500</constant>
</setHeader>
<setBody>
- <simple>GET Control Loop Definitions FAILED</simple>
+ <simple>GET Automation Composition Definitions FAILED</simple>
</setBody>
</doCatch>
</doTry>
</route>
</get>
- <post uri="/v2/toscaControlLoop/postToscaInstanceProperties"
+ <post uri="/v2/acm/postToscaInstanceProperties"
type="java.lang.String"
consumes="plain/text"
outType="java.lang.String"
@@ -1860,7 +1860,7 @@
</doTry>
</route>
</post>
- <delete uri="/v2/toscaControlLoop/deleteToscaInstanceProperties"
+ <delete uri="/v2/acm/deleteToscaInstanceProperties"
type="java.lang.String"
consumes="plain/text"
outType="java.lang.String"
@@ -1904,7 +1904,7 @@
</route>
</delete>
- <get uri="/v2/toscaControlLoop/getCommonOrInstanceProperties" outType="java.lang.String" bindingMode="off" produces="application/json">
+ <get uri="/v2/acm/getCommonOrInstanceProperties" outType="java.lang.String" bindingMode="off" produces="application/json">
<route>
<removeHeaders pattern="*"
excludePattern="name|version|requestId|common"/>
@@ -1939,7 +1939,7 @@
</route>
</get>
- <post uri="/v2/toscaControlLoop/postToscaInstantiation"
+ <post uri="/v2/acm/postToscaInstantiation"
type="java.lang.String"
consumes="plain/text"
outType="java.lang.String"
@@ -1982,7 +1982,7 @@
</route>
</post>
- <put uri="/v2/toscaControlLoop/putToscaInstantiationStateChange"
+ <put uri="/v2/acm/putToscaInstantiationStateChange"
type="java.lang.String"
consumes="plain/text"
outType="java.lang.String"
diff --git a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml b/runtime/src/main/resources/clds/camel/routes/acm-flows.xml
index 146ab14d5..c304c5360 100644
--- a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml
+++ b/runtime/src/main/resources/clds/camel/routes/acm-flows.xml
@@ -5,7 +5,7 @@
<log loggingLevel="INFO"
message="Getting the tosca service template"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Getting the tosca service template')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Getting the tosca service template')"/>
<setHeader name="CamelHttpMethod">
<constant>GET</constant>
</setHeader>
@@ -19,8 +19,8 @@
<simple>${header.version}</simple>
</setProperty>
<log loggingLevel="INFO"
- message="Endpoint to get Tosca Service Template: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/toscaservicetemplate"></log>
- <toD uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/toscaservicetemplate?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ message="Endpoint to get Tosca Service Template: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/toscaservicetemplate"></log>
+ <toD uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/toscaservicetemplate?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -35,7 +35,7 @@
<log loggingLevel="INFO"
message="Commissioning the tosca service template"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Commissioning the tosca service template')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Commissioning the tosca service template')"/>
<setHeader name="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
@@ -43,9 +43,9 @@
<constant>application/json</constant>
</setHeader>
<log loggingLevel="INFO"
- message="Endpoint to send Tosca Service Template: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission"></log>
+ message="Endpoint to send Tosca Service Template: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission? bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission? bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -60,7 +60,7 @@
<log loggingLevel="INFO"
message="Decommissioning the tosca service template"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Decommissioning the tosca service template')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Decommissioning the tosca service template')"/>
<setHeader name="CamelHttpMethod">
<constant>DELETE</constant>
</setHeader>
@@ -74,9 +74,9 @@
<simple>${header.version}</simple>
</setProperty>
<log loggingLevel="INFO"
- message="Endpoint to send Tosca Service Template: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission"></log>
+ message="Endpoint to send Tosca Service Template: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -91,7 +91,7 @@
<log loggingLevel="INFO"
message="Getting the Tosca instantiation"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('ControlLoop', 'Getting the Tosca instantiation')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Getting the Tosca instantiation')"/>
<setHeader name="CamelHttpMethod">
<constant>GET</constant>
</setHeader>
@@ -99,9 +99,9 @@
<constant>application/json</constant>
</setHeader>
<log loggingLevel="INFO"
- message="Endpoint to get Tosca Instantiation: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation"></log>
+ message="Endpoint to get Tosca Instantiation: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instantiation"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instantiation?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -116,7 +116,7 @@
<log loggingLevel="INFO"
message="Deleting Tosca Instantiation"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Deleting Tosca Instantiation')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Deleting Tosca Instantiation')"/>
<setHeader name="CamelHttpMethod">
<constant>DELETE</constant>
</setHeader>
@@ -130,9 +130,9 @@
<simple>${header.version}</simple>
</setProperty>
<log loggingLevel="INFO"
- message="Endpoint to delete Tosca Instantiation: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation"></log>
+ message="Endpoint to delete Tosca Instantiation: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instantiation"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instantiation?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -147,7 +147,7 @@
<log loggingLevel="INFO"
message="Creating the tosca instance properties"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Creating the tosca instance properties')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Creating the tosca instance properties')"/>
<setHeader name="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
@@ -155,9 +155,9 @@
<constant>application/json</constant>
</setHeader>
<log loggingLevel="INFO"
- message="Endpoint to send Tosca Instance Properties: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instanceProperties"></log>
+ message="Endpoint to send Tosca Instance Properties: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instanceProperties"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instanceProperties?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instanceProperties?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -172,7 +172,7 @@
<log loggingLevel="INFO"
message="Deleting Tosca Instance Properties"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Deleting Tosca Instance Properties')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Deleting Tosca Instance Properties')"/>
<setHeader name="CamelHttpMethod">
<constant>DELETE</constant>
</setHeader>
@@ -186,9 +186,9 @@
<simple>${header.version}</simple>
</setProperty>
<log loggingLevel="INFO"
- message="Endpoint to delete Tosca Instance Properties: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instanceProperties"></log>
+ message="Endpoint to delete Tosca Instance Properties: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instanceProperties"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instanceProperties?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instanceProperties?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -203,7 +203,7 @@
<log loggingLevel="INFO"
message="Create the tosca instantiation service"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Create the tosca instantiation service')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Create the tosca instantiation service')"/>
<setHeader name="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
@@ -211,9 +211,9 @@
<constant>application/json</constant>
</setHeader>
<log loggingLevel="INFO"
- message="Endpoint to send Tosca Instantiation Service: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation"></log>
+ message="Endpoint to send Tosca Instantiation Service: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instantiation"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instantiation?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -228,7 +228,7 @@
<log loggingLevel="INFO"
message="Change the tosca instantiation state service"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Change the tosca instantiation state service')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Change the tosca instantiation state service')"/>
<setHeader name="CamelHttpMethod">
<constant>PUT</constant>
</setHeader>
@@ -236,9 +236,9 @@
<constant>application/json</constant>
</setHeader>
<log loggingLevel="INFO"
- message="Endpoint to send Tosca Instantiation state change Service: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation/command"></log>
+ message="Endpoint to send Tosca Instantiation state change Service: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instantiation/command"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation/command?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instantiation/command?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -253,7 +253,7 @@
<log loggingLevel="INFO"
message="Getting the Tosca Instantiation Order State"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('ControlLoop', 'Getting the Tosca Instantiation Order State')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Getting the Tosca Instantiation Order State')"/>
<setHeader name="CamelHttpMethod">
<constant>GET</constant>
</setHeader>
@@ -267,9 +267,9 @@
<simple>${header.version}</simple>
</setProperty>
<log loggingLevel="INFO"
- message="Endpoint to get Tosca Instantiation Order State: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiationState"></log>
+ message="Endpoint to get Tosca Instantiation Order State: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instantiationState"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiationState?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instantiationState?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -284,7 +284,7 @@
<log loggingLevel="INFO"
message="Getting the JSON Schema"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('ControlLoop', 'Getting the JSON Schema')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Getting the JSON Schema')"/>
<setHeader name="CamelHttpMethod">
<constant>GET</constant>
</setHeader>
@@ -295,9 +295,9 @@
<simple>${header.section}</simple>
</setProperty>
<log loggingLevel="INFO"
- message="Endpoint to get Json Schema: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/toscaServiceTemplateSchema"></log>
+ message="Endpoint to get Json Schema: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/toscaServiceTemplateSchema"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/toscaServiceTemplateSchema?section=${exchangeProperty[section]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/toscaServiceTemplateSchema?section=${exchangeProperty[section]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -310,9 +310,9 @@
<from uri="direct:get-element-definitions"/>
<doTry>
<log loggingLevel="INFO"
- message="Getting the Control Loop Element Definitions"/>
+ message="Getting the Automation Composition Element Definitions"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('ControlLoop', 'Getting the Controlloop Element Definitions')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Getting the Automation Composition Element Definitions')"/>
<setHeader name="CamelHttpMethod">
<constant>GET</constant>
</setHeader>
@@ -320,9 +320,9 @@
<constant>application/json</constant>
</setHeader>
<log loggingLevel="INFO"
- message="Endpoint to get Json Schema: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/elements"></log>
+ message="Endpoint to get Json Schema: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/elements"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/elements?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/elements?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -331,13 +331,13 @@
</doFinally>
</doTry>
</route>
- <route id="get-control-loop-definitions">
- <from uri="direct:get-control-loop-definitions"/>
+ <route id="get-acm-definitions">
+ <from uri="direct:get-acm-definitions"/>
<doTry>
<log loggingLevel="INFO"
- message="Getting the Control Loop Definitions"/>
+ message="Getting the Automation Composition Definitions"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('ControlLoop', 'Getting the Controlloop Element Definitions')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Getting the Automation Composition Element Definitions')"/>
<setHeader name="CamelHttpMethod">
<constant>GET</constant>
</setHeader>
@@ -345,9 +345,9 @@
<constant>application/json</constant>
</setHeader>
<log loggingLevel="INFO"
- message="Endpoint to get Json Schema: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/elements"></log>
+ message="Endpoint to get Json Schema: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/elements"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission? bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission? bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -362,7 +362,7 @@
<log loggingLevel="INFO"
message="Getting Common Or Instance Properties"/>
<to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('ControlLoop', 'Getting Common Or Instance Properties')"/>
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Getting Common Or Instance Properties')"/>
<setHeader name="CamelHttpMethod">
<constant>GET</constant>
</setHeader>
@@ -373,9 +373,9 @@
<simple>${header.common}</simple>
</setProperty>
<log loggingLevel="INFO"
- message="Endpoint to get Common Or Instance Properties: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/getCommonOrInstanceProperties"></log>
+ message="Endpoint to get Common Or Instance Properties: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/getCommonOrInstanceProperties"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/getCommonOrInstanceProperties?common=${exchangeProperty[common]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/getCommonOrInstanceProperties?common=${exchangeProperty[common]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
diff --git a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseItTestCase.java b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseItTestCase.java
index 7824be460..8c9c5b3e4 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseItTestCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseItTestCase.java
@@ -125,7 +125,7 @@ public class RuntimeCommissioningResponseItTestCase {
ProducerTemplate prodTemplate = camelContext.createProducerTemplate();
Exchange exchangeResponse =
- prodTemplate.send("direct:get-control-loop-definitions", ExchangeBuilder.anExchange(camelContext)
+ prodTemplate.send("direct:get-acm-definitions", ExchangeBuilder.anExchange(camelContext)
.withProperty("name", "ToscaServiceTemplate")
.withProperty("version", "1.0.0")
.withProperty("raiseHttpExceptionFlag", "true")
diff --git a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java
index cc08ea0a6..d655257c6 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java
@@ -53,9 +53,10 @@ public class RuntimeInstantiationResponseItTestCase {
private static final String RAISE_HTTP_EXCEPTION_FLAG = "raiseHttpExceptionFlag";
- private static final String SAMPLE_CONTROL_LOOP_LIST = "{\"controlLoopList\": [{\"name\": \"PMSHInstance0\","
+ private static final String SAMPLE_CONTROL_LOOP_LIST =
+ "{\"automationCompositionList\": [{\"name\": \"PMSHInstance0\","
+ "\"version\": \"1.0.1\",\"definition\": {},\"state\": \"UNINITIALISED\",\"orderedState\": \"UNINITIALISED\","
- + "\"description\": \"PMSH control loop instance 0\",\"elements\": {}}]}";
+ + "\"description\": \"PMSH Automation Composition instance 0\",\"elements\": {}}]}";
private static final String SAMPLE_TOSCA_TEMPLATE =
"{\"tosca_definitions_version\": \"tosca_simple_yaml_1_1_0\","
diff --git a/runtime/src/test/resources/application.properties b/runtime/src/test/resources/application.properties
index f2cf0dd33..d09b3ce49 100644
--- a/runtime/src/test/resources/application.properties
+++ b/runtime/src/test/resources/application.properties
@@ -182,6 +182,6 @@ clamp.config.tosca.converter.default.datatypes=classpath:/clds/tosca-converter/d
clamp.config.tosca.converter.dictionary.support.enabled=true
# Configuration settings for ControlLoop Runtime Rest API
-clamp.config.controlloop.runtime.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.controlloop.runtime.userName=runtimeUser
-clamp.config.controlloop.runtime.password=zb!XztG34
+clamp.config.acm.runtime.url=http://localhost:${docker.http-cache.port.host}
+clamp.config.acm.runtime.userName=runtimeUser
+clamp.config.acm.runtime.password=zb!XztG34
diff --git a/runtime/src/test/resources/http-cache/third_party_proxy.py b/runtime/src/test/resources/http-cache/third_party_proxy.py
index 786c366e0..9c22f3ff5 100644
--- a/runtime/src/test/resources/http-cache/third_party_proxy.py
+++ b/runtime/src/test/resources/http-cache/third_party_proxy.py
@@ -276,44 +276,44 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w') as f:
f.write(response)
return True
- elif (self.path.startswith("/onap/controlloop/v2/commission/toscaservicetemplate")) and http_type == "GET":
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/commission/toscaservicetemplate")) and http_type == "GET":
if not _file_available:
cached_file_folder = cached_file_folder.split('bridgeEndpoint')[0]
print(("cached file folder for onap is %s: ", cached_file_folder))
- print("self.path start with /onap/controlloop/v2/commission/, generating response json...")
+ print("self.path start with /onap/policy/clamp/acm/v2/commission/, generating response json...")
jsonGenerated = "{\"tosca_definitions_version\": \"tosca_simple_yaml_1_1_0\",\"data_types\": {},\"node_types\": {}, \"policy_types\": {}, \"topology_template\": {}, \"name\": \"ToscaServiceTemplateSimple\", \"version\": \"1.0.0\", \"metadata\": {}}"
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)
return True
- elif (self.path.startswith("/onap/controlloop/v2/commission/toscaServiceTemplateSchema")) and http_type == "GET":
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/commission/toscaServiceTemplateSchema")) and http_type == "GET":
if not _file_available:
cached_file_folder = cached_file_folder.split('bridgeEndpoint')[0]
print(("cached file folder for onap is %s: ", cached_file_folder))
- print("self.path start with /onap/controlloop/v2/commission/, generating response json...")
+ print("self.path start with /onap/policy/clamp/acm/v2/commission/, generating response json...")
jsonGenerated = "{\"tosca_definitions_version\": \"tosca_simple_yaml_1_1_0\",\"data_types\": {},\"node_types\": {}, \"policy_types\": {}, \"topology_template\": {}, \"name\": \"ToscaServiceTemplateSimple\", \"version\": \"1.0.0\", \"metadata\": {}}"
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)
return True
- elif (self.path.startswith("/onap/controlloop/v2/commission/elements")) and http_type == "GET":
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/commission/elements")) and http_type == "GET":
if not _file_available:
- print("self.path start with /commission/elements Control Loop Elements, generating response json...")
+ print("self.path start with /commission/elements Automation Composition Elements, generating response json...")
jsonGenerated = "[{\"name\": ,\"org.onap.domain.pmsh.PMSH_DCAEMicroservice\": [{ \"version\": \"1.2.3\", \"derived_from\": null }]}]"
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)
return True
- elif (self.path.startswith("/onap/controlloop/v2/commission")) and http_type == "GET":
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/commission")) and http_type == "GET":
if not _file_available:
- print("self.path start with /commission control loop definition, generating response json...")
+ print("self.path start with /commission Automation Composition definition, generating response json...")
#jsondata = json.loads(self.data_string)
jsonGenerated = "[{\"name\": ,\"org.onap.domain.pmsh.PMSHControlLoopDefinition\": [{ \"version\": \"1.2.3\", \"derived_from\": null }]}]"
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)
return True
- elif (self.path.startswith("/onap/controlloop/v2/commission/getCommonOrInstanceProperties")) and http_type == "GET":
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/commission/getCommonOrInstanceProperties")) and http_type == "GET":
if not _file_available:
print("self.path start with /commission getting common properties, generating response json...")
with open("example/node_template.json", "r") as f:
jsonGenerated = f.read()
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)
return True
- elif (self.path.startswith("/onap/controlloop/v2/commission")) and http_type == "POST":
- print("self.path start with POST /onap/controlloop/v2/commission, copying body to response ...")
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/commission")) and http_type == "POST":
+ print("self.path start with POST /onap/policy/clamp/acm/v2/commission, copying body to response ...")
if not os.path.exists(cached_file_folder):
os.makedirs(cached_file_folder, 0o777)
with open(cached_file_header, 'w+') as f:
@@ -321,18 +321,18 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w+') as f:
f.write(self.data_string)
return True
- elif (self.path.startswith("/onap/controlloop/v2/commission")) and http_type == "DELETE":
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/commission")) and http_type == "DELETE":
print("self.path start with /commission Decommissioning, generating response json...")
jsonGenerated = "{\"errorDetails\": null,\"affectedControlLoopDefinitions\": [{ \"name\": \"ToscaServiceTemplateSimple\", \"version\": \"1.0.0\" }]}"
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)
return True
- elif (self.path.startswith("/onap/controlloop/v2/instantiation")) and http_type == "GET":
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/instantiation")) and http_type == "GET":
print("self.path start with /instantiation Retrieving Instantiation, generating response json...")
- jsonGenerated = "{\"controlLoopList\": [{\"name\": \"PMSHInstance0\",\"version\": \"1.0.1\",\"definition\": {},\"state\": \"UNINITIALISED\",\"orderedState\": \"UNINITIALISED\",\"description\": \"PMSH control loop instance 0\",\"elements\": {}}]}";
+ jsonGenerated = "{\"automationCompositionList\": [{\"name\": \"PMSHInstance0\",\"version\": \"1.0.1\",\"definition\": {},\"state\": \"UNINITIALISED\",\"orderedState\": \"UNINITIALISED\",\"description\": \"PMSH Automation Composition instance 0\",\"elements\": {}}]}";
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)
return True
- elif (self.path.startswith("/onap/controlloop/v2/instanceProperties")) and http_type == "POST":
- print("self.path start with POST /onap/controlloop/v2/instanceProperties, copying body to response ...")
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/instanceProperties")) and http_type == "POST":
+ print("self.path start with POST /onap/policy/clamp/acm/v2/instanceProperties, copying body to response ...")
if not os.path.exists(cached_file_folder):
os.makedirs(cached_file_folder, 0o777)
with open(cached_file_header, 'w+') as f:
@@ -340,12 +340,12 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w+') as f:
f.write(self.data_string)
return True
- elif (self.path.startswith("/onap/controlloop/v2/instanceProperties")) and http_type == "DELETE":
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/instanceProperties")) and http_type == "DELETE":
print("self.path start with /instanceProperties Deleting instance properties, generating response json...")
jsonGenerated = "{\"errorDetails\": null,\"affectedControlLoopDefinitions\": [{ \"name\": \"PMSH_Instance1\", \"version\": \"2.3.1\" }]}"
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)
return True
- elif (self.path.startswith("/onap/controlloop/v2/instantiation/command")) and http_type == "PUT":
+ elif (self.path.startswith("/onap/policy/clamp/acm/v2/instantiation/command")) and http_type == "PUT":
print("self.path start with /instantiation/command Changing order state, generating response json...")
jsonGenerated = "{\"orderedState\":\"PASSIVE\",\"controlLoopIdentifierList\":[{\"name\":\"PMSH_Instance1\",\"version\":\"2.3.1\"}]}"
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)