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 8 or later, APEX is tested with the
34 - Building from source: JAVA development kit (JDK,
35 Java 8 or later, APEX is tested with the Oracle
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 - RPM to install from the RPM distribution
72 - Install: ``sudo apt-get install rpm``
74 - DPKG to install from the DEB distribution
78 - Install: ``sudo apt-get install dpkg``
83 .. container:: paragraph
85 APEX supports a number of features that require extra
86 software being installed.
90 - `Apache Kafka <https://kafka.apache.org/>`__ to
91 connect APEX to a Kafka message bus
93 - `Hazelcast <https://hazelcast.com/>`__ to use
94 distributed hash maps for context
96 - `Infinispan <http://infinispan.org/>`__ for
97 distributed context and persistence
99 - `Docker <https://www.docker.com/>`__ to run APEX
100 inside a Docker container
102 Build (Install from Source) Requirements
103 ########################################
105 .. container:: paragraph
107 Installation from source requires a few development
112 - GIT to retrieve the source code
114 - Java SDK, Java version 8 or later
116 - Apache Maven 3 (the APEX build environment)
118 Get the APEX Source Code
119 ------------------------
121 .. container:: paragraph
123 The first APEX source code was hosted on Github in
124 January 2018. By the end of 2018, APEX was added as a
125 project in the ONAP Policy Framework, released later in
126 the ONAP Casablanca release.
128 .. container:: paragraph
130 The APEX source code is hosted in ONAP as project APEX.
131 The current stable version is in the master branch.
132 Simply clone the master branch from ONAP using HTTPS.
134 .. container:: listingblock
136 .. container:: content
141 git clone https://gerrit.onap.org/r/policy/apex-pdp
146 .. container:: paragraph
148 The examples in this document assume that the APEX source
149 repositories are cloned to:
153 - Unix, Cygwin: ``/usr/local/src/apex-pdp``
155 - Windows: ``C:\dev\apex-pdp``
157 - Cygwin: ``/cygdrive/c/dev/apex-pdp``
160 A Build requires ONAP Nexus
161 APEX has a dependency to ONAP parent projects. You might need to adjust your Maven M2 settings. The most current
162 settings can be found in the ONAP oparent repo: `Settings <https://git.onap.org/oparent/plain/settings.xml>`__.
166 Building APEX requires approximately 2-3 GB of hard disc space, 1 GB for the actual build with full
167 distribution and 1-2 GB for the downloaded dependencies
170 A Build requires Internet (for first build)
171 During the build, several (a lot) of Maven dependencies will be downloaded and stored in the configured local Maven
172 repository. The first standard build (and any first specific build) requires Internet access to download those
176 Building RPM distributions
177 RPM images are only build if the ``rpm`` package is installed (Unix). To install ``rpm`` run ``sudo apt-get install rpm``,
180 .. container:: paragraph
182 Use Maven to for a standard build without any tests.
184 +-------------------------------------------------------+--------------------------------------------------------+
185 | Unix, Cygwin | Windows |
186 +=======================================================+========================================================+
187 | .. container:: | .. container:: |
189 | .. container:: content | .. container:: content |
191 | .. code:: | .. code:: |
192 | :number-lines: | :number-lines: |
194 | # cd /usr/local/src/apex-pdp | >c: |
195 | # mvn clean install -Pdocker -DskipTests | >cd \dev\apex |
196 | | >mvn clean install -Pdocker -DskipTests |
197 +-------------------------------------------------------+--------------------------------------------------------+
199 .. container:: paragraph
201 The build takes 2-3 minutes on a standard development laptop. It
202 should run through without errors, but with a lot of messages from
205 .. container:: paragraph
207 When Maven is finished with the build, the final screen should look
208 similar to this (omitting some ``success`` lines):
210 .. container:: listingblock
212 .. container:: content
217 [INFO] tools .............................................. SUCCESS [ 0.248 s]
218 [INFO] tools-common ....................................... SUCCESS [ 0.784 s]
219 [INFO] simple-wsclient .................................... SUCCESS [ 3.303 s]
220 [INFO] model-generator .................................... SUCCESS [ 0.644 s]
221 [INFO] packages ........................................... SUCCESS [ 0.336 s]
222 [INFO] apex-pdp-package-full .............................. SUCCESS [01:10 min]
223 [INFO] Policy APEX PDP - Docker build 2.0.0-SNAPSHOT ...... SUCCESS [ 10.307 s]
224 [INFO] ------------------------------------------------------------------------
226 [INFO] ------------------------------------------------------------------------
227 [INFO] Total time: 03:43 min
228 [INFO] Finished at: 2018-09-03T11:56:01+01:00
229 [INFO] ------------------------------------------------------------------------
231 .. container:: paragraph
233 The build will have created all artifacts required for an APEX
234 installation. The following example show how to change to the target
235 directory and how it should look like.
237 +----------------------------------------------------------------------------------------------------------------------------+
239 +============================================================================================================================+
242 | .. container:: listingblock |
244 | .. container:: content |
249 | -rwxrwx---+ 1 esvevan Domain Users 772 Sep 3 11:55 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes* |
250 | -rwxrwx---+ 1 esvevan Domain Users 146328082 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT.deb* |
251 | -rwxrwx---+ 1 esvevan Domain Users 15633 Sep 3 11:54 apex-pdp-package-full-2.0.0-SNAPSHOT.jar* |
252 | -rwxrwx---+ 1 esvevan Domain Users 146296819 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz* |
253 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 archive-tmp/ |
254 | -rwxrwx---+ 1 esvevan Domain Users 89 Sep 3 11:54 checkstyle-cachefile* |
255 | -rwxrwx---+ 1 esvevan Domain Users 10621 Sep 3 11:54 checkstyle-checker.xml* |
256 | -rwxrwx---+ 1 esvevan Domain Users 584 Sep 3 11:54 checkstyle-header.txt* |
257 | -rwxrwx---+ 1 esvevan Domain Users 86 Sep 3 11:54 checkstyle-result.xml* |
258 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 classes/ |
259 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 dependency-maven-plugin-markers/ |
260 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 etc/ |
261 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 examples/ |
262 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:55 install_hierarchy/ |
263 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 maven-archiver/ |
264 +----------------------------------------------------------------------------------------------------------------------------+
266 +--------------------------------------------------------------------------------------------------------+
268 +========================================================================================================+
271 | .. container:: listingblock |
273 | .. container:: content |
278 | 03/09/2018 11:55 <DIR> . |
279 | 03/09/2018 11:55 <DIR> .. |
280 | 03/09/2018 11:55 146,296,819 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz |
281 | 03/09/2018 11:55 146,328,082 apex-pdp-package-full-2.0.0-SNAPSHOT.deb |
282 | 03/09/2018 11:54 15,633 apex-pdp-package-full-2.0.0-SNAPSHOT.jar |
283 | 03/09/2018 11:55 772 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes |
284 | 03/09/2018 11:54 <DIR> archive-tmp |
285 | 03/09/2018 11:54 89 checkstyle-cachefile |
286 | 03/09/2018 11:54 10,621 checkstyle-checker.xml |
287 | 03/09/2018 11:54 584 checkstyle-header.txt |
288 | 03/09/2018 11:54 86 checkstyle-result.xml |
289 | 03/09/2018 11:54 <DIR> classes |
290 | 03/09/2018 11:54 <DIR> dependency-maven-plugin-markers |
291 | 03/09/2018 11:54 <DIR> etc |
292 | 03/09/2018 11:54 <DIR> examples |
293 | 03/09/2018 11:55 <DIR> install_hierarchy |
294 | 03/09/2018 11:54 <DIR> maven-archiver |
295 | 8 File(s) 292,652,686 bytes |
296 | 9 Dir(s) 14,138,720,256 bytes free |
297 +--------------------------------------------------------------------------------------------------------+
302 .. container:: paragraph
304 APEX can be installed in different ways:
308 - Unix: automatically using ``rpm`` or ``dpkg`` from ``.rpm`` or
311 - Windows, Unix, Cygwin: manually from a ``.tar.gz`` archive
313 - Windows, Unix, Cygwin: build from source using Maven, then
316 Install with RPM and DPKG
317 #########################
319 .. container:: paragraph
321 The install distributions of APEX automatically install the
322 system. The installation directory is
323 ``/opt/app/policy/apex-pdp``. Log files are located in
324 ``/var/log/onap/policy/apex-pdp``. The latest APEX version will
325 be available as ``/opt/app/policy/apex-pdp/apex-pdp``.
327 .. container:: paragraph
329 For the installation, a new user ``apexuser`` and a new group
330 ``apexuser`` will be created. This user owns the installation
331 directories and the log file location. The user is also used by
332 the standard APEX start scripts to run APEX with this user’s
335 +-----------------------------------------------------------------------+
337 +=======================================================================+
340 | .. container:: listingblock |
342 | .. container:: content |
347 | # sudo rpm -i apex-pdp-package-full-2.0.0-SNAPSHOT.rpm |
348 | ********************preinst******************* |
350 | ********************************************** |
351 | creating group apexuser . . . |
352 | creating user apexuser . . . |
353 | ********************postinst**************** |
355 | *********************************************** |
356 +-----------------------------------------------------------------------+
358 +--------------------------------------------------------------------------------------+
359 | DPKG Installation |
360 +======================================================================================+
363 | .. container:: listingblock |
365 | .. container:: content |
370 | # sudo dpkg -i apex-pdp-package-full-2.0.0-SNAPSHOT.deb |
371 | Selecting previously unselected package apex-uservice. |
372 | (Reading database ... 288458 files and directories currently installed.) |
373 | Preparing to unpack apex-pdp-package-full-2.0.0-SNAPSHOT.deb ... |
374 | ********************preinst******************* |
375 | arguments install |
376 | ********************************************** |
377 | creating group apexuser . . . |
378 | creating user apexuser . . . |
379 | Unpacking apex-uservice (2.0.0-SNAPSHOT) ... |
380 | Setting up apex-uservice (2.0.0-SNAPSHOT) ... |
381 | ********************postinst**************** |
382 | arguments configure |
383 | *********************************************** |
384 +--------------------------------------------------------------------------------------+
386 .. container:: paragraph
388 Once the installation is finished, APEX is fully installed and ready
391 Install Manually from Archive (Unix, Cygwin)
392 ############################################
394 .. container:: paragraph
396 Download a ``tar.gz`` archive. Create a directory where APEX
397 should be installed. Extract the ``tar`` archive. The following
398 example shows how to install APEX in ``/opt/apex`` and create a
399 link to ``/opt/apex/apex`` for the most recent installation.
401 .. container:: listingblock
403 .. container:: content
411 # mkdir apex-full-2.0.0-SNAPSHOT
412 # tar xvfz ~/Downloads/apex-pdp-package-full-2.0.0-SNAPSHOT.tar.gz -C apex-full-2.0.0-SNAPSHOT
413 # ln -s apex apex-pdp-package-full-2.0.0-SNAPSHOT
415 Install Manually from Archive (Windows, 7Zip, GUI)
416 ##################################################
418 .. container:: paragraph
420 Download a ``tar.gz`` archive and copy the file into the install
421 folder (in this example ``C:\apex``). Assuming you are using 7Zip,
422 right click on the file and extract the ``tar`` archive. Note: the
423 screenshots might show an older version than you have.
425 .. container:: imageblock
427 .. container:: content
429 |Extract the TAR archive|
431 .. container:: paragraph
433 The right-click on the new created TAR file and extract the actual
436 .. container:: imageblock
438 .. container:: content
440 |Extract the APEX distribution|
442 .. container:: paragraph
444 Inside the new APEX folder you see the main directories: ``bin``,
445 ``etc``, ``examples``, ``lib``, and ``war``
447 .. container:: paragraph
449 Once extracted, please rename the created folder to
450 ``apex-full-2.0.0-SNAPSHOT``. This will keep the directory name in
451 line with the rest of this documentation.
453 Install Manually from Archive (Windows, 7Zip, CMD)
454 ##################################################
456 .. container:: paragraph
458 Download a ``tar.gz`` archive and copy the file into the install
459 folder (in this example ``C:\apex``). Start ``cmd``, for instance
460 typing ``Windows+R`` and then ``cmd`` in the dialog. Assuming
461 ``7Zip`` is installed in the standard folder, simply run the
462 following commands (for APEX version 2.0.0-SNAPSHOT full
465 .. container:: listingblock
467 .. container:: content
474 >"\Program Files\7-Zip\7z.exe" x apex-pdp-package-full-2.0.0-SNAPSHOT.tar.gz -so | "\Program Files\7-Zip\7z.exe" x -aoa -si -ttar -o"apex-full-2.0.0-SNAPSHOT"
476 .. container:: paragraph
478 APEX is now installed in the folder
479 ``C:\apex\apex-full-2.0.0-SNAPSHOT``.
484 Build and Install Manually (Unix, Windows, Cygwin)
485 ##################################################
487 .. container:: paragraph
489 Clone the APEX GIT repositories into a directory. Go to that
490 directory. Use Maven to build APEX (all details on building
491 APEX from source can be found in *APEX HowTo: Build*). Install
492 from the created artifacts (``rpm``, ``deb``, ``tar.gz``, or
496 Building RPM distributions
497 RPM images are only build if the ``rpm`` package is installed (Unix). To install ``rpm`` run
498 ``sudo apt-get install rpm``, then build APEX.
500 .. container:: paragraph
502 The following example shows how to build the APEX system,
503 without tests (``-DskipTests``) to safe some time. It assumes
504 that the APX GIT repositories are cloned to:
508 - Unix, Cygwin: ``/usr/local/src/apex``
510 - Windows: ``C:\dev\apex``
512 +-------------------------------------------------------+--------------------------------------------------------+
513 | Unix, Cygwin | Windows |
514 +=======================================================+========================================================+
515 | .. container:: | .. container:: |
517 | .. container:: content | .. container:: content |
519 | .. code:: | .. code:: |
520 | :number-lines: | :number-lines: |
522 | # cd /usr/local/src/apex | >c: |
523 | # mvn clean install -Pdocker -DskipTests | >cd \dev\apex |
524 | | >mvn clean install -Pdocker -DskipTests |
525 +-------------------------------------------------------+--------------------------------------------------------+
527 .. container:: paragraph
529 The build takes about 2 minutes without test and about 4-5 minutes
530 with tests on a standard development laptop. It should run through
531 without errors, but with a lot of messages from the build process. If
532 build with tests (i.e. without ``-DskipTests``), there will be error
533 messages and stack trace prints from some tests. This is normal, as
534 long as the build finishes successful.
536 .. container:: paragraph
538 When Maven is finished with the build, the final screen should look
539 similar to this (omitting some ``success`` lines):
541 .. container:: listingblock
543 .. container:: content
548 [INFO] tools .............................................. SUCCESS [ 0.248 s]
549 [INFO] tools-common ....................................... SUCCESS [ 0.784 s]
550 [INFO] simple-wsclient .................................... SUCCESS [ 3.303 s]
551 [INFO] model-generator .................................... SUCCESS [ 0.644 s]
552 [INFO] packages ........................................... SUCCESS [ 0.336 s]
553 [INFO] apex-pdp-package-full .............................. SUCCESS [01:10 min]
554 [INFO] Policy APEX PDP - Docker build 2.0.0-SNAPSHOT ...... SUCCESS [ 10.307 s]
555 [INFO] ------------------------------------------------------------------------
557 [INFO] ------------------------------------------------------------------------
558 [INFO] Total time: 03:43 min
559 [INFO] Finished at: 2018-09-03T11:56:01+01:00
560 [INFO] ------------------------------------------------------------------------
562 .. container:: paragraph
564 The build will have created all artifacts required for an APEX
565 installation. The following example show how to change to the target
566 directory and how it should look like.
568 +-----------------------------------------------------------------------------------------------------------------------------+
570 +=============================================================================================================================+
573 | .. container:: listingblock |
578 | # cd packages/apex-pdp-package-full/target |
580 | -rwxrwx---+ 1 esvevan Domain Users 772 Sep 3 11:55 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes* |
581 | -rwxrwx---+ 1 esvevan Domain Users 146328082 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT.deb* |
582 | -rwxrwx---+ 1 esvevan Domain Users 15633 Sep 3 11:54 apex-pdp-package-full-2.0.0-SNAPSHOT.jar* |
583 | -rwxrwx---+ 1 esvevan Domain Users 146296819 Sep 3 11:55 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz* |
584 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 archive-tmp/ |
585 | -rwxrwx---+ 1 esvevan Domain Users 89 Sep 3 11:54 checkstyle-cachefile* |
586 | -rwxrwx---+ 1 esvevan Domain Users 10621 Sep 3 11:54 checkstyle-checker.xml* |
587 | -rwxrwx---+ 1 esvevan Domain Users 584 Sep 3 11:54 checkstyle-header.txt* |
588 | -rwxrwx---+ 1 esvevan Domain Users 86 Sep 3 11:54 checkstyle-result.xml* |
589 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 classes/ |
590 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 dependency-maven-plugin-markers/ |
591 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 etc/ |
592 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 examples/ |
593 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:55 install_hierarchy/ |
594 | drwxrwx---+ 1 esvevan Domain Users 0 Sep 3 11:54 maven-archiver/ |
595 +-----------------------------------------------------------------------------------------------------------------------------+
597 +-----------------------------------------------------------------------------------------------------------------------------+
599 +=============================================================================================================================+
602 | .. container:: listingblock |
607 | >cd packages\apex-pdp-package-full\target |
609 | 03/09/2018 11:55 <DIR> . |
610 | 03/09/2018 11:55 <DIR> .. |
611 | 03/09/2018 11:55 146,296,819 apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz |
612 | 03/09/2018 11:55 146,328,082 apex-pdp-package-full-2.0.0-SNAPSHOT.deb |
613 | 03/09/2018 11:54 15,633 apex-pdp-package-full-2.0.0-SNAPSHOT.jar |
614 | 03/09/2018 11:55 772 apex-pdp-package-full_2.0.0~SNAPSHOT_all.changes |
615 | 03/09/2018 11:54 <DIR> archive-tmp |
616 | 03/09/2018 11:54 89 checkstyle-cachefile |
617 | 03/09/2018 11:54 10,621 checkstyle-checker.xml |
618 | 03/09/2018 11:54 584 checkstyle-header.txt |
619 | 03/09/2018 11:54 86 checkstyle-result.xml |
620 | 03/09/2018 11:54 <DIR> classes |
621 | 03/09/2018 11:54 <DIR> dependency-maven-plugin-markers |
622 | 03/09/2018 11:54 <DIR> etc |
623 | 03/09/2018 11:54 <DIR> examples |
624 | 03/09/2018 11:55 <DIR> install_hierarchy |
625 | 03/09/2018 11:54 <DIR> maven-archiver |
626 | 8 File(s) 292,652,686 bytes |
627 | 9 Dir(s) 14,138,720,256 bytes free |
628 +-----------------------------------------------------------------------------------------------------------------------------+
630 .. container:: paragraph
632 Now, take the ``.deb`` or the ``.tar.gz`` file and install APEX.
633 Alternatively, copy the content of the folder ``install_hierarchy``
634 to your APEX directory.
639 .. container:: paragraph
641 A full installation of APEX comes with the following layout.
643 .. container:: listingblock
645 .. container:: content
664 │ └───applications (11)
667 .. container:: colist arabic
669 +-----------------------------------+-----------------------------------+
670 | **1** | binaries, mainly scripts (bash |
671 | | and bat) to start the APEX engine |
672 | | and applications |
673 +-----------------------------------+-----------------------------------+
674 | **2** | configuration files, such as |
675 | | logback (logging) and third party |
676 | | library configurations |
677 +-----------------------------------+-----------------------------------+
678 | **3** | example policy models to get |
680 +-----------------------------------+-----------------------------------+
681 | **4** | configurations for the examples |
682 | | (with sub directories for |
683 | | individual examples) |
684 +-----------------------------------+-----------------------------------+
685 | **5** | Docker files and additional |
686 | | Docker instructions for the |
688 +-----------------------------------+-----------------------------------+
689 | **6** | example events for the examples |
690 | | (with sub directories for |
691 | | individual examples) |
692 +-----------------------------------+-----------------------------------+
693 | **7** | HTML files for some examples, |
694 | | e.g. the Decisionmaker example |
695 +-----------------------------------+-----------------------------------+
696 | **8** | the policy models, generated for |
697 | | each example (with sub |
698 | | directories for individual |
700 +-----------------------------------+-----------------------------------+
701 | **9** | additional scripts for the |
702 | | examples (with sub directories |
703 | | for individual examples) |
704 +-----------------------------------+-----------------------------------+
705 | **10** | the library folder with all Java |
707 +-----------------------------------+-----------------------------------+
708 | **11** | applications, also known as jar |
709 | | with dependencies (or fat jars), |
710 | | individually deployable |
711 +-----------------------------------+-----------------------------------+
712 | **12** | WAR files for web applications |
713 +-----------------------------------+-----------------------------------+
718 .. container:: paragraph
720 Once APEX is installed, a few configurations need to be done:
724 - Create an APEX user and an APEX group (optional, if not
725 installed using RPM and DPKG)
727 - Create environment settings for ``APEX_HOME`` and
728 ``APEX_USER``, required by the start scripts
730 - Change settings of the logging framework (optional)
732 - Create directories for logging, required (execution might fail
733 if directories do not exist or cannot be created)
738 .. container:: paragraph
740 On smaller installations and test systems, APEX can run as any
743 .. container:: paragraph
745 However, if APEX is installed in production, we strongly
746 recommend you set up a dedicated user for running APEX. This
747 will isolate the execution of APEX to that user. We recommend
748 you use the userid ``apexuser`` but you may use any user you
751 .. container:: paragraph
753 The following example, for UNIX, creates a group called
754 ``apexuser``, an APEX user called ``apexuser``, adds the group
755 to the user, and changes ownership of the APEX installation to
756 the user. Substitute ``<apex-dir>`` with the directory where
759 .. container:: listingblock
761 .. container:: content
766 # sudo groupadd apexuser
767 # sudo useradd -g apexuser apexuser
768 # sudo chown -R apexuser:apexuser <apex-dir>
770 .. container:: paragraph
772 For other operating systems please consult your manual or system
775 Environment Settings: APEX_HOME and APEX_USER
776 #############################################
778 .. container:: paragraph
780 The provided start scripts for APEX require two environment
785 - ``APEX_USER`` with the user under whos name and permission APEX
786 should be started (Unix only)
788 - ``APEX_HOME`` with the directory where APEX is installed (Unix,
791 .. container:: paragraph
793 The first row in the following table shows how to set these
794 environment variables temporary (assuming the user is
795 ``apexuser``). The second row shows how to verify the settings.
796 The last row explains how to set those variables permanently.
798 +------------------------------------------------+---------------------------------------------------------+
799 | Unix, Cygwin (bash/tcsh) | Windows |
800 +================================================+=========================================================+
801 | .. container:: | .. container:: |
803 | .. container:: content | .. container:: content |
805 | .. code:: | .. code:: |
806 | :number-lines: | :number-lines: |
808 | # export APEX_USER=apexuser | >set APEX_HOME=C:\apex\apex-full-2.0.0-SNAPSHOT |
809 | # cd /opt/app/policy/apex-pdp | |
810 | # export APEX_HOME=`pwd` | |
812 +------------------------------------------------+ |
815 | .. container:: content | |
820 | # setenv APEX_USER apexuser | |
821 | # cd /opt/app/policy/apex-pdp | |
822 | # setenv APEX_HOME `pwd` | |
824 +------------------------------------------------+---------------------------------------------------------+
825 | .. container:: | .. container:: |
827 | .. container:: content | .. container:: content |
829 | .. code:: | .. code:: |
830 | :number-lines: | :number-lines: |
832 | # env | grep APEX | >set APEX_HOME |
833 | # APEX_USER=apexuser | APEX_HOME=\apex\apex-full-2.0.0-SNAPSHOT |
834 | # APEX_HOME=/opt/app/policy/apex-pdp | |
836 +------------------------------------------------+---------------------------------------------------------+
838 Making Environment Settings Permanent (Unix, Cygwin)
839 ====================================================
841 .. container:: paragraph
843 For a per-user setting, edit the a user’s ``bash`` or ``tcsh``
844 settings in ``~/.bashrc`` or ``~/.tcshrc``. For system-wide
845 settings, edit ``/etc/profiles`` (requires permissions).
847 Making Environment Settings Permanent (Windows)
848 ===============================================
850 .. container:: paragraph
856 - Click on the **Start** Menu
858 - Right click on **Computer**
860 - Select **Properties**
862 .. container:: paragraph
868 - Click on the **Start** Menu
872 .. container:: paragraph
874 Then do the following
878 - Select **Advanced System Settings**
880 - On the **Advanced** tab, click the **Environment Variables**
883 - Edit an existing variable, or create a new System variable:
884 'Variable name'="APEX_HOME", 'Variable
885 value'="C:\apex\apex-full-2.0.0-SNAPSHOT"
887 .. container:: paragraph
889 For the settings to take effect, an application needs to be
890 restarted (e.g. any open ``cmd`` window).
892 Edit the APEX Logging Settings
893 ##############################
895 .. container:: paragraph
897 Configure the APEX logging settings to your requirements, for
902 - change the directory where logs are written to, or
904 - change the log levels
906 .. container:: paragraph
908 Edit the file ``$APEX_HOME/etc/logback.xml`` for any required
909 changes. To change the log directory change the line
911 .. container:: paragraph
913 ``<property name="logDir" value="/var/log/onap/policy/apex-pdp/" />``
915 .. container:: paragraph
919 .. container:: paragraph
921 ``<property name="logDir" value="/PATH/TO/LOG/DIRECTORY/" />``
923 .. container:: paragraph
925 On Windows, it is recommended to change the log directory to:
927 .. container:: paragraph
929 ``<property name="logDir" value="C:/apex/apex-full-2.0.0-SNAPSHOT/logs" />``
931 .. container:: paragraph
933 Note: Be careful about when to use ``\`` vs. ``/`` as the path
936 Create Directories for Logging
937 ##############################
939 .. container:: paragraph
941 Make sure that the log directory exists. This is important when
942 APEX was installed manually or when the log directory was changed
943 in the settings (see above).
945 +-----------------------------------------------------------------------+-------------------------------------------------------+
946 | Unix, Cygwin | Windows |
947 +=======================================================================+=======================================================+
948 | .. container:: | .. container:: |
950 | .. container:: content | .. container:: content |
952 | .. code:: | .. code:: |
953 | :number-lines: | :number-lines: |
955 | sudo mkdir -p /var/log/onap/policy/apex-pdp | >mkdir C:\apex\apex-full-2.0.0-SNAPSHOT\logs |
956 | sudo chown -R apexuser:apexuser /var/log/onap/policy/apex-pdp | |
957 +-----------------------------------------------------------------------+-------------------------------------------------------+
959 Verify the APEX Installation
960 ----------------------------
962 .. container:: paragraph
964 When APEX is installed and all settings are realized, the
965 installation can be verified.
967 Verify Installation - run Engine
968 ################################
970 .. container:: paragraph
972 A simple verification of an APEX installation can be done by
973 simply starting the APEX engine without any configuration. On
974 Unix (or Cygwin) start the engine using
975 ``$APEX_HOME/bin/apexEngine.sh``. On Windows start the engine
976 using ``%APEX_HOME%\bin\apexEngine.bat``. The engine will fail
977 to fully start. However, if the output looks similar to the
978 following line, the APEX installation is realized.
980 .. container:: listingblock
982 .. container:: content
987 Starting Apex service with parameters [] . . .
988 start of Apex service failed: Apex configuration file was not specified as an argument
989 2018-09-03 13:11:33,914 Apex [main] ERROR o.o.p.a.service.engine.main.ApexMain - start of Apex service failed
990 org.onap.policy.apex.model.basicmodel.concepts.ApexException: Apex configuration file was not specified as an argument
991 at org.onap.policy.apex.service.engine.main.ApexCommandLineArguments.validateReadableFile(ApexCommandLineArguments.java:267)
992 at org.onap.policy.apex.service.engine.main.ApexCommandLineArguments.validate(ApexCommandLineArguments.java:161)
993 at org.onap.policy.apex.service.engine.main.ApexMain.<init>(ApexMain.java:68)
994 at org.onap.policy.apex.service.engine.main.ApexMain.main(ApexMain.java:165)
995 usage: org.onap.policy.apex.service.engine.main.ApexMain [options...]
997 -c,--config-file <CONFIG_FILE>the full path to the configuration file to use, the configuration file must be a Json file
998 containing the Apex configuration parameters
999 -h,--help outputs the usage of this command
1000 -m,--model-file <MODEL_FILE> the full path to the model file to use, if set it overrides the model file set in the
1002 -v,--version outputs the version of Apex
1004 Verify Installation - run an Example
1005 ####################################
1007 .. container:: paragraph
1009 A full APEX installation comes with several examples. Here, we can
1010 fully verify the installation by running one of the examples.
1012 .. container:: paragraph
1014 We use the example called *SampleDomain* and configure the engine
1015 to use standard in and standard out for events. Run the engine
1016 with the provided configuration. Note: Cygwin executes scripts as
1017 Unix scripts but runs Java as a Windows application, thus the
1018 configuration file must be given as a Windows path.
1020 .. container:: paragraph
1022 On Unix/Linux flavoured platforms, give the commands below:
1024 .. container:: listingblock
1026 .. container:: content
1032 export APEX_HOME <path to apex installation>
1033 export APEX_USER apexuser
1035 .. container:: paragraph
1037 You can now try to run apex.
1039 .. container:: listingblock
1041 .. container:: content
1046 # $APEX_HOME/bin/apexEngine.sh -c $APEX_HOME/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json (1)
1047 # $APEX_HOME/bin/apexEngine.sh -c C:/apex/apex-full-2.0.0-SNAPSHOT/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json (2)
1048 >%APEX_HOME%\bin\apexEngine.bat -c %APEX_HOME%\examples\config\SampleDomain\Stdin2StdoutJsonEventJava.json :: (3)
1050 .. container:: colist arabic
1060 .. container:: paragraph
1062 The engine should start successfully. Assuming the logging levels are set to ``info`` in the built system, the output
1063 should look similar to this (last few lines)
1065 .. container:: listingblock
1067 .. container:: content
1072 Starting Apex service with parameters [-c, v:/dev/ericsson/apex/onap/apex-pdp/packages/apex-pdp-package-full/target/install_hierarchy/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json] . . .
1073 2018-09-05 15:16:42,800 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-0:0.0.1 .
1074 2018-09-05 15:16:42,804 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-1:0.0.1 .
1075 2018-09-05 15:16:42,804 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-2:0.0.1 .
1076 2018-09-05 15:16:42,805 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-3:0.0.1 .
1077 2018-09-05 15:16:42,805 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - APEX service created.
1078 2018-09-05 15:16:43,962 Apex [main] INFO o.o.p.a.s.e.e.EngDepMessagingService - engine<-->deployment messaging starting . . .
1079 2018-09-05 15:16:43,963 Apex [main] INFO o.o.p.a.s.e.e.EngDepMessagingService - engine<-->deployment messaging started
1080 2018-09-05 15:16:44,987 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Registering apex model on engine MyApexEngine-0:0.0.1
1081 2018-09-05 15:16:45,112 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Registering apex model on engine MyApexEngine-1:0.0.1
1082 2018-09-05 15:16:45,113 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Registering apex model on engine MyApexEngine-2:0.0.1
1083 2018-09-05 15:16:45,113 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Registering apex model on engine MyApexEngine-3:0.0.1
1084 2018-09-05 15:16:45,120 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Added the action listener to the engine
1085 Started Apex service
1087 .. container:: paragraph
1089 Important are the last two line, stating that APEX has added the
1090 final action listener to the engine and that the engine is started.
1092 .. container:: paragraph
1094 The engine is configured to read events from standard input and write
1095 produced events to standard output. The policy model is a very simple
1098 .. container:: paragraph
1100 The following table shows an input event in the left column and an
1101 output event in the right column. Past the input event into the
1102 console where APEX is running, and the output event should appear in
1103 the console. Pasting the input event multiple times will produce
1104 output events with different values.
1106 +-------------------------------------------------------------+-------------------------------------------------------------+
1107 | Input Event | Example Output Event |
1108 +=============================================================+=============================================================+
1109 | .. container:: | .. container:: |
1111 | .. container:: content | .. container:: content |
1113 | .. code:: | .. code:: |
1114 | :number-lines: | :number-lines: |
1117 | "nameSpace": "org.onap.policy.apex.sample.events", | "name": "Event0004", |
1118 | "name": "Event0000", | "version": "0.0.1", |
1119 | "version": "0.0.1", | "nameSpace": "org.onap.policy.apex.sample.events", |
1120 | "source": "test", | "source": "Act", |
1121 | "target": "apex", | "target": "Outside", |
1122 | "TestSlogan": "Test slogan for External Event0", | "TestActCaseSelected": 2, |
1123 | "TestMatchCase": 0, | "TestActStateTime": 1536157104627, |
1124 | "TestTimestamp": 1469781869269, | "TestDecideCaseSelected": 0, |
1125 | "TestTemperature": 9080.866 | "TestDecideStateTime": 1536157104625, |
1126 | } | "TestEstablishCaseSelected": 0, |
1127 | | "TestEstablishStateTime": 1536157104623, |
1128 | | "TestMatchCase": 0, |
1129 | | "TestMatchCaseSelected": 1, |
1130 | | "TestMatchStateTime": 1536157104620, |
1131 | | "TestSlogan": "Test slogan for External Event0", |
1132 | | "TestTemperature": 9080.866, |
1133 | | "TestTimestamp": 1469781869269 |
1135 +-------------------------------------------------------------+-------------------------------------------------------------+
1137 .. container:: paragraph
1139 Terminate APEX by simply using ``CTRL+C`` in the console.
1141 Verify a Full Installation - REST Editor
1142 ########################################
1144 .. container:: paragraph
1146 APEX has a REST application for viewing policy models. The
1147 application can also be used to create new policy models close to
1148 the engine native policy language. Start the REST editor as
1151 .. container:: listingblock
1153 .. container:: content
1158 # $APEX_HOME/bin/apexApps.sh rest-editor
1160 .. container:: listingblock
1162 .. container:: content
1167 >%APEX_HOME%\bin\apexApps.bat rest-editor
1169 .. container:: paragraph
1171 The script will start a simple web server
1172 (`Grizzly <https://javaee.github.io/grizzly/>`__) and deploy a
1173 ``war`` web archive in it. Once the editor is started, it will be
1174 available on ``localhost:18989``. The last few line of the messages
1177 .. container:: listingblock
1179 .. container:: content
1184 Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
1185 Sep 05, 2018 10:35:57 PM org.glassfish.grizzly.http.server.NetworkListener start
1186 INFO: Started listener bound to [localhost:18989]
1187 Sep 05, 2018 10:35:57 PM org.glassfish.grizzly.http.server.HttpServer start
1188 INFO: [HttpServer] Started.
1189 Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
1191 .. container:: paragraph
1193 Now open a browser (Firefox, Chrome, Opera, Internet Explorer) and
1194 use the URL ``http://localhost:18989/``. This will connect the
1195 browser to the started REST editor. The start screen should be as
1198 .. container:: imageblock
1200 .. container:: content
1202 |REST Editor Start Screen|
1204 .. container:: title
1206 Figure 1. REST Editor Start Screen
1208 .. container:: paragraph
1210 Now load a policy model by clicking the menu ``File`` and then
1211 ``Open``. In the opened dialog, go to the directory where APEX is
1212 installed, then ``examples``, ``models``, ``SampleDomain``, and there
1213 select the file ``SamplePolicyModelJAVA.json``. This will load the
1214 policy model used to verify the policy engine (see above). Once
1215 loaded, the screen should look as follows.
1217 .. container:: imageblock
1219 .. container:: content
1221 |REST Editor with loaded SampleDomain Policy Model|
1223 .. container:: title
1225 Figure 2. REST Editor with loaded SampleDomain Policy Model
1227 .. container:: paragraph
1229 Now you can use the REST editor. To finish this verification, simply
1230 terminate your browser (or the tab), and then use ``CTRL+C`` in the
1231 console where you started the REST editor.
1233 Installing WAR Applications
1234 ---------------------------
1236 .. container:: paragraph
1238 APEX comes with a set of WAR files. These are complete
1239 applications that can be installed and run in an application
1240 server. All of these applications are realized as servlets. You
1241 can find the WAR applications in ``$APEX_HOME/war`` (UNIX, Cygwin)
1242 or ``%APEX_HOME%\war`` (Windows).
1244 .. container:: paragraph
1246 Installing and using the WAR applications requires a web server
1247 that can execute ``war`` web archives. We recommend to use `Apache
1248 Tomcat <https://tomcat.apache.org/>`__, however other web servers
1249 can be used as well.
1251 .. container:: paragraph
1253 Install Apache Tomcat including the ``Manager App``, see `V9.0
1254 Docs <https://tomcat.apache.org/tomcat-9.0-doc/manager-howto.html#Configuring_Manager_Application_Access>`__
1255 for details. Start the Tomcat service, or make sure that Tomcat is
1258 .. container:: paragraph
1260 There are multiple ways to install the APEX WAR applications:
1262 .. container:: ulist
1264 - copy the ``.war`` file into the Tomcat ``webapps`` folder
1266 - use the Tomcat ``Manager App`` to deploy via the web interface
1268 - deploy using a REST call to Tomcat
1270 .. container:: paragraph
1272 For details on how to install ``war`` files please consult the
1274 Documentation <https://tomcat.apache.org/tomcat-9.0-doc/index.html>`__
1276 HOW-TO <https://tomcat.apache.org/tomcat-9.0-doc/manager-howto.html>`__.
1277 Once you installed an APEX WAR application (and wait for
1278 sufficient time for Tomcat to finalize the installation), open the
1279 ``Manager App`` in Tomcat. You should see the APEX WAR application
1280 being installed and running.
1282 .. container:: paragraph
1284 In case of errors, examine the log files in the Tomcat log
1285 directory. In a conventional install, those log files are in the
1286 logs directory where Tomcat is installed.
1288 .. container:: paragraph
1290 The current APEX version provides the following WAR applications:
1292 .. container:: ulist
1294 - client-deployment-2.0.0-SNAPSHOT.war - a client to deploy new
1295 policy models to a running engine
1297 - client-editor-2.0.0-SNAPSHOT.war - the standard policy REST
1300 - client-monitoring-2.0.0-SNAPSHOT.war - a client for monitoring
1301 a running APEX engine
1303 - client-full-2.0.0-SNAPSHOT.war - a full client with a
1304 one-stop-access to deployment, monitoring, and REST editor
1306 - examples-servlet-2.0.0-SNAPSHOT.war - an example APEX servlet
1308 Running APEX in Docker
1309 ----------------------
1311 .. container:: paragraph
1313 Since APEX is in ONAP, we provide a full virtualization
1314 environment for the engine.
1319 .. container:: paragraph
1321 Running APEX from the ONAP docker repository only requires 2
1324 .. container:: olist arabic
1326 #. Log into the ONAP docker repo
1328 .. container:: listingblock
1330 .. container:: content
1334 docker login -u docker -p docker nexus3.onap.org:10003
1336 .. container:: olist arabic
1338 #. Run the APEX docker image
1340 .. container:: listingblock
1342 .. container:: content
1346 docker run -it --rm nexus3.onap.org:10003/onap/policy-apex-pdp:latest
1348 Build a Docker Image
1349 ####################
1351 .. container:: paragraph
1353 Alternatively, one can use the Dockerfile defined in the Docker
1354 package to build an image.
1356 .. container:: listingblock
1358 .. container:: title
1362 .. container:: content
1368 # Docker file to build an image that runs APEX on Java 8 in Ubuntu
1372 RUN apt-get update && \
1373 apt-get upgrade -y && \
1374 apt-get install -y software-properties-common && \
1375 add-apt-repository ppa:openjdk-r/ppa -y && \
1377 apt-get install -y openjdk-8-jdk
1379 # Create apex user and group
1380 RUN groupadd apexuser
1381 RUN useradd --create-home -g apexuser apexuser
1383 # Add Apex-specific directories and set ownership as the Apex admin user
1384 RUN mkdir -p /opt/app/policy/apex-pdp
1385 RUN mkdir -p /var/log/onap/policy/apex-pdp
1386 RUN chown -R apexuser:apexuser /var/log/onap/policy/apex-pdp
1388 # Unpack the tarball
1390 COPY apex-pdp-package-full.tar.gz /packages
1391 RUN tar xvfz /packages/apex-pdp-package-full.tar.gz --directory /opt/app/policy/apex-pdp
1392 RUN rm /packages/apex-pdp-package-full.tar.gz
1394 # Ensure everything has the correct permissions
1395 RUN find /opt/app -type d -perm 755
1396 RUN find /opt/app -type f -perm 644
1397 RUN chmod a+x /opt/app/policy/apex-pdp/bin/*
1399 # Copy examples to Apex user area
1400 RUN cp -pr /opt/app/policy/apex-pdp/examples /home/apexuser
1404 RUN chown -R apexuser:apexuser /home/apexuser/*
1407 ENV PATH /opt/app/policy/apex-pdp/bin:$PATH
1408 WORKDIR /home/apexuser
1410 APEX Configurations Explained
1411 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1413 Introduction to APEX Configuration
1414 ----------------------------------
1416 .. container:: paragraph
1418 An APEX engine can be configured to use various combinations
1419 of event input handlers, event output handlers, event
1420 protocols, context handlers, and logic executors. The system
1421 is build using a plugin architecture. Each configuration
1422 option is realized by a plugin, which can be loaded and
1423 configured when the engine is started. New plugins can be
1424 added to the system at any time, though to benefit from a
1425 new plugin an engine will need to be restarted.
1427 .. container:: imageblock
1429 .. container:: content
1431 |APEX Configuration Matrix|
1433 .. container:: title
1435 Figure 3. APEX Configuration Matrix
1437 .. container:: paragraph
1439 The APEX distribution already comes with a number of
1440 plugins. The figure above shows the provided plugins. Any
1441 combination of input, output, event protocol, context
1442 handlers, and executors is possible.
1444 General Configuration Format
1445 ----------------------------
1447 .. container:: paragraph
1449 The APEX configuration file is a JSON file containing a few
1450 main blocks for different parts of the configuration. Each
1451 block then holds the configuration details. The following
1452 code shows the main blocks:
1454 .. container:: listingblock
1456 .. container:: content
1461 "engineServiceParameters":{
1463 "engineParameters":{ (2)
1464 "executorParameters":{...}, (3)
1465 "contextParameters":{...} (4)
1466 "taskParameters":[...] (5)
1469 "eventInputParameters":{ (6)
1471 "carrierTechnologyParameters":{...},
1472 "eventProtocolParameters":{...}
1475 "carrierTechnologyParameters":{...},
1476 "eventProtocolParameters":{...}
1480 "eventOutputParameters":{ (10)
1482 "carrierTechnologyParameters":{...},
1483 "eventProtocolParameters":{...}
1486 "carrierTechnologyParameters":{...},
1487 "eventProtocolParameters":{...}
1493 .. container:: colist arabic
1495 +-----------------------------------+-----------------------------------+
1496 | **1** | main engine configuration |
1497 +-----------------------------------+-----------------------------------+
1498 | **2** | engine parameters for plugin |
1499 | | configurations (execution |
1500 | | environments and context |
1502 +-----------------------------------+-----------------------------------+
1503 | **3** | engine specific parameters, |
1504 | | mainly for executor plugins |
1505 +-----------------------------------+-----------------------------------+
1506 | **4** | context specific parameters, e.g. |
1507 | | for context schemas, persistence, |
1509 +-----------------------------------+-----------------------------------+
1510 | **5** | list of task parameters that |
1511 | | should be made available in task |
1512 | | logic (optional). |
1513 +-----------------------------------+-----------------------------------+
1514 | **6** | configuration of the input |
1516 +-----------------------------------+-----------------------------------+
1517 | **7** | an example input called |
1518 | | ``input1`` with carrier |
1519 | | technology and event protocol |
1520 +-----------------------------------+-----------------------------------+
1521 | **8** | an example input called |
1522 | | ``input2`` with carrier |
1523 | | technology and event protocol |
1524 +-----------------------------------+-----------------------------------+
1525 | **9** | any further input configuration |
1526 +-----------------------------------+-----------------------------------+
1527 | **10** | configuration of the output |
1529 +-----------------------------------+-----------------------------------+
1530 | **11** | an example output called |
1531 | | ``output1`` with carrier |
1532 | | technology and event protocol |
1533 +-----------------------------------+-----------------------------------+
1534 | **12** | an example output called |
1535 | | ``output2`` with carrier |
1536 | | technology and event protocol |
1537 +-----------------------------------+-----------------------------------+
1538 | **13** | any further output configuration |
1539 +-----------------------------------+-----------------------------------+
1541 Engine Service Parameters
1542 -------------------------
1544 .. container:: paragraph
1546 The configuration provides a number of parameters to
1547 configure the engine. An example configuration with
1548 explanations of all options is shown below.
1550 .. container:: listingblock
1552 .. container:: content
1556 "engineServiceParameters" : {
1557 "name" : "AADMApexEngine", (1)
1558 "version" : "0.0.1", (2)
1560 "instanceCount" : 4, (4)
1561 "deploymentPort" : 12345, (5)
1562 "policyModelFileName" : "examples/models/VPN/VPNPolicyModelJava.json", (6)
1563 "periodicEventPeriod": 1000, (7)
1564 "engineParameters":{ (8)
1565 "executorParameters":{...}, (9)
1566 "contextParameters":{...}, (10)
1567 "taskParameters":[...] (11)
1571 .. container:: colist arabic
1573 +-----------------------------------+-----------------------------------+
1574 | **1** | a name for the engine. The engine |
1575 | | name is used to create a key in a |
1576 | | runtime engine. An name matching |
1577 | | the following regular expression |
1578 | | can be used here: |
1579 | | ``[A-Za-z0-9\\-_\\.]+`` |
1580 +-----------------------------------+-----------------------------------+
1581 | **2** | a version of the engine, use |
1582 | | semantic versioning as explained |
1583 | | here: `Semantic |
1584 | | Versioning <http://semver.org/>`_ |
1586 | | This version is used in a runtime |
1587 | | engine to create a version of the |
1588 | | engine. For that reason, the |
1589 | | version must match the following |
1590 | | regular expression ``[A-Z0-9.]+`` |
1591 +-----------------------------------+-----------------------------------+
1592 | **3** | a numeric identifier for the |
1594 +-----------------------------------+-----------------------------------+
1595 | **4** | the number of threads (policy |
1596 | | instances executed in parallel) |
1597 | | the engine should use, use ``1`` |
1598 | | for single threaded engines |
1599 +-----------------------------------+-----------------------------------+
1600 | **5** | the port for the deployment |
1601 | | Websocket connection to the |
1603 +-----------------------------------+-----------------------------------+
1604 | **6** | the model file to load into the |
1605 | | engine on startup (optional) |
1606 +-----------------------------------+-----------------------------------+
1607 | **7** | an optional timer for periodic |
1608 | | policies, in milliseconds (a |
1609 | | defined periodic policy will be |
1610 | | executed every ``X`` |
1611 | | milliseconds), not used of not |
1613 +-----------------------------------+-----------------------------------+
1614 | **8** | engine parameters for plugin |
1615 | | configurations (execution |
1616 | | environments and context |
1618 +-----------------------------------+-----------------------------------+
1619 | **9** | engine specific parameters, |
1620 | | mainly for executor plugins |
1621 +-----------------------------------+-----------------------------------+
1622 | **10** | context specific parameters, e.g. |
1623 | | for context schemas, persistence, |
1625 +-----------------------------------+-----------------------------------+
1626 | **11** | list of task parameters that |
1627 | | should be made available in task |
1628 | | logic (optional). |
1629 +-----------------------------------+-----------------------------------+
1631 .. container:: paragraph
1633 The model file is optional, it can also be specified via
1634 command line. In any case, make sure all execution and other
1635 required plug-ins for the loaded model are loaded as
1638 Input and Output Interfaces
1639 ---------------------------
1641 .. container:: paragraph
1643 An APEX engine has two main interfaces:
1645 .. container:: ulist
1647 - An *input* interface to receive events: also known as
1648 ingress interface or consumer, receiving (consuming)
1649 events commonly named triggers, and
1651 - An *output* interface to publish produced events: also
1652 known as egress interface or producer, sending
1653 (publishing) events commonly named actions or action
1656 .. container:: paragraph
1658 The input and output interface is configured in terms of
1659 inputs and outputs, respectively. Each input and output is a
1660 combination of a carrier technology and an event protocol.
1661 Carrier technologies and event protocols are provided by
1662 plugins, each with its own specific configuration. Most
1663 carrier technologies can be configured for input as well as
1664 output. Most event protocols can be used for all carrier
1665 technologies. One exception is the JMS object event
1666 protocol, which can only be used for the JMS carrier
1667 technology. Some further restrictions apply (for instance
1668 for carrier technologies using bi- or uni-directional
1671 .. container:: paragraph
1673 Input and output interface can be configured separately, in
1674 isolation, with any number of carrier technologies. The
1675 resulting general configuration options are:
1677 .. container:: ulist
1679 - Input interface with one or more inputs
1681 .. container:: ulist
1683 - each input with a carrier technology and an event
1686 - some inputs with optional synchronous mode
1688 - some event protocols with additional parameters
1690 - Output interface with one or more outputs
1692 .. container:: ulist
1694 - each output with a carrier technology and an event
1697 - some outputs with optional synchronous mode
1699 - some event protocols with additional parameters
1701 .. container:: paragraph
1703 The configuration for input and output is contained in
1704 ``eventInputParameters`` and ``eventOutputParameters``,
1705 respectively. Inside here, one can configure any number of
1706 inputs and outputs. Each of them needs to have a unique
1707 identifier (name), the content of the name is free form. The
1708 example below shows a configuration for two inputs and two
1711 .. container:: listingblock
1713 .. container:: content
1717 "eventInputParameters": { (1)
1718 "FirstConsumer": { (2)
1719 "carrierTechnologyParameters" : {...}, (3)
1720 "eventProtocolParameters":{...}, (4)
1723 "SecondConsumer": { (6)
1724 "carrierTechnologyParameters" : {...}, (7)
1725 "eventProtocolParameters":{...}, (8)
1729 "eventOutputParameters": { (10)
1730 "FirstProducer": { (11)
1731 "carrierTechnologyParameters":{...}, (12)
1732 "eventProtocolParameters":{...}, (13)
1735 "SecondProducer": { (15)
1736 "carrierTechnologyParameters":{...}, (16)
1737 "eventProtocolParameters":{...}, (17)
1742 .. container:: colist arabic
1744 +--------+--------------------------------------------------------------------+
1745 | **1** | input interface configuration, APEX input plugins |
1746 +--------+--------------------------------------------------------------------+
1747 | **2** | first input called ``FirstConsumer`` |
1748 +--------+--------------------------------------------------------------------+
1749 | **3** | carrier technology for plugin |
1750 +--------+--------------------------------------------------------------------+
1751 | **4** | event protocol for plugin |
1752 +--------+--------------------------------------------------------------------+
1753 | **5** | any other input configuration (e.g. event name filter, see below) |
1754 +--------+--------------------------------------------------------------------+
1755 | **6** | second input called ``SecondConsumer`` |
1756 +--------+--------------------------------------------------------------------+
1757 | **7** | carrier technology for plugin |
1758 +--------+--------------------------------------------------------------------+
1759 | **8** | event protocol for plugin |
1760 +--------+--------------------------------------------------------------------+
1761 | **9** | any other plugin configuration |
1762 +--------+--------------------------------------------------------------------+
1763 | **10** | output interface configuration, APEX output plugins |
1764 +--------+--------------------------------------------------------------------+
1765 | **11** | first output called ``FirstProducer`` |
1766 +--------+--------------------------------------------------------------------+
1767 | **12** | carrier technology for plugin |
1768 +--------+--------------------------------------------------------------------+
1769 | **13** | event protocol for plugin |
1770 +--------+--------------------------------------------------------------------+
1771 | **14** | any other plugin configuration |
1772 +--------+--------------------------------------------------------------------+
1773 | **15** | second output called ``SecondProducer`` |
1774 +--------+--------------------------------------------------------------------+
1775 | **16** | carrier technology for plugin |
1776 +--------+--------------------------------------------------------------------+
1777 | **17** | event protocol for plugin |
1778 +--------+--------------------------------------------------------------------+
1779 | **18** | any other output configuration (e.g. event name filter, see below) |
1780 +--------+--------------------------------------------------------------------+
1785 .. container:: paragraph
1787 APEX will always send an event after a policy execution
1788 is finished. For a successful execution, the event sent
1789 is the output event created by the policy. In case the
1790 policy does not create an output event, APEX will create
1791 a new event with all input event fields plus an
1792 additional field ``exceptionMessage`` with an exception
1795 .. container:: paragraph
1797 There are situations in which this auto-generated error
1798 event might not be required or wanted:
1800 .. container:: ulist
1802 - when a policy failing should not result in an event
1803 send out via an output interface
1805 - when the auto-generated event goes back in an APEX
1806 engine (or the same APEX engine), this can create
1809 - the auto-generated event should go to a special output
1810 interface or channel
1812 .. container:: paragraph
1814 All of these situations are supported by a filter option
1815 using a wildecard (regular expression) configuration on
1816 APEX I/O interfaces. The parameter is called
1817 ``eventNameFilter`` and the value are `Java regular
1818 expressions <https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html>`__
1820 `tutorial <http://www.vogella.com/tutorials/JavaRegularExpressions/article.html>`__).
1821 The following code shows some examples:
1823 .. container:: listingblock
1825 .. container:: content
1829 "eventInputParameters": {
1831 "carrierTechnologyParameters" : {...},
1832 "eventProtocolParameters":{...},
1833 "eventNameFilter" : "^E[Vv][Ee][Nn][Tt][0-9]004$" (1)
1836 "eventOutputParameters": {
1838 "carrierTechnologyParameters":{...},
1839 "eventProtocolParameters":{...},
1840 "eventNameFilter" : "^E[Vv][Ee][Nn][Tt][0-9]104$" (2)
1847 .. container:: paragraph
1849 Executors are plugins that realize the execution of logic
1850 contained in a policy model. Logic can be in a task
1851 selector, a task, and a state finalizer. Using plugins for
1852 execution environments makes APEX very flexible to support
1853 virtually any executable logic expressions.
1855 .. container:: paragraph
1857 APEX 2.0.0-SNAPSHOT supports the following executors:
1859 .. container:: ulist
1861 - Java, for Java implemented logic
1863 .. container:: ulist
1865 - This executor requires logic implemented using the
1866 APEX Java interfaces.
1868 - Generated JAR files must be in the classpath of the
1869 APEX engine at start time.
1879 .. container:: ulist
1881 - This executor uses the latest version of the MVEL
1882 engine, which can be very hard to debug and can
1883 produce unwanted side effects during execution
1885 Configure the Javascript Executor
1886 #################################
1888 .. container:: paragraph
1890 The Javascript executor is added to the configuration as
1893 .. container:: listingblock
1895 .. container:: content
1899 "engineServiceParameters":{
1900 "engineParameters":{
1901 "executorParameters":{
1903 "parameterClassName" :
1904 "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
1910 Configure the Jython Executor
1911 #############################
1913 .. container:: paragraph
1915 The Jython executor is added to the configuration as
1918 .. container:: listingblock
1920 .. container:: content
1924 "engineServiceParameters":{
1925 "engineParameters":{
1926 "executorParameters":{
1928 "parameterClassName" :
1929 "org.onap.policy.apex.plugins.executor.jython.JythonExecutorParameters"
1935 Configure the JRuby Executor
1936 ############################
1938 .. container:: paragraph
1940 The JRuby executor is added to the configuration as
1943 .. container:: listingblock
1945 .. container:: content
1949 "engineServiceParameters":{
1950 "engineParameters":{
1951 "executorParameters":{
1953 "parameterClassName" :
1954 "org.onap.policy.apex.plugins.executor.jruby.JrubyExecutorParameters"
1960 Configure the Java Executor
1961 ###########################
1963 .. container:: paragraph
1965 The Java executor is added to the configuration as
1968 .. container:: listingblock
1970 .. container:: content
1974 "engineServiceParameters":{
1975 "engineParameters":{
1976 "executorParameters":{
1978 "parameterClassName" :
1979 "org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters"
1985 Configure the MVEL Executor
1986 ###########################
1988 .. container:: paragraph
1990 The MVEL executor is added to the configuration as
1993 .. container:: listingblock
1995 .. container:: content
1999 "engineServiceParameters":{
2000 "engineParameters":{
2001 "executorParameters":{
2003 "parameterClassName" :
2004 "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters"
2013 .. container:: paragraph
2015 Context handlers are responsible for all context processing.
2016 There are the following main areas:
2018 .. container:: ulist
2020 - Context schema: use schema handlers other than Java class
2021 (supported by default without configuration)
2023 - Context distribution: distribute context across multiple
2026 - Context locking: mechanisms to lock context elements for
2029 - Context persistence: mechanisms to persist context
2031 .. container:: paragraph
2033 APEX provides plugins for each of the main areas.
2035 Configure AVRO Schema Handler
2036 #############################
2038 .. container:: paragraph
2040 The AVRO schema handler is added to the configuration as
2043 .. container:: listingblock
2045 .. container:: content
2049 "engineServiceParameters":{
2050 "engineParameters":{
2051 "contextParameters":{
2052 "parameterClassName" : "org.onap.policy.apex.context.parameters.ContextParameters",
2053 "schemaParameters":{
2055 "parameterClassName" :
2056 "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
2063 .. container:: paragraph
2065 Using the AVRO schema handler has one limitation: AVRO
2066 only supports field names that represent valid Java class
2067 names. This means only letters and the character ``_``
2068 are supported. Characters commonly used in field names,
2069 such as ``.`` and ``-``, are not supported by AVRO. for
2070 more information see `Avro Spec:
2071 Names <https://avro.apache.org/docs/1.8.1/spec.html#names>`__.
2073 .. container:: paragraph
2075 To work with this limitation, the APEX Avro plugin will
2076 parse a given AVRO definition and replace *all*
2077 occurrences of ``.`` and ``-`` with a ``_``. This means
2080 .. container:: ulist
2082 - In a policy model, if the AVRO schema defined a field
2083 as ``my-name`` the policy logic should access it as
2086 - In a policy model, if the AVRO schema defined a field
2087 as ``my.name`` the policy logic should access it as
2090 - There should be no field names that convert to the
2093 .. container:: ulist
2095 - For instance the simultaneous use of
2096 ``my_name``, ``my.name``, and ``my-name`` should
2099 - If not avoided, the event processing might
2100 create unwanted side effects
2102 - If field names use any other not-supported character,
2103 the AVRO plugin will reject it
2105 .. container:: ulist
2107 - Since AVRO uses lazy initialization, this
2108 rejection might only become visible at runtime
2110 Configure Task Parameters
2111 #########################
2113 .. container:: paragraph
2115 The Task Parameters are added to the configuration as
2118 .. container:: listingblock
2120 .. container:: content
2124 "engineServiceParameters": {
2125 "engineParameters": {
2128 "key": "ParameterKey1",
2129 "value": "ParameterValue1"
2132 "taskId": "Task_Act0",
2133 "key": "ParameterKey2",
2134 "value": "ParameterValue2"
2140 .. container:: paragraph
2142 TaskParameters can be used to pass parameters from ApexConfig
2143 to the policy logic. In the config, these are optional.
2144 The list of task parameters provided in the config may be added
2145 to the tasks or existing task parameters in the task will be overriden.
2147 .. container:: paragraph
2149 If taskId is provided in ApexConfig for an entry, then that
2150 parameter is updated only for that particular task. Otherwise,
2151 the task parameter is added to all tasks.
2153 Carrier Technologies
2154 --------------------
2156 .. container:: paragraph
2158 Carrier technologies define how APEX receives (input) and
2159 sends (output) events. They can be used in any combination,
2160 using asynchronous or synchronous mode. There can also be
2161 any number of carrier technologies for the input (consume)
2162 and the output (produce) interface.
2164 .. container:: paragraph
2166 Supported *input* technologies are:
2168 .. container:: ulist
2170 - Standard input, read events from the standard input
2171 (console), not suitable for APEX background servers
2173 - File input, read events from a file
2175 - Kafka, read events from a Kafka system
2177 - Websockets, read events from a Websocket
2181 - REST (synchronous and asynchronous), additionally as
2184 - Event Requestor, allows reading of events that have been
2185 looped back into APEX
2187 .. container:: paragraph
2189 Supported *output* technologies are:
2191 .. container:: ulist
2193 - Standard output, write events to the standard output
2194 (console), not suitable for APEX background servers
2196 - File output, write events to a file
2198 - Kafka, write events to a Kafka system
2200 - Websockets, write events to a Websocket
2204 - REST (synchronous and asynchronous), additionally as
2207 - Event Requestor, allows events to be looped back into
2210 .. container:: paragraph
2212 New carrier technologies can be added as plugins to APEX or
2213 developed outside APEX and added to an APEX deployment.
2218 .. container:: paragraph
2220 Standard IO does not require a specific plugin, it is
2221 supported be default.
2225 .. container:: paragraph
2227 APEX will take events from its standard input. This
2228 carrier is good for testing, but certainly not for a
2229 use case where APEX runs as a server. The
2230 configuration is as follows:
2232 .. container:: listingblock
2234 .. container:: content
2238 "carrierTechnologyParameters" : {
2239 "carrierTechnology" : "FILE", (1)
2241 "standardIO" : true (2)
2245 .. container:: colist arabic
2247 +-------+---------------------------------------+
2248 | **1** | standard input is considered a file |
2249 +-------+---------------------------------------+
2250 | **2** | file descriptor set to standard input |
2251 +-------+---------------------------------------+
2256 .. container:: paragraph
2258 APEX will send events to its standard output. This
2259 carrier is good for testing, but certainly not for a
2260 use case where APEX runs as a server. The
2261 configuration is as follows:
2263 .. container:: listingblock
2265 .. container:: content
2269 "carrierTechnologyParameters" : {
2270 "carrierTechnology" : "FILE", (1)
2272 "standardIO" : true (2)
2276 .. container:: colist arabic
2278 +-------+----------------------------------------+
2279 | **1** | standard output is considered a file |
2280 +-------+----------------------------------------+
2281 | **2** | file descriptor set to standard output |
2282 +-------+----------------------------------------+
2287 .. container:: paragraph
2289 File IO does not require a specific plugin, it is
2290 supported be default.
2295 .. container:: paragraph
2297 APEX will take events from a file. The same file
2298 should not be used as an output. The configuration is
2301 .. container:: listingblock
2303 .. container:: content
2307 "carrierTechnologyParameters" : {
2308 "carrierTechnology" : "FILE", (1)
2310 "fileName" : "examples/events/SampleDomain/EventsIn.xmlfile" (2)
2314 .. container:: colist arabic
2316 +-------+------------------------------------------+
2317 | **1** | set file input |
2318 +-------+------------------------------------------+
2319 | **2** | the name of the file to read events from |
2320 +-------+------------------------------------------+
2324 .. container:: paragraph
2326 APEX will write events to a file. The same file should
2327 not be used as an input. The configuration is as
2330 .. container:: listingblock
2332 .. container:: content
2336 "carrierTechnologyParameters" : {
2337 "carrierTechnology" : "FILE", (1)
2339 "fileName" : "examples/events/SampleDomain/EventsOut.xmlfile" (2)
2343 .. container:: colist arabic
2345 +-------+-----------------------------------------+
2346 | **1** | set file output |
2347 +-------+-----------------------------------------+
2348 | **2** | the name of the file to write events to |
2349 +-------+-----------------------------------------+
2354 .. container:: paragraph
2356 Event Requestor IO does not require a specific plugin, it
2357 is supported be default. It should only be used with the
2358 APEX event protocol.
2360 Event Requestor Input
2361 =====================
2363 .. container:: paragraph
2365 APEX will take events from APEX.
2367 .. container:: listingblock
2369 .. container:: content
2373 "carrierTechnologyParameters" : {
2374 "carrierTechnology": "EVENT_REQUESTOR" (1)
2377 .. container:: colist arabic
2379 +-------+---------------------------+
2380 | **1** | set event requestor input |
2381 +-------+---------------------------+
2383 Event Requestor Output
2384 ======================
2386 .. container:: paragraph
2388 APEX will write events to APEX.
2390 .. container:: listingblock
2392 .. container:: content
2396 "carrierTechnologyParameters" : {
2397 "carrierTechnology": "EVENT_REQUESTOR" (1)
2400 Peering Event Requestors
2401 ========================
2403 .. container:: paragraph
2405 When using event requestors, they need to be peered.
2406 This means an event requestor output needs to be
2407 peered (associated) with an event requestor input. The
2408 following example shows the use of an event requestor
2409 with the APEX event protocol and the peering of output
2412 .. container:: listingblock
2414 .. container:: content
2418 "eventInputParameters": {
2419 "EventRequestorConsumer": {
2420 "carrierTechnologyParameters": {
2421 "carrierTechnology": "EVENT_REQUESTOR" (1)
2423 "eventProtocolParameters": {
2424 "eventProtocol": "APEX" (2)
2426 "eventNameFilter": "InputEvent", (3)
2427 "requestorMode": true, (4)
2428 "requestorPeer": "EventRequestorProducer", (5)
2429 "requestorTimeout": 500 (6)
2432 "eventOutputParameters": {
2433 "EventRequestorProducer": {
2434 "carrierTechnologyParameters": {
2435 "carrierTechnology": "EVENT_REQUESTOR" (7)
2437 "eventProtocolParameters": {
2438 "eventProtocol": "APEX" (8)
2440 "eventNameFilter": "EventListEvent", (9)
2441 "requestorMode": true, (10)
2442 "requestorPeer": "EventRequestorConsumer", (11)
2443 "requestorTimeout": 500 (12)
2447 .. container:: colist arabic
2449 +-----------------------------------+-----------------------------------+
2450 | **1** | event requestor on a consumer |
2451 +-----------------------------------+-----------------------------------+
2452 | **2** | with APEX event protocol |
2453 +-----------------------------------+-----------------------------------+
2454 | **3** | optional filter (best to use a |
2455 | | filter to prevent unwanted events |
2456 | | on the consumer side) |
2457 +-----------------------------------+-----------------------------------+
2458 | **4** | activate requestor mode |
2459 +-----------------------------------+-----------------------------------+
2460 | **5** | the peer to the output (must |
2461 | | match the output carrier) |
2462 +-----------------------------------+-----------------------------------+
2463 | **6** | an optional timeout in |
2465 +-----------------------------------+-----------------------------------+
2466 | **7** | event requestor on a producer |
2467 +-----------------------------------+-----------------------------------+
2468 | **8** | with APEX event protocol |
2469 +-----------------------------------+-----------------------------------+
2470 | **9** | optional filter (best to use a |
2471 | | filter to prevent unwanted events |
2472 | | on the consumer side) |
2473 +-----------------------------------+-----------------------------------+
2474 | **10** | activate requestor mode |
2475 +-----------------------------------+-----------------------------------+
2476 | **11** | the peer to the output (must |
2477 | | match the input carrier) |
2478 +-----------------------------------+-----------------------------------+
2479 | **12** | an optional timeout in |
2481 +-----------------------------------+-----------------------------------+
2486 .. container:: paragraph
2488 Kafka IO is supported by the APEX Kafka plugin. The
2489 configurations below are examples. APEX will take any
2490 configuration inside the parameter object and forward it
2491 to Kafka. More information on Kafka specific
2492 configuration parameters can be found in the Kafka
2495 .. container:: ulist
2498 Class <https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html>`__
2501 Class <https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html>`__
2505 .. container:: paragraph
2507 APEX will receive events from the Apache Kafka
2508 messaging system. The input is uni-directional, an
2509 engine will only receive events from the input but not
2510 send any event to the input.
2512 .. container:: listingblock
2514 .. container:: content
2518 "carrierTechnologyParameters" : {
2519 "carrierTechnology" : "KAFKA", (1)
2520 "parameterClassName" :
2521 "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
2523 "bootstrapServers" : "localhost:49092", (2)
2524 "groupId" : "apex-group-id", (3)
2525 "enableAutoCommit" : true, (4)
2526 "autoCommitTime" : 1000, (5)
2527 "sessionTimeout" : 30000, (6)
2528 "consumerPollTime" : 100, (7)
2529 "consumerTopicList" : ["apex-in-0", "apex-in-1"], (8)
2531 "org.apache.kafka.common.serialization.StringDeserializer", (9)
2532 "valueDeserializer" :
2533 "org.apache.kafka.common.serialization.StringDeserializer" (10)
2537 .. container:: colist arabic
2539 +--------+-------------------------------------+
2540 | **1** | set Kafka as carrier technology |
2541 +--------+-------------------------------------+
2542 | **2** | bootstrap server and port |
2543 +--------+-------------------------------------+
2544 | **3** | a group identifier |
2545 +--------+-------------------------------------+
2546 | **4** | flag for auto-commit |
2547 +--------+-------------------------------------+
2548 | **5** | auto-commit timeout in milliseconds |
2549 +--------+-------------------------------------+
2550 | **6** | session timeout in milliseconds |
2551 +--------+-------------------------------------+
2552 | **7** | consumer poll time in milliseconds |
2553 +--------+-------------------------------------+
2554 | **8** | consumer topic list |
2555 +--------+-------------------------------------+
2556 | **9** | key for the Kafka de-serializer |
2557 +--------+-------------------------------------+
2558 | **10** | value for the Kafka de-serializer |
2559 +--------+-------------------------------------+
2563 .. container:: paragraph
2565 APEX will send events to the Apache Kafka messaging
2566 system. The output is uni-directional, an engine will
2567 send events to the output but not receive any event
2570 .. container:: listingblock
2572 .. container:: content
2576 "carrierTechnologyParameters" : {
2577 "carrierTechnology" : "KAFKA", (1)
2578 "parameterClassName" :
2579 "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
2581 "bootstrapServers" : "localhost:49092", (2)
2584 "batchSize" : 16384, (5)
2585 "lingerTime" : 1, (6)
2586 "bufferMemory" : 33554432, (7)
2587 "producerTopic" : "apex-out", (8)
2589 "org.apache.kafka.common.serialization.StringSerializer", (9)
2591 "org.apache.kafka.common.serialization.StringSerializer" (10)
2595 .. container:: colist arabic
2597 +--------+---------------------------------+
2598 | **1** | set Kafka as carrier technology |
2599 +--------+---------------------------------+
2600 | **2** | bootstrap server and port |
2601 +--------+---------------------------------+
2602 | **3** | acknowledgement strategy |
2603 +--------+---------------------------------+
2604 | **4** | number of retries |
2605 +--------+---------------------------------+
2606 | **5** | batch size |
2607 +--------+---------------------------------+
2608 | **6** | time to linger in milliseconds |
2609 +--------+---------------------------------+
2610 | **7** | buffer memory in byte |
2611 +--------+---------------------------------+
2612 | **8** | producer topic |
2613 +--------+---------------------------------+
2614 | **9** | key for the Kafka serializer |
2615 +--------+---------------------------------+
2616 | **10** | value for the Kafka serializer |
2617 +--------+---------------------------------+
2622 .. container:: paragraph
2624 APEX supports the Java Messaging Service (JMS) as input
2625 as well as output. JMS IO is supported by the APEX JMS
2626 plugin. Input and output support an event encoding as
2627 text (JSON string) or object (serialized object). The
2628 input configuration is the same for both encodings, the
2629 output configuration differs.
2633 .. container:: paragraph
2635 APEX will receive events from a JMS messaging system.
2636 The input is uni-directional, an engine will only
2637 receive events from the input but not send any event
2640 .. container:: listingblock
2642 .. container:: content
2646 "carrierTechnologyParameters" : {
2647 "carrierTechnology" : "JMS", (1)
2648 "parameterClassName" :
2649 "org.onap.policy.apex.plugins.event.carrier.jms.JMSCarrierTechnologyParameters",
2650 "parameters" : { (2)
2651 "initialContextFactory" :
2652 "org.jboss.naming.remote.client.InitialContextFactory", (3)
2653 "connectionFactory" : "ConnectionFactory", (4)
2654 "providerURL" : "remote://localhost:5445", (5)
2655 "securityPrincipal" : "guest", (6)
2656 "securityCredentials" : "IAmAGuest", (7)
2657 "consumerTopic" : "jms/topic/apexIn" (8)
2661 .. container:: colist arabic
2663 +-----------------------------------+-----------------------------------+
2664 | **1** | set JMS as carrier technology |
2665 +-----------------------------------+-----------------------------------+
2666 | **2** | set all JMS specific parameters |
2667 +-----------------------------------+-----------------------------------+
2668 | **3** | the context factory, in this case |
2669 | | from JBOSS (it requires the |
2671 | | org.jboss:jboss-remote-naming:2.0 |
2673 | | or a different version to be in |
2674 | | the directory ``$APEX_HOME/lib`` |
2675 | | or ``%APEX_HOME%\lib`` |
2676 +-----------------------------------+-----------------------------------+
2677 | **4** | a connection factory for the JMS |
2679 +-----------------------------------+-----------------------------------+
2680 | **5** | URL with host and port of the JMS |
2682 +-----------------------------------+-----------------------------------+
2683 | **6** | access credentials, user name |
2684 +-----------------------------------+-----------------------------------+
2685 | **7** | access credentials, user password |
2686 +-----------------------------------+-----------------------------------+
2687 | **8** | the JMS topic to listen to |
2688 +-----------------------------------+-----------------------------------+
2690 JMS Output with Text
2691 ====================
2693 .. container:: paragraph
2695 APEX engine send events to a JMS messaging system. The
2696 output is uni-directional, an engine will send events
2697 to the output but not receive any event from output.
2699 .. container:: listingblock
2701 .. container:: content
2705 "carrierTechnologyParameters" : {
2706 "carrierTechnology" : "JMS", (1)
2707 "parameterClassName" :
2708 "org.onap.policy.apex.plugins.event.carrier.jms.JMSCarrierTechnologyParameters",
2709 "parameters" : { (2)
2710 "initialContextFactory" :
2711 "org.jboss.naming.remote.client.InitialContextFactory", (3)
2712 "connectionFactory" : "ConnectionFactory", (4)
2713 "providerURL" : "remote://localhost:5445", (5)
2714 "securityPrincipal" : "guest", (6)
2715 "securityCredentials" : "IAmAGuest", (7)
2716 "producerTopic" : "jms/topic/apexOut", (8)
2717 "objectMessageSending": "false" (9)
2721 .. container:: colist arabic
2723 +-----------------------------------+-----------------------------------+
2724 | **1** | set JMS as carrier technology |
2725 +-----------------------------------+-----------------------------------+
2726 | **2** | set all JMS specific parameters |
2727 +-----------------------------------+-----------------------------------+
2728 | **3** | the context factory, in this case |
2729 | | from JBOSS (it requires the |
2731 | | org.jboss:jboss-remote-naming:2.0 |
2733 | | or a different version to be in |
2734 | | the directory ``$APEX_HOME/lib`` |
2735 | | or ``%APEX_HOME%\lib`` |
2736 +-----------------------------------+-----------------------------------+
2737 | **4** | a connection factory for the JMS |
2739 +-----------------------------------+-----------------------------------+
2740 | **5** | URL with host and port of the JMS |
2742 +-----------------------------------+-----------------------------------+
2743 | **6** | access credentials, user name |
2744 +-----------------------------------+-----------------------------------+
2745 | **7** | access credentials, user password |
2746 +-----------------------------------+-----------------------------------+
2747 | **8** | the JMS topic to write to |
2748 +-----------------------------------+-----------------------------------+
2749 | **9** | set object messaging to ``false`` |
2750 | | means it sends JSON text |
2751 +-----------------------------------+-----------------------------------+
2753 JMS Output with Object
2754 ======================
2756 .. container:: paragraph
2758 To configure APEX for JMS objects on the output
2759 interface use the same configuration as above (for
2760 output). Simply change the ``objectMessageSending``
2761 parameter to ``true``.
2764 ########################
2766 .. container:: paragraph
2768 APEX supports the Websockets as input as well as output.
2769 WS IO is supported by the APEX Websocket plugin. This
2770 carrier technology does only support uni-directional
2771 communication. APEX will not send events to a Websocket
2772 input and any event sent to a Websocket output will
2773 result in an error log.
2775 .. container:: paragraph
2777 The input can be configured as client (APEX connects to
2778 an existing Websocket server) or server (APEX starts a
2779 Websocket server). The same applies to the output. Input
2780 and output can both use a client or a server
2781 configuration, or separate configurations (input as
2782 client and output as server, input as server and output
2783 as client). Each configuration should use its own
2784 dedicated port to avoid any communication loops. The
2785 configuration of a Websocket client is the same for input
2786 and output. The configuration of a Websocket server is
2787 the same for input and output.
2792 .. container:: paragraph
2794 APEX will connect to a given Websocket server. As
2795 input, it will receive events from the server but not
2796 send any events. As output, it will send events to the
2797 server and any event received from the server will
2798 result in an error log.
2800 .. container:: listingblock
2802 .. container:: content
2806 "carrierTechnologyParameters" : {
2807 "carrierTechnology" : "WEBSOCKET", (1)
2808 "parameterClassName" :
2809 "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
2811 "host" : "localhost", (2)
2816 .. container:: colist arabic
2818 +-------+------------------------------------------------------+
2819 | **1** | set Websocket as carrier technology |
2820 +-------+------------------------------------------------------+
2821 | **2** | the host name on which a Websocket server is running |
2822 +-------+------------------------------------------------------+
2823 | **3** | the port of that Websocket server |
2824 +-------+------------------------------------------------------+
2829 .. container:: paragraph
2831 APEX will start a Websocket server, which will accept
2832 any Websocket clients to connect. As input, it will
2833 receive events from the server but not send any
2834 events. As output, it will send events to the server
2835 and any event received from the server will result in
2838 .. container:: listingblock
2840 .. container:: content
2844 "carrierTechnologyParameters" : {
2845 "carrierTechnology" : "WEBSOCKET", (1)
2846 "parameterClassName" :
2847 "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
2849 "wsClient" : false, (2)
2854 .. container:: colist arabic
2856 +-------+------------------------------------------------------------+
2857 | **1** | set Websocket as carrier technology |
2858 +-------+------------------------------------------------------------+
2859 | **2** | disable client, so that APEX will start a Websocket server |
2860 +-------+------------------------------------------------------------+
2861 | **3** | the port for the Websocket server APEX will start |
2862 +-------+------------------------------------------------------------+
2867 .. container:: paragraph
2869 APEX can act as REST client on the input as well as on
2870 the output interface. The media type is
2871 ``application/json``, so this plugin only works with
2872 the JSON Event protocol.
2877 .. container:: paragraph
2879 APEX will connect to a given URL to receive events,
2880 but not send any events. The server is polled, i.e.
2881 APEX will do an HTTP GET, take the result, and then do
2882 the next GET. Any required timing needs to be handled
2883 by the server configured via the URL. For instance,
2884 the server could support a wait timeout via the URL as
2886 The httpCodeFilter is used for filtering the status
2887 code, and it can be configured as a regular expression
2888 string. The default httpCodeFilter is "[2][0-9][0-9]"
2889 - for successful response codes.
2890 The response with HTTP status code that matches the
2891 given regular expression is forwarded to the task,
2892 otherwise it is logged as a failure.
2894 .. container:: listingblock
2896 .. container:: content
2900 "carrierTechnologyParameters" : {
2901 "carrierTechnology" : "RESTCLIENT", (1)
2902 "parameterClassName" :
2903 "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters",
2905 "url" : "http://example.org:8080/triggers/events", (2)
2906 "httpCodeFilter" : "[2][0-9][0-9]" (3)
2910 .. container:: colist arabic
2912 +-------+--------------------------------------------------+
2913 | **1** | set REST client as carrier technology |
2914 +-------+--------------------------------------------------+
2915 | **2** | the URL of the HTTP server for events |
2916 +-------+--------------------------------------------------+
2917 | **3** | use HTTP CODE FILTER for filtering status code |
2918 +-------+--------------------------------------------------+
2923 .. container:: paragraph
2925 APEX will connect to a given URL to send events, but
2926 not receive any events. The default HTTP operation is
2927 POST (no configuration required). To change it to PUT
2928 simply add the configuration parameter (as shown in
2930 The URL can be configured statically or tagged
2931 as ``?example.{site}.org:8080/{trig}/events``,
2932 all tags such as ``site`` and ``trig`` in the URL
2933 need to be set in the properties object available to
2934 the tasks. In addition, the keys should exactly match
2935 with the tags defined in url. The scope of the properties
2936 object is per HTTP call. Hence, key/value pairs set
2937 in the properties object by task are only available
2938 for that specific HTTP call.
2940 .. container:: listingblock
2942 .. container:: content
2946 "carrierTechnologyParameters" : {
2947 "carrierTechnology" : "RESTCLIENT", (1)
2948 "parameterClassName" :
2949 "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters",
2951 "url" : "http://example.com:8888/actions/events", (2)
2952 "url" : "http://example.{site}.com:8888/{trig}/events", (2')
2953 "httpMethod" : "PUT" (3)
2957 .. container:: colist arabic
2959 +-------+--------------------------------------------------+
2960 | **1** | set REST client as carrier technology |
2961 +-------+--------------------------------------------------+
2962 | **2** | the static URL of the HTTP server for events |
2963 +-------+--------------------------------------------------+
2964 | **2'**| the tagged URL of the HTTP server for events |
2965 +-------+--------------------------------------------------+
2966 | **3** | use HTTP PUT (remove this line to use HTTP POST) |
2967 +-------+--------------------------------------------------+
2972 .. container:: paragraph
2974 APEX supports a REST server for input and output.
2976 .. container:: paragraph
2978 The REST server plugin always uses a synchronous mode. A
2979 client does a HTTP GET on the APEX REST server with the
2980 input event and receives the generated output event in
2981 the server reply. This means that for the REST server
2982 there has to always to be an input with an associated
2983 output. Input or output only are not permitted.
2985 .. container:: paragraph
2987 The plugin will start a Grizzly server as REST server for
2988 a normal APEX engine. If the APEX engine is executed as a
2989 servlet, for instance inside Tomcat, then Tomcat will be
2990 used as REST server (this case requires configuration on
2993 .. container:: paragraph
2995 Some configuration restrictions apply for all scenarios:
2997 .. container:: ulist
2999 - Minimum port: 1024
3001 - Maximum port: 65535
3003 - The media type is ``application/json``, so this plugin
3004 only works with the JSON Event protocol.
3006 .. container:: paragraph
3008 The URL the client calls is created using
3010 .. container:: ulist
3012 - the configured host and port, e.g.
3013 ``http://localhost:12345``
3015 - the standard path, e.g. ``/apex/``
3017 - the name of the input/output, e.g. ``FirstConsumer/``
3019 - the input or output name, e.g. ``EventIn``.
3021 .. container:: paragraph
3023 The examples above lead to the URL
3024 ``http://localhost:12345/apex/FirstConsumer/EventIn``.
3026 .. container:: paragraph
3028 A client can also get status information of the REST
3029 server using ``/Status``, e.g.
3030 ``http://localhost:12345/apex/FirstConsumer/Status``.
3032 REST Server Stand-alone
3033 =======================
3035 .. container:: paragraph
3037 We need to configure a REST server input and a REST
3038 server output. Input and output are associated with
3039 each other via there name.
3041 .. container:: paragraph
3043 Timeouts for REST calls need to be set carefully. If
3044 they are too short, the call might timeout before a
3045 policy finished creating an event.
3047 .. container:: paragraph
3049 The following example configures the input named as
3050 ``MyConsumer`` and associates an output named
3051 ``MyProducer`` with it.
3053 .. container:: listingblock
3055 .. container:: content
3059 "eventInputParameters": {
3061 "carrierTechnologyParameters" : {
3062 "carrierTechnology" : "RESTSERVER", (1)
3063 "parameterClassName" :
3064 "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters",
3066 "standalone" : true, (2)
3067 "host" : "localhost", (3)
3071 "eventProtocolParameters":{
3072 "eventProtocol" : "JSON" (5)
3074 "synchronousMode" : true, (6)
3075 "synchronousPeer" : "MyProducer", (7)
3076 "synchronousTimeout" : 500 (8)
3080 .. container:: colist arabic
3082 +-------+---------------------------------------+
3083 | **1** | set REST server as carrier technology |
3084 +-------+---------------------------------------+
3085 | **2** | set the server as stand-alone |
3086 +-------+---------------------------------------+
3087 | **3** | set the server host |
3088 +-------+---------------------------------------+
3089 | **4** | set the server listen port |
3090 +-------+---------------------------------------+
3091 | **5** | use JSON event protocol |
3092 +-------+---------------------------------------+
3093 | **6** | activate synchronous mode |
3094 +-------+---------------------------------------+
3095 | **7** | associate an output ``MyProducer`` |
3096 +-------+---------------------------------------+
3097 | **8** | set a timeout of 500 milliseconds |
3098 +-------+---------------------------------------+
3100 .. container:: paragraph
3102 The following example configures the output named as
3103 ``MyProducer`` and associates the input ``MyConsumer``
3104 with it. Note that for the output there are no more
3105 paramters (such as host or port), since they are
3106 already configured in the associated input
3108 .. container:: listingblock
3110 .. container:: content
3114 "eventOutputParameters": {
3116 "carrierTechnologyParameters":{
3117 "carrierTechnology" : "RESTSERVER",
3118 "parameterClassName" :
3119 "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters"
3121 "eventProtocolParameters":{
3122 "eventProtocol" : "JSON"
3124 "synchronousMode" : true,
3125 "synchronousPeer" : "MyConsumer",
3126 "synchronousTimeout" : 500
3130 REST Server Stand-alone, multi input
3131 ====================================
3133 .. container:: paragraph
3135 Any number of input/output pairs for REST servers can
3136 be configured. For instance, we can configure an input
3137 ``FirstConsumer`` with output ``FirstProducer`` and an
3138 input ``SecondConsumer`` with output
3139 ``SecondProducer``. Important is that there is always
3140 one pair of input/output.
3142 REST Server Stand-alone in Servlet
3143 ==================================
3145 .. container:: paragraph
3147 If APEX is executed as a servlet, e.g. inside Tomcat,
3148 the configuration becomes easier since the plugin can
3149 now use Tomcat as the REST server. In this scenario,
3150 there are not parameters (port, host, etc.) and the
3151 key ``standalone`` must not be used (or set to false).
3153 .. container:: paragraph
3155 For the Tomcat configuration, we need to add the REST
3158 .. container:: listingblock
3160 .. container:: content
3168 <param-value>org.onap.policy.apex.plugins.event.carrier.restserver</param-value>
3176 .. container:: paragraph
3178 APEX can act as REST requestor on the input as well as on
3179 the output interface. The media type is
3180 ``application/json``, so this plugin only works with
3181 the JSON Event protocol.
3183 REST Requestor Input
3184 ====================
3186 .. container:: paragraph
3188 APEX will connect to a given URL to request an input.
3189 The URL can be configured statically or tagged
3190 as ``?example.{site}.org:8080/{trig}/events``,
3191 all tags such as ``site`` and ``trig`` in the URL
3192 need to be set in the properties object available to
3193 the tasks. In addition, the keys should exactly match
3194 with the tags defined in url. The scope of the properties
3195 object is per HTTP call. Hence, key/value pairs set
3196 in the properties object by task are only available
3197 for that specific HTTP call.
3198 The httpCodeFilter is used for filtering the status
3199 code, and it can be configured as a regular expression
3200 string. The default httpCodeFilter is "[2][0-9][0-9]"
3201 - for successful response codes.
3202 The response with HTTP status code that matches the
3203 given regular expression is forwarded to the task,
3204 otherwise it is logged as a failure.
3206 .. container:: listingblock
3208 .. container:: content
3212 "carrierTechnologyParameters": {
3213 "carrierTechnology": "RESTREQUESTOR", (1)
3214 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters",
3216 "url": "http://localhost:54321/some/path/to/rest/resource", (2)
3217 "url": "http://localhost:54321/{site}/path/to/rest/{resValue}", (2')
3218 "httpMethod": "POST", (3)
3219 "restRequestTimeout": 2000, (4)
3220 "httpCodeFilter" : "[2][0-9][0-9]" (5)
3224 .. container:: colist arabic
3226 +-------+--------------------------------------------------+
3227 | **1** | set REST requestor as carrier technology |
3228 +-------+--------------------------------------------------+
3229 | **2** | the static URL of the HTTP server for events |
3230 +-------+--------------------------------------------------+
3231 | **2'**| the tagged URL of the HTTP server for events |
3232 +-------+--------------------------------------------------+
3233 | **3** | use HTTP PUT (remove this line to use HTTP POST) |
3234 +-------+--------------------------------------------------+
3235 | **4** | request timeout in milliseconds |
3236 +-------+--------------------------------------------------+
3237 | **5** | use HTTP CODE FILTER for filtering status code |
3238 +-------+--------------------------------------------------+
3240 .. container:: paragraph
3242 Further settings are required on the consumer to
3243 define the event that is requested, for example:
3245 .. container:: listingblock
3247 .. container:: content
3251 "eventName": "GuardResponseEvent", (1)
3252 "eventNameFilter": "GuardResponseEvent", (2)
3253 "requestorMode": true, (3)
3254 "requestorPeer": "GuardRequestorProducer", (4)
3255 "requestorTimeout": 500 (5)
3257 .. container:: colist arabic
3259 +-------+---------------------------+
3260 | **1** | the event name |
3261 +-------+---------------------------+
3262 | **2** | a filter on the event |
3263 +-------+---------------------------+
3264 | **3** | the mode of the requestor |
3265 +-------+---------------------------+
3266 | **4** | a peer for the requestor |
3267 +-------+---------------------------+
3268 | **5** | a general request timeout |
3269 +-------+---------------------------+
3271 REST Requestor Output
3272 =====================
3274 .. container:: paragraph
3276 APEX will connect to a given URL to send events, but
3277 not receive any events.
3279 .. container:: listingblock
3281 .. container:: content
3285 "carrierTechnologyParameters": {
3286 "carrierTechnology": "RESTREQUESTOR", (1)
3287 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters"
3290 .. container:: colist arabic
3292 +-------+------------------------------------------+
3293 | **1** | set REST requestor as carrier technology |
3294 +-------+------------------------------------------+
3296 .. container:: paragraph
3298 Further settings are required on the consumer to
3299 define the event that is requested, for example:
3301 .. container:: listingblock
3303 .. container:: content
3307 "eventNameFilter": "GuardRequestEvent", (1)
3308 "requestorMode": true, (2)
3309 "requestorPeer": "GuardRequestorConsumer", (3)
3310 "requestorTimeout": 500 (4)
3312 .. container:: colist arabic
3314 +-------+---------------------------+
3315 | **1** | a filter on the event |
3316 +-------+---------------------------+
3317 | **2** | the mode of the requestor |
3318 +-------+---------------------------+
3319 | **3** | a peer for the requestor |
3320 +-------+---------------------------+
3321 | **4** | a general request timeout |
3322 +-------+---------------------------+
3327 .. container:: paragraph
3329 APEX can send requests over gRPC at the output side, and get back
3330 response at the input side. This can be used to send requests to CDS
3331 over gRPC. The media type is ``application/json``, so this plugin
3332 only works with the JSON Event protocol.
3337 .. container:: paragraph
3339 APEX will connect to a given host to send a request over
3342 .. container:: listingblock
3344 .. container:: content
3348 "carrierTechnologyParameters": {
3349 "carrierTechnology": "GRPC", (1)
3350 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
3352 "host": "cds-blueprints-processor-grpc", (2)
3354 "username": "ccsdkapps", (3)
3355 "password": ccsdkapps, (4)
3360 .. container:: colist arabic
3362 +-------+--------------------------------------------------+
3363 | **1** | set GRPC as carrier technology |
3364 +-------+--------------------------------------------------+
3365 | **2** | the host to which request is sent |
3366 +-------+--------------------------------------------------+
3367 | **2'**| the value for port |
3368 +-------+--------------------------------------------------+
3369 | **3** | username required to initiate connection |
3370 +-------+--------------------------------------------------+
3371 | **4** | password required to initiate connection |
3372 +-------+--------------------------------------------------+
3373 | **5** | the timeout value for completing the request |
3374 +-------+--------------------------------------------------+
3376 .. container:: paragraph
3378 Further settings are required on the producer to
3379 define the event that is requested, for example:
3381 .. container:: listingblock
3383 .. container:: content
3387 "eventName": "GRPCRequestEvent", (1)
3388 "eventNameFilter": "GRPCRequestEvent", (2)
3389 "requestorMode": true, (3)
3390 "requestorPeer": "GRPCRequestConsumer", (4)
3391 "requestorTimeout": 500 (5)
3393 .. container:: colist arabic
3395 +-------+---------------------------+
3396 | **1** | the event name |
3397 +-------+---------------------------+
3398 | **2** | a filter on the event |
3399 +-------+---------------------------+
3400 | **3** | the mode of the requestor |
3401 +-------+---------------------------+
3402 | **4** | a peer for the requestor |
3403 +-------+---------------------------+
3404 | **5** | a general request timeout |
3405 +-------+---------------------------+
3410 .. container:: paragraph
3412 APEX will connect to the host specified in the producer
3413 side, anad take in response back at the consumer side.
3415 .. container:: listingblock
3417 .. container:: content
3421 "carrierTechnologyParameters": {
3422 "carrierTechnology": "GRPC", (1)
3423 "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
3426 .. container:: colist arabic
3428 +-------+------------------------------------------+
3429 | **1** | set GRPC as carrier technology |
3430 +-------+------------------------------------------+
3432 .. container:: paragraph
3434 Further settings are required on the consumer to
3435 define the event that is requested, for example:
3437 .. container:: listingblock
3439 .. container:: content
3443 "eventNameFilter": "GRPCResponseEvent", (1)
3444 "requestorMode": true, (2)
3445 "requestorPeer": "GRPCRequestProducer", (3)
3446 "requestorTimeout": 500 (4)
3448 .. container:: colist arabic
3450 +-------+---------------------------+
3451 | **1** | a filter on the event |
3452 +-------+---------------------------+
3453 | **2** | the mode of the requestor |
3454 +-------+---------------------------+
3455 | **3** | a peer for the requestor |
3456 +-------+---------------------------+
3457 | **4** | a general request timeout |
3458 +-------+---------------------------+
3460 Event Protocols, Format and Encoding
3461 ------------------------------------
3463 .. container:: paragraph
3465 Event protocols define what event formats APEX can receive
3466 (input) and should send (output). They can be used in any
3467 combination for input and output, unless further restricted
3468 by a carrier technology plugin (for instance for JMS
3469 output). There can only be 1 event protocol per event
3472 .. container:: paragraph
3474 Supported *input* event protocols are:
3476 .. container:: ulist
3478 - JSON, the event as a JSON string
3480 - APEX, an APEX event
3482 - JMS object, the event as a JMS object,
3484 - JMS text, the event as a JMS text,
3486 - XML, the event as an XML string,
3488 - YAML, the event as YAML text
3490 .. container:: paragraph
3492 Supported *output* event protocols are:
3494 .. container:: ulist
3496 - JSON, the event as a JSON string
3498 - APEX, an APEX event
3500 - JMS object, the event as a JMS object,
3502 - JMS text, the event as a JMS text,
3504 - XML, the event as an XML string,
3506 - YAML, the event as YAML text
3508 .. container:: paragraph
3510 New event protocols can be added as plugins to APEX or
3511 developed outside APEX and added to an APEX deployment.
3516 .. container:: paragraph
3518 The event protocol for JSON encoding does not require a
3519 specific plugin, it is supported by default. Furthermore,
3520 there is no difference in the configuration for the input
3521 and output interface.
3523 .. container:: paragraph
3525 For an input, APEX requires a well-formed JSON string.
3526 Well-formed here means according to the definitions of a
3527 policy. Any JSON string that is not defined as a trigger
3528 event (consume) will not be consumed (errors will be
3529 thrown). For output JSON events, APEX will always produce
3530 valid JSON strings according to the definition in the
3533 .. container:: paragraph
3535 The following JSON shows the configuration.
3537 .. container:: listingblock
3539 .. container:: content
3543 "eventProtocolParameters":{
3544 "eventProtocol" : "JSON"
3547 .. container:: paragraph
3549 For JSON events, there are a few more optional
3550 parameters, which allow to define a mapping for standard
3551 event fields. An APEX event must have the fields
3552 ``name``, ``version``, ``source``, and ``target``
3553 defined. Sometimes it is not possible to configure a
3554 trigger or actioning system to use those fields. However,
3555 they might be in an event generated outside APEX (or used
3556 outside APEX) just with different names. To configure
3557 APEX to map between the different event names, simply add
3558 the following parameters to a JSON event:
3560 .. container:: listingblock
3562 .. container:: content
3566 "eventProtocolParameters":{
3567 "eventProtocol" : "JSON",
3568 "nameAlias" : "policyName", (1)
3569 "versionAlias" : "policyVersion", (2)
3570 "sourceAlias" : "from", (3)
3571 "targetAlias" : "to", (4)
3572 "nameSpaceAlias": "my.name.space" (5)
3575 .. container:: colist arabic
3577 +-----------------------------------+-----------------------------------+
3578 | **1** | mapping for the ``name`` field, |
3579 | | here from a field called |
3580 | | ``policyName`` |
3581 +-----------------------------------+-----------------------------------+
3582 | **2** | mapping for the ``version`` |
3583 | | field, here from a field called |
3584 | | ``policyVersion`` |
3585 +-----------------------------------+-----------------------------------+
3586 | **3** | mapping for the ``source`` field, |
3587 | | here from a field called ``from`` |
3588 | | (only for an input event) |
3589 +-----------------------------------+-----------------------------------+
3590 | **4** | mapping for the ``target`` field, |
3591 | | here from a field called ``to`` |
3592 | | (only for an output event) |
3593 +-----------------------------------+-----------------------------------+
3594 | **5** | mapping for the ``nameSpace`` |
3595 | | field, here from a field called |
3596 | | ``my.name.space`` |
3597 +-----------------------------------+-----------------------------------+
3601 .. container:: paragraph
3603 The event protocol for APEX events does not require a
3604 specific plugin, it is supported by default. Furthermore,
3605 there is no difference in the configuration for the input
3606 and output interface.
3608 .. container:: paragraph
3610 For input and output APEX uses APEX events.
3612 .. container:: paragraph
3614 The following JSON shows the configuration.
3616 .. container:: listingblock
3618 .. container:: content
3622 "eventProtocolParameters":{
3623 "eventProtocol" : "APEX"
3629 .. container:: paragraph
3631 The event protocol for JMS is provided by the APEX JMS
3632 plugin. The plugin supports encoding as JSON text or as
3633 object. There is no difference in the configuration for
3634 the input and output interface.
3638 .. container:: paragraph
3640 If used as input, APEX will take a JMS message and
3641 extract a JSON string, then proceed as if a JSON event
3642 was received. If used as output, APEX will take the
3643 event produced by a policy, create a JSON string, and
3644 then wrap it into a JMS message.
3646 .. container:: paragraph
3648 The configuration for JMS text is as follows:
3650 .. container:: listingblock
3652 .. container:: content
3656 "eventProtocolParameters":{
3657 "eventProtocol" : "JMSTEXT",
3658 "parameterClassName" :
3659 "org.onap.policy.apex.plugins.event.protocol.jms.JMSTextEventProtocolParameters"
3664 .. container:: paragraph
3666 If used as input, APEX will will take a JMS message,
3667 extract a Java Bean from the ``ObjectMessage``
3668 message, construct an APEX event and put the bean on
3669 the APEX event as a parameter. If used as output, APEX
3670 will take the event produced by a policy, create a
3671 Java Bean and send it as a JMS message.
3673 .. container:: paragraph
3675 The configuration for JMS object is as follows:
3677 .. container:: listingblock
3679 .. container:: content
3683 "eventProtocolParameters":{
3684 "eventProtocol" : "JMSOBJECT",
3685 "parameterClassName" :
3686 "org.onap.policy.apex.plugins.event.protocol.jms.JMSObjectEventProtocolParameters"
3692 .. container:: paragraph
3694 The event protocol for YAML is provided by the APEX YAML
3695 plugin. There is no difference in the configuration for
3696 the input and output interface.
3698 .. container:: paragraph
3700 If used as input, APEX will consume events as YAML and
3701 map them to policy trigger events. Not well-formed YAML
3702 and not understood trigger events will be rejected. If
3703 used as output, APEX produce YAML encoded events from the
3704 event a policy produces. Those events will always be
3705 well-formed according to the definition in the policy
3708 .. container:: paragraph
3710 The following code shows the configuration.
3712 .. container:: listingblock
3714 .. container:: content
3718 "eventProtocolParameters":{
3719 "eventProtocol" : "XML",
3720 "parameterClassName" :
3721 "org.onap.policy.apex.plugins.event.protocol.yaml.YamlEventProtocolParameters"
3726 .. container:: paragraph
3728 The event protocol for XML is provided by the APEX XML
3729 plugin. There is no difference in the configuration for
3730 the input and output interface.
3732 .. container:: paragraph
3734 If used as input, APEX will consume events as XML and map
3735 them to policy trigger events. Not well-formed XML and
3736 not understood trigger events will be rejected. If used
3737 as output, APEX produce XML encoded events from the event
3738 a policy produces. Those events will always be
3739 well-formed according to the definition in the policy
3742 .. container:: paragraph
3744 The following code shows the configuration.
3746 .. container:: listingblock
3748 .. container:: content
3752 "eventProtocolParameters":{
3753 "eventProtocol" : "XML",
3754 "parameterClassName" :
3755 "org.onap.policy.apex.plugins.event.protocol.xml.XMLEventProtocolParameters"
3758 A configuration example
3759 -----------------------
3761 .. container:: paragraph
3763 The following example loads all available plug-ins.
3765 .. container:: paragraph
3767 Events are consumed from a Websocket, APEX as client.
3768 Consumed event format is JSON.
3770 .. container:: paragraph
3772 Events are produced to Kafka. Produced event format is XML.
3774 .. container:: listingblock
3776 .. container:: content
3781 "engineServiceParameters" : {
3782 "name" : "MyApexEngine",
3783 "version" : "0.0.1",
3785 "instanceCount" : 4,
3786 "deploymentPort" : 12345,
3787 "policyModelFileName" : "examples/models/some-model.json",
3788 "engineParameters" : {
3789 "executorParameters" : {
3791 "parameterClassName" :
3792 "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
3795 "parameterClassName" :
3796 "org.onap.policy.apex.plugins.executor.jython.JythonExecutorParameters"
3799 "parameterClassName" :
3800 "org.onap.policy.apex.plugins.executor.jruby.JrubyExecutorParameters"
3803 "parameterClassName" :
3804 "org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters"
3807 "parameterClassName" :
3808 "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters"
3811 "contextParameters" : {
3812 "parameterClassName" :
3813 "org.onap.policy.apex.context.parameters.ContextParameters",
3814 "schemaParameters" : {
3816 "parameterClassName" :
3817 "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
3823 "producerCarrierTechnologyParameters" : {
3824 "carrierTechnology" : "KAFKA",
3825 "parameterClassName" :
3826 "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
3828 "bootstrapServers" : "localhost:49092",
3831 "batchSize" : 16384,
3833 "bufferMemory" : 33554432,
3834 "producerTopic" : "apex-out",
3835 "keySerializer" : "org.apache.kafka.common.serialization.StringSerializer",
3836 "valueSerializer" : "org.apache.kafka.common.serialization.StringSerializer"
3839 "producerEventProtocolParameters" : {
3840 "eventProtocol" : "XML",
3841 "parameterClassName" :
3842 "org.onap.policy.apex.plugins.event.protocol.xml.XMLEventProtocolParameters"
3844 "consumerCarrierTechnologyParameters" : {
3845 "carrierTechnology" : "WEBSOCKET",
3846 "parameterClassName" :
3847 "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
3849 "host" : "localhost",
3853 "consumerEventProtocolParameters" : {
3854 "eventProtocol" : "JSON"
3858 Engine and Applications of the APEX System
3859 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3861 Introduction to APEX Engine and Applications
3862 --------------------------------------------
3864 .. container:: paragraph
3866 The core of APEX is the APEX Engine, also known as the APEX
3867 Policy Engine or the APEX PDP (since it is in fact a Policy
3868 Decision Point). Beside this engine, an APEX system comes
3869 with a few applications intended to help with policy
3870 authoring, deployment, and execution.
3872 .. container:: paragraph
3874 The engine itself and most applications are started from the
3875 command line with command line arguments. This is called a
3876 Command Line Interface (CLI). Some applications require an
3877 installation on a webserver, as for instance the REST
3878 Editor. Those applications can be accessed via a web
3881 .. container:: paragraph
3883 You can also use the available APEX APIs and applications to
3884 develop other applications as required. This includes policy
3885 languages (and associated parsers and compilers /
3886 interpreters), GUIs to access APEX or to define policies,
3887 clients to connect to APEX, etc.
3889 .. container:: paragraph
3891 For this documentation, we assume an installation of APEX as
3892 a full system based on a current ONAP release.
3894 CLI on Unix, Windows, and Cygwin
3895 --------------------------------
3897 .. container:: paragraph
3899 A note on APEX CLI applications: all applications and the
3900 engine itself have been deployed and tested on different
3901 operating systems: Red Hat, Ubuntu, Debian, Mac OSX,
3902 Windows, Cygwin. Each operating system comes with its own
3903 way of configuring and executing Java. The main items here
3906 .. container:: ulist
3908 - For UNIX systems (RHL, Ubuntu, Debian, Mac OSX), the
3909 provided bash scripts work as expected with absolute
3911 ``/opt/app/policy/apex-pdp/apex-pdp-2.0.0-SNAPSHOT/examples``),
3912 indirect and linked paths (e.g. ``../apex/apex``), and
3913 path substitutions using environment settings (e.g.
3914 ``$APEX_HOME/bin/``)
3916 - For Windows systems, the provided batch files (``.bat``)
3917 work as expected with with absolute paths (e.g.
3918 ``C:\apex\apex-2.0.0-SNAPSHOT\examples``), and path
3919 substitutions using environment settings (e.g.
3920 ``%APEX_HOME%\bin\``)
3922 - For Cygwin system we assume a standard Cygwin
3923 installation with standard tools (mainly bash) using a
3924 Windows Java installation. This means that the bash
3925 scripts can be used as in UNIX, however any argument
3926 pointing to files and directories need to use either a
3928 ``C:\apex\apex-2.0.0-SNAPSHOT\examples\config...``) or
3929 the command ``cygpath`` with a mixed option. The reason
3930 for that is: Cygwin executes Java using UNIX paths but
3931 then runs Java as a DOS/WINDOWS process, which requires
3932 DOS paths for file access.
3937 .. container:: paragraph
3939 The APEX engine can be started in different ways, depending
3940 your requirements. All scripts are located in the APEX *bin*
3943 .. container:: paragraph
3945 On UNIX and Cygwin systems use:
3947 .. container:: ulist
3949 - ``apexEngine.sh`` - this script will
3951 .. container:: ulist
3953 - Test if ``$APEX_USER`` is set and if the user
3954 exists, terminate with an error otherwise
3956 - Test if ``$APEX_HOME`` is set. If not set, it will
3957 use the default setting as
3958 ``/opt/app/policy/apex-pdp/apex-pdp``. Then the set
3959 directory is tested to exist, the script will
3962 - When all tests are passed successfully, the script
3963 will call ``apexApps.sh`` with arguments to start
3966 - ``apexApps.sh engine`` - this is the general APEX
3967 application launcher, which will
3969 .. container:: ulist
3971 - Start the engine with the argument ``engine``
3973 - Test if ``$APEX_HOME`` is set and points to an
3974 existing directory. If not set or directory does
3975 not exist, script terminates.
3977 - Not test for any settings of ``$APEX_USER``.
3979 .. container:: paragraph
3981 On Windows systems use ``apexEngine.bat`` and
3982 ``apexApps.bat engine`` respectively. Note: none of the
3983 windows batch files will test for ``%APEX_USER%``.
3985 .. container:: paragraph
3987 Summary of alternatives to start the APEX Engine:
3989 +--------------------------------------------------------+----------------------------------------------------------+
3990 | Unix, Cygwin | Windows |
3991 +========================================================+==========================================================+
3992 | .. container:: | .. container:: |
3994 | .. container:: listingblock | .. container:: listingblock |
3996 | .. container:: content | .. container:: content |
3998 | .. code:: | .. code:: |
4000 | # $APEX_HOME/bin/apexEngine.sh [args] | > %APEX_HOME%\bin\apexEngine.bat [args] |
4001 | # $APEX_HOME/bin/apexApps.sh engine [args] | > %APEX_HOME%\bin\apexApps.bat engine [args] |
4002 +--------------------------------------------------------+----------------------------------------------------------+
4004 .. container:: paragraph
4006 The APEX engine comes with a few CLI arguments for setting
4007 configuration and policy model. The configuration file is
4008 always required. The policy model file is only required if
4009 no model file is specified in the configuration, or if the
4010 specified model file should be over written. The option
4011 ``-h`` prints a help screen.
4013 .. container:: listingblock
4015 .. container:: content
4019 usage: org.onap.policy.apex.service.engine.main.ApexMain [options...]
4021 -c,--config-file <CONFIG_FILE> the full path to the configuration file to use, the configuration file must be a Json file
4022 containing the Apex configuration parameters
4023 -h,--help outputs the usage of this command
4024 -m,--model-file <MODEL_FILE> the full path to the model file to use, if set it overrides the model file set in the
4026 -v,--version outputs the version of Apex
4031 .. container:: paragraph
4033 The CLI Editor allows to define policies from the command
4034 line. The application uses a simple language and supports
4035 all elements of an APEX policy. It can be used in to
4038 .. container:: ulist
4040 - non-interactive, specifying a file with the commands to
4043 - interactive, using the editors CLI to create a policy
4045 .. container:: paragraph
4047 When a policy is fully specified, the editor will generate
4048 the APEX core policy specification in JSON. This core
4049 specification is called the policy model in the APEX engine
4050 and can be used directly with the APEX engine.
4052 .. container:: paragraph
4054 On UNIX and Cygwin systems use:
4056 .. container:: ulist
4058 - ``apexCLIEditor.sh`` - simply starts the CLI editor,
4059 arguments to the script determine the mode of the editor
4061 - ``apexApps.sh cli-editor`` - simply starts the CLI
4062 editor, arguments to the script determine the mode of the
4065 .. container:: paragraph
4067 On Windows systems use:
4069 .. container:: ulist
4071 - ``apexCLIEditor.bat`` - simply starts the CLI editor,
4072 arguments to the script determine the mode of the editor
4074 - ``apexApps.bat cli-editor`` - simply starts the CLI
4075 editor, arguments to the script determine the mode of the
4078 .. container:: paragraph
4080 Summary of alternatives to start the APEX CLI Editor:
4082 +------------------------------------------------------------+--------------------------------------------------------------+
4083 | Unix, Cygwin | Windows |
4084 +============================================================+==============================================================+
4085 | .. container:: | .. container:: |
4087 | .. container:: listingblock | .. container:: listingblock |
4089 | .. container:: content | .. container:: content |
4091 | .. code:: | .. code:: |
4093 | # $APEX_HOME/bin/apexCLIEditor.sh.sh [args] | > %APEX_HOME%\bin\apexCLIEditor.bat [args] |
4094 | # $APEX_HOME/bin/apexApps.sh cli-editor [args] | > %APEX_HOME%\bin\apexApps.bat cli-editor [args] |
4095 +------------------------------------------------------------+--------------------------------------------------------------+
4097 .. container:: paragraph
4099 The option ``-h`` provides a help screen with all command
4102 .. container:: listingblock
4104 .. container:: content
4108 usage: org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain [options...]
4110 -a,--model-props-file <MODEL_PROPS_FILE> name of the apex model properties file to use
4111 -c,--command-file <COMMAND_FILE> name of a file containing editor commands to run into the editor
4112 -h,--help outputs the usage of this command
4113 -i,--input-model-file <INPUT_MODEL_FILE> name of a file that contains an input model for the editor
4114 -if,--ignore-failures <IGNORE_FAILURES_FLAG> true or false, ignore failures of commands in command files and continue
4115 executing the command file
4116 -l,--log-file <LOG_FILE> name of a file that will contain command logs from the editor, will log
4117 to standard output if not specified or suppressed with "-nl" flag
4118 -m,--metadata-file <CMD_METADATA_FILE> name of the command metadata file to use
4119 -nl,--no-log if specified, no logging or output of commands to standard output or log
4121 -nm,--no-model-output if specified, no output of a model to standard output or model output
4122 file is carried out, the user can use the "save" command in a script to
4124 -o,--output-model-file <OUTPUT_MODEL_FILE> name of a file that will contain the output model for the editor, will
4125 output model to standard output if not specified or suppressed with
4127 -wd,--working-directory <WORKING_DIRECTORY> the working directory that is the root for the CLI editor and is the
4128 root from which to look for included macro files
4130 The APEX CLI Tosca Editor
4131 -------------------------
4133 .. container:: paragraph
4135 As per the new Policy LifeCycle API, the policies are expected to be defined as ToscaServiceTemplate. The CLI Tosca Editor is an extended version of the APEX CLI Editor which can generate the policies in ToscaServiceTemplate way.
4137 .. container:: paragraph
4139 The APEX config file(.json), command file(.apex) and the tosca template skeleton(.json) file paths need to be passed as input arguments to the CLI Tosca Editor. Policy in ToscaServiceTemplate format is generated as the output. This can be used as the input to Policy API for creating policies.
4141 .. container:: paragraph
4143 On UNIX and Cygwin systems use:
4145 .. container:: ulist
4147 - ``apexCLIToscaEditor.sh`` - starts the CLI Tosca editor,
4148 all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4150 - ``apexApps.sh cli-tosca-editor`` - starts the CLI Tosca editor,
4151 all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4153 .. container:: paragraph
4155 On Windows systems use:
4157 .. container:: ulist
4159 - ``apexCLIToscaEditor.bat`` - starts the CLI Tosca editor,
4160 all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4162 - ``apexApps.bat cli-tosca-editor`` - starts the CLI Tosca
4163 editor, all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
4165 .. container:: paragraph
4167 Summary of alternatives to start the APEX CLI Tosca Editor:
4169 +-----------------------------------------------------------------+--------------------------------------------------------------------+
4170 | Unix, Cygwin | Windows |
4171 +=================================================================+====================================================================+
4172 | .. container:: | .. container:: |
4174 | .. container:: listingblock | .. container:: listingblock |
4176 | .. container:: content | .. container:: content |
4178 | .. code:: | .. code:: |
4180 | # $APEX_HOME/bin/apexCLIToscaEditor.sh.sh [args] | > %APEX_HOME%\bin\apexCLIToscaEditor.bat [args] |
4181 | # $APEX_HOME/bin/apexApps.sh cli-tosca-editor [args]| > %APEX_HOME%\bin\apexApps.bat cli-tosca-editor [args] |
4182 +-----------------------------------------------------------------+--------------------------------------------------------------------+
4184 .. container:: paragraph
4186 The option ``-h`` provides a help screen with all command
4189 .. container:: listingblock
4191 .. container:: content
4195 usage: org.onap.policy.apex.auth.clieditor.tosca.ApexCliToscaEditorMain [options...]
4197 -a,--model-props-file <MODEL_PROPS_FILE> name of the apex model properties file to use
4198 -ac,--apex-config-file <APEX_CONFIG_FILE> name of the file containing apex configuration details
4199 -c,--command-file <COMMAND_FILE> name of a file containing editor commands to run into the editor
4200 -h,--help outputs the usage of this command
4201 -i,--input-model-file <INPUT_MODEL_FILE> name of a file that contains an input model for the editor
4202 -if,--ignore-failures <IGNORE_FAILURES_FLAG> true or false, ignore failures of commands in command files and
4203 continue executing the command file
4204 -l,--log-file <LOG_FILE> name of a file that will contain command logs from the editor, will
4205 log to standard output if not specified or suppressed with "-nl" flag
4206 -m,--metadata-file <CMD_METADATA_FILE> name of the command metadata file to use
4207 -nl,--no-log if specified, no logging or output of commands to standard output or
4208 log file is carried out
4209 -ot,--output-tosca-file <OUTPUT_TOSCA_FILE> name of a file that will contain the output ToscaServiceTemplate
4210 -t,--tosca-template-file <TOSCA_TEMPLATE_FILE> name of the input file containing tosca template which needs to be
4212 -wd,--working-directory <WORKING_DIRECTORY> the working directory that is the root for the CLI editor and is the
4213 root from which to look for included macro files
4215 .. container:: paragraph
4217 An example command to run the APEX CLI Tosca editor on windows machine is given below.
4219 .. container:: listingblock
4221 .. container:: content
4225 %APEX_HOME%/\bin/\apexCLIToscaEditor.bat -c %APEX_HOME%\examples\PolicyModel.apex -ot %APEX_HOME%\examples\test.json -l %APEX_HOME%\examples\test.log -ac %APEX_HOME%\examples\RESTServerStandaloneJsonEvent.json -t %APEX_HOME%\examples\ToscaTemplate.json
4227 The APEX REST Editor
4228 --------------------
4230 .. container:: paragraph
4232 The standard way to use the APEX REST Editor is via an
4233 installation of the *war* file on a webserver. However, the
4234 REST editor can also be started via command line. This will
4235 start a Grizzly webserver with the *war* deployed. Access to
4236 the REST Editor is then via the provided URL
4238 .. container:: paragraph
4240 On UNIX and Cygwin systems use:
4242 .. container:: ulist
4244 - ``apexRESTEditor.sh`` - simply starts the webserver with
4247 - ``apexApps.sh rest-editor`` - simply starts the webserver
4248 with the REST editor
4250 .. container:: paragraph
4252 On Windows systems use:
4254 .. container:: ulist
4256 - ``apexRESTEditor.bat`` - simply starts the webserver with
4259 - ``apexApps.bat rest-editor`` - simply starts the
4260 webserver with the REST editor
4262 .. container:: paragraph
4264 Summary of alternatives to start the APEX REST Editor:
4266 +-------------------------------------------------------------+---------------------------------------------------------------+
4267 | Unix, Cygwin | Windows |
4268 +=============================================================+===============================================================+
4269 | .. container:: | .. container:: |
4271 | .. container:: listingblock | .. container:: listingblock |
4273 | .. container:: content | .. container:: content |
4275 | .. code:: | .. code:: |
4277 | # $APEX_HOME/bin/apexRESTEditor.sh.sh [args] | > %APEX_HOME%\bin\apexRESTEditor.bat [args] |
4278 | # $APEX_HOME/bin/apexApps.sh rest-editor [args] | > %APEX_HOME%\bin\apexApps.bat rest-editor [args] |
4279 +-------------------------------------------------------------+---------------------------------------------------------------+
4281 .. container:: paragraph
4283 The option ``-h`` provides a help screen with all command
4286 .. container:: listingblock
4288 .. container:: content
4292 usage: org.onap.policy.apex.client.editor.rest.ApexEditorMain [options...]
4293 -h,--help outputs the usage of this command
4294 -l,--listen <ADDRESS> the IP address to listen on. Default value is localhost to restrict access to the
4296 -p,--port <PORT> port to use for the Apex RESTful editor REST calls.
4297 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating. Default
4298 value is -1 to run indefinitely.
4300 .. container:: paragraph
4302 If the REST Editor is started without any arguments the
4303 final messages will look similar to this:
4305 .. container:: listingblock
4307 .. container:: content
4311 Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4312 Sep 05, 2018 11:24:30 PM org.glassfish.grizzly.http.server.NetworkListener start
4313 INFO: Started listener bound to [localhost:18989]
4314 Sep 05, 2018 11:24:30 PM org.glassfish.grizzly.http.server.HttpServer start
4315 INFO: [HttpServer] Started.
4316 Apex Editor REST endpoint (ApexEditorMain: Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4318 .. container:: paragraph
4320 The last line states the URL on which the REST Editor can be
4321 accessed. The example above stated
4322 ``http://0.0.0.0:18989/apex/``. In a web browser use the URL
4323 ``http://localhost:18989`` and the REST Editor will start.
4325 The APEX Monitoring Client
4326 --------------------------
4328 .. container:: paragraph
4330 The standard way to use the APEX Monitoring Client is via an
4331 installation of the *war* file on a webserver. However, the
4332 Monitoring Client can also be started via command line. This
4333 will start a Grizzly webserver with the *war* deployed.
4334 Access to the Monitoring Client is then via the provided URL
4336 .. container:: paragraph
4338 On UNIX and Cygwin systems use:
4340 .. container:: ulist
4342 - ``apexApps.sh eng-monitoring`` - simply starts the
4343 webserver with the Monitoring Client
4345 .. container:: paragraph
4347 On Windows systems use:
4349 .. container:: ulist
4351 - ``apexApps.bat eng-monitoring`` - simply starts the
4352 webserver with the Monitoring Client
4354 .. container:: paragraph
4356 The option ``-h`` provides a help screen with all command
4359 .. container:: listingblock
4361 .. container:: content
4365 usage: org.onap.policy.apex.client.monitoring.rest.ApexMonitoringRestMain [options...]
4366 -h,--help outputs the usage of this command
4367 -p,--port <PORT> port to use for the Apex Services REST calls
4368 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating
4370 .. container:: paragraph
4372 If the Monitoring Client is started without any arguments
4373 the final messages will look similar to this:
4375 .. container:: listingblock
4377 .. container:: content
4381 Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4382 Sep 05, 2018 11:26:20 PM org.glassfish.grizzly.http.server.NetworkListener start
4383 INFO: Started listener bound to [localhost:18989]
4384 Sep 05, 2018 11:26:20 PM org.glassfish.grizzly.http.server.HttpServer start
4385 INFO: [HttpServer] Started.
4386 Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4388 .. container:: paragraph
4390 The last line states the URL on which the Monitoring Client
4391 can be accessed. The example above stated
4392 ``http://localhost:18989/apexservices``. In a web browser
4393 use the URL ``http://localhost:18989``.
4395 The APEX Deployment Client
4396 --------------------------
4398 .. container:: paragraph
4400 The standard way to use the APEX Deployment Client is via an
4401 installation of the *war* file on a webserver. However, the
4402 Deployment Client can also be started via command line. This
4403 will start a Grizzly webserver with the *war* deployed.
4404 Access to the Deployment Client is then via the provided URL
4406 .. container:: paragraph
4408 On UNIX and Cygwin systems use:
4410 .. container:: ulist
4412 - ``apexApps.sh eng-deployment`` - simply starts the
4413 webserver with the Deployment Client
4415 .. container:: paragraph
4417 On Windows systems use:
4419 .. container:: ulist
4421 - ``apexApps.bat eng-deployment`` - simply starts the
4422 webserver with the Deployment Client
4424 .. container:: paragraph
4426 The option ``-h`` provides a help screen with all command
4429 .. container:: listingblock
4431 .. container:: content
4435 usage: org.onap.policy.apex.client.deployment.rest.ApexDeploymentRestMain [options...]
4436 -h,--help outputs the usage of this command
4437 -p,--port <PORT> port to use for the Apex Services REST calls
4438 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating
4440 .. container:: paragraph
4442 If the Deployment Client is started without any arguments
4443 the final messages will look similar to this:
4445 .. container:: listingblock
4447 .. container:: content
4451 Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4452 Sep 05, 2018 11:27:09 PM org.glassfish.grizzly.http.server.NetworkListener start
4453 INFO: Started listener bound to [localhost:18989]
4454 Sep 05, 2018 11:27:09 PM org.glassfish.grizzly.http.server.HttpServer start
4455 INFO: [HttpServer] Started.
4456 Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4458 .. container:: paragraph
4460 The last line states the URL on which the Deployment Client
4461 can be accessed. The example above stated
4462 ``http://localhost:18989/apexservices``. In a web browser
4463 use the URL ``http://localhost:18989``.
4465 The APEX Full Client
4466 --------------------
4468 .. container:: paragraph
4470 The APEX Full Client combines the REST Editor, the
4471 Monitoring Client, and the Deployment Client into a single
4472 application. The standard way to use the APEX Full Client is
4473 via an installation of the *war* file on a webserver.
4474 However, the Full Client can also be started via command
4475 line. This will start a Grizzly webserver with the *war*
4476 deployed. Access to the Full Client is then via the provided
4479 .. container:: paragraph
4481 On UNIX and Cygwin systems use:
4483 .. container:: ulist
4485 - ``apexApps.sh full-client`` - simply starts the webserver
4486 with the Full Client
4488 .. container:: paragraph
4490 On Windows systems use:
4492 .. container:: ulist
4494 - ``apexApps.bat full-client`` - simply starts the
4495 webserver with the Full Client
4497 .. container:: paragraph
4499 The option ``-h`` provides a help screen with all command
4502 .. container:: listingblock
4504 .. container:: content
4508 usage: org.onap.policy.apex.client.full.rest.ApexServicesRestMain [options...]
4509 -h,--help outputs the usage of this command
4510 -p,--port <PORT> port to use for the Apex Services REST calls
4511 -t,--time-to-live <TIME_TO_LIVE> the amount of time in seconds that the server will run for before terminating
4513 .. container:: paragraph
4515 If the Full Client is started without any arguments the
4516 final messages will look similar to this:
4518 .. container:: listingblock
4520 .. container:: content
4524 Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=READY) starting at http://localhost:18989/apexservices/ . . .
4525 Sep 05, 2018 11:28:28 PM org.glassfish.grizzly.http.server.NetworkListener start
4526 INFO: Started listener bound to [localhost:18989]
4527 Sep 05, 2018 11:28:28 PM org.glassfish.grizzly.http.server.HttpServer start
4528 INFO: [HttpServer] Started.
4529 Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=RUNNING) started at http://localhost:18989/apexservices/
4531 .. container:: paragraph
4533 The last line states the URL on which the Monitoring Client
4534 can be accessed. The example above stated
4535 ``http://localhost:18989/apexservices``. In a web browser
4536 use the URL ``http://localhost:18989``.
4538 The APEX Application Launcher
4539 -----------------------------
4541 .. container:: paragraph
4543 The standard applications (Engine, CLI Editor, REST Editor)
4544 come with dedicated start scripts. For all other APEX
4545 applications, we provide an application launcher.
4547 .. container:: paragraph
4549 On UNIX and Cygwin systems use:
4551 .. container:: ulist
4553 - apexApps.sh\` - simply starts the application launcher
4555 .. container:: paragraph
4557 On Windows systems use:
4559 .. container:: ulist
4561 - ``apexApps.bat`` - simply starts the application launcher
4563 .. container:: paragraph
4565 Summary of alternatives to start the APEX application
4568 +-------------------------------------------------+---------------------------------------------------+
4569 | Unix, Cygwin | Windows |
4570 +=================================================+===================================================+
4571 | .. container:: | .. container:: |
4573 | .. container:: listingblock | .. container:: listingblock |
4575 | .. container:: content | .. container:: content |
4577 | .. code:: | .. code:: |
4579 | # $APEX_HOME/bin/apexApps.sh [args] | > %APEX_HOME%\bin\apexApps.bat [args] |
4580 +-------------------------------------------------+---------------------------------------------------+
4582 .. container:: paragraph
4584 The option ``-h`` provides a help screen with all launcher
4585 command line arguments.
4587 .. container:: listingblock
4589 .. container:: content
4593 apexApps.sh - runs APEX applications
4595 Usage: apexApps.sh [options] | [<application> [<application options>]]
4598 -d <app> - describes an application
4599 -l - lists all applications supported by this script
4600 -h - this help screen
4602 .. container:: paragraph
4604 Using ``-l`` lists all known application the launcher can
4607 .. container:: listingblock
4609 .. container:: content
4613 apexApps.sh: supported applications:
4614 --> ws-echo engine eng-monitoring full-client eng-deployment tpl-event-json model-2-cli rest-editor cli-editor ws-console
4616 .. container:: paragraph
4618 Using the ``-d <name>`` option describes the named
4619 application, for instance for the ``ws-console``:
4621 .. container:: listingblock
4623 .. container:: content
4627 apexApps.sh: application 'ws-console'
4628 --> a simple console sending events to APEX, connect to APEX consumer port
4630 .. container:: paragraph
4632 Launching an application is done by calling the script with
4633 only the application name and any CLI arguments for the
4634 application. For instance, starting the ``ws-echo``
4635 application with port ``8888``:
4637 .. container:: listingblock
4639 .. container:: content
4643 apexApps.sh ws-echo -p 8888
4645 Application: Create Event Templates
4646 -----------------------------------
4648 .. container:: paragraph
4650 **Status: Experimental**
4652 .. container:: paragraph
4654 This application takes a policy model (JSON or XML encoded)
4655 and generates templates for events in JSON format. This can
4656 help when a policy defines rather complex trigger or action
4657 events or complex events between states. The application can
4658 produce events for the types: stimuli (policy trigger
4659 events), internal (events between policy states), and
4660 response (action events).
4662 +----------------------------------------------------------------+------------------------------------------------------------------+
4663 | Unix, Cygwin | Windows |
4664 +================================================================+==================================================================+
4665 | .. container:: | .. container:: |
4667 | .. container:: listingblock | .. container:: listingblock |
4669 | .. container:: content | .. container:: content |
4671 | .. code:: | .. code:: |
4673 | # $APEX_HOME/bin/apexApps.sh tpl-event-json [args] | > %APEX_HOME%\bin\apexApps.bat tpl-event-json [args] |
4674 +----------------------------------------------------------------+------------------------------------------------------------------+
4676 .. container:: paragraph
4678 The option ``-h`` provides a help screen.
4680 .. container:: listingblock
4682 .. container:: content
4686 gen-model2event v{release-version} - generates JSON templates for events generated from a policy model
4687 usage: gen-model2event
4688 -h,--help prints this help and usage screen
4689 -m,--model <MODEL-FILE> set the input policy model file
4690 -t,--type <TYPE> set the event type for generation, one of:
4691 stimuli (trigger events), response (action
4692 events), internal (events between states)
4693 -v,--version prints the application version
4695 .. container:: paragraph
4697 The created templates are not valid events, instead they use
4698 some markup for values one will need to change to actual
4699 values. For instance, running the tool with the *Sample
4700 Domain* policy model as:
4702 .. container:: listingblock
4704 .. container:: content
4708 apexApps.sh tpl-event-json -m $APEX_HOME/examples/models/SampleDomain/SamplePolicyModelJAVA.json -t stimuli
4710 .. container:: paragraph
4712 will produce the following status messages:
4714 .. container:: listingblock
4716 .. container:: content
4720 gen-model2event: starting Event generator
4721 --> model file: examples/models/SampleDomain/SamplePolicyModelJAVA.json
4724 .. container:: paragraph
4726 and then run the generator application producing two event
4727 templates. The first template is called ``Event0000``.
4729 .. container:: listingblock
4731 .. container:: content
4736 "name" : "Event0000",
4737 "nameSpace" : "org.onap.policy.apex.sample.events",
4738 "version" : "0.0.1",
4739 "source" : "Outside",
4741 "TestTemperature" : ###double: 0.0###,
4742 "TestTimestamp" : ###long: 0###,
4743 "TestMatchCase" : ###integer: 0###,
4744 "TestSlogan" : "###string###"
4747 .. container:: paragraph
4749 The values for the keys are marked with ``#`` and the
4750 expected type of the value. To create an actual stimuli
4751 event, all these markers need to be change to actual values,
4754 .. container:: listingblock
4756 .. container:: content
4761 "name" : "Event0000",
4762 "nameSpace" : "org.onap.policy.apex.sample.events",
4763 "version" : "0.0.1",
4764 "source" : "Outside",
4766 "TestTemperature" : 25,
4767 "TestTimestamp" : 123456789123456789,
4768 "TestMatchCase" : 1,
4769 "TestSlogan" : "Testing the Match Case with Temperature 25"
4772 Application: Convert a Policy Model to CLI Editor Commands
4773 ----------------------------------------------------------
4775 .. container:: paragraph
4777 **Status: Experimental**
4779 .. container:: paragraph
4781 This application takes a policy model (JSON or XML encoded)
4782 and generates commands for the APEX CLI Editor. This
4783 effectively reverses a policy specification realized with
4786 +-------------------------------------------------------------+---------------------------------------------------------------+
4787 | Unix, Cygwin | Windows |
4788 +=============================================================+===============================================================+
4789 | .. container:: | .. container:: |
4791 | .. container:: listingblock | .. container:: listingblock |
4793 | .. container:: content | .. container:: content |
4795 | .. code:: | .. code:: |
4797 | # $APEX_HOME/bin/apexApps.sh model-2-cli [args] | > %APEX_HOME%\bin\apexApps.bat model-2-cli [args] |
4798 +-------------------------------------------------------------+---------------------------------------------------------------+
4800 .. container:: paragraph
4802 The option ``-h`` provides a help screen.
4804 .. container:: listingblock
4806 .. container:: content
4810 usage: gen-model2cli
4811 -h,--help prints this help and usage screen
4812 -m,--model <MODEL-FILE> set the input policy model file
4813 -sv,--skip-validation switch of validation of the input file
4814 -v,--version prints the application version
4816 .. container:: paragraph
4818 For instance, running the tool with the *Sample Domain*
4821 .. container:: listingblock
4823 .. container:: content
4827 apexApps.sh model-2-cli -m $APEX_HOME/examples/models/SampleDomain/SamplePolicyModelJAVA.json
4829 .. container:: paragraph
4831 will produce the following status messages:
4833 .. container:: listingblock
4835 .. container:: content
4839 gen-model2cli: starting CLI generator
4840 --> model file: examples/models/SampleDomain/SamplePolicyModelJAVA.json
4842 .. container:: paragraph
4844 and then run the generator application producing all CLI
4845 Editor commands and printing them to standard out.
4847 Application: Websocket Clients (Echo and Console)
4848 -------------------------------------------------
4850 .. container:: paragraph
4852 **Status: Production**
4854 .. container:: paragraph
4856 The application launcher also provides a Websocket echo
4857 client and a Websocket console client. The echo client
4858 connects to APEX and prints all events it receives from
4859 APEX. The console client connects to APEX, reads input from
4860 the command line, and sends this input as events to APEX.
4862 +------------------------------------------------------------+--------------------------------------------------------------+
4863 | Unix, Cygwin | Windows |
4864 +============================================================+==============================================================+
4865 | .. container:: | .. container:: |
4867 | .. container:: listingblock | .. container:: listingblock |
4869 | .. container:: content | .. container:: content |
4871 | .. code:: | .. code:: |
4873 | # $APEX_HOME/bin/apexApps.sh ws-echo [args] | > %APEX_HOME%\bin\apexApps.bat ws-echo [args] |
4874 | # $APEX_HOME/bin/apexApps.sh ws-console [args] | > %APEX_HOME%\bin\apexApps.bat ws-console [args] |
4875 +------------------------------------------------------------+--------------------------------------------------------------+
4877 .. container:: paragraph
4879 The arguments are the same for both applications:
4881 .. container:: ulist
4883 - ``-p`` defines the Websocket port to connect to (defaults
4886 - ``-s`` defines the host on which a Websocket server is
4887 running (defaults to ``localhost``)
4889 .. container:: paragraph
4891 A discussion on how to use these two applications to build
4892 an APEX system is detailed HowTo-Websockets.
4897 Introduction to APEX Logging
4898 ----------------------------
4900 .. container:: paragraph
4902 All APEX components make extensive use of logging using the
4903 logging façade `SLF4J <https://www.slf4j.org/>`__ with the
4904 backend `Logback <https://logback.qos.ch/>`__. Both are used
4905 off-the-shelve, so the standard documentation and
4906 configuration apply to APEX logging. For details on how to
4907 work with logback please see the `logback
4908 manual <https://logback.qos.ch/manual/index.html>`__.
4910 .. container:: paragraph
4912 The APEX applications is the logback configuration file
4913 ``$APEX_HOME/etc/logback.xml`` (Windows:
4914 ``%APEX_HOME%\etc\logback.xml``). The logging backend is set
4915 to no debug, i.e. logs from the logging framework should be
4918 .. container:: paragraph
4920 The configurable log levels work as expected:
4922 .. container:: ulist
4924 - *error* (or *ERROR*) is used for serious errors in the
4927 - *warn* (or *WARN*) is used for warnings, which in general
4928 can be ignored but might indicate some deeper problems
4930 - *info* (or *INFO*) is used to provide generally
4931 interesting messages for startup and policy execution
4933 - *debug* (or *DEBUG*) provides more details on startup and
4936 - *trace* (or *TRACE*) gives full details on every aspect
4937 of the APEX engine from start to end
4939 .. container:: paragraph
4941 The loggers can also be configured as expected. The standard
4942 configuration (after installing APEX) uses log level *info*
4943 on all APEX classes (components).
4945 .. container:: paragraph
4947 The applications and scripts in ``$APEX_HOME/bin`` (Windows:
4948 ``%APEX_HOME\bin``) are configured to use the logback
4949 configuration ``$APEX_HOME/etc/logback.xml`` (Windows:
4950 ``%APEX_HOME\etc\logback.xml``). There are multiple ways to
4951 use different logback configurations, for instance:
4953 .. container:: ulist
4955 - Maintain multiple configurations in ``etc``, for instance
4956 a ``logback-debug.xml`` for deep debugging and a
4957 ``logback-production.xml`` for APEX in production mode,
4958 then copy the required configuration file to the used
4959 ``logback.xml`` prior starting APEX
4961 - Edit the scripts in ``bin`` to use a different logback
4962 configuration file (only recommended if you are familiar
4963 with editing bash scripts or windows batch files)
4965 Standard Logging Configuration
4966 ------------------------------
4968 .. container:: paragraph
4970 The standard logging configuration defines a context *APEX*,
4971 which is used in the standard output pattern. The location
4972 for log files is defined in the property ``logDir`` and set
4973 to ``/var/log/onap/policy/apex-pdp``. The standard status
4974 listener is set to *NOP* and the overall logback
4975 configuration is set to no debug.
4977 .. container:: listingblock
4979 .. container:: content
4984 <configuration debug="false">
4985 <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
4987 <contextName>Apex</contextName>
4988 <property name="logDir" value="/var/log/onap/policy/apex-pdp/" />
4994 .. container:: paragraph
4996 The first appender defined is called ``STDOUT`` for logs to standard
4999 .. container:: listingblock
5001 .. container:: content
5006 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5008 <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
5012 .. container:: paragraph
5014 The root level logger then is set to the level *info* using the
5015 standard out appender.
5017 .. container:: listingblock
5019 .. container:: content
5025 <appender-ref ref="STDOUT" />
5028 .. container:: paragraph
5030 The second appender is called ``FILE``. It writes logs to a file
5033 .. container:: listingblock
5035 .. container:: content
5040 <appender name="FILE" class="ch.qos.logback.core.FileAppender">
5041 <file>${logDir}/apex.log</file>
5043 <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %n %ex{full}</pattern>
5047 .. container:: paragraph
5049 The third appender is called ``CTXT_FILE``. It writes logs to a file
5052 .. container:: listingblock
5054 .. container:: content
5059 <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
5060 <file>${logDir}/apex_ctxt.log</file>
5062 <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %n %ex{full}</pattern>
5066 .. container:: paragraph
5068 The last definitions are for specific loggers. The first logger
5069 captures all standard APEX classes. It is configured for log level
5070 *info* and uses the standard output and file appenders. The second
5071 logger captures APEX context classes responsible for context
5072 monitoring. It is configured for log level *trace* and uses the
5073 context file appender.
5075 .. container:: listingblock
5077 .. container:: content
5083 <logger name="org.onap.policy.apex" level="info" additivity="false">
5084 <appender-ref ref="STDOUT" />
5085 <appender-ref ref="FILE" />
5088 <logger name="org.onap.policy.apex.core.context.monitoring" level="TRACE" additivity="false">
5089 <appender-ref ref="CTXT_FILE" />
5092 Adding Logback Status and Debug
5093 -------------------------------
5095 .. container:: paragraph
5097 To activate logback status messages change the status listener
5098 from 'NOP' to for instance console.
5100 .. container:: listingblock
5102 .. container:: content
5106 <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
5108 .. container:: paragraph
5110 To activate all logback debugging, for instance to debug a new
5111 logback configuration, activate the debug attribute in the
5114 .. container:: listingblock
5116 .. container:: content
5120 <configuration debug="true">
5124 Logging External Components
5125 ---------------------------
5127 .. container:: paragraph
5129 Logback can also be configured to log any other, external
5130 components APEX is using, if they are using the common logging
5133 .. container:: paragraph
5135 For instance, the context component of APEX is using *Infinispan*
5136 and one can add a logger for this external component. The
5137 following example adds a logger for *Infinispan* using the
5138 standard output appender.
5140 .. container:: listingblock
5142 .. container:: content
5146 <logger name="org.infinispan" level="INFO" additivity="false">
5147 <appender-ref ref="STDOUT" />
5150 .. container:: paragraph
5152 Another example is Apache Zookeeper. The following example adds a
5153 logger for Zookeeper using the standard outout appender.
5155 .. container:: listingblock
5157 .. container:: content
5161 <logger name="org.apache.zookeeper.ClientCnxn" level="INFO" additivity="false">
5162 <appender-ref ref="STDOUT" />
5165 Configuring loggers for Policy Logic
5166 ------------------------------------
5168 .. container:: paragraph
5170 The logging for the logic inside a policy (task logic, task
5171 selection logic, state finalizer logic) can be configured separate
5172 from standard logging. The logger for policy logic is
5173 ``org.onap.policy.apex.executionlogging``. The following example
5176 .. container:: ulist
5178 - a new appender for standard out using a very simple pattern
5179 (simply the actual message)
5181 - a logger for policy logic to standard out using the new
5182 appender and the already described file appender.
5184 .. container:: listingblock
5186 .. container:: content
5190 <appender name="POLICY_APPENDER_STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5192 <pattern>policy: %msg\n</pattern>
5196 <logger name="org.onap.policy.apex.executionlogging" level="info" additivity="false">
5197 <appender-ref ref="POLICY_APPENDER_STDOUT" />
5198 <appender-ref ref="FILE" />
5201 .. container:: paragraph
5203 It is also possible to use specific logging for parts of policy
5204 logic. The following example defines a logger for task logic.
5206 .. container:: listingblock
5208 .. container:: content
5212 <logger name="org.onap.policy.apex.executionlogging.TaskExecutionLogging" level="TRACE" additivity="false">
5213 <appender-ref ref="POLICY_APPENDER_STDOUT" />
5216 Rolling File Appenders
5217 ----------------------
5219 .. container:: paragraph
5221 Rolling file appenders are a good option for more complex logging
5222 of a production or complex testing APEX installation. The standard
5223 logback configuration can be used for these use cases. This
5224 section gives two examples for the standard logging and for
5227 .. container:: paragraph
5229 First the standard logging. The following example defines a
5230 rolling file appender. The appender rolls over on a daily basis.
5231 It allows for a file size of 100 MB.
5233 .. container:: listingblock
5235 .. container:: content
5239 <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
5240 <file>${logDir}/apex.log</file>
5241 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
5242 <!-- rollover daily -->
5243 <!-- <fileNamePattern>xstream-%d{yyyy-MM-dd}.%i.txt</fileNamePattern> -->
5244 <fileNamePattern>${logDir}/apex_%d{yyyy-MM-dd}.%i.log.gz
5246 <maxHistory>4</maxHistory>
5247 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
5248 <!-- or whenever the file size reaches 100MB -->
5249 <maxFileSize>100MB</maxFileSize>
5250 </timeBasedFileNamingAndTriggeringPolicy>
5254 %d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %ex{full} %n
5259 .. container:: paragraph
5261 A very similar configuration can be used for a rolling file
5262 appender logging APEX context.
5264 .. container:: listingblock
5266 .. container:: content
5270 <appender name="CTXT-FILE"
5271 class="ch.qos.logback.core.rolling.RollingFileAppender">
5272 <file>${logDir}/apex_ctxt.log</file>
5273 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
5274 <fileNamePattern>${logDir}/apex_ctxt_%d{yyyy-MM-dd}.%i.log.gz
5276 <maxHistory>4</maxHistory>
5277 <timeBasedFileNamingAndTriggeringPolicy
5278 class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
5279 <maxFileSize>100MB</maxFileSize>
5280 </timeBasedFileNamingAndTriggeringPolicy>
5284 %d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %ex{full} %n
5289 Example Configuration for Logging Logic
5290 ---------------------------------------
5292 .. container:: paragraph
5294 The following example shows a configuration that logs policy logic
5295 to standard out and a file (*info*). All other APEX components are
5296 logging to a file (*debug*).. This configuration an be used in a
5297 pre-production phase with the APEX engine still running in a
5298 separate terminal to monitor policy execution. This logback
5299 configuration is in the APEX installation as
5300 ``etc/logback-logic.xml``.
5302 .. container:: listingblock
5304 .. container:: content
5308 <configuration debug="false">
5309 <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
5311 <contextName>Apex</contextName>
5312 <property name="logDir" value="/var/log/onap/policy/apex-pdp/" />
5314 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5316 <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
5320 <appender name="FILE" class="ch.qos.logback.core.FileAppender">
5321 <file>${logDir}/apex.log</file>
5324 %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full}
5329 <appender name="POLICY_APPENDER_STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5331 <pattern>policy: %msg\n</pattern>
5335 <root level="error">
5336 <appender-ref ref="STDOUT" />
5339 <logger name="org.onap.policy.apex" level="debug" additivity="false">
5340 <appender-ref ref="FILE" />
5343 <logger name="org.onap.policy.apex.executionlogging" level="info" additivity="false">
5344 <appender-ref ref="POLICY_APPENDER_STDOUT" />
5345 <appender-ref ref="FILE" />
5349 Example Configuration for a Production Server
5350 ---------------------------------------------
5352 .. container:: paragraph
5354 The following example shows a configuration that logs all APEX
5355 components, including policy logic, to a file (*debug*). This
5356 configuration an be used in a production phase with the APEX
5357 engine being executed as a service on a system without console
5358 output. This logback configuration is in the APEX installation as
5359 ``logback-server.xml``
5361 .. container:: listingblock
5363 .. container:: content
5367 <configuration debug="false">
5368 <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
5370 <contextName>Apex</contextName>
5371 <property name="logDir" value="/var/log/onap/policy/apex-pdp/" />
5373 <appender name="FILE" class="ch.qos.logback.core.FileAppender">
5374 <file>${logDir}/apex.log</file>
5377 %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full}
5382 <root level="debug">
5383 <appender-ref ref="FILE" />
5386 <logger name="org.onap.policy.apex.executionlogging" level="debug" additivity="false">
5387 <appender-ref ref="FILE" />
5391 Building a System with Websocket Backend
5392 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5397 .. container:: paragraph
5399 Websocket is a protocol to run sockets of HTTP. Since it in
5400 essence a socket, the connection is realized between a
5401 server (waiting for connections) and a client (connecting to
5402 a server). Server/client separation is only important for
5403 connection establishment, once connected, everyone can
5404 send/receive on the same socket (as any standard socket
5407 .. container:: paragraph
5409 Standard Websocket implementations are simple, no
5410 publish/subscribe and no special event handling. Most
5411 servers simply send all incoming messages to all
5412 connections. There is a PubSub definition on top of
5413 Websocket called `WAMP <http://wamp-proto.org/>`__. APEX
5414 does not support WAMP at the moment.
5419 .. container:: paragraph
5422 356 <http://www.oracle.com/technetwork/articles/java/jsr356-1937161.html>`__
5423 defines the standard Websocket API. This JSR is part of Jave
5424 EE 7 standard. For Java SE, several implementations exist in
5425 open source. Since Websockets are a stable standard and
5426 simple, most implementations are stable and ready to use. A
5427 lot of products support Websockets, like Spring, JBoss,
5428 Netty, … there are also Kafka extensions for Websockets.
5430 Websocket Example Code for Websocket clients (FOSS)
5431 ---------------------------------------------------
5433 .. container:: paragraph
5435 There are a lot of implementations and examples available on
5436 Github for Websocket clients. If one is using Java EE 7,
5437 then one can also use the native Websocket implementation.
5438 Good examples for clients using simply Java SE are here:
5440 .. container:: ulist
5443 implementation <https://github.com/TooTallNate/Java-WebSocket>`__
5445 - `Websocket sending client example, using
5446 AWT <https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/ChatClient.java>`__
5448 - `Websocket receiving client example (simple echo
5449 client) <https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/ExampleClient.java>`__
5451 .. container:: paragraph
5453 For Java EE, the native Websocket API is explained here:
5455 .. container:: ulist
5458 docs <http://www.oracle.com/technetwork/articles/java/jsr356-1937161.html>`__
5461 example <http://www.programmingforliving.com/2013/08/jsr-356-java-api-for-websocket-client-api.html>`__
5463 BCP: Websocket Configuration
5464 ----------------------------
5466 .. container:: paragraph
5468 The probably best is to configure APEX for Websocket servers
5469 for input (ingress, consume) and output (egress, produce)
5470 interfaces. This means that APEX will start Websocket
5471 servers on named ports and wait for clients to connect.
5472 Advantage: once APEX is running all connectivity
5473 infrastructure is running as well. Consequence: if APEX is
5474 not running, everyone else is in the dark, too.
5476 .. container:: paragraph
5478 The best protocol to be used is JSON string. Each event on
5479 any interface is then a string with a JSON encoding. JSON
5480 string is a little bit slower than byte code, but we doubt
5481 that this will be noticeable. A further advantage of JSON
5482 strings over Websockets with APEX starting the servers: it
5483 is very easy to connect web browsers to such a system.
5484 Simple connect the web browser to the APEX sockets and
5485 send/read JSON strings.
5487 .. container:: paragraph
5489 Once APEX is started you simply connect Websocket clients to
5490 it, and send/receive event. When APEX is terminated, the
5491 Websocket servers go down, and the clients will be
5492 disconnected. APEX does not (yet) support auto-client
5493 reconnect nor WAMP, so clients might need to be restarted or
5494 reconnected manually after an APEX boot.
5496 Demo with VPN Policy Model
5497 --------------------------
5499 .. container:: paragraph
5501 We assume that you have an APEX installation using the full
5502 package, i.e. APEX with all examples, of version ``0.5.6``
5503 or higher. We will use the VPN policy from the APEX examples
5506 .. container:: paragraph
5508 Now, have the following ready to start the demo:
5510 .. container:: ulist
5512 - 3 terminals on the host where APEX is running (we need 1
5513 for APEX and 1 for each client)
5515 - the events in the file
5516 ``$APEX_HOME/examples/events/VPN/SetupEvents.json`` open
5517 in an editor (we need to send those events to APEX)
5519 - the events in the file
5520 ``$APEX_HOME/examples/events/VPN/Link09Events.json`` open
5521 in an editor (we need to send those events to APEX)
5523 A Websocket Configuration for the VPN Domain
5524 ############################################
5526 .. container:: paragraph
5528 Create a new APEX configuration using the VPN policy
5529 model and configuring APEX as discussed above for
5530 Websockets. Copy the following configuration into
5531 ``$APEX_HOME/examples/config/VPN/Ws2WsServerAvroContextJsonEvent.json``
5533 ``%APEX_HOME%\examples\config\VPN\Ws2WsServerAvroContextJsonEvent.json``):
5535 .. container:: listingblock
5537 .. container:: content
5543 "engineServiceParameters" : {
5544 "name" : "VPNApexEngine",
5545 "version" : "0.0.1",
5547 "instanceCount" : 1,
5548 "deploymentPort" : 12345,
5549 "policyModelFileName" : "examples/models/VPN/VPNPolicyModelAvro.json",
5550 "engineParameters" : {
5551 "executorParameters" : {
5553 "parameterClassName" : "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters"
5556 "contextParameters" : {
5557 "parameterClassName" : "org.onap.policy.apex.context.parameters.ContextParameters",
5558 "schemaParameters":{
5560 "parameterClassName" : "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
5566 "producerCarrierTechnologyParameters" : {
5567 "carrierTechnology" : "WEBSOCKET",
5568 "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
5574 "producerEventProtocolParameters" : {
5575 "eventProtocol" : "JSON"
5577 "consumerCarrierTechnologyParameters" : {
5578 "carrierTechnology" : "WEBSOCKET",
5579 "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
5585 "consumerEventProtocolParameters" : {
5586 "eventProtocol" : "JSON"
5593 .. container:: paragraph
5595 In a new terminal, start APEX with the new configuration for
5596 Websocket-Server ingress/egress:
5598 .. container:: listingblock
5600 .. container:: content
5605 #: $APEX_HOME/bin/apexEngine.sh -c $APEX_HOME/examples/config/VPN/Ws2WsServerAvroContextJsonEvent.json
5607 .. container:: listingblock
5609 .. container:: content
5614 #: %APEX_HOME%\bin\apexEngine.bat -c %APEX_HOME%\examples\config\VPN\Ws2WsServerAvroContextJsonEvent.json
5616 .. container:: paragraph
5618 Wait for APEX to start, it takes a while to create all Websocket
5619 servers (about 8 seconds on a standard laptop without cached
5620 binaries). depending on your log messages, you will see no (some, a
5621 lot) log messages. If APEX starts correctly, the last few messages
5624 .. container:: listingblock
5626 .. container:: content
5631 2017-07-28 13:17:20,834 Apex [main] INFO c.e.a.s.engine.runtime.EngineService - engine model VPNPolicyModelAvro:0.0.1 added to the engine-AxArtifactKey:(name=VPNApexEngine-0,version=0.0.1)
5632 2017-07-28 13:17:21,057 Apex [Apex-apex-engine-service-0:0] INFO c.e.a.s.engine.runtime.EngineService - Engine AxArtifactKey:(name=VPNApexEngine-0,version=0.0.1) processing ...
5633 2017-07-28 13:17:21,296 Apex [main] INFO c.e.a.s.e.r.impl.EngineServiceImpl - Added the action listener to the engine
5634 Started Apex service
5636 .. container:: paragraph
5638 APEX is running in the new terminal and will produce output when the
5639 policy is triggered/executed.
5641 Run the Websocket Echo Client
5642 #############################
5644 .. container:: paragraph
5646 The echo client is included in an APEX full installation. To run
5647 the client, open a new shell (Unix, Cygwin) or command prompt
5648 (``cmd`` on Windows). Then use the APEX application launcher to
5652 APEX engine needs to run first
5653 The example assumes that an APEX engine configured for *produce* carrier technology Websocket and *JSON* event protocol is executed first.
5655 +---------------------------------------------------------+-----------------------------------------------------------+
5656 | Unix, Cygwin | Windows |
5657 +=========================================================+===========================================================+
5658 | .. container:: | .. container:: |
5660 | .. container:: listingblock | .. container:: listingblock |
5662 | .. container:: content | .. container:: content |
5664 | .. code:: | .. code:: |
5666 | # $APEX_HOME/bin/apexApps.sh ws-echo [args] | > %APEX_HOME%\bin\apexApps.bat ws-echo [args] |
5667 +---------------------------------------------------------+-----------------------------------------------------------+
5669 .. container:: paragraph
5671 Use the following command line arguments for server and port of
5672 the Websocket server. The port should be the same as configured in
5673 the APEX engine. The server host should be the host on which the
5674 APEX engine is running
5676 .. container:: ulist
5678 - ``-p`` defines the Websocket port to connect to (defaults to
5681 - ``-s`` defines the host on which a Websocket server is running
5682 (defaults to ``localhost``)
5684 .. container:: paragraph
5686 Let’s assume that there is an APEX engine running, configured for
5687 produce Websocket carrier technology, as server, for port 42452,
5688 with produce event protocol JSON,. If we start the console client
5689 on the same host, we can omit the ``-s`` options. We start the
5692 .. container:: listingblock
5694 .. container:: content
5698 # $APEX_HOME/bin/apexApps.sh ws-echo -p 42452 (1)
5699 > %APEX_HOME%\bin\apexApps.bat ws-echo -p 42452 (2)
5701 .. container:: colist arabic
5703 +-------+--------------------------------+
5704 | **1** | Start client on Unix or Cygwin |
5705 +-------+--------------------------------+
5706 | **2** | Start client on Windows |
5707 +-------+--------------------------------+
5709 .. container:: paragraph
5711 Once started successfully, the client will produce the following
5712 messages (assuming we used ``-p 42452`` and an APEX engine is
5713 running on ``localhost`` with the same port:
5715 .. container:: listingblock
5717 .. container:: content
5721 ws-simple-echo: starting simple event echo
5722 --> server: localhost
5725 Once started, the application will simply print out all received events to standard out.
5726 Each received event will be prefixed by '---' and suffixed by '===='
5729 ws-simple-echo: opened connection to APEX (Web Socket Protocol Handshake)
5731 Run the Websocket Console Client
5732 ################################
5734 .. container:: paragraph
5736 The console client is included in an APEX full installation. To
5737 run the client, open a new shell (Unix, Cygwin) or command prompt
5738 (``cmd`` on Windows). Then use the APEX application launcher to
5742 APEX engine needs to run first
5743 The example assumes that an APEX engine configured for *consume* carrier technology Websocket and *JSON* event
5744 protocol is executed first.
5746 +------------------------------------------------------------+--------------------------------------------------------------+
5747 | Unix, Cygwin | Windows |
5748 +============================================================+==============================================================+
5749 | .. container:: | .. container:: |
5751 | .. container:: listingblock | .. container:: listingblock |
5753 | .. container:: content | .. container:: content |
5755 | .. code:: | .. code:: |
5757 | # $APEX_HOME/bin/apexApps.sh ws-console [args] | > %APEX_HOME%\bin\apexApps.bat ws-console [args] |
5758 +------------------------------------------------------------+--------------------------------------------------------------+
5760 .. container:: paragraph
5762 Use the following command line arguments for server and port of
5763 the Websocket server. The port should be the same as configured in
5764 the APEX engine. The server host should be the host on which the
5765 APEX engine is running
5767 .. container:: ulist
5769 - ``-p`` defines the Websocket port to connect to (defaults to
5772 - ``-s`` defines the host on which a Websocket server is running
5773 (defaults to ``localhost``)
5775 .. container:: paragraph
5777 Let’s assume that there is an APEX engine running, configured for
5778 consume Websocket carrier technology, as server, for port 42450,
5779 with consume event protocol JSON,. If we start the console client
5780 on the same host, we can omit the ``-s`` options. We start the
5783 .. container:: listingblock
5785 .. container:: content
5789 # $APEX_HOME/bin/apexApps.sh ws-console -p 42450 (1)
5790 > %APEX_HOME%\bin\apexApps.sh ws-console -p 42450 (2)
5792 .. container:: colist arabic
5794 +-------+--------------------------------+
5795 | **1** | Start client on Unix or Cygwin |
5796 +-------+--------------------------------+
5797 | **2** | Start client on Windows |
5798 +-------+--------------------------------+
5800 .. container:: paragraph
5802 Once started successfully, the client will produce the following
5803 messages (assuming we used ``-p 42450`` and an APEX engine is
5804 running on ``localhost`` with the same port:
5806 .. container:: listingblock
5808 .. container:: content
5812 ws-simple-console: starting simple event console
5813 --> server: localhost
5816 - terminate the application typing 'exit<enter>' or using 'CTRL+C'
5817 - events are created by a non-blank starting line and terminated by a blank line
5820 ws-simple-console: opened connection to APEX (Web Socket Protocol Handshake)
5825 .. container:: paragraph
5827 Now you have the full system up and running:
5829 .. container:: ulist
5831 - Terminal 1: APEX ready and loaded
5833 - Terminal 2: an echo client, printing received messages produced
5836 - Terminal 2: a console client, waiting for input on the console
5837 (standard in) and sending text to APEX
5839 .. container:: paragraph
5841 We started the engine with the VPN policy example. So all the
5842 events we are using now are located in files in the following
5845 .. container:: listingblock
5847 .. container:: content
5852 #: $APEX_HOME/examples/events/VPN
5853 > %APEX_HOME%\examples\events\VPN
5855 .. container:: paragraph
5857 To sends events, simply copy the content of the event files into
5858 Terminal 3 (the console client). It will read multi-line JSON text
5859 and send the events. So copy the content of ``SetupEvents.json`` into
5860 the client. APEX will trigger a policy and produce some output, the
5861 echo client will also print some events created in the policy. In
5862 Terminal 1 (APEX) you’ll see some status messages from the policy as:
5864 .. container:: listingblock
5866 .. container:: content
5871 {Link=L09, LinkUp=true}
5873 outFields: {Link=L09, LinkUp=true}
5874 {Link=L10, LinkUp=true}
5877 outFields: {Link=L10, LinkUp=true}
5878 {CustomerName=C, LinkList=L09 L10, SlaDT=300, YtdDT=300}
5880 C 300 300 [L09, L10]
5881 outFields: {CustomerName=C, LinkList=L09 L10, SlaDT=300, YtdDT=300}
5882 {CustomerName=A, LinkList=L09 L10, SlaDT=300, YtdDT=50}
5885 C 300 300 [L09, L10]
5886 outFields: {CustomerName=A, LinkList=L09 L10, SlaDT=300, YtdDT=50}
5887 {CustomerName=D, LinkList=L09 L10, SlaDT=300, YtdDT=400}
5890 C 300 300 [L09, L10]
5891 D 300 400 [L09, L10]
5892 outFields: {CustomerName=D, LinkList=L09 L10, SlaDT=300, YtdDT=400}
5893 {CustomerName=B, LinkList=L09 L10, SlaDT=300, YtdDT=299}
5896 B 300 299 [L09, L10]
5897 C 300 300 [L09, L10]
5898 D 300 400 [L09, L10]
5899 outFields: {CustomerName=B, LinkList=L09 L10, SlaDT=300, YtdDT=299}
5901 .. container:: paragraph
5903 In Terminal 2 (echo-client) you see the received events, the last two
5906 .. container:: listingblock
5908 .. container:: content
5913 ws-simple-echo: received
5914 ---------------------------------
5916 "name": "VPNCustomerCtxtActEvent",
5918 "nameSpace": "org.onap.policy.apex.domains.vpn.events",
5921 "CustomerName": "C",
5922 "LinkList": "L09 L10",
5926 =================================
5928 ws-simple-echo: received
5929 ---------------------------------
5931 "name": "VPNCustomerCtxtActEvent",
5933 "nameSpace": "org.onap.policy.apex.domains.vpn.events",
5936 "CustomerName": "D",
5937 "LinkList": "L09 L10",
5941 =================================
5943 .. container:: paragraph
5945 Congratulations, you have triggered a policy in APEX using
5946 Websockets, the policy did run through, created events, picked up by
5949 .. container:: paragraph
5951 Now you can send the Link 09 and Link 10 events, they will trigger
5952 the actual VPN policy and some calculations are made. Let’s take the
5953 Link 09 events from ``Link09Events.json``, copy them all into
5954 Terminal 3 (the console). APEX will run the policy (with some status
5955 output), and the echo client will receive and print events.
5957 .. container:: paragraph
5959 To terminate the applications, simply press ``CTRL+C`` in Terminal 1
5960 (APEX). This will also terminate the echo-client in Terminal 2. Then
5961 type ``exit<enter>`` in Terminal 3 (or ``CTRL+C``) to terminate the
5971 Last updated 2018-09-10 15:38:16 IST
5973 .. |Extract the TAR archive| image:: images/install-guide/win-extract-tar-gz.png
5974 .. |Extract the APEX distribution| image:: images/install-guide/win-extract-tar.png
5975 .. |REST Editor Start Screen| image:: images/install-guide/rest-start.png
5976 .. |REST Editor with loaded SampleDomain Policy Model| image:: images/install-guide/rest-loaded.png
5977 .. |APEX Configuration Matrix| image:: images/apex-intro/ApexEngineConfig.png