1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
17 .. container:: paragraph
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
25 Installation Requirements
26 #########################
30 - Downloaded distribution: JAVA runtime environment
31 (JRE, Java 11 or later, APEX is tested with the
34 - Building from source: JAVA development kit (JDK,
35 Java 11 or later, APEX is tested with the OpenJDK
38 - A web archive capable webserver, for instance for
39 the monitoring application
43 - for instance `Apache
44 Tomcat <https://tomcat.apache.org/>`__
46 - Sufficient rights to install APEX on the system
48 - Installation tools depending on the installation
53 - ZIP to extract from a ZIP distribution
57 - Windows for instance
58 `7Zip <http://www.7-zip.org/>`__
60 - TAR and GZ to extract from that TAR.GZ
65 - Windows for instance
66 `7Zip <http://www.7-zip.org/>`__
68 - DPKG to install from the DEB distribution
72 - Install: ``sudo apt-get install dpkg``
77 .. container:: paragraph
79 APEX supports a number of features that require extra
80 software being installed.
84 - `Apache Kafka <https://kafka.apache.org/>`__ to
85 connect APEX to a Kafka message bus
87 - `Hazelcast <https://hazelcast.com/>`__ to use
88 distributed hash maps for context
90 - `Infinispan <http://infinispan.org/>`__ for
91 distributed context and persistence
93 - `Docker <https://www.docker.com/>`__ to run APEX
94 inside a Docker container
96 Build (Install from Source) Requirements
97 ########################################
99 .. container:: paragraph
101 Installation from source requires a few development
106 - GIT to retrieve the source code
108 - Java SDK, Java version 8 or later
110 - Apache Maven 3 (the APEX build environment)
112 Get the APEX Source Code
113 ------------------------
115 .. container:: paragraph
117 The first APEX source code was hosted on Github in
118 January 2018. By the end of 2018, APEX was added as a
119 project in the ONAP Policy Framework, released later in
120 the ONAP Casablanca release.
122 .. container:: paragraph
124 The APEX source code is hosted in ONAP as project APEX.
125 The current stable version is in the master branch.
126 Simply clone the master branch from ONAP using HTTPS.
128 .. container:: listingblock
130 .. container:: content
135 git clone https://gerrit.onap.org/r/policy/apex-pdp
140 .. container:: paragraph
142 The examples in this document assume that the APEX source
143 repositories are cloned to:
147 - Unix, Cygwin: ``/usr/local/src/apex-pdp``
149 - Windows: ``C:\dev\apex-pdp``
151 - Cygwin: ``/cygdrive/c/dev/apex-pdp``
154 A Build requires ONAP Nexus
155 APEX has a dependency to ONAP parent projects. You might need to adjust your Maven M2 settings. The most current
156 settings can be found in the ONAP oparent repo: `Settings <https://git.onap.org/oparent/plain/settings.xml>`__.
160 Building APEX requires approximately 2-3 GB of hard disc space, 1 GB for the actual build with full
161 distribution and 1-2 GB for the downloaded dependencies
164 A Build requires Internet (for first build)
165 During the build, several (a lot) of Maven dependencies will be downloaded and stored in the configured local Maven
166 repository. The first standard build (and any first specific build) requires Internet access to download those
169 .. container:: paragraph
171 Use Maven to for a standard build without any tests.
173 +-------------------------------------------------------+--------------------------------------------------------+
174 | Unix, Cygwin | Windows |
175 +=======================================================+========================================================+
176 | .. container:: | .. container:: |
178 | .. container:: content | .. container:: content |
180 | .. code:: | .. code:: |
181 | :number-lines: | :number-lines: |
183 | # cd /usr/local/src/apex-pdp | >c: |
184 | # mvn clean install -Pdocker -DskipTests | >cd \dev\apex |
185 | | >mvn clean install -Pdocker -DskipTests |
186 +-------------------------------------------------------+--------------------------------------------------------+
188 .. container:: paragraph
190 The build takes 2-3 minutes on a standard development laptop. It
191 should run through without errors, but with a lot of messages from
194 .. container:: paragraph
196 When Maven is finished with the build, the final screen should look
197 similar to this (omitting some ``success`` lines):
199 .. container:: listingblock
201 .. container:: content
206 [INFO] tools .............................................. SUCCESS [ 0.248 s]
207 [INFO] tools-common ....................................... SUCCESS [ 0.784 s]
208 [INFO] simple-wsclient .................................... SUCCESS [ 3.303 s]
209 [INFO] model-generator .................................... SUCCESS [ 0.644 s]
210 [INFO] packages ........................................... SUCCESS [ 0.336 s]
211 [INFO] apex-pdp-package-full .............................. SUCCESS [01:10 min]
212 [INFO] Policy APEX PDP - Docker build 2.0.0-SNAPSHOT ...... SUCCESS [ 10.307 s]
213 [INFO] ------------------------------------------------------------------------
215 [INFO] ------------------------------------------------------------------------
216 [INFO] Total time: 03:43 min
217 [INFO] Finished at: 2018-09-03T11:56:01+01:00
218 [INFO] ------------------------------------------------------------------------
220 .. container:: paragraph
222 The build will have created all artifacts required for an APEX
223 installation. The following example show how to change to the target
224 directory and how it should look like.
226 +----------------------------------------------------------------------------------------------------------------------------+
228 +============================================================================================================================+
231 | .. container:: listingblock |
233 | .. container:: content |
238 | -rwxrwx---+ 1 esvevan Domain Users 772 Sep 3 11:55 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes* |
239 | -rwxrwx---+ 1 esvevan Domain Users 146328082 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT.deb* |
240 | -rwxrwx---+ 1 esvevan Domain Users 15633 Sep 3 11:54 apex-pdp-package-full-2.0.0-SNAPSHOT.jar* |
241 | -rwxrwx---+ 1 esvevan Domain Users 146296819 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz* |
242 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 archive-tmp/ |
243 | -rwxrwx---+ 1 esvevan Domain Users 89 Sep 3 11:54 checkstyle-cachefile* |
244 | -rwxrwx---+ 1 esvevan Domain Users 10621 Sep 3 11:54 checkstyle-checker.xml* |
245 | -rwxrwx---+ 1 esvevan Domain Users 584 Sep 3 11:54 checkstyle-header.txt* |
246 | -rwxrwx---+ 1 esvevan Domain Users 86 Sep 3 11:54 checkstyle-result.xml* |
247 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 classes/ |
248 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 dependency-maven-plugin-markers/ |
249 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 etc/ |
250 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 examples/ |
251 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:55 install_hierarchy/ |
252 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 maven-archiver/ |
253 +----------------------------------------------------------------------------------------------------------------------------+
255 +--------------------------------------------------------------------------------------------------------+
257 +========================================================================================================+
260 | .. container:: listingblock |
262 | .. container:: content |
267 | 03/09/2018 11:55 <DIR> . |
268 | 03/09/2018 11:55 <DIR> .. |
269 | 03/09/2018 11:55 146,296,819 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz |
270 | 03/09/2018 11:55 146,328,082 apex-pdp-package-full-2.0.0-SNAPSHOT.deb |
271 | 03/09/2018 11:54 15,633 apex-pdp-package-full-2.0.0-SNAPSHOT.jar |
272 | 03/09/2018 11:55 772 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes |
273 | 03/09/2018 11:54 <DIR> archive-tmp |
274 | 03/09/2018 11:54 89 checkstyle-cachefile |
275 | 03/09/2018 11:54 10,621 checkstyle-checker.xml |
276 | 03/09/2018 11:54 584 checkstyle-header.txt |
277 | 03/09/2018 11:54 86 checkstyle-result.xml |
278 | 03/09/2018 11:54 <DIR> classes |
279 | 03/09/2018 11:54 <DIR> dependency-maven-plugin-markers |
280 | 03/09/2018 11:54 <DIR> etc |
281 | 03/09/2018 11:54 <DIR> examples |
282 | 03/09/2018 11:55 <DIR> install_hierarchy |
283 | 03/09/2018 11:54 <DIR> maven-archiver |
284 | 8 File(s) 292,652,686 bytes |
285 | 9 Dir(s) 14,138,720,256 bytes free |
286 +--------------------------------------------------------------------------------------------------------+
291 .. container:: paragraph
293 APEX can be installed in different ways:
297 - Unix: automatically using ``dpkg`` from
300 - Windows, Unix, Cygwin: manually from a ``.tar.gz`` archive
302 - Windows, Unix, Cygwin: build from source using Maven, then
308 .. container:: paragraph
310 You can get the APEX debian package from the
311 `ONAP Nexus Repository <https://nexus.onap.org/content/groups/public/org/onap/policy/apex-pdp/packages/apex-pdp-package-full/>`__.
313 The install distributions of APEX automatically install the
314 system. The installation directory is
315 ``/opt/app/policy/apex-pdp``. Log files are located in
316 ``/var/log/onap/policy/apex-pdp``. The latest APEX version will
317 be available as ``/opt/app/policy/apex-pdp/apex-pdp``.
319 .. container:: paragraph
321 For the installation, a new user ``apexuser`` and a new group
322 ``apexuser`` will be created. This user owns the installation
323 directories and the log file location. The user is also used by
324 the standard APEX start scripts to run APEX with this user’s
327 +--------------------------------------------------------------------------------------+
328 | DPKG Installation |
329 +======================================================================================+
332 | .. container:: listingblock |
334 | .. container:: content |
339 | # sudo dpkg -i apex-pdp-package-full-2.0.0-SNAPSHOT.deb |
340 | Selecting previously unselected package apex-uservice. |
341 | (Reading database ... 288458 files and directories currently installed.) |
342 | Preparing to unpack apex-pdp-package-full-2.0.0-SNAPSHOT.deb ... |
343 | ********************preinst******************* |
344 | arguments install |
345 | ********************************************** |
346 | creating group apexuser . . . |
347 | creating user apexuser . . . |
348 | Unpacking apex-uservice (2.0.0-SNAPSHOT) ... |
349 | Setting up apex-uservice (2.0.0-SNAPSHOT) ... |
350 | ********************postinst**************** |
351 | arguments configure |
352 | *********************************************** |
353 +--------------------------------------------------------------------------------------+
355 .. container:: paragraph
357 Once the installation is finished, APEX is fully installed and ready
360 Install Manually from Archive (Unix, Cygwin)
361 ############################################
363 .. container:: paragraph
365 You can download a ``tar.gz`` archive from the
366 `ONAP Nexus Repository <https://nexus.onap.org/content/groups/public/org/onap/policy/apex-pdp/packages/apex-pdp-package-full/>`__.
368 Create a directory where APEX
369 should be installed. Extract the ``tar`` archive. The following
370 example shows how to install APEX in ``/opt/apex`` and create a
371 link to ``/opt/apex/apex`` for the most recent installation.
373 .. container:: listingblock
375 .. container:: content
383 # mkdir apex-full-2.0.0-SNAPSHOT
384 # tar xvfz ~/Downloads/apex-pdp-package-full-2.0.0-SNAPSHOT.tar.gz -C apex-full-2.0.0-SNAPSHOT
385 # ln -s apex apex-pdp-package-full-2.0.0-SNAPSHOT
387 Install Manually from Archive (Windows, 7Zip, GUI)
388 ##################################################
390 .. container:: paragraph
392 You can download a ``tar.gz`` archive from the
393 `ONAP Nexus Repository <https://nexus.onap.org/content/groups/public/org/onap/policy/apex-pdp/packages/apex-pdp-package-full/>`__.
395 Copy the ``tar.gz`` file into the install
396 folder (in this example ``C:\apex``). Assuming you are using 7Zip,
397 right click on the file and extract the ``tar`` archive. Note: the
398 screenshots might show an older version than you have.
400 .. container:: imageblock
402 .. container:: content
404 |Extract the TAR archive|
406 .. container:: paragraph
408 The right-click on the new created TAR file and extract the actual
411 .. container:: imageblock
413 .. container:: content
415 |Extract the APEX distribution|
417 .. container:: paragraph
419 Inside the new APEX folder you see the main directories: ``bin``,
420 ``etc``, ``examples``, ``lib``, and ``war``
422 .. container:: paragraph
424 Once extracted, please rename the created folder to
425 ``apex-full-2.0.0-SNAPSHOT``. This will keep the directory name in
426 line with the rest of this documentation.
428 Install Manually from Archive (Windows, 7Zip, CMD)
429 ##################################################
431 .. container:: paragraph
433 You can download a ``tar.gz`` archive from the
434 `ONAP Nexus Repository <https://nexus.onap.org/content/groups/public/org/onap/policy/apex-pdp/packages/apex-pdp-package-full/>`__.
436 Copy the ``tar.gz`` file into the install
437 folder (in this example ``C:\apex``). Start ``cmd``, for instance
438 typing ``Windows+R`` and then ``cmd`` in the dialog. Assuming
439 ``7Zip`` is installed in the standard folder, simply run the
440 following commands (for APEX version 2.0.0-SNAPSHOT full
443 .. container:: listingblock
445 .. container:: content
452 >"\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"
454 .. container:: paragraph
456 APEX is now installed in the folder
457 ``C:\apex\apex-full-2.0.0-SNAPSHOT``.
462 Build and Install Manually (Unix, Windows, Cygwin)
463 ##################################################
465 .. container:: paragraph
467 Clone the APEX GIT repositories into a directory. Go to that
468 directory. Use Maven to build APEX (all details on building
469 APEX from source can be found in *APEX HowTo: Build*). Install
470 from the created artifacts (``rpm``, ``deb``, ``tar.gz``, or
473 .. container:: paragraph
475 The following example shows how to build the APEX system,
476 without tests (``-DskipTests``) to safe some time. It assumes
477 that the APX GIT repositories are cloned to:
481 - Unix, Cygwin: ``/usr/local/src/apex``
483 - Windows: ``C:\dev\apex``
485 +-------------------------------------------------------+--------------------------------------------------------+
486 | Unix, Cygwin | Windows |
487 +=======================================================+========================================================+
488 | .. container:: | .. container:: |
490 | .. container:: content | .. container:: content |
492 | .. code:: | .. code:: |
493 | :number-lines: | :number-lines: |
495 | # cd /usr/local/src/apex | >c: |
496 | # mvn clean install -Pdocker -DskipTests | >cd \dev\apex |
497 | | >mvn clean install -Pdocker -DskipTests |
498 +-------------------------------------------------------+--------------------------------------------------------+
500 .. container:: paragraph
502 The build takes about 2 minutes without test and about 4-5 minutes
503 with tests on a standard development laptop. It should run through
504 without errors, but with a lot of messages from the build process. If
505 build with tests (i.e. without ``-DskipTests``), there will be error
506 messages and stack trace prints from some tests. This is normal, as
507 long as the build finishes successful.
509 .. container:: paragraph
511 When Maven is finished with the build, the final screen should look
512 similar to this (omitting some ``success`` lines):
514 .. container:: listingblock
516 .. container:: content
521 [INFO] tools .............................................. SUCCESS [ 0.248 s]
522 [INFO] tools-common ....................................... SUCCESS [ 0.784 s]
523 [INFO] simple-wsclient .................................... SUCCESS [ 3.303 s]
524 [INFO] model-generator .................................... SUCCESS [ 0.644 s]
525 [INFO] packages ........................................... SUCCESS [ 0.336 s]
526 [INFO] apex-pdp-package-full .............................. SUCCESS [01:10 min]
527 [INFO] Policy APEX PDP - Docker build 2.0.0-SNAPSHOT ...... SUCCESS [ 10.307 s]
528 [INFO] ------------------------------------------------------------------------
530 [INFO] ------------------------------------------------------------------------
531 [INFO] Total time: 03:43 min
532 [INFO] Finished at: 2018-09-03T11:56:01+01:00
533 [INFO] ------------------------------------------------------------------------
535 .. container:: paragraph
537 The build will have created all artifacts required for an APEX
538 installation. The following example show how to change to the target
539 directory and how it should look like.
541 +-----------------------------------------------------------------------------------------------------------------------------+
543 +=============================================================================================================================+
546 | .. container:: listingblock |
551 | # cd packages/apex-pdp-package-full/target |
553 | -rwxrwx---+ 1 esvevan Domain Users 772 Sep 3 11:55 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes* |
554 | -rwxrwx---+ 1 esvevan Domain Users 146328082 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT.deb* |
555 | -rwxrwx---+ 1 esvevan Domain Users 15633 Sep 3 11:54 apex-pdp-package-full-2.0.0-SNAPSHOT.jar* |
556 | -rwxrwx---+ 1 esvevan Domain Users 146296819 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz* |
557 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 archive-tmp/ |
558 | -rwxrwx---+ 1 esvevan Domain Users 89 Sep 3 11:54 checkstyle-cachefile* |
559 | -rwxrwx---+ 1 esvevan Domain Users 10621 Sep 3 11:54 checkstyle-checker.xml* |
560 | -rwxrwx---+ 1 esvevan Domain Users 584 Sep 3 11:54 checkstyle-header.txt* |
561 | -rwxrwx---+ 1 esvevan Domain Users 86 Sep 3 11:54 checkstyle-result.xml* |
562 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 classes/ |
563 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 dependency-maven-plugin-markers/ |
564 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 etc/ |
565 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 examples/ |
566 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:55 install_hierarchy/ |
567 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 maven-archiver/ |
568 +-----------------------------------------------------------------------------------------------------------------------------+
570 +-----------------------------------------------------------------------------------------------------------------------------+
572 +=============================================================================================================================+
575 | .. container:: listingblock |
580 | >cd packages\apex-pdp-package-full\target |
582 | 03/09/2018 11:55 <DIR> . |
583 | 03/09/2018 11:55 <DIR> .. |
584 | 03/09/2018 11:55 146,296,819 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz |
585 | 03/09/2018 11:55 146,328,082 apex-pdp-package-full-2.0.0-SNAPSHOT.deb |
586 | 03/09/2018 11:54 15,633 apex-pdp-package-full-2.0.0-SNAPSHOT.jar |
587 | 03/09/2018 11:55 772 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes |
588 | 03/09/2018 11:54 <DIR> archive-tmp |
589 | 03/09/2018 11:54 89 checkstyle-cachefile |
590 | 03/09/2018 11:54 10,621 checkstyle-checker.xml |
591 | 03/09/2018 11:54 584 checkstyle-header.txt |
592 | 03/09/2018 11:54 86 checkstyle-result.xml |
593 | 03/09/2018 11:54 <DIR> classes |
594 | 03/09/2018 11:54 <DIR> dependency-maven-plugin-markers |
595 | 03/09/2018 11:54 <DIR> etc |
596 | 03/09/2018 11:54 <DIR> examples |
597 | 03/09/2018 11:55 <DIR> install_hierarchy |
598 | 03/09/2018 11:54 <DIR> maven-archiver |
599 | 8 File(s) 292,652,686 bytes |
600 | 9 Dir(s) 14,138,720,256 bytes free |
601 +-----------------------------------------------------------------------------------------------------------------------------+
603 .. container:: paragraph
605 Now, take the ``.deb`` or the ``.tar.gz`` file and install APEX.
606 Alternatively, copy the content of the folder ``install_hierarchy``
607 to your APEX directory.
612 .. container:: paragraph
614 A full installation of APEX comes with the following layout.
616 .. container:: listingblock
618 .. container:: content
637 │ └───applications (11)
640 .. container:: colist arabic
642 +-----------------------------------+-----------------------------------+
643 | **1** | binaries, mainly scripts (bash |
644 | | and bat) to start the APEX engine |
645 | | and applications |
646 +-----------------------------------+-----------------------------------+
647 | **2** | configuration files, such as |
648 | | logback (logging) and third party |
649 | | library configurations |
650 +-----------------------------------+-----------------------------------+
651 | **3** | example policy models to get |
653 +-----------------------------------+-----------------------------------+
654 | **4** | configurations for the examples |
655 | | (with sub directories for |
656 | | individual examples) |
657 +-----------------------------------+-----------------------------------+
658 | **5** | Docker files and additional |
659 | | Docker instructions for the |
661 +-----------------------------------+-----------------------------------+
662 | **6** | example events for the examples |
663 | | (with sub directories for |
664 | | individual examples) |
665 +-----------------------------------+-----------------------------------+
666 | **7** | HTML files for some examples, |
667 | | e.g. the Decisionmaker example |
668 +-----------------------------------+-----------------------------------+
669 | **8** | the policy models, generated for |
670 | | each example (with sub |
671 | | directories for individual |
673 +-----------------------------------+-----------------------------------+
674 | **9** | additional scripts for the |
675 | | examples (with sub directories |
676 | | for individual examples) |
677 +-----------------------------------+-----------------------------------+
678 | **10** | the library folder with all Java |
680 +-----------------------------------+-----------------------------------+
681 | **11** | applications, also known as jar |
682 | | with dependencies (or fat jars), |
683 | | individually deployable |
684 +-----------------------------------+-----------------------------------+
685 | **12** | WAR files for web applications |
686 +-----------------------------------+-----------------------------------+
691 .. container:: paragraph
693 Once APEX is installed, a few configurations need to be done:
697 - Create an APEX user and an APEX group (optional, if not
698 installed using RPM and DPKG)
700 - Create environment settings for ``APEX_HOME`` and
701 ``APEX_USER``, required by the start scripts
703 - Change settings of the logging framework (optional)
705 - Create directories for logging, required (execution might fail
706 if directories do not exist or cannot be created)
711 .. container:: paragraph
713 On smaller installations and test systems, APEX can run as any
716 .. container:: paragraph
718 However, if APEX is installed in production, we strongly
719 recommend you set up a dedicated user for running APEX. This
720 will isolate the execution of APEX to that user. We recommend
721 you use the userid ``apexuser`` but you may use any user you
724 .. container:: paragraph
726 The following example, for UNIX, creates a group called
727 ``apexuser``, an APEX user called ``apexuser``, adds the group
728 to the user, and changes ownership of the APEX installation to
729 the user. Substitute ``<apex-dir>`` with the directory where
732 .. container:: listingblock
734 .. container:: content
739 # sudo groupadd apexuser
740 # sudo useradd -g apexuser apexuser
741 # sudo chown -R apexuser:apexuser <apex-dir>
743 .. container:: paragraph
745 For other operating systems please consult your manual or system
748 Environment Settings: APEX_HOME and APEX_USER
749 #############################################
751 .. container:: paragraph
753 The provided start scripts for APEX require two environment
758 - ``APEX_USER`` with the user under whos name and permission APEX
759 should be started (Unix only)
761 - ``APEX_HOME`` with the directory where APEX is installed (Unix,
764 .. container:: paragraph
766 The first row in the following table shows how to set these
767 environment variables temporary (assuming the user is
768 ``apexuser``). The second row shows how to verify the settings.
769 The last row explains how to set those variables permanently.
771 +------------------------------------------------+---------------------------------------------------------+
772 | Unix, Cygwin (bash/tcsh) | Windows |
773 +================================================+=========================================================+
774 | .. container:: | .. container:: |
776 | .. container:: content | .. container:: content |
778 | .. code:: | .. code:: |
779 | :number-lines: | :number-lines: |
781 | # export APEX_USER=apexuser | >set APEX_HOME=C:\apex\apex-full-2.0.0-SNAPSHOT |
782 | # cd /opt/app/policy/apex-pdp | |
783 | # export APEX_HOME=`pwd` | |
785 +------------------------------------------------+ |
788 | .. container:: content | |
793 | # setenv APEX_USER apexuser | |
794 | # cd /opt/app/policy/apex-pdp | |
795 | # setenv APEX_HOME `pwd` | |
797 +------------------------------------------------+---------------------------------------------------------+
798 | .. container:: | .. container:: |
800 | .. container:: content | .. container:: content |
802 | .. code:: | .. code:: |
803 | :number-lines: | :number-lines: |
805 | # env | grep APEX | >set APEX_HOME |
806 | # APEX_USER=apexuser | APEX_HOME=\apex\apex-full-2.0.0-SNAPSHOT |
807 | # APEX_HOME=/opt/app/policy/apex-pdp | |
809 +------------------------------------------------+---------------------------------------------------------+
811 Making Environment Settings Permanent (Unix, Cygwin)
812 ====================================================
814 .. container:: paragraph
816 For a per-user setting, edit the a user’s ``bash`` or ``tcsh``
817 settings in ``~/.bashrc`` or ``~/.tcshrc``. For system-wide
818 settings, edit ``/etc/profiles`` (requires permissions).
820 Making Environment Settings Permanent (Windows)
821 ===============================================
823 .. container:: paragraph
829 - Click on the **Start** Menu
831 - Right click on **Computer**
833 - Select **Properties**
835 .. container:: paragraph
841 - Click on the **Start** Menu
845 .. container:: paragraph
847 Then do the following
851 - Select **Advanced System Settings**
853 - On the **Advanced** tab, click the **Environment Variables**
856 - Edit an existing variable, or create a new System variable:
857 'Variable name'="APEX_HOME", 'Variable
858 value'="C:\apex\apex-full-2.0.0-SNAPSHOT"
860 .. container:: paragraph
862 For the settings to take effect, an application needs to be
863 restarted (e.g. any open ``cmd`` window).
865 Edit the APEX Logging Settings
866 ##############################
868 .. container:: paragraph
870 Configure the APEX logging settings to your requirements, for
875 - change the directory where logs are written to, or
877 - change the log levels
879 .. container:: paragraph
881 Edit the file ``$APEX_HOME/etc/logback.xml`` for any required
882 changes. To change the log directory change the line
884 .. container:: paragraph
886 ``<property name="logDir" value="/var/log/onap/policy/apex-pdp/" />``
888 .. container:: paragraph
892 .. container:: paragraph
894 ``<property name="logDir" value="/PATH/TO/LOG/DIRECTORY/" />``
896 .. container:: paragraph
898 On Windows, it is recommended to change the log directory to:
900 .. container:: paragraph
902 ``<property name="logDir" value="C:/apex/apex-full-2.0.0-SNAPSHOT/logs" />``
904 .. container:: paragraph
906 Note: Be careful about when to use ``\`` vs. ``/`` as the path
909 Create Directories for Logging
910 ##############################
912 .. container:: paragraph
914 Make sure that the log directory exists. This is important when
915 APEX was installed manually or when the log directory was changed
916 in the settings (see above).
918 +-----------------------------------------------------------------------+-------------------------------------------------------+
919 | Unix, Cygwin | Windows |
920 +=======================================================================+=======================================================+
921 | .. container:: | .. container:: |
923 | .. container:: content | .. container:: content |
925 | .. code:: | .. code:: |
926 | :number-lines: | :number-lines: |
928 | sudo mkdir -p /var/log/onap/policy/apex-pdp | >mkdir C:\apex\apex-full-2.0.0-SNAPSHOT\logs |
929 | sudo chown -R apexuser:apexuser /var/log/onap/policy/apex-pdp | |
930 +-----------------------------------------------------------------------+-------------------------------------------------------+
932 Verify the APEX Installation
933 ----------------------------
935 .. container:: paragraph
937 When APEX is installed and all settings are realized, the
938 installation can be verified.
940 Verify Installation - run Engine
941 ################################
943 .. container:: paragraph
945 A simple verification of an APEX installation can be done by
946 simply starting the APEX engine without any configuration. On
947 Unix (or Cygwin) start the engine using
948 ``$APEX_HOME/bin/apexEngine.sh``. On Windows start the engine
949 using ``%APEX_HOME%\bin\apexEngine.bat``. The engine will fail
950 to fully start. However, if the output looks similar to the
951 following line, the APEX installation is realized.
953 .. container:: listingblock
955 .. container:: content
960 Starting Apex service with parameters [] . . .
961 start of Apex service failed: Apex configuration file was not specified as an argument
962 2018-09-03 13:11:33,914 Apex [main] ERROR o.o.p.a.service.engine.main.ApexMain - start of Apex service failed
963 org.onap.policy.apex.model.basicmodel.concepts.ApexException: Apex configuration file was not specified as an argument
964 at org.onap.policy.apex.service.engine.main.ApexCommandLineArguments.validateReadableFile(ApexCommandLineArguments.java:267)
965 at org.onap.policy.apex.service.engine.main.ApexCommandLineArguments.validate(ApexCommandLineArguments.java:161)
966 at org.onap.policy.apex.service.engine.main.ApexMain.<init>(ApexMain.java:68)
967 at org.onap.policy.apex.service.engine.main.ApexMain.main(ApexMain.java:165)
968 usage: org.onap.policy.apex.service.engine.main.ApexMain [options...]
970 -c,--config-file <CONFIG_FILE>the full path to the configuration file to use, the configuration file must be a Json file
971 containing the Apex configuration parameters
972 -h,--help outputs the usage of this command
973 -m,--model-file <MODEL_FILE> the full path to the model file to use, if set it overrides the model file set in the
975 -v,--version outputs the version of Apex
977 Verify Installation - run an Example
978 ####################################
980 .. container:: paragraph
982 A full APEX installation comes with several examples. Here, we can
983 fully verify the installation by running one of the examples.
985 .. container:: paragraph
987 We use the example called *SampleDomain* and configure the engine
988 to use standard in and standard out for events. Run the engine
989 with the provided configuration. Note: Cygwin executes scripts as
990 Unix scripts but runs Java as a Windows application, thus the
991 configuration file must be given as a Windows path.
993 .. container:: paragraph
995 On Unix/Linux flavoured platforms, give the commands below:
997 .. container:: listingblock
999 .. container:: content
1005 export APEX_HOME <path to apex installation>
1006 export APEX_USER apexuser
1008 .. container:: paragraph
1010 You can now try to run apex.
1012 .. container:: listingblock
1014 .. container:: content
1019 # $APEX_HOME/bin/apexEngine.sh -c $APEX_HOME/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json (1)
1020 # $APEX_HOME/bin/apexEngine.sh -c C:/apex/apex-full-2.0.0-SNAPSHOT/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json (2)
1021 >%APEX_HOME%\bin\apexEngine.bat -c %APEX_HOME%\examples\config\SampleDomain\Stdin2StdoutJsonEventJava.json :: (3)
1023 .. container:: colist arabic
1033 .. container:: paragraph
1035 The engine should start successfully. Assuming the logging levels are set to ``info`` in the built system, the output
1036 should look similar to this (last few lines)
1038 .. container:: listingblock
1040 .. container:: content
1045 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] . . .
1046 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 .
1047 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 .
1048 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 .
1049 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 .
1050 2018-09-05 15:16:42,805 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - APEX service created.
1051 2018-09-05 15:16:43,962 Apex [main] INFO o.o.p.a.s.e.e.EngDepMessagingService - engine<-->deployment messaging starting . . .
1052 2018-09-05 15:16:43,963 Apex [main] INFO o.o.p.a.s.e.e.EngDepMessagingService - engine<-->deployment messaging started
1053 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
1054 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
1055 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
1056 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
1057 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
1058 Started Apex service
1060 .. container:: paragraph
1062 Important are the last two line, stating that APEX has added the
1063 final action listener to the engine and that the engine is started.
1065 .. container:: paragraph
1067 The engine is configured to read events from standard input and write
1068 produced events to standard output. The policy model is a very simple
1071 .. container:: paragraph
1073 The following table shows an input event in the left column and an
1074 output event in the right column. Past the input event into the
1075 console where APEX is running, and the output event should appear in
1076 the console. Pasting the input event multiple times will produce
1077 output events with different values.
1079 +-------------------------------------------------------------+-------------------------------------------------------------+
1080 | Input Event | Example Output Event |
1081 +=============================================================+=============================================================+
1082 | .. container:: | .. container:: |
1084 | .. container:: content | .. container:: content |
1086 | .. code:: | .. code:: |
1087 | :number-lines: | :number-lines: |
1090 | "nameSpace": "org.onap.policy.apex.sample.events", | "name": "Event0004", |
1091 | "name": "Event0000", | "version": "0.0.1", |
1092 | "version": "0.0.1", | "nameSpace": "org.onap.policy.apex.sample.events", |
1093 | "source": "test", | "source": "Act", |
1094 | "target": "apex", | "target": "Outside", |
1095 | "TestSlogan": "Test slogan for External Event0", | "TestActCaseSelected": 2, |
1096 | "TestMatchCase": 0, | "TestActStateTime": 1536157104627, |
1097 | "TestTimestamp": 1469781869269, | "TestDecideCaseSelected": 0, |
1098 | "TestTemperature": 9080.866 | "TestDecideStateTime": 1536157104625, |
1099 | } | "TestEstablishCaseSelected": 0, |
1100 | | "TestEstablishStateTime": 1536157104623, |
1101 | | "TestMatchCase": 0, |
1102 | | "TestMatchCaseSelected": 1, |
1103 | | "TestMatchStateTime": 1536157104620, |
1104 | | "TestSlogan": "Test slogan for External Event0", |
1105 | | "TestTemperature": 9080.866, |
1106 | | "TestTimestamp": 1469781869269 |
1108 +-------------------------------------------------------------+-------------------------------------------------------------+
1110 .. container:: paragraph
1112 Terminate APEX by simply using ``CTRL+C`` in the console.
1114 Verify a Full Installation - REST Client
1115 ########################################
1117 .. container:: paragraph
1119 APEX has a REST application for deploying, monitoring, and viewing policy models. The
1120 application can also be used to create new policy models close to
1121 the engine native policy language. Start the REST client as
1124 .. container:: listingblock
1126 .. container:: content
1131 # $APEX_HOME/bin/apexApps.sh full-client
1133 .. container:: listingblock
1135 .. container:: content
1140 >%APEX_HOME%\bin\apexApps.bat full-client
1142 .. container:: paragraph
1144 The script will start a simple web server
1145 (`Grizzly <https://javaee.github.io/grizzly/>`__) and deploy a
1146 ``war`` web archive in it. Once the client is started, it will be
1147 available on ``localhost:18989``. The last few line of the messages
1150 .. container:: listingblock
1152 .. container:: content
1157 Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
1158 Jul 02, 2020 2:57:39 PM org.glassfish.grizzly.http.server.NetworkListener start
1159 INFO: Started listener bound to [localhost:18989]
1160 Jul 02, 2020 2:57:39 PM org.glassfish.grizzly.http.server.HttpServer start
1161 INFO: [HttpServer] Started.
1162 Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
1165 .. container:: paragraph
1167 Now open a browser (Firefox, Chrome, Opera, Internet Explorer) and
1168 use the URL ``http://localhost:18989/``. This will connect the
1169 browser to the started REST client. Click on the "Policy Editor" button and the Policy Editor start screen should be as
1172 .. container:: imageblock
1174 .. container:: content
1176 |REST Editor Start Screen|
1178 .. container:: title
1180 Figure 1. REST Editor Start Screen
1182 .. container:: paragraph
1184 Now load a policy model by clicking the menu ``File`` and then
1185 ``Open``. In the opened dialog, go to the directory where APEX is
1186 installed, then ``examples``, ``models``, ``SampleDomain``, and there
1187 select the file ``SamplePolicyModelJAVA.json``. This will load the
1188 policy model used to verify the policy engine (see above). Once
1189 loaded, the screen should look as follows.
1191 .. container:: imageblock
1193 .. container:: content
1195 |REST Editor with loaded SampleDomain Policy Model|
1197 .. container:: title
1199 Figure 2. REST Editor with loaded SampleDomain Policy Model
1201 .. container:: paragraph
1203 Now you can use the REST editor. To finish this verification, simply
1204 terminate your browser (or the tab), and then use ``CTRL+C`` in the
1205 console where you started the REST editor.
1207 Installing the WAR Application
1208 ------------------------------
1210 .. container:: paragraph
1212 The three APEX clients are packaged in a WAR file. This is a complete
1213 application that can be installed and run in an application
1214 server. The application is realized as a servlet. You
1215 can find the WAR application in the `ONAP Nexus Repository <https://nexus.onap.org/content/groups/public/org/onap/policy/apex-pdp/client/apex-client-full/>`__.
1218 .. container:: paragraph
1220 Installing and using the WAR application requires a web server
1221 that can execute ``war`` web archives. We recommend to use `Apache
1222 Tomcat <https://tomcat.apache.org/>`__, however other web servers
1223 can be used as well.
1225 .. container:: paragraph
1227 Install Apache Tomcat including the ``Manager App``, see `V9.0
1228 Docs <https://tomcat.apache.org/tomcat-9.0-doc/manager-howto.html#Configuring_Manager_Application_Access>`__
1229 for details. Start the Tomcat service, or make sure that Tomcat is
1232 .. container:: paragraph
1234 There are multiple ways to install the APEX WAR application:
1236 .. container:: ulist
1238 - copy the ``.war`` file into the Tomcat ``webapps`` folder
1240 - use the Tomcat ``Manager App`` to deploy via the web interface
1242 - deploy using a REST call to Tomcat
1244 .. container:: paragraph
1246 For details on how to install ``war`` files please consult the
1248 Documentation <https://tomcat.apache.org/tomcat-9.0-doc/index.html>`__
1250 HOW-TO <https://tomcat.apache.org/tomcat-9.0-doc/manager-howto.html>`__.
1251 Once you installed an APEX WAR application (and wait for
1252 sufficient time for Tomcat to finalize the installation), open the
1253 ``Manager App`` in Tomcat. You should see the APEX WAR application
1254 being installed and running.
1256 .. container:: paragraph
1258 In case of errors, examine the log files in the Tomcat log
1259 directory. In a conventional install, those log files are in the
1260 logs directory where Tomcat is installed.
1262 .. container:: paragraph
1264 The WAR application file has a name similar to *apex-client-full-<VERSION>.war*.
1266 Running APEX in Docker
1267 ----------------------
1269 .. container:: paragraph
1271 Since APEX is in ONAP, we provide a full virtualization
1272 environment for the engine.
1277 .. container:: paragraph
1279 Running APEX from the ONAP docker repository only requires 2
1282 .. container:: olist arabic
1284 #. Log into the ONAP docker repo
1286 .. container:: listingblock
1288 .. container:: content
1292 docker login -u docker -p docker nexus3.onap.org:10003
1294 .. container:: olist arabic
1296 #. Run the APEX docker image
1298 .. container:: listingblock
1300 .. container:: content
1304 docker run -it --rm nexus3.onap.org:10003/onap/policy-apex-pdp:latest
1306 Build a Docker Image
1307 ####################
1309 .. container:: paragraph
1311 Alternatively, one can use the Dockerfile defined in the Docker
1312 package to build an image.
1314 .. container:: listingblock
1316 .. container:: title
1320 .. container:: content
1326 # Docker file to build an image that runs APEX on Java 8 in Ubuntu
1330 RUN apt-get update && \
1331 apt-get upgrade -y && \
1332 apt-get install -y software-properties-common && \
1333 add-apt-repository ppa:openjdk-r/ppa -y && \
1335 apt-get install -y openjdk-8-jdk
1337 # Create apex user and group
1338 RUN groupadd apexuser
1339 RUN useradd --create-home -g apexuser apexuser
1341 # Add Apex-specific directories and set ownership as the Apex admin user
1342 RUN mkdir -p /opt/app/policy/apex-pdp
1343 RUN mkdir -p /var/log/onap/policy/apex-pdp
1344 RUN chown -R apexuser:apexuser /var/log/onap/policy/apex-pdp
1346 # Unpack the tarball
1348 COPY apex-pdp-package-full.tar.gz /packages
1349 RUN tar xvfz /packages/apex-pdp-package-full.tar.gz --directory /opt/app/policy/apex-pdp
1350 RUN rm /packages/apex-pdp-package-full.tar.gz
1352 # Ensure everything has the correct permissions
1353 RUN find /opt/app -type d -perm 755
1354 RUN find /opt/app -type f -perm 644
1355 RUN chmod a+x /opt/app/policy/apex-pdp/bin/*
1357 # Copy examples to Apex user area
1358 RUN cp -pr /opt/app/policy/apex-pdp/examples /home/apexuser
1362 RUN chown -R apexuser:apexuser /home/apexuser/*
1365 ENV PATH /opt/app/policy/apex-pdp/bin:$PATH
1366 WORKDIR /home/apexuser
1368 APEX Configurations Explained
1369 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1371 Introduction to APEX Configuration
1372 ----------------------------------
1374 .. container:: paragraph
1376 An APEX engine can be configured to use various combinations
1377 of event input handlers, event output handlers, event
1378 protocols, context handlers, and logic executors. The system
1379 is build using a plugin architecture. Each configuration
1380 option is realized by a plugin, which can be loaded and
1381 configured when the engine is started. New plugins can be
1382 added to the system at any time, though to benefit from a
1383 new plugin an engine will need to be restarted.
1385 .. container:: imageblock
1387 .. container:: content
1389 |APEX Configuration Matrix|
1391 .. container:: title
1393 Figure 3. APEX Configuration Matrix
1395 .. container:: paragraph
1397 The APEX distribution already comes with a number of
1398 plugins. The figure above shows the provided plugins. Any
1399 combination of input, output, event protocol, context
1400 handlers, and executors is possible.
1402 General Configuration Format
1403 ----------------------------
1405 .. container:: paragraph
1407 The APEX configuration file is a JSON file containing a few
1408 main blocks for different parts of the configuration. Each
1409 block then holds the configuration details. The following
1410 code shows the main blocks:
1412 .. container:: listingblock
1414 .. container:: content
1419 "engineServiceParameters":{
1421 "engineParameters":{ (2)
1422 "executorParameters":{...}, (3)
1423 "contextParameters":{...} (4)
1424 "taskParameters":[...] (5)
1427 "eventInputParameters":{ (6)
1429 "carrierTechnologyParameters":{...},
1430 "eventProtocolParameters":{...}
1433 "carrierTechnologyParameters":{...},
1434 "eventProtocolParameters":{...}
1438 "eventOutputParameters":{ (10)
1440 "carrierTechnologyParameters":{...},
1441 "eventProtocolParameters":{...}
1444 "carrierTechnologyParameters":{...},
1445 "eventProtocolParameters":{...}
1451 .. container:: colist arabic
1453 +-----------------------------------+-----------------------------------+
1454 | **1** | main engine configuration |
1455 +-----------------------------------+-----------------------------------+
1456 | **2** | engine parameters for plugin |
1457 | | configurations (execution |
1458 | | environments and context |
1460 +-----------------------------------+-----------------------------------+
1461 | **3** | engine specific parameters, |
1462 | | mainly for executor plugins |
1463 +-----------------------------------+-----------------------------------+
1464 | **4** | context specific parameters, e.g. |
1465 | | for context schemas, persistence, |
1467 +-----------------------------------+-----------------------------------+
1468 | **5** | list of task parameters that |
1469 | | should be made available in task |
1470 | | logic (optional). |
1471 +-----------------------------------+-----------------------------------+
1472 | **6** | configuration of the input |
1474 +-----------------------------------+-----------------------------------+
1475 | **7** | an example input called |
1476 | | ``input1`` with carrier |
1477 | | technology and event protocol |
1478 +-----------------------------------+-----------------------------------+
1479 | **8** | an example input called |
1480 | | ``input2`` with carrier |
1481 | | technology and event protocol |
1482 +-----------------------------------+-----------------------------------+
1483 | **9** | any further input configuration |
1484 +-----------------------------------+-----------------------------------+
1485 | **10** | configuration of the output |
1487 +-----------------------------------+-----------------------------------+
1488 | **11** | an example output called |
1489 | | ``output1`` with carrier |
1490 | | technology and event protocol |
1491 +-----------------------------------+-----------------------------------+
1492 | **12** | an example output called |
1493 | | ``output2`` with carrier |
1494 | | technology and event protocol |
1495 +-----------------------------------+-----------------------------------+
1496 | **13** | any further output configuration |
1497 +-----------------------------------+-----------------------------------+
1499 Engine Service Parameters
1500 -------------------------
1502 .. container:: paragraph
1504 The configuration provides a number of parameters to
1505 configure the engine. An example configuration with
1506 explanations of all options is shown below.
1508 .. container:: listingblock
1510 .. container:: content
1514 "engineServiceParameters" : {
1515 "name" : "AADMApexEngine", (1)
1516 "version" : "0.0.1", (2)
1518 "instanceCount" : 4, (4)
1519 "deploymentPort" : 12345, (5)
1520 "policyModelFileName" : "examples/models/VPN/VPNPolicyModelJava.json", (6a)
1521 "policy_type_impl" : {...}, (6b)
1522 "periodicEventPeriod": 1000, (7)
1523 "engineParameters":{ (8)
1524 "executorParameters":{...}, (9)
1525 "contextParameters":{...}, (10)
1526 "taskParameters":[...] (11)
1530 .. container:: colist arabic
1532 +-----------------------------------+-----------------------------------+
1533 | **1** | a name for the engine. The engine |
1534 | | name is used to create a key in a |
1535 | | runtime engine. An name matching |
1536 | | the following regular expression |
1537 | | can be used here: |
1538 | | ``[A-Za-z0-9\\-_\\.]+`` |
1539 +-----------------------------------+-----------------------------------+
1540 | **2** | a version of the engine, use |
1541 | | semantic versioning as explained |
1542 | | here: `Semantic |
1543 | | Versioning <http://semver.org/>`_ |
1545 | | This version is used in a runtime |
1546 | | engine to create a version of the |
1547 | | engine. For that reason, the |
1548 | | version must match the following |
1549 | | regular expression ``[A-Z0-9.]+`` |
1550 +-----------------------------------+-----------------------------------+
1551 | **3** | a numeric identifier for the |
1553 +-----------------------------------+-----------------------------------+
1554 | **4** | the number of threads (policy |
1555 | | instances executed in parallel) |
1556 | | the engine should use, use ``1`` |
1557 | | for single threaded engines |
1558 +-----------------------------------+-----------------------------------+
1559 | **5** | the port for the deployment |
1560 | | Websocket connection to the |
1562 +-----------------------------------+-----------------------------------+
1563 | **6a** | the APEX policy model file to |
1564 | | load into the engine on startup |
1565 | | when APEX is running native |
1566 | | policies in standalone mode |
1568 +-----------------------------------+-----------------------------------+
1569 | **6b** | the APEX policy model as a JSON |
1570 | | or YAML block to load into the |
1571 | | engine on startup when |
1572 | | APEX is running a policy that has |
1573 | | its logic and parameters |
1574 | | specified in TOSCA |
1576 +-----------------------------------+-----------------------------------+
1577 | **7** | an optional timer for periodic |
1578 | | policies, in milliseconds (a |
1579 | | defined periodic policy will be |
1580 | | executed every ``X`` |
1581 | | milliseconds), not used of not |
1583 +-----------------------------------+-----------------------------------+
1584 | **8** | engine parameters for plugin |
1585 | | configurations (execution |
1586 | | environments and context |
1588 +-----------------------------------+-----------------------------------+
1589 | **9** | engine specific parameters, |
1590 | | mainly for executor plugins |
1591 +-----------------------------------+-----------------------------------+
1592 | **10** | context specific parameters, e.g. |
1593 | | for context schemas, persistence, |
1595 +-----------------------------------+-----------------------------------+
1596 | **11** | list of task parameters that |
1597 | | should be made available in task |
1598 | | logic (optional). |
1599 +-----------------------------------+-----------------------------------+
1601 .. container:: paragraph
1603 The model file is optional, it can also be specified via
1604 command line. In any case, make sure all execution and other
1605 required plug-ins for the loaded model are loaded as
1608 Input and Output Interfaces
1609 ---------------------------
1611 .. container:: paragraph
1613 An APEX engine has two main interfaces:
1615 .. container:: ulist
1617 - An *input* interface to receive events: also known as
1618 ingress interface or consumer, receiving (consuming)
1619 events commonly named triggers, and
1621 - An *output* interface to publish produced events: also
1622 known as egress interface or producer, sending
1623 (publishing) events commonly named actions or action
1626 .. container:: paragraph
1628 The input and output interface is configured in terms of
1629 inputs and outputs, respectively. Each input and output is a
1630 combination of a carrier technology and an event protocol.
1631 Carrier technologies and event protocols are provided by
1632 plugins, each with its own specific configuration. Most
1633 carrier technologies can be configured for input as well as
1634 output. Most event protocols can be used for all carrier
1635 technologies. One exception is the JMS object event
1636 protocol, which can only be used for the JMS carrier
1637 technology. Some further restrictions apply (for instance
1638 for carrier technologies using bi- or uni-directional
1641 .. container:: paragraph
1643 Input and output interface can be configured separately, in
1644 isolation, with any number of carrier technologies. The
1645 resulting general configuration options are:
1647 .. container:: ulist
1649 - Input interface with one or more inputs
1651 .. container:: ulist
1653 - each input with a carrier technology and an event
1656 - some inputs with optional synchronous mode
1658 - some event protocols with additional parameters
1660 - Output interface with one or more outputs
1662 .. container:: ulist
1664 - each output with a carrier technology and an event
1667 - some outputs with optional synchronous mode
1669 - some event protocols with additional parameters
1671 .. container:: paragraph
1673 The configuration for input and output is contained in
1674 ``eventInputParameters`` and ``eventOutputParameters``,
1675 respectively. Inside here, one can configure any number of
1676 inputs and outputs. Each of them needs to have a unique
1677 identifier (name), the content of the name is free form. The
1678 example below shows a configuration for two inputs and two
1681 .. container:: listingblock
1683 .. container:: content
1687 "eventInputParameters": { (1)
1688 "FirstConsumer": { (2)
1689 "carrierTechnologyParameters" : {...}, (3)
1690 "eventProtocolParameters":{...}, (4)
1693 "SecondConsumer": { (6)
1694 "carrierTechnologyParameters" : {...}, (7)
1695 "eventProtocolParameters":{...}, (8)
1699 "eventOutputParameters": { (10)
1700 "FirstProducer": { (11)
1701 "carrierTechnologyParameters":{...}, (12)
1702 "eventProtocolParameters":{...}, (13)
1705 "SecondProducer": { (15)
1706 "carrierTechnologyParameters":{...}, (16)
1707 "eventProtocolParameters":{...}, (17)
1712 .. container:: colist arabic
1714 +--------+--------------------------------------------------------------------+
1715 | **1** | input interface configuration, APEX input plugins |
1716 +--------+--------------------------------------------------------------------+
1717 | **2** | first input called ``FirstConsumer`` |
1718 +--------+--------------------------------------------------------------------+
1719 | **3** | carrier technology for plugin |
1720 +--------+--------------------------------------------------------------------+
1721 | **4** | event protocol for plugin |
1722 +--------+--------------------------------------------------------------------+
1723 | **5** | any other input configuration (e.g. event name filter, see below) |
1724 +--------+--------------------------------------------------------------------+
1725 | **6** | second input called ``SecondConsumer`` |
1726 +--------+--------------------------------------------------------------------+
1727 | **7** | carrier technology for plugin |
1728 +--------+--------------------------------------------------------------------+
1729 | **8** | event protocol for plugin |
1730 +--------+--------------------------------------------------------------------+
1731 | **9** | any other plugin configuration |
1732 +--------+--------------------------------------------------------------------+
1733 | **10** | output interface configuration, APEX output plugins |
1734 +--------+--------------------------------------------------------------------+
1735 | **11** | first output called ``FirstProducer`` |
1736 +--------+--------------------------------------------------------------------+
1737 | **12** | carrier technology for plugin |
1738 +--------+--------------------------------------------------------------------+
1739 | **13** | event protocol for plugin |
1740 +--------+--------------------------------------------------------------------+
1741 | **14** | any other plugin configuration |
1742 +--------+--------------------------------------------------------------------+
1743 | **15** | second output called ``SecondProducer`` |
1744 +--------+--------------------------------------------------------------------+
1745 | **16** | carrier technology for plugin |
1746 +--------+--------------------------------------------------------------------+
1747 | **17** | event protocol for plugin |
1748 +--------+--------------------------------------------------------------------+
1749 | **18** | any other output configuration (e.g. event name filter, see below) |
1750 +--------+--------------------------------------------------------------------+
1755 .. container:: paragraph
1757 APEX will always send an event after a policy execution
1758 is finished. For a successful execution, the event sent
1759 is the output event created by the policy. In case the
1760 policy does not create an output event, APEX will create
1761 a new event with all input event fields plus an
1762 additional field ``exceptionMessage`` with an exception
1765 .. container:: paragraph
1767 There are situations in which this auto-generated error
1768 event might not be required or wanted:
1770 .. container:: ulist
1772 - when a policy failing should not result in an event
1773 send out via an output interface
1775 - when the auto-generated event goes back in an APEX
1776 engine (or the same APEX engine), this can create
1779 - the auto-generated event should go to a special output
1780 interface or channel
1782 .. container:: paragraph
1784 All of these situations are supported by a filter option
1785 using a wildecard (regular expression) configuration on
1786 APEX I/O interfaces. The parameter is called
1787 ``eventNameFilter`` and the value are `Java regular
1788 expressions <https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html>`__
1790 `tutorial <http://www.vogella.com/tutorials/JavaRegularExpressions/article.html>`__).
1791 The following code shows some examples:
1793 .. container:: listingblock
1795 .. container:: content
1799 "eventInputParameters": {
1801 "carrierTechnologyParameters" : {...},
1802 "eventProtocolParameters":{...},
1803 "eventNameFilter" : "^E[Vv][Ee][Nn][Tt][0-9]004$" (1)
1806 "eventOutputParameters": {
1808 "carrierTechnologyParameters":{...},
1809 "eventProtocolParameters":{...},
1810 "eventNameFilter" : "^E[Vv][Ee][Nn][Tt][0-9]104$" (2)
1817 .. container:: paragraph
1819 Executors are plugins that realize the execution of logic
1820 contained in a policy model. Logic can be in a task
1821 selector, a task, and a state finalizer. Using plugins for
1822 execution environments makes APEX very flexible to support
1823 virtually any executable logic expressions.
1825 .. container:: paragraph
1827 APEX 2.0.0-SNAPSHOT supports the following executors:
1829 .. container:: ulist
1831 - Java, for Java implemented logic
1833 .. container:: ulist
1835 - This executor requires logic implemented using the
1836 APEX Java interfaces.
1838 - Generated JAR files must be in the classpath of the
1839 APEX engine at start time.
1849 .. container:: ulist
1851 - This executor uses the latest version of the MVEL
1852 engine, which can be very hard to debug and can
1853 produce unwanted side effects during execution
1855 Configure the Javascript Executor
1856 #################################
1858 .. container:: paragraph
1860 The Javascript executor is added to the configuration as
1863 .. container:: listingblock
1865 .. container:: content
1869 "engineServiceParameters":{
1870 "engineParameters":{
1871 "executorParameters":{
1873 "parameterClassName" :
1874 "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
1880 Configure the Jython Executor
1881 #############################
1883 .. container:: paragraph
1885 The Jython executor is added to the configuration as
1888 .. container:: listingblock
1890 .. container:: content
1894 "engineServiceParameters":{
1895 "engineParameters":{
1896 "executorParameters":{
1898 "parameterClassName" :
1899 "org.onap.policy.apex.plugins.executor.jython.JythonExecutorParameters"
1905 Configure the JRuby Executor
1906 ############################
1908 .. container:: paragraph
1910 The JRuby executor is added to the configuration as
1913 .. container:: listingblock
1915 .. container:: content
1919 "engineServiceParameters":{
1920 "engineParameters":{
1921 "executorParameters":{
1923 "parameterClassName" :
1924 "org.onap.policy.apex.plugins.executor.jruby.JrubyExecutorParameters"
1930 Configure the Java Executor
1931 ###########################
1933 .. container:: paragraph
1935 The Java executor is added to the configuration as
1938 .. container:: listingblock
1940 .. container:: content
1944 "engineServiceParameters":{
1945 "engineParameters":{
1946 "executorParameters":{
1948 "parameterClassName" :
1949 "org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters"
1955 Configure the MVEL Executor
1956 ###########################
1958 .. container:: paragraph
1960 The MVEL executor is added to the configuration as
1963 .. container:: listingblock
1965 .. container:: content
1969 "engineServiceParameters":{
1970 "engineParameters":{
1971 "executorParameters":{
1973 "parameterClassName" :
1974 "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters"
1983 .. container:: paragraph
1985 Context handlers are responsible for all context processing.
1986 There are the following main areas:
1988 .. container:: ulist
1990 - Context schema: use schema handlers other than Java class
1991 (supported by default without configuration)
1993 - Context distribution: distribute context across multiple
1996 - Context locking: mechanisms to lock context elements for
1999 - Context persistence: mechanisms to persist context
2001 .. container:: paragraph
2003 APEX provides plugins for each of the main areas.
2005 Configure AVRO Schema Handler
2006 #############################
2008 .. container:: paragraph
2010 The AVRO schema handler is added to the configuration as
2013 .. container:: listingblock
2015 .. container:: content
2019 "engineServiceParameters":{
2020 "engineParameters":{
2021 "contextParameters":{
2022 "parameterClassName" : "org.onap.policy.apex.context.parameters.ContextParameters",
2023 "schemaParameters":{
2025 "parameterClassName" :
2026 "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
2033 .. container:: paragraph
2035 Using the AVRO schema handler has one limitation: AVRO
2036 only supports field names that represent valid Java class
2037 names. This means only letters and the character ``_``
2038 are supported. Characters commonly used in field names,
2039 such as ``.`` and ``-``, are not supported by AVRO. for
2040 more information see `Avro Spec:
2041 Names <https://avro.apache.org/docs/1.8.1/spec.html#names>`__.
2043 .. container:: paragraph
2045 To work with this limitation, the APEX Avro plugin will
2046 parse a given AVRO definition and replace *all*
2047 occurrences of ``.`` and ``-`` with a ``_``. This means
2050 .. container:: ulist
2052 - In a policy model, if the AVRO schema defined a field
2053 as ``my-name`` the policy logic should access it as
2056 - In a policy model, if the AVRO schema defined a field
2057 as ``my.name`` the policy logic should access it as
2060 - There should be no field names that convert to the
2063 .. container:: ulist
2065 - For instance the simultaneous use of
2066 ``my_name``, ``my.name``, and ``my-name`` should
2069 - If not avoided, the event processing might
2070 create unwanted side effects
2072 - If field names use any other not-supported character,
2073 the AVRO plugin will reject it
2075 .. container:: ulist
2077 - Since AVRO uses lazy initialization, this
2078 rejection might only become visible at runtime
2080 Configure Task Parameters
2081 #########################
2083 .. container:: paragraph
2085 The Task Parameters are added to the configuration as
2088 .. container:: listingblock
2090 .. container:: content
2094 "engineServiceParameters": {
2095 "engineParameters": {
2098 "key": "ParameterKey1",
2099 "value": "ParameterValue1"
2102 "taskId": "Task_Act0",
2103 "key": "ParameterKey2",
2104 "value": "ParameterValue2"
2110 .. container:: paragraph
2112 TaskParameters can be used to pass parameters from ApexConfig
2113 to the policy logic. In the config, these are optional.
2114 The list of task parameters provided in the config may be added
2115 to the tasks or existing task parameters in the task will be overriden.
2117 .. container:: paragraph
2119 If taskId is provided in ApexConfig for an entry, then that
2120 parameter is updated only for that particular task. Otherwise,
2121 the task parameter is added to all tasks.
2123 Carrier Technologies
2124 --------------------
2126 .. container:: paragraph
2128 Carrier technologies define how APEX receives (input) and
2129 sends (output) events. They can be used in any combination,
2130 using asynchronous or synchronous mode. There can also be
2131 any number of carrier technologies for the input (consume)
2132 and the output (produce) interface.
2134 .. container:: paragraph
2136 Supported *input* technologies are:
2138 .. container:: ulist
2140 - Standard input, read events from the standard input
2141 (console), not suitable for APEX background servers
2143 - File input, read events from a file
2145 - Kafka, read events from a Kafka system
2147 - Websockets, read events from a Websocket
2151 - REST (synchronous and asynchronous), additionally as
2154 - Event Requestor, allows reading of events that have been
2155 looped back into APEX
2157 .. container:: paragraph
2159 Supported *output* technologies are:
2161 .. container:: ulist
2163 - Standard output, write events to the standard output
2164 (console), not suitable for APEX background servers
2166 - File output, write events to a file
2168 - Kafka, write events to a Kafka system
2170 - Websockets, write events to a Websocket
2174 - REST (synchronous and asynchronous), additionally as
2177 - Event Requestor, allows events to be looped back into
2180 .. container:: paragraph
2182 New carrier technologies can be added as plugins to APEX or
2183 developed outside APEX and added to an APEX deployment.
2188 .. container:: paragraph
2190 Standard IO does not require a specific plugin, it is
2191 supported be default.
2195 .. container:: paragraph
2197 APEX will take events from its standard input. This
2198 carrier is good for testing, but certainly not for a
2199 use case where APEX runs as a server. The
2200 configuration is as follows:
2202 .. container:: listingblock
2204 .. container:: content
2208 "carrierTechnologyParameters" : {
2209 "carrierTechnology" : "FILE", (1)
2211 "standardIO" : true (2)
2215 .. container:: colist arabic
2217 +-------+---------------------------------------+
2218 | **1** | standard input is considered a file |
2219 +-------+---------------------------------------+
2220 | **2** | file descriptor set to standard input |
2221 +-------+---------------------------------------+
2226 .. container:: paragraph
2228 APEX will send events to its standard output. This
2229 carrier is good for testing, but certainly not for a
2230 use case where APEX runs as a server. The
2231 configuration is as follows:
2233 .. container:: listingblock
2235 .. container:: content
2239 "carrierTechnologyParameters" : {
2240 "carrierTechnology" : "FILE", (1)
2242 "standardIO" : true (2)
2246 .. container:: colist arabic
2248 +-------+----------------------------------------+
2249 | **1** | standard output is considered a file |
2250 +-------+----------------------------------------+
2251 | **2** | file descriptor set to standard output |
2252 +-------+----------------------------------------+
2257 .. container:: paragraph
2259 File IO does not require a specific plugin, it is
2260 supported be default.
2265 .. container:: paragraph
2267 APEX will take events from a file. The same file
2268 should not be used as an output. The configuration is
2271 .. container:: listingblock
2273 .. container:: content
2277 "carrierTechnologyParameters" : {
2278 "carrierTechnology" : "FILE", (1)
2280 "fileName" : "examples/events/SampleDomain/EventsIn.xmlfile" (2)
2284 .. container:: colist arabic
2286 +-------+------------------------------------------+
2287 | **1** | set file input |
2288 +-------+------------------------------------------+
2289 | **2** | the name of the file to read events from |
2290 +-------+------------------------------------------+
2294 .. container:: paragraph
2296 APEX will write events to a file. The same file should
2297 not be used as an input. The configuration is as
2300 .. container:: listingblock
2302 .. container:: content
2306 "carrierTechnologyParameters" : {
2307 "carrierTechnology" : "FILE", (1)
2309 "fileName" : "examples/events/SampleDomain/EventsOut.xmlfile" (2)
2313 .. container:: colist arabic
2315 +-------+-----------------------------------------+
2316 | **1** | set file output |
2317 +-------+-----------------------------------------+
2318 | **2** | the name of the file to write events to |
2319 +-------+-----------------------------------------+
2324 .. container:: paragraph
2326 Event Requestor IO does not require a specific plugin, it
2327 is supported be default. It should only be used with the
2328 APEX event protocol.
2330 Event Requestor Input
2331 =====================
2333 .. container:: paragraph
2335 APEX will take events from APEX.
2337 .. container:: listingblock
2339 .. container:: content
2343 "carrierTechnologyParameters" : {
2344 "carrierTechnology": "EVENT_REQUESTOR" (1)
2347 .. container:: colist arabic
2349 +-------+---------------------------+
2350 | **1** | set event requestor input |
2351 +-------+---------------------------+
2353 Event Requestor Output
2354 ======================
2356 .. container:: paragraph
2358 APEX will write events to APEX.
2360 .. container:: listingblock
2362 .. container:: content
2366 "carrierTechnologyParameters" : {
2367 "carrierTechnology": "EVENT_REQUESTOR" (1)
2370 Peering Event Requestors
2371 ========================
2373 .. container:: paragraph
2375 When using event requestors, they need to be peered.
2376 This means an event requestor output needs to be
2377 peered (associated) with an event requestor input. The
2378 following example shows the use of an event requestor
2379 with the APEX event protocol and the peering of output
2382 .. container:: listingblock
2384 .. container:: content
2388 "eventInputParameters": {
2389 "EventRequestorConsumer": {
2390 "carrierTechnologyParameters": {
2391 "carrierTechnology": "EVENT_REQUESTOR" (1)
2393 "eventProtocolParameters": {
2394 "eventProtocol": "APEX" (2)
2396 "eventNameFilter": "InputEvent", (3)
2397 "requestorMode": true, (4)
2398 "requestorPeer": "EventRequestorProducer", (5)
2399 "requestorTimeout": 500 (6)
2402 "eventOutputParameters": {
2403 "EventRequestorProducer": {
2404 "carrierTechnologyParameters": {
2405 "carrierTechnology": "EVENT_REQUESTOR" (7)
2407 "eventProtocolParameters": {
2408 "eventProtocol": "APEX" (8)
2410 "eventNameFilter": "EventListEvent", (9)
2411 "requestorMode": true, (10)
2412 "requestorPeer": "EventRequestorConsumer", (11)
2413 "requestorTimeout": 500 (12)
2417 .. container:: colist arabic
2419 +-----------------------------------+-----------------------------------+
2420 | **1** | event requestor on a consumer |
2421 +-----------------------------------+-----------------------------------+
2422 | **2** | with APEX event protocol |
2423 +-----------------------------------+-----------------------------------+
2424 | **3** | optional filter (best to use a |
2425 | | filter to prevent unwanted events |
2426 | | on the consumer side) |
2427 +-----------------------------------+-----------------------------------+
2428 | **4** | activate requestor mode |
2429 +-----------------------------------+-----------------------------------+
2430 | **5** | the peer to the output (must |
2431 | | match the output carrier) |
2432 +-----------------------------------+-----------------------------------+
2433 | **6** | an optional timeout in |
2435 +-----------------------------------+-----------------------------------+
2436 | **7** | event requestor on a producer |
2437 +-----------------------------------+-----------------------------------+
2438 | **8** | with APEX event protocol |
2439 +-----------------------------------+-----------------------------------+
2440 | **9** | optional filter (best to use a |
2441 | | filter to prevent unwanted events |
2442 | | on the consumer side) |
2443 +-----------------------------------+-----------------------------------+
2444 | **10** | activate requestor mode |
2445 +-----------------------------------+-----------------------------------+
2446 | **11** | the peer to the output (must |
2447 | | match the input carrier) |
2448 +-----------------------------------+-----------------------------------+
2449 | **12** | an optional timeout in |
2451 +-----------------------------------+-----------------------------------+
2456 .. container:: paragraph
2458 Kafka IO is supported by the APEX Kafka plugin. The
2459 configurations below are examples. APEX will take any
2460 configuration inside the parameter object and forward it
2461 to Kafka. More information on Kafka specific
2462 configuration parameters can be found in the Kafka
2465 .. container:: ulist
2468 Class <https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html>`__
2471 Class <https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html>`__
2475 .. container:: paragraph
2477 APEX will receive events from the Apache Kafka
2478 messaging system. The input is uni-directional, an
2479 engine will only receive events from the input but not
2480 send any event to the input.
2482 .. container:: listingblock
2484 .. container:: content
2488 "carrierTechnologyParameters" : {
2489 "carrierTechnology" : "KAFKA", (1)
2490 "parameterClassName" :
2491 "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
2493 "bootstrapServers" : "localhost:49092", (2)
2494 "groupId" : "apex-group-id", (3)
2495 "enableAutoCommit" : true, (4)
2496 "autoCommitTime" : 1000, (5)
2497 "sessionTimeout" : 30000, (6)
2498 "consumerPollTime" : 100, (7)
2499 "consumerTopicList" : ["apex-in-0", "apex-in-1"], (8)
2501 "org.apache.kafka.common.serialization.StringDeserializer", (9)
2502 "valueDeserializer" :
2503 "org.apache.kafka.common.serialization.StringDeserializer" (10)
2507 .. container:: colist arabic
2509 +--------+-------------------------------------+
2510 | **1** | set Kafka as carrier technology |
2511 +--------+-------------------------------------+
2512 | **2** | bootstrap server and port |
2513 +--------+-------------------------------------+
2514 | **3** | a group identifier |
2515 +--------+-------------------------------------+
2516 | **4** | flag for auto-commit |
2517 +--------+-------------------------------------+
2518 | **5** | auto-commit timeout in milliseconds |
2519 +--------+-------------------------------------+
2520 | **6** | session timeout in milliseconds |
2521 +--------+-------------------------------------+
2522 | **7** | consumer poll time in milliseconds |
2523 +--------+-------------------------------------+
2524 | **8** | consumer topic list |
2525 +--------+-------------------------------------+
2526 | **9** | key for the Kafka de-serializer |
2527 +--------+-------------------------------------+
2528 | **10** | value for the Kafka de-serializer |
2529 +--------+-------------------------------------+
2533 .. container:: paragraph
2535 APEX will send events to the Apache Kafka messaging
2536 system. The output is uni-directional, an engine will
2537 send events to the output but not receive any event
2540 .. container:: listingblock
2542 .. container:: content
2546 "carrierTechnologyParameters" : {
2547 "carrierTechnology" : "KAFKA", (1)
2548 "parameterClassName" :
2549 "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
2551 "bootstrapServers" : "localhost:49092", (2)
2554 "batchSize" : 16384, (5)
2555 "lingerTime" : 1, (6)
2556 "bufferMemory" : 33554432, (7)
2557 "producerTopic" : "apex-out", (8)
2559 "org.apache.kafka.common.serialization.StringSerializer", (9)
2561 "org.apache.kafka.common.serialization.StringSerializer" (10)
2565 .. container:: colist arabic
2567 +--------+---------------------------------+
2568 | **1** | set Kafka as carrier technology |
2569 +--------+---------------------------------+
2570 | **2** | bootstrap server and port |
2571 +--------+---------------------------------+
2572 | **3** | acknowledgement strategy |
2573 +--------+---------------------------------+
2574 | **4** | number of retries |
2575 +--------+---------------------------------+
2576 | **5** | batch size |
2577 +--------+---------------------------------+
2578 | **6** | time to linger in milliseconds |
2579 +--------+---------------------------------+
2580 | **7** | buffer memory in byte |
2581 +--------+---------------------------------+
2582 | **8** | producer topic |
2583 +--------+---------------------------------+
2584 | **9** | key for the Kafka serializer |
2585 +--------+---------------------------------+
2586 | **10** | value for the Kafka serializer |
2587 +--------+---------------------------------+
2592 .. container:: paragraph
2594 APEX supports the Java Messaging Service (JMS) as input
2595 as well as output. JMS IO is supported by the APEX JMS
2596 plugin. Input and output support an event encoding as
2597 text (JSON string) or object (serialized object). The
2598 input configuration is the same for both encodings, the
2599 output configuration differs.
2603 .. container:: paragraph
2605 APEX will receive events from a JMS messaging system.
2606 The input is uni-directional, an engine will only
2607 receive events from the input but not send any event
2610 .. container:: listingblock
2612 .. container:: content
2616 "carrierTechnologyParameters" : {
2617 "carrierTechnology" : "JMS", (1)
2618 "parameterClassName" :
2619 "org.onap.policy.apex.plugins.event.carrier.jms.JMSCarrierTechnologyParameters",
2620 "parameters" : { (2)
2621 "initialContextFactory" :
2622 "org.jboss.naming.remote.client.InitialContextFactory", (3)
2623 "connectionFactory" : "ConnectionFactory", (4)
2624 "providerURL" : "remote://localhost:5445", (5)
2625 "securityPrincipal" : "guest", (6)
2626 "securityCredentials" : "IAmAGuest", (7)
2627 "consumerTopic" : "jms/topic/apexIn" (8)
2631 .. container:: colist arabic
2633 +-----------------------------------+-----------------------------------+
2634 | **1** | set JMS as carrier technology |
2635 +-----------------------------------+-----------------------------------+
2636 | **2** | set all JMS specific parameters |
2637 +-----------------------------------+-----------------------------------+
2638 | **3** | the context factory, in this case |
2639 | | from JBOSS (it requires the |
2641 | | org.jboss:jboss-remote-naming:2.0 |
2643 | | or a different version to be in |
2644 | | the directory ``$APEX_HOME/lib`` |
2645 | | or ``%APEX_HOME%\lib`` |
2646 +-----------------------------------+-----------------------------------+
2647 | **4** | a connection factory for the JMS |
2649 +-----------------------------------+-----------------------------------+
2650 | **5** | URL with host and port of the JMS |
2652 +-----------------------------------+-----------------------------------+
2653 | **6** | access credentials, user name |
2654 +-----------------------------------+-----------------------------------+
2655 | **7** | access credentials, user password |
2656 +-----------------------------------+-----------------------------------+
2657 | **8** | the JMS topic to listen to |
2658 +-----------------------------------+-----------------------------------+
2660 JMS Output with Text
2661 ====================
2663 .. container:: paragraph
2665 APEX engine send events to a JMS messaging system. The
2666 output is uni-directional, an engine will send events
2667 to the output but not receive any event from output.
2669 .. container:: listingblock
2671 .. container:: content
2675 "carrierTechnologyParameters" : {
2676 "carrierTechnology" : "JMS", (1)
2677 "parameterClassName" :
2678 "org.onap.policy.apex.plugins.event.carrier.jms.JMSCarrierTechnologyParameters",
2679 "parameters" : { (2)
2680 "initialContextFactory" :
2681 "org.jboss.naming.remote.client.InitialContextFactory", (3)
2682 "connectionFactory" : "ConnectionFactory", (4)
2683 "providerURL" : "remote://localhost:5445", (5)
2684 "securityPrincipal" : "guest", (6)
2685 "securityCredentials" : "IAmAGuest", (7)
2686 "producerTopic" : "jms/topic/apexOut", (8)
2687 "objectMessageSending": "false" (9)
2691 .. container:: colist arabic
2693 +-----------------------------------+-----------------------------------+
2694 | **1** | set JMS as carrier technology |
2695 +-----------------------------------+-----------------------------------+
2696 | **2** | set all JMS specific parameters |
2697 +-----------------------------------+-----------------------------------+
2698 | **3** | the context factory, in this case |
2699 | | from JBOSS (it requires the |
2701 | | org.jboss:jboss-remote-naming:2.0 |
2703 | | or a different version to be in |
2704 | | the directory ``$APEX_HOME/lib`` |
2705 | | or ``%APEX_HOME%\lib`` |
2706 +-----------------------------------+-----------------------------------+
2707 | **4** | a connection factory for the JMS |
2709 +-----------------------------------+-----------------------------------+
2710 | **5** | URL with host and port of the JMS |
2712 +-----------------------------------+-----------------------------------+
2713 | **6** | access credentials, user name |
2714 +-----------------------------------+-----------------------------------+
2715 | **7** | access credentials, user password |
2716 +-----------------------------------+-----------------------------------+
2717 | **8** | the JMS topic to write to |
2718 +-----------------------------------+-----------------------------------+
2719 | **9** | set object messaging to ``false`` |
2720 | | means it sends JSON text |
2721 +-----------------------------------+-----------------------------------+
2723 JMS Output with Object
2724 ======================
2726 .. container:: paragraph
2728 To configure APEX for JMS objects on the output
2729 interface use the same configuration as above (for
2730 output). Simply change the ``objectMessageSending``
2731 parameter to ``true``.
2734 ########################
2736 .. container:: paragraph
2738 APEX supports the Websockets as input as well as output.
2739 WS IO is supported by the APEX Websocket plugin. This
2740 carrier technology does only support uni-directional
2741 communication. APEX will not send events to a Websocket
2742 input and any event sent to a Websocket output will
2743 result in an error log.
2745 .. container:: paragraph
2747 The input can be configured as client (APEX connects to
2748 an existing Websocket server) or server (APEX starts a
2749 Websocket server). The same applies to the output. Input
2750 and output can both use a client or a server
2751 configuration, or separate configurations (input as
2752 client and output as server, input as server and output
2753 as client). Each configuration should use its own
2754 dedicated port to avoid any communication loops. The
2755 configuration of a Websocket client is the same for input
2756 and output. The configuration of a Websocket server is
2757 the same for input and output.
2762 .. container:: paragraph
2764 APEX will connect to a given Websocket server. As
2765 input, it will receive events from the server but not
2766 send any events. As output, it will send events to the
2767 server and any event received from the server will
2768 result in an error log.
2770 .. container:: listingblock
2772 .. container:: content
2776 "carrierTechnologyParameters" : {
2777 "carrierTechnology" : "WEBSOCKET", (1)
2778 "parameterClassName" :
2779 "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
2781 "host" : "localhost", (2)
2786 .. container:: colist arabic
2788 +-------+------------------------------------------------------+
2789 | **1** | set Websocket as carrier technology |
2790 +-------+------------------------------------------------------+
2791 | **2** | the host name on which a Websocket server is running |
2792 +-------+------------------------------------------------------+
2793 | **3** | the port of that Websocket server |
2794 +-------+------------------------------------------------------+
2799 .. container:: paragraph
2801 APEX will start a Websocket server, which will accept
2802 any Websocket clients to connect. As input, it will
2803 receive events from the server but not send any
2804 events. As output, it will send events to the server
2805 and any event received from the server will result in
2808 .. container:: listingblock
2810 .. container:: content
2814 "carrierTechnologyParameters" : {
2815 "carrierTechnology" : "WEBSOCKET", (1)
2816 "parameterClassName" :
2817 "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
2819 "wsClient" : false, (2)
2824 .. container:: colist arabic
2826 +-------+------------------------------------------------------------+
2827 | **1** | set Websocket as carrier technology |
2828 +-------+------------------------------------------------------------+
2829 | **2** | disable client, so that APEX will start a Websocket server |
2830 +-------+------------------------------------------------------------+
2831 | **3** | the port for the Websocket server APEX will start |
2832 +-------+------------------------------------------------------------+
2837 .. container:: paragraph
2839 APEX can act as REST client on the input as well as on
2840 the output interface. The media type is
2841 ``application/json``, so this plugin only works with
2842 the JSON Event protocol.
2847 .. container:: paragraph
2849 APEX will connect to a given URL to receive events,
2850 but not send any events. The server is polled, i.e.
2851 APEX will do an HTTP GET, take the result, and then do
2852 the next GET. Any required timing needs to be handled
2853 by the server configured via the URL. For instance,
2854 the server could support a wait timeout via the URL as
2856 The httpCodeFilter is used for filtering the status
2857 code, and it can be configured as a regular expression
2858 string. The default httpCodeFilter is "[2][0-9][0-9]"
2859 - for successful response codes.
2860 The response with HTTP status code that matches the
2861 given regular expression is forwarded to the task,
2862 otherwise it is logged as a failure.
2864 .. container:: listingblock
2866 .. container:: content
2870 "carrierTechnologyParameters" : {
2871 "carrierTechnology" : "RESTCLIENT", (1)
2872 "parameterClassName" :
2873 "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters",
2875 "url" : "http://example.org:8080/triggers/events", (2)
2876 "httpCodeFilter" : "[2][0-9][0-9]" (3)
2880 .. container:: colist arabic
2882 +-------+--------------------------------------------------+
2883 | **1** | set REST client as carrier technology |
2884 +-------+--------------------------------------------------+
2885 | **2** | the URL of the HTTP server for events |
2886 +-------+--------------------------------------------------+
2887 | **3** | use HTTP CODE FILTER for filtering status code |
2888 +-------+--------------------------------------------------+
2893 .. container:: paragraph
2895 APEX will connect to a given URL to send events, but
2896 not receive any events. The default HTTP operation is
2897 POST (no configuration required). To change it to PUT
2898 simply add the configuration parameter (as shown in
2900 The URL can be configured statically or tagged
2901 as ``?example.{site}.org:8080/{trig}/events``,
2902 all tags such as ``site`` and ``trig`` in the URL
2903 need to be set in the properties object available to
2904 the tasks. In addition, the keys should exactly match
2905 with the tags defined in url. The scope of the properties
2906 object is per HTTP call. Hence, key/value pairs set
2907 in the properties object by task are only available
2908 for that specific HTTP call.
2910 .. container:: listingblock
2912 .. container:: content
2916 "carrierTechnologyParameters" : {
2917 "carrierTechnology" : "RESTCLIENT", (1)
2918 "parameterClassName" :
2919 "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters",
2921 "url" : "http://example.com:8888/actions/events", (2)
2922 "url" : "http://example.{site}.com:8888/{trig}/events", (2')
2923 "httpMethod" : "PUT" (3)
2927 .. container:: colist arabic
2929 +-------+--------------------------------------------------+
2930 | **1** | set REST client as carrier technology |
2931 +-------+--------------------------------------------------+
2932 | **2** | the static URL of the HTTP server for events |
2933 +-------+--------------------------------------------------+
2934 | **2'**| the tagged URL of the HTTP server for events |
2935 +-------+--------------------------------------------------+
2936 | **3** | use HTTP PUT (remove this line to use HTTP POST) |
2937 +-------+--------------------------------------------------+
2942 .. container:: paragraph
2944 APEX supports a REST server for input and output.
2946 .. container:: paragraph
2948 The REST server plugin always uses a synchronous mode. A
2949 client does a HTTP GET on the APEX REST server with the
2950 input event and receives the generated output event in
2951 the server reply. This means that for the REST server
2952 there has to always to be an input with an associated
2953 output. Input or output only are not permitted.
2955 .. container:: paragraph
2957 The plugin will start a Grizzly server as REST server for
2958 a normal APEX engine. If the APEX engine is executed as a
2959 servlet, for instance inside Tomcat, then Tomcat will be
2960 used as REST server (this case requires configuration on
2963 .. container:: paragraph
2965 Some configuration restrictions apply for all scenarios:
2967 .. container:: ulist
2969 - Minimum port: 1024
2971 - Maximum port: 65535
2973 - The media type is ``application/json``, so this plugin
2974 only works with the JSON Event protocol.
2976 .. container:: paragraph
2978 The URL the client calls is created using
2980 .. container:: ulist
2982 - the configured host and port, e.g.
2983 ``http://localhost:12345``
2985 - the standard path, e.g. ``/apex/``
2987 - the name of the input/output, e.g. ``FirstConsumer/``
2989 - the input or output name, e.g. ``EventIn``.
2991 .. container:: paragraph
2993 The examples above lead to the URL
2994 ``http://localhost:12345/apex/FirstConsumer/EventIn``.
2996 .. container:: paragraph
2998 A client can also get status information of the REST
2999 server using ``/Status``, e.g.
3000 ``http://localhost:12345/apex/FirstConsumer/Status``.
3002 REST Server Stand-alone
3003 =======================
3005 .. container:: paragraph
3007 We need to configure a REST server input and a REST
3008 server output. Input and output are associated with
3009 each other via there name.
3011 .. container:: paragraph
3013 Timeouts for REST calls need to be set carefully. If
3014 they are too short, the call might timeout before a
3015 policy finished creating an event.
3017 .. container:: paragraph
3019 The following example configures the input named as
3020 ``MyConsumer`` and associates an output named
3021 ``MyProducer`` with it.
3023 .. container:: listingblock
3025 .. container:: content
3029 "eventInputParameters": {
3031 "carrierTechnologyParameters" : {
3032 "carrierTechnology" : "RESTSERVER", (1)
3033 "parameterClassName" :
3034 "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters",
3036 "standalone" : true, (2)
3037 "host" : "localhost", (3)
3041 "eventProtocolParameters":{
3042 "eventProtocol" : "JSON" (5)
3044 "synchronousMode" : true, (6)
3045 "synchronousPeer" : "MyProducer", (7)
3046 "synchronousTimeout" : 500 (8)
3050 .. container:: colist arabic
3052 +-------+---------------------------------------+
3053 | **1** | set REST server as carrier technology |
3054 +-------+---------------------------------------+
3055 | **2** | set the server as stand-alone |
3056 +-------+---------------------------------------+
3057 | **3** | set the server host |
3058 +-------+---------------------------------------+
3059 | **4** | set the server listen port |
3060 +-------+---------------------------------------+
3061 | **5** | use JSON event protocol |
3062 +-------+---------------------------------------+
3063 | **6** | activate synchronous mode |
3064 +-------+---------------------------------------+
3065 | **7** | associate an output ``MyProducer`` |
3066 +-------+---------------------------------------+
3067 | **8** | set a timeout of 500 milliseconds |
3068 +-------+---------------------------------------+
3070 .. container:: paragraph
3072 The following example configures the output named as
3073 ``MyProducer`` and associates the input ``MyConsumer``
3074 with it. Note that for the output there are no more
3075 paramters (such as host or port), since they are
3076 already configured in the associated input
3078 .. container:: listingblock
3080 .. container:: content
3084 "eventOutputParameters": {
3086 "carrierTechnologyParameters":{
3087 "carrierTechnology" : "RESTSERVER",
3088 "parameterClassName" :
3089 "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters"
3091 "eventProtocolParameters":{
3092 "eventProtocol" : "JSON"
3094 "synchronousMode" : true,
3095 "synchronousPeer" : "MyConsumer",
3096 "synchronousTimeout" : 500
3100 REST Server Stand-alone, multi input
3101 ====================================
3103 .. container:: paragraph
3105 Any number of input/output pairs for REST servers can
3106 be configured. For instance, we can configure an input
3107 ``FirstConsumer`` with output ``FirstProducer`` and an
3108 input ``SecondConsumer`` with output
3109 ``SecondProducer``. Important is that there is always
3110 one pair of input/output.
3112 REST Server Stand-alone in Servlet
3113 ==================================
3115 .. container:: paragraph
3117 If APEX is executed as a servlet, e.g. inside Tomcat,
3118 the configuration becomes easier since the plugin can
3119 now use Tomcat as the REST server. In this scenario,
3120 there are not parameters (port, host, etc.) and the
3121 key ``standalone`` must not be used (or set to false).
3123 .. container:: paragraph
3125 For the Tomcat configuration, we need to add the REST
3128 .. container:: listingblock
3130 .. container:: content
3138 <param-value>org.onap.policy.apex.plugins.event.carrier.restserver</param-value>
3146 .. container:: paragraph
3148 APEX can act as REST requestor on the input as well as on
3149 the output interface. The media type is
3150 ``application/json``, so this plugin only works with
3151 the JSON Event protocol.
3153 REST Requestor Input
3154 ====================
3156 .. container:: paragraph
3158 APEX will connect to a given URL to request an input.
3159 The URL can be configured statically or tagged
3160 as ``?example.{site}.org:8080/{trig}/events``,
3161 all tags such as ``site`` and ``trig`` in the URL
3162 need to be set in the properties object available to
3163 the tasks. In addition, the keys should exactly match
3164 with the tags defined in url. The scope of the properties
3165 object is per HTTP call. Hence, key/value pairs set
3166 in the properties object by task are only available
3167 for that specific HTTP call.
3168 The httpCodeFilter is used for filtering the status
3169 code, and it can be configured as a regular expression
3170 string. The default httpCodeFilter is "[2][0-9][0-9]"
3171 - for successful response codes.
3172 The response with HTTP status code that matches the
3173 given regular expression is forwarded to the task,
3174 otherwise it is logged as a failure.
3176 .. container:: listingblock
3178 .. container:: content
3182 "carrierTechnologyParameters": {
3183 "carrierTechnology": "RESTREQUESTOR", (1)
3184 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters",
3186 "url": "http://localhost:54321/some/path/to/rest/resource", (2)
3187 "url": "http://localhost:54321/{site}/path/to/rest/{resValue}", (2')
3188 "httpMethod": "POST", (3)
3189 "restRequestTimeout": 2000, (4)
3190 "httpCodeFilter" : "[2][0-9][0-9]" (5)
3194 .. container:: colist arabic
3196 +-------+--------------------------------------------------+
3197 | **1** | set REST requestor as carrier technology |
3198 +-------+--------------------------------------------------+
3199 | **2** | the static URL of the HTTP server for events |
3200 +-------+--------------------------------------------------+
3201 | **2'**| the tagged URL of the HTTP server for events |
3202 +-------+--------------------------------------------------+
3203 | **3** | use HTTP PUT (remove this line to use HTTP POST) |
3204 +-------+--------------------------------------------------+
3205 | **4** | request timeout in milliseconds |
3206 +-------+--------------------------------------------------+
3207 | **5** | use HTTP CODE FILTER for filtering status code |
3208 +-------+--------------------------------------------------+
3210 .. container:: paragraph
3212 Further settings are required on the consumer to
3213 define the event that is requested, for example:
3215 .. container:: listingblock
3217 .. container:: content
3221 "eventName": "GuardResponseEvent", (1)
3222 "eventNameFilter": "GuardResponseEvent", (2)
3223 "requestorMode": true, (3)
3224 "requestorPeer": "GuardRequestorProducer", (4)
3225 "requestorTimeout": 500 (5)
3227 .. container:: colist arabic
3229 +-------+---------------------------+
3230 | **1** | the event name |
3231 +-------+---------------------------+
3232 | **2** | a filter on the event |
3233 +-------+---------------------------+
3234 | **3** | the mode of the requestor |
3235 +-------+---------------------------+
3236 | **4** | a peer for the requestor |
3237 +-------+---------------------------+
3238 | **5** | a general request timeout |
3239 +-------+---------------------------+
3241 REST Requestor Output
3242 =====================
3244 .. container:: paragraph
3246 APEX will connect to a given URL to send events, but
3247 not receive any events.
3249 .. container:: listingblock
3251 .. container:: content
3255 "carrierTechnologyParameters": {
3256 "carrierTechnology": "RESTREQUESTOR", (1)
3257 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters"
3260 .. container:: colist arabic
3262 +-------+------------------------------------------+
3263 | **1** | set REST requestor as carrier technology |
3264 +-------+------------------------------------------+
3266 .. container:: paragraph
3268 Further settings are required on the consumer to
3269 define the event that is requested, for example:
3271 .. container:: listingblock
3273 .. container:: content
3277 "eventNameFilter": "GuardRequestEvent", (1)
3278 "requestorMode": true, (2)
3279 "requestorPeer": "GuardRequestorConsumer", (3)
3280 "requestorTimeout": 500 (4)
3282 .. container:: colist arabic
3284 +-------+---------------------------+
3285 | **1** | a filter on the event |
3286 +-------+---------------------------+
3287 | **2** | the mode of the requestor |
3288 +-------+---------------------------+
3289 | **3** | a peer for the requestor |
3290 +-------+---------------------------+
3291 | **4** | a general request timeout |
3292 +-------+---------------------------+
3297 .. container:: paragraph
3299 APEX can send requests over gRPC at the output side, and get back
3300 response at the input side. This can be used to send requests to CDS
3301 over gRPC. The media type is ``application/json``, so this plugin
3302 only works with the JSON Event protocol.
3307 .. container:: paragraph
3309 APEX will connect to a given host to send a request over
3312 .. container:: listingblock
3314 .. container:: content
3318 "carrierTechnologyParameters": {
3319 "carrierTechnology": "GRPC", (1)
3320 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
3322 "host": "cds-blueprints-processor-grpc", (2)
3324 "username": "ccsdkapps", (3)
3325 "password": ccsdkapps, (4)
3330 .. container:: colist arabic
3332 +-------+--------------------------------------------------+
3333 | **1** | set GRPC as carrier technology |
3334 +-------+--------------------------------------------------+
3335 | **2** | the host to which request is sent |
3336 +-------+--------------------------------------------------+
3337 | **2'**| the value for port |
3338 +-------+--------------------------------------------------+
3339 | **3** | username required to initiate connection |
3340 +-------+--------------------------------------------------+
3341 | **4** | password required to initiate connection |
3342 +-------+--------------------------------------------------+
3343 | **5** | the timeout value for completing the request |
3344 +-------+--------------------------------------------------+
3346 .. container:: paragraph
3348 Further settings are required on the producer to
3349 define the event that is requested, for example:
3351 .. container:: listingblock
3353 .. container:: content
3357 "eventName": "GRPCRequestEvent", (1)
3358 "eventNameFilter": "GRPCRequestEvent", (2)
3359 "requestorMode": true, (3)
3360 "requestorPeer": "GRPCRequestConsumer", (4)
3361 "requestorTimeout": 500 (5)
3363 .. container:: colist arabic
3365 +-------+---------------------------+
3366 | **1** | the event name |
3367 +-------+---------------------------+
3368 | **2** | a filter on the event |
3369 +-------+---------------------------+
3370 | **3** | the mode of the requestor |
3371 +-------+---------------------------+
3372 | **4** | a peer for the requestor |
3373 +-------+---------------------------+
3374 | **5** | a general request timeout |
3375 +-------+---------------------------+
3380 .. container:: paragraph
3382 APEX will connect to the host specified in the producer
3383 side, anad take in response back at the consumer side.
3385 .. container:: listingblock
3387 .. container:: content
3391 "carrierTechnologyParameters": {
3392 "carrierTechnology": "GRPC", (1)
3393 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
3396 .. container:: colist arabic
3398 +-------+------------------------------------------+
3399 | **1** | set GRPC as carrier technology |
3400 +-------+------------------------------------------+
3402 .. container:: paragraph
3404 Further settings are required on the consumer to
3405 define the event that is requested, for example:
3407 .. container:: listingblock
3409 .. container:: content
3413 "eventNameFilter": "GRPCResponseEvent", (1)
3414 "requestorMode": true, (2)
3415 "requestorPeer": "GRPCRequestProducer", (3)
3416 "requestorTimeout": 500 (4)
3418 .. container:: colist arabic
3420 +-------+---------------------------+
3421 | **1** | a filter on the event |
3422 +-------+---------------------------+
3423 | **2** | the mode of the requestor |
3424 +-------+---------------------------+
3425 | **3** | a peer for the requestor |
3426 +-------+---------------------------+
3427 | **4** | a general request timeout |
3428 +-------+---------------------------+
3430 Event Protocols, Format and Encoding
3431 ------------------------------------
3433 .. container:: paragraph
3435 Event protocols define what event formats APEX can receive
3436 (input) and should send (output). They can be used in any
3437 combination for input and output, unless further restricted
3438 by a carrier technology plugin (for instance for JMS
3439 output). There can only be 1 event protocol per event
3442 .. container:: paragraph
3444 Supported *input* event protocols are:
3446 .. container:: ulist
3448 - JSON, the event as a JSON string
3450 - APEX, an APEX event
3452 - JMS object, the event as a JMS object,
3454 - JMS text, the event as a JMS text,
3456 - XML, the event as an XML string,
3458 - YAML, the event as YAML text
3460 .. container:: paragraph
3462 Supported *output* event protocols are:
3464 .. container:: ulist
3466 - JSON, the event as a JSON string
3468 - APEX, an APEX event
3470 - JMS object, the event as a JMS object,
3472 - JMS text, the event as a JMS text,
3474 - XML, the event as an XML string,
3476 - YAML, the event as YAML text
3478 .. container:: paragraph
3480 New event protocols can be added as plugins to APEX or
3481 developed outside APEX and added to an APEX deployment.
3486 .. container:: paragraph
3488 The event protocol for JSON encoding does not require a
3489 specific plugin, it is supported by default. Furthermore,
3490 there is no difference in the configuration for the input
3491 and output interface.
3493 .. container:: paragraph
3495 For an input, APEX requires a well-formed JSON string.
3496 Well-formed here means according to the definitions of a
3497 policy. Any JSON string that is not defined as a trigger
3498 event (consume) will not be consumed (errors will be
3499 thrown). For output JSON events, APEX will always produce
3500 valid JSON strings according to the definition in the
3503 .. container:: paragraph
3505 The following JSON shows the configuration.
3507 .. container:: listingblock
3509 .. container:: content
3513 "eventProtocolParameters":{
3514 "eventProtocol" : "JSON"
3517 .. container:: paragraph
3519 For JSON events, there are a few more optional
3520 parameters, which allow to define a mapping for standard
3521 event fields. An APEX event must have the fields
3522 ``name``, ``version``, ``source``, and ``target``
3523 defined. Sometimes it is not possible to configure a
3524 trigger or actioning system to use those fields. However,
3525 they might be in an event generated outside APEX (or used
3526 outside APEX) just with different names. To configure
3527 APEX to map between the different event names, simply add
3528 the following parameters to a JSON event:
3530 .. container:: listingblock
3532 .. container:: content
3536 "eventProtocolParameters":{
3537 "eventProtocol" : "JSON",
3538 "nameAlias" : "policyName", (1)
3539 "versionAlias" : "policyVersion", (2)
3540 "sourceAlias" : "from", (3)
3541 "targetAlias" : "to", (4)
3542 "nameSpaceAlias": "my.name.space" (5)
3545 .. container:: colist arabic
3547 +-----------------------------------+-----------------------------------+
3548 | **1** | mapping for the ``name`` field, |
3549 | | here from a field called |
3550 | | ``policyName`` |
3551 +-----------------------------------+-----------------------------------+
3552 | **2** | mapping for the ``version`` |
3553 | | field, here from a field called |
3554 | | ``policyVersion`` |
3555 +-----------------------------------+-----------------------------------+
3556 | **3** | mapping for the ``source`` field, |
3557 | | here from a field called ``from`` |
3558 | | (only for an input event) |
3559 +-----------------------------------+-----------------------------------+
3560 | **4** | mapping for the ``target`` field, |
3561 | | here from a field called ``to`` |
3562 | | (only for an output event) |
3563 +-----------------------------------+-----------------------------------+
3564 | **5** | mapping for the ``nameSpace`` |
3565 | | field, here from a field called |
3566 | | ``my.name.space`` |
3567 +-----------------------------------+-----------------------------------+
3571 .. container:: paragraph
3573 The event protocol for APEX events does not require a
3574 specific plugin, it is supported by default. Furthermore,
3575 there is no difference in the configuration for the input
3576 and output interface.
3578 .. container:: paragraph
3580 For input and output APEX uses APEX events.
3582 .. container:: paragraph
3584 The following JSON shows the configuration.
3586 .. container:: listingblock
3588 .. container:: content
3592 "eventProtocolParameters":{
3593 "eventProtocol" : "APEX"
3599 .. container:: paragraph
3601 The event protocol for JMS is provided by the APEX JMS
3602 plugin. The plugin supports encoding as JSON text or as
3603 object. There is no difference in the configuration for
3604 the input and output interface.
3608 .. container:: paragraph
3610 If used as input, APEX will take a JMS message and
3611 extract a JSON string, then proceed as if a JSON event
3612 was received. If used as output, APEX will take the
3613 event produced by a policy, create a JSON string, and
3614 then wrap it into a JMS message.
3616 .. container:: paragraph
3618 The configuration for JMS text is as follows:
3620 .. container:: listingblock
3622 .. container:: content
3626 "eventProtocolParameters":{
3627 "eventProtocol" : "JMSTEXT",
3628 "parameterClassName" :
3629 "org.onap.policy.apex.plugins.event.protocol.jms.JMSTextEventProtocolParameters"
3634 .. container:: paragraph
3636 If used as input, APEX will will take a JMS message,
3637 extract a Java Bean from the ``ObjectMessage``
3638 message, construct an APEX event and put the bean on
3639 the APEX event as a parameter. If used as output, APEX
3640 will take the event produced by a policy, create a
3641 Java Bean and send it as a JMS message.
3643 .. container:: paragraph
3645 The configuration for JMS object is as follows:
3647 .. container:: listingblock
3649 .. container:: content
3653 "eventProtocolParameters":{
3654 "eventProtocol" : "JMSOBJECT",
3655 "parameterClassName" :
3656 "org.onap.policy.apex.plugins.event.protocol.jms.JMSObjectEventProtocolParameters"
3662 .. container:: paragraph
3664 The event protocol for YAML is provided by the APEX YAML
3665 plugin. There is no difference in the configuration for
3666 the input and output interface.
3668 .. container:: paragraph
3670 If used as input, APEX will consume events as YAML and
3671 map them to policy trigger events. Not well-formed YAML
3672 and not understood trigger events will be rejected. If
3673 used as output, APEX produce YAML encoded events from the
3674 event a policy produces. Those events will always be
3675 well-formed according to the definition in the policy
3678 .. container:: paragraph
3680 The following code shows the configuration.
3682 .. container:: listingblock
3684 .. container:: content
3688 "eventProtocolParameters":{
3689 "eventProtocol" : "XML",
3690 "parameterClassName" :
3691 "org.onap.policy.apex.plugins.event.protocol.yaml.YamlEventProtocolParameters"
3696 .. container:: paragraph
3698 The event protocol for XML is provided by the APEX XML
3699 plugin. There is no difference in the configuration for
3700 the input and output interface.
3702 .. container:: paragraph
3704 If used as input, APEX will consume events as XML and map
3705 them to policy trigger events. Not well-formed XML and
3706 not understood trigger events will be rejected. If used
3707 as output, APEX produce XML encoded events from the event
3708 a policy produces. Those events will always be
3709 well-formed according to the definition in the policy
3712 .. container:: paragraph
3714 The following code shows the configuration.
3716 .. container:: listingblock
3718 .. container:: content
3722 "eventProtocolParameters":{
3723 "eventProtocol" : "XML",
3724 "parameterClassName" :
3725 "org.onap.policy.apex.plugins.event.protocol.xml.XMLEventProtocolParameters"
3728 A configuration example
3729 -----------------------
3731 .. container:: paragraph
3733 The following example loads all available plug-ins.
3735 .. container:: paragraph
3737 Events are consumed from a Websocket, APEX as client.
3738 Consumed event format is JSON.
3740 .. container:: paragraph
3742 Events are produced to Kafka. Produced event format is XML.
3744 .. container:: listingblock
3746 .. container:: content
3751 "engineServiceParameters" : {
3752 "name" : "MyApexEngine",
3753 "version" : "0.0.1",
3755 "instanceCount" : 4,
3756 "deploymentPort" : 12345,
3757 "policyModelFileName" : "examples/models/some-model.json",
3758 "engineParameters" : {
3759 "executorParameters" : {
3761 "parameterClassName" :
3762 "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
3765 "parameterClassName" :
3766 "org.onap.policy.apex.plugins.executor.jython.JythonExecutorParameters"
3769 "parameterClassName" :
3770 "org.onap.policy.apex.plugins.executor.jruby.JrubyExecutorParameters"
3773 "parameterClassName" :
3774 "org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters"
3777 "parameterClassName" :
3778 "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters"
3781 "contextParameters" : {
3782 "parameterClassName" :
3783 "org.onap.policy.apex.context.parameters.ContextParameters",
3784 "schemaParameters" : {
3786 "parameterClassName" :
3787 "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
3793 "producerCarrierTechnologyParameters" : {
3794 "carrierTechnology" : "KAFKA",
3795 "parameterClassName" :
3796 "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
3798 "bootstrapServers" : "localhost:49092",
3801 "batchSize" : 16384,
3803 "bufferMemory" : 33554432,
3804 "producerTopic" : "apex-out",
3805 "keySerializer" : "org.apache.kafka.common.serialization.StringSerializer",
3806 "valueSerializer" : "org.apache.kafka.common.serialization.StringSerializer"
3809 "producerEventProtocolParameters" : {
3810 "eventProtocol" : "XML",
3811 "parameterClassName" :
3812 "org.onap.policy.apex.plugins.event.protocol.xml.XMLEventProtocolParameters"
3814 "consumerCarrierTechnologyParameters" : {
3815 "carrierTechnology" : "WEBSOCKET",
3816 "parameterClassName" :
3817 "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
3819 "host" : "localhost",
3823 "consumerEventProtocolParameters" : {
3824 "eventProtocol" : "JSON"
3828 Engine and Applications of the APEX System
3829 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3831 Introduction to APEX Engine and Applications
3832 --------------------------------------------
3834 .. container:: paragraph
3836 The core of APEX is the APEX Engine, also known as the APEX
3837 Policy Engine or the APEX PDP (since it is in fact a Policy
3838 Decision Point). Beside this engine, an APEX system comes
3839 with a few applications intended to help with policy
3840 authoring, deployment, and execution.
3842 .. container:: paragraph
3844 The engine itself and most applications are started from the
3845 command line with command line arguments. This is called a
3846 Command Line Interface (CLI). Some applications require an
3847 installation on a webserver, as for instance the REST
3848 Editor. Those applications can be accessed via a web
3851 .. container:: paragraph
3853 You can also use the available APEX APIs and applications to
3854 develop other applications as required. This includes policy
3855 languages (and associated parsers and compilers /
3856 interpreters), GUIs to access APEX or to define policies,
3857 clients to connect to APEX, etc.
3859 .. container:: paragraph
3861 For this documentation, we assume an installation of APEX as
3862 a full system based on a current ONAP release.
3864 CLI on Unix, Windows, and Cygwin
3865 --------------------------------
3867 .. container:: paragraph
3869 A note on APEX CLI applications: all applications and the
3870 engine itself have been deployed and tested on different
3871 operating systems: Red Hat, Ubuntu, Debian, Mac OSX,
3872 Windows, Cygwin. Each operating system comes with its own
3873 way of configuring and executing Java. The main items here
3876 .. container:: ulist
3878 - For UNIX systems (RHL, Ubuntu, Debian, Mac OSX), the
3879 provided bash scripts work as expected with absolute
3881 ``/opt/app/policy/apex-pdp/apex-pdp-2.0.0-SNAPSHOT/examples``),
3882 indirect and linked paths (e.g. ``../apex/apex``), and
3883 path substitutions using environment settings (e.g.
3884 ``$APEX_HOME/bin/``)
3886 - For Windows systems, the provided batch files (``.bat``)
3887 work as expected with with absolute paths (e.g.
3888 ``C:\apex\apex-2.0.0-SNAPSHOT\examples``), and path
3889 substitutions using environment settings (e.g.
3890 ``%APEX_HOME%\bin\``)
3892 - For Cygwin system we assume a standard Cygwin
3893 installation with standard tools (mainly bash) using a
3894 Windows Java installation. This means that the bash
3895 scripts can be used as in UNIX, however any argument
3896 pointing to files and directories need to use either a
3898 ``C:\apex\apex-2.0.0-SNAPSHOT\examples\config...``) or
3899 the command ``cygpath`` with a mixed option. The reason
3900 for that is: Cygwin executes Java using UNIX paths but
3901 then runs Java as a DOS/WINDOWS process, which requires
3902 DOS paths for file access.
3907 .. container:: paragraph
3909 The APEX engine can be started in different ways, depending
3910 your requirements. All scripts are located in the APEX *bin*
3913 .. container:: paragraph
3915 On UNIX and Cygwin systems use:
3917 .. container:: ulist
3919 - ``apexEngine.sh`` - this script will
3921 .. container:: ulist
3923 - Test if ``$APEX_USER`` is set and if the user
3924 exists, terminate with an error otherwise
3926 - Test if ``$APEX_HOME`` is set. If not set, it will
3927 use the default setting as
3928 ``/opt/app/policy/apex-pdp/apex-pdp``. Then the set
3929 directory is tested to exist, the script will
3932 - When all tests are passed successfully, the script
3933 will call ``apexApps.sh`` with arguments to start
3936 - ``apexApps.sh engine`` - this is the general APEX
3937 application launcher, which will
3939 .. container:: ulist
3941 - Start the engine with the argument ``engine``
3943 - Test if ``$APEX_HOME`` is set and points to an
3944 existing directory. If not set or directory does
3945 not exist, script terminates.
3947 - Not test for any settings of ``$APEX_USER``.
3949 .. container:: paragraph
3951 On Windows systems use ``apexEngine.bat`` and
3952 ``apexApps.bat engine`` respectively. Note: none of the
3953 windows batch files will test for ``%APEX_USER%``.
3955 .. container:: paragraph
3957 Summary of alternatives to start the APEX Engine:
3959 +--------------------------------------------------------+----------------------------------------------------------+
3960 | Unix, Cygwin | Windows |
3961 +========================================================+==========================================================+
3962 | .. container:: | .. container:: |
3964 | .. container:: listingblock | .. container:: listingblock |
3966 | .. container:: content | .. container:: content |
3968 | .. code:: | .. code:: |
3970 | # $APEX_HOME/bin/apexEngine.sh [args] | > %APEX_HOME%\bin\apexEngine.bat [args] |
3971 | # $APEX_HOME/bin/apexApps.sh engine [args] | > %APEX_HOME%\bin\apexApps.bat engine [args] |
3972 +--------------------------------------------------------+----------------------------------------------------------+
3974 .. container:: paragraph
3976 The APEX engine comes with a few CLI arguments for setting
3977 configuration and policy model. The configuration file is
3978 always required. The policy model file is only required if
3979 no model file is specified in the configuration, or if the
3980 specified model file should be over written. The option
3981 ``-h`` prints a help screen.
3983 .. container:: listingblock
3985 .. container:: content
3989 usage: org.onap.policy.apex.service.engine.main.ApexMain [options...]
3991 -c,--config-file <CONFIG_FILE> the full path to the configuration file to use, the configuration file must be a Json file
3992 containing the Apex configuration parameters
3993 -h,--help outputs the usage of this command
3994 -m,--model-file <MODEL_FILE> the full path to the model file to use, if set it overrides the model file set in the
3996 -v,--version outputs the version of Apex
4001 .. container:: paragraph
4003 The CLI Editor allows to define policies from the command
4004 line. The application uses a simple language and supports
4005 all elements of an APEX policy. It can be used in to
4008 .. container:: ulist
4010 - non-interactive, specifying a file with the commands to
4013 - interactive, using the editors CLI to create a policy
4015 .. container:: paragraph
4017 When a policy is fully specified, the editor will generate
4018 the APEX core policy specification in JSON. This core
4019 specification is called the policy model in the APEX engine
4020 and can be used directly with the APEX engine.
4022 .. container:: paragraph
4024 On UNIX and Cygwin systems use:
4026 .. container:: ulist
4028 - ``apexCLIEditor.sh`` - simply starts the CLI editor,
4029 arguments to the script determine the mode of the editor
4031 - ``apexApps.sh cli-editor`` - simply starts the CLI
4032 editor, arguments to the script determine the mode of the
4035 .. container:: paragraph
4037 On Windows systems use:
4039 .. container:: ulist
4041 - ``apexCLIEditor.bat`` - simply starts the CLI editor,
4042 arguments to the script determine the mode of the editor
4044 - ``apexApps.bat cli-editor`` - simply starts the CLI
4045 editor, arguments to the script determine the mode of the
4048 .. container:: paragraph
4050 Summary of alternatives to start the APEX CLI Editor:
4052 +------------------------------------------------------------+--------------------------------------------------------------+
4053 | Unix, Cygwin | Windows |
4054 +============================================================+==============================================================+
4055 | .. container:: | .. container:: |
4057 | .. container:: listingblock | .. container:: listingblock |
4059 | .. container:: content | .. container:: content |
4061 | .. code:: | .. code:: |
4063 | # $APEX_HOME/bin/apexCLIEditor.sh.sh [args] | > %APEX_HOME%\bin\apexCLIEditor.bat [args] |
4064 | # $APEX_HOME/bin/apexApps.sh cli-editor [args] | > %APEX_HOME%\bin\apexApps.bat cli-editor [args] |
4065 +------------------------------------------------------------+--------------------------------------------------------------+
4067 .. container:: paragraph
4069 The option ``-h`` provides a help screen with all command
4072 .. container:: listingblock
4074 .. container:: content
4078 usage: org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain [options...]
4080 -a,--model-props-file <MODEL_PROPS_FILE> name of the apex model properties file to use
4081 -c,--command-file <COMMAND_FILE> name of a file containing editor commands to run into the editor
4082 -h,--help outputs the usage of this command
4083 -i,--input-model-file <INPUT_MODEL_FILE> name of a file that contains an input model for the editor
4084 -if,--ignore-failures <IGNORE_FAILURES_FLAG> true or false, ignore failures of commands in command files and continue
4085 executing the command file
4086 -l,--log-file <LOG_FILE> name of a file that will contain command logs from the editor, will log
4087 to standard output if not specified or suppressed with "-nl" flag
4088 -m,--metadata-file <CMD_METADATA_FILE> name of the command metadata file to use
4089 -nl,--no-log if specified, no logging or output of commands to standard output or log
4091 -nm,--no-model-output if specified, no output of a model to standard output or model output
4092 file is carried out, the user can use the "save" command in a script to
4094 -o,--output-model-file <OUTPUT_MODEL_FILE> name of a file that will contain the output model for the editor, will
4095 output model to standard output if not specified or suppressed with
4097 -wd,--working-directory <WORKING_DIRECTORY> the working directory that is the root for the CLI editor and is the
4098 root from which to look for included macro files
4100 The APEX CLI Tosca Editor
4101 -------------------------
4103 .. container:: paragraph
4105 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.
4107 .. container:: paragraph
4109 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.
4111 .. container:: paragraph
4113 On UNIX and Cygwin systems use:
4115 .. container:: ulist
4117 - ``apexCLIToscaEditor.sh`` - starts the CLI Tosca editor,
4118 all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4120 - ``apexApps.sh cli-tosca-editor`` - starts the CLI Tosca editor,
4121 all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4123 .. container:: paragraph
4125 On Windows systems use:
4127 .. container:: ulist
4129 - ``apexCLIToscaEditor.bat`` - starts the CLI Tosca editor,
4130 all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4132 - ``apexApps.bat cli-tosca-editor`` - starts the CLI Tosca
4133 editor, all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4135 .. container:: paragraph
4137 Summary of alternatives to start the APEX CLI Tosca Editor:
4139 +-----------------------------------------------------------------+--------------------------------------------------------------------+
4140 | Unix, Cygwin | Windows |
4141 +=================================================================+====================================================================+
4142 | .. container:: | .. container:: |
4144 | .. container:: listingblock | .. container:: listingblock |
4146 | .. container:: content | .. container:: content |
4148 | .. code:: | .. code:: |
4150 | # $APEX_HOME/bin/apexCLIToscaEditor.sh.sh [args] | > %APEX_HOME%\bin\apexCLIToscaEditor.bat [args] |
4151 | # $APEX_HOME/bin/apexApps.sh cli-tosca-editor [args]| > %APEX_HOME%\bin\apexApps.bat cli-tosca-editor [args] |
4152 +-----------------------------------------------------------------+--------------------------------------------------------------------+
4154 .. container:: paragraph
4156 The option ``-h`` provides a help screen with all command
4159 .. container:: listingblock
4161 .. container:: content
4165 usage: org.onap.policy.apex.auth.clieditor.tosca.ApexCliToscaEditorMain [options...]
4167 -a,--model-props-file <MODEL_PROPS_FILE> name of the apex model properties file to use
4168 -ac,--apex-config-file <APEX_CONFIG_FILE> name of the file containing apex configuration details
4169 -c,--command-file <COMMAND_FILE> name of a file containing editor commands to run into the editor
4170 -h,--help outputs the usage of this command
4171 -i,--input-model-file <INPUT_MODEL_FILE> name of a file that contains an input model for the editor
4172 -if,--ignore-failures <IGNORE_FAILURES_FLAG> true or false, ignore failures of commands in command files and
4173 continue executing the command file
4174 -l,--log-file <LOG_FILE> name of a file that will contain command logs from the editor, will
4175 log to standard output if not specified or suppressed with "-nl" flag
4176 -m,--metadata-file <CMD_METADATA_FILE> name of the command metadata file to use
4177 -nl,--no-log if specified, no logging or output of commands to standard output or
4178 log file is carried out
4179 -ot,--output-tosca-file <OUTPUT_TOSCA_FILE> name of a file that will contain the output ToscaServiceTemplate
4180 -t,--tosca-template-file <TOSCA_TEMPLATE_FILE> name of the input file containing tosca template which needs to be
4182 -wd,--working-directory <WORKING_DIRECTORY> the working directory that is the root for the CLI editor and is the
4183 root from which to look for included macro files
4185 .. container:: paragraph
4187 An example command to run the APEX CLI Tosca editor on windows machine is given below.
4189 .. container:: listingblock
4191 .. container:: content
4195 %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
4197 The APEX REST Editor
4198 --------------------
4200 .. container:: paragraph
4202 The standard way to use the APEX REST Editor is via an
4203 installation of the *war* file on a webserver. However, the
4204 REST editor can also be started via command line. This will
4205 start a Grizzly webserver with the *war* deployed. Access to
4206 the REST Editor is then via the provided URL
4208 .. container:: paragraph
4210 On UNIX and Cygwin systems use:
4212 .. container:: ulist
4214 - ``apexRESTEditor.sh`` - simply starts the webserver with
4217 - ``apexApps.sh rest-editor`` - simply starts the webserver
4218 with the REST editor
4220 .. container:: paragraph
4222 On Windows systems use:
4224 .. container:: ulist
4226 - ``apexRESTEditor.bat`` - simply starts the webserver with
4229 - ``apexApps.bat rest-editor`` - simply starts the
4230 webserver with the REST editor
4232 .. container:: paragraph
4234 Summary of alternatives to start the APEX REST Editor:
4236 +-------------------------------------------------------------+---------------------------------------------------------------+
4237 | Unix, Cygwin | Windows |
4238 +=============================================================+===============================================================+
4239 | .. container:: | .. container:: |
4241 | .. container:: listingblock | .. container:: listingblock |
4243 | .. container:: content | .. container:: content |
4245 | .. code:: | .. code:: |
4247 | # $APEX_HOME/bin/apexRESTEditor.sh.sh [args] | > %APEX_HOME%\bin\apexRESTEditor.bat [args] |
4248 | # $APEX_HOME/bin/apexApps.sh rest-editor [args] | > %APEX_HOME%\bin\apexApps.bat rest-editor [args] |
4249 +-------------------------------------------------------------+---------------------------------------------------------------+
4251 .. container:: paragraph
4253 The option ``-h`` provides a help screen with all command
4256 .. container:: listingblock
4258 .. container:: content
4262 usage: org.onap.policy.apex.client.editor.rest.ApexEditorMain [options...]
4263 -h,--help outputs the usage of this command
4264 -l,--listen <ADDRESS> the IP address to listen on. Default value is localhost to restrict access to the
4266 -p,--port <PORT> port to use for the Apex RESTful editor REST calls.
4267 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating. Default
4268 value is -1 to run indefinitely.
4270 .. container:: paragraph
4272 If the REST Editor is started without any arguments the
4273 final messages will look similar to this:
4275 .. container:: listingblock
4277 .. container:: content
4281 Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4282 Sep 05, 2018 11:24:30 PM org.glassfish.grizzly.http.server.NetworkListener start
4283 INFO: Started listener bound to [localhost:18989]
4284 Sep 05, 2018 11:24:30 PM org.glassfish.grizzly.http.server.HttpServer start
4285 INFO: [HttpServer] Started.
4286 Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4288 .. container:: paragraph
4290 The last line states the URL on which the REST Editor can be
4291 accessed. The example above stated
4292 ``http://0.0.0.0:18989/apex/``. In a web browser use the URL
4293 ``http://localhost:18989`` and the REST Editor will start.
4295 The APEX Monitoring Client
4296 --------------------------
4298 .. container:: paragraph
4300 The standard way to use the APEX Monitoring Client is via an
4301 installation of the *war* file on a webserver. However, the
4302 Monitoring Client can also be started via command line. This
4303 will start a Grizzly webserver with the *war* deployed.
4304 Access to the Monitoring Client is then via the provided URL
4306 .. container:: paragraph
4308 On UNIX and Cygwin systems use:
4310 .. container:: ulist
4312 - ``apexApps.sh eng-monitoring`` - simply starts the
4313 webserver with the Monitoring Client
4315 .. container:: paragraph
4317 On Windows systems use:
4319 .. container:: ulist
4321 - ``apexApps.bat eng-monitoring`` - simply starts the
4322 webserver with the Monitoring Client
4324 .. container:: paragraph
4326 The option ``-h`` provides a help screen with all command
4329 .. container:: listingblock
4331 .. container:: content
4335 usage: org.onap.policy.apex.client.monitoring.rest.ApexMonitoringRestMain [options...]
4336 -h,--help outputs the usage of this command
4337 -p,--port <PORT> port to use for the Apex Services REST calls
4338 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating
4340 .. container:: paragraph
4342 If the Monitoring Client is started without any arguments
4343 the final messages will look similar to this:
4345 .. container:: listingblock
4347 .. container:: content
4351 Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4352 Sep 05, 2018 11:26:20 PM org.glassfish.grizzly.http.server.NetworkListener start
4353 INFO: Started listener bound to [localhost:18989]
4354 Sep 05, 2018 11:26:20 PM org.glassfish.grizzly.http.server.HttpServer start
4355 INFO: [HttpServer] Started.
4356 Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4358 .. container:: paragraph
4360 The last line states the URL on which the Monitoring Client
4361 can be accessed. The example above stated
4362 ``http://localhost:18989/apexservices``. In a web browser
4363 use the URL ``http://localhost:18989``.
4365 The APEX Deployment Client
4366 --------------------------
4368 .. container:: paragraph
4370 The standard way to use the APEX Deployment Client is via an
4371 installation of the *war* file on a webserver. However, the
4372 Deployment Client can also be started via command line. This
4373 will start a Grizzly webserver with the *war* deployed.
4374 Access to the Deployment Client is then via the provided URL
4376 .. container:: paragraph
4378 On UNIX and Cygwin systems use:
4380 .. container:: ulist
4382 - ``apexApps.sh eng-deployment`` - simply starts the
4383 webserver with the Deployment Client
4385 .. container:: paragraph
4387 On Windows systems use:
4389 .. container:: ulist
4391 - ``apexApps.bat eng-deployment`` - simply starts the
4392 webserver with the Deployment Client
4394 .. container:: paragraph
4396 The option ``-h`` provides a help screen with all command
4399 .. container:: listingblock
4401 .. container:: content
4405 usage: org.onap.policy.apex.client.deployment.rest.ApexDeploymentRestMain [options...]
4406 -h,--help outputs the usage of this command
4407 -p,--port <PORT> port to use for the Apex Services REST calls
4408 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating
4410 .. container:: paragraph
4412 If the Deployment Client is started without any arguments
4413 the final messages will look similar to this:
4415 .. container:: listingblock
4417 .. container:: content
4421 Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4422 Sep 05, 2018 11:27:09 PM org.glassfish.grizzly.http.server.NetworkListener start
4423 INFO: Started listener bound to [localhost:18989]
4424 Sep 05, 2018 11:27:09 PM org.glassfish.grizzly.http.server.HttpServer start
4425 INFO: [HttpServer] Started.
4426 Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4428 .. container:: paragraph
4430 The last line states the URL on which the Deployment Client
4431 can be accessed. The example above stated
4432 ``http://localhost:18989/apexservices``. In a web browser
4433 use the URL ``http://localhost:18989``.
4435 The APEX Full Client
4436 --------------------
4438 .. container:: paragraph
4440 The APEX Full Client combines the REST Editor, the
4441 Monitoring Client, and the Deployment Client into a single
4442 application. The standard way to use the APEX Full Client is
4443 via an installation of the *war* file on a webserver.
4444 However, the Full Client can also be started via command
4445 line. This will start a Grizzly webserver with the *war*
4446 deployed. Access to the Full Client is then via the provided
4449 .. container:: paragraph
4451 On UNIX and Cygwin systems use:
4453 .. container:: ulist
4455 - ``apexApps.sh full-client`` - simply starts the webserver
4456 with the Full Client
4458 .. container:: paragraph
4460 On Windows systems use:
4462 .. container:: ulist
4464 - ``apexApps.bat full-client`` - simply starts the
4465 webserver with the Full Client
4467 .. container:: paragraph
4469 The option ``-h`` provides a help screen with all command
4472 .. container:: listingblock
4474 .. container:: content
4478 usage: org.onap.policy.apex.client.full.rest.ApexServicesRestMain [options...]
4479 -h,--help outputs the usage of this command
4480 -p,--port <PORT> port to use for the Apex Services REST calls
4481 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating
4483 .. container:: paragraph
4485 If the Full Client is started without any arguments the
4486 final messages will look similar to this:
4488 .. container:: listingblock
4490 .. container:: content
4494 Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4495 Sep 05, 2018 11:28:28 PM org.glassfish.grizzly.http.server.NetworkListener start
4496 INFO: Started listener bound to [localhost:18989]
4497 Sep 05, 2018 11:28:28 PM org.glassfish.grizzly.http.server.HttpServer start
4498 INFO: [HttpServer] Started.
4499 Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4501 .. container:: paragraph
4503 The last line states the URL on which the Monitoring Client
4504 can be accessed. The example above stated
4505 ``http://localhost:18989/apexservices``. In a web browser
4506 use the URL ``http://localhost:18989``.
4508 The APEX Application Launcher
4509 -----------------------------
4511 .. container:: paragraph
4513 The standard applications (Engine, CLI Editor, REST Editor)
4514 come with dedicated start scripts. For all other APEX
4515 applications, we provide an application launcher.
4517 .. container:: paragraph
4519 On UNIX and Cygwin systems use:
4521 .. container:: ulist
4523 - apexApps.sh\` - simply starts the application launcher
4525 .. container:: paragraph
4527 On Windows systems use:
4529 .. container:: ulist
4531 - ``apexApps.bat`` - simply starts the application launcher
4533 .. container:: paragraph
4535 Summary of alternatives to start the APEX application
4538 +-------------------------------------------------+---------------------------------------------------+
4539 | Unix, Cygwin | Windows |
4540 +=================================================+===================================================+
4541 | .. container:: | .. container:: |
4543 | .. container:: listingblock | .. container:: listingblock |
4545 | .. container:: content | .. container:: content |
4547 | .. code:: | .. code:: |
4549 | # $APEX_HOME/bin/apexApps.sh [args] | > %APEX_HOME%\bin\apexApps.bat [args] |
4550 +-------------------------------------------------+---------------------------------------------------+
4552 .. container:: paragraph
4554 The option ``-h`` provides a help screen with all launcher
4555 command line arguments.
4557 .. container:: listingblock
4559 .. container:: content
4563 apexApps.sh - runs APEX applications
4565 Usage: apexApps.sh [options] | [<application> [<application options>]]
4568 -d <app> - describes an application
4569 -l - lists all applications supported by this script
4570 -h - this help screen
4572 .. container:: paragraph
4574 Using ``-l`` lists all known application the launcher can
4577 .. container:: listingblock
4579 .. container:: content
4583 apexApps.sh: supported applications:
4584 --> ws-echo engine eng-monitoring full-client eng-deployment tpl-event-json model-2-cli rest-editor cli-editor ws-console
4586 .. container:: paragraph
4588 Using the ``-d <name>`` option describes the named
4589 application, for instance for the ``ws-console``:
4591 .. container:: listingblock
4593 .. container:: content
4597 apexApps.sh: application 'ws-console'
4598 --> a simple console sending events to APEX, connect to APEX consumer port
4600 .. container:: paragraph
4602 Launching an application is done by calling the script with
4603 only the application name and any CLI arguments for the
4604 application. For instance, starting the ``ws-echo``
4605 application with port ``8888``:
4607 .. container:: listingblock
4609 .. container:: content
4613 apexApps.sh ws-echo -p 8888
4615 Application: Create Event Templates
4616 -----------------------------------
4618 .. container:: paragraph
4620 **Status: Experimental**
4622 .. container:: paragraph
4624 This application takes a policy model (JSON or XML encoded)
4625 and generates templates for events in JSON format. This can
4626 help when a policy defines rather complex trigger or action
4627 events or complex events between states. The application can
4628 produce events for the types: stimuli (policy trigger
4629 events), internal (events between policy states), and
4630 response (action events).
4632 +----------------------------------------------------------------+------------------------------------------------------------------+
4633 | Unix, Cygwin | Windows |
4634 +================================================================+==================================================================+
4635 | .. container:: | .. container:: |
4637 | .. container:: listingblock | .. container:: listingblock |
4639 | .. container:: content | .. container:: content |
4641 | .. code:: | .. code:: |
4643 | # $APEX_HOME/bin/apexApps.sh tpl-event-json [args] | > %APEX_HOME%\bin\apexApps.bat tpl-event-json [args] |
4644 +----------------------------------------------------------------+------------------------------------------------------------------+
4646 .. container:: paragraph
4648 The option ``-h`` provides a help screen.
4650 .. container:: listingblock
4652 .. container:: content
4656 gen-model2event v{release-version} - generates JSON templates for events generated from a policy model
4657 usage: gen-model2event
4658 -h,--help prints this help and usage screen
4659 -m,--model <MODEL-FILE> set the input policy model file
4660 -t,--type <TYPE> set the event type for generation, one of:
4661 stimuli (trigger events), response (action
4662 events), internal (events between states)
4663 -v,--version prints the application version
4665 .. container:: paragraph
4667 The created templates are not valid events, instead they use
4668 some markup for values one will need to change to actual
4669 values. For instance, running the tool with the *Sample
4670 Domain* policy model as:
4672 .. container:: listingblock
4674 .. container:: content
4678 apexApps.sh tpl-event-json -m $APEX_HOME/examples/models/SampleDomain/SamplePolicyModelJAVA.json -t stimuli
4680 .. container:: paragraph
4682 will produce the following status messages:
4684 .. container:: listingblock
4686 .. container:: content
4690 gen-model2event: starting Event generator
4691 --> model file: examples/models/SampleDomain/SamplePolicyModelJAVA.json
4694 .. container:: paragraph
4696 and then run the generator application producing two event
4697 templates. The first template is called ``Event0000``.
4699 .. container:: listingblock
4701 .. container:: content
4706 "name" : "Event0000",
4707 "nameSpace" : "org.onap.policy.apex.sample.events",
4708 "version" : "0.0.1",
4709 "source" : "Outside",
4711 "TestTemperature" : ###double: 0.0###,
4712 "TestTimestamp" : ###long: 0###,
4713 "TestMatchCase" : ###integer: 0###,
4714 "TestSlogan" : "###string###"
4717 .. container:: paragraph
4719 The values for the keys are marked with ``#`` and the
4720 expected type of the value. To create an actual stimuli
4721 event, all these markers need to be change to actual values,
4724 .. container:: listingblock
4726 .. container:: content
4731 "name" : "Event0000",
4732 "nameSpace" : "org.onap.policy.apex.sample.events",
4733 "version" : "0.0.1",
4734 "source" : "Outside",
4736 "TestTemperature" : 25,
4737 "TestTimestamp" : 123456789123456789,
4738 "TestMatchCase" : 1,
4739 "TestSlogan" : "Testing the Match Case with Temperature 25"
4742 Application: Convert a Policy Model to CLI Editor Commands
4743 ----------------------------------------------------------
4745 .. container:: paragraph
4747 **Status: Experimental**
4749 .. container:: paragraph
4751 This application takes a policy model (JSON or XML encoded)
4752 and generates commands for the APEX CLI Editor. This
4753 effectively reverses a policy specification realized with
4756 +-------------------------------------------------------------+---------------------------------------------------------------+
4757 | Unix, Cygwin | Windows |
4758 +=============================================================+===============================================================+
4759 | .. container:: | .. container:: |
4761 | .. container:: listingblock | .. container:: listingblock |
4763 | .. container:: content | .. container:: content |
4765 | .. code:: | .. code:: |
4767 | # $APEX_HOME/bin/apexApps.sh model-2-cli [args] | > %APEX_HOME%\bin\apexApps.bat model-2-cli [args] |
4768 +-------------------------------------------------------------+---------------------------------------------------------------+
4770 .. container:: paragraph
4772 The option ``-h`` provides a help screen.
4774 .. container:: listingblock
4776 .. container:: content
4780 usage: gen-model2cli
4781 -h,--help prints this help and usage screen
4782 -m,--model <MODEL-FILE> set the input policy model file
4783 -sv,--skip-validation switch of validation of the input file
4784 -v,--version prints the application version
4786 .. container:: paragraph
4788 For instance, running the tool with the *Sample Domain*
4791 .. container:: listingblock
4793 .. container:: content
4797 apexApps.sh model-2-cli -m $APEX_HOME/examples/models/SampleDomain/SamplePolicyModelJAVA.json
4799 .. container:: paragraph
4801 will produce the following status messages:
4803 .. container:: listingblock
4805 .. container:: content
4809 gen-model2cli: starting CLI generator
4810 --> model file: examples/models/SampleDomain/SamplePolicyModelJAVA.json
4812 .. container:: paragraph
4814 and then run the generator application producing all CLI
4815 Editor commands and printing them to standard out.
4817 Application: Websocket Clients (Echo and Console)
4818 -------------------------------------------------
4820 .. container:: paragraph
4822 **Status: Production**
4824 .. container:: paragraph
4826 The application launcher also provides a Websocket echo
4827 client and a Websocket console client. The echo client
4828 connects to APEX and prints all events it receives from
4829 APEX. The console client connects to APEX, reads input from
4830 the command line, and sends this input as events to APEX.
4832 +------------------------------------------------------------+--------------------------------------------------------------+
4833 | Unix, Cygwin | Windows |
4834 +============================================================+==============================================================+
4835 | .. container:: | .. container:: |
4837 | .. container:: listingblock | .. container:: listingblock |
4839 | .. container:: content | .. container:: content |
4841 | .. code:: | .. code:: |
4843 | # $APEX_HOME/bin/apexApps.sh ws-echo [args] | > %APEX_HOME%\bin\apexApps.bat ws-echo [args] |
4844 | # $APEX_HOME/bin/apexApps.sh ws-console [args] | > %APEX_HOME%\bin\apexApps.bat ws-console [args] |
4845 +------------------------------------------------------------+--------------------------------------------------------------+
4847 .. container:: paragraph
4849 The arguments are the same for both applications:
4851 .. container:: ulist
4853 - ``-p`` defines the Websocket port to connect to (defaults
4856 - ``-s`` defines the host on which a Websocket server is
4857 running (defaults to ``localhost``)
4859 .. container:: paragraph
4861 A discussion on how to use these two applications to build
4862 an APEX system is detailed HowTo-Websockets.
4867 Introduction to APEX Logging
4868 ----------------------------
4870 .. container:: paragraph
4872 All APEX components make extensive use of logging using the
4873 logging façade `SLF4J <https://www.slf4j.org/>`__ with the
4874 backend `Logback <https://logback.qos.ch/>`__. Both are used
4875 off-the-shelve, so the standard documentation and
4876 configuration apply to APEX logging. For details on how to
4877 work with logback please see the `logback
4878 manual <https://logback.qos.ch/manual/index.html>`__.
4880 .. container:: paragraph
4882 The APEX applications is the logback configuration file
4883 ``$APEX_HOME/etc/logback.xml`` (Windows:
4884 ``%APEX_HOME%\etc\logback.xml``). The logging backend is set
4885 to no debug, i.e. logs from the logging framework should be
4888 .. container:: paragraph
4890 The configurable log levels work as expected:
4892 .. container:: ulist
4894 - *error* (or *ERROR*) is used for serious errors in the
4897 - *warn* (or *WARN*) is used for warnings, which in general
4898 can be ignored but might indicate some deeper problems
4900 - *info* (or *INFO*) is used to provide generally
4901 interesting messages for startup and policy execution
4903 - *debug* (or *DEBUG*) provides more details on startup and
4906 - *trace* (or *TRACE*) gives full details on every aspect
4907 of the APEX engine from start to end
4909 .. container:: paragraph
4911 The loggers can also be configured as expected. The standard
4912 configuration (after installing APEX) uses log level *info*
4913 on all APEX classes (components).
4915 .. container:: paragraph
4917 The applications and scripts in ``$APEX_HOME/bin`` (Windows:
4918 ``%APEX_HOME\bin``) are configured to use the logback
4919 configuration ``$APEX_HOME/etc/logback.xml`` (Windows:
4920 ``%APEX_HOME\etc\logback.xml``). There are multiple ways to
4921 use different logback configurations, for instance:
4923 .. container:: ulist
4925 - Maintain multiple configurations in ``etc``, for instance
4926 a ``logback-debug.xml`` for deep debugging and a
4927 ``logback-production.xml`` for APEX in production mode,
4928 then copy the required configuration file to the used
4929 ``logback.xml`` prior starting APEX
4931 - Edit the scripts in ``bin`` to use a different logback
4932 configuration file (only recommended if you are familiar
4933 with editing bash scripts or windows batch files)
4935 Standard Logging Configuration
4936 ------------------------------
4938 .. container:: paragraph
4940 The standard logging configuration defines a context *APEX*,
4941 which is used in the standard output pattern. The location
4942 for log files is defined in the property ``logDir`` and set
4943 to ``/var/log/onap/policy/apex-pdp``. The standard status
4944 listener is set to *NOP* and the overall logback
4945 configuration is set to no debug.
4947 .. container:: listingblock
4949 .. container:: content
4954 <configuration debug="false">
4955 <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
4957 <contextName>Apex</contextName>
4958 <property name="logDir" value="/var/log/onap/policy/apex-pdp/" />
4964 .. container:: paragraph
4966 The first appender defined is called ``STDOUT`` for logs to standard
4969 .. container:: listingblock
4971 .. container:: content
4976 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
4978 <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
4982 .. container:: paragraph
4984 The root level logger then is set to the level *info* using the
4985 standard out appender.
4987 .. container:: listingblock
4989 .. container:: content
4995 <appender-ref ref="STDOUT" />
4998 .. container:: paragraph
5000 The second appender is called ``FILE``. It writes logs to a file
5003 .. container:: listingblock
5005 .. container:: content
5010 <appender name="FILE" class="ch.qos.logback.core.FileAppender">
5011 <file>${logDir}/apex.log</file>
5013 <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %n %ex{full}</pattern>
5017 .. container:: paragraph
5019 The third appender is called ``CTXT_FILE``. It writes logs to a file
5022 .. container:: listingblock
5024 .. container:: content
5029 <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
5030 <file>${logDir}/apex_ctxt.log</file>
5032 <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %n %ex{full}</pattern>
5036 .. container:: paragraph
5038 The last definitions are for specific loggers. The first logger
5039 captures all standard APEX classes. It is configured for log level
5040 *info* and uses the standard output and file appenders. The second
5041 logger captures APEX context classes responsible for context
5042 monitoring. It is configured for log level *trace* and uses the
5043 context file appender.
5045 .. container:: listingblock
5047 .. container:: content
5053 <logger name="org.onap.policy.apex" level="info" additivity="false">
5054 <appender-ref ref="STDOUT" />
5055 <appender-ref ref="FILE" />
5058 <logger name="org.onap.policy.apex.core.context.monitoring" level="TRACE" additivity="false">
5059 <appender-ref ref="CTXT_FILE" />
5062 Adding Logback Status and Debug
5063 -------------------------------
5065 .. container:: paragraph
5067 To activate logback status messages change the status listener
5068 from 'NOP' to for instance console.
5070 .. container:: listingblock
5072 .. container:: content
5076 <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
5078 .. container:: paragraph
5080 To activate all logback debugging, for instance to debug a new
5081 logback configuration, activate the debug attribute in the
5084 .. container:: listingblock
5086 .. container:: content
5090 <configuration debug="true">
5094 Logging External Components
5095 ---------------------------
5097 .. container:: paragraph
5099 Logback can also be configured to log any other, external
5100 components APEX is using, if they are using the common logging
5103 .. container:: paragraph
5105 For instance, the context component of APEX is using *Infinispan*
5106 and one can add a logger for this external component. The
5107 following example adds a logger for *Infinispan* using the
5108 standard output appender.
5110 .. container:: listingblock
5112 .. container:: content
5116 <logger name="org.infinispan" level="INFO" additivity="false">
5117 <appender-ref ref="STDOUT" />
5120 .. container:: paragraph
5122 Another example is Apache Zookeeper. The following example adds a
5123 logger for Zookeeper using the standard outout appender.
5125 .. container:: listingblock
5127 .. container:: content
5131 <logger name="org.apache.zookeeper.ClientCnxn" level="INFO" additivity="false">
5132 <appender-ref ref="STDOUT" />
5135 Configuring loggers for Policy Logic
5136 ------------------------------------
5138 .. container:: paragraph
5140 The logging for the logic inside a policy (task logic, task
5141 selection logic, state finalizer logic) can be configured separate
5142 from standard logging. The logger for policy logic is
5143 ``org.onap.policy.apex.executionlogging``. The following example
5146 .. container:: ulist
5148 - a new appender for standard out using a very simple pattern
5149 (simply the actual message)
5151 - a logger for policy logic to standard out using the new
5152 appender and the already described file appender.
5154 .. container:: listingblock
5156 .. container:: content
5160 <appender name="POLICY_APPENDER_STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5162 <pattern>policy: %msg\n</pattern>
5166 <logger name="org.onap.policy.apex.executionlogging" level="info" additivity="false">
5167 <appender-ref ref="POLICY_APPENDER_STDOUT" />
5168 <appender-ref ref="FILE" />
5171 .. container:: paragraph
5173 It is also possible to use specific logging for parts of policy
5174 logic. The following example defines a logger for task logic.
5176 .. container:: listingblock
5178 .. container:: content
5182 <logger name="org.onap.policy.apex.executionlogging.TaskExecutionLogging" level="TRACE" additivity="false">
5183 <appender-ref ref="POLICY_APPENDER_STDOUT" />
5186 Rolling File Appenders
5187 ----------------------
5189 .. container:: paragraph
5191 Rolling file appenders are a good option for more complex logging
5192 of a production or complex testing APEX installation. The standard
5193 logback configuration can be used for these use cases. This
5194 section gives two examples for the standard logging and for
5197 .. container:: paragraph
5199 First the standard logging. The following example defines a
5200 rolling file appender. The appender rolls over on a daily basis.
5201 It allows for a file size of 100 MB.
5203 .. container:: listingblock
5205 .. container:: content
5209 <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
5210 <file>${logDir}/apex.log</file>
5211 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
5212 <!-- rollover daily -->
5213 <!-- <fileNamePattern>xstream-%d{yyyy-MM-dd}.%i.txt</fileNamePattern> -->
5214 <fileNamePattern>${logDir}/apex_%d{yyyy-MM-dd}.%i.log.gz
5216 <maxHistory>4</maxHistory>
5217 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
5218 <!-- or whenever the file size reaches 100MB -->
5219 <maxFileSize>100MB</maxFileSize>
5220 </timeBasedFileNamingAndTriggeringPolicy>
5224 %d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %ex{full} %n
5229 .. container:: paragraph
5231 A very similar configuration can be used for a rolling file
5232 appender logging APEX context.
5234 .. container:: listingblock
5236 .. container:: content
5240 <appender name="CTXT-FILE"
5241 class="ch.qos.logback.core.rolling.RollingFileAppender">
5242 <file>${logDir}/apex_ctxt.log</file>
5243 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
5244 <fileNamePattern>${logDir}/apex_ctxt_%d{yyyy-MM-dd}.%i.log.gz
5246 <maxHistory>4</maxHistory>
5247 <timeBasedFileNamingAndTriggeringPolicy
5248 class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
5249 <maxFileSize>100MB</maxFileSize>
5250 </timeBasedFileNamingAndTriggeringPolicy>
5254 %d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %ex{full} %n
5259 Example Configuration for Logging Logic
5260 ---------------------------------------
5262 .. container:: paragraph
5264 The following example shows a configuration that logs policy logic
5265 to standard out and a file (*info*). All other APEX components are
5266 logging to a file (*debug*).. This configuration an be used in a
5267 pre-production phase with the APEX engine still running in a
5268 separate terminal to monitor policy execution. This logback
5269 configuration is in the APEX installation as
5270 ``etc/logback-logic.xml``.
5272 .. container:: listingblock
5274 .. container:: content
5278 <configuration debug="false">
5279 <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
5281 <contextName>Apex</contextName>
5282 <property name="logDir" value="/var/log/onap/policy/apex-pdp/" />
5284 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5286 <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
5290 <appender name="FILE" class="ch.qos.logback.core.FileAppender">
5291 <file>${logDir}/apex.log</file>
5294 %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full}
5299 <appender name="POLICY_APPENDER_STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5301 <pattern>policy: %msg\n</pattern>
5305 <root level="error">
5306 <appender-ref ref="STDOUT" />
5309 <logger name="org.onap.policy.apex" level="debug" additivity="false">
5310 <appender-ref ref="FILE" />
5313 <logger name="org.onap.policy.apex.executionlogging" level="info" additivity="false">
5314 <appender-ref ref="POLICY_APPENDER_STDOUT" />
5315 <appender-ref ref="FILE" />
5319 Example Configuration for a Production Server
5320 ---------------------------------------------
5322 .. container:: paragraph
5324 The following example shows a configuration that logs all APEX
5325 components, including policy logic, to a file (*debug*). This
5326 configuration an be used in a production phase with the APEX
5327 engine being executed as a service on a system without console
5328 output. This logback configuration is in the APEX installation as
5329 ``logback-server.xml``
5331 .. container:: listingblock
5333 .. container:: content
5337 <configuration debug="false">
5338 <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
5340 <contextName>Apex</contextName>
5341 <property name="logDir" value="/var/log/onap/policy/apex-pdp/" />
5343 <appender name="FILE" class="ch.qos.logback.core.FileAppender">
5344 <file>${logDir}/apex.log</file>
5347 %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full}
5352 <root level="debug">
5353 <appender-ref ref="FILE" />
5356 <logger name="org.onap.policy.apex.executionlogging" level="debug" additivity="false">
5357 <appender-ref ref="FILE" />
5361 Building a System with Websocket Backend
5362 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5367 .. container:: paragraph
5369 Websocket is a protocol to run sockets of HTTP. Since it in
5370 essence a socket, the connection is realized between a
5371 server (waiting for connections) and a client (connecting to
5372 a server). Server/client separation is only important for
5373 connection establishment, once connected, everyone can
5374 send/receive on the same socket (as any standard socket
5377 .. container:: paragraph
5379 Standard Websocket implementations are simple, no
5380 publish/subscribe and no special event handling. Most
5381 servers simply send all incoming messages to all
5382 connections. There is a PubSub definition on top of
5383 Websocket called `WAMP <http://wamp-proto.org/>`__. APEX
5384 does not support WAMP at the moment.
5389 .. container:: paragraph
5392 356 <http://www.oracle.com/technetwork/articles/java/jsr356-1937161.html>`__
5393 defines the standard Websocket API. This JSR is part of Jave
5394 EE 7 standard. For Java SE, several implementations exist in
5395 open source. Since Websockets are a stable standard and
5396 simple, most implementations are stable and ready to use. A
5397 lot of products support Websockets, like Spring, JBoss,
5398 Netty, … there are also Kafka extensions for Websockets.
5400 Websocket Example Code for Websocket clients (FOSS)
5401 ---------------------------------------------------
5403 .. container:: paragraph
5405 There are a lot of implementations and examples available on
5406 Github for Websocket clients. If one is using Java EE 7,
5407 then one can also use the native Websocket implementation.
5408 Good examples for clients using simply Java SE are here:
5410 .. container:: ulist
5413 implementation <https://github.com/TooTallNate/Java-WebSocket>`__
5415 - `Websocket sending client example, using
5416 AWT <https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/ChatClient.java>`__
5418 - `Websocket receiving client example (simple echo
5419 client) <https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/ExampleClient.java>`__
5421 .. container:: paragraph
5423 For Java EE, the native Websocket API is explained here:
5425 .. container:: ulist
5428 docs <http://www.oracle.com/technetwork/articles/java/jsr356-1937161.html>`__
5431 example <http://www.programmingforliving.com/2013/08/jsr-356-java-api-for-websocket-client-api.html>`__
5433 BCP: Websocket Configuration
5434 ----------------------------
5436 .. container:: paragraph
5438 The probably best is to configure APEX for Websocket servers
5439 for input (ingress, consume) and output (egress, produce)
5440 interfaces. This means that APEX will start Websocket
5441 servers on named ports and wait for clients to connect.
5442 Advantage: once APEX is running all connectivity
5443 infrastructure is running as well. Consequence: if APEX is
5444 not running, everyone else is in the dark, too.
5446 .. container:: paragraph
5448 The best protocol to be used is JSON string. Each event on
5449 any interface is then a string with a JSON encoding. JSON
5450 string is a little bit slower than byte code, but we doubt
5451 that this will be noticeable. A further advantage of JSON
5452 strings over Websockets with APEX starting the servers: it
5453 is very easy to connect web browsers to such a system.
5454 Simple connect the web browser to the APEX sockets and
5455 send/read JSON strings.
5457 .. container:: paragraph
5459 Once APEX is started you simply connect Websocket clients to
5460 it, and send/receive event. When APEX is terminated, the
5461 Websocket servers go down, and the clients will be
5462 disconnected. APEX does not (yet) support auto-client
5463 reconnect nor WAMP, so clients might need to be restarted or
5464 reconnected manually after an APEX boot.
5466 Demo with VPN Policy Model
5467 --------------------------
5469 .. container:: paragraph
5471 We assume that you have an APEX installation using the full
5472 package, i.e. APEX with all examples, of version ``0.5.6``
5473 or higher. We will use the VPN policy from the APEX examples
5476 .. container:: paragraph
5478 Now, have the following ready to start the demo:
5480 .. container:: ulist
5482 - 3 terminals on the host where APEX is running (we need 1
5483 for APEX and 1 for each client)
5485 - the events in the file
5486 ``$APEX_HOME/examples/events/VPN/SetupEvents.json`` open
5487 in an editor (we need to send those events to APEX)
5489 - the events in the file
5490 ``$APEX_HOME/examples/events/VPN/Link09Events.json`` open
5491 in an editor (we need to send those events to APEX)
5493 A Websocket Configuration for the VPN Domain
5494 ############################################
5496 .. container:: paragraph
5498 Create a new APEX configuration using the VPN policy
5499 model and configuring APEX as discussed above for
5500 Websockets. Copy the following configuration into
5501 ``$APEX_HOME/examples/config/VPN/Ws2WsServerAvroContextJsonEvent.json``
5503 ``%APEX_HOME%\examples\config\VPN\Ws2WsServerAvroContextJsonEvent.json``):
5505 .. container:: listingblock
5507 .. container:: content
5513 "engineServiceParameters" : {
5514 "name" : "VPNApexEngine",
5515 "version" : "0.0.1",
5517 "instanceCount" : 1,
5518 "deploymentPort" : 12345,
5519 "policyModelFileName" : "examples/models/VPN/VPNPolicyModelAvro.json",
5520 "engineParameters" : {
5521 "executorParameters" : {
5523 "parameterClassName" : "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters"
5526 "contextParameters" : {
5527 "parameterClassName" : "org.onap.policy.apex.context.parameters.ContextParameters",
5528 "schemaParameters":{
5530 "parameterClassName" : "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
5536 "producerCarrierTechnologyParameters" : {
5537 "carrierTechnology" : "WEBSOCKET",
5538 "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
5544 "producerEventProtocolParameters" : {
5545 "eventProtocol" : "JSON"
5547 "consumerCarrierTechnologyParameters" : {
5548 "carrierTechnology" : "WEBSOCKET",
5549 "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
5555 "consumerEventProtocolParameters" : {
5556 "eventProtocol" : "JSON"
5563 .. container:: paragraph
5565 In a new terminal, start APEX with the new configuration for
5566 Websocket-Server ingress/egress:
5568 .. container:: listingblock
5570 .. container:: content
5575 #: $APEX_HOME/bin/apexEngine.sh -c $APEX_HOME/examples/config/VPN/Ws2WsServerAvroContextJsonEvent.json
5577 .. container:: listingblock
5579 .. container:: content
5584 #: %APEX_HOME%\bin\apexEngine.bat -c %APEX_HOME%\examples\config\VPN\Ws2WsServerAvroContextJsonEvent.json
5586 .. container:: paragraph
5588 Wait for APEX to start, it takes a while to create all Websocket
5589 servers (about 8 seconds on a standard laptop without cached
5590 binaries). depending on your log messages, you will see no (some, a
5591 lot) log messages. If APEX starts correctly, the last few messages
5594 .. container:: listingblock
5596 .. container:: content
5601 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)
5602 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 ...
5603 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
5604 Started Apex service
5606 .. container:: paragraph
5608 APEX is running in the new terminal and will produce output when the
5609 policy is triggered/executed.
5611 Run the Websocket Echo Client
5612 #############################
5614 .. container:: paragraph
5616 The echo client is included in an APEX full installation. To run
5617 the client, open a new shell (Unix, Cygwin) or command prompt
5618 (``cmd`` on Windows). Then use the APEX application launcher to
5622 APEX engine needs to run first
5623 The example assumes that an APEX engine configured for *produce* carrier technology Websocket and *JSON* event protocol is executed first.
5625 +---------------------------------------------------------+-----------------------------------------------------------+
5626 | Unix, Cygwin | Windows |
5627 +=========================================================+===========================================================+
5628 | .. container:: | .. container:: |
5630 | .. container:: listingblock | .. container:: listingblock |
5632 | .. container:: content | .. container:: content |
5634 | .. code:: | .. code:: |
5636 | # $APEX_HOME/bin/apexApps.sh ws-echo [args] | > %APEX_HOME%\bin\apexApps.bat ws-echo [args] |
5637 +---------------------------------------------------------+-----------------------------------------------------------+
5639 .. container:: paragraph
5641 Use the following command line arguments for server and port of
5642 the Websocket server. The port should be the same as configured in
5643 the APEX engine. The server host should be the host on which the
5644 APEX engine is running
5646 .. container:: ulist
5648 - ``-p`` defines the Websocket port to connect to (defaults to
5651 - ``-s`` defines the host on which a Websocket server is running
5652 (defaults to ``localhost``)
5654 .. container:: paragraph
5656 Let’s assume that there is an APEX engine running, configured for
5657 produce Websocket carrier technology, as server, for port 42452,
5658 with produce event protocol JSON,. If we start the console client
5659 on the same host, we can omit the ``-s`` options. We start the
5662 .. container:: listingblock
5664 .. container:: content
5668 # $APEX_HOME/bin/apexApps.sh ws-echo -p 42452 (1)
5669 > %APEX_HOME%\bin\apexApps.bat ws-echo -p 42452 (2)
5671 .. container:: colist arabic
5673 +-------+--------------------------------+
5674 | **1** | Start client on Unix or Cygwin |
5675 +-------+--------------------------------+
5676 | **2** | Start client on Windows |
5677 +-------+--------------------------------+
5679 .. container:: paragraph
5681 Once started successfully, the client will produce the following
5682 messages (assuming we used ``-p 42452`` and an APEX engine is
5683 running on ``localhost`` with the same port:
5685 .. container:: listingblock
5687 .. container:: content
5691 ws-simple-echo: starting simple event echo
5692 --> server: localhost
5695 Once started, the application will simply print out all received events to standard out.
5696 Each received event will be prefixed by '---' and suffixed by '===='
5699 ws-simple-echo: opened connection to APEX (Web Socket Protocol Handshake)
5701 Run the Websocket Console Client
5702 ################################
5704 .. container:: paragraph
5706 The console client is included in an APEX full installation. To
5707 run the client, open a new shell (Unix, Cygwin) or command prompt
5708 (``cmd`` on Windows). Then use the APEX application launcher to
5712 APEX engine needs to run first
5713 The example assumes that an APEX engine configured for *consume* carrier technology Websocket and *JSON* event
5714 protocol is executed first.
5716 +------------------------------------------------------------+--------------------------------------------------------------+
5717 | Unix, Cygwin | Windows |
5718 +============================================================+==============================================================+
5719 | .. container:: | .. container:: |
5721 | .. container:: listingblock | .. container:: listingblock |
5723 | .. container:: content | .. container:: content |
5725 | .. code:: | .. code:: |
5727 | # $APEX_HOME/bin/apexApps.sh ws-console [args] | > %APEX_HOME%\bin\apexApps.bat ws-console [args] |
5728 +------------------------------------------------------------+--------------------------------------------------------------+
5730 .. container:: paragraph
5732 Use the following command line arguments for server and port of
5733 the Websocket server. The port should be the same as configured in
5734 the APEX engine. The server host should be the host on which the
5735 APEX engine is running
5737 .. container:: ulist
5739 - ``-p`` defines the Websocket port to connect to (defaults to
5742 - ``-s`` defines the host on which a Websocket server is running
5743 (defaults to ``localhost``)
5745 .. container:: paragraph
5747 Let’s assume that there is an APEX engine running, configured for
5748 consume Websocket carrier technology, as server, for port 42450,
5749 with consume event protocol JSON,. If we start the console client
5750 on the same host, we can omit the ``-s`` options. We start the
5753 .. container:: listingblock
5755 .. container:: content
5759 # $APEX_HOME/bin/apexApps.sh ws-console -p 42450 (1)
5760 > %APEX_HOME%\bin\apexApps.sh ws-console -p 42450 (2)
5762 .. container:: colist arabic
5764 +-------+--------------------------------+
5765 | **1** | Start client on Unix or Cygwin |
5766 +-------+--------------------------------+
5767 | **2** | Start client on Windows |
5768 +-------+--------------------------------+
5770 .. container:: paragraph
5772 Once started successfully, the client will produce the following
5773 messages (assuming we used ``-p 42450`` and an APEX engine is
5774 running on ``localhost`` with the same port:
5776 .. container:: listingblock
5778 .. container:: content
5782 ws-simple-console: starting simple event console
5783 --> server: localhost
5786 - terminate the application typing 'exit<enter>' or using 'CTRL+C'
5787 - events are created by a non-blank starting line and terminated by a blank line
5790 ws-simple-console: opened connection to APEX (Web Socket Protocol Handshake)
5795 .. container:: paragraph
5797 Now you have the full system up and running:
5799 .. container:: ulist
5801 - Terminal 1: APEX ready and loaded
5803 - Terminal 2: an echo client, printing received messages produced
5806 - Terminal 2: a console client, waiting for input on the console
5807 (standard in) and sending text to APEX
5809 .. container:: paragraph
5811 We started the engine with the VPN policy example. So all the
5812 events we are using now are located in files in the following
5815 .. container:: listingblock
5817 .. container:: content
5822 #: $APEX_HOME/examples/events/VPN
5823 > %APEX_HOME%\examples\events\VPN
5825 .. container:: paragraph
5827 To sends events, simply copy the content of the event files into
5828 Terminal 3 (the console client). It will read multi-line JSON text
5829 and send the events. So copy the content of ``SetupEvents.json`` into
5830 the client. APEX will trigger a policy and produce some output, the
5831 echo client will also print some events created in the policy. In
5832 Terminal 1 (APEX) you’ll see some status messages from the policy as:
5834 .. container:: listingblock
5836 .. container:: content
5841 {Link=L09, LinkUp=true}
5843 outFields: {Link=L09, LinkUp=true}
5844 {Link=L10, LinkUp=true}
5847 outFields: {Link=L10, LinkUp=true}
5848 {CustomerName=C, LinkList=L09 L10, SlaDT=300, YtdDT=300}
5850 C 300 300 [L09, L10]
5851 outFields: {CustomerName=C, LinkList=L09 L10, SlaDT=300, YtdDT=300}
5852 {CustomerName=A, LinkList=L09 L10, SlaDT=300, YtdDT=50}
5855 C 300 300 [L09, L10]
5856 outFields: {CustomerName=A, LinkList=L09 L10, SlaDT=300, YtdDT=50}
5857 {CustomerName=D, LinkList=L09 L10, SlaDT=300, YtdDT=400}
5860 C 300 300 [L09, L10]
5861 D 300 400 [L09, L10]
5862 outFields: {CustomerName=D, LinkList=L09 L10, SlaDT=300, YtdDT=400}
5863 {CustomerName=B, LinkList=L09 L10, SlaDT=300, YtdDT=299}
5866 B 300 299 [L09, L10]
5867 C 300 300 [L09, L10]
5868 D 300 400 [L09, L10]
5869 outFields: {CustomerName=B, LinkList=L09 L10, SlaDT=300, YtdDT=299}
5871 .. container:: paragraph
5873 In Terminal 2 (echo-client) you see the received events, the last two
5876 .. container:: listingblock
5878 .. container:: content
5883 ws-simple-echo: received
5884 ---------------------------------
5886 "name": "VPNCustomerCtxtActEvent",
5888 "nameSpace": "org.onap.policy.apex.domains.vpn.events",
5891 "CustomerName": "C",
5892 "LinkList": "L09 L10",
5896 =================================
5898 ws-simple-echo: received
5899 ---------------------------------
5901 "name": "VPNCustomerCtxtActEvent",
5903 "nameSpace": "org.onap.policy.apex.domains.vpn.events",
5906 "CustomerName": "D",
5907 "LinkList": "L09 L10",
5911 =================================
5913 .. container:: paragraph
5915 Congratulations, you have triggered a policy in APEX using
5916 Websockets, the policy did run through, created events, picked up by
5919 .. container:: paragraph
5921 Now you can send the Link 09 and Link 10 events, they will trigger
5922 the actual VPN policy and some calculations are made. Let’s take the
5923 Link 09 events from ``Link09Events.json``, copy them all into
5924 Terminal 3 (the console). APEX will run the policy (with some status
5925 output), and the echo client will receive and print events.
5927 .. container:: paragraph
5929 To terminate the applications, simply press ``CTRL+C`` in Terminal 1
5930 (APEX). This will also terminate the echo-client in Terminal 2. Then
5931 type ``exit<enter>`` in Terminal 3 (or ``CTRL+C``) to terminate the
5941 Last updated 2018-09-10 15:38:16 IST
5943 .. |Extract the TAR archive| image:: images/install-guide/win-extract-tar-gz.png
5944 .. |Extract the APEX distribution| image:: images/install-guide/win-extract-tar.png
5945 .. |REST Editor Start Screen| image:: images/install-guide/rest-start.png
5946 .. |REST Editor with loaded SampleDomain Policy Model| image:: images/install-guide/rest-loaded.png
5947 .. |APEX Configuration Matrix| image:: images/apex-intro/ApexEngineConfig.png