blob: 50468a22006d35584c110dd10e2aeef22f8deb99 [file] [log] [blame]
ramverma3b71c972019-07-10 11:25:37 +00001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
3
4
5APEX User Manual
6****************
7
8.. contents::
9 :depth: 3
10
11Installation
12^^^^^^^^^^^^
13
14Requirements
15------------
16
17 .. container:: paragraph
18
19 APEX is 100% written in Java and runs on any platform
20 that supports a JVM, e.g. Windows, Unix, Cygwin. Some
21 APEX applications (such as the monitoring application)
22 come as web archives, they do require a war-capable web
23 server installed.
24
25Installation Requirements
26#########################
27
28 .. container:: ulist
29
30 - Downloaded distribution: JAVA runtime environment
31 (JRE, Java 8 or later, APEX is tested with the
32 Oracle Java)
33
34 - Building from source: JAVA development kit (JDK,
35 Java 8 or later, APEX is tested with the Oracle
36 Java)
37
38 - A web archive capable webserver, for instance for
39 the monitoring application
40
41 .. container:: ulist
42
43 - for instance `Apache
44 Tomcat <https://tomcat.apache.org/>`__
45
46 - Sufficient rights to install APEX on the system
47
48 - Installation tools depending on the installation
49 method used:
50
51 .. container:: ulist
52
53 - ZIP to extract from a ZIP distribution
54
55 .. container:: ulist
56
57 - Windows for instance
58 `7Zip <http://www.7-zip.org/>`__
59
60 - TAR and GZ to extract from that TAR.GZ
61 distribution
62
63 .. container:: ulist
64
65 - Windows for instance
66 `7Zip <http://www.7-zip.org/>`__
67
68 - RPM to install from the RPM distribution
69
70 .. container:: ulist
71
72 - Install: ``sudo apt-get install rpm``
73
74 - DPKG to install from the DEB distribution
75
76 .. container:: ulist
77
78 - Install: ``sudo apt-get install dpkg``
79
80Feature Requirements
81####################
82
83 .. container:: paragraph
84
85 APEX supports a number of features that require extra
86 software being installed.
87
88 .. container:: ulist
89
90 - `Apache Kafka <https://kafka.apache.org/>`__ to
91 connect APEX to a Kafka message bus
92
93 - `Hazelcast <https://hazelcast.com/>`__ to use
94 distributed hash maps for context
95
96 - `Infinispan <http://infinispan.org/>`__ for
97 distributed context and persistence
98
99 - `Docker <https://www.docker.com/>`__ to run APEX
100 inside a Docker container
101
102Build (Install from Source) Requirements
103########################################
104
105 .. container:: paragraph
106
107 Installation from source requires a few development
108 tools
109
110 .. container:: ulist
111
112 - GIT to retrieve the source code
113
114 - Java SDK, Java version 8 or later
115
116 - Apache Maven 3 (the APEX build environment)
117
118Get the APEX Source Code
119------------------------
120
121 .. container:: paragraph
122
123 The first APEX source code was hosted on Github in
124 January 2018. By the end of 2018, APEX was added as a
125 project in the ONAP Policy Framework, released later in
126 the ONAP Casablanca release.
127
128 .. container:: paragraph
129
130 The APEX source code is hosted in ONAP as project APEX.
131 The current stable version is in the master branch.
132 Simply clone the master branch from ONAP using HTTPS.
133
134 .. container:: listingblock
135
136 .. container:: content
137
ramverma760cce92019-07-11 12:57:49 +0000138 .. code::
ramverma3b71c972019-07-10 11:25:37 +0000139 :number-lines:
140
141 git clone https://gerrit.onap.org/r/policy/apex-pdp
142
143Build APEX
144----------
145
146 .. container:: paragraph
147
148 The examples in this document assume that the APEX source
149 repositories are cloned to:
150
151 .. container:: ulist
152
153 - Unix, Cygwin: ``/usr/local/src/apex-pdp``
154
155 - Windows: ``C:\dev\apex-pdp``
156
157 - Cygwin: ``/cygdrive/c/dev/apex-pdp``
158
ramverma760cce92019-07-11 12:57:49 +0000159 .. important::
ramverma3b71c972019-07-10 11:25:37 +0000160 A Build requires ONAP Nexus
ramverma760cce92019-07-11 12:57:49 +0000161 APEX has a dependency to ONAP parent projects. You might need to adjust your Maven M2 settings. The most current
162 settings can be found in the ONAP oparent repo: `Settings <https://git.onap.org/oparent/plain/settings.xml>`__.
ramverma3b71c972019-07-10 11:25:37 +0000163
ramverma760cce92019-07-11 12:57:49 +0000164 .. important::
165 A Build needs Space
166 Building APEX requires approximately 2-3 GB of hard disc space, 1 GB for the actual build with full
167 distribution and 1-2 GB for the downloaded dependencies
ramverma3b71c972019-07-10 11:25:37 +0000168
ramverma760cce92019-07-11 12:57:49 +0000169 .. important::
ramverma3b71c972019-07-10 11:25:37 +0000170 A Build requires Internet (for first build)
ramverma760cce92019-07-11 12:57:49 +0000171 During the build, several (a lot) of Maven dependencies will be downloaded and stored in the configured local Maven
172 repository. The first standard build (and any first specific build) requires Internet access to download those
173 dependencies.
ramverma3b71c972019-07-10 11:25:37 +0000174
ramverma760cce92019-07-11 12:57:49 +0000175 .. important::
ramverma3b71c972019-07-10 11:25:37 +0000176 Building RPM distributions
ramverma760cce92019-07-11 12:57:49 +0000177 RPM images are only build if the ``rpm`` package is installed (Unix). To install ``rpm`` run ``sudo apt-get install rpm``,
178 then build APEX.
ramverma3b71c972019-07-10 11:25:37 +0000179
180 .. container:: paragraph
181
182 Use Maven to for a standard build without any tests.
183
184 +-------------------------------------------------------+--------------------------------------------------------+
185 | Unix, Cygwin | Windows |
186 +=======================================================+========================================================+
187 | .. container:: | .. container:: |
188 | | |
189 | .. container:: content | .. container:: content |
190 | | |
191 | .. code:: | .. code:: |
192 | :number-lines: | :number-lines: |
193 | | |
194 | # cd /usr/local/src/apex-pdp | >c: |
liamfallon1540e472019-11-28 15:14:07 +0000195 | # mvn clean install -Pdocker -DskipTests | >cd \dev\apex |
196 | | >mvn clean install -Pdocker -DskipTests |
ramverma3b71c972019-07-10 11:25:37 +0000197 +-------------------------------------------------------+--------------------------------------------------------+
198
199.. container:: paragraph
200
201 The build takes 2-3 minutes on a standard development laptop. It
202 should run through without errors, but with a lot of messages from
203 the build process.
204
205.. container:: paragraph
206
207 When Maven is finished with the build, the final screen should look
208 similar to this (omitting some ``success`` lines):
209
210.. container:: listingblock
211
212 .. container:: content
213
ramverma760cce92019-07-11 12:57:49 +0000214 .. code::
ramverma3b71c972019-07-10 11:25:37 +0000215 :number-lines:
216
217 [INFO] tools .............................................. SUCCESS [ 0.248 s]
218 [INFO] tools-common ....................................... SUCCESS [ 0.784 s]
219 [INFO] simple-wsclient .................................... SUCCESS [ 3.303 s]
220 [INFO] model-generator .................................... SUCCESS [ 0.644 s]
221 [INFO] packages ........................................... SUCCESS [ 0.336 s]
222 [INFO] apex-pdp-package-full .............................. SUCCESS [01:10 min]
223 [INFO] Policy APEX PDP - Docker build 2.0.0-SNAPSHOT ...... SUCCESS [ 10.307 s]
224 [INFO] ------------------------------------------------------------------------
225 [INFO] BUILD SUCCESS
226 [INFO] ------------------------------------------------------------------------
227 [INFO] Total time: 03:43 min
228 [INFO] Finished at: 2018-09-03T11:56:01+01:00
229 [INFO] ------------------------------------------------------------------------
230
231.. container:: paragraph
232
233 The build will have created all artifacts required for an APEX
234 installation. The following example show how to change to the target
235 directory and how it should look like.
236
237+----------------------------------------------------------------------------------------------------------------------------+
238| Unix, Cygwin |
239+============================================================================================================================+
240| .. container:: |
241| |
242| .. container:: listingblock |
243| |
244| .. container:: content |
245| |
246| .. code:: |
247| :number-lines: |
248| |
249| -rwxrwx---+ 1 esvevan Domain Users 772 Sep 3 11:55 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes* |
250| -rwxrwx---+ 1 esvevan Domain Users 146328082 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT.deb* |
251| -rwxrwx---+ 1 esvevan Domain Users 15633 Sep 3 11:54 apex-pdp-package-full-2.0.0-SNAPSHOT.jar* |
252| -rwxrwx---+ 1 esvevan Domain Users 146296819 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz* |
253| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 archive-tmp/ |
254| -rwxrwx---+ 1 esvevan Domain Users 89 Sep 3 11:54 checkstyle-cachefile* |
255| -rwxrwx---+ 1 esvevan Domain Users 10621 Sep 3 11:54 checkstyle-checker.xml* |
256| -rwxrwx---+ 1 esvevan Domain Users 584 Sep 3 11:54 checkstyle-header.txt* |
257| -rwxrwx---+ 1 esvevan Domain Users 86 Sep 3 11:54 checkstyle-result.xml* |
258| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 classes/ |
259| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 dependency-maven-plugin-markers/ |
260| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 etc/ |
261| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 examples/ |
262| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:55 install_hierarchy/ |
263| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 maven-archiver/ |
264+----------------------------------------------------------------------------------------------------------------------------+
265
266+--------------------------------------------------------------------------------------------------------+
267| Windows |
268+========================================================================================================+
269| .. container:: |
270| |
271| .. container:: listingblock |
272| |
273| .. container:: content |
274| |
275| .. code:: |
276| :number-lines: |
277| |
278| 03/09/2018 11:55 <DIR> . |
279| 03/09/2018 11:55 <DIR> .. |
280| 03/09/2018 11:55 146,296,819 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz |
281| 03/09/2018 11:55 146,328,082 apex-pdp-package-full-2.0.0-SNAPSHOT.deb |
282| 03/09/2018 11:54 15,633 apex-pdp-package-full-2.0.0-SNAPSHOT.jar |
283| 03/09/2018 11:55 772 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes |
284| 03/09/2018 11:54 <DIR> archive-tmp |
285| 03/09/2018 11:54 89 checkstyle-cachefile |
286| 03/09/2018 11:54 10,621 checkstyle-checker.xml |
287| 03/09/2018 11:54 584 checkstyle-header.txt |
288| 03/09/2018 11:54 86 checkstyle-result.xml |
289| 03/09/2018 11:54 <DIR> classes |
290| 03/09/2018 11:54 <DIR> dependency-maven-plugin-markers |
291| 03/09/2018 11:54 <DIR> etc |
292| 03/09/2018 11:54 <DIR> examples |
293| 03/09/2018 11:55 <DIR> install_hierarchy |
294| 03/09/2018 11:54 <DIR> maven-archiver |
295| 8 File(s) 292,652,686 bytes |
296| 9 Dir(s) 14,138,720,256 bytes free |
297+--------------------------------------------------------------------------------------------------------+
298
299Install APEX
300------------
301
302 .. container:: paragraph
303
304 APEX can be installed in different ways:
305
306 .. container:: ulist
307
308 - Unix: automatically using ``rpm`` or ``dpkg`` from ``.rpm`` or
309 ``.deb`` archive
310
311 - Windows, Unix, Cygwin: manually from a ``.tar.gz`` archive
312
313 - Windows, Unix, Cygwin: build from source using Maven, then
314 install manually
315
316Install with RPM and DPKG
317#########################
318
319 .. container:: paragraph
320
321 The install distributions of APEX automatically install the
322 system. The installation directory is
323 ``/opt/app/policy/apex-pdp``. Log files are located in
324 ``/var/log/onap/policy/apex-pdp``. The latest APEX version will
325 be available as ``/opt/app/policy/apex-pdp/apex-pdp``.
326
327 .. container:: paragraph
328
329 For the installation, a new user ``apexuser`` and a new group
330 ``apexuser`` will be created. This user owns the installation
331 directories and the log file location. The user is also used by
332 the standard APEX start scripts to run APEX with this user’s
333 permissions.
334
335 +-----------------------------------------------------------------------+
336 | RPM Installation |
337 +=======================================================================+
338 | .. container:: |
339 | |
340 | .. container:: listingblock |
341 | |
342 | .. container:: content |
343 | |
344 | .. code:: |
345 | :number-lines: |
346 | |
347 | # sudo rpm -i apex-pdp-package-full-2.0.0-SNAPSHOT.rpm |
348 | ********************preinst******************* |
349 | arguments 1 |
350 | ********************************************** |
351 | creating group apexuser . . . |
352 | creating user apexuser . . . |
353 | ********************postinst**************** |
354 | arguments 1 |
355 | *********************************************** |
356 +-----------------------------------------------------------------------+
357
358+--------------------------------------------------------------------------------------+
359| DPKG Installation |
360+======================================================================================+
361| .. container:: |
362| |
363| .. container:: listingblock |
364| |
365| .. container:: content |
366| |
367| .. code:: |
ramverma760cce92019-07-11 12:57:49 +0000368| :number-lines: |
ramverma3b71c972019-07-10 11:25:37 +0000369| |
liamfallon9c7bd672019-10-03 13:42:08 +0100370| # sudo dpkg -i apex-pdp-package-full-2.0.0-SNAPSHOT.deb |
ramverma3b71c972019-07-10 11:25:37 +0000371| Selecting previously unselected package apex-uservice. |
372| (Reading database ... 288458 files and directories currently installed.) |
373| Preparing to unpack apex-pdp-package-full-2.0.0-SNAPSHOT.deb ... |
374| ********************preinst******************* |
375| arguments install |
376| ********************************************** |
377| creating group apexuser . . . |
378| creating user apexuser . . . |
379| Unpacking apex-uservice (2.0.0-SNAPSHOT) ... |
380| Setting up apex-uservice (2.0.0-SNAPSHOT) ... |
381| ********************postinst**************** |
382| arguments configure |
383| *********************************************** |
384+--------------------------------------------------------------------------------------+
385
386.. container:: paragraph
387
388 Once the installation is finished, APEX is fully installed and ready
389 to run.
390
391Install Manually from Archive (Unix, Cygwin)
392############################################
393
394 .. container:: paragraph
395
396 Download a ``tar.gz`` archive. Create a directory where APEX
397 should be installed. Extract the ``tar`` archive. The following
398 example shows how to install APEX in ``/opt/apex`` and create a
399 link to ``/opt/apex/apex`` for the most recent installation.
400
401 .. container:: listingblock
402
403 .. container:: content
404
ramverma760cce92019-07-11 12:57:49 +0000405 .. code::
ramverma3b71c972019-07-10 11:25:37 +0000406 :number-lines:
407
408 # cd /opt
409 # mkdir apex
410 # cd apex
411 # mkdir apex-full-2.0.0-SNAPSHOT
412 # tar xvfz ~/Downloads/apex-pdp-package-full-2.0.0-SNAPSHOT.tar.gz -C apex-full-2.0.0-SNAPSHOT
413 # ln -s apex apex-pdp-package-full-2.0.0-SNAPSHOT
414
415Install Manually from Archive (Windows, 7Zip, GUI)
416##################################################
417
418 .. container:: paragraph
419
420 Download a ``tar.gz`` archive and copy the file into the install
421 folder (in this example ``C:\apex``). Assuming you are using 7Zip,
422 right click on the file and extract the ``tar`` archive. Note: the
423 screenshots might show an older version than you have.
424
425 .. container:: imageblock
426
427 .. container:: content
428
429 |Extract the TAR archive|
430
431 .. container:: paragraph
432
433 The right-click on the new created TAR file and extract the actual
434 APEX distribution.
435
436 .. container:: imageblock
437
438 .. container:: content
439
440 |Extract the APEX distribution|
441
442 .. container:: paragraph
443
444 Inside the new APEX folder you see the main directories: ``bin``,
445 ``etc``, ``examples``, ``lib``, and ``war``
446
447 .. container:: paragraph
448
449 Once extracted, please rename the created folder to
450 ``apex-full-2.0.0-SNAPSHOT``. This will keep the directory name in
451 line with the rest of this documentation.
452
453Install Manually from Archive (Windows, 7Zip, CMD)
454##################################################
455
456 .. container:: paragraph
457
458 Download a ``tar.gz`` archive and copy the file into the install
459 folder (in this example ``C:\apex``). Start ``cmd``, for instance
460 typing ``Windows+R`` and then ``cmd`` in the dialog. Assuming
461 ``7Zip`` is installed in the standard folder, simply run the
462 following commands (for APEX version 2.0.0-SNAPSHOT full
463 distribution)
464
465 .. container:: listingblock
466
467 .. container:: content
468
ramverma760cce92019-07-11 12:57:49 +0000469 .. code::
ramverma3b71c972019-07-10 11:25:37 +0000470 :number-lines:
471
472 >c:
473 >cd \apex
474 >"\Program Files\7-Zip\7z.exe" x apex-pdp-package-full-2.0.0-SNAPSHOT.tar.gz -so | "\Program Files\7-Zip\7z.exe" x -aoa -si -ttar -o"apex-full-2.0.0-SNAPSHOT"
475
476.. container:: paragraph
477
478 APEX is now installed in the folder
479 ``C:\apex\apex-full-2.0.0-SNAPSHOT``.
480
481Build from Source
482-----------------
483
484Build and Install Manually (Unix, Windows, Cygwin)
485##################################################
486
487 .. container:: paragraph
488
489 Clone the APEX GIT repositories into a directory. Go to that
490 directory. Use Maven to build APEX (all details on building
491 APEX from source can be found in *APEX HowTo: Build*). Install
492 from the created artifacts (``rpm``, ``deb``, ``tar.gz``, or
493 copying manually).
494
ramverma760cce92019-07-11 12:57:49 +0000495 .. important::
496 Building RPM distributions
497 RPM images are only build if the ``rpm`` package is installed (Unix). To install ``rpm`` run
498 ``sudo apt-get install rpm``, then build APEX.
ramverma3b71c972019-07-10 11:25:37 +0000499
500 .. container:: paragraph
501
502 The following example shows how to build the APEX system,
503 without tests (``-DskipTests``) to safe some time. It assumes
504 that the APX GIT repositories are cloned to:
505
506 .. container:: ulist
507
508 - Unix, Cygwin: ``/usr/local/src/apex``
509
510 - Windows: ``C:\dev\apex``
511
ramverma760cce92019-07-11 12:57:49 +0000512 +-------------------------------------------------------+--------------------------------------------------------+
ramverma3b71c972019-07-10 11:25:37 +0000513 | Unix, Cygwin | Windows |
514 +=======================================================+========================================================+
515 | .. container:: | .. container:: |
516 | | |
517 | .. container:: content | .. container:: content |
518 | | |
519 | .. code:: | .. code:: |
520 | :number-lines: | :number-lines: |
521 | | |
522 | # cd /usr/local/src/apex | >c: |
liamfallon1540e472019-11-28 15:14:07 +0000523 | # mvn clean install -Pdocker -DskipTests | >cd \dev\apex |
524 | | >mvn clean install -Pdocker -DskipTests |
ramverma3b71c972019-07-10 11:25:37 +0000525 +-------------------------------------------------------+--------------------------------------------------------+
526
527.. container:: paragraph
528
529 The build takes about 2 minutes without test and about 4-5 minutes
530 with tests on a standard development laptop. It should run through
531 without errors, but with a lot of messages from the build process. If
532 build with tests (i.e. without ``-DskipTests``), there will be error
533 messages and stack trace prints from some tests. This is normal, as
534 long as the build finishes successful.
535
536.. container:: paragraph
537
538 When Maven is finished with the build, the final screen should look
539 similar to this (omitting some ``success`` lines):
540
541.. container:: listingblock
542
543 .. container:: content
544
ramverma760cce92019-07-11 12:57:49 +0000545 .. code::
ramverma3b71c972019-07-10 11:25:37 +0000546 :number-lines:
547
548 [INFO] tools .............................................. SUCCESS [ 0.248 s]
549 [INFO] tools-common ....................................... SUCCESS [ 0.784 s]
550 [INFO] simple-wsclient .................................... SUCCESS [ 3.303 s]
551 [INFO] model-generator .................................... SUCCESS [ 0.644 s]
552 [INFO] packages ........................................... SUCCESS [ 0.336 s]
553 [INFO] apex-pdp-package-full .............................. SUCCESS [01:10 min]
554 [INFO] Policy APEX PDP - Docker build 2.0.0-SNAPSHOT ...... SUCCESS [ 10.307 s]
555 [INFO] ------------------------------------------------------------------------
556 [INFO] BUILD SUCCESS
557 [INFO] ------------------------------------------------------------------------
558 [INFO] Total time: 03:43 min
559 [INFO] Finished at: 2018-09-03T11:56:01+01:00
560 [INFO] ------------------------------------------------------------------------
561
562.. container:: paragraph
563
564 The build will have created all artifacts required for an APEX
565 installation. The following example show how to change to the target
566 directory and how it should look like.
567
568+-----------------------------------------------------------------------------------------------------------------------------+
569| Unix, Cygwin |
570+=============================================================================================================================+
571| .. container:: |
572| |
573| .. container:: listingblock |
574| |
575| .. code:: |
576| :number-lines: |
577| |
578| # cd packages/apex-pdp-package-full/target |
579| # ls -l |
580| -rwxrwx---+ 1 esvevan Domain Users 772 Sep 3 11:55 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes* |
581| -rwxrwx---+ 1 esvevan Domain Users 146328082 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT.deb* |
582| -rwxrwx---+ 1 esvevan Domain Users 15633 Sep 3 11:54 apex-pdp-package-full-2.0.0-SNAPSHOT.jar* |
583| -rwxrwx---+ 1 esvevan Domain Users 146296819 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz* |
584| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 archive-tmp/ |
585| -rwxrwx---+ 1 esvevan Domain Users 89 Sep 3 11:54 checkstyle-cachefile* |
586| -rwxrwx---+ 1 esvevan Domain Users 10621 Sep 3 11:54 checkstyle-checker.xml* |
587| -rwxrwx---+ 1 esvevan Domain Users 584 Sep 3 11:54 checkstyle-header.txt* |
588| -rwxrwx---+ 1 esvevan Domain Users 86 Sep 3 11:54 checkstyle-result.xml* |
589| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 classes/ |
590| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 dependency-maven-plugin-markers/ |
591| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 etc/ |
592| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 examples/ |
593| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:55 install_hierarchy/ |
594| drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 maven-archiver/ |
595+-----------------------------------------------------------------------------------------------------------------------------+
596
597+-----------------------------------------------------------------------------------------------------------------------------+
598| Windows |
599+=============================================================================================================================+
600| .. container:: |
601| |
602| .. container:: listingblock |
603| |
604| .. code:: |
605| :number-lines: |
606| |
607| >cd packages\apex-pdp-package-full\target |
608| >dir |
609| 03/09/2018 11:55 <DIR> . |
610| 03/09/2018 11:55 <DIR> .. |
611| 03/09/2018 11:55 146,296,819 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz |
612| 03/09/2018 11:55 146,328,082 apex-pdp-package-full-2.0.0-SNAPSHOT.deb |
613| 03/09/2018 11:54 15,633 apex-pdp-package-full-2.0.0-SNAPSHOT.jar |
614| 03/09/2018 11:55 772 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes |
615| 03/09/2018 11:54 <DIR> archive-tmp |
616| 03/09/2018 11:54 89 checkstyle-cachefile |
617| 03/09/2018 11:54 10,621 checkstyle-checker.xml |
618| 03/09/2018 11:54 584 checkstyle-header.txt |
619| 03/09/2018 11:54 86 checkstyle-result.xml |
620| 03/09/2018 11:54 <DIR> classes |
621| 03/09/2018 11:54 <DIR> dependency-maven-plugin-markers |
622| 03/09/2018 11:54 <DIR> etc |
623| 03/09/2018 11:54 <DIR> examples |
624| 03/09/2018 11:55 <DIR> install_hierarchy |
625| 03/09/2018 11:54 <DIR> maven-archiver |
626| 8 File(s) 292,652,686 bytes |
627| 9 Dir(s) 14,138,720,256 bytes free |
628+-----------------------------------------------------------------------------------------------------------------------------+
629
630.. container:: paragraph
631
632 Now, take the ``.deb`` or the ``.tar.gz`` file and install APEX.
633 Alternatively, copy the content of the folder ``install_hierarchy``
634 to your APEX directory.
635
636Installation Layout
637-------------------
638
639 .. container:: paragraph
640
641 A full installation of APEX comes with the following layout.
642
643 .. container:: listingblock
644
645 .. container:: content
646
647 ::
648
649 $APEX_HOME
650 ├───bin (1)
651 ├───etc (2)
652 │ ├───editor
653 │ ├───hazelcast
654 │ ├───infinispan
655 │ └───META-INF
656 ├───examples (3)
657 │ ├───config (4)
658 │ ├───docker (5)
659 │ ├───events (6)
660 │ ├───html (7)
661 │ ├───models (8)
662 │ └───scripts (9)
663 ├───lib (10)
664 │ └───applications (11)
665 └───war (12)
666
667 .. container:: colist arabic
668
669 +-----------------------------------+-----------------------------------+
670 | **1** | binaries, mainly scripts (bash |
671 | | and bat) to start the APEX engine |
672 | | and applications |
673 +-----------------------------------+-----------------------------------+
674 | **2** | configuration files, such as |
675 | | logback (logging) and third party |
676 | | library configurations |
677 +-----------------------------------+-----------------------------------+
678 | **3** | example policy models to get |
679 | | started |
680 +-----------------------------------+-----------------------------------+
681 | **4** | configurations for the examples |
682 | | (with sub directories for |
683 | | individual examples) |
684 +-----------------------------------+-----------------------------------+
685 | **5** | Docker files and additional |
686 | | Docker instructions for the |
687 | | exampples |
688 +-----------------------------------+-----------------------------------+
689 | **6** | example events for the examples |
690 | | (with sub directories for |
691 | | individual examples) |
692 +-----------------------------------+-----------------------------------+
693 | **7** | HTML files for some examples, |
694 | | e.g. the Decisionmaker example |
695 +-----------------------------------+-----------------------------------+
696 | **8** | the policy models, generated for |
697 | | each example (with sub |
698 | | directories for individual |
699 | | examples) |
700 +-----------------------------------+-----------------------------------+
701 | **9** | additional scripts for the |
702 | | examples (with sub directories |
703 | | for individual examples) |
704 +-----------------------------------+-----------------------------------+
705 | **10** | the library folder with all Java |
706 | | JAR files |
707 +-----------------------------------+-----------------------------------+
708 | **11** | applications, also known as jar |
709 | | with dependencies (or fat jars), |
710 | | individually deployable |
711 +-----------------------------------+-----------------------------------+
712 | **12** | WAR files for web applications |
713 +-----------------------------------+-----------------------------------+
714
715System Configuration
716--------------------
717
718 .. container:: paragraph
719
720 Once APEX is installed, a few configurations need to be done:
721
722 .. container:: ulist
723
724 - Create an APEX user and an APEX group (optional, if not
725 installed using RPM and DPKG)
726
727 - Create environment settings for ``APEX_HOME`` and
728 ``APEX_USER``, required by the start scripts
729
730 - Change settings of the logging framework (optional)
731
732 - Create directories for logging, required (execution might fail
733 if directories do not exist or cannot be created)
734
735APEX User and Group
736###################
737
738 .. container:: paragraph
739
740 On smaller installations and test systems, APEX can run as any
741 user or group.
742
743 .. container:: paragraph
744
745 However, if APEX is installed in production, we strongly
746 recommend you set up a dedicated user for running APEX. This
747 will isolate the execution of APEX to that user. We recommend
748 you use the userid ``apexuser`` but you may use any user you
749 choose.
750
751 .. container:: paragraph
752
753 The following example, for UNIX, creates a group called
754 ``apexuser``, an APEX user called ``apexuser``, adds the group
755 to the user, and changes ownership of the APEX installation to
756 the user. Substitute ``<apex-dir>`` with the directory where
757 APEX is installed.
758
759 .. container:: listingblock
760
761 .. container:: content
762
ramverma760cce92019-07-11 12:57:49 +0000763 .. code::
ramverma3b71c972019-07-10 11:25:37 +0000764 :number-lines:
765
766 # sudo groupadd apexuser
767 # sudo useradd -g apexuser apexuser
768 # sudo chown -R apexuser:apexuser <apex-dir>
769
770.. container:: paragraph
771
772 For other operating systems please consult your manual or system
773 administrator.
774
775Environment Settings: APEX_HOME and APEX_USER
776#############################################
777
778 .. container:: paragraph
779
780 The provided start scripts for APEX require two environment
781 variables being set:
782
783 .. container:: ulist
784
785 - ``APEX_USER`` with the user under whos name and permission APEX
786 should be started (Unix only)
787
788 - ``APEX_HOME`` with the directory where APEX is installed (Unix,
789 Windows, Cygwin)
790
791 .. container:: paragraph
792
793 The first row in the following table shows how to set these
794 environment variables temporary (assuming the user is
795 ``apexuser``). The second row shows how to verify the settings.
796 The last row explains how to set those variables permanently.
797
798 +------------------------------------------------+---------------------------------------------------------+
799 | Unix, Cygwin (bash/tcsh) | Windows |
800 +================================================+=========================================================+
801 | .. container:: | .. container:: |
802 | | |
803 | .. container:: content | .. container:: content |
804 | | |
805 | .. code:: | .. code:: |
806 | :number-lines: | :number-lines: |
807 | | |
808 | # export APEX_USER=apexuser | >set APEX_HOME=C:\apex\apex-full-2.0.0-SNAPSHOT |
809 | # cd /opt/app/policy/apex-pdp | |
ramverma760cce92019-07-11 12:57:49 +0000810 | # export APEX_HOME=`pwd` | |
ramverma3b71c972019-07-10 11:25:37 +0000811 | | |
812 +------------------------------------------------+ |
813 | .. container:: | |
814 | | |
815 | .. container:: content | |
816 | | |
ramverma760cce92019-07-11 12:57:49 +0000817 | .. code::tcsh | |
ramverma3b71c972019-07-10 11:25:37 +0000818 | :number-lines: | |
819 | | |
820 | # setenv APEX_USER apexuser | |
821 | # cd /opt/app/policy/apex-pdp | |
ramverma760cce92019-07-11 12:57:49 +0000822 | # setenv APEX_HOME `pwd` | |
ramverma3b71c972019-07-10 11:25:37 +0000823 | | |
824 +------------------------------------------------+---------------------------------------------------------+
825 | .. container:: | .. container:: |
826 | | |
827 | .. container:: content | .. container:: content |
828 | | |
829 | .. code:: | .. code:: |
830 | :number-lines: | :number-lines: |
831 | | |
832 | # env | grep APEX | >set APEX_HOME |
833 | # APEX_USER=apexuser | APEX_HOME=\apex\apex-full-2.0.0-SNAPSHOT |
ramverma760cce92019-07-11 12:57:49 +0000834 | # APEX_HOME=/opt/app/policy/apex-pdp | |
ramverma3b71c972019-07-10 11:25:37 +0000835 | | |
836 +------------------------------------------------+---------------------------------------------------------+
837
838Making Environment Settings Permanent (Unix, Cygwin)
839====================================================
840
841 .. container:: paragraph
842
843 For a per-user setting, edit the a user’s ``bash`` or ``tcsh``
844 settings in ``~/.bashrc`` or ``~/.tcshrc``. For system-wide
845 settings, edit ``/etc/profiles`` (requires permissions).
846
847Making Environment Settings Permanent (Windows)
848===============================================
849
850 .. container:: paragraph
851
852 On Windows 7 do
853
854 .. container:: ulist
855
856 - Click on the **Start** Menu
857
858 - Right click on **Computer**
859
860 - Select **Properties**
861
862 .. container:: paragraph
863
864 On Windows 8/10 do
865
866 .. container:: ulist
867
868 - Click on the **Start** Menu
869
870 - Select **System**
871
872 .. container:: paragraph
873
874 Then do the following
875
876 .. container:: ulist
877
878 - Select **Advanced System Settings**
879
880 - On the **Advanced** tab, click the **Environment Variables**
881 button
882
883 - Edit an existing variable, or create a new System variable:
884 'Variable name'="APEX_HOME", 'Variable
885 value'="C:\apex\apex-full-2.0.0-SNAPSHOT"
886
887 .. container:: paragraph
888
889 For the settings to take effect, an application needs to be
890 restarted (e.g. any open ``cmd`` window).
891
892Edit the APEX Logging Settings
893##############################
894
895 .. container:: paragraph
896
897 Configure the APEX logging settings to your requirements, for
898 instance:
899
900 .. container:: ulist
901
902 - change the directory where logs are written to, or
903
904 - change the log levels
905
906 .. container:: paragraph
907
908 Edit the file ``$APEX_HOME/etc/logback.xml`` for any required
909 changes. To change the log directory change the line
910
911 .. container:: paragraph
912
liamfallon1540e472019-11-28 15:14:07 +0000913 ``<property name="logDir" value="/var/log/onap/policy/apex-pdp/" />``
ramverma3b71c972019-07-10 11:25:37 +0000914
915 .. container:: paragraph
916
917 to
918
919 .. container:: paragraph
920
liamfallon1540e472019-11-28 15:14:07 +0000921 ``<property name="logDir" value="/PATH/TO/LOG/DIRECTORY/" />``
ramverma3b71c972019-07-10 11:25:37 +0000922
923 .. container:: paragraph
924
925 On Windows, it is recommended to change the log directory to:
926
927 .. container:: paragraph
928
liamfallon1540e472019-11-28 15:14:07 +0000929 ``<property name="logDir" value="C:/apex/apex-full-2.0.0-SNAPSHOT/logs" />``
ramverma3b71c972019-07-10 11:25:37 +0000930
931 .. container:: paragraph
932
933 Note: Be careful about when to use ``\`` vs. ``/`` as the path
934 separator!
935
936Create Directories for Logging
937##############################
938
939 .. container:: paragraph
940
941 Make sure that the log directory exists. This is important when
942 APEX was installed manually or when the log directory was changed
943 in the settings (see above).
944
liamfallon9c7bd672019-10-03 13:42:08 +0100945 +-----------------------------------------------------------------------+-------------------------------------------------------+
946 | Unix, Cygwin | Windows |
947 +=======================================================================+=======================================================+
948 | .. container:: | .. container:: |
949 | | |
950 | .. container:: content | .. container:: content |
951 | | |
952 | .. code:: | .. code:: |
953 | :number-lines: | :number-lines: |
954 | | |
955 | sudo mkdir -p /var/log/onap/policy/apex-pdp | >mkdir C:\apex\apex-full-2.0.0-SNAPSHOT\logs |
956 | sudo chown -R apexuser:apexuser /var/log/onap/policy/apex-pdp | |
957 +-----------------------------------------------------------------------+-------------------------------------------------------+
ramverma3b71c972019-07-10 11:25:37 +0000958
959Verify the APEX Installation
960----------------------------
961
962 .. container:: paragraph
963
964 When APEX is installed and all settings are realized, the
965 installation can be verified.
966
967Verify Installation - run Engine
968################################
969
970 .. container:: paragraph
971
972 A simple verification of an APEX installation can be done by
973 simply starting the APEX engine without any configuration. On
974 Unix (or Cygwin) start the engine using
975 ``$APEX_HOME/bin/apexEngine.sh``. On Windows start the engine
976 using ``%APEX_HOME%\bin\apexEngine.bat``. The engine will fail
977 to fully start. However, if the output looks similar to the
978 following line, the APEX installation is realized.
979
980 .. container:: listingblock
981
982 .. container:: content
983
ramverma760cce92019-07-11 12:57:49 +0000984 .. code::
ramverma3b71c972019-07-10 11:25:37 +0000985 :number-lines:
986
987 Starting Apex service with parameters [] . . .
988 start of Apex service failed: Apex configuration file was not specified as an argument
989 2018-09-03 13:11:33,914 Apex [main] ERROR o.o.p.a.service.engine.main.ApexMain - start of Apex service failed
990 org.onap.policy.apex.model.basicmodel.concepts.ApexException: Apex configuration file was not specified as an argument
991 at org.onap.policy.apex.service.engine.main.ApexCommandLineArguments.validateReadableFile(ApexCommandLineArguments.java:267)
992 at org.onap.policy.apex.service.engine.main.ApexCommandLineArguments.validate(ApexCommandLineArguments.java:161)
993 at org.onap.policy.apex.service.engine.main.ApexMain.<init>(ApexMain.java:68)
994 at org.onap.policy.apex.service.engine.main.ApexMain.main(ApexMain.java:165)
995 usage: org.onap.policy.apex.service.engine.main.ApexMain [options...]
996 options
997 -c,--config-file <CONFIG_FILE>the full path to the configuration file to use, the configuration file must be a Json file
998 containing the Apex configuration parameters
999 -h,--help outputs the usage of this command
1000 -m,--model-file <MODEL_FILE> the full path to the model file to use, if set it overrides the model file set in the
1001 configuration file
1002 -v,--version outputs the version of Apex
1003
1004Verify Installation - run an Example
1005####################################
1006
1007 .. container:: paragraph
1008
1009 A full APEX installation comes with several examples. Here, we can
1010 fully verify the installation by running one of the examples.
1011
1012 .. container:: paragraph
1013
1014 We use the example called *SampleDomain* and configure the engine
1015 to use standard in and standard out for events. Run the engine
1016 with the provided configuration. Note: Cygwin executes scripts as
1017 Unix scripts but runs Java as a Windows application, thus the
1018 configuration file must be given as a Windows path.
1019
liamfallon9c7bd672019-10-03 13:42:08 +01001020 .. container:: paragraph
1021
1022 On Unix/Linux flavoured platforms, give the commands below:
1023
ramverma3b71c972019-07-10 11:25:37 +00001024 .. container:: listingblock
1025
1026 .. container:: content
1027
aditya.puthuparambil9e67eb72020-04-30 15:59:43 +01001028 .. code::
liamfallon9c7bd672019-10-03 13:42:08 +01001029 :number-lines:
ramverma3b71c972019-07-10 11:25:37 +00001030
aditya.puthuparambil9e67eb72020-04-30 15:59:43 +01001031 sudo su - apexuser
1032 export APEX_HOME <path to apex installation>
1033 export APEX_USER apexuser
liamfallon9c7bd672019-10-03 13:42:08 +01001034
1035 .. container:: paragraph
1036
1037 You can now try to run apex.
1038
1039 .. container:: listingblock
1040
1041 .. container:: content
1042
aditya.puthuparambil9e67eb72020-04-30 15:59:43 +01001043 .. code::
liamfallon9c7bd672019-10-03 13:42:08 +01001044 :number-lines:
1045
1046 # $APEX_HOME/bin/apexEngine.sh -c $APEX_HOME/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json (1)
1047 # $APEX_HOME/bin/apexEngine.sh -c C:/apex/apex-full-2.0.0-SNAPSHOT/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json (2)
1048 >%APEX_HOME%\bin\apexEngine.bat -c %APEX_HOME%\examples\config\SampleDomain\Stdin2StdoutJsonEventJava.json :: (3)
ramverma3b71c972019-07-10 11:25:37 +00001049
1050.. container:: colist arabic
1051
1052 +-------+---------+
1053 | **1** | UNIX |
1054 +-------+---------+
1055 | **2** | Cygwin |
1056 +-------+---------+
1057 | **3** | Windows |
1058 +-------+---------+
1059
1060.. container:: paragraph
1061
liamfallon9c7bd672019-10-03 13:42:08 +01001062 The engine should start successfully. Assuming the logging levels are set to ``info`` in the built system, the output
1063 should look similar to this (last few lines)
ramverma3b71c972019-07-10 11:25:37 +00001064
1065.. container:: listingblock
1066
1067 .. container:: content
1068
ramverma760cce92019-07-11 12:57:49 +00001069 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001070 :number-lines:
1071
1072 Starting Apex service with parameters [-c, v:/dev/ericsson/apex/onap/apex-pdp/packages/apex-pdp-package-full/target/install_hierarchy/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json] . . .
1073 2018-09-05 15:16:42,800 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-0:0.0.1 .
1074 2018-09-05 15:16:42,804 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-1:0.0.1 .
1075 2018-09-05 15:16:42,804 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-2:0.0.1 .
1076 2018-09-05 15:16:42,805 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-3:0.0.1 .
1077 2018-09-05 15:16:42,805 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - APEX service created.
1078 2018-09-05 15:16:43,962 Apex [main] INFO o.o.p.a.s.e.e.EngDepMessagingService - engine<-->deployment messaging starting . . .
1079 2018-09-05 15:16:43,963 Apex [main] INFO o.o.p.a.s.e.e.EngDepMessagingService - engine<-->deployment messaging started
1080 2018-09-05 15:16:44,987 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Registering apex model on engine MyApexEngine-0:0.0.1
1081 2018-09-05 15:16:45,112 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Registering apex model on engine MyApexEngine-1:0.0.1
1082 2018-09-05 15:16:45,113 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Registering apex model on engine MyApexEngine-2:0.0.1
1083 2018-09-05 15:16:45,113 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Registering apex model on engine MyApexEngine-3:0.0.1
1084 2018-09-05 15:16:45,120 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Added the action listener to the engine
1085 Started Apex service
1086
1087.. container:: paragraph
1088
1089 Important are the last two line, stating that APEX has added the
1090 final action listener to the engine and that the engine is started.
1091
1092.. container:: paragraph
1093
1094 The engine is configured to read events from standard input and write
1095 produced events to standard output. The policy model is a very simple
1096 policy.
1097
1098.. container:: paragraph
1099
1100 The following table shows an input event in the left column and an
1101 output event in the right column. Past the input event into the
1102 console where APEX is running, and the output event should appear in
1103 the console. Pasting the input event multiple times will produce
1104 output events with different values.
1105
1106+-------------------------------------------------------------+-------------------------------------------------------------+
1107| Input Event | Example Output Event |
1108+=============================================================+=============================================================+
1109| .. container:: | .. container:: |
1110| | |
1111| .. container:: content | .. container:: content |
1112| | |
1113| .. code:: | .. code:: |
1114| :number-lines: | :number-lines: |
1115| | |
1116| { | { |
1117| "nameSpace": "org.onap.policy.apex.sample.events", | "name": "Event0004", |
1118| "name": "Event0000", | "version": "0.0.1", |
1119| "version": "0.0.1", | "nameSpace": "org.onap.policy.apex.sample.events", |
1120| "source": "test", | "source": "Act", |
1121| "target": "apex", | "target": "Outside", |
1122| "TestSlogan": "Test slogan for External Event0", | "TestActCaseSelected": 2, |
1123| "TestMatchCase": 0, | "TestActStateTime": 1536157104627, |
1124| "TestTimestamp": 1469781869269, | "TestDecideCaseSelected": 0, |
1125| "TestTemperature": 9080.866 | "TestDecideStateTime": 1536157104625, |
1126| } | "TestEstablishCaseSelected": 0, |
1127| | "TestEstablishStateTime": 1536157104623, |
1128| | "TestMatchCase": 0, |
1129| | "TestMatchCaseSelected": 1, |
1130| | "TestMatchStateTime": 1536157104620, |
1131| | "TestSlogan": "Test slogan for External Event0", |
1132| | "TestTemperature": 9080.866, |
1133| | "TestTimestamp": 1469781869269 |
1134| | } |
1135+-------------------------------------------------------------+-------------------------------------------------------------+
1136
1137.. container:: paragraph
1138
1139 Terminate APEX by simply using ``CTRL+C`` in the console.
1140
1141Verify a Full Installation - REST Editor
1142########################################
1143
1144 .. container:: paragraph
1145
1146 APEX has a REST application for viewing policy models. The
1147 application can also be used to create new policy models close to
1148 the engine native policy language. Start the REST editor as
1149 follows.
1150
1151 .. container:: listingblock
1152
1153 .. container:: content
1154
ramverma760cce92019-07-11 12:57:49 +00001155 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001156 :number-lines:
1157
1158 # $APEX_HOME/bin/apexApps.sh rest-editor
1159
1160.. container:: listingblock
1161
1162 .. container:: content
1163
ramverma760cce92019-07-11 12:57:49 +00001164 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001165 :number-lines:
1166
1167 >%APEX_HOME%\bin\apexApps.bat rest-editor
1168
1169.. container:: paragraph
1170
1171 The script will start a simple web server
1172 (`Grizzly <https://javaee.github.io/grizzly/>`__) and deploy a
1173 ``war`` web archive in it. Once the editor is started, it will be
1174 available on ``localhost:18989``. The last few line of the messages
1175 should be:
1176
1177.. container:: listingblock
1178
1179 .. container:: content
1180
ramverma760cce92019-07-11 12:57:49 +00001181 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001182 :number-lines:
1183
1184 Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
1185 Sep 05, 2018 10:35:57 PM org.glassfish.grizzly.http.server.NetworkListener start
1186 INFO: Started listener bound to [localhost:18989]
1187 Sep 05, 2018 10:35:57 PM org.glassfish.grizzly.http.server.HttpServer start
1188 INFO: [HttpServer] Started.
1189 Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
1190
1191.. container:: paragraph
1192
1193 Now open a browser (Firefox, Chrome, Opera, Internet Explorer) and
1194 use the URL ``http://localhost:18989/``. This will connect the
1195 browser to the started REST editor. The start screen should be as
1196 follows.
1197
1198.. container:: imageblock
1199
1200 .. container:: content
1201
1202 |REST Editor Start Screen|
1203
1204 .. container:: title
1205
1206 Figure 1. REST Editor Start Screen
1207
1208.. container:: paragraph
1209
1210 Now load a policy model by clicking the menu ``File`` and then
1211 ``Open``. In the opened dialog, go to the directory where APEX is
1212 installed, then ``examples``, ``models``, ``SampleDomain``, and there
1213 select the file ``SamplePolicyModelJAVA.json``. This will load the
1214 policy model used to verify the policy engine (see above). Once
1215 loaded, the screen should look as follows.
1216
1217.. container:: imageblock
1218
1219 .. container:: content
1220
1221 |REST Editor with loaded SampleDomain Policy Model|
1222
1223 .. container:: title
1224
1225 Figure 2. REST Editor with loaded SampleDomain Policy Model
1226
1227.. container:: paragraph
1228
1229 Now you can use the REST editor. To finish this verification, simply
1230 terminate your browser (or the tab), and then use ``CTRL+C`` in the
1231 console where you started the REST editor.
1232
1233Installing WAR Applications
1234---------------------------
1235
1236 .. container:: paragraph
1237
1238 APEX comes with a set of WAR files. These are complete
1239 applications that can be installed and run in an application
1240 server. All of these applications are realized as servlets. You
1241 can find the WAR applications in ``$APEX_HOME/war`` (UNIX, Cygwin)
1242 or ``%APEX_HOME%\war`` (Windows).
1243
1244 .. container:: paragraph
1245
1246 Installing and using the WAR applications requires a web server
1247 that can execute ``war`` web archives. We recommend to use `Apache
1248 Tomcat <https://tomcat.apache.org/>`__, however other web servers
1249 can be used as well.
1250
1251 .. container:: paragraph
1252
1253 Install Apache Tomcat including the ``Manager App``, see `V9.0
1254 Docs <https://tomcat.apache.org/tomcat-9.0-doc/manager-howto.html#Configuring_Manager_Application_Access>`__
1255 for details. Start the Tomcat service, or make sure that Tomcat is
1256 running.
1257
1258 .. container:: paragraph
1259
1260 There are multiple ways to install the APEX WAR applications:
1261
1262 .. container:: ulist
1263
1264 - copy the ``.war`` file into the Tomcat ``webapps`` folder
1265
1266 - use the Tomcat ``Manager App`` to deploy via the web interface
1267
1268 - deploy using a REST call to Tomcat
1269
1270 .. container:: paragraph
1271
1272 For details on how to install ``war`` files please consult the
1273 `Tomcat
1274 Documentation <https://tomcat.apache.org/tomcat-9.0-doc/index.html>`__
1275 or the `Manager App
1276 HOW-TO <https://tomcat.apache.org/tomcat-9.0-doc/manager-howto.html>`__.
1277 Once you installed an APEX WAR application (and wait for
1278 sufficient time for Tomcat to finalize the installation), open the
1279 ``Manager App`` in Tomcat. You should see the APEX WAR application
1280 being installed and running.
1281
1282 .. container:: paragraph
1283
1284 In case of errors, examine the log files in the Tomcat log
1285 directory. In a conventional install, those log files are in the
1286 logs directory where Tomcat is installed.
1287
1288 .. container:: paragraph
1289
1290 The current APEX version provides the following WAR applications:
1291
1292 .. container:: ulist
1293
1294 - client-deployment-2.0.0-SNAPSHOT.war - a client to deploy new
1295 policy models to a running engine
1296
1297 - client-editor-2.0.0-SNAPSHOT.war - the standard policy REST
1298 editor GUI
1299
1300 - client-monitoring-2.0.0-SNAPSHOT.war - a client for monitoring
1301 a running APEX engine
1302
1303 - client-full-2.0.0-SNAPSHOT.war - a full client with a
1304 one-stop-access to deployment, monitoring, and REST editor
1305
1306 - examples-servlet-2.0.0-SNAPSHOT.war - an example APEX servlet
1307
1308Running APEX in Docker
1309----------------------
1310
1311 .. container:: paragraph
1312
1313 Since APEX is in ONAP, we provide a full virtualization
1314 environment for the engine.
1315
1316Run in ONAP
1317###########
1318
1319 .. container:: paragraph
1320
1321 Running APEX from the ONAP docker repository only requires 2
1322 commands:
1323
1324 .. container:: olist arabic
1325
1326 #. Log into the ONAP docker repo
1327
1328 .. container:: listingblock
1329
1330 .. container:: content
1331
1332 ::
1333
1334 docker login -u docker -p docker nexus3.onap.org:10003
1335
1336 .. container:: olist arabic
1337
1338 #. Run the APEX docker image
1339
1340 .. container:: listingblock
1341
1342 .. container:: content
1343
1344 ::
1345
1346 docker run -it --rm nexus3.onap.org:10003/onap/policy-apex-pdp:latest
1347
1348Build a Docker Image
1349####################
1350
1351 .. container:: paragraph
1352
1353 Alternatively, one can use the Dockerfile defined in the Docker
1354 package to build an image.
1355
1356 .. container:: listingblock
1357
1358 .. container:: title
1359
1360 APEX Dockerfile
1361
1362 .. container:: content
1363
ramverma760cce92019-07-11 12:57:49 +00001364 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001365 :number-lines:
1366
1367 #
1368 # Docker file to build an image that runs APEX on Java 8 in Ubuntu
1369 #
1370 FROM ubuntu:16.04
1371
1372 RUN apt-get update && \
1373 apt-get upgrade -y && \
1374 apt-get install -y software-properties-common && \
1375 add-apt-repository ppa:openjdk-r/ppa -y && \
1376 apt-get update && \
1377 apt-get install -y openjdk-8-jdk
1378
1379 # Create apex user and group
1380 RUN groupadd apexuser
1381 RUN useradd --create-home -g apexuser apexuser
1382
1383 # Add Apex-specific directories and set ownership as the Apex admin user
1384 RUN mkdir -p /opt/app/policy/apex-pdp
1385 RUN mkdir -p /var/log/onap/policy/apex-pdp
1386 RUN chown -R apexuser:apexuser /var/log/onap/policy/apex-pdp
1387
1388 # Unpack the tarball
1389 RUN mkdir /packages
1390 COPY apex-pdp-package-full.tar.gz /packages
1391 RUN tar xvfz /packages/apex-pdp-package-full.tar.gz --directory /opt/app/policy/apex-pdp
1392 RUN rm /packages/apex-pdp-package-full.tar.gz
1393
1394 # Ensure everything has the correct permissions
1395 RUN find /opt/app -type d -perm 755
1396 RUN find /opt/app -type f -perm 644
1397 RUN chmod a+x /opt/app/policy/apex-pdp/bin/*
1398
1399 # Copy examples to Apex user area
1400 RUN cp -pr /opt/app/policy/apex-pdp/examples /home/apexuser
1401
1402 RUN apt-get clean
1403
1404 RUN chown -R apexuser:apexuser /home/apexuser/*
1405
1406 USER apexuser
1407 ENV PATH /opt/app/policy/apex-pdp/bin:$PATH
1408 WORKDIR /home/apexuser
1409
1410APEX Configurations Explained
1411^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1412
1413Introduction to APEX Configuration
1414----------------------------------
1415
1416 .. container:: paragraph
1417
1418 An APEX engine can be configured to use various combinations
1419 of event input handlers, event output handlers, event
1420 protocols, context handlers, and logic executors. The system
1421 is build using a plugin architecture. Each configuration
1422 option is realized by a plugin, which can be loaded and
1423 configured when the engine is started. New plugins can be
1424 added to the system at any time, though to benefit from a
1425 new plugin an engine will need to be restarted.
1426
1427 .. container:: imageblock
1428
1429 .. container:: content
1430
1431 |APEX Configuration Matrix|
1432
1433 .. container:: title
1434
1435 Figure 3. APEX Configuration Matrix
1436
1437 .. container:: paragraph
1438
1439 The APEX distribution already comes with a number of
1440 plugins. The figure above shows the provided plugins. Any
1441 combination of input, output, event protocol, context
1442 handlers, and executors is possible.
1443
1444General Configuration Format
1445----------------------------
1446
1447 .. container:: paragraph
1448
1449 The APEX configuration file is a JSON file containing a few
1450 main blocks for different parts of the configuration. Each
1451 block then holds the configuration details. The following
1452 code shows the main blocks:
1453
1454 .. container:: listingblock
1455
1456 .. container:: content
1457
ramverma760cce92019-07-11 12:57:49 +00001458 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001459
1460 {
1461 "engineServiceParameters":{
1462 ... (1)
1463 "engineParameters":{ (2)
a.sreekumarcc0e9172020-03-16 13:36:45 +00001464 "executorParameters":{...}, (3)
ramverma3b71c972019-07-10 11:25:37 +00001465 "contextParameters":{...} (4)
a.sreekumarcc0e9172020-03-16 13:36:45 +00001466 "taskParameters":[...] (5)
ramverma3b71c972019-07-10 11:25:37 +00001467 }
1468 },
a.sreekumarcc0e9172020-03-16 13:36:45 +00001469 "eventInputParameters":{ (6)
1470 "input1":{ (7)
ramverma3b71c972019-07-10 11:25:37 +00001471 "carrierTechnologyParameters":{...},
1472 "eventProtocolParameters":{...}
1473 },
a.sreekumarcc0e9172020-03-16 13:36:45 +00001474 "input2":{...}, (8)
ramverma3b71c972019-07-10 11:25:37 +00001475 "carrierTechnologyParameters":{...},
1476 "eventProtocolParameters":{...}
1477 },
a.sreekumarcc0e9172020-03-16 13:36:45 +00001478 ... (9)
ramverma3b71c972019-07-10 11:25:37 +00001479 },
a.sreekumarcc0e9172020-03-16 13:36:45 +00001480 "eventOutputParameters":{ (10)
1481 "output1":{ (11)
ramverma3b71c972019-07-10 11:25:37 +00001482 "carrierTechnologyParameters":{...},
1483 "eventProtocolParameters":{...}
1484 },
a.sreekumarcc0e9172020-03-16 13:36:45 +00001485 "output2":{ (12)
ramverma3b71c972019-07-10 11:25:37 +00001486 "carrierTechnologyParameters":{...},
1487 "eventProtocolParameters":{...}
1488 },
a.sreekumarcc0e9172020-03-16 13:36:45 +00001489 ... (13)
ramverma3b71c972019-07-10 11:25:37 +00001490 }
1491 }
1492
1493 .. container:: colist arabic
1494
1495 +-----------------------------------+-----------------------------------+
1496 | **1** | main engine configuration |
1497 +-----------------------------------+-----------------------------------+
1498 | **2** | engine parameters for plugin |
1499 | | configurations (execution |
1500 | | environments and context |
1501 | | handling) |
1502 +-----------------------------------+-----------------------------------+
1503 | **3** | engine specific parameters, |
1504 | | mainly for executor plugins |
1505 +-----------------------------------+-----------------------------------+
1506 | **4** | context specific parameters, e.g. |
1507 | | for context schemas, persistence, |
1508 | | etc. |
1509 +-----------------------------------+-----------------------------------+
a.sreekumarcc0e9172020-03-16 13:36:45 +00001510 | **5** | list of task parameters that |
1511 | | should be made available in task |
1512 | | logic (optional). |
1513 +-----------------------------------+-----------------------------------+
1514 | **6** | configuration of the input |
ramverma3b71c972019-07-10 11:25:37 +00001515 | | interface |
1516 +-----------------------------------+-----------------------------------+
a.sreekumarcc0e9172020-03-16 13:36:45 +00001517 | **7** | an example input called |
ramverma3b71c972019-07-10 11:25:37 +00001518 | | ``input1`` with carrier |
1519 | | technology and event protocol |
1520 +-----------------------------------+-----------------------------------+
a.sreekumarcc0e9172020-03-16 13:36:45 +00001521 | **8** | an example input called |
ramverma3b71c972019-07-10 11:25:37 +00001522 | | ``input2`` with carrier |
1523 | | technology and event protocol |
1524 +-----------------------------------+-----------------------------------+
a.sreekumarcc0e9172020-03-16 13:36:45 +00001525 | **9** | any further input configuration |
ramverma3b71c972019-07-10 11:25:37 +00001526 +-----------------------------------+-----------------------------------+
a.sreekumarcc0e9172020-03-16 13:36:45 +00001527 | **10** | configuration of the output |
ramverma3b71c972019-07-10 11:25:37 +00001528 | | interface |
1529 +-----------------------------------+-----------------------------------+
a.sreekumarcc0e9172020-03-16 13:36:45 +00001530 | **11** | an example output called |
ramverma3b71c972019-07-10 11:25:37 +00001531 | | ``output1`` with carrier |
1532 | | technology and event protocol |
1533 +-----------------------------------+-----------------------------------+
a.sreekumarcc0e9172020-03-16 13:36:45 +00001534 | **12** | an example output called |
ramverma3b71c972019-07-10 11:25:37 +00001535 | | ``output2`` with carrier |
1536 | | technology and event protocol |
1537 +-----------------------------------+-----------------------------------+
a.sreekumarcc0e9172020-03-16 13:36:45 +00001538 | **13** | any further output configuration |
ramverma3b71c972019-07-10 11:25:37 +00001539 +-----------------------------------+-----------------------------------+
1540
1541Engine Service Parameters
1542-------------------------
1543
1544 .. container:: paragraph
1545
1546 The configuration provides a number of parameters to
1547 configure the engine. An example configuration with
1548 explanations of all options is shown below.
1549
1550 .. container:: listingblock
1551
1552 .. container:: content
1553
ramverma760cce92019-07-11 12:57:49 +00001554 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001555
1556 "engineServiceParameters" : {
1557 "name" : "AADMApexEngine", (1)
1558 "version" : "0.0.1", (2)
1559 "id" : 45, (3)
1560 "instanceCount" : 4, (4)
1561 "deploymentPort" : 12345, (5)
1562 "policyModelFileName" : "examples/models/VPN/VPNPolicyModelJava.json", (6)
1563 "periodicEventPeriod": 1000, (7)
1564 "engineParameters":{ (8)
a.sreekumarcc0e9172020-03-16 13:36:45 +00001565 "executorParameters":{...}, (9)
1566 "contextParameters":{...}, (10)
1567 "taskParameters":[...] (11)
ramverma3b71c972019-07-10 11:25:37 +00001568 }
1569 }
1570
1571 .. container:: colist arabic
1572
1573 +-----------------------------------+-----------------------------------+
1574 | **1** | a name for the engine. The engine |
1575 | | name is used to create a key in a |
1576 | | runtime engine. An name matching |
1577 | | the following regular expression |
1578 | | can be used here: |
1579 | | ``[A-Za-z0-9\\-_\\.]+`` |
1580 +-----------------------------------+-----------------------------------+
1581 | **2** | a version of the engine, use |
1582 | | semantic versioning as explained |
1583 | | here: `Semantic |
1584 | | Versioning <http://semver.org/>`_ |
1585 | | _. |
1586 | | This version is used in a runtime |
1587 | | engine to create a version of the |
1588 | | engine. For that reason, the |
1589 | | version must match the following |
1590 | | regular expression ``[A-Z0-9.]+`` |
1591 +-----------------------------------+-----------------------------------+
1592 | **3** | a numeric identifier for the |
1593 | | engine |
1594 +-----------------------------------+-----------------------------------+
1595 | **4** | the number of threads (policy |
1596 | | instances executed in parallel) |
1597 | | the engine should use, use ``1`` |
1598 | | for single threaded engines |
1599 +-----------------------------------+-----------------------------------+
1600 | **5** | the port for the deployment |
1601 | | Websocket connection to the |
1602 | | engine |
1603 +-----------------------------------+-----------------------------------+
1604 | **6** | the model file to load into the |
1605 | | engine on startup (optional) |
1606 +-----------------------------------+-----------------------------------+
1607 | **7** | an optional timer for periodic |
1608 | | policies, in milliseconds (a |
1609 | | defined periodic policy will be |
1610 | | executed every ``X`` |
1611 | | milliseconds), not used of not |
1612 | | set or ``0`` |
1613 +-----------------------------------+-----------------------------------+
1614 | **8** | engine parameters for plugin |
1615 | | configurations (execution |
1616 | | environments and context |
1617 | | handling) |
1618 +-----------------------------------+-----------------------------------+
1619 | **9** | engine specific parameters, |
1620 | | mainly for executor plugins |
1621 +-----------------------------------+-----------------------------------+
1622 | **10** | context specific parameters, e.g. |
1623 | | for context schemas, persistence, |
1624 | | etc. |
1625 +-----------------------------------+-----------------------------------+
a.sreekumarcc0e9172020-03-16 13:36:45 +00001626 | **11** | list of task parameters that |
1627 | | should be made available in task |
1628 | | logic (optional). |
1629 +-----------------------------------+-----------------------------------+
ramverma3b71c972019-07-10 11:25:37 +00001630
1631 .. container:: paragraph
1632
1633 The model file is optional, it can also be specified via
1634 command line. In any case, make sure all execution and other
1635 required plug-ins for the loaded model are loaded as
1636 required.
1637
1638Input and Output Interfaces
1639---------------------------
1640
1641 .. container:: paragraph
1642
1643 An APEX engine has two main interfaces:
1644
1645 .. container:: ulist
1646
1647 - An *input* interface to receive events: also known as
1648 ingress interface or consumer, receiving (consuming)
1649 events commonly named triggers, and
1650
1651 - An *output* interface to publish produced events: also
1652 known as egress interface or producer, sending
1653 (publishing) events commonly named actions or action
1654 events.
1655
1656 .. container:: paragraph
1657
1658 The input and output interface is configured in terms of
1659 inputs and outputs, respectively. Each input and output is a
1660 combination of a carrier technology and an event protocol.
1661 Carrier technologies and event protocols are provided by
1662 plugins, each with its own specific configuration. Most
1663 carrier technologies can be configured for input as well as
1664 output. Most event protocols can be used for all carrier
1665 technologies. One exception is the JMS object event
1666 protocol, which can only be used for the JMS carrier
1667 technology. Some further restrictions apply (for instance
1668 for carrier technologies using bi- or uni-directional
1669 modes).
1670
1671 .. container:: paragraph
1672
1673 Input and output interface can be configured separately, in
1674 isolation, with any number of carrier technologies. The
1675 resulting general configuration options are:
1676
1677 .. container:: ulist
1678
1679 - Input interface with one or more inputs
1680
1681 .. container:: ulist
1682
1683 - each input with a carrier technology and an event
1684 protocol
1685
1686 - some inputs with optional synchronous mode
1687
1688 - some event protocols with additional parameters
1689
1690 - Output interface with one or more outputs
1691
1692 .. container:: ulist
1693
1694 - each output with a carrier technology and an event
1695 encoding
1696
1697 - some outputs with optional synchronous mode
1698
1699 - some event protocols with additional parameters
1700
1701 .. container:: paragraph
1702
1703 The configuration for input and output is contained in
1704 ``eventInputParameters`` and ``eventOutputParameters``,
1705 respectively. Inside here, one can configure any number of
1706 inputs and outputs. Each of them needs to have a unique
1707 identifier (name), the content of the name is free form. The
1708 example below shows a configuration for two inputs and two
1709 outputs.
1710
1711 .. container:: listingblock
1712
1713 .. container:: content
1714
ramverma760cce92019-07-11 12:57:49 +00001715 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001716
1717 "eventInputParameters": { (1)
1718 "FirstConsumer": { (2)
1719 "carrierTechnologyParameters" : {...}, (3)
1720 "eventProtocolParameters":{...}, (4)
1721 ... (5)
1722 },
1723 "SecondConsumer": { (6)
1724 "carrierTechnologyParameters" : {...}, (7)
1725 "eventProtocolParameters":{...}, (8)
1726 ... (9)
1727 },
1728 },
1729 "eventOutputParameters": { (10)
1730 "FirstProducer": { (11)
1731 "carrierTechnologyParameters":{...}, (12)
1732 "eventProtocolParameters":{...}, (13)
1733 ... (14)
1734 },
1735 "SecondProducer": { (15)
1736 "carrierTechnologyParameters":{...}, (16)
1737 "eventProtocolParameters":{...}, (17)
1738 ... (18)
1739 }
1740 }
1741
1742 .. container:: colist arabic
1743
1744 +--------+--------------------------------------------------------------------+
1745 | **1** | input interface configuration, APEX input plugins |
1746 +--------+--------------------------------------------------------------------+
1747 | **2** | first input called ``FirstConsumer`` |
1748 +--------+--------------------------------------------------------------------+
1749 | **3** | carrier technology for plugin |
1750 +--------+--------------------------------------------------------------------+
1751 | **4** | event protocol for plugin |
1752 +--------+--------------------------------------------------------------------+
1753 | **5** | any other input configuration (e.g. event name filter, see below) |
1754 +--------+--------------------------------------------------------------------+
1755 | **6** | second input called ``SecondConsumer`` |
1756 +--------+--------------------------------------------------------------------+
1757 | **7** | carrier technology for plugin |
1758 +--------+--------------------------------------------------------------------+
1759 | **8** | event protocol for plugin |
1760 +--------+--------------------------------------------------------------------+
1761 | **9** | any other plugin configuration |
1762 +--------+--------------------------------------------------------------------+
1763 | **10** | output interface configuration, APEX output plugins |
1764 +--------+--------------------------------------------------------------------+
1765 | **11** | first output called ``FirstProducer`` |
1766 +--------+--------------------------------------------------------------------+
1767 | **12** | carrier technology for plugin |
1768 +--------+--------------------------------------------------------------------+
1769 | **13** | event protocol for plugin |
1770 +--------+--------------------------------------------------------------------+
1771 | **14** | any other plugin configuration |
1772 +--------+--------------------------------------------------------------------+
1773 | **15** | second output called ``SecondProducer`` |
1774 +--------+--------------------------------------------------------------------+
1775 | **16** | carrier technology for plugin |
1776 +--------+--------------------------------------------------------------------+
1777 | **17** | event protocol for plugin |
1778 +--------+--------------------------------------------------------------------+
1779 | **18** | any other output configuration (e.g. event name filter, see below) |
1780 +--------+--------------------------------------------------------------------+
1781
1782Event Filters
1783#############
1784
1785 .. container:: paragraph
1786
1787 APEX will always send an event after a policy execution
1788 is finished. For a successful execution, the event sent
1789 is the output event created by the policy. In case the
1790 policy does not create an output event, APEX will create
1791 a new event with all input event fields plus an
1792 additional field ``exceptionMessage`` with an exception
1793 message.
1794
1795 .. container:: paragraph
1796
1797 There are situations in which this auto-generated error
1798 event might not be required or wanted:
1799
1800 .. container:: ulist
1801
1802 - when a policy failing should not result in an event
1803 send out via an output interface
1804
1805 - when the auto-generated event goes back in an APEX
1806 engine (or the same APEX engine), this can create
1807 endless loops
1808
1809 - the auto-generated event should go to a special output
1810 interface or channel
1811
1812 .. container:: paragraph
1813
1814 All of these situations are supported by a filter option
1815 using a wildecard (regular expression) configuration on
1816 APEX I/O interfaces. The parameter is called
1817 ``eventNameFilter`` and the value are `Java regular
1818 expressions <https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html>`__
1819 (a
1820 `tutorial <http://www.vogella.com/tutorials/JavaRegularExpressions/article.html>`__).
1821 The following code shows some examples:
1822
1823 .. container:: listingblock
1824
1825 .. container:: content
1826
ramverma760cce92019-07-11 12:57:49 +00001827 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001828
1829 "eventInputParameters": {
1830 "Input1": {
1831 "carrierTechnologyParameters" : {...},
1832 "eventProtocolParameters":{...},
1833 "eventNameFilter" : "^E[Vv][Ee][Nn][Tt][0-9]004$" (1)
1834 }
1835 },
1836 "eventOutputParameters": {
1837 "Output1": {
1838 "carrierTechnologyParameters":{...},
1839 "eventProtocolParameters":{...},
1840 "eventNameFilter" : "^E[Vv][Ee][Nn][Tt][0-9]104$" (2)
1841 }
1842 }
1843
1844Executors
1845---------
1846
1847 .. container:: paragraph
1848
1849 Executors are plugins that realize the execution of logic
1850 contained in a policy model. Logic can be in a task
1851 selector, a task, and a state finalizer. Using plugins for
1852 execution environments makes APEX very flexible to support
1853 virtually any executable logic expressions.
1854
1855 .. container:: paragraph
1856
1857 APEX 2.0.0-SNAPSHOT supports the following executors:
1858
1859 .. container:: ulist
1860
1861 - Java, for Java implemented logic
1862
1863 .. container:: ulist
1864
1865 - This executor requires logic implemented using the
1866 APEX Java interfaces.
1867
1868 - Generated JAR files must be in the classpath of the
1869 APEX engine at start time.
1870
1871 - Javascript
1872
1873 - JRuby,
1874
1875 - Jython,
1876
1877 - MVEL
1878
1879 .. container:: ulist
1880
1881 - This executor uses the latest version of the MVEL
1882 engine, which can be very hard to debug and can
1883 produce unwanted side effects during execution
1884
1885Configure the Javascript Executor
1886#################################
1887
1888 .. container:: paragraph
1889
1890 The Javascript executor is added to the configuration as
1891 follows:
1892
1893 .. container:: listingblock
1894
1895 .. container:: content
1896
ramverma760cce92019-07-11 12:57:49 +00001897 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001898
1899 "engineServiceParameters":{
1900 "engineParameters":{
1901 "executorParameters":{
1902 "JAVASCRIPT":{
1903 "parameterClassName" :
1904 "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
1905 }
1906 }
1907 }
1908 }
1909
1910Configure the Jython Executor
1911#############################
1912
1913 .. container:: paragraph
1914
1915 The Jython executor is added to the configuration as
1916 follows:
1917
1918 .. container:: listingblock
1919
1920 .. container:: content
1921
ramverma760cce92019-07-11 12:57:49 +00001922 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001923
1924 "engineServiceParameters":{
1925 "engineParameters":{
1926 "executorParameters":{
1927 "JYTHON":{
1928 "parameterClassName" :
1929 "org.onap.policy.apex.plugins.executor.jython.JythonExecutorParameters"
1930 }
1931 }
1932 }
1933 }
1934
1935Configure the JRuby Executor
1936############################
1937
1938 .. container:: paragraph
1939
1940 The JRuby executor is added to the configuration as
1941 follows:
1942
1943 .. container:: listingblock
1944
1945 .. container:: content
1946
ramverma760cce92019-07-11 12:57:49 +00001947 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001948
1949 "engineServiceParameters":{
1950 "engineParameters":{
1951 "executorParameters":{
1952 "JRUBY":{
1953 "parameterClassName" :
1954 "org.onap.policy.apex.plugins.executor.jruby.JrubyExecutorParameters"
1955 }
1956 }
1957 }
1958 }
1959
1960Configure the Java Executor
1961###########################
1962
1963 .. container:: paragraph
1964
1965 The Java executor is added to the configuration as
1966 follows:
1967
1968 .. container:: listingblock
1969
1970 .. container:: content
1971
ramverma760cce92019-07-11 12:57:49 +00001972 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001973
1974 "engineServiceParameters":{
1975 "engineParameters":{
1976 "executorParameters":{
1977 "JAVA":{
1978 "parameterClassName" :
1979 "org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters"
1980 }
1981 }
1982 }
1983 }
1984
1985Configure the MVEL Executor
1986###########################
1987
1988 .. container:: paragraph
1989
1990 The MVEL executor is added to the configuration as
1991 follows:
1992
1993 .. container:: listingblock
1994
1995 .. container:: content
1996
ramverma760cce92019-07-11 12:57:49 +00001997 .. code::
ramverma3b71c972019-07-10 11:25:37 +00001998
1999 "engineServiceParameters":{
2000 "engineParameters":{
2001 "executorParameters":{
2002 "MVEL":{
2003 "parameterClassName" :
2004 "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters"
2005 }
2006 }
2007 }
2008 }
2009
2010Context Handlers
2011----------------
2012
2013 .. container:: paragraph
2014
2015 Context handlers are responsible for all context processing.
2016 There are the following main areas:
2017
2018 .. container:: ulist
2019
2020 - Context schema: use schema handlers other than Java class
2021 (supported by default without configuration)
2022
2023 - Context distribution: distribute context across multiple
2024 APEX engines
2025
2026 - Context locking: mechanisms to lock context elements for
2027 read/write
2028
2029 - Context persistence: mechanisms to persist context
2030
2031 .. container:: paragraph
2032
2033 APEX provides plugins for each of the main areas.
2034
2035Configure AVRO Schema Handler
2036#############################
2037
2038 .. container:: paragraph
2039
2040 The AVRO schema handler is added to the configuration as
2041 follows:
2042
2043 .. container:: listingblock
2044
2045 .. container:: content
2046
ramverma760cce92019-07-11 12:57:49 +00002047 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002048
2049 "engineServiceParameters":{
2050 "engineParameters":{
2051 "contextParameters":{
2052 "parameterClassName" : "org.onap.policy.apex.context.parameters.ContextParameters",
2053 "schemaParameters":{
2054 "Avro":{
2055 "parameterClassName" :
2056 "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
2057 }
2058 }
2059 }
2060 }
2061 }
2062
2063 .. container:: paragraph
2064
2065 Using the AVRO schema handler has one limitation: AVRO
2066 only supports field names that represent valid Java class
2067 names. This means only letters and the character ``_``
2068 are supported. Characters commonly used in field names,
2069 such as ``.`` and ``-``, are not supported by AVRO. for
2070 more information see `Avro Spec:
2071 Names <https://avro.apache.org/docs/1.8.1/spec.html#names>`__.
2072
2073 .. container:: paragraph
2074
2075 To work with this limitation, the APEX Avro plugin will
2076 parse a given AVRO definition and replace *all*
2077 occurrences of ``.`` and ``-`` with a ``_``. This means
2078 that
2079
2080 .. container:: ulist
2081
2082 - In a policy model, if the AVRO schema defined a field
2083 as ``my-name`` the policy logic should access it as
2084 ``my_name``
2085
2086 - In a policy model, if the AVRO schema defined a field
2087 as ``my.name`` the policy logic should access it as
2088 ``my_name``
2089
2090 - There should be no field names that convert to the
2091 same internal name
2092
2093 .. container:: ulist
2094
2095 - For instance the simultaneous use of
2096 ``my_name``, ``my.name``, and ``my-name`` should
2097 be avoided
2098
2099 - If not avoided, the event processing might
2100 create unwanted side effects
2101
2102 - If field names use any other not-supported character,
2103 the AVRO plugin will reject it
2104
2105 .. container:: ulist
2106
2107 - Since AVRO uses lazy initialization, this
2108 rejection might only become visible at runtime
2109
a.sreekumarcc0e9172020-03-16 13:36:45 +00002110Configure Task Parameters
2111#########################
2112
2113 .. container:: paragraph
2114
2115 The Task Parameters are added to the configuration as
2116 follows:
2117
2118 .. container:: listingblock
2119
2120 .. container:: content
2121
2122 .. code::
2123
2124 "engineServiceParameters": {
2125 "engineParameters": {
2126 "taskParameters": [
2127 {
2128 "key": "ParameterKey1",
2129 "value": "ParameterValue1"
2130 },
2131 {
2132 "taskId": "Task_Act0",
2133 "key": "ParameterKey2",
2134 "value": "ParameterValue2"
2135 }
2136 ]
2137 }
2138 }
2139
2140 .. container:: paragraph
2141
2142 TaskParameters can be used to pass parameters from ApexConfig
2143 to the policy logic. In the config, these are optional.
2144 The list of task parameters provided in the config may be added
2145 to the tasks or existing task parameters in the task will be overriden.
2146
2147 .. container:: paragraph
2148
2149 If taskId is provided in ApexConfig for an entry, then that
2150 parameter is updated only for that particular task. Otherwise,
2151 the task parameter is added to all tasks.
2152
ramverma3b71c972019-07-10 11:25:37 +00002153Carrier Technologies
2154--------------------
2155
2156 .. container:: paragraph
2157
2158 Carrier technologies define how APEX receives (input) and
2159 sends (output) events. They can be used in any combination,
2160 using asynchronous or synchronous mode. There can also be
2161 any number of carrier technologies for the input (consume)
2162 and the output (produce) interface.
2163
2164 .. container:: paragraph
2165
2166 Supported *input* technologies are:
2167
2168 .. container:: ulist
2169
2170 - Standard input, read events from the standard input
2171 (console), not suitable for APEX background servers
2172
2173 - File input, read events from a file
2174
2175 - Kafka, read events from a Kafka system
2176
2177 - Websockets, read events from a Websocket
2178
2179 - JMS,
2180
2181 - REST (synchronous and asynchronous), additionally as
2182 client or server
2183
2184 - Event Requestor, allows reading of events that have been
2185 looped back into APEX
2186
2187 .. container:: paragraph
2188
2189 Supported *output* technologies are:
2190
2191 .. container:: ulist
2192
2193 - Standard output, write events to the standard output
2194 (console), not suitable for APEX background servers
2195
2196 - File output, write events to a file
2197
2198 - Kafka, write events to a Kafka system
2199
2200 - Websockets, write events to a Websocket
2201
2202 - JMS
2203
2204 - REST (synchronous and asynchronous), additionally as
2205 client or server
2206
2207 - Event Requestor, allows events to be looped back into
2208 APEX
2209
2210 .. container:: paragraph
2211
2212 New carrier technologies can be added as plugins to APEX or
2213 developed outside APEX and added to an APEX deployment.
2214
2215Standard IO
2216###########
2217
2218 .. container:: paragraph
2219
2220 Standard IO does not require a specific plugin, it is
2221 supported be default.
2222
2223Standard Input
2224==============
2225 .. container:: paragraph
2226
2227 APEX will take events from its standard input. This
2228 carrier is good for testing, but certainly not for a
2229 use case where APEX runs as a server. The
2230 configuration is as follows:
2231
2232 .. container:: listingblock
2233
2234 .. container:: content
2235
2236 ::
2237
2238 "carrierTechnologyParameters" : {
2239 "carrierTechnology" : "FILE", (1)
2240 "parameters" : {
2241 "standardIO" : true (2)
2242 }
2243 }
2244
2245 .. container:: colist arabic
2246
2247 +-------+---------------------------------------+
2248 | **1** | standard input is considered a file |
2249 +-------+---------------------------------------+
2250 | **2** | file descriptor set to standard input |
2251 +-------+---------------------------------------+
2252
2253Standard Output
2254===============
2255
2256 .. container:: paragraph
2257
2258 APEX will send events to its standard output. This
2259 carrier is good for testing, but certainly not for a
2260 use case where APEX runs as a server. The
2261 configuration is as follows:
2262
2263 .. container:: listingblock
2264
2265 .. container:: content
2266
ramverma760cce92019-07-11 12:57:49 +00002267 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002268
2269 "carrierTechnologyParameters" : {
2270 "carrierTechnology" : "FILE", (1)
2271 "parameters" : {
2272 "standardIO" : true (2)
2273 }
2274 }
2275
2276 .. container:: colist arabic
2277
2278 +-------+----------------------------------------+
2279 | **1** | standard output is considered a file |
2280 +-------+----------------------------------------+
2281 | **2** | file descriptor set to standard output |
2282 +-------+----------------------------------------+
2283
22842.7.2. File IO
2285##############
2286
2287 .. container:: paragraph
2288
2289 File IO does not require a specific plugin, it is
2290 supported be default.
2291
2292File Input
2293==========
2294
2295 .. container:: paragraph
2296
2297 APEX will take events from a file. The same file
2298 should not be used as an output. The configuration is
2299 as follows:
2300
2301 .. container:: listingblock
2302
2303 .. container:: content
2304
ramverma760cce92019-07-11 12:57:49 +00002305 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002306
2307 "carrierTechnologyParameters" : {
2308 "carrierTechnology" : "FILE", (1)
2309 "parameters" : {
2310 "fileName" : "examples/events/SampleDomain/EventsIn.xmlfile" (2)
2311 }
2312 }
2313
2314 .. container:: colist arabic
2315
2316 +-------+------------------------------------------+
2317 | **1** | set file input |
2318 +-------+------------------------------------------+
2319 | **2** | the name of the file to read events from |
2320 +-------+------------------------------------------+
2321
2322File Output
2323===========
2324 .. container:: paragraph
2325
2326 APEX will write events to a file. The same file should
2327 not be used as an input. The configuration is as
2328 follows:
2329
2330 .. container:: listingblock
2331
2332 .. container:: content
2333
ramverma760cce92019-07-11 12:57:49 +00002334 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002335
2336 "carrierTechnologyParameters" : {
2337 "carrierTechnology" : "FILE", (1)
2338 "parameters" : {
2339 "fileName" : "examples/events/SampleDomain/EventsOut.xmlfile" (2)
2340 }
2341 }
2342
2343 .. container:: colist arabic
2344
2345 +-------+-----------------------------------------+
2346 | **1** | set file output |
2347 +-------+-----------------------------------------+
2348 | **2** | the name of the file to write events to |
2349 +-------+-----------------------------------------+
2350
2351Event Requestor IO
2352##################
2353
2354 .. container:: paragraph
2355
2356 Event Requestor IO does not require a specific plugin, it
2357 is supported be default. It should only be used with the
2358 APEX event protocol.
2359
2360Event Requestor Input
2361=====================
2362
2363 .. container:: paragraph
2364
2365 APEX will take events from APEX.
2366
2367 .. container:: listingblock
2368
2369 .. container:: content
2370
ramverma760cce92019-07-11 12:57:49 +00002371 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002372
2373 "carrierTechnologyParameters" : {
2374 "carrierTechnology": "EVENT_REQUESTOR" (1)
2375 }
2376
2377 .. container:: colist arabic
2378
2379 +-------+---------------------------+
2380 | **1** | set event requestor input |
2381 +-------+---------------------------+
2382
2383Event Requestor Output
2384======================
2385
2386 .. container:: paragraph
2387
2388 APEX will write events to APEX.
2389
2390 .. container:: listingblock
2391
2392 .. container:: content
2393
ramverma760cce92019-07-11 12:57:49 +00002394 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002395
2396 "carrierTechnologyParameters" : {
2397 "carrierTechnology": "EVENT_REQUESTOR" (1)
2398 }
2399
2400Peering Event Requestors
2401========================
2402
2403 .. container:: paragraph
2404
2405 When using event requestors, they need to be peered.
2406 This means an event requestor output needs to be
2407 peered (associated) with an event requestor input. The
2408 following example shows the use of an event requestor
2409 with the APEX event protocol and the peering of output
2410 and input.
2411
2412 .. container:: listingblock
2413
2414 .. container:: content
2415
ramverma760cce92019-07-11 12:57:49 +00002416 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002417
2418 "eventInputParameters": {
2419 "EventRequestorConsumer": {
2420 "carrierTechnologyParameters": {
2421 "carrierTechnology": "EVENT_REQUESTOR" (1)
2422 },
2423 "eventProtocolParameters": {
2424 "eventProtocol": "APEX" (2)
2425 },
2426 "eventNameFilter": "InputEvent", (3)
2427 "requestorMode": true, (4)
2428 "requestorPeer": "EventRequestorProducer", (5)
2429 "requestorTimeout": 500 (6)
2430 }
2431 },
2432 "eventOutputParameters": {
2433 "EventRequestorProducer": {
2434 "carrierTechnologyParameters": {
2435 "carrierTechnology": "EVENT_REQUESTOR" (7)
2436 },
2437 "eventProtocolParameters": {
2438 "eventProtocol": "APEX" (8)
2439 },
2440 "eventNameFilter": "EventListEvent", (9)
2441 "requestorMode": true, (10)
2442 "requestorPeer": "EventRequestorConsumer", (11)
2443 "requestorTimeout": 500 (12)
2444 }
2445 }
2446
2447 .. container:: colist arabic
2448
2449 +-----------------------------------+-----------------------------------+
2450 | **1** | event requestor on a consumer |
2451 +-----------------------------------+-----------------------------------+
2452 | **2** | with APEX event protocol |
2453 +-----------------------------------+-----------------------------------+
2454 | **3** | optional filter (best to use a |
2455 | | filter to prevent unwanted events |
2456 | | on the consumer side) |
2457 +-----------------------------------+-----------------------------------+
2458 | **4** | activate requestor mode |
2459 +-----------------------------------+-----------------------------------+
2460 | **5** | the peer to the output (must |
2461 | | match the output carrier) |
2462 +-----------------------------------+-----------------------------------+
2463 | **6** | an optional timeout in |
2464 | | milliseconds |
2465 +-----------------------------------+-----------------------------------+
2466 | **7** | event requestor on a producer |
2467 +-----------------------------------+-----------------------------------+
2468 | **8** | with APEX event protocol |
2469 +-----------------------------------+-----------------------------------+
2470 | **9** | optional filter (best to use a |
2471 | | filter to prevent unwanted events |
2472 | | on the consumer side) |
2473 +-----------------------------------+-----------------------------------+
2474 | **10** | activate requestor mode |
2475 +-----------------------------------+-----------------------------------+
2476 | **11** | the peer to the output (must |
2477 | | match the input carrier) |
2478 +-----------------------------------+-----------------------------------+
2479 | **12** | an optional timeout in |
2480 | | milliseconds |
2481 +-----------------------------------+-----------------------------------+
2482
2483Kafka IO
2484########
2485
2486 .. container:: paragraph
2487
2488 Kafka IO is supported by the APEX Kafka plugin. The
2489 configurations below are examples. APEX will take any
2490 configuration inside the parameter object and forward it
2491 to Kafka. More information on Kafka specific
2492 configuration parameters can be found in the Kafka
2493 documentation:
2494
2495 .. container:: ulist
2496
2497 - `Kafka Consumer
2498 Class <https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html>`__
2499
2500 - `Kafka Producer
2501 Class <https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html>`__
2502
2503Kafka Input
2504===========
2505 .. container:: paragraph
2506
2507 APEX will receive events from the Apache Kafka
2508 messaging system. The input is uni-directional, an
2509 engine will only receive events from the input but not
2510 send any event to the input.
2511
2512 .. container:: listingblock
2513
2514 .. container:: content
2515
ramverma760cce92019-07-11 12:57:49 +00002516 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002517
2518 "carrierTechnologyParameters" : {
2519 "carrierTechnology" : "KAFKA", (1)
2520 "parameterClassName" :
2521 "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
2522 "parameters" : {
2523 "bootstrapServers" : "localhost:49092", (2)
2524 "groupId" : "apex-group-id", (3)
2525 "enableAutoCommit" : true, (4)
2526 "autoCommitTime" : 1000, (5)
2527 "sessionTimeout" : 30000, (6)
2528 "consumerPollTime" : 100, (7)
2529 "consumerTopicList" : ["apex-in-0", "apex-in-1"], (8)
2530 "keyDeserializer" :
2531 "org.apache.kafka.common.serialization.StringDeserializer", (9)
2532 "valueDeserializer" :
2533 "org.apache.kafka.common.serialization.StringDeserializer" (10)
2534 }
2535 }
2536
2537 .. container:: colist arabic
2538
2539 +--------+-------------------------------------+
2540 | **1** | set Kafka as carrier technology |
2541 +--------+-------------------------------------+
2542 | **2** | bootstrap server and port |
2543 +--------+-------------------------------------+
2544 | **3** | a group identifier |
2545 +--------+-------------------------------------+
2546 | **4** | flag for auto-commit |
2547 +--------+-------------------------------------+
2548 | **5** | auto-commit timeout in milliseconds |
2549 +--------+-------------------------------------+
2550 | **6** | session timeout in milliseconds |
2551 +--------+-------------------------------------+
2552 | **7** | consumer poll time in milliseconds |
2553 +--------+-------------------------------------+
2554 | **8** | consumer topic list |
2555 +--------+-------------------------------------+
2556 | **9** | key for the Kafka de-serializer |
2557 +--------+-------------------------------------+
2558 | **10** | value for the Kafka de-serializer |
2559 +--------+-------------------------------------+
2560
2561Kafka Output
2562============
2563 .. container:: paragraph
2564
2565 APEX will send events to the Apache Kafka messaging
2566 system. The output is uni-directional, an engine will
2567 send events to the output but not receive any event
2568 from the output.
2569
2570 .. container:: listingblock
2571
2572 .. container:: content
2573
ramverma760cce92019-07-11 12:57:49 +00002574 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002575
2576 "carrierTechnologyParameters" : {
2577 "carrierTechnology" : "KAFKA", (1)
2578 "parameterClassName" :
2579 "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
2580 "parameters" : {
2581 "bootstrapServers" : "localhost:49092", (2)
2582 "acks" : "all", (3)
2583 "retries" : 0, (4)
2584 "batchSize" : 16384, (5)
2585 "lingerTime" : 1, (6)
2586 "bufferMemory" : 33554432, (7)
2587 "producerTopic" : "apex-out", (8)
2588 "keySerializer" :
2589 "org.apache.kafka.common.serialization.StringSerializer", (9)
2590 "valueSerializer" :
2591 "org.apache.kafka.common.serialization.StringSerializer" (10)
2592 }
2593 }
2594
2595 .. container:: colist arabic
2596
2597 +--------+---------------------------------+
2598 | **1** | set Kafka as carrier technology |
2599 +--------+---------------------------------+
2600 | **2** | bootstrap server and port |
2601 +--------+---------------------------------+
2602 | **3** | acknowledgement strategy |
2603 +--------+---------------------------------+
2604 | **4** | number of retries |
2605 +--------+---------------------------------+
2606 | **5** | batch size |
2607 +--------+---------------------------------+
2608 | **6** | time to linger in milliseconds |
2609 +--------+---------------------------------+
2610 | **7** | buffer memory in byte |
2611 +--------+---------------------------------+
2612 | **8** | producer topic |
2613 +--------+---------------------------------+
2614 | **9** | key for the Kafka serializer |
2615 +--------+---------------------------------+
2616 | **10** | value for the Kafka serializer |
2617 +--------+---------------------------------+
2618
2619JMS IO
2620#######
2621
2622 .. container:: paragraph
2623
2624 APEX supports the Java Messaging Service (JMS) as input
2625 as well as output. JMS IO is supported by the APEX JMS
2626 plugin. Input and output support an event encoding as
2627 text (JSON string) or object (serialized object). The
2628 input configuration is the same for both encodings, the
2629 output configuration differs.
2630
2631JMS Input
2632=========
2633 .. container:: paragraph
2634
2635 APEX will receive events from a JMS messaging system.
2636 The input is uni-directional, an engine will only
2637 receive events from the input but not send any event
2638 to the input.
2639
2640 .. container:: listingblock
2641
2642 .. container:: content
2643
ramverma760cce92019-07-11 12:57:49 +00002644 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002645
2646 "carrierTechnologyParameters" : {
2647 "carrierTechnology" : "JMS", (1)
2648 "parameterClassName" :
2649 "org.onap.policy.apex.plugins.event.carrier.jms.JMSCarrierTechnologyParameters",
2650 "parameters" : { (2)
2651 "initialContextFactory" :
2652 "org.jboss.naming.remote.client.InitialContextFactory", (3)
2653 "connectionFactory" : "ConnectionFactory", (4)
2654 "providerURL" : "remote://localhost:5445", (5)
2655 "securityPrincipal" : "guest", (6)
2656 "securityCredentials" : "IAmAGuest", (7)
2657 "consumerTopic" : "jms/topic/apexIn" (8)
2658 }
2659 }
2660
2661 .. container:: colist arabic
2662
2663 +-----------------------------------+-----------------------------------+
2664 | **1** | set JMS as carrier technology |
2665 +-----------------------------------+-----------------------------------+
2666 | **2** | set all JMS specific parameters |
2667 +-----------------------------------+-----------------------------------+
2668 | **3** | the context factory, in this case |
2669 | | from JBOSS (it requires the |
2670 | | dependency |
2671 | | org.jboss:jboss-remote-naming:2.0 |
2672 | | .4.Final |
2673 | | or a different version to be in |
2674 | | the directory ``$APEX_HOME/lib`` |
2675 | | or ``%APEX_HOME%\lib`` |
2676 +-----------------------------------+-----------------------------------+
2677 | **4** | a connection factory for the JMS |
2678 | | connection |
2679 +-----------------------------------+-----------------------------------+
2680 | **5** | URL with host and port of the JMS |
2681 | | provider |
2682 +-----------------------------------+-----------------------------------+
2683 | **6** | access credentials, user name |
2684 +-----------------------------------+-----------------------------------+
2685 | **7** | access credentials, user password |
2686 +-----------------------------------+-----------------------------------+
2687 | **8** | the JMS topic to listen to |
2688 +-----------------------------------+-----------------------------------+
2689
2690JMS Output with Text
2691====================
2692
2693 .. container:: paragraph
2694
2695 APEX engine send events to a JMS messaging system. The
2696 output is uni-directional, an engine will send events
2697 to the output but not receive any event from output.
2698
2699 .. container:: listingblock
2700
2701 .. container:: content
2702
ramverma760cce92019-07-11 12:57:49 +00002703 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002704
2705 "carrierTechnologyParameters" : {
2706 "carrierTechnology" : "JMS", (1)
2707 "parameterClassName" :
2708 "org.onap.policy.apex.plugins.event.carrier.jms.JMSCarrierTechnologyParameters",
2709 "parameters" : { (2)
2710 "initialContextFactory" :
2711 "org.jboss.naming.remote.client.InitialContextFactory", (3)
2712 "connectionFactory" : "ConnectionFactory", (4)
2713 "providerURL" : "remote://localhost:5445", (5)
2714 "securityPrincipal" : "guest", (6)
2715 "securityCredentials" : "IAmAGuest", (7)
2716 "producerTopic" : "jms/topic/apexOut", (8)
2717 "objectMessageSending": "false" (9)
2718 }
2719 }
2720
2721 .. container:: colist arabic
2722
2723 +-----------------------------------+-----------------------------------+
2724 | **1** | set JMS as carrier technology |
2725 +-----------------------------------+-----------------------------------+
2726 | **2** | set all JMS specific parameters |
2727 +-----------------------------------+-----------------------------------+
2728 | **3** | the context factory, in this case |
2729 | | from JBOSS (it requires the |
2730 | | dependency |
2731 | | org.jboss:jboss-remote-naming:2.0 |
2732 | | .4.Final |
2733 | | or a different version to be in |
2734 | | the directory ``$APEX_HOME/lib`` |
2735 | | or ``%APEX_HOME%\lib`` |
2736 +-----------------------------------+-----------------------------------+
2737 | **4** | a connection factory for the JMS |
2738 | | connection |
2739 +-----------------------------------+-----------------------------------+
2740 | **5** | URL with host and port of the JMS |
2741 | | provider |
2742 +-----------------------------------+-----------------------------------+
2743 | **6** | access credentials, user name |
2744 +-----------------------------------+-----------------------------------+
2745 | **7** | access credentials, user password |
2746 +-----------------------------------+-----------------------------------+
2747 | **8** | the JMS topic to write to |
2748 +-----------------------------------+-----------------------------------+
2749 | **9** | set object messaging to ``false`` |
2750 | | means it sends JSON text |
2751 +-----------------------------------+-----------------------------------+
2752
2753JMS Output with Object
2754======================
2755
2756 .. container:: paragraph
2757
2758 To configure APEX for JMS objects on the output
2759 interface use the same configuration as above (for
2760 output). Simply change the ``objectMessageSending``
2761 parameter to ``true``.
2762
2763Websocket (WS) IO
2764########################
2765
2766 .. container:: paragraph
2767
2768 APEX supports the Websockets as input as well as output.
2769 WS IO is supported by the APEX Websocket plugin. This
2770 carrier technology does only support uni-directional
2771 communication. APEX will not send events to a Websocket
2772 input and any event sent to a Websocket output will
2773 result in an error log.
2774
2775 .. container:: paragraph
2776
2777 The input can be configured as client (APEX connects to
2778 an existing Websocket server) or server (APEX starts a
2779 Websocket server). The same applies to the output. Input
2780 and output can both use a client or a server
2781 configuration, or separate configurations (input as
2782 client and output as server, input as server and output
2783 as client). Each configuration should use its own
2784 dedicated port to avoid any communication loops. The
2785 configuration of a Websocket client is the same for input
2786 and output. The configuration of a Websocket server is
2787 the same for input and output.
2788
2789Websocket Client
2790================
2791
2792 .. container:: paragraph
2793
2794 APEX will connect to a given Websocket server. As
2795 input, it will receive events from the server but not
2796 send any events. As output, it will send events to the
2797 server and any event received from the server will
2798 result in an error log.
2799
2800 .. container:: listingblock
2801
2802 .. container:: content
2803
ramverma760cce92019-07-11 12:57:49 +00002804 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002805
2806 "carrierTechnologyParameters" : {
2807 "carrierTechnology" : "WEBSOCKET", (1)
2808 "parameterClassName" :
2809 "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
2810 "parameters" : {
2811 "host" : "localhost", (2)
2812 "port" : 42451 (3)
2813 }
2814 }
2815
2816 .. container:: colist arabic
2817
2818 +-------+------------------------------------------------------+
2819 | **1** | set Websocket as carrier technology |
2820 +-------+------------------------------------------------------+
2821 | **2** | the host name on which a Websocket server is running |
2822 +-------+------------------------------------------------------+
2823 | **3** | the port of that Websocket server |
2824 +-------+------------------------------------------------------+
2825
2826Websocket Server
2827================
2828
2829 .. container:: paragraph
2830
2831 APEX will start a Websocket server, which will accept
2832 any Websocket clients to connect. As input, it will
2833 receive events from the server but not send any
2834 events. As output, it will send events to the server
2835 and any event received from the server will result in
2836 an error log.
2837
2838 .. container:: listingblock
2839
2840 .. container:: content
2841
ramverma760cce92019-07-11 12:57:49 +00002842 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002843
2844 "carrierTechnologyParameters" : {
2845 "carrierTechnology" : "WEBSOCKET", (1)
2846 "parameterClassName" :
2847 "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
2848 "parameters" : {
2849 "wsClient" : false, (2)
2850 "port" : 42450 (3)
2851 }
2852 }
2853
2854 .. container:: colist arabic
2855
2856 +-------+------------------------------------------------------------+
2857 | **1** | set Websocket as carrier technology |
2858 +-------+------------------------------------------------------------+
2859 | **2** | disable client, so that APEX will start a Websocket server |
2860 +-------+------------------------------------------------------------+
2861 | **3** | the port for the Websocket server APEX will start |
2862 +-------+------------------------------------------------------------+
2863
2864REST Client IO
2865##############
2866
2867 .. container:: paragraph
2868
2869 APEX can act as REST client on the input as well as on
2870 the output interface. The media type is
a.sreekumarcc0e9172020-03-16 13:36:45 +00002871 ``application/json``, so this plugin only works with
ramverma3b71c972019-07-10 11:25:37 +00002872 the JSON Event protocol.
2873
2874REST Client Input
2875=================
2876
2877 .. container:: paragraph
2878
2879 APEX will connect to a given URL to receive events,
2880 but not send any events. The server is polled, i.e.
2881 APEX will do an HTTP GET, take the result, and then do
2882 the next GET. Any required timing needs to be handled
2883 by the server configured via the URL. For instance,
2884 the server could support a wait timeout via the URL as
2885 ``?timeout=100ms``.
Henry.Sun2941bc02019-07-22 08:32:32 +00002886 The httpCodeFilter is used for filtering the status
2887 code, and it can be configured as a regular expression
2888 string. The default httpCodeFilter is "[2][0-9][0-9]"
2889 - for successful response codes.
2890 The response with HTTP status code that matches the
2891 given regular expression is forwarded to the task,
2892 otherwise it is logged as a failure.
ramverma3b71c972019-07-10 11:25:37 +00002893
2894 .. container:: listingblock
2895
2896 .. container:: content
2897
ramverma760cce92019-07-11 12:57:49 +00002898 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002899
2900 "carrierTechnologyParameters" : {
2901 "carrierTechnology" : "RESTCLIENT", (1)
2902 "parameterClassName" :
2903 "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters",
2904 "parameters" : {
2905 "url" : "http://example.org:8080/triggers/events", (2)
Henry.Sun2941bc02019-07-22 08:32:32 +00002906 "httpCodeFilter" : "[2][0-9][0-9]" (3)
ramverma3b71c972019-07-10 11:25:37 +00002907 }
2908 }
2909
2910 .. container:: colist arabic
2911
Henry.Sun2941bc02019-07-22 08:32:32 +00002912 +-------+--------------------------------------------------+
2913 | **1** | set REST client as carrier technology |
2914 +-------+--------------------------------------------------+
2915 | **2** | the URL of the HTTP server for events |
2916 +-------+--------------------------------------------------+
2917 | **3** | use HTTP CODE FILTER for filtering status code |
2918 +-------+--------------------------------------------------+
ramverma3b71c972019-07-10 11:25:37 +00002919
2920REST Client Output
2921==================
2922
2923 .. container:: paragraph
2924
2925 APEX will connect to a given URL to send events, but
2926 not receive any events. The default HTTP operation is
2927 POST (no configuration required). To change it to PUT
2928 simply add the configuration parameter (as shown in
2929 the example below).
ning.xi8bc537d2019-07-18 07:50:10 +00002930 The URL can be configured statically or tagged
2931 as ``?example.{site}.org:8080/{trig}/events``,
2932 all tags such as ``site`` and ``trig`` in the URL
Henry.Sun2941bc02019-07-22 08:32:32 +00002933 need to be set in the properties object available to
2934 the tasks. In addition, the keys should exactly match
2935 with the tags defined in url. The scope of the properties
2936 object is per HTTP call. Hence, key/value pairs set
2937 in the properties object by task are only available
2938 for that specific HTTP call.
ramverma3b71c972019-07-10 11:25:37 +00002939
2940 .. container:: listingblock
2941
2942 .. container:: content
2943
ramverma760cce92019-07-11 12:57:49 +00002944 .. code::
ramverma3b71c972019-07-10 11:25:37 +00002945
2946 "carrierTechnologyParameters" : {
2947 "carrierTechnology" : "RESTCLIENT", (1)
2948 "parameterClassName" :
2949 "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters",
2950 "parameters" : {
2951 "url" : "http://example.com:8888/actions/events", (2)
ning.xi8bc537d2019-07-18 07:50:10 +00002952 "url" : "http://example.{site}.com:8888/{trig}/events", (2')
ramverma3b71c972019-07-10 11:25:37 +00002953 "httpMethod" : "PUT" (3)
2954 }
2955 }
2956
2957 .. container:: colist arabic
2958
2959 +-------+--------------------------------------------------+
2960 | **1** | set REST client as carrier technology |
2961 +-------+--------------------------------------------------+
ning.xi8bc537d2019-07-18 07:50:10 +00002962 | **2** | the static URL of the HTTP server for events |
2963 +-------+--------------------------------------------------+
2964 | **2'**| the tagged URL of the HTTP server for events |
ramverma3b71c972019-07-10 11:25:37 +00002965 +-------+--------------------------------------------------+
2966 | **3** | use HTTP PUT (remove this line to use HTTP POST) |
2967 +-------+--------------------------------------------------+
2968
2969REST Server IO
2970##############
2971
2972 .. container:: paragraph
2973
2974 APEX supports a REST server for input and output.
2975
2976 .. container:: paragraph
2977
2978 The REST server plugin always uses a synchronous mode. A
2979 client does a HTTP GET on the APEX REST server with the
2980 input event and receives the generated output event in
2981 the server reply. This means that for the REST server
2982 there has to always to be an input with an associated
2983 output. Input or output only are not permitted.
2984
2985 .. container:: paragraph
2986
2987 The plugin will start a Grizzly server as REST server for
2988 a normal APEX engine. If the APEX engine is executed as a
2989 servlet, for instance inside Tomcat, then Tomcat will be
2990 used as REST server (this case requires configuration on
2991 Tomcat as well).
2992
2993 .. container:: paragraph
2994
2995 Some configuration restrictions apply for all scenarios:
2996
2997 .. container:: ulist
2998
2999 - Minimum port: 1024
3000
3001 - Maximum port: 65535
3002
3003 - The media type is ``application/json``, so this plugin
a.sreekumarcc0e9172020-03-16 13:36:45 +00003004 only works with the JSON Event protocol.
ramverma3b71c972019-07-10 11:25:37 +00003005
3006 .. container:: paragraph
3007
3008 The URL the client calls is created using
3009
3010 .. container:: ulist
3011
3012 - the configured host and port, e.g.
3013 ``http://localhost:12345``
3014
3015 - the standard path, e.g. ``/apex/``
3016
3017 - the name of the input/output, e.g. ``FirstConsumer/``
3018
3019 - the input or output name, e.g. ``EventIn``.
3020
3021 .. container:: paragraph
3022
3023 The examples above lead to the URL
3024 ``http://localhost:12345/apex/FirstConsumer/EventIn``.
3025
3026 .. container:: paragraph
3027
3028 A client can also get status information of the REST
3029 server using ``/Status``, e.g.
3030 ``http://localhost:12345/apex/FirstConsumer/Status``.
3031
3032REST Server Stand-alone
3033=======================
3034
3035 .. container:: paragraph
3036
3037 We need to configure a REST server input and a REST
3038 server output. Input and output are associated with
3039 each other via there name.
3040
3041 .. container:: paragraph
3042
3043 Timeouts for REST calls need to be set carefully. If
3044 they are too short, the call might timeout before a
3045 policy finished creating an event.
3046
3047 .. container:: paragraph
3048
3049 The following example configures the input named as
3050 ``MyConsumer`` and associates an output named
3051 ``MyProducer`` with it.
3052
3053 .. container:: listingblock
3054
3055 .. container:: content
3056
ramverma760cce92019-07-11 12:57:49 +00003057 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003058
3059 "eventInputParameters": {
3060 "MyConsumer": {
3061 "carrierTechnologyParameters" : {
3062 "carrierTechnology" : "RESTSERVER", (1)
3063 "parameterClassName" :
3064 "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters",
3065 "parameters" : {
3066 "standalone" : true, (2)
3067 "host" : "localhost", (3)
3068 "port" : 12345 (4)
3069 }
3070 },
3071 "eventProtocolParameters":{
3072 "eventProtocol" : "JSON" (5)
3073 },
3074 "synchronousMode" : true, (6)
3075 "synchronousPeer" : "MyProducer", (7)
3076 "synchronousTimeout" : 500 (8)
3077 }
3078 }
3079
3080 .. container:: colist arabic
3081
3082 +-------+---------------------------------------+
3083 | **1** | set REST server as carrier technology |
3084 +-------+---------------------------------------+
3085 | **2** | set the server as stand-alone |
3086 +-------+---------------------------------------+
3087 | **3** | set the server host |
3088 +-------+---------------------------------------+
3089 | **4** | set the server listen port |
3090 +-------+---------------------------------------+
3091 | **5** | use JSON event protocol |
3092 +-------+---------------------------------------+
3093 | **6** | activate synchronous mode |
3094 +-------+---------------------------------------+
3095 | **7** | associate an output ``MyProducer`` |
3096 +-------+---------------------------------------+
3097 | **8** | set a timeout of 500 milliseconds |
3098 +-------+---------------------------------------+
3099
3100 .. container:: paragraph
3101
3102 The following example configures the output named as
3103 ``MyProducer`` and associates the input ``MyConsumer``
3104 with it. Note that for the output there are no more
3105 paramters (such as host or port), since they are
3106 already configured in the associated input
3107
3108 .. container:: listingblock
3109
3110 .. container:: content
3111
ramverma760cce92019-07-11 12:57:49 +00003112 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003113
3114 "eventOutputParameters": {
3115 "MyProducer": {
3116 "carrierTechnologyParameters":{
3117 "carrierTechnology" : "RESTSERVER",
3118 "parameterClassName" :
3119 "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters"
3120 },
3121 "eventProtocolParameters":{
3122 "eventProtocol" : "JSON"
3123 },
3124 "synchronousMode" : true,
3125 "synchronousPeer" : "MyConsumer",
3126 "synchronousTimeout" : 500
3127 }
3128 }
3129
3130REST Server Stand-alone, multi input
3131====================================
3132
3133 .. container:: paragraph
3134
3135 Any number of input/output pairs for REST servers can
3136 be configured. For instance, we can configure an input
3137 ``FirstConsumer`` with output ``FirstProducer`` and an
3138 input ``SecondConsumer`` with output
3139 ``SecondProducer``. Important is that there is always
3140 one pair of input/output.
3141
3142REST Server Stand-alone in Servlet
3143==================================
3144
3145 .. container:: paragraph
3146
3147 If APEX is executed as a servlet, e.g. inside Tomcat,
3148 the configuration becomes easier since the plugin can
3149 now use Tomcat as the REST server. In this scenario,
3150 there are not parameters (port, host, etc.) and the
3151 key ``standalone`` must not be used (or set to false).
3152
3153 .. container:: paragraph
3154
3155 For the Tomcat configuration, we need to add the REST
3156 server plugin, e.g.
3157
3158 .. container:: listingblock
3159
3160 .. container:: content
3161
ramverma760cce92019-07-11 12:57:49 +00003162 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003163
3164 <servlet>
3165 ...
3166 <init-param>
3167 ...
3168 <param-value>org.onap.policy.apex.plugins.event.carrier.restserver</param-value>
3169 </init-param>
3170 ...
3171 </servlet>
3172
3173REST Requestor IO
3174##################
3175
3176 .. container:: paragraph
3177
3178 APEX can act as REST requestor on the input as well as on
3179 the output interface. The media type is
a.sreekumarcc0e9172020-03-16 13:36:45 +00003180 ``application/json``, so this plugin only works with
ramverma3b71c972019-07-10 11:25:37 +00003181 the JSON Event protocol.
3182
3183REST Requestor Input
3184====================
3185
3186 .. container:: paragraph
3187
3188 APEX will connect to a given URL to request an input.
ning.xi8bc537d2019-07-18 07:50:10 +00003189 The URL can be configured statically or tagged
3190 as ``?example.{site}.org:8080/{trig}/events``,
3191 all tags such as ``site`` and ``trig`` in the URL
Henry.Sun2941bc02019-07-22 08:32:32 +00003192 need to be set in the properties object available to
3193 the tasks. In addition, the keys should exactly match
3194 with the tags defined in url. The scope of the properties
3195 object is per HTTP call. Hence, key/value pairs set
3196 in the properties object by task are only available
3197 for that specific HTTP call.
3198 The httpCodeFilter is used for filtering the status
3199 code, and it can be configured as a regular expression
3200 string. The default httpCodeFilter is "[2][0-9][0-9]"
3201 - for successful response codes.
3202 The response with HTTP status code that matches the
3203 given regular expression is forwarded to the task,
3204 otherwise it is logged as a failure.
ramverma3b71c972019-07-10 11:25:37 +00003205
3206 .. container:: listingblock
3207
3208 .. container:: content
3209
ramverma760cce92019-07-11 12:57:49 +00003210 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003211
3212 "carrierTechnologyParameters": {
3213 "carrierTechnology": "RESTREQUESTOR", (1)
3214 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters",
3215 "parameters": {
3216 "url": "http://localhost:54321/some/path/to/rest/resource", (2)
ning.xi8bc537d2019-07-18 07:50:10 +00003217 "url": "http://localhost:54321/{site}/path/to/rest/{resValue}", (2')
ramverma3b71c972019-07-10 11:25:37 +00003218 "httpMethod": "POST", (3)
Henry.Sun2941bc02019-07-22 08:32:32 +00003219 "restRequestTimeout": 2000, (4)
3220 "httpCodeFilter" : "[2][0-9][0-9]" (5)
ramverma3b71c972019-07-10 11:25:37 +00003221 }
3222 },
3223
3224 .. container:: colist arabic
3225
3226 +-------+--------------------------------------------------+
3227 | **1** | set REST requestor as carrier technology |
3228 +-------+--------------------------------------------------+
ning.xi8bc537d2019-07-18 07:50:10 +00003229 | **2** | the static URL of the HTTP server for events |
3230 +-------+--------------------------------------------------+
3231 | **2'**| the tagged URL of the HTTP server for events |
ramverma3b71c972019-07-10 11:25:37 +00003232 +-------+--------------------------------------------------+
3233 | **3** | use HTTP PUT (remove this line to use HTTP POST) |
3234 +-------+--------------------------------------------------+
3235 | **4** | request timeout in milliseconds |
3236 +-------+--------------------------------------------------+
Henry.Sun2941bc02019-07-22 08:32:32 +00003237 | **5** | use HTTP CODE FILTER for filtering status code |
3238 +-------+--------------------------------------------------+
ramverma3b71c972019-07-10 11:25:37 +00003239
3240 .. container:: paragraph
3241
3242 Further settings are required on the consumer to
3243 define the event that is requested, for example:
3244
3245 .. container:: listingblock
3246
3247 .. container:: content
3248
ramverma760cce92019-07-11 12:57:49 +00003249 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003250
3251 "eventName": "GuardResponseEvent", (1)
3252 "eventNameFilter": "GuardResponseEvent", (2)
3253 "requestorMode": true, (3)
3254 "requestorPeer": "GuardRequestorProducer", (4)
3255 "requestorTimeout": 500 (5)
3256
3257 .. container:: colist arabic
3258
3259 +-------+---------------------------+
3260 | **1** | the event name |
3261 +-------+---------------------------+
3262 | **2** | a filter on the event |
3263 +-------+---------------------------+
3264 | **3** | the mode of the requestor |
3265 +-------+---------------------------+
3266 | **4** | a peer for the requestor |
3267 +-------+---------------------------+
3268 | **5** | a general request timeout |
3269 +-------+---------------------------+
3270
3271REST Requestor Output
3272=====================
3273
3274 .. container:: paragraph
3275
3276 APEX will connect to a given URL to send events, but
3277 not receive any events.
3278
3279 .. container:: listingblock
3280
3281 .. container:: content
3282
ramverma760cce92019-07-11 12:57:49 +00003283 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003284
3285 "carrierTechnologyParameters": {
3286 "carrierTechnology": "RESTREQUESTOR", (1)
3287 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters"
3288 },
3289
3290 .. container:: colist arabic
3291
3292 +-------+------------------------------------------+
3293 | **1** | set REST requestor as carrier technology |
3294 +-------+------------------------------------------+
3295
3296 .. container:: paragraph
3297
3298 Further settings are required on the consumer to
3299 define the event that is requested, for example:
3300
3301 .. container:: listingblock
3302
3303 .. container:: content
3304
ramverma760cce92019-07-11 12:57:49 +00003305 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003306
3307 "eventNameFilter": "GuardRequestEvent", (1)
3308 "requestorMode": true, (2)
3309 "requestorPeer": "GuardRequestorConsumer", (3)
3310 "requestorTimeout": 500 (4)
3311
3312 .. container:: colist arabic
3313
3314 +-------+---------------------------+
3315 | **1** | a filter on the event |
3316 +-------+---------------------------+
3317 | **2** | the mode of the requestor |
3318 +-------+---------------------------+
3319 | **3** | a peer for the requestor |
3320 +-------+---------------------------+
3321 | **4** | a general request timeout |
3322 +-------+---------------------------+
3323
a.sreekumarcc0e9172020-03-16 13:36:45 +00003324gRPC IO
3325#######
3326
3327 .. container:: paragraph
3328
3329 APEX can send requests over gRPC at the output side, and get back
3330 response at the input side. This can be used to send requests to CDS
3331 over gRPC. The media type is ``application/json``, so this plugin
3332 only works with the JSON Event protocol.
3333
3334gRPC Output
3335===========
3336
3337 .. container:: paragraph
3338
3339 APEX will connect to a given host to send a request over
3340 gRPC.
3341
3342 .. container:: listingblock
3343
3344 .. container:: content
3345
3346 .. code::
3347
3348 "carrierTechnologyParameters": {
3349 "carrierTechnology": "GRPC", (1)
3350 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
3351 "parameters": {
3352 "host": "cds-blueprints-processor-grpc", (2)
3353 "port": 9111, (2')
3354 "username": "ccsdkapps", (3)
3355 "password": ccsdkapps, (4)
3356 "timeout" : 10 (5)
3357 }
3358 },
3359
3360 .. container:: colist arabic
3361
3362 +-------+--------------------------------------------------+
3363 | **1** | set GRPC as carrier technology |
3364 +-------+--------------------------------------------------+
3365 | **2** | the host to which request is sent |
3366 +-------+--------------------------------------------------+
3367 | **2'**| the value for port |
3368 +-------+--------------------------------------------------+
3369 | **3** | username required to initiate connection |
3370 +-------+--------------------------------------------------+
3371 | **4** | password required to initiate connection |
3372 +-------+--------------------------------------------------+
3373 | **5** | the timeout value for completing the request |
3374 +-------+--------------------------------------------------+
3375
3376 .. container:: paragraph
3377
3378 Further settings are required on the producer to
3379 define the event that is requested, for example:
3380
3381 .. container:: listingblock
3382
3383 .. container:: content
3384
3385 .. code::
3386
3387 "eventName": "GRPCRequestEvent", (1)
3388 "eventNameFilter": "GRPCRequestEvent", (2)
3389 "requestorMode": true, (3)
3390 "requestorPeer": "GRPCRequestConsumer", (4)
3391 "requestorTimeout": 500 (5)
3392
3393 .. container:: colist arabic
3394
3395 +-------+---------------------------+
3396 | **1** | the event name |
3397 +-------+---------------------------+
3398 | **2** | a filter on the event |
3399 +-------+---------------------------+
3400 | **3** | the mode of the requestor |
3401 +-------+---------------------------+
3402 | **4** | a peer for the requestor |
3403 +-------+---------------------------+
3404 | **5** | a general request timeout |
3405 +-------+---------------------------+
3406
3407gRPC Input
3408==========
3409
3410 .. container:: paragraph
3411
3412 APEX will connect to the host specified in the producer
3413 side, anad take in response back at the consumer side.
3414
3415 .. container:: listingblock
3416
3417 .. container:: content
3418
3419 .. code::
3420
3421 "carrierTechnologyParameters": {
3422 "carrierTechnology": "GRPC", (1)
3423 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
3424 },
3425
3426 .. container:: colist arabic
3427
3428 +-------+------------------------------------------+
3429 | **1** | set GRPC as carrier technology |
3430 +-------+------------------------------------------+
3431
3432 .. container:: paragraph
3433
3434 Further settings are required on the consumer to
3435 define the event that is requested, for example:
3436
3437 .. container:: listingblock
3438
3439 .. container:: content
3440
3441 .. code::
3442
3443 "eventNameFilter": "GRPCResponseEvent", (1)
3444 "requestorMode": true, (2)
3445 "requestorPeer": "GRPCRequestProducer", (3)
3446 "requestorTimeout": 500 (4)
3447
3448 .. container:: colist arabic
3449
3450 +-------+---------------------------+
3451 | **1** | a filter on the event |
3452 +-------+---------------------------+
3453 | **2** | the mode of the requestor |
3454 +-------+---------------------------+
3455 | **3** | a peer for the requestor |
3456 +-------+---------------------------+
3457 | **4** | a general request timeout |
3458 +-------+---------------------------+
3459
ramverma3b71c972019-07-10 11:25:37 +00003460Event Protocols, Format and Encoding
3461------------------------------------
3462
3463 .. container:: paragraph
3464
3465 Event protocols define what event formats APEX can receive
3466 (input) and should send (output). They can be used in any
3467 combination for input and output, unless further restricted
3468 by a carrier technology plugin (for instance for JMS
3469 output). There can only be 1 event protocol per event
3470 plugin.
3471
3472 .. container:: paragraph
3473
3474 Supported *input* event protocols are:
3475
3476 .. container:: ulist
3477
3478 - JSON, the event as a JSON string
3479
3480 - APEX, an APEX event
3481
3482 - JMS object, the event as a JMS object,
3483
3484 - JMS text, the event as a JMS text,
3485
3486 - XML, the event as an XML string,
3487
3488 - YAML, the event as YAML text
3489
3490 .. container:: paragraph
3491
3492 Supported *output* event protocols are:
3493
3494 .. container:: ulist
3495
3496 - JSON, the event as a JSON string
3497
3498 - APEX, an APEX event
3499
3500 - JMS object, the event as a JMS object,
3501
3502 - JMS text, the event as a JMS text,
3503
3504 - XML, the event as an XML string,
3505
3506 - YAML, the event as YAML text
3507
3508 .. container:: paragraph
3509
3510 New event protocols can be added as plugins to APEX or
3511 developed outside APEX and added to an APEX deployment.
3512
3513JSON Event
3514##########
3515
3516 .. container:: paragraph
3517
3518 The event protocol for JSON encoding does not require a
3519 specific plugin, it is supported by default. Furthermore,
3520 there is no difference in the configuration for the input
3521 and output interface.
3522
3523 .. container:: paragraph
3524
3525 For an input, APEX requires a well-formed JSON string.
3526 Well-formed here means according to the definitions of a
3527 policy. Any JSON string that is not defined as a trigger
3528 event (consume) will not be consumed (errors will be
3529 thrown). For output JSON events, APEX will always produce
3530 valid JSON strings according to the definition in the
3531 policy model.
3532
3533 .. container:: paragraph
3534
3535 The following JSON shows the configuration.
3536
3537 .. container:: listingblock
3538
3539 .. container:: content
3540
ramverma760cce92019-07-11 12:57:49 +00003541 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003542
3543 "eventProtocolParameters":{
3544 "eventProtocol" : "JSON"
3545 }
3546
3547 .. container:: paragraph
3548
3549 For JSON events, there are a few more optional
3550 parameters, which allow to define a mapping for standard
3551 event fields. An APEX event must have the fields
3552 ``name``, ``version``, ``source``, and ``target``
3553 defined. Sometimes it is not possible to configure a
3554 trigger or actioning system to use those fields. However,
3555 they might be in an event generated outside APEX (or used
3556 outside APEX) just with different names. To configure
3557 APEX to map between the different event names, simply add
3558 the following parameters to a JSON event:
3559
3560 .. container:: listingblock
3561
3562 .. container:: content
3563
ramverma760cce92019-07-11 12:57:49 +00003564 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003565
3566 "eventProtocolParameters":{
3567 "eventProtocol" : "JSON",
3568 "nameAlias" : "policyName", (1)
3569 "versionAlias" : "policyVersion", (2)
3570 "sourceAlias" : "from", (3)
3571 "targetAlias" : "to", (4)
3572 "nameSpaceAlias": "my.name.space" (5)
3573 }
3574
3575 .. container:: colist arabic
3576
3577 +-----------------------------------+-----------------------------------+
3578 | **1** | mapping for the ``name`` field, |
3579 | | here from a field called |
3580 | | ``policyName`` |
3581 +-----------------------------------+-----------------------------------+
3582 | **2** | mapping for the ``version`` |
3583 | | field, here from a field called |
3584 | | ``policyVersion`` |
3585 +-----------------------------------+-----------------------------------+
3586 | **3** | mapping for the ``source`` field, |
3587 | | here from a field called ``from`` |
3588 | | (only for an input event) |
3589 +-----------------------------------+-----------------------------------+
3590 | **4** | mapping for the ``target`` field, |
3591 | | here from a field called ``to`` |
3592 | | (only for an output event) |
3593 +-----------------------------------+-----------------------------------+
3594 | **5** | mapping for the ``nameSpace`` |
3595 | | field, here from a field called |
3596 | | ``my.name.space`` |
3597 +-----------------------------------+-----------------------------------+
3598
3599APEX Event
3600##########
3601 .. container:: paragraph
3602
3603 The event protocol for APEX events does not require a
3604 specific plugin, it is supported by default. Furthermore,
3605 there is no difference in the configuration for the input
3606 and output interface.
3607
3608 .. container:: paragraph
3609
3610 For input and output APEX uses APEX events.
3611
3612 .. container:: paragraph
3613
3614 The following JSON shows the configuration.
3615
3616 .. container:: listingblock
3617
3618 .. container:: content
3619
ramverma760cce92019-07-11 12:57:49 +00003620 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003621
3622 "eventProtocolParameters":{
3623 "eventProtocol" : "APEX"
3624 }
3625
3626JMS Event
3627#########
3628
3629 .. container:: paragraph
3630
3631 The event protocol for JMS is provided by the APEX JMS
3632 plugin. The plugin supports encoding as JSON text or as
3633 object. There is no difference in the configuration for
3634 the input and output interface.
3635
3636JMS Text
3637========
3638 .. container:: paragraph
3639
3640 If used as input, APEX will take a JMS message and
3641 extract a JSON string, then proceed as if a JSON event
3642 was received. If used as output, APEX will take the
3643 event produced by a policy, create a JSON string, and
3644 then wrap it into a JMS message.
3645
3646 .. container:: paragraph
3647
3648 The configuration for JMS text is as follows:
3649
3650 .. container:: listingblock
3651
3652 .. container:: content
3653
ramverma760cce92019-07-11 12:57:49 +00003654 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003655
3656 "eventProtocolParameters":{
3657 "eventProtocol" : "JMSTEXT",
3658 "parameterClassName" :
3659 "org.onap.policy.apex.plugins.event.protocol.jms.JMSTextEventProtocolParameters"
3660 }
3661
3662JMS Object
3663==========
3664 .. container:: paragraph
3665
3666 If used as input, APEX will will take a JMS message,
3667 extract a Java Bean from the ``ObjectMessage``
3668 message, construct an APEX event and put the bean on
3669 the APEX event as a parameter. If used as output, APEX
3670 will take the event produced by a policy, create a
3671 Java Bean and send it as a JMS message.
3672
3673 .. container:: paragraph
3674
3675 The configuration for JMS object is as follows:
3676
3677 .. container:: listingblock
3678
3679 .. container:: content
3680
ramverma760cce92019-07-11 12:57:49 +00003681 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003682
3683 "eventProtocolParameters":{
3684 "eventProtocol" : "JMSOBJECT",
3685 "parameterClassName" :
3686 "org.onap.policy.apex.plugins.event.protocol.jms.JMSObjectEventProtocolParameters"
3687 }
3688
3689YAML Event
3690##########
3691
3692 .. container:: paragraph
3693
3694 The event protocol for YAML is provided by the APEX YAML
3695 plugin. There is no difference in the configuration for
3696 the input and output interface.
3697
3698 .. container:: paragraph
3699
3700 If used as input, APEX will consume events as YAML and
3701 map them to policy trigger events. Not well-formed YAML
3702 and not understood trigger events will be rejected. If
3703 used as output, APEX produce YAML encoded events from the
3704 event a policy produces. Those events will always be
3705 well-formed according to the definition in the policy
3706 model.
3707
3708 .. container:: paragraph
3709
3710 The following code shows the configuration.
3711
3712 .. container:: listingblock
3713
3714 .. container:: content
3715
ramverma760cce92019-07-11 12:57:49 +00003716 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003717
3718 "eventProtocolParameters":{
3719 "eventProtocol" : "XML",
3720 "parameterClassName" :
3721 "org.onap.policy.apex.plugins.event.protocol.yaml.YamlEventProtocolParameters"
3722 }
3723
3724XML Event
3725#########
3726 .. container:: paragraph
3727
3728 The event protocol for XML is provided by the APEX XML
3729 plugin. There is no difference in the configuration for
3730 the input and output interface.
3731
3732 .. container:: paragraph
3733
3734 If used as input, APEX will consume events as XML and map
3735 them to policy trigger events. Not well-formed XML and
3736 not understood trigger events will be rejected. If used
3737 as output, APEX produce XML encoded events from the event
3738 a policy produces. Those events will always be
3739 well-formed according to the definition in the policy
3740 model.
3741
3742 .. container:: paragraph
3743
3744 The following code shows the configuration.
3745
3746 .. container:: listingblock
3747
3748 .. container:: content
3749
ramverma760cce92019-07-11 12:57:49 +00003750 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003751
3752 "eventProtocolParameters":{
3753 "eventProtocol" : "XML",
3754 "parameterClassName" :
3755 "org.onap.policy.apex.plugins.event.protocol.xml.XMLEventProtocolParameters"
3756 }
3757
3758A configuration example
3759-----------------------
3760
3761 .. container:: paragraph
3762
3763 The following example loads all available plug-ins.
3764
3765 .. container:: paragraph
3766
3767 Events are consumed from a Websocket, APEX as client.
3768 Consumed event format is JSON.
3769
3770 .. container:: paragraph
3771
3772 Events are produced to Kafka. Produced event format is XML.
3773
3774 .. container:: listingblock
3775
3776 .. container:: content
3777
ramverma760cce92019-07-11 12:57:49 +00003778 .. code::
ramverma3b71c972019-07-10 11:25:37 +00003779
3780 {
3781 "engineServiceParameters" : {
3782 "name" : "MyApexEngine",
3783 "version" : "0.0.1",
3784 "id" : 45,
3785 "instanceCount" : 4,
3786 "deploymentPort" : 12345,
3787 "policyModelFileName" : "examples/models/some-model.json",
3788 "engineParameters" : {
3789 "executorParameters" : {
3790 "JAVASCRIPT" : {
3791 "parameterClassName" :
3792 "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
3793 },
3794 "JYTHON" : {
3795 "parameterClassName" :
3796 "org.onap.policy.apex.plugins.executor.jython.JythonExecutorParameters"
3797 },
3798 "JRUBY" : {
3799 "parameterClassName" :
3800 "org.onap.policy.apex.plugins.executor.jruby.JrubyExecutorParameters"
3801 },
3802 "JAVA" : {
3803 "parameterClassName" :
3804 "org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters"
3805 },
3806 "MVEL" : {
3807 "parameterClassName" :
3808 "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters"
3809 }
3810 },
3811 "contextParameters" : {
3812 "parameterClassName" :
3813 "org.onap.policy.apex.context.parameters.ContextParameters",
3814 "schemaParameters" : {
3815 "Avro":{
3816 "parameterClassName" :
3817 "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
3818 }
3819 }
3820 }
3821 }
3822 },
3823 "producerCarrierTechnologyParameters" : {
3824 "carrierTechnology" : "KAFKA",
3825 "parameterClassName" :
3826 "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
3827 "parameters" : {
3828 "bootstrapServers" : "localhost:49092",
3829 "acks" : "all",
3830 "retries" : 0,
3831 "batchSize" : 16384,
3832 "lingerTime" : 1,
3833 "bufferMemory" : 33554432,
3834 "producerTopic" : "apex-out",
3835 "keySerializer" : "org.apache.kafka.common.serialization.StringSerializer",
3836 "valueSerializer" : "org.apache.kafka.common.serialization.StringSerializer"
3837 }
3838 },
3839 "producerEventProtocolParameters" : {
3840 "eventProtocol" : "XML",
3841 "parameterClassName" :
3842 "org.onap.policy.apex.plugins.event.protocol.xml.XMLEventProtocolParameters"
3843 },
3844 "consumerCarrierTechnologyParameters" : {
3845 "carrierTechnology" : "WEBSOCKET",
3846 "parameterClassName" :
3847 "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
3848 "parameters" : {
3849 "host" : "localhost",
3850 "port" : 88888
3851 }
3852 },
3853 "consumerEventProtocolParameters" : {
3854 "eventProtocol" : "JSON"
3855 }
3856 }
3857
3858Engine and Applications of the APEX System
3859^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3860
3861Introduction to APEX Engine and Applications
3862--------------------------------------------
3863
3864 .. container:: paragraph
3865
3866 The core of APEX is the APEX Engine, also known as the APEX
3867 Policy Engine or the APEX PDP (since it is in fact a Policy
3868 Decision Point). Beside this engine, an APEX system comes
3869 with a few applications intended to help with policy
3870 authoring, deployment, and execution.
3871
3872 .. container:: paragraph
3873
3874 The engine itself and most applications are started from the
3875 command line with command line arguments. This is called a
3876 Command Line Interface (CLI). Some applications require an
3877 installation on a webserver, as for instance the REST
3878 Editor. Those applications can be accessed via a web
3879 browser.
3880
3881 .. container:: paragraph
3882
3883 You can also use the available APEX APIs and applications to
3884 develop other applications as required. This includes policy
3885 languages (and associated parsers and compilers /
3886 interpreters), GUIs to access APEX or to define policies,
3887 clients to connect to APEX, etc.
3888
3889 .. container:: paragraph
3890
3891 For this documentation, we assume an installation of APEX as
3892 a full system based on a current ONAP release.
3893
3894CLI on Unix, Windows, and Cygwin
3895--------------------------------
3896
3897 .. container:: paragraph
3898
3899 A note on APEX CLI applications: all applications and the
3900 engine itself have been deployed and tested on different
3901 operating systems: Red Hat, Ubuntu, Debian, Mac OSX,
3902 Windows, Cygwin. Each operating system comes with its own
3903 way of configuring and executing Java. The main items here
3904 are:
3905
3906 .. container:: ulist
3907
3908 - For UNIX systems (RHL, Ubuntu, Debian, Mac OSX), the
3909 provided bash scripts work as expected with absolute
3910 paths (e.g.
3911 ``/opt/app/policy/apex-pdp/apex-pdp-2.0.0-SNAPSHOT/examples``),
3912 indirect and linked paths (e.g. ``../apex/apex``), and
3913 path substitutions using environment settings (e.g.
3914 ``$APEX_HOME/bin/``)
3915
3916 - For Windows systems, the provided batch files (``.bat``)
3917 work as expected with with absolute paths (e.g.
3918 ``C:\apex\apex-2.0.0-SNAPSHOT\examples``), and path
3919 substitutions using environment settings (e.g.
3920 ``%APEX_HOME%\bin\``)
3921
3922 - For Cygwin system we assume a standard Cygwin
3923 installation with standard tools (mainly bash) using a
3924 Windows Java installation. This means that the bash
3925 scripts can be used as in UNIX, however any argument
3926 pointing to files and directories need to use either a
3927 DOS path (e.g.
3928 ``C:\apex\apex-2.0.0-SNAPSHOT\examples\config...``) or
3929 the command ``cygpath`` with a mixed option. The reason
3930 for that is: Cygwin executes Java using UNIX paths but
3931 then runs Java as a DOS/WINDOWS process, which requires
3932 DOS paths for file access.
3933
3934The APEX Engine
3935---------------
3936
3937 .. container:: paragraph
3938
3939 The APEX engine can be started in different ways, depending
3940 your requirements. All scripts are located in the APEX *bin*
3941 directory
3942
3943 .. container:: paragraph
3944
3945 On UNIX and Cygwin systems use:
3946
3947 .. container:: ulist
3948
3949 - ``apexEngine.sh`` - this script will
3950
3951 .. container:: ulist
3952
3953 - Test if ``$APEX_USER`` is set and if the user
3954 exists, terminate with an error otherwise
3955
3956 - Test if ``$APEX_HOME`` is set. If not set, it will
3957 use the default setting as
3958 ``/opt/app/policy/apex-pdp/apex-pdp``. Then the set
3959 directory is tested to exist, the script will
3960 terminate if not.
3961
3962 - When all tests are passed successfully, the script
3963 will call ``apexApps.sh`` with arguments to start
3964 the APEX engine.
3965
3966 - ``apexApps.sh engine`` - this is the general APEX
3967 application launcher, which will
3968
3969 .. container:: ulist
3970
3971 - Start the engine with the argument ``engine``
3972
3973 - Test if ``$APEX_HOME`` is set and points to an
3974 existing directory. If not set or directory does
3975 not exist, script terminates.
3976
3977 - Not test for any settings of ``$APEX_USER``.
3978
3979 .. container:: paragraph
3980
3981 On Windows systems use ``apexEngine.bat`` and
3982 ``apexApps.bat engine`` respectively. Note: none of the
3983 windows batch files will test for ``%APEX_USER%``.
3984
3985 .. container:: paragraph
3986
3987 Summary of alternatives to start the APEX Engine:
3988
3989 +--------------------------------------------------------+----------------------------------------------------------+
3990 | Unix, Cygwin | Windows |
3991 +========================================================+==========================================================+
3992 | .. container:: | .. container:: |
3993 | | |
3994 | .. container:: listingblock | .. container:: listingblock |
3995 | | |
3996 | .. container:: content | .. container:: content |
3997 | | |
3998 | .. code:: | .. code:: |
3999 | | |
4000 | # $APEX_HOME/bin/apexEngine.sh [args] | > %APEX_HOME%\bin\apexEngine.bat [args] |
4001 | # $APEX_HOME/bin/apexApps.sh engine [args] | > %APEX_HOME%\bin\apexApps.bat engine [args] |
4002 +--------------------------------------------------------+----------------------------------------------------------+
4003
4004 .. container:: paragraph
4005
4006 The APEX engine comes with a few CLI arguments for setting
4007 configuration and policy model. The configuration file is
4008 always required. The policy model file is only required if
4009 no model file is specified in the configuration, or if the
4010 specified model file should be over written. The option
4011 ``-h`` prints a help screen.
4012
4013 .. container:: listingblock
4014
4015 .. container:: content
4016
ramverma760cce92019-07-11 12:57:49 +00004017 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004018
4019 usage: org.onap.policy.apex.service.engine.main.ApexMain [options...]
4020 options
4021 -c,--config-file <CONFIG_FILE> the full path to the configuration file to use, the configuration file must be a Json file
4022 containing the Apex configuration parameters
4023 -h,--help outputs the usage of this command
4024 -m,--model-file <MODEL_FILE> the full path to the model file to use, if set it overrides the model file set in the
4025 configuration file
4026 -v,--version outputs the version of Apex
4027
4028The APEX CLI Editor
4029-------------------
4030
4031 .. container:: paragraph
4032
4033 The CLI Editor allows to define policies from the command
4034 line. The application uses a simple language and supports
4035 all elements of an APEX policy. It can be used in to
4036 different ways:
4037
4038 .. container:: ulist
4039
4040 - non-interactive, specifying a file with the commands to
4041 create a policy
4042
4043 - interactive, using the editors CLI to create a policy
4044
4045 .. container:: paragraph
4046
4047 When a policy is fully specified, the editor will generate
4048 the APEX core policy specification in JSON. This core
4049 specification is called the policy model in the APEX engine
4050 and can be used directly with the APEX engine.
4051
4052 .. container:: paragraph
4053
4054 On UNIX and Cygwin systems use:
4055
4056 .. container:: ulist
4057
4058 - ``apexCLIEditor.sh`` - simply starts the CLI editor,
4059 arguments to the script determine the mode of the editor
4060
4061 - ``apexApps.sh cli-editor`` - simply starts the CLI
4062 editor, arguments to the script determine the mode of the
4063 editor
4064
4065 .. container:: paragraph
4066
4067 On Windows systems use:
4068
4069 .. container:: ulist
4070
4071 - ``apexCLIEditor.bat`` - simply starts the CLI editor,
4072 arguments to the script determine the mode of the editor
4073
4074 - ``apexApps.bat cli-editor`` - simply starts the CLI
4075 editor, arguments to the script determine the mode of the
4076 editor
4077
4078 .. container:: paragraph
4079
4080 Summary of alternatives to start the APEX CLI Editor:
4081
4082 +------------------------------------------------------------+--------------------------------------------------------------+
4083 | Unix, Cygwin | Windows |
4084 +============================================================+==============================================================+
4085 | .. container:: | .. container:: |
4086 | | |
4087 | .. container:: listingblock | .. container:: listingblock |
4088 | | |
4089 | .. container:: content | .. container:: content |
4090 | | |
4091 | .. code:: | .. code:: |
4092 | | |
4093 | # $APEX_HOME/bin/apexCLIEditor.sh.sh [args] | > %APEX_HOME%\bin\apexCLIEditor.bat [args] |
4094 | # $APEX_HOME/bin/apexApps.sh cli-editor [args] | > %APEX_HOME%\bin\apexApps.bat cli-editor [args] |
4095 +------------------------------------------------------------+--------------------------------------------------------------+
4096
4097 .. container:: paragraph
4098
4099 The option ``-h`` provides a help screen with all command
4100 line arguments.
4101
4102 .. container:: listingblock
4103
4104 .. container:: content
4105
ramverma760cce92019-07-11 12:57:49 +00004106 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004107
4108 usage: org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain [options...]
4109 options
4110 -a,--model-props-file <MODEL_PROPS_FILE> name of the apex model properties file to use
4111 -c,--command-file <COMMAND_FILE> name of a file containing editor commands to run into the editor
4112 -h,--help outputs the usage of this command
4113 -i,--input-model-file <INPUT_MODEL_FILE> name of a file that contains an input model for the editor
4114 -if,--ignore-failures <IGNORE_FAILURES_FLAG> true or false, ignore failures of commands in command files and continue
4115 executing the command file
4116 -l,--log-file <LOG_FILE> name of a file that will contain command logs from the editor, will log
4117 to standard output if not specified or suppressed with "-nl" flag
4118 -m,--metadata-file <CMD_METADATA_FILE> name of the command metadata file to use
4119 -nl,--no-log if specified, no logging or output of commands to standard output or log
4120 file is carried out
4121 -nm,--no-model-output if specified, no output of a model to standard output or model output
4122 file is carried out, the user can use the "save" command in a script to
4123 save a model
4124 -o,--output-model-file <OUTPUT_MODEL_FILE> name of a file that will contain the output model for the editor, will
4125 output model to standard output if not specified or suppressed with
4126 "-nm" flag
4127 -wd,--working-directory <WORKING_DIRECTORY> the working directory that is the root for the CLI editor and is the
4128 root from which to look for included macro files
4129
a.sreekumar717a24a2019-07-26 13:47:42 +00004130The APEX CLI Tosca Editor
4131-------------------------
4132
4133 .. container:: paragraph
4134
4135 As per the new Policy LifeCycle API, the policies are expected to be defined as ToscaServiceTemplate. The CLI Tosca Editor is an extended version of the APEX CLI Editor which can generate the policies in ToscaServiceTemplate way.
4136
4137 .. container:: paragraph
4138
4139 The APEX config file(.json), command file(.apex) and the tosca template skeleton(.json) file paths need to be passed as input arguments to the CLI Tosca Editor. Policy in ToscaServiceTemplate format is generated as the output. This can be used as the input to Policy API for creating policies.
4140
4141 .. container:: paragraph
4142
4143 On UNIX and Cygwin systems use:
4144
4145 .. container:: ulist
4146
4147 - ``apexCLIToscaEditor.sh`` - starts the CLI Tosca editor,
4148 all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4149
4150 - ``apexApps.sh cli-tosca-editor`` - starts the CLI Tosca editor,
4151 all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4152
4153 .. container:: paragraph
4154
4155 On Windows systems use:
4156
4157 .. container:: ulist
4158
4159 - ``apexCLIToscaEditor.bat`` - starts the CLI Tosca editor,
4160 all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4161
4162 - ``apexApps.bat cli-tosca-editor`` - starts the CLI Tosca
4163 editor, all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4164
4165 .. container:: paragraph
4166
4167 Summary of alternatives to start the APEX CLI Tosca Editor:
4168
4169 +-----------------------------------------------------------------+--------------------------------------------------------------------+
4170 | Unix, Cygwin | Windows |
4171 +=================================================================+====================================================================+
4172 | .. container:: | .. container:: |
4173 | | |
4174 | .. container:: listingblock | .. container:: listingblock |
4175 | | |
4176 | .. container:: content | .. container:: content |
4177 | | |
4178 | .. code:: | .. code:: |
4179 | | |
4180 | # $APEX_HOME/bin/apexCLIToscaEditor.sh.sh [args] | > %APEX_HOME%\bin\apexCLIToscaEditor.bat [args] |
4181 | # $APEX_HOME/bin/apexApps.sh cli-tosca-editor [args]| > %APEX_HOME%\bin\apexApps.bat cli-tosca-editor [args] |
4182 +-----------------------------------------------------------------+--------------------------------------------------------------------+
4183
4184 .. container:: paragraph
4185
4186 The option ``-h`` provides a help screen with all command
4187 line arguments.
4188
4189 .. container:: listingblock
4190
4191 .. container:: content
4192
4193 .. code::
4194
4195 usage: org.onap.policy.apex.auth.clieditor.tosca.ApexCliToscaEditorMain [options...]
4196 options
4197 -a,--model-props-file <MODEL_PROPS_FILE> name of the apex model properties file to use
4198 -ac,--apex-config-file <APEX_CONFIG_FILE> name of the file containing apex configuration details
4199 -c,--command-file <COMMAND_FILE> name of a file containing editor commands to run into the editor
4200 -h,--help outputs the usage of this command
4201 -i,--input-model-file <INPUT_MODEL_FILE> name of a file that contains an input model for the editor
4202 -if,--ignore-failures <IGNORE_FAILURES_FLAG> true or false, ignore failures of commands in command files and
4203 continue executing the command file
4204 -l,--log-file <LOG_FILE> name of a file that will contain command logs from the editor, will
4205 log to standard output if not specified or suppressed with "-nl" flag
4206 -m,--metadata-file <CMD_METADATA_FILE> name of the command metadata file to use
4207 -nl,--no-log if specified, no logging or output of commands to standard output or
4208 log file is carried out
4209 -ot,--output-tosca-file <OUTPUT_TOSCA_FILE> name of a file that will contain the output ToscaServiceTemplate
4210 -t,--tosca-template-file <TOSCA_TEMPLATE_FILE> name of the input file containing tosca template which needs to be
4211 updated with policy
4212 -wd,--working-directory <WORKING_DIRECTORY> the working directory that is the root for the CLI editor and is the
4213 root from which to look for included macro files
4214
4215 .. container:: paragraph
4216
4217 An example command to run the APEX CLI Tosca editor on windows machine is given below.
4218
4219 .. container:: listingblock
4220
4221 .. container:: content
4222
4223 .. code::
4224
4225 %APEX_HOME%/\bin/\apexCLIToscaEditor.bat -c %APEX_HOME%\examples\PolicyModel.apex -ot %APEX_HOME%\examples\test.json -l %APEX_HOME%\examples\test.log -ac %APEX_HOME%\examples\RESTServerStandaloneJsonEvent.json -t %APEX_HOME%\examples\ToscaTemplate.json
4226
ramverma3b71c972019-07-10 11:25:37 +00004227The APEX REST Editor
4228--------------------
4229
4230 .. container:: paragraph
4231
4232 The standard way to use the APEX REST Editor is via an
4233 installation of the *war* file on a webserver. However, the
4234 REST editor can also be started via command line. This will
4235 start a Grizzly webserver with the *war* deployed. Access to
4236 the REST Editor is then via the provided URL
4237
4238 .. container:: paragraph
4239
4240 On UNIX and Cygwin systems use:
4241
4242 .. container:: ulist
4243
4244 - ``apexRESTEditor.sh`` - simply starts the webserver with
4245 the REST editor
4246
4247 - ``apexApps.sh rest-editor`` - simply starts the webserver
4248 with the REST editor
4249
4250 .. container:: paragraph
4251
4252 On Windows systems use:
4253
4254 .. container:: ulist
4255
4256 - ``apexRESTEditor.bat`` - simply starts the webserver with
4257 the REST editor
4258
4259 - ``apexApps.bat rest-editor`` - simply starts the
4260 webserver with the REST editor
4261
4262 .. container:: paragraph
4263
4264 Summary of alternatives to start the APEX REST Editor:
4265
4266 +-------------------------------------------------------------+---------------------------------------------------------------+
4267 | Unix, Cygwin | Windows |
4268 +=============================================================+===============================================================+
4269 | .. container:: | .. container:: |
4270 | | |
4271 | .. container:: listingblock | .. container:: listingblock |
4272 | | |
4273 | .. container:: content | .. container:: content |
4274 | | |
4275 | .. code:: | .. code:: |
4276 | | |
4277 | # $APEX_HOME/bin/apexRESTEditor.sh.sh [args] | > %APEX_HOME%\bin\apexRESTEditor.bat [args] |
4278 | # $APEX_HOME/bin/apexApps.sh rest-editor [args] | > %APEX_HOME%\bin\apexApps.bat rest-editor [args] |
4279 +-------------------------------------------------------------+---------------------------------------------------------------+
4280
4281 .. container:: paragraph
4282
4283 The option ``-h`` provides a help screen with all command
4284 line arguments.
4285
4286 .. container:: listingblock
4287
4288 .. container:: content
4289
ramverma760cce92019-07-11 12:57:49 +00004290 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004291
4292 usage: org.onap.policy.apex.client.editor.rest.ApexEditorMain [options...]
4293 -h,--help outputs the usage of this command
4294 -l,--listen <ADDRESS> the IP address to listen on. Default value is localhost to restrict access to the
4295 local machine only.
4296 -p,--port <PORT> port to use for the Apex RESTful editor REST calls.
4297 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating. Default
4298 value is -1 to run indefinitely.
4299
4300 .. container:: paragraph
4301
4302 If the REST Editor is started without any arguments the
4303 final messages will look similar to this:
4304
4305 .. container:: listingblock
4306
4307 .. container:: content
4308
ramverma760cce92019-07-11 12:57:49 +00004309 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004310
4311 Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4312 Sep 05, 2018 11:24:30 PM org.glassfish.grizzly.http.server.NetworkListener start
4313 INFO: Started listener bound to [localhost:18989]
4314 Sep 05, 2018 11:24:30 PM org.glassfish.grizzly.http.server.HttpServer start
4315 INFO: [HttpServer] Started.
4316 Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4317
4318 .. container:: paragraph
4319
4320 The last line states the URL on which the REST Editor can be
4321 accessed. The example above stated
4322 ``http://0.0.0.0:18989/apex/``. In a web browser use the URL
4323 ``http://localhost:18989`` and the REST Editor will start.
4324
4325The APEX Monitoring Client
4326--------------------------
4327
4328 .. container:: paragraph
4329
4330 The standard way to use the APEX Monitoring Client is via an
4331 installation of the *war* file on a webserver. However, the
4332 Monitoring Client can also be started via command line. This
4333 will start a Grizzly webserver with the *war* deployed.
4334 Access to the Monitoring Client is then via the provided URL
4335
4336 .. container:: paragraph
4337
4338 On UNIX and Cygwin systems use:
4339
4340 .. container:: ulist
4341
4342 - ``apexApps.sh eng-monitoring`` - simply starts the
4343 webserver with the Monitoring Client
4344
4345 .. container:: paragraph
4346
4347 On Windows systems use:
4348
4349 .. container:: ulist
4350
4351 - ``apexApps.bat eng-monitoring`` - simply starts the
4352 webserver with the Monitoring Client
4353
4354 .. container:: paragraph
4355
4356 The option ``-h`` provides a help screen with all command
4357 line arguments.
4358
4359 .. container:: listingblock
4360
4361 .. container:: content
4362
ramverma760cce92019-07-11 12:57:49 +00004363 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004364
4365 usage: org.onap.policy.apex.client.monitoring.rest.ApexMonitoringRestMain [options...]
4366 -h,--help outputs the usage of this command
4367 -p,--port <PORT> port to use for the Apex Services REST calls
4368 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating
4369
4370 .. container:: paragraph
4371
4372 If the Monitoring Client is started without any arguments
4373 the final messages will look similar to this:
4374
4375 .. container:: listingblock
4376
4377 .. container:: content
4378
ramverma760cce92019-07-11 12:57:49 +00004379 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004380
4381 Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4382 Sep 05, 2018 11:26:20 PM org.glassfish.grizzly.http.server.NetworkListener start
4383 INFO: Started listener bound to [localhost:18989]
4384 Sep 05, 2018 11:26:20 PM org.glassfish.grizzly.http.server.HttpServer start
4385 INFO: [HttpServer] Started.
4386 Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4387
4388 .. container:: paragraph
4389
4390 The last line states the URL on which the Monitoring Client
4391 can be accessed. The example above stated
4392 ``http://localhost:18989/apexservices``. In a web browser
4393 use the URL ``http://localhost:18989``.
4394
4395The APEX Deployment Client
4396--------------------------
4397
4398 .. container:: paragraph
4399
4400 The standard way to use the APEX Deployment Client is via an
4401 installation of the *war* file on a webserver. However, the
4402 Deployment Client can also be started via command line. This
4403 will start a Grizzly webserver with the *war* deployed.
4404 Access to the Deployment Client is then via the provided URL
4405
4406 .. container:: paragraph
4407
4408 On UNIX and Cygwin systems use:
4409
4410 .. container:: ulist
4411
4412 - ``apexApps.sh eng-deployment`` - simply starts the
4413 webserver with the Deployment Client
4414
4415 .. container:: paragraph
4416
4417 On Windows systems use:
4418
4419 .. container:: ulist
4420
4421 - ``apexApps.bat eng-deployment`` - simply starts the
4422 webserver with the Deployment Client
4423
4424 .. container:: paragraph
4425
4426 The option ``-h`` provides a help screen with all command
4427 line arguments.
4428
4429 .. container:: listingblock
4430
4431 .. container:: content
4432
ramverma760cce92019-07-11 12:57:49 +00004433 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004434
4435 usage: org.onap.policy.apex.client.deployment.rest.ApexDeploymentRestMain [options...]
4436 -h,--help outputs the usage of this command
4437 -p,--port <PORT> port to use for the Apex Services REST calls
4438 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating
4439
4440 .. container:: paragraph
4441
4442 If the Deployment Client is started without any arguments
4443 the final messages will look similar to this:
4444
4445 .. container:: listingblock
4446
4447 .. container:: content
4448
ramverma760cce92019-07-11 12:57:49 +00004449 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004450
4451 Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4452 Sep 05, 2018 11:27:09 PM org.glassfish.grizzly.http.server.NetworkListener start
4453 INFO: Started listener bound to [localhost:18989]
4454 Sep 05, 2018 11:27:09 PM org.glassfish.grizzly.http.server.HttpServer start
4455 INFO: [HttpServer] Started.
4456 Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4457
4458 .. container:: paragraph
4459
4460 The last line states the URL on which the Deployment Client
4461 can be accessed. The example above stated
4462 ``http://localhost:18989/apexservices``. In a web browser
4463 use the URL ``http://localhost:18989``.
4464
4465The APEX Full Client
4466--------------------
4467
4468 .. container:: paragraph
4469
4470 The APEX Full Client combines the REST Editor, the
4471 Monitoring Client, and the Deployment Client into a single
4472 application. The standard way to use the APEX Full Client is
4473 via an installation of the *war* file on a webserver.
4474 However, the Full Client can also be started via command
4475 line. This will start a Grizzly webserver with the *war*
4476 deployed. Access to the Full Client is then via the provided
4477 URL
4478
4479 .. container:: paragraph
4480
4481 On UNIX and Cygwin systems use:
4482
4483 .. container:: ulist
4484
4485 - ``apexApps.sh full-client`` - simply starts the webserver
4486 with the Full Client
4487
4488 .. container:: paragraph
4489
4490 On Windows systems use:
4491
4492 .. container:: ulist
4493
4494 - ``apexApps.bat full-client`` - simply starts the
4495 webserver with the Full Client
4496
4497 .. container:: paragraph
4498
4499 The option ``-h`` provides a help screen with all command
4500 line arguments.
4501
4502 .. container:: listingblock
4503
4504 .. container:: content
4505
ramverma760cce92019-07-11 12:57:49 +00004506 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004507
4508 usage: org.onap.policy.apex.client.full.rest.ApexServicesRestMain [options...]
4509 -h,--help outputs the usage of this command
4510 -p,--port <PORT> port to use for the Apex Services REST calls
4511 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating
4512
4513 .. container:: paragraph
4514
4515 If the Full Client is started without any arguments the
4516 final messages will look similar to this:
4517
4518 .. container:: listingblock
4519
4520 .. container:: content
4521
ramverma760cce92019-07-11 12:57:49 +00004522 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004523
4524 Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4525 Sep 05, 2018 11:28:28 PM org.glassfish.grizzly.http.server.NetworkListener start
4526 INFO: Started listener bound to [localhost:18989]
4527 Sep 05, 2018 11:28:28 PM org.glassfish.grizzly.http.server.HttpServer start
4528 INFO: [HttpServer] Started.
4529 Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4530
4531 .. container:: paragraph
4532
4533 The last line states the URL on which the Monitoring Client
4534 can be accessed. The example above stated
4535 ``http://localhost:18989/apexservices``. In a web browser
4536 use the URL ``http://localhost:18989``.
4537
aditya.puthuparambil9e67eb72020-04-30 15:59:43 +01004538The APEX Application Launcher
4539-----------------------------
ramverma3b71c972019-07-10 11:25:37 +00004540
4541 .. container:: paragraph
4542
4543 The standard applications (Engine, CLI Editor, REST Editor)
4544 come with dedicated start scripts. For all other APEX
4545 applications, we provide an application launcher.
4546
4547 .. container:: paragraph
4548
4549 On UNIX and Cygwin systems use:
4550
4551 .. container:: ulist
4552
4553 - apexApps.sh\` - simply starts the application launcher
4554
4555 .. container:: paragraph
4556
4557 On Windows systems use:
4558
4559 .. container:: ulist
4560
4561 - ``apexApps.bat`` - simply starts the application launcher
4562
4563 .. container:: paragraph
4564
4565 Summary of alternatives to start the APEX application
4566 launcher:
4567
4568 +-------------------------------------------------+---------------------------------------------------+
4569 | Unix, Cygwin | Windows |
4570 +=================================================+===================================================+
4571 | .. container:: | .. container:: |
4572 | | |
4573 | .. container:: listingblock | .. container:: listingblock |
4574 | | |
4575 | .. container:: content | .. container:: content |
4576 | | |
4577 | .. code:: | .. code:: |
4578 | | |
4579 | # $APEX_HOME/bin/apexApps.sh [args] | > %APEX_HOME%\bin\apexApps.bat [args] |
4580 +-------------------------------------------------+---------------------------------------------------+
4581
4582 .. container:: paragraph
4583
4584 The option ``-h`` provides a help screen with all launcher
4585 command line arguments.
4586
4587 .. container:: listingblock
4588
4589 .. container:: content
4590
ramverma760cce92019-07-11 12:57:49 +00004591 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004592
4593 apexApps.sh - runs APEX applications
4594
4595 Usage: apexApps.sh [options] | [<application> [<application options>]]
4596
4597 Options
4598 -d <app> - describes an application
4599 -l - lists all applications supported by this script
4600 -h - this help screen
4601
4602 .. container:: paragraph
4603
4604 Using ``-l`` lists all known application the launcher can
4605 start.
4606
4607 .. container:: listingblock
4608
4609 .. container:: content
4610
ramverma760cce92019-07-11 12:57:49 +00004611 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004612
4613 apexApps.sh: supported applications:
4614 --> ws-echo engine eng-monitoring full-client eng-deployment tpl-event-json model-2-cli rest-editor cli-editor ws-console
4615
4616 .. container:: paragraph
4617
4618 Using the ``-d <name>`` option describes the named
4619 application, for instance for the ``ws-console``:
4620
4621 .. container:: listingblock
4622
4623 .. container:: content
4624
ramverma760cce92019-07-11 12:57:49 +00004625 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004626
4627 apexApps.sh: application 'ws-console'
4628 --> a simple console sending events to APEX, connect to APEX consumer port
4629
4630 .. container:: paragraph
4631
4632 Launching an application is done by calling the script with
4633 only the application name and any CLI arguments for the
4634 application. For instance, starting the ``ws-echo``
4635 application with port ``8888``:
4636
4637 .. container:: listingblock
4638
4639 .. container:: content
4640
ramverma760cce92019-07-11 12:57:49 +00004641 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004642
4643 apexApps.sh ws-echo -p 8888
4644
4645Application: Create Event Templates
4646-----------------------------------
4647
4648 .. container:: paragraph
4649
4650 **Status: Experimental**
4651
4652 .. container:: paragraph
4653
4654 This application takes a policy model (JSON or XML encoded)
4655 and generates templates for events in JSON format. This can
4656 help when a policy defines rather complex trigger or action
4657 events or complex events between states. The application can
4658 produce events for the types: stimuli (policy trigger
4659 events), internal (events between policy states), and
4660 response (action events).
4661
4662 +----------------------------------------------------------------+------------------------------------------------------------------+
4663 | Unix, Cygwin | Windows |
4664 +================================================================+==================================================================+
4665 | .. container:: | .. container:: |
4666 | | |
4667 | .. container:: listingblock | .. container:: listingblock |
4668 | | |
4669 | .. container:: content | .. container:: content |
4670 | | |
4671 | .. code:: | .. code:: |
4672 | | |
4673 | # $APEX_HOME/bin/apexApps.sh tpl-event-json [args] | > %APEX_HOME%\bin\apexApps.bat tpl-event-json [args] |
4674 +----------------------------------------------------------------+------------------------------------------------------------------+
4675
4676 .. container:: paragraph
4677
4678 The option ``-h`` provides a help screen.
4679
4680 .. container:: listingblock
4681
4682 .. container:: content
4683
ramverma760cce92019-07-11 12:57:49 +00004684 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004685
4686 gen-model2event v{release-version} - generates JSON templates for events generated from a policy model
4687 usage: gen-model2event
4688 -h,--help prints this help and usage screen
4689 -m,--model <MODEL-FILE> set the input policy model file
4690 -t,--type <TYPE> set the event type for generation, one of:
4691 stimuli (trigger events), response (action
4692 events), internal (events between states)
4693 -v,--version prints the application version
4694
4695 .. container:: paragraph
4696
4697 The created templates are not valid events, instead they use
4698 some markup for values one will need to change to actual
4699 values. For instance, running the tool with the *Sample
4700 Domain* policy model as:
4701
4702 .. container:: listingblock
4703
4704 .. container:: content
4705
ramverma760cce92019-07-11 12:57:49 +00004706 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004707
4708 apexApps.sh tpl-event-json -m $APEX_HOME/examples/models/SampleDomain/SamplePolicyModelJAVA.json -t stimuli
4709
4710 .. container:: paragraph
4711
4712 will produce the following status messages:
4713
4714 .. container:: listingblock
4715
4716 .. container:: content
4717
ramverma760cce92019-07-11 12:57:49 +00004718 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004719
4720 gen-model2event: starting Event generator
4721 --> model file: examples/models/SampleDomain/SamplePolicyModelJAVA.json
4722 --> type: stimuli
4723
4724 .. container:: paragraph
4725
4726 and then run the generator application producing two event
4727 templates. The first template is called ``Event0000``.
4728
4729 .. container:: listingblock
4730
4731 .. container:: content
4732
4733 .. code::
4734
4735 {
4736 "name" : "Event0000",
4737 "nameSpace" : "org.onap.policy.apex.sample.events",
4738 "version" : "0.0.1",
4739 "source" : "Outside",
4740 "target" : "Match",
4741 "TestTemperature" : ###double: 0.0###,
4742 "TestTimestamp" : ###long: 0###,
4743 "TestMatchCase" : ###integer: 0###,
4744 "TestSlogan" : "###string###"
4745 }
4746
4747 .. container:: paragraph
4748
4749 The values for the keys are marked with ``#`` and the
4750 expected type of the value. To create an actual stimuli
4751 event, all these markers need to be change to actual values,
4752 for instance:
4753
4754 .. container:: listingblock
4755
4756 .. container:: content
4757
ramverma760cce92019-07-11 12:57:49 +00004758 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004759
4760 {
4761 "name" : "Event0000",
4762 "nameSpace" : "org.onap.policy.apex.sample.events",
4763 "version" : "0.0.1",
4764 "source" : "Outside",
4765 "target" : "Match",
4766 "TestTemperature" : 25,
4767 "TestTimestamp" : 123456789123456789,
4768 "TestMatchCase" : 1,
4769 "TestSlogan" : "Testing the Match Case with Temperature 25"
4770 }
4771
4772Application: Convert a Policy Model to CLI Editor Commands
4773----------------------------------------------------------
4774
4775 .. container:: paragraph
4776
4777 **Status: Experimental**
4778
4779 .. container:: paragraph
4780
4781 This application takes a policy model (JSON or XML encoded)
4782 and generates commands for the APEX CLI Editor. This
4783 effectively reverses a policy specification realized with
4784 the CLI Editor.
4785
4786 +-------------------------------------------------------------+---------------------------------------------------------------+
4787 | Unix, Cygwin | Windows |
4788 +=============================================================+===============================================================+
4789 | .. container:: | .. container:: |
4790 | | |
4791 | .. container:: listingblock | .. container:: listingblock |
4792 | | |
4793 | .. container:: content | .. container:: content |
4794 | | |
4795 | .. code:: | .. code:: |
4796 | | |
4797 | # $APEX_HOME/bin/apexApps.sh model-2-cli [args] | > %APEX_HOME%\bin\apexApps.bat model-2-cli [args] |
4798 +-------------------------------------------------------------+---------------------------------------------------------------+
4799
4800 .. container:: paragraph
4801
4802 The option ``-h`` provides a help screen.
4803
4804 .. container:: listingblock
4805
4806 .. container:: content
4807
ramverma760cce92019-07-11 12:57:49 +00004808 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004809
4810 usage: gen-model2cli
4811 -h,--help prints this help and usage screen
4812 -m,--model <MODEL-FILE> set the input policy model file
4813 -sv,--skip-validation switch of validation of the input file
4814 -v,--version prints the application version
4815
4816 .. container:: paragraph
4817
4818 For instance, running the tool with the *Sample Domain*
4819 policy model as:
4820
4821 .. container:: listingblock
4822
4823 .. container:: content
4824
ramverma760cce92019-07-11 12:57:49 +00004825 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004826
4827 apexApps.sh model-2-cli -m $APEX_HOME/examples/models/SampleDomain/SamplePolicyModelJAVA.json
4828
4829 .. container:: paragraph
4830
4831 will produce the following status messages:
4832
4833 .. container:: listingblock
4834
4835 .. container:: content
4836
ramverma760cce92019-07-11 12:57:49 +00004837 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004838
4839 gen-model2cli: starting CLI generator
4840 --> model file: examples/models/SampleDomain/SamplePolicyModelJAVA.json
4841
4842 .. container:: paragraph
4843
4844 and then run the generator application producing all CLI
4845 Editor commands and printing them to standard out.
4846
4847Application: Websocket Clients (Echo and Console)
4848-------------------------------------------------
4849
4850 .. container:: paragraph
4851
4852 **Status: Production**
4853
4854 .. container:: paragraph
4855
4856 The application launcher also provides a Websocket echo
4857 client and a Websocket console client. The echo client
4858 connects to APEX and prints all events it receives from
4859 APEX. The console client connects to APEX, reads input from
4860 the command line, and sends this input as events to APEX.
4861
4862 +------------------------------------------------------------+--------------------------------------------------------------+
4863 | Unix, Cygwin | Windows |
4864 +============================================================+==============================================================+
4865 | .. container:: | .. container:: |
4866 | | |
4867 | .. container:: listingblock | .. container:: listingblock |
4868 | | |
4869 | .. container:: content | .. container:: content |
4870 | | |
4871 | .. code:: | .. code:: |
4872 | | |
4873 | # $APEX_HOME/bin/apexApps.sh ws-echo [args] | > %APEX_HOME%\bin\apexApps.bat ws-echo [args] |
4874 | # $APEX_HOME/bin/apexApps.sh ws-console [args] | > %APEX_HOME%\bin\apexApps.bat ws-console [args] |
4875 +------------------------------------------------------------+--------------------------------------------------------------+
4876
4877 .. container:: paragraph
4878
4879 The arguments are the same for both applications:
4880
4881 .. container:: ulist
4882
4883 - ``-p`` defines the Websocket port to connect to (defaults
4884 to ``8887``)
4885
4886 - ``-s`` defines the host on which a Websocket server is
4887 running (defaults to ``localhost``)
4888
4889 .. container:: paragraph
4890
4891 A discussion on how to use these two applications to build
4892 an APEX system is detailed HowTo-Websockets.
4893
ramverma3b71c972019-07-10 11:25:37 +00004894APEX Logging
4895^^^^^^^^^^^^
4896
4897Introduction to APEX Logging
4898----------------------------
4899
4900 .. container:: paragraph
4901
4902 All APEX components make extensive use of logging using the
4903 logging façade `SLF4J <https://www.slf4j.org/>`__ with the
4904 backend `Logback <https://logback.qos.ch/>`__. Both are used
4905 off-the-shelve, so the standard documentation and
4906 configuration apply to APEX logging. For details on how to
4907 work with logback please see the `logback
4908 manual <https://logback.qos.ch/manual/index.html>`__.
4909
4910 .. container:: paragraph
4911
4912 The APEX applications is the logback configuration file
4913 ``$APEX_HOME/etc/logback.xml`` (Windows:
4914 ``%APEX_HOME%\etc\logback.xml``). The logging backend is set
4915 to no debug, i.e. logs from the logging framework should be
4916 hidden at runtime.
4917
4918 .. container:: paragraph
4919
4920 The configurable log levels work as expected:
4921
4922 .. container:: ulist
4923
4924 - *error* (or *ERROR*) is used for serious errors in the
4925 APEX runtime engine
4926
4927 - *warn* (or *WARN*) is used for warnings, which in general
4928 can be ignored but might indicate some deeper problems
4929
4930 - *info* (or *INFO*) is used to provide generally
4931 interesting messages for startup and policy execution
4932
4933 - *debug* (or *DEBUG*) provides more details on startup and
4934 policy execution
4935
4936 - *trace* (or *TRACE*) gives full details on every aspect
4937 of the APEX engine from start to end
4938
4939 .. container:: paragraph
4940
4941 The loggers can also be configured as expected. The standard
4942 configuration (after installing APEX) uses log level *info*
4943 on all APEX classes (components).
4944
4945 .. container:: paragraph
4946
4947 The applications and scripts in ``$APEX_HOME/bin`` (Windows:
4948 ``%APEX_HOME\bin``) are configured to use the logback
4949 configuration ``$APEX_HOME/etc/logback.xml`` (Windows:
4950 ``%APEX_HOME\etc\logback.xml``). There are multiple ways to
4951 use different logback configurations, for instance:
4952
4953 .. container:: ulist
4954
4955 - Maintain multiple configurations in ``etc``, for instance
4956 a ``logback-debug.xml`` for deep debugging and a
4957 ``logback-production.xml`` for APEX in production mode,
4958 then copy the required configuration file to the used
4959 ``logback.xml`` prior starting APEX
4960
4961 - Edit the scripts in ``bin`` to use a different logback
4962 configuration file (only recommended if you are familiar
4963 with editing bash scripts or windows batch files)
4964
4965Standard Logging Configuration
4966------------------------------
4967
4968 .. container:: paragraph
4969
4970 The standard logging configuration defines a context *APEX*,
4971 which is used in the standard output pattern. The location
liamfallon1540e472019-11-28 15:14:07 +00004972 for log files is defined in the property ``logDir`` and set
ramverma3b71c972019-07-10 11:25:37 +00004973 to ``/var/log/onap/policy/apex-pdp``. The standard status
4974 listener is set to *NOP* and the overall logback
4975 configuration is set to no debug.
4976
4977 .. container:: listingblock
4978
4979 .. container:: content
4980
ramverma760cce92019-07-11 12:57:49 +00004981 .. code::
ramverma3b71c972019-07-10 11:25:37 +00004982 :number-lines:
4983
4984 <configuration debug="false">
4985 <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
4986
4987 <contextName>Apex</contextName>
liamfallon1540e472019-11-28 15:14:07 +00004988 <property name="logDir" value="/var/log/onap/policy/apex-pdp/" />
ramverma3b71c972019-07-10 11:25:37 +00004989
4990 ...appenders
4991 ...loggers
4992 </configuration>
4993
4994.. container:: paragraph
4995
4996 The first appender defined is called ``STDOUT`` for logs to standard
4997 out.
4998
4999.. container:: listingblock
5000
5001 .. container:: content
5002
ramverma760cce92019-07-11 12:57:49 +00005003 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005004 :number-lines:
5005
5006 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5007 <encoder>
5008 <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
5009 </encoder>
5010 </appender>
5011
5012.. container:: paragraph
5013
5014 The root level logger then is set to the level *info* using the
5015 standard out appender.
5016
5017.. container:: listingblock
5018
5019 .. container:: content
5020
ramverma760cce92019-07-11 12:57:49 +00005021 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005022 :number-lines:
5023
5024 <root level="info">
5025 <appender-ref ref="STDOUT" />
5026 </root>
5027
5028.. container:: paragraph
5029
5030 The second appender is called ``FILE``. It writes logs to a file
5031 ``apex.log``.
5032
5033.. container:: listingblock
5034
5035 .. container:: content
5036
ramverma760cce92019-07-11 12:57:49 +00005037 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005038 :number-lines:
5039
5040 <appender name="FILE" class="ch.qos.logback.core.FileAppender">
liamfallon1540e472019-11-28 15:14:07 +00005041 <file>${logDir}/apex.log</file>
ramverma3b71c972019-07-10 11:25:37 +00005042 <encoder>
5043 <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %n %ex{full}</pattern>
5044 </encoder>
5045 </appender>
5046
5047.. container:: paragraph
5048
5049 The third appender is called ``CTXT_FILE``. It writes logs to a file
5050 ``apex_ctxt.log``.
5051
5052.. container:: listingblock
5053
5054 .. container:: content
5055
ramverma760cce92019-07-11 12:57:49 +00005056 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005057 :number-lines:
5058
5059 <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
liamfallon1540e472019-11-28 15:14:07 +00005060 <file>${logDir}/apex_ctxt.log</file>
ramverma3b71c972019-07-10 11:25:37 +00005061 <encoder>
5062 <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %n %ex{full}</pattern>
5063 </encoder>
5064 </appender>
5065
5066.. container:: paragraph
5067
5068 The last definitions are for specific loggers. The first logger
5069 captures all standard APEX classes. It is configured for log level
5070 *info* and uses the standard output and file appenders. The second
5071 logger captures APEX context classes responsible for context
5072 monitoring. It is configured for log level *trace* and uses the
5073 context file appender.
5074
5075.. container:: listingblock
5076
5077 .. container:: content
5078
ramverma760cce92019-07-11 12:57:49 +00005079 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005080 :number-lines:
5081
5082
5083 <logger name="org.onap.policy.apex" level="info" additivity="false">
5084 <appender-ref ref="STDOUT" />
5085 <appender-ref ref="FILE" />
5086 </logger>
5087
5088 <logger name="org.onap.policy.apex.core.context.monitoring" level="TRACE" additivity="false">
5089 <appender-ref ref="CTXT_FILE" />
5090 </logger>
5091
5092Adding Logback Status and Debug
5093-------------------------------
5094
5095 .. container:: paragraph
5096
5097 To activate logback status messages change the status listener
5098 from 'NOP' to for instance console.
5099
5100 .. container:: listingblock
5101
5102 .. container:: content
5103
ramverma760cce92019-07-11 12:57:49 +00005104 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005105
5106 <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
5107
5108 .. container:: paragraph
5109
5110 To activate all logback debugging, for instance to debug a new
5111 logback configuration, activate the debug attribute in the
5112 configuration.
5113
5114 .. container:: listingblock
5115
5116 .. container:: content
5117
ramverma760cce92019-07-11 12:57:49 +00005118 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005119
5120 <configuration debug="true">
5121 ...
5122 </configuration>
5123
5124Logging External Components
5125---------------------------
5126
5127 .. container:: paragraph
5128
5129 Logback can also be configured to log any other, external
5130 components APEX is using, if they are using the common logging
5131 framework.
5132
5133 .. container:: paragraph
5134
5135 For instance, the context component of APEX is using *Infinispan*
5136 and one can add a logger for this external component. The
5137 following example adds a logger for *Infinispan* using the
5138 standard output appender.
5139
5140 .. container:: listingblock
5141
5142 .. container:: content
5143
ramverma760cce92019-07-11 12:57:49 +00005144 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005145
5146 <logger name="org.infinispan" level="INFO" additivity="false">
5147 <appender-ref ref="STDOUT" />
5148 </logger>
5149
5150 .. container:: paragraph
5151
5152 Another example is Apache Zookeeper. The following example adds a
5153 logger for Zookeeper using the standard outout appender.
5154
5155 .. container:: listingblock
5156
5157 .. container:: content
5158
ramverma760cce92019-07-11 12:57:49 +00005159 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005160
5161 <logger name="org.apache.zookeeper.ClientCnxn" level="INFO" additivity="false">
5162 <appender-ref ref="STDOUT" />
5163 </logger>
5164
5165Configuring loggers for Policy Logic
5166------------------------------------
5167
5168 .. container:: paragraph
5169
5170 The logging for the logic inside a policy (task logic, task
5171 selection logic, state finalizer logic) can be configured separate
5172 from standard logging. The logger for policy logic is
5173 ``org.onap.policy.apex.executionlogging``. The following example
5174 defines
5175
5176 .. container:: ulist
5177
5178 - a new appender for standard out using a very simple pattern
5179 (simply the actual message)
5180
5181 - a logger for policy logic to standard out using the new
5182 appender and the already described file appender.
5183
5184 .. container:: listingblock
5185
5186 .. container:: content
5187
ramverma760cce92019-07-11 12:57:49 +00005188 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005189
5190 <appender name="POLICY_APPENDER_STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5191 <encoder>
5192 <pattern>policy: %msg\n</pattern>
5193 </encoder>
5194 </appender>
5195
5196 <logger name="org.onap.policy.apex.executionlogging" level="info" additivity="false">
5197 <appender-ref ref="POLICY_APPENDER_STDOUT" />
5198 <appender-ref ref="FILE" />
5199 </logger>
5200
5201 .. container:: paragraph
5202
5203 It is also possible to use specific logging for parts of policy
5204 logic. The following example defines a logger for task logic.
5205
5206 .. container:: listingblock
5207
5208 .. container:: content
5209
ramverma760cce92019-07-11 12:57:49 +00005210 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005211
5212 <logger name="org.onap.policy.apex.executionlogging.TaskExecutionLogging" level="TRACE" additivity="false">
5213 <appender-ref ref="POLICY_APPENDER_STDOUT" />
5214 </logger>
5215
5216Rolling File Appenders
5217----------------------
5218
5219 .. container:: paragraph
5220
5221 Rolling file appenders are a good option for more complex logging
5222 of a production or complex testing APEX installation. The standard
5223 logback configuration can be used for these use cases. This
5224 section gives two examples for the standard logging and for
5225 context logging.
5226
5227 .. container:: paragraph
5228
5229 First the standard logging. The following example defines a
5230 rolling file appender. The appender rolls over on a daily basis.
5231 It allows for a file size of 100 MB.
5232
5233 .. container:: listingblock
5234
5235 .. container:: content
5236
ramverma760cce92019-07-11 12:57:49 +00005237 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005238
5239 <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
liamfallon1540e472019-11-28 15:14:07 +00005240 <file>${logDir}/apex.log</file>
ramverma3b71c972019-07-10 11:25:37 +00005241 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
5242 <!-- rollover daily -->
5243 <!-- <fileNamePattern>xstream-%d{yyyy-MM-dd}.%i.txt</fileNamePattern> -->
liamfallon1540e472019-11-28 15:14:07 +00005244 <fileNamePattern>${logDir}/apex_%d{yyyy-MM-dd}.%i.log.gz
ramverma3b71c972019-07-10 11:25:37 +00005245 </fileNamePattern>
5246 <maxHistory>4</maxHistory>
5247 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
5248 <!-- or whenever the file size reaches 100MB -->
5249 <maxFileSize>100MB</maxFileSize>
5250 </timeBasedFileNamingAndTriggeringPolicy>
5251 </rollingPolicy>
5252 <encoder>
5253 <pattern>
5254 %d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %ex{full} %n
5255 </pattern>
5256 </encoder>
5257 </appender>
5258
5259 .. container:: paragraph
5260
5261 A very similar configuration can be used for a rolling file
5262 appender logging APEX context.
5263
5264 .. container:: listingblock
5265
5266 .. container:: content
5267
ramverma760cce92019-07-11 12:57:49 +00005268 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005269
5270 <appender name="CTXT-FILE"
5271 class="ch.qos.logback.core.rolling.RollingFileAppender">
liamfallon1540e472019-11-28 15:14:07 +00005272 <file>${logDir}/apex_ctxt.log</file>
ramverma3b71c972019-07-10 11:25:37 +00005273 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
liamfallon1540e472019-11-28 15:14:07 +00005274 <fileNamePattern>${logDir}/apex_ctxt_%d{yyyy-MM-dd}.%i.log.gz
ramverma3b71c972019-07-10 11:25:37 +00005275 </fileNamePattern>
5276 <maxHistory>4</maxHistory>
5277 <timeBasedFileNamingAndTriggeringPolicy
5278 class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
5279 <maxFileSize>100MB</maxFileSize>
5280 </timeBasedFileNamingAndTriggeringPolicy>
5281 </rollingPolicy>
5282 <encoder>
5283 <pattern>
5284 %d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %ex{full} %n
5285 </pattern>
5286 </encoder>
5287 </appender>
5288
5289Example Configuration for Logging Logic
5290---------------------------------------
5291
5292 .. container:: paragraph
5293
5294 The following example shows a configuration that logs policy logic
5295 to standard out and a file (*info*). All other APEX components are
5296 logging to a file (*debug*).. This configuration an be used in a
5297 pre-production phase with the APEX engine still running in a
5298 separate terminal to monitor policy execution. This logback
5299 configuration is in the APEX installation as
5300 ``etc/logback-logic.xml``.
5301
5302 .. container:: listingblock
5303
5304 .. container:: content
5305
ramverma760cce92019-07-11 12:57:49 +00005306 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005307
5308 <configuration debug="false">
5309 <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
5310
5311 <contextName>Apex</contextName>
liamfallon1540e472019-11-28 15:14:07 +00005312 <property name="logDir" value="/var/log/onap/policy/apex-pdp/" />
ramverma3b71c972019-07-10 11:25:37 +00005313
5314 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5315 <encoder>
5316 <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
5317 </encoder>
5318 </appender>
5319
5320 <appender name="FILE" class="ch.qos.logback.core.FileAppender">
liamfallon1540e472019-11-28 15:14:07 +00005321 <file>${logDir}/apex.log</file>
ramverma3b71c972019-07-10 11:25:37 +00005322 <encoder>
5323 <pattern>
5324 %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full}
5325 </pattern>
5326 </encoder>
5327 </appender>
5328
5329 <appender name="POLICY_APPENDER_STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5330 <encoder>
5331 <pattern>policy: %msg\n</pattern>
5332 </encoder>
5333 </appender>
5334
5335 <root level="error">
5336 <appender-ref ref="STDOUT" />
5337 </root>
5338
5339 <logger name="org.onap.policy.apex" level="debug" additivity="false">
5340 <appender-ref ref="FILE" />
5341 </logger>
5342
5343 <logger name="org.onap.policy.apex.executionlogging" level="info" additivity="false">
5344 <appender-ref ref="POLICY_APPENDER_STDOUT" />
5345 <appender-ref ref="FILE" />
5346 </logger>
5347 </configuration>
5348
5349Example Configuration for a Production Server
5350---------------------------------------------
5351
5352 .. container:: paragraph
5353
5354 The following example shows a configuration that logs all APEX
5355 components, including policy logic, to a file (*debug*). This
5356 configuration an be used in a production phase with the APEX
5357 engine being executed as a service on a system without console
5358 output. This logback configuration is in the APEX installation as
5359 ``logback-server.xml``
5360
5361 .. container:: listingblock
5362
5363 .. container:: content
5364
ramverma760cce92019-07-11 12:57:49 +00005365 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005366
5367 <configuration debug="false">
5368 <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
5369
5370 <contextName>Apex</contextName>
liamfallon1540e472019-11-28 15:14:07 +00005371 <property name="logDir" value="/var/log/onap/policy/apex-pdp/" />
ramverma3b71c972019-07-10 11:25:37 +00005372
5373 <appender name="FILE" class="ch.qos.logback.core.FileAppender">
liamfallon1540e472019-11-28 15:14:07 +00005374 <file>${logDir}/apex.log</file>
ramverma3b71c972019-07-10 11:25:37 +00005375 <encoder>
5376 <pattern>
5377 %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full}
5378 </pattern>
5379 </encoder>
5380 </appender>
5381
5382 <root level="debug">
5383 <appender-ref ref="FILE" />
5384 </root>
5385
5386 <logger name="org.onap.policy.apex.executionlogging" level="debug" additivity="false">
5387 <appender-ref ref="FILE" />
5388 </logger>
5389 </configuration>
5390
5391Building a System with Websocket Backend
5392^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5393
5394Websockets
5395----------
5396
5397 .. container:: paragraph
5398
5399 Websocket is a protocol to run sockets of HTTP. Since it in
5400 essence a socket, the connection is realized between a
5401 server (waiting for connections) and a client (connecting to
5402 a server). Server/client separation is only important for
5403 connection establishment, once connected, everyone can
5404 send/receive on the same socket (as any standard socket
5405 would allow).
5406
5407 .. container:: paragraph
5408
5409 Standard Websocket implementations are simple, no
5410 publish/subscribe and no special event handling. Most
5411 servers simply send all incoming messages to all
5412 connections. There is a PubSub definition on top of
5413 Websocket called `WAMP <http://wamp-proto.org/>`__. APEX
5414 does not support WAMP at the moment.
5415
5416Websocket in Java
5417-----------------
5418
5419 .. container:: paragraph
5420
5421 In Java, `JSR
5422 356 <http://www.oracle.com/technetwork/articles/java/jsr356-1937161.html>`__
5423 defines the standard Websocket API. This JSR is part of Jave
5424 EE 7 standard. For Java SE, several implementations exist in
5425 open source. Since Websockets are a stable standard and
5426 simple, most implementations are stable and ready to use. A
5427 lot of products support Websockets, like Spring, JBoss,
5428 Netty, … there are also Kafka extensions for Websockets.
5429
5430Websocket Example Code for Websocket clients (FOSS)
5431---------------------------------------------------
5432
5433 .. container:: paragraph
5434
5435 There are a lot of implementations and examples available on
5436 Github for Websocket clients. If one is using Java EE 7,
5437 then one can also use the native Websocket implementation.
5438 Good examples for clients using simply Java SE are here:
5439
5440 .. container:: ulist
5441
5442 - `Websocket
5443 implementation <https://github.com/TooTallNate/Java-WebSocket>`__
5444
5445 - `Websocket sending client example, using
5446 AWT <https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/ChatClient.java>`__
5447
5448 - `Websocket receiving client example (simple echo
5449 client) <https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/ExampleClient.java>`__
5450
5451 .. container:: paragraph
5452
5453 For Java EE, the native Websocket API is explained here:
5454
5455 .. container:: ulist
5456
5457 - `Oracle
5458 docs <http://www.oracle.com/technetwork/articles/java/jsr356-1937161.html>`__
5459
5460 - link: `An
5461 example <http://www.programmingforliving.com/2013/08/jsr-356-java-api-for-websocket-client-api.html>`__
5462
5463BCP: Websocket Configuration
5464----------------------------
5465
5466 .. container:: paragraph
5467
5468 The probably best is to configure APEX for Websocket servers
5469 for input (ingress, consume) and output (egress, produce)
5470 interfaces. This means that APEX will start Websocket
5471 servers on named ports and wait for clients to connect.
5472 Advantage: once APEX is running all connectivity
5473 infrastructure is running as well. Consequence: if APEX is
5474 not running, everyone else is in the dark, too.
5475
5476 .. container:: paragraph
5477
5478 The best protocol to be used is JSON string. Each event on
5479 any interface is then a string with a JSON encoding. JSON
5480 string is a little bit slower than byte code, but we doubt
5481 that this will be noticeable. A further advantage of JSON
5482 strings over Websockets with APEX starting the servers: it
5483 is very easy to connect web browsers to such a system.
5484 Simple connect the web browser to the APEX sockets and
5485 send/read JSON strings.
5486
5487 .. container:: paragraph
5488
5489 Once APEX is started you simply connect Websocket clients to
5490 it, and send/receive event. When APEX is terminated, the
5491 Websocket servers go down, and the clients will be
5492 disconnected. APEX does not (yet) support auto-client
5493 reconnect nor WAMP, so clients might need to be restarted or
5494 reconnected manually after an APEX boot.
5495
5496Demo with VPN Policy Model
5497--------------------------
5498
5499 .. container:: paragraph
5500
5501 We assume that you have an APEX installation using the full
5502 package, i.e. APEX with all examples, of version ``0.5.6``
5503 or higher. We will use the VPN policy from the APEX examples
5504 here.
5505
5506 .. container:: paragraph
5507
5508 Now, have the following ready to start the demo:
5509
5510 .. container:: ulist
5511
5512 - 3 terminals on the host where APEX is running (we need 1
5513 for APEX and 1 for each client)
5514
5515 - the events in the file
5516 ``$APEX_HOME/examples/events/VPN/SetupEvents.json`` open
5517 in an editor (we need to send those events to APEX)
5518
5519 - the events in the file
5520 ``$APEX_HOME/examples/events/VPN/Link09Events.json`` open
5521 in an editor (we need to send those events to APEX)
5522
5523A Websocket Configuration for the VPN Domain
5524############################################
5525
5526 .. container:: paragraph
5527
5528 Create a new APEX configuration using the VPN policy
5529 model and configuring APEX as discussed above for
5530 Websockets. Copy the following configuration into
5531 ``$APEX_HOME/examples/config/VPN/Ws2WsServerAvroContextJsonEvent.json``
5532 (for Windows use
5533 ``%APEX_HOME%\examples\config\VPN\Ws2WsServerAvroContextJsonEvent.json``):
5534
5535 .. container:: listingblock
5536
5537 .. container:: content
5538
ramverma760cce92019-07-11 12:57:49 +00005539 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005540 :number-lines:
5541
5542 {
5543 "engineServiceParameters" : {
5544 "name" : "VPNApexEngine",
5545 "version" : "0.0.1",
5546 "id" : 45,
5547 "instanceCount" : 1,
5548 "deploymentPort" : 12345,
5549 "policyModelFileName" : "examples/models/VPN/VPNPolicyModelAvro.json",
5550 "engineParameters" : {
5551 "executorParameters" : {
5552 "MVEL" : {
5553 "parameterClassName" : "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters"
5554 }
5555 },
5556 "contextParameters" : {
5557 "parameterClassName" : "org.onap.policy.apex.context.parameters.ContextParameters",
5558 "schemaParameters":{
5559 "Avro":{
5560 "parameterClassName" : "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
5561 }
5562 }
5563 }
5564 }
5565 },
5566 "producerCarrierTechnologyParameters" : {
5567 "carrierTechnology" : "WEBSOCKET",
5568 "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
5569 "parameters" : {
5570 "wsClient" : false,
5571 "port" : 42452
5572 }
5573 },
5574 "producerEventProtocolParameters" : {
5575 "eventProtocol" : "JSON"
5576 },
5577 "consumerCarrierTechnologyParameters" : {
5578 "carrierTechnology" : "WEBSOCKET",
5579 "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
5580 "parameters" : {
5581 "wsClient" : false,
5582 "port" : 42450
5583 }
5584 },
5585 "consumerEventProtocolParameters" : {
5586 "eventProtocol" : "JSON"
5587 }
5588 }
5589
5590Start APEX Engine
5591#################
5592
5593 .. container:: paragraph
5594
5595 In a new terminal, start APEX with the new configuration for
5596 Websocket-Server ingress/egress:
5597
5598 .. container:: listingblock
5599
5600 .. container:: content
5601
ramverma760cce92019-07-11 12:57:49 +00005602 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005603 :number-lines:
5604
5605 #: $APEX_HOME/bin/apexEngine.sh -c $APEX_HOME/examples/config/VPN/Ws2WsServerAvroContextJsonEvent.json
5606
5607.. container:: listingblock
5608
5609 .. container:: content
5610
ramverma760cce92019-07-11 12:57:49 +00005611 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005612 :number-lines:
5613
5614 #: %APEX_HOME%\bin\apexEngine.bat -c %APEX_HOME%\examples\config\VPN\Ws2WsServerAvroContextJsonEvent.json
5615
5616.. container:: paragraph
5617
5618 Wait for APEX to start, it takes a while to create all Websocket
5619 servers (about 8 seconds on a standard laptop without cached
5620 binaries). depending on your log messages, you will see no (some, a
5621 lot) log messages. If APEX starts correctly, the last few messages
5622 you should see are:
5623
5624.. container:: listingblock
5625
5626 .. container:: content
5627
ramverma760cce92019-07-11 12:57:49 +00005628 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005629 :number-lines:
5630
5631 2017-07-28 13:17:20,834 Apex [main] INFO c.e.a.s.engine.runtime.EngineService - engine model VPNPolicyModelAvro:0.0.1 added to the engine-AxArtifactKey:(name=VPNApexEngine-0,version=0.0.1)
5632 2017-07-28 13:17:21,057 Apex [Apex-apex-engine-service-0:0] INFO c.e.a.s.engine.runtime.EngineService - Engine AxArtifactKey:(name=VPNApexEngine-0,version=0.0.1) processing ...
5633 2017-07-28 13:17:21,296 Apex [main] INFO c.e.a.s.e.r.impl.EngineServiceImpl - Added the action listener to the engine
5634 Started Apex service
5635
5636.. container:: paragraph
5637
5638 APEX is running in the new terminal and will produce output when the
5639 policy is triggered/executed.
5640
5641Run the Websocket Echo Client
5642#############################
5643
5644 .. container:: paragraph
5645
5646 The echo client is included in an APEX full installation. To run
5647 the client, open a new shell (Unix, Cygwin) or command prompt
5648 (``cmd`` on Windows). Then use the APEX application launcher to
5649 start the client.
5650
liamfallon9c7bd672019-10-03 13:42:08 +01005651 .. important::
ramverma3b71c972019-07-10 11:25:37 +00005652 APEX engine needs to run first
ramverma760cce92019-07-11 12:57:49 +00005653 The example assumes that an APEX engine configured for *produce* carrier technology Websocket and *JSON* event protocol is executed first.
ramverma3b71c972019-07-10 11:25:37 +00005654
5655 +---------------------------------------------------------+-----------------------------------------------------------+
5656 | Unix, Cygwin | Windows |
5657 +=========================================================+===========================================================+
5658 | .. container:: | .. container:: |
5659 | | |
5660 | .. container:: listingblock | .. container:: listingblock |
5661 | | |
5662 | .. container:: content | .. container:: content |
5663 | | |
5664 | .. code:: | .. code:: |
5665 | | |
5666 | # $APEX_HOME/bin/apexApps.sh ws-echo [args] | > %APEX_HOME%\bin\apexApps.bat ws-echo [args] |
5667 +---------------------------------------------------------+-----------------------------------------------------------+
5668
5669 .. container:: paragraph
5670
5671 Use the following command line arguments for server and port of
5672 the Websocket server. The port should be the same as configured in
5673 the APEX engine. The server host should be the host on which the
5674 APEX engine is running
5675
5676 .. container:: ulist
5677
5678 - ``-p`` defines the Websocket port to connect to (defaults to
5679 ``8887``)
5680
5681 - ``-s`` defines the host on which a Websocket server is running
5682 (defaults to ``localhost``)
5683
5684 .. container:: paragraph
5685
5686 Let’s assume that there is an APEX engine running, configured for
5687 produce Websocket carrier technology, as server, for port 42452,
5688 with produce event protocol JSON,. If we start the console client
5689 on the same host, we can omit the ``-s`` options. We start the
5690 console client as:
5691
5692 .. container:: listingblock
5693
5694 .. container:: content
5695
ramverma760cce92019-07-11 12:57:49 +00005696 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005697
5698 # $APEX_HOME/bin/apexApps.sh ws-echo -p 42452 (1)
5699 > %APEX_HOME%\bin\apexApps.bat ws-echo -p 42452 (2)
5700
5701 .. container:: colist arabic
5702
5703 +-------+--------------------------------+
5704 | **1** | Start client on Unix or Cygwin |
5705 +-------+--------------------------------+
5706 | **2** | Start client on Windows |
5707 +-------+--------------------------------+
5708
5709 .. container:: paragraph
5710
5711 Once started successfully, the client will produce the following
5712 messages (assuming we used ``-p 42452`` and an APEX engine is
5713 running on ``localhost`` with the same port:
5714
5715 .. container:: listingblock
5716
5717 .. container:: content
5718
ramverma760cce92019-07-11 12:57:49 +00005719 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005720
5721 ws-simple-echo: starting simple event echo
5722 --> server: localhost
5723 --> port: 42452
5724
5725 Once started, the application will simply print out all received events to standard out.
5726 Each received event will be prefixed by '---' and suffixed by '===='
5727
5728
5729 ws-simple-echo: opened connection to APEX (Web Socket Protocol Handshake)
5730
5731Run the Websocket Console Client
5732################################
5733
5734 .. container:: paragraph
5735
5736 The console client is included in an APEX full installation. To
5737 run the client, open a new shell (Unix, Cygwin) or command prompt
5738 (``cmd`` on Windows). Then use the APEX application launcher to
5739 start the client.
5740
liamfallon9c7bd672019-10-03 13:42:08 +01005741 .. important::
ramverma3b71c972019-07-10 11:25:37 +00005742 APEX engine needs to run first
ramverma760cce92019-07-11 12:57:49 +00005743 The example assumes that an APEX engine configured for *consume* carrier technology Websocket and *JSON* event
5744 protocol is executed first.
ramverma3b71c972019-07-10 11:25:37 +00005745
5746 +------------------------------------------------------------+--------------------------------------------------------------+
5747 | Unix, Cygwin | Windows |
5748 +============================================================+==============================================================+
5749 | .. container:: | .. container:: |
5750 | | |
5751 | .. container:: listingblock | .. container:: listingblock |
5752 | | |
5753 | .. container:: content | .. container:: content |
5754 | | |
5755 | .. code:: | .. code:: |
5756 | | |
5757 | # $APEX_HOME/bin/apexApps.sh ws-console [args] | > %APEX_HOME%\bin\apexApps.bat ws-console [args] |
5758 +------------------------------------------------------------+--------------------------------------------------------------+
5759
5760 .. container:: paragraph
5761
5762 Use the following command line arguments for server and port of
5763 the Websocket server. The port should be the same as configured in
5764 the APEX engine. The server host should be the host on which the
5765 APEX engine is running
5766
5767 .. container:: ulist
5768
5769 - ``-p`` defines the Websocket port to connect to (defaults to
5770 ``8887``)
5771
5772 - ``-s`` defines the host on which a Websocket server is running
5773 (defaults to ``localhost``)
5774
5775 .. container:: paragraph
5776
5777 Let’s assume that there is an APEX engine running, configured for
5778 consume Websocket carrier technology, as server, for port 42450,
5779 with consume event protocol JSON,. If we start the console client
5780 on the same host, we can omit the ``-s`` options. We start the
5781 console client as:
5782
5783 .. container:: listingblock
5784
5785 .. container:: content
5786
ramverma760cce92019-07-11 12:57:49 +00005787 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005788
5789 # $APEX_HOME/bin/apexApps.sh ws-console -p 42450 (1)
5790 > %APEX_HOME%\bin\apexApps.sh ws-console -p 42450 (2)
5791
5792 .. container:: colist arabic
5793
5794 +-------+--------------------------------+
5795 | **1** | Start client on Unix or Cygwin |
5796 +-------+--------------------------------+
5797 | **2** | Start client on Windows |
5798 +-------+--------------------------------+
5799
5800 .. container:: paragraph
5801
5802 Once started successfully, the client will produce the following
5803 messages (assuming we used ``-p 42450`` and an APEX engine is
5804 running on ``localhost`` with the same port:
5805
5806 .. container:: listingblock
5807
5808 .. container:: content
5809
ramverma760cce92019-07-11 12:57:49 +00005810 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005811
5812 ws-simple-console: starting simple event console
5813 --> server: localhost
5814 --> port: 42450
5815
5816 - terminate the application typing 'exit<enter>' or using 'CTRL+C'
5817 - events are created by a non-blank starting line and terminated by a blank line
5818
5819
5820 ws-simple-console: opened connection to APEX (Web Socket Protocol Handshake)
5821
5822Send Events
5823###########
5824
5825 .. container:: paragraph
5826
5827 Now you have the full system up and running:
5828
5829 .. container:: ulist
5830
5831 - Terminal 1: APEX ready and loaded
5832
5833 - Terminal 2: an echo client, printing received messages produced
5834 by the VPN policy
5835
5836 - Terminal 2: a console client, waiting for input on the console
5837 (standard in) and sending text to APEX
5838
5839 .. container:: paragraph
5840
5841 We started the engine with the VPN policy example. So all the
5842 events we are using now are located in files in the following
5843 example directory:
5844
5845 .. container:: listingblock
5846
5847 .. container:: content
5848
ramverma760cce92019-07-11 12:57:49 +00005849 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005850 :number-lines:
5851
5852 #: $APEX_HOME/examples/events/VPN
5853 > %APEX_HOME%\examples\events\VPN
5854
5855.. container:: paragraph
5856
5857 To sends events, simply copy the content of the event files into
5858 Terminal 3 (the console client). It will read multi-line JSON text
5859 and send the events. So copy the content of ``SetupEvents.json`` into
5860 the client. APEX will trigger a policy and produce some output, the
5861 echo client will also print some events created in the policy. In
5862 Terminal 1 (APEX) you’ll see some status messages from the policy as:
5863
5864.. container:: listingblock
5865
5866 .. container:: content
5867
ramverma760cce92019-07-11 12:57:49 +00005868 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005869 :number-lines:
5870
5871 {Link=L09, LinkUp=true}
5872 L09 true
5873 outFields: {Link=L09, LinkUp=true}
5874 {Link=L10, LinkUp=true}
5875 L09 true
5876 L10 true
5877 outFields: {Link=L10, LinkUp=true}
5878 {CustomerName=C, LinkList=L09 L10, SlaDT=300, YtdDT=300}
5879 *** Customers ***
5880 C 300 300 [L09, L10]
5881 outFields: {CustomerName=C, LinkList=L09 L10, SlaDT=300, YtdDT=300}
5882 {CustomerName=A, LinkList=L09 L10, SlaDT=300, YtdDT=50}
5883 *** Customers ***
5884 A 300 50 [L09, L10]
5885 C 300 300 [L09, L10]
5886 outFields: {CustomerName=A, LinkList=L09 L10, SlaDT=300, YtdDT=50}
5887 {CustomerName=D, LinkList=L09 L10, SlaDT=300, YtdDT=400}
5888 *** Customers ***
5889 A 300 50 [L09, L10]
5890 C 300 300 [L09, L10]
5891 D 300 400 [L09, L10]
5892 outFields: {CustomerName=D, LinkList=L09 L10, SlaDT=300, YtdDT=400}
5893 {CustomerName=B, LinkList=L09 L10, SlaDT=300, YtdDT=299}
5894 *** Customers ***
5895 A 300 50 [L09, L10]
5896 B 300 299 [L09, L10]
5897 C 300 300 [L09, L10]
5898 D 300 400 [L09, L10]
5899 outFields: {CustomerName=B, LinkList=L09 L10, SlaDT=300, YtdDT=299}
5900
5901.. container:: paragraph
5902
5903 In Terminal 2 (echo-client) you see the received events, the last two
5904 should look like:
5905
5906.. container:: listingblock
5907
5908 .. container:: content
5909
ramverma760cce92019-07-11 12:57:49 +00005910 .. code::
ramverma3b71c972019-07-10 11:25:37 +00005911 :number-lines:
5912
5913 ws-simple-echo: received
5914 ---------------------------------
5915 {
5916 "name": "VPNCustomerCtxtActEvent",
5917 "version": "0.0.1",
5918 "nameSpace": "org.onap.policy.apex.domains.vpn.events",
5919 "source": "Source",
5920 "target": "Target",
5921 "CustomerName": "C",
5922 "LinkList": "L09 L10",
5923 "SlaDT": 300,
5924 "YtdDT": 300
5925 }
5926 =================================
5927
5928 ws-simple-echo: received
5929 ---------------------------------
5930 {
5931 "name": "VPNCustomerCtxtActEvent",
5932 "version": "0.0.1",
5933 "nameSpace": "org.onap.policy.apex.domains.vpn.events",
5934 "source": "Source",
5935 "target": "Target",
5936 "CustomerName": "D",
5937 "LinkList": "L09 L10",
5938 "SlaDT": 300,
5939 "YtdDT": 400
5940 }
5941 =================================
5942
5943.. container:: paragraph
5944
5945 Congratulations, you have triggered a policy in APEX using
5946 Websockets, the policy did run through, created events, picked up by
5947 the echo-client.
5948
5949.. container:: paragraph
5950
5951 Now you can send the Link 09 and Link 10 events, they will trigger
5952 the actual VPN policy and some calculations are made. Let’s take the
5953 Link 09 events from ``Link09Events.json``, copy them all into
5954 Terminal 3 (the console). APEX will run the policy (with some status
5955 output), and the echo client will receive and print events.
5956
5957.. container:: paragraph
5958
5959 To terminate the applications, simply press ``CTRL+C`` in Terminal 1
5960 (APEX). This will also terminate the echo-client in Terminal 2. Then
5961 type ``exit<enter>`` in Terminal 3 (or ``CTRL+C``) to terminate the
5962 console-client.
5963
5964.. container::
5965 :name: footer
5966
5967 .. container::
5968 :name: footer-text
5969
5970 2.0.0-SNAPSHOT
5971 Last updated 2018-09-10 15:38:16 IST
5972
5973.. |Extract the TAR archive| image:: images/install-guide/win-extract-tar-gz.png
5974.. |Extract the APEX distribution| image:: images/install-guide/win-extract-tar.png
5975.. |REST Editor Start Screen| image:: images/install-guide/rest-start.png
5976.. |REST Editor with loaded SampleDomain Policy Model| image:: images/install-guide/rest-loaded.png
5977.. |APEX Configuration Matrix| image:: images/apex-intro/ApexEngineConfig.png
aditya.puthuparambil9e67eb72020-04-30 15:59:43 +01005978
ramverma3b71c972019-07-10 11:25:37 +00005979