aboutsummaryrefslogtreecommitdiffstats
path: root/participant
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2021-05-21 15:00:36 +0100
committerliamfallon <liam.fallon@est.tech>2021-05-21 15:37:13 +0100
commitc9624f0e437db1d91b7076a1abdf71f74b5024dc (patch)
treebcc8462292df137cd9635df161f5b161f2959440 /participant
parentfa94a96fed5fd7af230a90373a04da47370e2eea (diff)
Move tosca-controlloop src directries to new modulestosca-poc
This is the second stage of the TOSCA Controlloop merge. In this review, the src directories of the old tosca-controlloop modules are moved to the new modules off the root of the clamp repo and the pom.xml files are updated with dependencies to allow the build of the moved modules to run. So the changes are renaming of files and updates of POM files in the modules to which src directories are added so that the build works, and of course deletion of the tosca-controlloop directory and its sub- modules The third and final review will follow this, which will merge the tosca-poc branch onto master, in effect merging this review to master. The differences with the clamp master repo are shown here: diff -qr clamp clamp-tp | diff_filter.sh Files clamp/INFO.yaml and clamp-tp/INFO.yaml differ Only in clamp-tp/common: src Only in clamp-tp/models: src Files clamp/participant/participant-impl/participant-impl-dcae/pom.xml and clamp-tp/participant/participant-impl/participant-impl-dcae/pom.xml differ Only in clamp-tp/participant/participant-impl/participant-impl-dcae: src Only in clamp-tp/participant/participant-impl/participant-impl-policy: src Only in clamp-tp/participant/participant-impl/participant-impl-simulator: src Files clamp/participant/participant-impl/pom.xml and clamp-tp/participant/participant-impl/pom.xml differ Only in clamp-tp/participant/participant-intermediary: src Files clamp/participant/pom.xml and clamp-tp/participant/pom.xml differ Files clamp/pom.xml and clamp-tp/pom.xml differ Only in clamp/releases: 6.0.1-container.yaml Only in clamp/releases: 6.0.1.yaml Only in clamp/releases: 6.0.2-container.yaml Only in clamp/releases: 6.0.2.yaml Only in clamp/releases: 6.1.0-container.yaml Only in clamp/releases: 6.1.0.yaml Only in clamp/releases: 6.1.1-container.yaml Only in clamp/releases: 6.1.1.yaml Files clamp/runtime/pom.xml and clamp-tp/runtime/pom.xml differ Only in clamp-tp: runtime-controlloop Issue-ID: POLICY-3215 Change-Id: I0e69e3c566ea387d61f77cfa118bb6d67b4f8253 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'participant')
-rw-r--r--participant/participant-impl/participant-impl-dcae/pom.xml19
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java154
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java140
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java46
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java197
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeHandler.java82
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeProvider.java133
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java78
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java93
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/Main.java151
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeActivator.java58
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeCommandLineArguments.java151
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java35
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java34
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java36
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json71
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt4
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java128
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java294
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.java102
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java90
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java255
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestMain.java151
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestParticipantDcaeActivator.java94
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json3
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json61
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json2
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestCLParams.json160
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json71
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json71
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json81
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/logback-test.xml42
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml452
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/rest/status.json3918
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java159
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyHandler.java100
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyProvider.java57
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameterHandler.java79
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java49
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/Main.java141
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/ParticipantPolicyActivator.java57
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/ParticipantPolicyCommandLineArguments.java145
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml79
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/resources/config/PolicyParticipantConfig.json31
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/resources/version.txt4
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/TestPolicyHandler.java134
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java221
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameterHandler.java98
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameters.java106
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestMain.java143
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestParticipantPolicyActivator.java88
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java343
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/InvalidParameters.json3
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/MinimumParametersH2.json53
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/NoParameters.json2
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml161
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParameters.json53
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParametersStd.json53
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/Unreadable.json73
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml42
-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_control_loop_tosca.yaml614
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameterHandler.java78
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java51
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java38
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/RestController.java130
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/Main.java141
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorActivator.java75
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorCommandLineArguments.java151
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationHandler.java81
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java129
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java195
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java192
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/config/CDSParticipantConfig.json31
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/config/DCAEParticipantConfig.json31
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/config/PolicyParticipantConfig.json31
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt4
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/intermediary/TestControlLoopUpdateListener.java91
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/CommonTestData.java249
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameterHandler.java120
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java110
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/CommonParticipantRestServer.java227
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/RestControllerTest.java95
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java258
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestSimulationRestController.java186
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/TestMain.java117
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/TestParticipantSimulatorActivator.java89
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/EmptyParameters.json0
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/InvalidParameters.json3
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/NoParameters.json2
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/TestParameters.json61
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/TestParametersStd.json61
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/Unreadable.json81
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml452
-rw-r--r--participant/participant-impl/pom.xml8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java62
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java139
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryFactory.java38
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java133
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java68
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java67
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java162
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantHealthCheckListener.java69
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java68
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusPublisher.java63
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java323
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java165
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java235
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java58
-rw-r--r--participant/pom.xml32
141 files changed, 17963 insertions, 0 deletions
diff --git a/participant/participant-impl/participant-impl-dcae/pom.xml b/participant/participant-impl/participant-impl-dcae/pom.xml
index 6186ced61..308084255 100644
--- a/participant/participant-impl/participant-impl-dcae/pom.xml
+++ b/participant/participant-impl/participant-impl-dcae/pom.xml
@@ -31,4 +31,23 @@
<artifactId>policy-clamp-participant-impl-dcae</artifactId>
<name>${project.artifactId}</name>
<description>DCAE participant, that allows DCAE to partake in control loops</description>
+
+ <properties>
+ <mockserver.version>5.11.2</mockserver.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.mock-server</groupId>
+ <artifactId>mockserver-netty</artifactId>
+ <version>${mockserver.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mock-server</groupId>
+ <artifactId>mockserver-client-java</artifactId>
+ <version>${mockserver.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java
new file mode 100644
index 000000000..b2d0b61d0
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java
@@ -0,0 +1,154 @@
+/*-
+ * ============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.dcae.httpclient;
+
+import java.io.Closeable;
+import java.io.IOException;
+import javax.ws.rs.core.Response.Status;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
+import org.apache.http.ParseException;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.AuthCache;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.protocol.HttpClientContext;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
+import org.apache.http.impl.auth.BasicScheme;
+import org.apache.http.impl.client.BasicAuthCache;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.apache.http.util.EntityUtils;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
+import org.onap.policy.common.endpoints.parameters.RestServerParameters;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractHttpClient implements Closeable {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AbstractHttpClient.class);
+ private final HttpClientContext localContext;
+ private final CloseableHttpClient httpclient;
+ private final HttpHost target;
+ public static final Coder CODER = new StandardCoder();
+
+ /**
+ * Constructor.
+ */
+ protected AbstractHttpClient(RestServerParameters restServerParameters) {
+ try {
+ final String scheme = restServerParameters.isHttps() ? "https" : "http";
+ target = new HttpHost(restServerParameters.getHost(), restServerParameters.getPort(), scheme);
+
+ CredentialsProvider credsProvider = new BasicCredentialsProvider();
+ credsProvider.setCredentials(new AuthScope(target.getHostName(), target.getPort()),
+ new UsernamePasswordCredentials(restServerParameters.getUserName(),
+ restServerParameters.getPassword()));
+
+ AuthCache authCache = new BasicAuthCache();
+ BasicScheme basicAuth = new BasicScheme();
+ authCache.put(target, basicAuth);
+ localContext = HttpClientContext.create();
+ localContext.setAuthCache(authCache);
+
+ HttpClientBuilder builder = HttpClients.custom().setDefaultCredentialsProvider(credsProvider);
+ if (restServerParameters.isHttps()) {
+ final SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(new SSLContextBuilder()
+ .loadTrustMaterial(null, new TrustSelfSignedStrategy()).setProtocol("TLSv1.2").build(),
+ new NoopHostnameVerifier());
+ builder.setSSLSocketFactory(sslsf);
+ }
+ httpclient = builder.build();
+
+ } catch (final Exception e) {
+ throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR,
+ restServerParameters.getName() + " Client failed to start", e);
+ }
+ }
+
+ CloseableHttpResponse execute(HttpRequest request) throws IOException {
+ return httpclient.execute(target, request, localContext);
+ }
+
+ protected boolean executePut(String path, int statusCode) {
+ try (CloseableHttpResponse response = execute(new HttpPut(path))) {
+ return response.getStatusLine().getStatusCode() == statusCode;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ protected Loop executePost(String path, int statusCode) {
+ try (CloseableHttpResponse response = execute(new HttpPost(path))) {
+ if (response.getStatusLine().getStatusCode() != statusCode) {
+ return null;
+ }
+ return entityToMap(response.getEntity());
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ protected Loop executeGet(String path, int statusCode) {
+ try (CloseableHttpResponse response = execute(new HttpGet(path))) {
+ if (response.getStatusLine().getStatusCode() != statusCode) {
+ return null;
+ }
+ return entityToMap(response.getEntity());
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private Loop entityToMap(HttpEntity httpEntity) {
+ if (httpEntity == null) {
+ return new Loop();
+ }
+ try {
+ return CODER.convert(EntityUtils.toString(httpEntity), Loop.class);
+ } catch (ParseException | IOException e) {
+ LOGGER.error("error reading Entity", e);
+ return new Loop();
+ } catch (CoderException e) {
+ LOGGER.error("cannot convert to Loop Object", e);
+ return new Loop();
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ httpclient.close();
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
new file mode 100644
index 000000000..eb805054d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
@@ -0,0 +1,140 @@
+/*-
+ * ============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.dcae.httpclient;
+
+import org.apache.http.HttpStatus;
+import org.onap.policy.clamp.controlloop.participant.dcae.model.ExternalComponent;
+import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
+import org.onap.policy.common.endpoints.parameters.RestServerParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ClampHttpClient extends AbstractHttpClient {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ClampHttpClient.class);
+
+ private static final String STATUS = "/restservices/clds/v2/loop/getstatus/";
+ private static final String CREATE = "/restservices/clds/v2/loop/create/%s?templateName=%s";
+ private static final String UPDATE = "/restservices/clds/v2/loop/updateMicroservicePolicy/";
+ private static final String DEPLOY = "/restservices/clds/v2/loop/deploy/";
+ private static final String STOP = "/restservices/clds/v2/loop/stop/";
+ private static final String DELETE = "/restservices/clds/v2/loop/delete/";
+ private static final String UNDEPLOY = "/restservices/clds/v2/loop/undeploy/";
+ public static final String STATUS_NOT_FOUND = "STATUS_NOT_FOUND";
+ public static final String POLICY_NOT_FOUND = "POLICY_NOT_FOUND";
+
+ /**
+ * Constructor.
+ */
+ public ClampHttpClient(RestServerParameters restServerParameters) {
+ super(restServerParameters);
+ }
+
+ /**
+ * Create.
+ *
+ * @param loopName the loopName
+ * @param templateName the templateName
+ * @return the Loop object or null if error occurred
+ */
+ public Loop create(String loopName, String templateName) {
+ return executePost(String.format(CREATE, loopName, templateName), HttpStatus.SC_OK);
+ }
+
+ /**
+ * Update.
+ *
+ * @param loopName the loopName
+ * @param jsonEntity the Json entity
+ * @return true
+ */
+ public boolean update(String loopName, String jsonEntity) {
+ return executePost(UPDATE + loopName, HttpStatus.SC_OK) != null;
+ }
+
+ /**
+ * Deploy.
+ *
+ * @param loopName the loopName
+ * @return true
+ */
+ public boolean deploy(String loopName) { // DCAE
+ return executePut(DEPLOY + loopName, HttpStatus.SC_ACCEPTED);
+ }
+
+ /**
+ * Get Status.
+ *
+ * @param loopName the loopName
+ * @return the Loop object or null if error occurred
+ */
+ public Loop getstatus(String loopName) {
+ return executeGet(STATUS + loopName, HttpStatus.SC_OK);
+ }
+
+ /**
+ * Undeploy.
+ *
+ * @param loopName the loopName
+ * @return true
+ */
+ public boolean undeploy(String loopName) {
+ return executePut(UNDEPLOY + loopName, HttpStatus.SC_ACCEPTED);
+ }
+
+ /**
+ * Stop.
+ *
+ * @param loopName the loopName
+ * @return true
+ */
+ public boolean stop(String loopName) {
+ return executePut(STOP + loopName, HttpStatus.SC_OK);
+ }
+
+ /**
+ * Delete.
+ *
+ * @param loopName the loopName
+ * @return true
+ */
+ public boolean delete(String loopName) {
+ return executePut(DELETE + loopName, HttpStatus.SC_OK);
+ }
+
+ /**
+ * return status from Loop object.
+ *
+ * @param loop Loop
+ * @return status
+ */
+ public static String getStatusCode(Loop loop) {
+ if (loop == null || loop.getComponents() == null || loop.getComponents().isEmpty()) {
+ return STATUS_NOT_FOUND;
+ }
+ ExternalComponent externalComponent = loop.getComponents().get("DCAE");
+ if (externalComponent == null || externalComponent.getComponentState() == null) {
+ return STATUS_NOT_FOUND;
+ }
+
+ return externalComponent.getComponentState().getStateName();
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java
new file mode 100644
index 000000000..cd84a2feb
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java
@@ -0,0 +1,46 @@
+/*-
+ * ============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.dcae.httpclient;
+
+import org.apache.http.HttpStatus;
+import org.onap.policy.common.endpoints.parameters.RestServerParameters;
+
+public class ConsulDcaeHttpClient extends AbstractHttpClient {
+
+ private static final String DEPLOY = "/v1/kv/dcae-pmsh:policy";
+
+ /**
+ * constructor.
+ */
+ public ConsulDcaeHttpClient(RestServerParameters restServerParameters) {
+ super(restServerParameters);
+ }
+
+ /**
+ * call consult.
+ *
+ * @param jsonEntity the Entity
+ * @return true
+ */
+ public boolean deploy(String jsonEntity) {
+ return executePut(DEPLOY + jsonEntity, HttpStatus.SC_ACCEPTED);
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java
new file mode 100644
index 000000000..96677f320
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java
@@ -0,0 +1,197 @@
+/*-
+ * ============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.dcae.main.handler;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.time.Instant;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+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.participant.dcae.httpclient.ClampHttpClient;
+import org.onap.policy.clamp.controlloop.participant.dcae.httpclient.ConsulDcaeHttpClient;
+import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
+import org.onap.policy.common.endpoints.parameters.RestServerParameters;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class handles implementation of controlLoopElement updates.
+ */
+public class ControlLoopElementHandler implements ControlLoopElementListener, Closeable {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopElementHandler.class);
+ private final ClampHttpClient clampClient;
+ private final ConsulDcaeHttpClient consulClient;
+
+ private static final String LOOP = "pmsh_loop";
+ private static final String TEMPLATE = "LOOP_TEMPLATE_k8s_pmsh";
+
+ private static final String BLUEPRINT_DEPLOYED = "BLUEPRINT_DEPLOYED";
+ private static final String MICROSERVICE_INSTALLED_SUCCESSFULLY = "MICROSERVICE_INSTALLED_SUCCESSFULLY";
+ private static final int CHECK_COUNT = 10;
+
+ private static final String BODY_CONSUL =
+ "{ \"subscription\": { \"subscriptionName\": \"subscriptiona\", \"administrativeState\": \"UNLOCKED\", "
+ + "\"fileBasedGP\": 15, \"fileLocation\": \"/pm/pm.xml\", \"nfFilter\": "
+ + "{ \"nfNames\": [ \"^pnf1.*\" ], \"modelInvariantIDs\": "
+ + "[ \"5845y423-g654-6fju-po78-8n53154532k6\", \"7129e420-d396-4efb-af02-6b83499b12f8\" ], "
+ + "\"modelVersionIDs\": [ \"e80a6ae3-cafd-4d24-850d-e14c084a5ca9\" ] }, \"measurementGroups\": "
+ + "[ { \"measurementGroup\": { \"measurementTypes\": [ { \"measurementType\": \"countera\" }, "
+ + "{ \"measurementType\": \"counterb\" } ], \"managedObjectDNsBasic\": [ { \"DN\": \"dna\" }, "
+ + "{ \"DN\": \"dnb\" } ] } }, { \"measurementGroup\": { \"measurementTypes\": "
+ + "[ { \"measurementType\": \"counterc\" }, { \"measurementType\": \"counterd\" } ], "
+ + "\"managedObjectDNsBasic\": " + "[ { \"DN\": \"dnc\" }, { \"DN\": \"dnd\" } ] } } ] } }";
+
+ /**
+ * Constructor.
+ */
+ public ControlLoopElementHandler(RestServerParameters clampParameters, RestServerParameters consulParameters) {
+ clampClient = new ClampHttpClient(clampParameters);
+ consulClient = new ConsulDcaeHttpClient(consulParameters);
+ }
+
+ /**
+ * 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
+ */
+ @Override
+ public void controlLoopElementStateChange(UUID controlLoopElementId, ControlLoopState currentState,
+ ControlLoopOrderedState newState) {
+ switch (newState) {
+ case UNINITIALISED:
+ Loop loop = clampClient.getstatus(LOOP);
+ if (loop != null) {
+ clampClient.undeploy(LOOP);
+ DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi()
+ .updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.UNINITIALISED);
+ }
+ break;
+ case PASSIVE:
+ DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi()
+ .updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.PASSIVE);
+ break;
+ case RUNNING:
+ DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi()
+ .updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.RUNNING);
+ break;
+ default:
+ LOGGER.debug("Unknown orderedstate {}", newState);
+ break;
+ }
+ }
+
+ private Loop getStatus() throws PfModelException {
+ Loop loop = clampClient.getstatus(LOOP);
+ if (loop == null) {
+ loop = clampClient.create(LOOP, TEMPLATE);
+ }
+ if (loop == null) {
+ throw new PfModelException(null, "");
+ }
+ return loop;
+ }
+
+ private void deploy() throws PfModelException {
+ if (!consulClient.deploy(BODY_CONSUL)) {
+ throw new PfModelException(null, "deploy to consul failed");
+ }
+ if (!clampClient.deploy(LOOP)) {
+ throw new PfModelException(null, "deploy failed");
+ }
+ }
+
+ /**
+ * Callback method to handle an update on a control loop element.
+ *
+ * @param element the information on the control loop element
+ * @param controlLoopDefinition toscaServiceTemplate
+ * @throws PfModelException in case of an exception
+ */
+ @Override
+ public void controlLoopElementUpdate(ControlLoopElement element, ToscaServiceTemplate controlLoopDefinition)
+ throws PfModelException {
+ try {
+ Loop loop = getStatus();
+
+ if (BLUEPRINT_DEPLOYED.equals(ClampHttpClient.getStatusCode(loop))) {
+ deploy();
+ boolean deployedFlag = false;
+ for (int i = 0; i < CHECK_COUNT; i++) {
+ //sleep 10 seconds
+ TimeUnit.SECONDS.sleep(CHECK_COUNT);
+ loop = getStatus();
+ String status = ClampHttpClient.getStatusCode(loop);
+ if (MICROSERVICE_INSTALLED_SUCCESSFULLY.equals(status)) {
+ DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi()
+ .updateControlLoopElementState(element.getId(), element.getOrderedState(),
+ ControlLoopState.PASSIVE);
+ deployedFlag = true;
+ break;
+ }
+ }
+ if (!deployedFlag) {
+ LOGGER.warn("DCAE is not deployed properly, ClElement state will be UNINITIALISED2PASSIVE");
+ DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi()
+ .updateControlLoopElementState(element.getId(), element.getOrderedState(),
+ ControlLoopState.UNINITIALISED2PASSIVE);
+ }
+ }
+ } catch (PfModelException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new PfModelException(null, e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Handle controlLoopElement statistics.
+ *
+ * @param controlLoopElementId controlloop element id
+ */
+ @Override
+ public void handleStatistics(UUID controlLoopElementId) {
+ ControlLoopElement clElement = DcaeHandler.getInstance().getDcaeProvider()
+ .getIntermediaryApi().getControlLoopElement(controlLoopElementId);
+ if (clElement != null) {
+ ClElementStatistics clElementStatistics = new ClElementStatistics();
+ clElementStatistics.setControlLoopState(clElement.getState());
+ clElementStatistics.setTimeStamp(Instant.now());
+ DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi()
+ .updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics);
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ clampClient.close();
+ consulClient.close();
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeHandler.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeHandler.java
new file mode 100644
index 000000000..1963e38b1
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeHandler.java
@@ -0,0 +1,82 @@
+/*-
+ * ============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.dcae.main.handler;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import javax.ws.rs.core.Response;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.common.handler.ControlLoopHandler;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
+import org.onap.policy.common.endpoints.event.comm.TopicSink;
+import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher;
+import org.onap.policy.common.utils.services.Registry;
+import org.onap.policy.models.base.PfModelRuntimeException;
+
+/**
+ * This class handles dcae of participants and control loop elements.
+ *
+ * </p>
+ * It is effectively a singleton that is started at system start.
+ */
+public class DcaeHandler extends ControlLoopHandler {
+
+ private final ParticipantDcaeParameters parameters;
+ @Getter
+ private DcaeProvider dcaeProvider;
+
+ /**
+ * Create a handler.
+ *
+ * @param parameters the parameters for access to the database
+ */
+ public DcaeHandler(ParticipantDcaeParameters parameters) {
+ super(parameters.getDatabaseProviderParameters());
+ this.parameters = parameters;
+ }
+
+ public static DcaeHandler getInstance() {
+ return Registry.get(DcaeHandler.class.getName());
+ }
+
+ @Override
+ public Set<Class<?>> getProviderClasses() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public void startProviders() {
+ dcaeProvider = new DcaeProvider(parameters);
+ }
+
+ @Override
+ public void stopProviders() {
+ try {
+ dcaeProvider.close();
+ } catch (IOException e) {
+ throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage());
+ } finally {
+ dcaeProvider = null;
+ }
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeProvider.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeProvider.java
new file mode 100644
index 000000000..afaf1c754
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeProvider.java
@@ -0,0 +1,133 @@
+/*-
+ * ============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.dcae.main.handler;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+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.rest.TypedSimpleResponse;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryFactory;
+
+/**
+ * This provider class dcae of participants and control loop elements.
+ */
+public class DcaeProvider implements Closeable {
+ @Getter
+ private final ParticipantIntermediaryApi intermediaryApi;
+
+ private final ControlLoopElementHandler clElementHandler;
+
+ /**
+ * Create a participant dcae provider.
+ *
+ * @throws ControlLoopRuntimeException on errors creating the provider
+ */
+ public DcaeProvider(ParticipantDcaeParameters parameters) throws ControlLoopRuntimeException {
+ intermediaryApi = new ParticipantIntermediaryFactory().createApiImplementation();
+ intermediaryApi.init(parameters.getIntermediaryParameters());
+ clElementHandler = new ControlLoopElementHandler(parameters.getClampClientParameters(),
+ parameters.getConsulClientParameters());
+ intermediaryApi.registerControlLoopElementListener(clElementHandler);
+ }
+
+ @Override
+ public void close() throws IOException {
+ intermediaryApi.close();
+ clElementHandler.close();
+ }
+
+ /**
+ * Get the control loops.
+ *
+ * @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
+ */
+ public ControlLoops getControlLoops(String name, String version) throws ControlLoopException {
+ return intermediaryApi.getControlLoops(name, version);
+ }
+
+ /**
+ * Get the dcae control loop elements.
+ *
+ * @param name the controlLoopElement, null to get all
+ * @param version the controlLoopElement, null to get all
+ * @return the control loop elements
+ * @throws ControlLoopException on errors getting the control loop elements
+ */
+ public Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version)
+ throws ControlLoopException {
+ return intermediaryApi.getControlLoopElements(name, version);
+ }
+
+ /**
+ * Update the given control loop element in the dcae.
+ *
+ * @param element the control loop element to update
+ * @return response simple response returned
+ * @throws ControlLoopException on errors updating the control loop element
+ */
+ public TypedSimpleResponse<ControlLoopElement> updateControlLoopElement(ControlLoopElement element)
+ throws ControlLoopException {
+ TypedSimpleResponse<ControlLoopElement> response = new TypedSimpleResponse<>();
+ response.setResponse(intermediaryApi.updateControlLoopElementState(element.getId(),
+ element.getOrderedState(), element.getState()));
+ return response;
+ }
+
+ /**
+ * Get the current dcae participants.
+ *
+ * @param name the participant, null to get all
+ * @param version the participant, null to get all
+ * @return the list of participants
+ * @throws ControlLoopException on errors getting the participants
+ */
+ public List<Participant> getParticipants(String name, String version) throws ControlLoopException {
+ return intermediaryApi.getParticipants(name, version);
+ }
+
+ /**
+ * Update a dcae participant.
+ *
+ * @param participant the participant to update
+ * @return TypedSimpleResponse simple response
+ * @throws ControlLoopException on errors updating the participant
+ */
+
+ public TypedSimpleResponse<Participant> updateParticipant(Participant participant) throws ControlLoopException {
+ TypedSimpleResponse<Participant> response = new TypedSimpleResponse<>();
+ response.setResponse(
+ intermediaryApi.updateParticipantState(participant.getDefinition(), participant.getParticipantState()));
+ return response;
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java
new file mode 100644
index 000000000..8d9bef98c
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java
@@ -0,0 +1,78 @@
+/*-
+ * ============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.dcae.main.parameters;
+
+import java.io.File;
+import javax.ws.rs.core.Response;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.ParticipantDcaeCommandLineArguments;
+import org.onap.policy.common.parameters.ValidationResult;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+
+/**
+ * This class handles reading, parsing and validating of control loop runtime parameters from JSON files.
+ */
+public class ParticipantDcaeParameterHandler {
+
+ private static final Coder CODER = new StandardCoder();
+
+ /**
+ * Read the parameters from the parameter file.
+ *
+ * @param arguments the arguments passed to dcae
+ * @return the parameters read from the configuration file
+ * @throws ControlLoopException on parameter exceptions
+ */
+ public ParticipantDcaeParameters getParameters(final ParticipantDcaeCommandLineArguments arguments)
+ throws ControlLoopException {
+ ParticipantDcaeParameters parameters = null;
+
+ // Read the parameters
+ try {
+ // Read the parameters from JSON
+ File file = new File(arguments.getFullConfigurationFilePath());
+ parameters = CODER.decode(file, ParticipantDcaeParameters.class);
+ } catch (final CoderException e) {
+ final String errorMessage = "error reading parameters from \"" + arguments.getConfigurationFilePath()
+ + "\"\n" + "(" + e.getClass().getSimpleName() + ")";
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage, e);
+ }
+
+ // The JSON processing returns null if there is an empty file
+ if (parameters == null) {
+ final String errorMessage = "no parameters found in \"" + arguments.getConfigurationFilePath() + "\"";
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage);
+ }
+
+ // validate the parameters
+ final ValidationResult validationResult = parameters.validate();
+ if (!validationResult.isValid()) {
+ String returnMessage =
+ "validation error(s) on parameters from \"" + arguments.getConfigurationFilePath() + "\"\n";
+ returnMessage += validationResult.getResult();
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, returnMessage);
+ }
+
+ return parameters;
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java
new file mode 100644
index 000000000..beb273086
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java
@@ -0,0 +1,93 @@
+/*-
+ * ============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.dcae.main.parameters;
+
+import javax.validation.constraints.NotBlank;
+import lombok.Getter;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.common.endpoints.parameters.RestServerParameters;
+import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
+import org.onap.policy.common.parameters.ValidationStatus;
+import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.common.parameters.annotations.Valid;
+import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+
+/**
+ * Class to hold all parameters needed for the participant dcae.
+ *
+ */
+@NotNull
+@NotBlank
+@Getter
+public class ParticipantDcaeParameters extends ParameterGroupImpl {
+ @Valid
+ private RestServerParameters clampClientParameters;
+
+ @Valid
+ private RestServerParameters consulClientParameters;
+
+ private ParticipantIntermediaryParameters intermediaryParameters;
+ private PolicyModelsProviderParameters databaseProviderParameters;
+
+ /**
+ * Create the participant dcae parameter group.
+ *
+ * @param name the parameter group name
+ */
+ public ParticipantDcaeParameters(final String name) {
+ super(name);
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public BeanValidationResult validate() {
+ BeanValidationResult result = super.validate();
+ if (result.isValid()) {
+ result.addResult(checkMissingMandatoryParams(clampClientParameters));
+ result.addResult(checkMissingMandatoryParams(consulClientParameters));
+ }
+ return result;
+ }
+
+ private BeanValidationResult checkMissingMandatoryParams(RestServerParameters clientParameters) {
+ BeanValidationResult result = new BeanValidationResult(clientParameters.getName(), clientParameters);
+ if (StringUtils.isBlank(clientParameters.getHost())) {
+ result.addResult("Host", clientParameters.getHost(), ValidationStatus.INVALID, "is blank");
+ }
+ if (StringUtils.isBlank(clientParameters.getName())) {
+ result.addResult("Name", clientParameters.getName(), ValidationStatus.INVALID, "is blank");
+ }
+ if (StringUtils.isBlank(clientParameters.getPassword())) {
+ result.addResult("Password", clientParameters.getPassword(), ValidationStatus.INVALID, "is blank");
+ }
+ if (StringUtils.isBlank(clientParameters.getUserName())) {
+ result.addResult("UserName", clientParameters.getUserName(), ValidationStatus.INVALID, "is blank");
+ }
+ if (clientParameters.getPort() <= 0 || clientParameters.getPort() >= 65535) {
+ result.addResult("Port", clientParameters.getPort(), ValidationStatus.INVALID, "is not valid");
+ }
+ return result;
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/Main.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/Main.java
new file mode 100644
index 000000000..2b47a2c13
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/Main.java
@@ -0,0 +1,151 @@
+/*-
+ * ============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.dcae.main.startstop;
+
+import java.util.Arrays;
+import javax.ws.rs.core.Response;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.common.ControlLoopConstants;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameterHandler;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
+import org.onap.policy.common.utils.resources.MessageConstants;
+import org.onap.policy.common.utils.services.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class initiates ONAP Policy Framework Control Loop participant component.
+ */
+public class Main {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
+
+ private ParticipantDcaeActivator activator;
+
+ @Getter
+ private ParticipantDcaeParameters parameterGroup;
+
+ /**
+ * Instantiates the control loop participant service.
+ *
+ * @param args the command line arguments
+ */
+ public Main(final String[] args) {
+ final String argumentString = Arrays.toString(args);
+ LOGGER.info("Starting the control loop participant service with arguments - {}", argumentString);
+
+ // Check the arguments
+ final ParticipantDcaeCommandLineArguments arguments = new ParticipantDcaeCommandLineArguments();
+ try {
+ // The arguments return a string if there is a message to print and we should exit
+ final String argumentMessage = arguments.parse(args);
+ if (argumentMessage != null) {
+ LOGGER.info(argumentMessage);
+ return;
+ }
+ // Validate that the arguments are sane
+ arguments.validate();
+
+ // Read the parameters
+ parameterGroup = new ParticipantDcaeParameterHandler().getParameters(arguments);
+
+ // Now, create the activator for the service
+ activator = new ParticipantDcaeActivator(parameterGroup);
+ Registry.register(ControlLoopConstants.REG_CLRUNTIME_ACTIVATOR, activator);
+
+ // Start the activator
+ activator.start();
+ } catch (Exception exp) {
+ if (null != activator) {
+ Registry.unregister(ControlLoopConstants.REG_CLRUNTIME_ACTIVATOR);
+ }
+ throw new ControlLoopRuntimeException(Response.Status.BAD_REQUEST,
+ String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP), exp);
+ }
+
+ // Add a shutdown hook to shut everything down in an orderly manner
+ Runtime.getRuntime().addShutdownHook(new ClRuntimeShutdownHookClass());
+ String successMsg = String.format(MessageConstants.START_SUCCESS_MSG, MessageConstants.POLICY_CLAMP);
+ LOGGER.info(successMsg);
+ }
+
+ /**
+ * Check if main is running.
+ */
+ public boolean isRunning() {
+ return activator != null && activator.isAlive();
+ }
+
+ /**
+ * Shut down Execution.
+ *
+ * @throws ControlLoopException on shutdown errors
+ */
+ public void shutdown() throws ControlLoopException {
+ // clear the parameterGroup variable
+ parameterGroup = null;
+
+ // clear the cl participant activator
+ if (activator != null) {
+ activator.stop();
+ }
+ }
+
+ /**
+ * The Class ClRuntimeShutdownHookClass terminates the control loop participant service
+ * when its run method is called.
+ */
+ private class ClRuntimeShutdownHookClass extends Thread {
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+ if (!activator.isAlive()) {
+ return;
+ }
+
+ try {
+ // Shutdown the control loop participant service and wait for everything to stop
+ activator.stop();
+ } catch (final RuntimeException e) {
+ LOGGER.warn("error occured during shut down of the control loop participant service", e);
+ }
+ }
+ }
+
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
+ public static void main(final String[] args) { // NOSONAR
+ /*
+ * NOTE: arguments are validated by the constructor, thus sonar is disabled.
+ */
+
+ new Main(args);
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeActivator.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeActivator.java
new file mode 100644
index 000000000..d485895cf
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeActivator.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.dcae.main.startstop;
+
+import java.util.concurrent.atomic.AtomicReference;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.handler.DcaeHandler;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
+import org.onap.policy.common.utils.services.ServiceManagerContainer;
+
+/**
+ * This class activates the control loop runtime component as a complete service together with all its controllers,
+ * listeners & handlers.
+ */
+public class ParticipantDcaeActivator extends ServiceManagerContainer {
+ @Getter
+ private final ParticipantDcaeParameters parameters;
+
+ /**
+ * Instantiate the activator for the dcae as a complete service.
+ *
+ * @param parameters the parameters for the control loop runtime service
+ */
+ public ParticipantDcaeActivator(final ParticipantDcaeParameters parameters) {
+ this.parameters = parameters;
+
+ final AtomicReference<DcaeHandler> dcaeHandler = new AtomicReference<>();
+
+ // @formatter:off
+ addAction("Dcae Handler",
+ () -> dcaeHandler.set(new DcaeHandler(parameters)),
+ () -> dcaeHandler.get().close());
+
+ addAction("Dcae Providers",
+ () -> dcaeHandler.get().startProviders(),
+ () -> dcaeHandler.get().stopProviders());
+
+ // @formatter:on
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeCommandLineArguments.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeCommandLineArguments.java
new file mode 100644
index 000000000..0bf382ab1
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeCommandLineArguments.java
@@ -0,0 +1,151 @@
+/*-
+ * ============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.dcae.main.startstop;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Arrays;
+import javax.ws.rs.core.Response;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.common.startstop.CommonCommandLineArguments;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+
+/**
+ * This class reads and handles command line parameters for the control loop runtime service.
+ *
+ */
+public class ParticipantDcaeCommandLineArguments {
+ private static final String FILE_MESSAGE_PREAMBLE = " file \"";
+ private static final int HELP_LINE_LENGTH = 120;
+
+ private final Options options;
+ private final CommonCommandLineArguments commonCommandLineArguments;
+
+ @Getter()
+ @Setter()
+ private String configurationFilePath = null;
+
+ /**
+ * Construct the options for the dcae participant.
+ */
+ public ParticipantDcaeCommandLineArguments() {
+ options = new Options();
+ commonCommandLineArguments = new CommonCommandLineArguments(options);
+ }
+
+ /**
+ * Construct the options for the CLI editor and parse in the given arguments.
+ *
+ * @param args The command line arguments
+ */
+ public ParticipantDcaeCommandLineArguments(final String[] args) {
+ // Set up the options with the default constructor
+ this();
+
+ // Parse the arguments
+ try {
+ parse(args);
+ } catch (final ControlLoopException e) {
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
+ "parse error on dcae participant parameters", e);
+ }
+ }
+
+ /**
+ * Parse the command line options.
+ *
+ * @param args The command line arguments
+ * @return a string with a message for help and version, or null if there is no message
+ * @throws ControlLoopException on command argument errors
+ */
+ public String parse(final String[] args) throws ControlLoopException {
+ // Clear all our arguments
+ setConfigurationFilePath(null);
+ CommandLine commandLine = null;
+ try {
+ commandLine = new DefaultParser().parse(options, args);
+ } catch (final ParseException e) {
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
+ "invalid command line arguments specified : " + e.getMessage());
+ }
+
+ // Arguments left over after Commons CLI does its stuff
+ final String[] remainingArgs = commandLine.getArgs();
+
+ if (remainingArgs.length > 0) {
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
+ "too many command line arguments specified : " + Arrays.toString(args));
+ }
+
+ if (commandLine.hasOption('h')) {
+ return commonCommandLineArguments.help(Main.class.getName(), options);
+ }
+
+ if (commandLine.hasOption('v')) {
+ return commonCommandLineArguments.version();
+ }
+
+ if (commandLine.hasOption('c')) {
+ setConfigurationFilePath(commandLine.getOptionValue('c'));
+ }
+
+ return null;
+ }
+
+ /**
+ * Validate the command line options.
+ *
+ * @throws ControlLoopException on command argument validation errors
+ */
+ public void validate() throws ControlLoopException {
+ commonCommandLineArguments.validate(configurationFilePath);
+ }
+
+ /**
+ * Gets the full expanded configuration file path.
+ *
+ * @return the configuration file path
+ */
+ public String getFullConfigurationFilePath() {
+ return ResourceUtils.getFilePath4Resource(getConfigurationFilePath());
+ }
+
+ /**
+ * Check set configuration file path.
+ *
+ * @return true, if check set configuration file path
+ */
+ public boolean checkSetConfigurationFilePath() {
+ return !StringUtils.isEmpty(configurationFilePath);
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java
new file mode 100644
index 000000000..01a514f43
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java
@@ -0,0 +1,35 @@
+/*-
+ * ============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.dcae.model;
+
+import java.io.Serializable;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class ExternalComponent implements Serializable {
+
+ private static final long serialVersionUID = -10;
+
+ private ExternalComponentState componentState;
+
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java
new file mode 100644
index 000000000..da7360a9b
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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.dcae.model;
+
+import java.io.Serializable;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class ExternalComponentState implements Serializable {
+
+ private static final long serialVersionUID = -10;
+
+ private String stateName;
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java
new file mode 100644
index 000000000..d84270500
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.dcae.model;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class Loop implements Serializable {
+
+ private static final long serialVersionUID = -10;
+
+ private Map<String, ExternalComponent> components = new HashMap<>();
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json
new file mode 100644
index 000000000..863c135d5
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json
@@ -0,0 +1,71 @@
+{
+ "name": "ControlLoopParticipantDcae",
+ "clampClientParameters": {
+ "name": "Clamp",
+ "host": "0.0.0.0",
+ "port": 8443,
+ "userName": "admin",
+ "password": "password",
+ "https": true,
+ "aaf": false
+ },
+ "consulClientParameters": {
+ "name": "Consul",
+ "host": "consul",
+ "port": 31321,
+ "userName": "admin",
+ "password": "password",
+ "https": false,
+ "aaf": false
+ },
+ "intermediaryParameters": {
+ "name": "Participant parameters",
+ "reportingTimeInterval": 120000,
+ "description": "Participant Description",
+ "participantId": {
+ "name": "DCAEParticipant0",
+ "version": "1.0.0"
+ },
+ "participantType": {
+ "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "version": "2.3.4"
+ },
+ "clampControlLoopTopics": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt b/participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt
new file mode 100644
index 000000000..dbd67585f
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt
@@ -0,0 +1,4 @@
+ONAP Tosca defined control loop Participant
+Version: ${project.version}
+Built (UTC): ${maven.build.timestamp}
+ONAP https://wiki.onap.org
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java
new file mode 100644
index 000000000..040b33f5e
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java
@@ -0,0 +1,128 @@
+/*-
+ * ============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.dcae.httpclient;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
+import static org.junit.Assert.assertTrue;
+import static org.mockserver.model.HttpRequest.request;
+import static org.mockserver.model.HttpResponse.response;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockserver.integration.ClientAndServer;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
+import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.StandardCoder;
+
+/**
+ * Class to perform unit test of {@link ClampHttpClient}.
+ *
+ */
+public class ClampHttpClientTest {
+
+ private static final String LOOP = "pmsh_loop";
+ private static final String BLUEPRINT_DEPLOYED = "BLUEPRINT_DEPLOYED";
+
+ private static ClientAndServer mockServer;
+ private static ParticipantDcaeParameters parameters;
+ public static final Coder CODER = new StandardCoder();
+
+ /**
+ * Set up.
+ */
+ @BeforeClass
+ public static void setUp() {
+ CommonTestData commonTestData = new CommonTestData();
+
+ parameters = commonTestData.toObject(
+ commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME),
+ ParticipantDcaeParameters.class);
+
+ mockServer = ClientAndServer.startClientAndServer(parameters.getClampClientParameters().getPort());
+
+ mockServer.when(request().withMethod("GET").withPath("/restservices/clds/v2/loop/getstatus/" + LOOP))
+ .respond(response().withBody(CommonTestData.createJsonStatus(BLUEPRINT_DEPLOYED)).withStatusCode(200));
+
+ mockServer.when(request().withMethod("PUT").withPath("/restservices/clds/v2/loop/deploy/" + LOOP))
+ .respond(response().withStatusCode(202));
+
+ mockServer.when(request().withMethod("PUT").withPath("/restservices/clds/v2/loop/undeploy/" + LOOP))
+ .respond(response().withStatusCode(202));
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ mockServer.stop();
+ mockServer = null;
+ }
+
+ @Test
+ public void test_getstatus() throws Exception {
+ try (ClampHttpClient client = new ClampHttpClient(parameters.getClampClientParameters())) {
+
+ Loop status = client.getstatus(LOOP);
+
+ String json = CommonTestData.createJsonStatus(BLUEPRINT_DEPLOYED);
+ Loop loop = CODER.convert(json, Loop.class);
+
+ assertThat(ClampHttpClient.getStatusCode(status)).isEqualTo(ClampHttpClient.getStatusCode(loop));
+
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void test_deploy() throws Exception {
+ try (ClampHttpClient client = new ClampHttpClient(parameters.getClampClientParameters())) {
+
+ assertTrue(client.deploy(LOOP));
+
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void test_undeploy() throws Exception {
+ try (ClampHttpClient client = new ClampHttpClient(parameters.getClampClientParameters())) {
+
+ assertTrue(client.undeploy(LOOP));
+
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void test_getStatusCodeNull() {
+ assertThat(ClampHttpClient.getStatusCode(null)).isEqualTo(ClampHttpClient.STATUS_NOT_FOUND);
+ }
+
+ @Test
+ public void test_getStatusEmptyMap() {
+ assertThat(ClampHttpClient.getStatusCode(new Loop())).isEqualTo(ClampHttpClient.STATUS_NOT_FOUND);
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java
new file mode 100644
index 000000000..bcfaf8bb9
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java
@@ -0,0 +1,294 @@
+/*-
+ * ============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.dcae.main.parameters;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import javax.ws.rs.core.Response;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.common.endpoints.parameters.TopicParameters;
+import org.onap.policy.common.parameters.ParameterGroup;
+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.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 DESCRIPTION = "Participant description";
+ public static final long TIME_INTERVAL = 2000;
+ public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams());
+ private static final String REST_CLIENT_PASSWORD = "password";
+ private static final String REST_CLIENT_USER = "admin";
+ private static final int REST_CLAMP_PORT = 8443;
+ private static final int REST_CONSUL_PORT = 31321;
+ private static final String REST_CLAMP_HOST = "localhost";
+ private static final String REST_CONSUL_HOST = "consul";
+ private static final boolean REST_CLAMP_HTTPS = false;
+ private static final boolean REST_CONSUL_HTTPS = false;
+ private static final boolean REST_CLIENT_AAF = false;
+
+ public static final Coder coder = new StandardCoder();
+
+ /**
+ * Converts the contents of a map to a parameter class.
+ *
+ * @param source property map
+ * @param clazz class of object to be created from the map
+ * @return a new object represented by the map
+ */
+ public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) {
+ try {
+ return coder.convert(source, clazz);
+
+ } catch (final CoderException e) {
+ throw new RuntimeException("cannot create " + clazz.getName() + " from map", e);
+ }
+ }
+
+ /**
+ * Returns a property map for a ApexStarterParameterGroup map for test cases.
+ *
+ * @param name name of the parameters
+ *
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getParticipantParameterGroupMap(final String name) {
+ final Map<String, Object> map = new TreeMap<>();
+
+ map.put("name", name);
+ map.put("clampClientParameters", getClampClientParametersMap(false));
+ map.put("consulClientParameters", getConsulClientParametersMap(false));
+ map.put("intermediaryParameters", getIntermediaryParametersMap(false));
+ map.put("databaseProviderParameters", getDatabaseProviderParametersMap(false));
+ return map;
+ }
+
+ /**
+ * Returns a property map for a RestServerParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getClampClientParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ map.put("https", REST_CLAMP_HTTPS);
+ map.put("aaf", REST_CLIENT_AAF);
+
+ if (!isEmpty) {
+ map.put("host", REST_CLAMP_HOST);
+ map.put("port", REST_CLAMP_PORT);
+ map.put("userName", REST_CLIENT_USER);
+ map.put("password", REST_CLIENT_PASSWORD);
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a property map for a RestServerParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getConsulClientParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ map.put("https", REST_CONSUL_HTTPS);
+ map.put("aaf", REST_CLIENT_AAF);
+
+ if (!isEmpty) {
+ map.put("host", REST_CONSUL_HOST);
+ map.put("port", REST_CONSUL_PORT);
+ map.put("userName", REST_CLIENT_USER);
+ map.put("password", REST_CLIENT_PASSWORD);
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a property map for a databaseProviderParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getDatabaseProviderParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ if (!isEmpty) {
+ map.put("name", "PolicyProviderParameterGroup");
+ map.put("implementation", "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl");
+ map.put("databaseDriver", "org.h2.Driver");
+ map.put("databaseUrl", "jdbc:h2:mem:testdb");
+ map.put("databaseUser", "policy");
+ map.put("databasePassword", "P01icY");
+ map.put("persistenceUnit", "ToscaConceptTest");
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a property map for a intermediaryParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getIntermediaryParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ if (!isEmpty) {
+ map.put("name", "Participant parameters");
+ map.put("reportingTimeInterval", TIME_INTERVAL);
+ map.put("description", DESCRIPTION);
+ map.put("participantId", getParticipantId());
+ map.put("participantType", getParticipantId());
+ map.put("clampControlLoopTopics", getTopicParametersMap(false));
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a property map for a TopicParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getTopicParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ if (!isEmpty) {
+ map.put("topicSources", TOPIC_PARAMS);
+ map.put("topicSinks", TOPIC_PARAMS);
+ }
+ return map;
+ }
+
+ /**
+ * Returns topic parameters for test cases.
+ *
+ * @return topic parameters
+ */
+ public static TopicParameters getTopicParams() {
+ final TopicParameters topicParams = new TopicParameters();
+ topicParams.setTopic("POLICY-CLRUNTIME-PARTICIPANT");
+ topicParams.setTopicCommInfrastructure("dmaap");
+ topicParams.setServers(Arrays.asList("localhost"));
+ return topicParams;
+ }
+
+ /**
+ * Returns participantId for test cases.
+ *
+ * @return participant Id
+ */
+ public static ToscaConceptIdentifier getParticipantId() {
+ final ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
+ participantId.setName("CDSParticipant0");
+ participantId.setVersion("1.0.0");
+ return participantId;
+ }
+
+ /**
+ * Gets the standard participant parameters.
+ *
+ * @param port port to be inserted into the parameters
+ * @return the standard participant parameters
+ */
+ public ParticipantDcaeParameters getParticipantParameterGroup(int port) {
+ try {
+ return coder.decode(getParticipantParameterGroupAsString(port), ParticipantDcaeParameters.class);
+
+ } catch (CoderException e) {
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters",
+ e);
+ }
+ }
+
+ /**
+ * Gets the standard participant parameters, as a String.
+ *
+ * @param port port to be inserted into the parameters
+ * @return the standard participant parameters
+ */
+ public static String getParticipantParameterGroupAsString(int port) {
+
+ try {
+ File file = new File(getParamFile());
+ String json = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8);
+
+ json = json.replace("${port}", String.valueOf(port));
+ json = json.replace("${dbName}", "jdbc:h2:mem:testdb");
+
+ return json;
+
+ } catch (IOException e) {
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters",
+ e);
+
+ }
+ }
+
+ /**
+ * Gets the full path to the parameter file, which may vary depending on whether or
+ * not this is an end-to-end test.
+ *
+ * @return the parameter file name
+ */
+ private static String getParamFile() {
+ return "src/test/resources/parameters/TestParametersStd.json";
+ }
+
+ /**
+ * Nulls out a field within a JSON string.
+ *
+ * @param json JSON string
+ * @param field field to be nulled out
+ * @return a new JSON string with the field nulled out
+ */
+ public String nullifyField(String json, String field) {
+ return json.replace(field + "\"", field + "\":null, \"" + field + "Xxx\"");
+ }
+
+ /**
+ * create Json response from getstatus call.
+ *
+ * @param status the status of Partecipant
+ * @return the JSON
+ */
+ public static String createJsonStatus(String status) {
+ try {
+ File file = new File("src/test/resources/rest/status.json");
+ String json = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8);
+ return json.replace("${status}", status);
+
+ } catch (IOException e) {
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read json file", e);
+ }
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.java
new file mode 100644
index 000000000..058a3dae4
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.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.controlloop.participant.dcae.main.parameters;
+
+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.assertTrue;
+
+import java.io.FileNotFoundException;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameterHandler;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.ParticipantDcaeCommandLineArguments;
+import org.onap.policy.common.utils.coder.CoderException;
+
+/**
+ * Class to perform unit test of {@link ParticipantParameterHandler}.
+ *
+ */
+public class TestParticipantDcaeParameterHandler {
+
+ @Test
+ public void testParameterHandlerNoParameterFile() throws ControlLoopException {
+ final String[] emptyArgumentString = { "-c", "src/test/resources/parameters/NoParametersFile.json" };
+
+ final ParticipantDcaeCommandLineArguments emptyArguments = new ParticipantDcaeCommandLineArguments();
+ emptyArguments.parse(emptyArgumentString);
+
+ assertThatThrownBy(() -> new ParticipantDcaeParameterHandler().getParameters(emptyArguments))
+ .hasCauseInstanceOf(CoderException.class)
+ .hasRootCauseInstanceOf(FileNotFoundException.class);
+ }
+
+ @Test
+ public void testParameterHandlerInvalidParameters() throws ControlLoopException {
+ final String[] invalidArgumentString = { "-c", "src/test/resources/parameters/InvalidParameters.json" };
+
+ final ParticipantDcaeCommandLineArguments invalidArguments =
+ new ParticipantDcaeCommandLineArguments();
+ invalidArguments.parse(invalidArgumentString);
+
+ assertThatThrownBy(() -> new ParticipantDcaeParameterHandler().getParameters(invalidArguments))
+ .hasMessageStartingWith("error reading parameters from")
+ .hasCauseInstanceOf(CoderException.class);
+ }
+
+ @Test
+ public void testParticipantParameterGroup() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json" };
+
+ final ParticipantDcaeCommandLineArguments arguments = new ParticipantDcaeCommandLineArguments();
+ arguments.parse(participantConfigParameters);
+
+ final ParticipantDcaeParameters parGroup = new ParticipantDcaeParameterHandler()
+ .getParameters(arguments);
+ assertTrue(arguments.checkSetConfigurationFilePath());
+ assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, parGroup.getName());
+ }
+
+ @Test
+ public void testParticipantVersion() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-v" };
+ final ParticipantDcaeCommandLineArguments arguments = new ParticipantDcaeCommandLineArguments();
+ assertThat(arguments.parse(participantConfigParameters)).startsWith(
+ "ONAP Tosca defined control loop Participant");
+ }
+
+ @Test
+ public void testParticipantHelp() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-h" };
+ final ParticipantDcaeCommandLineArguments arguments = new ParticipantDcaeCommandLineArguments();
+ assertThat(arguments.parse(participantConfigParameters)).startsWith("usage:");
+ }
+
+ @Test
+ public void testParticipantInvalidOption() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-d" };
+ final ParticipantDcaeCommandLineArguments arguments = new ParticipantDcaeCommandLineArguments();
+ assertThatThrownBy(() -> arguments.parse(participantConfigParameters))
+ .hasMessageStartingWith("invalid command line arguments specified");
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java
new file mode 100644
index 000000000..edb429322
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java
@@ -0,0 +1,90 @@
+/*-
+ * ============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.dcae.main.parameters;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Map;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
+import org.onap.policy.common.parameters.ValidationResult;
+
+/**
+ * Class to perform unit test of {@link ParticipantParameterGroup}.
+ *
+ */
+public class TestParticipantDcaeParameters {
+ CommonTestData commonTestData = new CommonTestData();
+
+ @Test
+ public void testParticipantParameterGroup_Named() {
+ final ParticipantDcaeParameters participantParameters = new ParticipantDcaeParameters("my-name");
+ assertEquals("my-name", participantParameters.getName());
+ }
+
+ @Test
+ public void testParticipantParameterGroup() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.toObject(
+ commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME),
+ ParticipantDcaeParameters.class);
+ final ParticipantIntermediaryParameters participantIntermediaryParameters = participantParameters
+ .getIntermediaryParameters();
+ final TopicParameterGroup topicParameterGroup = participantParameters.getIntermediaryParameters()
+ .getClampControlLoopTopics();
+ final ValidationResult validationResult = participantParameters.validate();
+ assertTrue(validationResult.isValid());
+ assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, participantParameters.getName());
+ assertEquals(CommonTestData.TIME_INTERVAL, participantIntermediaryParameters.getReportingTimeInterval());
+ assertEquals(CommonTestData.DESCRIPTION, participantIntermediaryParameters.getDescription());
+ assertEquals(CommonTestData.TOPIC_PARAMS, topicParameterGroup.getTopicSinks());
+ assertEquals(CommonTestData.TOPIC_PARAMS, topicParameterGroup.getTopicSources());
+ }
+
+ @Test
+ public void testParticipantParameterGroup_EmptyParticipantIntermediaryParameters() {
+ final Map<String, Object> map =
+ commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME);
+ map.replace("intermediaryParameters", commonTestData.getIntermediaryParametersMap(true));
+ final ParticipantDcaeParameters participantParameters =
+ commonTestData.toObject(map, ParticipantDcaeParameters.class);
+ final ValidationResult validationResult = participantParameters.validate();
+ assertNull(validationResult.getResult());
+ }
+
+ @Test
+ public void testParticipantParameterGroup_EmptyTopicParameters() {
+ final Map<String, Object> map =
+ commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME);
+ final Map<String, Object> intermediaryParametersMap = commonTestData.getIntermediaryParametersMap(false);
+ intermediaryParametersMap.put("clampControlLoopTopics", commonTestData.getTopicParametersMap(true));
+ map.replace("intermediaryParameters", intermediaryParametersMap);
+
+ final ParticipantDcaeParameters participantParameters =
+ commonTestData.toObject(map, ParticipantDcaeParameters.class);
+ final ValidationResult validationResult = participantParameters.validate();
+ assertNull(validationResult.getResult());
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java
new file mode 100644
index 000000000..c3cc8b755
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java
@@ -0,0 +1,255 @@
+/*-
+ * ============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.dcae.main.rest;
+
+import java.io.File;
+import java.time.Instant;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.UUID;
+import lombok.Getter;
+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.ParticipantState;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.handler.DcaeProvider;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
+import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+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;
+
+public class TestListenerUtils {
+
+ private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
+ private static final Coder CODER = new StandardCoder();
+ private static final String TOSCA_TEMPLATE_YAML = "examples/controlloop/PMSubscriptionHandling.yaml";
+ static CommonTestData commonTestData = new CommonTestData();
+
+ @Getter
+ private static ParticipantHandler participantHandler;
+
+ /**
+ * Method to initialize participantHandler.
+ */
+ public static void initParticipantHandler() {
+
+ final ParticipantDcaeParameters parameters = commonTestData.toObject(
+ commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME),
+ ParticipantDcaeParameters.class);
+
+ DcaeProvider dcaeProvider = new DcaeProvider(parameters);
+
+ participantHandler = dcaeProvider.getIntermediaryApi().getParticipantHandler();
+ }
+
+ /**
+ * 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 ParticipantStateChange message from the arguments passed.
+ *
+ * @param participantState participant State
+ *
+ * @return ParticipantStateChange message
+ */
+ public static ParticipantStateChange createParticipantStateChangeMsg(final ParticipantState participantState) {
+ final ParticipantStateChange participantStateChangeMsg = new ParticipantStateChange();
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
+ participantId.setName("CDSParticipant0");
+ participantId.setVersion("1.0.0");
+
+ participantStateChangeMsg.setParticipantId(participantId);
+ participantStateChangeMsg.setTimestamp(Instant.now());
+ participantStateChangeMsg.setState(participantState);
+
+ return participantStateChangeMsg;
+ }
+
+ /**
+ * Method to create ControlLoopStateChange message from the arguments passed.
+ *
+ * @param controlLoopOrderedState controlLoopOrderedState
+ *
+ * @return ParticipantControlLoopStateChange message
+ */
+ public static ParticipantControlLoopStateChange createControlLoopStateChangeMsg(
+ final ControlLoopOrderedState controlLoopOrderedState) {
+ final ParticipantControlLoopStateChange participantClStateChangeMsg = new ParticipantControlLoopStateChange();
+
+ ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier();
+ controlLoopId.setName("PMSHInstance0");
+ controlLoopId.setVersion("1.0.0");
+
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
+ participantId.setName("CDSParticipant0");
+ participantId.setVersion("1.0.0");
+
+ participantClStateChangeMsg.setControlLoopId(controlLoopId);
+ participantClStateChangeMsg.setParticipantId(participantId);
+ participantClStateChangeMsg.setTimestamp(Instant.now());
+ participantClStateChangeMsg.setOrderedState(controlLoopOrderedState);
+
+ return participantClStateChangeMsg;
+ }
+
+ /**
+ * Method to create ControlLoopUpdateMsg.
+ *
+ * @return ParticipantControlLoopUpdate message
+ */
+ public static ParticipantControlLoopUpdate createControlLoopUpdateMsg() {
+ final ParticipantControlLoopUpdate clUpdateMsg = new ParticipantControlLoopUpdate();
+ ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier();
+ controlLoopId.setName("PMSHInstance0");
+ controlLoopId.setVersion("1.0.0");
+
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
+ participantId.setName("CDSParticipant0");
+ participantId.setVersion("1.0.0");
+
+ clUpdateMsg.setControlLoopId(controlLoopId);
+ clUpdateMsg.setParticipantId(participantId);
+
+ 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");
+ controlLoop.setDefinition(controlLoopId);
+ clUpdateMsg.setControlLoop(controlLoop);
+ clUpdateMsg.setControlLoopDefinition(toscaServiceTemplate);
+
+ return clUpdateMsg;
+ }
+
+ /**
+ * Method to create ParticipantHealthCheck message.
+ *
+ * @return ParticipantHealthCheck message
+ */
+ public static ParticipantHealthCheck createParticipantHealthCheckMsg() {
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
+ participantId.setName("CDSParticipant0");
+ participantId.setVersion("1.0.0");
+
+ ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier();
+ controlLoopId.setName("PMSHInstance0");
+ controlLoopId.setVersion("1.0.0");
+
+ final ParticipantHealthCheck participantHealthCheckMsg = new ParticipantHealthCheck();
+ participantHealthCheckMsg.setParticipantId(participantId);
+ participantHealthCheckMsg.setControlLoopId(controlLoopId);
+ participantHealthCheckMsg.setTimestamp(Instant.now());
+ participantHealthCheckMsg.setState(ParticipantState.PASSIVE);
+
+ return participantHealthCheckMsg;
+ }
+
+ /**
+ * Method to create ParticipantControlLoopUpdate using the arguments passed.
+ *
+ * @param jsonFilePath the path of the controlloop content
+ *
+ * @return ParticipantControlLoopUpdate message
+ * @throws CoderException exception while reading the file to object
+ */
+ public static ParticipantControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath)
+ throws CoderException {
+ ParticipantControlLoopUpdate participantControlLoopUpdateMsg =
+ CODER.decode(new File(jsonFilePath), ParticipantControlLoopUpdate.class);
+ return participantControlLoopUpdateMsg;
+ }
+
+ private static ToscaServiceTemplate testControlLoopRead() {
+ return testControlLoopYamlSerialization(TOSCA_TEMPLATE_YAML);
+ }
+
+ private static ToscaServiceTemplate testControlLoopYamlSerialization(String controlLoopFilePath) {
+ String controlLoopString = ResourceUtils.getResourceAsString(controlLoopFilePath);
+ ToscaServiceTemplate serviceTemplate = yamlTranslator.fromYaml(controlLoopString, ToscaServiceTemplate.class);
+ return serviceTemplate;
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestMain.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestMain.java
new file mode 100644
index 000000000..f779f3a57
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestMain.java
@@ -0,0 +1,151 @@
+/*-
+ * ============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.dcae.main.startstop;
+
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.common.ControlLoopConstants;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.Main;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.ParticipantDcaeActivator;
+import org.onap.policy.common.utils.resources.MessageConstants;
+import org.onap.policy.common.utils.services.Registry;
+
+/**
+ * Class to perform unit test of {@link Main}}.
+ */
+public class TestMain {
+
+ /**
+ * Set up.
+ */
+ @BeforeClass
+ public static void setUp() {
+ Registry.newRegistry();
+ }
+
+ /**
+ * Shuts "main" down.
+ *
+ * @throws Exception if an error occurs
+ */
+ @AfterClass
+ public static void tearDown() throws Exception {
+ // shut down activator
+ final ParticipantDcaeActivator activator =
+ Registry.getOrDefault(ControlLoopConstants.REG_CLRUNTIME_ACTIVATOR,
+ ParticipantDcaeActivator.class, null);
+ if (activator != null && activator.isAlive()) {
+ activator.shutdown();
+ }
+ }
+
+ @Test
+ public void testMain_Help() {
+ final String[] configParameters = {"-h"};
+ Main main = new Main(configParameters);
+ assertFalse(main.isRunning());
+ }
+
+ @Test
+ public void testMain_Version() {
+ final String[] configParameters = {"-v"};
+ Main main = new Main(configParameters);
+ assertFalse(main.isRunning());
+ }
+
+ @Test
+ public void testMain_Valid() {
+ final String[] configParameters = {"-c", "src/test/resources/parameters/TestParameters.json"};
+ Main main = new Main(configParameters);
+ assertTrue(main.isRunning());
+
+ // ensure items were added to the registry
+ assertNotNull(Registry.get(ControlLoopConstants.REG_CLRUNTIME_ACTIVATOR, ParticipantDcaeActivator.class));
+
+ assertThatCode(() -> main.shutdown()).doesNotThrowAnyException();
+
+ assertFalse(main.isRunning());
+ }
+
+ @Test
+ public void testMain_NoParameter() {
+ assertThatConfigParameterThrownException(new String[] {});
+ }
+
+ @Test
+ public void testMain_FilePathNotDefined() {
+ assertThatConfigParameterThrownException(new String[] {"-c"});
+ }
+
+ @Test
+ public void testMain_TooManyCommand() {
+ assertThatConfigParameterThrownException(new String[] {"-h", "d"});
+ }
+
+ @Test
+ public void testMain_WrongParameter() {
+ assertThatConfigParameterThrownException(new String[] {"-d"});
+ }
+
+ private void assertThatConfigParameterThrownException(final String[] configParameters) {
+ assertThatThrownBy(() -> Main.main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class)
+ .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP));
+ }
+
+ @Test
+ public void testParticipant_NoFileWithThisName() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/NoFileWithThisName.json");
+ }
+
+ @Test
+ public void testParticipant_NotValidFile() {
+ assertThatConfigFileThrownException("src/test/resources/parameters");
+ }
+
+ @Test
+ public void testParticipant_NoParameters() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/NoParameters.json");
+ }
+
+ @Test
+ public void testParticipant_InvalidParameters() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/InvalidParameters.json");
+ }
+
+ @Test
+ public void testParticipant_WrongJsonFormat() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/Unreadable.json");
+ }
+
+ private void assertThatConfigFileThrownException(final String configFilePath) {
+ final String[] configParameters = new String[] {"-c", configFilePath};
+ assertThatThrownBy(() -> new Main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class)
+ .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP));
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestParticipantDcaeActivator.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestParticipantDcaeActivator.java
new file mode 100644
index 000000000..1903868e2
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestParticipantDcaeActivator.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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.dcae.main.startstop;
+
+import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameterHandler;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.ParticipantDcaeActivator;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.ParticipantDcaeCommandLineArguments;
+import org.onap.policy.common.utils.services.Registry;
+
+/**
+ * Class to perform unit test of {@link ParticipantDcaeActivator}}.
+ *
+ */
+public class TestParticipantDcaeActivator {
+
+ private static ParticipantDcaeActivator activator;
+
+ /**
+ * Initializes an activator.
+ *
+ * @throws Exception if an error occurs
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ Registry.newRegistry();
+ final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json"};
+ final ParticipantDcaeCommandLineArguments arguments =
+ new ParticipantDcaeCommandLineArguments(participantConfigParameters);
+ final ParticipantDcaeParameters parGroup =
+ new ParticipantDcaeParameterHandler().getParameters(arguments);
+ activator = new ParticipantDcaeActivator(parGroup);
+ }
+
+ /**
+ * Method for cleanup after each test.
+ *
+ * @throws Exception if an error occurs
+ */
+ @AfterClass
+ public static void teardown() throws Exception {
+ // shut down activator
+ if (activator != null && activator.isAlive()) {
+ activator.shutdown();
+ }
+ }
+
+ @Test
+ public void testParticipantActivator() {
+ activator.start();
+ assertTrue(activator.isAlive());
+ assertTrue(activator.getParameters().isValid());
+ assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, activator.getParameters().getName());
+
+ // repeat - should throw an exception
+ assertThatIllegalStateException().isThrownBy(() -> activator.start());
+ assertTrue(activator.isAlive());
+ assertTrue(activator.getParameters().isValid());
+
+ activator.shutdown();
+ assertFalse(activator.isAlive());
+
+ // repeat - should throw an exception
+ assertThatIllegalStateException().isThrownBy(() -> activator.shutdown());
+ assertFalse(activator.isAlive());
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json
new file mode 100644
index 000000000..1035ccb67
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json
@@ -0,0 +1,3 @@
+{
+ "name": "
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json
new file mode 100644
index 000000000..1ee2955b9
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json
@@ -0,0 +1,61 @@
+{
+ "name": "ControlLoopParticipantGroup",
+ "restServerParameters": {
+ "host": "0.0.0.0",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "https": false,
+ "aaf": false
+ },
+ "intermediaryParameters": {
+ "name": "Participant parameters",
+ "reportingTimeInterval": 120000,
+ "description": "Participant Description",
+ "participantId": {
+ "name": "DCAEParticipant0",
+ "version": "1.0.0"
+ },
+ "participantType": {
+ "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "version": "2.3.4"
+ },
+ "clampControlLoopTopics": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json
new file mode 100644
index 000000000..7a73a41bf
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json
@@ -0,0 +1,2 @@
+{
+} \ No newline at end of file
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestCLParams.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestCLParams.json
new file mode 100644
index 000000000..a4258622d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestCLParams.json
@@ -0,0 +1,160 @@
+tosca_definitions_version: tosca_simple_yaml_1_3
+data_types:
+ onap.datatypes.ToscaConceptIdentifier:
+ derived_from: tosca.datatypes.Root
+ properties:
+ name:
+ type: string
+ required: true
+ version:
+ type: string
+ required: true
+node_types:
+ org.onap.policy.clamp.controlloop.Participant:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ org.onap.policy.clamp.controlloop.ControlLoopElement:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ participant_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.controlloop.ControlLoop:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ elements:
+ type: list
+ required: true
+ entry_schema:
+ type: onap.datatypes.ToscaConceptIdentifier
+ org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ properties:
+ dcae_blueprint_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ properties:
+ policy_type_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ properties:
+ cds_blueprint_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+topology_template:
+ node_templates:
+ org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:
+ version: 2.3.4
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.policy.controlloop.MonitoringPolicyControlLoopParticipant:
+ version: 2.3.1
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.policy.controlloop.OperationalPolicyControlLoopParticipant:
+ version: 3.2.1
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant:
+ version: 2.2.1
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.domain.pmsh.PMSH_DCAEMicroservice:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ version: 2.3.4
+ dcae_blueprint_id:
+ name: org.onap.dcae.blueprints.PMSHBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.policy.controlloop.MonitoringPolicyControlLoopParticipant
+ version: 2.3.1
+ policy_type_id:
+ name: onap.policies.monitoring.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the operational policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.policy.controlloop.OperationalPolicyControlLoopParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.operational.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.ControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for CDS for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_Id:
+ name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
+ version: 3.2.1
+ cds_blueprint_id:
+ name: org.onap.ccsdk.cds.PMSHCdsBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSHControlLoopDefinition:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.ControlLoop
+ type_version: 1.0.0
+ description: Control loop for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ elements:
+ - name: org.onap.domain.pmsh.PMSH_DCAEMicroservice
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement
+ version: 1.2.3
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json
new file mode 100644
index 000000000..789fc7bbd
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json
@@ -0,0 +1,71 @@
+{
+ "name": "ControlLoopParticipantGroup",
+ "clampClientParameters": {
+ "name": "Clamp",
+ "host": "0.0.0.0",
+ "port": 8443,
+ "userName": "admin",
+ "password": "password",
+ "https": true,
+ "aaf": false
+ },
+ "consulClientParameters": {
+ "name": "Clamp",
+ "host": "consul",
+ "port": 31321,
+ "userName": "admin",
+ "password": "password",
+ "https": false,
+ "aaf": false
+ },
+ "intermediaryParameters": {
+ "name": "Participant parameters",
+ "reportingTimeInterval": 120000,
+ "description": "Participant Description",
+ "participantId": {
+ "name": "DCAEParticipant0",
+ "version": "1.0.0"
+ },
+ "participantType": {
+ "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "version": "2.3.4"
+ },
+ "clampControlLoopTopics": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json
new file mode 100644
index 000000000..789fc7bbd
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json
@@ -0,0 +1,71 @@
+{
+ "name": "ControlLoopParticipantGroup",
+ "clampClientParameters": {
+ "name": "Clamp",
+ "host": "0.0.0.0",
+ "port": 8443,
+ "userName": "admin",
+ "password": "password",
+ "https": true,
+ "aaf": false
+ },
+ "consulClientParameters": {
+ "name": "Clamp",
+ "host": "consul",
+ "port": 31321,
+ "userName": "admin",
+ "password": "password",
+ "https": false,
+ "aaf": false
+ },
+ "intermediaryParameters": {
+ "name": "Participant parameters",
+ "reportingTimeInterval": 120000,
+ "description": "Participant Description",
+ "participantId": {
+ "name": "DCAEParticipant0",
+ "version": "1.0.0"
+ },
+ "participantType": {
+ "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "version": "2.3.4"
+ },
+ "clampControlLoopTopics": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json
new file mode 100644
index 000000000..581ce8f4f
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json
@@ -0,0 +1,81 @@
+{
+ "name": "ControlLoopRuntimeGroup",
+ "restServerParameters": {
+ "host": "0.0.0.0",
+ "port": ${port},
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "https": false,
+ "aaf": false
+ },
+ "participantParameters": {
+ "heartBeatMs": 120000,
+ "updateParameters": {
+ "maxRetryCount": 1,
+ "maxWaitMs": 30000
+ },
+ "stateChangeParameters": {
+ "maxRetryCount": 1,
+ "maxWaitMs": 30000
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "${dbName}",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ },
+ "topicParameterGroup": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ },
+ "healthCheckRestClientParameters": [
+ {
+ "clientName": "api",
+ "hostname": "policy-api",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "policy/api/v1/healthcheck"
+ },
+ {
+ "clientName": "distribution",
+ "hostname": "policy-distribution",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "healthcheck"
+ }
+ ]
+}
+
+
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/logback-test.xml b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/logback-test.xml
new file mode 100644
index 000000000..cf6b89eb9
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/logback-test.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+-->
+
+<configuration>
+
+ <contextName>Participant</contextName>
+ <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
+ <property name="LOG_DIR" value="${java.io.tmpdir}/clamp_logging/" />
+
+ <!-- USE FOR STD OUT ONLY -->
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
+ </encoder>
+ </appender>
+
+ <root level="info">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <logger name="org.onap.policy.clamp.controlloop.participant" level="trace" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+</configuration>
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml b/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml
new file mode 100644
index 000000000..01f825fc9
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml
@@ -0,0 +1,452 @@
+tosca_definitions_version: tosca_simple_yaml_1_3
+capability_types:
+ org.onap.EventProducer:
+ properties:
+ carrier_protocol_type:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ data_format:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - JSON
+ - YAML
+ - JMS
+ event_format:
+ type: string
+ required: true
+ event_format_version:
+ type: string
+ required: false
+ 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.'
+ version: 0.0.1
+ derived_from: tosca.capabilities.Root
+ org.onap.EventConsumer:
+ properties:
+ responding_capability:
+ type: string
+ required: false
+ carrier_protocol_type:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ data_format:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - JSON
+ - YAML
+ - JMS
+ - all valid values should be added here
+ event_format:
+ type: string
+ description: 'examples for event_format: Ves_specification, LinkUp, VnfConfigured,
+ etc.'
+ required: true
+ event_format_version:
+ type: string
+ description: 'examples for event_format_version: 5.28.4, 7.30.1, etc.'
+ required: false
+ 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.'
+ version: 0.0.1
+ derived_from: tosca.capabilities.Root
+node_types:
+ org.onap.DynamicConfig:
+ properties:
+ application_name:
+ type: string
+ description: Value used to tie the config to an application ? should we be
+ using a relationship here instead?
+ required: true
+ application_version:
+ type: string
+ required: true
+ application_provider:
+ type: string
+ required: false
+ data_types:
+ type: object
+ required: false
+ schema:
+ type: object
+ required: false
+ version: 0.0.1
+ derived_from: tosca.nodes.Root
+ org.onap.APP:
+ 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
+ required: false
+ monitoring_policy:
+ type: string
+ description: A reference to the monitoring policy
+ required: false
+ requirements:
+ - receive:
+ capability: org.onap.EventProducer
+ relationship: org.onap.PropagateEvent
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ - send:
+ capability: org.onap.EventConsumer
+ relationship: org.onap.PropagateEvent
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ version: 0.0.1
+ derived_from: tosca.nodes.Root
+ org.onap.EventRelay:
+ properties:
+ event_format:
+ type: string
+ description: 'examples for event_format: Ves_specification, etc.'
+ required: true
+ event_format_version:
+ type: string
+ description: 'examples for event_format_version: 5.28.4, 7.30.1, etc.'
+ required: true
+ 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
+ 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}'
+ required: true
+ key_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ - all valid values should be added here
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ - all valid values should be added here
+ supported_data_formats:
+ type: map
+ 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 }'
+ required: true
+ 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:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ - send:
+ capability: org.onap.EventConsumer
+ relationship: org.onap.PropagateEvent
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ version: 0.0.1
+ derived_from: tosca.nodes.Root
+relationship_types:
+ org.onap.PropagateEvent:
+ properties:
+ config_keys:
+ type: list
+ description: The relationship type used on requirements to org.onap.EventProducer
+ and org.onap.EventConsumer capabilities. 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.
+ required: false
+ entry_schema:
+ type: string
+ version: 0.0.1
+ derived_from: tosca.relationships.Root
+topology_template:
+ inputs:
+ pm_subscription_topic:
+ type: string
+ pm_subscription_response_topic:
+ type: string
+ pm_subscription_handler_blueprint_id:
+ type: string
+ pm_subscription_operational_policy_id:
+ type: string
+ pm_subscription_cds_blueprint_id:
+ type: string
+ enable_tls:
+ type: string
+ node_templates:
+ org.onap.PM_Subscription_Handler:
+ type: org.onap.APP
+ properties:
+ application_name: PM Subscription Handler
+ provider: Ericsson
+ application_version: 1.0.0
+ artifact_id:
+ get_input: pm_subscription_handler_blueprint_id
+ description: Is this a reference to the DCAE Cloudify Blueprint that is
+ already stored(or will be stored before CL configuration & instatiation)
+ in DCAE Inventory?
+ artifact_config:
+ enable_tls:
+ get_input: enable_tls
+ pmsh_publish_topic_name:
+ get_input: pm_subscription_topic
+ capabilities:
+ pm-subscription-event-publisher:
+ properties:
+ carrier_protocol_type: DMAAP_message_router
+ data_format: JSON
+ event_format: pm-subscription-event-format
+ event_format_version: 1.0.0
+ attributes:
+ type: org.onap.EventProducer
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ pm-subscription-event-receiver:
+ properties:
+ carrier_protocol_type: DMAAP_message_router
+ data_format: JSON
+ event_format: pm-subscription-event-response-format
+ event_format_version: 1.0.0
+ relationships:
+ - type: tosca.relationships.DependsOn
+ - description: any ideas on a better realtionship ? or is it better to
+ just use the root realtionship ?
+ - target: org.onap.PM_Monitoring_Policy
+ attributes:
+ type: org.onap.EventConsumer
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ version: 0.0.0
+ org.onap.PM_Monitoring_Policy:
+ type: org.onap.DynamicConfig
+ properties:
+ application_name: PM Subscription Handler
+ application_version: 1.0.0
+ provider: Ericsson
+ data_types:
+ measurementType:
+ type: string
+ DN:
+ type: string
+ nfFilter:
+ properties:
+ nfNames:
+ type: list
+ entry_schema: string
+ modelInvariantIDs:
+ type: list
+ entry_schema:
+ type: string
+ modelVersionIDs:
+ type: list
+ entry_schema:
+ type: string
+ measurementGroup:
+ properties:
+ masurementTypes:
+ type: list
+ entry_schema:
+ type: measurementType
+ managedObjectDNsBasic:
+ type: list
+ entry_schema:
+ type: DN
+ schema:
+ subscription:
+ subscriptionName:
+ type: string
+ required: true
+ administrativeState:
+ type: string
+ required: true
+ filebasedGP:
+ type: integer
+ required: true
+ fileLocation:
+ type: string
+ required: true
+ nfFilter:
+ type: nfFilter
+ measurementGroups:
+ type: list
+ entry_schema:
+ type: measurementGroup
+ version: 0.0.0
+ description: Should I be showing a dependency between PM Subscription Handler
+ and the PM Monitoring Policy
+ org.onap.PM_Policy:
+ type: org.onap.APP
+ properties:
+ application_name: PM Subscription Operational Policy
+ provider: Ericsson
+ application_version: 1.0.0
+ artifact_id:
+ get_input: pm_subscription_operational_policy_id
+ artifact_config: NOT_DEFINED
+ requirements:
+ - receive_0:
+ capability: pm-subscription-event-publisher
+ node: org.onap.PM_Subscription_Handler
+ relationship: NOT_DEFINED
+ properties:
+ config_keys:
+ - topic_name:
+ get_input: pm_subscription_topic
+ version: 0.0.0
+ - send_0:
+ capability: cds-rest-receive
+ node: org.onap.CDS
+ version: 0.0.0
+ - receive_1:
+ capability: cds-rest-response
+ node: org.onap.CDS
+ version: 0.0.0
+ - send_1:
+ capability: pm-subscription-event-receiver
+ node: org.onap.PM_Subscription_Handler
+ relationship: NOT_DEFINED
+ properties:
+ config_keys:
+ - topic_name:
+ get_input: pm_subscription_response_topic
+ version: 0.0.0
+ capabilities:
+ pm-subscription-response-event-publisher:
+ properties:
+ type: org.onap.EventProducer
+ carrier_protocol_type: DMAAP_message_router
+ data_format: JSON
+ event_format: pm-subscription-event-response-format
+ event_format_version: 1.0.0
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ version: 0.0.0
+ org.onap.PM_CDS_Blueprint:
+ type: org.onap.APP
+ properties:
+ application_name: PM Subscription CDS Blueprint
+ provider: Ericsson
+ application_version: 1.0.0
+ artifact_id:
+ get_input: pm_subscription_cds_blueprint_id
+ capabilities:
+ cds-rest-receive:
+ properties:
+ type: org.onap.EventConsumer
+ protocol_type: REST
+ data_format: JSON
+ event_format: cds_action_format
+ event_format_version: 1.0.0
+ responding_capability: cds-rest-response
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ cds-rest-response:
+ properties:
+ type: org.onap.EventProducer
+ protocol_type: REST
+ data_format: JSON
+ event_format: cds_action_response_format
+ event_format_version: 1.0.0
+ occurrences:
+ - 0.0
+ version: 0.0.0
+ version: 0.0.0
+ org.onap.controlloop0:
+ type: org.onap.APP
+ properties:
+ application_name: Test Control Loop
+ provider: Ericsson
+ application_version: 1.0.0
+ status: NOT_DEPLOYED
+ version: 0.0.0
+version: 0.0.0
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/status.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/status.json
new file mode 100644
index 000000000..143ef635d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/status.json
@@ -0,0 +1,3918 @@
+{
+ "name": "pmsh_loop",
+ "globalPropertiesJson": {
+ "dcaeDeployParameters": {
+ "uniqueBlueprintParameters": {
+ "tag_version": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pmsh:1.1.2",
+ "replicas": 1,
+ "operational_policy_name": "pmsh-operational-policy",
+ "control_loop_name": "pmsh-control-loop",
+ "pmsh_publish_topic_name": "unauthenticated.DCAE_CL_OUTPUT",
+ "policy_feedback_topic_name": "unauthenticated.PMSH_CL_INPUT",
+ "aai_notification_topic_name": "AAI-EVENT",
+ "publisher_client_role": "org.onap.dcae.pmPublisher",
+ "subscriber_client_role": "org.onap.dcae.pmSubscriber",
+ "dcae_location": "san-francisco",
+ "cpu_limit": "1000m",
+ "cpu_request": "1000m",
+ "memory_limit": "1024Mi",
+ "memory_request": "1024Mi",
+ "pgaas_cluster_name": "dcae-pg-primary.onap",
+ "enable_tls": true,
+ "protocol": "https",
+ "policy_model_id": "onap.policies.monitoring.dcae-pm-subscription-handler",
+ "policy_id": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh"
+ }
+ }
+ },
+ "modelService": {
+ "serviceDetails": {
+ "serviceType": "",
+ "serviceRole": "",
+ "description": "vLBMS",
+ "type": "Service",
+ "instantiationType": "A-la-carte",
+ "namingPolicy": "",
+ "serviceEcompNaming": "true",
+ "environmentContext": "General_Revenue-Bearing",
+ "name": "vLoadBalancerMS",
+ "invariantUUID": "30ec5b59-4799-48d8-ac5f-1058a6b0e48f",
+ "ecompGeneratedNaming": "true",
+ "UUID": "63cac700-ab9a-4115-a74f-7eac85e3fce0",
+ "category": "Network L4+"
+ },
+ "resourceDetails": {
+ "CP": {},
+ "VL": {},
+ "VF": {
+ "vLoadBalancerMS 0": {
+ "resourceVendor": "Test",
+ "name": "vLoadBalancerMS",
+ "resourceVendorModelNumber": "",
+ "description": "vLBMS",
+ "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506",
+ "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6",
+ "type": "VF",
+ "category": "Application L4+",
+ "subcategory": "Load Balancer",
+ "version": "1.0",
+ "customizationUUID": "465246dc-7748-45f4-a013-308d92922552",
+ "resourceVendorRelease": "1.0",
+ "controllerProperties": {
+ "sdnc_model_name": "baseconfiguration",
+ "sdnc_model_version": "1.0.0",
+ "workflows": {
+ "resource-assignment": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "activate": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "activate-restconf": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "activate-cli": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "assign-activate": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "imperative-test-wf": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "CR": {},
+ "VFC": {},
+ "PNF": {},
+ "Service": {},
+ "CVFC": {},
+ "Service Proxy": {},
+ "Configuration": {},
+ "AllottedResource": {},
+ "VFModule": {
+ "Vloadbalancerms..vpkg..module-1": {
+ "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vpkg..module-1",
+ "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc",
+ "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vpkg",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ },
+ "Vloadbalancerms..vdns..module-3": {
+ "vfModuleModelInvariantUUID": "4c10ba9b-f88f-415e-9de3-5d33336047fa",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vdns..module-3",
+ "vfModuleModelUUID": "4fa73b49-8a6c-493e-816b-eb401567b720",
+ "vfModuleModelCustomizationUUID": "bafcdab0-801d-4d81-9ead-f464640a38b1",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vdns",
+ "max_vf_module_instances": 50,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ },
+ "Vloadbalancerms..base_template..module-0": {
+ "vfModuleModelInvariantUUID": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..base_template..module-0",
+ "vfModuleModelUUID": "63734409-f745-4e4d-a38b-131638a0edce",
+ "vfModuleModelCustomizationUUID": "86baddea-c730-4fb8-9410-cd2e17fd7f27",
+ "min_vf_module_instances": 1,
+ "vf_module_label": "base_template",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Base",
+ "isBase": true,
+ "initial_count": 1,
+ "volume_group": false
+ },
+ "Vloadbalancerms..vlb..module-2": {
+ "vfModuleModelInvariantUUID": "a772a1f4-0064-412c-833d-4749b15828dd",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vlb..module-2",
+ "vfModuleModelUUID": "0f5c3f6a-650a-4303-abb6-fff3e573a07a",
+ "vfModuleModelCustomizationUUID": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vlb",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ }
+ }
+ }
+ },
+ "lastComputedState": "DESIGN",
+ "components": {
+ "POLICY": {
+ "componentState": {
+ "stateName": "NOT_SENT",
+ "description": "The policies defined have NOT yet been created on the policy engine"
+ }
+ },
+ "DCAE": {
+ "componentState": {
+ "stateName": "${status}",
+ "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
+ }
+ }
+ },
+ "operationalPolicies": [],
+ "microServicePolicies": [
+ {
+ "name": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh",
+ "shared": false,
+ "jsonRepresentation": {
+ "title": "onap.policies.monitoring.dcae-pm-subscription-handler",
+ "type": "object",
+ "required": [],
+ "properties": {
+ "pmsh_policy": {
+ "title": "onap.datatypes.monitoring.subscription",
+ "type": "object",
+ "required": [
+ "measurementGroups",
+ "fileBasedGP",
+ "fileLocation",
+ "subscriptionName",
+ "administrativeState",
+ "nfFilter"
+ ],
+ "properties": {
+ "measurementGroups": {
+ "type": "array",
+ "description": "Measurement Groups",
+ "items": {
+ "title": "onap.datatypes.monitoring.measurementGroups",
+ "type": "object",
+ "required": [
+ "measurementGroup"
+ ],
+ "properties": {
+ "measurementGroup": {
+ "type": "object",
+ "description": "Measurement Group",
+ "properties": {
+ "onap.datatypes.monitoring.measurementGroup": {
+ "title": "onap.datatypes.monitoring.measurementGroup",
+ "type": "object",
+ "required": [
+ "measurementTypes",
+ "managedObjectDNsBasic"
+ ],
+ "properties": {
+ "measurementTypes": {
+ "type": "array",
+ "description": "List of measurement types",
+ "items": {
+ "title": "onap.datatypes.monitoring.measurementTypes",
+ "type": "object",
+ "required": [
+ "measurementType"
+ ],
+ "properties": {
+ "measurementType": {
+ "type": "object",
+ "description": "Measurement type object",
+ "properties": {
+ "onap.datatypes.monitoring.measurementType": {
+ "title": "onap.datatypes.monitoring.measurementType",
+ "type": "object",
+ "required": [
+ "measurementType"
+ ],
+ "properties": {
+ "measurementType": {
+ "type": "string",
+ "description": "Measurement type"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "format": "tabs-top"
+ },
+ "managedObjectDNsBasic": {
+ "type": "array",
+ "description": "List of managed object distinguished names",
+ "items": {
+ "title": "onap.datatypes.monitoring.managedObjectDNsBasics",
+ "type": "object",
+ "required": [
+ "managedObjectDNsBasic"
+ ],
+ "properties": {
+ "managedObjectDNsBasic": {
+ "type": "object",
+ "description": "Managed object distinguished name object",
+ "properties": {
+ "onap.datatypes.monitoring.managedObjectDNsBasic": {
+ "title": "onap.datatypes.monitoring.managedObjectDNsBasic",
+ "type": "object",
+ "required": [
+ "DN"
+ ],
+ "properties": {
+ "DN": {
+ "type": "string",
+ "description": "Managed object distinguished name"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "format": "tabs-top"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "format": "tabs-top"
+ },
+ "fileBasedGP": {
+ "type": "integer",
+ "description": "File based granularity period"
+ },
+ "fileLocation": {
+ "type": "string",
+ "description": "ROP file location"
+ },
+ "subscriptionName": {
+ "type": "string",
+ "description": "Name of the subscription"
+ },
+ "administrativeState": {
+ "type": "string",
+ "description": "State of the subscription",
+ "enum": [
+ "LOCKED",
+ "UNLOCKED"
+ ]
+ },
+ "nfFilter": {
+ "type": "object",
+ "description": "Network function filter",
+ "properties": {
+ "onap.datatypes.monitoring.nfFilter": {
+ "title": "onap.datatypes.monitoring.nfFilter",
+ "type": "object",
+ "required": [
+ "modelVersionIDs",
+ "modelInvariantIDs",
+ "modelNames",
+ "nfNames"
+ ],
+ "properties": {
+ "modelVersionIDs": {
+ "type": "array",
+ "description": "List of model version IDs",
+ "items": {
+ "type": "string"
+ },
+ "format": "tabs-top"
+ },
+ "modelInvariantIDs": {
+ "type": "array",
+ "description": "List of model invariant IDs",
+ "items": {
+ "type": "string"
+ },
+ "format": "tabs-top"
+ },
+ "modelNames": {
+ "type": "array",
+ "description": "List of model names",
+ "items": {
+ "type": "string"
+ },
+ "format": "tabs-top"
+ },
+ "nfNames": {
+ "type": "array",
+ "description": "List of network functions",
+ "items": {
+ "type": "string"
+ },
+ "format": "tabs-top"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "loopElementModel": {
+ "name": "onap.policies.monitoring.dcae-pm-subscription-handler",
+ "loopElementType": "MICRO_SERVICE_TYPE",
+ "policyModels": [
+ {
+ "policyModelType": "onap.policies.monitoring.dcae-pm-subscription-handler",
+ "version": "1.0.0",
+ "policyAcronym": "dcae-pm-subscription-handler",
+ "policyPdpGroup": {
+ "supportedPdpGroups": [
+ {
+ "ControlLoopGroup": [
+ "apex",
+ "xacml"
+ ]
+ },
+ {
+ "defaultGroup": [
+ "xacml"
+ ]
+ }
+ ]
+ },
+ "createdDate": "2021-03-30T09:55:52.261232Z",
+ "updatedDate": "2021-03-30T09:56:17.502284Z",
+ "updatedBy": "Not found",
+ "createdBy": "Not found"
+ }
+ ],
+ "createdDate": "2021-03-30T08:48:21Z",
+ "updatedDate": "2021-03-30T08:48:21Z",
+ "updatedBy": "Not found",
+ "createdBy": "Not found"
+ },
+ "policyModel": {
+ "policyModelType": "onap.policies.monitoring.dcae-pm-subscription-handler",
+ "version": "1.0.0",
+ "policyAcronym": "dcae-pm-subscription-handler",
+ "policyPdpGroup": {
+ "supportedPdpGroups": [
+ {
+ "ControlLoopGroup": [
+ "apex",
+ "xacml"
+ ]
+ },
+ {
+ "defaultGroup": [
+ "xacml"
+ ]
+ }
+ ]
+ },
+ "createdDate": "2021-03-30T09:55:52.261232Z",
+ "updatedDate": "2021-03-30T09:56:17.502284Z",
+ "updatedBy": "Not found",
+ "createdBy": "Not found"
+ },
+ "createdDate": "2021-03-30T13:07:07.960379Z",
+ "updatedDate": "2021-03-30T13:07:07.960379Z",
+ "updatedBy": "admin",
+ "createdBy": "admin"
+ }
+ ],
+ "loopLogs": [
+ {
+ "id": 478,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-05-07T09:32:44Z"
+ },
+ {
+ "id": 477,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-05-07T09:32:44Z"
+ },
+ {
+ "id": 476,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-05-07T09:32:43Z"
+ },
+ {
+ "id": 475,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-05-07T09:32:43Z"
+ },
+ {
+ "id": 474,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-05-07T09:32:43Z"
+ },
+ {
+ "id": 473,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-05-07T09:32:43Z"
+ },
+ {
+ "id": 472,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-05-07T09:32:39Z"
+ },
+ {
+ "id": 471,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-05-07T09:32:39Z"
+ },
+ {
+ "id": 470,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-05-07T09:32:35Z"
+ },
+ {
+ "id": 451,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-07T13:34:30Z"
+ },
+ {
+ "id": 450,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-07T13:34:30Z"
+ },
+ {
+ "id": 449,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-07T13:34:30Z"
+ },
+ {
+ "id": 448,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-07T13:34:30Z"
+ },
+ {
+ "id": 447,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-07T13:34:30Z"
+ },
+ {
+ "id": 446,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-07T13:34:30Z"
+ },
+ {
+ "id": 445,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-07T13:34:26Z"
+ },
+ {
+ "id": 444,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-07T13:34:26Z"
+ },
+ {
+ "id": 443,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-07T13:34:22Z"
+ },
+ {
+ "id": 442,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "PDP Group remove ALL status - : ",
+ "logInstant": "2021-04-07T08:32:06Z"
+ },
+ {
+ "id": 441,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "STOP request",
+ "logInstant": "2021-04-07T08:32:02Z"
+ },
+ {
+ "id": 440,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-07T08:23:46Z"
+ },
+ {
+ "id": 439,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-07T08:23:46Z"
+ },
+ {
+ "id": 438,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-07T08:23:46Z"
+ },
+ {
+ "id": 437,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-07T08:23:46Z"
+ },
+ {
+ "id": 436,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-07T08:23:46Z"
+ },
+ {
+ "id": 435,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-07T08:23:46Z"
+ },
+ {
+ "id": 434,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-07T08:23:42Z"
+ },
+ {
+ "id": 433,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-07T08:23:41Z"
+ },
+ {
+ "id": 432,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-07T08:23:37Z"
+ },
+ {
+ "id": 431,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-06T15:06:27Z"
+ },
+ {
+ "id": 430,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-06T15:06:27Z"
+ },
+ {
+ "id": 429,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-06T15:06:27Z"
+ },
+ {
+ "id": 428,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-06T15:06:27Z"
+ },
+ {
+ "id": 427,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-06T15:06:27Z"
+ },
+ {
+ "id": 426,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T15:06:27Z"
+ },
+ {
+ "id": 425,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-06T15:06:22Z"
+ },
+ {
+ "id": 424,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T15:06:22Z"
+ },
+ {
+ "id": 423,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-06T15:06:18Z"
+ },
+ {
+ "id": 422,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "PDP Group remove ALL status - : ",
+ "logInstant": "2021-04-06T15:06:04Z"
+ },
+ {
+ "id": 421,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "STOP request",
+ "logInstant": "2021-04-06T15:06:00Z"
+ },
+ {
+ "id": 420,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-06T15:05:28Z"
+ },
+ {
+ "id": 419,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-06T15:05:28Z"
+ },
+ {
+ "id": 418,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-06T15:05:28Z"
+ },
+ {
+ "id": 417,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-06T15:05:28Z"
+ },
+ {
+ "id": 416,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-06T15:05:28Z"
+ },
+ {
+ "id": 415,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T15:05:28Z"
+ },
+ {
+ "id": 414,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-06T15:05:24Z"
+ },
+ {
+ "id": 413,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T15:05:23Z"
+ },
+ {
+ "id": 412,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-06T15:05:19Z"
+ },
+ {
+ "id": 411,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "UNDEPLOY request successfully executed",
+ "logInstant": "2021-04-06T15:05:07Z"
+ },
+ {
+ "id": 410,
+ "logType": "WARNING",
+ "logComponent": "CLAMP",
+ "message": "Cannot Undeploy for the loop: pmsh_loop, the Deployment ID does not exist !",
+ "logInstant": "2021-04-06T15:05:07Z"
+ },
+ {
+ "id": 409,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "DCAE UNDEPLOY request",
+ "logInstant": "2021-04-06T15:05:07Z"
+ },
+ {
+ "id": 408,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DEPLOY loop status\n (Dep-id:CLAMP_7ae6f14d-80c8-4403-a174-ecb215d04c81,\n StatusUrl:) - : ",
+ "logInstant": "2021-04-06T15:02:46Z"
+ },
+ {
+ "id": 407,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "DCAE DEPLOY request",
+ "logInstant": "2021-04-06T15:02:42Z"
+ },
+ {
+ "id": 406,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-06T15:02:26Z"
+ },
+ {
+ "id": 405,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-06T15:02:26Z"
+ },
+ {
+ "id": 404,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-06T15:02:26Z"
+ },
+ {
+ "id": 403,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-06T15:02:26Z"
+ },
+ {
+ "id": 402,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-06T15:02:25Z"
+ },
+ {
+ "id": 401,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T15:02:25Z"
+ },
+ {
+ "id": 400,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-06T15:02:21Z"
+ },
+ {
+ "id": 399,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T15:02:21Z"
+ },
+ {
+ "id": 398,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-06T15:02:17Z"
+ },
+ {
+ "id": 397,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-06T14:32:53Z"
+ },
+ {
+ "id": 396,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-06T14:32:53Z"
+ },
+ {
+ "id": 395,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-06T14:32:53Z"
+ },
+ {
+ "id": 394,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-06T14:32:53Z"
+ },
+ {
+ "id": 393,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-06T14:32:53Z"
+ },
+ {
+ "id": 392,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T14:32:53Z"
+ },
+ {
+ "id": 391,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-06T14:32:49Z"
+ },
+ {
+ "id": 390,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T14:32:49Z"
+ },
+ {
+ "id": 389,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-06T14:32:44Z"
+ },
+ {
+ "id": 388,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-06T14:31:37Z"
+ },
+ {
+ "id": 387,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-06T14:31:37Z"
+ },
+ {
+ "id": 386,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-06T14:31:37Z"
+ },
+ {
+ "id": 385,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-06T14:31:37Z"
+ },
+ {
+ "id": 384,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-06T14:31:37Z"
+ },
+ {
+ "id": 383,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T14:31:37Z"
+ },
+ {
+ "id": 382,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-06T14:31:33Z"
+ },
+ {
+ "id": 381,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T14:31:33Z"
+ },
+ {
+ "id": 380,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-06T14:31:28Z"
+ },
+ {
+ "id": 379,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-06T14:30:35Z"
+ },
+ {
+ "id": 378,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-06T14:30:35Z"
+ },
+ {
+ "id": 377,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-06T14:30:34Z"
+ },
+ {
+ "id": 376,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-06T14:30:34Z"
+ },
+ {
+ "id": 375,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-06T14:30:34Z"
+ },
+ {
+ "id": 374,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T14:30:34Z"
+ },
+ {
+ "id": 373,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-06T14:30:30Z"
+ },
+ {
+ "id": 372,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T14:30:30Z"
+ },
+ {
+ "id": 371,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-06T14:30:26Z"
+ },
+ {
+ "id": 370,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "PDP Group remove ALL status - : ",
+ "logInstant": "2021-04-06T14:04:21Z"
+ },
+ {
+ "id": 369,
+ "logType": "WARNING",
+ "logComponent": "CLAMP",
+ "message": "Cannot Undeploy for the loop: pmsh_loop, the Deployment ID does not exist !",
+ "logInstant": "2021-04-06T14:04:17Z"
+ },
+ {
+ "id": 368,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "DELETE request",
+ "logInstant": "2021-04-06T14:04:17Z"
+ },
+ {
+ "id": 367,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-06T14:03:52Z"
+ },
+ {
+ "id": 366,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-06T14:03:52Z"
+ },
+ {
+ "id": 365,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-06T14:03:51Z"
+ },
+ {
+ "id": 364,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-06T14:03:51Z"
+ },
+ {
+ "id": 363,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-06T14:03:51Z"
+ },
+ {
+ "id": 362,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T14:03:51Z"
+ },
+ {
+ "id": 361,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-06T14:03:47Z"
+ },
+ {
+ "id": 360,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T14:03:47Z"
+ },
+ {
+ "id": 359,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-06T14:03:43Z"
+ },
+ {
+ "id": 358,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "UNDEPLOY request successfully executed",
+ "logInstant": "2021-04-06T14:03:35Z"
+ },
+ {
+ "id": 357,
+ "logType": "WARNING",
+ "logComponent": "CLAMP",
+ "message": "Cannot Undeploy for the loop: pmsh_loop, the Deployment ID does not exist !",
+ "logInstant": "2021-04-06T14:03:35Z"
+ },
+ {
+ "id": 356,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "DCAE UNDEPLOY request",
+ "logInstant": "2021-04-06T14:03:35Z"
+ },
+ {
+ "id": 355,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-06T13:57:38Z"
+ },
+ {
+ "id": 354,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-06T13:57:38Z"
+ },
+ {
+ "id": 353,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-06T13:57:38Z"
+ },
+ {
+ "id": 352,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-06T13:57:38Z"
+ },
+ {
+ "id": 351,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-06T13:57:37Z"
+ },
+ {
+ "id": 350,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T13:57:37Z"
+ },
+ {
+ "id": 349,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-06T13:57:33Z"
+ },
+ {
+ "id": 348,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T13:57:33Z"
+ },
+ {
+ "id": 347,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-06T13:57:29Z"
+ },
+ {
+ "id": 346,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "PDP Group remove ALL status - : ",
+ "logInstant": "2021-04-06T13:57:21Z"
+ },
+ {
+ "id": 345,
+ "logType": "WARNING",
+ "logComponent": "CLAMP",
+ "message": "Cannot Undeploy for the loop: pmsh_loop, the Deployment ID does not exist !",
+ "logInstant": "2021-04-06T13:57:16Z"
+ },
+ {
+ "id": 344,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "DELETE request",
+ "logInstant": "2021-04-06T13:57:16Z"
+ },
+ {
+ "id": 343,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-06T13:16:29Z"
+ },
+ {
+ "id": 342,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-06T13:16:29Z"
+ },
+ {
+ "id": 341,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-06T13:16:29Z"
+ },
+ {
+ "id": 340,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-06T13:16:29Z"
+ },
+ {
+ "id": 339,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-06T13:16:29Z"
+ },
+ {
+ "id": 338,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T13:16:29Z"
+ },
+ {
+ "id": 337,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-06T13:16:24Z"
+ },
+ {
+ "id": 336,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-06T13:16:24Z"
+ },
+ {
+ "id": 335,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-06T13:16:20Z"
+ },
+ {
+ "id": 334,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "Micro Service policies UPDATED",
+ "logInstant": "2021-04-01T16:12:47Z"
+ },
+ {
+ "id": 333,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T16:09:36Z"
+ },
+ {
+ "id": 332,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T16:09:36Z"
+ },
+ {
+ "id": 331,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T16:09:36Z"
+ },
+ {
+ "id": 330,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T16:09:36Z"
+ },
+ {
+ "id": 329,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T16:09:36Z"
+ },
+ {
+ "id": 328,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T16:09:36Z"
+ },
+ {
+ "id": 327,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T16:09:32Z"
+ },
+ {
+ "id": 326,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T16:09:32Z"
+ },
+ {
+ "id": 325,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T16:09:27Z"
+ },
+ {
+ "id": 324,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "Micro Service policies UPDATED",
+ "logInstant": "2021-04-01T15:16:20Z"
+ },
+ {
+ "id": 323,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T15:15:57Z"
+ },
+ {
+ "id": 322,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T15:15:57Z"
+ },
+ {
+ "id": 321,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T15:15:57Z"
+ },
+ {
+ "id": 320,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T15:15:57Z"
+ },
+ {
+ "id": 319,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T15:15:57Z"
+ },
+ {
+ "id": 318,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T15:15:57Z"
+ },
+ {
+ "id": 317,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T15:15:52Z"
+ },
+ {
+ "id": 316,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T15:15:52Z"
+ },
+ {
+ "id": 315,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T15:15:48Z"
+ },
+ {
+ "id": 314,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T15:14:19Z"
+ },
+ {
+ "id": 313,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T15:14:19Z"
+ },
+ {
+ "id": 312,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T15:14:19Z"
+ },
+ {
+ "id": 311,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T15:14:19Z"
+ },
+ {
+ "id": 310,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T15:14:19Z"
+ },
+ {
+ "id": 309,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T15:14:19Z"
+ },
+ {
+ "id": 308,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T15:14:15Z"
+ },
+ {
+ "id": 307,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T15:14:15Z"
+ },
+ {
+ "id": 306,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T15:14:10Z"
+ },
+ {
+ "id": 305,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T15:10:59Z"
+ },
+ {
+ "id": 304,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T15:10:59Z"
+ },
+ {
+ "id": 303,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T15:10:59Z"
+ },
+ {
+ "id": 302,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T15:10:59Z"
+ },
+ {
+ "id": 301,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T15:10:59Z"
+ },
+ {
+ "id": 300,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T15:10:59Z"
+ },
+ {
+ "id": 299,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T15:10:55Z"
+ },
+ {
+ "id": 298,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T15:10:54Z"
+ },
+ {
+ "id": 297,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T15:10:50Z"
+ },
+ {
+ "id": 287,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T14:31:38Z"
+ },
+ {
+ "id": 286,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T14:31:38Z"
+ },
+ {
+ "id": 285,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T14:31:37Z"
+ },
+ {
+ "id": 284,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T14:31:37Z"
+ },
+ {
+ "id": 283,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T14:31:37Z"
+ },
+ {
+ "id": 282,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T14:31:37Z"
+ },
+ {
+ "id": 281,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T14:31:33Z"
+ },
+ {
+ "id": 280,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T14:31:33Z"
+ },
+ {
+ "id": 279,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "Micro Service policies UPDATED",
+ "logInstant": "2021-04-01T14:31:32Z"
+ },
+ {
+ "id": 278,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T14:31:31Z"
+ },
+ {
+ "id": 277,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T14:31:31Z"
+ },
+ {
+ "id": 276,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T14:31:30Z"
+ },
+ {
+ "id": 275,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T14:31:30Z"
+ },
+ {
+ "id": 274,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 273,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 272,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 271,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 270,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 269,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 268,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 267,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 266,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 265,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 264,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 263,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 262,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 261,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 260,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 259,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 258,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T14:31:29Z"
+ },
+ {
+ "id": 257,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-04-01T14:31:28Z"
+ },
+ {
+ "id": 256,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T14:31:28Z"
+ },
+ {
+ "id": 255,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T14:31:28Z"
+ },
+ {
+ "id": 254,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-04-01T14:31:28Z"
+ },
+ {
+ "id": 253,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T14:31:28Z"
+ },
+ {
+ "id": 252,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T14:31:28Z"
+ },
+ {
+ "id": 251,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T14:31:28Z"
+ },
+ {
+ "id": 250,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "Micro Service policies UPDATED",
+ "logInstant": "2021-04-01T12:39:55Z"
+ },
+ {
+ "id": 249,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T12:38:31Z"
+ },
+ {
+ "id": 248,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T12:38:31Z"
+ },
+ {
+ "id": 247,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T12:38:30Z"
+ },
+ {
+ "id": 246,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T12:38:30Z"
+ },
+ {
+ "id": 245,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T12:38:30Z"
+ },
+ {
+ "id": 244,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T12:38:30Z"
+ },
+ {
+ "id": 243,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T12:38:26Z"
+ },
+ {
+ "id": 242,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T12:38:26Z"
+ },
+ {
+ "id": 241,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T12:38:22Z"
+ },
+ {
+ "id": 240,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "Micro Service policies UPDATED",
+ "logInstant": "2021-04-01T12:37:20Z"
+ },
+ {
+ "id": 239,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T12:37:19Z"
+ },
+ {
+ "id": 238,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T12:37:19Z"
+ },
+ {
+ "id": 237,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T12:37:19Z"
+ },
+ {
+ "id": 236,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T12:37:19Z"
+ },
+ {
+ "id": 235,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T12:37:19Z"
+ },
+ {
+ "id": 234,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T12:37:19Z"
+ },
+ {
+ "id": 233,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T12:37:14Z"
+ },
+ {
+ "id": 232,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T12:37:14Z"
+ },
+ {
+ "id": 231,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T12:37:10Z"
+ },
+ {
+ "id": 221,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "Micro Service policies UPDATED",
+ "logInstant": "2021-04-01T11:57:59Z"
+ },
+ {
+ "id": 220,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-04-01T11:57:34Z"
+ },
+ {
+ "id": 219,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-04-01T11:57:34Z"
+ },
+ {
+ "id": 218,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-04-01T11:57:34Z"
+ },
+ {
+ "id": 217,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-04-01T11:57:33Z"
+ },
+ {
+ "id": 216,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-04-01T11:57:33Z"
+ },
+ {
+ "id": 215,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T11:57:33Z"
+ },
+ {
+ "id": 214,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-04-01T11:57:29Z"
+ },
+ {
+ "id": 213,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-04-01T11:57:29Z"
+ },
+ {
+ "id": 212,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-04-01T11:57:25Z"
+ },
+ {
+ "id": 211,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T15:50:20Z"
+ },
+ {
+ "id": 210,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T15:50:20Z"
+ },
+ {
+ "id": 209,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T15:50:20Z"
+ },
+ {
+ "id": 208,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T15:50:20Z"
+ },
+ {
+ "id": 207,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T15:50:20Z"
+ },
+ {
+ "id": 206,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T15:50:20Z"
+ },
+ {
+ "id": 205,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T15:50:16Z"
+ },
+ {
+ "id": 204,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T15:50:16Z"
+ },
+ {
+ "id": 203,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T15:50:11Z"
+ },
+ {
+ "id": 202,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T15:49:39Z"
+ },
+ {
+ "id": 201,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T15:49:39Z"
+ },
+ {
+ "id": 200,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T15:49:39Z"
+ },
+ {
+ "id": 199,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T15:49:39Z"
+ },
+ {
+ "id": 198,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T15:49:39Z"
+ },
+ {
+ "id": 197,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T15:49:39Z"
+ },
+ {
+ "id": 196,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T15:49:35Z"
+ },
+ {
+ "id": 195,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T15:49:35Z"
+ },
+ {
+ "id": 194,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T15:49:30Z"
+ },
+ {
+ "id": 193,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T15:49:06Z"
+ },
+ {
+ "id": 192,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T15:49:06Z"
+ },
+ {
+ "id": 191,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T15:49:06Z"
+ },
+ {
+ "id": 190,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T15:49:06Z"
+ },
+ {
+ "id": 189,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T15:49:06Z"
+ },
+ {
+ "id": 188,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T15:49:06Z"
+ },
+ {
+ "id": 187,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T15:49:01Z"
+ },
+ {
+ "id": 186,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T15:49:01Z"
+ },
+ {
+ "id": 185,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T15:48:57Z"
+ },
+ {
+ "id": 184,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T15:47:28Z"
+ },
+ {
+ "id": 183,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T15:47:28Z"
+ },
+ {
+ "id": 182,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T15:47:28Z"
+ },
+ {
+ "id": 181,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T15:47:28Z"
+ },
+ {
+ "id": 180,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T15:47:27Z"
+ },
+ {
+ "id": 179,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T15:47:27Z"
+ },
+ {
+ "id": 178,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T15:47:23Z"
+ },
+ {
+ "id": 177,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T15:47:23Z"
+ },
+ {
+ "id": 176,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T15:47:19Z"
+ },
+ {
+ "id": 175,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T15:43:41Z"
+ },
+ {
+ "id": 174,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T15:43:41Z"
+ },
+ {
+ "id": 173,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T15:43:41Z"
+ },
+ {
+ "id": 172,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T15:43:41Z"
+ },
+ {
+ "id": 171,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T15:43:41Z"
+ },
+ {
+ "id": 170,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T15:43:41Z"
+ },
+ {
+ "id": 169,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T15:43:36Z"
+ },
+ {
+ "id": 168,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T15:43:36Z"
+ },
+ {
+ "id": 167,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T15:43:34Z"
+ },
+ {
+ "id": 166,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T15:43:34Z"
+ },
+ {
+ "id": 165,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T15:43:34Z"
+ },
+ {
+ "id": 164,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T15:43:34Z"
+ },
+ {
+ "id": 163,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T15:43:34Z"
+ },
+ {
+ "id": 162,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T15:43:34Z"
+ },
+ {
+ "id": 161,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 160,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 159,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 158,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 157,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 156,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 155,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 154,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 153,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 152,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 151,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 150,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-03-31T15:43:33Z"
+ },
+ {
+ "id": 149,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T15:43:32Z"
+ },
+ {
+ "id": 148,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T15:43:32Z"
+ },
+ {
+ "id": 147,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T15:43:32Z"
+ },
+ {
+ "id": 146,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-03-31T15:43:32Z"
+ },
+ {
+ "id": 145,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-03-31T15:43:32Z"
+ },
+ {
+ "id": 144,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connection is still allocated",
+ "logInstant": "2021-03-31T15:43:32Z"
+ },
+ {
+ "id": 143,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T15:43:32Z"
+ },
+ {
+ "id": 142,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T15:43:32Z"
+ },
+ {
+ "id": 141,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T15:43:32Z"
+ },
+ {
+ "id": 140,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T15:43:32Z"
+ },
+ {
+ "id": 139,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T10:13:01Z"
+ },
+ {
+ "id": 138,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T10:13:01Z"
+ },
+ {
+ "id": 137,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T10:13:00Z"
+ },
+ {
+ "id": 136,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T10:13:00Z"
+ },
+ {
+ "id": 135,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T10:13:00Z"
+ },
+ {
+ "id": 134,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T10:13:00Z"
+ },
+ {
+ "id": 133,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T10:12:56Z"
+ },
+ {
+ "id": 132,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T10:12:56Z"
+ },
+ {
+ "id": 131,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T10:12:52Z"
+ },
+ {
+ "id": 130,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T09:55:12Z"
+ },
+ {
+ "id": 129,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T09:55:12Z"
+ },
+ {
+ "id": 128,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T09:55:12Z"
+ },
+ {
+ "id": 127,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T09:55:12Z"
+ },
+ {
+ "id": 126,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T09:55:12Z"
+ },
+ {
+ "id": 125,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T09:55:12Z"
+ },
+ {
+ "id": 124,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T09:55:08Z"
+ },
+ {
+ "id": 123,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T09:55:07Z"
+ },
+ {
+ "id": 122,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T09:55:03Z"
+ },
+ {
+ "id": 121,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T09:46:18Z"
+ },
+ {
+ "id": 120,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T09:46:18Z"
+ },
+ {
+ "id": 119,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T09:46:18Z"
+ },
+ {
+ "id": 118,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T09:46:18Z"
+ },
+ {
+ "id": 117,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T09:46:18Z"
+ },
+ {
+ "id": 116,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T09:46:18Z"
+ },
+ {
+ "id": 115,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T09:46:13Z"
+ },
+ {
+ "id": 114,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T09:46:13Z"
+ },
+ {
+ "id": 113,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T09:46:09Z"
+ },
+ {
+ "id": 112,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-31T09:45:56Z"
+ },
+ {
+ "id": 111,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-31T09:45:56Z"
+ },
+ {
+ "id": 110,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-31T09:45:56Z"
+ },
+ {
+ "id": 109,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-31T09:45:56Z"
+ },
+ {
+ "id": 108,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-31T09:45:56Z"
+ },
+ {
+ "id": 107,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T09:45:55Z"
+ },
+ {
+ "id": 106,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-31T09:45:51Z"
+ },
+ {
+ "id": 105,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-31T09:45:51Z"
+ },
+ {
+ "id": 104,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-31T09:45:47Z"
+ },
+ {
+ "id": 103,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-30T16:00:55Z"
+ },
+ {
+ "id": 102,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-30T16:00:55Z"
+ },
+ {
+ "id": 101,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-30T16:00:55Z"
+ },
+ {
+ "id": 100,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-30T16:00:55Z"
+ },
+ {
+ "id": 99,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-30T16:00:55Z"
+ },
+ {
+ "id": 98,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T16:00:54Z"
+ },
+ {
+ "id": 97,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-30T16:00:50Z"
+ },
+ {
+ "id": 96,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T16:00:50Z"
+ },
+ {
+ "id": 95,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-30T16:00:46Z"
+ },
+ {
+ "id": 94,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-30T15:58:05Z"
+ },
+ {
+ "id": 93,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-30T15:58:05Z"
+ },
+ {
+ "id": 92,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-30T15:58:05Z"
+ },
+ {
+ "id": 91,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-30T15:58:05Z"
+ },
+ {
+ "id": 90,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-30T15:58:05Z"
+ },
+ {
+ "id": 89,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T15:58:05Z"
+ },
+ {
+ "id": 88,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-30T15:58:00Z"
+ },
+ {
+ "id": 87,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T15:58:00Z"
+ },
+ {
+ "id": 86,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-30T15:57:56Z"
+ },
+ {
+ "id": 85,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-30T15:00:21Z"
+ },
+ {
+ "id": 84,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-30T15:00:21Z"
+ },
+ {
+ "id": 83,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-30T15:00:21Z"
+ },
+ {
+ "id": 82,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-30T15:00:21Z"
+ },
+ {
+ "id": 81,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-30T15:00:21Z"
+ },
+ {
+ "id": 80,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T15:00:21Z"
+ },
+ {
+ "id": 79,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-30T15:00:17Z"
+ },
+ {
+ "id": 78,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T15:00:17Z"
+ },
+ {
+ "id": 77,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-30T15:00:12Z"
+ },
+ {
+ "id": 76,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-30T14:51:24Z"
+ },
+ {
+ "id": 75,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-30T14:51:23Z"
+ },
+ {
+ "id": 74,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-30T14:51:23Z"
+ },
+ {
+ "id": 73,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-30T14:51:23Z"
+ },
+ {
+ "id": 72,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-30T14:51:23Z"
+ },
+ {
+ "id": 71,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T14:51:23Z"
+ },
+ {
+ "id": 70,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-30T14:51:19Z"
+ },
+ {
+ "id": 69,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T14:51:19Z"
+ },
+ {
+ "id": 68,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-30T14:51:15Z"
+ },
+ {
+ "id": 67,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-30T14:45:06Z"
+ },
+ {
+ "id": 66,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-30T14:45:06Z"
+ },
+ {
+ "id": 65,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-30T14:45:06Z"
+ },
+ {
+ "id": 64,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-30T14:45:06Z"
+ },
+ {
+ "id": 63,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-30T14:45:06Z"
+ },
+ {
+ "id": 62,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T14:45:06Z"
+ },
+ {
+ "id": 61,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-30T14:45:02Z"
+ },
+ {
+ "id": 60,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T14:45:02Z"
+ },
+ {
+ "id": 59,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-30T14:44:57Z"
+ },
+ {
+ "id": 58,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-30T14:44:31Z"
+ },
+ {
+ "id": 57,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-30T14:44:31Z"
+ },
+ {
+ "id": 56,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-30T14:44:31Z"
+ },
+ {
+ "id": 55,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-30T14:44:31Z"
+ },
+ {
+ "id": 54,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-30T14:44:31Z"
+ },
+ {
+ "id": 53,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T14:44:31Z"
+ },
+ {
+ "id": 52,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-30T14:44:27Z"
+ },
+ {
+ "id": 51,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T14:44:26Z"
+ },
+ {
+ "id": 50,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-30T14:44:22Z"
+ },
+ {
+ "id": 49,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-30T14:32:12Z"
+ },
+ {
+ "id": 48,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-30T14:32:12Z"
+ },
+ {
+ "id": 47,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-30T14:32:12Z"
+ },
+ {
+ "id": 46,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-30T14:32:12Z"
+ },
+ {
+ "id": 45,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-30T14:32:12Z"
+ },
+ {
+ "id": 44,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T14:32:11Z"
+ },
+ {
+ "id": 43,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-30T14:32:07Z"
+ },
+ {
+ "id": 42,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T14:32:07Z"
+ },
+ {
+ "id": 41,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-30T14:32:03Z"
+ },
+ {
+ "id": 40,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request successfully executed",
+ "logInstant": "2021-03-30T13:07:24Z"
+ },
+ {
+ "id": 39,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "New loop state is: DESIGN",
+ "logInstant": "2021-03-30T13:07:24Z"
+ },
+ {
+ "id": 38,
+ "logType": "INFO",
+ "logComponent": "DCAE",
+ "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ",
+ "logInstant": "2021-03-30T13:07:24Z"
+ },
+ {
+ "id": 37,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "Policy state set to: NOT_SENT",
+ "logInstant": "2021-03-30T13:07:24Z"
+ },
+ {
+ "id": 36,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ",
+ "logInstant": "2021-03-30T13:07:24Z"
+ },
+ {
+ "id": 35,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T13:07:24Z"
+ },
+ {
+ "id": 34,
+ "logType": "INFO",
+ "logComponent": "POLICY",
+ "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ",
+ "logInstant": "2021-03-30T13:07:19Z"
+ },
+ {
+ "id": 33,
+ "logType": "ERROR",
+ "logComponent": "CLAMP",
+ "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect",
+ "logInstant": "2021-03-30T13:07:19Z"
+ },
+ {
+ "id": 32,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "GET STATUS request",
+ "logInstant": "2021-03-30T13:07:15Z"
+ }
+ ],
+ "loopTemplate": {
+ "name": "LOOP_TEMPLATE_k8s_pmsh",
+ "dcaeBlueprintId": "9dc5dba0-e685-4d5a-b144-8f4d84cfa01f",
+ "loopElementModelsUsed": [
+ {
+ "loopElementModel": {
+ "name": "onap.policies.monitoring.dcae-pm-subscription-handler",
+ "loopElementType": "MICRO_SERVICE_TYPE",
+ "policyModels": [
+ {
+ "policyModelType": "onap.policies.monitoring.dcae-pm-subscription-handler",
+ "version": "1.0.0",
+ "policyAcronym": "dcae-pm-subscription-handler",
+ "policyPdpGroup": {
+ "supportedPdpGroups": [
+ {
+ "ControlLoopGroup": [
+ "apex",
+ "xacml"
+ ]
+ },
+ {
+ "defaultGroup": [
+ "xacml"
+ ]
+ }
+ ]
+ },
+ "createdDate": "2021-03-30T09:55:52.261232Z",
+ "updatedDate": "2021-03-30T09:56:17.502284Z",
+ "updatedBy": "Not found",
+ "createdBy": "Not found"
+ }
+ ],
+ "createdDate": "2021-03-30T08:48:21Z",
+ "updatedDate": "2021-03-30T08:48:21Z",
+ "updatedBy": "Not found",
+ "createdBy": "Not found"
+ },
+ "flowOrder": 0
+ }
+ ],
+ "modelService": {
+ "serviceDetails": {
+ "serviceType": "",
+ "serviceRole": "",
+ "description": "vLBMS",
+ "type": "Service",
+ "instantiationType": "A-la-carte",
+ "namingPolicy": "",
+ "serviceEcompNaming": "true",
+ "environmentContext": "General_Revenue-Bearing",
+ "name": "vLoadBalancerMS",
+ "invariantUUID": "30ec5b59-4799-48d8-ac5f-1058a6b0e48f",
+ "ecompGeneratedNaming": "true",
+ "UUID": "63cac700-ab9a-4115-a74f-7eac85e3fce0",
+ "category": "Network L4+"
+ },
+ "resourceDetails": {
+ "CP": {},
+ "VL": {},
+ "VF": {
+ "vLoadBalancerMS 0": {
+ "resourceVendor": "Test",
+ "name": "vLoadBalancerMS",
+ "resourceVendorModelNumber": "",
+ "description": "vLBMS",
+ "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506",
+ "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6",
+ "type": "VF",
+ "category": "Application L4+",
+ "subcategory": "Load Balancer",
+ "version": "1.0",
+ "customizationUUID": "465246dc-7748-45f4-a013-308d92922552",
+ "resourceVendorRelease": "1.0",
+ "controllerProperties": {
+ "sdnc_model_name": "baseconfiguration",
+ "sdnc_model_version": "1.0.0",
+ "workflows": {
+ "resource-assignment": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "activate": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "activate-restconf": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "activate-cli": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "assign-activate": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "imperative-test-wf": {
+ "inputs": {
+ "resource-assignment-properties": {
+ "type": "object",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "type": "object",
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "CR": {},
+ "VFC": {},
+ "PNF": {},
+ "Service": {},
+ "CVFC": {},
+ "Service Proxy": {},
+ "Configuration": {},
+ "AllottedResource": {},
+ "VFModule": {
+ "Vloadbalancerms..vpkg..module-1": {
+ "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vpkg..module-1",
+ "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc",
+ "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vpkg",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ },
+ "Vloadbalancerms..vdns..module-3": {
+ "vfModuleModelInvariantUUID": "4c10ba9b-f88f-415e-9de3-5d33336047fa",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vdns..module-3",
+ "vfModuleModelUUID": "4fa73b49-8a6c-493e-816b-eb401567b720",
+ "vfModuleModelCustomizationUUID": "bafcdab0-801d-4d81-9ead-f464640a38b1",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vdns",
+ "max_vf_module_instances": 50,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ },
+ "Vloadbalancerms..base_template..module-0": {
+ "vfModuleModelInvariantUUID": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..base_template..module-0",
+ "vfModuleModelUUID": "63734409-f745-4e4d-a38b-131638a0edce",
+ "vfModuleModelCustomizationUUID": "86baddea-c730-4fb8-9410-cd2e17fd7f27",
+ "min_vf_module_instances": 1,
+ "vf_module_label": "base_template",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Base",
+ "isBase": true,
+ "initial_count": 1,
+ "volume_group": false
+ },
+ "Vloadbalancerms..vlb..module-2": {
+ "vfModuleModelInvariantUUID": "a772a1f4-0064-412c-833d-4749b15828dd",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vlb..module-2",
+ "vfModuleModelUUID": "0f5c3f6a-650a-4303-abb6-fff3e573a07a",
+ "vfModuleModelCustomizationUUID": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vlb",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ }
+ }
+ }
+ },
+ "maximumInstancesAllowed": 0,
+ "uniqueBlueprint": true,
+ "allowedLoopType": "CLOSED",
+ "createdDate": "2021-03-30T08:48:21Z",
+ "updatedDate": "2021-03-30T08:48:21Z",
+ "updatedBy": "Not found",
+ "createdBy": "Not found"
+ },
+ "createdDate": "2021-03-30T13:07:07.901081Z",
+ "updatedDate": "2021-03-30T13:07:07.901081Z",
+ "updatedBy": "admin",
+ "createdBy": "admin"
+}
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
new file mode 100644
index 000000000..932ebbece
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
@@ -0,0 +1,159 @@
+/*-
+ * ============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 java.time.Instant;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+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.participant.intermediary.api.ControlLoopElementListener;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.provider.PolicyModelsProvider;
+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;
+
+/**
+ * This class handles implementation of controlLoopElement updates.
+ */
+public class ControlLoopElementHandler implements ControlLoopElementListener {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopElementHandler.class);
+ private static final Map<String, String> policyTypeMap = new LinkedHashMap<>();
+ private static final Map<String, String> policyMap = new LinkedHashMap<>();
+
+ /**
+ * 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(UUID controlLoopElementId,
+ ControlLoopState currentState,
+ ControlLoopOrderedState newState) throws PfModelException {
+ PolicyProvider policyProvider = PolicyHandler.getInstance().getPolicyProvider();
+ switch (newState) {
+ case UNINITIALISED:
+ try {
+ deletePolicyData(controlLoopElementId, newState);
+ } catch (PfModelRuntimeException e) {
+ LOGGER.debug("Delete policytpes failed", e);
+ }
+ break;
+ case PASSIVE:
+ policyProvider.getIntermediaryApi()
+ .updateControlLoopElementState(controlLoopElementId, newState,
+ ControlLoopState.PASSIVE);
+ break;
+ case RUNNING:
+ policyProvider.getIntermediaryApi()
+ .updateControlLoopElementState(controlLoopElementId, newState,
+ ControlLoopState.RUNNING);
+ break;
+ default:
+ LOGGER.debug("Unknown orderedstate {}", newState);
+ break;
+ }
+ }
+
+ private void deletePolicyData(UUID controlLoopElementId,
+ ControlLoopOrderedState newState) throws PfModelException {
+ PolicyModelsProvider dbProvider = PolicyHandler.getInstance().getDatabaseProvider();
+ PolicyProvider policyProvider = PolicyHandler.getInstance().getPolicyProvider();
+ if (policyMap != null) {
+ // Delete all policies of this controlLoop from policy framework
+ for (Entry<String, String> policy : policyMap.entrySet()) {
+ dbProvider.deletePolicy(policy.getKey(), policy.getValue());
+ }
+ }
+ if (policyTypeMap != null) {
+ // Delete all policy types of this control loop from policy framework
+ for (Entry<String, String> policy : policyTypeMap.entrySet()) {
+ dbProvider.deletePolicyType(policy.getKey(), policy.getValue());
+ }
+ }
+ policyProvider.getIntermediaryApi()
+ .updateControlLoopElementState(controlLoopElementId, newState,
+ ControlLoopState.UNINITIALISED);
+ }
+
+ /**
+ * Callback method to handle an update on a control loop element.
+ *
+ * @param element the information on the control loop element
+ * @param controlLoopDefinition toscaServiceTemplate
+ * @throws PfModelException in case of an exception
+ */
+ @Override
+ public void controlLoopElementUpdate(ControlLoopElement element,
+ ToscaServiceTemplate controlLoopDefinition) throws PfModelException {
+ PolicyModelsProvider dbProvider = PolicyHandler.getInstance().getDatabaseProvider();
+ PolicyProvider policyProvider = PolicyHandler.getInstance().getPolicyProvider();
+
+ policyProvider.getIntermediaryApi()
+ .updateControlLoopElementState(element.getId(), element.getOrderedState(), ControlLoopState.PASSIVE);
+ if (controlLoopDefinition.getPolicyTypes() != null) {
+ for (ToscaPolicyType policyType : controlLoopDefinition.getPolicyTypes().values()) {
+ policyTypeMap.put(policyType.getName(), policyType.getVersion());
+ }
+ dbProvider.createPolicyTypes(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());
+ }
+ }
+ dbProvider.createPolicies(controlLoopDefinition);
+ }
+ }
+
+ /**
+ * Handle controlLoopElement statistics.
+ *
+ * @param controlLoopElementId controlloop element id
+ */
+ @Override
+ public void handleStatistics(UUID controlLoopElementId) {
+ PolicyProvider policyProvider = PolicyHandler.getInstance().getPolicyProvider();
+ ControlLoopElement clElement = policyProvider.getIntermediaryApi()
+ .getControlLoopElement(controlLoopElementId);
+ if (clElement != null) {
+ ClElementStatistics clElementStatistics = new ClElementStatistics();
+ clElementStatistics.setControlLoopState(clElement.getState());
+ clElementStatistics.setTimeStamp(Instant.now());
+ policyProvider.getIntermediaryApi()
+ .updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics);
+ }
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyHandler.java
new file mode 100644
index 000000000..d62e5f9f3
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyHandler.java
@@ -0,0 +1,100 @@
+/*-
+ * ============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 java.io.IOException;
+import java.util.List;
+import java.util.Set;
+import javax.ws.rs.core.Response;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.common.handler.ControlLoopHandler;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters;
+import org.onap.policy.common.endpoints.event.comm.TopicSink;
+import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher;
+import org.onap.policy.common.utils.services.Registry;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.provider.PolicyModelsProvider;
+import org.onap.policy.models.provider.PolicyModelsProviderFactory;
+
+/**
+ * This class handles policy participant and control loop elements.
+ *
+ * <p/>It is effectively a singleton that is started at system start.
+ */
+public class PolicyHandler extends ControlLoopHandler {
+
+ private final ParticipantIntermediaryParameters participantParameters;
+ private final ParticipantPolicyParameters policyParameters;
+
+ @Getter
+ private PolicyProvider policyProvider;
+ @Getter
+ private PolicyModelsProvider databaseProvider;
+
+ /**
+ * Create a handler.
+ *
+ * @param parameters the parameters for access to the database
+ * @throws PfModelException in case of an exception
+ */
+ public PolicyHandler(ParticipantPolicyParameters parameters) throws PfModelException {
+ super(parameters.getDatabaseProviderParameters());
+ participantParameters = parameters.getIntermediaryParameters();
+ policyParameters = parameters;
+ }
+
+ public static PolicyHandler getInstance() {
+ return Registry.get(PolicyHandler.class.getName());
+ }
+
+ @Override
+ public Set<Class<?>> getProviderClasses() {
+ return null;
+ }
+
+ @Override
+ public void startProviders() {
+ try {
+ policyProvider = new PolicyProvider(participantParameters);
+ databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(
+ policyParameters.getDatabaseProviderParameters());
+ } catch (PfModelException e) {
+ throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "Start providers failed ", e);
+ }
+ }
+
+ @Override
+ public void stopProviders() {
+ try {
+ policyProvider.close();
+ } catch (IOException e) {
+ throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "Stop providers failed ", e);
+ }
+
+ try {
+ databaseProvider.close();
+ } catch (PfModelException e) {
+ throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "Stop providers failed ", e);
+ }
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyProvider.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyProvider.java
new file mode 100644
index 000000000..420c77ee3
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyProvider.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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 java.io.Closeable;
+import java.io.IOException;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryFactory;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+
+/**
+ * Provider class for policy participant.
+ */
+public class PolicyProvider implements Closeable {
+ @Getter
+ private final ParticipantIntermediaryApi intermediaryApi;
+
+ private final ControlLoopElementHandler controlLoopElementHandler;
+
+ /**
+ * Create a policy participant provider.
+ *
+ * @throws ControlLoopRuntimeException on errors creating the provider
+ */
+ public PolicyProvider(ParticipantIntermediaryParameters participantParameters)
+ throws ControlLoopRuntimeException {
+ intermediaryApi = new ParticipantIntermediaryFactory().createApiImplementation();
+ intermediaryApi.init(participantParameters);
+ controlLoopElementHandler = new ControlLoopElementHandler();
+ intermediaryApi.registerControlLoopElementListener(controlLoopElementHandler);
+ }
+
+ @Override
+ public void close() throws IOException {
+ intermediaryApi.close();
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameterHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameterHandler.java
new file mode 100644
index 000000000..98cea821a
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameterHandler.java
@@ -0,0 +1,79 @@
+/*-
+ * ============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.parameters;
+
+import java.io.File;
+import javax.ws.rs.core.Response;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.participant.policy.main.startstop.ParticipantPolicyCommandLineArguments;
+import org.onap.policy.common.parameters.ValidationResult;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+
+/**
+ * This class handles reading, parsing and validating of policy participant parameters from JSON files.
+ */
+public class ParticipantPolicyParameterHandler {
+
+ private static final Coder CODER = new StandardCoder();
+
+ /**
+ * Read the parameters from the parameter file.
+ *
+ * @param arguments the arguments passed to policy
+ * @return the parameters read from the configuration file
+ * @throws ControlLoopException on parameter exceptions
+ */
+ public ParticipantPolicyParameters getParameters(final ParticipantPolicyCommandLineArguments arguments)
+ throws ControlLoopException {
+ ParticipantPolicyParameters parameters = null;
+
+ // Read the parameters
+ try {
+ // Read the parameters from JSON
+ File file = new File(arguments.getFullConfigurationFilePath());
+ parameters = CODER.decode(file, ParticipantPolicyParameters.class);
+ } catch (final CoderException e) {
+ final String errorMessage = "error reading parameters from \"" + arguments.getConfigurationFilePath()
+ + "\"\n" + "(" + e.getClass().getSimpleName() + ")";
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage, e);
+ }
+
+ // The JSON processing returns null if there is an empty file
+ if (parameters == null) {
+ final String errorMessage = "no parameters found in \"" + arguments.getConfigurationFilePath() + "\"";
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage);
+ }
+
+ // validate the parameters
+ final ValidationResult validationResult = parameters.validate();
+ if (!validationResult.isValid()) {
+ String returnMessage =
+ "validation error(s) on parameters from \"" + arguments.getConfigurationFilePath() + "\"\n";
+ returnMessage += validationResult.getResult();
+
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, returnMessage);
+ }
+
+ return parameters;
+ }
+}
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/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java
new file mode 100644
index 000000000..13d89faba
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.parameters;
+
+import javax.validation.constraints.NotBlank;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
+import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+
+/**
+ * Class to hold all parameters needed for the policy participant.
+ *
+ */
+@NotNull
+@NotBlank
+@Getter
+public class ParticipantPolicyParameters extends ParameterGroupImpl {
+ private ParticipantIntermediaryParameters intermediaryParameters;
+ private PolicyModelsProviderParameters databaseProviderParameters;
+
+ /**
+ * Create the policy participant parameter group.
+ *
+ * @param name the parameter group name
+ */
+ public ParticipantPolicyParameters(final String name) {
+ super(name);
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/Main.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/Main.java
new file mode 100644
index 000000000..9a6bfdf7d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/Main.java
@@ -0,0 +1,141 @@
+/*-
+ * ============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.startstop;
+
+import java.util.Arrays;
+import javax.ws.rs.core.Response;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameterHandler;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters;
+import org.onap.policy.common.utils.resources.MessageConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class initiates Policy Participant.
+ */
+public class Main {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
+
+ private ParticipantPolicyActivator activator;
+
+ @Getter
+ private ParticipantPolicyParameters parameterGroup;
+
+ /**
+ * Instantiates policy participant.
+ *
+ * @param args the command line arguments
+ */
+ public Main(final String[] args) {
+ final String argumentString = Arrays.toString(args);
+ LOGGER.info("Starting the control loop participant service with arguments - {}", argumentString);
+
+ // Check the arguments
+ final ParticipantPolicyCommandLineArguments arguments = new ParticipantPolicyCommandLineArguments();
+ try {
+ // The arguments return a string if there is a message to print and we should exit
+ final String argumentMessage = arguments.parse(args);
+ if (argumentMessage != null) {
+ LOGGER.info(argumentMessage);
+ return;
+ }
+ // Validate that the arguments are sane
+ arguments.validate();
+
+ // Read the parameters
+ parameterGroup = new ParticipantPolicyParameterHandler().getParameters(arguments);
+
+ // Now, create the activator for the service
+ activator = new ParticipantPolicyActivator(parameterGroup);
+
+ // Start the activator
+ activator.start();
+ } catch (Exception exp) {
+ throw new ControlLoopRuntimeException(Response.Status.BAD_REQUEST,
+ String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP), exp);
+ }
+
+ // Add a shutdown hook to shut everything down in an orderly manner
+ Runtime.getRuntime().addShutdownHook(new ClRuntimeShutdownHookClass());
+ String successMsg = String.format(MessageConstants.START_SUCCESS_MSG, MessageConstants.POLICY_CLAMP);
+ LOGGER.info(successMsg);
+ }
+
+ /**
+ * Check if main is running.
+ */
+ public boolean isRunning() {
+ return activator != null && activator.isAlive();
+ }
+
+ /**
+ * Shut down Execution.
+ *
+ * @throws ControlLoopException on shutdown errors
+ */
+ public void shutdown() throws ControlLoopException {
+ // clear the parameterGroup variable
+ parameterGroup = null;
+
+ // clear the cl participant activator
+ if (activator != null) {
+ activator.stop();
+ }
+ }
+
+ /**
+ * The Class ClRuntimeShutdownHookClass terminates the policy participant
+ * when its run method is called.
+ */
+ private class ClRuntimeShutdownHookClass extends Thread {
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+ try {
+ // Shutdown the control loop participant service and wait for everything to stop
+ shutdown();
+ } catch (final RuntimeException | ControlLoopException e) {
+ LOGGER.warn("error occured during shut down of the policy participant", e);
+ }
+ }
+ }
+
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
+ public static void main(final String[] args) { // NOSONAR
+ /*
+ * NOTE: arguments are validated by the constructor, thus sonar is disabled.
+ */
+
+ new Main(args);
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/ParticipantPolicyActivator.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/ParticipantPolicyActivator.java
new file mode 100644
index 000000000..760f8267d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/ParticipantPolicyActivator.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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.startstop;
+
+import java.util.concurrent.atomic.AtomicReference;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.participant.policy.main.handler.PolicyHandler;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters;
+import org.onap.policy.common.utils.services.ServiceManagerContainer;
+
+/**
+ * This class activates the policy participant.
+ *
+ */
+public class ParticipantPolicyActivator extends ServiceManagerContainer {
+ @Getter
+ private final ParticipantPolicyParameters parameters;
+
+ /**
+ * Instantiate the activator for the policy participant.
+ *
+ * @param parameters the parameters for the policy participant
+ */
+ public ParticipantPolicyActivator(final ParticipantPolicyParameters parameters) {
+ this.parameters = parameters;
+
+ final AtomicReference<PolicyHandler> policyHandler = new AtomicReference<>();
+
+ // @formatter:off
+ addAction("Policy Handler",
+ () -> policyHandler.set(new PolicyHandler(parameters)),
+ () -> policyHandler.get().close());
+
+ addAction("Policy Providers",
+ () -> policyHandler.get().startProviders(),
+ () -> policyHandler.get().stopProviders());
+ // @formatter:on
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/ParticipantPolicyCommandLineArguments.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/ParticipantPolicyCommandLineArguments.java
new file mode 100644
index 000000000..af7a189f6
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/ParticipantPolicyCommandLineArguments.java
@@ -0,0 +1,145 @@
+/*-
+ * ============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.startstop;
+
+import java.util.Arrays;
+import javax.ws.rs.core.Response;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.common.startstop.CommonCommandLineArguments;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+
+/**
+ * This class reads and handles command line parameters for the policy participant.
+ *
+ */
+public class ParticipantPolicyCommandLineArguments {
+ private static final String FILE_MESSAGE_PREAMBLE = " file \"";
+ private static final int HELP_LINE_LENGTH = 120;
+
+ private final Options options;
+ private final CommonCommandLineArguments commonCommandLineArguments;
+
+ @Getter()
+ @Setter()
+ private String configurationFilePath = null;
+
+ /**
+ * Construct the options for the policy participant.
+ */
+ public ParticipantPolicyCommandLineArguments() {
+ options = new Options();
+ commonCommandLineArguments = new CommonCommandLineArguments(options);
+ }
+
+ /**
+ * Construct the options for the CLI editor and parse in the given arguments.
+ *
+ * @param args The command line arguments
+ */
+ public ParticipantPolicyCommandLineArguments(final String[] args) {
+ // Set up the options with the default constructor
+ this();
+
+ // Parse the arguments
+ try {
+ parse(args);
+ } catch (final ControlLoopException e) {
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
+ "parse error on policy participant parameters", e);
+ }
+ }
+
+ /**
+ * Parse the command line options.
+ *
+ * @param args The command line arguments
+ * @return a string with a message for help and version, or null if there is no message
+ * @throws ControlLoopException on command argument errors
+ */
+ public String parse(final String[] args) throws ControlLoopException {
+ // Clear all our arguments
+ setConfigurationFilePath(null);
+ CommandLine commandLine = null;
+ try {
+ commandLine = new DefaultParser().parse(options, args);
+ } catch (final ParseException e) {
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
+ "invalid command line arguments specified : " + e.getMessage());
+ }
+
+ // Arguments left over after Commons CLI does its stuff
+ final String[] remainingArgs = commandLine.getArgs();
+
+ if (remainingArgs.length > 0) {
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
+ "too many command line arguments specified : " + Arrays.toString(args));
+ }
+
+ if (commandLine.hasOption('h')) {
+ return commonCommandLineArguments.help(Main.class.getName(), options);
+ }
+
+ if (commandLine.hasOption('v')) {
+ return commonCommandLineArguments.version();
+ }
+
+ if (commandLine.hasOption('c')) {
+ setConfigurationFilePath(commandLine.getOptionValue('c'));
+ }
+
+ return null;
+ }
+
+ /**
+ * Validate the command line options.
+ *
+ * @throws ControlLoopException on command argument validation errors
+ */
+ public void validate() throws ControlLoopException {
+ commonCommandLineArguments.validate(configurationFilePath);
+ }
+
+ /**
+ * Gets the full expanded configuration file path.
+ *
+ * @return the configuration file path
+ */
+ public String getFullConfigurationFilePath() {
+ return ResourceUtils.getFilePath4Resource(getConfigurationFilePath());
+ }
+
+ /**
+ * Check set configuration file path.
+ *
+ * @return true, if check set configuration file path
+ */
+ public boolean checkSetConfigurationFilePath() {
+ return !StringUtils.isEmpty(configurationFilePath);
+ }
+}
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
new file mode 100644
index 000000000..46db712b6
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
+ <persistence-unit name="ToscaConceptTest" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+
+ <class>org.onap.policy.models.base.PfConceptKey</class>
+ <class>org.onap.policy.models.dao.converters.CDataConditioner</class>
+ <class>org.onap.policy.models.dao.converters.Uuid2String</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpStatistics</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignment</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignments</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityType</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityTypes</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeType</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTypes</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaParameter</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRelationshipType</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRelationshipTypes</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRequirement</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRequirements</class>
+ <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>
+ <properties>
+ <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
+ <property name="eclipselink.ddl-generation.output-mode" value="database" />
+ <property name="eclipselink.logging.level" value="INFO" />
+
+ <!-- property name="eclipselink.logging.level" value="ALL" />
+ <property name="eclipselink.logging.level.jpa" value="ALL" />
+ <property name="eclipselink.logging.level.ddl" value="ALL" />
+ <property name="eclipselink.logging.level.connection" value="ALL" />
+ <property name="eclipselink.logging.level.sql" value="ALL" />
+ <property name="eclipselink.logging.level.transaction" value="ALL" />
+ <property name="eclipselink.logging.level.sequencing" value="ALL" />
+ <property name="eclipselink.logging.level.server" value="ALL" />
+ <property name="eclipselink.logging.level.query" value="ALL" />
+ <property name="eclipselink.logging.level.properties" value="ALL" /-->
+ </properties>
+ <shared-cache-mode>NONE</shared-cache-mode>
+ </persistence-unit>
+</persistence>
+
diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/config/PolicyParticipantConfig.json b/participant/participant-impl/participant-impl-policy/src/main/resources/config/PolicyParticipantConfig.json
new file mode 100644
index 000000000..e6b3c8eb1
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/resources/config/PolicyParticipantConfig.json
@@ -0,0 +1,31 @@
+{
+ "name":"ParticipantParameterGroup",
+ "participantStatusParameters":{
+ "timeIntervalMs":10000,
+ "description":"Participant Status",
+ "participantId":{
+ "name": "PolicyParticipant0",
+ "version":"1.0.0"
+ },
+ "participantType":{
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version":"2.3.1"
+ },
+ "participantDefinition":{
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version":"2.3.1"
+ }
+ },
+ "topicParameterGroup": {
+ "topicSources" : [{
+ "topic" : "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers" : [ "127.0.0.1:3904" ],
+ "topicCommInfrastructure" : "dmaap"
+ }],
+ "topicSinks" : [{
+ "topic" : "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers" : [ "127.0.0.1:3904" ],
+ "topicCommInfrastructure" : "dmaap"
+ }]
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/version.txt b/participant/participant-impl/participant-impl-policy/src/main/resources/version.txt
new file mode 100644
index 000000000..dbd67585f
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/resources/version.txt
@@ -0,0 +1,4 @@
+ONAP Tosca defined control loop Participant
+Version: ${project.version}
+Built (UTC): ${maven.build.timestamp}
+ONAP https://wiki.onap.org
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/TestPolicyHandler.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/TestPolicyHandler.java
new file mode 100644
index 000000000..abc3e71b8
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/TestPolicyHandler.java
@@ -0,0 +1,134 @@
+/*-
+ * ============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.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.common.ControlLoopConstants;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopStateChangeListener;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopUpdateListener;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.policy.main.startstop.Main;
+import org.onap.policy.clamp.controlloop.participant.policy.main.startstop.ParticipantPolicyActivator;
+import org.onap.policy.clamp.controlloop.participant.policy.main.utils.TestListenerUtils;
+import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
+import org.onap.policy.common.utils.services.Registry;
+
+public class TestPolicyHandler {
+
+ private static ControlLoopUpdateListener clUpdateListener;
+ private ControlLoopStateChangeListener clStateChangeListener;
+ private static ParticipantControlLoopUpdate participantControlLoopUpdateMsg;
+ private ParticipantControlLoopStateChange participantControlLoopStateChangeMsg;
+ private static final String PARTICIPANTS_ENDPOINT = "participants";
+ private static final String ELEMENTS_ENDPOINT = "elements";
+ private static final CommInfrastructure INFRA = CommInfrastructure.NOOP;
+ private static final String TOPIC = "my-topic";
+ private static final Object lockit = new Object();
+ static CommonTestData commonTestData = new CommonTestData();
+
+ /**
+ * Setup before class, instantiate Main.
+ *
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ Registry.newRegistry();
+ final String[] configParameters = {"-c", "src/test/resources/parameters/TestParameters.json"};
+ Main main = new Main(configParameters);
+ assertTrue(main.isRunning());
+ TestListenerUtils.initParticipantHandler();
+
+ clUpdateListener = new ControlLoopUpdateListener(
+ PolicyHandler.getInstance()
+ .getPolicyProvider()
+ .getIntermediaryApi()
+ .getParticipantHandler());
+ participantControlLoopUpdateMsg =
+ TestListenerUtils.createControlLoopUpdateMsg();
+ participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE);
+ }
+
+ @Test
+ public void testUpdatePolicyTypes() throws Exception {
+ // Verify that the ToscaServicetemplate has policy_types
+ assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition().getPolicyTypes());
+
+ synchronized (lockit) {
+ clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg);
+ }
+ // Verify the result of GET participants with what is stored
+ assertEquals("org.onap.PM_Policy",
+ TestListenerUtils.getParticipantHandler().getParticipantId().getName());
+ }
+
+ @Test
+ public void testUpdatePolicies() throws Exception {
+ // Add policies to the toscaServiceTemplate
+ TestListenerUtils.addPoliciesToToscaServiceTemplate(participantControlLoopUpdateMsg.getControlLoopDefinition());
+
+ // Verify that the ToscaServicetemplate has policies
+ assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition()
+ .getToscaTopologyTemplate().getPolicies());
+
+ synchronized (lockit) {
+ clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg);
+ }
+ // Verify the result of GET participants with what is stored
+ assertEquals("org.onap.PM_Policy",
+ TestListenerUtils.getParticipantHandler().getParticipantId().getName());
+ }
+
+ @Test
+ public void testDeletePoliciesAndPolicyTypes() throws Exception {
+ // Add policies to the toscaServiceTemplate
+ TestListenerUtils.addPoliciesToToscaServiceTemplate(participantControlLoopUpdateMsg.getControlLoopDefinition());
+
+ // Verify that the ToscaServicetemplate has policies
+ assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition()
+ .getToscaTopologyTemplate().getPolicies());
+
+ synchronized (lockit) {
+ clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg);
+ }
+ // Verify the result of GET participants with what is stored
+ assertEquals("org.onap.PM_Policy",
+ TestListenerUtils.getParticipantHandler().getParticipantId().getName());
+
+ clStateChangeListener = new ControlLoopStateChangeListener(TestListenerUtils.getParticipantHandler());
+ participantControlLoopStateChangeMsg =
+ TestListenerUtils.createControlLoopStateChangeMsg(ControlLoopOrderedState.UNINITIALISED);
+ participantControlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
+ clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopStateChangeMsg);
+
+ // Verify the result of GET participants with what is stored
+ assertEquals("org.onap.PM_Policy",
+ TestListenerUtils.getParticipantHandler().getParticipantId().getName());
+ }
+}
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/controlloop/participant/policy/main/parameters/CommonTestData.java
new file mode 100644
index 000000000..e3d7e3aa5
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
@@ -0,0 +1,221 @@
+/*-
+ * ============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.parameters;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import javax.ws.rs.core.Response;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.common.endpoints.parameters.TopicParameters;
+import org.onap.policy.common.parameters.ParameterGroup;
+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.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 DESCRIPTION = "Participant description";
+ public static final long TIME_INTERVAL = 2000;
+ public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams());
+
+ public static final Coder coder = new StandardCoder();
+
+ /**
+ * Converts the contents of a map to a parameter class.
+ *
+ * @param source property map
+ * @param clazz class of object to be created from the map
+ * @return a new object represented by the map
+ */
+ public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) {
+ try {
+ return coder.convert(source, clazz);
+ } catch (final CoderException e) {
+ throw new RuntimeException("cannot create " + clazz.getName() + " from map", e);
+ }
+ }
+
+ /**
+ * Returns a property map for a ParticipantPolicyParameters map for test cases.
+ *
+ * @param name name of the parameters
+ *
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getParticipantPolicyParametersMap(final String name) {
+ final Map<String, Object> map = new TreeMap<>();
+
+ map.put("name", name);
+ map.put("intermediaryParameters", getIntermediaryParametersMap(false));
+ map.put("databaseProviderParameters", getDatabaseProviderParametersMap(false));
+ return map;
+ }
+
+ /**
+ * Returns a property map for a databaseProviderParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getDatabaseProviderParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ if (!isEmpty) {
+ map.put("name", "PolicyProviderParameterGroup");
+ map.put("implementation", "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl");
+ map.put("databaseDriver", "org.h2.Driver");
+ map.put("databaseUrl", "jdbc:h2:mem:testdb");
+ map.put("databaseUser", "policy");
+ map.put("databasePassword", "P01icY");
+ map.put("persistenceUnit", "ToscaConceptTest");
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a property map for a intermediaryParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getIntermediaryParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ if (!isEmpty) {
+ map.put("name", "Participant parameters");
+ map.put("reportingTimeInterval", TIME_INTERVAL);
+ map.put("description", DESCRIPTION);
+ map.put("participantId", getParticipantId());
+ map.put("participantType", getParticipantId());
+ map.put("clampControlLoopTopics", getTopicParametersMap(false));
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a property map for a TopicParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getTopicParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ if (!isEmpty) {
+ map.put("topicSources", TOPIC_PARAMS);
+ map.put("topicSinks", TOPIC_PARAMS);
+ }
+ return map;
+ }
+
+ /**
+ * Returns topic parameters for test cases.
+ *
+ * @return topic parameters
+ */
+ public static TopicParameters getTopicParams() {
+ final TopicParameters topicParams = new TopicParameters();
+ topicParams.setTopic("POLICY-CLRUNTIME-PARTICIPANT");
+ topicParams.setTopicCommInfrastructure("dmaap");
+ topicParams.setServers(Arrays.asList("localhost"));
+ return topicParams;
+ }
+
+ /**
+ * Returns participantId for test cases.
+ *
+ * @return participant Id
+ */
+ public static ToscaConceptIdentifier getParticipantId() {
+ final ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "0.0.0");
+ return participantId;
+ }
+
+ /**
+ * Gets the standard participant parameters.
+ *
+ * @param port port to be inserted into the parameters
+ * @return the standard participant parameters
+ */
+ public ParticipantPolicyParameters getParticipantPolicyParameters(int port) {
+ try {
+ return coder.decode(getParticipantPolicyParametersAsString(port), ParticipantPolicyParameters.class);
+
+ } catch (CoderException e) {
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
+ "cannot read participant parameters", e);
+ }
+ }
+
+ /**
+ * Gets the standard participant parameters, as a String.
+ *
+ * @param port port to be inserted into the parameters
+ * @return the standard participant parameters
+ */
+ public static String getParticipantPolicyParametersAsString(int port) {
+
+ try {
+ File file = new File(getParamFile());
+ String json = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8);
+
+ json = json.replace("${port}", String.valueOf(port));
+ json = json.replace("${dbName}", "jdbc:h2:mem:testdb");
+
+ return json;
+
+ } catch (IOException e) {
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
+ "cannot read participant parameters", e);
+
+ }
+ }
+
+ /**
+ * Gets the full path to the parameter file, which may vary depending on whether or
+ * not this is an end-to-end test.
+ *
+ * @return the parameter file name
+ */
+ private static String getParamFile() {
+ String paramFile = "src/test/resources/parameters/TestParametersStd.json";
+ return paramFile;
+ }
+
+ /**
+ * Nulls out a field within a JSON string.
+ * @param json JSON string
+ * @param field field to be nulled out
+ * @return a new JSON string with the field nulled out
+ */
+ public String nullifyField(String json, String field) {
+ return json.replace(field + "\"", field + "\":null, \"" + field + "Xxx\"");
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameterHandler.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameterHandler.java
new file mode 100644
index 000000000..dd62dbfc4
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameterHandler.java
@@ -0,0 +1,98 @@
+/*-
+ * ============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.parameters;
+
+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.assertTrue;
+
+import java.io.FileNotFoundException;
+import org.apache.commons.io.DirectoryWalker.CancelException;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.participant.policy.main.startstop.ParticipantPolicyCommandLineArguments;
+import org.onap.policy.common.utils.coder.CoderException;
+
+public class TestParticipantPolicyParameterHandler {
+
+ @Test
+ public void testParameterHandlerNoParameterFile() throws ControlLoopException {
+ final String[] emptyArgumentString = { "-c", "src/test/resources/parameters/NoParametersFile.json" };
+
+ final ParticipantPolicyCommandLineArguments emptyArguments = new ParticipantPolicyCommandLineArguments();
+ emptyArguments.parse(emptyArgumentString);
+
+ assertThatThrownBy(() -> new ParticipantPolicyParameterHandler().getParameters(emptyArguments))
+ .hasCauseInstanceOf(CoderException.class)
+ .hasRootCauseInstanceOf(FileNotFoundException.class);
+ }
+
+ @Test
+ public void testParameterHandlerInvalidParameters() throws ControlLoopException {
+ final String[] invalidArgumentString = { "-c", "src/test/resources/parameters/InvalidParameters.json" };
+
+ final ParticipantPolicyCommandLineArguments invalidArguments =
+ new ParticipantPolicyCommandLineArguments();
+ invalidArguments.parse(invalidArgumentString);
+
+ assertThatThrownBy(() -> new ParticipantPolicyParameterHandler().getParameters(invalidArguments))
+ .hasMessageStartingWith("error reading parameters from")
+ .hasCauseInstanceOf(CoderException.class);
+ }
+
+ @Test
+ public void testParticipantPolicyParameters() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json" };
+
+ final ParticipantPolicyCommandLineArguments arguments = new ParticipantPolicyCommandLineArguments();
+ arguments.parse(participantConfigParameters);
+
+ final ParticipantPolicyParameters parGroup = new ParticipantPolicyParameterHandler()
+ .getParameters(arguments);
+ assertTrue(arguments.checkSetConfigurationFilePath());
+ assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, parGroup.getName());
+ }
+
+ @Test
+ public void testParticipantVersion() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-v" };
+ final ParticipantPolicyCommandLineArguments arguments = new ParticipantPolicyCommandLineArguments();
+ final String version = arguments.parse(participantConfigParameters);
+ assertThat(arguments.parse(participantConfigParameters)).startsWith(
+ "ONAP Tosca defined control loop Participant");
+ }
+
+ @Test
+ public void testParticipantHelp() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-h" };
+ final ParticipantPolicyCommandLineArguments arguments = new ParticipantPolicyCommandLineArguments();
+ assertThat(arguments.parse(participantConfigParameters)).startsWith("usage:");
+ }
+
+ @Test
+ public void testParticipantInvalidOption() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-d" };
+ final ParticipantPolicyCommandLineArguments arguments = new ParticipantPolicyCommandLineArguments();
+ assertThatThrownBy(() -> arguments.parse(participantConfigParameters))
+ .hasMessageStartingWith("invalid command line arguments specified");
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameters.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameters.java
new file mode 100644
index 000000000..5ffe5101d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameters.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.controlloop.participant.policy.main.parameters;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
+import java.util.Map;
+import org.junit.Test;
+import org.onap.policy.common.parameters.ValidationResult;
+
+public class TestParticipantPolicyParameters {
+ CommonTestData commonTestData = new CommonTestData();
+
+ @Test
+ public void testParticipantPolicyParameters_Named() {
+ final ParticipantPolicyParameters participantParameters = new ParticipantPolicyParameters("my-name");
+ assertEquals("my-name", participantParameters.getName());
+ }
+
+ @Test
+ public void testParticipantPolicyParameters() {
+ final ParticipantPolicyParameters participantParameters = commonTestData.toObject(
+ commonTestData.getParticipantPolicyParametersMap(CommonTestData.PARTICIPANT_GROUP_NAME),
+ ParticipantPolicyParameters.class);
+ assertThat(participantParameters.validate().isValid()).isTrue();
+ }
+
+ @Test
+ public void testParticipantPolicyParameters_NullName() {
+ final ParticipantPolicyParameters participantParameters = commonTestData
+ .toObject(commonTestData.getParticipantPolicyParametersMap(null),
+ ParticipantPolicyParameters.class);
+ final ValidationResult validationResult = participantParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertEquals(null, participantParameters.getName());
+ assertThat(validationResult.getResult()).contains("is null");
+ }
+
+ @Test
+ public void testParticipantPolicyParameters_EmptyName() {
+ final ParticipantPolicyParameters participantParameters = commonTestData
+ .toObject(commonTestData.getParticipantPolicyParametersMap(""),
+ ParticipantPolicyParameters.class);
+ final ValidationResult validationResult = participantParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertEquals("", participantParameters.getName());
+ assertThat(validationResult.getResult()).contains(
+ "item \"name\" value \"\" INVALID, " + "is blank");
+ }
+
+ @Test
+ public void testParticipantPolicyParameters_SetName() {
+ final ParticipantPolicyParameters participantParameters = commonTestData.toObject(
+ commonTestData.getParticipantPolicyParametersMap(CommonTestData.PARTICIPANT_GROUP_NAME),
+ ParticipantPolicyParameters.class);
+ participantParameters.setName("ParticipantNewGroup");
+ assertThat(participantParameters.validate().isValid()).isTrue();
+ assertEquals("ParticipantNewGroup", participantParameters.getName());
+ }
+
+ @Test
+ public void testParticipantPolicyParameters_EmptyParticipantIntermediaryParameters() {
+ final Map<String, Object> map =
+ commonTestData.getParticipantPolicyParametersMap(CommonTestData.PARTICIPANT_GROUP_NAME);
+ map.replace("intermediaryParameters", commonTestData.getIntermediaryParametersMap(true));
+ final ParticipantPolicyParameters participantParameters =
+ commonTestData.toObject(map, ParticipantPolicyParameters.class);
+ final ValidationResult validationResult = participantParameters.validate();
+ assertNull(validationResult.getResult());
+ }
+
+ @Test
+ public void testParticipantPolicyParametersp_EmptyTopicParameters() {
+ final Map<String, Object> map =
+ commonTestData.getParticipantPolicyParametersMap(CommonTestData.PARTICIPANT_GROUP_NAME);
+ final Map<String, Object> intermediaryParametersMap = commonTestData.getIntermediaryParametersMap(false);
+ intermediaryParametersMap.put("clampControlLoopTopics", commonTestData.getTopicParametersMap(true));
+ map.replace("intermediaryParameters", intermediaryParametersMap);
+
+ final ParticipantPolicyParameters participantParameters =
+ commonTestData.toObject(map, ParticipantPolicyParameters.class);
+ final ValidationResult validationResult = participantParameters.validate();
+ assertNull(validationResult.getResult());
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestMain.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestMain.java
new file mode 100644
index 000000000..f77b678c0
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestMain.java
@@ -0,0 +1,143 @@
+/*-
+ * ============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.startstop;
+
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.common.ControlLoopConstants;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.common.utils.resources.MessageConstants;
+import org.onap.policy.common.utils.services.Registry;
+
+public class TestMain {
+
+ /**
+ * Set up.
+ */
+ @BeforeClass
+ public static void setUp() {
+ Registry.newRegistry();
+ }
+
+ /**
+ * Shuts "main" down.
+ *
+ * @throws Exception if an error occurs
+ */
+ @AfterClass
+ public static void tearDown() throws Exception {
+ // shut down activator
+ final ParticipantPolicyActivator activator =
+ Registry.getOrDefault(ControlLoopConstants.REG_CLRUNTIME_ACTIVATOR,
+ ParticipantPolicyActivator.class, null);
+ if (activator != null && activator.isAlive()) {
+ activator.shutdown();
+ }
+ }
+
+ @Test
+ public void testMain_Help() {
+ final String[] configParameters = {"-h"};
+ Main main = new Main(configParameters);
+ assertFalse(main.isRunning());
+ }
+
+ @Test
+ public void testMain_Version() {
+ final String[] configParameters = {"-v"};
+ Main main = new Main(configParameters);
+ assertFalse(main.isRunning());
+ }
+
+ @Test
+ public void testMain_Valid() {
+ final String[] configParameters = {"-c", "src/test/resources/parameters/TestParameters.json"};
+ Main main = new Main(configParameters);
+ assertTrue(main.isRunning());
+
+ assertThatCode(() -> main.shutdown()).doesNotThrowAnyException();
+
+ assertFalse(main.isRunning());
+ }
+
+ @Test
+ public void testMain_NoParameter() {
+ assertThatConfigParameterThrownException(new String[] {});
+ }
+
+ @Test
+ public void testMain_FilePathNotDefined() {
+ assertThatConfigParameterThrownException(new String[] {"-c"});
+ }
+
+ @Test
+ public void testMain_TooManyCommand() {
+ assertThatConfigParameterThrownException(new String[] {"-h", "d"});
+ }
+
+ @Test
+ public void testMain_WrongParameter() {
+ assertThatConfigParameterThrownException(new String[] {"-d"});
+ }
+
+ private void assertThatConfigParameterThrownException(final String[] configParameters) {
+ assertThatThrownBy(() -> Main.main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class)
+ .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP));
+ }
+
+ @Test
+ public void testParticipant_NoFileWithThisName() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/NoFileWithThisName.json");
+ }
+
+ @Test
+ public void testParticipant_NotValidFile() {
+ assertThatConfigFileThrownException("src/test/resources/parameters");
+ }
+
+ @Test
+ public void testParticipant_NoParameters() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/NoParameters.json");
+ }
+
+ @Test
+ public void testParticipant_InvalidParameters() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/InvalidParameters.json");
+ }
+
+ @Test
+ public void testParticipant_WrongJsonFormat() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/Unreadable.json");
+ }
+
+ private void assertThatConfigFileThrownException(final String configFilePath) {
+ final String[] configParameters = new String[] {"-c", configFilePath};
+ assertThatThrownBy(() -> new Main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class)
+ .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP));
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestParticipantPolicyActivator.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestParticipantPolicyActivator.java
new file mode 100644
index 000000000..afb0f6cb4
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/startstop/TestParticipantPolicyActivator.java
@@ -0,0 +1,88 @@
+/*-
+ * ============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.startstop;
+
+import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameterHandler;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters;
+import org.onap.policy.common.utils.services.Registry;
+
+public class TestParticipantPolicyActivator {
+
+ private static ParticipantPolicyActivator activator;
+
+ /**
+ * Initializes an activator.
+ *
+ * @throws Exception if an error occurs
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ Registry.newRegistry();
+ final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json"};
+ final ParticipantPolicyCommandLineArguments arguments =
+ new ParticipantPolicyCommandLineArguments(participantConfigParameters);
+ final ParticipantPolicyParameters parGroup =
+ new ParticipantPolicyParameterHandler().getParameters(arguments);
+ activator = new ParticipantPolicyActivator(parGroup);
+ }
+
+ /**
+ * Method for cleanup after each test.
+ *
+ * @throws Exception if an error occurs
+ */
+ @AfterClass
+ public static void teardown() throws Exception {
+ // shut down activator
+ if (activator != null && activator.isAlive()) {
+ activator.shutdown();
+ }
+ }
+
+ @Test
+ public void testParticipantActivator() {
+ activator.start();
+ assertTrue(activator.isAlive());
+ assertTrue(activator.getParameters().isValid());
+ assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, activator.getParameters().getName());
+
+ // repeat - should throw an exception
+ assertThatIllegalStateException().isThrownBy(() -> activator.start());
+ assertTrue(activator.isAlive());
+ assertTrue(activator.getParameters().isValid());
+
+ activator.shutdown();
+ assertFalse(activator.isAlive());
+
+ // repeat - should throw an exception
+ assertThatIllegalStateException().isThrownBy(() -> activator.shutdown());
+ assertFalse(activator.isAlive());
+ }
+}
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
new file mode 100644
index 000000000..4f3d6d62c
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
@@ -0,0 +1,343 @@
+/*-
+ * ============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.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import lombok.Getter;
+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.ParticipantState;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
+import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.controlloop.participant.policy.main.handler.PolicyProvider;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters;
+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;
+
+public 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);
+
+ @Getter
+ private static ParticipantHandler participantHandler;
+
+ private TestListenerUtils() {}
+
+ /**
+ * Method to initialize participantHandler.
+ */
+ public static void initParticipantHandler() {
+
+ final ParticipantPolicyParameters participantParameters = commonTestData.toObject(
+ commonTestData.getParticipantPolicyParametersMap(CommonTestData.PARTICIPANT_GROUP_NAME),
+ ParticipantPolicyParameters.class);
+
+ PolicyProvider policyProvider =
+ new PolicyProvider(participantParameters.getIntermediaryParameters());
+
+ participantHandler = policyProvider.getIntermediaryApi().getParticipantHandler();
+ }
+
+ /**
+ * 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 ParticipantStateChange message from the arguments passed.
+ *
+ * @param participantState participant State
+ *
+ * @return ParticipantStateChange message
+ */
+ public static ParticipantStateChange createParticipantStateChangeMsg(final ParticipantState participantState) {
+ final ParticipantStateChange participantStateChangeMsg = new ParticipantStateChange();
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
+ participantId.setName("org.onap.PM_Policy");
+ participantId.setVersion("0.0.0");
+
+ participantStateChangeMsg.setParticipantId(participantId);
+ participantStateChangeMsg.setTimestamp(Instant.now());
+ participantStateChangeMsg.setState(participantState);
+
+ return participantStateChangeMsg;
+ }
+
+ /**
+ * Method to create ControlLoopStateChange message from the arguments passed.
+ *
+ * @param controlLoopOrderedState controlLoopOrderedState
+ *
+ * @return ParticipantControlLoopStateChange message
+ */
+ public static ParticipantControlLoopStateChange createControlLoopStateChangeMsg(
+ final ControlLoopOrderedState controlLoopOrderedState) {
+ final ParticipantControlLoopStateChange participantClStateChangeMsg = new ParticipantControlLoopStateChange();
+
+ 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");
+
+ participantClStateChangeMsg.setControlLoopId(controlLoopId);
+ participantClStateChangeMsg.setParticipantId(participantId);
+ participantClStateChangeMsg.setTimestamp(Instant.now());
+ participantClStateChangeMsg.setOrderedState(controlLoopOrderedState);
+
+ return participantClStateChangeMsg;
+ }
+
+ /**
+ * Method to create ControlLoopUpdateMsg.
+ *
+ * @return ParticipantControlLoopUpdate message
+ */
+ public static ParticipantControlLoopUpdate createControlLoopUpdateMsg() {
+ final ParticipantControlLoopUpdate clUpdateMsg = new ParticipantControlLoopUpdate();
+ 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");
+
+ clUpdateMsg.setControlLoopId(controlLoopId);
+ clUpdateMsg.setParticipantId(participantId);
+
+ 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");
+ controlLoop.setDefinition(controlLoopId);
+ clUpdateMsg.setControlLoop(controlLoop);
+ clUpdateMsg.setControlLoopDefinition(toscaServiceTemplate);
+
+ return clUpdateMsg;
+ }
+
+ /**
+ * Method to create ParticipantHealthCheck message.
+ *
+ * @return ParticipantHealthCheck message
+ */
+ public static ParticipantHealthCheck createParticipantHealthCheckMsg() {
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
+ participantId.setName("org.onap.PM_Policy");
+ participantId.setVersion("0.0.0");
+
+ ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier();
+ controlLoopId.setName("PMSHInstance0");
+ controlLoopId.setVersion("1.0.0");
+
+ final ParticipantHealthCheck participantHealthCheckMsg = new ParticipantHealthCheck();
+ participantHealthCheckMsg.setParticipantId(participantId);
+ participantHealthCheckMsg.setControlLoopId(controlLoopId);
+ participantHealthCheckMsg.setTimestamp(Instant.now());
+ participantHealthCheckMsg.setState(ParticipantState.PASSIVE);
+
+ return participantHealthCheckMsg;
+ }
+
+ /**
+ * Method to create ParticipantControlLoopUpdate using the arguments passed.
+ *
+ * @param jsonFilePath the path of the controlloop content
+ *
+ * @return ParticipantControlLoopUpdate message
+ * @throws CoderException exception while reading the file to object
+ */
+ public static ParticipantControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath)
+ throws CoderException {
+ ParticipantControlLoopUpdate participantControlLoopUpdateMsg =
+ CODER.decode(new File(jsonFilePath), ParticipantControlLoopUpdate.class);
+ return participantControlLoopUpdateMsg;
+ }
+
+ 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/parameters/InvalidParameters.json b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/InvalidParameters.json
new file mode 100644
index 000000000..1035ccb67
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/InvalidParameters.json
@@ -0,0 +1,3 @@
+{
+ "name": "
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/MinimumParametersH2.json b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/MinimumParametersH2.json
new file mode 100644
index 000000000..30250be68
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/MinimumParametersH2.json
@@ -0,0 +1,53 @@
+{
+ "name": "ControlLoopParticipantGroup",
+ "intermediaryParameters": {
+ "name": "Participant parameters",
+ "reportingTimeInterval": 120000,
+ "description": "Participant Description",
+ "participantType":{
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version":"2.3.1"
+ },
+ "participantId": {
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
+ },
+ "clampControlLoopTopics": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/NoParameters.json b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/NoParameters.json
new file mode 100644
index 000000000..7a73a41bf
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/NoParameters.json
@@ -0,0 +1,2 @@
+{
+} \ No newline at end of file
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
new file mode 100644
index 000000000..c2ffb40a9
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml
@@ -0,0 +1,161 @@
+tosca_definitions_version: "tosca_simple_yaml_1_3"
+data_types:
+ onap.datatypes.ToscaConceptIdentifier:
+ derived_from: tosca.datatypes.Root
+ properties:
+ name:
+ type: string
+ required: true
+ version:
+ type: string
+ required: true
+node_types:
+ org.onap.policy.clamp.controlloop.Participant:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ org.onap.policy.clamp.controlloop.ControlLoopElement:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ participant_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.controlloop.ControlLoop:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ elements:
+ type: list
+ required: true
+ entry_schema:
+ type: onap.datatypes.ToscaConceptIdentifier
+ org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ properties:
+ dcae_blueprint_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ properties:
+ policy_type_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ properties:
+ cds_blueprint_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+topology_template:
+ node_templates:
+ org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:
+ version: 2.3.4
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.policy.controlloop.MonitoringPolicyControlLoopParticipant:
+ version: 2.3.1
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.policy.controlloop.OperationalPolicyControlLoopParticipant:
+ version: 3.2.1
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant:
+ version: 2.2.1
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.domain.pmsh.PMSH_DCAEMicroservice:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ version: 2.3.4
+ dcae_blueprint_id:
+ name: org.onap.dcae.blueprints.PMSHBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.policy.controlloop.MonitoringPolicyControlLoopParticipant
+ version: 2.3.1
+ policy_type_id:
+ name: onap.policies.monitoring.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the operational policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.policy.controlloop.OperationalPolicyControlLoopParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.operational.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.ControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for CDS for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_Id:
+ name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
+ version: 3.2.1
+ cds_blueprint_id:
+ name: org.onap.ccsdk.cds.PMSHCdsBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSHControlLoopDefinition:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.ControlLoop
+ type_version: 1.0.0
+ description: Control loop for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ elements:
+ - name: org.onap.domain.pmsh.PMSH_DCAEMicroservice
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement
+ version: 1.2.3
+
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParameters.json b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParameters.json
new file mode 100644
index 000000000..30250be68
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParameters.json
@@ -0,0 +1,53 @@
+{
+ "name": "ControlLoopParticipantGroup",
+ "intermediaryParameters": {
+ "name": "Participant parameters",
+ "reportingTimeInterval": 120000,
+ "description": "Participant Description",
+ "participantType":{
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version":"2.3.1"
+ },
+ "participantId": {
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
+ },
+ "clampControlLoopTopics": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParametersStd.json b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParametersStd.json
new file mode 100644
index 000000000..79540631a
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParametersStd.json
@@ -0,0 +1,53 @@
+{
+ "name": "ControlLoopParticipantGroup",
+ "intermediaryParameters": {
+ "name": "Participant parameters",
+ "reportingTimeInterval": 120000,
+ "description": "Participant Description",
+ "participantType": {
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version": "2.3.1"
+ },
+ "participantId": {
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
+ },
+ "clampControlLoopTopics": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/Unreadable.json b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/Unreadable.json
new file mode 100644
index 000000000..efbfbe29f
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/Unreadable.json
@@ -0,0 +1,73 @@
+{
+ "name": "ControlLoopRuntimeGroup",
+ "participantParameters": {
+ "heartBeatMs": 120000,
+ "updateParameters": {
+ "maxRetryCount": 1,
+ "maxWaitMs": 30000
+ },
+ "stateChangeParameters": {
+ "maxRetryCount": 1,
+ "maxWaitMs": 30000
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ },
+ "topicParameterGroup": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ },
+ "healthCheckRestClientParameters": [
+ {
+ "clientName": "api",
+ "hostname": "policy-api",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "policy/api/v1/healthcheck"
+ },
+ {
+ "clientName": "distribution",
+ "hostname": "policy-distribution",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "healthcheck"
+ }
+ ]
+}
+
+
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
new file mode 100644
index 000000000..cf6b89eb9
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+-->
+
+<configuration>
+
+ <contextName>Participant</contextName>
+ <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
+ <property name="LOG_DIR" value="${java.io.tmpdir}/clamp_logging/" />
+
+ <!-- USE FOR STD OUT ONLY -->
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
+ </encoder>
+ </appender>
+
+ <root level="info">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <logger name="org.onap.policy.clamp.controlloop.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
new file mode 100644
index 000000000..126e8e6e2
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml
@@ -0,0 +1,348 @@
+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
new file mode 100644
index 000000000..88b870580
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Match.yaml
@@ -0,0 +1,8 @@
+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
new file mode 100644
index 000000000..bde730cd7
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Naming.yaml
@@ -0,0 +1,102 @@
+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
new file mode 100644
index 000000000..7fe0e59de
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Optimization.yaml
@@ -0,0 +1,33 @@
+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
new file mode 100644
index 000000000..3dc979220
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.Common.yaml
@@ -0,0 +1,28 @@
+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
new file mode 100644
index 000000000..f2b67e18f
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml
@@ -0,0 +1,16 @@
+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
new file mode 100644
index 000000000..ea8e92aaf
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Filter.yaml
@@ -0,0 +1,66 @@
+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
new file mode 100644
index 000000000..3e31ec218
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml
@@ -0,0 +1,26 @@
+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
new file mode 100644
index 000000000..8f93572bf
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.MinMax.yaml
@@ -0,0 +1,24 @@
+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
new file mode 100644
index 000000000..eaeee605d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml
@@ -0,0 +1,27 @@
+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
new file mode 100644
index 000000000..9b3b057b8
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.Common.yaml
@@ -0,0 +1,143 @@
+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
new file mode 100644
index 000000000..a0c5b2456
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Apex.yaml
@@ -0,0 +1,26 @@
+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
new file mode 100644
index 000000000..69d73db58
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Drools.yaml
@@ -0,0 +1,14 @@
+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
new file mode 100644
index 000000000..c50392eca
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-mapper.yaml
@@ -0,0 +1,50 @@
+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
new file mode 100644
index 000000000..8ac9b7484
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-subscription-handler.yaml
@@ -0,0 +1,132 @@
+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
new file mode 100644
index 000000000..58e60e98d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml
@@ -0,0 +1,128 @@
+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
new file mode 100644
index 000000000..408e8cd00
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 000000000..04026b323
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.tcagen2.yaml
@@ -0,0 +1,161 @@
+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
new file mode 100644
index 000000000..d2a7632f3
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Apex.yaml
@@ -0,0 +1,203 @@
+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
new file mode 100644
index 000000000..0ae96dbc2
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Drools.yaml
@@ -0,0 +1,118 @@
+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
new file mode 100644
index 000000000..eb25cdb91
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Xacml.yaml
@@ -0,0 +1,20 @@
+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
new file mode 100644
index 000000000..6b3a2460d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Resource.yaml
@@ -0,0 +1,25 @@
+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
new file mode 100644
index 000000000..8b37a67e7
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Service.yaml
@@ -0,0 +1,17 @@
+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
new file mode 100644
index 000000000..bb6adb0aa
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml
@@ -0,0 +1,33 @@
+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
new file mode 100644
index 000000000..f41dcfd6f
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.DistancePolicy.yaml
@@ -0,0 +1,58 @@
+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
new file mode 100644
index 000000000..dfe30774b
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.HpaPolicy.yaml
@@ -0,0 +1,105 @@
+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
new file mode 100644
index 000000000..b0f77d67e
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml
@@ -0,0 +1,68 @@
+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
new file mode 100644
index 000000000..e636582df
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.PciPolicy.yaml
@@ -0,0 +1,32 @@
+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
new file mode 100644
index 000000000..cb387dda1
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.Vim_fit.yaml
@@ -0,0 +1,30 @@
+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
new file mode 100644
index 000000000..30b8b7212
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.VnfPolicy.yaml
@@ -0,0 +1,46 @@
+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
new file mode 100644
index 000000000..2ff263b24
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.QueryPolicy.yaml
@@ -0,0 +1,26 @@
+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
new file mode 100644
index 000000000..81dea2c3c
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml
@@ -0,0 +1,36 @@
+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_control_loop_tosca.yaml
new file mode 100644
index 000000000..7d92a0884
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_control_loop_tosca.yaml
@@ -0,0 +1,614 @@
+tosca_definitions_version: tosca_simple_yaml_1_3
+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
+capability_types:
+ org.onap.EventProducer:
+ properties:
+ carrier_protocol_type:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ data_format:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - JSON
+ - YAML
+ - JMS
+ event_format:
+ type: string
+ required: true
+ event_format_version:
+ type: string
+ required: false
+ 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.'
+ version: 0.0.1
+ derived_from: tosca.capabilities.Root
+ org.onap.EventConsumer:
+ properties:
+ responding_capability:
+ type: string
+ required: false
+ carrier_protocol_type:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ data_format:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - JSON
+ - YAML
+ - JMS
+ - all valid values should be added here
+ event_format:
+ type: string
+ description: 'examples for event_format: Ves_specification, LinkUp, VnfConfigured,
+ etc.'
+ required: true
+ event_format_version:
+ type: string
+ description: 'examples for event_format_version: 5.28.4, 7.30.1, etc.'
+ required: false
+ 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.'
+ version: 0.0.1
+ derived_from: tosca.capabilities.Root
+node_types:
+ org.onap.DynamicConfig:
+ properties:
+ application_name:
+ type: string
+ description: Value used to tie the config to an application ? should we be
+ using a relationship here instead?
+ required: true
+ application_version:
+ type: string
+ required: true
+ application_provider:
+ type: string
+ required: false
+ data_types:
+ type: object
+ required: false
+ schema:
+ type: object
+ required: false
+ version: 0.0.1
+ derived_from: tosca.nodes.Root
+ org.onap.APP:
+ 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
+ required: false
+ monitoring_policy:
+ type: string
+ description: A reference to the monitoring policy
+ required: false
+ requirements:
+ - receive:
+ capability: org.onap.EventProducer
+ relationship: org.onap.PropagateEvent
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ - send:
+ capability: org.onap.EventConsumer
+ relationship: org.onap.PropagateEvent
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ version: 0.0.1
+ derived_from: tosca.nodes.Root
+ org.onap.EventRelay:
+ properties:
+ event_format:
+ type: string
+ description: 'examples for event_format: Ves_specification, etc.'
+ required: true
+ event_format_version:
+ type: string
+ description: 'examples for event_format_version: 5.28.4, 7.30.1, etc.'
+ required: true
+ 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
+ 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}'
+ required: true
+ key_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ - all valid values should be added here
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ - all valid values should be added here
+ supported_data_formats:
+ type: map
+ 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 }'
+ required: true
+ 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:
+ - 0.0
+ - UNBOUNDED
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ - send:
+ capability: org.onap.EventConsumer
+ relationship: org.onap.PropagateEvent
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ version: 0.0.1
+ derived_from: tosca.nodes.Root
+relationship_types:
+ org.onap.PropagateEvent:
+ properties:
+ config_keys:
+ type: list
+ description: The relationship type used on requirements to org.onap.EventProducer
+ and org.onap.EventConsumer capabilities. 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.
+ required: false
+ entry_schema:
+ type: string
+ version: 0.0.1
+ derived_from: tosca.relationships.Root
+topology_template:
+ inputs:
+ pm_subscription_topic:
+ type: string
+ pm_subscription_response_topic:
+ type: string
+ pm_subscription_handler_blueprint_id:
+ type: string
+ pm_subscription_operational_policy_id:
+ type: string
+ pm_subscription_cds_blueprint_id:
+ type: string
+ enable_tls:
+ type: string
+ node_templates:
+ org.onap.PM_Subscription_Handler:
+ type: org.onap.APP
+ type_version: 0.0.0
+ properties:
+ application_name: PM Subscription Handler
+ provider: Ericsson
+ application_version: 1.0.0
+ artifact_id:
+ get_input: pm_subscription_handler_blueprint_id
+ description: Is this a reference to the DCAE Cloudify Blueprint that is
+ already stored(or will be stored before CL configuration & instatiation)
+ in DCAE Inventory?
+ artifact_config:
+ enable_tls:
+ get_input: enable_tls
+ pmsh_publish_topic_name:
+ get_input: pm_subscription_topic
+ capabilities:
+ pm-subscription-event-publisher:
+ properties:
+ carrier_protocol_type: DMAAP_message_router
+ data_format: JSON
+ event_format: pm-subscription-event-format
+ event_format_version: 1.0.0
+ attributes:
+ type: org.onap.EventProducer
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ pm-subscription-event-receiver:
+ properties:
+ carrier_protocol_type: DMAAP_message_router
+ data_format: JSON
+ event_format: pm-subscription-event-response-format
+ event_format_version: 1.0.0
+ relationships:
+ - type: tosca.relationships.DependsOn
+ - description: any ideas on a better realtionship ? or is it better to
+ just use the root realtionship ?
+ - target: org.onap.PM_Monitoring_Policy
+ attributes:
+ type: org.onap.EventConsumer
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ version: 0.0.0
+ org.onap.PM_Monitoring_Policy:
+ type: org.onap.DynamicConfig
+ type_version: 0.0.0
+ properties:
+ application_name: PM Subscription Handler
+ application_version: 1.0.0
+ provider: Ericsson
+ data_types:
+ measurementType:
+ type: string
+ DN:
+ type: string
+ nfFilter:
+ properties:
+ nfNames:
+ type: list
+ entry_schema: string
+ modelInvariantIDs:
+ type: list
+ entry_schema:
+ type: string
+ modelVersionIDs:
+ type: list
+ entry_schema:
+ type: string
+ measurementGroup:
+ properties:
+ masurementTypes:
+ type: list
+ entry_schema:
+ type: measurementType
+ managedObjectDNsBasic:
+ type: list
+ entry_schema:
+ type: DN
+ schema:
+ subscription:
+ subscriptionName:
+ type: string
+ required: true
+ administrativeState:
+ type: string
+ required: true
+ filebasedGP:
+ type: integer
+ required: true
+ fileLocation:
+ type: string
+ required: true
+ nfFilter:
+ type: nfFilter
+ measurementGroups:
+ type: list
+ entry_schema:
+ type: measurementGroup
+ version: 0.0.0
+ description: Should I be showing a dependency between PM Subscription Handler
+ and the PM Monitoring Policy
+ org.onap.PM_Policy:
+ type: org.onap.APP
+ type_version: 0.0.0
+ properties:
+ application_name: PM Subscription Operational Policy
+ provider: Ericsson
+ application_version: 1.0.0
+ artifact_id:
+ get_input: pm_subscription_operational_policy_id
+ artifact_config: NOT_DEFINED
+ requirements:
+ - receive_0:
+ capability: pm-subscription-event-publisher
+ node: org.onap.PM_Subscription_Handler
+ relationship: NOT_DEFINED
+ properties:
+ config_keys:
+ - topic_name:
+ get_input: pm_subscription_topic
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ - send_0:
+ capability: cds-rest-receive
+ node: org.onap.CDS
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ - receive_1:
+ capability: cds-rest-response
+ node: org.onap.CDS
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ - send_1:
+ capability: pm-subscription-event-receiver
+ node: org.onap.PM_Subscription_Handler
+ relationship: NOT_DEFINED
+ properties:
+ config_keys:
+ - topic_name:
+ get_input: pm_subscription_response_topic
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ capabilities:
+ pm-subscription-response-event-publisher:
+ properties:
+ type: org.onap.EventProducer
+ carrier_protocol_type: DMAAP_message_router
+ data_format: JSON
+ event_format: pm-subscription-event-response-format
+ event_format_version: 1.0.0
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ version: 0.0.0
+ org.onap.PM_CDS_Blueprint:
+ type: org.onap.APP
+ type_version: 0.0.0
+ properties:
+ application_name: PM Subscription CDS Blueprint
+ provider: Ericsson
+ application_version: 1.0.0
+ artifact_id:
+ get_input: pm_subscription_cds_blueprint_id
+ capabilities:
+ cds-rest-receive:
+ properties:
+ type: org.onap.EventConsumer
+ protocol_type: REST
+ data_format: JSON
+ event_format: cds_action_format
+ event_format_version: 1.0.0
+ responding_capability: cds-rest-response
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ cds-rest-response:
+ properties:
+ type: org.onap.EventProducer
+ protocol_type: REST
+ data_format: JSON
+ event_format: cds_action_response_format
+ event_format_version: 1.0.0
+ occurrences:
+ - 0.0
+ type: string
+ type_version: 0.0.0
+ version: 0.0.0
+ version: 0.0.0
+ org.onap.controlloop0:
+ type: org.onap.APP
+ type_version: 0.0.0
+ properties:
+ application_name: Test Control Loop
+ provider: Ericsson
+ application_version: 1.0.0
+ status: NOT_DEPLOYED
+ version: 0.0.0
+version: 0.0.0
+
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameterHandler.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameterHandler.java
new file mode 100644
index 000000000..42f458602
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameterHandler.java
@@ -0,0 +1,78 @@
+/*-
+ * ============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.parameters;
+
+import java.io.File;
+import javax.ws.rs.core.Response;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.startstop.ParticipantSimulatorCommandLineArguments;
+import org.onap.policy.common.parameters.ValidationResult;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+
+/**
+ * This class handles reading, parsing and validating of participant simulator parameters from JSON files.
+ */
+public class ParticipantSimulatorParameterHandler {
+
+ private static final Coder CODER = new StandardCoder();
+
+ /**
+ * Read the parameters from the parameter file.
+ *
+ * @param arguments the arguments passed to simulator
+ * @return the parameters read from the configuration file
+ * @throws ControlLoopException on parameter exceptions
+ */
+ public ParticipantSimulatorParameters getParameters(final ParticipantSimulatorCommandLineArguments arguments)
+ throws ControlLoopException {
+ ParticipantSimulatorParameters parameters = null;
+
+ // Read the parameters
+ try {
+ // Read the parameters from JSON
+ File file = new File(arguments.getFullConfigurationFilePath());
+ parameters = CODER.decode(file, ParticipantSimulatorParameters.class);
+ } catch (final CoderException e) {
+ final String errorMessage = "error reading parameters from \"" + arguments.getConfigurationFilePath()
+ + "\"\n" + "(" + e.getClass().getSimpleName() + ")";
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage, e);
+ }
+
+ // The JSON processing returns null if there is an empty file
+ if (parameters == null) {
+ final String errorMessage = "no parameters found in \"" + arguments.getConfigurationFilePath() + "\"";
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage);
+ }
+
+ // validate the parameters
+ final ValidationResult validationResult = parameters.validate();
+ if (!validationResult.isValid()) {
+ String returnMessage =
+ "validation error(s) on parameters from \"" + arguments.getConfigurationFilePath() + "\"\n";
+ returnMessage += validationResult.getResult();
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, returnMessage);
+ }
+
+ return parameters;
+ }
+}
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/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java
new file mode 100644
index 000000000..a4e62b446
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.parameters;
+
+import javax.validation.constraints.NotBlank;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.common.endpoints.parameters.RestServerParameters;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
+import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+
+/**
+ * Class to hold all parameters needed for the participant simulator.
+ *
+ */
+@NotNull
+@NotBlank
+@Getter
+public class ParticipantSimulatorParameters extends ParameterGroupImpl {
+ private RestServerParameters restServerParameters;
+ private ParticipantIntermediaryParameters intermediaryParameters;
+ private PolicyModelsProviderParameters databaseProviderParameters;
+
+ /**
+ * Create the participant simulator parameter group.
+ *
+ * @param name the parameter group name
+ */
+ public ParticipantSimulatorParameters(final String name) {
+ super(name);
+ }
+}
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/controlloop/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java
new file mode 100644
index 000000000..f200f975a
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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 org.onap.policy.common.endpoints.http.server.aaf.AafGranularAuthFilter;
+import org.onap.policy.common.utils.resources.MessageConstants;
+
+/**
+ * Class to manage AAF filters for the participant simulator component.
+ */
+public class ParticipantSimulatorAafFilter extends AafGranularAuthFilter {
+
+ public static final String AAF_NODETYPE = MessageConstants.POLICY_CLAMP + "-participant-simulator";
+ public static final String AAF_ROOT_PERMISSION = DEFAULT_NAMESPACE + "." + AAF_NODETYPE;
+
+ @Override
+ public String getPermissionTypeRoot() {
+ return AAF_ROOT_PERMISSION;
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/RestController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/RestController.java
new file mode 100644
index 000000000..444f37889
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/RestController.java
@@ -0,0 +1,130 @@
+/*-
+ * ============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 io.swagger.annotations.Api;
+import io.swagger.annotations.BasicAuthDefinition;
+import io.swagger.annotations.Info;
+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.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import lombok.AccessLevel;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationHandler;
+import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationProvider;
+
+/**
+ * Common superclass to provide REST endpoints for the participant simulator.
+ */
+// @formatter:off
+@Path("/onap/participantsim/v2")
+@Api(value = "Participant Simulator API")
+@Produces({MediaType.APPLICATION_JSON, RestController.APPLICATION_YAML})
+@SwaggerDefinition(
+ info = @Info(description =
+ "Participant Simulator", version = "v1.0",
+ title = "Participant Simulator"),
+ consumes = {MediaType.APPLICATION_JSON, RestController.APPLICATION_YAML},
+ produces = {MediaType.APPLICATION_JSON, RestController.APPLICATION_YAML},
+ schemes = {SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS},
+ tags = {@Tag(name = "participantsim", description = "Participant Simulator")},
+ securityDefinition = @SecurityDefinition(basicAuthDefinitions = {@BasicAuthDefinition(key = "basicAuth")}))
+// @formatter:on
+public class RestController {
+ public static final String APPLICATION_YAML = "application/yaml";
+
+ public static final String EXTENSION_NAME = "interface info";
+
+ public static final String API_VERSION_NAME = "api-version";
+ 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 VERSION_MINOR_NAME = "X-MinorVersion";
+ public static final String VERSION_MINOR_DESCRIPTION =
+ "Used to request or communicate a MINOR version back from the client"
+ + " to the server, and from the server back to the client";
+
+ public static final String VERSION_PATCH_NAME = "X-PatchVersion";
+ public static final String VERSION_PATCH_DESCRIPTION = "Used only to communicate a PATCH version in a response for"
+ + " troubleshooting purposes only, and will not be provided by" + " the client on request";
+
+ public static final String VERSION_LATEST_NAME = "X-LatestVersion";
+ public static final String VERSION_LATEST_DESCRIPTION = "Used only to communicate an API's latest version";
+
+ public static final String REQUEST_ID_NAME = "X-ONAP-RequestID";
+ public static final String REQUEST_ID_HDR_DESCRIPTION = "Used to track REST transactions for logging purpose";
+ public static final String REQUEST_ID_PARAM_DESCRIPTION = "RequestID for http transaction";
+
+ public static final String AUTHORIZATION_TYPE = "basicAuth";
+
+ public static final int AUTHENTICATION_ERROR_CODE = HttpURLConnection.HTTP_UNAUTHORIZED;
+ public static final int AUTHORIZATION_ERROR_CODE = HttpURLConnection.HTTP_FORBIDDEN;
+ public static final int SERVER_ERROR_CODE = HttpURLConnection.HTTP_INTERNAL_ERROR;
+
+ public static final String AUTHENTICATION_ERROR_MESSAGE = "Authentication Error";
+ 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
+ private SimulationProvider simulationProvider;
+
+
+ /**
+ * create a Rest Controller.
+ */
+ public RestController() {
+ simulationProvider = SimulationHandler.getInstance().getSimulationProvider();
+ }
+
+ /**
+ * Adds version headers to the response.
+ *
+ * @param respBuilder response builder
+ * @return the response builder, with version headers
+ */
+ public ResponseBuilder addVersionControlHeaders(ResponseBuilder respBuilder) {
+ return respBuilder.header(VERSION_MINOR_NAME, "0").header(VERSION_PATCH_NAME, "0").header(VERSION_LATEST_NAME,
+ API_VERSION);
+ }
+
+ /**
+ * Adds logging headers to the response.
+ *
+ * @param respBuilder response builder
+ * @return the response builder, with version logging
+ */
+ public ResponseBuilder addLoggingHeaders(ResponseBuilder respBuilder, UUID requestId) {
+ if (requestId == null) {
+ // Generate a random uuid if client does not embed requestId in rest request
+ return respBuilder.header(REQUEST_ID_NAME, UUID.randomUUID());
+ }
+
+ return respBuilder.header(REQUEST_ID_NAME, requestId);
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/Main.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/Main.java
new file mode 100644
index 000000000..e6c93d55d
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/Main.java
@@ -0,0 +1,141 @@
+/*-
+ * ============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.startstop;
+
+import java.util.Arrays;
+import javax.ws.rs.core.Response;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.ParticipantSimulatorParameterHandler;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.ParticipantSimulatorParameters;
+import org.onap.policy.common.utils.resources.MessageConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class initiates participant simulator.
+ */
+public class Main {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
+
+ private ParticipantSimulatorActivator activator;
+
+ @Getter
+ private ParticipantSimulatorParameters parameterGroup;
+
+ /**
+ * Instantiates the control loop participant service.
+ *
+ * @param args the command line arguments
+ */
+ public Main(final String[] args) {
+ final String argumentString = Arrays.toString(args);
+ LOGGER.info("Starting the participant service with arguments - {}", argumentString);
+
+ // Check the arguments
+ final ParticipantSimulatorCommandLineArguments arguments = new ParticipantSimulatorCommandLineArguments();
+ try {
+ // The arguments return a string if there is a message to print and we should exit
+ final String argumentMessage = arguments.parse(args);
+ if (argumentMessage != null) {
+ LOGGER.info(argumentMessage);
+ return;
+ }
+ // Validate that the arguments are sane
+ arguments.validate();
+
+ // Read the parameters
+ parameterGroup = new ParticipantSimulatorParameterHandler().getParameters(arguments);
+
+ // Now, create the activator for the service
+ activator = new ParticipantSimulatorActivator(parameterGroup);
+
+ // Start the activator
+ activator.start();
+ } catch (Exception exp) {
+ throw new ControlLoopRuntimeException(Response.Status.BAD_REQUEST,
+ String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP), exp);
+ }
+
+ // Add a shutdown hook to shut everything down in an orderly manner
+ Runtime.getRuntime().addShutdownHook(new ClParticipantSimulatorShutdownHookClass());
+ String successMsg = String.format(MessageConstants.START_SUCCESS_MSG, MessageConstants.POLICY_CLAMP);
+ LOGGER.info(successMsg);
+ }
+
+ /**
+ * Check if main is running.
+ */
+ public boolean isRunning() {
+ return activator != null && activator.isAlive();
+ }
+
+ /**
+ * Shut down Execution.
+ *
+ * @throws ControlLoopException on shutdown errors
+ */
+ public void shutdown() throws ControlLoopException {
+ // clear the parameterGroup variable
+ parameterGroup = null;
+
+ // clear the cl participant activator
+ if (activator != null) {
+ activator.stop();
+ }
+ }
+
+ /**
+ * The Class ClParticipantSimulatorShutdownHookClass terminates the control loop participant service
+ * when its run method is called.
+ */
+ private class ClParticipantSimulatorShutdownHookClass extends Thread {
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+ try {
+ // Shutdown the participant simulator and wait for everything to stop
+ shutdown();
+ } catch (final RuntimeException | ControlLoopException e) {
+ LOGGER.warn("error occured during shut down of the participant simulator", e);
+ }
+ }
+ }
+
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
+ public static void main(final String[] args) { // NOSONAR
+ /*
+ * NOTE: arguments are validated by the constructor, thus sonar is disabled.
+ */
+
+ new Main(args);
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorActivator.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorActivator.java
new file mode 100644
index 000000000..4daa0393f
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorActivator.java
@@ -0,0 +1,75 @@
+/*-
+ * ============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.startstop;
+
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.ParticipantSimulatorParameters;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.rest.ParticipantSimulatorAafFilter;
+import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationHandler;
+import org.onap.policy.common.endpoints.http.server.RestServer;
+import org.onap.policy.common.utils.services.ServiceManagerContainer;
+
+/**
+ * This class activates the participant simulator component as a complete service together with all its controllers,
+ * listeners and handlers.
+ */
+public class ParticipantSimulatorActivator extends ServiceManagerContainer {
+ @Getter
+ private final ParticipantSimulatorParameters parameters;
+
+ /**
+ * Instantiate the activator for the simulator as a complete service.
+ *
+ * @param parameters the parameters for the participant service
+ */
+ public ParticipantSimulatorActivator(final ParticipantSimulatorParameters parameters) {
+ this.parameters = parameters;
+
+ final AtomicReference<SimulationHandler> simulationHandler = new AtomicReference<>();
+ final AtomicReference<RestServer> restServer = new AtomicReference<>();
+
+ // @formatter:off
+ addAction("Simulation Handler",
+ () -> simulationHandler.set(new SimulationHandler(parameters)),
+ () -> simulationHandler.get().close());
+
+ addAction("Simulation Providers",
+ () -> simulationHandler.get().startProviders(),
+ () -> simulationHandler.get().stopProviders());
+
+ parameters.getRestServerParameters().setName(parameters.getName());
+
+ addAction("REST server",
+ () -> {
+ Set<Class<?>> providerClasses = simulationHandler.get().getProviderClasses();
+
+ RestServer server = new RestServer(parameters.getRestServerParameters(),
+ ParticipantSimulatorAafFilter.class,
+ providerClasses.toArray(new Class<?>[providerClasses.size()]));
+ restServer.set(server);
+ restServer.get().start();
+ },
+ () -> restServer.get().stop());
+ // @formatter:on
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorCommandLineArguments.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorCommandLineArguments.java
new file mode 100644
index 000000000..51ac3a4d5
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorCommandLineArguments.java
@@ -0,0 +1,151 @@
+/*-
+ * ============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.startstop;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Arrays;
+import javax.ws.rs.core.Response;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.common.startstop.CommonCommandLineArguments;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+
+/**
+ * This class reads and handles command line parameters for the participant simulator service.
+ *
+ */
+public class ParticipantSimulatorCommandLineArguments {
+ private static final String FILE_MESSAGE_PREAMBLE = " file \"";
+ private static final int HELP_LINE_LENGTH = 120;
+
+ private final Options options;
+ private final CommonCommandLineArguments commonCommandLineArguments;
+
+ @Getter()
+ @Setter()
+ private String configurationFilePath = null;
+
+ /**
+ * Construct the options for the participant component.
+ */
+ public ParticipantSimulatorCommandLineArguments() {
+ options = new Options();
+ commonCommandLineArguments = new CommonCommandLineArguments(options);
+ }
+
+ /**
+ * Construct the options for the participant component and parse in the given arguments.
+ *
+ * @param args The command line arguments
+ */
+ public ParticipantSimulatorCommandLineArguments(final String[] args) {
+ // Set up the options with the default constructor
+ this();
+
+ // Parse the arguments
+ try {
+ parse(args);
+ } catch (final ControlLoopException e) {
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
+ "parse error on participant parameters", e);
+ }
+ }
+
+ /**
+ * Parse the command line options.
+ *
+ * @param args The command line arguments
+ * @return a string with a message for help and version, or null if there is no message
+ * @throws ControlLoopException on command argument errors
+ */
+ public String parse(final String[] args) throws ControlLoopException {
+ // Clear all our arguments
+ setConfigurationFilePath(null);
+ CommandLine commandLine = null;
+ try {
+ commandLine = new DefaultParser().parse(options, args);
+ } catch (final ParseException e) {
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
+ "invalid command line arguments specified : " + e.getMessage());
+ }
+
+ // Arguments left over after Commons CLI does its stuff
+ final String[] remainingArgs = commandLine.getArgs();
+
+ if (remainingArgs.length > 0) {
+ throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE,
+ "too many command line arguments specified : " + Arrays.toString(args));
+ }
+
+ if (commandLine.hasOption('h')) {
+ return commonCommandLineArguments.help(Main.class.getName(), options);
+ }
+
+ if (commandLine.hasOption('v')) {
+ return commonCommandLineArguments.version();
+ }
+
+ if (commandLine.hasOption('c')) {
+ setConfigurationFilePath(commandLine.getOptionValue('c'));
+ }
+
+ return null;
+ }
+
+ /**
+ * Validate the command line options.
+ *
+ * @throws ControlLoopException on command argument validation errors
+ */
+ public void validate() throws ControlLoopException {
+ commonCommandLineArguments.validate(configurationFilePath);
+ }
+
+ /**
+ * Gets the full expanded configuration file path.
+ *
+ * @return the configuration file path
+ */
+ public String getFullConfigurationFilePath() {
+ return ResourceUtils.getFilePath4Resource(getConfigurationFilePath());
+ }
+
+ /**
+ * Check set configuration file path.
+ *
+ * @return true, if check set configuration file path
+ */
+ public boolean checkSetConfigurationFilePath() {
+ return !StringUtils.isEmpty(configurationFilePath);
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationHandler.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationHandler.java
new file mode 100644
index 000000000..df7f2a611
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationHandler.java
@@ -0,0 +1,81 @@
+/*-
+ * ============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.simulation;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
+import javax.ws.rs.core.Response;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.common.handler.ControlLoopHandler;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.ParticipantSimulatorParameters;
+import org.onap.policy.clamp.controlloop.participant.simulator.simulation.rest.SimulationElementController;
+import org.onap.policy.clamp.controlloop.participant.simulator.simulation.rest.SimulationParticipantController;
+import org.onap.policy.common.endpoints.event.comm.TopicSink;
+import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher;
+import org.onap.policy.common.utils.services.Registry;
+import org.onap.policy.models.base.PfModelRuntimeException;
+
+/**
+ * This class handles simulation of participants and control loop elements.
+ *
+ * <p/>It is effectively a singleton that is started at system start.
+ */
+public class SimulationHandler extends ControlLoopHandler {
+ private final ParticipantIntermediaryParameters participantParameters;
+
+ @Getter
+ private SimulationProvider simulationProvider;
+
+ /**
+ * Create a handler.
+ *
+ * @param parameters the parameters for access to the database
+ */
+ public SimulationHandler(ParticipantSimulatorParameters parameters) {
+ super(parameters.getDatabaseProviderParameters());
+ participantParameters = parameters.getIntermediaryParameters();
+ }
+
+ public static SimulationHandler getInstance() {
+ return Registry.get(SimulationHandler.class.getName());
+ }
+
+ @Override
+ public Set<Class<?>> getProviderClasses() {
+ return Set.of(SimulationElementController.class, SimulationParticipantController.class);
+ }
+
+ @Override
+ public void startProviders() {
+ simulationProvider = new SimulationProvider(participantParameters);
+ }
+
+ @Override
+ public void stopProviders() {
+ try {
+ simulationProvider.close();
+ } catch (IOException e) {
+ throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "Stop providers failed ", e);
+ }
+ }
+}
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/controlloop/participant/simulator/simulation/SimulationProvider.java
new file mode 100644
index 000000000..1fcbba3af
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java
@@ -0,0 +1,129 @@
+/*-
+ * ============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.simulation;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import lombok.Getter;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+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.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.rest.TypedSimpleResponse;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryFactory;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+
+/**
+ * This provider class simulation of participants and control loop elements.
+ */
+public class SimulationProvider implements Closeable {
+ @Getter
+ private final ParticipantIntermediaryApi intermediaryApi;
+
+ /**
+ * Create a participant simulation provider.
+ *
+ * @throws ControlLoopRuntimeException on errors creating the provider
+ */
+ public SimulationProvider(ParticipantIntermediaryParameters participantParameters)
+ throws ControlLoopRuntimeException {
+ intermediaryApi = new ParticipantIntermediaryFactory().createApiImplementation();
+ intermediaryApi.init(participantParameters);
+ }
+
+ @Override
+ public void close() throws IOException {
+ intermediaryApi.close();
+ }
+
+ /**
+ * Get the control loops.
+ *
+ * @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
+ */
+ public ControlLoops getControlLoops(String name, String version) throws ControlLoopException {
+ return intermediaryApi.getControlLoops(name, version);
+ }
+
+ /**
+ * Get the simulated control loop elements.
+ *
+ * @param name the controlLoopElement, null to get all
+ * @param version the controlLoopElement, null to get all
+ * @return the control loop elements
+ * @throws ControlLoopException on errors getting the control loop elements
+ */
+ public Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version)
+ throws ControlLoopException {
+ return intermediaryApi.getControlLoopElements(name, version);
+ }
+
+ /**
+ * Update the given control loop element in the simulator.
+ *
+ * @param element the control loop element to update
+ * @return response simple response returned
+ * @throws ControlLoopException on errors updating the control loop element
+ */
+ public TypedSimpleResponse<ControlLoopElement> updateControlLoopElement(ControlLoopElement element)
+ throws ControlLoopException {
+ TypedSimpleResponse<ControlLoopElement> response = new TypedSimpleResponse<>();
+ response.setResponse(intermediaryApi.updateControlLoopElementState(
+ element.getId(), element.getOrderedState(), element.getState()));
+ return response;
+ }
+
+ /**
+ * Get the current simulated participants.
+ *
+ * @param name the participant, null to get all
+ * @param version the participant, null to get all
+ * @return the list of participants
+ * @throws ControlLoopException on errors getting the participants
+ */
+ public List<Participant> getParticipants(String name, String version) throws ControlLoopException {
+ return intermediaryApi.getParticipants(name, version);
+ }
+
+ /**
+ * Update a simulated participant.
+ *
+ * @param participant the participant to update
+ * @return TypedSimpleResponse simple response
+ * @throws ControlLoopException on errors updating the participant
+ */
+
+ public TypedSimpleResponse<Participant> updateParticipant(Participant participant) throws ControlLoopException {
+ TypedSimpleResponse<Participant> response = new TypedSimpleResponse<>();
+ response.setResponse(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/controlloop/participant/simulator/simulation/rest/SimulationElementController.java
new file mode 100644
index 000000000..1869047c9
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java
@@ -0,0 +1,195 @@
+/*-
+ * ============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.simulation.rest;
+
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import io.swagger.annotations.Authorization;
+import io.swagger.annotations.Extension;
+import io.swagger.annotations.ExtensionProperty;
+import io.swagger.annotations.ResponseHeader;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+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.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.controlloop.models.messages.rest.TypedSimpleResponse;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.rest.RestController;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Class to provide REST end points for participant simulator to query/update details of controlLoopElements.
+ */
+public class SimulationElementController extends RestController {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SimulationElementController.class);
+
+ /**
+ * Queries details of all control loop 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
+ */
+ // @formatter:off
+ @GET
+ @Path("/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,
+ tags = {
+ "Clamp Control Loop Participant Simulator API"
+ },
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE),
+ responseHeaders = {
+ @ResponseHeader(
+ name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
+ response = UUID.class)},
+ extensions = {
+ @Extension(
+ name = EXTENSION_NAME,
+ properties = {
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
+ @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
+ }
+ )
+ }
+ )
+ @ApiResponses(
+ value = {
+ @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
+ @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
+ @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
+ }
+ )
+ // @formatter:on
+ public Response elements(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Control loop element name", required = true) @PathParam("name") String name,
+ @ApiParam(value = "Control loop element version", required = true) @PathParam("version") String version) {
+
+ try {
+ Map<UUID, ControlLoopElement> response = getSimulationProvider().getControlLoopElements(name, version);
+ return addLoggingHeaders(addVersionControlHeaders(Response.status(Status.OK)), requestId).entity(response)
+ .build();
+
+ } catch (ControlLoopException cle) {
+ LOGGER.warn("get of control loop elements failed", cle);
+ SimpleResponse resp = new SimpleResponse();
+ resp.setErrorDetails(cle.getErrorResponse().getErrorMessage());
+ return addLoggingHeaders(
+ addVersionControlHeaders(Response.status(cle.getErrorResponse().getResponseCode())), requestId)
+ .entity(resp).build();
+ }
+
+ }
+
+ /**
+ * Updates a control loop element in the simulator.
+ *
+ * @param requestId request ID used in ONAP logging
+ * @param body the body of a control loop element
+ * @return a response
+ */
+ // @formatter:off
+ @PUT
+ @Path("/elements")
+ @ApiOperation(
+ value = "Updates simulated control loop elements",
+ notes = "Updates simulated control loop elements, returning the updated control loop definition IDs",
+ response = TypedSimpleResponse.class,
+ tags = {
+ "Clamp Control Loop Participant Simulator API"
+ },
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE),
+ responseHeaders = {
+ @ResponseHeader(
+ name = VERSION_MINOR_NAME,
+ description = VERSION_MINOR_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = VERSION_PATCH_NAME,
+ description = VERSION_PATCH_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = VERSION_LATEST_NAME,
+ description = VERSION_LATEST_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = REQUEST_ID_NAME,
+ description = REQUEST_ID_HDR_DESCRIPTION,
+ response = UUID.class)
+ },
+ extensions = {
+ @Extension(
+ name = EXTENSION_NAME,
+ properties = {
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
+ @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
+ }
+ )
+ }
+ )
+ @ApiResponses(
+ value = {
+ @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
+ @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
+ @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
+ }
+ )
+ // @formatter:on
+ public Response update(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Body of a control loop element", required = true) ControlLoopElement body) {
+
+ try {
+ TypedSimpleResponse<ControlLoopElement> response =
+ getSimulationProvider().updateControlLoopElement(body);
+ return addLoggingHeaders(addVersionControlHeaders(Response.status(Status.OK)), requestId).entity(response)
+ .build();
+
+ } catch (ControlLoopException cle) {
+ LOGGER.warn("update of control loop element failed", cle);
+ TypedSimpleResponse<ControlLoopElement> resp = new TypedSimpleResponse<>();
+ resp.setErrorDetails(cle.getErrorResponse().getErrorMessage());
+ return addLoggingHeaders(
+ addVersionControlHeaders(Response.status(cle.getErrorResponse().getResponseCode())), requestId)
+ .entity(resp).build();
+ }
+ }
+}
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/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java
new file mode 100644
index 000000000..d6ca6d0d1
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java
@@ -0,0 +1,192 @@
+/*-
+ * ============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.simulation.rest;
+
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import io.swagger.annotations.Authorization;
+import io.swagger.annotations.Extension;
+import io.swagger.annotations.ExtensionProperty;
+import io.swagger.annotations.ResponseHeader;
+import java.util.List;
+import java.util.UUID;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
+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.controlloop.participant.simulator.main.rest.RestController;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Class to provide REST end points for participant simulator to query/update details of all participants.
+ */
+public class SimulationParticipantController extends RestController {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SimulationParticipantController.class);
+
+ /**
+ * Queries details of all participants within the simulator.
+ *
+ * @param requestId request ID used in ONAP logging
+ * @param name the name of the participant to get, null to get all
+ * @param version the version of the participant to get, null to get all
+ * @return the participants
+ */
+ // @formatter:off
+ @GET
+ @Path("/participants/{name}/{version}")
+ @ApiOperation(value = "Query details of the requested simulated participants",
+ notes = "Queries details of the requested simulated participants, "
+ + "returning all participant details",
+ response = List.class,
+ tags = {
+ "Clamp Control Loop Participant Simulator API"
+ },
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE),
+ responseHeaders = {
+ @ResponseHeader(
+ name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
+ response = UUID.class)},
+ extensions = {
+ @Extension(
+ name = EXTENSION_NAME,
+ properties = {
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
+ @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
+ }
+ )
+ }
+ )
+ @ApiResponses(
+ value = {
+ @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
+ @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
+ @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
+ }
+ )
+ // @formatter:on
+ public Response participants(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Participant name", required = true) @PathParam("name") String name,
+ @ApiParam(value = "Participant version", required = true) @PathParam("version") String version) {
+
+ try {
+ List<Participant> response = getSimulationProvider().getParticipants(name, version);
+ return addLoggingHeaders(addVersionControlHeaders(Response.status(Status.OK)), requestId).entity(response)
+ .build();
+
+ } catch (ControlLoopException cle) {
+ LOGGER.warn("get of participants failed", cle);
+ SimpleResponse resp = new SimpleResponse();
+ resp.setErrorDetails(cle.getErrorResponse().getErrorMessage());
+ return addLoggingHeaders(
+ addVersionControlHeaders(Response.status(cle.getErrorResponse().getResponseCode())), requestId)
+ .entity(resp).build();
+ }
+
+ }
+
+ /**
+ * Updates a participant in the simulator.
+ *
+ * @param requestId request ID used in ONAP logging
+ * @param body the body of a participant
+ * @return a response
+ */
+ // @formatter:off
+ @PUT
+ @Path("/participants")
+ @ApiOperation(
+ value = "Updates simulated participants",
+ notes = "Updates simulated participants, returning the updated control loop definition IDs",
+ response = TypedSimpleResponse.class,
+ tags = {
+ "Clamp Control Loop Participant Simulator API"
+ },
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE),
+ responseHeaders = {
+ @ResponseHeader(
+ name = VERSION_MINOR_NAME,
+ description = VERSION_MINOR_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = VERSION_PATCH_NAME,
+ description = VERSION_PATCH_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = VERSION_LATEST_NAME,
+ description = VERSION_LATEST_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = REQUEST_ID_NAME,
+ description = REQUEST_ID_HDR_DESCRIPTION,
+ response = UUID.class)
+ },
+ extensions = {
+ @Extension(
+ name = EXTENSION_NAME,
+ properties = {
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
+ @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
+ }
+ )
+ }
+ )
+ @ApiResponses(
+ value = {
+ @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
+ @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
+ @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
+ }
+ )
+ // @formatter:on
+ public Response update(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Body of a participant", required = true) Participant body) {
+
+ try {
+ TypedSimpleResponse<Participant> response = getSimulationProvider().updateParticipant(body);
+ return addLoggingHeaders(addVersionControlHeaders(Response.status(Status.OK)), requestId).entity(response)
+ .build();
+
+ } catch (ControlLoopException cle) {
+ LOGGER.warn("update of participant failed", cle);
+ TypedSimpleResponse<Participant> resp = new TypedSimpleResponse<>();
+ resp.setErrorDetails(cle.getErrorResponse().getErrorMessage());
+ return addLoggingHeaders(
+ addVersionControlHeaders(Response.status(cle.getErrorResponse().getResponseCode())), requestId)
+ .entity(resp).build();
+ }
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/CDSParticipantConfig.json b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/CDSParticipantConfig.json
new file mode 100644
index 000000000..3eca87678
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/CDSParticipantConfig.json
@@ -0,0 +1,31 @@
+{
+ "name":"ParticipantParameterGroup",
+ "participantStatusParameters":{
+ "timeIntervalMs": 10000,
+ "description":"Participant Status",
+ "participantType":{
+ "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "version":"2.2.1"
+ },
+ "participantId":{
+ "name": "CDSParticipant0",
+ "version":"1.0.0"
+ },
+ "participantDefinition":{
+ "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "version":"3.2.1"
+ }
+ },
+ "topicParameterGroup": {
+ "topicSources" : [{
+ "topic" : "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers" : [ "127.0.0.1:3904" ],
+ "topicCommInfrastructure" : "dmaap"
+ }],
+ "topicSinks" : [{
+ "topic" : "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers" : [ "127.0.0.1:3904" ],
+ "topicCommInfrastructure" : "dmaap"
+ }]
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/DCAEParticipantConfig.json b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/DCAEParticipantConfig.json
new file mode 100644
index 000000000..e80570f93
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/DCAEParticipantConfig.json
@@ -0,0 +1,31 @@
+{
+ "name":"ParticipantParameterGroup",
+ "participantStatusParameters":{
+ "timeIntervalMs": 10000,
+ "description":"Participant Status",
+ "participantType":{
+ "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "version":"2.3.4"
+ },
+ "participantId":{
+ "name": "DCAEParticipant0",
+ "version":"1.0.0"
+ },
+ "participantDefinition":{
+ "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "version":"2.3.4"
+ }
+ },
+ "topicParameterGroup": {
+ "topicSources" : [{
+ "topic" : "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers" : [ "127.0.0.1:3904" ],
+ "topicCommInfrastructure" : "dmaap"
+ }],
+ "topicSinks" : [{
+ "topic" : "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers" : [ "127.0.0.1:3904" ],
+ "topicCommInfrastructure" : "dmaap"
+ }]
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/PolicyParticipantConfig.json b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/PolicyParticipantConfig.json
new file mode 100644
index 000000000..8c8fa33cb
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/PolicyParticipantConfig.json
@@ -0,0 +1,31 @@
+{
+ "name":"ParticipantParameterGroup",
+ "participantStatusParameters":{
+ "timeIntervalMs":10000,
+ "description":"Participant Status",
+ "participantType":{
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version":"2.3.1"
+ },
+ "participantId":{
+ "name": "PolicyParticipant0",
+ "version":"1.0.0"
+ },
+ "participantDefinition":{
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version":"2.3.1"
+ }
+ },
+ "topicParameterGroup": {
+ "topicSources" : [{
+ "topic" : "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers" : [ "127.0.0.1:3904" ],
+ "topicCommInfrastructure" : "dmaap"
+ }],
+ "topicSinks" : [{
+ "topic" : "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers" : [ "127.0.0.1:3904" ],
+ "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
new file mode 100644
index 000000000..dbd67585f
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt
@@ -0,0 +1,4 @@
+ONAP Tosca defined control loop 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/main/intermediary/TestControlLoopUpdateListener.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/intermediary/TestControlLoopUpdateListener.java
new file mode 100644
index 000000000..a307d3457
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/intermediary/TestControlLoopUpdateListener.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.controlloop.participant.simulator.main.intermediary;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopUpdateListener;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.rest.TestListenerUtils;
+import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
+import org.onap.policy.common.utils.coder.CoderException;
+
+/**
+ * Class to perform unit test of {@link ControlLoopUpdateListener}.
+ */
+public class TestControlLoopUpdateListener {
+ private static ControlLoopUpdateListener clUpdateListener;
+ private static final CommInfrastructure INFRA = CommInfrastructure.NOOP;
+ private static final String TOPIC = "my-topic";
+ static CommonTestData commonTestData = new CommonTestData();
+
+ /**
+ * Method for setup.
+ *
+ * @throws ParticipantException if some error occurs while starting up the participant
+ * @throws FileNotFoundException if the file is missing
+ * @throws IOException if IO exception occurs
+ */
+ @BeforeClass
+ public static void setUp() throws ControlLoopException, FileNotFoundException, IOException {
+ TestListenerUtils.initParticipantHandler();
+ clUpdateListener = new ControlLoopUpdateListener(TestListenerUtils.getParticipantHandler());
+ }
+
+ @Test
+ public void testControlLoopUpdateListener_ParticipantIdNoMatch() throws CoderException {
+ ParticipantControlLoopUpdate participantControlLoopUpdateMsg = prepareMsg("DummyName");
+ clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg);
+
+ // Verify the content in participantHandler
+ assertNotEquals(participantControlLoopUpdateMsg.getParticipantId().getName(),
+ TestListenerUtils.getParticipantHandler().getParticipantId().getName());
+ }
+
+ @Test
+ public void testControlLoopUpdateListener() throws CoderException {
+ ParticipantControlLoopUpdate participantControlLoopUpdateMsg = prepareMsg("org.onap.PM_CDS_Blueprint");
+ clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg);
+
+ // Verify the content in participantHandler
+ assertEquals(TestListenerUtils.getParticipantHandler().getParticipantId(),
+ participantControlLoopUpdateMsg.getParticipantId());
+ assertThat(TestListenerUtils.getParticipantHandler().getControlLoopHandler().getControlLoops()
+ .getControlLoopList()).hasSize(1);
+ }
+
+ private ParticipantControlLoopUpdate prepareMsg(final String participantName) {
+ ParticipantControlLoopUpdate participantControlLoopUpdateMsg;
+ participantControlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg();
+ participantControlLoopUpdateMsg.getParticipantId().setName(participantName);
+ participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE);
+ return participantControlLoopUpdateMsg;
+ }
+}
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/controlloop/participant/simulator/main/parameters/CommonTestData.java
new file mode 100644
index 000000000..0a8754256
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/CommonTestData.java
@@ -0,0 +1,249 @@
+/*-
+ * ============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.parameters;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import javax.ws.rs.core.Response;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.common.endpoints.parameters.TopicParameters;
+import org.onap.policy.common.parameters.ParameterGroup;
+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.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 DESCRIPTION = "Participant description";
+ public static final long TIME_INTERVAL = 2000;
+ public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams());
+ private static final String REST_SERVER_PASSWORD = "zb!XztG34";
+ private static final String REST_SERVER_USER = "healthcheck";
+ private static final int REST_SERVER_PORT = 6969;
+ private static final String REST_SERVER_HOST = "0.0.0.0";
+ private static final boolean REST_SERVER_HTTPS = true;
+ private static final boolean REST_SERVER_AAF = false;
+
+ public static final Coder coder = new StandardCoder();
+
+ /**
+ * Converts the contents of a map to a parameter class.
+ *
+ * @param source property map
+ * @param clazz class of object to be created from the map
+ * @return a new object represented by the map
+ */
+ public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) {
+ try {
+ return coder.convert(source, clazz);
+ } catch (final CoderException e) {
+ throw new RuntimeException("cannot create " + clazz.getName() + " from map", e);
+ }
+ }
+
+ /**
+ * Returns a property map for a ApexStarterParameterGroup map for test cases.
+ *
+ * @param name name of the parameters
+ *
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getParticipantParameterGroupMap(final String name) {
+ final Map<String, Object> map = new TreeMap<>();
+
+ map.put("name", name);
+ map.put("restServerParameters", getRestServerParametersMap(false));
+ map.put("intermediaryParameters", getIntermediaryParametersMap(false));
+ map.put("databaseProviderParameters", getDatabaseProviderParametersMap(false));
+ return map;
+ }
+
+ /**
+ * Returns a property map for a RestServerParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getRestServerParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ map.put("https", REST_SERVER_HTTPS);
+ map.put("aaf", REST_SERVER_AAF);
+
+ if (!isEmpty) {
+ map.put("host", REST_SERVER_HOST);
+ map.put("port", REST_SERVER_PORT);
+ map.put("userName", REST_SERVER_USER);
+ map.put("password", REST_SERVER_PASSWORD);
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a property map for a databaseProviderParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getDatabaseProviderParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ if (!isEmpty) {
+ map.put("name", "PolicyProviderParameterGroup");
+ map.put("implementation", "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl");
+ map.put("databaseDriver", "org.h2.Driver");
+ map.put("databaseUrl", "jdbc:h2:mem:testdb");
+ map.put("databaseUser", "policy");
+ map.put("databasePassword", "P01icY");
+ map.put("persistenceUnit", "ToscaConceptTest");
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a property map for a intermediaryParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getIntermediaryParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ if (!isEmpty) {
+ map.put("name", "Participant parameters");
+ map.put("reportingTimeInterval", TIME_INTERVAL);
+ map.put("description", DESCRIPTION);
+ map.put("participantId", getParticipantId());
+ map.put("participantType", getParticipantId());
+ map.put("clampControlLoopTopics", getTopicParametersMap(false));
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a property map for a TopicParameters map for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getTopicParametersMap(final boolean isEmpty) {
+ final Map<String, Object> map = new TreeMap<>();
+ if (!isEmpty) {
+ map.put("topicSources", TOPIC_PARAMS);
+ map.put("topicSinks", TOPIC_PARAMS);
+ }
+ return map;
+ }
+
+ /**
+ * Returns topic parameters for test cases.
+ *
+ * @return topic parameters
+ */
+ public static TopicParameters getTopicParams() {
+ final TopicParameters topicParams = new TopicParameters();
+ topicParams.setTopic("POLICY-CLRUNTIME-PARTICIPANT");
+ topicParams.setTopicCommInfrastructure("dmaap");
+ topicParams.setServers(Arrays.asList("localhost"));
+ return topicParams;
+ }
+
+ /**
+ * Returns participantId for test cases.
+ *
+ * @return participant Id
+ */
+ public static ToscaConceptIdentifier getParticipantId() {
+ final ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_CDS_Blueprint", "1.0.0");
+ return participantId;
+ }
+
+ /**
+ * Gets the standard participant parameters.
+ *
+ * @param port port to be inserted into the parameters
+ * @return the standard participant parameters
+ */
+ public ParticipantSimulatorParameters getParticipantParameterGroup(int port) {
+ try {
+ return coder.decode(getParticipantParameterGroupAsString(port), ParticipantSimulatorParameters.class);
+
+ } catch (CoderException e) {
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
+ "cannot read participant parameters", e);
+ }
+ }
+
+ /**
+ * Gets the standard participant parameters, as a String.
+ *
+ * @param port port to be inserted into the parameters
+ * @return the standard participant parameters
+ */
+ public static String getParticipantParameterGroupAsString(int port) {
+
+ try {
+ File file = new File(getParamFile());
+ String json = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8);
+
+ json = json.replace("${port}", String.valueOf(port));
+ json = json.replace("${dbName}", "jdbc:h2:mem:testdb");
+
+ return json;
+
+ } catch (IOException e) {
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
+ "cannot read participant parameters", e);
+
+ }
+ }
+
+ /**
+ * Gets the full path to the parameter file, which may vary depending on whether or
+ * not this is an end-to-end test.
+ *
+ * @return the parameter file name
+ */
+ private static String getParamFile() {
+ String paramFile = "src/test/resources/parameters/TestParametersStd.json";
+ return paramFile;
+ }
+
+ /**
+ * Nulls out a field within a JSON string.
+ * @param json JSON string
+ * @param field field to be nulled out
+ * @return a new JSON string with the field nulled out
+ */
+ public String nullifyField(String json, String field) {
+ return json.replace(field + "\"", field + "\":null, \"" + field + "Xxx\"");
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameterHandler.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameterHandler.java
new file mode 100644
index 000000000..e94939af8
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameterHandler.java
@@ -0,0 +1,120 @@
+/*-
+ * ============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.parameters;
+
+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.assertTrue;
+
+import java.io.FileNotFoundException;
+import org.apache.commons.io.DirectoryWalker.CancelException;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.startstop.ParticipantSimulatorCommandLineArguments;
+import org.onap.policy.common.utils.coder.CoderException;
+
+/**
+ * Class to perform unit test of {@link ParticipantParameterHandler}.
+ */
+public class TestParticipantSimulatorParameterHandler {
+
+ @Test
+ public void testParameterHandlerNoParameterFile() throws ControlLoopException {
+ final String[] emptyArgumentString = { "-c", "src/test/resources/parameters/NoParametersFile.json" };
+
+ final ParticipantSimulatorCommandLineArguments emptyArguments = new ParticipantSimulatorCommandLineArguments();
+ emptyArguments.parse(emptyArgumentString);
+
+ assertThatThrownBy(() -> new ParticipantSimulatorParameterHandler().getParameters(emptyArguments))
+ .hasCauseInstanceOf(CoderException.class)
+ .hasRootCauseInstanceOf(FileNotFoundException.class);
+ }
+
+ @Test
+ public void testParameterHandlerInvalidParameters() throws ControlLoopException {
+ final String[] invalidArgumentString = { "-c", "src/test/resources/parameters/InvalidParameters.json" };
+
+ final ParticipantSimulatorCommandLineArguments invalidArguments =
+ new ParticipantSimulatorCommandLineArguments();
+ invalidArguments.parse(invalidArgumentString);
+
+ assertThatThrownBy(() -> new ParticipantSimulatorParameterHandler().getParameters(invalidArguments))
+ .hasMessageStartingWith("error reading parameters from")
+ .hasCauseInstanceOf(CoderException.class);
+ }
+
+ @Test
+ public void testParameterHandlerNoParameters() throws CancelException, ControlLoopException {
+ final String[] noArgumentString = { "-c", "src/test/resources/parameters/EmptyParameters.json" };
+
+ final ParticipantSimulatorCommandLineArguments noArguments = new ParticipantSimulatorCommandLineArguments();
+ noArguments.parse(noArgumentString);
+
+ assertThatThrownBy(() -> new ParticipantSimulatorParameterHandler().getParameters(noArguments))
+ .hasMessageContaining("no parameters found");
+ }
+
+ @Test
+ public void testParticipantParameterGroup() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json"};
+
+ final ParticipantSimulatorCommandLineArguments arguments = new ParticipantSimulatorCommandLineArguments();
+ arguments.parse(participantConfigParameters);
+
+ final ParticipantSimulatorParameters parGroup = new ParticipantSimulatorParameterHandler()
+ .getParameters(arguments);
+ assertTrue(arguments.checkSetConfigurationFilePath());
+ assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, parGroup.getName());
+ }
+
+ @Test
+ public void testParticipantVersion() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-v" };
+ final ParticipantSimulatorCommandLineArguments arguments = new ParticipantSimulatorCommandLineArguments();
+ assertThat(arguments.parse(participantConfigParameters)).startsWith(
+ "ONAP Tosca defined control loop Participant");
+ }
+
+ @Test
+ public void testParticipantHelp() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-h" };
+ final ParticipantSimulatorCommandLineArguments arguments = new ParticipantSimulatorCommandLineArguments();
+ assertThat(arguments.parse(participantConfigParameters)).startsWith("usage:");
+ }
+
+ @Test
+ public void testParticipant_TooManyArguments() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json",
+ "TooMany"};
+ final ParticipantSimulatorCommandLineArguments arguments = new ParticipantSimulatorCommandLineArguments();
+ assertThatThrownBy(() -> arguments.parse(participantConfigParameters))
+ .hasMessageStartingWith("too many command line arguments specified");
+ }
+
+ @Test
+ public void testParticipantInvalidOption() throws ControlLoopException {
+ final String[] participantConfigParameters = { "-d" };
+ final ParticipantSimulatorCommandLineArguments arguments = new ParticipantSimulatorCommandLineArguments();
+ assertThatThrownBy(() -> arguments.parse(participantConfigParameters))
+ .hasMessageStartingWith("invalid command line arguments specified");
+ }
+}
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/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java
new file mode 100644
index 000000000..8027d6f08
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java
@@ -0,0 +1,110 @@
+/*-
+ * ============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.parameters;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
+import java.util.Map;
+import org.junit.Test;
+import org.onap.policy.common.parameters.ValidationResult;
+
+/**
+ * Class to perform unit test of {@link ParticipantParameterGroup}.
+ */
+public class TestParticipantSimulatorParameters {
+ CommonTestData commonTestData = new CommonTestData();
+
+ @Test
+ public void testParticipantParameterGroup_Named() {
+ final ParticipantSimulatorParameters participantParameters = new ParticipantSimulatorParameters("my-name");
+ assertEquals("my-name", participantParameters.getName());
+ }
+
+ @Test
+ public void testParticipantParameterGroup() {
+ final ParticipantSimulatorParameters participantParameters = commonTestData.toObject(
+ commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME),
+ ParticipantSimulatorParameters.class);
+ assertThat(participantParameters.validate().isValid()).isTrue();
+ assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, participantParameters.getName());
+ }
+
+ @Test
+ public void testParticipantParameterGroup_NullName() {
+ final ParticipantSimulatorParameters participantParameters = commonTestData
+ .toObject(commonTestData.getParticipantParameterGroupMap(null),
+ ParticipantSimulatorParameters.class);
+ final ValidationResult validationResult = participantParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertEquals(null, participantParameters.getName());
+ assertThat(validationResult.getResult()).contains("is null");
+ }
+
+ @Test
+ public void testParticipantParameterGroup_EmptyName() {
+ final ParticipantSimulatorParameters participantParameters = commonTestData
+ .toObject(commonTestData.getParticipantParameterGroupMap(""),
+ ParticipantSimulatorParameters.class);
+ final ValidationResult validationResult = participantParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertEquals("", participantParameters.getName());
+ assertThat(validationResult.getResult()).contains(
+ "item \"name\" value \"\" INVALID, " + "is blank");
+ }
+
+ @Test
+ public void testParticipantParameterGroup_SetName() {
+ final ParticipantSimulatorParameters participantParameters = commonTestData.toObject(
+ commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME),
+ ParticipantSimulatorParameters.class);
+ participantParameters.setName("ParticipantNewGroup");
+ assertThat(participantParameters.validate().isValid()).isTrue();
+ assertEquals("ParticipantNewGroup", participantParameters.getName());
+ }
+
+ @Test
+ public void testParticipantParameterGroup_EmptyParticipantIntermediaryParameters() {
+ final Map<String, Object> map =
+ commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME);
+ map.replace("intermediaryParameters", commonTestData.getIntermediaryParametersMap(true));
+ final ParticipantSimulatorParameters participantParameters =
+ commonTestData.toObject(map, ParticipantSimulatorParameters.class);
+ final ValidationResult validationResult = participantParameters.validate();
+ assertNull(validationResult.getResult());
+ }
+
+ @Test
+ public void testParticipantParameterGroupp_EmptyTopicParameters() {
+ final Map<String, Object> map =
+ commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME);
+ final Map<String, Object> intermediaryParametersMap = commonTestData.getIntermediaryParametersMap(false);
+ intermediaryParametersMap.put("clampControlLoopTopics", commonTestData.getTopicParametersMap(true));
+ map.replace("intermediaryParameters", intermediaryParametersMap);
+
+ final ParticipantSimulatorParameters participantParameters =
+ commonTestData.toObject(map, ParticipantSimulatorParameters.class);
+ final ValidationResult validationResult = participantParameters.validate();
+ assertNull(validationResult.getResult());
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/CommonParticipantRestServer.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/CommonParticipantRestServer.java
new file mode 100644
index 000000000..ae004de49
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/CommonParticipantRestServer.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.controlloop.participant.simulator.main.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import org.glassfish.jersey.client.ClientProperties;
+import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.startstop.Main;
+import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
+import org.onap.policy.common.gson.GsonMessageBodyHandler;
+import org.onap.policy.common.utils.network.NetworkUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Class to perform Rest unit tests.
+ *
+ */
+
+public class CommonParticipantRestServer {
+
+ private static final String CONFIG_FILE = "src/test/resources/parameters/TestConfigParameters.json";
+ private static final Logger LOGGER = LoggerFactory.getLogger(CommonParticipantRestServer.class);
+ public static final String SELF = NetworkUtil.getHostname();
+ public static final String ENDPOINT_PREFIX = "onap/participantsim/v2/";
+ private static int port;
+ private static String httpPrefix;
+ private static Main main;
+
+ /**
+ * Allocates a port for the server, writes a config file, and then starts Main.
+ *
+ * @throws Exception if an error occurs
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ setUpBeforeClass(true);
+ }
+
+ /**
+ * Allocates a port for the server, writes a config file, and then starts Main, if
+ * specified.
+ *
+ * @param shouldStart {@code true} if Main should be started, {@code false} otherwise
+ * @throws Exception if an error occurs
+ */
+ public static void setUpBeforeClass(boolean shouldStart) throws Exception {
+ port = NetworkUtil.allocPort();
+ httpPrefix = "http://localhost:" + port + "/";
+
+ makeConfigFile();
+ HttpServletServerFactoryInstance.getServerFactory().destroy();
+ TopicEndpointManager.getManager().shutdown();
+
+ if (shouldStart) {
+ startMain();
+ }
+ }
+
+ /**
+ * Stops Main.
+ */
+ @AfterClass
+ public static void teardownAfterClass() {
+ try {
+ stopMain();
+
+ } catch (ControlLoopException exp) {
+ LOGGER.error("cannot stop main", exp);
+ }
+ }
+
+ /**
+ * Set up.
+ *
+ * @throws Exception if an error occurs
+ */
+ @Before
+ public void setUp() throws Exception {
+ // restart, if not currently running
+ if (main == null) {
+ startMain();
+ }
+ }
+
+ /**
+ * Verifies that an endpoint appears within the swagger response.
+ *
+ * @param endpoint the endpoint of interest
+ * @throws Exception if an error occurs
+ */
+ protected void testSwagger(final String endpoint) throws Exception {
+ final Invocation.Builder invocationBuilder = sendFqeRequest(httpPrefix + "swagger.yaml", true);
+ assertThat(invocationBuilder.get(String.class)).contains(ENDPOINT_PREFIX + endpoint + ":");
+ }
+
+ /**
+ * Makes a parameter configuration file.
+ *
+ * @throws IOException if an error occurs writing the configuration file
+ * @throws FileNotFoundException if an error occurs writing the configuration file
+ *
+ * @throws Exception if an error occurs
+ */
+ private static void makeConfigFile() throws FileNotFoundException, IOException {
+ String json = CommonTestData.getParticipantParameterGroupAsString(port);
+ File file = new File(String.format(CONFIG_FILE, port));
+ file.deleteOnExit();
+ try (FileOutputStream output = new FileOutputStream(file)) {
+ output.write(json.getBytes(StandardCharsets.UTF_8));
+ }
+ }
+
+ /**
+ * Starts the "Main".
+ *
+ * @throws InterruptedException
+ *
+ * @throws Exception if an error occurs
+ */
+ protected static void startMain() throws InterruptedException {
+ // make sure port is available
+ if (NetworkUtil.isTcpPortOpen("localhost", port, 1, 1L)) {
+ throw new IllegalStateException("port " + port + " is still in use");
+ }
+
+ final String[] configParameters = { "-c", CONFIG_FILE };
+
+ main = new Main(configParameters);
+
+ if (!NetworkUtil.isTcpPortOpen("localhost", port, 40, 250L)) {
+ throw new IllegalStateException("server is not listening on port " + port);
+ }
+ }
+
+ /**
+ * Stops the "Main".
+ *
+ * @throws ControlLoopException
+ *
+ * @throws Exception if an error occurs
+ */
+ private static void stopMain() throws ControlLoopException {
+ if (main != null) {
+ main.shutdown();
+ main = null;
+ }
+ }
+
+ /**
+ * Sends a request to an endpoint.
+ *
+ * @param endpoint the target endpoint
+ * @return a request builder
+ * @throws Exception if an error occurs
+ */
+ protected Invocation.Builder sendRequest(final String endpoint) throws Exception {
+ return sendFqeRequest(httpPrefix + ENDPOINT_PREFIX + endpoint, true);
+ }
+
+ /**
+ * Sends a request to an endpoint, without any authorization header.
+ *
+ * @param endpoint the target endpoint
+ * @return a request builder
+ * @throws Exception if an error occurs
+ */
+ protected Invocation.Builder sendNoAuthRequest(final String endpoint) throws Exception {
+ return sendFqeRequest(httpPrefix + ENDPOINT_PREFIX + endpoint, false);
+ }
+
+ /**
+ * Sends a request to a fully qualified endpoint.
+ *
+ * @param fullyQualifiedEndpoint the fully qualified target endpoint
+ * @param includeAuth if authorization header should be included
+ * @return a request builder
+ * @throws Exception if an error occurs
+ */
+ protected Invocation.Builder sendFqeRequest(final String fullyQualifiedEndpoint, boolean includeAuth)
+ throws Exception {
+ final Client client = ClientBuilder.newBuilder().build();
+ client.property(ClientProperties.METAINF_SERVICES_LOOKUP_DISABLE, "true");
+ client.register(GsonMessageBodyHandler.class);
+ if (includeAuth) {
+ client.register(HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34"));
+ }
+ final WebTarget webTarget = client.target(fullyQualifiedEndpoint);
+ return webTarget.request(MediaType.APPLICATION_JSON);
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/RestControllerTest.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/RestControllerTest.java
new file mode 100644
index 000000000..1311eee35
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/RestControllerTest.java
@@ -0,0 +1,95 @@
+/*
+ * ============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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.controlloop.participant.simulator.main.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.UUID;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationHandler;
+import org.onap.policy.common.utils.services.Registry;
+
+public class RestControllerTest {
+
+ private RestController ctlr;
+ private ResponseBuilder bldr;
+
+ /**
+ * Setup before class, instantiate SimulationHandler.
+ *
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ Registry.newRegistry();
+ Registry.register(SimulationHandler.class.getName(), Mockito.mock(SimulationHandler.class));
+ }
+
+ @AfterClass
+ public static void teardownAfterClass() throws Exception {
+ Registry.unregister(SimulationHandler.class.getName());
+ }
+
+ /**
+ * set Up.
+ */
+ @Before
+ public void setUp() {
+ ctlr = new RestController();
+ bldr = Response.status(Response.Status.OK);
+ }
+
+ @Test
+ public void testProduces() {
+ Produces annotation = RestController.class.getAnnotation(Produces.class);
+ assertNotNull(annotation);
+ assertThat(annotation.value()).contains(MediaType.APPLICATION_JSON)
+ .contains(RestController.APPLICATION_YAML);
+ }
+
+ @Test
+ public void testAddVersionControlHeaders() {
+ Response resp = ctlr.addVersionControlHeaders(bldr).build();
+ assertEquals("0", resp.getHeaderString(RestController.VERSION_MINOR_NAME));
+ assertEquals("0", resp.getHeaderString(RestController.VERSION_PATCH_NAME));
+ assertEquals("1.0.0", resp.getHeaderString(RestController.VERSION_LATEST_NAME));
+ }
+
+ @Test
+ public void testAddLoggingHeaders_Null() {
+ Response resp = ctlr.addLoggingHeaders(bldr, null).build();
+ assertNotNull(resp.getHeaderString(RestController.REQUEST_ID_NAME));
+ }
+
+ @Test
+ public void testAddLoggingHeaders_NonNull() {
+ UUID uuid = UUID.randomUUID();
+ Response resp = ctlr.addLoggingHeaders(bldr, uuid).build();
+ assertEquals(uuid.toString(), resp.getHeaderString(RestController.REQUEST_ID_NAME));
+ }
+}
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
new file mode 100644
index 000000000..9c20ffe22
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java
@@ -0,0 +1,258 @@
+/*-
+ * ============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.Getter;
+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.ParticipantState;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
+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.parameters.ParticipantSimulatorParameters;
+import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationProvider;
+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;
+
+public 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);
+
+ private TestListenerUtils() {}
+
+ @Getter
+ private static ParticipantHandler participantHandler;
+
+ /**
+ * Method to initialize participantHandler.
+ */
+ public static void initParticipantHandler() {
+
+ final ParticipantSimulatorParameters participantParameters = commonTestData.toObject(
+ commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME),
+ ParticipantSimulatorParameters.class);
+
+ SimulationProvider simulationProvider =
+ new SimulationProvider(participantParameters.getIntermediaryParameters());
+
+ participantHandler = simulationProvider.getIntermediaryApi().getParticipantHandler();
+ }
+
+ /**
+ * 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 ParticipantStateChange message from the arguments passed.
+ *
+ * @param participantState participant State
+ *
+ * @return ParticipantStateChange message
+ */
+ public static ParticipantStateChange createParticipantStateChangeMsg(final ParticipantState participantState) {
+ final ParticipantStateChange participantStateChangeMsg = new ParticipantStateChange();
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_CDS_Blueprint", "1.0.0");
+
+ participantStateChangeMsg.setParticipantId(participantId);
+ participantStateChangeMsg.setTimestamp(Instant.now());
+ participantStateChangeMsg.setState(participantState);
+
+ return participantStateChangeMsg;
+ }
+
+ /**
+ * Method to create ControlLoopStateChange message from the arguments passed.
+ *
+ * @param controlLoopOrderedState controlLoopOrderedState
+ *
+ * @return ParticipantControlLoopStateChange message
+ */
+ public static ParticipantControlLoopStateChange createControlLoopStateChangeMsg(
+ final ControlLoopOrderedState controlLoopOrderedState) {
+ final ParticipantControlLoopStateChange participantClStateChangeMsg = new ParticipantControlLoopStateChange();
+
+ ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_CDS_Blueprint", "1.0.0");
+
+ participantClStateChangeMsg.setControlLoopId(controlLoopId);
+ participantClStateChangeMsg.setParticipantId(participantId);
+ participantClStateChangeMsg.setTimestamp(Instant.now());
+ participantClStateChangeMsg.setOrderedState(controlLoopOrderedState);
+
+ return participantClStateChangeMsg;
+ }
+
+ /**
+ * Method to create ControlLoopUpdateMsg.
+ *
+ * @return ParticipantControlLoopUpdate message
+ */
+ public static ParticipantControlLoopUpdate createControlLoopUpdateMsg() {
+ final ParticipantControlLoopUpdate clUpdateMsg = new ParticipantControlLoopUpdate();
+ ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
+ ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_CDS_Blueprint", "1.0.0");
+
+ clUpdateMsg.setControlLoopId(controlLoopId);
+ clUpdateMsg.setParticipantId(participantId);
+ clUpdateMsg.setParticipantType(participantId);
+
+ 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");
+ controlLoop.setDefinition(controlLoopId);
+ clUpdateMsg.setControlLoop(controlLoop);
+ clUpdateMsg.setControlLoopDefinition(toscaServiceTemplate);
+
+ return clUpdateMsg;
+ }
+
+ /**
+ * Method to create ParticipantControlLoopUpdate using the arguments passed.
+ *
+ * @param jsonFilePath the path of the controlloop content
+ *
+ * @return ParticipantControlLoopUpdate message
+ * @throws CoderException exception while reading the file to object
+ */
+ public static ParticipantControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath)
+ throws CoderException {
+ ParticipantControlLoopUpdate participantControlLoopUpdateMsg =
+ CODER.decode(new File(jsonFilePath), ParticipantControlLoopUpdate.class);
+ return participantControlLoopUpdateMsg;
+ }
+
+ 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/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestSimulationRestController.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestSimulationRestController.java
new file mode 100644
index 000000000..472b4beee
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestSimulationRestController.java
@@ -0,0 +1,186 @@
+/*-
+ * ============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.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+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.ParticipantControlLoopUpdate;
+import org.onap.policy.clamp.controlloop.models.messages.rest.TypedSimpleResponse;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopUpdateListener;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationHandler;
+import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationProvider;
+import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+
+/**
+ * Class to perform unit test of {@link TestSimulationRestController}.
+ */
+public class TestSimulationRestController extends CommonParticipantRestServer {
+
+ private static ControlLoopUpdateListener clUpdateListener;
+ private static final String PARTICIPANTS_ENDPOINT = "participants";
+ private static final String ELEMENTS_ENDPOINT = "elements";
+ private static final CommInfrastructure INFRA = CommInfrastructure.NOOP;
+ private static final String TOPIC = "my-topic";
+ static CommonTestData commonTestData = new CommonTestData();
+
+ /**
+ * Setup before class.
+ *
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ CommonParticipantRestServer.setUpBeforeClass();
+ clUpdateListener = new ControlLoopUpdateListener(
+ SimulationHandler.getInstance()
+ .getSimulationProvider()
+ .getIntermediaryApi()
+ .getParticipantHandler());
+ ParticipantControlLoopUpdate participantControlLoopUpdateMsg =
+ TestListenerUtils.createControlLoopUpdateMsg();
+ participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE);
+ clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg);
+ }
+
+ @AfterClass
+ public static void teardownAfterClass() {
+ CommonParticipantRestServer.teardownAfterClass();
+ }
+
+ @Test
+ public void testSwagger() throws Exception {
+ super.testSwagger(ELEMENTS_ENDPOINT);
+ }
+
+ @Test
+ public void testQuery_Unauthorized() throws Exception {
+ Invocation.Builder invocationBuilder = super.sendNoAuthRequest(ELEMENTS_ENDPOINT);
+ Response rawresp = invocationBuilder.buildGet().invoke();
+ assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus());
+ }
+
+ @Test
+ public void testQueryParticipants() throws Exception {
+ Participant participant = new Participant();
+ ToscaConceptIdentifier participantId = CommonTestData.getParticipantId();
+ participant.setDefinition(participantId);
+ participant.setName(participantId.getName());
+ participant.setVersion(participantId.getVersion());
+
+ // GET REST call for querying the participants
+ Invocation.Builder invocationBuilder =
+ super.sendRequest(PARTICIPANTS_ENDPOINT + "/" + participant.getKey().getName()
+ + "/" + participant.getVersion());
+
+ Response rawresp = invocationBuilder.buildGet().invoke();
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ List<Participant> returnValue = rawresp.readEntity(new GenericType<List<Participant>>() {});
+ assertNotNull(returnValue);
+ assertThat(returnValue).hasSize(1);
+ // Verify the result of GET participants with what is stored
+ assertEquals(participant.getDefinition(), returnValue.get(0).getDefinition());
+ }
+
+ @Test
+ public void testQueryControlLoopElements() throws Exception {
+ // GET REST call for querying the controlLoop elements
+ Invocation.Builder invocationBuilder = super.sendRequest(ELEMENTS_ENDPOINT + "/"
+ + "PMSHInstance0" + "/" + "1.0.0");
+
+ Response rawresp = invocationBuilder.buildGet().invoke();
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ Map<UUID, ControlLoopElement> returnValue =
+ rawresp.readEntity(new GenericType<Map<UUID, ControlLoopElement>>() {});
+ assertNotNull(returnValue);
+ // Verify the result of GET controlloop elements with what is stored
+ assertThat(returnValue).hasSize(1);
+ returnValue.values().forEach(element -> assertEquals("org.onap.PM_CDS_Blueprint",
+ element.getDefinition().getName()));
+ }
+
+ @Test
+ public void testUpdateParticipant() throws Exception {
+ SimulationProvider provider = SimulationHandler.getInstance().getSimulationProvider();
+ List<Participant> participants = provider.getParticipants(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);
+ Entity<Participant> entParticipant = Entity.entity(participants.get(0), MediaType.APPLICATION_JSON);
+
+ // PUT REST call for updating Participant
+ Invocation.Builder invocationBuilder = sendRequest(PARTICIPANTS_ENDPOINT);
+ Response rawresp = invocationBuilder.put(entParticipant);
+ TypedSimpleResponse<Participant> resp = rawresp.readEntity(TypedSimpleResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ assertNotNull(resp.getResponse());
+ // Verify the response and state returned by PUT REST call for updating participants
+ assertThat(resp.toString()).contains("definition={name=org.onap.PM_CDS_Blueprint, version=1.0.0}");
+ assertThat(resp.toString()).contains("participantState=PASSIVE");
+ }
+
+ @Test
+ public void testUpdateControlLoopElement() throws Exception {
+ ControlLoop controlLoop = TestListenerUtils.createControlLoop();
+ SimulationProvider provider = SimulationHandler.getInstance().getSimulationProvider();
+ Map<UUID, ControlLoopElement> controlLoopElements = provider.getControlLoopElements(
+ controlLoop.getDefinition().getName(), controlLoop.getDefinition().getVersion());
+
+ for (Map.Entry<UUID, ControlLoopElement> clElement : controlLoopElements.entrySet()) {
+ // Check the initial state on the ControlLoopElement, which is UNINITIALISED
+ assertEquals(ControlLoopOrderedState.UNINITIALISED, clElement.getValue().getOrderedState());
+ // Change the state of the ControlLoopElement to PASSIVE from UNINITIALISED
+ clElement.getValue().setOrderedState(ControlLoopOrderedState.PASSIVE);
+ Entity<ControlLoopElement> entClElement = Entity.entity(clElement.getValue(), MediaType.APPLICATION_JSON);
+
+ // PUT REST call for updating ControlLoopElement
+ Invocation.Builder invocationBuilder = sendRequest(ELEMENTS_ENDPOINT);
+ Response rawresp = invocationBuilder.put(entClElement);
+ TypedSimpleResponse<ControlLoopElement> resp = rawresp.readEntity(TypedSimpleResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ assertNotNull(resp.getResponse());
+ // Verify the response and state returned by PUT REST call for updating participants
+ assertThat(resp.toString()).contains("definition={name=org.onap.PM_CDS_Blueprint, version=1.0.0}");
+ assertThat(resp.toString()).contains("orderedState=PASSIVE");
+ }
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/TestMain.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/TestMain.java
new file mode 100644
index 000000000..5a5ad8931
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/TestMain.java
@@ -0,0 +1,117 @@
+/*-
+ * ============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.startstop;
+
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.common.utils.resources.MessageConstants;
+
+/**
+ * Class to perform unit test of {@link Main}}.
+ */
+public class TestMain {
+
+ @Test
+ public void testMain_Help() {
+ final String[] configParameters = {"-h"};
+ Main main = new Main(configParameters);
+ assertFalse(main.isRunning());
+ }
+
+ @Test
+ public void testMain_Version() {
+ final String[] configParameters = {"-v"};
+ Main main = new Main(configParameters);
+ assertFalse(main.isRunning());
+ }
+
+ @Test
+ public void testMain_Valid() {
+ final String[] configParameters = {"-c", "src/test/resources/parameters/TestParameters.json"};
+ Main main = new Main(configParameters);
+ assertTrue(main.isRunning());
+
+ assertThatCode(() -> main.shutdown()).doesNotThrowAnyException();
+
+ assertFalse(main.isRunning());
+ }
+
+ @Test
+ public void testMain_NoParameter() {
+ assertThatConfigParameterThrownException(new String[] {});
+ }
+
+ @Test
+ public void testMain_FilePathNotDefined() {
+ assertThatConfigParameterThrownException(new String[] {"-c"});
+ }
+
+ @Test
+ public void testMain_TooManyCommand() {
+ assertThatConfigParameterThrownException(new String[] {"-h", "d"});
+ }
+
+ @Test
+ public void testMain_WrongParameter() {
+ assertThatConfigParameterThrownException(new String[] {"-d"});
+ }
+
+ private void assertThatConfigParameterThrownException(final String[] configParameters) {
+ assertThatThrownBy(() -> Main.main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class)
+ .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP));
+ }
+
+ @Test
+ public void testParticipant_NoFileWithThisName() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/NoFileWithThisName.json");
+ }
+
+ @Test
+ public void testParticipant_NotValidFile() {
+ assertThatConfigFileThrownException("src/test/resources/parameters");
+ }
+
+ @Test
+ public void testParticipant_FileEmpty() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/EmptyParameters.json");
+ }
+
+ @Test
+ public void testParticipant_NoParameters() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/NoParameters.json");
+ }
+
+ @Test
+ public void testParticipant_InvalidParameters() {
+ assertThatConfigFileThrownException("src/test/resources/parameters/InvalidParameters.json");
+ }
+
+ private void assertThatConfigFileThrownException(final String configFilePath) {
+ final String[] configParameters = new String[] {"-c", configFilePath};
+ assertThatThrownBy(() -> new Main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class)
+ .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP));
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/TestParticipantSimulatorActivator.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/TestParticipantSimulatorActivator.java
new file mode 100644
index 000000000..c695d5f24
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/TestParticipantSimulatorActivator.java
@@ -0,0 +1,89 @@
+/*-
+ * ============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.startstop;
+
+import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.ParticipantSimulatorParameterHandler;
+import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.ParticipantSimulatorParameters;
+
+/**
+ * Class to perform unit test of {@link ParticipantActivator}}.
+ */
+public class TestParticipantSimulatorActivator {
+
+ private static ParticipantSimulatorActivator activator;
+
+ /**
+ * Initializes an activator.
+ *
+ * @throws Exception if an error occurs
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json"};
+ final ParticipantSimulatorCommandLineArguments arguments =
+ new ParticipantSimulatorCommandLineArguments(participantConfigParameters);
+ final ParticipantSimulatorParameters parGroup =
+ new ParticipantSimulatorParameterHandler().getParameters(arguments);
+ activator = new ParticipantSimulatorActivator(parGroup);
+ }
+
+ /**
+ * Method for cleanup after each test.
+ *
+ * @throws Exception if an error occurs
+ */
+ @AfterClass
+ public static void teardown() throws Exception {
+ // shut down activator
+ if (activator != null && activator.isAlive()) {
+ activator.shutdown();
+ }
+ }
+
+ @Test
+ public void testParticipantActivator() {
+ activator.start();
+ assertTrue(activator.isAlive());
+ assertTrue(activator.getParameters().isValid());
+ assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, activator.getParameters().getName());
+
+ // repeat - should throw an exception
+ assertThatIllegalStateException().isThrownBy(() -> activator.start());
+ assertTrue(activator.isAlive());
+ assertTrue(activator.getParameters().isValid());
+
+ activator.shutdown();
+ assertFalse(activator.isAlive());
+
+ // repeat - should throw an exception
+ assertThatIllegalStateException().isThrownBy(() -> activator.shutdown());
+ assertFalse(activator.isAlive());
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/EmptyParameters.json b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/EmptyParameters.json
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/EmptyParameters.json
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/InvalidParameters.json b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/InvalidParameters.json
new file mode 100644
index 000000000..1035ccb67
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/InvalidParameters.json
@@ -0,0 +1,3 @@
+{
+ "name": "
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/NoParameters.json b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/NoParameters.json
new file mode 100644
index 000000000..7a73a41bf
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/NoParameters.json
@@ -0,0 +1,2 @@
+{
+} \ No newline at end of file
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/TestParameters.json b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/TestParameters.json
new file mode 100644
index 000000000..8c594044b
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/TestParameters.json
@@ -0,0 +1,61 @@
+{
+ "name": "ControlLoopParticipantGroup",
+ "restServerParameters": {
+ "host": "0.0.0.0",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "https": false,
+ "aaf": false
+ },
+ "intermediaryParameters": {
+ "name": "Participant parameters",
+ "reportingTimeInterval": 120000,
+ "description": "Participant Description",
+ "participantId": {
+ "name": "org.onap.PM_CDS_Blueprint",
+ "version": "1.0.0"
+ },
+ "participantType": {
+ "name": "org.onap.PM_CDS_Blueprint",
+ "version": "1.0.0"
+ },
+ "clampControlLoopTopics": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/TestParametersStd.json b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/TestParametersStd.json
new file mode 100644
index 000000000..0295a8f91
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/TestParametersStd.json
@@ -0,0 +1,61 @@
+{
+ "name": "ControlLoopParticipantGroup",
+ "restServerParameters": {
+ "host": "0.0.0.0",
+ "port": ${port},
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "https": false,
+ "aaf": false
+ },
+ "intermediaryParameters": {
+ "name": "Participant parameters",
+ "reportingTimeInterval": 120000,
+ "description": "Participant Description",
+ "participantId": {
+ "name": "org.onap.PM_CDS_Blueprint",
+ "version": "1.0.0"
+ },
+ "participantType": {
+ "name": "org.onap.PM_CDS_Blueprint",
+ "version": "1.0.0"
+ },
+ "clampControlLoopTopics": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ }
+}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/Unreadable.json b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/Unreadable.json
new file mode 100644
index 000000000..f11bd8c95
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/resources/parameters/Unreadable.json
@@ -0,0 +1,81 @@
+{
+ "name": "ControlLoopRuntimeGroup",
+ "restServerParameters": {
+ "host": "0.0.0.0",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "https": false,
+ "aaf": false
+ },
+ "participantParameters": {
+ "heartBeatMs": 120000,
+ "updateParameters": {
+ "maxRetryCount": 1,
+ "maxWaitMs": 30000
+ },
+ "stateChangeParameters": {
+ "maxRetryCount": 1,
+ "maxWaitMs": 30000
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.h2.Driver",
+ "databaseUrl": "jdbc:h2:mem:testdb",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "ToscaConceptTest"
+ },
+ "topicParameterGroup": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ },
+ "healthCheckRestClientParameters": [
+ {
+ "clientName": "api",
+ "hostname": "policy-api",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "policy/api/v1/healthcheck"
+ },
+ {
+ "clientName": "distribution",
+ "hostname": "policy-distribution",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "healthcheck"
+ }
+ ]
+}
+
+
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml b/participant/participant-impl/participant-impl-simulator/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml
new file mode 100644
index 000000000..99dd0ed68
--- /dev/null
+++ b/participant/participant-impl/participant-impl-simulator/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml
@@ -0,0 +1,452 @@
+tosca_definitions_version: tosca_simple_yaml_1_3
+capability_types:
+ org.onap.EventProducer:
+ properties:
+ carrier_protocol_type:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ data_format:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - JSON
+ - YAML
+ - JMS
+ event_format:
+ type: string
+ required: true
+ event_format_version:
+ type: string
+ required: false
+ 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.'
+ version: 0.0.1
+ derived_from: tosca.capabilities.Root
+ org.onap.EventConsumer:
+ properties:
+ responding_capability:
+ type: string
+ required: false
+ carrier_protocol_type:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ data_format:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - JSON
+ - YAML
+ - JMS
+ - all valid values should be added here
+ event_format:
+ type: string
+ description: 'examples for event_format: Ves_specification, LinkUp, VnfConfigured,
+ etc.'
+ required: true
+ event_format_version:
+ type: string
+ description: 'examples for event_format_version: 5.28.4, 7.30.1, etc.'
+ required: false
+ 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.'
+ version: 0.0.1
+ derived_from: tosca.capabilities.Root
+node_types:
+ org.onap.DynamicConfig:
+ properties:
+ application_name:
+ type: string
+ description: Value used to tie the config to an application ? should we be
+ using a relationship here instead?
+ required: true
+ application_version:
+ type: string
+ required: true
+ application_provider:
+ type: string
+ required: false
+ data_types:
+ type: object
+ required: false
+ schema:
+ type: object
+ required: false
+ version: 0.0.1
+ derived_from: tosca.nodes.Root
+ org.onap.APP:
+ 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
+ required: false
+ monitoring_policy:
+ type: string
+ description: A reference to the monitoring policy
+ required: false
+ requirements:
+ - receive:
+ capability: org.onap.EventProducer
+ relationship: org.onap.PropagateEvent
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ - send:
+ capability: org.onap.EventConsumer
+ relationship: org.onap.PropagateEvent
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ version: 0.0.1
+ derived_from: tosca.nodes.Root
+ org.onap.EventRelay:
+ properties:
+ event_format:
+ type: string
+ description: 'examples for event_format: Ves_specification, etc.'
+ required: true
+ event_format_version:
+ type: string
+ description: 'examples for event_format_version: 5.28.4, 7.30.1, etc.'
+ required: true
+ 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
+ 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}'
+ required: true
+ key_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ - all valid values should be added here
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - DMAAP_message_router
+ - SOMETHING_ELSE
+ - REST
+ - all valid values should be added here
+ supported_data_formats:
+ type: map
+ 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 }'
+ required: true
+ 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:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ - send:
+ capability: org.onap.EventConsumer
+ relationship: org.onap.PropagateEvent
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ version: 0.0.1
+ derived_from: tosca.nodes.Root
+relationship_types:
+ org.onap.PropagateEvent:
+ properties:
+ config_keys:
+ type: list
+ description: The relationship type used on requirements to org.onap.EventProducer
+ and org.onap.EventConsumer capabilities. 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.
+ required: false
+ entry_schema:
+ type: string
+ version: 0.0.1
+ derived_from: tosca.relationships.Root
+topology_template:
+ inputs:
+ pm_subscription_topic:
+ type: string
+ pm_subscription_response_topic:
+ type: string
+ pm_subscription_handler_blueprint_id:
+ type: string
+ pm_subscription_operational_policy_id:
+ type: string
+ pm_subscription_cds_blueprint_id:
+ type: string
+ enable_tls:
+ type: string
+ node_templates:
+ org.onap.PM_Subscription_Handler:
+ type: org.onap.APP
+ properties:
+ application_name: PM Subscription Handler
+ provider: Ericsson
+ application_version: 1.0.0
+ artifact_id:
+ get_input: pm_subscription_handler_blueprint_id
+ description: Is this a reference to the DCAE Cloudify Blueprint that is
+ already stored(or will be stored before CL configuration & instatiation)
+ in DCAE Inventory?
+ artifact_config:
+ enable_tls:
+ get_input: enable_tls
+ pmsh_publish_topic_name:
+ get_input: pm_subscription_topic
+ capabilities:
+ pm-subscription-event-publisher:
+ properties:
+ carrier_protocol_type: DMAAP_message_router
+ data_format: JSON
+ event_format: pm-subscription-event-format
+ event_format_version: 1.0.0
+ attributes:
+ type: org.onap.EventProducer
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ pm-subscription-event-receiver:
+ properties:
+ carrier_protocol_type: DMAAP_message_router
+ data_format: JSON
+ event_format: pm-subscription-event-response-format
+ event_format_version: 1.0.0
+ relationships:
+ - type: tosca.relationships.DependsOn
+ - description: any ideas on a better realtionship ? or is it better to
+ just use the root realtionship ?
+ - target: org.onap.PM_Monitoring_Policy
+ attributes:
+ type: org.onap.EventConsumer
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ version: 0.0.0
+ org.onap.PM_Monitoring_Policy:
+ type: org.onap.DynamicConfig
+ properties:
+ application_name: PM Subscription Handler
+ application_version: 1.0.0
+ provider: Ericsson
+ data_types:
+ measurementType:
+ type: string
+ DN:
+ type: string
+ nfFilter:
+ properties:
+ nfNames:
+ type: list
+ entry_schema: string
+ modelInvariantIDs:
+ type: list
+ entry_schema:
+ type: string
+ modelVersionIDs:
+ type: list
+ entry_schema:
+ type: string
+ measurementGroup:
+ properties:
+ masurementTypes:
+ type: list
+ entry_schema:
+ type: measurementType
+ managedObjectDNsBasic:
+ type: list
+ entry_schema:
+ type: DN
+ schema:
+ subscription:
+ subscriptionName:
+ type: string
+ required: true
+ administrativeState:
+ type: string
+ required: true
+ filebasedGP:
+ type: integer
+ required: true
+ fileLocation:
+ type: string
+ required: true
+ nfFilter:
+ type: nfFilter
+ measurementGroups:
+ type: list
+ entry_schema:
+ type: measurementGroup
+ version: 0.0.0
+ description: Should I be showing a dependency between PM Subscription Handler
+ and the PM Monitoring Policy
+ org.onap.PM_Policy:
+ type: org.onap.APP
+ properties:
+ application_name: PM Subscription Operational Policy
+ provider: Ericsson
+ application_version: 1.0.0
+ artifact_id:
+ get_input: pm_subscription_operational_policy_id
+ artifact_config: NOT_DEFINED
+ requirements:
+ - receive_0:
+ capability: pm-subscription-event-publisher
+ node: org.onap.PM_Subscription_Handler
+ relationship: NOT_DEFINED
+ properties:
+ config_keys:
+ - topic_name:
+ get_input: pm_subscription_topic
+ version: 0.0.0
+ - send_0:
+ capability: cds-rest-receive
+ node: org.onap.CDS
+ version: 0.0.0
+ - receive_1:
+ capability: cds-rest-response
+ node: org.onap.CDS
+ version: 0.0.0
+ - send_1:
+ capability: pm-subscription-event-receiver
+ node: org.onap.PM_Subscription_Handler
+ relationship: NOT_DEFINED
+ properties:
+ config_keys:
+ - topic_name:
+ get_input: pm_subscription_response_topic
+ version: 0.0.0
+ capabilities:
+ pm-subscription-response-event-publisher:
+ properties:
+ type: org.onap.EventProducer
+ carrier_protocol_type: DMAAP_message_router
+ data_format: JSON
+ event_format: pm-subscription-event-response-format
+ event_format_version: 1.0.0
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ version: 0.0.0
+ org.onap.PM_CDS_Blueprint:
+ type: org.onap.APP
+ properties:
+ application_name: PM Subscription CDS Blueprint
+ provider: Ericsson
+ application_version: 1.0.0
+ artifact_id:
+ get_input: pm_subscription_cds_blueprint_id
+ capabilities:
+ cds-rest-receive:
+ properties:
+ type: org.onap.EventConsumer
+ protocol_type: REST
+ data_format: JSON
+ event_format: cds_action_format
+ event_format_version: 1.0.0
+ responding_capability: cds-rest-response
+ occurrences:
+ - 0.0
+ - UNBOUNDED
+ version: 0.0.0
+ cds-rest-response:
+ properties:
+ type: org.onap.EventProducer
+ protocol_type: REST
+ data_format: JSON
+ event_format: cds_action_response_format
+ event_format_version: 1.0.0
+ occurrences:
+ - 0.0
+ version: 0.0.0
+ version: 1.0.0
+ org.onap.controlloop0:
+ type: org.onap.APP
+ properties:
+ application_name: Test Control Loop
+ provider: Ericsson
+ application_version: 1.0.0
+ status: NOT_DEPLOYED
+ version: 0.0.0
+version: 0.0.0
diff --git a/participant/participant-impl/pom.xml b/participant/participant-impl/pom.xml
index 6c67bfa51..8afd81045 100644
--- a/participant/participant-impl/pom.xml
+++ b/participant/participant-impl/pom.xml
@@ -40,4 +40,12 @@
<module>participant-impl-cds</module>
<module>participant-impl-kubernetes</module>
</modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.policy.clamp.participant</groupId>
+ <artifactId>policy-clamp-participant-intermediary</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
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
new file mode 100644
index 000000000..9e5d2c663
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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.ToscaServiceTemplate;
+
+/**
+ * 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(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 controlLoopDefinition toscaServiceTemplate
+ * @throws PfModelException from Policy framework
+ */
+ public void controlLoopElementUpdate(ControlLoopElement element,
+ ToscaServiceTemplate controlLoopDefinition) 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
new file mode 100644
index 000000000..d31ae1082
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java
@@ -0,0 +1,139 @@
+/*-
+ * ============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.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.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+/**
+ * This interface is used by participant implementations to use the participant intermediary.
+ */
+public interface ParticipantIntermediaryApi {
+ /**
+ * Initialise the participant intermediary.
+ *
+ * @param parameters the parameters for the intermediary
+ */
+ void init(ParticipantIntermediaryParameters parameters);
+
+ /**
+ * Close the intermediary.
+ */
+ void close();
+
+ /**
+ * 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);
+
+ /**
+ * 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(UUID id, ControlLoopOrderedState currentState,
+ ControlLoopState newState);
+
+ /**
+ * 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);
+
+ /**
+ * Return participantHandler, This will not be used in real world, but for junits,
+ * if participantHandler is not returned, there is no way to test state change messages
+ * without dmaap simulator.
+ *
+ */
+ ParticipantHandler getParticipantHandler();
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryFactory.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryFactory.java
new file mode 100644
index 000000000..d7cc4b2ed
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryFactory.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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 org.onap.policy.clamp.controlloop.participant.intermediary.api.impl.ParticipantIntermediaryApiImpl;
+
+/**
+ * Factory class for creating {@link ParticipantIntermediaryApi} instances.
+ */
+public class ParticipantIntermediaryFactory {
+
+ /**
+ * Create an implementation of the {@link ParticipantIntermediaryApi} interface.
+ *
+ * @return the implementation of the API
+ */
+ public ParticipantIntermediaryApi createApiImplementation() {
+ return new ParticipantIntermediaryApiImpl();
+ }
+}
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
new file mode 100644
index 000000000..839088d72
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
@@ -0,0 +1,133 @@
+/*-
+ * ============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.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.participant.intermediary.api.ControlLoopElementListener;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.controlloop.participant.intermediary.handler.IntermediaryActivator;
+import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+/**
+ * This class is api implementation used by participant intermediary.
+ */
+public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryApi {
+
+ // The activator for the participant intermediary
+ private IntermediaryActivator activator;
+
+ @Override
+ public void init(ParticipantIntermediaryParameters parameters) {
+ activator = new IntermediaryActivator(parameters);
+
+ activator.start();
+ }
+
+ @Override
+ public void close() {
+ activator.shutdown();
+ }
+
+ @Override
+ public void registerControlLoopElementListener(ControlLoopElementListener controlLoopElementListener) {
+ activator.getParticipantHandler().getControlLoopHandler()
+ .registerControlLoopElementListener(controlLoopElementListener);
+ }
+
+ @Override
+ public List<Participant> getParticipants(String name, String version) {
+ return List.of(activator.getParticipantHandler().getParticipant(name, version));
+ }
+
+ @Override
+ public Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state) {
+ return activator.getParticipantHandler().updateParticipantState(definition, state);
+ }
+
+ @Override
+ public void updateParticipantStatistics(ParticipantStatistics participantStatistics) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public ControlLoops getControlLoops(String name, String version) {
+ return activator.getParticipantHandler().getControlLoopHandler().getControlLoops();
+ }
+
+ @Override
+ public Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version) {
+ List<ControlLoop> controlLoops = activator.getParticipantHandler()
+ .getControlLoopHandler().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 = activator.getParticipantHandler()
+ .getControlLoopHandler().getControlLoops().getControlLoopList();
+
+ for (ControlLoop controlLoop : controlLoops) {
+ ControlLoopElement clElement = controlLoop.getElements().get(id);
+ if (clElement != null) {
+ return clElement;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState currentState,
+ ControlLoopState newState) {
+ return activator.getParticipantHandler().getControlLoopHandler()
+ .updateControlLoopElementState(id, currentState, newState);
+ }
+
+ @Override
+ public void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics) {
+ activator.getParticipantHandler().getControlLoopHandler()
+ .updateControlLoopElementStatistics(id, elementStatistics);
+ }
+
+ @Override
+ public ParticipantHandler getParticipantHandler() {
+ return activator.getParticipantHandler();
+ }
+}
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/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java
new file mode 100644
index 000000000..50b8b9cdc
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.comm;
+
+import java.io.Closeable;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
+import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Listener for Participant State Change messages sent by CLAMP.
+ */
+public class ControlLoopStateChangeListener extends ScoListener<ParticipantControlLoopStateChange>
+ implements Closeable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopStateChangeListener.class);
+
+ private final ParticipantHandler participantHandler;
+
+ /**
+ * Constructs the object.
+ *
+ * @param participantHandler the handler for managing the state of the participant
+ */
+ public ControlLoopStateChangeListener(final ParticipantHandler participantHandler) {
+ super(ParticipantControlLoopStateChange.class);
+ this.participantHandler = participantHandler;
+ }
+
+ @Override
+ public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
+ final ParticipantControlLoopStateChange controlLoopStateChangeMsg) {
+ LOGGER.debug("Control Loop State Change received from CLAMP - {}", controlLoopStateChangeMsg);
+
+ if (participantHandler.canHandle(controlLoopStateChangeMsg)) {
+ LOGGER.debug("Message for this participant");
+ participantHandler.getControlLoopHandler().handleControlLoopStateChange(controlLoopStateChangeMsg);
+ } else {
+ LOGGER.debug("Message not for this participant");
+ }
+ }
+
+ @Override
+ public void close() {
+ // No explicit action on this class
+ }
+}
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/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java
new file mode 100644
index 000000000..ab2437c1c
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.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.controlloop.participant.intermediary.comm;
+
+import java.io.Closeable;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate;
+import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Listener for Control Loop Update messages sent by CLAMP.
+ */
+public class ControlLoopUpdateListener extends ScoListener<ParticipantControlLoopUpdate> implements Closeable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopUpdateListener.class);
+
+ private final ParticipantHandler participantHandler;
+
+ /**
+ * Constructs the object.
+ *
+ * @param participantHandler the handler for managing the state of the participant
+ */
+ public ControlLoopUpdateListener(final ParticipantHandler participantHandler) {
+ super(ParticipantControlLoopUpdate.class);
+ this.participantHandler = participantHandler;
+ }
+
+ @Override
+ public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
+ final ParticipantControlLoopUpdate participantControlLoopUpdateMsg) {
+ LOGGER.debug("Control Loop update received from CLAMP - {}", participantControlLoopUpdateMsg);
+
+ if (participantHandler.canHandle(participantControlLoopUpdateMsg)) {
+ LOGGER.debug("Message for this participant");
+ participantHandler.getControlLoopHandler().handleControlLoopUpdate(participantControlLoopUpdateMsg);
+ } else {
+ LOGGER.debug("Message not for this participant");
+ }
+ }
+
+ @Override
+ public void close() {
+ // No explicit action on this class
+ }
+}
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/controlloop/participant/intermediary/comm/MessageSender.java
new file mode 100644
index 000000000..3128f1eaa
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java
@@ -0,0 +1,162 @@
+/*-
+ * ============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.comm;
+
+import java.io.Closeable;
+import java.time.Instant;
+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.models.controlloop.concepts.ControlLoop;
+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.ParticipantStatistics;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseDetails;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseStatus;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStatusPublisher;
+import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class sends messages from participants to CLAMP.
+ */
+public class MessageSender extends TimerTask implements Closeable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(MessageSender.class);
+
+ private final ParticipantHandler participantHandler;
+ private final ParticipantStatusPublisher publisher;
+ private ScheduledExecutorService timerPool;
+
+ /**
+ * Constructor, set the publisher.
+ *
+ * @param participantHandler the participant handler to use for gathering information
+ * @param publisher the publisher to use for sending messages
+ * @param interval time interval to send Participant Status periodic messages
+ */
+ public MessageSender(ParticipantHandler participantHandler, ParticipantStatusPublisher publisher,
+ long interval) {
+ this.participantHandler = participantHandler;
+ this.publisher = publisher;
+
+ // Kick off the timer
+ timerPool = makeTimerPool();
+ timerPool.scheduleAtFixedRate(this, 0, interval, TimeUnit.SECONDS);
+ }
+
+ @Override
+ public void run() {
+ LOGGER.debug("Sent heartbeat to CLAMP");
+
+ ParticipantResponseDetails response = new ParticipantResponseDetails();
+
+ response.setResponseTo(null);
+ response.setResponseStatus(ParticipantResponseStatus.PERIODIC);
+ response.setResponseMessage("Periodic response from participant");
+ }
+
+ @Override
+ public void close() {
+ timerPool.shutdown();
+ }
+
+ /**
+ * Send a response message for this participant.
+ *
+ * @param response the details to include in the response message
+ */
+ public void sendResponse(ParticipantResponseDetails response) {
+ sendResponse(null, response);
+ }
+
+ /**
+ * Dispatch a response message for this participant.
+ *
+ * @param controlLoopId the control loop to which this message is a response
+ * @param response the details to include in the response message
+ */
+ public void sendResponse(ToscaConceptIdentifier controlLoopId, ParticipantResponseDetails response) {
+ ParticipantStatus status = new ParticipantStatus();
+
+ // Participant related fields
+ status.setParticipantType(participantHandler.getParticipantType());
+ status.setParticipantId(participantHandler.getParticipantId());
+ status.setState(participantHandler.getState());
+ status.setHealthStatus(participantHandler.getHealthStatus());
+
+ // Control loop related fields
+ ControlLoops controlLoops = participantHandler.getControlLoopHandler().getControlLoops();
+ status.setControlLoopId(controlLoopId);
+ status.setControlLoops(controlLoops);
+ status.setResponse(response);
+
+ ParticipantStatistics participantStatistics = new ParticipantStatistics();
+ participantStatistics.setTimeStamp(Instant.now());
+ participantStatistics.setParticipantId(participantHandler.getParticipantId());
+ participantStatistics.setHealthStatus(participantHandler.getHealthStatus());
+ participantStatistics.setState(participantHandler.getState());
+ status.setParticipantStatistics(participantStatistics);
+
+ for (ControlLoopElementListener clElementListener :
+ participantHandler.getControlLoopHandler().getListeners()) {
+ updateClElementStatistics(controlLoops, clElementListener);
+ }
+
+ status.setControlLoops(controlLoops);
+
+ publisher.send(status);
+ }
+
+ /**
+ * Update ControlLoopElement statistics. The control loop elements listening will be
+ * notified to retrieve statistics from respective controlloop elements, and controlloopelements
+ * data on the handler will be updated.
+ *
+ * @param controlLoops the control loops
+ * @param clElementListener control loop element listener
+ */
+ public void updateClElementStatistics(ControlLoops controlLoops, ControlLoopElementListener clElementListener) {
+ for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
+ for (ControlLoopElement element : controlLoop.getElements().values()) {
+ try {
+ clElementListener.handleStatistics(element.getId());
+ } catch (PfModelException e) {
+ LOGGER.debug("Getting statistics for Control loop element failed");
+ }
+ }
+ }
+ }
+
+ /**
+ * Makes a new timer pool.
+ *
+ * @return a new timer pool
+ */
+ protected ScheduledExecutorService makeTimerPool() {
+ return Executors.newScheduledThreadPool(1);
+ }
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantHealthCheckListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantHealthCheckListener.java
new file mode 100644
index 000000000..e0e6be329
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantHealthCheckListener.java
@@ -0,0 +1,69 @@
+/*-
+ * ============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.comm;
+
+import java.io.Closeable;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck;
+import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Listener for Participant health status messages sent by CLAMP.
+ */
+public class ParticipantHealthCheckListener extends ScoListener<ParticipantHealthCheck> implements Closeable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantHealthCheckListener.class);
+
+ private final ParticipantHandler participantHandler;
+
+ /**
+ * Constructs the object.
+ *
+ * @param participantHandler the handler for managing the state and health of the participant
+ */
+ public ParticipantHealthCheckListener(final ParticipantHandler participantHandler) {
+ super(ParticipantHealthCheck.class);
+ this.participantHandler = participantHandler;
+ }
+
+ @Override
+ public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
+ final ParticipantHealthCheck participantHealthCheckMsg) {
+ LOGGER.debug("Participant Health Check message received from CLAMP - {}", participantHealthCheckMsg);
+
+
+ if (participantHandler.canHandle(participantHealthCheckMsg)) {
+ LOGGER.debug("Message for this participant");
+ participantHandler.handleParticipantHealthCheck(participantHealthCheckMsg);
+ } else {
+ LOGGER.debug("Message not for this participant");
+ }
+
+ }
+
+ @Override
+ public void close() {
+ // No explicit action on this class
+ }
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java
new file mode 100644
index 000000000..c1a8b5b4a
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.comm;
+
+import java.io.Closeable;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
+import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Listener for Participant State Change messages sent by CLAMP.
+ *
+ */
+public class ParticipantStateChangeListener extends ScoListener<ParticipantStateChange> implements Closeable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantStateChangeListener.class);
+
+ private final ParticipantHandler participantHandler;
+
+ /**
+ * Constructs the object.
+ *
+ * @param participantHandler the handler for managing the state of the participant
+ */
+ public ParticipantStateChangeListener(final ParticipantHandler participantHandler) {
+ super(ParticipantStateChange.class);
+ this.participantHandler = participantHandler;
+ }
+
+ @Override
+ public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
+ final ParticipantStateChange participantStateChangeMsg) {
+ LOGGER.debug("Participant State Change received from CLAMP - {}", participantStateChangeMsg);
+
+ if (participantHandler.canHandle(participantStateChangeMsg)) {
+ LOGGER.debug("Message for this participant");
+ participantHandler.handleParticipantStateChange(participantStateChangeMsg);
+ } else {
+ LOGGER.debug("Message not for this participant");
+ }
+ }
+
+ @Override
+ public void close() {
+ // No explicit action on this class
+ }
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusPublisher.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusPublisher.java
new file mode 100644
index 000000000..bc53b4e9d
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusPublisher.java
@@ -0,0 +1,63 @@
+/*-
+ * ============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.comm;
+
+import java.io.Closeable;
+import java.util.List;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
+import org.onap.policy.common.endpoints.event.comm.TopicSink;
+import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is used to send Participant Status messages to clamp using TopicSinkClient.
+ *
+ */
+public class ParticipantStatusPublisher implements Closeable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantStatusPublisher.class);
+
+ private final TopicSinkClient topicSinkClient;
+
+ /**
+ * Constructor for instantiating ParticipantStatusPublisher.
+ *
+ * @param topicSinks the topic sinks
+ */
+ public ParticipantStatusPublisher(List<TopicSink> topicSinks) {
+ this.topicSinkClient = new TopicSinkClient(topicSinks.get(0));
+ }
+
+ /**
+ * Method to send Participant Status message to clamp on demand.
+ *
+ * @param participantStatus the Participant Status
+ */
+ public void send(final ParticipantStatus participantStatus) {
+ topicSinkClient.send(participantStatus);
+ LOGGER.debug("Sent Participant Status message to CLAMP - {}", participantStatus);
+ }
+
+ @Override
+ public void close() {
+ // No explicit action on this class
+ }
+}
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
new file mode 100644
index 000000000..cc2a66b58
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
@@ -0,0 +1,323 @@
+/*-
+ * ============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 java.io.Closeable;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import lombok.Getter;
+import org.apache.commons.collections4.CollectionUtils;
+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.ParticipantControlLoopStateChange;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseDetails;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseStatus;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.MessageSender;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/*
+ * This class is responsible for managing the state of all control loops in the participant.
+ */
+public class ControlLoopHandler implements Closeable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopHandler.class);
+
+ private ToscaConceptIdentifier participantType = null;
+ private ToscaConceptIdentifier participantId = null;
+ private MessageSender messageSender = null;
+
+ private final Map<ToscaConceptIdentifier, ControlLoop> controlLoopMap = new LinkedHashMap<>();
+
+ private final Map<UUID, ControlLoopElement> elementsOnThisParticipant = new LinkedHashMap<>();
+
+ @Getter
+ private List<ControlLoopElementListener> listeners = new ArrayList<>();
+
+ public ControlLoopHandler() {}
+
+ /**
+ * Constructor, set the participant ID and messageSender.
+ *
+ * @param parameters the parameters of the participant
+ * @param messageSender the messageSender for sending responses to messages
+ */
+ public ControlLoopHandler(ParticipantIntermediaryParameters parameters, MessageSender messageSender) {
+ this.participantType = parameters.getParticipantType();
+ this.participantId = parameters.getParticipantId();
+ this.messageSender = messageSender;
+ }
+
+ @Override
+ public void close() {
+ // No explicit action on this class
+ }
+
+ public void registerControlLoopElementListener(ControlLoopElementListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * Handle a control loop element state change message.
+ *
+ * @param id controlloop element id
+ * @param orderedState the current state
+ * @param newState the ordered state
+ * @return controlLoopElement the updated controlloop element
+ */
+ public ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState orderedState,
+ ControlLoopState newState) {
+
+ if (id == null) {
+ return null;
+ }
+
+ ControlLoopElement clElement = elementsOnThisParticipant.get(id);
+ if (clElement != null) {
+ clElement.setOrderedState(orderedState);
+ clElement.setState(newState);
+ LOGGER.debug("Control loop element {} state changed to {}", id, newState);
+ ParticipantResponseDetails response = new ParticipantResponseDetails();
+ response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
+ response.setResponseMessage("ControlLoopElement state changed to {} " + newState);
+ messageSender.sendResponse(response);
+ 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) {
+ ControlLoopElement 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
+ */
+ public void handleControlLoopStateChange(ParticipantControlLoopStateChange stateChangeMsg) {
+ if (stateChangeMsg.getControlLoopId() == null) {
+ return;
+ }
+
+ ControlLoop controlLoop = controlLoopMap.get(stateChangeMsg.getControlLoopId());
+
+ if (controlLoop == null) {
+ LOGGER.debug("Control loop {} does not use this participant", stateChangeMsg.getControlLoopId());
+ return;
+ }
+
+ ParticipantResponseDetails response = new ParticipantResponseDetails(stateChangeMsg);
+ handleState(controlLoop, response, stateChangeMsg.getOrderedState());
+ messageSender.sendResponse(response);
+ }
+
+ /**
+ * Method to handle state changes.
+ *
+ * @param controlLoop participant response
+ * @param response participant response
+ * @param orderedState controlloop ordered state
+ */
+ private void handleState(final ControlLoop controlLoop, final ParticipantResponseDetails response,
+ ControlLoopOrderedState orderedState) {
+ switch (orderedState) {
+ case UNINITIALISED:
+ handleUninitialisedState(controlLoop, orderedState, response);
+ break;
+ case PASSIVE:
+ handlePassiveState(controlLoop, orderedState, response);
+ break;
+ case RUNNING:
+ handleRunningState(controlLoop, orderedState, response);
+ 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
+ */
+ public void handleControlLoopUpdate(ParticipantControlLoopUpdate updateMsg) {
+
+ if (!updateMsg.appliesTo(participantType, participantId)) {
+ return;
+ }
+
+ ControlLoop controlLoop = controlLoopMap.get(updateMsg.getControlLoopId());
+
+ ParticipantResponseDetails response = new ParticipantResponseDetails(updateMsg);
+
+ // TODO: Updates to existing ControlLoops are not supported yet (Addition/Removal of ControlLoop
+ // elements to existing ControlLoop has to be supported).
+ if (controlLoop != null) {
+ response.setResponseStatus(ParticipantResponseStatus.FAIL);
+ response.setResponseMessage("Control loop " + updateMsg.getControlLoopId()
+ + " already defined on participant " + participantId);
+
+ messageSender.sendResponse(response);
+ return;
+ }
+
+ controlLoop = updateMsg.getControlLoop();
+ controlLoop.getElements().values().removeIf(element -> !participantType.equals(element.getParticipantType()));
+
+ controlLoopMap.put(updateMsg.getControlLoopId(), controlLoop);
+ for (ControlLoopElement element : updateMsg.getControlLoop().getElements().values()) {
+ element.setState(element.getOrderedState().asState());
+ element.setParticipantId(participantId);
+ elementsOnThisParticipant.put(element.getId(), element);
+ }
+
+ for (ControlLoopElementListener clElementListener : listeners) {
+ try {
+ for (ControlLoopElement element : updateMsg.getControlLoop().getElements().values()) {
+ clElementListener.controlLoopElementUpdate(element, updateMsg.getControlLoopDefinition());
+ }
+ } catch (PfModelException e) {
+ LOGGER.debug("Control loop element update failed {}", updateMsg.getControlLoopId());
+ }
+ }
+
+ response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
+ response.setResponseMessage(
+ "Control loop " + updateMsg.getControlLoopId() + " defined on participant " + participantId);
+
+ messageSender.sendResponse(response);
+ }
+
+ /**
+ * Method to handle when the new state from participant is UNINITIALISED state.
+ *
+ * @param controlLoop participant response
+ * @param orderedState orderedState
+ * @param response participant response
+ */
+ private void handleUninitialisedState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
+ final ParticipantResponseDetails response) {
+ handleStateChange(controlLoop, orderedState, ControlLoopState.UNINITIALISED, response);
+ controlLoopMap.remove(controlLoop.getKey().asIdentifier());
+
+ for (ControlLoopElementListener clElementListener : listeners) {
+ try {
+ for (ControlLoopElement element : controlLoop.getElements().values()) {
+ clElementListener.controlLoopElementStateChange(element.getId(), element.getState(),
+ orderedState);
+ }
+ } catch (PfModelException e) {
+ LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition());
+ }
+ }
+ }
+
+ /**
+ * Method to handle when the new state from participant is PASSIVE state.
+ *
+ * @param controlLoop participant response
+ * @param orderedState orderedState
+ * @param response participant response
+ */
+ private void handlePassiveState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
+ final ParticipantResponseDetails response) {
+ handleStateChange(controlLoop, orderedState, ControlLoopState.PASSIVE, response);
+ }
+
+ /**
+ * Method to handle when the new state from participant is RUNNING state.
+ *
+ * @param controlLoop participant response
+ * @param orderedState orderedState
+ * @param response participant response
+ */
+ private void handleRunningState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
+ final ParticipantResponseDetails response) {
+ handleStateChange(controlLoop, orderedState, ControlLoopState.RUNNING, response);
+ }
+
+ /**
+ * Method to update the state of control loop elements.
+ *
+ * @param controlLoop participant status in memory
+ * @param orderedState orderedState
+ * @param state new state of the control loop elements
+ */
+ private void handleStateChange(ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
+ ControlLoopState newState, ParticipantResponseDetails response) {
+
+ if (orderedState.equals(controlLoop.getOrderedState())) {
+ response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
+ response.setResponseMessage("Control loop is already in state " + orderedState);
+ return;
+ }
+
+ if (!CollectionUtils.isEmpty(controlLoop.getElements().values())) {
+ controlLoop.getElements().values().forEach(element -> {
+ element.setState(newState);
+ element.setOrderedState(orderedState);
+ }
+ );
+ }
+
+ response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
+ response.setResponseMessage("ControlLoop state changed from " + controlLoop.getOrderedState()
+ + " to " + orderedState);
+ controlLoop.setOrderedState(orderedState);
+ }
+
+
+ /**
+ * Get control loops as a {@link ConrolLoops} class.
+ *
+ * @return the control loops
+ */
+ public ControlLoops getControlLoops() {
+ ControlLoops controlLoops = new ControlLoops();
+ controlLoops.setControlLoopList(new ArrayList<>(controlLoopMap.values()));
+ return controlLoops;
+ }
+}
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/controlloop/participant/intermediary/handler/IntermediaryActivator.java
new file mode 100644
index 000000000..be2fa1a30
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java
@@ -0,0 +1,165 @@
+/*-
+ * ============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 java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.ws.rs.core.Response.Status;
+import lombok.Getter;
+import lombok.experimental.Delegate;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopStateChangeListener;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopUpdateListener;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantHealthCheckListener;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStateChangeListener;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStatusPublisher;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+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;
+import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher;
+import org.onap.policy.common.endpoints.listeners.ScoListener;
+import org.onap.policy.common.utils.services.ServiceManagerContainer;
+
+/**
+ * This class activates the Participant Intermediary together with all its handlers.
+ */
+public class IntermediaryActivator extends ServiceManagerContainer {
+ // Name of the message type for messages on topics
+ private static final String[] MSG_TYPE_NAMES = {"messageType"};
+
+ @Getter
+ private final ParticipantIntermediaryParameters parameters;
+
+ // Topics from which the participant receives and to which the participant sends messages
+ private List<TopicSink> topicSinks;
+ private List<TopicSource> topicSources;
+
+ // The participant handler for this intermediary
+ final AtomicReference<ParticipantHandler> participantHandler = new AtomicReference<>();
+
+ /**
+ * Listens for messages on the topic, decodes them into a message, and then dispatches them.
+ */
+ private final MessageTypeDispatcher msgDispatcher;
+
+ /**
+ * Instantiate the activator for participant.
+ *
+ * @param parameters the parameters for the participant intermediary
+ */
+ public IntermediaryActivator(final ParticipantIntermediaryParameters parameters) {
+ this.parameters = parameters;
+
+ topicSinks =
+ TopicEndpointManager.getManager().addTopicSinks(parameters.getClampControlLoopTopics().getTopicSinks());
+
+ topicSources = TopicEndpointManager.getManager()
+ .addTopicSources(parameters.getClampControlLoopTopics().getTopicSources());
+
+ try {
+ this.msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES);
+ } catch (final RuntimeException e) {
+ throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR,
+ "topic message dispatcher failed to start", e);
+ }
+
+ // @formatter:off
+ final AtomicReference<ParticipantStatusPublisher> statusPublisher = new AtomicReference<>();
+ final AtomicReference<ParticipantStateChangeListener> participantStateChangeListener = new AtomicReference<>();
+ final AtomicReference<ParticipantHealthCheckListener> participantHealthCheckListener = new AtomicReference<>();
+ final AtomicReference<ControlLoopStateChangeListener> controlLoopStateChangeListener = new AtomicReference<>();
+ final AtomicReference<ControlLoopUpdateListener> controlLoopUpdateListener = new AtomicReference<>();
+
+ addAction("Topic endpoint management",
+ () -> TopicEndpointManager.getManager().start(),
+ () -> TopicEndpointManager.getManager().shutdown());
+
+ addAction("Participant Status Publisher",
+ () -> statusPublisher.set(new ParticipantStatusPublisher(topicSinks)),
+ () -> statusPublisher.get().close());
+
+ addAction("Participant Handler",
+ () -> participantHandler.set(new ParticipantHandler(parameters, statusPublisher.get())),
+ () -> participantHandler.get().close());
+
+ addAction("Participant State Change Listener",
+ () -> participantStateChangeListener.set(new ParticipantStateChangeListener(participantHandler.get())),
+ () -> participantStateChangeListener.get().close());
+
+ addAction("Participant Health Check Listener",
+ () -> participantHealthCheckListener.set(new ParticipantHealthCheckListener(participantHandler.get())),
+ () -> participantHealthCheckListener.get().close());
+
+ addAction("Control Loop State Change Listener",
+ () -> controlLoopStateChangeListener.set(new ControlLoopStateChangeListener(participantHandler.get())),
+ () -> controlLoopStateChangeListener.get().close());
+
+ addAction("Control Loop Update Listener",
+ () -> controlLoopUpdateListener.set(new ControlLoopUpdateListener(participantHandler.get())),
+ () -> controlLoopUpdateListener.get().close());
+
+ addAction("Topic Message Dispatcher", this::registerMsgDispatcher, this::unregisterMsgDispatcher);
+ // @formatter:on
+ }
+
+ /**
+ * Registers the dispatcher with the topic source(s).
+ */
+ private void registerMsgDispatcher() {
+ msgDispatcher.register(ParticipantMessageType.PARTICIPANT_STATE_CHANGE.name(),
+ (ScoListener<ParticipantStateChange>) new ParticipantStateChangeListener(
+ participantHandler.get()));
+ msgDispatcher.register(ParticipantMessageType.PARTICIPANT_HEALTH_CHECK.name(),
+ (ScoListener<ParticipantHealthCheck>) new ParticipantHealthCheckListener(
+ participantHandler.get()));
+ msgDispatcher.register(ParticipantMessageType.PARTICIPANT_CONTROL_LOOP_STATE_CHANGE.name(),
+ (ScoListener<ParticipantControlLoopStateChange>) new ControlLoopStateChangeListener(
+ participantHandler.get()));
+ msgDispatcher.register(ParticipantMessageType.PARTICIPANT_CONTROL_LOOP_UPDATE.name(),
+ (ScoListener<ParticipantControlLoopUpdate>) new ControlLoopUpdateListener(
+ participantHandler.get()));
+ for (final TopicSource source : topicSources) {
+ source.register(msgDispatcher);
+ }
+ }
+
+ /**
+ * Unregisters the dispatcher from the topic source(s).
+ */
+ private void unregisterMsgDispatcher() {
+ for (final TopicSource source : topicSources) {
+ source.unregister(msgDispatcher);
+ }
+ }
+
+ /**
+ * Return the participant handler.
+ */
+ public ParticipantHandler getParticipantHandler() {
+ return participantHandler.get();
+ }
+}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
new file mode 100644
index 000000000..980ab6ec1
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
@@ -0,0 +1,235 @@
+/*-
+ * ============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 java.io.Closeable;
+import java.util.Objects;
+import lombok.Getter;
+import lombok.Setter;
+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.messages.dmaap.participant.ParticipantHealthCheck;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseDetails;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseStatus;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.MessageSender;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStatusPublisher;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is responsible for managing the state of a participant.
+ */
+@Getter
+public class ParticipantHandler implements Closeable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantHandler.class);
+
+ private final ToscaConceptIdentifier participantType;
+ private final ToscaConceptIdentifier participantId;
+ private final MessageSender sender;
+ private final ControlLoopHandler controlLoopHandler;
+ private final ParticipantStatistics participantStatistics;
+
+ @Setter
+ private ParticipantState state = ParticipantState.UNKNOWN;
+
+ @Setter
+ private ParticipantHealthStatus healthStatus = ParticipantHealthStatus.UNKNOWN;
+
+ /**
+ * Constructor, set the participant ID and sender.
+ *
+ * @param parameters the parameters of the participant
+ * @param publisher the publisher for sending responses to messages
+ */
+ public ParticipantHandler(ParticipantIntermediaryParameters parameters, ParticipantStatusPublisher publisher) {
+ this.participantType = parameters.getParticipantType();
+ this.participantId = parameters.getParticipantId();
+ this.sender = new MessageSender(this, publisher, parameters.getReportingTimeInterval());
+ this.controlLoopHandler = new ControlLoopHandler(parameters, sender);
+ this.participantStatistics = new ParticipantStatistics();
+ }
+
+ @Override
+ public void close() {
+ sender.close();
+ controlLoopHandler.close();
+ }
+
+ /**
+ * Method which handles a participant state change event from clamp.
+ *
+ * @param stateChangeMsg participant state change message
+ */
+ public void handleParticipantStateChange(final ParticipantStateChange stateChangeMsg) {
+
+ if (!stateChangeMsg.appliesTo(participantType, participantId)) {
+ return;
+ }
+
+ ParticipantResponseDetails response = new ParticipantResponseDetails(stateChangeMsg);
+
+ switch (stateChangeMsg.getState()) {
+ case PASSIVE:
+ handlePassiveState(response);
+ break;
+ case ACTIVE:
+ handleActiveState(response);
+ break;
+ case SAFE:
+ handleSafeState(response);
+ break;
+ case TEST:
+ handleTestState(response);
+ break;
+ case TERMINATED:
+ handleTerminatedState(response);
+ break;
+ default:
+ LOGGER.debug("StateChange message has no state, state is null {}", stateChangeMsg.getParticipantId());
+ response.setResponseStatus(ParticipantResponseStatus.FAIL);
+ response.setResponseMessage("StateChange message has invalid state for participantId "
+ + stateChangeMsg.getParticipantId());
+ break;
+ }
+
+ sender.sendResponse(response);
+ }
+
+
+ /**
+ * Method which handles a participant health check event from clamp.
+ *
+ * @param healthCheckMsg participant health check message
+ */
+ public void handleParticipantHealthCheck(final ParticipantHealthCheck healthCheckMsg) {
+ ParticipantResponseDetails response = new ParticipantResponseDetails(healthCheckMsg);
+ response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
+ response.setResponseMessage(healthStatus.toString());
+
+ sender.sendResponse(response);
+ }
+
+ /**
+ * Method to handle when the new state from participant is active.
+ *
+ * @param response participant response
+ */
+ private void handleActiveState(final ParticipantResponseDetails response) {
+ handleStateChange(ParticipantState.ACTIVE, response);
+ }
+
+ /**
+ * Method to handle when the new state from participant is passive.
+ *
+ * @param response participant response
+ */
+ private void handlePassiveState(final ParticipantResponseDetails response) {
+ handleStateChange(ParticipantState.PASSIVE, response);
+ }
+
+ /**
+ * Method to handle when the new state from participant is safe.
+ *
+ * @param response participant response
+ */
+ private void handleSafeState(final ParticipantResponseDetails response) {
+ handleStateChange(ParticipantState.SAFE, response);
+ }
+
+ /**
+ * Method to handle when the new state from participant is TEST.
+ *
+ * @param response participant response
+ */
+ private void handleTestState(final ParticipantResponseDetails response) {
+ handleStateChange(ParticipantState.TEST, response);
+ }
+
+ /**
+ * Method to handle when the new state from participant is Terminated.
+ *
+ * @param response participant response
+ */
+ private void handleTerminatedState(final ParticipantResponseDetails response) {
+ handleStateChange(ParticipantState.TERMINATED, response);
+ }
+
+ private void handleStateChange(ParticipantState newParticipantState, ParticipantResponseDetails response) {
+ if (state.equals(newParticipantState)) {
+ response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
+ response.setResponseMessage("Participant already in state " + newParticipantState);
+ } else {
+ response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
+ response.setResponseMessage("Participant state changed from " + state + " to " + newParticipantState);
+ state = newParticipantState;
+ }
+ }
+
+ /**
+ * Method to update participant state.
+ *
+ * @param definition participant definition
+ * @param participantState participant state
+ */
+ public Participant updateParticipantState(ToscaConceptIdentifier definition,
+ ParticipantState participantState) {
+ if (!Objects.equals(definition, participantId)) {
+ LOGGER.debug("No participant with this ID {}", definition.getName());
+ return null;
+ }
+ ParticipantResponseDetails response = new ParticipantResponseDetails();
+ handleStateChange(participantState, response);
+ sender.sendResponse(response);
+ return getParticipant(definition.getName(), definition.getVersion());
+ }
+
+ /**
+ * Get participants as a {@link Participant} class.
+ *
+ * @return the participant
+ */
+ public Participant getParticipant(String name, String version) {
+ if (participantId.getName().equals(name)) {
+ Participant participant = new Participant();
+ participant.setDefinition(participantId);
+ participant.setParticipantState(state);
+ participant.setHealthStatus(healthStatus);
+ return participant;
+ }
+ return null;
+ }
+
+ /**
+ * Check if a participant message applies to this participant handler.
+ *
+ * @param partipantMsg the message to check
+ * @return true if it applies, false otherwise
+ */
+ public boolean canHandle(ParticipantMessage partipantMsg) {
+ return partipantMsg.appliesTo(participantType, participantId);
+ }
+}
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/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
new file mode 100644
index 000000000..8e3440e42
--- /dev/null
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.parameters;
+
+import lombok.Getter;
+import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+/**
+ * Class to hold all parameters needed for participant component.
+ */
+@NotNull
+@NotBlank
+@Getter
+public class ParticipantIntermediaryParameters extends ParameterGroupImpl {
+ // The ID and description of this participant
+ private ToscaConceptIdentifier participantId;
+ private String description;
+
+ // The participant type of this participant
+ private ToscaConceptIdentifier participantType;
+
+ // The time interval for periodic reporting of status to the CLAMP control loop server
+ private long reportingTimeInterval;
+
+ // DMaaP topics for communicating with the CLAMP control loop server
+ private TopicParameterGroup clampControlLoopTopics;
+
+ /**
+ * Create the participant parameter group.
+ *
+ * @param instanceId instance id of the event.
+ */
+ public ParticipantIntermediaryParameters(final String instanceId) {
+ super(instanceId);
+ }
+}
diff --git a/participant/pom.xml b/participant/pom.xml
index c18ee14d0..b0ee3c084 100644
--- a/participant/pom.xml
+++ b/participant/pom.xml
@@ -39,4 +39,36 @@
<module>participant-intermediary</module>
<module>participant-impl</module>
</modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.policy.clamp</groupId>
+ <artifactId>policy-clamp-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.clamp</groupId>
+ <artifactId>policy-clamp-models</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.onap.policy.clamp.controlloop.participant.simulator.main.startstop.Main</mainClass>
+ </manifest>
+ </archive>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>