diff options
author | 2018-07-31 18:25:39 +0100 | |
---|---|---|
committer | 2018-07-31 18:27:31 +0100 | |
commit | af74a6270d6ab6badf04a97495a6ef8ccded9b4b (patch) | |
tree | 2c7a536e54207a0870ca2008ce457a64de917ab9 /src/site-docs/adoc/fragments/howto-apex/app-tpl-event-json.adoc | |
parent | 9e318f20f2e64970bf3c2e3a5532c516231a6f8a (diff) |
Adding first set of apex-pdp document changes
Adding document changes for auth, context, core, model, services & the
main apex-pdp module.
Change-Id: Id0d026baa258f1dc6998978f9911f3c4a73b5b3b
Issue-ID: POLICY-867
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'src/site-docs/adoc/fragments/howto-apex/app-tpl-event-json.adoc')
-rw-r--r-- | src/site-docs/adoc/fragments/howto-apex/app-tpl-event-json.adoc | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/site-docs/adoc/fragments/howto-apex/app-tpl-event-json.adoc b/src/site-docs/adoc/fragments/howto-apex/app-tpl-event-json.adoc new file mode 100644 index 000000000..bd31bedf9 --- /dev/null +++ b/src/site-docs/adoc/fragments/howto-apex/app-tpl-event-json.adoc @@ -0,0 +1,99 @@ +// +// ============LICENSE_START======================================================= +// Copyright (C) 2016-2018 Ericsson. All rights reserved. +// ================================================================================ +// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE +// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode +// +// SPDX-License-Identifier: CC-BY-4.0 +// ============LICENSE_END========================================================= +// +// @author Sven van der Meer (sven.van.der.meer@ericsson.com) +// + +== Application: Create Event Templates + +**Status: Experimental** + +This application takes a policy model (JSON or XML encoded) and generates templates for events in JSON format. +This can help when a policy defines rather complex trigger or action events or complex events between states. +The application can produce events for the types: stimuli (policy trigger events), internal (events between policy states), and response (action events). + +[width="100%",options="header",cols="5a,5a"] +|==================== +| Unix, Cygwin | Windows +| +[source%nowrap,sh] +---- +# $APEX_HOME/bin/apexApps.sh tpl-event-json [args] +---- +| +[source%nowrap,bat] +---- +> %APEX_HOME%\bin\apexApps.bat tpl-event-json [args] +---- +|==================== + +The option `-h` provides a help screen. + +[source%nowrap,sh] +---- +usage: gen-model2event + -h,--help prints this help and usage screen + -m,--model <MODEL-FILE> set the input policy model file + -t,--type <TYPE> set the event type for generation, one of: + stimuli (trigger events), response (action + events), internal (events between states) + -v,--version prints the application version +---- + +The created templates are not valid events, instead they use some markup for values one will need to change to actual values. +For instance, running the tool with the __Sample Domain__ policy model as: +[source%nowrap,sh] +---- +apexApps.sh tpl-event-json -m $APEX_HOME/examples/models/SampleDomain/SamplePolicyModelJAVA.json -t stimuli +---- + +will produce the following status messages: + +[source%nowrap,sh] +---- +gen-model2event: starting Event generator + --> model file: examples/models/SampleDomain/SamplePolicyModelJAVA.json + --> type: stimuli +---- + +and then run the generator application producing two event templates. +The first template is called `Event0000`. + +[source%nowrap,json] +---- +{ + "name" : "Event0000", + "nameSpace" : "org.onap.policy.apex.sample.events", + "version" : "0.0.1", + "source" : "Outside", + "target" : "Match", + "TestTemperature" : ###double: 0.0###, + "TestTimestamp" : ###long: 0###, + "TestMatchCase" : ###integer: 0###, + "TestSlogan" : "###string###" +} +---- +The values for the keys are marked with `###` and the expected type of the value. +To create an actual stimuli event, all these markers need to be change to actual values, for instance: +[source%nowrap,json] +---- +{ + "name" : "Event0000", + "nameSpace" : "org.onap.policy.apex.sample.events", + "version" : "0.0.1", + "source" : "Outside", + "target" : "Match", + "TestTemperature" : 25, + "TestTimestamp" : 123456789123456789, + "TestMatchCase" : 1, + "TestSlogan" : "Testing the Match Case with Temperature 25" +} +---- + |