diff options
author | Jorge Hernandez <jh1730@att.com> | 2018-07-25 13:56:20 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-07-25 13:56:20 +0000 |
commit | dccf9a9e0758be0a926c94bf1599ee625066100d (patch) | |
tree | cae6ba9c95fb6425ef6f796a7b746511c6c159a4 /packages/apex-pdp-package-full/src/main | |
parent | 79ae3f7f229db52b8ab18c405c5109f8d18db1b6 (diff) | |
parent | d524cedc578ae1bfa3bae895b3170f87463cbed9 (diff) |
Merge "Adding more examples to apex-pdp"
Diffstat (limited to 'packages/apex-pdp-package-full/src/main')
13 files changed, 1047 insertions, 0 deletions
diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/AnswerInitiationEvent.json b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/AnswerInitiationEvent.json new file mode 100644 index 000000000..6df3115d6 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/AnswerInitiationEvent.json @@ -0,0 +1,14 @@ +{ + "nameSpace": "org.onap.policy.apex.domains.decisionmaker", + "name": "AnswerEvent", + "version": "0.0.1", + "source": "dcae", + "target": "apex", + "a0" : "choice 0", + "a1" : "choice 1", + "a2" : "choice 2", + "a3" : "choice 3", + "a4" : "choice 4", + "a5" : "choice 5", + "a6" : "choice 6" +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTClient.json b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTClient.json new file mode 100644 index 000000000..9fa0b6ddd --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTClient.json @@ -0,0 +1,67 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12345, + "policyModelFileName": "examples/models/DecisionMaker/DecisionMakerPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "VNFInitConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "examples/config/DecisionMaker/AnswerInitiationEvent.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "DMaaPConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://localhost:3904/events/toApex/APEX/1?timeout=60000" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + }, + "eventOutputParameters": { + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/EventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "DMaapProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://localhost:3904/events/fromApex" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + } +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTServer.json b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTServer.json new file mode 100644 index 000000000..edf1b9cc3 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/DecisionMaker/ApexConfigRESTServer.json @@ -0,0 +1,72 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12345, + "policyModelFileName": "examples/models/DecisionMaker/DecisionMakerPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "VNFInitConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "examples/config/DecisionMaker/AnswerInitiationEvent.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "RESTConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTSERVER", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters", + "parameters": { + "standalone": true, + "host": "0.0.0.0", + "port": 23324 + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "RESTProducer", + "synchronousTimeout": 500 + } + }, + "eventOutputParameters": { + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/EventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "RESTProducer": { + "carrierTechnologyParameters":{ + "carrierTechnology" : "RESTSERVER", + "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters" + }, + "eventProtocolParameters":{ + "eventProtocol" : "JSON" + }, + "synchronousMode" : true, + "synchronousPeer" : "RESTConsumer", + "synchronousTimeout" : 500 + } + } +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/ApexConfig.json b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/ApexConfig.json new file mode 100644 index 000000000..070bbc105 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/ApexConfig.json @@ -0,0 +1,145 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "policy/ONAPTLGoalPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + }, + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "schemaParameters": { + "Avro": { + "parameterClassName": "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters" + } + } + } + } + }, + "eventInputParameters": { + "VCPEInitConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "config/VCPEInitiationEvent.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "nameAlias": "closedLoopControlName", + "versionAlias": "version", + "sourceAlias": "from" + } + } + }, + "GuardRequestorConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTREQUESTOR", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters", + "parameters": { + "url": "http://192.168.144.235:54321/AAIAndGuardSim/sim/pdp/api/getDecision", + "httpMethod": "POST", + "restRequestTimeout": 2000 + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "GuardResponseEvent", + "eventNameFilter": "GuardResponseEvent", + "requestorMode": true, + "requestorPeer": "GuardRequestorProducer", + "requestorTimeout": 500 + }, + "DCAEConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://192.168.144.235:3904/events/unauthenticated.DCAE_CL_OUTPUT/APEX/1?timeout=60000" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "nameAlias": "closedLoopControlName", + "versionAlias": "version", + "sourceAlias": "from" + } + } + }, + "APPCConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://192.168.144.235:3904/events/APPC_LCM_WRITE/APEX/1?timeout=60000" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "APPCRestartVNFResponseEvent", + "eventNameFilter": "APPCRestartVNFResponseEvent" + } + }, + "eventOutputParameters": { + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/VCPEEventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "GuardRequestorProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTREQUESTOR", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "GuardRequestEvent", + "requestorMode": true, + "requestorPeer": "GuardRequestorConsumer", + "requestorTimeout": 500 + }, + "APPCProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://192.168.144.235:3904/events/APPC-LCM-READ" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "APPCRestartVNFRequestEvent" + }, + "PolicyLogProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters", + "parameters": { + "url": "http://192.168.144.235:3904/events/POLICY_CL_MGT" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "ControlLoopLogEvent" + } + } +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent0.json b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent0.json new file mode 100644 index 000000000..e46a2739c --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent0.json @@ -0,0 +1,22 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "4a68f8a5-0db9-4070-a132-adede51ebeef", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "generic-vnf.resource-version": "1", + "generic-vnf.vnf-name": "vCPEInfraVNF99", + "generic-vnf.prov-status": "PREPROV", + "generic-vnf.is-closed-loop-disabled": "false", + "generic-vnf.orchestration-status": "Created", + "generic-vnf.vnf-type": "cCPEInfraService10/vCPEInfraService10 0", + "generic-vnf.in-maint": "false", + "generic-vnf.service-id": "5585fd2c-ad0d-4050-b0cf-dfe4a03bf00f", + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db001e" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent1.json b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent1.json new file mode 100644 index 000000000..5fcece8ac --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent1.json @@ -0,0 +1,14 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638197699, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "4a68f8a5-0db9-4070-a132-adede51ebeaf", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db001c" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent2.json b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent2.json new file mode 100644 index 000000000..7e3e33777 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/ONAPvCPE/VCPEInitiationEvent2.json @@ -0,0 +1,36 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638197699, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "4a68f8a5-0db9-4070-a132-adede51ebeaf", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db001c" + }, + "from": "DCAE", + "version": "1.0.2" +} +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "4a68f8a5-0db9-4070-a132-adede51ebeef", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "generic-vnf.resource-version": "1", + "generic-vnf.vnf-name": "vCPEInfraVNF99", + "generic-vnf.prov-status": "PREPROV", + "generic-vnf.is-closed-loop-disabled": "false", + "generic-vnf.orchestration-status": "Created", + "generic-vnf.vnf-type": "cCPEInfraService10/vCPEInfraService10 0", + "generic-vnf.in-maint": "false", + "generic-vnf.service-id": "5585fd2c-ad0d-4050-b0cf-dfe4a03bf00f", + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db001e" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/config/Periodic/ApexConfigPeriodic.json b/packages/apex-pdp-package-full/src/main/package/examples/config/Periodic/ApexConfigPeriodic.json new file mode 100644 index 000000000..a4c94779b --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/config/Periodic/ApexConfigPeriodic.json @@ -0,0 +1,58 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "examples/models/Periodic/PeriodicPolicyModel.json", + "periodicEventPeriod": 1000, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "EventRequestorConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "EVENT_REQUESTOR" + }, + "eventProtocolParameters": { + "eventProtocol": "APEX" + }, + "eventNameFilter": "InputEvent", + "requestorMode": true, + "requestorPeer": "EventRequestorProducer", + "requestorTimeout": 500 + } + }, + "eventOutputParameters": { + "EventRequestorProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "EVENT_REQUESTOR" + }, + "eventProtocolParameters": { + "eventProtocol": "APEX" + }, + "eventNameFilter": "EventListEvent", + "requestorMode": true, + "requestorPeer": "EventRequestorConsumer", + "requestorTimeout": 500 + }, + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/PeriodicEventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "OutputEvent" + } + } +} diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Client.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Client.html new file mode 100644 index 000000000..1077939b0 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Client.html @@ -0,0 +1,156 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2016-2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!-- http://localhost:3904/events/toApex --> + +<html> +<head> +<script src="http://code.jquery.com/jquery-latest.js"></script> +<script> + $(document).ready(function() { + $("#answerspost").click(function(e) { + var elements = document.getElementById("answerform").elements; + + var formValues = new Object; + formValues["name"] = "AnswerEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "text" && element.value != "") { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:3904/events/toApex", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Answers Set Successfully !!!"); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +<script> + $(document).ready(function() { + $("#modepost").click(function(e) { + var elements = document.getElementById("modeform").elements; + + var formValues = new Object; + formValues["name"] = "MakeDecisionEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "radio" && element.checked) { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:3904/events/toApex", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Decision Taken: " + data.decision); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +</head> +<body> + <h3>Decision Maker Answers</h3> + <form name="answerform" id="answerform" method="POST"> + <table> + <tr> + <td>First Answer:</td> + <td><input type="text" name="a0" value="Never Ever" /></td> + </tr> + <tr> + <td>Second Answer:</td> + <td><input type="text" name="a1" value="No" /></td> + </tr> + <tr> + <td>Third Answer:</td> + <td><input type="text" name="a2" value="Maybe not" /></td> + </tr> + <tr> + <td>Fourth Answer</td> + <td><input type="text" name="a3" value="Wait" /></td> + </tr> + <tr> + <td>Fifth Answer:</td> + <td><input type="text" name="a4" value="Maybe" /></td> + </tr> + <tr> + <td>Sixth Answer:</td> + <td><input type="text" name="a5" value="Yes" /></td> + </tr> + <tr> + <td>Seventh Answer:</td> + <td><input type="text" name="a6" value="Absolutely" /></td> + </tr> + <tr> + <td /> + <td><input type="button" class="btn btn-info" id="answerspost" + value="Set Answers"></td> + </tr> + </table> + </form> + <h3>Decision Maker Mode</h3> + <form name="modeform" id="modeform" method="POST"> + <table> + <tr> + <td><input name="mode" type="radio" value="random" + checked="checked">random</td> + <td><input name="mode" type="radio" value="pessimistic">pessimistic</td> + <td><input name="mode" type="radio" value="optimistic"> + optimistic</td> + <td><input name="mode" type="radio" value="dithering">dithering</td> + <td><input name="mode" type="radio" value="roundrobin">round + robin</td> + </tr> + <tr> + <td /> + <td /> + <td /> + <td /> + <td><input type="button" class="btn btn-info" id="modepost" + value="Make Decision"></td> + </tr> + </table> + </form> +</body> +</html> diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Server.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Server.html new file mode 100644 index 000000000..06df67e59 --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Server.html @@ -0,0 +1,156 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2016-2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!-- http://localhost:23324/apex/EventIn --> + +<html> +<head> +<script src="http://code.jquery.com/jquery-latest.js"></script> +<script> + $(document).ready(function() { + $("#answerspost").click(function(e) { + var elements = document.getElementById("answerform").elements; + + var formValues = new Object; + formValues["name"] = "AnswerEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "text" && element.value != "") { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:23324/apex/RESTConsumer/EventIn", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Answers Set Successfully !!!"); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +<script> + $(document).ready(function() { + $("#modepost").click(function(e) { + var elements = document.getElementById("modeform").elements; + + var formValues = new Object; + formValues["name"] = "MakeDecisionEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "radio" && element.checked) { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:23324/apex/RESTConsumer/EventIn", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Decision Taken: " + data.decision); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +</head> +<body> + <h3>Decision Maker Answers</h3> + <form name="answerform" id="answerform" method="POST"> + <table> + <tr> + <td>First Answer:</td> + <td><input type="text" name="a0" value="Never Ever" /></td> + </tr> + <tr> + <td>Second Answer:</td> + <td><input type="text" name="a1" value="No" /></td> + </tr> + <tr> + <td>Third Answer:</td> + <td><input type="text" name="a2" value="Maybe not" /></td> + </tr> + <tr> + <td>Fourth Answer</td> + <td><input type="text" name="a3" value="Wait" /></td> + </tr> + <tr> + <td>Fifth Answer:</td> + <td><input type="text" name="a4" value="Maybe" /></td> + </tr> + <tr> + <td>Sixth Answer:</td> + <td><input type="text" name="a5" value="Yes" /></td> + </tr> + <tr> + <td>Seventh Answer:</td> + <td><input type="text" name="a6" value="Absolutely" /></td> + </tr> + <tr> + <td /> + <td><input type="button" class="btn btn-info" id="answerspost" + value="Set Answers"></td> + </tr> + </table> + </form> + <h3>Decision Maker Mode</h3> + <form name="modeform" id="modeform" method="POST"> + <table> + <tr> + <td><input name="mode" type="radio" value="random" + checked="checked">random</td> + <td><input name="mode" type="radio" value="pessimistic">pessimistic</td> + <td><input name="mode" type="radio" value="optimistic"> + optimistic</td> + <td><input name="mode" type="radio" value="dithering">dithering</td> + <td><input name="mode" type="radio" value="roundrobin">round + robin</td> + </tr> + <tr> + <td /> + <td /> + <td /> + <td /> + <td><input type="button" class="btn btn-info" id="modepost" + value="Make Decision"></td> + </tr> + </table> + </form> +</body> +</html> diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Client.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Client.html new file mode 100644 index 000000000..f7a3f0c5b --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Client.html @@ -0,0 +1,153 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2016-2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!-- http://localhost:3904/events/toApex --> + +<html> +<head> +<script src="http://code.jquery.com/jquery-latest.js"></script> +<script> + $(document).ready(function() { + $("#answerspost").click(function(e) { + var elements = document.getElementById("answerform").elements; + + var formValues = new Object; + formValues["name"] = "AnswerEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "text" && element.value != "") { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:3904/events/toApex", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Answers Set Successfully !!!"); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +<script> + $(document).ready(function() { + $("#modepost").click(function(e) { + var elements = document.getElementById("modeform").elements; + + var formValues = new Object; + formValues["name"] = "MakeDecisionEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "radio" && element.checked) { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:3904/events/toApex", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Decision Taken: " + data.decision); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +</head> +<body> + <h3>Decision Maker Answers</h3> + <form name="answerform" id="answerform" method="POST"> + <table> + <tr> + <td>First Answer:</td> + <td><input type="text" name="a0" value="Never Ever" /></td> + </tr> + <tr> + <td>Second Answer:</td> + <td><input type="text" name="a1" value="No" /></td> + </tr> + <tr> + <td>Third Answer:</td> + <td><input type="text" name="a2" value="Maybe not" /></td> + </tr> + <tr> + <td>Fourth Answer</td> + <td><input type="text" name="a3" value="Wait" /></td> + </tr> + <tr> + <td>Fifth Answer:</td> + <td><input type="text" name="a4" value="Maybe" /></td> + </tr> + <tr> + <td>Sixth Answer:</td> + <td><input type="text" name="a5" value="Yes" /></td> + </tr> + <tr> + <td>Seventh Answer:</td> + <td><input type="text" name="a6" value="Absolutely" /></td> + </tr> + <tr> + <td /> + <td><input type="button" class="btn btn-info" id="answerspost" + value="Set Answers"></td> + </tr> + </table> + </form> + <h3>Decision Maker Mode</h3> + <form name="modeform" id="modeform" method="POST"> + <table> + <tr> + <td><input name="mode" type="radio" value="random" + checked="checked">random</td> + <td><input name="mode" type="radio" value="pessimistic">pessimistic</td> + <td><input name="mode" type="radio" value="optimistic"> + optimistic</td> + <td><input name="mode" type="radio" value="dithering">dithering</td> + </tr> + <tr> + <td /> + <td /> + <td /> + <td><input type="button" class="btn btn-info" id="modepost" + value="Make Decision"></td> + </tr> + </table> + </form> +</body> +</html> diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Server.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Server.html new file mode 100644 index 000000000..4c8f311af --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Server.html @@ -0,0 +1,153 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2016-2018 Ericsson. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!-- http://localhost:23324/apex/eventInput/EventIn --> + +<html> +<head> +<script src="http://code.jquery.com/jquery-latest.js"></script> +<script> + $(document).ready(function() { + $("#answerspost").click(function(e) { + var elements = document.getElementById("answerform").elements; + + var formValues = new Object; + formValues["name"] = "AnswerEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "text" && element.value != "") { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:23324/apex/RESTConsumer/EventIn", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Answers Set Successfully !!!"); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +<script> + $(document).ready(function() { + $("#modepost").click(function(e) { + var elements = document.getElementById("modeform").elements; + + var formValues = new Object; + formValues["name"] = "MakeDecisionEvent"; + for (var i = 0, element; element = elements[i++];) { + if (element.type === "radio" && element.checked) { + formValues[element.name] = element.value; + } + } + console.log(formValues); + var stringifiedForm = JSON.stringify(formValues); + console.log(stringifiedForm); + $.ajax({ + type : "POST", + url : "http://localhost:23324/apex/RESTConsumer/EventIn", + data : stringifiedForm, + crossDomain : true, + contentType : "application/json; charset=utf-8", + success : function(data) { + alert("Decision Taken: " + data.decision); + }, + failure : function(errMsg) { + alert(errMsg); + } + }); + e.preventDefault(); //STOP default action + + }); + }); +</script> +</head> +<body> + <h3>Decision Maker Answers</h3> + <form name="answerform" id="answerform" method="POST"> + <table> + <tr> + <td>First Answer:</td> + <td><input type="text" name="a0" value="Never Ever" /></td> + </tr> + <tr> + <td>Second Answer:</td> + <td><input type="text" name="a1" value="No" /></td> + </tr> + <tr> + <td>Third Answer:</td> + <td><input type="text" name="a2" value="Maybe not" /></td> + </tr> + <tr> + <td>Fourth Answer</td> + <td><input type="text" name="a3" value="Wait" /></td> + </tr> + <tr> + <td>Fifth Answer:</td> + <td><input type="text" name="a4" value="Maybe" /></td> + </tr> + <tr> + <td>Sixth Answer:</td> + <td><input type="text" name="a5" value="Yes" /></td> + </tr> + <tr> + <td>Seventh Answer:</td> + <td><input type="text" name="a6" value="Absolutely" /></td> + </tr> + <tr> + <td /> + <td><input type="button" class="btn btn-info" id="answerspost" + value="Set Answers"></td> + </tr> + </table> + </form> + <h3>Decision Maker Mode</h3> + <form name="modeform" id="modeform" method="POST"> + <table> + <tr> + <td><input name="mode" type="radio" value="random" + checked="checked">random</td> + <td><input name="mode" type="radio" value="pessimistic">pessimistic</td> + <td><input name="mode" type="radio" value="optimistic"> + optimistic</td> + <td><input name="mode" type="radio" value="dithering">dithering</td> + </tr> + <tr> + <td /> + <td /> + <td /> + <td><input type="button" class="btn btn-info" id="modepost" + value="Make Decision"></td> + </tr> + </table> + </form> +</body> +</html> diff --git a/packages/apex-pdp-package-full/src/main/resources/app-version.txt b/packages/apex-pdp-package-full/src/main/resources/app-version.txt new file mode 100644 index 000000000..f2ab45c3b --- /dev/null +++ b/packages/apex-pdp-package-full/src/main/resources/app-version.txt @@ -0,0 +1 @@ +${project.version}
\ No newline at end of file |