diff options
241 files changed, 4617 insertions, 30 deletions
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java index ee6e1a329..389d04dcc 100644 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java +++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java @@ -91,7 +91,7 @@ public class MessageServerImpl<MESSAGE> extends InternalMessageBusServer<MESSAGE // Stop the web socket server try { // Close all connections on this web socket server - for (final WebSocket connection : connections()) { + for (final WebSocket connection : getConnections()) { connection.closeConnection(0, ""); } stop(); @@ -128,7 +128,7 @@ public class MessageServerImpl<MESSAGE> extends InternalMessageBusServer<MESSAGE @Override public void send(final MessageHolder<MESSAGE> message) { // Send the incoming message to all clients connected to this web socket - final Collection<WebSocket> connections = connections(); + final Collection<WebSocket> connections = getConnections(); for (final WebSocket webSocket : connections) { webSocket.send(MessagingUtils.serializeObject(message)); } @@ -142,7 +142,7 @@ public class MessageServerImpl<MESSAGE> extends InternalMessageBusServer<MESSAGE */ @Override public void send(final String messageString) { - final Collection<WebSocket> connections = connections(); + final Collection<WebSocket> connections = getConnections(); for (final WebSocket webSocket : connections) { webSocket.send(messageString); } diff --git a/examples/aadm/pom.xml b/examples/examples-aadm/pom.xml index d85b52b3b..c67d71aba 100644 --- a/examples/aadm/pom.xml +++ b/examples/examples-aadm/pom.xml @@ -26,7 +26,7 @@ <version>2.0.0-SNAPSHOT</version> </parent> - <artifactId>aadm</artifactId> + <artifactId>examples-aadm</artifactId> <name>${project.artifactId}</name> <description>Specific code for the Apex AADM Example</description> diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java index 13fbb1eca..13fbb1eca 100644 --- a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java index f59e982b0..f59e982b0 100644 --- a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java index fc3780f17..fc3780f17 100644 --- a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/package-info.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/package-info.java index 68e91457d..68e91457d 100644 --- a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/package-info.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/package-info.java diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java index b0cbf0c17..b0cbf0c17 100644 --- a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java index 618a9535a..618a9535a 100644 --- a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/package-info.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/package-info.java index 659154d45..659154d45 100644 --- a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/package-info.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/package-info.java diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/package-info.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/package-info.java index 90198c254..90198c254 100644 --- a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/package-info.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/package-info.java diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent.xml b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent.xml index 3ce3246d0..3ce3246d0 100644 --- a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent.xml +++ b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent.xml diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent0.json b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent0.json index 64d34fcf9..64d34fcf9 100644 --- a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent0.json +++ b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent0.json diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent1.json b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent1.json index b525e5f2e..b525e5f2e 100644 --- a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent1.json +++ b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent1.json diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent2.json b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent2.json index 893a19675..893a19675 100644 --- a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent2.json +++ b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent2.json diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent3.json b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent3.json index dd8e0d549..dd8e0d549 100644 --- a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent3.json +++ b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent3.json diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent4.json b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent4.json index dca754500..dca754500 100644 --- a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent4.json +++ b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent4.json diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent5.json b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent5.json index a7676e12f..a7676e12f 100644 --- a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent5.json +++ b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent5.json diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent6.json b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent6.json index 64d34fcf9..64d34fcf9 100644 --- a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent6.json +++ b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent6.json diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent7.json b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent7.json index 694b28f2a..694b28f2a 100644 --- a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent7.json +++ b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestEvent7.json diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestPeridociEvent.json b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestPeridociEvent.json index 6283293c9..6283293c9 100644 --- a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestPeridociEvent.json +++ b/examples/examples-aadm/src/main/resources/examples/events/AADM/AADMTestPeridociEvent.json diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel index 078841792..078841792 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel index d04f9425e..d04f9425e 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel index bb38034af..bb38034af 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTask_TaskLogic.mvel index 7107b940b..7107b940b 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTask_TaskLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel index 2d0d45bdf..2d0d45bdf 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskLogic.mvel index 69146d19c..69146d19c 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskSelectionLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskSelectionLogic.mvel index 20fe626cd..20fe626cd 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskSelectionLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskSelectionLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel index 115ac5477..115ac5477 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel index 7ceaa2abe..7ceaa2abe 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel index 1de8b190c..1de8b190c 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTask_TaskLogic.mvel index db1abdfe9..db1abdfe9 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTask_TaskLogic.mvel diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel index 33dbd4cd0..33dbd4cd0 100644 --- a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel diff --git a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java index 02e6f9179..02e6f9179 100644 --- a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java diff --git a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java index 2c62c4994..2c62c4994 100644 --- a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java diff --git a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java index 9aa2095c7..9aa2095c7 100644 --- a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java diff --git a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java index 58b1800ba..58b1800ba 100644 --- a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java diff --git a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java index ccf4539aa..ccf4539aa 100644 --- a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java diff --git a/examples/aadm/src/test/resources/META-INF/persistence.xml b/examples/examples-aadm/src/test/resources/META-INF/persistence.xml index eaef96a85..eaef96a85 100644 --- a/examples/aadm/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-aadm/src/test/resources/META-INF/persistence.xml diff --git a/examples/aadm/src/test/resources/logback-test.xml b/examples/examples-aadm/src/test/resources/logback-test.xml index 4b9258c40..4b9258c40 100644 --- a/examples/aadm/src/test/resources/logback-test.xml +++ b/examples/examples-aadm/src/test/resources/logback-test.xml diff --git a/examples/adaptive/pom.xml b/examples/examples-adaptive/pom.xml index 76315d201..66f991e88 100644 --- a/examples/adaptive/pom.xml +++ b/examples/examples-adaptive/pom.xml @@ -26,7 +26,7 @@ <version>2.0.0-SNAPSHOT</version> </parent> - <artifactId>adaptive</artifactId> + <artifactId>examples-adaptive</artifactId> <name>${project.artifactId}</name> <description>Specific code for the Apex Adaptive Example</description> diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java index f574c74ec..f574c74ec 100644 --- a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java index f2e27725b..f2e27725b 100644 --- a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/package-info.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/package-info.java index 8561ed074..8561ed074 100644 --- a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/package-info.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/package-info.java diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java index 6242b1618..6242b1618 100644 --- a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java index 0cc9bd3a2..0cc9bd3a2 100644 --- a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java index a0b2a8f40..a044ad14b 100644 --- a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java @@ -230,7 +230,7 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { while (pValue < significanceLevel) { // takes approx 20% of method time // the score value as the anomaly probability final double score = (significanceLevel - pValue) / significanceLevel; - if (v == currentV) { + if (Double.compare(v, currentV) == 0) { return score; } // do the critical check again for the left values @@ -326,7 +326,7 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { */ private static Double[] removevalue(final Double[] lValues, final double v) { for (int i = 0; i < lValues.length; i++) { - if (lValues[i] == v) { + if (Double.compare(lValues[i], v) == 0) { final Double[] ret = new Double[lValues.length - 1]; System.arraycopy(lValues, 0, ret, 0, i); System.arraycopy(lValues, i + 1, ret, i, lValues.length - i - 1); @@ -389,7 +389,7 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { private static boolean isAllEqual(final List<Double> lValues) { final double first = lValues.get(0); for (final Double d : lValues) { - if (d != first) { + if (Double.compare(d, first) != 0) { return false; } } @@ -405,7 +405,7 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { private static boolean isAllEqual(final Double[] lValues) { final double first = lValues[0]; for (final Double d : lValues) { - if (d != first) { + if (Double.compare(d, first) != 0) { return false; } } diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicy_Decide_TaskSelectionLogic.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicy_Decide_TaskSelectionLogic.java index 23d4e2486..23d4e2486 100644 --- a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicy_Decide_TaskSelectionLogic.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicy_Decide_TaskSelectionLogic.java diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/package-info.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/package-info.java index 172be5ada..172be5ada 100644 --- a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/package-info.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/package-info.java diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/package-info.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/package-info.java index d38333ba8..d38333ba8 100644 --- a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/package-info.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/package-info.java diff --git a/examples/adaptive/src/main/resources/examples/events/Adaptive/AnomalyDetectionEvents.json b/examples/examples-adaptive/src/main/resources/examples/events/Adaptive/AnomalyDetectionEvents.json index 2872f5ae4..2872f5ae4 100644 --- a/examples/adaptive/src/main/resources/examples/events/Adaptive/AnomalyDetectionEvents.json +++ b/examples/examples-adaptive/src/main/resources/examples/events/Adaptive/AnomalyDetectionEvents.json diff --git a/examples/adaptive/src/main/resources/examples/events/Adaptive/AutoLearnEvents.json b/examples/examples-adaptive/src/main/resources/examples/events/Adaptive/AutoLearnEvents.json index 4a90c944d..4a90c944d 100644 --- a/examples/adaptive/src/main/resources/examples/events/Adaptive/AutoLearnEvents.json +++ b/examples/examples-adaptive/src/main/resources/examples/events/Adaptive/AutoLearnEvents.json diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel index 758062b8e..758062b8e 100644 --- a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel index 051766045..051766045 100644 --- a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel index b787b2153..b787b2153 100644 --- a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel index 7fbc8c765..7fbc8c765 100644 --- a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel index a0a12d84f..a0a12d84f 100644 --- a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel index fc2005fdf..fc2005fdf 100644 --- a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel index 5eb44839c..5eb44839c 100644 --- a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAnomalyDetectionTask_Logic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAnomalyDetectionTask_Logic.mvel index 8f894d297..8f894d297 100644 --- a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAnomalyDetectionTask_Logic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAnomalyDetectionTask_Logic.mvel diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAutoLearnTask_Logic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAutoLearnTask_Logic.mvel index 636378396..636378396 100644 --- a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAutoLearnTask_Logic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAutoLearnTask_Logic.mvel diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultState_Logic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultState_Logic.mvel index 2db0a0031..2db0a0031 100644 --- a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultState_Logic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultState_Logic.mvel diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java index 898531c32..898531c32 100644 --- a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java index 7e2fb0eb7..7e2fb0eb7 100644 --- a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java index 2b50d69ab..2b50d69ab 100644 --- a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTSLUseCase.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTSLUseCase.java index 7d9791d46..7d9791d46 100644 --- a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTSLUseCase.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTSLUseCase.java diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java index ec7c197b7..ec7c197b7 100644 --- a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java index 64efa6c35..64efa6c35 100644 --- a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java index aa7f621c9..aa7f621c9 100644 --- a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java index 11f1991bf..11f1991bf 100644 --- a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTSLUseCase.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTSLUseCase.java index 88b504cef..88b504cef 100644 --- a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTSLUseCase.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTSLUseCase.java diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/package-info.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/package-info.java index 0e004fe8d..0e004fe8d 100644 --- a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/package-info.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/package-info.java diff --git a/examples/adaptive/src/test/resources/META-INF/persistence.xml b/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml index 7282bb562..7282bb562 100644 --- a/examples/adaptive/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml diff --git a/examples/examples-decisionmaker/pom.xml b/examples/examples-decisionmaker/pom.xml new file mode 100644 index 000000000..09264447c --- /dev/null +++ b/examples/examples-decisionmaker/pom.xml @@ -0,0 +1,74 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>examples-decisionmaker</artifactId> + <name>${project.artifactId}</name> + <description>Specific code for the APEX Decision Maker Example</description> + + <properties> + <policymodel.name>DecisionMakerPolicyModel</policymodel.name> + <apex-domains-decisionmaker-dir>${project.basedir}/src</apex-domains-decisionmaker-dir> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.policy.apex-pdp.auth</groupId> + <artifactId>cli-editor</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- Generate the APEX Policy JSON from the APEX CLI command --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-policy</id> + <phase>compile</phase> + <goals> + <goal>java</goal> + </goals> + <configuration> + <mainClass>org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain</mainClass> + <classpathScope>compile</classpathScope> + <arguments> + <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument> + <argument>--output-model-file=${project.build.directory}/classes/${policymodel.name}.json</argument> + <argument>--log-file=${project.build.directory}/${policymodel.name}_policygeneration.log</argument> + <argument>--working-dir=${project.basedir}</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/examples/examples-decisionmaker/src/main/resources/logic/AnswerInitTask.js b/examples/examples-decisionmaker/src/main/resources/logic/AnswerInitTask.js new file mode 100644 index 000000000..59074963a --- /dev/null +++ b/examples/examples-decisionmaker/src/main/resources/logic/AnswerInitTask.js @@ -0,0 +1,47 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var answerAlbum = executor.getContextAlbum("AnswerAlbum"); + +answerAlbum.put("a0", executor.inFields.get("a0")); +answerAlbum.put("a1", executor.inFields.get("a1")); +answerAlbum.put("a2", executor.inFields.get("a2")); +answerAlbum.put("a3", executor.inFields.get("a3")); +answerAlbum.put("a4", executor.inFields.get("a4")); +answerAlbum.put("a5", executor.inFields.get("a5")); +answerAlbum.put("a6", executor.inFields.get("a6")); + +var lastAnswerAlbum = executor.getContextAlbum("LastAnswerAlbum"); +lastAnswerAlbum.put("lastAnswer", answerAlbum.size() - 1); + +executor.outFields.put("a0", answerAlbum.get("a0")); +executor.outFields.put("a1", answerAlbum.get("a1")); +executor.outFields.put("a2", answerAlbum.get("a2")); +executor.outFields.put("a3", answerAlbum.get("a3")); +executor.outFields.put("a4", answerAlbum.get("a4")); +executor.outFields.put("a5", answerAlbum.get("a5")); +executor.outFields.put("a6", answerAlbum.get("a6")); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE;
\ No newline at end of file diff --git a/examples/examples-decisionmaker/src/main/resources/logic/DitheringAnswerTask.js b/examples/examples-decisionmaker/src/main/resources/logic/DitheringAnswerTask.js new file mode 100644 index 000000000..ec3455851 --- /dev/null +++ b/examples/examples-decisionmaker/src/main/resources/logic/DitheringAnswerTask.js @@ -0,0 +1,37 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var size = executor.getContextAlbum("AnswerAlbum").size(); + +var selection = 2 + Math.floor(Math.random() * 3); + +var selectionA = "a" + selection; + +executor.logger.info(size); +executor.logger.info(selectionA); + +executor.outFields.put("decision", executor.getContextAlbum("AnswerAlbum").get(selectionA)); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE;
\ No newline at end of file diff --git a/examples/examples-decisionmaker/src/main/resources/logic/MakeDecisionStateTSL.js b/examples/examples-decisionmaker/src/main/resources/logic/MakeDecisionStateTSL.js new file mode 100644 index 000000000..93261e2e0 --- /dev/null +++ b/examples/examples-decisionmaker/src/main/resources/logic/MakeDecisionStateTSL.js @@ -0,0 +1,42 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var returnValue = executor.TRUE; + +if (executor.inFields.get("mode").equals("random")) { + executor.subject.getTaskKey("RandomAnswerTask").copyTo(executor.selectedTask); +} +else if (executor.inFields.get("mode").equals("pessimistic")) { + executor.subject.getTaskKey("PessimisticAnswerTask").copyTo(executor.selectedTask); +} +else if (executor.inFields.get("mode").equals("optimistic")) { + executor.subject.getTaskKey("OptimisticAnswerTask").copyTo(executor.selectedTask); +} +else if (executor.inFields.get("mode").equals("dithering")) { + executor.subject.getTaskKey("DitheringAnswerTask").copyTo(executor.selectedTask); +} +//else if (executor.inFields.get("mode").equals("roundrobin")) { +// executor.subject.getTaskKey("RoundRobinAnswerTask").copyTo(executor.selectedTask); +//} + +executor.logger.info("Answer Selected Task:" + executor.selectedTask);
\ No newline at end of file diff --git a/examples/examples-decisionmaker/src/main/resources/logic/OptimisticAnswerTask.js b/examples/examples-decisionmaker/src/main/resources/logic/OptimisticAnswerTask.js new file mode 100644 index 000000000..e197c5f07 --- /dev/null +++ b/examples/examples-decisionmaker/src/main/resources/logic/OptimisticAnswerTask.js @@ -0,0 +1,37 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var size = executor.getContextAlbum("AnswerAlbum").size(); + +var selection = size - Math.floor(Math.random() * size / 2) - 1; + +var selectionA = "a" + selection; + +executor.logger.info(size); +executor.logger.info(selectionA); + +executor.outFields.put("decision", executor.getContextAlbum("AnswerAlbum").get(selectionA)); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE;
\ No newline at end of file diff --git a/examples/examples-decisionmaker/src/main/resources/logic/PessimisticAnswerTask.js b/examples/examples-decisionmaker/src/main/resources/logic/PessimisticAnswerTask.js new file mode 100644 index 000000000..34942d846 --- /dev/null +++ b/examples/examples-decisionmaker/src/main/resources/logic/PessimisticAnswerTask.js @@ -0,0 +1,37 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var size = executor.getContextAlbum("AnswerAlbum").size(); + +var selection = Math.floor(Math.random() * size / 2); + +var selectionA = "a" + selection; + +executor.logger.info(size); +executor.logger.info(selectionA); + +executor.outFields.put("decision", executor.getContextAlbum("AnswerAlbum").get(selectionA)); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE;
\ No newline at end of file diff --git a/examples/examples-decisionmaker/src/main/resources/logic/RandomAnswerTask.js b/examples/examples-decisionmaker/src/main/resources/logic/RandomAnswerTask.js new file mode 100644 index 000000000..f4012ac6e --- /dev/null +++ b/examples/examples-decisionmaker/src/main/resources/logic/RandomAnswerTask.js @@ -0,0 +1,37 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var size = executor.getContextAlbum("AnswerAlbum").size(); + +var selection = Math.floor(Math.random() * size); + +var selectionA = "a" + selection; + +executor.logger.info(size); +executor.logger.info(selectionA); + +executor.outFields.put("decision", executor.getContextAlbum("AnswerAlbum").get(selectionA)); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE;
\ No newline at end of file diff --git a/examples/examples-decisionmaker/src/main/resources/logic/RoundRobinAnswerTask.js b/examples/examples-decisionmaker/src/main/resources/logic/RoundRobinAnswerTask.js new file mode 100644 index 000000000..a3d52f20f --- /dev/null +++ b/examples/examples-decisionmaker/src/main/resources/logic/RoundRobinAnswerTask.js @@ -0,0 +1,45 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var size = executor.getContextAlbum("AnswerAlbum").size(); +var lastAnswer = executor.getContextAlbum("LastAnswerAlbum").get("lastAnswer"); + +executor.logger.info(size); +executor.logger.info(lastAnswer); + +var answer = ++lastAnswer; +if (answer >= size) { + answer = 0; +} + +executor.getContextAlbum("LastAnswerAlbum").put("lastAnswer", answer) + +var selectionA = "a" + answer; + +executor.logger.info(selectionA); + +executor.outFields.put("decision", executor.getContextAlbum("AnswerAlbum").get(selectionA)); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE;
\ No newline at end of file diff --git a/examples/examples-decisionmaker/src/main/resources/policy/DecisionMakerPolicyModel.apex b/examples/examples-decisionmaker/src/main/resources/policy/DecisionMakerPolicyModel.apex new file mode 100644 index 000000000..295afa159 --- /dev/null +++ b/examples/examples-decisionmaker/src/main/resources/policy/DecisionMakerPolicyModel.apex @@ -0,0 +1,150 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START======================================================= +# Copyright (C) 2016-2018 Ericsson. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +#------------------------------------------------------------------------------- + +model create name=DecisionMakerPolicyModel + +schema create name=SimpleStringType flavour=Java schema=java.lang.String +schema create name=SimpleIntegerType flavour=Java schema=java.lang.Integer + +album create name=AnswerAlbum scope=policy writable=true schemaName=SimpleStringType +album create name=LastAnswerAlbum scope=policy writable=true schemaName=SimpleIntegerType + +event create name=AnswerEvent nameSpace=org.onap.policy.apex.domains.decisionmaker source=DCAE target=apex +event parameter create name=AnswerEvent parName=a0 schemaName=SimpleStringType +event parameter create name=AnswerEvent parName=a1 schemaName=SimpleStringType +event parameter create name=AnswerEvent parName=a2 schemaName=SimpleStringType +event parameter create name=AnswerEvent parName=a3 schemaName=SimpleStringType +event parameter create name=AnswerEvent parName=a4 schemaName=SimpleStringType +event parameter create name=AnswerEvent parName=a5 schemaName=SimpleStringType +event parameter create name=AnswerEvent parName=a6 schemaName=SimpleStringType + +event create name=MakeDecisionEvent nameSpace=org.onap.policy.apex.domains.decisionmaker source=DCAE target=apex +event parameter create name=MakeDecisionEvent parName=mode schemaName=SimpleStringType + +event create name=DecisionEvent nameSpace=org.onap.policy.apex.domains.decisionmaker source=DCAE target=apex +event parameter create name=DecisionEvent parName=decision schemaName=SimpleStringType + +task create name=AnswerInitTask +task inputfield create name=AnswerInitTask fieldName=a0 schemaName=SimpleStringType +task inputfield create name=AnswerInitTask fieldName=a1 schemaName=SimpleStringType +task inputfield create name=AnswerInitTask fieldName=a2 schemaName=SimpleStringType +task inputfield create name=AnswerInitTask fieldName=a3 schemaName=SimpleStringType +task inputfield create name=AnswerInitTask fieldName=a4 schemaName=SimpleStringType +task inputfield create name=AnswerInitTask fieldName=a5 schemaName=SimpleStringType +task inputfield create name=AnswerInitTask fieldName=a6 schemaName=SimpleStringType + +task outputfield create name=AnswerInitTask fieldName=a0 schemaName=SimpleStringType +task outputfield create name=AnswerInitTask fieldName=a1 schemaName=SimpleStringType +task outputfield create name=AnswerInitTask fieldName=a2 schemaName=SimpleStringType +task outputfield create name=AnswerInitTask fieldName=a3 schemaName=SimpleStringType +task outputfield create name=AnswerInitTask fieldName=a4 schemaName=SimpleStringType +task outputfield create name=AnswerInitTask fieldName=a5 schemaName=SimpleStringType +task outputfield create name=AnswerInitTask fieldName=a6 schemaName=SimpleStringType + +task contextref create name=AnswerInitTask albumName=AnswerAlbum +task contextref create name=AnswerInitTask albumName=LastAnswerAlbum + +task logic create name=AnswerInitTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/AnswerInitTask.js" +LE + +task create name=RandomAnswerTask + +task inputfield create name=RandomAnswerTask fieldName=mode schemaName=SimpleStringType + +task outputfield create name=RandomAnswerTask fieldName=decision schemaName=SimpleStringType + +task contextref create name=RandomAnswerTask albumName=AnswerAlbum + +task logic create name=RandomAnswerTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/RandomAnswerTask.js" +LE + +task create name=PessimisticAnswerTask + +task inputfield create name=PessimisticAnswerTask fieldName=mode schemaName=SimpleStringType + +task outputfield create name=PessimisticAnswerTask fieldName=decision schemaName=SimpleStringType + +task contextref create name=PessimisticAnswerTask albumName=AnswerAlbum + +task logic create name=PessimisticAnswerTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/PessimisticAnswerTask.js" +LE + +task create name=OptimisticAnswerTask + +task inputfield create name=OptimisticAnswerTask fieldName=mode schemaName=SimpleStringType + +task outputfield create name=OptimisticAnswerTask fieldName=decision schemaName=SimpleStringType + +task contextref create name=OptimisticAnswerTask albumName=AnswerAlbum + +task logic create name=OptimisticAnswerTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/OptimisticAnswerTask.js" +LE + +task create name=DitheringAnswerTask + +task inputfield create name=DitheringAnswerTask fieldName=mode schemaName=SimpleStringType + +task outputfield create name=DitheringAnswerTask fieldName=decision schemaName=SimpleStringType + +task contextref create name=DitheringAnswerTask albumName=AnswerAlbum + +task logic create name=DitheringAnswerTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/DitheringAnswerTask.js" +LE + +#task create name=RoundRobinAnswerTask +# +#task inputfield create name=RoundRobinAnswerTask fieldName=mode schemaName=SimpleStringType +# +#task outputfield create name=RoundRobinAnswerTask fieldName=decision schemaName=SimpleStringType +# +#task contextref create name=RoundRobinAnswerTask albumName=AnswerAlbum +#task contextref create name=RoundRobinAnswerTask albumName=LastAnswerAlbum +# +#task logic create name=RoundRobinAnswerTask logicFlavour=JAVASCRIPT logic=LS +##MACROFILE:"src/main/resources/logic/RoundRobinAnswerTask.js" +#LE + +policy create name=AnswerInitPolicy template=freestyle firstState=AnswerInitState + +policy state create name=AnswerInitPolicy stateName=AnswerInitState triggerName=AnswerEvent defaultTaskName=AnswerInitTask +policy state output create name=AnswerInitPolicy stateName=AnswerInitState outputName=AnswerInitOutput eventName=AnswerEvent +policy state taskref create name=AnswerInitPolicy stateName=AnswerInitState taskName=AnswerInitTask outputType=DIRECT outputName=AnswerInitOutput + +policy create name=DecisionMakerPolicy template=freestyle firstState=MakeDecisionState + +policy state create name=DecisionMakerPolicy stateName=MakeDecisionState triggerName=MakeDecisionEvent defaultTaskName=RandomAnswerTask +policy state output create name=DecisionMakerPolicy stateName=MakeDecisionState outputName=DecisionFinalOutput eventName=DecisionEvent +policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState taskName=RandomAnswerTask outputType=DIRECT outputName=DecisionFinalOutput +policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState taskName=PessimisticAnswerTask outputType=DIRECT outputName=DecisionFinalOutput +policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState taskName=OptimisticAnswerTask outputType=DIRECT outputName=DecisionFinalOutput +policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState taskName=DitheringAnswerTask outputType=DIRECT outputName=DecisionFinalOutput +#policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState taskName=RoundRobinAnswerTask outputType=DIRECT outputName=DecisionFinalOutput + +policy state selecttasklogic create name=DecisionMakerPolicy stateName=MakeDecisionState logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/MakeDecisionStateTSL.js" +LE + +validate + diff --git a/examples/myfirstpolicy/pom.xml b/examples/examples-myfirstpolicy/pom.xml index 56a9fe40a..a774ae79c 100644 --- a/examples/myfirstpolicy/pom.xml +++ b/examples/examples-myfirstpolicy/pom.xml @@ -26,7 +26,7 @@ <version>2.0.0-SNAPSHOT</version> </parent> - <artifactId>myfirstpolicy</artifactId> + <artifactId>examples-myfirstpolicy</artifactId> <name>${project.artifactId}</name> <description>Specific code for the Apex MyFirstPolicy Example</description> diff --git a/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelFactory.java b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelFactory.java index 9b3f6cc8a..9b3f6cc8a 100644 --- a/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelFactory.java +++ b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelFactory.java diff --git a/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java index 7343f747d..7343f747d 100644 --- a/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java +++ b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java diff --git a/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/package-info.java b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/package-info.java index ed03da4ca..ed03da4ca 100644 --- a/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/package-info.java +++ b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/package-info.java diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/csv/AssistantInput.csv b/examples/examples-myfirstpolicy/src/main/resources/SampleData/csv/AssistantInput.csv index cd59d06c4..cd59d06c4 100644 --- a/examples/myfirstpolicy/src/main/resources/SampleData/csv/AssistantInput.csv +++ b/examples/examples-myfirstpolicy/src/main/resources/SampleData/csv/AssistantInput.csv diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/csv/BranchInput.csv b/examples/examples-myfirstpolicy/src/main/resources/SampleData/csv/BranchInput.csv index 8d37e1ccd..8d37e1ccd 100644 --- a/examples/myfirstpolicy/src/main/resources/SampleData/csv/BranchInput.csv +++ b/examples/examples-myfirstpolicy/src/main/resources/SampleData/csv/BranchInput.csv diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/csv/ItemInput.csv b/examples/examples-myfirstpolicy/src/main/resources/SampleData/csv/ItemInput.csv index 08416546c..08416546c 100644 --- a/examples/myfirstpolicy/src/main/resources/SampleData/csv/ItemInput.csv +++ b/examples/examples-myfirstpolicy/src/main/resources/SampleData/csv/ItemInput.csv diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/csv/SalesInput.csv b/examples/examples-myfirstpolicy/src/main/resources/SampleData/csv/SalesInput.csv index 302430789..302430789 100644 --- a/examples/myfirstpolicy/src/main/resources/SampleData/csv/SalesInput.csv +++ b/examples/examples-myfirstpolicy/src/main/resources/SampleData/csv/SalesInput.csv diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/sql/apex_sales.sql b/examples/examples-myfirstpolicy/src/main/resources/SampleData/sql/apex_sales.sql index a2ff5733b..a2ff5733b 100644 --- a/examples/myfirstpolicy/src/main/resources/SampleData/sql/apex_sales.sql +++ b/examples/examples-myfirstpolicy/src/main/resources/SampleData/sql/apex_sales.sql diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/sql/readme.txt b/examples/examples-myfirstpolicy/src/main/resources/SampleData/sql/readme.txt index f86aeb02c..f86aeb02c 100644 --- a/examples/myfirstpolicy/src/main/resources/SampleData/sql/readme.txt +++ b/examples/examples-myfirstpolicy/src/main/resources/SampleData/sql/readme.txt diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json index 4c5af6c2d..4c5af6c2d 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json index cc18e7ddd..cc18e7ddd 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json index 1cdc4992c..1cdc4992c 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json index 3625f908f..3625f908f 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json index 2b760d5f1..2b760d5f1 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json index b90c6fa0c..b90c6fa0c 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsIn.json.txt b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsIn.json.txt index a9570f989..a9570f989 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsIn.json.txt +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsIn.json.txt diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsOut.json.txt b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsOut.json.txt index 46fd887f4..46fd887f4 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsOut.json.txt +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsOut.json.txt diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_101433CET_thurs.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_101433CET_thurs.json index 952b4b189..952b4b189 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_101433CET_thurs.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_101433CET_thurs.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_171937CET_sun.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_171937CET_sun.json index 7c8fb2bf8..7c8fb2bf8 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_171937CET_sun.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_171937CET_sun.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_NonBoozeItem_111309CET_mon.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_NonBoozeItem_111309CET_mon.json index f8aa8760e..f8aa8760e 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_NonBoozeItem_111309CET_mon.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_NonBoozeItem_111309CET_mon.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_101433CET_thurs.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_101433CET_thurs.json index d7c3a3781..d7c3a3781 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_101433CET_thurs.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_101433CET_thurs.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_171937CET_sun.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_171937CET_sun.json index cb838b838..cb838b838 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_171937CET_sun.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_171937CET_sun.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_NonBoozeItem_111309CET_mon.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_NonBoozeItem_111309CET_mon.json index 4b031e453..4b031e453 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_NonBoozeItem_111309CET_mon.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_NonBoozeItem_111309CET_mon.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsIn.json.txt b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsIn.json.txt index a38fcdbc8..a38fcdbc8 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsIn.json.txt +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsIn.json.txt diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsOut.json.txt b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsOut.json.txt index 16cff198c..16cff198c 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsOut.json.txt +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsOut.json.txt diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.js b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.js index 8ec15a992..8ec15a992 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.js +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.js diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.mvel b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.mvel index 5d1af17de..5d1af17de 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.mvel +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.mvel diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json index 2651355fd..2651355fd 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex index 1cb678777..1cb678777 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json index d93f8f370..d93f8f370 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheck.mvel b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheck.mvel index 6c24cdf36..6c24cdf36 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheck.mvel +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheck.mvel diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheckAlt1.mvel b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheckAlt1.mvel index 93fbb85f6..93fbb85f6 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheckAlt1.mvel +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheckAlt1.mvel diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex index 1599ff20b..1599ff20b 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json index 2e50a8126..2e50a8126 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicy_BoozeAuthDecideTSL.js b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicy_BoozeAuthDecideTSL.js index 643e3446b..643e3446b 100644 --- a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicy_BoozeAuthDecideTSL.js +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicy_BoozeAuthDecideTSL.js diff --git a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json index 06601e5d1..06601e5d1 100644 --- a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json +++ b/examples/examples-myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json diff --git a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json index 657371f3c..657371f3c 100644 --- a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json +++ b/examples/examples-myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json diff --git a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json index c9c29cdd2..c9c29cdd2 100644 --- a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json +++ b/examples/examples-myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json diff --git a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json index 3faf4ca32..3faf4ca32 100644 --- a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json +++ b/examples/examples-myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPLogic.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPLogic.java index 652e228c8..652e228c8 100644 --- a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPLogic.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPLogic.java diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java index a8be6c4e4..a8be6c4e4 100644 --- a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCLI.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCLI.java index fe9d3a205..fe9d3a205 100644 --- a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCLI.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCLI.java diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCreator.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCreator.java index 2f51f2851..2f51f2851 100644 --- a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCreator.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCreator.java diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java index 194072d99..194072d99 100644 --- a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java index 2dfd1af61..2dfd1af61 100644 --- a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java diff --git a/examples/myfirstpolicy/src/test/resources/META-INF/persistence.xml b/examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml index 4dcba14b7..4dcba14b7 100644 --- a/examples/myfirstpolicy/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml diff --git a/examples/myfirstpolicy/src/test/resources/logback-test.xml b/examples/examples-myfirstpolicy/src/test/resources/logback-test.xml index ea201e0a9..ea201e0a9 100644 --- a/examples/myfirstpolicy/src/test/resources/logback-test.xml +++ b/examples/examples-myfirstpolicy/src/test/resources/logback-test.xml diff --git a/examples/examples-onap-vcpe/pom.xml b/examples/examples-onap-vcpe/pom.xml new file mode 100644 index 000000000..2fa531529 --- /dev/null +++ b/examples/examples-onap-vcpe/pom.xml @@ -0,0 +1,85 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>examples-onap-vcpe</artifactId> + <name>${project.artifactId}</name> + <description>Specific code for the APEX ONAP vCPE Example</description> + + <properties> + <policymodel.name>ONAPvCPEPolicyModel</policymodel.name> + <apex-domains-onap-vcpe-dir>${project.basedir}/src</apex-domains-onap-vcpe-dir> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.policy.apex-pdp.auth</groupId> + <artifactId>cli-editor</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.services</groupId> + <artifactId>services-engine</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.containers</groupId> + <artifactId>jersey-container-grizzly2-http</artifactId> + <version>${version.jersey}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- Generate the APEX Policy JSON from the APEX CLI command --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-policy</id> + <phase>compile</phase> + <goals> + <goal>java</goal> + </goals> + <configuration> + <mainClass>org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain</mainClass> + <classpathScope>compile</classpathScope> + <arguments> + <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument> + <argument>--output-model-file=${project.build.directory}/classes/${policymodel.name}.json</argument> + <argument>--log-file=${project.build.directory}/${policymodel.name}_policygeneration.log</argument> + <argument>--working-dir=${project.basedir}</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupRequestTask.js new file mode 100644 index 000000000..f3c0c45cd --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupRequestTask.js @@ -0,0 +1,44 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get( + executor.inFields.get("vnfID").toString()); + +var guardDecisionAttributes = executor.subject.getOutFieldSchemaHelper("decisionAttributes").createNewInstance(); + +guardDecisionAttributes.put("actor", "APPC"); +guardDecisionAttributes.put("recipe", "Restart"); +guardDecisionAttributes.put("target", executor.inFields.get("vnfID").toString()); +guardDecisionAttributes.put("clname", "APEXvCPEImplementation"); + +executor.logger.info(guardDecisionAttributes); + +executor.outFields.put("decisionAttributes", guardDecisionAttributes); +executor.outFields.put("onapName", "APEX"); + +executor.getContextAlbum("ControlLoopExecutionIDAlbum").put(executor.executionID.toString(), + executor.inFields.get("vnfID")); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE;
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupResponseTask.js new file mode 100644 index 000000000..df98c25f4 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupResponseTask.js @@ -0,0 +1,50 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var vnfID = executor.getContextAlbum("ControlLoopExecutionIDAlbum").remove(executor.executionID.toString()); + +executor.logger.info("Continuing execution with VNF ID: " + vnfID); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(vnfID.toString()); +executor.logger.info(vcpeClosedLoopStatus); + +var guardResult = executor.inFields.get("decision"); + +if (guardResult === "PERMIT") { + vcpeClosedLoopStatus.put("notification", "OPERATION: GUARD_PERMIT"); +} else if (guardResult === "DENY") { + vcpeClosedLoopStatus.put("notification", "OPERATION: GUARD_DENY"); +} else { + executor.message = "guard result must be either \"PERMIT\" or \"DENY\""; + returnValue = executor.FALSE; +} + +var uuidType = Java.type("java.util.UUID"); +var requestID = uuidType.fromString(vcpeClosedLoopStatus.get("requestID")); + +executor.outFields.put("requestID", requestID); +executor.outFields.put("vnfID", vnfID); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE; diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js new file mode 100644 index 000000000..45a70c014 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js @@ -0,0 +1,76 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var genericDataRecordType = Java.type("org.apache.avro.generic.GenericData.Record"); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get( + executor.inFields.get("vnfID").toString()); + +var appcBodyRecord = executor.subject.getOutFieldSchemaHelper("body").createNewInstance(); +var appcBodyRecordSchema = appcBodyRecord.getSchema(); + +var inputRecord = new genericDataRecordType(appcBodyRecordSchema.getField("input").schema()); +var inputRecordRecordSchema = inputRecord.getSchema(); + +var actionIndentifiersRecord = new genericDataRecordType(inputRecordRecordSchema.getField("action_DasH_identifiers") + .schema()); + +var commonHeaderRecord = new genericDataRecordType(inputRecordRecordSchema.getField("common_DasH_header").schema()); +var commonHeaderRecordSchema = commonHeaderRecord.getSchema(); + +var commonHeaderFlagsRecord = new genericDataRecordType(commonHeaderRecordSchema.getField("flags").schema()); + +appcBodyRecord.put("input", inputRecord); +inputRecord.put("action_DasH_identifiers", actionIndentifiersRecord); +inputRecord.put("common_DasH_header", commonHeaderRecord); +commonHeaderRecord.put("flags", commonHeaderFlagsRecord); + +inputRecord.put("action", "Restart"); +inputRecord.put("payload", "{}"); + +actionIndentifiersRecord.put("vnf_DasH_id", executor.inFields.get("vnfID").toString()); + +commonHeaderRecord.put("timestamp", new Date().toISOString()); +commonHeaderRecord.put("api_DasH_ver", "2.00"); +commonHeaderRecord.put("originator_DasH_id", executor.inFields.get("requestID").toString()); +commonHeaderRecord.put("request_DasH_id", executor.inFields.get("requestID").toString()); +commonHeaderRecord.put("sub_DasH_request_DasH_id", "1"); + +commonHeaderFlagsRecord.put("ttl", "10000"); +commonHeaderFlagsRecord.put("force", "TRUE"); +commonHeaderFlagsRecord.put("mode", "EXCLUSIVE"); + +executor.outFields.put("version", "2.0"); +executor.outFields.put("rpc-name", "restart"); +executor.outFields.put("correlation-id", executor.inFields.get("vnfID")); +executor.outFields.put("type", "request"); +executor.outFields.put("body", appcBodyRecord); + +executor.getContextAlbum("RequestIDVNFIDAlbum").put(executor.inFields.get("requestID").toString(), + executor.inFields.get("vnfID")); + +vcpeClosedLoopStatus.put("notification", "OPERATION: RESTART REQUESTED"); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE; diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js new file mode 100644 index 000000000..d382e6274 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js @@ -0,0 +1,50 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var uuidType = Java.type("java.util.UUID"); +var integerType = Java.type("java.lang.Integer"); + +var requestID = uuidType.fromString(executor.inFields.get("correlation-id")); +var vnfID = executor.getContextAlbum("RequestIDVNFIDAlbum").remove(requestID.toString()); + +var returnValue = executor.TRUE; + +if (vnfID != null) { + var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(vnfID.toString()); + + var notification = "OPERATION: VNF RESTART WITH RETURN CODE " + + executor.inFields.get("body").get("output").get("status").get("code") + ", " + + executor.inFields.get("body").get("output").get("status").get("message"); + + vcpeClosedLoopStatus.put("notification", notification); + vcpeClosedLoopStatus.put("notificationTime", executor.inFields.get("body").get("output").get("common_DasH_header") + .get("timestamp")); + + executor.outFields.put("requestID", requestID); + executor.outFields.put("vnfID", vnfID); +} else { + executor.message = "VNF ID not found in context album for request ID " + requestID; + returnValue = executor.FALSE +} + +executor.logger.info(executor.outFields); diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/AbatedTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/AbatedTask.js new file mode 100644 index 000000000..1fb46b7ba --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/AbatedTask.js @@ -0,0 +1,32 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get( + executor.inFields.get("vnfID").toString()); + +vcpeClosedLoopStatus.put("notification", "VCPE NOTIFICATION HAS BEEN ABATED"); +vcpeClosedLoopStatus.put("notificationTime", new Date().toISOString()); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE; diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js new file mode 100644 index 000000000..65922e7f1 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js @@ -0,0 +1,48 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get( + executor.inFields.get("vnfID").toString()); + +executor.logger.info("Logging context information for VNF \"" + executor.inFields.get("vnfID") + "\""); + +executor.outFields.put("AAI", vcpeClosedLoopStatus.get("AAI")); +executor.outFields.put("closedLoopControlName", vcpeClosedLoopStatus.get("closedLoopControlName")); +executor.outFields.put("closedLoopAlarmStart", vcpeClosedLoopStatus.get("closedLoopAlarmStart")); +executor.outFields.put("closedLoopAlarmEnd", vcpeClosedLoopStatus.get("closedLoopAlarmEnd")); +executor.outFields.put("closedLoopEventClient", vcpeClosedLoopStatus.get("closedLoopEventClient")); +executor.outFields.put("closedLoopEventStatus", vcpeClosedLoopStatus.get("closedLoopEventStatus")); +executor.outFields.put("version", vcpeClosedLoopStatus.get("version")); +executor.outFields.put("requestID", vcpeClosedLoopStatus.get("requestID")); +executor.outFields.put("target_type", vcpeClosedLoopStatus.get("target_type")); +executor.outFields.put("target", vcpeClosedLoopStatus.get("target")); +executor.outFields.put("from", vcpeClosedLoopStatus.get("from")); +executor.outFields.put("policyScope", vcpeClosedLoopStatus.get("policyScope")); +executor.outFields.put("policyName", vcpeClosedLoopStatus.get("policyName")); +executor.outFields.put("policyVersion", vcpeClosedLoopStatus.get("policyVersion")); +executor.outFields.put("notification", vcpeClosedLoopStatus.get("notification")); +executor.outFields.put("notificationTime", vcpeClosedLoopStatus.get("notificationTime")); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE; diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/DeniedTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/DeniedTask.js new file mode 100644 index 000000000..7f3a9d6b6 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/DeniedTask.js @@ -0,0 +1,32 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get( + executor.inFields.get("vnfID").toString()); + +vcpeClosedLoopStatus.put("notification", "VCPE VNF RESTART HAS BEEN DENIED BY GUARD"); +vcpeClosedLoopStatus.put("notificationTime", new Date().toISOString()); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE; diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/GetVCPEStateTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/GetVCPEStateTask.js new file mode 100644 index 000000000..435d6d735 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/GetVCPEStateTask.js @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var uuidType = Java.type("java.util.UUID"); +var longType = Java.type("java.lang.Long"); + +var requestID = uuidType.fromString(executor.inFields.get("requestID")); +var vnfID = uuidType.fromString(executor.inFields.get("AAI").get("generic_DasH_vnf_DoT_vnf_DasH_id")); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(vnfID); + +if (vcpeClosedLoopStatus == null) { + executor.logger.info("Creating context information for new vCPE VNF \"" + vnfID.toString() + "\""); + + vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").getSchemaHelper().createNewInstance(); + + vcpeClosedLoopStatus.put("AAI", executor.inFields.get("AAI")); + vcpeClosedLoopStatus.put("closedLoopControlName", executor.inFields.get("closedLoopControlName")); + vcpeClosedLoopStatus.put("closedLoopAlarmStart", executor.inFields.get("closedLoopAlarmStart")); + vcpeClosedLoopStatus.put("closedLoopEventClient", executor.inFields.get("closedLoopEventClient")); + vcpeClosedLoopStatus.put("closedLoopEventStatus", executor.inFields.get("closedLoopEventStatus")); + vcpeClosedLoopStatus.put("version", executor.inFields.get("version")); + vcpeClosedLoopStatus.put("requestID", executor.inFields.get("requestID")); + vcpeClosedLoopStatus.put("target_type", executor.inFields.get("target_type")); + vcpeClosedLoopStatus.put("target", executor.inFields.get("target")); + vcpeClosedLoopStatus.put("from", executor.inFields.get("from")); + vcpeClosedLoopStatus.put("policyScope", "vCPE"); + vcpeClosedLoopStatus.put("policyName", "ONAPvCPEPolicyModel"); + vcpeClosedLoopStatus.put("policyVersion", "0.0.1"); + vcpeClosedLoopStatus.put("notification", ""); + vcpeClosedLoopStatus.put("notificationTime", ""); + + if (executor.inFields.get("closedLoopAlarmEnd") != null) { + vcpeClosedLoopStatus.put("closedLoopAlarmEnd", executor.inFields.get("closedLoopAlarmEnd")); + } else { + vcpeClosedLoopStatus.put("closedLoopAlarmEnd", longType.valueOf(0)); + } + + executor.getContextAlbum("VCPEClosedLoopStatusAlbum").put(vnfID.toString(), vcpeClosedLoopStatus); + + executor.logger.info("Created context information for new vCPE VNF \"" + vnfID.toString() + "\""); +} + +executor.outFields.put("requestID", requestID); +executor.outFields.put("vnfID", vnfID); + +executor.logger.info(executor.outFields); + +returnValue = executor.TRUE; diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/GuardRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/GuardRequestTask.js new file mode 100644 index 000000000..f3c0c45cd --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/GuardRequestTask.js @@ -0,0 +1,44 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get( + executor.inFields.get("vnfID").toString()); + +var guardDecisionAttributes = executor.subject.getOutFieldSchemaHelper("decisionAttributes").createNewInstance(); + +guardDecisionAttributes.put("actor", "APPC"); +guardDecisionAttributes.put("recipe", "Restart"); +guardDecisionAttributes.put("target", executor.inFields.get("vnfID").toString()); +guardDecisionAttributes.put("clname", "APEXvCPEImplementation"); + +executor.logger.info(guardDecisionAttributes); + +executor.outFields.put("decisionAttributes", guardDecisionAttributes); +executor.outFields.put("onapName", "APEX"); + +executor.getContextAlbum("ControlLoopExecutionIDAlbum").put(executor.executionID.toString(), + executor.inFields.get("vnfID")); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE;
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/GuardResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/GuardResponseTask.js new file mode 100644 index 000000000..df98c25f4 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/GuardResponseTask.js @@ -0,0 +1,50 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var vnfID = executor.getContextAlbum("ControlLoopExecutionIDAlbum").remove(executor.executionID.toString()); + +executor.logger.info("Continuing execution with VNF ID: " + vnfID); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(vnfID.toString()); +executor.logger.info(vcpeClosedLoopStatus); + +var guardResult = executor.inFields.get("decision"); + +if (guardResult === "PERMIT") { + vcpeClosedLoopStatus.put("notification", "OPERATION: GUARD_PERMIT"); +} else if (guardResult === "DENY") { + vcpeClosedLoopStatus.put("notification", "OPERATION: GUARD_DENY"); +} else { + executor.message = "guard result must be either \"PERMIT\" or \"DENY\""; + returnValue = executor.FALSE; +} + +var uuidType = Java.type("java.util.UUID"); +var requestID = uuidType.fromString(vcpeClosedLoopStatus.get("requestID")); + +executor.outFields.put("requestID", requestID); +executor.outFields.put("vnfID", vnfID); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE; diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/NoAAILookupTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/NoAAILookupTask.js new file mode 100644 index 000000000..0c088078f --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/NoAAILookupTask.js @@ -0,0 +1,26 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE; diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyAAILookupStateTSL.js b/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyAAILookupStateTSL.js new file mode 100644 index 000000000..7bbfcd9ca --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyAAILookupStateTSL.js @@ -0,0 +1,46 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var returnValue = executor.TRUE; + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get( + executor.inFields.get("vnfID").toString()); +var aaiInfo = vcpeClosedLoopStatus.get("AAI"); + +executor.logger.info(aaiInfo); + +if (aaiInfo.get("generic_DasH_vnf.resource_DasH_version") != null + && aaiInfo.get("generic_DasH_vnf.vnf_DasH_name") != null + && aaiInfo.get("generic_DasH_vnf.prov_DasH_status") != null + && aaiInfo.get("generic_DasH_vnf.is_DasH_closed_DasH_loop_DasH_disabled") != null + && aaiInfo.get("generic_DasH_vnf.orchestration_DasH_status") != null + && aaiInfo.get("generic_DasH_vnf.vnf_DasH_type") != null + && aaiInfo.get("generic_DasH_vnf.in_DasH_maint") != null + && aaiInfo.get("generic_DasH_vnf.service_DasH_id") != null + && aaiInfo.get("generic_DasH_vnf.vnf_DasH_id") != null) { + executor.subject.getTaskKey("AAILookupRequestTask").copyTo(executor.selectedTask); +} else { + executor.subject.getTaskKey("NoAAILookupTask").copyTo(executor.selectedTask); +} + +executor.logger.info("ReceiveEventPolicyOnsetOrAbatedStateTSL State Selected Task:" + executor.selectedTask); diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyOnsetOrAbatedStateTSL.js b/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyOnsetOrAbatedStateTSL.js new file mode 100644 index 000000000..3fea4a025 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyOnsetOrAbatedStateTSL.js @@ -0,0 +1,43 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var returnValue = executor.TRUE; + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get( + executor.inFields.get("vnfID").toString()); + +var status = vcpeClosedLoopStatus.get("closedLoopEventStatus"); + +var returnValue = executor.TRUE; + +if (status === "ONSET") { + executor.subject.getTaskKey("GuardRequestTask").copyTo(executor.selectedTask); +} else if (status === "ABATED") { + executor.subject.getTaskKey("AbatedTask").copyTo(executor.selectedTask); + onsetFlag = executor.FALSE; +} else { + executor.message = "closedLoopEventStatus must be either \"ONSET\" or \"ABATED\""; + returnValue = executor.FALSE; +} + +executor.logger.info("ReceiveEventPolicyOnsetOrAbatedStateTSL State Selected Task:" + executor.selectedTask); diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js b/examples/examples-onap-vcpe/src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js new file mode 100644 index 000000000..b1b6420cb --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js @@ -0,0 +1,37 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get( + executor.inFields.get("vnfID").toString()); + +var guardResult = vcpeClosedLoopStatus.get("notification"); + +if (guardResult === "OPERATION: GUARD_PERMIT") { + executor.subject.getTaskKey("APPCRestartVNFRequestTask").copyTo(executor.selectedTask); +} else { + executor.subject.getTaskKey("DeniedTask").copyTo(executor.selectedTask); +} + +executor.logger.info("RestartAPPCRequestPolicyPermitOrDenyTSL State Selected Task:" + executor.selectedTask); + +var returnValue = executor.TRUE; diff --git a/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex b/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex new file mode 100644 index 000000000..22d0ddae0 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex @@ -0,0 +1,320 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START======================================================= +# Copyright (C) 2016-2018 Ericsson. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +#------------------------------------------------------------------------------- + +model create name=ONAPvCPEPolicyModel + +schema create name=SimpleStringType flavour=Java schema=java.lang.String +schema create name=SimpleLongType flavour=Java schema=java.lang.Long +schema create name=SimpleBooleanType flavour=Java schema=java.lang.Boolean +schema create name=UUIDType flavour=Java schema=java.util.UUID + +schema create name=VCPEAAIInfoType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/VCPEAAIInfoType.avsc" +LE + +schema create name=GuardDecisionAttributesType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/GuardDecisionAttributesType.avsc" +LE + +schema create name=APPCInputBodyType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/APPCInputBodyType.avsc" +LE + +schema create name=APPCOutputBodyType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/APPCOutputBodyType.avsc" +LE + +schema create name=VCPEClosedLoopStatusType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/VCPEClosedLoopStatusType.avsc" +LE + +album create name=VCPEClosedLoopStatusAlbum scope=policy writable=true schemaName=VCPEClosedLoopStatusType + +album create name=ControlLoopExecutionIDAlbum scope=policy writable=true schemaName=UUIDType + +album create name=RequestIDVNFIDAlbum scope=policy writable=true schemaName=UUIDType + +event create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 version=1.0.2 nameSpace=org.onap.policy.apex.onap.vcpe source=DCAE target=APEX + +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=closedLoopControlName schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=closedLoopAlarmStart schemaName=SimpleLongType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=closedLoopEventClient schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=closedLoopEventStatus schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=requestID schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=target_type schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=target schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=from schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=version schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=AAI schemaName=VCPEAAIInfoType + +event create name=VCPEStateUpdatedEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APEX + +event parameter create name=VCPEStateUpdatedEvent parName=requestID schemaName=UUIDType +event parameter create name=VCPEStateUpdatedEvent parName=vnfID schemaName=UUIDType + +event create name=GuardRequestEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APEX + +event parameter create name=GuardRequestEvent parName=decisionAttributes schemaName=GuardDecisionAttributesType +event parameter create name=GuardRequestEvent parName=onapName schemaName=SimpleStringType + +event create name=GuardResponseEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APEX + +event parameter create name=GuardResponseEvent parName=decision schemaName=SimpleStringType +event parameter create name=GuardResponseEvent parName=details schemaName=SimpleStringType + +event create name=APPCRestartVNFRequestEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APPC + +event parameter create name=APPCRestartVNFRequestEvent parName=body schemaName=APPCInputBodyType +event parameter create name=APPCRestartVNFRequestEvent parName=version schemaName=SimpleStringType +event parameter create name=APPCRestartVNFRequestEvent parName=rpc-name schemaName=SimpleStringType +event parameter create name=APPCRestartVNFRequestEvent parName=correlation-id schemaName=SimpleStringType +event parameter create name=APPCRestartVNFRequestEvent parName=type schemaName=SimpleStringType + +event create name=APPCRestartVNFResponseEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APPC + +event parameter create name=APPCRestartVNFResponseEvent parName=body schemaName=APPCOutputBodyType +event parameter create name=APPCRestartVNFResponseEvent parName=version schemaName=SimpleStringType +event parameter create name=APPCRestartVNFResponseEvent parName=rpc-name schemaName=SimpleStringType +event parameter create name=APPCRestartVNFResponseEvent parName=correlation-id schemaName=SimpleStringType +event parameter create name=APPCRestartVNFResponseEvent parName=type schemaName=SimpleStringType + +event create name=ControlLoopLogEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APEX + +event parameter create name=ControlLoopLogEvent parName=AAI schemaName=VCPEAAIInfoType +event parameter create name=ControlLoopLogEvent parName=closedLoopControlName schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=closedLoopAlarmStart schemaName=SimpleLongType +event parameter create name=ControlLoopLogEvent parName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true +event parameter create name=ControlLoopLogEvent parName=closedLoopEventClient schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=closedLoopEventStatus schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=version schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=requestID schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=target_type schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=target schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=from schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=policyScope schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=policyName schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=policyVersion schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=notification schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=message schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=notificationTime schemaName=SimpleStringType + +task create name=GetVCPEStateTask + +task inputfield create name=GetVCPEStateTask fieldName=closedLoopControlName schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=closedLoopAlarmStart schemaName=SimpleLongType +task inputfield create name=GetVCPEStateTask fieldName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true +task inputfield create name=GetVCPEStateTask fieldName=closedLoopEventClient schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=closedLoopEventStatus schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=requestID schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=target_type schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=target schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=from schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=version schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=AAI schemaName=VCPEAAIInfoType + +task contextref create name=GetVCPEStateTask albumName=VCPEClosedLoopStatusAlbum + +task outputfield create name=GetVCPEStateTask fieldName=requestID schemaName=UUIDType +task outputfield create name=GetVCPEStateTask fieldName=vnfID schemaName=UUIDType + +task logic create name=GetVCPEStateTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/GetVCPEStateTask.js" +LE + +task create name=AbatedTask + +task inputfield create name=AbatedTask fieldName=requestID schemaName=UUIDType +task inputfield create name=AbatedTask fieldName=vnfID schemaName=UUIDType + +task outputfield create name=AbatedTask fieldName=requestID schemaName=UUIDType +task outputfield create name=AbatedTask fieldName=vnfID schemaName=UUIDType + +task contextref create name=AbatedTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=AbatedTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/AbatedTask.js" +LE + +task create name=GuardRequestTask + +task inputfield create name=GuardRequestTask fieldName=requestID schemaName=UUIDType +task inputfield create name=GuardRequestTask fieldName=vnfID schemaName=UUIDType + +task outputfield create name=GuardRequestTask fieldName=decisionAttributes schemaName=GuardDecisionAttributesType +task outputfield create name=GuardRequestTask fieldName=onapName schemaName=SimpleStringType + +task contextref create name=GuardRequestTask albumName=VCPEClosedLoopStatusAlbum +task contextref create name=GuardRequestTask albumName=ControlLoopExecutionIDAlbum + +task logic create name=GuardRequestTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/GuardRequestTask.js" +LE + +task create name=GuardResponseTask + +task inputfield create name=GuardResponseTask fieldName=decision schemaName=SimpleStringType +task inputfield create name=GuardResponseTask fieldName=details schemaName=SimpleStringType + +task outputfield create name=GuardResponseTask fieldName=requestID schemaName=UUIDType +task outputfield create name=GuardResponseTask fieldName=vnfID schemaName=UUIDType + +task contextref create name=GuardResponseTask albumName=VCPEClosedLoopStatusAlbum +task contextref create name=GuardResponseTask albumName=ControlLoopExecutionIDAlbum + +task logic create name=GuardResponseTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/GuardResponseTask.js" +LE + +task create name=DeniedTask + +task inputfield create name=DeniedTask fieldName=requestID schemaName=UUIDType +task inputfield create name=DeniedTask fieldName=vnfID schemaName=UUIDType + +task outputfield create name=DeniedTask fieldName=requestID schemaName=UUIDType +task outputfield create name=DeniedTask fieldName=vnfID schemaName=UUIDType + +task contextref create name=DeniedTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=DeniedTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/DeniedTask.js" +LE + +task create name=APPCRestartVNFRequestTask + +task inputfield create name=APPCRestartVNFRequestTask fieldName=requestID schemaName=UUIDType +task inputfield create name=APPCRestartVNFRequestTask fieldName=vnfID schemaName=UUIDType + +task outputfield create name=APPCRestartVNFRequestTask fieldName=body schemaName=APPCInputBodyType +task outputfield create name=APPCRestartVNFRequestTask fieldName=version schemaName=SimpleStringType +task outputfield create name=APPCRestartVNFRequestTask fieldName=rpc-name schemaName=SimpleStringType +task outputfield create name=APPCRestartVNFRequestTask fieldName=correlation-id schemaName=SimpleStringType +task outputfield create name=APPCRestartVNFRequestTask fieldName=type schemaName=SimpleStringType + +task contextref create name=APPCRestartVNFRequestTask albumName=VCPEClosedLoopStatusAlbum +task contextref create name=APPCRestartVNFRequestTask albumName=RequestIDVNFIDAlbum + +task logic create name=APPCRestartVNFRequestTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/APPCRestartVNFRequestTask.js" +LE + +task create name=APPCRestartVNFResponseTask + +task inputfield create name=APPCRestartVNFResponseTask fieldName=body schemaName=APPCOutputBodyType +task inputfield create name=APPCRestartVNFResponseTask fieldName=version schemaName=SimpleStringType +task inputfield create name=APPCRestartVNFResponseTask fieldName=rpc-name schemaName=SimpleStringType +task inputfield create name=APPCRestartVNFResponseTask fieldName=correlation-id schemaName=SimpleStringType +task inputfield create name=APPCRestartVNFResponseTask fieldName=type schemaName=SimpleStringType + +task outputfield create name=APPCRestartVNFResponseTask fieldName=requestID schemaName=UUIDType +task outputfield create name=APPCRestartVNFResponseTask fieldName=vnfID schemaName=UUIDType + +task contextref create name=APPCRestartVNFResponseTask albumName=VCPEClosedLoopStatusAlbum +task contextref create name=APPCRestartVNFResponseTask albumName=RequestIDVNFIDAlbum + +task logic create name=APPCRestartVNFResponseTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/APPCRestartVNFResponseTask.js" +LE + +task create name=ControlLoopLogTask + +task inputfield create name=ControlLoopLogTask fieldName=requestID schemaName=UUIDType +task inputfield create name=ControlLoopLogTask fieldName=vnfID schemaName=UUIDType + +task outputfield create name=ControlLoopLogTask fieldName=AAI schemaName=VCPEAAIInfoType +task outputfield create name=ControlLoopLogTask fieldName=closedLoopControlName schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=closedLoopAlarmStart schemaName=SimpleLongType +task outputfield create name=ControlLoopLogTask fieldName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true +task outputfield create name=ControlLoopLogTask fieldName=closedLoopEventClient schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=closedLoopEventStatus schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=requestID schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=version schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=target_type schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=target schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=from schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=policyScope schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=policyName schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=policyVersion schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=notification schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=message schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=notificationTime schemaName=SimpleStringType + +task contextref create name=ControlLoopLogTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=ControlLoopLogTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/ControlLoopLogTask.js" +LE + +policy create name=ReceiveEventPolicy template=Freestyle firstState=GetVCPEState + +policy state create name=ReceiveEventPolicy stateName=AbatedState triggerName=VCPEStateUpdatedEvent defaultTaskName=ControlLoopLogTask +policy state output create name=ReceiveEventPolicy stateName=AbatedState outputName=AbatedOutput eventName=ControlLoopLogEvent +policy state taskref create name=ReceiveEventPolicy stateName=AbatedState taskName=ControlLoopLogTask outputType=DIRECT outputName=AbatedOutput + +policy state create name=ReceiveEventPolicy stateName=OnsetOrAbatedState triggerName=VCPEStateUpdatedEvent defaultTaskName=AbatedTask +policy state output create name=ReceiveEventPolicy stateName=OnsetOrAbatedState outputName=OnsetOutput eventName=GuardRequestEvent +policy state taskref create name=ReceiveEventPolicy stateName=OnsetOrAbatedState taskName=GuardRequestTask outputType=DIRECT outputName=OnsetOutput +policy state output create name=ReceiveEventPolicy stateName=OnsetOrAbatedState outputName=AbatedOutput eventName=VCPEStateUpdatedEvent nextState=AbatedState +policy state taskref create name=ReceiveEventPolicy stateName=OnsetOrAbatedState taskName=AbatedTask outputType=DIRECT outputName=AbatedOutput + +policy state contextref create name=ReceiveEventPolicy stateName=OnsetOrAbatedState albumName=VCPEClosedLoopStatusAlbum + +policy state selecttasklogic create name=ReceiveEventPolicy stateName=OnsetOrAbatedState logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/ReceiveEventPolicyOnsetOrAbatedStateTSL.js" +LE + +policy state create name=ReceiveEventPolicy stateName=GetVCPEState triggerName=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 defaultTaskName=GetVCPEStateTask +policy state output create name=ReceiveEventPolicy stateName=GetVCPEState outputName=GetVCPEStateOutput eventName=VCPEStateUpdatedEvent nextState=OnsetOrAbatedState +policy state taskref create name=ReceiveEventPolicy stateName=GetVCPEState taskName=GetVCPEStateTask outputType=DIRECT outputName=GetVCPEStateOutput + +policy create name=RestartAPPCRequestPolicy template=Freestyle firstState=PolicyGuardResponseState + +policy state create name=RestartAPPCRequestPolicy stateName=DeniedState triggerName=VCPEStateUpdatedEvent defaultTaskName=ControlLoopLogTask +policy state output create name=RestartAPPCRequestPolicy stateName=DeniedState outputName=DeniedOutput eventName=ControlLoopLogEvent +policy state taskref create name=RestartAPPCRequestPolicy stateName=DeniedState taskName=ControlLoopLogTask outputType=DIRECT outputName=DeniedOutput + +policy state create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState triggerName=VCPEStateUpdatedEvent defaultTaskName=DeniedTask +policy state output create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState outputName=PermitOutput eventName=APPCRestartVNFRequestEvent +policy state taskref create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState taskName=APPCRestartVNFRequestTask outputType=DIRECT outputName=PermitOutput +policy state output create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState outputName=DenyOutput eventName=VCPEStateUpdatedEvent nextState=DeniedState +policy state taskref create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState taskName=DeniedTask outputType=DIRECT outputName=DenyOutput + +policy state create name=RestartAPPCRequestPolicy stateName=PolicyGuardResponseState triggerName=GuardResponseEvent defaultTaskName=GuardResponseTask +policy state output create name=RestartAPPCRequestPolicy stateName=PolicyGuardResponseState outputName=GuardResponseOutput eventName=VCPEStateUpdatedEvent nextState=PermitOrDenyState +policy state taskref create name=RestartAPPCRequestPolicy stateName=PolicyGuardResponseState taskName=GuardResponseTask outputType=DIRECT outputName=GuardResponseOutput + +policy state contextref create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState albumName=VCPEClosedLoopStatusAlbum + +policy state selecttasklogic create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js" +LE + +policy create name=RestartAPPCResponsePolicy template=Freestyle firstState=RestartAPPCResponseState + +policy state create name=RestartAPPCResponsePolicy stateName=ResponseLogState triggerName=VCPEStateUpdatedEvent defaultTaskName=ControlLoopLogTask +policy state output create name=RestartAPPCResponsePolicy stateName=ResponseLogState outputName=ResponseLogOutput eventName=ControlLoopLogEvent +policy state taskref create name=RestartAPPCResponsePolicy stateName=ResponseLogState taskName=ControlLoopLogTask outputType=DIRECT outputName=ResponseLogOutput + +policy state create name=RestartAPPCResponsePolicy stateName=RestartAPPCResponseState triggerName=APPCRestartVNFResponseEvent defaultTaskName=APPCRestartVNFResponseTask +policy state output create name=RestartAPPCResponsePolicy stateName=RestartAPPCResponseState outputName=APPCRestartVNFResponseOutput eventName=VCPEStateUpdatedEvent nextState=ResponseLogState +policy state taskref create name=RestartAPPCResponsePolicy stateName=RestartAPPCResponseState taskName=APPCRestartVNFResponseTask outputType=DIRECT outputName=APPCRestartVNFResponseOutput + +validate + diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInstanceFiltersType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInstanceFiltersType.avsc new file mode 100644 index 000000000..621372d2f --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInstanceFiltersType.avsc @@ -0,0 +1,30 @@ +{ + "type": "record", + "name": "AAIInstanceFilters_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "type": "record", + "name": "instance_DasH_filters", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "instance_DasH_filter", + "type": { + "type": "array", + "items": { + "type": "record", + "name": "generic_DasH_vnf", + "fields": [ + { + "name": "vnf_DasH_id", + "type": "string" + } + ] + } + } + } + ] + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInventoryResponseItemType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInventoryResponseItemType.avsc new file mode 100644 index 000000000..e64d0e36a --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInventoryResponseItemType.avsc @@ -0,0 +1,70 @@ +{ + "type": "array", + "items": { + "type": "record", + "name": "AAIInventoryResponseItem_Type", + "fields": [ + { + "name": "model_DasH_name", + "type": "string" + }, + { + "name": "extra_DasH_properties", + "type": { + "type": "record", + "name": "AAIInventoryResponseItemExtraProperties_Type", + "fields": [] + } + }, + { + "name": "generic_DasH_vnf", + "type": { + "type": "record", + "name": "AAIInventoryResponseItemGenericVNF_Type", + "fields": [ + { + "name": "vnf_DasH_id", + "type": "string" + }, + { + "name": "vnf_DasH_name", + "type": "string" + }, + { + "name": "vnf_DasH_type", + "type": "string" + }, + { + "name": "service_DasH_id", + "type": "string" + }, + { + "name": "orchestration_DasH_status", + "type": "string" + }, + { + "name": "in_DasH_maint", + "type": "boolean" + }, + { + "name": "is_DasH_closed_DasH_loop_DasH_disabled", + "type": "boolean" + }, + { + "name": "resource_DasH_version", + "type": "string" + }, + { + "name": "model_DasH_invariant_DasH_id", + "type": "string" + }, + { + "name": "model_DasH_version_DasH_id", + "type": "string" + } + ] + } + } + ] + } +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/AAINamedQueryType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/AAINamedQueryType.avsc new file mode 100644 index 000000000..ffa3ca534 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/AAINamedQueryType.avsc @@ -0,0 +1,11 @@ +{ + "type": "record", + "name": "AAINamedQuery_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "named_DasH_query_DasH_uuid", + "type": "string" + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/APPCInputBodyType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/APPCInputBodyType.avsc new file mode 100644 index 000000000..3acf96e7f --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/APPCInputBodyType.avsc @@ -0,0 +1,76 @@ +{ + "type" : "record", + "name" : "APPCInputBody_Type", + "namespace" : "org.onap.policy.apex.onap.vcpe", + "fields" : [ + { + "name": "input", + "type": { + "type" : "record", + "name" : "InputRecord", + "fields" : [ + { + "name": "action", "type": "string" + }, + { + "name": "action_DasH_identifiers", + "type": { + "type" : "record", + "name" : "ActionIdentifiersRecord", + "fields" : [ + { + "name": "vnf_DasH_id", "type": "string" + } + ] + } + }, + { + "name": "common_DasH_header", + "type": { + "type" : "record", + "name" : "InputCommonHeaderRecord", + "fields" : [ + { + "name": "request_DasH_id", "type": "string" + }, + { + "name": "originator_DasH_id", "type": "string" + }, + { + "name": "api_DasH_ver", "type": "string" + }, + { + "name": "sub_DasH_request_DasH_id", "type": "string" + }, + { + "name": "timestamp", "type": "string" + }, + { + "name": "flags", + "type": { + "type" : "record", + "name" : "FlagsRecord", + "fields" : [ + { + "name": "ttl", "type": "string" + }, + { + "name": "force", "type": "string" + }, + { + "name": "mode", "type": "string" + } + ] + } + } + ] + } + }, + { + "name": "payload", "type": "string" + } + ] + } + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/APPCOutputBodyType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/APPCOutputBodyType.avsc new file mode 100644 index 000000000..2c110170a --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/APPCOutputBodyType.avsc @@ -0,0 +1,55 @@ +{ + "type" : "record", + "name" : "APPCOutputBody_Type", + "namespace" : "org.onap.policy.apex.onap.vcpe", + "fields" : [ + { + "name": "output", + "type": { + "type" : "record", + "name" : "OutputRecord", + "fields" : [ + { + "name": "status", + "type": { + "type" : "record", + "name" : "StatusRecord", + "fields" : [ + { + "name": "code", "type": "int" + }, + { + "name": "message", "type": "string" + } + ] + } + }, + { + "name": "common_DasH_header", + "type": { + "type" : "record", + "name" : "OutputCommonHeaderRecord", + "fields" : [ + { + "name": "request_DasH_id", "type": "string" + }, + { + "name": "originator_DasH_id", "type": "string" + }, + { + "name": "api_DasH_ver", "type": "string" + }, + { + "name": "sub_DasH_request_DasH_id", "type": "string" + }, + { + "name": "timestamp", "type": "string" + } + ] + } + } + ] + } + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/GuardDecisionAttributesType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/GuardDecisionAttributesType.avsc new file mode 100644 index 000000000..bc25955fa --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/GuardDecisionAttributesType.avsc @@ -0,0 +1,23 @@ +{ + "type": "record", + "name": "GuardDecisionAttributes_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "actor", + "type": "string" + }, + { + "name": "recipe", + "type": "string" + }, + { + "name": "target", + "type": "string" + }, + { + "name": "clname", + "type": "string" + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEAAIInfoType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEAAIInfoType.avsc new file mode 100644 index 000000000..ff7cad18a --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEAAIInfoType.avsc @@ -0,0 +1,43 @@ +{ + "type": "record", + "name": "AAI_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "generic_DasH_vnf_DoT_resource_DasH_version", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_name", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_prov_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_is_DasH_closed_DasH_loop_DasH_disabled", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_orchestration_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_type", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_in_DasH_maint", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_service_DasH_id", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_id", + "type": "string" + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusType.avsc new file mode 100644 index 000000000..e628c23d9 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusType.avsc @@ -0,0 +1,112 @@ +{ + "type": "record", + "name": "VCPEClosedLoopStatus", + "fields": [ + { + "name": "AAI", + "type": { + "type": "record", + "name": "VCPE_AAI_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "generic_DasH_vnf_DoT_resource_DasH_version", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_name", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_prov_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_is_DasH_closed_DasH_loop_DasH_disabled", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_orchestration_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_type", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_in_DasH_maint", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_service_DasH_id", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_id", + "type": "string" + } + ] + } + }, + { + "name": "closedLoopAlarmStart", + "type": "long" + }, + { + "name": "closedLoopAlarmEnd", + "type": "long" + }, + { + "name": "closedLoopControlName", + "type": "string" + }, + { + "name": "version", + "type": "string" + }, + { + "name": "requestID", + "type": "string" + }, + { + "name": "closedLoopEventClient", + "type": "string" + }, + { + "name": "closedLoopEventStatus", + "type": "string" + }, + { + "name": "target_type", + "type": "string" + }, + { + "name": "target", + "type": "string" + }, + { + "name": "from", + "type": "string" + }, + { + "name": "policyScope", + "type": "string" + }, + { + "name": "policyName", + "type": "string" + }, + { + "name": "policyVersion", + "type": "string" + }, + { + "name": "notification", + "type": "string" + }, + { + "name": "notificationTime", + "type": "string" + } + ] +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusTypeWithHistory.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusTypeWithHistory.avsc new file mode 100644 index 000000000..9b76f9440 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusTypeWithHistory.avsc @@ -0,0 +1,152 @@ +{ + "type": "record", + "name": "VCPEClosedLoopStatus", + "fields": [ + { + "name": "AAI", + "type": { + "type": "record", + "name": "VCPE_AAI_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "generic_DasH_vnf_DoT_resource_DasH_version", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_name", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_prov_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_is_DasH_closed_DasH_loop_DasH_disabled", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_orchestration_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_type", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_in_DasH_maint", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_service_DasH_id", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_id", + "type": "string" + } + ] + } + }, + { + "name": "closedLoopAlarmStart", + "type": "long" + }, + { + "name": "closedLoopControlName", + "type": "string" + }, + { + "name": "version", + "type": "string" + }, + { + "name": "requestID", + "type": "string" + }, + { + "name": "closedLoopEventClient", + "type": "string" + }, + { + "name": "closedLoopEventStatus", + "type": "string" + }, + { + "name": "target_type", + "type": "string" + }, + { + "name": "target", + "type": "string" + }, + { + "name": "from", + "type": "string" + }, + { + "name": "policyScope", + "type": "string" + }, + { + "name": "policyName", + "type": "string" + }, + { + "name": "policyVersion", + "type": "string" + }, + { + "name": "notification", + "type": "string" + }, + { + "name": "history", + "type": [ + { + "type": "record", + "name": "VCPE_History_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "generic_DasH_vnf_DoT_resource_DasH_version", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_name", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_prov_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_is_DasH_closed_DasH_loop_DasH_disabled", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_orchestration_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_type", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_in_DasH_maint", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_service_DasH_id", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_id", + "type": "string" + } + ] + } + ] + } + ] +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java new file mode 100644 index 000000000..a821462f6 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.domains.onap.vcpe; + +import java.net.URI; + +import org.glassfish.grizzly.http.server.HttpServer; +import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; +import org.glassfish.jersey.server.ResourceConfig; +import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; + +public class AAIAndGuardSim { + private static final String BASE_URI = "http://192.168.144.235:54321/AAIAndGuardSim"; + private HttpServer server; + + public AAIAndGuardSim() { + final ResourceConfig rc = new ResourceConfig(AAIAndGuardSimEndpoint.class); + server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc); + + while (!server.isStarted()) { + ThreadUtilities.sleep(50); + } + } + + public void tearDown() throws Exception { + server.shutdown(); + } + + public static void main(final String[] args) throws Exception { + final AAIAndGuardSim sim = new AAIAndGuardSim(); + + while (true) { + try { + Thread.sleep(100); + } catch (final InterruptedException e) { + break; + } + } + sim.tearDown(); + } +} diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSimEndpoint.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSimEndpoint.java new file mode 100644 index 000000000..6c7f7db19 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSimEndpoint.java @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.domains.onap.vcpe; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import com.google.gson.Gson; + +import java.util.Map; +import java.util.Random; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.core.Response; + + +@Path("/sim") +public class AAIAndGuardSimEndpoint { + + private static int postMessagesReceived = 0; + private static int putMessagesReceived = 0; + private static int statMessagesReceived = 0; + private static int getMessagesReceived = 0; + + @Path("/pdp/api/Stats") + @GET + public Response serviceGetStats() { + statMessagesReceived++; + return Response.status(200).entity("{\"GET\": " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived + + ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build(); + } + + @Path("/pdp/api/getDecision") + @POST + public Response serviceGuardPostRequest(final String jsonString) { + postMessagesReceived++; + + if (postMessagesReceived % 2 == 0) { + return Response.status(200).entity("{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}") + .build(); + } else { + return Response.status(200).entity("{\"decision\": \"DENY\", \"details\": \"Decision Denied. NOK :-(\"}") + .build(); + } + } + + @Path("/event/GetEvent") + @GET + public Response serviceGetEvent() { + final Random rand = new Random(); + final int nextMatchCase = rand.nextInt(4); + final String nextEventName = "Event0" + rand.nextInt(2) + "00"; + + final String eventString = "{\n" + "\"nameSpace\": \"org.onap.policy.apex.sample.events\",\n" + "\"name\": \"" + + nextEventName + "\",\n" + "\"version\": \"0.0.1\",\n" + "\"source\": \"REST_" + getMessagesReceived + + "\",\n" + "\"target\": \"apex\",\n" + "\"TestSlogan\": \"Test slogan for External Event0\",\n" + + "\"TestMatchCase\": " + nextMatchCase + ",\n" + "\"TestTimestamp\": " + System.currentTimeMillis() + + ",\n" + "\"TestTemperature\": 9080.866\n" + "}"; + + getMessagesReceived++; + + return Response.status(200).entity(eventString).build(); + } + + @Path("/event/GetEmptyEvent") + @GET + public Response serviceGetEmptyEvent() { + return Response.status(200).build(); + } + + @Path("/event/GetEventBadResponse") + @GET + public Response serviceGetEventBadResponse() { + return Response.status(400).build(); + } + + @Path("/event/PostEvent") + @POST + public Response servicePostRequest(final String jsonString) { + postMessagesReceived++; + + @SuppressWarnings("unchecked") + final Map<String, Object> jsonMap = new Gson().fromJson(jsonString, Map.class); + assertTrue(jsonMap.containsKey("name")); + assertEquals("0.0.1", jsonMap.get("version")); + assertEquals("org.onap.policy.apex.sample.events", jsonMap.get("nameSpace")); + assertEquals("Act", jsonMap.get("source")); + assertEquals("Outside", jsonMap.get("target")); + + return Response.status(200).entity("{\"GET\": , " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived + + ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build(); + } + + @Path("/event/PostEventBadResponse") + @POST + public Response servicePostRequestBadResponse(final String jsonString) { + return Response.status(400).build(); + } + + @Path("/event/PutEvent") + @PUT + public Response servicePutRequest(final String jsonString) { + putMessagesReceived++; + + @SuppressWarnings("unchecked") + final Map<String, Object> jsonMap = new Gson().fromJson(jsonString, Map.class); + assertTrue(jsonMap.containsKey("name")); + assertEquals("0.0.1", jsonMap.get("version")); + assertEquals("org.onap.policy.apex.sample.events", jsonMap.get("nameSpace")); + assertEquals("Act", jsonMap.get("source")); + assertEquals("Outside", jsonMap.get("target")); + + return Response.status(200).entity("{\"GET\": , " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived + + ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build(); + } +} diff --git a/examples/examples-onap-vcpe/src/test/resources/config/ApexConfigFileOnly.json b/examples/examples-onap-vcpe/src/test/resources/config/ApexConfigFileOnly.json new file mode 100644 index 000000000..f2ffdf079 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/config/ApexConfigFileOnly.json @@ -0,0 +1,88 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "policy/ONAPTLGoalPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + }, + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "schemaParameters": { + "Avro": { + "parameterClassName": "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters" + } + } + } + } + }, + "eventInputParameters": { + "VCPEInitConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "src/main/resources/config/VCPEInitiationEvents.txt" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "nameAlias": "closedLoopControlName", + "versionAlias": "version", + "sourceAlias": "from" + } + } + }, + "GuardRequestorConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTREQUESTOR", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters", + "parameters": { + "url": "http://localhost:54321/AAIAndGuardSim/sim/pdp/api/getDecision", + "httpMethod": "POST", + "restRequestTimeout": 2000 + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "GuardResponseEvent", + "eventNameFilter": "GuardResponseEvent", + "requestorMode": true, + "requestorPeer": "GuardRequestorProducer", + "requestorTimeout": 500 + } + }, + "eventOutputParameters": { + "GuardRequestorProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTREQUESTOR", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "GuardRequestEvent", + "requestorMode": true, + "requestorPeer": "GuardRequestorConsumer", + "requestorTimeout": 500 + }, + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/VCPEEventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + } +} diff --git a/examples/examples-onap-vcpe/src/test/resources/config/appc.lcm.success.json b/examples/examples-onap-vcpe/src/test/resources/config/appc.lcm.success.json new file mode 100644 index 000000000..2d2005d98 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/config/appc.lcm.success.json @@ -0,0 +1,22 @@ +{ + "body": { + "output": { + "common-header": { + "timestamp": "2017-08-25T21:06:23.037Z", + "api-ver": "5.00", + "originator-id": "664be3d2-6c12-4f4b-a3e7-c349acced200", + "request-id": "664be3d2-6c12-4f4b-a3e7-c349acced200", + "sub-request-id": "1", + "flags": {} + }, + "status": { + "code": 400, + "message": "Restart Successful" + } + } + }, + "version": "2.0", + "rpc-name": "restart", + "correlation-id": "664be3d2-6c12-4f4b-a3e7-c349acced200-1", + "type": "response" +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.abatement.json b/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.abatement.json new file mode 100644 index 000000000..729451191 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.abatement.json @@ -0,0 +1,16 @@ +{ + "closedLoopControlName": "${closedLoopControlName}", + "closedLoopAlarmStart": 1463679805324, + "closedLoopAlarmEnd": 1463699805324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ABATED", + "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "vserver.is-closed-loop-disabled": "false", + "generic-vnf.vnf-id": "vCPE_Infrastructure_vGMUX_demo_app" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.onset.json b/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.onset.json new file mode 100644 index 000000000..feb15c153 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.onset.json @@ -0,0 +1,15 @@ +{ + "closedLoopControlName": "${closedLoopControlName}", + "closedLoopAlarmStart": 1463679805324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "vserver.is-closed-loop-disabled": "false", + "generic-vnf.vnf-id": "vCPE_Infrastructure_vGMUX_demo_app" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIQuery.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIQuery.json new file mode 100644 index 000000000..46b5dbe73 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/AAIQuery.json @@ -0,0 +1,16 @@ +{ + "query-parameters": { + "named-query": { + "named-query-uuid": "a93ac487-409c-4e8c-9e5f-334ae8f99087" + } + }, + "instance-filters": { + "instance-filter": [ + { + "generic-vnf": { + "vnf-id": "de7cc3ab-0212-47df-9e64-da1c79234deb" + } + } + ] + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4Policy.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4Policy.json new file mode 100644 index 000000000..5bcff1b4b --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4Policy.json @@ -0,0 +1,76 @@ +{ + "inventory-response-item": [ + { + "model-name": "service-instance", + "generic-vnf": { + "vnf-id": "de7cc3ab-0212-47df-9e64-da1c79234deb", + "vnf-name": "ZRDM2MMEX39", + "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "orchestration-status": "active", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1503082370097", + "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4", + "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "service-instance", + "service-instance": { + "service-instance-id": "37b8cdb7-94eb-468f-a0c2-4e3c3546578e", + "service-instance-name": "Changed Service Instance NAME", + "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4", + "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9", + "resource-version": "1503082993532", + "orchestration-status": "Active" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "pnf", + "generic-vnf": { + "vnf-id": "jimmy-test", + "vnf-name": "jimmy-test-vnf", + "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "orchestration-status": "active", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1504013830207", + "model-invariant-id": "862b25a1-262a-4961-bdaa-cdc55d69785a", + "model-version-id": "e9f1fa7d-c839-418a-9601-03dc0d2ad687" + }, + "extra-properties": { + } + }, + { + "model-name": "service-instance", + "generic-vnf": { + "vnf-id": "jimmy-test-vnf2", + "vnf-name": "jimmy-test-vnf2-named", + "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "orchestration-status": "active", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1504014833841", + "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4", + "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9" + }, + "extra-properties": { + } + } + ] + } + } + ] + } + } + ] +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4VNF.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4VNF.json new file mode 100644 index 000000000..3e8391eaa --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4VNF.json @@ -0,0 +1,287 @@ +{ + "inventory-response-item": [ + { + "model-name": "vFW", + "generic-vnf": { + "vnf-id": "vFirewall_demo_app", + "vnf-name": "vFirewall_demo_app", + "vnf-type": "vFW", + "service-id": "vFirewall_demo_app", + "orchestration-status": "running", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509456799110", + "model-invariant-id": "vFirewall", + "model-version-id": "vFW" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "vserver": { + "vserver-id": "5b06cf36-40a0-4bcb-bde9-849aa4702d67", + "vserver-name": "vFW", + "vserver-name2": "vFW", + "prov-status": "Running", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/5b06cf36-40a0-4bcb-bde9-849aa4702d67", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509047869791" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "vnfc": { + "vnfc-name": "VNFC_vGMUX_demo_app2", + "nfc-naming-code": "vGMUXCODE2", + "nfc-function": "vGMUX", + "prov-status": "Running", + "orchestration-status": "Error", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509407048855" + }, + "extra-properties": { + } + }, + { + "tenant": { + "tenant-id": "466979b815b5415ba14ada713e6e1846", + "tenant-name": "Integration", + "resource-version": "1508920100541" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "pod25", + "cloud-region-id": "RegionOne", + "identity-url": "http://10.12.25.2:5000/v3", + "sriov-automation": false, + "resource-version": "1509048416263" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "esr-system-info": { + "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29", + "system-name": "example-system-name-val-29070", + "type": "example-type-val-85254", + "vendor": "example-vendor-val-94515", + "version": "example-version-val-71880", + "service-url": "http://10.12.25.2:5000/v3", + "user-name": "demo", + "password": "onapdemo", + "system-type": "VIM", + "ssl-cacert": "example-ssl-cacert-val-75021", + "ssl-insecure": true, + "ip-address": "example-ip-address-val-44431", + "port": "example-port-val-93234", + "cloud-domain": "Default", + "default-tenant": "Integration", + "resource-version": "1508920101033" + }, + "extra-properties": { + } + } + ] + } + } + ] + } + } + ] + } + }, + { + "vserver": { + "vserver-id": "0c52905c-f682-42cf-bd52-e7f8953e80e3", + "vserver-name": "vFW", + "vserver-name2": "vFW", + "prov-status": "Running", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/0c52905c-f682-42cf-bd52-e7f8953e80e3", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509047548567" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "vnfc": { + "vnfc-name": "VNFC_vGMUX_demo_app3", + "nfc-naming-code": "vGMUXCODE3", + "nfc-function": "vGMUX", + "prov-status": "Running", + "orchestration-status": "Running", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509041912808" + }, + "extra-properties": { + } + }, + { + "tenant": { + "tenant-id": "466979b815b5415ba14ada713e6e1846", + "tenant-name": "Integration", + "resource-version": "1508920100541" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "pod25", + "cloud-region-id": "RegionOne", + "identity-url": "http://10.12.25.2:5000/v3", + "sriov-automation": false, + "resource-version": "1509048416263" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "esr-system-info": { + "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29", + "system-name": "example-system-name-val-29070", + "type": "example-type-val-85254", + "vendor": "example-vendor-val-94515", + "version": "example-version-val-71880", + "service-url": "http://10.12.25.2:5000/v3", + "user-name": "demo", + "password": "onapdemo", + "system-type": "VIM", + "ssl-cacert": "example-ssl-cacert-val-75021", + "ssl-insecure": true, + "ip-address": "example-ip-address-val-44431", + "port": "example-port-val-93234", + "cloud-domain": "Default", + "default-tenant": "Integration", + "resource-version": "1508920101033" + }, + "extra-properties": { + } + } + ] + } + } + ] + } + } + ] + } + }, + { + "vserver": { + "vserver-id": "33e16e02-098a-4f4e-a37f-b4e0307596c0", + "vserver-name": "vFW", + "vserver-name2": "vFW", + "prov-status": "Running", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/33e16e02-098a-4f4e-a37f-b4e0307596c0", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509047285114" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "vnfc": { + "vnfc-name": "vnfc-related-to-vserver-example", + "nfc-naming-code": "example-nfc-naming-code-val-78172", + "nfc-function": "example-nfc-function-val-56352", + "prov-status": "example-prov-status-val-10699", + "orchestration-status": "example-orchestration-status-val-68896", + "ipaddress-v4-oam-vip": "example-ipaddress-v4-oam-vip-val-71483", + "in-maint": true, + "is-closed-loop-disabled": true, + "group-notation": "example-group-notation-val-31912", + "resource-version": "1508800709772" + }, + "extra-properties": { + } + }, + { + "vnfc": { + "vnfc-name": "VNFC_vGMUX_demo_app", + "nfc-naming-code": "vGMUXCODE", + "nfc-function": "vGMUX", + "prov-status": "Running", + "orchestration-status": "Running", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509041573965" + }, + "extra-properties": { + } + }, + { + "tenant": { + "tenant-id": "466979b815b5415ba14ada713e6e1846", + "tenant-name": "Integration", + "resource-version": "1508920100541" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "pod25", + "cloud-region-id": "RegionOne", + "identity-url": "http://10.12.25.2:5000/v3", + "sriov-automation": false, + "resource-version": "1509048416263" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "esr-system-info": { + "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29", + "system-name": "example-system-name-val-29070", + "type": "example-type-val-85254", + "vendor": "example-vendor-val-94515", + "version": "example-version-val-71880", + "service-url": "http://10.12.25.2:5000/v3", + "user-name": "demo", + "password": "onapdemo", + "system-type": "VIM", + "ssl-cacert": "example-ssl-cacert-val-75021", + "ssl-insecure": true, + "ip-address": "example-ip-address-val-44431", + "port": "example-port-val-93234", + "cloud-domain": "Default", + "default-tenant": "Integration", + "resource-version": "1508920101033" + }, + "extra-properties": { + } + } + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponseExample.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponseExample.json new file mode 100644 index 000000000..1d3f64c78 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponseExample.json @@ -0,0 +1,206 @@ +{ + "inventory-response-item": [ + { + "vserver": { + "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", + "vserver-name": "zdfw1lb01lb02", + "vserver-name2": "zdfw1lb01lb02", + "prov-status": "ACTIVE", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1510606403522" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "vLoadBalancer", + "generic-vnf": { + "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vnf-name": "Vfmodule_vLB1113", + "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0", + "service-id": "66f157fc-4148-4880-95f5-e120677e98d1", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1510604011851", + "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc", + "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2", + "model-customization-id": "1983c783-444f-4e79-af3a-85e5d49628f3", + "nf-type": "", + "nf-function": "", + "nf-role": "", + "nf-naming-code": "" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" + }, + { + "property-name": "model-ver.model-name", + "property-value": "vLoadBalancer" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "cee050ed-92a5-494f-ab04-234307a846dc" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "vLoadBalancer-1106", + "service-instance": { + "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941", + "service-instance-name": "vLoadBalancer-1113", + "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a", + "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50", + "resource-version": "1510603936425" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50" + }, + { + "property-name": "model-ver.model-name", + "property-value": "vLoadBalancer-1106" + }, + { + "property-name": "model.model-type", + "property-value": "service" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + } + }, + { + "model-name": "Vloadbalancer..base_vlb..module-0", + "vf-module": { + "vf-module-id": "e6b3e3eb-34e1-4c00-b8c1-2a4fbe479b12", + "vf-module-name": "Vfmodule_vLB1113-1", + "heat-stack-id": "Vfmodule_vLB1113-1/3dd6d900-772f-4fcc-a0cb-e250ab2bb4db", + "orchestration-status": "active", + "is-base-vf-module": true, + "resource-version": "1510604612557", + "model-invariant-id": "6d760188-9a24-451a-b05b-e08b86cb94f2", + "model-version-id": "93facad9-55f2-4fe0-9574-814c2bc2d071", + "model-customization-id": "93fd5bd4-8051-4074-8530-c0c504604df5", + "module-index": 0 + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "93facad9-55f2-4fe0-9574-814c2bc2d071" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..base_vlb..module-0" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "6d760188-9a24-451a-b05b-e08b86cb94f2" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + }, + { + "model-name": "Vloadbalancer..dnsscaling..module-1", + "vf-module": { + "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "is-base-vf-module": false, + "resource-version": "1510610079687", + "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", + "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..dnsscaling..module-1" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + } + ] + } + }, + { + "tenant": { + "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd", + "tenant-name": "Integration-SB-00", + "resource-version": "1509587770200" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "CloudOwner", + "cloud-region-id": "RegionOne", + "cloud-type": "SharedNode", + "owner-defined-type": "OwnerType", + "cloud-region-version": "v1", + "cloud-zone": "CloudZone", + "sriov-automation": false, + "resource-version": "1509587770092" + }, + "extra-properties": { + } + } + ] + } + } + ] + } + } + ] +} diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartRequestEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartRequestEvent.json new file mode 100644 index 000000000..6e18a91b0 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartRequestEvent.json @@ -0,0 +1,22 @@ +{ + "rpc-name": "restart", + "version": "2.0", + "correlation-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "type": "request", + "body": { + "input": { + "common-header": { + "timestamp": "2018-02-26T10:23:41.97Z", + "api-ver": "2.15", + "originator-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "request-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "sub-request-id": "1", + "flags": {} + }, + "action": "Restart", + "action-identifiers": { + "vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1" + } + } + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseNOKEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseNOKEvent.json new file mode 100644 index 000000000..9a0ff9af1 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseNOKEvent.json @@ -0,0 +1,22 @@ +{ + "rpc-name": "restart", + "version": "0.0.1", + "correlation-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "type": "response", + "body": { + "output": { + "common-header": { + "timestamp": "2018-02-26T10:23:42.97Z", + "api-ver": "5.00", + "originator-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "request-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "sub-request-id": "1", + "flags": {} + }, + "status": { + "code": 400, + "message": "Restart Failed" + } + } + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKEvent.json new file mode 100644 index 000000000..4afc51d85 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKEvent.json @@ -0,0 +1,22 @@ +{ + "rpc-name": "restart", + "version": "0.0.1", + "correlation-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "type": "response", + "body": { + "output": { + "common-header": { + "timestamp": "2018-02-26T10:23:42.97Z", + "api-ver": "5.00", + "originator-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "request-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "sub-request-id": "1", + "flags": {} + }, + "status": { + "code": 200, + "message": "Restart Successful" + } + } + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKInitialEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKInitialEvent.json new file mode 100644 index 000000000..2f53a83bc --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKInitialEvent.json @@ -0,0 +1,22 @@ +{ + "rpc-name": "restart", + "version": "0.0.1", + "correlation-id": "4a68f8a5-0db9-4070-a132-adede51ebeef", + "type": "response", + "body": { + "output": { + "common-header": { + "timestamp": "2018-02-26T10:23:42.97Z", + "api-ver": "5.00", + "originator-id": "4a68f8a5-0db9-4070-a132-adede51ebeef", + "request-id": "4a68f8a5-0db9-4070-a132-adede51ebeef", + "sub-request-id": "1", + "flags": {} + }, + "status": { + "code": 200, + "message": "Restart Successful" + } + } + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedAAIInfoEvent.json new file mode 100644 index 000000000..5efbfef69 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedAAIInfoEvent.json @@ -0,0 +1,23 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638001326, + "closedLoopAlarmEnd": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ABATED", + "requestID": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "version": "1.0.2", + "from": "DCAE", + "AAI": { + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1", + "generic-vnf.resource-version": "1", + "generic-vnf.vnf-name": "vCPEInfraVNF13", + "generic-vnf.prov-status": "PREPROV", + "generic-vnf.is-closed-loop-disabled": "false", + "generic-vnf.orchestration-status": "Created", + "generic-vnf.vnf-type": "cCPEInfraService10/vCPEInfraService10 0", + "generic-vnf.in-maint": "false", + "generic-vnf.service-id": "5585fd2c-ad0d-4050-b0cf-dfe4a03bd01f" + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedNoAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedNoAAIInfoEvent.json new file mode 100644 index 000000000..7cc910e96 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedNoAAIInfoEvent.json @@ -0,0 +1,15 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638001326, + "closedLoopAlarmEnd": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ABATED", + "requestID": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "version": "1.0.2", + "from": "DCAE", + "AAI": { + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1" + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetAAIInfoEvent.json new file mode 100644 index 000000000..405cc0b2b --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetAAIInfoEvent.json @@ -0,0 +1,22 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "generic-vnf.resource-version": "1", + "generic-vnf.vnf-name": "vCPEInfraVNF13", + "generic-vnf.prov-status": "PREPROV", + "generic-vnf.is-closed-loop-disabled": "false", + "generic-vnf.orchestration-status": "Created", + "generic-vnf.vnf-type": "cCPEInfraService10/vCPEInfraService10 0", + "generic-vnf.in-maint": "false", + "generic-vnf.service-id": "5585fd2c-ad0d-4050-b0cf-dfe4a03bd01f", + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetNoAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetNoAAIInfoEvent.json new file mode 100644 index 000000000..342451a0c --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetNoAAIInfoEvent.json @@ -0,0 +1,15 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "closedLoopAlarmStart": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "vserver.is-closed-loop-disabled": "false", + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/examples/pcvs/pom.xml b/examples/examples-pcvs/pom.xml index 22da4eda1..a8efe9c6b 100644 --- a/examples/pcvs/pom.xml +++ b/examples/examples-pcvs/pom.xml @@ -26,7 +26,7 @@ <version>2.0.0-SNAPSHOT</version> </parent> - <artifactId>pcvs</artifactId> + <artifactId>examples-pcvs</artifactId> <name>${project.artifactId}</name> <description>Example for Policy-controlled Video Streaming</description> diff --git a/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java index 19825e335..19825e335 100644 --- a/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java +++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java diff --git a/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java index ee6277a8e..ee6277a8e 100644 --- a/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java +++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java diff --git a/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java index ff9b39730..ff9b39730 100644 --- a/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java +++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java diff --git a/examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json b/examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json index 841028bd5..841028bd5 100644 --- a/examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json +++ b/examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json diff --git a/examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json b/examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json index d48a47e69..d48a47e69 100644 --- a/examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json +++ b/examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json diff --git a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json index 50eac5726..50eac5726 100644 --- a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json +++ b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json diff --git a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json index f611ce16d..f611ce16d 100644 --- a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json +++ b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json diff --git a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json index 5c195a8cf..5c195a8cf 100644 --- a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json +++ b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json diff --git a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json index d204614f6..d204614f6 100644 --- a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json +++ b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py index 907dd22cb..907dd22cb 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py index 4d6aea8f5..4d6aea8f5 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh index 0579dcce5..0579dcce5 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh index 7d8542f5a..7d8542f5a 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh index dd2f77d88..dd2f77d88 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh index a2f6ba417..a2f6ba417 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh index 37321a6f2..37321a6f2 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh index 2a166bc87..2a166bc87 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh index ba6e343b2..ba6e343b2 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh index 1e709bb53..1e709bb53 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh index b00bca2c6..b00bca2c6 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh index 8de02941a..8de02941a 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh index b00bca2c6..b00bca2c6 100644 --- a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh +++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc index eca3836a3..eca3836a3 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc index 5961cb6f6..5961cb6f6 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc index 440a3d0a9..440a3d0a9 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc index c633c129d..c633c129d 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc index 622f8af61..622f8af61 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc index 993f608ab..993f608ab 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc index bf5e62796..bf5e62796 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js index cefb7a97c..cefb7a97c 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js index dd667a87d..dd667a87d 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js index 532820f15..532820f15 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js index df96235d3..df96235d3 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js index ad6a51027..ad6a51027 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js index 5f2e3be92..5f2e3be92 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js index bd09a747b..bd09a747b 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js index 78bc94f00..78bc94f00 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js index 48d69e8eb..48d69e8eb 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js index c50dd9794..c50dd9794 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js index 44767467d..44767467d 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex index eb4145788..eb4145788 100644 --- a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex +++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex diff --git a/examples/pcvs/src/test/resources/META-INF/persistence.xml b/examples/examples-pcvs/src/test/resources/META-INF/persistence.xml index 4dcba14b7..4dcba14b7 100644 --- a/examples/pcvs/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-pcvs/src/test/resources/META-INF/persistence.xml diff --git a/examples/pcvs/src/test/resources/logback-test.xml b/examples/examples-pcvs/src/test/resources/logback-test.xml index ea201e0a9..ea201e0a9 100644 --- a/examples/pcvs/src/test/resources/logback-test.xml +++ b/examples/examples-pcvs/src/test/resources/logback-test.xml diff --git a/examples/pcvs/src/test/resources/org/onap/policy/apex/examples/pcvs/vpnsla/config/stdin2stdout.json b/examples/examples-pcvs/src/test/resources/org/onap/policy/apex/examples/pcvs/vpnsla/config/stdin2stdout.json index 4c5e2760a..4c5e2760a 100644 --- a/examples/pcvs/src/test/resources/org/onap/policy/apex/examples/pcvs/vpnsla/config/stdin2stdout.json +++ b/examples/examples-pcvs/src/test/resources/org/onap/policy/apex/examples/pcvs/vpnsla/config/stdin2stdout.json diff --git a/examples/examples-periodic/pom.xml b/examples/examples-periodic/pom.xml new file mode 100644 index 000000000..ed0e5b19f --- /dev/null +++ b/examples/examples-periodic/pom.xml @@ -0,0 +1,74 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>examples-periodic</artifactId> + <name>${project.artifactId}</name> + <description>APEX periodic event example</description> + + <properties> + <policymodel.name>PeriodicPolicyModel</policymodel.name> + <apex-domains-periodic-dir>${project.basedir}/src</apex-domains-periodic-dir> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.policy.apex-pdp.auth</groupId> + <artifactId>cli-editor</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- Generate the APEX Policy JSON from the APEX CLI command --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-policy</id> + <phase>compile</phase> + <goals> + <goal>java</goal> + </goals> + <configuration> + <mainClass>org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain</mainClass> + <classpathScope>compile</classpathScope> + <arguments> + <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument> + <argument>--output-model-file=${project.build.directory}/classes/${policymodel.name}.json</argument> + <argument>--log-file=${project.build.directory}/${policymodel.name}_policygeneration.log</argument> + <argument>--working-dir=${project.basedir}</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/examples/examples-periodic/src/main/resources/logic/OutputTask.js b/examples/examples-periodic/src/main/resources/logic/OutputTask.js new file mode 100644 index 000000000..0e44653c1 --- /dev/null +++ b/examples/examples-periodic/src/main/resources/logic/OutputTask.js @@ -0,0 +1,26 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE;
\ No newline at end of file diff --git a/examples/examples-periodic/src/main/resources/logic/PeriodicTask.js b/examples/examples-periodic/src/main/resources/logic/PeriodicTask.js new file mode 100644 index 000000000..18dbcda0e --- /dev/null +++ b/examples/examples-periodic/src/main/resources/logic/PeriodicTask.js @@ -0,0 +1,44 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var eventList = executor.subject.getOutFieldSchemaHelper("EventList").createNewInstance(); + +var eventType = Java.type("org.onap.policy.apex.service.engine.event.ApexEvent"); + +for (i = 0; i < 5; i++) { + var event = new eventType("InputEvent", "0.0.1", "org.onap.policy.apex.periodic", "APEX", "APEX"); + + var par0 = "Hello: " + i; + var par1 = "Goodbye: " + i; + + event.put("Par0", par0); + event.put("Par1", par1); + + eventList.add(event); +} + +executor.outFields.put("EventList", eventList); + +executor.logger.info(executor.outFields); + +var returnValue = executor.TRUE;
\ No newline at end of file diff --git a/examples/examples-periodic/src/main/resources/policy/PeriodicPolicyModel.apex b/examples/examples-periodic/src/main/resources/policy/PeriodicPolicyModel.apex new file mode 100644 index 000000000..22a07f5f5 --- /dev/null +++ b/examples/examples-periodic/src/main/resources/policy/PeriodicPolicyModel.apex @@ -0,0 +1,83 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START======================================================= +# Copyright (C) 2016-2018 Ericsson. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +#------------------------------------------------------------------------------- + +model create name=PeriodicPolicyModel + +schema create name=SimpleLongType flavour=Java schema=java.lang.Long +schema create name=SimpleStringType flavour=Java schema=java.lang.String +schema create name=EventListType flavour=Java schema=org.onap.policy.apex.service.engine.event.ApexEventList + +event create name=PERIODIC_EVENT nameSpace=org.onap.policy.apex.periodic source=APEX target=APEX +event parameter create name=PERIODIC_EVENT parName=PERIODIC_DELAY schemaName=SimpleLongType +event parameter create name=PERIODIC_EVENT parName=PERIODIC_FIRST_TIME schemaName=SimpleLongType +event parameter create name=PERIODIC_EVENT parName=PERIODIC_LAST_TIME schemaName=SimpleLongType +event parameter create name=PERIODIC_EVENT parName=PERIODIC_CURRENT_TIME schemaName=SimpleLongType +event parameter create name=PERIODIC_EVENT parName=PERIODIC_EVENT_COUNT schemaName=SimpleLongType + +event create name=EventListEvent nameSpace=org.onap.policy.apex.periodic source=APEX target=APEX +event parameter create name=EventListEvent parName=EventList schemaName=EventListType + +event create name=InputEvent nameSpace=org.onap.policy.apex.periodic source=APEX target=APEX +event parameter create name=InputEvent parName=Par0 schemaName=SimpleStringType +event parameter create name=InputEvent parName=Par1 schemaName=SimpleStringType + +event create name=OutputEvent nameSpace=org.onap.policy.apex.periodic source=APEX target=APEX +event parameter create name=OutputEvent parName=Par0 schemaName=SimpleStringType +event parameter create name=OutputEvent parName=Par1 schemaName=SimpleStringType + +task create name=PeriodicTask +task inputfield create name=PeriodicTask fieldName=PERIODIC_DELAY schemaName=SimpleLongType +task inputfield create name=PeriodicTask fieldName=PERIODIC_FIRST_TIME schemaName=SimpleLongType +task inputfield create name=PeriodicTask fieldName=PERIODIC_LAST_TIME schemaName=SimpleLongType +task inputfield create name=PeriodicTask fieldName=PERIODIC_CURRENT_TIME schemaName=SimpleLongType +task inputfield create name=PeriodicTask fieldName=PERIODIC_EVENT_COUNT schemaName=SimpleLongType + +task outputfield create name=PeriodicTask fieldName=EventList schemaName=EventListType + +task logic create name=PeriodicTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/PeriodicTask.js" +LE + +task create name=OutputTask +task inputfield create name=OutputTask fieldName=Par0 schemaName=SimpleStringType +task inputfield create name=OutputTask fieldName=Par1 schemaName=SimpleStringType + +task outputfield create name=OutputTask fieldName=Par0 schemaName=SimpleStringType +task outputfield create name=OutputTask fieldName=Par1 schemaName=SimpleStringType + +task logic create name=OutputTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/OutputTask.js" +LE + +policy create name=PeriodicPolicy template=freestyle firstState=PeriodicState + +policy state create name=PeriodicPolicy stateName=PeriodicState triggerName=PERIODIC_EVENT defaultTaskName=PeriodicTask +policy state output create name=PeriodicPolicy stateName=PeriodicState outputName=PeriodicOutput eventName=EventListEvent +policy state taskref create name=PeriodicPolicy stateName=PeriodicState taskName=PeriodicTask outputType=DIRECT outputName=PeriodicOutput + + +policy create name=OutputPolicy template=freestyle firstState=OutputState + +policy state create name=OutputPolicy stateName=OutputState triggerName=InputEvent defaultTaskName=OutputTask +policy state output create name=OutputPolicy stateName=OutputState outputName=OutputOutput eventName=OutputEvent +policy state taskref create name=OutputPolicy stateName=OutputState taskName=OutputTask outputType=DIRECT outputName=OutputOutput + +validate + diff --git a/examples/pom.xml b/examples/pom.xml index 3d0f969d9..37306f3aa 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -35,9 +35,12 @@ <modules> - <module>myfirstpolicy</module> - <module>aadm</module> - <module>adaptive</module> - <module>pcvs</module> + <module>examples-myfirstpolicy</module> + <module>examples-aadm</module> + <module>examples-adaptive</module> + <module>examples-pcvs</module> + <module>examples-decisionmaker</module> + <module>examples-periodic</module> + <module>examples-onap-vcpe</module> </modules> </project>
\ No newline at end of file diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/AbstractParameters.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/AbstractParameters.java index c7ec2d662..cc7c7b06f 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/AbstractParameters.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/AbstractParameters.java @@ -32,7 +32,7 @@ import org.onap.policy.apex.model.utilities.Assertions; */ public abstract class AbstractParameters { // The name of the parameter subclass - private String parameterClassName = this.getClass().getCanonicalName(); + private final String parameterClassName; /** * Constructor, creates a parameter class that must be a subclass of {@link AbstractParameters}. @@ -47,6 +47,8 @@ public abstract class AbstractParameters { throw new ApexRuntimeException( "class \"" + parameterClassName + "\" not found or not an instance of \"" + this.getClass().getCanonicalName() + "\"", e); } + + this.parameterClassName = parameterClassName; } /** diff --git a/packages/apex-pdp-package-full/pom.xml b/packages/apex-pdp-package-full/pom.xml index a067d1fcf..bb0beee9f 100644 --- a/packages/apex-pdp-package-full/pom.xml +++ b/packages/apex-pdp-package-full/pom.xml @@ -177,22 +177,37 @@ <!-- Sample Examples --> <dependency> <groupId>org.onap.policy.apex-pdp.examples</groupId> - <artifactId>aadm</artifactId> + <artifactId>examples-aadm</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.onap.policy.apex-pdp.examples</groupId> - <artifactId>adaptive</artifactId> + <artifactId>examples-adaptive</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.onap.policy.apex-pdp.examples</groupId> - <artifactId>myfirstpolicy</artifactId> + <artifactId>examples-myfirstpolicy</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.onap.policy.apex-pdp.examples</groupId> - <artifactId>pcvs</artifactId> + <artifactId>examples-pcvs</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples-decisionmaker</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples-periodic</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples-onap-vcpe</artifactId> <version>${project.version}</version> </dependency> </dependencies> @@ -232,7 +247,7 @@ </artifactItem> <artifactItem> <groupId>org.onap.policy.apex-pdp.examples</groupId> - <artifactId>aadm</artifactId> + <artifactId>examples-aadm</artifactId> <version>${project.version}</version> <type>jar</type> <overWrite>false</overWrite> @@ -241,7 +256,7 @@ </artifactItem> <artifactItem> <groupId>org.onap.policy.apex-pdp.examples</groupId> - <artifactId>adaptive</artifactId> + <artifactId>examples-adaptive</artifactId> <version>${project.version}</version> <type>jar</type> <overWrite>false</overWrite> @@ -250,7 +265,7 @@ </artifactItem> <artifactItem> <groupId>org.onap.policy.apex-pdp.examples</groupId> - <artifactId>myfirstpolicy</artifactId> + <artifactId>examples-myfirstpolicy</artifactId> <version>${project.version}</version> <type>jar</type> <overWrite>false</overWrite> @@ -259,13 +274,40 @@ </artifactItem> <artifactItem> <groupId>org.onap.policy.apex-pdp.examples</groupId> - <artifactId>pcvs</artifactId> + <artifactId>examples-pcvs</artifactId> <version>${project.version}</version> <type>jar</type> <overWrite>false</overWrite> <outputDirectory>${project.build.directory}</outputDirectory> <includes>etc/**/*,examples/**/*</includes> </artifactItem> + <artifactItem> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples-decisionmaker</artifactId> + <version>${project.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/examples/models/DecisionMaker</outputDirectory> + <includes>/DecisionMakerPolicyModel.json</includes> + </artifactItem> + <artifactItem> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples-periodic</artifactId> + <version>${project.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/examples/models/Periodic</outputDirectory> + <includes>/PeriodicPolicyModel.json</includes> + </artifactItem> + <artifactItem> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples-onap-vcpe</artifactId> + <version>${project.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/examples/models/ONAPvCPE</outputDirectory> + <includes>/ONAPvCPEPolicyModel.json</includes> + </artifactItem> </artifactItems> <overWriteReleases>true</overWriteReleases> <overWriteSnapshots>true</overWriteSnapshots> @@ -273,7 +315,7 @@ </execution> </executions> </plugin> - + <!-- Build the tar ball --> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/AnswerInitiationEvent.json b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/AnswerInitiationEvent.json new file mode 100644 index 000000000..6df3115d6 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/AnswerInitiationEvent.json @@ -0,0 +1,14 @@ +{ + "nameSpace": "org.onap.policy.apex.domains.decisionmaker", + "name": "AnswerEvent", + "version": "0.0.1", + "source": "dcae", + "target": "apex", + "a0" : "choice 0", + "a1" : "choice 1", + "a2" : "choice 2", + "a3" : "choice 3", + "a4" : "choice 4", + "a5" : "choice 5", + "a6" : "choice 6" +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTClient.json b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTClient.json new file mode 100644 index 000000000..9fa0b6ddd --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTClient.json @@ -0,0 +1,67 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12345, + "policyModelFileName": "examples/models/DecisionMaker/DecisionMakerPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "VNFInitConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "examples/config/DecisionMaker/AnswerInitiationEvent.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "DMaaPConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://localhost:3904/events/toApex/APEX/1?timeout=60000" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + }, + "eventOutputParameters": { + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/EventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "DMaapProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://localhost:3904/events/fromApex" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + } +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTServer.json b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTServer.json new file mode 100644 index 000000000..edf1b9cc3 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTServer.json @@ -0,0 +1,72 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12345, + "policyModelFileName": "examples/models/DecisionMaker/DecisionMakerPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "VNFInitConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "examples/config/DecisionMaker/AnswerInitiationEvent.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "RESTConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTSERVER", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters", + "parameters": { + "standalone": true, + "host": "0.0.0.0", + "port": 23324 + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "RESTProducer", + "synchronousTimeout": 500 + } + }, + "eventOutputParameters": { + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/EventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "RESTProducer": { + "carrierTechnologyParameters":{ + "carrierTechnology" : "RESTSERVER", + "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters" + }, + "eventProtocolParameters":{ + "eventProtocol" : "JSON" + }, + "synchronousMode" : true, + "synchronousPeer" : "RESTConsumer", + "synchronousTimeout" : 500 + } + } +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/ApexConfig.json b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/ApexConfig.json new file mode 100644 index 000000000..070bbc105 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/ApexConfig.json @@ -0,0 +1,145 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "policy/ONAPTLGoalPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + }, + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "schemaParameters": { + "Avro": { + "parameterClassName": "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters" + } + } + } + } + }, + "eventInputParameters": { + "VCPEInitConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "config/VCPEInitiationEvent.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "nameAlias": "closedLoopControlName", + "versionAlias": "version", + "sourceAlias": "from" + } + } + }, + "GuardRequestorConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTREQUESTOR", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters", + "parameters": { + "url": "http://192.168.144.235:54321/AAIAndGuardSim/sim/pdp/api/getDecision", + "httpMethod": "POST", + "restRequestTimeout": 2000 + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "GuardResponseEvent", + "eventNameFilter": "GuardResponseEvent", + "requestorMode": true, + "requestorPeer": "GuardRequestorProducer", + "requestorTimeout": 500 + }, + "DCAEConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://192.168.144.235:3904/events/unauthenticated.DCAE_CL_OUTPUT/APEX/1?timeout=60000" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "nameAlias": "closedLoopControlName", + "versionAlias": "version", + "sourceAlias": "from" + } + } + }, + "APPCConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://192.168.144.235:3904/events/APPC_LCM_WRITE/APEX/1?timeout=60000" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "APPCRestartVNFResponseEvent", + "eventNameFilter": "APPCRestartVNFResponseEvent" + } + }, + "eventOutputParameters": { + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/VCPEEventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "GuardRequestorProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTREQUESTOR", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "GuardRequestEvent", + "requestorMode": true, + "requestorPeer": "GuardRequestorConsumer", + "requestorTimeout": 500 + }, + "APPCProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://192.168.144.235:3904/events/APPC-LCM-READ" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "APPCRestartVNFRequestEvent" + }, + "PolicyLogProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://192.168.144.235:3904/events/POLICY_CL_MGT" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "ControlLoopLogEvent" + } + } +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent0.json b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent0.json new file mode 100644 index 000000000..e46a2739c --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent0.json @@ -0,0 +1,22 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "4a68f8a5-0db9-4070-a132-adede51ebeef", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "generic-vnf.resource-version": "1", + "generic-vnf.vnf-name": "vCPEInfraVNF99", + "generic-vnf.prov-status": "PREPROV", + "generic-vnf.is-closed-loop-disabled": "false", + "generic-vnf.orchestration-status": "Created", + "generic-vnf.vnf-type": "cCPEInfraService10/vCPEInfraService10 0", + "generic-vnf.in-maint": "false", + "generic-vnf.service-id": "5585fd2c-ad0d-4050-b0cf-dfe4a03bf00f", + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db001e" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent1.json b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent1.json new file mode 100644 index 000000000..5fcece8ac --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent1.json @@ -0,0 +1,14 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638197699, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "4a68f8a5-0db9-4070-a132-adede51ebeaf", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db001c" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent2.json b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent2.json new file mode 100644 index 000000000..7e3e33777 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent2.json @@ -0,0 +1,36 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638197699, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "4a68f8a5-0db9-4070-a132-adede51ebeaf", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db001c" + }, + "from": "DCAE", + "version": "1.0.2" +} +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "4a68f8a5-0db9-4070-a132-adede51ebeef", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "generic-vnf.resource-version": "1", + "generic-vnf.vnf-name": "vCPEInfraVNF99", + "generic-vnf.prov-status": "PREPROV", + "generic-vnf.is-closed-loop-disabled": "false", + "generic-vnf.orchestration-status": "Created", + "generic-vnf.vnf-type": "cCPEInfraService10/vCPEInfraService10 0", + "generic-vnf.in-maint": "false", + "generic-vnf.service-id": "5585fd2c-ad0d-4050-b0cf-dfe4a03bf00f", + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db001e" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/Periodic/ApexConfigPeriodic.json b/packages/apex-pdp-package-full/src/main/package/examples/config/Periodic/ApexConfigPeriodic.json new file mode 100644 index 000000000..a4c94779b --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/Periodic/ApexConfigPeriodic.json @@ -0,0 +1,58 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "examples/models/Periodic/PeriodicPolicyModel.json", + "periodicEventPeriod": 1000, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "EventRequestorConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "EVENT_REQUESTOR" + }, + "eventProtocolParameters": { + "eventProtocol": "APEX" + }, + "eventNameFilter": "InputEvent", + "requestorMode": true, + "requestorPeer": "EventRequestorProducer", + "requestorTimeout": 500 + } + }, + "eventOutputParameters": { + "EventRequestorProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "EVENT_REQUESTOR" + }, + "eventProtocolParameters": { + "eventProtocol": "APEX" + }, + "eventNameFilter": "EventListEvent", + "requestorMode": true, + "requestorPeer": "EventRequestorConsumer", + "requestorTimeout": 500 + }, + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/PeriodicEventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "OutputEvent" + } + } +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Client.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Client.html new file mode 100644 index 000000000..1077939b0 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Client.html @@ -0,0 +1,156 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2016-2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!-- http://localhost:3904/events/toApex --> + +<html> +<head> +<script src="http://code.jquery.com/jquery-latest.js"></script> +<script> + $(document).ready(function() { + $("#answerspost").click(function(e) { + var elements = document.getElementById("answerform").elements; + + var formValues = new Object; + formValues["name"] = "AnswerEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "text" && element.value != "") { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:3904/events/toApex", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Answers Set Successfully !!!"); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +<script> + $(document).ready(function() { + $("#modepost").click(function(e) { + var elements = document.getElementById("modeform").elements; + + var formValues = new Object; + formValues["name"] = "MakeDecisionEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "radio" && element.checked) { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:3904/events/toApex", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Decision Taken: " + data.decision); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +</head> +<body> + <h3>Decision Maker Answers</h3> + <form name="answerform" id="answerform" method="POST"> + <table> + <tr> + <td>First Answer:</td> + <td><input type="text" name="a0" value="Never Ever" /></td> + </tr> + <tr> + <td>Second Answer:</td> + <td><input type="text" name="a1" value="No" /></td> + </tr> + <tr> + <td>Third Answer:</td> + <td><input type="text" name="a2" value="Maybe not" /></td> + </tr> + <tr> + <td>Fourth Answer</td> + <td><input type="text" name="a3" value="Wait" /></td> + </tr> + <tr> + <td>Fifth Answer:</td> + <td><input type="text" name="a4" value="Maybe" /></td> + </tr> + <tr> + <td>Sixth Answer:</td> + <td><input type="text" name="a5" value="Yes" /></td> + </tr> + <tr> + <td>Seventh Answer:</td> + <td><input type="text" name="a6" value="Absolutely" /></td> + </tr> + <tr> + <td /> + <td><input type="button" class="btn btn-info" id="answerspost" + value="Set Answers"></td> + </tr> + </table> + </form> + <h3>Decision Maker Mode</h3> + <form name="modeform" id="modeform" method="POST"> + <table> + <tr> + <td><input name="mode" type="radio" value="random" + checked="checked">random</td> + <td><input name="mode" type="radio" value="pessimistic">pessimistic</td> + <td><input name="mode" type="radio" value="optimistic"> + optimistic</td> + <td><input name="mode" type="radio" value="dithering">dithering</td> + <td><input name="mode" type="radio" value="roundrobin">round + robin</td> + </tr> + <tr> + <td /> + <td /> + <td /> + <td /> + <td><input type="button" class="btn btn-info" id="modepost" + value="Make Decision"></td> + </tr> + </table> + </form> +</body> +</html> diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Server.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Server.html new file mode 100644 index 000000000..06df67e59 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Server.html @@ -0,0 +1,156 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2016-2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!-- http://localhost:23324/apex/EventIn --> + +<html> +<head> +<script src="http://code.jquery.com/jquery-latest.js"></script> +<script> + $(document).ready(function() { + $("#answerspost").click(function(e) { + var elements = document.getElementById("answerform").elements; + + var formValues = new Object; + formValues["name"] = "AnswerEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "text" && element.value != "") { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:23324/apex/RESTConsumer/EventIn", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Answers Set Successfully !!!"); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +<script> + $(document).ready(function() { + $("#modepost").click(function(e) { + var elements = document.getElementById("modeform").elements; + + var formValues = new Object; + formValues["name"] = "MakeDecisionEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "radio" && element.checked) { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:23324/apex/RESTConsumer/EventIn", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Decision Taken: " + data.decision); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +</head> +<body> + <h3>Decision Maker Answers</h3> + <form name="answerform" id="answerform" method="POST"> + <table> + <tr> + <td>First Answer:</td> + <td><input type="text" name="a0" value="Never Ever" /></td> + </tr> + <tr> + <td>Second Answer:</td> + <td><input type="text" name="a1" value="No" /></td> + </tr> + <tr> + <td>Third Answer:</td> + <td><input type="text" name="a2" value="Maybe not" /></td> + </tr> + <tr> + <td>Fourth Answer</td> + <td><input type="text" name="a3" value="Wait" /></td> + </tr> + <tr> + <td>Fifth Answer:</td> + <td><input type="text" name="a4" value="Maybe" /></td> + </tr> + <tr> + <td>Sixth Answer:</td> + <td><input type="text" name="a5" value="Yes" /></td> + </tr> + <tr> + <td>Seventh Answer:</td> + <td><input type="text" name="a6" value="Absolutely" /></td> + </tr> + <tr> + <td /> + <td><input type="button" class="btn btn-info" id="answerspost" + value="Set Answers"></td> + </tr> + </table> + </form> + <h3>Decision Maker Mode</h3> + <form name="modeform" id="modeform" method="POST"> + <table> + <tr> + <td><input name="mode" type="radio" value="random" + checked="checked">random</td> + <td><input name="mode" type="radio" value="pessimistic">pessimistic</td> + <td><input name="mode" type="radio" value="optimistic"> + optimistic</td> + <td><input name="mode" type="radio" value="dithering">dithering</td> + <td><input name="mode" type="radio" value="roundrobin">round + robin</td> + </tr> + <tr> + <td /> + <td /> + <td /> + <td /> + <td><input type="button" class="btn btn-info" id="modepost" + value="Make Decision"></td> + </tr> + </table> + </form> +</body> +</html> diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Client.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Client.html new file mode 100644 index 000000000..f7a3f0c5b --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Client.html @@ -0,0 +1,153 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2016-2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!-- http://localhost:3904/events/toApex --> + +<html> +<head> +<script src="http://code.jquery.com/jquery-latest.js"></script> +<script> + $(document).ready(function() { + $("#answerspost").click(function(e) { + var elements = document.getElementById("answerform").elements; + + var formValues = new Object; + formValues["name"] = "AnswerEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "text" && element.value != "") { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:3904/events/toApex", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Answers Set Successfully !!!"); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +<script> + $(document).ready(function() { + $("#modepost").click(function(e) { + var elements = document.getElementById("modeform").elements; + + var formValues = new Object; + formValues["name"] = "MakeDecisionEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "radio" && element.checked) { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:3904/events/toApex", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Decision Taken: " + data.decision); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +</head> +<body> + <h3>Decision Maker Answers</h3> + <form name="answerform" id="answerform" method="POST"> + <table> + <tr> + <td>First Answer:</td> + <td><input type="text" name="a0" value="Never Ever" /></td> + </tr> + <tr> + <td>Second Answer:</td> + <td><input type="text" name="a1" value="No" /></td> + </tr> + <tr> + <td>Third Answer:</td> + <td><input type="text" name="a2" value="Maybe not" /></td> + </tr> + <tr> + <td>Fourth Answer</td> + <td><input type="text" name="a3" value="Wait" /></td> + </tr> + <tr> + <td>Fifth Answer:</td> + <td><input type="text" name="a4" value="Maybe" /></td> + </tr> + <tr> + <td>Sixth Answer:</td> + <td><input type="text" name="a5" value="Yes" /></td> + </tr> + <tr> + <td>Seventh Answer:</td> + <td><input type="text" name="a6" value="Absolutely" /></td> + </tr> + <tr> + <td /> + <td><input type="button" class="btn btn-info" id="answerspost" + value="Set Answers"></td> + </tr> + </table> + </form> + <h3>Decision Maker Mode</h3> + <form name="modeform" id="modeform" method="POST"> + <table> + <tr> + <td><input name="mode" type="radio" value="random" + checked="checked">random</td> + <td><input name="mode" type="radio" value="pessimistic">pessimistic</td> + <td><input name="mode" type="radio" value="optimistic"> + optimistic</td> + <td><input name="mode" type="radio" value="dithering">dithering</td> + </tr> + <tr> + <td /> + <td /> + <td /> + <td><input type="button" class="btn btn-info" id="modepost" + value="Make Decision"></td> + </tr> + </table> + </form> +</body> +</html> diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Server.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Server.html new file mode 100644 index 000000000..4c8f311af --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Server.html @@ -0,0 +1,153 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2016-2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!-- http://localhost:23324/apex/eventInput/EventIn --> + +<html> +<head> +<script src="http://code.jquery.com/jquery-latest.js"></script> +<script> + $(document).ready(function() { + $("#answerspost").click(function(e) { + var elements = document.getElementById("answerform").elements; + + var formValues = new Object; + formValues["name"] = "AnswerEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "text" && element.value != "") { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:23324/apex/RESTConsumer/EventIn", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Answers Set Successfully !!!"); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +<script> + $(document).ready(function() { + $("#modepost").click(function(e) { + var elements = document.getElementById("modeform").elements; + + var formValues = new Object; + formValues["name"] = "MakeDecisionEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "radio" && element.checked) { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:23324/apex/RESTConsumer/EventIn", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Decision Taken: " + data.decision); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +</head> +<body> + <h3>Decision Maker Answers</h3> + <form name="answerform" id="answerform" method="POST"> + <table> + <tr> + <td>First Answer:</td> + <td><input type="text" name="a0" value="Never Ever" /></td> + </tr> + <tr> + <td>Second Answer:</td> + <td><input type="text" name="a1" value="No" /></td> + </tr> + <tr> + <td>Third Answer:</td> + <td><input type="text" name="a2" value="Maybe not" /></td> + </tr> + <tr> + <td>Fourth Answer</td> + <td><input type="text" name="a3" value="Wait" /></td> + </tr> + <tr> + <td>Fifth Answer:</td> + <td><input type="text" name="a4" value="Maybe" /></td> + </tr> + <tr> + <td>Sixth Answer:</td> + <td><input type="text" name="a5" value="Yes" /></td> + </tr> + <tr> + <td>Seventh Answer:</td> + <td><input type="text" name="a6" value="Absolutely" /></td> + </tr> + <tr> + <td /> + <td><input type="button" class="btn btn-info" id="answerspost" + value="Set Answers"></td> + </tr> + </table> + </form> + <h3>Decision Maker Mode</h3> + <form name="modeform" id="modeform" method="POST"> + <table> + <tr> + <td><input name="mode" type="radio" value="random" + checked="checked">random</td> + <td><input name="mode" type="radio" value="pessimistic">pessimistic</td> + <td><input name="mode" type="radio" value="optimistic"> + optimistic</td> + <td><input name="mode" type="radio" value="dithering">dithering</td> + </tr> + <tr> + <td /> + <td /> + <td /> + <td><input type="button" class="btn btn-info" id="modepost" + value="Make Decision"></td> + </tr> + </table> + </form> +</body> +</html> diff --git a/packages/apex-pdp-package-full/src/main/resources/app-version.txt b/packages/apex-pdp-package-full/src/main/resources/app-version.txt new file mode 100644 index 000000000..f2ab45c3b --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/resources/app-version.txt @@ -0,0 +1 @@ +${project.version}
\ No newline at end of file diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilter.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilter.java new file mode 100644 index 000000000..b1c6bb9ad --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilter.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.plugins.event.carrier.restserver; + +import java.io.IOException; + +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerResponseContext; +import javax.ws.rs.container.ContainerResponseFilter; +import javax.ws.rs.ext.Provider; + +/** + * This class implements ContainerResponseFilter which intercepts every request/response coming to REST server and adds + * the required HTTP headers to support CORS. + * + * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com) + */ +@Provider +public class AccessControlFilter implements ContainerResponseFilter { + + @Override + public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext) + throws IOException { + responseContext.getHeaders().add("Access-Control-Allow-Origin", requestContext.getHeaderString("Origin")); + + responseContext.getHeaders().add("Access-Control-Expose-Headers", "Content-Type, Accept, Allow"); + + responseContext.getHeaders().add("Access-Control-Allow-Headers", "Origin, Content-Type, Accept"); + + responseContext.getHeaders().add("Access-Control-Allow-Credentials", "true"); + + responseContext.getHeaders().add("Access-Control-Allow-Methods", "OPTIONS, GET, POST, PUT"); + } + +} diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java index 71bf80f66..8cf0c8f9c 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java @@ -135,7 +135,7 @@ public class ApexRestServerConsumer implements ApexEventConsumer, Runnable { restConsumerProperties.getPort()); // Instantiate the standalone server - final ResourceConfig rc = new ResourceConfig(RestServerEndpoint.class); + final ResourceConfig rc = new ResourceConfig(RestServerEndpoint.class, AccessControlFilter.class); server = GrizzlyHttpServerFactory.createHttpServer(URI.create(baseURI), rc); while (!server.isStarted()) { @@ -161,8 +161,8 @@ <module>plugins</module> <module>examples</module> <module>testsuites</module> - <module>packages</module> <module>client</module> <module>tools</module> + <module>packages</module> </modules> </project> diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java index 1b5603482..436225fc4 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java @@ -45,7 +45,7 @@ public class ApexMain { private ApexParameters parameters; /** - * Instantiates the Apex Apex service. + * Instantiates the Apex service. * * @param args the commaind line arguments */ @@ -138,8 +138,6 @@ public class ApexMain { /** * The Class ApexMainShutdownHookClass terminates the Apex engine for the Apex service when its * run method is called. - * - * @author Liam Fallon (liam.fallon@ericsson.com) */ private class ApexMainShutdownHookClass extends Thread { /* |