blob: 782c2723e6f4c3cb2a2dee0f5f4fb9ba2c9b1ee8 [file] [log] [blame]
ramvermaaf74a622018-07-31 18:25:39 +01001//
2// ============LICENSE_START=======================================================
3// Copyright (C) 2016-2018 Ericsson. All rights reserved.
4// ================================================================================
5// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
6// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
7//
8// SPDX-License-Identifier: CC-BY-4.0
9// ============LICENSE_END=========================================================
10//
11// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
12//
13
14== Verify the APEX Installation
15When APEX is installed and all settings are realized, the installation can be verified.
16
17=== Verify a Minimal Installation
18The minimal installation does not come with any configuration or policy model.
19It is therefore not possible to test all APEX features, or an engine running with policies.
20
21However, one can verify that the engine starts up to the point where it tries to load a configuration.
22
23On Unix (or Cygwin) start the engine using `$APEX_HOME/bin/apexEngine.sh`.
24The engine will fail to fully start.
25However, if the output looks similar to the following line, the APEX installation is realized.
26
27[source%nowrap,sh,numbered]
28----
29Starting Apex service with parameters [] . . .
30start of Apex service failed: Apex configuration file was not specified as an argument
312017-07-28 13:18:44,266 Apex [main] ERROR c.e.a.service.engine.main.ApexMain - start of Apex service failed:
32----
33
34On Windows start the engine using `%APEX_HOME%\bin\apexEngine.bat`.
35The engine will fail to fully start.
36However, if the output looks similar to the following line, the APEX installation is realized.
37
38[source%nowrap,bat,numbered]
39----
40Starting Apex service with parameters [] . . .
41start of Apex service failed: Apex configuration file was not specified as an argument
422017-07-28 13:18:44,266 Apex [main] ERROR c.e.a.service.engine.main.ApexMain - start of Apex service failed:
43----
44
45
46=== Verify a Full Installation - run an Example
47A full APEX installation comes with several examples.
48Here, we can fully verify the installation by running one of the examples.
49
50We use the example called _SampleDomain_ and configure the engine to use standard in and standard out for events.
51Run the engine with the provided configuration.
52Note: Cygwin executes scripts as Unix scripts but runs Java as a Windows application, thus the configuration file must be given as a Windows path.
53
54[source%nowrap,sh,numbered,subs="attributes+"]
55----
56# $APEX_HOME/bin/apexEngine.sh -c $APEX_HOME/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json # <1>
57# $APEX_HOME/bin/apexEngine.sh -c C:/apex/apex-full-{release-version}/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json # <2>
58>%APEX_HOME%\bin\apexEngine.bat -c %APEX_HOME%\examples\config\SampleDomain\Stdin2StdoutJsonEventJava.json @@ <3>
59----
60<1> UNIX
61<2> Cygwin
62<3> Windows
63
64
65The engine should start successfully.
66Assuming the logging levels are not change (default level is `info`), the output should look similar to this (last few lines)
67
68[source%nowrap,sh,numbered]
69----
702017-07-28 13:20:54,673 Apex [main] INFO c.e.a.s.engine.runtime.EngineService - engine model SamplePolicyModelJAVA:0.0.1 added to the engine-AxArtifactKey:(name=MyApexEngine-3,version=0.0.1)
712017-07-28 13:20:54,675 Apex [Apex-apex-engine-service-0:0] INFO c.e.a.s.engine.runtime.EngineService - Engine AxArtifactKey:(name=MyApexEngine-0,version=0.0.1) processing ...
722017-07-28 13:20:54,677 Apex [Apex-apex-engine-service-0:1] INFO c.e.a.s.engine.runtime.EngineService - Engine AxArtifactKey:(name=MyApexEngine-1,version=0.0.1) processing ...
732017-07-28 13:20:54,677 Apex [Apex-apex-engine-service-0:2] INFO c.e.a.s.engine.runtime.EngineService - Engine AxArtifactKey:(name=MyApexEngine-2,version=0.0.1) processing ...
742017-07-28 13:20:54,677 Apex [Apex-apex-engine-service-0:3] INFO c.e.a.s.engine.runtime.EngineService - Engine AxArtifactKey:(name=MyApexEngine-3,version=0.0.1) processing ...
752017-07-28 13:20:54,680 Apex [main] INFO c.e.a.s.e.r.impl.EngineServiceImpl - Added the action listener to the engine
76Started Apex service
77----
78
79Important are the last two line, stating that APEX has added the final action listener to the engine and that the engine is started.
80
81The engine is configured to read events from standard input and write produced events to standard output.
82The policy model is a very simple policy.
83
84The following table shows an input event in the left column and an output event in the right column.
85Past the input event into the console where APEX is running, and the output event should appear in the console.
86Pasting the input event multiple times will produce output events with different values.
87
88[width="100%",options="header",cols="5a,5a"]
89|====================
90| Input Event | Example Output Event
91|
92[source%nowrap,json,numbered]
93----
94{
95 "nameSpace": "org.onap.policy.apex.sample.events",
96 "name": "Event0000",
97 "version": "0.0.1",
98 "source": "test",
99 "target": "apex",
100 "TestSlogan": "Test slogan for External Event0",
101 "TestMatchCase": 0,
102 "TestTimestamp": 1469781869269,
103 "TestTemperature": 9080.866
104}
105----
106|
107[source%nowrap,json,numbered]
108----
109{
110 "nameSpace" : "org.onap.policy.apex.sample.events",
111 "name" : "Event0004",
112 "version" : "0.0.1",
113 "source" : "Act",
114 "target" : "Outside",
115 "TestActCaseSelected" : 1,
116 "TestActStateTime" : 1499280954832,
117 "TestTemperature" : 9080.866,
118 "TestDecideCaseSelected" : 2,
119 "TestMatchCaseSelected" : 2,
120 "TestTimestamp" : 1469781869269,
121 "TestDecideStateTime" : 1499280954831,
122 "TestMatchCase" : 0,
123 "TestSlogan" : "Test slogan for External Event0",
124 "TestEstablishCaseSelected" : 1,
125 "TestEstablishStateTime" : 1499280954831,
126 "TestMatchStateTime" : 1499280954828
127}
128----
129|====================
130
131Terminate APEX by simply using `CTRL+C` in the console.
132
133
134=== Verify a Full Installation - REST Editor
135APEX has a REST application for viewing policy models.
136The application can also be used to create new policy models close to the engine native policy language.
137Start the REST editor as follows.
138
139[source%nowrap,sh,numbered]
140----
141# $APEX_HOME/bin/apexApps.sh rest-editor
142----
143
144[source%nowrap,bat,numbered]
145----
146>%APEX_HOME%\bin\apexApps.bat rest-editor
147----
148
149The script will start a simple web server (link:https://javaee.github.io/grizzly/[Grizzly]) and deploy a `war` web archive in it.
150Once the editor is started, it will be available on `localhost:18988`.
151The last few line of the messages should be:
152
153[source%nowrap,sh,numbered]
154----
155Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18988/apex/, TTL=-1sec], State=READY) starting at http://localhost:18988/apex/ . . .
156Jul 28, 2017 1:22:15 PM org.glassfish.grizzly.http.server.NetworkListener start
157INFO: Started listener bound to [localhost:18988]
158Jul 28, 2017 1:22:15 PM org.glassfish.grizzly.http.server.HttpServer start
159INFO: [HttpServer] Started.
160Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18988/apex/, TTL=-1sec], State=RUNNING) started at http://localhost:18988/apex/
161----
162
163Now open a browser (Firefox, Chrome, Opera, Internet Explorer) and use the URL `http://localhost:18988/`.
164This will connect the browser to the started REST editor.
165The start screen should be as follows.
166
167.REST Editor Start Screen
168image::install-guide/rest-start.png[REST Editor Start Screen]
169
170Now load a policy model by clicking the menu `File` and then `Open`.
171In the opened dialog, go to the directory where APEX is installed, then `examples`, `models`, `SampleDomain`, and there select the file `SamplePolicyModelJAVA.json`.
172This will load the policy model used to verify the policy engine (see above).
173Once loaded, the screen should look as follows.
174
175.REST Editor with loaded SampleDomain Policy Model
176image::install-guide/rest-loaded.png[REST Editor with loaded SampleDomain Policy Model]
177
178Now you can use the REST editor.
179To finish this verification, simply terminate your browser (or the tab), and then use `CTRL+C` in the console where you started the REST editor.
180