From 3d02543fc00a46da2da8f682f71b538ca2fd36e5 Mon Sep 17 00:00:00 2001 From: ramverma Date: Thu, 19 Jul 2018 18:45:16 +0100 Subject: [PATCH] Adding examples module to apex-pdp Adding examples (MyFirstPolicy, AADM, Adaptive, PCVS) to apex-pdp so that anyone can try out running few sample policies and understand how to create and run policies in apex-pdp. Change-Id: I0dff6d54ef94d8b5bdb63eabcb09e9f64d76fd0c Issue-ID: POLICY-861 Signed-off-by: ramverma --- examples/aadm/pom.xml | 92 + .../apex/examples/aadm/concepts/ENodeBStatus.java | 107 + .../apex/examples/aadm/concepts/IMSIStatus.java | 175 + .../examples/aadm/concepts/IPAddressStatus.java | 79 + .../apex/examples/aadm/concepts/package-info.java | 27 + .../aadm/model/AADMDomainModelFactory.java | 703 ++ .../examples/aadm/model/AADMDomainModelSaver.java | 57 + .../apex/examples/aadm/model/package-info.java | 27 + .../policy/apex/examples/aadm/package-info.java | 27 + .../examples/events/AADM/AADMTestEvent.xml | 108 + .../examples/events/AADM/AADMTestEvent0.json | 27 + .../examples/events/AADM/AADMTestEvent1.json | 27 + .../examples/events/AADM/AADMTestEvent2.json | 27 + .../examples/events/AADM/AADMTestEvent3.json | 27 + .../examples/events/AADM/AADMTestEvent4.json | 28 + .../examples/events/AADM/AADMTestEvent5.json | 27 + .../examples/events/AADM/AADMTestEvent6.json | 27 + .../examples/events/AADM/AADMTestEvent7.json | 27 + .../events/AADM/AADMTestPeridociEvent.json | 12 + .../model/mvel/AADMDoSProvenActTask_TaskLogic.mvel | 80 + .../mvel/AADMDoSSuggestionActTask_TaskLogic.mvel | 106 + .../aadm/model/mvel/AADMMatchTask_TaskLogic.mvel | 75 + .../aadm/model/mvel/AADMNoActTask_TaskLogic.mvel | 55 + .../mvel/AADMPolicy_Act_TaskSelectionLogic.mvel | 67 + .../aadm/model/mvel/Default_TaskLogic.mvel | 23 + .../model/mvel/Default_TaskSelectionLogic.mvel | 23 + .../aadm/model/mvel/PeriodicActTask_TaskLogic.mvel | 40 + .../aadm/model/mvel/SAPCActTask_TaskLogic.mvel | 79 + .../aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel | 52 + .../aadm/model/mvel/VMMEActTask_TaskLogic.mvel | 44 + .../aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel | 47 + .../policy/apex/examples/aadm/TestAADMDBWrite.java | 60 + .../policy/apex/examples/aadm/TestAADMModel.java | 81 + .../apex/examples/aadm/TestAADMModelCreator.java | 56 + .../policy/apex/examples/aadm/TestAADMUseCase.java | 412 + .../apex/examples/aadm/TestApexActionListener.java | 91 + .../src/test/resources/META-INF/persistence.xml | 69 + examples/aadm/src/test/resources/logback-test.xml | 74 + examples/adaptive/pom.xml | 102 + .../adaptive/concepts/AnomalyDetection.java | 243 + .../apex/examples/adaptive/concepts/AutoLearn.java | 198 + .../examples/adaptive/concepts/package-info.java | 27 + .../adaptive/model/AdaptiveDomainModelFactory.java | 558 ++ .../adaptive/model/AdaptiveDomainModelSaver.java | 64 + ...yDetectionPolicy_Decide_TaskSelectionLogic.java | 414 + .../AutoLearnPolicy_Decide_TaskSelectionLogic.java | 151 + .../examples/adaptive/model/java/package-info.java | 27 + .../apex/examples/adaptive/model/package-info.java | 27 + .../events/Adaptive/AnomalyDetectionEvents.json | 200 + .../examples/events/Adaptive/AutoLearnEvents.json | 10000 +++++++++++++++++++ .../model/mvel/AutoLearnDecideTask0_TaskLogic.mvel | 40 + .../model/mvel/AutoLearnDecideTask1_TaskLogic.mvel | 40 + .../model/mvel/AutoLearnDecideTask2_TaskLogic.mvel | 40 + .../model/mvel/AutoLearnDecideTask3_TaskLogic.mvel | 40 + .../model/mvel/AutoLearnDecideTask4_TaskLogic.mvel | 40 + .../model/mvel/AutoLearnDecideTask5_TaskLogic.mvel | 40 + .../model/mvel/AutoLearnDecideTask6_TaskLogic.mvel | 40 + .../mvel/DefaultAnomalyDetectionTask_Logic.mvel | 25 + .../model/mvel/DefaultAutoLearnTask_Logic.mvel | 26 + .../adaptive/model/mvel/DefaultState_Logic.mvel | 23 + .../adaptive/TestAnomalyDetectionDBWrite.java | 60 + .../adaptive/TestAnomalyDetectionModel.java | 81 + .../adaptive/TestAnomalyDetectionModelCreator.java | 56 + .../adaptive/TestAnomalyDetectionTSLUseCase.java | 164 + .../examples/adaptive/TestApexActionListener.java | 91 + .../examples/adaptive/TestAutoLearnDBWrite.java | 60 + .../apex/examples/adaptive/TestAutoLearnModel.java | 81 + .../adaptive/TestAutoLearnModelCreator.java | 56 + .../examples/adaptive/TestAutoLearnTSLUseCase.java | 187 + .../apex/examples/adaptive/package-info.java | 27 + .../src/test/resources/META-INF/persistence.xml | 69 + examples/myfirstpolicy/pom.xml | 109 + .../myfirstpolicy/model/MFPDomainModelFactory.java | 86 + .../myfirstpolicy/model/MFPDomainModelSaver.java | 62 + .../examples/myfirstpolicy/model/package-info.java | 27 + .../resources/SampleData/csv/AssistantInput.csv | 7 + .../main/resources/SampleData/csv/BranchInput.csv | 8 + .../main/resources/SampleData/csv/ItemInput.csv | 6 + .../main/resources/SampleData/csv/SalesInput.csv | 45 + .../main/resources/SampleData/sql/apex_sales.sql | 232 + .../src/main/resources/SampleData/sql/readme.txt | 31 + .../1/EventIn_BoozeItem_084106GMT.json | 12 + .../1/EventIn_BoozeItem_201713GMT.json | 12 + .../1/EventIn_NonBoozeItem_101309GMT.json | 13 + .../1/EventOut_BoozeItem_084106GMT.json | 17 + .../1/EventOut_BoozeItem_201713GMT.json | 17 + .../1/EventOut_NonBoozeItem_101309GMT.json | 17 + .../events/MyFirstPolicy/1/EventsIn.json.txt | 37 + .../events/MyFirstPolicy/1/EventsOut.json.txt | 51 + .../2/EventIn_BoozeItem_101433CET_thurs.json | 12 + .../2/EventIn_BoozeItem_171937CET_sun.json | 13 + .../2/EventIn_NonBoozeItem_111309CET_mon.json | 13 + .../2/EventOut_BoozeItem_101433CET_thurs.json | 17 + .../2/EventOut_BoozeItem_171937CET_sun.json | 17 + .../2/EventOut_NonBoozeItem_111309CET_mon.json | 17 + .../events/MyFirstPolicy/2/EventsIn.json.txt | 75 + .../events/MyFirstPolicy/2/EventsOut.json.txt | 102 + .../models/MyFirstPolicy/1/MorningBoozeCheck.js | 79 + .../models/MyFirstPolicy/1/MorningBoozeCheck.mvel | 80 + .../1/MyFirstPolicyModel_0.0.1.alt.json | 974 ++ .../MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex | 178 + .../MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json | 974 ++ .../models/MyFirstPolicy/2/MorningBoozeCheck.mvel | 76 + .../MyFirstPolicy/2/MorningBoozeCheckAlt1.mvel | 82 + .../MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex | 333 + .../MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json | 1213 +++ .../2/MyFirstPolicy_BoozeAuthDecideTSL.js | 48 + .../MyFirstPolicyConfigStdin2StdoutJsonEvent.json | 46 + .../MyFirstPolicyConfigWs2WsServerJsonEvent.json | 50 + .../MyFirstPolicyConfigStdin2StdoutJsonEvent.json | 46 + .../MyFirstPolicyConfigWs2WsServerJsonEvent.json | 50 + .../apex/examples/myfirstpolicy/TestMFPLogic.java | 183 + .../apex/examples/myfirstpolicy/TestMFPModel.java | 106 + .../examples/myfirstpolicy/TestMFPModelCLI.java | 96 + .../myfirstpolicy/TestMFPModelCreator.java | 106 + .../examples/myfirstpolicy/TestMFPUseCase.java | 331 + .../myfirstpolicy/TestSaleAuthListener.java | 93 + .../src/test/resources/META-INF/persistence.xml | 69 + .../src/test/resources/logback-test.xml | 74 + examples/pcvs/pom.xml | 106 + .../pcvs/model/PCVSDomainModelFactory.java | 72 + .../examples/pcvs/model/PCVSDomainModelSaver.java | 57 + .../apex/examples/pcvs/model/package-info.java | 30 + .../examples/config/pcvs/vpnsla/kafka2kafka.json | 69 + .../examples/config/pcvs/vpnsla/stdin2stdout.json | 51 + .../examples/events/pcvs/vpnsla/CtxtCustomers.json | 28 + .../examples/events/pcvs/vpnsla/CtxtEdges.json | 120 + .../examples/events/pcvs/vpnsla/CtxtNodes.json | 101 + .../events/pcvs/vpnsla/Trigger_Edge09.json | 50 + .../examples/scripts/pcvs/vpnsla/LinkMonitor.py | 214 + .../scripts/pcvs/vpnsla/MininetTopology.py | 216 + .../examples/scripts/pcvs/vpnsla/configure.sh | 23 + .../resources/examples/scripts/pcvs/vpnsla/env.sh | 23 + .../examples/scripts/pcvs/vpnsla/start-apex.sh | 21 + .../scripts/pcvs/vpnsla/start-floodlight.sh | 21 + .../examples/scripts/pcvs/vpnsla/start-kafka-zk.sh | 21 + .../scripts/pcvs/vpnsla/start-linkmonitor.sh | 21 + .../examples/scripts/pcvs/vpnsla/start-mininet.sh | 21 + .../examples/scripts/pcvs/vpnsla/streams/a1.sh | 33 + .../examples/scripts/pcvs/vpnsla/streams/a2.sh | 22 + .../examples/scripts/pcvs/vpnsla/streams/b1.sh | 33 + .../examples/scripts/pcvs/vpnsla/streams/b2.sh | 22 + .../apex/examples/pcvs/vpnsla/avro/customers.avsc | 16 + .../apex/examples/pcvs/vpnsla/avro/decision.avsc | 22 + .../examples/pcvs/vpnsla/avro/link-status.avsc | 8 + .../apex/examples/pcvs/vpnsla/avro/problems.avsc | 34 + .../apex/examples/pcvs/vpnsla/avro/situation.avsc | 8 + .../examples/pcvs/vpnsla/avro/topology-edges.avsc | 10 + .../examples/pcvs/vpnsla/avro/topology-nodes.avsc | 8 + .../examples/pcvs/vpnsla/logic/ctxt-customer.js | 80 + .../apex/examples/pcvs/vpnsla/logic/ctxt-edges.js | 65 + .../apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js | 63 + .../apex/examples/pcvs/vpnsla/logic/task-act.js | 69 + .../examples/pcvs/vpnsla/logic/task-decide-none.js | 58 + .../pcvs/vpnsla/logic/task-decide-priority.js | 76 + .../examples/pcvs/vpnsla/logic/task-decide-sla.js | 83 + .../pcvs/vpnsla/logic/task-decide-solved.js | 63 + .../examples/pcvs/vpnsla/logic/task-establish.js | 170 + .../apex/examples/pcvs/vpnsla/logic/task-match.js | 80 + .../apex/examples/pcvs/vpnsla/logic/tsl-decide.js | 58 + .../policy/apex/examples/pcvs/vpnsla/vpnsla.apex | 325 + .../src/test/resources/META-INF/persistence.xml | 69 + examples/pcvs/src/test/resources/logback-test.xml | 74 + .../examples/pcvs/vpnsla/config/stdin2stdout.json | 51 + examples/pom.xml | 43 + packages/apex-pdp-package-full/pom.xml | 58 + pom.xml | 3 +- 167 files changed, 25772 insertions(+), 1 deletion(-) create mode 100644 examples/aadm/pom.xml create mode 100644 examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java create mode 100644 examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java create mode 100644 examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java create mode 100644 examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/package-info.java create mode 100644 examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java create mode 100644 examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java create mode 100644 examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/package-info.java create mode 100644 examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/package-info.java create mode 100644 examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent.xml create mode 100644 examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent0.json create mode 100644 examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent1.json create mode 100644 examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent2.json create mode 100644 examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent3.json create mode 100644 examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent4.json create mode 100644 examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent5.json create mode 100644 examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent6.json create mode 100644 examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent7.json create mode 100644 examples/aadm/src/main/resources/examples/events/AADM/AADMTestPeridociEvent.json create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTask_TaskLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskSelectionLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTask_TaskLogic.mvel create mode 100644 examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel create mode 100644 examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java create mode 100644 examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java create mode 100644 examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java create mode 100644 examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java create mode 100644 examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java create mode 100644 examples/aadm/src/test/resources/META-INF/persistence.xml create mode 100644 examples/aadm/src/test/resources/logback-test.xml create mode 100644 examples/adaptive/pom.xml create mode 100644 examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java create mode 100644 examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java create mode 100644 examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/package-info.java create mode 100644 examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java create mode 100644 examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java create mode 100644 examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java create mode 100644 examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicy_Decide_TaskSelectionLogic.java create mode 100644 examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/package-info.java create mode 100644 examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/package-info.java create mode 100644 examples/adaptive/src/main/resources/examples/events/Adaptive/AnomalyDetectionEvents.json create mode 100644 examples/adaptive/src/main/resources/examples/events/Adaptive/AutoLearnEvents.json create mode 100644 examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel create mode 100644 examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel create mode 100644 examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel create mode 100644 examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel create mode 100644 examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel create mode 100644 examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel create mode 100644 examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel create mode 100644 examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAnomalyDetectionTask_Logic.mvel create mode 100644 examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAutoLearnTask_Logic.mvel create mode 100644 examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultState_Logic.mvel create mode 100644 examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java create mode 100644 examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java create mode 100644 examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java create mode 100644 examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTSLUseCase.java create mode 100644 examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java create mode 100644 examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java create mode 100644 examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java create mode 100644 examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java create mode 100644 examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTSLUseCase.java create mode 100644 examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/package-info.java create mode 100644 examples/adaptive/src/test/resources/META-INF/persistence.xml create mode 100644 examples/myfirstpolicy/pom.xml create mode 100644 examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelFactory.java create mode 100644 examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java create mode 100644 examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/package-info.java create mode 100644 examples/myfirstpolicy/src/main/resources/SampleData/csv/AssistantInput.csv create mode 100644 examples/myfirstpolicy/src/main/resources/SampleData/csv/BranchInput.csv create mode 100644 examples/myfirstpolicy/src/main/resources/SampleData/csv/ItemInput.csv create mode 100644 examples/myfirstpolicy/src/main/resources/SampleData/csv/SalesInput.csv create mode 100644 examples/myfirstpolicy/src/main/resources/SampleData/sql/apex_sales.sql create mode 100644 examples/myfirstpolicy/src/main/resources/SampleData/sql/readme.txt create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsIn.json.txt create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsOut.json.txt create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_101433CET_thurs.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_171937CET_sun.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_NonBoozeItem_111309CET_mon.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_101433CET_thurs.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_171937CET_sun.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_NonBoozeItem_111309CET_mon.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsIn.json.txt create mode 100644 examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsOut.json.txt create mode 100644 examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.js create mode 100644 examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.mvel create mode 100644 examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex create mode 100644 examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheck.mvel create mode 100644 examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheckAlt1.mvel create mode 100644 examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex create mode 100644 examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json create mode 100644 examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicy_BoozeAuthDecideTSL.js create mode 100644 examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json create mode 100644 examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json create mode 100644 examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json create mode 100644 examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json create mode 100644 examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPLogic.java create mode 100644 examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java create mode 100644 examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCLI.java create mode 100644 examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCreator.java create mode 100644 examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java create mode 100644 examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java create mode 100644 examples/myfirstpolicy/src/test/resources/META-INF/persistence.xml create mode 100644 examples/myfirstpolicy/src/test/resources/logback-test.xml create mode 100644 examples/pcvs/pom.xml create mode 100644 examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java create mode 100644 examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java create mode 100644 examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java create mode 100644 examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json create mode 100644 examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json create mode 100644 examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json create mode 100644 examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json create mode 100644 examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json create mode 100644 examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh create mode 100644 examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js create mode 100644 examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex create mode 100644 examples/pcvs/src/test/resources/META-INF/persistence.xml create mode 100644 examples/pcvs/src/test/resources/logback-test.xml create mode 100644 examples/pcvs/src/test/resources/org/onap/policy/apex/examples/pcvs/vpnsla/config/stdin2stdout.json create mode 100644 examples/pom.xml diff --git a/examples/aadm/pom.xml b/examples/aadm/pom.xml new file mode 100644 index 000000000..d85b52b3b --- /dev/null +++ b/examples/aadm/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + + org.onap.policy.apex-pdp.examples + examples + 2.0.0-SNAPSHOT + + + aadm + ${project.artifactId} + Specific code for the Apex AADM Example + + + + org.onap.policy.apex-pdp.model + policy-model + ${project.version} + + + org.onap.policy.apex-pdp.core + core-engine + ${project.version} + test + + + org.onap.policy.apex-pdp.core + core-infrastructure + ${project.version} + test + + + org.onap.policy.apex-pdp.plugins.plugins-executor + plugins-executor-mvel + ${project.version} + test + + + org.apache.derby + derby + ${version.derby} + test + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + generate-models + process-classes + + exec + + + java + + -classpath + + + org.onap.policy.apex.examples.aadm.model.AADMDomainModelSaver + ${project.build.directory}/classes/examples/models/AADM + + + + + + + + \ No newline at end of file diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java new file mode 100644 index 000000000..13fbb1eca --- /dev/null +++ b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java @@ -0,0 +1,107 @@ +/*- + * ============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.examples.aadm.concepts; + +import java.io.Serializable; + +/** + * The Class ENodeBStatus holds the status of an eNodeB in the AADM domain. + */ +public class ENodeBStatus implements Serializable { + private static final long serialVersionUID = 2852523814242234172L; + + private final String eNodeB; + + private long dosCount = 0; + private boolean beingProbed = false; + + /** + * The Constructor initiates the status of the eNodeB. + * + * @param eNodeB the e node B + */ + public ENodeBStatus(final String eNodeB) { + this.eNodeB = eNodeB; + } + + /** + * Gets the eNodeB name. + * + * @return the eNodeB name + */ + public String getENodeB() { + return eNodeB; + } + + /** + * Gets the number of Denial Of Service incidents on the eNodeB. + * + * @return the number of Denial Of Service incidents on the eNodeB + */ + public long getDOSCount() { + return dosCount; + } + + /** + * Sets the number of Denial Of Service incidents on the eNodeB. + * + * @param incomingDosCount the number of Denial Of Service incidents on the eNodeB + */ + public void setDOSCount(final long incomingDosCount) { + this.dosCount = incomingDosCount; + } + + /** + * Increment DOS count. + * + * @return the long + */ + public long incrementDOSCount() { + return ++dosCount; + } + + /** + * Decrement DOS count. + * + * @return the long + */ + public long decrementDOSCount() { + return --dosCount; + } + + /** + * Gets the being probed. + * + * @return the being probed + */ + public boolean getBeingProbed() { + return beingProbed; + } + + /** + * Sets the being probed. + * + * @param beingProbed the being probed + */ + public void setBeingProbed(final boolean beingProbed) { + this.beingProbed = beingProbed; + } +} diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java new file mode 100644 index 000000000..f59e982b0 --- /dev/null +++ b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java @@ -0,0 +1,175 @@ +/*- + * ============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.examples.aadm.concepts; + +import java.io.Serializable; + +/** + * The Class IMSIStatus holds the status of an IMSI in the AADM domain. + */ +public class IMSIStatus implements Serializable { + private static final long serialVersionUID = 2852523814242234172L; + + private static final long TIME_NOT_SET = 0; + + private final String imsi; + + private boolean anomalous = false; + private long anomalousTime = TIME_NOT_SET; + private String eNodeBID; + private long blackListedTime = TIME_NOT_SET; + private long blockingCount = 0; + + /** + * Initiate an IMSI status instance with an IMSI value. + * + * @param imsi the IMSI value + */ + public IMSIStatus(final String imsi) { + this.imsi = imsi; + } + + /** + * Gets the IMSI value. + * + * @return the IMSI value + */ + public String getIMSI() { + return imsi; + } + + /** + * Gets the anomalous flag. + * + * @return the anomalous flag + */ + public boolean getAnomalous() { + return anomalous; + } + + /** + * Sets the anomalous flag. + * + * @param anomalous the anomalous flag + */ + public void setAnomalous(final boolean anomalous) { + this.anomalous = anomalous; + } + + /** + * Gets the time of the most recent anomolous event. + * + * @return the time of the most recent anomolous event + */ + public long getAnomolousTime() { + return anomalousTime; + } + + /** + * Sets the time of the most recent anomolous event. + * + * @param incomingAnomalousTime the time of the most recent anomolous event + */ + public void setAnomolousTime(final long incomingAnomalousTime) { + this.anomalousTime = incomingAnomalousTime; + } + + /** + * Gets the eNodeB ID to which the IMSI is attached. + * + * @return theeNodeB ID to which the IMSI is attached + */ + public String getENodeBID() { + return eNodeBID; + } + + /** + * Sets the eNodeB ID to which the IMSI is attached. + * + * @param incomingENodeBID the eNodeB ID to which the IMSI is attached + */ + public void setENodeBID(final String incomingENodeBID) { + this.eNodeBID = incomingENodeBID; + } + + /** + * Checks if the eNodeB ID to which the IMSI is attached is set. + * + * @return true, if eNodeB ID to which the IMSI is attached is set + */ + public boolean checkSetENodeBID() { + return (eNodeBID != null); + } + + /** + * Gets the time at which the IMSI was blacklisted. + * + * @return the time at which the IMSI was blacklisted + */ + public long getBlacklistedTime() { + return blackListedTime; + } + + /** + * Sets the time at which the IMSI was blacklisted. + * + * @param incomingBlackListedTime the time at which the IMSI was blacklisted + */ + public void setBlacklistedTime(final long incomingBlackListedTime) { + this.blackListedTime = incomingBlackListedTime; + } + + /** + * Gets the number of times this IMSI was blocked. + * + * @return the number of times this IMSI was blocked + */ + public long getBlockingCount() { + return blockingCount; + } + + /** + * Sets the number of times this IMSI was blocked. + * + * @param blockingCount the number of times this IMSI was blocked + */ + public void setBlockingCount(final long blockingCount) { + this.blockingCount = blockingCount; + } + + /** + * Increment the number of times this IMSI was blocked. + * + * @return the incremented number of times this IMSI was blocked + */ + public long incrementBlockingCount() { + return ++blockingCount; + } + + /** + * Decrement the number of times this IMSI was blocked. + * + * @return the decremented number of times this IMSI was blocked + */ + public long decrementBlockingCount() { + return --blockingCount; + } +} diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java new file mode 100644 index 000000000..fc3780f17 --- /dev/null +++ b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java @@ -0,0 +1,79 @@ +/*- + * ============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.examples.aadm.concepts; + +import java.io.Serializable; + +/** + * The Class IPAddressStatus holds the status of an IP address in the AADM domain. + */ +public class IPAddressStatus implements Serializable { + private static final long serialVersionUID = -7402022458317593252L; + + private final String ipAddress; + + private String imsi; + + /** + * The Constructor sets up the IP address status instance. + * + * @param ipAddress the ip address + */ + public IPAddressStatus(final String ipAddress) { + this.ipAddress = ipAddress; + } + + /** + * Gets the IP address. + * + * @return the IP address + */ + public String getIPAddress() { + return ipAddress; + } + + /** + * Gets the IMSI. + * + * @return the imsi + */ + public String getIMSI() { + return imsi; + } + + /** + * Sets the IMSI. + * + * @param incomingImsi the imsi + */ + public void setIMSI(final String incomingImsi) { + this.imsi = incomingImsi; + } + + /** + * Check set IMSI. + * + * @return true, if check set IMSI + */ + public boolean checkSetIMSI() { + return (imsi != null); + } +} diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/package-info.java b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/package-info.java new file mode 100644 index 000000000..68e91457d --- /dev/null +++ b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/package-info.java @@ -0,0 +1,27 @@ +/*- + * ============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========================================================= + */ + +/** + * Provides Java types that are used in the AADM domain. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ + +package org.onap.policy.apex.examples.aadm.concepts; diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java new file mode 100644 index 000000000..b0cbf0c17 --- /dev/null +++ b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java @@ -0,0 +1,703 @@ +/*- + * ============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.examples.aadm.model; + +import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation; +import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; +import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; +import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; +import org.onap.policy.apex.model.eventmodel.concepts.AxField; +import org.onap.policy.apex.model.policymodel.concepts.AxLogicReader; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicies; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.model.policymodel.concepts.AxState; +import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput; +import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType; +import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference; +import org.onap.policy.apex.model.policymodel.concepts.AxTask; +import org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic; +import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic; +import org.onap.policy.apex.model.policymodel.concepts.AxTasks; +import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader; + +/** + * The Class AADMDomainModelFactory. + */ +public class AADMDomainModelFactory { + /** + * Gets the AADM policy model. + * + * @return the AADM policy model + */ + // CHECKSTYLE:OFF: checkstyle + public AxPolicyModel getAADMPolicyModel() { + // CHECKSTYLE:ON: checkstyle + // Data types for event parameters + final AxContextSchema imsi = new AxContextSchema(new AxArtifactKey("IMSI", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema ueIPAddress = + new AxContextSchema(new AxArtifactKey("UEIPAddress", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema nwIPAddress = + new AxContextSchema(new AxArtifactKey("NWIPAddress", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema dosFlag = + new AxContextSchema(new AxArtifactKey("DOSFlag", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema roundTripTime = + new AxContextSchema(new AxArtifactKey("RoundTripTime", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema applicationName = + new AxContextSchema(new AxArtifactKey("ApplicationName", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema protocolGroup = + new AxContextSchema(new AxArtifactKey("ProtocolGroup", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema eNodeBID = + new AxContextSchema(new AxArtifactKey("ENodeBID", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema httpHostClass = + new AxContextSchema(new AxArtifactKey("HttpHostClass", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema tcpOnFlag = + new AxContextSchema(new AxArtifactKey("TCPOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema probeOnFlag = + new AxContextSchema(new AxArtifactKey("ProbeOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema blacklistOnFlag = + new AxContextSchema(new AxArtifactKey("BlacklistOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema averageThroughput = + new AxContextSchema(new AxArtifactKey("AverageThroughput", "0.0.1"), "Java", "java.lang.Double"); + final AxContextSchema serviceRequestCount = + new AxContextSchema(new AxArtifactKey("ServiceRequestCount", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema attchCount = + new AxContextSchema(new AxArtifactKey("AttachCount", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema subscriberCount = + new AxContextSchema(new AxArtifactKey("SubscriberCount", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema averageServiceRequest = + new AxContextSchema(new AxArtifactKey("AverageServiceRequest", "0.0.1"), "Java", "java.lang.Double"); + final AxContextSchema averageAttach = + new AxContextSchema(new AxArtifactKey("AverageAttach", "0.0.1"), "Java", "java.lang.Double"); + final AxContextSchema actionTask = + new AxContextSchema(new AxArtifactKey("ActionTask", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema version = + new AxContextSchema(new AxArtifactKey("Version", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema profile = + new AxContextSchema(new AxArtifactKey("Profile", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema threshold = + new AxContextSchema(new AxArtifactKey("Threshold", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema triggerSpec = + new AxContextSchema(new AxArtifactKey("TriggerSpec", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema periodicEventCount = + new AxContextSchema(new AxArtifactKey("PeriodicEventCount", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema periodicDelay = + new AxContextSchema(new AxArtifactKey("PeriodicDelay", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema periodicTime = + new AxContextSchema(new AxArtifactKey("PeriodicTime", "0.0.1"), "Java", "java.lang.Long"); + + final AxContextSchemas aadmContextSchemas = new AxContextSchemas(new AxArtifactKey("AADMDatatypes", "0.0.1")); + aadmContextSchemas.getSchemasMap().put(imsi.getKey(), imsi); + aadmContextSchemas.getSchemasMap().put(ueIPAddress.getKey(), ueIPAddress); + aadmContextSchemas.getSchemasMap().put(nwIPAddress.getKey(), nwIPAddress); + aadmContextSchemas.getSchemasMap().put(dosFlag.getKey(), dosFlag); + aadmContextSchemas.getSchemasMap().put(roundTripTime.getKey(), roundTripTime); + aadmContextSchemas.getSchemasMap().put(applicationName.getKey(), applicationName); + aadmContextSchemas.getSchemasMap().put(protocolGroup.getKey(), protocolGroup); + aadmContextSchemas.getSchemasMap().put(eNodeBID.getKey(), eNodeBID); + aadmContextSchemas.getSchemasMap().put(httpHostClass.getKey(), httpHostClass); + aadmContextSchemas.getSchemasMap().put(tcpOnFlag.getKey(), tcpOnFlag); + aadmContextSchemas.getSchemasMap().put(probeOnFlag.getKey(), probeOnFlag); + aadmContextSchemas.getSchemasMap().put(blacklistOnFlag.getKey(), blacklistOnFlag); + aadmContextSchemas.getSchemasMap().put(averageThroughput.getKey(), averageThroughput); + aadmContextSchemas.getSchemasMap().put(serviceRequestCount.getKey(), serviceRequestCount); + aadmContextSchemas.getSchemasMap().put(attchCount.getKey(), attchCount); + aadmContextSchemas.getSchemasMap().put(subscriberCount.getKey(), subscriberCount); + aadmContextSchemas.getSchemasMap().put(averageServiceRequest.getKey(), averageServiceRequest); + aadmContextSchemas.getSchemasMap().put(averageAttach.getKey(), averageAttach); + aadmContextSchemas.getSchemasMap().put(actionTask.getKey(), actionTask); + aadmContextSchemas.getSchemasMap().put(version.getKey(), version); + aadmContextSchemas.getSchemasMap().put(profile.getKey(), profile); + aadmContextSchemas.getSchemasMap().put(threshold.getKey(), threshold); + aadmContextSchemas.getSchemasMap().put(triggerSpec.getKey(), triggerSpec); + aadmContextSchemas.getSchemasMap().put(periodicEventCount.getKey(), periodicEventCount); + aadmContextSchemas.getSchemasMap().put(periodicDelay.getKey(), periodicDelay); + aadmContextSchemas.getSchemasMap().put(periodicTime.getKey(), periodicTime); + + final AxEvent aadmEvent = + new AxEvent(new AxArtifactKey("AADMEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); + aadmEvent.setSource("External"); + aadmEvent.setTarget("Apex"); + aadmEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI"), imsi.getKey())); + aadmEvent.getParameterMap().put("ENODEB_ID", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); + aadmEvent.getParameterMap().put("IMSI_IP", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); + aadmEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); + aadmEvent.getParameterMap().put("DoS", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "DoS"), dosFlag.getKey())); + aadmEvent.getParameterMap().put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", new AxField( + new AxReferenceKey(aadmEvent.getKey(), "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX"), roundTripTime.getKey())); + aadmEvent.getParameterMap().put("TCP_UE_SIDE_AVG_THROUGHPUT", new AxField( + new AxReferenceKey(aadmEvent.getKey(), "TCP_UE_SIDE_AVG_THROUGHPUT"), averageThroughput.getKey())); + aadmEvent.getParameterMap().put("APPLICATION", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "APPLICATION"), applicationName.getKey())); + aadmEvent.getParameterMap().put("protocol_group", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "protocol_group"), protocolGroup.getKey())); + aadmEvent.getParameterMap().put("http_host_class", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "http_host_class"), httpHostClass.getKey())); + aadmEvent.getParameterMap().put("PROBE_ON", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); + aadmEvent.getParameterMap().put("TCP_ON", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); + aadmEvent.getParameterMap().put("SGW_IP_ADDRESS", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "SGW_IP_ADDRESS"), nwIPAddress.getKey())); + aadmEvent.getParameterMap().put("UE_IP_ADDRESS", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "UE_IP_ADDRESS"), ueIPAddress.getKey())); + aadmEvent.getParameterMap().put("SERVICE_REQUEST_COUNT", new AxField( + new AxReferenceKey(aadmEvent.getKey(), "SERVICE_REQUEST_COUNT"), serviceRequestCount.getKey())); + aadmEvent.getParameterMap().put("ATTACH_COUNT", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "ATTACH_COUNT"), attchCount.getKey())); + aadmEvent.getParameterMap().put("NUM_SUBSCRIBERS", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "NUM_SUBSCRIBERS"), subscriberCount.getKey())); + aadmEvent.getParameterMap().put("AVG_SUBSCRIBER_SERVICE_REQUEST", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "AVG_SUBSCRIBER_SERVICE_REQUEST"), + averageServiceRequest.getKey())); + aadmEvent.getParameterMap().put("AVG_SUBSCRIBER_ATTACH", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "AVG_SUBSCRIBER_ATTACH"), averageAttach.getKey())); + aadmEvent.getParameterMap().put("ACTTASK", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "ACTTASK"), actionTask.getKey())); + + final AxEvent aadmXStreamActEvent = new AxEvent(new AxArtifactKey("XSTREAM_AADM_ACT_EVENT", "0.0.1"), + "org.onap.policy.apex.examples.aadm.events"); + aadmXStreamActEvent.setSource("Apex"); + aadmXStreamActEvent.setTarget("External"); + aadmXStreamActEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI"), imsi.getKey())); + aadmXStreamActEvent.getParameterMap().put("IMSI_IP", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); + aadmXStreamActEvent.getParameterMap().put("ENODEB_ID", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); + aadmXStreamActEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); + aadmXStreamActEvent.getParameterMap().put("ACTTASK", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ACTTASK"), actionTask.getKey())); + aadmXStreamActEvent.getParameterMap().put("PROBE_ON", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); + aadmXStreamActEvent.getParameterMap().put("TCP_ON", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); + aadmXStreamActEvent.getParameterMap().put("VERSION", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "VERSION"), version.getKey())); + aadmXStreamActEvent.getParameterMap().put("TRIGGER_SPEC", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "TRIGGER_SPEC"), triggerSpec.getKey())); + aadmXStreamActEvent.getParameterMap().put("MAJ_MIN_MAINT_VERSION", new AxField( + new AxReferenceKey(aadmXStreamActEvent.getKey(), "MAJ_MIN_MAINT_VERSION"), version.getKey())); + aadmXStreamActEvent.getParameterMap().put("BLACKLIST_ON", new AxField( + new AxReferenceKey(aadmXStreamActEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); + aadmXStreamActEvent.getParameterMap().put("PROFILE", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "PROFILE"), profile.getKey())); + aadmXStreamActEvent.getParameterMap().put("THRESHOLD", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "THRESHOLD"), threshold.getKey())); + + final AxEvent vMMEEvent = + new AxEvent(new AxArtifactKey("VMMEEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); + vMMEEvent.setSource("External"); + vMMEEvent.setTarget("Apex"); + vMMEEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(vMMEEvent.getKey(), "IMSI"), imsi.getKey())); + vMMEEvent.getParameterMap().put("ENODEB_ID", + new AxField(new AxReferenceKey(vMMEEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); + vMMEEvent.getParameterMap().put("IMSI_IP", + new AxField(new AxReferenceKey(vMMEEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); + vMMEEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(vMMEEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); + vMMEEvent.getParameterMap().put("PROFILE", + new AxField(new AxReferenceKey(vMMEEvent.getKey(), "PROFILE"), profile.getKey())); + vMMEEvent.getParameterMap().put("THRESHOLD", + new AxField(new AxReferenceKey(vMMEEvent.getKey(), "THRESHOLD"), threshold.getKey())); + + final AxEvent sapcEvent = + new AxEvent(new AxArtifactKey("SAPCEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); + sapcEvent.setSource("External"); + sapcEvent.setTarget("Apex"); + sapcEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI"), imsi.getKey())); + sapcEvent.getParameterMap().put("ENODEB_ID", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); + sapcEvent.getParameterMap().put("IMSI_IP", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); + sapcEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); + sapcEvent.getParameterMap().put("PROFILE", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "PROFILE"), profile.getKey())); + sapcEvent.getParameterMap().put("THRESHOLD", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "THRESHOLD"), threshold.getKey())); + sapcEvent.getParameterMap().put("TCP_ON", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); + sapcEvent.getParameterMap().put("PROBE_ON", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); + sapcEvent.getParameterMap().put("VERSION", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "VERSION"), version.getKey())); + sapcEvent.getParameterMap().put("BLACKLIST_ON", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); + + final AxEvent sapcBlacklistSubscriberEvent = + new AxEvent(new AxArtifactKey("SAPCBlacklistSubscriberEvent", "0.0.1"), + "org.onap.policy.apex.examples.aadm.events"); + sapcBlacklistSubscriberEvent.setSource("Apex"); + sapcBlacklistSubscriberEvent.setTarget("External"); + sapcBlacklistSubscriberEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI"), imsi.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("PROFILE", + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "PROFILE"), profile.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("BLACKLIST_ON", new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("IMSI_IP", new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("PROBE_ON", new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("TCP_ON", + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); + + final AxEvent periodicEvent = + new AxEvent(new AxArtifactKey("PeriodicEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); + periodicEvent.setSource("System"); + periodicEvent.setTarget("Apex"); + periodicEvent.getParameterMap().put("PERIODIC_EVENT_COUNT", new AxField( + new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_EVENT_COUNT"), periodicEventCount.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_DELAY", + new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_DELAY"), periodicDelay.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_FIRST_TIME", + new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_FIRST_TIME"), periodicTime.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_CURRENT_TIME", new AxField( + new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_CURRENT_TIME"), periodicTime.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_LAST_TIME", + new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_LAST_TIME"), periodicTime.getKey())); + + final AxEvents aadmEvents = new AxEvents(new AxArtifactKey("AADMEvents", "0.0.1")); + aadmEvents.getEventMap().put(aadmEvent.getKey(), aadmEvent); + aadmEvents.getEventMap().put(aadmXStreamActEvent.getKey(), aadmXStreamActEvent); + aadmEvents.getEventMap().put(vMMEEvent.getKey(), vMMEEvent); + aadmEvents.getEventMap().put(sapcEvent.getKey(), sapcEvent); + aadmEvents.getEventMap().put(sapcBlacklistSubscriberEvent.getKey(), sapcBlacklistSubscriberEvent); + aadmEvents.getEventMap().put(periodicEvent.getKey(), periodicEvent); + + // Data types for context + final AxContextSchema eNodeBStatus = new AxContextSchema(new AxArtifactKey("ENodeBStatus", "0.0.1"), "Java", + "org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus"); + final AxContextSchema imsiStatus = new AxContextSchema(new AxArtifactKey("IMSIStatus", "0.0.1"), "Java", + "org.onap.policy.apex.examples.aadm.concepts.IMSIStatus"); + final AxContextSchema ipAddressStatus = new AxContextSchema(new AxArtifactKey("IPAddressStatus", "0.0.1"), + "Java", "org.onap.policy.apex.examples.aadm.concepts.IPAddressStatus"); + aadmContextSchemas.getSchemasMap().put(eNodeBStatus.getKey(), eNodeBStatus); + aadmContextSchemas.getSchemasMap().put(imsiStatus.getKey(), imsiStatus); + aadmContextSchemas.getSchemasMap().put(ipAddressStatus.getKey(), ipAddressStatus); + + // Three context albums for AADM + final AxContextAlbum eNodeBStatusAlbum = new AxContextAlbum(new AxArtifactKey("ENodeBStatusAlbum", "0.0.1"), + "APPLICATION", true, eNodeBStatus.getKey()); + final AxContextAlbum imsiStatusAlbum = new AxContextAlbum(new AxArtifactKey("IMSIStatusAlbum", "0.0.1"), + "APPLICATION", true, imsiStatus.getKey()); + final AxContextAlbum ipAddressStatusAlbum = new AxContextAlbum( + new AxArtifactKey("IPAddressStatusAlbum", "0.0.1"), "APPLICATION", true, ipAddressStatus.getKey()); + + final AxContextAlbums aadmAlbums = new AxContextAlbums(new AxArtifactKey("AADMContext", "0.0.1")); + aadmAlbums.getAlbumsMap().put(eNodeBStatusAlbum.getKey(), eNodeBStatusAlbum); + aadmAlbums.getAlbumsMap().put(imsiStatusAlbum.getKey(), imsiStatusAlbum); + aadmAlbums.getAlbumsMap().put(ipAddressStatusAlbum.getKey(), ipAddressStatusAlbum); + + // Tasks + final AxLogicReader logicReader = + new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName()).setDefaultLogic(null); + + final AxTask aadmMatchTask = new AxTask(new AxArtifactKey("AADMMatchTask", "0.0.1")); + aadmMatchTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmMatchTask.duplicateOutputFields(aadmEvent.getParameterMap()); + aadmMatchTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); + aadmMatchTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + aadmMatchTask.getContextAlbumReferences().add(ipAddressStatusAlbum.getKey()); + aadmMatchTask.setTaskLogic(new AxTaskLogic(aadmMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask aadmEstablishTask = new AxTask(new AxArtifactKey("AADMEstablishTask", "0.0.1")); + aadmEstablishTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmEstablishTask.duplicateOutputFields(aadmEvent.getParameterMap()); + logicReader.setDefaultLogic("Default_TaskLogic"); + aadmEstablishTask.setTaskLogic(new AxTaskLogic(aadmEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask aadmDecideTask = new AxTask(new AxArtifactKey("AADMDecideTask", "0.0.1")); + aadmDecideTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmDecideTask.duplicateOutputFields(aadmEvent.getParameterMap()); + aadmDecideTask.setTaskLogic(new AxTaskLogic(aadmDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + logicReader.setDefaultLogic(null); + + final AxTask aadmDoSSuggestionActTask = new AxTask(new AxArtifactKey("AADMDoSSuggestionActTask", "0.0.1")); + aadmDoSSuggestionActTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmDoSSuggestionActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); + aadmDoSSuggestionActTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); + aadmDoSSuggestionActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + aadmDoSSuggestionActTask + .setTaskLogic(new AxTaskLogic(aadmDoSSuggestionActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask aadmNoActTask = new AxTask(new AxArtifactKey("AADMNoActTask", "0.0.1")); + aadmNoActTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmNoActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); + aadmNoActTask.setTaskLogic(new AxTaskLogic(aadmNoActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask aadmDoSProvenActTask = new AxTask(new AxArtifactKey("AADMDoSProvenActTask", "0.0.1")); + aadmDoSProvenActTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmDoSProvenActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); + aadmDoSProvenActTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); + aadmDoSProvenActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + aadmDoSProvenActTask + .setTaskLogic(new AxTaskLogic(aadmDoSProvenActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask vMMEMatchTask = new AxTask(new AxArtifactKey("VMMEMatchTask", "0.0.1")); + vMMEMatchTask.duplicateInputFields(vMMEEvent.getParameterMap()); + vMMEMatchTask.duplicateOutputFields(vMMEEvent.getParameterMap()); + vMMEMatchTask.setTaskLogic(new AxTaskLogic(vMMEMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask vMMEEstablishTask = new AxTask(new AxArtifactKey("VMMEEstablishTask", "0.0.1")); + vMMEEstablishTask.duplicateInputFields(vMMEEvent.getParameterMap()); + vMMEEstablishTask.duplicateOutputFields(vMMEEvent.getParameterMap()); + logicReader.setDefaultLogic("Default_TaskLogic"); + vMMEEstablishTask.setTaskLogic(new AxTaskLogic(vMMEEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask vMMEDecideTask = new AxTask(new AxArtifactKey("VMMEDecideTask", "0.0.1")); + vMMEDecideTask.duplicateInputFields(vMMEEvent.getParameterMap()); + vMMEDecideTask.duplicateOutputFields(vMMEEvent.getParameterMap()); + vMMEDecideTask.setTaskLogic(new AxTaskLogic(vMMEDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask vMMENoActTask = new AxTask(new AxArtifactKey("VMMENoActTask", "0.0.1")); + vMMENoActTask.duplicateInputFields(vMMEEvent.getParameterMap()); + vMMENoActTask.duplicateOutputFields(vMMEEvent.getParameterMap()); + vMMENoActTask.setTaskLogic(new AxTaskLogic(vMMENoActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask vMMEActTask = new AxTask(new AxArtifactKey("VMMEActTask", "0.0.1")); + vMMEActTask.duplicateInputFields(vMMEEvent.getParameterMap()); + vMMEActTask.duplicateOutputFields(vMMEEvent.getParameterMap()); + logicReader.setDefaultLogic(null); + vMMEActTask.setTaskLogic(new AxTaskLogic(vMMEActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask sapcMatchTask = new AxTask(new AxArtifactKey("SAPCMatchTask", "0.0.1")); + sapcMatchTask.duplicateInputFields(sapcEvent.getParameterMap()); + sapcMatchTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); + sapcMatchTask.setTaskLogic(new AxTaskLogic(sapcMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask sapcEstablishTask = new AxTask(new AxArtifactKey("SAPCEstablishTask", "0.0.1")); + sapcEstablishTask.duplicateInputFields(sapcEvent.getParameterMap()); + sapcEstablishTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); + logicReader.setDefaultLogic("Default_TaskLogic"); + sapcEstablishTask.setTaskLogic(new AxTaskLogic(sapcEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask sapcDecideTask = new AxTask(new AxArtifactKey("SAPCDecideTask", "0.0.1")); + sapcDecideTask.duplicateInputFields(sapcEvent.getParameterMap()); + sapcDecideTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); + sapcDecideTask.setTaskLogic(new AxTaskLogic(sapcDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask sapcActTask = new AxTask(new AxArtifactKey("SAPCActTask", "0.0.1")); + sapcActTask.duplicateInputFields(sapcEvent.getParameterMap()); + sapcActTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); + sapcActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + logicReader.setDefaultLogic(null); + sapcActTask.setTaskLogic(new AxTaskLogic(sapcActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + logicReader.setDefaultLogic("Default_TaskLogic"); + + final AxTask periodicMatchTask = new AxTask(new AxArtifactKey("PeriodicMatchTask", "0.0.1")); + periodicMatchTask.duplicateInputFields(periodicEvent.getParameterMap()); + periodicMatchTask.duplicateOutputFields(periodicEvent.getParameterMap()); + periodicMatchTask.setTaskLogic(new AxTaskLogic(periodicMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask periodicEstablishTask = new AxTask(new AxArtifactKey("PeriodicEstablishTask", "0.0.1")); + periodicEstablishTask.duplicateInputFields(periodicEvent.getParameterMap()); + periodicEstablishTask.duplicateOutputFields(periodicEvent.getParameterMap()); + periodicEstablishTask + .setTaskLogic(new AxTaskLogic(periodicEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask periodicDecideTask = new AxTask(new AxArtifactKey("PeriodicDecideTask", "0.0.1")); + periodicDecideTask.duplicateInputFields(periodicEvent.getParameterMap()); + periodicDecideTask.duplicateOutputFields(periodicEvent.getParameterMap()); + periodicDecideTask.setTaskLogic(new AxTaskLogic(periodicDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask periodicActTask = new AxTask(new AxArtifactKey("PeriodicActTask", "0.0.1")); + periodicActTask.duplicateInputFields(periodicEvent.getParameterMap()); + periodicActTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); + periodicActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + logicReader.setDefaultLogic(null); + periodicActTask.setTaskLogic(new AxTaskLogic(periodicActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTasks aadmTasks = new AxTasks(new AxArtifactKey("AADMTasks", "0.0.1")); + aadmTasks.getTaskMap().put(aadmMatchTask.getKey(), aadmMatchTask); + aadmTasks.getTaskMap().put(aadmEstablishTask.getKey(), aadmEstablishTask); + aadmTasks.getTaskMap().put(aadmDecideTask.getKey(), aadmDecideTask); + aadmTasks.getTaskMap().put(aadmDoSSuggestionActTask.getKey(), aadmDoSSuggestionActTask); + aadmTasks.getTaskMap().put(aadmNoActTask.getKey(), aadmNoActTask); + aadmTasks.getTaskMap().put(aadmDoSProvenActTask.getKey(), aadmDoSProvenActTask); + aadmTasks.getTaskMap().put(vMMEMatchTask.getKey(), vMMEMatchTask); + aadmTasks.getTaskMap().put(vMMEEstablishTask.getKey(), vMMEEstablishTask); + aadmTasks.getTaskMap().put(vMMEDecideTask.getKey(), vMMEDecideTask); + aadmTasks.getTaskMap().put(vMMENoActTask.getKey(), vMMENoActTask); + aadmTasks.getTaskMap().put(vMMEActTask.getKey(), vMMEActTask); + aadmTasks.getTaskMap().put(sapcMatchTask.getKey(), sapcMatchTask); + aadmTasks.getTaskMap().put(sapcEstablishTask.getKey(), sapcEstablishTask); + aadmTasks.getTaskMap().put(sapcDecideTask.getKey(), sapcDecideTask); + aadmTasks.getTaskMap().put(sapcActTask.getKey(), sapcActTask); + aadmTasks.getTaskMap().put(periodicMatchTask.getKey(), periodicMatchTask); + aadmTasks.getTaskMap().put(periodicEstablishTask.getKey(), periodicEstablishTask); + aadmTasks.getTaskMap().put(periodicDecideTask.getKey(), periodicDecideTask); + aadmTasks.getTaskMap().put(periodicActTask.getKey(), periodicActTask); + + // Policies + logicReader.setDefaultLogic(null); + + final AxPolicy aadmPolicy = new AxPolicy(new AxArtifactKey("AADMPolicy", "0.0.1")); + aadmPolicy.setTemplate("MEDA"); + + final AxState aadmActState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Act")); + aadmActState.setTrigger(aadmEvent.getKey()); + final AxStateOutput aadmAct2Out = + new AxStateOutput(aadmActState.getKey(), AxReferenceKey.getNullKey(), aadmXStreamActEvent.getKey()); + aadmActState.getStateOutputs().put(aadmAct2Out.getKey().getLocalName(), aadmAct2Out); + aadmActState.getContextAlbumReferences().add(ipAddressStatusAlbum.getKey()); + aadmActState.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + aadmActState.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); + aadmActState.setTaskSelectionLogic( + new AxTaskSelectionLogic(aadmActState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + aadmActState.setDefaultTask(aadmNoActTask.getKey()); + aadmActState.getTaskReferences().put(aadmNoActTask.getKey(), new AxStateTaskReference(aadmActState.getKey(), + aadmNoActTask.getKey(), AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); + aadmActState.getTaskReferences().put(aadmDoSSuggestionActTask.getKey(), + new AxStateTaskReference(aadmActState.getKey(), aadmDoSSuggestionActTask.getKey(), + AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); + aadmActState.getTaskReferences().put(aadmDoSProvenActTask.getKey(), + new AxStateTaskReference(aadmActState.getKey(), aadmDoSProvenActTask.getKey(), + AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); + + logicReader.setDefaultLogic("Default_TaskSelectionLogic"); + + final AxState aadmDecideState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Decide")); + aadmDecideState.setTrigger(aadmEvent.getKey()); + final AxStateOutput aadmDec2Act = + new AxStateOutput(aadmDecideState.getKey(), aadmActState.getKey(), aadmEvent.getKey()); + aadmDecideState.getStateOutputs().put(aadmDec2Act.getKey().getLocalName(), aadmDec2Act); + aadmDecideState.setTaskSelectionLogic( + new AxTaskSelectionLogic(aadmDecideState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + aadmDecideState.setDefaultTask(aadmDecideTask.getKey()); + aadmDecideState.getTaskReferences().put(aadmDecideTask.getKey(), new AxStateTaskReference( + aadmDecideState.getKey(), aadmDecideTask.getKey(), AxStateTaskOutputType.DIRECT, aadmDec2Act.getKey())); + + final AxState aadmEstablishState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Establish")); + aadmEstablishState.setTrigger(aadmEvent.getKey()); + final AxStateOutput aadmEst2Dec = + new AxStateOutput(aadmEstablishState.getKey(), aadmDecideState.getKey(), aadmEvent.getKey()); + aadmEstablishState.getStateOutputs().put(aadmEst2Dec.getKey().getLocalName(), aadmEst2Dec); + aadmEstablishState.setTaskSelectionLogic( + new AxTaskSelectionLogic(aadmEstablishState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + aadmEstablishState.setDefaultTask(aadmEstablishTask.getKey()); + aadmEstablishState.getTaskReferences().put(aadmEstablishTask.getKey(), + new AxStateTaskReference(aadmEstablishState.getKey(), aadmEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, aadmEst2Dec.getKey())); + + final AxState aadmMatchState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Match")); + aadmMatchState.setTrigger(aadmEvent.getKey()); + final AxStateOutput aadmMat2Est = + new AxStateOutput(aadmMatchState.getKey(), aadmEstablishState.getKey(), aadmEvent.getKey()); + aadmMatchState.getStateOutputs().put(aadmMat2Est.getKey().getLocalName(), aadmMat2Est); + aadmMatchState.setTaskSelectionLogic( + new AxTaskSelectionLogic(aadmMatchState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + aadmMatchState.setDefaultTask(aadmMatchTask.getKey()); + aadmMatchState.getTaskReferences().put(aadmMatchTask.getKey(), new AxStateTaskReference(aadmMatchState.getKey(), + aadmMatchTask.getKey(), AxStateTaskOutputType.DIRECT, aadmMat2Est.getKey())); + + aadmPolicy.setFirstState(aadmMatchState.getKey().getLocalName()); + aadmPolicy.getStateMap().put(aadmMatchState.getKey().getLocalName(), aadmMatchState); + aadmPolicy.getStateMap().put(aadmEstablishState.getKey().getLocalName(), aadmEstablishState); + aadmPolicy.getStateMap().put(aadmDecideState.getKey().getLocalName(), aadmDecideState); + aadmPolicy.getStateMap().put(aadmActState.getKey().getLocalName(), aadmActState); + + final AxPolicy vMMEPolicy = new AxPolicy(new AxArtifactKey("VMMEPolicy", "0.0.1")); + vMMEPolicy.setTemplate("MEDA"); + + final AxState vMMEActState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Act")); + vMMEActState.setTrigger(vMMEEvent.getKey()); + final AxStateOutput vMMEAct2Out = + new AxStateOutput(vMMEActState.getKey(), AxReferenceKey.getNullKey(), vMMEEvent.getKey()); + vMMEActState.getStateOutputs().put(vMMEAct2Out.getKey().getLocalName(), vMMEAct2Out); + vMMEActState.setDefaultTask(vMMEActTask.getKey()); + vMMEActState.getTaskReferences().put(vMMEActTask.getKey(), new AxStateTaskReference(vMMEActState.getKey(), + vMMEActTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEAct2Out.getKey())); + vMMEActState.getTaskReferences().put(vMMENoActTask.getKey(), new AxStateTaskReference(vMMEActState.getKey(), + vMMENoActTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEAct2Out.getKey())); + + final AxState vMMEDecideState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Decide")); + vMMEDecideState.setTrigger(vMMEEvent.getKey()); + final AxStateOutput vMMEDec2Act = + new AxStateOutput(vMMEDecideState.getKey(), vMMEActState.getKey(), vMMEEvent.getKey()); + vMMEDecideState.getStateOutputs().put(vMMEDec2Act.getKey().getLocalName(), vMMEDec2Act); + vMMEDecideState.setDefaultTask(vMMEDecideTask.getKey()); + vMMEDecideState.getTaskReferences().put(vMMEDecideTask.getKey(), new AxStateTaskReference( + vMMEDecideState.getKey(), vMMEDecideTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEDec2Act.getKey())); + + final AxState vMMEEstablishState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Establish")); + vMMEEstablishState.setTrigger(vMMEEvent.getKey()); + final AxStateOutput vMMEEst2Dec = + new AxStateOutput(vMMEEstablishState.getKey(), vMMEDecideState.getKey(), vMMEEvent.getKey()); + vMMEEstablishState.getStateOutputs().put(vMMEEst2Dec.getKey().getLocalName(), vMMEEst2Dec); + vMMEEstablishState.setDefaultTask(vMMEEstablishTask.getKey()); + vMMEEstablishState.getTaskReferences().put(vMMEEstablishTask.getKey(), + new AxStateTaskReference(vMMEEstablishState.getKey(), vMMEEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, vMMEEst2Dec.getKey())); + + final AxState vMMEMatchState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Match")); + vMMEMatchState.setTrigger(vMMEEvent.getKey()); + final AxStateOutput vMMEMat2Est = + new AxStateOutput(vMMEMatchState.getKey(), vMMEEstablishState.getKey(), vMMEEvent.getKey()); + vMMEMatchState.getStateOutputs().put(vMMEMat2Est.getKey().getLocalName(), vMMEMat2Est); + vMMEMatchState.setDefaultTask(vMMEMatchTask.getKey()); + vMMEMatchState.getTaskReferences().put(vMMEMatchTask.getKey(), new AxStateTaskReference(vMMEMatchState.getKey(), + vMMEMatchTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEMat2Est.getKey())); + + vMMEPolicy.setFirstState(vMMEMatchState.getKey().getLocalName()); + vMMEPolicy.getStateMap().put(vMMEMatchState.getKey().getLocalName(), vMMEMatchState); + vMMEPolicy.getStateMap().put(vMMEEstablishState.getKey().getLocalName(), vMMEEstablishState); + vMMEPolicy.getStateMap().put(vMMEDecideState.getKey().getLocalName(), vMMEDecideState); + vMMEPolicy.getStateMap().put(vMMEActState.getKey().getLocalName(), vMMEActState); + + final AxPolicy sapcPolicy = new AxPolicy(new AxArtifactKey("SAPCPolicy", "0.0.1")); + sapcPolicy.setTemplate("MEDA"); + + final AxState sapcActState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Act")); + sapcActState.setTrigger(sapcEvent.getKey()); + final AxStateOutput sapcAct2Out = new AxStateOutput(sapcActState.getKey(), AxReferenceKey.getNullKey(), + sapcBlacklistSubscriberEvent.getKey()); + sapcActState.getStateOutputs().put(sapcAct2Out.getKey().getLocalName(), sapcAct2Out); + sapcActState.setDefaultTask(sapcActTask.getKey()); + sapcActState.getTaskReferences().put(sapcActTask.getKey(), new AxStateTaskReference(sapcActState.getKey(), + sapcActTask.getKey(), AxStateTaskOutputType.DIRECT, sapcAct2Out.getKey())); + + final AxState sapcDecideState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Decide")); + sapcDecideState.setTrigger(sapcEvent.getKey()); + final AxStateOutput sapcDec2Act = + new AxStateOutput(sapcDecideState.getKey(), sapcActState.getKey(), sapcEvent.getKey()); + sapcDecideState.getStateOutputs().put(sapcDec2Act.getKey().getLocalName(), sapcDec2Act); + sapcDecideState.setDefaultTask(sapcDecideTask.getKey()); + sapcDecideState.getTaskReferences().put(sapcDecideTask.getKey(), new AxStateTaskReference( + sapcDecideState.getKey(), sapcDecideTask.getKey(), AxStateTaskOutputType.DIRECT, sapcDec2Act.getKey())); + + final AxState sapcEstablishState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Establish")); + sapcEstablishState.setTrigger(sapcEvent.getKey()); + final AxStateOutput sapcEst2Dec = + new AxStateOutput(sapcEstablishState.getKey(), sapcDecideState.getKey(), sapcEvent.getKey()); + sapcEstablishState.getStateOutputs().put(sapcEst2Dec.getKey().getLocalName(), sapcEst2Dec); + sapcEstablishState.setDefaultTask(sapcEstablishTask.getKey()); + sapcEstablishState.getTaskReferences().put(sapcEstablishTask.getKey(), + new AxStateTaskReference(sapcEstablishState.getKey(), sapcEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, sapcEst2Dec.getKey())); + + final AxState sapcMatchState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Match")); + sapcMatchState.setTrigger(aadmXStreamActEvent.getKey()); + final AxStateOutput sapcMat2Est = + new AxStateOutput(sapcMatchState.getKey(), sapcEstablishState.getKey(), sapcEvent.getKey()); + sapcMatchState.getStateOutputs().put(sapcMat2Est.getKey().getLocalName(), sapcMat2Est); + sapcMatchState.setDefaultTask(sapcMatchTask.getKey()); + sapcMatchState.getTaskReferences().put(sapcMatchTask.getKey(), new AxStateTaskReference(sapcMatchState.getKey(), + sapcMatchTask.getKey(), AxStateTaskOutputType.DIRECT, sapcMat2Est.getKey())); + + sapcPolicy.setFirstState(sapcMatchState.getKey().getLocalName()); + sapcPolicy.getStateMap().put(sapcMatchState.getKey().getLocalName(), sapcMatchState); + sapcPolicy.getStateMap().put(sapcEstablishState.getKey().getLocalName(), sapcEstablishState); + sapcPolicy.getStateMap().put(sapcDecideState.getKey().getLocalName(), sapcDecideState); + sapcPolicy.getStateMap().put(sapcActState.getKey().getLocalName(), sapcActState); + + final AxPolicy periodicPolicy = new AxPolicy(new AxArtifactKey("PeriodicPolicy", "0.0.1")); + periodicPolicy.setTemplate("MEDA"); + + final AxState periodicActState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Act")); + periodicActState.setTrigger(periodicEvent.getKey()); + final AxStateOutput perAct2Out = new AxStateOutput(periodicActState.getKey(), AxReferenceKey.getNullKey(), + sapcBlacklistSubscriberEvent.getKey()); + periodicActState.getStateOutputs().put(perAct2Out.getKey().getLocalName(), perAct2Out); + periodicActState.setDefaultTask(periodicActTask.getKey()); + periodicActState.getTaskReferences().put(periodicActTask.getKey(), + new AxStateTaskReference(periodicActState.getKey(), periodicActTask.getKey(), + AxStateTaskOutputType.DIRECT, perAct2Out.getKey())); + + final AxState periodicDecideState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Decide")); + periodicDecideState.setTrigger(periodicEvent.getKey()); + final AxStateOutput perDec2Act = + new AxStateOutput(periodicDecideState.getKey(), periodicActState.getKey(), periodicEvent.getKey()); + periodicDecideState.getStateOutputs().put(perDec2Act.getKey().getLocalName(), perDec2Act); + periodicDecideState.setDefaultTask(periodicDecideTask.getKey()); + periodicDecideState.getTaskReferences().put(periodicDecideTask.getKey(), + new AxStateTaskReference(periodicDecideState.getKey(), periodicDecideTask.getKey(), + AxStateTaskOutputType.DIRECT, perDec2Act.getKey())); + + final AxState periodicEstablishState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Establish")); + periodicEstablishState.setTrigger(periodicEvent.getKey()); + final AxStateOutput perEst2Dec = new AxStateOutput(periodicEstablishState.getKey(), + periodicDecideState.getKey(), periodicEvent.getKey()); + periodicEstablishState.getStateOutputs().put(perEst2Dec.getKey().getLocalName(), perEst2Dec); + periodicEstablishState.setDefaultTask(periodicEstablishTask.getKey()); + periodicEstablishState.getTaskReferences().put(periodicEstablishTask.getKey(), + new AxStateTaskReference(periodicEstablishState.getKey(), periodicEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, perEst2Dec.getKey())); + + final AxState periodicMatchState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Match")); + periodicMatchState.setTrigger(periodicEvent.getKey()); + final AxStateOutput perMat2Est = + new AxStateOutput(periodicMatchState.getKey(), periodicEstablishState.getKey(), periodicEvent.getKey()); + periodicMatchState.getStateOutputs().put(perMat2Est.getKey().getLocalName(), perMat2Est); + periodicMatchState.setDefaultTask(periodicMatchTask.getKey()); + periodicMatchState.getTaskReferences().put(periodicMatchTask.getKey(), + new AxStateTaskReference(periodicMatchState.getKey(), periodicMatchTask.getKey(), + AxStateTaskOutputType.DIRECT, perMat2Est.getKey())); + + periodicPolicy.setFirstState(periodicMatchState.getKey().getLocalName()); + periodicPolicy.getStateMap().put(periodicMatchState.getKey().getLocalName(), periodicMatchState); + periodicPolicy.getStateMap().put(periodicEstablishState.getKey().getLocalName(), periodicEstablishState); + periodicPolicy.getStateMap().put(periodicDecideState.getKey().getLocalName(), periodicDecideState); + periodicPolicy.getStateMap().put(periodicActState.getKey().getLocalName(), periodicActState); + + final AxPolicies aadmPolicies = new AxPolicies(new AxArtifactKey("AADMPolicies", "0.0.1")); + aadmPolicies.getPolicyMap().put(aadmPolicy.getKey(), aadmPolicy); + aadmPolicies.getPolicyMap().put(vMMEPolicy.getKey(), vMMEPolicy); + aadmPolicies.getPolicyMap().put(sapcPolicy.getKey(), sapcPolicy); + aadmPolicies.getPolicyMap().put(periodicPolicy.getKey(), periodicPolicy); + + final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("AADMKeyInformation", "0.0.1")); + final AxPolicyModel aadmPolicyModel = new AxPolicyModel(new AxArtifactKey("AADMPolicyModel", "0.0.1")); + aadmPolicyModel.setPolicies(aadmPolicies); + aadmPolicyModel.setEvents(aadmEvents); + aadmPolicyModel.setTasks(aadmTasks); + aadmPolicyModel.setAlbums(aadmAlbums); + aadmPolicyModel.setSchemas(aadmContextSchemas); + aadmPolicyModel.setKeyInformation(keyInformation); + aadmPolicyModel.getKeyInformation().generateKeyInfo(aadmPolicyModel); + + final AxValidationResult result = aadmPolicyModel.validate(new AxValidationResult()); + if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) { + throw new ApexRuntimeException("model " + aadmPolicyModel.getID() + " is not valid" + result); + } + return aadmPolicyModel; + } +} diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java new file mode 100644 index 000000000..618a9535a --- /dev/null +++ b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java @@ -0,0 +1,57 @@ +/*- + * ============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.examples.aadm.model; + +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +/** + * This class saves sample domain models to disk in XML and JSON format. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public final class AADMDomainModelSaver { + /** + * Private default constructor to prevent subclassing. + */ + private AADMDomainModelSaver() {} + + /** + * Write the AADM model to args[0]. + * + * @param args Not used + * @throws ApexException the apex exception + */ + public static void main(final String[] args) throws ApexException { + if (args.length != 1) { + System.err.println("usage: " + AADMDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + return; + } + + // Save Java model + final AxPolicyModel aadmPolicyModel = new AADMDomainModelFactory().getAADMPolicyModel(); + final ApexModelSaver aadmModelSaver = + new ApexModelSaver<>(AxPolicyModel.class, aadmPolicyModel, args[0]); + aadmModelSaver.apexModelWriteJSON(); + aadmModelSaver.apexModelWriteXML(); + } +} diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/package-info.java b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/package-info.java new file mode 100644 index 000000000..659154d45 --- /dev/null +++ b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/package-info.java @@ -0,0 +1,27 @@ +/*- + * ============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========================================================= + */ + +/** + * Provides Java generation of the AADM model. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ + +package org.onap.policy.apex.examples.aadm.model; diff --git a/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/package-info.java b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/package-info.java new file mode 100644 index 000000000..90198c254 --- /dev/null +++ b/examples/aadm/src/main/java/org/onap/policy/apex/examples/aadm/package-info.java @@ -0,0 +1,27 @@ +/*- + * ============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========================================================= + */ + +/** + * Provides the policy model and supporting Java classes for the AADM domain. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ + +package org.onap.policy.apex.examples.aadm; diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent.xml b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent.xml new file mode 100644 index 000000000..3ce3246d0 --- /dev/null +++ b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent.xml @@ -0,0 +1,108 @@ + + + + + AADMEvent + 0.0.1 + org.onap.policy.apex.examples.aadm.events + CompaA + apex + + IMSI + 27201872253157 + + + ENODEB_ID + 10000 + + + IMSI_IP + 111.222.333.444 + + + NW_IP + THIS IS NOT AN IP ADDRESS + + + DoS + true + + + PROBE_ON + false + + + TCP_ON + false + + + SGW_IP_ADDRESS + 10.0.0.2 + + + UE_IP_ADDRESS + 10.0.0.4 + + + NUM_SUBSCRIBERS + 101 + + + ACTTASK + + + + APPLICATION + + + + ATTACH_COUNT + 0 + + + AVG_SUBSCRIBER_ATTACH + 0 + + + SERVICE_REQUEST_COUNT + 99 + + + AVG_SUBSCRIBER_SERVICE_REQUEST + 101.0 + + + TCP_UE_SIDE_AVG_THROUGHPUT + 0 + + + TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX + 0 + + + http_host_class + + + + protocol_group + + + diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent0.json b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent0.json new file mode 100644 index 000000000..64d34fcf9 --- /dev/null +++ b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent0.json @@ -0,0 +1,27 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.aadm.events", + "name": "AADMEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "IMSI": 123456, + "IMSI_IP": "101.111.121.131", + "ENODEB_ID": 123, + "SERVICE_REQUEST_COUNT": 99, + "AVG_SUBSCRIBER_SERVICE_REQUEST": 101.0, + "UE_IP_ADDRESS": "101.111.121.131", + "NUM_SUBSCRIBERS": 101, + "ACTTASK": "", + "APPLICATION": "", + "ATTACH_COUNT": 0, + "AVG_SUBSCRIBER_ATTACH": 0, + "DoS": false, + "NW_IP": "", + "PROBE_ON": false, + "SGW_IP_ADDRESS": "", + "TCP_ON": false, + "TCP_UE_SIDE_AVG_THROUGHPUT": 0, + "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX": 0, + "http_host_class": "", + "protocol_group": "" +} diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent1.json b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent1.json new file mode 100644 index 000000000..b525e5f2e --- /dev/null +++ b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent1.json @@ -0,0 +1,27 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.aadm.events", + "name": "AADMEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "IMSI": 123456, + "IMSI_IP": "101.111.121.131", + "ENODEB_ID": 123, + "SERVICE_REQUEST_COUNT": 101, + "AVG_SUBSCRIBER_SERVICE_REQUEST": 99.0, + "UE_IP_ADDRESS": "101.111.121.131", + "NUM_SUBSCRIBERS": 101, + "TCP_UE_SIDE_AVG_THROUGHPUT": 101.0, + "ACTTASK": "", + "APPLICATION": "", + "ATTACH_COUNT": 0, + "AVG_SUBSCRIBER_ATTACH": 0, + "DoS": false, + "NW_IP": "", + "PROBE_ON": false, + "SGW_IP_ADDRESS": "", + "TCP_ON": false, + "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX": 0, + "http_host_class": "", + "protocol_group": "" +} diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent2.json b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent2.json new file mode 100644 index 000000000..893a19675 --- /dev/null +++ b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent2.json @@ -0,0 +1,27 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.aadm.events", + "name": "AADMEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "IMSI": 123456, + "IMSI_IP": "101.111.121.131", + "ENODEB_ID": 123, + "SERVICE_REQUEST_COUNT": 99, + "AVG_SUBSCRIBER_SERVICE_REQUEST": 101.0, + "UE_IP_ADDRESS": "101.111.121.131", + "NUM_SUBSCRIBERS": 99, + "ACTTASK": "", + "APPLICATION": "", + "ATTACH_COUNT": 0, + "AVG_SUBSCRIBER_ATTACH": 0, + "DoS": false, + "NW_IP": "", + "PROBE_ON": false, + "SGW_IP_ADDRESS": "", + "TCP_ON": false, + "TCP_UE_SIDE_AVG_THROUGHPUT": 0, + "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX": 0, + "http_host_class": "", + "protocol_group": "" +} diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent3.json b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent3.json new file mode 100644 index 000000000..dd8e0d549 --- /dev/null +++ b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent3.json @@ -0,0 +1,27 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.aadm.events", + "name": "AADMEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "IMSI": 123456, + "IMSI_IP": "101.111.121.131", + "ENODEB_ID": 123, + "TCP_UE_SIDE_AVG_THROUGHPUT": 101.0, + "ACTTASK": "", + "APPLICATION": "", + "ATTACH_COUNT": 0, + "AVG_SUBSCRIBER_ATTACH": 0, + "AVG_SUBSCRIBER_SERVICE_REQUEST": 0.0, + "DoS": false, + "NUM_SUBSCRIBERS": 0, + "NW_IP": "", + "PROBE_ON": false, + "SERVICE_REQUEST_COUNT": 0, + "SGW_IP_ADDRESS": "", + "TCP_ON": false, + "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX": 0, + "UE_IP_ADDRESS": "", + "http_host_class": "", + "protocol_group": "" +} diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent4.json b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent4.json new file mode 100644 index 000000000..dca754500 --- /dev/null +++ b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent4.json @@ -0,0 +1,28 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.aadm.events", + "name": "AADMEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "IMSI": 123456, + "IMSI_IP": "101.111.121.131", + "ENODEB_ID": 123, + "SERVICE_REQUEST_COUNT": 99, + "AVG_SUBSCRIBER_SERVICE_REQUEST": 101.0, + "UE_IP_ADDRESS": "101.111.121.131", + "NUM_SUBSCRIBERS": 101, + "ACTTASK": "", + "APPLICATION": "", + "ATTACH_COUNT": 0, + "AVG_SUBSCRIBER_ATTACH": 0, + "AVG_SUBSCRIBER_SERVICE_REQUEST": 0.0, + "DoS": false, + "NW_IP": "", + "PROBE_ON": false, + "SGW_IP_ADDRESS": "", + "TCP_ON": false, + "TCP_UE_SIDE_AVG_THROUGHPUT": 0, + "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX": 0, + "http_host_class": "", + "protocol_group": "" +} diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent5.json b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent5.json new file mode 100644 index 000000000..a7676e12f --- /dev/null +++ b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent5.json @@ -0,0 +1,27 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.aadm.events", + "name": "AADMEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "IMSI": 123456, + "ENODEB_ID": 124, + "SERVICE_REQUEST_COUNT": 99, + "AVG_SUBSCRIBER_SERVICE_REQUEST": 101.0, + "UE_IP_ADDRESS": "101.111.121.131", + "NUM_SUBSCRIBERS": 101, + "ACTTASK": "", + "APPLICATION": "", + "ATTACH_COUNT": 0, + "AVG_SUBSCRIBER_ATTACH": 0, + "DoS": false, + "IMSI_IP": "", + "NW_IP": "", + "PROBE_ON": false, + "SGW_IP_ADDRESS": "", + "TCP_ON": false, + "TCP_UE_SIDE_AVG_THROUGHPUT": 0, + "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX": 0, + "http_host_class": "", + "protocol_group": "" +} diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent6.json b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent6.json new file mode 100644 index 000000000..64d34fcf9 --- /dev/null +++ b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent6.json @@ -0,0 +1,27 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.aadm.events", + "name": "AADMEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "IMSI": 123456, + "IMSI_IP": "101.111.121.131", + "ENODEB_ID": 123, + "SERVICE_REQUEST_COUNT": 99, + "AVG_SUBSCRIBER_SERVICE_REQUEST": 101.0, + "UE_IP_ADDRESS": "101.111.121.131", + "NUM_SUBSCRIBERS": 101, + "ACTTASK": "", + "APPLICATION": "", + "ATTACH_COUNT": 0, + "AVG_SUBSCRIBER_ATTACH": 0, + "DoS": false, + "NW_IP": "", + "PROBE_ON": false, + "SGW_IP_ADDRESS": "", + "TCP_ON": false, + "TCP_UE_SIDE_AVG_THROUGHPUT": 0, + "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX": 0, + "http_host_class": "", + "protocol_group": "" +} diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent7.json b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent7.json new file mode 100644 index 000000000..694b28f2a --- /dev/null +++ b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestEvent7.json @@ -0,0 +1,27 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.aadm.events", + "name": "AADMEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "IMSI": 123456, + "ENODEB_ID": 123, + "SERVICE_REQUEST_COUNT": 99, + "UE_IP_ADDRESS": "101.111.121.131", + "ACTTASK": "", + "APPLICATION": "", + "ATTACH_COUNT": 0, + "AVG_SUBSCRIBER_ATTACH": 0, + "AVG_SUBSCRIBER_SERVICE_REQUEST": 0.0, + "DoS": false, + "IMSI_IP": "", + "NUM_SUBSCRIBERS": 0, + "NW_IP": "", + "PROBE_ON": false, + "SGW_IP_ADDRESS": "", + "TCP_ON": false, + "TCP_UE_SIDE_AVG_THROUGHPUT": 0, + "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX": 0, + "http_host_class": "", + "protocol_group": "" +} diff --git a/examples/aadm/src/main/resources/examples/events/AADM/AADMTestPeridociEvent.json b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestPeridociEvent.json new file mode 100644 index 000000000..6283293c9 --- /dev/null +++ b/examples/aadm/src/main/resources/examples/events/AADM/AADMTestPeridociEvent.json @@ -0,0 +1,12 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.aadm.events", + "name": "PeriodicEvent", + "version": "0.0.1", + "source": "apex", + "target": "apex", + "PERIODIC_EVENT_COUNT": 100, + "PERIODIC_DELAY": 1000, + "PERIODIC_FIRST_TIME": 1496828877, + "PERIODIC_CURRENT_TIME": 1496828908, + "PERIODIC_LAST_TIME": 1496828919 +} \ No newline at end of file diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel new file mode 100644 index 000000000..078841792 --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel @@ -0,0 +1,80 @@ +/* + * ============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========================================================= + */ +import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; +import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; + +logger.debug(subject.id + ":" + subject.taskName + " execution logic"); +logger.debug(inFields); + +outFields["ACTTASK"] = "act"; +outFields["TRIGGER_SPEC"] = "XSTREAM_AADM_ACT_EVENT"; +outFields["MAJ_MIN_MAINT_VERSION"] = "0.0.1"; +outFields["PROBE_ON"] = true; +outFields["TCP_ON"] = false; +outFields["IMSI"] = inFields["IMSI"]; + +if (inFields["IMSI_IP"] != null) { + outFields["IMSI_IP"] = inFields["IMSI_IP"]; +} +else{ + outFields["IMSI_IP"] = inFields["UE_IP_ADDRESS"]; +} + +if (inFields["NW_IP"] != null) { + outFields["NW_IP"] = inFields["NW_IP"]; +} +else{ + outFields["NW_IP"] = inFields["SGW_IP_ADDRESS"]; +} + +IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +logger.debug(imsiStatus); + +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID()); +eNodeBStatus.setBeingProbed(false); + +leaveProbingOn = false; +for (ENodeBStatus enbStatus : getContextAlbum("ENodeBStatusAlbum").values) { + if (enbStatus.getBeingProbed()) { + leaveProbingOn = true; + } +} + +if (!leaveProbingOn) { + outFields["PROBE_ON"] = false; + outFields["TCP_ON"] = false; +} + +eNodeBStatus.decrementDOSCount(); +logger.debug(eNodeBStatus.getENodeB() + ": dosCount is " + eNodeBStatus.getDOSCount()); + +imsiStatus.setAnomalous(false); + +logger.debug("imsi: " + imsiStatus.getIMSI() + " anamalous " + imsiStatus.getAnomalous()); + +getContextAlbum("IMSIStatusAlbum") .put(imsiStatus.getIMSI(), imsiStatus); +getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); + +outFields["THRESHOLD"] = 0; +outFields["PROFILE"] = ""; +outFields["VERSION"] = "0.0.1"; +outFields["BLACKLIST_ON"] = false; + +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel new file mode 100644 index 000000000..d04f9425e --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel @@ -0,0 +1,106 @@ +/* + * ============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========================================================= + */ +import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; +import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; + +logger.debug(subject.id + ":" + subject.taskName + " execution logic"); +logger.debug(inFields); + +outFields["ACTTASK"] = "probe"; +outFields["TRIGGER_SPEC"] = "XSTREAM_AADM_ACT_EVENT"; +outFields["MAJ_MIN_MAINT_VERSION"] = "0.0.1"; +outFields["IMSI"] = inFields["IMSI"]; + +if (inFields["IMSI_IP"] != null) { + outFields["IMSI_IP"] = inFields["IMSI_IP"]; +} +else { + outFields["IMSI_IP"] = inFields["UE_IP_ADDRESS"]; +} + +if (inFields["NW_IP"] != null) { + outFields["NW_IP"] = inFields["NW_IP"]; +} +else { + outFields["NW_IP"] = inFields["SGW_IP_ADDRESS"]; +} + +IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +logger.debug(imsiStatus); + +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID()); +logger.debug(eNodeBStatus); + +if (imsiStatus.getENodeBID() != null && !imsiStatus.getENodeBID().equals(inFields["ENODEB_ID"]) || inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] == null) { + // if user moved enodeB remove him from previous one + if (imsiStatus.getENodeBID() != null) { + eNodeBStatus.decrementDOSCount(); + } + + // if user became non anomalous return action + if (inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] == null) { + imsiStatus.setAnomalous(false); + outFields["ACTTASK"] = "remove_from_probe"; + + for (ENodeBStatus enbStatus : getContextAlbum("ENodeBStatusAlbum").values) { + if (enbStatus.getBeingProbed()) { + outFields["PROBE_ON"] = true; + outFields["TCP_ON"] = true; + return true; + } + } + + outFields["PROBE_ON"] = false; + outFields["TCP_ON"] = false; + + getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); + getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); + + return true; + } +} + +imsiStatus.setAnomalous(true); +imsiStatus.setAnomolousTime(System.currentTimeMillis()); +imsiStatus.setENodeBID(inFields["ENODEB_ID"]); +getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); +logger.debug(imsiStatus.getENodeBID() + ": enodeb added to imsi ip added " + outFields["IMSI_IP"]); + +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID()); +if (eNodeBStatus == null) { + eNodeBStatus = new ENodeBStatus(imsiStatus.getENodeBID()); + getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); + logger.debug("new eNodeB added " + getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID())); +} + +eNodeBStatus.incrementDOSCount(); +getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); +logger.debug(eNodeBStatus.getENodeB() + ": dosCount incremented to " + eNodeBStatus.getDOSCount()); + +outFields["PROBE_ON"] = true; +outFields["TCP_ON"] = true; +outFields["THRESHOLD"] = 0; +outFields["PROFILE"] = ""; +outFields["VERSION"] = "0.0.1"; +outFields["BLACKLIST_ON"] = false; + +logger.debug("out here5"); + +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel new file mode 100644 index 000000000..bb38034af --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel @@ -0,0 +1,75 @@ +/* + * ============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========================================================= + */ +import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; +import org.onap.policy.apex.examples.aadm.concepts.IPAddressStatus; +import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; + +logger.debug(subject.id + ":" + subject.taskName + " execution logic"); +logger.debug(inFields); + +ipAddress = inFields["UE_IP_ADDRESS"]; +if (ipAddress == null ) { + ipAddress = inFields["IMSI_IP"]; + + if (ipAddress == null ) { + logger.debug("Incoming event must specify parameter UE_IP_ADDRESS or parameter IMSI_IP"); + return false; + } +} + +imsi = inFields["IMSI"]; +if (imsi == null ) { + logger.debug("Incoming event must specify parameter IMSI"); + return false; +} + +eNodeBID = inFields["ENODEB_ID"]; +if (eNodeBID == null ) { + logger.debug("Incoming event must specify parameter ENODEB_ID"); + return false; +} + +IPAddressStatus ipAddressStatus = getContextAlbum("IPAddressStatusAlbum").get(ipAddress); +if (ipAddressStatus == null) { + ipAddressStatus = new IPAddressStatus(ipAddress); + ipAddressStatus.setIMSI(imsi); + getContextAlbum("IPAddressStatusAlbum").put(ipAddressStatus.getIPAddress(), ipAddressStatus); + logger.debug("added new IP address " + getContextAlbum("IPAddressStatusAlbum").get(ipAddress)); +} +else { + logger.debug("found IP address " + ipAddressStatus); +} + +IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)imsi); +if (imsiStatus == null) { + imsiStatus = new IMSIStatus(imsi); + imsiStatus.setENodeBID(eNodeBID); + getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); + logger.debug("added new IMSI " + imsi + " to IMSI status map") +} + +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get((String)eNodeBID); +if (eNodeBStatus == null) { + eNodeBStatus = new ENodeBStatus(eNodeBID); + getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); + logger.debug("added new ENodeB " + eNodeBID + " to ENodeB status map") +} + +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTask_TaskLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTask_TaskLogic.mvel new file mode 100644 index 000000000..7107b940b --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTask_TaskLogic.mvel @@ -0,0 +1,55 @@ +/* + * ============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========================================================= + */ +logger.debug(subject.id + ":" + subject.taskName + " execution logic"); + +outFields["ACTTASK"] = "no"; +outFields["TRIGGER_SPEC"] = "XSTREAM_AADM_ACT_EVENT"; +outFields["MAJ_MIN_MAINT_VERSION"] = "0.0.1"; + +if (inFields["PROBE_ON"] != null) { + outFields["PROBE_ON"] = inFields["PROBE_ON"]; +} +else{ + outFields["PROBE_ON"] = false; +} + +if (inFields["TCP_ON"] != null) { + outFields["TCP_ON"] = inFields["TCP_ON"]; +} +else { + outFields["TCP_ON"] = false; +} + +outFields["IMSI"] = inFields["IMSI"]; +if (inFields["IMSI_IP"] != null) { + outFields["IMSI_IP"] = inFields["IMSI_IP"]; +} +else { + outFields["IMSI_IP"] = inFields["UE_IP_ADDRESS"]; +} + +if (inFields["NW_IP"] != null) { + outFields["NW_IP"] = inFields["NW_IP"]; +} +else{ + outFields["NW_IP"] = inFields["SGW_IP_ADDRESS"]; +} + +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel new file mode 100644 index 000000000..2d0d45bdf --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel @@ -0,0 +1,67 @@ +/* + * ============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========================================================= + */ +import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; + +logger.debug(subject.id + ":" + subject.stateName + " execution logic"); +logger.debug(inFields); + +logger.debug("inFields[SERVICE_REQUEST_COUNT]=" + inFields["SERVICE_REQUEST_COUNT"]); + +IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); + +if (imsiStatus.getBlockingCount() > 1) { + subject.getTaskKey("AADMNoActTask").copyTo(selectedTask); + logger.debug("user blacklisted permanently"); + return false; +} + +logger.debug("imsi: " + imsiStatus.getIMSI() + " anamalous " + imsiStatus.getAnomalous()); + +// check if this is second iteration +if (inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] != null && inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] > 100 && imsiStatus.getAnomalous()) { + subject.getTaskKey("AADMDoSProvenActTask").copyTo(selectedTask); + logger.debug("inside TCP_UE_SIDE_AVG_THROUGHPUT"); + return true; +} + +// Get the status of the ENodeB +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get((String)inFields["ENODEB_ID"]); + +// check if this is first iteration and DoS +if (inFields["SERVICE_REQUEST_COUNT"] != null && + inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] != null && + inFields["SERVICE_REQUEST_COUNT"] > inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] && + eNodeBStatus != null && eNodeBStatus.getDOSCount() > 100 && + inFields["NUM_SUBSCRIBERS"] != null && inFields["NUM_SUBSCRIBERS"] > 100) { + logger.debug("inside NUM_SUBSCRIBERS"); + subject.getTaskKey("AADMDoSProvenActTask").copyTo(selectedTask); + return true; +} + +// check if this is first iteration and request probe +if (inFields["UE_IP_ADDRESS"] != null) { + logger.debug("inside UE_IP_ADDRESS"); + subject.getTaskKey("AADMDoSSuggestionActTask").copyTo(selectedTask); + return true; +} + +subject.defaultTaskKey.copyTo(selectedTask); +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskLogic.mvel new file mode 100644 index 000000000..69146d19c --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskLogic.mvel @@ -0,0 +1,23 @@ +/* + * ============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========================================================= + */ +logger.debug(subject.id + ":" + subject.taskName + " execution logic"); +logger.debug(inFields); +logger.debug(outFields); +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskSelectionLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskSelectionLogic.mvel new file mode 100644 index 000000000..20fe626cd --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskSelectionLogic.mvel @@ -0,0 +1,23 @@ +/* + * ============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========================================================= + */ +logger.debug(subject.id + ":" + subject.stateName); +subject.defaultTaskKey.copyTo(selectedTask) +logger.debug(subject.id + ":" + subject.stateName) + ", using default task"; +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel new file mode 100644 index 000000000..115ac5477 --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel @@ -0,0 +1,40 @@ +/* + * ============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========================================================= + */ +import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; + +logger.debug(subject.id + ":" + subject.taskName + " execution logic"); +logger.debug(inFields); + +for (IMSIStatus imsiStatus : getContextAlbum("IMSIStatusAlbum").values()) { + if ((System.currentTimeMillis() - imsiStatus.getBlacklistedTime()) > 180000) { + imsiStatus.setBlacklistedTime(0); + getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); + } +} + +outFields["IMSI"] = 0; +outFields["PROFILE"] = "ServiceA"; +outFields["BLACKLIST_ON"] = false; +outFields["PROBE_ON"] = false; +outFields["TCP_ON"] = false; +outFields["NW_IP"] = "0.0.0.0"; +outFields["IMSI_IP"] = "0.0.0.0"; + +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel new file mode 100644 index 000000000..7ceaa2abe --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel @@ -0,0 +1,79 @@ +/* + * ============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========================================================= + */ +import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; + +logger.debug(subject.id + ":" + subject.taskName + " execution logic"); +logger.debug(inFields); + +if (inFields["IMSI"] == null) { + outFields["IMSI"] = 0; +} +else { + outFields["IMSI"] = inFields["IMSI"]; +} + +if (outFields["IMSI"] == 0 && inFields["IMSI_IP"] != null && inFields["IMSI_IP"].equals("0")) { + // no action arrived + outFields["IMSI"] = 0; + outFields["PROFILE"] = "none"; + outFields["BLACKLIST_ON"] = false; + outFields["PROBE_ON"] = false; + return true; +} + +IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +logger.debug(imsiStatus); + +if (imsiStatus.getBlockingCount() > 1) { + outFields["IMSI"] = 0; + outFields["PROFILE"] = "none"; + outFields["BLACKLIST_ON"] = false; + outFields["PROBE_ON"] = false; + + return true; +} + +if (imsiStatus.getBlockingCount() > 0 && imsiStatus.getBlacklistedTime() != 0) { + outFields["IMSI"] = 0; + outFields["PROFILE"] = "none"; + outFields["BLACKLIST_ON"] = false; + outFields["PROBE_ON"] = false; + + return true; +} + +imsiStatus.incrementBlockingCount(); +imsiStatus.setBlacklistedTime(System.currentTimeMillis()); + +logger.debug("Bocking count for IMSI: " + imsiStatus.getIMSI() + " is: " + imsiStatus.getBlockingCount()); +getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); + +outFields["PROFILE"] = "ServiceA"; +outFields["BLACKLIST_ON"] = true; +outFields["PROBE_ON"] = false; + +if (imsiStatus.getBlockingCount() > 1) { + logger.debug("POLICY SAPCPolicy - blacklisting imsi: " + outFields["IMSI"] + " permanently"); +} +else { + logger.debug("POLICY SAPCPolicy - blacklisting imsi: " + outFields["IMSI"] + " temporary for 120000 ms"); +} + +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel new file mode 100644 index 000000000..1de8b190c --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel @@ -0,0 +1,52 @@ +/* + * ============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========================================================= + */ +logger.debug(subject.id + ":" + subject.taskName + " execution logic"); +logger.debug(inFields); + +if (inFields["ACTTASK"] != null && inFields["ACTTASK"].equals("no")) { + outFields["IMSI"] = 0; + outFields["IMSI_IP"] = "0"; + return true; +} + +if (inFields["PROBE_ON"] != null) { + outFields["PROBE_ON"] = inFields["PROBE_ON"]; +} +else{ + outFields["PROBE_ON"] = false; +} + +if (inFields["TCP_ON"] != null) { + outFields["TCP_ON"] = inFields["TCP_ON"]; +} +else{ + outFields["TCP_ON"] = false; +} + +outFields["IMSI"] = inFields["IMSI"]; +if (inFields["IMSI_IP"] != null) { + outFields["IMSI_IP"] = inFields["IMSI_IP"]; +} + +if (inFields["NW_IP"] != null) { + outFields["NW_IP"] = inFields["NW_IP"]; +} + +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTask_TaskLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTask_TaskLogic.mvel new file mode 100644 index 000000000..db1abdfe9 --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTask_TaskLogic.mvel @@ -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========================================================= + */ +logger.debug(subject.id + ":" + subject.taskName + " execution logic"); +logger.debug(inFields); + +outFields["TRIGGER_SPEC"] = "vMMEThresholdEvent"; +outFields["MAJ_MIN_MAINT_VERSION"] = "0.0.1"; + +if (outFields["IMSI"] == null) { + outFields["IMSI"] = 0; +} + +if (outFields["ENODEB_ID"] == null) { + outFields["ENODEB_ID"] = 0; +} + +if (outFields["IMSI_IP"] == null) { + outFields["IMSI_IP"] = ""; +} + +if (outFields["NW_IP"] == null) { + outFields["NW_IP"] = ""; +} + +outFields["PROFILE"] = "ServiceA"; +outFields["THRESHOLD"] = 20; +return true; diff --git a/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel new file mode 100644 index 000000000..33dbd4cd0 --- /dev/null +++ b/examples/aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel @@ -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========================================================= + */ +logger.debug(subject.id + ":" + subject.taskName + " execution logic"); +logger.debug(inFields); + +if (inFields["PROBE_ON"] != null) { + outFields["PROBE_ON"] = inFields["PROBE_ON"]; +} +else{ + outFields["PROBE_ON"] = false; +} + +if (inFields["TCP_ON"] != null) { + outFields["TCP_ON"] = inFields["TCP_ON"]; +} +else{ + outFields["TCP_ON"] = false; +} + +outFields["IMSI"] = inFields["IMSI"]; +if (inFields["IMSI_IP"] != null) { + outFields["IMSI_IP"] = inFields["IMSI_IP"]; +} + +if (inFields["NW_IP"] != null) { + outFields["NW_IP"] = inFields["NW_IP"]; +} +outFields["VERSION"] = inFields.getkey().getVersion(); + +return true; diff --git a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java b/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java new file mode 100644 index 000000000..02e6f9179 --- /dev/null +++ b/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java @@ -0,0 +1,60 @@ +/*- + * ============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.examples.aadm; + +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.test.TestApexModel; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +public class TestAADMDBWrite { + private Connection connection; + TestApexModel testApexModel; + + @Before + public void setup() throws Exception { + Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); + connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); + + testApexModel = new TestApexModel(AxPolicyModel.class, new TestAADMModelCreator()); + } + + @After + public void teardown() throws Exception { + connection.close(); + new File("derby.log").delete(); + } + + @Test + public void testModelWriteReadJPA() throws Exception { + final DAOParameters daoParameters = new DAOParameters(); + daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + daoParameters.setPersistenceUnit("AADMModelTest"); + + testApexModel.testApexModelWriteReadJPA(daoParameters); + } +} diff --git a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java b/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java new file mode 100644 index 000000000..2c62c4994 --- /dev/null +++ b/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java @@ -0,0 +1,81 @@ +/*- + * ============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.examples.aadm; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.test.TestApexModel; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +public class TestAADMModel { + private Connection connection; + TestApexModel testApexModel; + + @Before + public void setup() throws Exception { + Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); + connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); + + testApexModel = new TestApexModel(AxPolicyModel.class, new TestAADMModelCreator()); + } + + @After + public void teardown() throws Exception { + connection.close(); + new File("derby.log").delete(); + } + + @Test + public void testModelValid() throws Exception { + final AxValidationResult result = testApexModel.testApexModelValid(); + assertTrue(result.toString().equals(VALID_MODEL_STRING)); + } + + @Test + public void testModelWriteReadXML() throws Exception { + testApexModel.testApexModelWriteReadXML(); + } + + @Test + public void testModelWriteReadJSON() throws Exception { + testApexModel.testApexModelWriteReadJSON(); + } + + @Test + public void testModelWriteReadJPA() throws Exception { + final DAOParameters daoParameters = new DAOParameters(); + daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + daoParameters.setPersistenceUnit("AADMModelTest"); + + testApexModel.testApexModelWriteReadJPA(daoParameters); + } + + private static final String VALID_MODEL_STRING = "***validation of model successful***"; +} diff --git a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java b/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java new file mode 100644 index 000000000..9aa2095c7 --- /dev/null +++ b/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java @@ -0,0 +1,56 @@ +/*- + * ============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.examples.aadm; + +import org.onap.policy.apex.examples.aadm.model.AADMDomainModelFactory; +import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +/** + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class TestAADMModelCreator implements TestApexModelCreator { + + @Override + public AxPolicyModel getModel() { + return new AADMDomainModelFactory().getAADMPolicyModel(); + } + + @Override + public AxPolicyModel getMalstructuredModel() { + return null; + } + + @Override + public AxPolicyModel getObservationModel() { + return null; + } + + @Override + public AxPolicyModel getWarningModel() { + return getModel(); + } + + @Override + public AxPolicyModel getInvalidModel() { + return null; + } +} diff --git a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java b/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java new file mode 100644 index 000000000..58b1800ba --- /dev/null +++ b/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java @@ -0,0 +1,412 @@ +/*- + * ============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.examples.aadm; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.apex.context.ContextAlbum; +import org.onap.policy.apex.core.engine.EngineParameters; +import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory; +import org.onap.policy.apex.core.engine.engine.impl.ApexEngineImpl; +import org.onap.policy.apex.core.engine.event.EnEvent; +import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; +import org.onap.policy.apex.examples.aadm.model.AADMDomainModelFactory; +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; + +/** + * User: Sergey Sachkov Date: 13/10/15 + */ +public class TestAADMUseCase { + private static final XLogger logger = XLoggerFactory.getXLogger(TestAADMUseCase.class); + + /** + * Test aadm use case setup. + */ + @Before + public void testAADMUseCaseSetup() {} + + /** + * Test aadm case. + * + * @throws ApexException the apex exception + * @throws InterruptedException the interrupted exception + * @throws IOException Signals that an I/O exception has occurred. + */ + @Test + public void testAADMCase() throws ApexException, InterruptedException, IOException { + final AxPolicyModel apexPolicyModel = new AADMDomainModelFactory().getAADMPolicyModel(); + assertNotNull(apexPolicyModel); + final AxArtifactKey key = new AxArtifactKey("AADMApexEngine", "0.0.1"); + + final EngineParameters parameters = new EngineParameters(); + parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + + final ApexEngineImpl apexEngine = (ApexEngineImpl) new ApexEngineFactory().createApexEngine(key); + final TestApexActionListener listener = new TestApexActionListener("Test"); + apexEngine.addEventListener("listener", listener); + apexEngine.updateModel(apexPolicyModel); + apexEngine.start(); + + final AxEvent axEvent = getTriggerEvent(apexPolicyModel); + assertNotNull(axEvent); + + // getting number of connections send it to policy, expecting probe action + logger.info("Sending too many connections trigger "); + EnEvent event = apexEngine.createEvent(axEvent.getKey()); + event.put("IMSI", new Long(123456)); + event.put("IMSI_IP", "101.111.121.131"); + event.put("ENODEB_ID", new Long(123)); + event.put("SERVICE_REQUEST_COUNT", 99); + event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0); + event.put("UE_IP_ADDRESS", "101.111.121.131"); + event.put("NUM_SUBSCRIBERS", 101); + event.put("ACTTASK", ""); + event.put("APPLICATION", ""); + event.put("ATTACH_COUNT", 0); + event.put("AVG_SUBSCRIBER_ATTACH", 0D); + event.put("DoS", false); + event.put("NW_IP", ""); + event.put("PROBE_ON", false); + event.put("SGW_IP_ADDRESS", ""); + event.put("TCP_ON", false); + event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D); + event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L); + event.put("http_host_class", ""); + event.put("protocol_group", ""); + apexEngine.handleEvent(event); + EnEvent result = listener.getResult(); + assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT")); + assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID()); + // no DOS_IN_eNodeB set so return probe action + assertTrue(result.get("ACTTASK").equals("probe")); + assertTrue((boolean) result.get("TCP_ON")); + assertTrue((boolean) result.get("PROBE_ON")); + logger.info("Receiving action event with {} action", result.get("ACTTASK")); + + final ContextAlbum eNodeBStatusAlbum = apexEngine.getInternalContext().get("ENodeBStatusAlbum"); + final ENodeBStatus eNodeBStatus = (ENodeBStatus) eNodeBStatusAlbum.get("123"); + eNodeBStatus.setDOSCount(101); + eNodeBStatusAlbum.put(eNodeBStatus.getENodeB(), eNodeBStatus); + + logger.info("Sending too many connections trigger "); + event = apexEngine.createEvent(axEvent.getKey()); + event.put("IMSI", new Long(123456)); + event.put("IMSI_IP", "101.111.121.131"); + event.put("ENODEB_ID", new Long(123)); + event.put("SERVICE_REQUEST_COUNT", 101); + event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 99.0); + event.put("UE_IP_ADDRESS", "101.111.121.131"); + event.put("NUM_SUBSCRIBERS", 101); + event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 101.0); + event.put("ACTTASK", ""); + event.put("APPLICATION", ""); + event.put("ATTACH_COUNT", 0); + event.put("AVG_SUBSCRIBER_ATTACH", 0D); + event.put("DoS", false); + event.put("NW_IP", ""); + event.put("PROBE_ON", false); + event.put("SGW_IP_ADDRESS", ""); + event.put("TCP_ON", false); + event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L); + event.put("http_host_class", ""); + event.put("protocol_group", ""); + + apexEngine.handleEvent(event); + result = listener.getResult(); + assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT")); + assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID()); + // DOS_IN_eNodeB set to be more than throughput so return act action + assertTrue(result.get("ACTTASK").equals("act")); + // only one imsi was sent to process, so stop probe and tcp + assertTrue(!(boolean) result.get("TCP_ON")); + assertTrue(!(boolean) result.get("PROBE_ON")); + assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + logger.info("Receiving action event with {} action", result.get("ACTTASK")); + + ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDOSCount(99); + + // getting number of connections send it to policy, expecting probe action + logger.info("Sending too many connections trigger "); + event = apexEngine.createEvent(axEvent.getKey()); + event.put("IMSI", new Long(123456)); + event.put("IMSI_IP", "101.111.121.131"); + event.put("ENODEB_ID", new Long(123)); + event.put("SERVICE_REQUEST_COUNT", 99); + event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0); + event.put("UE_IP_ADDRESS", "101.111.121.131"); + event.put("NUM_SUBSCRIBERS", 99); + event.put("ACTTASK", ""); + event.put("APPLICATION", ""); + event.put("ATTACH_COUNT", 0); + event.put("AVG_SUBSCRIBER_ATTACH", 0D); + event.put("DoS", false); + event.put("NW_IP", ""); + event.put("PROBE_ON", false); + event.put("SGW_IP_ADDRESS", ""); + event.put("TCP_ON", false); + event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D); + event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L); + event.put("http_host_class", ""); + event.put("protocol_group", ""); + + apexEngine.handleEvent(event); + result = listener.getResult(); + assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT")); + assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID()); + assertTrue(result.get("ACTTASK").equals("probe")); + assertTrue((boolean) result.get("TCP_ON")); + assertTrue((boolean) result.get("PROBE_ON")); + assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + + ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDOSCount(99); + + // tcp correlation return positive dos + logger.info("Receiving action event with {} action", result.get("ACTTASK")); + event = apexEngine.createEvent(axEvent.getKey()); + event.put("IMSI", new Long(123456)); + event.put("IMSI_IP", "101.111.121.131"); + event.put("ENODEB_ID", new Long(123)); + event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 101.0); + event.put("ACTTASK", ""); + event.put("APPLICATION", ""); + event.put("ATTACH_COUNT", 0); + event.put("AVG_SUBSCRIBER_ATTACH", 0D); + event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 0.0); + event.put("DoS", false); + event.put("NUM_SUBSCRIBERS", 0); + event.put("NW_IP", ""); + event.put("PROBE_ON", false); + event.put("SERVICE_REQUEST_COUNT", 0); + event.put("SGW_IP_ADDRESS", ""); + event.put("TCP_ON", false); + event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L); + event.put("UE_IP_ADDRESS", ""); + event.put("http_host_class", ""); + event.put("protocol_group", ""); + + apexEngine.handleEvent(event); + result = listener.getResult(); + assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT")); + assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID()); + assertTrue(result.get("ACTTASK").equals("act")); + assertTrue(!(boolean) result.get("TCP_ON")); + assertTrue(!(boolean) result.get("PROBE_ON")); + assertEquals(98, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + logger.info("Receiving action event with {} action", result.get("ACTTASK")); + + ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDOSCount(101); + + // user moving enodeB + logger.info("Sending too many connections trigger "); + event = apexEngine.createEvent(axEvent.getKey()); + event.put("IMSI", new Long(123456)); + event.put("IMSI_IP", "101.111.121.131"); + event.put("ENODEB_ID", new Long(123)); + event.put("SERVICE_REQUEST_COUNT", 99); + event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0); + event.put("UE_IP_ADDRESS", "101.111.121.131"); + event.put("NUM_SUBSCRIBERS", 101); + event.put("ACTTASK", ""); + event.put("APPLICATION", ""); + event.put("ATTACH_COUNT", 0); + event.put("AVG_SUBSCRIBER_ATTACH", 0D); + event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 0.0); + event.put("DoS", false); + event.put("NW_IP", ""); + event.put("PROBE_ON", false); + event.put("SGW_IP_ADDRESS", ""); + event.put("TCP_ON", false); + event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D); + event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L); + event.put("http_host_class", ""); + event.put("protocol_group", ""); + + apexEngine.handleEvent(event); + result = listener.getResult(); + assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT")); + assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID()); + assertTrue(result.get("ACTTASK").equals("act")); + assertTrue(!(boolean) result.get("TCP_ON")); + assertTrue(!(boolean) result.get("PROBE_ON")); + assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + logger.info("Receiving action event with {} action", result.get("ACTTASK")); + + logger.info("Sending too many connections trigger "); + event = apexEngine.createEvent(axEvent.getKey()); + event.put("IMSI", new Long(123456)); + event.put("ENODEB_ID", new Long(124)); + event.put("SERVICE_REQUEST_COUNT", 99); + event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0); + event.put("UE_IP_ADDRESS", "101.111.121.131"); + event.put("NUM_SUBSCRIBERS", 101); + event.put("ACTTASK", ""); + event.put("APPLICATION", ""); + event.put("ATTACH_COUNT", 0); + event.put("AVG_SUBSCRIBER_ATTACH", 0D); + event.put("DoS", false); + event.put("IMSI_IP", ""); + event.put("NW_IP", ""); + event.put("PROBE_ON", false); + event.put("SGW_IP_ADDRESS", ""); + event.put("TCP_ON", false); + event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D); + event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L); + event.put("http_host_class", ""); + event.put("protocol_group", ""); + + apexEngine.handleEvent(event); + result = listener.getResult(); + assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT")); + assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID()); + assertTrue(result.get("ACTTASK").equals("probe")); + assertTrue((boolean) result.get("TCP_ON")); + assertTrue((boolean) result.get("PROBE_ON")); + assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + assertEquals(1, ((ENodeBStatus) eNodeBStatusAlbum.get("124")).getDOSCount()); + logger.info("Receiving action event with {} action", result.get("ACTTASK")); + // End of user moving enodeB + + ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDOSCount(101); + + // user becomes non anomalous + logger.info("Sending too many connections trigger "); + event = apexEngine.createEvent(axEvent.getKey()); + event.put("IMSI", new Long(123456)); + event.put("IMSI_IP", "101.111.121.131"); + event.put("ENODEB_ID", new Long(123)); + event.put("SERVICE_REQUEST_COUNT", 99); + event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0); + event.put("UE_IP_ADDRESS", "101.111.121.131"); + event.put("NUM_SUBSCRIBERS", 101); + event.put("ACTTASK", ""); + event.put("APPLICATION", ""); + event.put("ATTACH_COUNT", 0); + event.put("AVG_SUBSCRIBER_ATTACH", 0D); + event.put("DoS", false); + event.put("NW_IP", ""); + event.put("PROBE_ON", false); + event.put("SGW_IP_ADDRESS", ""); + event.put("TCP_ON", false); + event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D); + event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L); + event.put("http_host_class", ""); + event.put("protocol_group", ""); + + apexEngine.handleEvent(event); + result = listener.getResult(); + assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT")); + assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID()); + assertTrue(result.get("ACTTASK").equals("probe")); + assertTrue((boolean) result.get("TCP_ON")); + assertTrue((boolean) result.get("PROBE_ON")); + assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + logger.info("Receiving action event with {} action", result.get("ACTTASK")); + + logger.info("Sending too many connections trigger "); + event = apexEngine.createEvent(axEvent.getKey()); + event.put("IMSI", new Long(123456)); + event.put("ENODEB_ID", new Long(123)); + event.put("SERVICE_REQUEST_COUNT", 99); + event.put("UE_IP_ADDRESS", "101.111.121.131"); + event.put("ACTTASK", ""); + event.put("APPLICATION", ""); + event.put("ATTACH_COUNT", 0); + event.put("AVG_SUBSCRIBER_ATTACH", 0D); + event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 0.0); + event.put("DoS", false); + event.put("IMSI_IP", ""); + event.put("NUM_SUBSCRIBERS", 0); + event.put("NW_IP", ""); + event.put("PROBE_ON", false); + event.put("SGW_IP_ADDRESS", ""); + event.put("TCP_ON", false); + event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D); + event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L); + event.put("http_host_class", ""); + event.put("protocol_group", ""); + + apexEngine.handleEvent(event); + result = listener.getResult(); + assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT")); + assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID()); + assertTrue(result.get("ACTTASK").equals("probe")); + assertTrue((boolean) result.get("TCP_ON")); + assertTrue((boolean) result.get("PROBE_ON")); + assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + logger.info("Receiving action event with {} action", result.get("ACTTASK")); + // End of user becomes non anomalous + apexEngine.handleEvent(result); + result = listener.getResult(); + assertTrue(result.getName().startsWith("SAPCBlacklistSubscriberEvent")); + assertTrue(result.get("PROFILE").equals("ServiceA")); + assertTrue(result.get("BLACKLIST_ON").equals(true)); + + event = apexEngine.createEvent(new AxArtifactKey("PeriodicEvent", "0.0.1")); + event.put("PERIODIC_EVENT_COUNT", (long) 100); + event.put("PERIODIC_DELAY", (long) 1000); + event.put("PERIODIC_FIRST_TIME", System.currentTimeMillis()); + event.put("PERIODIC_CURRENT_TIME", System.currentTimeMillis()); + event.put("PERIODIC_LAST_TIME", System.currentTimeMillis()); + apexEngine.handleEvent(event); + result = listener.getResult(); + assertTrue(result.getName().startsWith("SAPCBlacklistSubscriberEvent")); + assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID()); + assertEquals(0L, result.get("IMSI")); + assertTrue(result.get("PROFILE").equals("ServiceA")); + assertTrue(result.get("BLACKLIST_ON").equals(false)); + + apexEngine.stop(); + } + + /** + * Test vpn cleardown. + */ + @After + public void testAADMCleardown() {} + + /** + * Gets the trigger event. + * + * @param apexModel the apex model + * @return the trigger event + */ + private AxEvent getTriggerEvent(final AxPolicyModel apexPolicyModel) { + for (final AxEvent axEvent : apexPolicyModel.getEvents().getEventMap().values()) { + if (axEvent.getKey().getID().equals("AADMEvent:0.0.1")) { + return axEvent; + } + } + return null; + } +} diff --git a/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java b/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java new file mode 100644 index 000000000..ccf4539aa --- /dev/null +++ b/examples/aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java @@ -0,0 +1,91 @@ +/*- + * ============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.examples.aadm; + +import java.util.ArrayList; +import java.util.List; + +import org.onap.policy.apex.core.engine.engine.EnEventListener; +import org.onap.policy.apex.core.engine.event.EnEvent; +import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; + +/** + * The listener interface for receiving testApexAction events. The class that is interested in processing a + * testApexAction event implements this interface, and the object created with that class is registered with a component + * using the component's addTestApexActionListener method. When the testApexAction event occurs, that + * object's appropriate method is invoked. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class TestApexActionListener implements EnEventListener { + List resultEvents = new ArrayList(); + + private final String id; + + /** + * Instantiates a new test apex action listener. + * + * @param id the id + */ + public TestApexActionListener(final String id) { + this.id = id; + } + + /** + * Gets the result. + * + * @return the result + */ + public EnEvent getResult() { + while (resultEvents.isEmpty()) { + ThreadUtilities.sleep(100); + } + return resultEvents.remove(0); + } + + /* + * (non-Javadoc) + * + * @see + * org.onap.policy.apex.core.engine.engine.EnEventListener#onEnEvent(org.onap.policy.apex.core.engine.event.EnEvent) + */ + @Override + public void onEnEvent(final EnEvent actionEvent) { + try { + Thread.sleep(100); + } catch (final InterruptedException e) { + e.printStackTrace(); + } + if (actionEvent != null) { + System.out.println("Action event from engine:" + actionEvent.getName()); + resultEvents.add(actionEvent); + } + } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return id; + } +} diff --git a/examples/aadm/src/test/resources/META-INF/persistence.xml b/examples/aadm/src/test/resources/META-INF/persistence.xml new file mode 100644 index 000000000..eaef96a85 --- /dev/null +++ b/examples/aadm/src/test/resources/META-INF/persistence.xml @@ -0,0 +1,69 @@ + + + + + + org.eclipse.persistence.jpa.PersistenceProvider + + org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner + org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String + org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey + org.onap.policy.apex.model.basicmodel.concepts.AxConcept + org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo + org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation + org.onap.policy.apex.model.basicmodel.concepts.AxModel + org.onap.policy.apex.model.basicmodel.concepts.TestEntity + org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema + org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas + org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum + org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums + org.onap.policy.apex.model.contextmodel.concepts.AxContextModel + org.onap.policy.apex.model.eventmodel.concepts.AxField + org.onap.policy.apex.model.eventmodel.concepts.AxInputField + org.onap.policy.apex.model.eventmodel.concepts.AxOutputField + org.onap.policy.apex.model.eventmodel.concepts.AxEvent + org.onap.policy.apex.model.eventmodel.concepts.AxEvents + org.onap.policy.apex.model.eventmodel.concepts.AxEventModel + org.onap.policy.apex.model.policymodel.concepts.AxLogic + org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter + org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic + org.onap.policy.apex.model.policymodel.concepts.AxTask + org.onap.policy.apex.model.policymodel.concepts.AxTasks + org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic + org.onap.policy.apex.model.policymodel.concepts.AxStateFinalizerLogic + org.onap.policy.apex.model.policymodel.concepts.AxStateOutput + org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference + org.onap.policy.apex.model.policymodel.concepts.AxState + org.onap.policy.apex.model.policymodel.concepts.AxPolicy + org.onap.policy.apex.model.policymodel.concepts.AxPolicies + org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel + + + + + + + + + + + + diff --git a/examples/aadm/src/test/resources/logback-test.xml b/examples/aadm/src/test/resources/logback-test.xml new file mode 100644 index 000000000..4b9258c40 --- /dev/null +++ b/examples/aadm/src/test/resources/logback-test.xml @@ -0,0 +1,74 @@ + + + + + + Apex + + + + + + + %d %contextName [%t] %level %logger{36} - %msg%n + + + + + + + + + + + + + + + + + ${LOG_DIR}/apex.log + + %d %-5relative [procId=${processId}] [%thread] %-5level + %logger{26} - %msg %n %ex{full} + + + + + ${LOG_DIR}/apex_ctxt.log + + %d %-5relative [procId=${processId}] [%thread] %-5level + %logger{26} - %msg %n %ex{full} + + + + + + + + + + + + + + + diff --git a/examples/adaptive/pom.xml b/examples/adaptive/pom.xml new file mode 100644 index 000000000..76315d201 --- /dev/null +++ b/examples/adaptive/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + org.onap.policy.apex-pdp.examples + examples + 2.0.0-SNAPSHOT + + + adaptive + ${project.artifactId} + Specific code for the Apex Adaptive Example + + + + org.onap.policy.apex-pdp.model + policy-model + ${project.version} + + + org.onap.policy.apex-pdp.core + core-engine + ${project.version} + + + org.onap.policy.apex-pdp.core + core-infrastructure + ${project.version} + test + + + org.onap.policy.apex-pdp.plugins.plugins-executor + plugins-executor-mvel + ${project.version} + test + + + org.onap.policy.apex-pdp.plugins.plugins-executor + plugins-executor-java + ${project.version} + test + + + org.apache.commons + commons-math3 + 3.2 + + + org.apache.derby + derby + ${version.derby} + test + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + generate-models + process-classes + + exec + + + java + + -classpath + + + org.onap.policy.apex.examples.adaptive.model.AdaptiveDomainModelSaver + ${project.build.directory}/classes/examples/models/Adaptive + + + + + + + + \ No newline at end of file diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java new file mode 100644 index 000000000..f574c74ec --- /dev/null +++ b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java @@ -0,0 +1,243 @@ +/*- + * ============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.examples.adaptive.concepts; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +/** + * The Class AnomalyDetection is used as a Java context for Adaptive anomaly detection in the adaptive domain. + */ +public class AnomalyDetection implements Serializable { + private static final long serialVersionUID = -823013127095523727L; + + private static final int HASH_PRIME_1 = 31; + private static final int HASH_PRIME_2 = 1231; + private static final int HASH_PRIME_3 = 1237; + + private boolean firstRound = true; + private int frequency = 0; + + /** + * The Constructor creates an AnomalyDetection instance. + */ + public AnomalyDetection() { + firstRound = true; + frequency = 0; + } + + private List anomalyScores = new LinkedList<>(); + private List frequencyForecasted; + + /** + * Checks if the AnomalyDetection instance is initialized. + * + * @return true, if the AnomalyDetection instance is initialized + */ + public boolean isInitialized() { + return (frequencyForecasted != null); + } + + /** + * Initializes the AnomalyDetection instance. + * + * @param incomingFrequency the frequency + */ + public void init(final int incomingFrequency) { + frequencyForecasted = new ArrayList<>(incomingFrequency); + for (int i = 0; i < incomingFrequency; i++) { + frequencyForecasted.add(null); + } + } + + /** + * Indicates if this is the first round of the algorithm. + * + * @return true if this is the first round of the algorithm + */ + public boolean getFirstRound() { + return firstRound; + } + + /** + * Sets the first round indicator of the algorithm. + * + * @param firstRound the first round indicator of the algorithm + */ + public void setFirstRound(final boolean firstRound) { + this.firstRound = firstRound; + } + + /** + * Gets the frequency value of the algorithm. + * + * @return the frequency value of the algorithm + */ + public int getFrequency() { + return frequency; + } + + /** + * Sets the frequency value of the algorithm. + * + * @param frequency the frequency value of the algorithm + */ + public void setFrequency(final int frequency) { + this.frequency = frequency; + } + + /** + * Gets the anomaly score values of the algorithm. + * + * @return the anomaly score values of the algorithm + */ + public List getAnomalyScores() { + return anomalyScores; + } + + /** + * Sets the anomaly score values of the algorithm. + * + * @param anomalyScores the anomaly score values of the algorithm + */ + public void setAnomalyScores(final LinkedList anomalyScores) { + this.anomalyScores = anomalyScores; + } + + /** + * Check if the anomaly score values of the algorithm are set. + * + * @return true, if the anomaly score values of the algorithm are set + */ + public boolean checkSetAnomalyScores() { + return ((anomalyScores != null) && (!anomalyScores.isEmpty())); + } + + /** + * Unset the anomaly score values of the algorithm. + */ + public void unsetAnomalyScores() { + anomalyScores = null; + } + + /** + * Gets the frequency forecasted by the algorithm. + * + * @return the frequency forecasted by the algorithm + */ + public List getFrequencyForecasted() { + return frequencyForecasted; + } + + /** + * Sets the frequency forecasted by the algorithm. + * + * @param frequencyForecasted the frequency forecasted by the algorithm + */ + public void setFrequencyForecasted(final List frequencyForecasted) { + this.frequencyForecasted = frequencyForecasted; + } + + /** + * Check if the frequency forecasted by the algorithm is set. + * + * @return true, if the frequency forecasted by the algorithm is set + */ + public boolean checkSetFrequencyForecasted() { + return ((frequencyForecasted != null) && (!frequencyForecasted.isEmpty())); + } + + /** + * Unset the frequency forecasted by the algorithm. + */ + public void unsetFrequencyForecasted() { + frequencyForecasted = null; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "AnomalyDetection [firstRound=" + firstRound + ", frequency=" + frequency + ", anomalyScores=" + + anomalyScores + ", frequencyForecasted=" + frequencyForecasted + "]"; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = HASH_PRIME_1; + int result = 1; + result = prime * result + ((anomalyScores == null) ? 0 : anomalyScores.hashCode()); + result = prime * result + (firstRound ? HASH_PRIME_2 : HASH_PRIME_3); + result = prime * result + frequency; + result = prime * result + ((frequencyForecasted == null) ? 0 : frequencyForecasted.hashCode()); + return result; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AnomalyDetection other = (AnomalyDetection) obj; + if (anomalyScores == null) { + if (other.anomalyScores != null) { + return false; + } + } else if (!anomalyScores.equals(other.anomalyScores)) { + return false; + } + if (firstRound != other.firstRound) { + return false; + } + if (frequency != other.frequency) { + return false; + } + if (frequencyForecasted == null) { + if (other.frequencyForecasted != null) { + return false; + } + } else if (!frequencyForecasted.equals(other.frequencyForecasted)) { + return false; + } + return true; + } +} diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java new file mode 100644 index 000000000..f2e27725b --- /dev/null +++ b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java @@ -0,0 +1,198 @@ +/*- + * ============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.examples.adaptive.concepts; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * The Class AutoLearn is used as a Java context for Adaptive auto-learning of trends towards a fixed value in the + * adaptive domain. + */ +public class AutoLearn implements Serializable { + private static final long serialVersionUID = 3825970380434170754L; + + private List avDiffs = null; + + private List counts = null; + + /** + * The Constructor creates an AutoLearn concept. + */ + public AutoLearn() {} + + /** + * Checks if the Autolearn instance is initialized. + * + * @return true, if the Autolearn instance is initialized + */ + public boolean isInitialized() { + return (avDiffs != null && counts != null); + } + + /** + * initializes the auto learning algorithm with the number of convergent variables to use. + * + * @param size the number of convergent variables to use + */ + public void init(final int size) { + if (avDiffs == null || avDiffs.size() == 0) { + avDiffs = new ArrayList<>(size); + for (int i = 0; i < size; i++) { + avDiffs.add(i, Double.NaN); + } + } + + if (counts == null || counts.size() == 0) { + counts = new ArrayList<>(size); + for (int i = 0; i < size; i++) { + counts.add(i, 0L); + } + } + } + + /** + * Gets the average difference values of the algorithm. + * + * @return the average difference values of the algorithm + */ + public List getAvDiffs() { + return avDiffs; + } + + /** + * Sets the average difference values of the algorithm. + * + * @param avDiffs the average difference values of the algorithm + */ + public void setAvDiffs(final List avDiffs) { + this.avDiffs = avDiffs; + } + + /** + * Check if the average difference values of the algorithm are set. + * + * @return true, if check set av diffs + */ + public boolean checkSetAvDiffs() { + return ((avDiffs != null) && (!avDiffs.isEmpty())); + } + + /** + * Unset the average difference values of the algorithm. + */ + public void unsetAvDiffs() { + avDiffs = null; + } + + /** + * Gets the count values of the algorithm. + * + * @return the count values of the algorithm + */ + public List getCounts() { + return counts; + } + + /** + * Sets the count values of the algorithm. + * + * @param counts the count values of the algorithm + */ + public void setCounts(final List counts) { + this.counts = counts; + } + + /** + * Check if the count values of the algorithm are set. + * + * @return true, if the count values of the algorithm are set + */ + public boolean checkSetCounts() { + return ((counts != null) && (!counts.isEmpty())); + } + + /** + * Unset the count values of the algorithm. + */ + public void unsetCounts() { + counts = null; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "AutoLearn [avDiffs=" + avDiffs + ", counts=" + counts + "]"; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((avDiffs == null) ? 0 : avDiffs.hashCode()); + result = prime * result + ((counts == null) ? 0 : counts.hashCode()); + return result; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AutoLearn other = (AutoLearn) obj; + if (avDiffs == null) { + if (other.avDiffs != null) { + return false; + } + } else if (!avDiffs.equals(other.avDiffs)) { + return false; + } + if (counts == null) { + if (other.counts != null) { + return false; + } + } else if (!counts.equals(other.counts)) { + return false; + } + return true; + } +} diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/package-info.java b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/package-info.java new file mode 100644 index 000000000..8561ed074 --- /dev/null +++ b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/package-info.java @@ -0,0 +1,27 @@ +/*- + * ============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========================================================= + */ + +/** + * Provides Java types that are used in the Adaptive domain. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ + +package org.onap.policy.apex.examples.adaptive.concepts; diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java new file mode 100644 index 000000000..6242b1618 --- /dev/null +++ b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java @@ -0,0 +1,558 @@ +/*- + * ============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.examples.adaptive.model; + +import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation; +import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; +import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; +import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; +import org.onap.policy.apex.model.eventmodel.concepts.AxField; +import org.onap.policy.apex.model.policymodel.concepts.AxLogicReader; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicies; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.model.policymodel.concepts.AxState; +import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput; +import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType; +import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference; +import org.onap.policy.apex.model.policymodel.concepts.AxTask; +import org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic; +import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic; +import org.onap.policy.apex.model.policymodel.concepts.AxTasks; +import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader; + +/** + * The Class AdaptiveDomainModelFactory. + */ +public class AdaptiveDomainModelFactory { + + /** + * Gets the anomaly detection policy model. + * + * @return the anomaly detection policy model + */ + // CHECKSTYLE:OFF: checkstyle:maximumMethodLength + public AxPolicyModel getAnomalyDetectionPolicyModel() { + // CHECKSTYLE:ON: checkstyle:maximumMethodLength + // Data types for event parameters + final AxContextSchema monitoredValue = + new AxContextSchema(new AxArtifactKey("MonitoredValue", "0.0.1"), "Java", "java.lang.Double"); + final AxContextSchema iteration = + new AxContextSchema(new AxArtifactKey("Iteration", "0.0.1"), "Java", "java.lang.Integer"); + + final AxContextSchemas adContextSchemas = new AxContextSchemas(new AxArtifactKey("AADMDatatypes", "0.0.1")); + adContextSchemas.getSchemasMap().put(monitoredValue.getKey(), monitoredValue); + adContextSchemas.getSchemasMap().put(iteration.getKey(), iteration); + + final AxEvent anomalyDetectionTriggerEvent = + new AxEvent(new AxArtifactKey("AnomalyDetectionTriggerEvent", "0.0.1"), + "org.onap.policy.apex.examples.adaptive.events"); + anomalyDetectionTriggerEvent.setSource("External"); + anomalyDetectionTriggerEvent.setTarget("Match"); + anomalyDetectionTriggerEvent.getParameterMap().put("MonitoredValue", new AxField( + new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); + anomalyDetectionTriggerEvent.getParameterMap().put("Iteration", new AxField( + new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), "Iteration"), iteration.getKey())); + + final AxEvent anomalyDetectionMatchEvent = new AxEvent(new AxArtifactKey("AnomalyDetectionMatchEvent", "0.0.1"), + "org.onap.policy.apex.examples.adaptive.events"); + anomalyDetectionMatchEvent.setSource("Match"); + anomalyDetectionMatchEvent.setTarget("Establish"); + anomalyDetectionMatchEvent.getParameterMap().put("MonitoredValue", new AxField( + new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); + anomalyDetectionMatchEvent.getParameterMap().put("Iteration", + new AxField(new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), "Iteration"), iteration.getKey())); + + final AxEvent anomalyDetectionEstablishEvent = + new AxEvent(new AxArtifactKey("AnomalyDetectionEstablishEvent", "0.0.1"), + "org.onap.policy.apex.examples.adaptive.events"); + anomalyDetectionEstablishEvent.setSource("Establish"); + anomalyDetectionEstablishEvent.setTarget("Decide"); + anomalyDetectionEstablishEvent.getParameterMap().put("MonitoredValue", + new AxField(new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), "MonitoredValue"), + monitoredValue.getKey())); + anomalyDetectionEstablishEvent.getParameterMap().put("Iteration", new AxField( + new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), "Iteration"), iteration.getKey())); + + final AxEvent anomalyDetectionDecideEvent = + new AxEvent(new AxArtifactKey("AnomalyDetectionDecideEvent", "0.0.1"), + "org.onap.policy.apex.examples.adaptive.events"); + anomalyDetectionDecideEvent.setSource("Decide"); + anomalyDetectionDecideEvent.setTarget("Act"); + anomalyDetectionDecideEvent.getParameterMap().put("MonitoredValue", new AxField( + new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); + anomalyDetectionDecideEvent.getParameterMap().put("Iteration", + new AxField(new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), "Iteration"), iteration.getKey())); + + final AxEvent anomalyDetectionActEvent = new AxEvent(new AxArtifactKey("AnomalyDetectionActEvent", "0.0.1"), + "org.onap.policy.apex.examples.adaptive.events"); + anomalyDetectionActEvent.setSource("Act"); + anomalyDetectionActEvent.setTarget("External"); + anomalyDetectionActEvent.getParameterMap().put("MonitoredValue", new AxField( + new AxReferenceKey(anomalyDetectionActEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); + anomalyDetectionActEvent.getParameterMap().put("Iteration", + new AxField(new AxReferenceKey(anomalyDetectionActEvent.getKey(), "Iteration"), iteration.getKey())); + + final AxEvents anomalyDetectionEvents = new AxEvents(new AxArtifactKey("AnomalyDetectionEvents", "0.0.1")); + anomalyDetectionEvents.getEventMap().put(anomalyDetectionTriggerEvent.getKey(), anomalyDetectionTriggerEvent); + anomalyDetectionEvents.getEventMap().put(anomalyDetectionMatchEvent.getKey(), anomalyDetectionMatchEvent); + anomalyDetectionEvents.getEventMap().put(anomalyDetectionEstablishEvent.getKey(), + anomalyDetectionEstablishEvent); + anomalyDetectionEvents.getEventMap().put(anomalyDetectionDecideEvent.getKey(), anomalyDetectionDecideEvent); + anomalyDetectionEvents.getEventMap().put(anomalyDetectionActEvent.getKey(), anomalyDetectionActEvent); + + // Data types for context + final AxContextSchema anomalyDetection = new AxContextSchema(new AxArtifactKey("AnomalyDetection", "0.0.1"), + "Java", "org.onap.policy.apex.examples.adaptive.concepts.AnomalyDetection"); + adContextSchemas.getSchemasMap().put(anomalyDetection.getKey(), anomalyDetection); + + // One context map + final AxContextAlbum anomalyDetectionAlbum = new AxContextAlbum( + new AxArtifactKey("AnomalyDetectionAlbum", "0.0.1"), "APPLICATION", true, anomalyDetection.getKey()); + final AxContextAlbums anomalyDetectionAlbums = + new AxContextAlbums(new AxArtifactKey("AnomalyDetectionAlbums", "0.0.1")); + anomalyDetectionAlbums.getAlbumsMap().put(anomalyDetectionAlbum.getKey(), anomalyDetectionAlbum); + + // Tasks + final AxLogicReader logicReader = + new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName()) + .setDefaultLogic("DefaultAnomalyDetectionTask_Logic"); + + final AxTask anomalyDetectionMatchTask = new AxTask(new AxArtifactKey("AnomalyDetectionMatchTask", "0.0.1")); + anomalyDetectionMatchTask.duplicateInputFields(anomalyDetectionTriggerEvent.getParameterMap()); + anomalyDetectionMatchTask.duplicateOutputFields(anomalyDetectionMatchEvent.getParameterMap()); + anomalyDetectionMatchTask + .setTaskLogic(new AxTaskLogic(anomalyDetectionMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask anomalyDetectionEstablishTask = + new AxTask(new AxArtifactKey("AnomalyDetectionEstablishTask", "0.0.1")); + anomalyDetectionEstablishTask.duplicateInputFields(anomalyDetectionMatchEvent.getParameterMap()); + anomalyDetectionEstablishTask.duplicateOutputFields(anomalyDetectionEstablishEvent.getParameterMap()); + anomalyDetectionEstablishTask.setTaskLogic( + new AxTaskLogic(anomalyDetectionEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask anomalyDetectionDecideTask0 = + new AxTask(new AxArtifactKey("AnomalyDetectionDecideTask0", "0.0.1")); + anomalyDetectionDecideTask0.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); + anomalyDetectionDecideTask0.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); + anomalyDetectionDecideTask0 + .setTaskLogic(new AxTaskLogic(anomalyDetectionDecideTask0.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask anomalyDetectionDecideTask1 = + new AxTask(new AxArtifactKey("AnomalyDetectionDecideTask1", "0.0.1")); + anomalyDetectionDecideTask1.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); + anomalyDetectionDecideTask1.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); + anomalyDetectionDecideTask1 + .setTaskLogic(new AxTaskLogic(anomalyDetectionDecideTask1.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask anomalyDetectionDecideTask2 = + new AxTask(new AxArtifactKey("AnomalyDetectionDecideTask2", "0.0.1")); + anomalyDetectionDecideTask2.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); + anomalyDetectionDecideTask2.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); + anomalyDetectionDecideTask2 + .setTaskLogic(new AxTaskLogic(anomalyDetectionDecideTask2.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask anomalyDetectionActTask = new AxTask(new AxArtifactKey("AnomalyDetectionActTask", "0.0.1")); + anomalyDetectionActTask.duplicateInputFields(anomalyDetectionDecideEvent.getParameterMap()); + anomalyDetectionActTask.duplicateOutputFields(anomalyDetectionActEvent.getParameterMap()); + anomalyDetectionActTask + .setTaskLogic(new AxTaskLogic(anomalyDetectionActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTasks anomalyDetectionTasks = new AxTasks(new AxArtifactKey("AnomalyDetectionTasks", "0.0.1")); + anomalyDetectionTasks.getTaskMap().put(anomalyDetectionMatchTask.getKey(), anomalyDetectionMatchTask); + anomalyDetectionTasks.getTaskMap().put(anomalyDetectionEstablishTask.getKey(), anomalyDetectionEstablishTask); + anomalyDetectionTasks.getTaskMap().put(anomalyDetectionDecideTask0.getKey(), anomalyDetectionDecideTask0); + anomalyDetectionTasks.getTaskMap().put(anomalyDetectionDecideTask1.getKey(), anomalyDetectionDecideTask1); + anomalyDetectionTasks.getTaskMap().put(anomalyDetectionDecideTask2.getKey(), anomalyDetectionDecideTask2); + anomalyDetectionTasks.getTaskMap().put(anomalyDetectionActTask.getKey(), anomalyDetectionActTask); + + // Policies + logicReader.setDefaultLogic("DefaultState_Logic"); + + final AxPolicy anomalyDetectionPolicy = new AxPolicy(new AxArtifactKey("AnomalyDetectionPolicy", "0.0.1")); + anomalyDetectionPolicy.setTemplate("MEDA"); + + final AxState anomalyDetectionActState = + new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Act")); + anomalyDetectionActState.setTrigger(anomalyDetectionDecideEvent.getKey()); + final AxStateOutput adAct2Out = new AxStateOutput(anomalyDetectionActState.getKey(), + AxReferenceKey.getNullKey(), anomalyDetectionActEvent.getKey()); + anomalyDetectionActState.getStateOutputs().put(adAct2Out.getKey().getLocalName(), adAct2Out); + anomalyDetectionActState.setTaskSelectionLogic( + new AxTaskSelectionLogic(anomalyDetectionActState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + anomalyDetectionActState.setDefaultTask(anomalyDetectionActTask.getKey()); + anomalyDetectionActState.getTaskReferences().put(anomalyDetectionActTask.getKey(), + new AxStateTaskReference(anomalyDetectionActState.getKey(), anomalyDetectionActTask.getKey(), + AxStateTaskOutputType.DIRECT, adAct2Out.getKey())); + + logicReader.setDefaultLogic(null); + + final AxState anomalyDetectionDecideState = + new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Decide")); + anomalyDetectionDecideState.setTrigger(anomalyDetectionEstablishEvent.getKey()); + final AxStateOutput adDec2Act = new AxStateOutput(anomalyDetectionDecideState.getKey(), + anomalyDetectionActState.getKey(), anomalyDetectionDecideEvent.getKey()); + anomalyDetectionDecideState.getStateOutputs().put(adDec2Act.getKey().getLocalName(), adDec2Act); + anomalyDetectionDecideState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionDecideState.getKey(), + "TaskSelectionLogic", "JAVA", logicReader)); + anomalyDetectionDecideState.setDefaultTask(anomalyDetectionDecideTask0.getKey()); + anomalyDetectionDecideState.getContextAlbumReferences().add(anomalyDetectionAlbum.getKey()); + anomalyDetectionDecideState.getTaskReferences().put(anomalyDetectionDecideTask0.getKey(), + new AxStateTaskReference(anomalyDetectionDecideState.getKey(), anomalyDetectionDecideTask0.getKey(), + AxStateTaskOutputType.DIRECT, adDec2Act.getKey())); + anomalyDetectionDecideState.getTaskReferences().put(anomalyDetectionDecideTask1.getKey(), + new AxStateTaskReference(anomalyDetectionDecideState.getKey(), anomalyDetectionDecideTask1.getKey(), + AxStateTaskOutputType.DIRECT, adDec2Act.getKey())); + anomalyDetectionDecideState.getTaskReferences().put(anomalyDetectionDecideTask2.getKey(), + new AxStateTaskReference(anomalyDetectionDecideState.getKey(), anomalyDetectionDecideTask2.getKey(), + AxStateTaskOutputType.DIRECT, adDec2Act.getKey())); + + logicReader.setDefaultLogic("DefaultState_Logic"); + + final AxState anomalyDetectionEstablishState = + new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Establish")); + anomalyDetectionEstablishState.setTrigger(anomalyDetectionMatchEvent.getKey()); + final AxStateOutput adEst2Dec = new AxStateOutput(anomalyDetectionEstablishState.getKey(), + anomalyDetectionDecideState.getKey(), anomalyDetectionEstablishEvent.getKey()); + anomalyDetectionEstablishState.getStateOutputs().put(adEst2Dec.getKey().getLocalName(), adEst2Dec); + anomalyDetectionEstablishState.setTaskSelectionLogic(new AxTaskSelectionLogic( + anomalyDetectionEstablishState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + anomalyDetectionEstablishState.setDefaultTask(anomalyDetectionEstablishTask.getKey()); + anomalyDetectionEstablishState.getTaskReferences().put(anomalyDetectionEstablishTask.getKey(), + new AxStateTaskReference(anomalyDetectionEstablishState.getKey(), + anomalyDetectionEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, adEst2Dec.getKey())); + + final AxState anomalyDetectionMatchState = + new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Match")); + anomalyDetectionMatchState.setTrigger(anomalyDetectionTriggerEvent.getKey()); + final AxStateOutput adMat2Est = new AxStateOutput(anomalyDetectionMatchState.getKey(), + anomalyDetectionEstablishState.getKey(), anomalyDetectionMatchEvent.getKey()); + anomalyDetectionMatchState.getStateOutputs().put(adMat2Est.getKey().getLocalName(), adMat2Est); + anomalyDetectionMatchState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionMatchState.getKey(), + "TaskSelectionLogic", "MVEL", logicReader)); + anomalyDetectionMatchState.setDefaultTask(anomalyDetectionMatchTask.getKey()); + anomalyDetectionMatchState.getTaskReferences().put(anomalyDetectionMatchTask.getKey(), + new AxStateTaskReference(anomalyDetectionMatchState.getKey(), anomalyDetectionMatchTask.getKey(), + AxStateTaskOutputType.DIRECT, adMat2Est.getKey())); + + anomalyDetectionPolicy.setFirstState(anomalyDetectionMatchState.getKey().getLocalName()); + anomalyDetectionPolicy.getStateMap().put(anomalyDetectionMatchState.getKey().getLocalName(), + anomalyDetectionMatchState); + anomalyDetectionPolicy.getStateMap().put(anomalyDetectionEstablishState.getKey().getLocalName(), + anomalyDetectionEstablishState); + anomalyDetectionPolicy.getStateMap().put(anomalyDetectionDecideState.getKey().getLocalName(), + anomalyDetectionDecideState); + anomalyDetectionPolicy.getStateMap().put(anomalyDetectionActState.getKey().getLocalName(), + anomalyDetectionActState); + + final AxPolicies anomalyDetectionPolicies = + new AxPolicies(new AxArtifactKey("AnomalyDetectionPolicies", "0.0.1")); + anomalyDetectionPolicies.getPolicyMap().put(anomalyDetectionPolicy.getKey(), anomalyDetectionPolicy); + + final AxKeyInformation keyInformation = + new AxKeyInformation(new AxArtifactKey("AnomalyDetectionKeyInformation", "0.0.1")); + final AxPolicyModel anomalyDetectionPolicyModel = + new AxPolicyModel(new AxArtifactKey("AnomalyDetectionPolicyModel", "0.0.1")); + anomalyDetectionPolicyModel.setPolicies(anomalyDetectionPolicies); + anomalyDetectionPolicyModel.setEvents(anomalyDetectionEvents); + anomalyDetectionPolicyModel.setTasks(anomalyDetectionTasks); + anomalyDetectionPolicyModel.setAlbums(anomalyDetectionAlbums); + anomalyDetectionPolicyModel.setSchemas(adContextSchemas); + anomalyDetectionPolicyModel.setKeyInformation(keyInformation); + anomalyDetectionPolicyModel.getKeyInformation().generateKeyInfo(anomalyDetectionPolicyModel); + + final AxValidationResult result = anomalyDetectionPolicyModel.validate(new AxValidationResult()); + if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) { + throw new ApexRuntimeException("model " + anomalyDetectionPolicyModel.getID() + " is not valid" + result); + } + return anomalyDetectionPolicyModel; + } + + /** + * Gets the auto learn policy model. + * + * @return the auto learn policy model + */ + // CHECKSTYLE:OFF: checkstyle:maximumMethodLength + public AxPolicyModel getAutoLearnPolicyModel() { + // CHECKSTYLE:ON: checkstyle:maximumMethodLength + // Data types for event parameters + final AxContextSchema monitoredValue = + new AxContextSchema(new AxArtifactKey("MonitoredValue", "0.0.1"), "Java", "java.lang.Double"); + + final AxContextSchemas alContextSchemas = new AxContextSchemas(new AxArtifactKey("ALDatatypes", "0.0.1")); + alContextSchemas.getSchemasMap().put(monitoredValue.getKey(), monitoredValue); + + final AxEvent autoLearnTriggerEvent = new AxEvent(new AxArtifactKey("AutoLearnTriggerEvent", "0.0.1"), + "org.onap.policy.apex.examples.adaptive.events"); + autoLearnTriggerEvent.setSource("External"); + autoLearnTriggerEvent.setTarget("Match"); + autoLearnTriggerEvent.getParameterMap().put("MonitoredValue", new AxField( + new AxReferenceKey(autoLearnTriggerEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); + autoLearnTriggerEvent.getParameterMap().put("LastMonitoredValue", new AxField( + new AxReferenceKey(autoLearnTriggerEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); + + final AxEvent autoLearnMatchEvent = new AxEvent(new AxArtifactKey("AutoLearnMatchEvent", "0.0.1"), + "org.onap.policy.apex.examples.adaptive.events"); + autoLearnMatchEvent.setSource("Match"); + autoLearnMatchEvent.setTarget("Establish"); + autoLearnMatchEvent.getParameterMap().put("MonitoredValue", new AxField( + new AxReferenceKey(autoLearnMatchEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); + autoLearnMatchEvent.getParameterMap().put("LastMonitoredValue", new AxField( + new AxReferenceKey(autoLearnMatchEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); + + final AxEvent autoLearnEstablishEvent = new AxEvent(new AxArtifactKey("AutoLearnEstablishEvent", "0.0.1"), + "org.onap.policy.apex.examples.adaptive.events"); + autoLearnEstablishEvent.setSource("Establish"); + autoLearnEstablishEvent.setTarget("Decide"); + autoLearnEstablishEvent.getParameterMap().put("MonitoredValue", new AxField( + new AxReferenceKey(autoLearnEstablishEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); + autoLearnEstablishEvent.getParameterMap().put("LastMonitoredValue", new AxField( + new AxReferenceKey(autoLearnEstablishEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); + + final AxEvent autoLearnDecideEvent = new AxEvent(new AxArtifactKey("AutoLearnDecideEvent", "0.0.1"), + "org.onap.policy.apex.examples.adaptive.events"); + autoLearnDecideEvent.setSource("Decide"); + autoLearnDecideEvent.setTarget("Act"); + autoLearnDecideEvent.getParameterMap().put("MonitoredValue", new AxField( + new AxReferenceKey(autoLearnDecideEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); + autoLearnDecideEvent.getParameterMap().put("LastMonitoredValue", new AxField( + new AxReferenceKey(autoLearnDecideEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); + + final AxEvent autoLearnActEvent = new AxEvent(new AxArtifactKey("AutoLearnActEvent", "0.0.1"), + "org.onap.policy.apex.examples.adaptive.events"); + autoLearnActEvent.setSource("Act"); + autoLearnActEvent.setTarget("External"); + autoLearnActEvent.getParameterMap().put("MonitoredValue", + new AxField(new AxReferenceKey(autoLearnActEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); + autoLearnActEvent.getParameterMap().put("LastMonitoredValue", new AxField( + new AxReferenceKey(autoLearnActEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); + + final AxEvents autoLearnEvents = new AxEvents(new AxArtifactKey("AutoLearnEvents", "0.0.1")); + autoLearnEvents.getEventMap().put(autoLearnTriggerEvent.getKey(), autoLearnTriggerEvent); + autoLearnEvents.getEventMap().put(autoLearnMatchEvent.getKey(), autoLearnMatchEvent); + autoLearnEvents.getEventMap().put(autoLearnEstablishEvent.getKey(), autoLearnEstablishEvent); + autoLearnEvents.getEventMap().put(autoLearnDecideEvent.getKey(), autoLearnDecideEvent); + autoLearnEvents.getEventMap().put(autoLearnActEvent.getKey(), autoLearnActEvent); + + // Data types for context + final AxContextSchema autoLearn = new AxContextSchema(new AxArtifactKey("AutoLearn", "0.0.1"), "Java", + "org.onap.policy.apex.examples.adaptive.concepts.AutoLearn"); + alContextSchemas.getSchemasMap().put(autoLearn.getKey(), autoLearn); + + // One context map + final AxContextAlbum autoLearnAlbum = new AxContextAlbum(new AxArtifactKey("AutoLearnAlbum", "0.0.1"), + "APPLICATION", true, autoLearn.getKey()); + + final AxContextAlbums autoLearnAlbums = new AxContextAlbums(new AxArtifactKey("AutoLearnContext", "0.0.1")); + autoLearnAlbums.getAlbumsMap().put(autoLearnAlbum.getKey(), autoLearnAlbum); + + // Tasks + final AxLogicReader logicReader = new PolicyLogicReader() + .setLogicPackage(this.getClass().getPackage().getName()).setDefaultLogic("DefaultAutoLearnTask_Logic"); + + final AxTask autoLearnMatchTask = new AxTask(new AxArtifactKey("AutoLearnMatchTask", "0.0.1")); + autoLearnMatchTask.duplicateInputFields(autoLearnTriggerEvent.getParameterMap()); + autoLearnMatchTask.duplicateOutputFields(autoLearnMatchEvent.getParameterMap()); + autoLearnMatchTask.setTaskLogic(new AxTaskLogic(autoLearnMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask autoLearnEstablishTask = new AxTask(new AxArtifactKey("AutoLearnEstablishTask", "0.0.1")); + autoLearnEstablishTask.duplicateInputFields(autoLearnMatchEvent.getParameterMap()); + autoLearnEstablishTask.duplicateOutputFields(autoLearnEstablishEvent.getParameterMap()); + autoLearnEstablishTask + .setTaskLogic(new AxTaskLogic(autoLearnEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + logicReader.setDefaultLogic(null); + + final AxTask autoLearnDecideTask0 = new AxTask(new AxArtifactKey("AutoLearnDecideTask0", "0.0.1")); + autoLearnDecideTask0.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); + autoLearnDecideTask0.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); + autoLearnDecideTask0 + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask0.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask autoLearnDecideTask1 = new AxTask(new AxArtifactKey("AutoLearnDecideTask1", "0.0.1")); + autoLearnDecideTask1.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); + autoLearnDecideTask1.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); + autoLearnDecideTask1 + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask1.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask autoLearnDecideTask2 = new AxTask(new AxArtifactKey("AutoLearnDecideTask2", "0.0.1")); + autoLearnDecideTask2.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); + autoLearnDecideTask2.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); + autoLearnDecideTask2 + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask2.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask autoLearnDecideTask3 = new AxTask(new AxArtifactKey("AutoLearnDecideTask3", "0.0.1")); + autoLearnDecideTask3.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); + autoLearnDecideTask3.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); + autoLearnDecideTask3 + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask3.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask autoLearnDecideTask4 = new AxTask(new AxArtifactKey("AutoLearnDecideTask4", "0.0.1")); + autoLearnDecideTask4.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); + autoLearnDecideTask4.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); + autoLearnDecideTask4 + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask4.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask autoLearnDecideTask5 = new AxTask(new AxArtifactKey("AutoLearnDecideTask5", "0.0.1")); + autoLearnDecideTask5.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); + autoLearnDecideTask5.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); + autoLearnDecideTask5 + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask5.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask autoLearnDecideTask6 = new AxTask(new AxArtifactKey("AutoLearnDecideTask6", "0.0.1")); + autoLearnDecideTask6.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); + autoLearnDecideTask6.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); + autoLearnDecideTask6 + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask6.getKey(), "TaskLogic", "MVEL", logicReader)); + + logicReader.setDefaultLogic("DefaultAutoLearnTask_Logic"); + + final AxTask autoLearnActTask = new AxTask(new AxArtifactKey("AutoLearnActTask", "0.0.1")); + autoLearnActTask.duplicateInputFields(autoLearnDecideEvent.getParameterMap()); + autoLearnActTask.duplicateOutputFields(autoLearnActEvent.getParameterMap()); + autoLearnActTask.setTaskLogic(new AxTaskLogic(autoLearnActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTasks autoLearnTasks = new AxTasks(new AxArtifactKey("AutoLearnTasks", "0.0.1")); + autoLearnTasks.getTaskMap().put(autoLearnMatchTask.getKey(), autoLearnMatchTask); + autoLearnTasks.getTaskMap().put(autoLearnEstablishTask.getKey(), autoLearnEstablishTask); + autoLearnTasks.getTaskMap().put(autoLearnDecideTask0.getKey(), autoLearnDecideTask0); + autoLearnTasks.getTaskMap().put(autoLearnDecideTask1.getKey(), autoLearnDecideTask1); + autoLearnTasks.getTaskMap().put(autoLearnDecideTask2.getKey(), autoLearnDecideTask2); + autoLearnTasks.getTaskMap().put(autoLearnDecideTask3.getKey(), autoLearnDecideTask3); + autoLearnTasks.getTaskMap().put(autoLearnDecideTask4.getKey(), autoLearnDecideTask4); + autoLearnTasks.getTaskMap().put(autoLearnDecideTask5.getKey(), autoLearnDecideTask5); + autoLearnTasks.getTaskMap().put(autoLearnDecideTask6.getKey(), autoLearnDecideTask6); + autoLearnTasks.getTaskMap().put(autoLearnActTask.getKey(), autoLearnActTask); + + // Policies + logicReader.setDefaultLogic("DefaultState_Logic"); + + final AxPolicy autoLearnPolicy = new AxPolicy(new AxArtifactKey("AutoLearnPolicy", "0.0.1")); + autoLearnPolicy.setTemplate("MEDA"); + + final AxState autoLearnActState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Act")); + autoLearnActState.setTrigger(autoLearnDecideEvent.getKey()); + final AxStateOutput alAct2Out = + new AxStateOutput(autoLearnActState.getKey(), AxReferenceKey.getNullKey(), autoLearnActEvent.getKey()); + autoLearnActState.getStateOutputs().put(alAct2Out.getKey().getLocalName(), alAct2Out); + autoLearnActState.setTaskSelectionLogic( + new AxTaskSelectionLogic(autoLearnActState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + autoLearnActState.setDefaultTask(autoLearnActTask.getKey()); + autoLearnActState.getTaskReferences().put(autoLearnActTask.getKey(), + new AxStateTaskReference(autoLearnActState.getKey(), autoLearnActTask.getKey(), + AxStateTaskOutputType.DIRECT, alAct2Out.getKey())); + + logicReader.setDefaultLogic(null); + + final AxState autoLearnDecideState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Decide")); + autoLearnDecideState.setTrigger(autoLearnEstablishEvent.getKey()); + final AxStateOutput alDec2Act = new AxStateOutput(autoLearnDecideState.getKey(), autoLearnActState.getKey(), + autoLearnDecideEvent.getKey()); + autoLearnDecideState.getStateOutputs().put(alDec2Act.getKey().getLocalName(), alDec2Act); + autoLearnDecideState.getContextAlbumReferences().add(autoLearnAlbum.getKey()); + autoLearnDecideState.setTaskSelectionLogic( + new AxTaskSelectionLogic(autoLearnDecideState.getKey(), "TaskSelectionLogic", "JAVA", logicReader)); + autoLearnDecideState.setDefaultTask(autoLearnDecideTask0.getKey()); + autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask0.getKey(), + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask0.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask1.getKey(), + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask1.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask2.getKey(), + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask2.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask3.getKey(), + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask3.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask4.getKey(), + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask4.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask5.getKey(), + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask5.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask6.getKey(), + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask6.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + + logicReader.setDefaultLogic("DefaultState_Logic"); + + final AxState autoLearnEstablishState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Establish")); + autoLearnEstablishState.setTrigger(autoLearnMatchEvent.getKey()); + final AxStateOutput alEst2Dec = new AxStateOutput(autoLearnEstablishState.getKey(), + autoLearnDecideState.getKey(), autoLearnEstablishEvent.getKey()); + autoLearnEstablishState.getStateOutputs().put(alEst2Dec.getKey().getLocalName(), alEst2Dec); + autoLearnEstablishState.setTaskSelectionLogic( + new AxTaskSelectionLogic(autoLearnEstablishState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + autoLearnEstablishState.setDefaultTask(autoLearnEstablishTask.getKey()); + autoLearnEstablishState.getTaskReferences().put(autoLearnEstablishTask.getKey(), + new AxStateTaskReference(autoLearnEstablishState.getKey(), autoLearnEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, alEst2Dec.getKey())); + + final AxState autoLearnMatchState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Match")); + autoLearnMatchState.setTrigger(autoLearnTriggerEvent.getKey()); + final AxStateOutput alMat2Est = new AxStateOutput(autoLearnMatchState.getKey(), + autoLearnEstablishState.getKey(), autoLearnMatchEvent.getKey()); + autoLearnMatchState.getStateOutputs().put(alMat2Est.getKey().getLocalName(), alMat2Est); + autoLearnMatchState.setTaskSelectionLogic( + new AxTaskSelectionLogic(autoLearnMatchState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + autoLearnMatchState.setDefaultTask(autoLearnMatchTask.getKey()); + autoLearnMatchState.getTaskReferences().put(autoLearnMatchTask.getKey(), + new AxStateTaskReference(autoLearnMatchState.getKey(), autoLearnMatchTask.getKey(), + AxStateTaskOutputType.DIRECT, alMat2Est.getKey())); + + autoLearnPolicy.setFirstState(autoLearnMatchState.getKey().getLocalName()); + autoLearnPolicy.getStateMap().put(autoLearnMatchState.getKey().getLocalName(), autoLearnMatchState); + autoLearnPolicy.getStateMap().put(autoLearnEstablishState.getKey().getLocalName(), autoLearnEstablishState); + autoLearnPolicy.getStateMap().put(autoLearnDecideState.getKey().getLocalName(), autoLearnDecideState); + autoLearnPolicy.getStateMap().put(autoLearnActState.getKey().getLocalName(), autoLearnActState); + + final AxPolicies autoLearnPolicies = new AxPolicies(new AxArtifactKey("AutoLearnPolicies", "0.0.1")); + autoLearnPolicies.getPolicyMap().put(autoLearnPolicy.getKey(), autoLearnPolicy); + + final AxKeyInformation keyInformation = + new AxKeyInformation(new AxArtifactKey("AutoLearnKeyInformation", "0.0.1")); + final AxPolicyModel autoLearnPolicyModel = + new AxPolicyModel(new AxArtifactKey("AutoLearnPolicyModel", "0.0.1")); + autoLearnPolicyModel.setPolicies(autoLearnPolicies); + autoLearnPolicyModel.setEvents(autoLearnEvents); + autoLearnPolicyModel.setTasks(autoLearnTasks); + autoLearnPolicyModel.setAlbums(autoLearnAlbums); + autoLearnPolicyModel.setSchemas(alContextSchemas); + autoLearnPolicyModel.setKeyInformation(keyInformation); + autoLearnPolicyModel.getKeyInformation().generateKeyInfo(autoLearnPolicyModel); + + final AxValidationResult result = autoLearnPolicyModel.validate(new AxValidationResult()); + if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) { + throw new ApexRuntimeException("model " + autoLearnPolicyModel.getID() + " is not valid" + result); + } + return autoLearnPolicyModel; + } + +} diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java new file mode 100644 index 000000000..0cc9bd3a2 --- /dev/null +++ b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java @@ -0,0 +1,64 @@ +/*- + * ============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.examples.adaptive.model; + +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +/** + * This class saves sample domain models to disk in XML and JSON format. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public final class AdaptiveDomainModelSaver { + /** + * Private default constructor to prevent subclassing. + */ + private AdaptiveDomainModelSaver() {} + + /** + * Write the AADM model to args[0]. + * + * @param args Not used + * @throws ApexException the apex exception + */ + public static void main(final String[] args) throws ApexException { + if (args.length != 1) { + System.err.println("usage: " + AdaptiveDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + return; + } + + // Save Anomaly Detection model + final AxPolicyModel adPolicyModel = new AdaptiveDomainModelFactory().getAnomalyDetectionPolicyModel(); + final ApexModelSaver adModelSaver = + new ApexModelSaver<>(AxPolicyModel.class, adPolicyModel, args[0]); + adModelSaver.apexModelWriteJSON(); + adModelSaver.apexModelWriteXML(); + + // Save Auto Learn model + final AxPolicyModel alPolicyModel = new AdaptiveDomainModelFactory().getAutoLearnPolicyModel(); + final ApexModelSaver alModelSaver = + new ApexModelSaver<>(AxPolicyModel.class, alPolicyModel, args[0]); + alModelSaver.apexModelWriteJSON(); + alModelSaver.apexModelWriteXML(); + } +} diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java new file mode 100644 index 000000000..a0b2a8f40 --- /dev/null +++ b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java @@ -0,0 +1,414 @@ +/*- + * ============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.examples.adaptive.model.java; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.math3.distribution.TDistribution; +import org.apache.commons.math3.util.FastMath; +import org.onap.policy.apex.core.engine.executor.context.TaskSelectionExecutionContext; +import org.onap.policy.apex.examples.adaptive.concepts.AnomalyDetection; +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; +import org.slf4j.Logger; + +/** + * The Class AnomalyDetectionPolicy_Decide_TaskSelectionLogic. + */ +// CHECKSTYLE:OFF: checkstyle:className +public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { + // CHECKSTYLE:ON: checkstyle:className + + private Logger logger; + // configuration + private static final double ANOMALY_SENSITIVITY = 0.05; + private static final int FREQUENCY = 360; + + /** + * A map to hold the Anomaly degree/levels/probabilities required for each task.
+ * If there is no task defined for a calculated anomaly-degree, then the default task is used.
+ * The map use (LinkedHashMap) is an insertion-ordered map, so the first interval matching a query is used. + */ + // CHECKSTYLE:OFF: checkstyle:magicNumber + private static final Map TASK_INTERVALS = new LinkedHashMap<>(); + static { + TASK_INTERVALS.put(new double[] { 0.0, 0.1 }, null); // null will mean default task + TASK_INTERVALS.put(new double[] { 0.25, 0.5 }, "AnomalyDetectionDecideTask1"); + TASK_INTERVALS.put(new double[] { 0.5, 1.01 }, "AnomalyDetectionDecideTask2"); + } + // CHECKSTYLE:ON: checkstyle:magicNumber + + private volatile TaskSelectionExecutionContext executionContext; + + /** + * Gets the task. + * + * @param executor the executor + * @return the task + */ + public boolean getTask(final TaskSelectionExecutionContext executor) { + executionContext = executor; + logger = executionContext.logger; + logger.debug(executor.subject.getId()); + logger.debug(executor.inFields.toString()); + final double now = (Double) (executor.inFields.get("MonitoredValue")); + final Integer iteration = (Integer) (executor.inFields.get("Iteration")); + final double[] vals = this.forecastingAndAnomaly(now); // double[forecastedValue, AnomalyScore, + // AnomalyProbability] + final double anomalyness = vals[2]; + String task = null; + for (final Map.Entry i : TASK_INTERVALS.entrySet()) { + if (checkInterval(anomalyness, i.getKey())) { + task = i.getValue(); + break; + } + } + if (task == null) { + executionContext.subject.getDefaultTaskKey().copyTo(executionContext.selectedTask); + } else { + executionContext.subject.getTaskKey(task).copyTo(executionContext.selectedTask); + } + if (logger.isDebugEnabled()) { + logger.debug( + "TestAnomalyDetectionTSLPolicy0000DecideStateTaskSelectionLogic.getTask():\t************\t\t\t\t" + + "Iteration:\t" + iteration + "\tValue:\t" + now + "\tForecast:\t" + vals[0] + + "\tAnomalyScore:\t" + vals[1] + "\tAnomalyProbability:\t" + vals[2] + "\tInvoking Task:\t" + + executionContext.selectedTask); + } + return true; + } + + /** + * Anomaly detection and forecast. + * + * @param value The current value + * @return Null if the function can not be executed correctly, otherwise double[forecastedValue, AnomalyScore, + * AnomalyProbability] + */ + public double[] forecastingAndAnomaly(final double value) { + try { + executionContext.getContextAlbum("AnomalyDetectionAlbum").lockForWriting("AnomalyDetection"); + } catch (final ApexException e) { + logger.error("Failed to acquire write lock on \"AnomalyDetection\" context", e); + return null; + } + + // Get the context object + AnomalyDetection anomalyDetection = + (AnomalyDetection) executionContext.getContextAlbum("AnomalyDetectionAlbum").get("AnomalyDetection"); + if (anomalyDetection == null) { + anomalyDetection = new AnomalyDetection(); + executionContext.getContextAlbum("AnomalyDetectionAlbum").put("AnomalyDetection", anomalyDetection); + } + + // Check the lists are initialized + if (!anomalyDetection.isInitialized()) { + anomalyDetection.init(FREQUENCY); + } + + boolean unsetfirstround = false; + + int frequency = anomalyDetection.getFrequency(); + frequency = frequency + 1; + + // reset frequency counter + if (frequency >= FREQUENCY) { + unsetfirstround = true; + frequency = 0; + } + anomalyDetection.setFrequency(frequency); + + if (unsetfirstround && anomalyDetection.getFirstRound()) { + anomalyDetection.setFirstRound(false); + } + + // --------- calculate the forecasted value - simple version + final Double lastForecast = anomalyDetection.getFrequencyForecasted().get(frequency); + + // get forecast for current value + final double forecastedValue = lastForecast == null ? value : expMovingAverage(value, lastForecast); + + // --------- calculate the anomalyScore + final double anomalyScore = lastForecast == null ? 0.0 : FastMath.abs(lastForecast - value); + + anomalyDetection.getFrequencyForecasted().set(frequency, forecastedValue); + + // anomaly score is ignored in the first frequency period + if (!anomalyDetection.getFirstRound()) { + ((LinkedList) anomalyDetection.getAnomalyScores()).addLast(anomalyScore); + } + + // CHECKSTYLE:OFF: checkstyle:magicNumber + // max FREQUENCY*4 anomaly scores history + listSizeControl(anomalyDetection.getAnomalyScores(), FREQUENCY * 4); + + // ---------- calculate the anomaly probability + double anomalyProbability = 0.0; + if (anomalyDetection.getAnomalyScores().size() > 30) { + // 0.5 + anomalyProbability = gStatsTest(anomalyDetection.getAnomalyScores(), ANOMALY_SENSITIVITY); + } + // CHECKSTYLE:ON: checkstyle:magicNumber + + try { + executionContext.getContextAlbum("AnomalyDetectionAlbum").unlockForWriting("AnomalyDetection"); + } catch (final ApexException e) { + logger.error("Failed to release write lock on \"AnomalyDetection\" context", e); + return null; + } + + return new double[] { forecastedValue, anomalyScore, anomalyProbability }; + } + + /** + * Is the passed value inside the interval, i.e. (value=interval[0]) + * + * @param value The value to check + * @param interval A 2 element double array describing an interval + * @return true if the value is between interval[0] (inclusive) and interval[1] (exclusive), i.e. (value=interval[0]). Otherwise false; + */ + private static boolean checkInterval(final double value, final double[] interval) { + if (interval == null || interval.length != 2) { + throw new IllegalArgumentException("something other than an interval passed to checkInterval"); + } + final double min = interval[0]; + final double max = interval[1]; + return (value < max && value >= min); + } + + /** + * calculate the anomaly probability using statistical test. + * + * @param values the values + * @param significanceLevel the significance level + * @return the double + */ + private static double gStatsTest(final List values, final double significanceLevel) { + if (isAllEqual(values)) { + return 0.0; + } + // the targeted value or the last value + final double currentV = values.get(values.size() - 1); + Double[] lValuesCopy = values.toArray(new Double[values.size()]); + Arrays.sort(lValuesCopy); // takes ~40% of method time + // if(logger.isDebugEnabled()){ + // logger.debug("values:" + Arrays.toString(lValuesCopy)); + // } + // get mean + double mean = getMean(lValuesCopy); + // get the test value: v + double v = getV(lValuesCopy, mean, true); + // get the p value for the test value + double pValue = getPValue(lValuesCopy, v, mean); // takes approx 25% of method time + // if(logger.isDebugEnabled()){ + // logger.debug("pValue:" + pValue); + // } + + // check the critical level + 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) { + return score; + } + // do the critical check again for the left values + lValuesCopy = removevalue(lValuesCopy, v); + if (isAllEqual(lValuesCopy)) { + return 0.0; + } + // if(logger.isDebugEnabled()){ + // logger.debug("left values:" + Arrays.toString(lValuesCopy)); + // } + mean = getMean(lValuesCopy); + v = getV(lValuesCopy, mean, true); + pValue = getPValue(lValuesCopy, v, mean); + } + return 0.0; + } + + /** + * get the test value based on mean from sorted values. + * + * @param lValues the l values + * @param mean the mean + * @param maxValueOnly : only the max extreme value will be tested + * @return the value to be tested + */ + private static double getV(final Double[] lValues, final double mean, final boolean maxValueOnly) { + double v = lValues[lValues.length - 1]; + // max value as the extreme value + if (maxValueOnly) { + return v; + } + // check the extreme side + if ((v - mean) < (mean - lValues[0])) { + v = lValues[0]; + } + return v; + } + + /** + * calculate the P value for the t distribution. + * + * @param lValues the l values + * @param v the v + * @param mean the mean + * @return the p value + */ + private static double getPValue(final Double[] lValues, final double v, final double mean) { + // calculate z value + final double z = FastMath.abs(v - mean) / getStdDev(lValues, mean); + // logger.debug("z: " + z); + // calculate T + final double n = lValues.length; + final double s = (z * z * n * (2.0 - n)) / (z * z * n - (n - 1.0) * (n - 1.0)); + final double t = FastMath.sqrt(s); + // logger.debug("t:" + t); + // default p value = 0 + double pValue = 0.0; + if (!Double.isNaN(t)) { + // t distribution with n-2 degrees of freedom + final TDistribution tDist = new TDistribution(n - 2); + pValue = n * (1.0 - tDist.cumulativeProbability(t)); + // set max pValue = 1 + pValue = pValue > 1.0 ? 1.0 : pValue; + } + // logger.debug("value: "+ v + " , pValue: " + pValue); + return pValue; + } + + /* + * Some utility methods + */ + // exponential = 2(n+1) + private static final double EMA_EXPONENT = 2.0 / (7.0 + 1.0); + private static final double EMA_EXPONENT_1 = (1.0 - EMA_EXPONENT); + + /** + * exponential moving average. + * + * @param value the value + * @param lastForecast the last forecast + * @return the double + */ + private static double expMovingAverage(final double value, final double lastForecast) { + return (value * EMA_EXPONENT) + (lastForecast * EMA_EXPONENT_1); + } + + /** + * Remove the first occurence of the value v from the array. + * + * @param lValues the l values + * @param v the v + * @return the double[] + */ + private static Double[] removevalue(final Double[] lValues, final double v) { + for (int i = 0; i < lValues.length; i++) { + if (lValues[i] == v) { + 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); + return ret; + } + } + return lValues; + } + + /** + * get mean value of double list. + * + * @param lValues the l values + * @return the mean + */ + private static double getMean(final Double[] lValues) { + double sum = 0.0; + for (final double d : lValues) { + + sum += d; + } + return sum / lValues.length; + } + + /** + * get standard deviation of double list. + * + * @param lValues the l values + * @param mean the mean + * @return stddev + */ + private static double getStdDev(final Double[] lValues, final double mean) { + double temp = 0.0; + for (final double d : lValues) { + temp += (mean - d) * (mean - d); + } + return FastMath.sqrt(temp / lValues.length); + } + + /** + * Chop head off list to make it length max . + * + * @param list the list to chop + * @param max the max size + */ + private static void listSizeControl(final List list, final int max) { + final int k = list.size(); + if (k > max) { + // Chop the head off the list. + list.subList(0, k - max).clear(); + } + } + + /** + * return true if all values are equal. + * + * @param lValues the l values + * @return true, if checks if is all equal + */ + private static boolean isAllEqual(final List lValues) { + final double first = lValues.get(0); + for (final Double d : lValues) { + if (d != first) { + return false; + } + } + return true; + } + + /** + * return true if all values are equal. + * + * @param lValues the l values + * @return true, if checks if is all equal + */ + private static boolean isAllEqual(final Double[] lValues) { + final double first = lValues[0]; + for (final Double d : lValues) { + if (d != first) { + return false; + } + } + return true; + } +} diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicy_Decide_TaskSelectionLogic.java b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicy_Decide_TaskSelectionLogic.java new file mode 100644 index 000000000..23d4e2486 --- /dev/null +++ b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicy_Decide_TaskSelectionLogic.java @@ -0,0 +1,151 @@ +/*- + * ============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.examples.adaptive.model.java; + +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +import org.onap.policy.apex.context.ContextException; +import org.onap.policy.apex.core.engine.executor.context.TaskSelectionExecutionContext; +import org.onap.policy.apex.examples.adaptive.concepts.AutoLearn; + +/** + * The Class AutoLearnPolicy_Decide_TaskSelectionLogic. + */ +// CHECKSTYLE:OFF: checkstyle:typeName +public class AutoLearnPolicy_Decide_TaskSelectionLogic { + // CHECKSTYLE:ON: checkstyle:typeName + private static final Random RAND = new Random(System.currentTimeMillis()); + private static final double WANT = 50.0; + private int size; + + /** + * Gets the task. + * + * @param executor the executor + * @return the task + */ + public boolean getTask(final TaskSelectionExecutionContext executor) { + executor.logger.debug(executor.subject.getId()); + executor.logger.debug(executor.inFields.toString()); + final List tasks = executor.subject.getTaskNames(); + size = tasks.size(); + + try { + executor.getContextAlbum("AutoLearnAlbum").lockForWriting("AutoLearn"); + } catch (final ContextException e) { + executor.logger.error("Failed to acquire write lock on \"autoLearn\" context", e); + return false; + } + + // Get the context object + AutoLearn autoLearn = (AutoLearn) executor.getContextAlbum("AutoLearnAlbum").get("AutoLearn"); + if (autoLearn == null) { + autoLearn = new AutoLearn(); + } + + // Check the lists are initialized + if (!autoLearn.isInitialized()) { + autoLearn.init(size); + } + + final double now = (Double) (executor.inFields.get("MonitoredValue")); + final double diff = now - WANT; + final int option = getOption(diff, autoLearn); + learn(option, diff, autoLearn); + + executor.getContextAlbum("AutoLearnAlbum").put("AutoLearnAlbum", autoLearn); + + try { + executor.getContextAlbum("AutoLearnAlbum").unlockForWriting("AutoLearn"); + } catch (final ContextException e) { + executor.logger.error("Failed to acquire write lock on \"autoLearn\" context", e); + return false; + } + + executor.subject.getTaskKey(tasks.get(option)).copyTo(executor.selectedTask); + return true; + } + + /** + * Gets the option. + * + * @param diff the diff + * @param autoLearn the auto learn + * @return the option + */ + private int getOption(final double diff, final AutoLearn autoLearn) { + final Double[] avdiffs = autoLearn.getAvDiffs().toArray(new Double[autoLearn.getAvDiffs().size()]); + final int r = RAND.nextInt(size); + int closestupi = -1; + int closestdowni = -1; + double closestup = Double.MAX_VALUE; + double closestdown = Double.MIN_VALUE; + for (int i = 0; i < size; i++) { + if (Double.isNaN(avdiffs[i])) { + return r; + } + if (avdiffs[i] >= diff && avdiffs[i] <= closestup) { + closestup = avdiffs[i]; + closestupi = i; + } + if (avdiffs[i] <= diff && avdiffs[i] >= closestdown) { + closestdown = avdiffs[i]; + closestdowni = i; + } + } + if (closestupi == -1 || closestdowni == -1) { + return r; + } + if (closestupi == closestdowni) { + return closestupi; + } + if (Math.abs(closestdown - diff) > Math.abs(closestup - diff)) { + return closestupi; + } else { + return closestdowni; + } + } + + /** + * Learn. + * + * @param option the option + * @param diff the diff + * @param autoLearn the auto learn + */ + private void learn(final int option, final double diff, final AutoLearn autoLearn) { + final Double[] avdiffs = autoLearn.getAvDiffs().toArray(new Double[autoLearn.getAvDiffs().size()]); + final Long[] counts = autoLearn.getCounts().toArray(new Long[autoLearn.getCounts().size()]); + if (option < 0 || option >= avdiffs.length) { + throw new IllegalArgumentException("Error: option" + option); + } + counts[option]++; + if (Double.isNaN(avdiffs[option])) { + avdiffs[option] = diff; + } else { + avdiffs[option] = (avdiffs[option] * (counts[option] - 1) + diff) / counts[option]; + } + autoLearn.setAvDiffs(Arrays.asList(avdiffs)); + autoLearn.setCounts(Arrays.asList(counts)); + } +} diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/package-info.java b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/package-info.java new file mode 100644 index 000000000..172be5ada --- /dev/null +++ b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/package-info.java @@ -0,0 +1,27 @@ +/*- + * ============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========================================================= + */ + +/** + * Pprovides task selection logic for the adaptive domain in Java. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ + +package org.onap.policy.apex.examples.adaptive.model.java; diff --git a/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/package-info.java b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/package-info.java new file mode 100644 index 000000000..d38333ba8 --- /dev/null +++ b/examples/adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/package-info.java @@ -0,0 +1,27 @@ +/*- + * ============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========================================================= + */ + +/** + * Provides Java generation of the Adaptive model as well as Java task selection logic for the domain. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ + +package org.onap.policy.apex.examples.adaptive.model; diff --git a/examples/adaptive/src/main/resources/examples/events/Adaptive/AnomalyDetectionEvents.json b/examples/adaptive/src/main/resources/examples/events/Adaptive/AnomalyDetectionEvents.json new file mode 100644 index 000000000..2872f5ae4 --- /dev/null +++ b/examples/adaptive/src/main/resources/examples/events/Adaptive/AnomalyDetectionEvents.json @@ -0,0 +1,200 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "Iteration": 0, + "MonitoredValue": 0.04818448765182781 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 0.016856740089812434, + "Iteration": 1 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "Iteration": 2, + "MonitoredValue": 0.07283031742656552 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "Iteration": 3, + "MonitoredValue": 0.05284674407712258 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 0.08685406312054446, + "Iteration": 4 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 0.09580382706345814, + "Iteration": 5 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "Iteration": 6, + "MonitoredValue": 0.07022220893167114 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 0.05027456879617627, + "Iteration": 7 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "Iteration": 8, + "MonitoredValue": 0.16867139038930964 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 0.18383434112759453, + "Iteration": 9 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "Iteration": 10, + "MonitoredValue": 0.11940188164467769 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "Iteration": 11, + "MonitoredValue": 0.18528189685974508 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 0.19934812597926355, + "Iteration": 12 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 0.2769320946213342, + "Iteration": 13 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "Iteration": 14, + "MonitoredValue": 0.2573073533232842 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "Iteration": 15, + "MonitoredValue": 0.2114736039819203 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 0.3070179558734792, + "Iteration": 16 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 0.22817748171407137, + "Iteration": 17 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "Iteration": 18, + "MonitoredValue": 0.3742338965886025 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AnomalyDetectionTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 0.33767889848226273, + "Iteration": 19 +} + diff --git a/examples/adaptive/src/main/resources/examples/events/Adaptive/AutoLearnEvents.json b/examples/adaptive/src/main/resources/examples/events/Adaptive/AutoLearnEvents.json new file mode 100644 index 000000000..4a90c944d --- /dev/null +++ b/examples/adaptive/src/main/resources/examples/events/Adaptive/AutoLearnEvents.json @@ -0,0 +1,10000 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 0.0, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.69433155254976, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 78.80403683294003 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 78.8005362087235, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.70005535199167 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 78.79813005686083 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.6625792808998 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.17004743934565 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.54894158918367 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.35916974238323 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.93656846235159, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.45532801174336 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.39648909576073 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.85940196425808 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.82075367015489 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.94167435028217 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.13290458783666 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.90589416478501, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 74.40650100045869, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.34316868545527 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.04629219896326 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.84200148446877 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.73418181885977 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.95622304266477 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.8766006148359 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.16761645034099, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.89305194571767, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 78.66152476602161, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.9224955044742 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.08646413367919 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.14942792626715, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.72097169539272 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.14788550614098 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.56155193926921 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.00203507957606, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.69723158317599 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.05134165188178 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.70956681452282 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 78.22491597665497 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.17338017517335, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.0026108865973 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 74.57878915809123, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.43110592000204 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.8917377790589, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.45146064604081, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.77241877545107, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.89482139914819 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.43697808780172 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.3037067751828 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.25247147792905, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.03533792540335, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.20864757393446, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.6931776832379, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 78.25885870528629, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 78.06493533281379 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 78.13195640515596 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.34625474664468, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.14468249315169 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.51580105316857 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.40908251376047, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.89111679795279, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.7304338561524, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.86711526834038 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.03448758648997 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.95118148882904 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.02185903108796 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.71626176938796 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.7645698644982 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.07662976192651 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 78.13043615700668, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.88859134161586 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.65689651614777 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.55213841406979, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.56606191916234 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.23276946588183 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.74069038035756 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.72284728187904, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.97630974062314 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.00772549504518, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.70337883689913 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.4521750410877 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.76716555138643 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.0903362764708, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.80721739410535 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 78.16206335365106 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 78.15158460014776 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 78.84944000329642 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.60606719201483 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.82230962882491, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 78.0761852529311, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.7258263792994, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.46016950007558 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 78.398183741262 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 78.51249206780291, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.45942135900869 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.78631360056015 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.67063519741833 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.82649894733368 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.32884808360576 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.27859708587917 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.21256576198371, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.5608790858549 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.11690947637697 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.54703799343413 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.29942840663108, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.31446744790411 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.23240160921756 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.1055023967029, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.67111132175008 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.74719417850814 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.9131528213399, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.50065613005323, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.25823880172136, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.2121195665699, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.86866716998807, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.07717723908716 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.58634748282121 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.61088685497408 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.98796292233122 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.4569803714719 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.00047522492005 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.31415190822922 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.10408485494942, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.28495464116804 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.91413496331612 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.9912410007587 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.32497561234833 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.31343303571451, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.18974903073344 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.04366306125617 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.08766026297347 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 76.59088636971015 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 75.39247687938648, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.9080732157957 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.95286907934064, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.84147275043114 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 76.82377681985865, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 74.95060660478532, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.43985768687475 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.22866213897053 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 77.89674604484705, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 75.24961836787988 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 74.25243852072533 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 77.01106311345667 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 90.42073086787556, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 79.64186930310875 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 63.47357695595852 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "LastMonitoredValue": 71.55772312953363, + "MonitoredValue": 76.94715391191704 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.adaptive.events", + "name": "AutoLearnTriggerEvent", + "version": "0.0.1", + "source": "CompaA", + "target": "apex", + "MonitoredValue": 76.94715391191704, + "LastMonitoredValue": 82.33658469430046 +} + diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel b/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel new file mode 100644 index 000000000..758062b8e --- /dev/null +++ b/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel @@ -0,0 +1,40 @@ +/* + * ============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========================================================= + */ +logger.debug("AutoLearnDecideTask0: inFields:" + inFields); +java.util.Random rand = new java.util.Random(System.currentTimeMillis()); +double MIN = -100.0; +double MAX = 100.0; +double WANT = 50.0; + +double inval = (Double)(inFields["MonitoredValue"]); +double ret = inval; +/////////////// +double diff = (1.0/2.0) * (Math.abs(inval - WANT)); +/////////////// +ret = inval + diff; +if (ret > MAX) + ret = MAX; +if (ret MAX) + ret = MAX; +if (ret MAX) + ret = MAX; +if (ret MAX) + ret = MAX; +if (ret MAX) + ret = MAX; +if (ret MAX) + ret = MAX; +if (ret < MIN) + ret = MIN; + +outFields["MonitoredValue"] = ret; +outFields["LastMonitoredValue"] = inval; +logger.debug("AutoLearnDecideTask5: outFields:" + outFields); +return true; diff --git a/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel b/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel new file mode 100644 index 000000000..5eb44839c --- /dev/null +++ b/examples/adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel @@ -0,0 +1,40 @@ +/* + * ============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========================================================= + */ +logger.debug("AutoLearnDecideTask6: inFields:" + inFields); +java.util.Random rand = new java.util.Random(System.currentTimeMillis()); +double MIN = -100.0; +double MAX = 100.0; +double WANT = 50.0; + +double inval = (Double)(inFields["MonitoredValue"]); +double ret = inval; +/////////////// +double diff = (-1.0/2.0) * (Math.abs(inval - WANT)); +/////////////// +ret = inval + diff; +if (ret > MAX) + ret = MAX; +if (ret testApexModel; + + @Before + public void setup() throws Exception { + Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); + connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); + + testApexModel = new TestApexModel<>(AxPolicyModel.class, new TestAnomalyDetectionModelCreator()); + } + + @After + public void teardown() throws Exception { + connection.close(); + new File("derby.log").delete(); + } + + @Test + public void testModelWriteReadJPA() throws Exception { + final DAOParameters daoParameters = new DAOParameters(); + daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + daoParameters.setPersistenceUnit("AdaptiveModelsTest"); + + testApexModel.testApexModelWriteReadJPA(daoParameters); + } +} diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java new file mode 100644 index 000000000..7e2fb0eb7 --- /dev/null +++ b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java @@ -0,0 +1,81 @@ +/*- + * ============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.examples.adaptive; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.test.TestApexModel; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +public class TestAnomalyDetectionModel { + private Connection connection; + TestApexModel testApexModel; + + @Before + public void setup() throws Exception { + Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); + connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); + + testApexModel = new TestApexModel<>(AxPolicyModel.class, new TestAnomalyDetectionModelCreator()); + } + + @After + public void teardown() throws Exception { + connection.close(); + new File("derby.log").delete(); + } + + @Test + public void testModelValid() throws Exception { + final AxValidationResult result = testApexModel.testApexModelValid(); + assertTrue(result.toString().equals(VALID_MODEL_STRING)); + } + + @Test + public void testModelWriteReadXML() throws Exception { + testApexModel.testApexModelWriteReadXML(); + } + + @Test + public void testModelWriteReadJSON() throws Exception { + testApexModel.testApexModelWriteReadJSON(); + } + + @Test + public void testModelWriteReadJPA() throws Exception { + final DAOParameters daoParameters = new DAOParameters(); + daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + daoParameters.setPersistenceUnit("AdaptiveModelsTest"); + + testApexModel.testApexModelWriteReadJPA(daoParameters); + } + + private static final String VALID_MODEL_STRING = "***validation of model successful***"; +} diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java new file mode 100644 index 000000000..2b50d69ab --- /dev/null +++ b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java @@ -0,0 +1,56 @@ +/*- + * ============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.examples.adaptive; + +import org.onap.policy.apex.examples.adaptive.model.AdaptiveDomainModelFactory; +import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +/** + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class TestAnomalyDetectionModelCreator implements TestApexModelCreator { + + @Override + public AxPolicyModel getModel() { + return new AdaptiveDomainModelFactory().getAnomalyDetectionPolicyModel(); + } + + @Override + public AxPolicyModel getMalstructuredModel() { + return null; + } + + @Override + public AxPolicyModel getObservationModel() { + return null; + } + + @Override + public AxPolicyModel getWarningModel() { + return getModel(); + } + + @Override + public AxPolicyModel getInvalidModel() { + return null; + } +} diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTSLUseCase.java b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTSLUseCase.java new file mode 100644 index 000000000..7d9791d46 --- /dev/null +++ b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTSLUseCase.java @@ -0,0 +1,164 @@ +/*- + * ============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.examples.adaptive; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.Random; + +import org.junit.Test; +import org.onap.policy.apex.core.engine.EngineParameters; +import org.onap.policy.apex.core.engine.engine.ApexEngine; +import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory; +import org.onap.policy.apex.core.engine.event.EnEvent; +import org.onap.policy.apex.examples.adaptive.model.AdaptiveDomainModelFactory; +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters; +import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; + +/** + * This policy passes, and recieves a Double event context filed called "EVCDouble".
+ * The policy tries to detect anomalies in the pattern of values for EVCDouble
+ * See the 2 test cases below (1 short, 1 long) + * + * @author John Keeney (John.Keeney@ericsson.com) + */ +public class TestAnomalyDetectionTSLUseCase { + private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestAnomalyDetectionTSLUseCase.class); + + private static final int MAXITERATIONS = 3660; + private static final Random RAND = new Random(System.currentTimeMillis()); + + @Test + // once through the long running test below + public void TestAnomalyDetectionTSL() throws ApexException, InterruptedException, IOException { + final AxPolicyModel apexPolicyModel = new AdaptiveDomainModelFactory().getAnomalyDetectionPolicyModel(); + assertNotNull(apexPolicyModel); + + final AxValidationResult validationResult = new AxValidationResult(); + apexPolicyModel.validate(validationResult); + assertTrue(validationResult.isValid()); + + final AxArtifactKey key = new AxArtifactKey("AnomalyTSLApexEngine", "0.0.1"); + final EngineParameters parameters = new EngineParameters(); + parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + parameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters()); + + final ApexEngine apexEngine1 = new ApexEngineFactory().createApexEngine(key); + + final TestApexActionListener listener1 = new TestApexActionListener("TestListener1"); + apexEngine1.addEventListener("listener", listener1); + apexEngine1.updateModel(apexPolicyModel); + apexEngine1.start(); + final EnEvent triggerEvent = + apexEngine1.createEvent(new AxArtifactKey("AnomalyDetectionTriggerEvent", "0.0.1")); + final double rval = RAND.nextGaussian(); + triggerEvent.put("Iteration", 0); + triggerEvent.put("MonitoredValue", rval); + LOGGER.info("Triggering policy in Engine 1 with " + triggerEvent); + apexEngine1.handleEvent(triggerEvent); + final EnEvent result = listener1.getResult(); + LOGGER.info("Receiving action event {} ", result); + assertEquals("ExecutionIDs are different", triggerEvent.getExecutionID(), result.getExecutionID()); + triggerEvent.clear(); + result.clear(); + Thread.sleep(1); + apexEngine1.stop(); + } + + /** + * This policy passes, and recieves a Double event context filed called "EVCDouble"
+ * The policy tries to detect anomalies in the pattern of values for EVCDouble
+ * This test case generates a SineWave-like pattern for the parameter, repeating every 360 iterations. (These Period + * should probably be set using TaskParameters!) Every 361st value is a random number!, so should be identified as + * an Anomaly. The policy has 3 Decide Tasks, and the Decide TaskSelectionLogic picks one depending on the + * 'Anomaliness' of the input data.
+ * To plot the results grep debug results for the string "************", paste into excel and delete non-relevant + * columns
+ * + * @throws ApexException the apex exception + * @throws InterruptedException the interrupted exception + * @throws IOException Signals that an I/O exception has occurred. + */ + // Test is disabled by default. uncomment below, or execute using the main() method + // @Test + // EG Dos command: apex-core.engine> mvn + // -Dtest=org.onap.policy.apex.core.engine.ml.TestAnomalyDetectionTSLUseCase test | findstr /L /C:"Apex [main] DEBUG + // c.e.a.e.TaskSelectionExecutionLogging - + // TestAnomalyDetectionTSL_Policy0000DecideStateTaskSelectionLogic.getTask():" + public void TestAnomalyDetectionTSL_main() throws ApexException, InterruptedException, IOException { + + final AxPolicyModel apexPolicyModel = new AdaptiveDomainModelFactory().getAnomalyDetectionPolicyModel(); + assertNotNull(apexPolicyModel); + + final AxValidationResult validationResult = new AxValidationResult(); + apexPolicyModel.validate(validationResult); + assertTrue(validationResult.isValid()); + + final AxArtifactKey key = new AxArtifactKey("AnomalyTSLApexEngine", "0.0.1"); + final EngineParameters parameters = new EngineParameters(); + parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + parameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters()); + + final ApexEngine apexEngine1 = new ApexEngineFactory().createApexEngine(key); + + final TestApexActionListener listener1 = new TestApexActionListener("TestListener1"); + apexEngine1.addEventListener("listener1", listener1); + apexEngine1.updateModel(apexPolicyModel); + apexEngine1.start(); + + final EnEvent triggerEvent = + apexEngine1.createEvent(new AxArtifactKey("AnomalyDetectionTriggerEvent", "0.0.1")); + assertNotNull(triggerEvent); + + for (int iteration = 0; iteration < MAXITERATIONS; iteration++) { + // Trigger the policy in engine 1 + + double value = (Math.sin(Math.toRadians(iteration))) + (RAND.nextGaussian() / 25.0); + // lets make every 361st number a random value to perhaps flag as an anomaly + if (((iteration + 45) % 361) == 0) { + value = (RAND.nextGaussian() * 2.0); + } + triggerEvent.put("Iteration", iteration); + triggerEvent.put("MonitoredValue", value); + LOGGER.info("Iteration " + iteration + ":\tTriggering policy in Engine 1 with " + triggerEvent); + apexEngine1.handleEvent(triggerEvent); + final EnEvent result = listener1.getResult(); + LOGGER.info("Iteration " + iteration + ":\tReceiving action event {} ", result); + triggerEvent.clear(); + result.clear(); + } + apexEngine1.stop(); + Thread.sleep(1000); + } + + public static void main(final String[] args) throws ApexException, InterruptedException, IOException { + new TestAnomalyDetectionTSLUseCase().TestAnomalyDetectionTSL_main(); + } +} diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java new file mode 100644 index 000000000..ec7c197b7 --- /dev/null +++ b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java @@ -0,0 +1,91 @@ +/*- + * ============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.examples.adaptive; + +import java.util.ArrayList; +import java.util.List; + +import org.onap.policy.apex.core.engine.engine.EnEventListener; +import org.onap.policy.apex.core.engine.event.EnEvent; +import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; + +/** + * The listener interface for receiving testApexAction events. The class that is interested in processing a + * testApexAction event implements this interface, and the object created with that class is registered with a component + * using the component's addTestApexActionListener method. When the testApexAction event occurs, that + * object's appropriate method is invoked. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class TestApexActionListener implements EnEventListener { + private List resultEvents = new ArrayList<>(); + + private final String id; + + /** + * Instantiates a new test apex action listener. + * + * @param id the id + */ + public TestApexActionListener(final String id) { + this.id = id; + } + + /** + * Gets the result. + * + * @return the result + */ + public EnEvent getResult() { + while (resultEvents.isEmpty()) { + ThreadUtilities.sleep(100); + } + return resultEvents.remove(0); + } + + /* + * (non-Javadoc) + * + * @see + * org.onap.policy.apex.core.engine.engine.EnEventListener#onEnEvent(org.onap.policy.apex.core.engine.event.EnEvent) + */ + @Override + public void onEnEvent(final EnEvent actionEvent) { + try { + Thread.sleep(100); + } catch (final InterruptedException e) { + e.printStackTrace(); + } + if (actionEvent != null) { + System.out.println("Action event from engine:" + actionEvent.getName()); + resultEvents.add(actionEvent); + } + } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return id; + } +} diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java new file mode 100644 index 000000000..64efa6c35 --- /dev/null +++ b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java @@ -0,0 +1,60 @@ +/*- + * ============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.examples.adaptive; + +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.test.TestApexModel; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +public class TestAutoLearnDBWrite { + private Connection connection; + TestApexModel testApexModel; + + @Before + public void setup() throws Exception { + Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); + connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); + + testApexModel = new TestApexModel<>(AxPolicyModel.class, new TestAutoLearnModelCreator()); + } + + @After + public void teardown() throws Exception { + connection.close(); + new File("derby.log").delete(); + } + + @Test + public void testModelWriteReadJPA() throws Exception { + final DAOParameters daoParameters = new DAOParameters(); + daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + daoParameters.setPersistenceUnit("AdaptiveModelsTest"); + + testApexModel.testApexModelWriteReadJPA(daoParameters); + } +} diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java new file mode 100644 index 000000000..aa7f621c9 --- /dev/null +++ b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java @@ -0,0 +1,81 @@ +/*- + * ============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.examples.adaptive; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.test.TestApexModel; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +public class TestAutoLearnModel { + private Connection connection; + TestApexModel testApexModel; + + @Before + public void setup() throws Exception { + Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); + connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); + + testApexModel = new TestApexModel<>(AxPolicyModel.class, new TestAutoLearnModelCreator()); + } + + @After + public void teardown() throws Exception { + connection.close(); + new File("derby.log").delete(); + } + + @Test + public void testModelValid() throws Exception { + final AxValidationResult result = testApexModel.testApexModelValid(); + assertTrue(result.toString().equals(VALID_MODEL_STRING)); + } + + @Test + public void testModelWriteReadXML() throws Exception { + testApexModel.testApexModelWriteReadXML(); + } + + @Test + public void testModelWriteReadJSON() throws Exception { + testApexModel.testApexModelWriteReadJSON(); + } + + @Test + public void testModelWriteReadJPA() throws Exception { + final DAOParameters daoParameters = new DAOParameters(); + daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + daoParameters.setPersistenceUnit("AdaptiveModelsTest"); + + testApexModel.testApexModelWriteReadJPA(daoParameters); + } + + private static final String VALID_MODEL_STRING = "***validation of model successful***"; +} diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java new file mode 100644 index 000000000..11f1991bf --- /dev/null +++ b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java @@ -0,0 +1,56 @@ +/*- + * ============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.examples.adaptive; + +import org.onap.policy.apex.examples.adaptive.model.AdaptiveDomainModelFactory; +import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +/** + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class TestAutoLearnModelCreator implements TestApexModelCreator { + + @Override + public AxPolicyModel getModel() { + return new AdaptiveDomainModelFactory().getAutoLearnPolicyModel(); + } + + @Override + public AxPolicyModel getMalstructuredModel() { + return null; + } + + @Override + public AxPolicyModel getObservationModel() { + return null; + } + + @Override + public AxPolicyModel getWarningModel() { + return getModel(); + } + + @Override + public AxPolicyModel getInvalidModel() { + return null; + } +} diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTSLUseCase.java b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTSLUseCase.java new file mode 100644 index 000000000..88b504cef --- /dev/null +++ b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTSLUseCase.java @@ -0,0 +1,187 @@ +/*- + * ============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.examples.adaptive; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.Random; + +import org.junit.Test; +import org.onap.policy.apex.core.engine.EngineParameters; +import org.onap.policy.apex.core.engine.engine.ApexEngine; +import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory; +import org.onap.policy.apex.core.engine.event.EnEvent; +import org.onap.policy.apex.examples.adaptive.model.AdaptiveDomainModelFactory; +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters; +import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; + +/** + * Test Auto learning in TSL. + * + * @author John Keeney (John.Keeney@ericsson.com) + */ +public class TestAutoLearnTSLUseCase { + private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestAutoLearnTSLUseCase.class); + + private static final int MAXITERATIONS = 1000; + private static final Random rand = new Random(System.currentTimeMillis()); + + @Test + // once through the long running test below + public void TestAutoLearnTSL() throws ApexException, InterruptedException, IOException { + final AxPolicyModel apexPolicyModel = new AdaptiveDomainModelFactory().getAutoLearnPolicyModel(); + assertNotNull(apexPolicyModel); + + final AxValidationResult validationResult = new AxValidationResult(); + apexPolicyModel.validate(validationResult); + assertTrue(validationResult.isValid()); + + final AxArtifactKey key = new AxArtifactKey("AADMApexEngine", "0.0.1"); + final EngineParameters parameters = new EngineParameters(); + parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + parameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters()); + + final ApexEngine apexEngine1 = new ApexEngineFactory().createApexEngine(key); + + final TestApexActionListener listener1 = new TestApexActionListener("TestListener1"); + apexEngine1.addEventListener("listener", listener1); + apexEngine1.updateModel(apexPolicyModel); + apexEngine1.start(); + final EnEvent triggerEvent = apexEngine1.createEvent(new AxArtifactKey("AutoLearnTriggerEvent", "0.0.1")); + final double rval = rand.nextGaussian(); + triggerEvent.put("MonitoredValue", rval); + triggerEvent.put("LastMonitoredValue", 0D); + LOGGER.info("Triggering policy in Engine 1 with " + triggerEvent); + apexEngine1.handleEvent(triggerEvent); + final EnEvent result = listener1.getResult(); + LOGGER.info("Receiving action event {} ", result); + assertEquals("ExecutionIDs are different", triggerEvent.getExecutionID(), result.getExecutionID()); + triggerEvent.clear(); + result.clear(); + Thread.sleep(1); + apexEngine1.stop(); + } + + /** + * This policy passes, and receives a Double event context filed called "EVCDouble"
+ * The policy tries to keep the value at 50, with a Min -100, Max 100 (These should probably be set using + * TaskParameters!)
+ * The policy has 7 Decide Tasks that manipulate the value of this field in unknown ways.
+ * The Decide TSL learns the effect of each task, and then selects the appropriate task to get the value back to + * 50
+ * After the value settles close to 50 for a while, the test Rests the value to to random number and then + * continues
+ * To plot the results grep stdout debug results for the string "*******", paste into excel and delete non-relevant + * columns
+ * + * @throws ApexException the apex exception + * @throws InterruptedException the interrupted exception + * @throws IOException Signals that an I/O exception has occurred. + */ + // @Test + public void TestAutoLearnTSL_main() throws ApexException, InterruptedException, IOException { + + final double WANT = 50.0; + final double toleranceTileJump = 3.0; + + final AxPolicyModel apexPolicyModel = new AdaptiveDomainModelFactory().getAutoLearnPolicyModel(); + assertNotNull(apexPolicyModel); + + final AxValidationResult validationResult = new AxValidationResult(); + apexPolicyModel.validate(validationResult); + assertTrue(validationResult.isValid()); + + final AxArtifactKey key = new AxArtifactKey("AADMApexEngine", "0.0.1"); + final EngineParameters parameters = new EngineParameters(); + parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + parameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters()); + + final ApexEngine apexEngine1 = new ApexEngineFactory().createApexEngine(key); + + final TestApexActionListener listener1 = new TestApexActionListener("TestListener1"); + apexEngine1.addEventListener("listener1", listener1); + apexEngine1.updateModel(apexPolicyModel); + apexEngine1.start(); + + final EnEvent triggerEvent = apexEngine1.createEvent(new AxArtifactKey("AutoLearnTriggerEvent", "0.0.1")); + assertNotNull(triggerEvent); + final double MIN = -100; + final double MAX = 100; + + double rval = (((rand.nextGaussian() + 1) / 2) * (MAX - MIN)) + MIN; + triggerEvent.put("MonitoredValue", rval); + triggerEvent.put("LastMonitoredValue", 0); + + double avval = 0; + double distance; + double avcount = 0; + + for (int iteration = 0; iteration < MAXITERATIONS; iteration++) { + // Trigger the policy in engine 1 + LOGGER.info("Triggering policy in Engine 1 with " + triggerEvent); + apexEngine1.handleEvent(triggerEvent); + final EnEvent result = listener1.getResult(); + LOGGER.info("Receiving action event {} ", result); + triggerEvent.clear(); + + double val = (Double) result.get("MonitoredValue"); + final double prevval = (Double) result.get("LastMonitoredValue"); + + triggerEvent.put("MonitoredValue", prevval); + triggerEvent.put("LastMonitoredValue", val); + + avcount = Math.min((avcount + 1), 20); // maintain average of only the last 20 values + avval = ((avval * (avcount - 1)) + val) / (avcount); + + distance = Math.abs(WANT - avval); + if (distance < toleranceTileJump) { + rval = (((rand.nextGaussian() + 1) / 2) * (MAX - MIN)) + MIN; + val = rval; + triggerEvent.put("MonitoredValue", val); + LOGGER.info("Iteration " + iteration + ": Average " + avval + " has become closer (" + distance + + ") than " + toleranceTileJump + " to " + WANT + " so reseting val:\t\t\t\t\t\t\t\t" + val); + avval = 0; + avcount = 0; + } + LOGGER.info("Iteration " + iteration + ": \tpreval\t" + prevval + "\tval\t" + val + "\tavval\t" + avval); + + result.clear(); + Thread.sleep(1); + } + + apexEngine1.stop(); + Thread.sleep(1000); + + } + + public static void main(final String[] args) throws ApexException, InterruptedException, IOException { + new TestAutoLearnTSLUseCase().TestAutoLearnTSL_main(); + } +} diff --git a/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/package-info.java b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/package-info.java new file mode 100644 index 000000000..0e004fe8d --- /dev/null +++ b/examples/adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/package-info.java @@ -0,0 +1,27 @@ +/*- + * ============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========================================================= + */ + +/** + * Defines domain and policies demonstrating adaptive policies. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ + +package org.onap.policy.apex.examples.adaptive; diff --git a/examples/adaptive/src/test/resources/META-INF/persistence.xml b/examples/adaptive/src/test/resources/META-INF/persistence.xml new file mode 100644 index 000000000..7282bb562 --- /dev/null +++ b/examples/adaptive/src/test/resources/META-INF/persistence.xml @@ -0,0 +1,69 @@ + + + + + + org.eclipse.persistence.jpa.PersistenceProvider + + org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner + org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String + org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey + org.onap.policy.apex.model.basicmodel.concepts.AxConcept + org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo + org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation + org.onap.policy.apex.model.basicmodel.concepts.AxModel + org.onap.policy.apex.model.basicmodel.concepts.TestEntity + org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema + org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas + org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum + org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums + org.onap.policy.apex.model.contextmodel.concepts.AxContextModel + org.onap.policy.apex.model.eventmodel.concepts.AxField + org.onap.policy.apex.model.eventmodel.concepts.AxInputField + org.onap.policy.apex.model.eventmodel.concepts.AxOutputField + org.onap.policy.apex.model.eventmodel.concepts.AxEvent + org.onap.policy.apex.model.eventmodel.concepts.AxEvents + org.onap.policy.apex.model.eventmodel.concepts.AxEventModel + org.onap.policy.apex.model.policymodel.concepts.AxLogic + org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter + org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic + org.onap.policy.apex.model.policymodel.concepts.AxTask + org.onap.policy.apex.model.policymodel.concepts.AxTasks + org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic + org.onap.policy.apex.model.policymodel.concepts.AxStateFinalizerLogic + org.onap.policy.apex.model.policymodel.concepts.AxStateOutput + org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference + org.onap.policy.apex.model.policymodel.concepts.AxState + org.onap.policy.apex.model.policymodel.concepts.AxPolicy + org.onap.policy.apex.model.policymodel.concepts.AxPolicies + org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel + + + + + + + + + + + + diff --git a/examples/myfirstpolicy/pom.xml b/examples/myfirstpolicy/pom.xml new file mode 100644 index 000000000..56a9fe40a --- /dev/null +++ b/examples/myfirstpolicy/pom.xml @@ -0,0 +1,109 @@ + + + 4.0.0 + + org.onap.policy.apex-pdp.examples + examples + 2.0.0-SNAPSHOT + + + myfirstpolicy + ${project.artifactId} + Specific code for the Apex MyFirstPolicy Example + + + ${project.basedir}/src + + + + + org.onap.policy.apex-pdp.model + policy-model + ${project.version} + + + org.onap.policy.apex-pdp.core + core-engine + ${project.version} + test + + + org.onap.policy.apex-pdp.core + core-infrastructure + ${project.version} + test + + + org.onap.policy.apex-pdp.auth + cli-editor + ${project.version} + test + + + org.onap.policy.apex-pdp.plugins.plugins-executor + plugins-executor-mvel + ${project.version} + test + + + org.onap.policy.apex-pdp.plugins.plugins-executor + plugins-executor-javascript + ${project.version} + test + + + org.apache.derby + derby + ${version.derby} + test + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + generate-models + process-classes + + exec + + + java + + -classpath + + + org.onap.policy.apex.examples.myfirstpolicy.model.MFPDomainModelSaver + ${project.build.directory}/classes/examples/models/MyFirstPolicy + + + + + + + + \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelFactory.java b/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelFactory.java new file mode 100644 index 000000000..9b3f6cc8a --- /dev/null +++ b/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelFactory.java @@ -0,0 +1,86 @@ +/*- + * ============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.examples.myfirstpolicy.model; + +import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.model.utilities.ResourceUtils; + +/** + * A factory for creating MFPDomainModel objects. + * + * @author John Keeney (john.keeney@ericsson.com) + */ +public class MFPDomainModelFactory { + + private static final String MFP1PATH = "examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json"; + private static final String MFP1_ALT_PATH = "examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json"; + private static final String MFP2PATH = "examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json"; + + /** + * Gets the MyFirstPolicy#1 policy model. + * + * @return the MyFirstPolicy#1 policy model + */ + public AxPolicyModel getMFP1PolicyModel() { + java.util.TimeZone.getTimeZone("gmt"); + try { + final ApexModelReader reader = new ApexModelReader<>(AxPolicyModel.class); + return reader.read(ResourceUtils.getResourceAsString(MFPDomainModelFactory.MFP1PATH)); + } catch (final Exception e) { + throw new ApexRuntimeException("Failed to build MyFirstPolicy from path: " + MFPDomainModelFactory.MFP1PATH, + e); + } + } + + /** + * Gets the MyFirstPolicy#1 policy model, with alternate JavaScript task logic. + * + * @return the MyFirstPolicy#1 policy model + */ + public AxPolicyModel getMFP1AltPolicyModel() { + java.util.TimeZone.getTimeZone("gmt"); + try { + final ApexModelReader reader = new ApexModelReader<>(AxPolicyModel.class); + return reader.read(ResourceUtils.getResourceAsString(MFPDomainModelFactory.MFP1_ALT_PATH)); + } catch (final Exception e) { + throw new ApexRuntimeException( + "Failed to build MyFirstPolicy_ALT from path: " + MFPDomainModelFactory.MFP1_ALT_PATH, e); + } + } + + /** + * Gets the MyFirstPolicy#1 policy model. + * + * @return the MyFirstPolicy#1 policy model + */ + public AxPolicyModel getMFP2PolicyModel() { + try { + final ApexModelReader reader = new ApexModelReader<>(AxPolicyModel.class); + return reader.read(ResourceUtils.getResourceAsString(MFPDomainModelFactory.MFP2PATH)); + } catch (final Exception e) { + throw new ApexRuntimeException("Failed to build MyFirstPolicy from path: " + MFPDomainModelFactory.MFP2PATH, + e); + } + } + +} diff --git a/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java b/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java new file mode 100644 index 000000000..7343f747d --- /dev/null +++ b/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java @@ -0,0 +1,62 @@ +/*- + * ============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.examples.myfirstpolicy.model; + +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +/** + * The Class MFPDomainModelSaver. + * + * @author John Keeney (john.keeney@ericsson.com) + */ +public final class MFPDomainModelSaver { + + /** Private constructor to prevent instantiation. */ + private MFPDomainModelSaver() {} + + /** + * Write the MyFirstPolicy model to args[0]. + * + * @param args uses arg[0] for directory information + * @throws ApexException the apex exception + */ + public static void main(final String[] args) throws ApexException { + if (args.length != 1) { + System.err.println("usage: " + MFPDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + return; + } + + // Save Java model + AxPolicyModel mfpPolicyModel = new MFPDomainModelFactory().getMFP1PolicyModel(); + ApexModelSaver mfpModelSaver = + new ApexModelSaver<>(AxPolicyModel.class, mfpPolicyModel, args[0] + "/1/"); + mfpModelSaver.apexModelWriteJSON(); + mfpModelSaver.apexModelWriteXML(); + + mfpPolicyModel = new MFPDomainModelFactory().getMFP2PolicyModel(); + mfpModelSaver = new ApexModelSaver<>(AxPolicyModel.class, mfpPolicyModel, args[0] + "/2/"); + mfpModelSaver.apexModelWriteJSON(); + mfpModelSaver.apexModelWriteXML(); + + } +} diff --git a/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/package-info.java b/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/package-info.java new file mode 100644 index 000000000..ed03da4ca --- /dev/null +++ b/examples/myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/package-info.java @@ -0,0 +1,27 @@ +/*- + * ============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========================================================= + */ + +/** + * Contains the model for My-First-Policy. + * + * @author John Keeney (john.keeney@ericsson.com) + */ + +package org.onap.policy.apex.examples.myfirstpolicy.model; diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/csv/AssistantInput.csv b/examples/myfirstpolicy/src/main/resources/SampleData/csv/AssistantInput.csv new file mode 100644 index 000000000..cd59d06c4 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/SampleData/csv/AssistantInput.csv @@ -0,0 +1,7 @@ +AssistantID,Surname,Firstname,Middlename,Age,Grade,PhoneNo +1222,Citizen,Sean,Tadhg,23,3,871234321 +126,Doe,Jane,Donna,56,2,861234567 +13213,Svensson,Sven,Lars,72,1,854323456 +22,Bloggs,Joe,John,19,3,839877654 +33,Yamada,Taro,Nanno,34,3,892344333 +343,Mustermann,Max,Fritz,21,2,887655432 \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/csv/BranchInput.csv b/examples/myfirstpolicy/src/main/resources/SampleData/csv/BranchInput.csv new file mode 100644 index 000000000..8d37e1ccd --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/SampleData/csv/BranchInput.csv @@ -0,0 +1,8 @@ +BranchName,BranchID,BranchCategory,Street,City,Country,Postcode +Al Raqqah,5667,Main,7 April Park,Al Raqqa,Syria,SY.RA.RA +Athlone,99556,Sub,Church Street,Athlone,Ireland,N37 E733 +Cork,326,Main,Saint Patrick's Street,Cork,Ireland,T12 TE45 +Dallas,323,Main,John West Road,"Dallas, TX",USA,75228 +Pyongyang,3233,Sub,Sungri Street,Pyongyang,Korea,23060 +Tullamore,59,Franchise,O'Moore Street,Tullamore,Ireland,R35 YP55 +Vladivostok,7884,Main,Admiral Yumasheva Street,Vladivostok,Russian Federation,690000 \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/csv/ItemInput.csv b/examples/myfirstpolicy/src/main/resources/SampleData/csv/ItemInput.csv new file mode 100644 index 000000000..08416546c --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/SampleData/csv/ItemInput.csv @@ -0,0 +1,6 @@ +ItemID,Description,CostPrice,Barcode,SupplierID,Category +1232,Table and Chairs,122.34,233454432,12452,Furniture +1277689,Crested Ten,15.23,45543345,134435,Alcahol +16775645,Marlboro Lights,2.25,13215321,2332,Tobacco +234424,Stool,23.23,2132132,12452,Furniture +3455634,Bed,96.78,123123,13325,Furniture \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/csv/SalesInput.csv b/examples/myfirstpolicy/src/main/resources/SampleData/csv/SalesInput.csv new file mode 100644 index 000000000..302430789 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/SampleData/csv/SalesInput.csv @@ -0,0 +1,45 @@ +SaleID,Amount,ItemID,Quantity,AssistantID,BranchName,Notes +6778392,22.45,234424,10,126,Athlone,Fabulous Sale +7883454,167.89,1277689,2,343,Tullamore, +8988516,2445.62,16775645,3545,1222,Cork, +10093578,10.11,1277689,5,22,Athlone,Good Product +11198640,233.45,234424,32,13213,Dallas, +12303702,8585.74,3455634,435,33,Vladivostok, +13408764,55,1232,45,1222,Vladivostok, +14513826,955,16775645,2,33,Pyongyang, +15618888,788.52,16775645,56,33,Dallas, +16723950,9555.12,234424,84,33,Al Raqqah, +17829012,8.78,3455634,5,1222,Cork, +18934074,1,1232,9,126,Al Raqqah, +20039136,0,16775645,9,126,Cork, +21144198,28.63,1277689,4515,126,Athlone, +22249260,9944.6,234424,4,126,Pyongyang, +23354322,8.74,3455634,5,343,Dallas, +24459384,8.77,1232,65,1222,Pyongyang, +25564446,2722.88,16775645,5,22,Vladivostok, +26669508,855.21,16775645,65,13213,Athlone, +27774570,644.37,234424,56,33,Tullamore, +28879632,633.8,3455634,56,1222,Al Raqqah, +29984694,743.74,1232,7787,33,Cork, +31089756,144.63,234424,65,33,Cork, +32194818,5.7,1277689,89,33,Athlone, +33299880,522.36,16775645,8,1222,Dallas, +34404942,855.36,1277689,897,126,Al Raqqah, +35510004,455.79,234424,5,126,Pyongyang, +36615066,1.1,3455634,6,343,Pyongyang, +37720128,966.37,1232,2,1222,Vladivostok, +38825190,5.27,16775645,2,22,Pyongyang, +39930252,444.5,16775645,232,13213,Dallas, +41035314,214.59,234424,2,33,Al Raqqah, +42140376,6.3,3455634,1,1222,Cork, +43245438,455.17,1232,1,33,Al Raqqah, +44350500,658.74,16775645,1,33,Cork, +45455562,75755.8,1277689,2313,33,Athlone, +46560624,0.01,234424,1165,1222,Pyongyang, +47665686,855.96,3455634,33,126,Dallas, +48770748,44444,1232,3,126,Pyongyang, +49875810,8555.6,16775645,3131,343,Vladivostok, +50980872,444577.2,16775645,8,1222,Pyongyang, +52085934,8277,234424,1,22,Dallas, +53190996,987.65,3455634,561,13213,Al Raqqah, +54296058,123.54,1232,6551,33,Cork, \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/sql/apex_sales.sql b/examples/myfirstpolicy/src/main/resources/SampleData/sql/apex_sales.sql new file mode 100644 index 000000000..a2ff5733b --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/SampleData/sql/apex_sales.sql @@ -0,0 +1,232 @@ +/* + * ============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========================================================= + */ + +-- +-- Create apex_sales database and populate it +-- + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +-- +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: +-- + +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; + + +SET search_path = public, pg_catalog; + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Create the database and switch to it +-- +CREATE DATABASE apex_sales; +\connect apex_sales; + +-- +-- Name: assistants; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE assistants ( + assistantid text, + surname text, + firstname text, + middlename text, + age text, + grade text, + phoneno text +); + + +ALTER TABLE assistants OWNER TO postgres; + +-- +-- Name: branches; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE branches ( + branchname text, + branchid text, + branchcategory text, + street text, + city text, + country text, + postcode text +); + + +ALTER TABLE branches OWNER TO postgres; + +-- +-- Name: items; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE items ( + itemid text, + description text, + costprice text, + barcode text, + supplierid text, + category text +); + + +ALTER TABLE items OWNER TO postgres; + +-- +-- Name: sales; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE sales ( + saleid text, + amount text, + itemid text, + quantity text, + assistantid text, + branchname text, + notes text +); + + +ALTER TABLE sales OWNER TO postgres; + +-- +-- Data for Name: assistants; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY assistants (assistantid, surname, firstname, middlename, age, grade, phoneno) FROM stdin; +1222 Citizen Sean Tadhg 23 3 871234321 +126 Doe Jane Donna 56 2 861234567 +13213 Svensson Sven Lars 72 1 854323456 +22 Bloggs Joe John 19 3 839877654 +33 Yamada Taro Nanno 34 3 892344333 +343 Mustermann Max Fritz 21 2 887655432 +\. + + +-- +-- Data for Name: branches; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY branches (branchname, branchid, branchcategory, street, city, country, postcode) FROM stdin; +Al Raqqah 5667 Main 7 April Park Al Raqqa Syria SY.RA.RA +Athlone 99556 Sub Church Street Athlone Ireland N37 E733 +Cork 326 Main Saint Patrick's Street Cork Ireland T12 TE45 +Dallas 323 Main John West Road Dallas, TX USA 75228 +Pyongyang 3233 Sub Sungri Street Pyongyang Korea 23060 +Tullamore 59 Franchise O'Moore Street Tullamore Ireland R35 YP55 +Vladivostok 7884 Main Admiral Yumasheva Street Vladivostok Russian Federation 690000 +\. + + +-- +-- Data for Name: items; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY items (itemid, description, costprice, barcode, supplierid, category) FROM stdin; +1232 Table and Chairs 122.34 233454432 12452 Furniture +1277689 Crested Ten 15.23 45543345 134435 Alcahol +16775645 Marlboro Lights 2.25 13215321 2332 Tobacco +234424 Stool 23.23 2132132 12452 Furniture +3455634 Bed 96.78 123123 13325 Furniture +\. + + +-- +-- Data for Name: sales; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY sales (saleid, amount, itemid, quantity, assistantid, branchname, notes) FROM stdin; +6778392 22.45 234424 10 126 Athlone Fabulous Sale +7883454 167.89 1277689 2 343 Tullamore \N +8988516 2445.62 16775645 3545 1222 Cork \N +10093578 10.11 1277689 5 22 Athlone Good Product +11198640 233.45 234424 32 13213 Dallas \N +12303702 8585.74 3455634 435 33 Vladivostok \N +13408764 55 1232 45 1222 Vladivostok \N +14513826 955 16775645 2 33 Pyongyang \N +15618888 788.52 16775645 56 33 Dallas \N +16723950 9555.12 234424 84 33 Al Raqqah \N +17829012 8.78 3455634 5 1222 Cork \N +18934074 1 1232 9 126 Al Raqqah \N +20039136 0 16775645 9 126 Cork \N +21144198 28.63 1277689 4515 126 Athlone \N +22249260 9944.6 234424 4 126 Pyongyang \N +23354322 8.74 3455634 5 343 Dallas \N +24459384 8.77 1232 65 1222 Pyongyang \N +25564446 2722.88 16775645 5 22 Vladivostok \N +26669508 855.21 16775645 65 13213 Athlone \N +27774570 644.37 234424 56 33 Tullamore \N +28879632 633.8 3455634 56 1222 Al Raqqah \N +29984694 743.74 1232 7787 33 Cork \N +31089756 144.63 234424 65 33 Cork \N +32194818 5.7 1277689 89 33 Athlone \N +33299880 522.36 16775645 8 1222 Dallas \N +34404942 855.36 1277689 897 126 Al Raqqah \N +35510004 455.79 234424 5 126 Pyongyang \N +36615066 1.1 3455634 6 343 Pyongyang \N +37720128 966.37 1232 2 1222 Vladivostok \N +38825190 5.27 16775645 2 22 Pyongyang \N +39930252 444.5 16775645 232 13213 Dallas \N +41035314 214.59 234424 2 33 Al Raqqah \N +42140376 6.3 3455634 1 1222 Cork \N +43245438 455.17 1232 1 33 Al Raqqah \N +44350500 658.74 16775645 1 33 Cork \N +45455562 75755.8 1277689 2313 33 Athlone \N +46560624 0.01 234424 1165 1222 Pyongyang \N +47665686 855.96 3455634 33 126 Dallas \N +48770748 44444 1232 3 126 Pyongyang \N +49875810 8555.6 16775645 3131 343 Vladivostok \N +50980872 444577.2 16775645 8 1222 Pyongyang \N +52085934 8277 234424 1 22 Dallas \N +53190996 987.65 3455634 561 13213 Al Raqqah \N +54296058 123.54 1232 6551 33 Cork \N +\. + + +-- +-- Name: public; Type: ACL; Schema: -; Owner: postgres +-- + +REVOKE ALL ON SCHEMA public FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM postgres; +GRANT ALL ON SCHEMA public TO postgres; +GRANT ALL ON SCHEMA public TO PUBLIC; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/examples/myfirstpolicy/src/main/resources/SampleData/sql/readme.txt b/examples/myfirstpolicy/src/main/resources/SampleData/sql/readme.txt new file mode 100644 index 000000000..f86aeb02c --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/SampleData/sql/readme.txt @@ -0,0 +1,31 @@ +#------------------------------------------------------------------------------- +# ============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========================================================= +#------------------------------------------------------------------------------- + +To set up the apex_sales database, simply run the following command: +psql -U postgres -a -f apex_sales.sql + +To test if the database has been set up correctly, rin the psql client as follows: + +psql -U postgres -d apex_sales +select * from sales; +select * from items; +select * from assistants; +select * from branches; + diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json new file mode 100644 index 000000000..4c5af6c2d --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json @@ -0,0 +1,12 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1483346466000, + "sale_ID": 99999992, + "amount": 1249, + "item_ID": 1012, + "quantity": 1, + "assistant_ID": 12, + "branch_ID": 2 +} \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json new file mode 100644 index 000000000..cc18e7ddd --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json @@ -0,0 +1,12 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1482265033000, + "sale_ID": 99999993, + "amount": 4799, + "item_ID": 1943, + "quantity": 2, + "assistant_ID": 9, + "branch_ID": 3 +} \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json new file mode 100644 index 000000000..1cdc4992c --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json @@ -0,0 +1,13 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1483351989000, + "sale_ID": 99999991, + "amount": 299, + "item_ID": 5123, + "quantity": 1, + "assistant_ID": 23, + "branch_ID": 1, + "notes": "Special Offer!!" +} \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json new file mode 100644 index 000000000..3625f908f --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json @@ -0,0 +1,17 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_AUTH", + "version": "0.0.1", + "source": "", + "target": "", + "amount": 1249, + "assistant_ID": 12, + "authorised": false, + "branch_ID": 2, + "item_ID": 1012, + "message": "Sale not authorised by policy task MorningBoozeCheck for time 08:41:06 GMT. Alcohol can not be sold between 00:00:00 GMT and 11:30:00 GMT", + "notes": null, + "quantity": 1, + "sale_ID": 99999992, + "time": 1483346466000 +} \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json new file mode 100644 index 000000000..2b760d5f1 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json @@ -0,0 +1,17 @@ +{ + "name": "SALE_AUTH", + "version": "0.0.1", + "nameSpace": "com.hyperm", + "source": "", + "target": "", + "amount": 4799, + "assistant_ID": 9, + "authorised": true, + "branch_ID": 3, + "item_ID": 1943, + "message": "Sale authorised by policy task MorningBoozeCheck for time 20:17:13 GMT", + "notes": null, + "quantity": 2, + "sale_ID": 99999993, + "time": 1482265033000 +} \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json new file mode 100644 index 000000000..b90c6fa0c --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json @@ -0,0 +1,17 @@ +{ + "name": "SALE_AUTH", + "version": "0.0.1", + "nameSpace": "com.hyperm", + "source": "", + "target": "", + "amount": 299, + "assistant_ID": 23, + "authorised": true, + "branch_ID": 1, + "item_ID": 5123, + "message": "Sale authorised by policy task MorningBoozeCheck for time 10:13:09 GMT", + "notes": "Special Offer!!", + "quantity": 1, + "sale_ID": 99999991, + "time": 1483351989000 +} \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsIn.json.txt b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsIn.json.txt new file mode 100644 index 000000000..a9570f989 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsIn.json.txt @@ -0,0 +1,37 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1483346466000, + "sale_ID": 99999992, + "amount": 1249, + "item_ID": 1012, + "quantity": 1, + "assistant_ID": 12, + "branch_ID": 2 +} +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1482265033000, + "sale_ID": 99999993, + "amount": 4799, + "item_ID": 1943, + "quantity": 2, + "assistant_ID": 9, + "branch_ID": 3 +} +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1483351989000, + "sale_ID": 99999991, + "amount": 299, + "item_ID": 5123, + "quantity": 1, + "assistant_ID": 23, + "branch_ID": 1, + "notes": "Special Offer!!" +} \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsOut.json.txt b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsOut.json.txt new file mode 100644 index 000000000..46fd887f4 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/1/EventsOut.json.txt @@ -0,0 +1,51 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_AUTH", + "version": "0.0.1", + "source": "", + "target": "", + "amount": 1249, + "assistant_ID": 12, + "authorised": false, + "branch_ID": 2, + "item_ID": 1012, + "message": "Sale not authorised by policy task MorningBoozeCheck for time 08:41:06 GMT. Alcohol can not be sold between 00:00:00 GMT and 11:30:00 GMT", + "notes": null, + "quantity": 1, + "sale_ID": 99999992, + "time": 1483346466000 +} +{ + "name": "SALE_AUTH", + "version": "0.0.1", + "nameSpace": "com.hyperm", + "source": "", + "target": "", + "amount": 4799, + "assistant_ID": 9, + "authorised": true, + "branch_ID": 3, + "item_ID": 1943, + "message": "Sale authorised by policy task MorningBoozeCheck for time 20:17:13 GMT", + "notes": null, + "quantity": 2, + "sale_ID": 99999993, + "time": 1482265033000 +} +{ + "name": "SALE_AUTH", + "version": "0.0.1", + "nameSpace": "com.hyperm", + "source": "", + "target": "", + "amount": 299, + "assistant_ID": 23, + "authorised": true, + "branch_ID": 1, + "item_ID": 5123, + "message": "Sale authorised by policy task MorningBoozeCheck for time 10:13:09 GMT", + "notes": "Special Offer!!", + "quantity": 1, + "sale_ID": 99999991, + "time": 1483351989000 +} \ No newline at end of file diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_101433CET_thurs.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_101433CET_thurs.json new file mode 100644 index 000000000..952b4b189 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_101433CET_thurs.json @@ -0,0 +1,12 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1482398073000, + "sale_ID": 99999981, + "amount": 299, + "item_ID": 1047, + "quantity": 1, + "assistant_ID": 1212, + "branch_ID": 1002 +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_171937CET_sun.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_171937CET_sun.json new file mode 100644 index 000000000..7c8fb2bf8 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_BoozeItem_171937CET_sun.json @@ -0,0 +1,13 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1482077977000, + "sale_ID": 99999982, + "amount": 2199, + "item_ID": 1443, + "quantity": 12, + "assistant_ID": 94, + "branch_ID": 1003, + "notes": "Buy 3, get 1 free!!" +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_NonBoozeItem_111309CET_mon.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_NonBoozeItem_111309CET_mon.json new file mode 100644 index 000000000..f8aa8760e --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventIn_NonBoozeItem_111309CET_mon.json @@ -0,0 +1,13 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1483351989000, + "sale_ID": 99999983, + "amount": 699, + "item_ID": 5321, + "quantity": 1, + "assistant_ID": 2323, + "branch_ID": 1001, + "notes": "" +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_101433CET_thurs.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_101433CET_thurs.json new file mode 100644 index 000000000..d7c3a3781 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_101433CET_thurs.json @@ -0,0 +1,17 @@ +{ + "nameSpace" : "com.hyperm", + "name" : "SALE_AUTH", + "version" : "0.0.1", + "source" : "", + "target" : "", + "sale_ID" : 99999981, + "amount" : 299, + "assistant_ID" : 1212, + "notes" : null, + "quantity" : 1, + "branch_ID" : 1002, + "item_ID" : 1047, + "authorised" : false, + "time" : 1482398073000, + "message" : "Sale not authorised by policy task MorningBoozeCheckAlt1 for time 10:14:33 CET. Alcohol can not be sold between 00:00:00 CET and 13:00:00 CET or on Sunday" +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_171937CET_sun.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_171937CET_sun.json new file mode 100644 index 000000000..cb838b838 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_BoozeItem_171937CET_sun.json @@ -0,0 +1,17 @@ +{ + "nameSpace" : "com.hyperm", + "name" : "SALE_AUTH", + "version" : "0.0.1", + "source" : "", + "target" : "", + "sale_ID" : 99999982, + "amount" : 2199, + "assistant_ID" : 94, + "notes" : "Buy 3, get 1 free!!", + "quantity" : 12, + "branch_ID" : 1003, + "item_ID" : 1443, + "authorised" : false, + "time" : 1482077977000, + "message" : "Sale not authorised by policy task MorningBoozeCheckAlt1 for time 17:19:37 CET. Alcohol can not be sold between 00:00:00 CET and 13:00:00 CET or on Sunday" +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_NonBoozeItem_111309CET_mon.json b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_NonBoozeItem_111309CET_mon.json new file mode 100644 index 000000000..4b031e453 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventOut_NonBoozeItem_111309CET_mon.json @@ -0,0 +1,17 @@ +{ + "nameSpace" : "com.hyperm", + "name" : "SALE_AUTH", + "version" : "0.0.1", + "source" : "", + "target" : "", + "sale_ID" : 99999983, + "amount" : 699, + "assistant_ID" : 2323, + "notes" : "", + "quantity" : 1, + "branch_ID" : 1001, + "item_ID" : 5321, + "authorised" : true, + "time" : 1483351989000, + "message" : "Sale authorised by policy task MorningBoozeCheckAlt1 for time 11:13:09 CET" +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsIn.json.txt b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsIn.json.txt new file mode 100644 index 000000000..a38fcdbc8 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsIn.json.txt @@ -0,0 +1,75 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1483346466000, + "sale_ID": 99999992, + "amount": 1249, + "item_ID": 1012, + "quantity": 1, + "assistant_ID": 12, + "branch_ID": 2 +} +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1482265033000, + "sale_ID": 99999993, + "amount": 4799, + "item_ID": 1943, + "quantity": 2, + "assistant_ID": 9, + "branch_ID": 3 +} +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1483351989000, + "sale_ID": 99999991, + "amount": 299, + "item_ID": 5123, + "quantity": 1, + "assistant_ID": 23, + "branch_ID": 1, + "notes": "Special Offer!!" +} +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1482398073000, + "sale_ID": 99999981, + "amount": 299, + "item_ID": 1047, + "quantity": 1, + "assistant_ID": 1212, + "branch_ID": 1002 +} +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1482077977000, + "sale_ID": 99999982, + "amount": 2199, + "item_ID": 1443, + "quantity": 12, + "assistant_ID": 94, + "branch_ID": 1003, + "notes": "Buy 3, get 1 free!!" +} +{ + "nameSpace": "com.hyperm", + "name": "SALE_INPUT", + "version": "0.0.1", + "time": 1483351989000, + "sale_ID": 99999983, + "amount": 699, + "item_ID": 5321, + "quantity": 1, + "assistant_ID": 2323, + "branch_ID": 1001, + "notes": "" +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsOut.json.txt b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsOut.json.txt new file mode 100644 index 000000000..16cff198c --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/2/EventsOut.json.txt @@ -0,0 +1,102 @@ +{ + "nameSpace": "com.hyperm", + "name": "SALE_AUTH", + "version": "0.0.1", + "source": "", + "target": "", + "amount": 1249, + "assistant_ID": 12, + "authorised": false, + "branch_ID": 2, + "item_ID": 1012, + "message": "Sale not authorised by policy task MorningBoozeCheck for time 08:41:06 GMT. Alcohol can not be sold between 00:00:00 GMT and 11:30:00 GMT", + "notes": null, + "quantity": 1, + "sale_ID": 99999992, + "time": 1483346466000 +} +{ + "name": "SALE_AUTH", + "version": "0.0.1", + "nameSpace": "com.hyperm", + "source": "", + "target": "", + "amount": 4799, + "assistant_ID": 9, + "authorised": true, + "branch_ID": 3, + "item_ID": 1943, + "message": "Sale authorised by policy task MorningBoozeCheck for time 20:17:13 GMT", + "notes": null, + "quantity": 2, + "sale_ID": 99999993, + "time": 1482265033000 +} +{ + "name": "SALE_AUTH", + "version": "0.0.1", + "nameSpace": "com.hyperm", + "source": "", + "target": "", + "amount": 299, + "assistant_ID": 23, + "authorised": true, + "branch_ID": 1, + "item_ID": 5123, + "message": "Sale authorised by policy task MorningBoozeCheck for time 10:13:09 GMT", + "notes": "Special Offer!!", + "quantity": 1, + "sale_ID": 99999991, + "time": 1483351989000 +} +{ + "nameSpace" : "com.hyperm", + "name" : "SALE_AUTH", + "version" : "0.0.1", + "source" : "", + "target" : "", + "sale_ID" : 99999981, + "amount" : 299, + "assistant_ID" : 1212, + "notes" : null, + "quantity" : 1, + "branch_ID" : 1002, + "item_ID" : 1047, + "authorised" : false, + "time" : 1482398073000, + "message" : "Sale not authorised by policy task MorningBoozeCheckAlt1 for time 10:14:33 CET. Alcohol can not be sold between 00:00:00 CET and 13:00:00 CET or on Sunday" +} +{ + "nameSpace" : "com.hyperm", + "name" : "SALE_AUTH", + "version" : "0.0.1", + "source" : "", + "target" : "", + "sale_ID" : 99999982, + "amount" : 2199, + "assistant_ID" : 94, + "notes" : "Buy 3, get 1 free!!", + "quantity" : 12, + "branch_ID" : 1003, + "item_ID" : 1443, + "authorised" : false, + "time" : 1482077977000, + "message" : "Sale not authorised by policy task MorningBoozeCheckAlt1 for time 17:19:37 CET. Alcohol can not be sold between 00:00:00 CET and 13:00:00 CET or on Sunday" +} +{ + "nameSpace" : "com.hyperm", + "name" : "SALE_AUTH", + "version" : "0.0.1", + "source" : "", + "target" : "", + "sale_ID" : 99999983, + "amount" : 699, + "assistant_ID" : 2323, + "notes" : "", + "quantity" : 1, + "branch_ID" : 1001, + "item_ID" : 5321, + "authorised" : true, + "time" : 1483351989000, + "message" : "Sale authorised by policy task MorningBoozeCheckAlt1 for time 11:13:09 CET" +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.js b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.js new file mode 100644 index 000000000..8ec15a992 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.js @@ -0,0 +1,79 @@ +/* + * ============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========================================================= + */ + +var returnValueType = Java.type("java.lang.Boolean"); +var returnValue = new returnValueType(true); + +// Load compatibility script for imports etc +load("nashorn:mozilla_compat.js"); +importPackage(java.text); +importClass(java.text.SimpleDateFormat); + +executor.logger.info("Task Execution: '"+executor.subject.id+"'. Input Fields: '"+executor.inFields+"'"); + +executor.outFields.put("amount" , executor.inFields.get("amount")); +executor.outFields.put("assistant_ID", executor.inFields.get("assistant_ID")); +executor.outFields.put("notes" , executor.inFields.get("notes")); +executor.outFields.put("quantity" , executor.inFields.get("quantity")); +executor.outFields.put("branch_ID" , executor.inFields.get("branch_ID")); +executor.outFields.put("item_ID" , executor.inFields.get("item_ID")); +executor.outFields.put("time" , executor.inFields.get("time")); +executor.outFields.put("sale_ID" , executor.inFields.get("sale_ID")); + +item_id = executor.inFields.get("item_ID"); + +//All times in this script are in GMT/UTC since the policy and events assume time is in GMT. +var timenow_gmt = new Date(Number(executor.inFields.get("time"))); + +var midnight_gmt = new Date(Number(executor.inFields.get("time"))); +midnight_gmt.setUTCHours(0,0,0,0); + +var eleven30_gmt = new Date(Number(executor.inFields.get("time"))); +eleven30_gmt.setUTCHours(11,30,0,0); + +var timeformatter = new java.text.SimpleDateFormat("HH:mm:ss z"); + +var itemisalcohol = false; +if(item_id != null && item_id >=1000 && item_id < 2000) + itemisalcohol = true; + +if( itemisalcohol + && timenow_gmt.getTime() >= midnight_gmt.getTime() + && timenow_gmt.getTime() < eleven30_gmt.getTime()) { + + executor.outFields.put("authorised", false); + executor.outFields.put("message", "Sale not authorised by policy task " + + executor.subject.taskName+ " for time " + timeformatter.format(timenow_gmt.getTime()) + + ". Alcohol can not be sold between " + timeformatter.format(midnight_gmt.getTime()) + + " and " + timeformatter.format(eleven30_gmt.getTime())); +} +else{ + executor.outFields.put("authorised", true); + executor.outFields.put("message", "Sale authorised by policy task " + + executor.subject.taskName + " for time "+timeformatter.format(timenow_gmt.getTime())); +} + +/* +This task checks if a sale request is for an item that is an alcoholic drink. +If the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not +authorised. Otherwise the sale is authorised. +In this implementation we assume that items with item_ID value between 1000 and +2000 are all alcoholic drinks :-) +*/ diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.mvel b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.mvel new file mode 100644 index 000000000..5d1af17de --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MorningBoozeCheck.mvel @@ -0,0 +1,80 @@ +/* + * ============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========================================================= + */ +import java.util.Date; +import java.util.Calendar; +import java.util.TimeZone; +import java.text.SimpleDateFormat; + +logger.info("Task Execution: '"+subject.id+"'. Input Fields: '"+inFields+"'"); + +outFields.put("amount" , inFields.get("amount")); +outFields.put("assistant_ID", inFields.get("assistant_ID")); +outFields.put("notes" , inFields.get("notes")); +outFields.put("quantity" , inFields.get("quantity")); +outFields.put("branch_ID" , inFields.get("branch_ID")); +outFields.put("item_ID" , inFields.get("item_ID")); +outFields.put("time" , inFields.get("time")); +outFields.put("sale_ID" , inFields.get("sale_ID")); + +item_id = inFields.get("item_ID"); + +//The events used later to test this task use GMT timezone! +gmt = TimeZone.getTimeZone("GMT"); +timenow = Calendar.getInstance(gmt); +df = new SimpleDateFormat("HH:mm:ss z"); +df.setTimeZone(gmt); +timenow.setTimeInMillis(inFields.get("time")); + +midnight = timenow.clone(); +midnight.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),0,0,0); +eleven30 = timenow.clone(); +eleven30.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),11,30,0); + +itemisalcohol = false; +if(item_id != null && item_id >=1000 && item_id < 2000) + itemisalcohol = true; + +if( itemisalcohol + && timenow.after(midnight) && timenow.before(eleven30)){ + outFields.put("authorised", false); + outFields.put("message", "Sale not authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())+ + ". Alcohol can not be sold between "+df.format(midnight.getTime())+ + " and "+df.format(eleven30.getTime())); + return true; +} +else{ + outFields.put("authorised", true); + outFields.put("message", "Sale authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())); + return true; +} + +/* +This task checks if a sale request is for an item that is an alcoholic drink. +If the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not +authorised. Otherwise the sale is authorised. +In this implementation we assume that items with item_ID value between 1000 and +2000 are all alcoholic drinks :-) +*/ diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json new file mode 100644 index 000000000..2651355fd --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json @@ -0,0 +1,974 @@ +{ + "apexPolicyModel" : { + "key" : { + "name" : "MyFirstPolicyModel", + "version" : "0.0.1" + }, + "keyInformation" : { + "key" : { + "name" : "MyFirstPolicyModel_KeyInfo", + "version" : "0.0.1" + }, + "keyInfoMap" : { + "entry" : [ { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "UUID" : "3351b0f4-cf06-4fa2-8823-edf67bd30223", + "description" : "This task checks if the sales request is for an item that contains alcohol. \nIf the local time is between 00:00:00 and 11:30:00 then the sale is not authorised. Otherwise the sale is authorised. \nIn this implementation we assume that all items with item_ID values between 1000 and 2000 contain alcohol :-)" + } + }, { + "key" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "UUID" : "6c5e410f-489a-46ff-964e-982ce6e8b6d0", + "description" : "This is my first Apex policy. It checks if a sale should be authorised or not." + } + }, { + "key" : { + "name" : "MyFirstPolicyModel", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel", + "version" : "0.0.1" + }, + "UUID" : "540226fb-55ee-4f0e-a444-983a0494818e", + "description" : "This is my first Apex Policy Model." + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Albums", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Albums", + "version" : "0.0.1" + }, + "UUID" : "3f70ec50-f896-31ba-afec-5fd47e69045b", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Albums:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Events", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Events", + "version" : "0.0.1" + }, + "UUID" : "ef281318-5ac9-3ef0-8db3-8f9c4e4a81e2", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Events:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_KeyInfo", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_KeyInfo", + "version" : "0.0.1" + }, + "UUID" : "d9248c6f-7c00-38df-8251-611463ba4065", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_KeyInfo:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Policies", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Policies", + "version" : "0.0.1" + }, + "UUID" : "77c01a6b-510c-3aa9-b640-b4db356aa03b", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Policies:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Schemas", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Schemas", + "version" : "0.0.1" + }, + "UUID" : "d0cc3aa0-ea69-3a43-80ff-a0dbb0ebd885", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Schemas:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Tasks", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Tasks", + "version" : "0.0.1" + }, + "UUID" : "b02a7e02-2cd0-39e6-b3cb-946fa83a8f08", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Tasks:0.0.1\"" + } + }, { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "UUID" : "c4500941-3f98-4080-a9cc-5b9753ed050b", + "description" : "An event emitted by the Policy to indicate whether the sale of an item has been authorised" + } + }, { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "UUID" : "4f04aa98-e917-4f4a-882a-c75ba5a99374", + "description" : "An event raised by the PoS system each time an item is scanned for purchase" + } + }, { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "UUID" : "36df4c71-9616-4206-8b53-976a5cd4bd87", + "description" : "A type for 'assistant_ID' values" + } + }, { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "UUID" : "d48b619e-d00d-4008-b884-02d76ea4350b", + "description" : "A type for 'authorised' values" + } + }, { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "UUID" : "6468845f-4122-4128-8e49-0f52c26078b5", + "description" : "A type for 'branch_ID' values" + } + }, { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "UUID" : "4f227ff1-aee0-453a-b6b6-9a4b2e0da932", + "description" : "A type for 'item_ID' values" + } + }, { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "UUID" : "ad1431bb-3155-4e73-b5a3-b89bee498749", + "description" : "A type for 'message' values" + } + }, { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "UUID" : "eecfde90-896c-4343-8f9c-2603ced94e2d", + "description" : "A type for 'notes' values" + } + }, { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "UUID" : "52c2fc45-fd8c-463c-bd6f-d91b0554aea7", + "description" : "A type for 'amount'/'price' values" + } + }, { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "UUID" : "ac3d9842-80af-4a98-951c-bd79a431c613", + "description" : "A type for 'quantity' values" + } + }, { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "UUID" : "cca47d74-7754-4a61-b163-ca31f66b157b", + "description" : "A type for 'sale_ID' values" + } + }, { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "UUID" : "fd594e88-411d-4a94-b2be-697b3a0d7adf", + "description" : "A type for 'time' values" + } + } ] + } + }, + "policies" : { + "key" : { + "name" : "MyFirstPolicyModel_Policies", + "version" : "0.0.1" + }, + "policyMap" : { + "entry" : [ { + "key" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "value" : { + "policyKey" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "template" : "FREEFORM", + "state" : { + "entry" : [ { + "key" : "BoozeAuthDecide", + "value" : { + "stateKey" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "BoozeAuthDecide" + }, + "trigger" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "MorningBoozeCheck_Output_Direct", + "value" : { + "key" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheck_Output_Direct" + }, + "outgoingEvent" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "NULL", + "parentKeyVersion" : "0.0.0", + "parentLocalName" : "NULL", + "localName" : "NULL" + } + } + } ] + }, + "contextAlbumReference" : [ ], + "taskSelectionLogic" : { + "key" : "NULL", + "logicFlavour" : "UNDEFINED", + "logic" : "" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheck" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheck_Output_Direct" + } + } + } ] + } + } + } ] + }, + "firstState" : "BoozeAuthDecide" + } + } ] + } + }, + "tasks" : { + "key" : { + "name" : "MyFirstPolicyModel_Tasks", + "version" : "0.0.1" + }, + "taskMap" : { + "entry" : [ { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "authorised", + "value" : { + "key" : "authorised", + "fieldSchemaKey" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "message", + "value" : { + "key" : "message", + "fieldSchemaKey" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + }, + "taskParameters" : { + "entry" : [ ] + }, + "contextAlbumReference" : [ ], + "taskLogic" : { + "key" : "TaskLogic", + "logicFlavour" : "JAVASCRIPT", + "logic" : "/**============LICENSE_START=======================================================*Copyright(C)2016-2018Ericsson.Allrightsreserved.*================================================================================*LicensedundertheApacheLicense,Version2.0(the\"License\");*youmaynotusethisfileexceptincompliancewiththeLicense.*YoumayobtainacopyoftheLicenseat**http://www.apache.org/licenses/LICENSE-2.0**Unlessrequiredbyapplicablelaworagreedtoinwriting,software*distributedundertheLicenseisdistributedonan\"ASIS\"BASIS,*WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.*SeetheLicenseforthespecificlanguagegoverningpermissionsand*limitationsundertheLicense.**SPDX-License-Identifier:Apache-2.0*============LICENSE_END=========================================================*/\nvar returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);\n\n// Load compatibility script for imports etc \nload(\"nashorn:mozilla_compat.js\");\nimportPackage(java.text);\nimportClass(java.text.SimpleDateFormat);\n\nexecutor.logger.info(\"Task Execution: '\"+executor.subject.id+\"'. Input Fields: '\"+executor.inFields+\"'\");\n\nexecutor.outFields.put(\"amount\" , executor.inFields.get(\"amount\"));\nexecutor.outFields.put(\"assistant_ID\", executor.inFields.get(\"assistant_ID\"));\nexecutor.outFields.put(\"notes\" , executor.inFields.get(\"notes\"));\nexecutor.outFields.put(\"quantity\" , executor.inFields.get(\"quantity\"));\nexecutor.outFields.put(\"branch_ID\" , executor.inFields.get(\"branch_ID\"));\nexecutor.outFields.put(\"item_ID\" , executor.inFields.get(\"item_ID\"));\nexecutor.outFields.put(\"time\" , executor.inFields.get(\"time\"));\nexecutor.outFields.put(\"sale_ID\" , executor.inFields.get(\"sale_ID\"));\n\nitem_id = executor.inFields.get(\"item_ID\");\n\n//All times in this script are in GMT/UTC since the policy and events assume time is in GMT. \nvar timenow_gmt = new Date(Number(executor.inFields.get(\"time\")));\n\nvar midnight_gmt = new Date(Number(executor.inFields.get(\"time\")));\nmidnight_gmt.setUTCHours(0,0,0,0);\n\nvar eleven30_gmt = new Date(Number(executor.inFields.get(\"time\")));\neleven30_gmt.setUTCHours(11,30,0,0);\n\nvar timeformatter = new java.text.SimpleDateFormat(\"HH:mm:ss z\");\n\nvar itemisalcohol = false;\nif(item_id != null && item_id >=1000 && item_id < 2000)\n itemisalcohol = true;\n \nif( itemisalcohol\n && timenow_gmt.getTime() >= midnight_gmt.getTime()\n && timenow_gmt.getTime() < eleven30_gmt.getTime()) {\n\n executor.outFields.put(\"authorised\", false);\n executor.outFields.put(\"message\", \"Sale not authorised by policy task \" +\n executor.subject.taskName+ \" for time \" + timeformatter.format(timenow_gmt.getTime()) +\n \". Alcohol can not be sold between \" + timeformatter.format(midnight_gmt.getTime()) +\n \" and \" + timeformatter.format(eleven30_gmt.getTime()));\n}\nelse{\n executor.outFields.put(\"authorised\", true);\n executor.outFields.put(\"message\", \"Sale authorised by policy task \" + \n executor.subject.taskName + \" for time \"+timeformatter.format(timenow_gmt.getTime()));\n}\n\n/*\nThis task checks if a sale request is for an item that is an alcoholic drink.\nIf the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not\nauthorised. Otherwise the sale is authorised. \nIn this implementation we assume that items with item_ID value between 1000 and \n2000 are all alcoholic drinks :-)\n*/" + } + } + } ] + } + }, + "events" : { + "key" : { + "name" : "MyFirstPolicyModel_Events", + "version" : "0.0.1" + }, + "eventMap" : { + "entry" : [ { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "nameSpace" : "com.hyperm", + "source" : "APEX", + "target" : "POS", + "parameter" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "authorised", + "value" : { + "key" : "authorised", + "fieldSchemaKey" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "message", + "value" : { + "key" : "message", + "fieldSchemaKey" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + } + } + }, { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "nameSpace" : "com.hyperm", + "source" : "POS", + "target" : "APEX", + "parameter" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + } + } + } ] + } + }, + "albums" : { + "key" : { + "name" : "MyFirstPolicyModel_Albums", + "version" : "0.0.1" + }, + "albums" : { + "entry" : [ ] + } + }, + "schemas" : { + "key" : { + "name" : "MyFirstPolicyModel_Schemas", + "version" : "0.0.1" + }, + "schemas" : { + "entry" : [ { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Boolean" + } + }, { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.String" + } + }, { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.String" + } + }, { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Integer" + } + }, { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + } ] + } + } + } +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex new file mode 100644 index 000000000..1cb678777 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex @@ -0,0 +1,178 @@ +#------------------------------------------------------------------------------- +# ============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=MyFirstPolicyModel version=0.0.1 uuid=540226fb-55ee-4f0e-a444-983a0494818e description="This is my first Apex Policy Model." + +schema create name=assistant_ID_type version=0.0.1 uuid=36df4c71-9616-4206-8b53-976a5cd4bd87 description="A type for 'assistant_ID' values" flavour=Java schema=java.lang.Long + +schema create name=authorised_type version=0.0.1 uuid=d48b619e-d00d-4008-b884-02d76ea4350b description="A type for 'authorised' values" flavour=Java schema=java.lang.Boolean + +schema create name=branch_ID_type version=0.0.1 uuid=6468845f-4122-4128-8e49-0f52c26078b5 description="A type for 'branch_ID' values" flavour=Java schema=java.lang.Long + +schema create name=item_ID_type version=0.0.1 uuid=4f227ff1-aee0-453a-b6b6-9a4b2e0da932 description="A type for 'item_ID' values" flavour=Java schema=java.lang.Long + +schema create name=message_type version=0.0.1 uuid=ad1431bb-3155-4e73-b5a3-b89bee498749 description="A type for 'message' values" flavour=Java schema=java.lang.String + +schema create name=notes_type version=0.0.1 uuid=eecfde90-896c-4343-8f9c-2603ced94e2d description="A type for 'notes' values" flavour=Java schema=java.lang.String + +schema create name=price_type version=0.0.1 uuid=52c2fc45-fd8c-463c-bd6f-d91b0554aea7 description="A type for 'amount'/'price' values" flavour=Java schema=java.lang.Long + +schema create name=quantity_type version=0.0.1 uuid=ac3d9842-80af-4a98-951c-bd79a431c613 description="A type for 'quantity' values" flavour=Java schema=java.lang.Integer + +schema create name=sale_ID_type version=0.0.1 uuid=cca47d74-7754-4a61-b163-ca31f66b157b description="A type for 'sale_ID' values" flavour=Java schema=java.lang.Long + +schema create name=timestamp_type version=0.0.1 uuid=fd594e88-411d-4a94-b2be-697b3a0d7adf description="A type for 'time' values" flavour=Java schema=java.lang.Long + +task create name=MorningBoozeCheck version=0.0.1 uuid=3351b0f4-cf06-4fa2-8823-edf67bd30223 description=LS +This task checks if the sales request is for an item that contains alcohol. +If the local time is between 00:00:00 and 11:30:00 then the sale is not authorised. Otherwise the sale is authorised. +In this implementation we assume that all items with item_ID values between 1000 and 2000 contain alcohol :-) +LE +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=amount schemaName=price_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=quantity schemaName=quantity_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=item_ID schemaName=item_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=time schemaName=timestamp_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=amount schemaName=price_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=quantity schemaName=quantity_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=item_ID schemaName=item_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=authorised schemaName=authorised_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=time schemaName=timestamp_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=message schemaName=message_type schemaVersion=0.0.1 optional=true +task logic create name=MorningBoozeCheck version=0.0.1 logicFlavour=MVEL logic=LS +/* + * ============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========================================================= + */ +import java.util.Date; +import java.util.Calendar; +import java.util.TimeZone; +import java.text.SimpleDateFormat; + +logger.info("Task Execution: '"+subject.id+"'. Input Fields: '"+inFields+"'"); + +outFields.put("amount" , inFields.get("amount")); +outFields.put("assistant_ID", inFields.get("assistant_ID")); +outFields.put("notes" , inFields.get("notes")); +outFields.put("quantity" , inFields.get("quantity")); +outFields.put("branch_ID" , inFields.get("branch_ID")); +outFields.put("item_ID" , inFields.get("item_ID")); +outFields.put("time" , inFields.get("time")); +outFields.put("sale_ID" , inFields.get("sale_ID")); + +item_id = inFields.get("item_ID"); + +//The events used later to test this task use GMT timezone! +gmt = TimeZone.getTimeZone("GMT"); +timenow = Calendar.getInstance(gmt); +df = new SimpleDateFormat("HH:mm:ss z"); +df.setTimeZone(gmt); +timenow.setTimeInMillis(inFields.get("time")); + +midnight = timenow.clone(); +midnight.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),0,0,0); +eleven30 = timenow.clone(); +eleven30.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),11,30,0); + +itemisalcohol = false; +if(item_id != null && item_id >=1000 && item_id < 2000) + itemisalcohol = true; + +if( itemisalcohol + && timenow.after(midnight) && timenow.before(eleven30)){ + outFields.put("authorised", false); + outFields.put("message", "Sale not authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())+ + ". Alcohol can not be sold between "+df.format(midnight.getTime())+ + " and "+df.format(eleven30.getTime())); + return true; +} +else{ + outFields.put("authorised", true); + outFields.put("message", "Sale authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())); + return true; +} + +/* +This task checks if a sale request is for an item that is an alcoholic drink. +If the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not +authorised. Otherwise the sale is authorised. +In this implementation we assume that items with item_ID value between 1000 and +2000 are all alcoholic drinks :-) +*/ +LE + +event create name=SALE_AUTH version=0.0.1 uuid=c4500941-3f98-4080-a9cc-5b9753ed050b description="An event emitted by the Policy to indicate whether the sale of an item has been authorised" nameSpace=com.hyperm source="APEX" target="POS" +event parameter create name=SALE_AUTH version=0.0.1 parName=amount schemaName=price_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=authorised schemaName=authorised_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=item_ID schemaName=item_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=message schemaName=message_type schemaVersion=0.0.1 optional=true +event parameter create name=SALE_AUTH version=0.0.1 parName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true +event parameter create name=SALE_AUTH version=0.0.1 parName=quantity schemaName=quantity_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=time schemaName=timestamp_type schemaVersion=0.0.1 + +event create name=SALE_INPUT version=0.0.1 uuid=4f04aa98-e917-4f4a-882a-c75ba5a99374 description="An event raised by the PoS system each time an item is scanned for purchase" nameSpace=com.hyperm source="POS" target="APEX" +event parameter create name=SALE_INPUT version=0.0.1 parName=amount schemaName=price_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=item_ID schemaName=item_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true +event parameter create name=SALE_INPUT version=0.0.1 parName=quantity schemaName=quantity_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=time schemaName=timestamp_type schemaVersion=0.0.1 + + +policy create name=MyFirstPolicy version=0.0.1 uuid=6c5e410f-489a-46ff-964e-982ce6e8b6d0 description="This is my first Apex policy. It checks if a sale should be authorised or not." template=FREEFORM firstState=BoozeAuthDecide +policy state create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide triggerName=SALE_INPUT triggerVersion=0.0.1 defaultTaskName=MorningBoozeCheck defaultTaskVersion=0.0.1 +policy state output create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide outputName=MorningBoozeCheck_Output_Direct eventName=SALE_AUTH eventVersion=0.0.1 nextState=NULL +policy state taskref create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide taskLocalName=MorningBoozeCheck taskName=MorningBoozeCheck taskVersion=0.0.1 outputType=DIRECT outputName=MorningBoozeCheck_Output_Direct + + + diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json new file mode 100644 index 000000000..d93f8f370 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json @@ -0,0 +1,974 @@ +{ + "apexPolicyModel" : { + "key" : { + "name" : "MyFirstPolicyModel", + "version" : "0.0.1" + }, + "keyInformation" : { + "key" : { + "name" : "MyFirstPolicyModel_KeyInfo", + "version" : "0.0.1" + }, + "keyInfoMap" : { + "entry" : [ { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "UUID" : "3351b0f4-cf06-4fa2-8823-edf67bd30223", + "description" : "This task checks if the sales request is for an item that contains alcohol. \nIf the local time is between 00:00:00 and 11:30:00 then the sale is not authorised. Otherwise the sale is authorised. \nIn this implementation we assume that all items with item_ID values between 1000 and 2000 contain alcohol :-)" + } + }, { + "key" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "UUID" : "6c5e410f-489a-46ff-964e-982ce6e8b6d0", + "description" : "This is my first Apex policy. It checks if a sale should be authorised or not." + } + }, { + "key" : { + "name" : "MyFirstPolicyModel", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel", + "version" : "0.0.1" + }, + "UUID" : "540226fb-55ee-4f0e-a444-983a0494818e", + "description" : "This is my first Apex Policy Model." + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Albums", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Albums", + "version" : "0.0.1" + }, + "UUID" : "3f70ec50-f896-31ba-afec-5fd47e69045b", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Albums:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Events", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Events", + "version" : "0.0.1" + }, + "UUID" : "ef281318-5ac9-3ef0-8db3-8f9c4e4a81e2", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Events:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_KeyInfo", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_KeyInfo", + "version" : "0.0.1" + }, + "UUID" : "d9248c6f-7c00-38df-8251-611463ba4065", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_KeyInfo:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Policies", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Policies", + "version" : "0.0.1" + }, + "UUID" : "77c01a6b-510c-3aa9-b640-b4db356aa03b", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Policies:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Schemas", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Schemas", + "version" : "0.0.1" + }, + "UUID" : "d0cc3aa0-ea69-3a43-80ff-a0dbb0ebd885", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Schemas:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Tasks", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Tasks", + "version" : "0.0.1" + }, + "UUID" : "b02a7e02-2cd0-39e6-b3cb-946fa83a8f08", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Tasks:0.0.1\"" + } + }, { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "UUID" : "c4500941-3f98-4080-a9cc-5b9753ed050b", + "description" : "An event emitted by the Policy to indicate whether the sale of an item has been authorised" + } + }, { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "UUID" : "4f04aa98-e917-4f4a-882a-c75ba5a99374", + "description" : "An event raised by the PoS system each time an item is scanned for purchase" + } + }, { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "UUID" : "36df4c71-9616-4206-8b53-976a5cd4bd87", + "description" : "A type for 'assistant_ID' values" + } + }, { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "UUID" : "d48b619e-d00d-4008-b884-02d76ea4350b", + "description" : "A type for 'authorised' values" + } + }, { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "UUID" : "6468845f-4122-4128-8e49-0f52c26078b5", + "description" : "A type for 'branch_ID' values" + } + }, { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "UUID" : "4f227ff1-aee0-453a-b6b6-9a4b2e0da932", + "description" : "A type for 'item_ID' values" + } + }, { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "UUID" : "ad1431bb-3155-4e73-b5a3-b89bee498749", + "description" : "A type for 'message' values" + } + }, { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "UUID" : "eecfde90-896c-4343-8f9c-2603ced94e2d", + "description" : "A type for 'notes' values" + } + }, { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "UUID" : "52c2fc45-fd8c-463c-bd6f-d91b0554aea7", + "description" : "A type for 'amount'/'price' values" + } + }, { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "UUID" : "ac3d9842-80af-4a98-951c-bd79a431c613", + "description" : "A type for 'quantity' values" + } + }, { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "UUID" : "cca47d74-7754-4a61-b163-ca31f66b157b", + "description" : "A type for 'sale_ID' values" + } + }, { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "UUID" : "fd594e88-411d-4a94-b2be-697b3a0d7adf", + "description" : "A type for 'time' values" + } + } ] + } + }, + "policies" : { + "key" : { + "name" : "MyFirstPolicyModel_Policies", + "version" : "0.0.1" + }, + "policyMap" : { + "entry" : [ { + "key" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "value" : { + "policyKey" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "template" : "FREEFORM", + "state" : { + "entry" : [ { + "key" : "BoozeAuthDecide", + "value" : { + "stateKey" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "BoozeAuthDecide" + }, + "trigger" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "MorningBoozeCheck_Output_Direct", + "value" : { + "key" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheck_Output_Direct" + }, + "outgoingEvent" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "NULL", + "parentKeyVersion" : "0.0.0", + "parentLocalName" : "NULL", + "localName" : "NULL" + } + } + } ] + }, + "contextAlbumReference" : [ ], + "taskSelectionLogic" : { + "key" : "NULL", + "logicFlavour" : "UNDEFINED", + "logic" : "" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheck" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheck_Output_Direct" + } + } + } ] + } + } + } ] + }, + "firstState" : "BoozeAuthDecide" + } + } ] + } + }, + "tasks" : { + "key" : { + "name" : "MyFirstPolicyModel_Tasks", + "version" : "0.0.1" + }, + "taskMap" : { + "entry" : [ { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "authorised", + "value" : { + "key" : "authorised", + "fieldSchemaKey" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "message", + "value" : { + "key" : "message", + "fieldSchemaKey" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + }, + "taskParameters" : { + "entry" : [ ] + }, + "contextAlbumReference" : [ ], + "taskLogic" : { + "key" : "TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * \n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nimport java.util.Date;\nimport java.util.Calendar;\nimport java.util.TimeZone;\nimport java.text.SimpleDateFormat;\n\nlogger.info(\"Task Execution: '\"+subject.id+\"'. Input Fields: '\"+inFields+\"'\");\n\noutFields.put(\"amount\" , inFields.get(\"amount\"));\noutFields.put(\"assistant_ID\", inFields.get(\"assistant_ID\"));\noutFields.put(\"notes\" , inFields.get(\"notes\"));\noutFields.put(\"quantity\" , inFields.get(\"quantity\"));\noutFields.put(\"branch_ID\" , inFields.get(\"branch_ID\"));\noutFields.put(\"item_ID\" , inFields.get(\"item_ID\"));\noutFields.put(\"time\" , inFields.get(\"time\"));\noutFields.put(\"sale_ID\" , inFields.get(\"sale_ID\"));\n\nitem_id = inFields.get(\"item_ID\");\n\n//The events used later to test this task use GMT timezone!\ngmt = TimeZone.getTimeZone(\"GMT\");\ntimenow = Calendar.getInstance(gmt);\ndf = new SimpleDateFormat(\"HH:mm:ss z\");\ndf.setTimeZone(gmt);\ntimenow.setTimeInMillis(inFields.get(\"time\"));\n\nmidnight = timenow.clone();\nmidnight.set(\n timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),\n timenow.get(Calendar.DATE),0,0,0);\neleven30 = timenow.clone();\neleven30.set(\n timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),\n timenow.get(Calendar.DATE),11,30,0);\n\nitemisalcohol = false;\nif(item_id != null && item_id >=1000 && item_id < 2000)\n itemisalcohol = true;\n\nif( itemisalcohol\n && timenow.after(midnight) && timenow.before(eleven30)){\n outFields.put(\"authorised\", false);\n outFields.put(\"message\", \"Sale not authorised by policy task \"+subject.taskName+\n \" for time \"+df.format(timenow.getTime())+\n \". Alcohol can not be sold between \"+df.format(midnight.getTime())+\n \" and \"+df.format(eleven30.getTime()));\n return true;\n}\nelse{\n outFields.put(\"authorised\", true);\n outFields.put(\"message\", \"Sale authorised by policy task \"+subject.taskName+\n \" for time \"+df.format(timenow.getTime()));\n return true;\n}\n\n/*\nThis task checks if a sale request is for an item that is an alcoholic drink.\nIf the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not\nauthorised. Otherwise the sale is authorised. \nIn this implementation we assume that items with item_ID value between 1000 and \n2000 are all alcoholic drinks :-)\n*/" + } + } + } ] + } + }, + "events" : { + "key" : { + "name" : "MyFirstPolicyModel_Events", + "version" : "0.0.1" + }, + "eventMap" : { + "entry" : [ { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "nameSpace" : "com.hyperm", + "source" : "APEX", + "target" : "POS", + "parameter" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "authorised", + "value" : { + "key" : "authorised", + "fieldSchemaKey" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "message", + "value" : { + "key" : "message", + "fieldSchemaKey" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + } + } + }, { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "nameSpace" : "com.hyperm", + "source" : "POS", + "target" : "APEX", + "parameter" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + } + } + } ] + } + }, + "albums" : { + "key" : { + "name" : "MyFirstPolicyModel_Albums", + "version" : "0.0.1" + }, + "albums" : { + "entry" : [ ] + } + }, + "schemas" : { + "key" : { + "name" : "MyFirstPolicyModel_Schemas", + "version" : "0.0.1" + }, + "schemas" : { + "entry" : [ { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Boolean" + } + }, { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.String" + } + }, { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.String" + } + }, { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Integer" + } + }, { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + } ] + } + } + } +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheck.mvel b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheck.mvel new file mode 100644 index 000000000..6c24cdf36 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheck.mvel @@ -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========================================================= + */ +import java.util.Date; +import java.util.Calendar; +import java.util.TimeZone; +import java.text.SimpleDateFormat; + +logger.info("Task Execution: '"+subject.id+"'. Input Fields: '"+inFields+"'"); + +outFields.put("amount" , inFields.get("amount")); +outFields.put("assistant_ID", inFields.get("assistant_ID")); +outFields.put("notes" , inFields.get("notes")); +outFields.put("quantity" , inFields.get("quantity")); +outFields.put("branch_ID" , inFields.get("branch_ID")); +outFields.put("item_ID" , inFields.get("item_ID")); +outFields.put("time" , inFields.get("time")); +outFields.put("sale_ID" , inFields.get("sale_ID")); + +item_id = inFields.get("item_ID"); + +//The events used later to test this task use GMT timezone! +gmt = TimeZone.getTimeZone("GMT"); +timenow = Calendar.getInstance(gmt); +df = new SimpleDateFormat("HH:mm:ss z"); +df.setTimeZone(gmt); +timenow.setTimeInMillis(inFields.get("time")); + +midnight = timenow.clone(); +midnight.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),0,0,0); +eleven30 = timenow.clone(); +eleven30.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),11,30,0); + +itemisalcohol = false; +if(item_id != null && item_id >=1000 && item_id < 2000) + itemisalcohol = true; + +if( itemisalcohol + && timenow.after(midnight) && timenow.before(eleven30)){ + outFields.put("authorised", false); + outFields.put("message", "Sale not authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())+ + ". Alcohol can not be sold between "+df.format(midnight.getTime())+ + " and "+df.format(eleven30.getTime())); + return true; +} +else{ + outFields.put("authorised", true); + outFields.put("message", "Sale authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())); + return true; +} + +/* +This task checks if a sale request is for an item that is an alcoholic drink. If the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not authorised. Otherwise the sale is authorised. In this implementation we assume that items with item_ID value between 1000 and 2000 are all alcoholic drinks :-) +*/ diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheckAlt1.mvel b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheckAlt1.mvel new file mode 100644 index 000000000..93fbb85f6 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MorningBoozeCheckAlt1.mvel @@ -0,0 +1,82 @@ +/* + * ============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========================================================= + */ +import java.util.Date; +import java.util.Calendar; +import java.util.TimeZone; +import java.text.SimpleDateFormat; + +logger.info("Task Execution: '"+subject.id+"'. Input Event: '"+inFields+"'"); + +outFields.put("amount" , inFields.get("amount")); +outFields.put("assistant_ID", inFields.get("assistant_ID")); +outFields.put("notes" , inFields.get("notes")); +outFields.put("quantity" , inFields.get("quantity")); +outFields.put("branch_ID" , inFields.get("branch_ID")); +outFields.put("item_ID" , inFields.get("item_ID")); +outFields.put("time" , inFields.get("time")); +outFields.put("sale_ID" , inFields.get("sale_ID")); + +item_id = inFields.get("item_ID"); + +//The events used later to test this task use CET timezone! +cet = TimeZone.getTimeZone("CET"); +timenow = Calendar.getInstance(cet); +df = new SimpleDateFormat("HH:mm:ss z"); +df.setTimeZone(cet); +timenow.setTimeInMillis(inFields.get("time")); + +midnight = timenow.clone(); +midnight.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),0,0,0); +onepm = timenow.clone(); +onepm.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),13,0,0); + +itemisalcohol = false; +if(item_id != null && item_id >=1000 && item_id < 2000) + itemisalcohol = true; + +if( itemisalcohol && + ( (timenow.after(midnight) && timenow.before(onepm)) + || + (timenow.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) + )){ + outFields.put("authorised", false); + outFields.put("message", "Sale not authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())+ + ". Alcohol can not be sold between "+df.format(midnight.getTime())+ + " and "+df.format(onepm.getTime()) +" or on Sunday"); + return true; +} +else{ + outFields.put("authorised", true); + outFields.put("message", "Sale authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())); + return true; +} + +/* +This task checks if a sale request is for an item that is an alcoholic drink. +If the local time is between 00:00:00 CET and 13:00:00 CET then the sale is not authorised. +Also alcohol sales are not allowed on Sundays. Otherwise the sale is authorised. +In this implementation we assume that items with item_ID between 1000 and 2000 are all alcoholic drinks :-) +*/ diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex new file mode 100644 index 000000000..1599ff20b --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex @@ -0,0 +1,333 @@ +#------------------------------------------------------------------------------- +# ============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=MyFirstPolicyModel version=0.0.1 uuid=540226fb-55ee-4f0e-a444-983a0494818e description="This is my first Apex Policy Model." + +schema create name=assistant_ID_type version=0.0.1 uuid=36df4c71-9616-4206-8b53-976a5cd4bd87 description="A type for 'assistant_ID' values" flavour=Java schema=java.lang.Long + +schema create name=authorised_type version=0.0.1 uuid=d48b619e-d00d-4008-b884-02d76ea4350b description="A type for 'authorised' values" flavour=Java schema=java.lang.Boolean + +schema create name=branch_ID_type version=0.0.1 uuid=6468845f-4122-4128-8e49-0f52c26078b5 description="A type for 'branch_ID' values" flavour=Java schema=java.lang.Long + +schema create name=item_ID_type version=0.0.1 uuid=4f227ff1-aee0-453a-b6b6-9a4b2e0da932 description="A type for 'item_ID' values" flavour=Java schema=java.lang.Long + +schema create name=message_type version=0.0.1 uuid=ad1431bb-3155-4e73-b5a3-b89bee498749 description="A type for 'message' values" flavour=Java schema=java.lang.String + +schema create name=notes_type version=0.0.1 uuid=eecfde90-896c-4343-8f9c-2603ced94e2d description="A type for 'notes' values" flavour=Java schema=java.lang.String + +schema create name=price_type version=0.0.1 uuid=52c2fc45-fd8c-463c-bd6f-d91b0554aea7 description="A type for 'amount'/'price' values" flavour=Java schema=java.lang.Long + +schema create name=quantity_type version=0.0.1 uuid=ac3d9842-80af-4a98-951c-bd79a431c613 description="A type for 'quantity' values" flavour=Java schema=java.lang.Integer + +schema create name=sale_ID_type version=0.0.1 uuid=cca47d74-7754-4a61-b163-ca31f66b157b description="A type for 'sale_ID' values" flavour=Java schema=java.lang.Long + +schema create name=timestamp_type version=0.0.1 uuid=fd594e88-411d-4a94-b2be-697b3a0d7adf description="A type for 'time' values" flavour=Java schema=java.lang.Long + +task create name=MorningBoozeCheck version=0.0.1 uuid=3351b0f4-cf06-4fa2-8823-edf67bd30223 description=LS +This task checks if the sales request is for an item that contains alcohol. +If the local time is between 00:00:00 and 11:30:00 then the sale is not authorised. Otherwise the sale is authorised. +In this implementation we assume that all items with item_ID values between 1000 and 2000 contain alcohol :-) +LE +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=amount schemaName=price_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=quantity schemaName=quantity_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=item_ID schemaName=item_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=time schemaName=timestamp_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=amount schemaName=price_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=quantity schemaName=quantity_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=item_ID schemaName=item_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=authorised schemaName=authorised_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=time schemaName=timestamp_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=message schemaName=message_type schemaVersion=0.0.1 optional=true +task logic create name=MorningBoozeCheck version=0.0.1 logicFlavour=MVEL logic=LS +/* + * ============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========================================================= + */ +import java.util.Date; +import java.util.Calendar; +import java.util.TimeZone; +import java.text.SimpleDateFormat; + +logger.info("Task Execution: '"+subject.id+"'. Input Fields: '"+inFields+"'"); + +outFields.put("amount" , inFields.get("amount")); +outFields.put("assistant_ID", inFields.get("assistant_ID")); +outFields.put("notes" , inFields.get("notes")); +outFields.put("quantity" , inFields.get("quantity")); +outFields.put("branch_ID" , inFields.get("branch_ID")); +outFields.put("item_ID" , inFields.get("item_ID")); +outFields.put("time" , inFields.get("time")); +outFields.put("sale_ID" , inFields.get("sale_ID")); + +item_id = inFields.get("item_ID"); + +//The events used later to test this task use GMT timezone! +gmt = TimeZone.getTimeZone("GMT"); +timenow = Calendar.getInstance(gmt); +df = new SimpleDateFormat("HH:mm:ss z"); +df.setTimeZone(gmt); +timenow.setTimeInMillis(inFields.get("time")); + +midnight = timenow.clone(); +midnight.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),0,0,0); +eleven30 = timenow.clone(); +eleven30.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),11,30,0); + +itemisalcohol = false; +if(item_id != null && item_id >=1000 && item_id < 2000) + itemisalcohol = true; + +if( itemisalcohol + && timenow.after(midnight) && timenow.before(eleven30)){ + outFields.put("authorised", false); + outFields.put("message", "Sale not authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())+ + ". Alcohol can not be sold between "+df.format(midnight.getTime())+ + " and "+df.format(eleven30.getTime())); + return true; +} +else{ + outFields.put("authorised", true); + outFields.put("message", "Sale authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())); + return true; +} + +/* +This task checks if a sale request is for an item that is an alcoholic drink. +If the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not +authorised. Otherwise the sale is authorised. +In this implementation we assume that items with item_ID value between 1000 and +2000 are all alcoholic drinks :-) +*/ +LE + +task create name=MorningBoozeCheckAlt1 version=0.0.1 uuid=bc6d90c9-c902-4686-afd3-925b30e39990 description=LS +This task checks if a sale request is for an item that is an alcoholic drink. +If the local time is between 00:00:00 CET and 13:00:00 CET then the sale is not authorised. +Also alcohol sales are not allowed on Sundays. Otherwise the sale is authorised. +In this implementation we assume that items with item_ID between 1000 and 2000 are all alcoholic drinks +LE +task inputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=amount schemaName=price_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true +task inputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=quantity schemaName=quantity_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=item_ID schemaName=item_ID_type schemaVersion=0.0.1 +task inputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=time schemaName=timestamp_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=amount schemaName=price_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true +task outputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=quantity schemaName=quantity_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=item_ID schemaName=item_ID_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=authorised schemaName=authorised_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=time schemaName=timestamp_type schemaVersion=0.0.1 +task outputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=message schemaName=message_type schemaVersion=0.0.1 optional=true +task logic create name=MorningBoozeCheckAlt1 version=0.0.1 logicFlavour=MVEL logic=LS +/* + * ============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========================================================= + */ +import java.util.Date; +import java.util.Calendar; +import java.util.TimeZone; +import java.text.SimpleDateFormat; + +logger.info("Task Execution: '"+subject.id+"'. Input Event: '"+inFields+"'"); + +outFields.put("amount" , inFields.get("amount")); +outFields.put("assistant_ID", inFields.get("assistant_ID")); +outFields.put("notes" , inFields.get("notes")); +outFields.put("quantity" , inFields.get("quantity")); +outFields.put("branch_ID" , inFields.get("branch_ID")); +outFields.put("item_ID" , inFields.get("item_ID")); +outFields.put("time" , inFields.get("time")); +outFields.put("sale_ID" , inFields.get("sale_ID")); + +item_id = inFields.get("item_ID"); + +//The events used later to test this task use CET timezone! +cet = TimeZone.getTimeZone("CET"); +timenow = Calendar.getInstance(cet); +df = new SimpleDateFormat("HH:mm:ss z"); +df.setTimeZone(cet); +timenow.setTimeInMillis(inFields.get("time")); + +midnight = timenow.clone(); +midnight.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),0,0,0); +onepm = timenow.clone(); +onepm.set( + timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH), + timenow.get(Calendar.DATE),13,0,0); + +itemisalcohol = false; +if(item_id != null && item_id >=1000 && item_id < 2000) + itemisalcohol = true; + +if( itemisalcohol && + ( (timenow.after(midnight) && timenow.before(onepm)) + || + (timenow.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) + )){ + outFields.put("authorised", false); + outFields.put("message", "Sale not authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())+ + ". Alcohol can not be sold between "+df.format(midnight.getTime())+ + " and "+df.format(onepm.getTime()) +" or on Sunday"); + return true; +} +else{ + outFields.put("authorised", true); + outFields.put("message", "Sale authorised by policy task "+subject.taskName+ + " for time "+df.format(timenow.getTime())); + return true; +} + +/* +This task checks if a sale request is for an item that is an alcoholic drink. +If the local time is between 00:00:00 CET and 13:00:00 CET then the sale is not authorised. +Also alcohol sales are not allowed on Sundays. Otherwise the sale is authorised. +In this implementation we assume that items with item_ID between 1000 and 2000 are all alcoholic drinks :-) +*/ +LE + +event create name=SALE_AUTH version=0.0.1 uuid=c4500941-3f98-4080-a9cc-5b9753ed050b description="An event emitted by the Policy to indicate whether the sale of an item has been authorised" nameSpace=com.hyperm source="APEX" target="POS" +event parameter create name=SALE_AUTH version=0.0.1 parName=amount schemaName=price_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=authorised schemaName=authorised_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=item_ID schemaName=item_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=message schemaName=message_type schemaVersion=0.0.1 optional=true +event parameter create name=SALE_AUTH version=0.0.1 parName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true +event parameter create name=SALE_AUTH version=0.0.1 parName=quantity schemaName=quantity_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_AUTH version=0.0.1 parName=time schemaName=timestamp_type schemaVersion=0.0.1 + +event create name=SALE_INPUT version=0.0.1 uuid=4f04aa98-e917-4f4a-882a-c75ba5a99374 description="An event raised by the PoS system each time an item is scanned for purchase" nameSpace=com.hyperm source="POS" target="APEX" +event parameter create name=SALE_INPUT version=0.0.1 parName=amount schemaName=price_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=item_ID schemaName=item_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true +event parameter create name=SALE_INPUT version=0.0.1 parName=quantity schemaName=quantity_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 +event parameter create name=SALE_INPUT version=0.0.1 parName=time schemaName=timestamp_type schemaVersion=0.0.1 + + +policy create name=MyFirstPolicy version=0.0.1 uuid=6c5e410f-489a-46ff-964e-982ce6e8b6d0 description="This is my first Apex policy. It checks if a sale should be authorised or not." template=FREEFORM firstState=BoozeAuthDecide +policy state create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide triggerName=SALE_INPUT triggerVersion=0.0.1 defaultTaskName=MorningBoozeCheck defaultTaskVersion=0.0.1 +policy state output create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide outputName=MorningBoozeCheck_Output_Direct eventName=SALE_AUTH eventVersion=0.0.1 nextState=NULL +policy state taskref create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide taskLocalName=MorningBoozeCheckAlt1 taskName=MorningBoozeCheckAlt1 taskVersion=0.0.1 outputType=DIRECT outputName=MorningBoozeCheck_Output_Direct +policy state taskref create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide taskLocalName=MorningBoozeCheck taskName=MorningBoozeCheck taskVersion=0.0.1 outputType=DIRECT outputName=MorningBoozeCheck_Output_Direct +policy state selecttasklogic create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide logicFlavour=JAVASCRIPT logic=LS +/* + * ============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========================================================= + */ + +var returnValueType = Java.type("java.lang.Boolean"); +var returnValue = new returnValueType(true); + +executor.logger.info("Task Selection Execution: '"+executor.subject.id+"'. Input Event: '"+executor.inFields+"'"); + +branchid = executor.inFields.get("branch_ID"); +taskorig = executor.subject.getTaskKey("MorningBoozeCheck"); +taskalt = executor.subject.getTaskKey("MorningBoozeCheckAlt1"); +taskdef = executor.subject.getDefaultTaskKey(); + +if(branchid >=0 && branchid <1000){ + taskorig.copyTo(executor.selectedTask); +} +else if (branchid >=1000 && branchid <2000){ + taskalt.copyTo(executor.selectedTask); +} +else{ + taskdef.copyTo(executor.selectedTask); +} + +/* +This task selection logic selects task "MorningBoozeCheck" for branches with 0<=branch_ID<1000 and selects task "MorningBoozeCheckAlt1" for branches with 1000<=branch_ID<2000. Otherwise the default task is selected. In this case the default task is also "MorningBoozeCheck" +*/ +LE + + + diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json new file mode 100644 index 000000000..2e50a8126 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json @@ -0,0 +1,1213 @@ +{ + "apexPolicyModel" : { + "key" : { + "name" : "MyFirstPolicyModel", + "version" : "0.0.1" + }, + "keyInformation" : { + "key" : { + "name" : "MyFirstPolicyModel_KeyInfo", + "version" : "0.0.1" + }, + "keyInfoMap" : { + "entry" : [ { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "UUID" : "3351b0f4-cf06-4fa2-8823-edf67bd30223", + "description" : "This task checks if the sales request is for an item that contains alcohol. \nIf the local time is between 00:00:00 and 11:30:00 then the sale is not authorised. Otherwise the sale is authorised. \nIn this implementation we assume that all items with item_ID values between 1000 and 2000 contain alcohol :-)" + } + }, { + "key" : { + "name" : "MorningBoozeCheckAlt1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MorningBoozeCheckAlt1", + "version" : "0.0.1" + }, + "UUID" : "bc6d90c9-c902-4686-afd3-925b30e39990", + "description" : "This task checks if a sale request is for an item that is an alcoholic drink. \nIf the local time is between 00:00:00 CET and 13:00:00 CET then the sale is not authorised. \nAlso alcohol sales are not allowed on Sundays. Otherwise the sale is authorised. \nIn this implementation we assume that items with item_ID between 1000 and 2000 are all alcoholic drinks" + } + }, { + "key" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "UUID" : "6c5e410f-489a-46ff-964e-982ce6e8b6d0", + "description" : "This is my first Apex policy. It checks if a sale should be authorised or not." + } + }, { + "key" : { + "name" : "MyFirstPolicyModel", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel", + "version" : "0.0.1" + }, + "UUID" : "540226fb-55ee-4f0e-a444-983a0494818e", + "description" : "This is my first Apex Policy Model." + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Albums", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Albums", + "version" : "0.0.1" + }, + "UUID" : "3f70ec50-f896-31ba-afec-5fd47e69045b", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Albums:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Events", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Events", + "version" : "0.0.1" + }, + "UUID" : "ef281318-5ac9-3ef0-8db3-8f9c4e4a81e2", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Events:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_KeyInfo", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_KeyInfo", + "version" : "0.0.1" + }, + "UUID" : "d9248c6f-7c00-38df-8251-611463ba4065", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_KeyInfo:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Policies", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Policies", + "version" : "0.0.1" + }, + "UUID" : "77c01a6b-510c-3aa9-b640-b4db356aa03b", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Policies:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Schemas", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Schemas", + "version" : "0.0.1" + }, + "UUID" : "d0cc3aa0-ea69-3a43-80ff-a0dbb0ebd885", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Schemas:0.0.1\"" + } + }, { + "key" : { + "name" : "MyFirstPolicyModel_Tasks", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyFirstPolicyModel_Tasks", + "version" : "0.0.1" + }, + "UUID" : "b02a7e02-2cd0-39e6-b3cb-946fa83a8f08", + "description" : "Generated description for concept referred to by key \"MyFirstPolicyModel_Tasks:0.0.1\"" + } + }, { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "UUID" : "c4500941-3f98-4080-a9cc-5b9753ed050b", + "description" : "An event emitted by the Policy to indicate whether the sale of an item has been authorised" + } + }, { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "UUID" : "4f04aa98-e917-4f4a-882a-c75ba5a99374", + "description" : "An event raised by the PoS system each time an item is scanned for purchase" + } + }, { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "UUID" : "36df4c71-9616-4206-8b53-976a5cd4bd87", + "description" : "A type for 'assistant_ID' values" + } + }, { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "UUID" : "d48b619e-d00d-4008-b884-02d76ea4350b", + "description" : "A type for 'authorised' values" + } + }, { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "UUID" : "6468845f-4122-4128-8e49-0f52c26078b5", + "description" : "A type for 'branch_ID' values" + } + }, { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "UUID" : "4f227ff1-aee0-453a-b6b6-9a4b2e0da932", + "description" : "A type for 'item_ID' values" + } + }, { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "UUID" : "ad1431bb-3155-4e73-b5a3-b89bee498749", + "description" : "A type for 'message' values" + } + }, { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "UUID" : "eecfde90-896c-4343-8f9c-2603ced94e2d", + "description" : "A type for 'notes' values" + } + }, { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "UUID" : "52c2fc45-fd8c-463c-bd6f-d91b0554aea7", + "description" : "A type for 'amount'/'price' values" + } + }, { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "UUID" : "ac3d9842-80af-4a98-951c-bd79a431c613", + "description" : "A type for 'quantity' values" + } + }, { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "UUID" : "cca47d74-7754-4a61-b163-ca31f66b157b", + "description" : "A type for 'sale_ID' values" + } + }, { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "UUID" : "fd594e88-411d-4a94-b2be-697b3a0d7adf", + "description" : "A type for 'time' values" + } + } ] + } + }, + "policies" : { + "key" : { + "name" : "MyFirstPolicyModel_Policies", + "version" : "0.0.1" + }, + "policyMap" : { + "entry" : [ { + "key" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "value" : { + "policyKey" : { + "name" : "MyFirstPolicy", + "version" : "0.0.1" + }, + "template" : "FREEFORM", + "state" : { + "entry" : [ { + "key" : "BoozeAuthDecide", + "value" : { + "stateKey" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "BoozeAuthDecide" + }, + "trigger" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "MorningBoozeCheck_Output_Direct", + "value" : { + "key" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheck_Output_Direct" + }, + "outgoingEvent" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "NULL", + "parentKeyVersion" : "0.0.0", + "parentLocalName" : "NULL", + "localName" : "NULL" + } + } + } ] + }, + "contextAlbumReference" : [ ], + "taskSelectionLogic" : { + "key" : "TaskSelectionLogic", + "logicFlavour" : "JAVASCRIPT", + "logic" : "/* * ============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========================================================= */var returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);\n\nexecutor.logger.info(\"Task Selection Execution: '\"+executor.subject.id+\"'. Input Event: '\"+executor.inFields+\"'\");\n\nbranchid = executor.inFields.get(\"branch_ID\");\ntaskorig = executor.subject.getTaskKey(\"MorningBoozeCheck\");\ntaskalt = executor.subject.getTaskKey(\"MorningBoozeCheckAlt1\");\ntaskdef = executor.subject.getDefaultTaskKey();\n\nif(branchid >=0 && branchid <1000){\n taskorig.copyTo(executor.selectedTask);\n}\nelse if (branchid >=1000 && branchid <2000){\n taskalt.copyTo(executor.selectedTask);\n}\nelse{\n taskdef.copyTo(executor.selectedTask);\n}\n\n/*\nThis task selection logic selects task \"MorningBoozeCheck\" for branches with 0<=branch_ID<1000 and selects task \"MorningBoozeCheckAlt1\" for branches with 1000<=branch_ID<2000. Otherwise the default task is selected. In this case the default task is also \"MorningBoozeCheck\"\n*/" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheck" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheck_Output_Direct" + } + } + }, { + "key" : { + "name" : "MorningBoozeCheckAlt1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheckAlt1" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "MyFirstPolicy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "BoozeAuthDecide", + "localName" : "MorningBoozeCheck_Output_Direct" + } + } + } ] + } + } + } ] + }, + "firstState" : "BoozeAuthDecide" + } + } ] + } + }, + "tasks" : { + "key" : { + "name" : "MyFirstPolicyModel_Tasks", + "version" : "0.0.1" + }, + "taskMap" : { + "entry" : [ { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MorningBoozeCheck", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "authorised", + "value" : { + "key" : "authorised", + "fieldSchemaKey" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "message", + "value" : { + "key" : "message", + "fieldSchemaKey" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + }, + "taskParameters" : { + "entry" : [ ] + }, + "contextAlbumReference" : [ ], + "taskLogic" : { + "key" : "TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * \n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nimport java.util.Date;\nimport java.util.Calendar;\nimport java.util.TimeZone;\nimport java.text.SimpleDateFormat;\n\nlogger.info(\"Task Execution: '\"+subject.id+\"'. Input Fields: '\"+inFields+\"'\");\n\noutFields.put(\"amount\" , inFields.get(\"amount\"));\noutFields.put(\"assistant_ID\", inFields.get(\"assistant_ID\"));\noutFields.put(\"notes\" , inFields.get(\"notes\"));\noutFields.put(\"quantity\" , inFields.get(\"quantity\"));\noutFields.put(\"branch_ID\" , inFields.get(\"branch_ID\"));\noutFields.put(\"item_ID\" , inFields.get(\"item_ID\"));\noutFields.put(\"time\" , inFields.get(\"time\"));\noutFields.put(\"sale_ID\" , inFields.get(\"sale_ID\"));\n\nitem_id = inFields.get(\"item_ID\");\n\n//The events used later to test this task use GMT timezone!\ngmt = TimeZone.getTimeZone(\"GMT\");\ntimenow = Calendar.getInstance(gmt);\ndf = new SimpleDateFormat(\"HH:mm:ss z\");\ndf.setTimeZone(gmt);\ntimenow.setTimeInMillis(inFields.get(\"time\"));\n\nmidnight = timenow.clone();\nmidnight.set(\n timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),\n timenow.get(Calendar.DATE),0,0,0);\neleven30 = timenow.clone();\neleven30.set(\n timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),\n timenow.get(Calendar.DATE),11,30,0);\n\nitemisalcohol = false;\nif(item_id != null && item_id >=1000 && item_id < 2000)\n itemisalcohol = true;\n\nif( itemisalcohol\n && timenow.after(midnight) && timenow.before(eleven30)){\n outFields.put(\"authorised\", false);\n outFields.put(\"message\", \"Sale not authorised by policy task \"+subject.taskName+\n \" for time \"+df.format(timenow.getTime())+\n \". Alcohol can not be sold between \"+df.format(midnight.getTime())+\n \" and \"+df.format(eleven30.getTime()));\n return true;\n}\nelse{\n outFields.put(\"authorised\", true);\n outFields.put(\"message\", \"Sale authorised by policy task \"+subject.taskName+\n \" for time \"+df.format(timenow.getTime()));\n return true;\n}\n\n/*\nThis task checks if a sale request is for an item that is an alcoholic drink.\nIf the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not\nauthorised. Otherwise the sale is authorised. \nIn this implementation we assume that items with item_ID value between 1000 and \n2000 are all alcoholic drinks :-)\n*/" + } + } + }, { + "key" : { + "name" : "MorningBoozeCheckAlt1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MorningBoozeCheckAlt1", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "authorised", + "value" : { + "key" : "authorised", + "fieldSchemaKey" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "message", + "value" : { + "key" : "message", + "fieldSchemaKey" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + }, + "taskParameters" : { + "entry" : [ ] + }, + "contextAlbumReference" : [ ], + "taskLogic" : { + "key" : "TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * \n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nimport java.util.Date;\nimport java.util.Calendar;\nimport java.util.TimeZone;\nimport java.text.SimpleDateFormat;\n\nlogger.info(\"Task Execution: '\"+subject.id+\"'. Input Event: '\"+inFields+\"'\");\n\noutFields.put(\"amount\" , inFields.get(\"amount\"));\noutFields.put(\"assistant_ID\", inFields.get(\"assistant_ID\"));\noutFields.put(\"notes\" , inFields.get(\"notes\"));\noutFields.put(\"quantity\" , inFields.get(\"quantity\"));\noutFields.put(\"branch_ID\" , inFields.get(\"branch_ID\"));\noutFields.put(\"item_ID\" , inFields.get(\"item_ID\"));\noutFields.put(\"time\" , inFields.get(\"time\"));\noutFields.put(\"sale_ID\" , inFields.get(\"sale_ID\"));\n\nitem_id = inFields.get(\"item_ID\");\n\n//The events used later to test this task use CET timezone!\ncet = TimeZone.getTimeZone(\"CET\");\ntimenow = Calendar.getInstance(cet);\ndf = new SimpleDateFormat(\"HH:mm:ss z\");\ndf.setTimeZone(cet);\ntimenow.setTimeInMillis(inFields.get(\"time\"));\n\nmidnight = timenow.clone();\nmidnight.set(\n timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),\n timenow.get(Calendar.DATE),0,0,0);\nonepm = timenow.clone();\nonepm.set(\n timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),\n timenow.get(Calendar.DATE),13,0,0);\n\nitemisalcohol = false;\nif(item_id != null && item_id >=1000 && item_id < 2000)\n itemisalcohol = true;\n\nif( itemisalcohol &&\n ( (timenow.after(midnight) && timenow.before(onepm))\n ||\n (timenow.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)\n )){\n outFields.put(\"authorised\", false);\n outFields.put(\"message\", \"Sale not authorised by policy task \"+subject.taskName+\n \" for time \"+df.format(timenow.getTime())+\n \". Alcohol can not be sold between \"+df.format(midnight.getTime())+\n \" and \"+df.format(onepm.getTime()) +\" or on Sunday\");\n return true;\n}\nelse{\n outFields.put(\"authorised\", true);\n outFields.put(\"message\", \"Sale authorised by policy task \"+subject.taskName+\n \" for time \"+df.format(timenow.getTime()));\n return true;\n}\n\n/*\nThis task checks if a sale request is for an item that is an alcoholic drink. \nIf the local time is between 00:00:00 CET and 13:00:00 CET then the sale is not authorised. \nAlso alcohol sales are not allowed on Sundays. Otherwise the sale is authorised. \nIn this implementation we assume that items with item_ID between 1000 and 2000 are all alcoholic drinks :-)\n*/" + } + } + } ] + } + }, + "events" : { + "key" : { + "name" : "MyFirstPolicyModel_Events", + "version" : "0.0.1" + }, + "eventMap" : { + "entry" : [ { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_AUTH", + "version" : "0.0.1" + }, + "nameSpace" : "com.hyperm", + "source" : "APEX", + "target" : "POS", + "parameter" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "authorised", + "value" : { + "key" : "authorised", + "fieldSchemaKey" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "message", + "value" : { + "key" : "message", + "fieldSchemaKey" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + } + } + }, { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SALE_INPUT", + "version" : "0.0.1" + }, + "nameSpace" : "com.hyperm", + "source" : "POS", + "target" : "APEX", + "parameter" : { + "entry" : [ { + "key" : "amount", + "value" : { + "key" : "amount", + "fieldSchemaKey" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "assistant_ID", + "value" : { + "key" : "assistant_ID", + "fieldSchemaKey" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "branch_ID", + "value" : { + "key" : "branch_ID", + "fieldSchemaKey" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "item_ID", + "value" : { + "key" : "item_ID", + "fieldSchemaKey" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "notes", + "value" : { + "key" : "notes", + "fieldSchemaKey" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "optional" : true + } + }, { + "key" : "quantity", + "value" : { + "key" : "quantity", + "fieldSchemaKey" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "sale_ID", + "value" : { + "key" : "sale_ID", + "fieldSchemaKey" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "optional" : false + } + }, { + "key" : "time", + "value" : { + "key" : "time", + "fieldSchemaKey" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "optional" : false + } + } ] + } + } + } ] + } + }, + "albums" : { + "key" : { + "name" : "MyFirstPolicyModel_Albums", + "version" : "0.0.1" + }, + "albums" : { + "entry" : [ ] + } + }, + "schemas" : { + "key" : { + "name" : "MyFirstPolicyModel_Schemas", + "version" : "0.0.1" + }, + "schemas" : { + "entry" : [ { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "assistant_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "authorised_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Boolean" + } + }, { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "branch_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "item_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "message_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.String" + } + }, { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "notes_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.String" + } + }, { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "price_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "quantity_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Integer" + } + }, { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "sale_ID_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + }, { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "timestamp_type", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + } ] + } + } + } +} diff --git a/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicy_BoozeAuthDecideTSL.js b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicy_BoozeAuthDecideTSL.js new file mode 100644 index 000000000..643e3446b --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicy_BoozeAuthDecideTSL.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========================================================= + */ + + +var returnValueType = Java.type("java.lang.Boolean"); +var returnValue = new returnValueType(true); + +executor.logger.info("Task Selection Execution: '"+executor.subject.id+ + "'. Input Event: '"+executor.inFields+"'"); + +branchid = executor.inFields.get("branch_ID"); +taskorig = executor.subject.getTaskKey("MorningBoozeCheck"); +taskalt = executor.subject.getTaskKey("MorningBoozeCheckAlt1"); +taskdef = executor.subject.getDefaultTaskKey(); + +if(branchid >=0 && branchid <1000){ + taskorig.copyTo(executor.selectedTask); +} +else if (branchid >=1000 && branchid <2000){ + taskalt.copyTo(executor.selectedTask); +} +else{ + taskdef.copyTo(executor.selectedTask); +} + +/* +This task selection logic selects task "MorningBoozeCheck" for branches with +0<=branch_ID<1000 and selects task "MorningBoozeCheckAlt1" for branches with +1000<=branch_ID<2000. Otherwise the default task is selected. +In this case the default task is also "MorningBoozeCheck" +*/ diff --git a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json b/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json new file mode 100644 index 000000000..06601e5d1 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json @@ -0,0 +1,46 @@ +{ + "engineServiceParameters" : { + "name" : "MyFirstPolicyApexEngine", + "version" : "0.0.1", + "id" : 101, + "instanceCount" : 4, + "deploymentPort" : 12345, + "policyModelFileName" : "examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json", + "engineParameters" : { + "executorParameters" : { + "MVEL" : { + "parameterClassName" : "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + }, + "JAVASCRIPT" : { + "parameterClassName" : "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters" : { + "carrierTechnology" : "FILE", + "parameters" : { + "standardIO" : true + } + }, + "eventProtocolParameters" : { + "eventProtocol" : "JSON" + } + } + }, + "eventInputParameters": { + "FirstConsumer": { + "carrierTechnologyParameters" : { + "carrierTechnology" : "FILE", + "parameters" : { + "standardIO" : true + } + }, + "eventProtocolParameters" : { + "eventProtocol" : "JSON" + } + } + } +} diff --git a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json b/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json new file mode 100644 index 000000000..657371f3c --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json @@ -0,0 +1,50 @@ +{ + "engineServiceParameters" : { + "name" : "MyFirstPolicyApexEngine", + "version" : "0.0.1", + "id" : 101, + "instanceCount" : 4, + "deploymentPort" : 12345, + "policyModelFileName" : "examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json", + "engineParameters" : { + "executorParameters" : { + "MVEL" : { + "parameterClassName" : "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + }, + "JAVASCRIPT" : { + "parameterClassName" : "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters":{ + "carrierTechnology" : "WEBSOCKET", + "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameters" : { + "wsClient" : false, + "port" : 30000 + } + }, + "eventProtocolParameters":{ + "eventProtocol" : "JSON" + } + } + }, + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters":{ + "carrierTechnology" : "WEBSOCKET", + "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameters" : { + "wsClient" : false, + "port" : 40000 + } + }, + "eventProtocolParameters":{ + "eventProtocol" : "JSON" + } + } + } +} diff --git a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json b/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json new file mode 100644 index 000000000..c9c29cdd2 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json @@ -0,0 +1,46 @@ +{ + "engineServiceParameters" : { + "name" : "MyFirstPolicyApexEngine", + "version" : "0.0.1", + "id" : 102, + "instanceCount" : 4, + "deploymentPort" : 12345, + "policyModelFileName" : "examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json", + "engineParameters" : { + "executorParameters" : { + "MVEL" : { + "parameterClassName" : "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + }, + "JAVASCRIPT" : { + "parameterClassName" : "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters" : { + "carrierTechnology" : "FILE", + "parameters" : { + "standardIO" : true + } + }, + "eventProtocolParameters" : { + "eventProtocol" : "JSON" + } + } + }, + "eventInputParameters": { + "FirstConsumer": { + "carrierTechnologyParameters" : { + "carrierTechnology" : "FILE", + "parameters" : { + "standardIO" : true + } + }, + "eventProtocolParameters" : { + "eventProtocol" : "JSON" + } + } + } +} diff --git a/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json b/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json new file mode 100644 index 000000000..3faf4ca32 --- /dev/null +++ b/examples/myfirstpolicy/src/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigWs2WsServerJsonEvent.json @@ -0,0 +1,50 @@ +{ + "engineServiceParameters" : { + "name" : "MyFirstPolicyApexEngine", + "version" : "0.0.1", + "id" : 102, + "instanceCount" : 4, + "deploymentPort" : 12345, + "policyModelFileName" : "examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.json", + "engineParameters" : { + "executorParameters" : { + "MVEL" : { + "parameterClassName" : "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + }, + "JAVASCRIPT" : { + "parameterClassName" : "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters":{ + "carrierTechnology" : "WEBSOCKET", + "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameters" : { + "wsClient" : false, + "port" : 30000 + } + }, + "eventProtocolParameters":{ + "eventProtocol" : "JSON" + } + } + }, + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters":{ + "carrierTechnology" : "WEBSOCKET", + "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameters" : { + "wsClient" : false, + "port" : 40000 + } + }, + "eventProtocolParameters":{ + "eventProtocol" : "JSON" + } + } + } +} diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPLogic.java b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPLogic.java new file mode 100644 index 000000000..652e228c8 --- /dev/null +++ b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPLogic.java @@ -0,0 +1,183 @@ +/*- + * ============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.examples.myfirstpolicy; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.apex.examples.myfirstpolicy.model.MFPDomainModelFactory; +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.model.policymodel.concepts.AxState; +import org.onap.policy.apex.model.policymodel.concepts.AxTask; +import org.onap.policy.apex.model.utilities.ResourceUtils; + +/** + * The Class TestMFPLogic. + */ +public class TestMFPLogic { + + private static final Map LOGICEXTENSIONS = new LinkedHashMap<>(); + + /** + * Test setup. + */ + @BeforeClass + public static void testMFPUseCaseSetup() { + LOGICEXTENSIONS.put("MVEL", "mvel"); + LOGICEXTENSIONS.put("JAVASCRIPT", "js"); + } + + /** + * Check logic for MyFirstPolicy#1. + */ + @Test + public void testMFP1TaskLogic() { + final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP1PolicyModel(); + assertNotNull(apexPolicyModel); + + final Map logics = new LinkedHashMap<>(); + logics.putAll(getTSLLogics(apexPolicyModel)); + logics.putAll(getTaskLogics(apexPolicyModel)); + + for (final Entry logicvalue : logics.entrySet()) { + final String filename = "examples/models/MyFirstPolicy/1/" + logicvalue.getKey(); + final String logic = logicvalue.getValue(); + final String expectedlogic = ResourceUtils.getResourceAsString(filename); + assertNotNull("File " + filename + " was not found. It should contain logic for PolicyModel " + + apexPolicyModel.getKey(), expectedlogic); + assertEquals( + "The task in " + filename + " is not the same as the relevant logic in PolicyModel " + + apexPolicyModel.getKey(), + expectedlogic.replaceAll("\\s", ""), logic.replaceAll("\\s", "")); + } + } + + + /** + * Check logic for MyFirstPolicyAlt#1. + */ + @Test + public void testMFP1AltTaskLogic() { + final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP1AltPolicyModel(); + assertNotNull(apexPolicyModel); + + final Map logics = new LinkedHashMap<>(); + logics.putAll(getTSLLogics(apexPolicyModel)); + logics.putAll(getTaskLogics(apexPolicyModel)); + + for (final Entry logicvalue : logics.entrySet()) { + final String filename = "examples/models/MyFirstPolicy/1/" + logicvalue.getKey(); + final String logic = logicvalue.getValue(); + final String expectedlogic = ResourceUtils.getResourceAsString(filename); + assertNotNull("File " + filename + " was not found. It should contain logic for PolicyModel " + + apexPolicyModel.getKey(), expectedlogic); + assertEquals( + "The task in " + filename + " is not the same as the relevant logic in PolicyModel " + + apexPolicyModel.getKey(), + expectedlogic.replaceAll("\\s", ""), logic.replaceAll("\\s", "")); + } + } + + /** + * Check logic for MyFirstPolicy2. + */ + @Test + public void testMFP2TaskLogic() { + final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP2PolicyModel(); + assertNotNull(apexPolicyModel); + + final Map logics = new LinkedHashMap<>(); + logics.putAll(getTSLLogics(apexPolicyModel)); + logics.putAll(getTaskLogics(apexPolicyModel)); + + for (final Entry logicvalue : logics.entrySet()) { + final String filename = "examples/models/MyFirstPolicy/2/" + logicvalue.getKey(); + final String logic = logicvalue.getValue(); + final String expectedlogic = ResourceUtils.getResourceAsString(filename); + assertNotNull("File " + filename + " was not found. It should contain logic for PolicyModel " + + apexPolicyModel.getKey(), expectedlogic); + assertEquals( + "The task in " + filename + " is not the same as the relevant logic in PolicyModel " + + apexPolicyModel.getKey(), + expectedlogic.replaceAll("\\s", ""), logic.replaceAll("\\s", "")); + } + } + + /** + * Gets the TSL logics. + * + * @param apexPolicyModel the apex policy model + * @return the TSL logics + */ + private Map getTSLLogics(final AxPolicyModel apexPolicyModel) { + final Map ret = new LinkedHashMap<>(); + for (final Entry policyentry : apexPolicyModel.getPolicies().getPolicyMap() + .entrySet()) { + for (final Entry statesentry : policyentry.getValue().getStateMap().entrySet()) { + final AxState state = statesentry.getValue(); + final String tsllogic = state.getTaskSelectionLogic().getLogic(); + final String tsllogicflavour = state.getTaskSelectionLogic().getLogicFlavour(); + if (tsllogic != null && tsllogic.trim().length() > 0) { + assertNotNull( + "Logic Type \"" + tsllogicflavour + "\" in state " + statesentry.getKey() + " in policy " + + policyentry.getKey() + " is not supported in this test", + LOGICEXTENSIONS.get(tsllogicflavour.toUpperCase())); + final String filename = policyentry.getKey().getName() + "_" + statesentry.getKey() + "TSL." + + LOGICEXTENSIONS.get(tsllogicflavour.toUpperCase()); + ret.put(filename, tsllogic); + } + } + } + return ret; + } + + /** + * Gets the task logics. + * + * @param apexPolicyModel the apex policy model + * @return the task logics + */ + private Map getTaskLogics(final AxPolicyModel apexPolicyModel) { + final Map ret = new LinkedHashMap<>(); + for (final Entry taskentry : apexPolicyModel.getTasks().getTaskMap().entrySet()) { + final AxTask task = taskentry.getValue(); + final String tasklogic = task.getTaskLogic().getLogic(); + final String tasklogicflavour = task.getTaskLogic().getLogicFlavour(); + assertTrue("No/Blank logic found in task " + taskentry.getKey(), + (tasklogic != null && tasklogic.trim().length() > 0)); + assertNotNull("Logic Type \"" + tasklogicflavour + "\" in task " + taskentry.getKey() + + " is not supported in this test", LOGICEXTENSIONS.get(tasklogicflavour.toUpperCase())); + final String filename = + taskentry.getKey().getName() + "." + LOGICEXTENSIONS.get(tasklogicflavour.toUpperCase()); + ret.put(filename, tasklogic); + } + return ret; + } +} diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java new file mode 100644 index 000000000..a8be6c4e4 --- /dev/null +++ b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java @@ -0,0 +1,106 @@ +/*- + * ============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.examples.myfirstpolicy; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.basicmodel.test.TestApexModel; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +/** + * Test MyFirstPolicy Model. + * + * @author John Keeney (john.keeney@ericsson.com) + */ +public class TestMFPModel { + + private static Connection connection; + private static TestApexModel testApexModel1; + private static TestApexModel testApexModel2; + + /** + * Setup. + * + * @throws Exception if there is an error + */ + @BeforeClass + public static void setup() throws Exception { + Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); + connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); + testApexModel1 = new TestApexModel<>(AxPolicyModel.class, new TestMFPModelCreator.TestMFP1ModelCreator()); + testApexModel2 = new TestApexModel<>(AxPolicyModel.class, new TestMFPModelCreator.TestMFP2ModelCreator()); + } + + /** + * Teardown. + * + * @throws Exception if there is an error + */ + @AfterClass + public static void teardown() throws Exception { + connection.close(); + new File("derby.log").delete(); + } + + /** + * Test model is valid. + * + * @throws Exception if there is an error + */ + @Test + public void testModelValid() throws Exception { + AxValidationResult result = testApexModel1.testApexModelValid(); + assertTrue("Model did not validate cleanly", result.isOK()); + + result = testApexModel2.testApexModelValid(); + assertTrue("Model did not validate cleanly", result.isOK()); + } + + /** + * Test model write and read XML. + * + * @throws Exception if there is an error + */ + @Test + public void testModelWriteReadXML() throws Exception { + testApexModel1.testApexModelWriteReadXML(); + testApexModel2.testApexModelWriteReadXML(); + } + + /** + * Test model write and read JSON. + * + * @throws Exception if there is an error + */ + @Test + public void testModelWriteReadJSON() throws Exception { + testApexModel1.testApexModelWriteReadJSON(); + testApexModel2.testApexModelWriteReadJSON(); + } +} diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCLI.java b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCLI.java new file mode 100644 index 000000000..fe9d3a205 --- /dev/null +++ b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCLI.java @@ -0,0 +1,96 @@ +/*- + * ============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.examples.myfirstpolicy; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.IOException; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.model.utilities.TextFileUtils; + +/** + * Test MyFirstPolicyModel CLI. + */ +public class TestMFPModelCLI { + private static AxPolicyModel testApexModel1; + private static AxPolicyModel testApexModel2; + + /** + * Setup the test. + * + * @throws Exception if there is an error + */ + @BeforeClass + public static void setup() throws Exception { + testApexModel1 = new TestMFPModelCreator.TestMFP1ModelCreator().getModel(); + testApexModel2 = new TestMFPModelCreator.TestMFP2ModelCreator().getModel(); + } + + /** + * Test CLI policy. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws ApexModelException ifd there is an Apex Error + */ + @Test + public void testCLIPolicy() throws IOException, ApexModelException { + + final File tempLogFile1 = File.createTempFile("TestMyFirstPolicy1CLI", ".log"); + final File tempModelFile1 = File.createTempFile("TestMyFirstPolicy1CLI", ".json"); + final File tempLogFile2 = File.createTempFile("TestMyFirstPolicy2CLI", ".log"); + final File tempModelFile2 = File.createTempFile("TestMyFirstPolicy2CLI", ".json"); + final String[] testApexModel1CliArgs = + { "-c", "src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex", "-l", + tempLogFile1.getAbsolutePath(), "-o", tempModelFile1.getAbsolutePath() }; + final String[] testApexModel2CliArgs = + { "-c", "src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex", "-l", + tempLogFile2.getAbsolutePath(), "-o", tempModelFile2.getAbsolutePath() }; + + new ApexCLIEditorMain(testApexModel1CliArgs); + new ApexCLIEditorMain(testApexModel2CliArgs); + + final ApexModelReader reader = new ApexModelReader<>(AxPolicyModel.class); + AxPolicyModel generatedmodel = reader.read(TextFileUtils.getTextFileAsString(tempModelFile1.getAbsolutePath())); + + assertEquals("Model generated from the CLI (" + testApexModel1CliArgs[1] + ") into file " + + tempModelFile1.getAbsolutePath() + " is not the same as the test Model for " + + testApexModel1.getKey(), testApexModel1, generatedmodel); + + generatedmodel = reader.read(TextFileUtils.getTextFileAsString(tempModelFile2.getAbsolutePath())); + assertEquals("Model generated from the CLI (" + testApexModel2CliArgs[1] + ") into file " + + tempModelFile2.getAbsolutePath() + " is not the same as the test Model for " + + testApexModel2.getKey(), testApexModel2, generatedmodel); + + tempLogFile1.delete(); + tempModelFile1.delete(); + + tempLogFile2.delete(); + tempModelFile2.delete(); + + } +} diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCreator.java b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCreator.java new file mode 100644 index 000000000..2f51f2851 --- /dev/null +++ b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModelCreator.java @@ -0,0 +1,106 @@ +/*- + * ============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.examples.myfirstpolicy; + +import org.onap.policy.apex.examples.myfirstpolicy.model.MFPDomainModelFactory; +import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +/** + * Create the MyFirstPolicyModel - base class. + * + * @author John Keeney (John.Keeney@ericsson.com) + */ +public abstract class TestMFPModelCreator implements TestApexModelCreator { + + /* + * (non-Javadoc) + * + * @see org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator#getMalstructuredModel() + */ + @Override + public AxPolicyModel getMalstructuredModel() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator#getObservationModel() + */ + @Override + public AxPolicyModel getObservationModel() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator#getWarningModel() + */ + @Override + public AxPolicyModel getWarningModel() { + return getModel(); + } + + /* + * (non-Javadoc) + * + * @see org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator#getInvalidModel() + */ + @Override + public AxPolicyModel getInvalidModel() { + return null; + } + + /** + * Create the MyFirstPolicyModel #1. + */ + public static class TestMFP1ModelCreator extends TestMFPModelCreator { + + /* + * (non-Javadoc) + * + * @see org.onap.policy.apex.model.basicmodel.handling.ApexModelCreator#getModel() + */ + @Override + public AxPolicyModel getModel() { + return new MFPDomainModelFactory().getMFP1PolicyModel(); + } + } + + /** + * Create the MyFirstPolicyModel#2. + */ + public static class TestMFP2ModelCreator extends TestMFPModelCreator { + + /* + * (non-Javadoc) + * + * @see org.onap.policy.apex.model.basicmodel.handling.ApexModelCreator#getModel() + */ + @Override + public AxPolicyModel getModel() { + return new MFPDomainModelFactory().getMFP2PolicyModel(); + } + } + +} diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java new file mode 100644 index 000000000..194072d99 --- /dev/null +++ b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java @@ -0,0 +1,331 @@ +/*- + * ============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.examples.myfirstpolicy; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.apex.core.engine.EngineParameters; +import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory; +import org.onap.policy.apex.core.engine.engine.impl.ApexEngineImpl; +import org.onap.policy.apex.core.engine.event.EnEvent; +import org.onap.policy.apex.examples.myfirstpolicy.model.MFPDomainModelFactory; +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; +import org.onap.policy.apex.model.eventmodel.concepts.AxField; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.model.utilities.ResourceUtils; +import org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters; +import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters; + +/** + * Test MyFirstPolicy Use Case. + */ +public class TestMFPUseCase { + // CHECKSTYLE:OFF: MagicNumber + + private static ApexEngineImpl apexEngine; + + /** + * Test MFP use case setup. + */ + @BeforeClass + public static void testMFPUseCaseSetup() { + final AxArtifactKey key = new AxArtifactKey("MyFirstPolicyApexEngine", "0.0.1"); + final EngineParameters parameters = new EngineParameters(); + parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + parameters.getExecutorParameterMap().put("JAVASCRIPT", new JavascriptExecutorParameters()); + apexEngine = (ApexEngineImpl) new ApexEngineFactory().createApexEngine(key); + } + + /** + * Test MyFirstPolicy#1 use case. + * + * @throws ApexException if there is an Apex error + * @throws InterruptedException if there is an Interruption. + * @throws IOException Signals that an I/O exception has occurred. + */ + @Test + public void testMFP1Case() throws ApexException, InterruptedException, IOException { + final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP1PolicyModel(); + assertNotNull(apexPolicyModel); + + final TestSaleAuthListener listener = new TestSaleAuthListener("Test"); + apexEngine.addEventListener("listener", listener); + apexEngine.updateModel(apexPolicyModel); + apexEngine.start(); + + final AxEvent axEventin = apexPolicyModel.getEvents().get(new AxArtifactKey("SALE_INPUT:0.0.1")); + assertNotNull(axEventin); + final AxEvent axEventout = apexPolicyModel.getEvents().get(new AxArtifactKey("SALE_AUTH:0.0.1")); + assertNotNull(axEventout); + + EnEvent event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json"); + apexEngine.handleEvent(event); + EnEvent resultout = listener.getResult(); + EnEvent resulexpected = + fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json"); + assertEquals(resulexpected, resultout); + + event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json"); + apexEngine.handleEvent(event); + resultout = listener.getResult(); + resulexpected = + fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json"); + assertEquals(resulexpected, resultout); + assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID()); + + event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json"); + apexEngine.handleEvent(event); + resultout = listener.getResult(); + resulexpected = + fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json"); + assertEquals(resulexpected, resultout); + assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID()); + + apexEngine.stop(); + } + + /** + * Test MyFirstPolicy#2 use case. + * + * @throws ApexException if there is an Apex error + * @throws InterruptedException if there is an Interruption. + * @throws IOException Signals that an I/O exception has occurred. + */ + @Test + public void testMFP2Case() throws ApexException, InterruptedException, IOException { + final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP2PolicyModel(); + assertNotNull(apexPolicyModel); + + final TestSaleAuthListener listener = new TestSaleAuthListener("Test"); + apexEngine.addEventListener("listener", listener); + apexEngine.updateModel(apexPolicyModel); + apexEngine.start(); + + final AxEvent axEventin = apexPolicyModel.getEvents().get(new AxArtifactKey("SALE_INPUT:0.0.1")); + assertNotNull(axEventin); + final AxEvent axEventout = apexPolicyModel.getEvents().get(new AxArtifactKey("SALE_AUTH:0.0.1")); + assertNotNull(axEventout); + + EnEvent event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json"); + apexEngine.handleEvent(event); + EnEvent resultout = listener.getResult(); + EnEvent resulexpected = + fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json"); + assertEquals(resulexpected, resultout); + assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID()); + + event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json"); + apexEngine.handleEvent(event); + resultout = listener.getResult(); + resulexpected = + fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json"); + assertEquals(resulexpected, resultout); + assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID()); + + event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json"); + apexEngine.handleEvent(event); + resultout = listener.getResult(); + resulexpected = + fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json"); + assertEquals(resulexpected, resultout); + assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID()); + + event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/2/EventIn_BoozeItem_101433CET_thurs.json"); + apexEngine.handleEvent(event); + resultout = listener.getResult(); + resulexpected = + fillResultEvent(axEventout, "examples/events/MyFirstPolicy/2/EventOut_BoozeItem_101433CET_thurs.json"); + assertEquals(resulexpected, resultout); + assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID()); + + event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/2/EventIn_BoozeItem_171937CET_sun.json"); + apexEngine.handleEvent(event); + resultout = listener.getResult(); + resulexpected = + fillResultEvent(axEventout, "examples/events/MyFirstPolicy/2/EventOut_BoozeItem_171937CET_sun.json"); + assertEquals(resulexpected, resultout); + assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID()); + + event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/2/EventIn_NonBoozeItem_111309CET_mon.json"); + apexEngine.handleEvent(event); + resultout = listener.getResult(); + resulexpected = + fillResultEvent(axEventout, "examples/events/MyFirstPolicy/2/EventOut_NonBoozeItem_111309CET_mon.json"); + assertEquals(resulexpected, resultout); + assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID()); + + apexEngine.stop(); + } + + /** + * Fill trigger event for test. + * + * @param event the event + * @param inputFile the input file + * @return the filled event + */ + private EnEvent fillTriggerEvent(final AxEvent event, final String inputFile) { + final EnEvent ret = new EnEvent(event.getKey()); + final GsonBuilder gb = new GsonBuilder(); + gb.serializeNulls().enableComplexMapKeySerialization(); + final JsonObject jsonObject = + gb.create().fromJson(ResourceUtils.getResourceAsString(inputFile), JsonObject.class); + assertNotNull(jsonObject); + assertTrue(jsonObject.has("name")); + assertTrue(ret.getName().equals(jsonObject.get("name").getAsString())); + assertTrue(ret.getAxEvent().getKey().getName().equals(jsonObject.get("name").getAsString())); + assertTrue(jsonObject.has("nameSpace")); + assertTrue(ret.getAxEvent().getNameSpace().equals(jsonObject.get("nameSpace").getAsString())); + assertTrue(jsonObject.has("version")); + assertTrue(ret.getAxEvent().getKey().getVersion().equals(jsonObject.get("version").getAsString())); + final List reserved = Arrays.asList("name", "nameSpace", "version", "source", "target"); + for (final Map.Entry e : jsonObject.entrySet()) { + if (reserved.contains(e.getKey())) { + continue; + } + assertTrue("Event file " + inputFile + " has a field " + e.getKey() + " but this is not defined for " + + event.getID(), (event.getParameterMap().containsKey(e.getKey()))); + if (jsonObject.get(e.getKey()).isJsonNull()) { + ret.put(e.getKey(), null); + } + } + for (final AxField field : event.getFields()) { + if (!field.getOptional()) { + assertTrue("Event file " + inputFile + " is missing a mandatory field " + field.getKey().getLocalName() + + " for " + event.getID(), jsonObject.has(field.getKey().getLocalName())); + } else { + ret.put(field.getKey().getLocalName(), null); + } + } + if (jsonObject.has("time") && !jsonObject.get("time").isJsonNull()) { + ret.put("time", jsonObject.get("time").getAsLong()); + } + if (jsonObject.has("sale_ID") && !jsonObject.get("sale_ID").isJsonNull()) { + ret.put("sale_ID", jsonObject.get("sale_ID").getAsLong()); + } + if (jsonObject.has("amount") && !jsonObject.get("amount").isJsonNull()) { + ret.put("amount", jsonObject.get("amount").getAsDouble()); + } + if (jsonObject.has("item_ID") && !jsonObject.get("item_ID").isJsonNull()) { + ret.put("item_ID", jsonObject.get("item_ID").getAsLong()); + } + if (jsonObject.has("quantity") && !jsonObject.get("quantity").isJsonNull()) { + ret.put("quantity", jsonObject.get("quantity").getAsInt()); + } + if (jsonObject.has("assistant_ID") && !jsonObject.get("assistant_ID").isJsonNull()) { + ret.put("assistant_ID", jsonObject.get("assistant_ID").getAsLong()); + } + if (jsonObject.has("branch_ID") && !jsonObject.get("branch_ID").isJsonNull()) { + ret.put("branch_ID", jsonObject.get("branch_ID").getAsLong()); + } + if (jsonObject.has("notes") && !jsonObject.get("notes").isJsonNull()) { + ret.put("notes", jsonObject.get("notes").getAsString()); + } + return ret; + } + + /** + * Fill result event for test. + * + * @param event the event + * @param inputFile the input file + * @return the filled event + */ + private EnEvent fillResultEvent(final AxEvent event, final String inputFile) { + final EnEvent ret = new EnEvent(event.getKey()); + final GsonBuilder gb = new GsonBuilder(); + gb.serializeNulls().enableComplexMapKeySerialization(); + final JsonObject jsonObject = + gb.create().fromJson(ResourceUtils.getResourceAsString(inputFile), JsonObject.class); + assertNotNull(jsonObject); + assertTrue(jsonObject.has("name")); + assertTrue(ret.getName().equals(jsonObject.get("name").getAsString())); + assertTrue(ret.getAxEvent().getKey().getName().equals(jsonObject.get("name").getAsString())); + assertTrue(jsonObject.has("nameSpace")); + assertTrue(ret.getAxEvent().getNameSpace().equals(jsonObject.get("nameSpace").getAsString())); + assertTrue(jsonObject.has("version")); + assertTrue(ret.getAxEvent().getKey().getVersion().equals(jsonObject.get("version").getAsString())); + final List reserved = Arrays.asList("name", "nameSpace", "version", "source", "target"); + for (final Map.Entry e : jsonObject.entrySet()) { + if (reserved.contains(e.getKey())) { + continue; + } + assertTrue("Event file " + inputFile + " has a field " + e.getKey() + " but this is not defined for " + + event.getID(), (event.getParameterMap().containsKey(e.getKey()))); + if (jsonObject.get(e.getKey()).isJsonNull()) { + ret.put(e.getKey(), null); + } + } + for (final AxField field : event.getFields()) { + if (!field.getOptional()) { + assertTrue("Event file " + inputFile + " is missing a mandatory field " + field.getKey().getLocalName() + + " for " + event.getID(), jsonObject.has(field.getKey().getLocalName())); + } else { + ret.put(field.getKey().getLocalName(), null); + } + } + if (jsonObject.has("time") && !jsonObject.get("time").isJsonNull()) { + ret.put("time", jsonObject.get("time").getAsLong()); + } + if (jsonObject.has("sale_ID") && !jsonObject.get("sale_ID").isJsonNull()) { + ret.put("sale_ID", jsonObject.get("sale_ID").getAsLong()); + } + if (jsonObject.has("amount") && !jsonObject.get("amount").isJsonNull()) { + ret.put("amount", jsonObject.get("amount").getAsDouble()); + } + if (jsonObject.has("item_ID") && !jsonObject.get("item_ID").isJsonNull()) { + ret.put("item_ID", jsonObject.get("item_ID").getAsLong()); + } + if (jsonObject.has("quantity") && !jsonObject.get("quantity").isJsonNull()) { + ret.put("quantity", jsonObject.get("quantity").getAsInt()); + } + if (jsonObject.has("assistant_ID") && !jsonObject.get("assistant_ID").isJsonNull()) { + ret.put("assistant_ID", jsonObject.get("assistant_ID").getAsLong()); + } + if (jsonObject.has("branch_ID") && !jsonObject.get("branch_ID").isJsonNull()) { + ret.put("branch_ID", jsonObject.get("branch_ID").getAsLong()); + } + if (jsonObject.has("notes") && !jsonObject.get("notes").isJsonNull()) { + ret.put("notes", jsonObject.get("notes").getAsString()); + } + if (jsonObject.has("authorised") && !jsonObject.get("authorised").isJsonNull()) { + ret.put("authorised", jsonObject.get("authorised").getAsString()); + } + if (jsonObject.has("message") && !jsonObject.get("message").isJsonNull()) { + ret.put("message", jsonObject.get("message").getAsString()); + } + return ret; + } +} diff --git a/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java new file mode 100644 index 000000000..2dfd1af61 --- /dev/null +++ b/examples/myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java @@ -0,0 +1,93 @@ +/*- + * ============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.examples.myfirstpolicy; + +import java.util.ArrayList; +import java.util.List; + +import org.onap.policy.apex.core.engine.engine.EnEventListener; +import org.onap.policy.apex.core.engine.event.EnEvent; +import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; + +/** + * The listener interface for receiving SaleAuth events. The class that is interested in processing a SaleAuth event + * implements this interface, and the object created with that class is registered with a component using the + * component's addTestApexActionListener method. When the testApexAction event occurs, that object's + * appropriate method is invoked. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class TestSaleAuthListener implements EnEventListener { + // CHECKSTYLE:OFF: MagicNumber + + private final List resultEvents = new ArrayList<>(); + + private final String id; + + /** + * Instantiates a new action listener. + * + * @param id the id + */ + public TestSaleAuthListener(final String id) { + this.id = id; + } + + /** + * Gets the result. + * + * @return the result + */ + public EnEvent getResult() { + while (resultEvents.isEmpty()) { + ThreadUtilities.sleep(100); + } + return resultEvents.remove(0); + } + + /* + * (non-Javadoc) + * + * @see + * org.onap.policy.apex.core.engine.engine.EnEventListener#onEnEvent(org.onap.policy.apex.core.engine.event.EnEvent) + */ + @Override + public void onEnEvent(final EnEvent saleauthEvent) { + try { + Thread.sleep(100); + } catch (final InterruptedException e) { + e.printStackTrace(); + } + if (saleauthEvent != null) { + System.out.println("SaleAuth event from engine:" + saleauthEvent.getName()); + resultEvents.add(saleauthEvent); + } + } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return id; + } +} diff --git a/examples/myfirstpolicy/src/test/resources/META-INF/persistence.xml b/examples/myfirstpolicy/src/test/resources/META-INF/persistence.xml new file mode 100644 index 000000000..4dcba14b7 --- /dev/null +++ b/examples/myfirstpolicy/src/test/resources/META-INF/persistence.xml @@ -0,0 +1,69 @@ + + + + + + org.eclipse.persistence.jpa.PersistenceProvider + + org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner + org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String + org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey + org.onap.policy.apex.model.basicmodel.concepts.AxConcept + org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo + org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation + org.onap.policy.apex.model.basicmodel.concepts.AxModel + org.onap.policy.apex.model.basicmodel.concepts.TestEntity + org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema + org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas + org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum + org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums + org.onap.policy.apex.model.contextmodel.concepts.AxContextModel + org.onap.policy.apex.model.eventmodel.concepts.AxField + org.onap.policy.apex.model.eventmodel.concepts.AxInputField + org.onap.policy.apex.model.eventmodel.concepts.AxOutputField + org.onap.policy.apex.model.eventmodel.concepts.AxEvent + org.onap.policy.apex.model.eventmodel.concepts.AxEvents + org.onap.policy.apex.model.eventmodel.concepts.AxEventModel + org.onap.policy.apex.model.policymodel.concepts.AxLogic + org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter + org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic + org.onap.policy.apex.model.policymodel.concepts.AxTask + org.onap.policy.apex.model.policymodel.concepts.AxTasks + org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic + org.onap.policy.apex.model.policymodel.concepts.AxStateFinalizerLogic + org.onap.policy.apex.model.policymodel.concepts.AxStateOutput + org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference + org.onap.policy.apex.model.policymodel.concepts.AxState + org.onap.policy.apex.model.policymodel.concepts.AxPolicy + org.onap.policy.apex.model.policymodel.concepts.AxPolicies + org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel + + + + + + + + + + + + diff --git a/examples/myfirstpolicy/src/test/resources/logback-test.xml b/examples/myfirstpolicy/src/test/resources/logback-test.xml new file mode 100644 index 000000000..ea201e0a9 --- /dev/null +++ b/examples/myfirstpolicy/src/test/resources/logback-test.xml @@ -0,0 +1,74 @@ + + + + + Apex + + + + + + + + %d %contextName [%t] %level %logger{36} - %msg%n + + + + + + + + + + + + + + + + + ${LOG_DIR}/apex.log + + %d %-5relative [procId=${processId}] [%thread] %-5level + %logger{26} - %msg %n %ex{full} + + + + + ${LOG_DIR}/apex_ctxt.log + + %d %-5relative [procId=${processId}] [%thread] %-5level + %logger{26} - %msg %n %ex{full} + + + + + + + + + + + + + + + diff --git a/examples/pcvs/pom.xml b/examples/pcvs/pom.xml new file mode 100644 index 000000000..22da4eda1 --- /dev/null +++ b/examples/pcvs/pom.xml @@ -0,0 +1,106 @@ + + + 4.0.0 + + org.onap.policy.apex-pdp.examples + examples + 2.0.0-SNAPSHOT + + + pcvs + ${project.artifactId} + Example for Policy-controlled Video Streaming + + + ${project.basedir}/src + + + + + org.onap.policy.apex-pdp.model + policy-model + ${project.version} + + + org.onap.policy.apex-pdp.core + core-engine + ${project.version} + test + + + org.onap.policy.apex-pdp.core + core-infrastructure + ${project.version} + + + org.onap.policy.apex-pdp.auth + cli-editor + ${project.version} + + + org.onap.policy.apex-pdp.plugins.plugins-executor + plugins-executor-mvel + ${project.version} + test + + + org.onap.policy.apex-pdp.plugins.plugins-executor + plugins-executor-javascript + ${project.version} + test + + + org.apache.derby + derby + ${version.derby} + test + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + generate-models + process-classes + + exec + + + java + + -classpath + + org.onap.policy.apex.examples.pcvs.model.PCVSDomainModelSaver + ${project.basedir} + ${project.build.directory}/classes/examples/models/pcvs/ + + + + + + + + \ No newline at end of file diff --git a/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java b/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java new file mode 100644 index 000000000..19825e335 --- /dev/null +++ b/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java @@ -0,0 +1,72 @@ +/*- + * ============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.examples.pcvs.model; + +import java.io.File; + +import org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain; +import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.model.utilities.ResourceUtils; + +/** + * A factory for creating PCVSDomainModel objects. + * + * @author Sven van der Meer (sven.van.der.meer@ericsson.com) + */ +public class PCVSDomainModelFactory { + + /** + * Generates the PCVS VPN-SLA policy model from CLI commands and creates an APEX model. + * + * @param workingDirectory The working directory for the CLI editor for includes + * + * @return the PCVS VPN-SLA policy model + */ + public AxPolicyModel getPCVVpnSlaSPolicyModel(final String workingDirectory) { + final String path = "target/model-gen/pcvs/vpnsla"; + final String file = "policy.json"; + final String full = path + "/" + file; + + final File pathFile = new File(path); + pathFile.mkdirs(); + + final String[] args = + new String[] { "-c", "src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex", "-wd", + workingDirectory, "-o", full }; + + final ApexCLIEditorMain cliEditor = new ApexCLIEditorMain(args); + if (cliEditor.getErrorCount() > 0) { + throw new ApexRuntimeException( + "Apex CLI editor execution failed with " + cliEditor.getErrorCount() + " errors"); + } + + java.util.TimeZone.getTimeZone("gmt"); + try { + final ApexModelReader reader = new ApexModelReader<>(AxPolicyModel.class); + return reader.read(ResourceUtils.getResourceAsString(full)); + } catch (final Exception e) { + throw new ApexRuntimeException("Failed to build PCVS SLA1 policy from path: " + full, e); + } + } + +} diff --git a/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java b/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java new file mode 100644 index 000000000..ee6277a8e --- /dev/null +++ b/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java @@ -0,0 +1,57 @@ +/*- + * ============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.examples.pcvs.model; + +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +/** + * The Class PCVSDomainModelSaver. + * + * @author Sven van der Meer (sven.van.der.meer@ericsson.com) + */ +public final class PCVSDomainModelSaver { + + /** Private constructor to prevent instantiation. */ + private PCVSDomainModelSaver() {} + + /** + * Write all PCVS models to args[0]. + * + * @param args uses arg[0] for directory information + * @throws ApexException the apex exception + */ + public static void main(final String[] args) throws ApexException { + if (args.length != 2) { + System.err.println( + "usage: " + PCVSDomainModelSaver.class.getCanonicalName() + " workingDirectory modelDirectory"); + return; + } + + final AxPolicyModel pcvsPolicyModel = new PCVSDomainModelFactory().getPCVVpnSlaSPolicyModel(args[0]); + final ApexModelSaver pcvsModelSaver = + new ApexModelSaver<>(AxPolicyModel.class, pcvsPolicyModel, args[1] + "vpnsla/"); + pcvsModelSaver.apexModelWriteJSON(); + pcvsModelSaver.apexModelWriteXML(); + + } +} diff --git a/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java b/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java new file mode 100644 index 000000000..ff9b39730 --- /dev/null +++ b/examples/pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java @@ -0,0 +1,30 @@ +/*- + * ============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========================================================= + */ + +/** + * Contains the model for Policy-controlled Video Streaming. + * + * @author Sven van der Meer (sven.van.der.meer@ericsson.com) + * @author Joseph McNamara (joseph.mcnamara@ericsson.com) + * @author John Keeney (john.keeney@ericsson.com) + */ + +package org.onap.policy.apex.examples.pcvs.model; + diff --git a/examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json b/examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json new file mode 100644 index 000000000..841028bd5 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json @@ -0,0 +1,69 @@ +{ + "engineServiceParameters":{ + "name" : "VpnSlaApexEngine", + "version" : "1.0.0", + "id" : 45, + "instanceCount" : 1, + "deploymentPort" : 12345, + "policyModelFileName" : 'examples/models/pcvs/vpnsla/PCVS-VpnSla.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' + } + } + } + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters":{ + "carrierTechnology" : "KAFKA", + "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters", + "parameters" : { + 'bootstrapServers' : 'localhost:9092', + 'acks' : 'all', + 'retries' : 0, + 'batchSize' : 16384, + 'lingerTime' : 1, + 'bufferMemory' : 33554432, + 'producerTopic' : 'apex-out', + 'keySerializer' : 'org.apache.kafka.common.serialization.StringSerializer', + 'valueSerializer' : 'org.apache.kafka.common.serialization.StringSerializer' + } + }, + "eventProtocolParameters":{ + "eventProtocol" : "JSON" + } + } + }, + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters":{ + "carrierTechnology" : "KAFKA", + "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters", + "parameters" : { + 'bootstrapServers' : 'localhost:9092', + 'groupId' : 'apex-group-id', + 'enableAutoCommit' : true, + 'autoCommitTime' : 1000, + 'sessionTimeout' : 30000, + 'consumerPollTime' : 100, + 'consumerTopicList' : ['apex-in-0', 'apex-in-1'], + 'keyDeserializer' : 'org.apache.kafka.common.serialization.StringDeserializer', + 'valueDeserializer' : 'org.apache.kafka.common.serialization.StringDeserializer' + } + }, + "eventProtocolParameters":{ + "eventProtocol" : "JSON" + } + } + } +} diff --git a/examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json b/examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json new file mode 100644 index 000000000..d48a47e69 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json @@ -0,0 +1,51 @@ +{ + "engineServiceParameters":{ + "name" : "VpnSlaApexEngine", + "version" : "1.0.0", + "id" : 45, + "instanceCount" : 1, + "deploymentPort" : 12345, + "policyModelFileName" : "examples/models/pcvs/vpnsla/PCVS-VpnSla.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" + } + } + } + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters" : { + "carrierTechnology" : "FILE", + "parameters" : { + "standardIO" : true + } + }, + "eventProtocolParameters" : { + "eventProtocol" : "JSON" + } + } + }, + "eventInputParameters": { + "FirstConsumer": { + "carrierTechnologyParameters" : { + "carrierTechnology" : "FILE", + "parameters" : { + "standardIO" : true + } + }, + "eventProtocolParameters" : { + "eventProtocol" : "JSON" + } + } + } +} diff --git a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json b/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json new file mode 100644 index 000000000..50eac5726 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json @@ -0,0 +1,28 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "CustomerContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_CustomerContext", + "customerName": "A", + "links": "L01 L05 L09 L10", + "dtSLA": 180, + "dtYTD": 10, + "priority": false, + "satisfaction": 80 +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "CustomerContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_CustomerContext", + "customerName": "B", + "links": "L02 L07 L09 L10", + "dtSLA": 180, + "dtYTD": 120, + "priority": true, + "satisfaction": 99 +} + diff --git a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json b/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json new file mode 100644 index 000000000..f611ce16d --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json @@ -0,0 +1,120 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "EdgeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_EdgeContext", + "edgeName": "L01", + "start": "A1", + "end": "A1CO", + "status": true +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "EdgeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_EdgeContext", + "edgeName": "L02", + "start": "B1", + "end": "B1CO", + "status": true +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "EdgeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_EdgeContext", + "edgeName": "L03", + "start": "A2", + "end": "A2CO", + "status": true +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "EdgeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_EdgeContext", + "edgeName": "L04", + "start": "B2", + "end": "B2CO", + "status": true +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "EdgeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_EdgeContext", + "edgeName": "L05", + "start": "A1CO", + "end": "BBL", + "status": true +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "EdgeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_EdgeContext", + "edgeName": "L06", + "start": "B1CO", + "end": "BBL", + "status": true +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "EdgeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_EdgeContext", + "edgeName": "L07", + "start": "A2CO", + "end": "BBR", + "status": true +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "EdgeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_EdgeContext", + "edgeName": "L08", + "start": "B2CO", + "end": "BBR", + "status": true +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "EdgeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_EdgeContext", + "edgeName": "L09", + "start": "BBL", + "end": "BBR", + "status": true +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "EdgeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_EdgeContext", + "edgeName": "L10", + "start": "BBR", + "end": "BBL", + "status": true +} + diff --git a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json b/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json new file mode 100644 index 000000000..5c195a8cf --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json @@ -0,0 +1,101 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "NodeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_NodeContext", + "nodeName": "A1", + "mininetName": "nn" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "NodeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_NodeContext", + "nodeName": "A2", + "mininetName": "nn" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "NodeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_NodeContext", + "nodeName": "B1", + "mininetName": "nn" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "NodeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_NodeContext", + "nodeName": "B2", + "mininetName": "nn" +} + + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "NodeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_NodeContext", + "nodeName": "A1CO", + "mininetName": "s1" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "NodeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_NodeContext", + "nodeName": "A2CO", + "mininetName": "s2" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "NodeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_NodeContext", + "nodeName": "B1CO", + "mininetName": "s3" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "NodeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_NodeContext", + "nodeName": "B2CO", + "mininetName": "s4" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "NodeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_NodeContext", + "nodeName": "BBL", + "mininetName": "s5" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "NodeContextEventIn", + "version": "1.0.0", + "source": "CtxtManagement", + "target" : "VpnSlaPolicy_NodeContext", + "nodeName": "BBR", + "mininetName": "s6" +} + diff --git a/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json b/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json new file mode 100644 index 000000000..d204614f6 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json @@ -0,0 +1,50 @@ +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "VpnSlaTrigger", + "version": "1.0.0", + "source": "ExampleEvents", + "target" : "VpnSlaPolicy", + "edgeName": "L09", + "status": "UP" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "VpnSlaTrigger", + "version": "1.0.0", + "source": "ExampleEvents", + "target" : "VpnSlaPolicy", + "edgeName": "L09", + "status": "UP" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "VpnSlaTrigger", + "version": "1.0.0", + "source": "ExampleEvents", + "target" : "VpnSlaPolicy", + "edgeName": "L09", + "status": "DOWN" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "VpnSlaTrigger", + "version": "1.0.0", + "source": "ExampleEvents", + "target" : "VpnSlaPolicy", + "edgeName": "L09", + "status": "DOWN" +} + +{ + "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla", + "name": "VpnSlaTrigger", + "version": "1.0.0", + "source": "ExampleEvents", + "target" : "VpnSlaPolicy", + "edgeName": "L09", + "status": "UP" +} + diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py new file mode 100644 index 000000000..907dd22cb --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py @@ -0,0 +1,214 @@ +# ============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========================================================= + +import http.client +import json +import time +from kafka import KafkaConsumer, KafkaProducer + +class StaticFlowPusher(object): + + def __init__(self, server): + self.server = server + + def get(self, data): + ret = self.rest_call({}, 'GET') + return json.loads(ret[2]) + + def set(self, data): + ret = self.rest_call(data, 'POST') + return ret[0] == 200 + + def remove(self, objtype, data): + ret = self.rest_call(data, 'DELETE') + return ret[0] == 200 + + def getControllerSummary(self, data): + ret = self.rest_call_controller_summary({}, 'GET') + return json.loads(ret[2]) + + def getLinks(self, data): + ret = self.rest_call_links({}, 'GET') + return json.loads(ret[2].decode()) + + def rest_call(self, data, action): + path = '/wm/staticflowpusher/json' + headers = { + 'Content-type': 'application/json', + 'Accept': 'application/json', + } + body = json.dumps(data) + conn = http.client.HTTPConnection(self.server, 8080) + conn.request(action, path, body, headers) + response = conn.getresponse() + ret = (response.status, response.reason, response.read()) + print(ret) + conn.close() + return ret + + def rest_call_controller_summary(self, data, action): + path = '/wm/core/controller/summary/json' + headers = { + 'Content-type': 'application/json', + 'Accept': 'application/json', + } + body = json.dumps(data) + conn = http.client.HTTPConnection(self.server, 8080) + conn.request(action, path, body, headers) + response = conn.getresponse() + ret = (response.status, response.reason, response.read()) + print(ret) + conn.close() + return ret + + def rest_call_links(self, data, action): + path = '/wm/topology/links/json' + headers = { + 'Content-type': 'application/json', + 'Accept': 'application/json', + } + body = json.dumps(data) + conn = http.client.HTTPConnection(self.server, 8080) + conn.request(action, path, body, headers) + response = conn.getresponse() + ret = (response.status, response.reason, response.read()) + conn.close() + return ret + +pusher = StaticFlowPusher('127.0.1.1') + + +def parseLinks(links): + #print("\n\n\n",links) + result = [] + for link in links: + list = [] + #print("\n\n\n",link) + #print("\nsrc-switch : s", link['src-switch'][len(link['src-switch'])-1]) + #print("\ndst-switch : s", link['dst-switch'][len(link['dst-switch'])-1]) + list.append("s") + list.append(link['src-switch'][len(link['src-switch'])-1]) + list.append("-s") + list.append(link['dst-switch'][len(link['dst-switch'])-1]) + result.append(''.join(list)) + #print(result, "\n") + return result + + + +counter =0 +healthyList = [] +testableList = [] +healthyLinks = "" +testableLinks = "" +producer = KafkaProducer(bootstrap_servers='localhost:9092') +while(True): + time.sleep(30) + switchLinks = pusher.getLinks({}) + if counter == 0: + healthyList = parseLinks(switchLinks) + #Build All Links + print("READING LINKS FROM MININET\n") + for l in healthyList: + link = "" + #print(l, "\n") + #Links between switches [s6-s7 is ignored so it matches VPN SCENARIO] + if(l == "s1-s5"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L05', 'start': 'A1CO','end': 'BBL'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + if(l == "s5-s6"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L09', 'start': 'BBL','end': 'BBR'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + if(l == "s2-s6"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L07', 'start': 'A2CO','end': 'BBR'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + if(l == "s5-s7"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L10', 'start': 'BBR','end': 'BBL'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + if(l == "s3-s5"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L06', 'start': 'B1CO','end': 'BBL'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + if(l == "s4-s6"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L08', 'start': 'B2CO','end': 'BBR'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + #Links between switches and hosts [NoT SENT IN FROM FLOODLIGHT] + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L01', 'start': 'A1','end': 'A1CO'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L02', 'start': 'B1','end': 'B1CO'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L03', 'start': 'A2','end': 'A2CO'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L04', 'start': 'B2','end': 'B2CO'}") + print("LINKS HAVE BEEN SENT TO APEX\n") + + #Build Customers + print("BUILDING CUSTOMERS\n") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'CustomerContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_CustomerContext','dtYTD': 10,'dtSLA': 180,'links': 'L01 L05 L09 L10','customerName': 'A', 'priority': true,'satisfaction': 80}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'CustomerContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_CustomerContext','dtYTD': 120,'dtSLA': 180,'links': 'L02 L07 L09 L10','customerName': 'B', 'priority': false,'satisfaction': 99}") + print("CUSTOMERS HAVE BEEN SENT TO APEX\n") + healthyLinks = switchLinks + myfile = open('LinkInfo.json', 'a') + myfile.write(str(healthyLinks)) + myfile.write('\n') + myfile.close() + print("We start off with", len(healthyLinks), "healthy Links!\n") + else: + testableList = parseLinks(switchLinks) + issueLink = ""; + for h in healthyList: + issueLink = h + for t in testableList: + if t == h: + issueLink = "" + if issueLink != "": + print("There is an issue with the links! ", issueLink, " \n") + if(issueLink == "s1-s5"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L05'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + if(issueLink == "s5-s6"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L09'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + if(issueLink == "s2-s6"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L07'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + if(issueLink == "s5-s7"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L10'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + if(issueLink == "s3-s5"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L06'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + if(issueLink == "s4-s6"): + link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L08'}" + producer.send("apex-in-0", bytes(link, encoding="ascii")) + break + if issueLink == "": + print("All Links are working\n") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L01'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L02'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L03'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L04'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L05'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L06'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L07'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L08'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L09'}") + producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L10'}") + + testableLinks = switchLinks + myfile = open('LinkInfo.json', 'a') + myfile.write(str(testableLinks)) + myfile.write('\n') + myfile.close() + counter += 1 diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py new file mode 100644 index 000000000..4d6aea8f5 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py @@ -0,0 +1,216 @@ +# ============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========================================================= + +#Add Mininet to PATH +import sys +sys.path.insert(0, "/~/mininet") + +#Kafka +import httplib +import json +import time +from kafka import KafkaConsumer, KafkaProducer + +#Mininet +from mininet.clean import * +from mininet.cli import * +from mininet.link import * +from mininet.log import * +from mininet.net import * +from mininet.node import * +from mininet.nodelib import * +from mininet.topo import * +from mininet.topolib import * + +class StaticFlowPusher(object): + def __init__(self, server): + self.server = server + + def enableFirewall(self, data): + path = "/wm/firewall/module/enable/json" + headers = {'Content-Type': 'application/json','Accept': 'application/json',} + body = json.dumps(data) + conn = httplib.HTTPConnection(self.server, 8080) + conn.request("PUT", path, "") + response = conn.getresponse() + ret = (response.status, response.reason, response.read()) + conn.close() + return ret + + def addRule(self, data): + path = '/wm/firewall/rules/json' + headers = {'Content-Type': 'application/json','Accept': 'application/json',} + body = json.dumps(data) + conn = httplib.HTTPConnection(self.server, 8080) + conn.request('POST', path, body, headers) + response = conn.getresponse() + ret = (response.status, response.reason, response.read()) + conn.close() + return ret + + def deleteRule(self, data): + path = '/wm/firewall/rules/json' + headers = {'Content-Type': 'application/json','Accept': 'application/json',} + body = json.dumps(data) + conn = httplib.HTTPConnection(self.server, 8080) + conn.request('DELETE', path, body, headers) + response = conn.getresponse() + ret = (response.status, response.reason, response.read()) + conn.close() + return ret + +#Build Pusher(REST/IN) +pusher = StaticFlowPusher('127.0.0.1') + +net = Mininet(link=TCLink) + +#Create Customers +customerA1 = net.addHost( 'A1' ) +customerA2 = net.addHost( 'A2' ) +customerB1 = net.addHost( 'B1' ) +customerB2 = net.addHost( 'B2' ) + +#Create Switches +switchA1CO = net.addSwitch( 's1' ) +switchA2CO = net.addSwitch( 's2' ) +switchB1CO = net.addSwitch( 's3' ) +switchB2CO = net.addSwitch( 's4' ) +switchBBL = net.addSwitch( 's5' ) +switchBBR = net.addSwitch( 's6' ) +# we need an extra switch here because Mininet does not allow two links between two switches +switchEx = net.addSwitch( 's7' ) + +#Create Links +net.addLink( customerA1, switchA1CO ) +net.addLink( customerA2, switchA2CO ) +net.addLink( customerB1, switchB1CO ) +net.addLink( customerB2, switchB2CO ) +net.addLink( switchA1CO, switchBBL ) +net.addLink( switchB1CO, switchBBL ) +net.addLink( switchA2CO, switchBBR ) +net.addLink( switchB2CO, switchBBR ) +net.addLink( switchBBL, switchBBR) +net.addLink( switchBBR, switchEx, bw=1.2 ) +net.addLink( switchEx, switchBBL ) + +#Create Controller +floodlightController = net.addController(name='c0' , controller=RemoteController , ip='127.0.0.1', port=6653) + +net.start() + +if pusher.enableFirewall({})[0] == 200: + print("Firewall enabled!") + +#print(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01"})[2]) +s1id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01"})[2])['rule-id'] +s2id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:02"})[2])['rule-id'] +s3id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:03"})[2])['rule-id'] +s4id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:04"})[2])['rule-id'] +s5id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:05"})[2])['rule-id'] +s6id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:06"})[2])['rule-id'] +s7id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:07"})[2])['rule-id'] + + +result = 100 +while result!=0: + result = net.pingAll(None) +print("Network Simulation Complete") + +#Assume control and when finished "exit" +cli = CLI( net ) + +consumer = KafkaConsumer(bootstrap_servers='localhost:9092',auto_offset_reset='latest') +consumer.subscribe(['apex-out']) +print("Starting Message Loop") +for message in consumer: + myOutput = json.loads(message.value.decode()) + action = "" + try: + print("Checking Message") + #print("SWITCHES= ",net.switches) + #print("LINKS= ",net.links) + #print("VALUES= ",net.values) + if myOutput['edgeName'] != '': + print("Message Received: ",myOutput['edgeName']) + pusher.deleteRule({"ruleid": s1id}) + pusher.deleteRule({"ruleid": s2id}) + pusher.deleteRule({"ruleid": s3id}) + pusher.deleteRule({"ruleid": s4id}) + pusher.deleteRule({"ruleid": s5id}) + pusher.deleteRule({"ruleid": s6id}) + pusher.deleteRule({"ruleid": s7id}) + s1id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01"})[2])['rule-id'] + s2id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:02"})[2])['rule-id'] + s3id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:03"})[2])['rule-id'] + s4id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:04"})[2])['rule-id'] + s5id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:05"})[2])['rule-id'] + s6id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:06"})[2])['rule-id'] + s7id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:07"})[2])['rule-id'] + if myOutput['edgeName'] == "L01": + action = "link s1 s5 down" + #net.configLinkStatus('s1', 's5', "down") + pusher.deleteRule({"ruleid": s1id}) + s1id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01", "action": "DENY"})[2])['rule-id'] + if myOutput['edgeName'] == "L02": + action = "link s3 s5 down" + #net.configLinkStatus('s3', 's5', "down") + pusher.deleteRule({"ruleid": s3id}) + s3id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:03", "action": "DENY"})[2])['rule-id'] + if myOutput['edgeName'] == "L03": + action = "link s2 s6 down" + #net.configLinkStatus('s2', 's6', "down") + pusher.deleteRule({"ruleid": s1id}) + s1id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01", "action": "DENY"})[2])['rule-id'] + if myOutput['edgeName'] == "L04": + action = "link s4 s6 down" + #net.configLinkStatus('s4', 's6', "down") + pusher.deleteRule({"ruleid": s3id}) + s3id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:03", "action": "DENY"})[2])['rule-id'] + if myOutput['edgeName'] == "L05": + action = "link s1 s5 down" + #net.configLinkStatus('s1', 's5', "down") + pusher.deleteRule({"ruleid": s1id}) + s1id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01", "action": "DENY"})[2])['rule-id'] + if myOutput['edgeName'] == "L06": + action = "link s3 s5 down" + #net.configLinkStatus('s3', 's5', "down") + pusher.deleteRule({"ruleid": s3id}) + s3id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:03", "action": "DENY"})[2])['rule-id'] + if myOutput['edgeName'] == "L07": + action = "link s2 s6 down" + #net.configLinkStatus('s2', 's6', "down") + pusher.deleteRule({"ruleid": s2id}) + s2id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:02", "action": "DENY"})[2])['rule-id'] + if myOutput['edgeName'] == "L08": + action = "link s4 s6 down" + #net.configLinkStatus('s4', 's6', "down") + pusher.deleteRule({"ruleid": s4id}) + s4id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:04", "action": "DENY"})[2])['rule-id'] + if myOutput['edgeName'] == "L09": + action = "link s5 s6 down" + #net.configLinkStatus('s5', 's6', "down") + pusher.deleteRule({"ruleid": s7id}) + s7id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:07", "action": "DENY"})[2])['rule-id'] + if myOutput['edgeName'] == "L10": + print("L10") + #print(action) + #print("3") + except KeyError: + print(myOutput) +print("HA") +net.stop() diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh new file mode 100644 index 000000000..0579dcce5 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +cp $APEX_HOME/etc/logback-logic.xml $APEX_HOME/etc/logback.xml +cp $APEX_HOME/examples/scripts/pcvs/vpnsla/LinkMonitor.py $src_dir/kafka-python + diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh new file mode 100644 index 000000000..7d8542f5a --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +export src_dir=/usr/local/src +export APEX_HOME=/opt/app/policy/apex-pdp +export APEX_USER=apexuser diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh new file mode 100644 index 000000000..dd2f77d88 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +(cd $APEX_HOME; ./bin/apexApps.sh engine -c examples/config/pcvs/vpnsla/kafka2kafka.json) diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh new file mode 100644 index 000000000..a2f6ba417 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +(cd $src_dir/floodlight-master; java -jar target/floodlight.jar) diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh new file mode 100644 index 000000000..37321a6f2 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +/opt/Kafka/kafka_2.12-1.0.0/bin/kafka-server-start.sh /opt/Kafka/kafka_2.12-1.0.0/config/server.properties \ No newline at end of file diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh new file mode 100644 index 000000000..2a166bc87 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +(cd $src_dir; python3 $src_dir/kafka-python/LinkMonitor.py) \ No newline at end of file diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh new file mode 100644 index 000000000..ba6e343b2 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +mn -c && python $APEX_HOME/examples/scripts/pcvs/vpnsla/MininetTopology.py diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh new file mode 100644 index 000000000..1e709bb53 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +MOD_SCRIPT_NAME=`basename $0` + +if [ $# -eq 0 ]; then + echo "" + echo "$MOD_SCRIPT_NAME - run VLC that streams video" + echo "" + echo " Usage: $MOD_SCRIPT_NAME [video file]" + echo "" + exit +fi + +vlc-wrapper -vvv $1 --sout "#duplicate{dst=rtp{dst=10.0.0.2,port=5004,mux=ts},dst=display}" --sout-keep -q + diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh new file mode 100644 index 000000000..b00bca2c6 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +vlc-wrapper rtp://@:5004 -q + diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh new file mode 100644 index 000000000..8de02941a --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +MOD_SCRIPT_NAME=`basename $0` + +if [ $# -eq 0 ]; then + echo "" + echo "$MOD_SCRIPT_NAME - run VLC that streams video" + echo "" + echo " Usage: $MOD_SCRIPT_NAME [video file]" + echo "" + exit +fi + +vlc-wrapper -vvv $1 --sout "#duplicate{dst=rtp{dst=10.0.0.4,port=5004,mux=ts},dst=display}" --sout-keep -q + diff --git a/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh new file mode 100644 index 000000000..b00bca2c6 --- /dev/null +++ b/examples/pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# ============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========================================================= + +vlc-wrapper rtp://@:5004 -q + diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc new file mode 100644 index 000000000..eca3836a3 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc @@ -0,0 +1,16 @@ +{ + "type" : "record", + "name" : "Customer", + "fields" : [ + {"name" : "customerName", "type" : "string"}, + {"name" : "dtSLA" , "type" : "int"}, + {"name" : "dtYTD" , "type" : "int"}, + {"name" : "priority" , "type" : "boolean"}, + {"name" : "satisfaction", "type" : "int"}, + { + "name": "links", + "doc": "Links used by this customer", + "type": {"type" : "array", "items" : "string"} + } + ] +} diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc new file mode 100644 index 000000000..5961cb6f6 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc @@ -0,0 +1,22 @@ +{ + "type" : "record", + "name" : "Situation", + "fields" : [ + {"name": "description", "type": "string", "doc": "Description of the taken decision"}, + { + "name": "decision", + "doc": "taken decision", + "type": { + "type": "enum", + "name": "decisionEnum", + "symbols" : [ + "IMPEDE", + "REBUILD", + "NONE" + ] + } + }, + {"name": "customers", "type": {"type" : "array", "items" : "string"}, "doc": "List of customers affected by the decision"}, + {"name": "problemID", "type": "string", "doc": "Identifier of the problem for lookup in problemMap"} + ] +} diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc new file mode 100644 index 000000000..440a3d0a9 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc @@ -0,0 +1,8 @@ +{ + "type": "enum", + "name": "Status", + "symbols" : [ + "UP", + "DOWN" + ] +} diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc new file mode 100644 index 000000000..c633c129d --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc @@ -0,0 +1,34 @@ +{ + "type" : "record", + "name" : "Problem", + "fields" : [ + {"name": "edge", "type": "string"}, + {"name": "startTime", "type": "long"}, + {"name": "lastUpdate", "type": "long"}, + {"name": "endTime", "type": "long"}, + { + "name": "status", + "doc": "problem status", + "type": { + "type": "enum", + "name": "statusEnum", + "symbols" : [ + "NONE", + "STILL", + "SOLVED", + "NEW" + ] + } + }, + { + "name": "edgeUsedBy", + "doc": "customers using the edge", + "type": {"type" : "array", "items" : "string"} + }, + { + "name": "impededLast", + "doc": "customers last impeded", + "type": {"type" : "array", "items" : "string"} + } + ] +} diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc new file mode 100644 index 000000000..622f8af61 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc @@ -0,0 +1,8 @@ +{ + "type" : "record", + "name" : "Situation", + "fields" : [ + {"name": "problemID", "type": "string", "doc": "Identifier of the problem for lookup in problemMap"}, + {"name": "violatedSLAs", "type": {"type" : "array", "items" : "string"}, "doc": "List of customers with SLA violations"} + ] +} diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc new file mode 100644 index 000000000..993f608ab --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc @@ -0,0 +1,10 @@ +{ + "type" : "record", + "name" : "TopologyEdges", + "fields" : [ + {"name": "name", "type": "string", "doc": "Name of the Edge, typically a link name"}, + {"name": "start", "type": "string", "doc": "Edge endpoint: start - a node name"}, + {"name": "end", "type": "string", "doc": "Edge endpoint: end - a node name"}, + {"name": "active", "type": "boolean", "doc": "Flag for active/inactive edges, inactive means a link is down"} + ] +} diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc new file mode 100644 index 000000000..bf5e62796 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc @@ -0,0 +1,8 @@ +{ + "type" : "record", + "name" : "TopologyNodes", + "fields" : [ + {"name" : "name", "type" : "string", "doc": "The name of the node"}, + {"name" : "mnname", "type" : "string", "doc": "The name of the node in Mininet"} + ] +} diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js new file mode 100644 index 000000000..cefb7a97c --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js @@ -0,0 +1,80 @@ +/* + * ============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========================================================= + */ + +load("nashorn:mozilla_compat.js"); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id); +logger.trace("-- infields: " + executor.inFields); + +var ifCustomerName = executor.inFields["customerName"]; +var ifLinks = executor.inFields["links"]; + +logger.trace("-- got infields, testing existing customer"); +var ctxtCustomer = executor.getContextAlbum("albumCustomerMap").get(ifCustomerName); +if (ctxtCustomer != null) { + executor.getContextAlbum("albumCustomerMap").remove(ifCustomerName); + logger.trace("-- removed customer: <" + ifCustomerName + ">"); +} + +logger.trace("-- creating customer: <" + ifCustomerName + ">"); +var links = new Array(); +for (var i = 0; i < ifLinks.split(" ").length; i++) { + var link = executor.getContextAlbum("albumTopoEdges").get(ifLinks.split(" ")[i]); + if (link != null) { + logger.trace("-- link: <" + ifLinks.split(" ")[i] + ">"); + links.push(ifLinks.split(" ")[i]); + } else { + logger.trace("-- unknown link: <" + ifLinks.split(" ")[i] + "> for customer <" + ifCustomerName + ">"); + } +} +logger.trace("-- links: <" + links + ">"); +ctxtCustomer = "{customerName:" + ifCustomerName + ", dtSLA:" + executor.inFields["dtSLA"] + ", dtYTD:" + + executor.inFields["dtYTD"] + ", priority:" + executor.inFields["priority"] + ", satisfaction:" + + executor.inFields["satisfaction"] + ", links:[" + links + "]}"; + +executor.getContextAlbum("albumCustomerMap").put(ifCustomerName, ctxtCustomer); + +if (logger.isTraceEnabled()) { + logger.trace(" >> *** Customers ***"); + if (executor.getContextAlbum("albumCustomerMap") != null) { + for (var i = 0; i < executor.getContextAlbum("albumCustomerMap").values().size(); i++) { + logger.trace(" >> >> " + executor.getContextAlbum("albumCustomerMap").values().get(i).get("customerName") + + " : " + "dtSLA=" + executor.getContextAlbum("albumCustomerMap").values().get(i).get("dtSLA") + + " : " + "dtYTD=" + executor.getContextAlbum("albumCustomerMap").values().get(i).get("dtYTD") + + " : " + "links=" + executor.getContextAlbum("albumCustomerMap").values().get(i).get("links") + + " : " + "priority=" + + executor.getContextAlbum("albumCustomerMap").values().get(i).get("priority") + " : " + + "satisfaction=" + + executor.getContextAlbum("albumCustomerMap").values().get(i).get("satisfaction")); + } + } else { + logger.trace(" >> >> customer album is null"); + } +} + +executor.outFields["report"] = "customer ctxt :: added customer: " + ifCustomerName; + +logger.info("vpnsla: ctxt added customer " + ifCustomerName); + +var returnValueType = Java.type("java.lang.Boolean"); +var returnValue = new returnValueType(true); +logger.trace("finished: " + executor.subject.id); +logger.debug("."); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js new file mode 100644 index 000000000..dd667a87d --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js @@ -0,0 +1,65 @@ +/* + * ============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========================================================= + */ + +load("nashorn:mozilla_compat.js"); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id); +logger.trace("-- infields: " + executor.inFields); + +var ifEdgeName = executor.inFields["edgeName"]; +var ifEdgeStatus = executor.inFields["status"]; + +var albumTopoEdges = executor.getContextAlbum("albumTopoEdges"); + +logger.trace("-- got infields, testing existing edge"); + +var ctxtEdge = albumTopoEdges.get(ifEdgeName); +if (ctxtEdge != null) { + albumTopoEdges.remove(ifEdgeName); + logger.trace("-- removed edge: <" + ifEdgeName + ">"); +} + +logger.trace("-- creating edge: <" + ifEdgeName + ">"); +ctxtEdge = "{name:" + ifEdgeName + ", start:" + executor.inFields["start"] + ", end:" + executor.inFields["end"] + + ", active:" + ifEdgeStatus + "}"; +albumTopoEdges.put(ifEdgeName, ctxtEdge); + +if (logger.isTraceEnabled()) { + logger.trace(" >> *** Edges ***"); + if (albumTopoEdges != null) { + for (var i = 0; i < albumTopoEdges.values().size(); i++) { + logger.trace(" >> >> " + albumTopoEdges.values().get(i).get("name") + " \t " + + albumTopoEdges.values().get(i).get("start") + " --> " + albumTopoEdges.values().get(i).get("end") + + " \t " + albumTopoEdges.values().get(i).get("active")); + } + } else { + logger.trace(" >> >> edge album is null"); + } +} + +executor.outFields["report"] = "edge ctxt :: added edge " + ifEdgeName; + +logger.info("vpnsla: ctxt added edge " + ifEdgeName); + +var returnValueType = Java.type("java.lang.Boolean"); +var returnValue = new returnValueType(true); +logger.trace("finished: " + executor.subject.id); +logger.debug("."); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js new file mode 100644 index 000000000..532820f15 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js @@ -0,0 +1,63 @@ +/* + * ============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========================================================= + */ + +load("nashorn:mozilla_compat.js"); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id); +logger.trace("-- infields: " + executor.inFields); + +var ifNodeName = executor.inFields["nodeName"]; +var ifMininetName = executor.inFields["mininetName"]; + +var albumTopoNodes = executor.getContextAlbum("albumTopoNodes"); + +logger.trace("-- got infields, testing existing node"); + +var ctxtNode = albumTopoNodes.get(ifNodeName); +if (ctxtNode != null) { + albumTopoNodes.remove(ifNodeName); + logger.trace("-- removed node: <" + ifNodeName + ">"); +} + +logger.trace("-- creating node: <" + ifNodeName + ">"); +ctxtNode = "{name:" + ifNodeName + ", mnname:" + ifMininetName + "}"; +albumTopoNodes.put(ifNodeName, ctxtNode); + +if (logger.isTraceEnabled()) { + logger.trace(" >> *** Nodes ***"); + if (albumTopoNodes != null) { + for (var i = 0; i < albumTopoNodes.values().size(); i++) { + logger.trace(" >> >> " + albumTopoNodes.values().get(i).get("name") + " : " + + albumTopoNodes.values().get(i).get("mnname")); + } + } else { + logger.trace(" >> >> node album is null"); + } +} + +executor.outFields["report"] = "node ctxt :: added node " + ifNodeName; + +logger.info("vpnsla: ctxt added node " + ifNodeName); + +var returnValueType = Java.type("java.lang.Boolean"); +var returnValue = new returnValueType(true); +logger.trace("finished: " + executor.subject.id); +logger.debug("."); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js new file mode 100644 index 000000000..df96235d3 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.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========================================================= + */ + +load("nashorn:mozilla_compat.js"); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id); +logger.trace("-- infields: " + executor.inFields); + +var ifDecision = executor.inFields["decision"]; +var ifMatchStart = executor.inFields["matchStart"]; + +var albumCustomerMap = executor.getContextAlbum("albumCustomerMap"); +var albumProblemMap = executor.getContextAlbum("albumProblemMap"); + +switch (ifDecision.get("decision").toString()) { +case "NONE": + executor.outFields["edgeName"] = ""; + executor.outFields["action"] = ""; + break; +case "IMPEDE": + for (var i = 0; i < ifDecision.get("customers").size(); i++) { + customer = albumCustomerMap.get(ifDecision.get("customers").get(i).toString()); + executor.outFields["edgeName"] = customer.get("links").get(0); + executor.outFields["action"] = "firewall"; + } + break; +case "REBUILD": + // finally solved, remove problem + albumProblemMap.remove(ifDecision.get("problemID")); + executor.outFields["edgeName"] = "L10"; // this is ###static### + executor.outFields["action"] = "rebuild"; // this is ###static### + break; +default: + +} + +var returnValueType = Java.type("java.lang.Boolean"); +var returnValue = new returnValueType(true); + +if (executor.outFields["action"] != "") { + logger.info("vpnsla: action is to " + executor.outFields["action"] + " " + executor.outFields["edgeName"]); +} else { + logger.info("vpnsla: no action required"); +} + +logger.trace("-- outfields: " + executor.outFields); +logger.trace("finished: " + executor.subject.id); +logger.debug(".a"); + +var now = new Date().getTime(); +logger.info("VPN SLA finished in " + (now - ifMatchStart) + " ms"); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js new file mode 100644 index 000000000..ad6a51027 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js @@ -0,0 +1,58 @@ +/* + * ============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========================================================= + */ + +load("nashorn:mozilla_compat.js"); +importClass(org.slf4j.LoggerFactory); + +importClass(java.util.ArrayList); + +importClass(org.apache.avro.generic.GenericData.Array); +importClass(org.apache.avro.generic.GenericRecord); +importClass(org.apache.avro.Schema); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id); +logger.trace("-- infields: " + executor.inFields); + +var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME); + +var ifSituation = executor.inFields["situation"]; + +// create outfiled for decision +var decision = executor.subject.getOutFieldSchemaHelper("decision").createNewInstance(); +decision.put("description", "None, everything is ok"); +decision.put("decision", "NONE"); +decision.put("customers", new ArrayList()); + +var returnValueType = Java.type("java.lang.Boolean"); +if (ifSituation.get("problemID") == "NONE") { + logger.trace("-- no problem, everything ok"); + var returnValue = new returnValueType(true); +} else { + logger.trace("-- wrong problemID <" + problemID + "> for NONE task, we should not be here"); + rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + problemID + + "> for NONE task, we should not be here"); + var returnValue = new returnValueType(false); +} + +executor.outFields["decision"] = decision; + +logger.trace("finished: " + executor.subject.id); +logger.debug(".d-non"); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js new file mode 100644 index 000000000..5f2e3be92 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.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========================================================= + */ + +load("nashorn:mozilla_compat.js"); +importClass(org.slf4j.LoggerFactory); + +importClass(java.util.ArrayList); + +importClass(org.apache.avro.generic.GenericData.Array); +importClass(org.apache.avro.generic.GenericRecord); +importClass(org.apache.avro.Schema); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id); +logger.trace("-- infields: " + executor.inFields); + +var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME); + +var ifSituation = executor.inFields["situation"]; + +var albumCustomerMap = executor.getContextAlbum("albumCustomerMap"); +var albumProblemMap = executor.getContextAlbum("albumProblemMap"); + +// create outfiled for decision +var decision = executor.subject.getOutFieldSchemaHelper("decision").createNewInstance(); +decision.put("description", "None, everything is ok"); +decision.put("decision", "IMPEDE"); +decision.put("problemID", ifSituation.get("problemID")); +decision.put("customers", new ArrayList()); + +var problem = albumProblemMap.get(ifSituation.get("problemID")); +var returnValueType = Java.type("java.lang.Boolean"); +if (problem != null && ifSituation.get("violatedSLAs").size() > 0) { + logger.trace("-- impede by priority"); + for (var i = 0; i < problem.get("edgeUsedBy").size(); i++) { + customerCtxt = albumCustomerMap.get(problem.get("edgeUsedBy").get(i).toString()); + if (customerCtxt.get("priority") == false) { + decision.get("customers").add(customerCtxt.get("customerName")); + } + } + var returnValue = new returnValueType(true); +} else { + logger.trace("-- wrong problemID <" + ifSituation.get("problemID") + "> for PRIORITY task, we should not be here"); + rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + ifSituation.get("problemID") + + "> for PRIORITY task, we should not be here"); + var returnValue = new returnValueType(false); +} + +// set impededLast to decision[customers] +problem.get("impededLast").clear(); +problem.get("impededLast").addAll(decision.get("customers")); + +executor.outFields["decision"] = decision; +logger.trace("-- decision: " + decision); + +logger.info("vpnsla: priority, impeding customers " + decision.get("customers")); + +logger.trace("finished: " + executor.subject.id); +logger.debug(".d-pri"); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js new file mode 100644 index 000000000..bd09a747b --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js @@ -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========================================================= + */ + +load("nashorn:mozilla_compat.js"); +importClass(org.slf4j.LoggerFactory); + +importClass(java.util.ArrayList); + +importClass(org.apache.avro.generic.GenericData.Array); +importClass(org.apache.avro.generic.GenericRecord); +importClass(org.apache.avro.Schema); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id); +logger.trace("-- infields: " + executor.inFields); + +var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME); + +var ifSituation = executor.inFields["situation"]; + +var albumCustomerMap = executor.getContextAlbum("albumCustomerMap"); +var albumProblemMap = executor.getContextAlbum("albumProblemMap"); + +// create outfiled for decision +var decision = executor.subject.getOutFieldSchemaHelper("decision").createNewInstance(); +decision.put("description", "Impede given customers selected based on maximum SLA delta"); +decision.put("decision", "IMPEDE"); +decision.put("problemID", ifSituation.get("problemID")); +decision.put("customers", new ArrayList()); + +var problem = albumProblemMap.get(ifSituation.get("problemID")); +var returnValueType = Java.type("java.lang.Boolean"); +if (problem != null && ifSituation.get("violatedSLAs").size() == 0) { + logger.trace("-- impede by maximum SLA"); + var customer = ""; + var customerSla = 0; + for (var i = 0; i < problem.get("edgeUsedBy").size(); i++) { + customerCtxt = albumCustomerMap.get(problem.get("edgeUsedBy").get(i).toString()); + if (customerSla == 0) { + customerSla = customerCtxt.get("dtSLA") - customerCtxt.get("dtYTD"); + } + if ((customerCtxt.get("dtSLA") - customerCtxt.get("dtYTD")) >= customerSla) { + customer = customerCtxt.get("customerName"); + customerSla = (customerCtxt.get("dtSLA") - customerCtxt.get("dtYTD")); + } + } + decision.get("customers").add(customer); + var returnValue = new returnValueType(true); +} else { + logger.trace("-- wrong problemID <" + ifSituation.get("problemID") + "> for SLA task, we should not be here"); + rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + ifSituation.get("problemID") + + "> for SLA task, we should not be here"); + var returnValue = new returnValueType(false); +} + +// set impededLast to decision[customers] +problem.get("impededLast").clear(); +problem.get("impededLast").addAll(decision.get("customers")); + +executor.outFields["decision"] = decision; +logger.trace("-- decision: " + decision); + +logger.info("vpnsla: sla balance, impeding customers " + decision.get("customers")); + +logger.trace("finished: " + executor.subject.id); +logger.debug(".d-sla"); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js new file mode 100644 index 000000000..78bc94f00 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js @@ -0,0 +1,63 @@ +/* + * ============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========================================================= + */ + +load("nashorn:mozilla_compat.js"); +importClass(org.slf4j.LoggerFactory); + +importClass(java.util.ArrayList); + +importClass(org.apache.avro.generic.GenericData.Array); +importClass(org.apache.avro.generic.GenericRecord); +importClass(org.apache.avro.Schema); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id); +logger.trace("-- infields: " + executor.inFields); + +var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME); + +var ifSituation = executor.inFields["situation"]; + +var albumProblemMap = executor.getContextAlbum("albumProblemMap"); + +// create outfiled for decision +var decision = executor.subject.getOutFieldSchemaHelper("decision").createNewInstance(); +decision.put("description", "None, everything is ok"); +decision.put("decision", "REBUILD"); +decision.put("customers", new ArrayList()); +decision.put("problemID", ifSituation.get("problemID")); + +var returnValueType = Java.type("java.lang.Boolean"); +if (albumProblemMap.get(ifSituation.get("problemID")).get("status") == "SOLVED") { + logger.trace("-- problem solved"); + var returnValue = new returnValueType(true); +} else { + logger.trace("-- wrong problemID <" + problemID + "> for SOLVED task, we should not be here"); + rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + problemID + + "> for SOLVED task, we should not be here"); + var returnValue = new returnValueType(false); +} + +executor.outFields["decision"] = decision; + +logger.info("vpnsla: sla solved, problem solved"); + +logger.trace("finished: " + executor.subject.id); +logger.debug(".d-non"); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js new file mode 100644 index 000000000..48d69e8eb --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js @@ -0,0 +1,170 @@ +/* + * ============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========================================================= + */ + +load("nashorn:mozilla_compat.js"); +importClass(org.slf4j.LoggerFactory); + +importClass(java.util.ArrayList); + +importClass(org.apache.avro.generic.GenericData.Array); +importClass(org.apache.avro.generic.GenericRecord); +importClass(org.apache.avro.Schema); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id); +logger.trace("-- infields: " + executor.inFields); + +var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME); + +var ifEdgeName = executor.inFields["edgeName"]; +var ifEdgeStatus = executor.inFields["status"].toString(); +var ifhasChanged = executor.inFields["hasChanged"]; +var ifMatchStart = executor.inFields["matchStart"]; + +var albumCustomerMap = executor.getContextAlbum("albumCustomerMap"); +var albumProblemMap = executor.getContextAlbum("albumProblemMap"); + +var linkProblem = albumProblemMap.get(ifEdgeName); + +// create outfiled for situation +var situation = executor.subject.getOutFieldSchemaHelper("situation").createNewInstance(); +situation.put("violatedSLAs", new ArrayList()); + +// create a string as states+hasChanged+linkProblem and switch over it +var switchTest = ifEdgeStatus + ":" + ifhasChanged + ":" + (linkProblem == null ? "no" : "yes"); +switch (switchTest) { +case "UP:false:no": + logger.trace("-- edge <" + ifEdgeName + "> UP:false:no => everything ok"); + logger.info("vpnsla: everything ok"); + situation.put("problemID", "NONE"); + break; +case "UP:false:yes": + logger.trace("-- edge <" + ifEdgeName + "> UP:false:yes ==> did we miss earlier up?, removing problem"); + albumProblemMap.remove(ifEdgeName); + linkProblem = null; + situation.put("problemID", "NONE"); + break; +case "UP:true:no": + logger.trace("-- edge <" + ifEdgeName + "> UP:true:no ==> did we miss the earlier down?, creating new problem"); + situation.put("problemID", ifEdgeName); + break; +case "UP:true:yes": + logger.trace("-- edge <" + ifEdgeName + "> UP:true:yes ==> detected solution, link up again"); + logger.info("vpnsla: problem solved"); + linkProblem.put("endTime", ifMatchStart); + linkProblem.put("status", "SOLVED"); + situation.put("problemID", "NONE"); + break; +case "DOWN:false:no": + logger.trace("-- edge <" + ifEdgeName + "> DOWN:false:no ==> did we miss an earlier down?, creating new problem"); + situation.put("problemID", ifEdgeName); + break; +case "DOWN:false:yes": + logger.trace("-- edge <" + ifEdgeName + "> DOWN:false:yes ==> problem STILL exists"); + logger.info("vpnsla: problem still exists"); + linkProblem.put("status", "STILL"); + situation.put("problemID", ifEdgeName); + break; +case "DOWN:true:no": + logger.trace("-- edge <" + ifEdgeName + "> DOWN:true:no ==> found NEW problem"); + logger.info("vpnsla: this is a new problem"); + situation.put("problemID", ifEdgeName); + break; +case "DOWN:true:yes": + logger.trace("-- edge <" + ifEdgeName + + "> DOWN:true:yes ==> did we miss to remove an earlier problem?, remove and create new problem"); + linkProblem = null; + situation.put("problemID", ifEdgeName); + break; + +default: + logger.error("-- input wrong for edge" + ifEdgeName + ": edge status <" + ifEdgeStatus + + "> unknown or null on hasChanged <" + ifhasChanged + ">"); + rootLogger.error("-- input wrong for edge" + ifEdgeName + ": edge status <" + ifEdgeStatus + + "> unknown or null on hasChanged <" + ifhasChanged + ">"); +} + +// create new problem if situation requires it +if (situation.get("problemID").equals(ifEdgeName) && linkProblem == null) { + logger.trace("-- edge <" + ifEdgeName + "> creating new problem"); + linkProblem = albumProblemMap.getSchemaHelper().createNewInstance(); + linkProblem.put("edge", ifEdgeName); + linkProblem.put("startTime", ifMatchStart); + linkProblem.put("lastUpdate", ifMatchStart); + linkProblem.put("endTime", 0); + linkProblem.put("status", "NEW"); + linkProblem.put("edgeUsedBy", new ArrayList()); + linkProblem.put("impededLast", new ArrayList()); + + for (var i = 0; i < albumCustomerMap.values().size(); i++) { + var customer = albumCustomerMap.values().get(i); + var customerLinks = albumCustomerMap.values().get(i).get("links"); + for (var k = 0; k < customerLinks.size(); k++) { + if (customerLinks.get(k) == ifEdgeName) { + linkProblem.get("edgeUsedBy").add(customer.get("customerName")); + } + } + } + albumProblemMap.put(ifEdgeName, linkProblem); + logger.trace("-- edge <" + ifEdgeName + "> problem created as <" + linkProblem + ">"); +} + +// set dtYTD if situation requires it +if (linkProblem != null && (linkProblem.get("status") == "STILL" || linkProblem.get("status") == "SOLVED")) { + var linkDownTimeinSecs = (ifMatchStart - linkProblem.get("lastUpdate")) / 1000; + logger.trace("-- edge <" + ifEdgeName + "> down time: " + linkDownTimeinSecs + " s"); + for (var k = 0; k < linkProblem.get("impededLast").size(); k++) { + for (var i = 0; i < albumCustomerMap.values().size(); i++) { + var customer = albumCustomerMap.values().get(i); + if (customer.get("customerName").equals(linkProblem.get("impededLast").get(k))) { + logger.info("-- vpnsla: customer " + customer.get("customerName") + " YDT downtime increased from " + + customer.get("dtYTD") + " to " + (customer.get("dtYTD") + linkDownTimeinSecs)); + customer.put("dtYTD", (customer.get("dtYTD") + linkDownTimeinSecs)) + } + } + } + // set lastUpdate to this policy execution for next execution calculation + linkProblem.put("lastUpdate", ifMatchStart); +} + +// check SLA violations if situation requires it +if (linkProblem != null && linkProblem.get("status") != "SOLVED") { + logger.info(">e> customer\tDT SLA\tDT YTD\tviolation"); + for (var i = 0; i < albumCustomerMap.values().size(); i++) { + var customer = albumCustomerMap.values().get(i); + if (customer.get("dtYTD") > customer.get("dtSLA")) { + situation.get("violatedSLAs").add(customer.get("customerName")); + logger.info(">e> " + customer.get("customerName") + "\t\t" + customer.get("dtSLA") + "s\t" + + customer.get("dtYTD") + "s\t" + "!!"); + } else { + logger.info(">e> " + customer.get("customerName") + "\t\t" + customer.get("dtSLA") + "s\t" + + customer.get("dtYTD") + "s"); + } + } +} + +executor.outFields["situation"] = situation; + +logger.trace("-- out fields <" + executor.outFields + ">"); + +var returnValueType = Java.type("java.lang.Boolean"); +var returnValue = new returnValueType(true); +logger.trace("finished: " + executor.subject.id); +logger.debug(".e"); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js new file mode 100644 index 000000000..c50dd9794 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js @@ -0,0 +1,80 @@ +/* + * ============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========================================================= + */ + +load("nashorn:mozilla_compat.js"); + +var now = new Date().getTime(); +executor.outFields["matchStart"] = now; + +importClass(org.slf4j.LoggerFactory); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id); +logger.trace("-- infields: " + executor.inFields); + +var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME); + +var ifEdgeName = executor.inFields["edgeName"]; +var ifLinkStatus = executor.inFields["status"]; + +var albumTopoEdges = executor.getContextAlbum("albumTopoEdges"); + +logger.trace("-- got infields, checking albumTopoEdges changes"); + +var active = false; +switch (ifLinkStatus.toString()) { +case "UP": + active = true; + break; +case "DOWN": + active = false; + break; +default: + active = false; + logger.error("-- trigger sent unknown link status <" + ifLinkStatus + "> for link <" + ifEdgeName + ">"); + rootLogger.error(executor.subject.id + " " + "-- trigger sent unknown link status <" + ifLinkStatus + + "> for link <" + ifEdgeName + ">"); +} + +var link = albumTopoEdges.get(ifEdgeName); +if (link == null) { + logger.trace("-- link <" + ifEdgeName + "> not in albumTopoEdges"); +} else { + logger.trace("-- found link <" + link + "> in albumTopoEdges"); + logger.trace("-- active <" + active + "> : link.active <" + link.get("active") + ">"); + if (active != link.get("active")) { + link.put("active", active); + logger.trace("-- link <" + ifEdgeName + "> status changed to "); + executor.outFields["hasChanged"] = true; + } else { + logger.trace("-- link <" + ifEdgeName + "> status not changed "); + executor.outFields["hasChanged"] = false; + } +} + +executor.outFields["edgeName"] = ifEdgeName; +executor.outFields["status"] = ifLinkStatus; + +logger.info("vpnsla: detected " + ifEdgeName + " as " + ifLinkStatus); + +var returnValueType = Java.type("java.lang.Boolean"); +var returnValue = new returnValueType(true); +logger.trace("finished: " + executor.subject.id); +logger.debug(".m"); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js new file mode 100644 index 000000000..44767467d --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js @@ -0,0 +1,58 @@ +/* + * ============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========================================================= + */ + +load("nashorn:mozilla_compat.js"); +importClass(org.slf4j.LoggerFactory); + +var logger = executor.logger; +logger.trace("start: " + executor.subject.id + " - TSL"); + +var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME); + +var ifSituation = executor.inFields["situation"]; + +var albumProblemMap = executor.getContextAlbum("albumProblemMap"); + +var returnValueType = Java.type("java.lang.Boolean"); +if (ifSituation.get("problemID") == "NONE") { + logger.trace("-- situation has no problem, selecting "); + executor.subject.getTaskKey("VpnSlaPolicyDecideNoneTask").copyTo(executor.selectedTask); + var returnValue = new returnValueType(true); +} else if (albumProblemMap.get(ifSituation.get("problemID")).get("status") == "SOLVED") { + logger.trace("-- situation is solved, selecting "); + executor.subject.getTaskKey("VpnSlaPolicyDecideSolvedTask").copyTo(executor.selectedTask); + var returnValue = new returnValueType(true); +} else if (ifSituation.get("violatedSLAs") != null && ifSituation.get("violatedSLAs").size() > 0) { + logger.trace("-- situation is problem with violations, selecting "); + executor.subject.getTaskKey("VpnSlaPolicyDecidePriorityTask").copyTo(executor.selectedTask); + var returnValue = new returnValueType(true); +} else if (ifSituation.get("violatedSLAs") != null && ifSituation.get("violatedSLAs").size() == 0) { + logger.trace("-- situation is problem without violations, selecting "); + executor.subject.getTaskKey("VpnSlaPolicyDecideSlaTask").copyTo(executor.selectedTask); + var returnValue = new returnValueType(true); +} else { + logger.error("-- detected unknown decision for situation <" + ifSituation.get("problemID") + ">"); + rootLogger.error(executor.subject.id + " " + "-- detected unknown decision for situation <" + + ifSituation.get("problemID") + ">"); + var returnValue = new returnValueType(false); +} + +logger.trace("finished: " + executor.subject.id); +logger.debug(".d-tsl"); diff --git a/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex new file mode 100644 index 000000000..eb4145788 --- /dev/null +++ b/examples/pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex @@ -0,0 +1,325 @@ +#------------------------------------------------------------------------------- +# ============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========================================================= +#------------------------------------------------------------------------------- + +# ============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=PCVS-VpnSla version=1.0.0 description="Policies-Controlled Video Streaming, VPN SLA Policy Model" + + + +schema create name=reportDecl version=1.0.0 description="Report of activities of a policy/task" flavour=Java schema=java.lang.String +event create name=ReportOut version=1.0.0 description="Report of a policy (issued by a task)" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="APEX" target="CtxtManagement" +event parameter create name=ReportOut version=1.0.0 parName=report schemaName=reportDecl schemaVersion=1.0.0 + +schema create name=timestampDecl version=1.0.0 description="Timestamp" flavour=Java schema=java.lang.Long + + + +schema create name=ctxtEdgeNameDecl version=1.0.0 description="Topology Edges: edge (link) name" flavour=Java schema=java.lang.String +schema create name=ctxtEdgeStartDecl version=1.0.0 description="Topology Edges: edge endpoint (start)" flavour=Java schema=java.lang.String +schema create name=ctxtEdgeEndDecl version=1.0.0 description="Topology Edges: edge endpoint (end)" flavour=Java schema=java.lang.String +schema create name=ctxtEdgeStatusDecl version=1.0.0 description="Topology Edges: edge status as up (true) or down (false)" flavour=Java schema=java.lang.Boolean + +schema create name=ctxtTopologyEdgesDecl version=1.0.0 description="Topology Edges Context Map" flavour=Avro schema=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc" +LE +album create name=albumTopoEdges scope=global writable=true schemaName=ctxtTopologyEdgesDecl + + +task create name=EdgeContextTask version=1.0.0 description="This task adds event context to edge context" +task inputfield create name=EdgeContextTask version=1.0.0 fieldName=edgeName schemaName=ctxtEdgeNameDecl schemaVersion=1.0.0 +task inputfield create name=EdgeContextTask version=1.0.0 fieldName=start schemaName=ctxtEdgeStartDecl schemaVersion=1.0.0 +task inputfield create name=EdgeContextTask version=1.0.0 fieldName=end schemaName=ctxtEdgeEndDecl schemaVersion=1.0.0 +task inputfield create name=EdgeContextTask version=1.0.0 fieldName=status schemaName=ctxtEdgeStatusDecl schemaVersion=1.0.0 +task outputfield create name=EdgeContextTask version=1.0.0 fieldName=report schemaName=reportDecl schemaVersion=1.0.0 +task contextref create name=EdgeContextTask albumName=albumTopoEdges +task logic create name=EdgeContextTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js" +LE + +event create name=EdgeContextEventIn version=1.0.0 description="Event to add an Edge to engine Context" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="CtxtManagement" target="APEX" +event parameter create name=EdgeContextEventIn version=1.0.0 parName=edgeName schemaName=ctxtEdgeNameDecl schemaVersion=1.0.0 +event parameter create name=EdgeContextEventIn version=1.0.0 parName=start schemaName=ctxtEdgeStartDecl schemaVersion=1.0.0 +event parameter create name=EdgeContextEventIn version=1.0.0 parName=end schemaName=ctxtEdgeEndDecl schemaVersion=1.0.0 +event parameter create name=EdgeContextEventIn version=1.0.0 parName=status schemaName=ctxtEdgeStatusDecl schemaVersion=1.0.0 + +policy create name=EdgeContextPolicy version=1.0.0 description="Policy that adds an edge to context" template=FREEFORM firstState=EdgeContextState +policy state create name=EdgeContextPolicy version=1.0.0 stateName=EdgeContextState triggerName=EdgeContextEventIn triggerVersion=1.0.0 defaultTaskName=EdgeContextTask defaultTaskVersion=1.0.0 +policy state output create name=EdgeContextPolicy version=1.0.0 stateName=EdgeContextState outputName=EdgeContextState_Output_Direct eventName=ReportOut eventVersion=1.0.0 nextState=NULL +policy state taskref create name=EdgeContextPolicy version=1.0.0 stateName=EdgeContextState taskLocalName=doContext taskName=EdgeContextTask taskVersion=1.0.0 outputType=DIRECT outputName=EdgeContextState_Output_Direct + + + +schema create name=ctxtNodeNameDecl version=1.0.0 description="Topology Nodes: node name" flavour=Java schema=java.lang.String +schema create name=ctxtNodeMininetNameDecl version=1.0.0 description="Topology Nodes: node name in Mininet" flavour=Java schema=java.lang.String + +schema create name=ctxtTopologyNodesDecl version=1.0.0 description="Topology Nodes Context Map" flavour=Avro schema=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc" +LE +album create name=albumTopoNodes scope=global writable=true schemaName=ctxtTopologyNodesDecl + +task create name=NodeContextTask version=1.0.0 description="This task adds event context to node context" +task inputfield create name=NodeContextTask version=1.0.0 fieldName=nodeName schemaName=ctxtNodeNameDecl schemaVersion=1.0.0 +task inputfield create name=NodeContextTask version=1.0.0 fieldName=mininetName schemaName=ctxtNodeMininetNameDecl schemaVersion=1.0.0 +task outputfield create name=NodeContextTask version=1.0.0 fieldName=report schemaName=reportDecl schemaVersion=1.0.0 +task contextref create name=NodeContextTask albumName=albumTopoNodes +task logic create name=NodeContextTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js" +LE + +event create name=NodeContextEventIn version=1.0.0 description="Event to add Node to engine Context" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="CtxtManagement" target="APEX" +event parameter create name=NodeContextEventIn version=1.0.0 parName=nodeName schemaName=ctxtNodeNameDecl schemaVersion=1.0.0 +event parameter create name=NodeContextEventIn version=1.0.0 parName=mininetName schemaName=ctxtNodeMininetNameDecl schemaVersion=1.0.0 + +policy create name=NodeContextPolicy version=1.0.0 description="Policy that adds an node to context" template=FREEFORM firstState=NodeContextState +policy state create name=NodeContextPolicy version=1.0.0 stateName=NodeContextState triggerName=NodeContextEventIn triggerVersion=1.0.0 defaultTaskName=NodeContextTask defaultTaskVersion=1.0.0 +policy state output create name=NodeContextPolicy version=1.0.0 stateName=NodeContextState outputName=NodeContextState_Output_Direct eventName=ReportOut eventVersion=1.0.0 nextState=NULL +policy state taskref create name=NodeContextPolicy version=1.0.0 stateName=NodeContextState taskLocalName=doContext taskName=NodeContextTask taskVersion=1.0.0 outputType=DIRECT outputName=NodeContextState_Output_Direct + + + + +schema create name=ctxtCustomerNameDecl version=1.0.0 description="Customer Context: customer name" flavour=Java schema=java.lang.String +schema create name=ctxtCustomerPriorityDecl version=1.0.0 description="Customer Context: priority flag" flavour=Java schema=java.lang.Boolean +schema create name=ctxtCustomerSatisfactionDecl version=1.0.0 description="Customer Context: satisfaction in percent" flavour=Java schema=java.lang.Integer +schema create name=ctxtCustomerDowntimeSLADecl version=1.0.0 description="Customer Context: contracted downtime as per SLA" flavour=Java schema=java.lang.Integer +schema create name=ctxtCustomerDowntimeYTDDecl version=1.0.0 description="Customer Context: year-to-date downtime experienced" flavour=Java schema=java.lang.Integer +schema create name=ctxtCustomerLinksDecl version=1.0.0 description="Customer Context: links a customer uses (for events/task)" flavour=Java schema=java.lang.String + +schema create name=ctxtCustomerMapDecl version=1.0.0 description="Map of customers with all known information" flavour=Avro schema=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc" +LE +album create name=albumCustomerMap scope=global writable=true schemaName=ctxtCustomerMapDecl + +task create name=CustomerContextTask version=1.0.0 description="This task adds event context to customer context" +task inputfield create name=CustomerContextTask version=1.0.0 fieldName=customerName schemaName=ctxtCustomerNameDecl schemaVersion=1.0.0 +task inputfield create name=CustomerContextTask version=1.0.0 fieldName=priority schemaName=ctxtCustomerPriorityDecl schemaVersion=1.0.0 +task inputfield create name=CustomerContextTask version=1.0.0 fieldName=satisfaction schemaName=ctxtCustomerSatisfactionDecl schemaVersion=1.0.0 +task inputfield create name=CustomerContextTask version=1.0.0 fieldName=dtSLA schemaName=ctxtCustomerDowntimeSLADecl schemaVersion=1.0.0 +task inputfield create name=CustomerContextTask version=1.0.0 fieldName=dtYTD schemaName=ctxtCustomerDowntimeYTDDecl schemaVersion=1.0.0 +task inputfield create name=CustomerContextTask version=1.0.0 fieldName=links schemaName=ctxtCustomerLinksDecl schemaVersion=1.0.0 +task outputfield create name=CustomerContextTask version=1.0.0 fieldName=report schemaName=reportDecl schemaVersion=1.0.0 +task contextref create name=CustomerContextTask albumName=albumCustomerMap +task contextref create name=CustomerContextTask albumName=albumTopoEdges +task logic create name=CustomerContextTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js" +LE + +event create name=CustomerContextEventIn version=1.0.0 description="Event to add Customers to engine Context" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="CtxtManagement" target="APEX" +event parameter create name=CustomerContextEventIn version=1.0.0 parName=customerName schemaName=ctxtCustomerNameDecl schemaVersion=1.0.0 +event parameter create name=CustomerContextEventIn version=1.0.0 parName=priority schemaName=ctxtCustomerPriorityDecl schemaVersion=1.0.0 +event parameter create name=CustomerContextEventIn version=1.0.0 parName=satisfaction schemaName=ctxtCustomerSatisfactionDecl schemaVersion=1.0.0 +event parameter create name=CustomerContextEventIn version=1.0.0 parName=dtSLA schemaName=ctxtCustomerDowntimeSLADecl schemaVersion=1.0.0 +event parameter create name=CustomerContextEventIn version=1.0.0 parName=dtYTD schemaName=ctxtCustomerDowntimeYTDDecl schemaVersion=1.0.0 +event parameter create name=CustomerContextEventIn version=1.0.0 parName=links schemaName=ctxtCustomerLinksDecl schemaVersion=1.0.0 + +policy create name=CustomerContextPolicy version=1.0.0 description="Policy that adds Customer information to engine context" template=FREEFORM firstState=CustomerContextState +policy state create name=CustomerContextPolicy version=1.0.0 stateName=CustomerContextState triggerName=CustomerContextEventIn triggerVersion=1.0.0 defaultTaskName=CustomerContextTask defaultTaskVersion=1.0.0 +policy state output create name=CustomerContextPolicy version=1.0.0 stateName=CustomerContextState outputName=CustomerContextState_Output_Direct eventName=ReportOut eventVersion=1.0.0 nextState=NULL +policy state taskref create name=CustomerContextPolicy version=1.0.0 stateName=CustomerContextState taskLocalName=doContext taskName=CustomerContextTask taskVersion=1.0.0 outputType=DIRECT outputName=CustomerContextState_Output_Direct + + + + +schema create name=edgeNameDecl version=1.0.0 description="Edge name" flavour=Java schema=java.lang.String +schema create name=edgeStatusDecl version=1.0.0 description="Statuf of the edge (UP, DOWN)" flavour=Avro schema=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc" +LE +schema create name=edgeChangedDecl version=1.0.0 description="Status Change (true:change, false:no change)" flavour=Java schema=java.lang.Boolean + +task create name=VpnSlaPolicyMatchTask version=1.0.0 description="Pre-process an edge event" +task inputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0 +task inputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=status schemaName=edgeStatusDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=status schemaName=edgeStatusDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=hasChanged schemaName=edgeChangedDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task contextref create name=VpnSlaPolicyMatchTask albumName=albumTopoEdges +task logic create name=VpnSlaPolicyMatchTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js" +LE + + + + +schema create name=problemMapDecl version=1.0.0 description="Map of problems with all known Information" flavour=Avro schema=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc" +LE +album create name=albumProblemMap scope=global writable=true schemaName=problemMapDecl + +schema create name=establishSituationDecl version=1.0.0 description="Establish: the situation that was established" flavour=Avro schema=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc" +LE + +task create name=VpnSlaPolicyEstablishTask version=1.0.0 description="Task taking a match event and establishing a situation" +task inputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0 +task inputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=status schemaName=edgeStatusDecl schemaVersion=1.0.0 +task inputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=hasChanged schemaName=edgeChangedDecl schemaVersion=1.0.0 +task inputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=situation schemaName=establishSituationDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task contextref create name=VpnSlaPolicyEstablishTask albumName=albumProblemMap +task contextref create name=VpnSlaPolicyEstablishTask albumName=albumCustomerMap +task logic create name=VpnSlaPolicyEstablishTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js" +LE + + + + +schema create name=decideDecisionDecl version=1.0.0 description="Decide: the taken decision" flavour=Avro schema=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc" +LE + +task create name=VpnSlaPolicyDecideNoneTask version=1.0.0 description="Decide task for a 'none' problem" +task inputfield create name=VpnSlaPolicyDecideNoneTask version=1.0.0 fieldName=situation schemaName=establishSituationDecl schemaVersion=1.0.0 +task inputfield create name=VpnSlaPolicyDecideNoneTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyDecideNoneTask version=1.0.0 fieldName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyDecideNoneTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task logic create name=VpnSlaPolicyDecideNoneTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js" +LE + + +task create name=VpnSlaPolicyDecideSlaTask version=1.0.0 description="Decide task solving the problem by balancing SLAs" +task inputfield create name=VpnSlaPolicyDecideSlaTask version=1.0.0 fieldName=situation schemaName=establishSituationDecl schemaVersion=1.0.0 +task inputfield create name=VpnSlaPolicyDecideSlaTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyDecideSlaTask version=1.0.0 fieldName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyDecideSlaTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task contextref create name=VpnSlaPolicyDecideSlaTask albumName=albumCustomerMap +task contextref create name=VpnSlaPolicyDecideSlaTask albumName=albumProblemMap +task logic create name=VpnSlaPolicyDecideSlaTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js" +LE + + +task create name=VpnSlaPolicyDecidePriorityTask version=1.0.0 description="Decide task solving the problem by using customer priorities" +task inputfield create name=VpnSlaPolicyDecidePriorityTask version=1.0.0 fieldName=situation schemaName=establishSituationDecl schemaVersion=1.0.0 +task inputfield create name=VpnSlaPolicyDecidePriorityTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyDecidePriorityTask version=1.0.0 fieldName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyDecidePriorityTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task contextref create name=VpnSlaPolicyDecidePriorityTask albumName=albumCustomerMap +task contextref create name=VpnSlaPolicyDecidePriorityTask albumName=albumProblemMap +task logic create name=VpnSlaPolicyDecidePriorityTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js" +LE + + +task create name=VpnSlaPolicyDecideSolvedTask version=1.0.0 description="Decide task solving the problem by using customer priorities" +task inputfield create name=VpnSlaPolicyDecideSolvedTask version=1.0.0 fieldName=situation schemaName=establishSituationDecl schemaVersion=1.0.0 +task inputfield create name=VpnSlaPolicyDecideSolvedTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyDecideSolvedTask version=1.0.0 fieldName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyDecideSolvedTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task contextref create name=VpnSlaPolicyDecideSolvedTask albumName=albumProblemMap +task logic create name=VpnSlaPolicyDecideSolvedTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js" +LE + + + + +schema create name=actionDecl version=1.0.0 description="An action for the actioning system" flavour=Java schema=java.lang.String + +task create name=VpnSlaPolicyActTask version=1.0.0 description="Task issueing an action for taken decision" +task inputfield create name=VpnSlaPolicyActTask version=1.0.0 fieldName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0 +task inputfield create name=VpnSlaPolicyActTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyActTask version=1.0.0 fieldName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0 +task outputfield create name=VpnSlaPolicyActTask version=1.0.0 fieldName=action schemaName=actionDecl schemaVersion=1.0.0 +task contextref create name=VpnSlaPolicyActTask albumName=albumCustomerMap +task contextref create name=VpnSlaPolicyActTask albumName=albumProblemMap +task logic create name=VpnSlaPolicyActTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js" +LE + + + + + + + +event create name=VpnSlaTrigger version=1.0.0 description="Event triggering the VPN SLA policy" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="TriggerSys" target="VpnSlaMatch" +event parameter create name=VpnSlaTrigger version=1.0.0 parName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0 +event parameter create name=VpnSlaTrigger version=1.0.0 parName=status schemaName=edgeStatusDecl schemaVersion=1.0.0 + +event create name=VpnSlaMatchOut version=1.0.0 description="Event with matched trigger for the VPN SLA policy" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="VpnSlaMatch" target="VpnSlaEstablish" +event parameter create name=VpnSlaMatchOut version=1.0.0 parName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0 +event parameter create name=VpnSlaMatchOut version=1.0.0 parName=status schemaName=edgeStatusDecl schemaVersion=1.0.0 +event parameter create name=VpnSlaMatchOut version=1.0.0 parName=hasChanged schemaName=edgeChangedDecl schemaVersion=1.0.0 +event parameter create name=VpnSlaMatchOut version=1.0.0 parName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 + +event create name=VpnSlaEstablishOut version=1.0.0 description="Event with situation for the SLA policy" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="SlaEstablish" target="SlaDecide" +event parameter create name=VpnSlaEstablishOut version=1.0.0 parName=situation schemaName=establishSituationDecl schemaVersion=1.0.0 +event parameter create name=VpnSlaEstablishOut version=1.0.0 parName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 + +event create name=VpnSlaDecideOut version=1.0.0 description="Event with a decision for the SLA policy" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="SlaDecide" target="SlaAct" +event parameter create name=VpnSlaDecideOut version=1.0.0 parName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0 +event parameter create name=VpnSlaDecideOut version=1.0.0 parName=matchStart schemaName=timestampDecl schemaVersion=1.0.0 + +event create name=VpnSlaActOut version=1.0.0 description="Event action" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="SlaAct" target="ActioningSystem" +event parameter create name=VpnSlaActOut version=1.0.0 parName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0 +event parameter create name=VpnSlaActOut version=1.0.0 parName=action schemaName=actionDecl schemaVersion=1.0.0 + + +policy create name=VpnSlaPolicy version=1.0.0 description="Policy deciding customer treatment based on SLAs as MEDA policy" template=FREEFORM firstState=VpnSlaPolicyMatchState + +policy state create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyActState triggerName=VpnSlaDecideOut triggerVersion=1.0.0 defaultTaskName=VpnSlaPolicyActTask defaultTaskVersion=1.0.0 +policy state output create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyActState outputName=SlaPolicyAct_Output_Direct eventName=VpnSlaActOut eventVersion=1.0.0 nextState=NULL +policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyActState taskLocalName=act taskName=VpnSlaPolicyActTask taskVersion=1.0.0 outputType=DIRECT outputName=SlaPolicyAct_Output_Direct + +policy state create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState triggerName=VpnSlaEstablishOut triggerVersion=1.0.0 defaultTaskName=VpnSlaPolicyDecideSlaTask defaultTaskVersion=1.0.0 +policy state contextref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState albumName=albumProblemMap +policy state selecttasklogic create name=VpnSlaPolicy stateName=VpnSlaPolicyDecideState logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js" +LE +policy state output create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState outputName=VpnSlaPolicyDecide_Output_Direct eventName=VpnSlaDecideOut eventVersion=1.0.0 nextState=VpnSlaPolicyActState +policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState taskLocalName=decideNone taskName=VpnSlaPolicyDecideNoneTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyDecide_Output_Direct +policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState taskLocalName=decideNone taskName=VpnSlaPolicyDecideSolvedTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyDecide_Output_Direct +policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState taskLocalName=decideSla taskName=VpnSlaPolicyDecideSlaTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyDecide_Output_Direct +policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState taskLocalName=decidePriority taskName=VpnSlaPolicyDecidePriorityTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyDecide_Output_Direct + +policy state create name=VpnSlaPolicy version=1.0.0 stateName=VpmSlaPolicyEstablishState triggerName=VpnSlaMatchOut triggerVersion=1.0.0 defaultTaskName=VpnSlaPolicyEstablishTask defaultTaskVersion=1.0.0 +policy state output create name=VpnSlaPolicy version=1.0.0 stateName=VpmSlaPolicyEstablishState outputName=VpnSlaPolicyEstablish_Output_Direct eventName=VpnSlaEstablishOut eventVersion=1.0.0 nextState=VpnSlaPolicyDecideState +policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpmSlaPolicyEstablishState taskLocalName=establish taskName=VpnSlaPolicyEstablishTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyEstablish_Output_Direct + +policy state create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyMatchState triggerName=VpnSlaTrigger triggerVersion=1.0.0 defaultTaskName=VpnSlaPolicyMatchTask defaultTaskVersion=1.0.0 +policy state output create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyMatchState outputName=VpnSlaPolicyMatch_Output_Direct eventName=VpnSlaMatchOut eventVersion=1.0.0 nextState=VpmSlaPolicyEstablishState +policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyMatchState taskLocalName=match taskName=VpnSlaPolicyMatchTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyMatch_Output_Direct + + + +validate +quit + diff --git a/examples/pcvs/src/test/resources/META-INF/persistence.xml b/examples/pcvs/src/test/resources/META-INF/persistence.xml new file mode 100644 index 000000000..4dcba14b7 --- /dev/null +++ b/examples/pcvs/src/test/resources/META-INF/persistence.xml @@ -0,0 +1,69 @@ + + + + + + org.eclipse.persistence.jpa.PersistenceProvider + + org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner + org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String + org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey + org.onap.policy.apex.model.basicmodel.concepts.AxConcept + org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo + org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation + org.onap.policy.apex.model.basicmodel.concepts.AxModel + org.onap.policy.apex.model.basicmodel.concepts.TestEntity + org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema + org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas + org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum + org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums + org.onap.policy.apex.model.contextmodel.concepts.AxContextModel + org.onap.policy.apex.model.eventmodel.concepts.AxField + org.onap.policy.apex.model.eventmodel.concepts.AxInputField + org.onap.policy.apex.model.eventmodel.concepts.AxOutputField + org.onap.policy.apex.model.eventmodel.concepts.AxEvent + org.onap.policy.apex.model.eventmodel.concepts.AxEvents + org.onap.policy.apex.model.eventmodel.concepts.AxEventModel + org.onap.policy.apex.model.policymodel.concepts.AxLogic + org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter + org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic + org.onap.policy.apex.model.policymodel.concepts.AxTask + org.onap.policy.apex.model.policymodel.concepts.AxTasks + org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic + org.onap.policy.apex.model.policymodel.concepts.AxStateFinalizerLogic + org.onap.policy.apex.model.policymodel.concepts.AxStateOutput + org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference + org.onap.policy.apex.model.policymodel.concepts.AxState + org.onap.policy.apex.model.policymodel.concepts.AxPolicy + org.onap.policy.apex.model.policymodel.concepts.AxPolicies + org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel + + + + + + + + + + + + diff --git a/examples/pcvs/src/test/resources/logback-test.xml b/examples/pcvs/src/test/resources/logback-test.xml new file mode 100644 index 000000000..ea201e0a9 --- /dev/null +++ b/examples/pcvs/src/test/resources/logback-test.xml @@ -0,0 +1,74 @@ + + + + + Apex + + + + + + + + %d %contextName [%t] %level %logger{36} - %msg%n + + + + + + + + + + + + + + + + + ${LOG_DIR}/apex.log + + %d %-5relative [procId=${processId}] [%thread] %-5level + %logger{26} - %msg %n %ex{full} + + + + + ${LOG_DIR}/apex_ctxt.log + + %d %-5relative [procId=${processId}] [%thread] %-5level + %logger{26} - %msg %n %ex{full} + + + + + + + + + + + + + + + diff --git a/examples/pcvs/src/test/resources/org/onap/policy/apex/examples/pcvs/vpnsla/config/stdin2stdout.json b/examples/pcvs/src/test/resources/org/onap/policy/apex/examples/pcvs/vpnsla/config/stdin2stdout.json new file mode 100644 index 000000000..4c5e2760a --- /dev/null +++ b/examples/pcvs/src/test/resources/org/onap/policy/apex/examples/pcvs/vpnsla/config/stdin2stdout.json @@ -0,0 +1,51 @@ +{ + "engineServiceParameters":{ + "name" : "VpnSlaApexEngine", + "version" : "1.0.0", + "id" : 45, + "instanceCount" : 1, + "deploymentPort" : 12345, + "policyModelFileName" : "target/policy.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" + } + } + } + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters" : { + "carrierTechnology" : "FILE", + "parameters" : { + "standardIO" : true + } + }, + "eventProtocolParameters" : { + "eventProtocol" : "JSON" + } + } + }, + "eventInputParameters": { + "FirstConsumer": { + "carrierTechnologyParameters" : { + "carrierTechnology" : "FILE", + "parameters" : { + "standardIO" : true + } + }, + "eventProtocolParameters" : { + "eventProtocol" : "JSON" + } + } + } +} diff --git a/examples/pom.xml b/examples/pom.xml new file mode 100644 index 000000000..3d0f969d9 --- /dev/null +++ b/examples/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + + org.onap.policy.apex-pdp + apex-pdp + 2.0.0-SNAPSHOT + + + org.onap.policy.apex-pdp.examples + examples + + pom + ${project.artifactId} + Specific source code and other artifacts for Apex example applications. + + + + myfirstpolicy + aadm + adaptive + pcvs + + \ No newline at end of file diff --git a/packages/apex-pdp-package-full/pom.xml b/packages/apex-pdp-package-full/pom.xml index 7bb3a7b1d..a067d1fcf 100644 --- a/packages/apex-pdp-package-full/pom.xml +++ b/packages/apex-pdp-package-full/pom.xml @@ -173,6 +173,28 @@ integration-common ${project.version} + + + + org.onap.policy.apex-pdp.examples + aadm + ${project.version} + + + org.onap.policy.apex-pdp.examples + adaptive + ${project.version} + + + org.onap.policy.apex-pdp.examples + myfirstpolicy + ${project.version} + + + org.onap.policy.apex-pdp.examples + pcvs + ${project.version} + @@ -208,6 +230,42 @@ ${project.build.directory} etc/**/*,examples/**/* + + org.onap.policy.apex-pdp.examples + aadm + ${project.version} + jar + false + ${project.build.directory} + etc/**/*,examples/**/* + + + org.onap.policy.apex-pdp.examples + adaptive + ${project.version} + jar + false + ${project.build.directory} + etc/**/*,examples/**/* + + + org.onap.policy.apex-pdp.examples + myfirstpolicy + ${project.version} + jar + false + ${project.build.directory} + etc/**/*,examples/**/* + + + org.onap.policy.apex-pdp.examples + pcvs + ${project.version} + jar + false + ${project.build.directory} + etc/**/*,examples/**/* + true true diff --git a/pom.xml b/pom.xml index b983c6cf6..f8d8a5587 100644 --- a/pom.xml +++ b/pom.xml @@ -159,8 +159,9 @@ auth services plugins - packages + examples testsuites + packages client tools -- 2.16.6