1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
5 Policy Distribution User Manual
6 *******************************
17 .. container:: paragraph
19 Distribution is 100% written in Java and runs on any platform
20 that supports a JVM, e.g. Windows, Unix, Cygwin.
22 Installation Requirements
23 #########################
27 - Downloaded distribution: JAVA runtime environment
28 (JRE, Java 8 or later, Distribution is tested with the
31 - Building from source: JAVA development kit (JDK,
32 Java 8 or later, Distribution is tested with the OpenJDK)
34 - Sufficient rights to install Distribution on the system
40 - TAR and GZ to extract from that TAR.GZ
45 - Windows for instance
46 `7Zip <http://www.7-zip.org/>`__
48 - `Docker <https://www.docker.com/>`__ to run Distribution
49 inside a Docker container
52 Build (Install from Source) Requirements
53 ########################################
55 .. container:: paragraph
57 Installation from source requires a few development
62 - GIT to retrieve the source code
64 - Java SDK, Java version 8 or later
66 - Apache Maven 3 (the Distribution build environment)
68 Get the Distribution Source Code
69 --------------------------------
71 .. container:: paragraph
73 The Distribution source code is hosted in ONAP as project distribution.
74 The current stable version is in the master branch.
75 Simply clone the master branch from ONAP using HTTPS.
77 .. container:: listingblock
79 .. container:: content
83 git clone https://gerrit.onap.org/r/policy/distribution
88 .. container:: paragraph
90 The examples in this document assume that the distribution source
91 repositories are cloned to:
95 - Unix, Cygwin: ``/usr/local/src/distribution``
97 - Windows: ``C:\dev\distribution``
99 - Cygwin: ``/cygdrive/c/dev/distribution``
102 A Build requires ONAP Nexus
103 Distribution has a dependency to ONAP parent projects. You might need to adjust your Maven M2 settings. The most current
104 settings can be found in the ONAP oparent repo: `Settings <https://git.onap.org/oparent/plain/settings.xml>`__.
108 Building distribution requires approximately 1-2 GB of hard disc space, 100 MB for the actual build with full
109 distribution and around 1 GB for the downloaded dependencies.
112 A Build requires Internet (for first build)
113 During the build, several (a lot) of Maven dependencies will be downloaded and stored in the configured local Maven
114 repository. The first standard build (and any first specific build) requires Internet access to download those
117 .. container:: paragraph
119 Use Maven for a standard build without any tests.
121 +-------------------------------------------------------+--------------------------------------------------------+
122 | Unix, Cygwin | Windows |
123 +=======================================================+========================================================+
124 | .. container:: | .. container:: |
126 | .. container:: content | .. container:: content |
128 | .. code:: text | .. code:: text |
130 | # cd /usr/local/src/distribution | >c: |
131 | # mvn clean install -DskipTest | >cd \dev\distribution |
132 | | >mvn clean install -DskipTests |
133 +-------------------------------------------------------+--------------------------------------------------------+
135 .. container:: paragraph
137 The build takes 2-3 minutes on a standard development laptop. It
138 should run through without errors, but with a lot of messages from
143 .. container:: paragraph
145 When Maven is finished with the build, the final screen should look
146 similar to this (omitting some ``success`` lines):
148 .. container:: listingblock
150 .. container:: content
154 [INFO] ------------------------------------------------------------------------
155 [INFO] Reactor Summary:
157 [INFO] policy-distribution ................................ SUCCESS [ 3.666 s]
158 [INFO] distribution-model ................................. SUCCESS [ 11.234 s]
159 [INFO] forwarding ......................................... SUCCESS [ 7.611 s]
160 [INFO] reception .......................................... SUCCESS [ 7.072 s]
161 [INFO] main ............................................... SUCCESS [ 21.017 s]
162 [INFO] plugins ............................................ SUCCESS [ 0.453 s]
163 [INFO] forwarding-plugins ................................. SUCCESS [01:20 min]
164 [INFO] reception-plugins .................................. SUCCESS [ 18.545 s]
165 [INFO] Policy Distribution Packages ....................... SUCCESS [ 0.419 s]
166 [INFO] ------------------------------------------------------------------------
168 [INFO] ------------------------------------------------------------------------
169 [INFO] Total time: 02:39 min
170 [INFO] Finished at: 2018-11-15T13:59:09Z
171 [INFO] Final Memory: 73M/1207M
172 [INFO] ------------------------------------------------------------------------
174 .. container:: paragraph
176 The build will have created all artifacts required for distribution
177 installation. The following example show how to change to the target
178 directory and how it should look.
180 +----------------------------------------------------------------------------------------------------------------------------+
182 +============================================================================================================================+
185 | .. container:: listingblock |
187 | .. container:: content |
191 | -rw-r--r-- 1 user 1049089 10616 Oct 31 13:35 checkstyle-checker.xml |
192 | -rw-r--r-- 1 user 1049089 609 Oct 31 13:35 checkstyle-header.txt |
193 | -rw-r--r-- 1 user 1049089 245 Oct 31 13:35 checkstyle-result.xml |
194 | -rw-r--r-- 1 user 1049089 89 Oct 31 13:35 checkstyle-cachefile |
195 | drwxr-xr-x 1 user 1049089 0 Oct 31 13:35 maven-archiver/ |
196 | -rw-r--r-- 1 user 1049089 7171 Oct 31 13:35 policy-distribution-tarball-2.0.1-SNAPSHOT.jar |
197 | drwxr-xr-x 1 user 1049089 0 Oct 31 13:35 archive-tmp/ |
198 | -rw-r--r-- 1 user 1049089 66296012 Oct 31 13:35 policy-distribution-tarball-2.0.1-SNAPSHOT-tarball.tar.gz |
199 | drwxr-xr-x 1 user 1049089 0 Nov 12 10:56 test-classes/ |
200 | drwxr-xr-x 1 user 1049089 0 Nov 20 14:31 classes/ |
201 +----------------------------------------------------------------------------------------------------------------------------+
203 +-------------------------------------------------------------------------------------------------------------------+
205 +===================================================================================================================+
208 | .. container:: listingblock |
210 | .. container:: content |
214 | 11/12/2018 10:56 AM <DIR> . |
215 | 11/12/2018 10:56 AM <DIR> .. |
216 | 10/31/2018 01:35 PM <DIR> archive-tmp |
217 | 10/31/2018 01:35 PM 89 checkstyle-cachefile |
218 | 10/31/2018 01:35 PM 10,616 checkstyle-checker.xml |
219 | 10/31/2018 01:35 PM 609 checkstyle-header.txt |
220 | 10/31/2018 01:35 PM 245 checkstyle-result.xml |
221 | 11/20/2018 02:31 PM <DIR> classes |
222 | 10/31/2018 01:35 PM <DIR> maven-archiver |
223 | 10/31/2018 01:35 PM 66,296,012 policy-distribution-tarball-2.0.1-SNAPSHOT-tarball.tar.gz |
224 | 10/31/2018 01:35 PM 7,171 policy-distribution-tarball-2.0.1-SNAPSHOT.jar |
225 | 11/12/2018 10:56 AM <DIR> test-classes |
226 +-------------------------------------------------------------------------------------------------------------------+
231 .. container:: paragraph
233 Distribution can be installed in different ways:
237 - Windows, Unix, Cygwin: manually from a ``.tar.gz`` archive
239 - Windows, Unix, Cygwin: build from source using Maven, then
242 Install Manually from Archive (Windows, 7Zip, GUI)
243 ##################################################
245 .. container:: paragraph
247 Download a ``tar.gz`` archive and copy the file into the install
248 folder (in this example ``C:\distribution``). Assuming you are using 7Zip,
249 right click on the file and extract the ``tar`` archive.
253 .. container:: content
255 Extract the TAR archive
257 .. container:: paragraph
259 Then right-click on the new created TAR file and extract the actual
264 .. container:: content
266 Extract the distribution
268 .. container:: paragraph
270 Inside the new distribution folder you see the main directories: ``bin``,
275 .. container:: paragraph
277 Once extracted, please rename the created folder to
278 ``distribution-full-2.0.2-SNAPSHOT``. This will keep the directory name in
279 line with the rest of this documentation.
284 Build and Install Manually (Unix, Windows, Cygwin)
285 ##################################################
287 .. container:: paragraph
289 Clone the Distribution GIT repositories into a directory. Go to that
290 directory. Use Maven to build Distribution (all details on building
291 Distribution from source can be found in *Distribution HowTo: Build*).
293 .. container:: paragraph
295 Now, take the ``.tar.gz`` file and install distribution.
300 .. container:: paragraph
302 A full installation of distribution comes with the following layout.
304 .. container:: listingblock
306 .. container:: content
312 Running Distribution in Docker
313 ------------------------------
318 .. container:: paragraph
320 Running distribution from the ONAP docker repository only requires 2
323 .. container:: olist arabic
325 #. Log into the ONAP docker repo
327 .. container:: listingblock
329 .. container:: content
333 docker login -u docker -p docker nexus3.onap.org:10003
335 .. container:: olist arabic
337 #. Run the distribution docker image
339 .. container:: listingblock
341 .. container:: content
345 docker run -it --rm nexus3.onap.org:10003/onap/policy-distribution:latest
350 .. container:: paragraph
352 Alternatively, one can use the Dockerfile defined in the Docker
353 package to build an image.
355 Distribution Configurations Explained
356 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
358 Introduction to Distribution Configuration
359 ------------------------------------------
361 .. container:: paragraph
363 A distribution engine can be configured to use various combinations
364 of policy reception handlers, policy decoders and policy forwarders.
365 The system is built using a plugin architecture. Each configuration
366 option is realized by a plugin, which can be loaded and
367 configured when the engine is started. New plugins can be
368 added to the system at any time, though to benefit from a
369 new plugin, an engine will need to be restarted.
373 .. container:: paragraph
375 The distribution already comes with sdc reception handler,
376 file reception handler, xacml policy decoder, file in csar policy decoder,
377 xacml policy forwarder, apex policy forwarder.
379 General Configuration Format
380 ----------------------------
382 .. container:: paragraph
384 The distribution configuration file is a JSON file containing a few
385 main blocks for different parts of the configuration. Each
386 block then holds the configuration details. The following
387 code shows the main blocks:
389 .. container:: listingblock
391 .. container:: content
396 "restServerParameters":{
399 "receptionHandlerParameters":{ (2)
400 "pluginHandlerParameters":{ (3)
401 "policyDecoders":{...}, (4)
402 "policyForwarders":{...} (5)
405 "receptionHandlerConfigurationParameters":{
409 "policyForwarderConfigurationParameters":{
413 "policyDecoderConfigurationParameters":{
418 .. container:: colist arabic
420 +-----------------------------------+-----------------------------------+
421 | **1** | rest server configuration |
422 +-----------------------------------+-----------------------------------+
423 | **2** | reception handler plugin |
425 +-----------------------------------+-----------------------------------+
426 | **3** | plugin handler parameters |
428 +-----------------------------------+-----------------------------------+
429 | **4** | policy decoder plugin |
431 +-----------------------------------+-----------------------------------+
432 | **5** | policy forwarder plugin |
434 +-----------------------------------+-----------------------------------+
435 | **6** | reception handler plugin |
437 +-----------------------------------+-----------------------------------+
438 | **7** | policy forwarder plugin |
440 +-----------------------------------+-----------------------------------+
441 | **8** | policy decoder plugin |
443 +-----------------------------------+-----------------------------------+
445 A configuration example
446 -----------------------
448 .. container:: paragraph
450 The following example loads HPA use case related plug-ins.
452 .. container:: paragraph
454 Notifications are consumed from SDC through SDC client.
455 Consumed artifacts format is CSAR.
457 .. container:: paragraph
459 Generated policies are forwarded to XACML policy engine.
461 .. container:: listingblock
463 .. container:: content
468 "name":"SDCDistributionGroup",
469 "restServerParameters":{
472 "userName":"healthcheck",
473 "password":"zb!XztG34"
475 "receptionHandlerParameters":{
476 "SDCReceptionHandler":{
477 "receptionHandlerType":"SDC",
478 "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
479 "receptionHandlerConfigurationName":"sdcConfiguration",
480 "pluginHandlerParameters":{
483 "decoderType":"CsarDecoder",
484 "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderCsarPdpx",
485 "decoderConfigurationName": "csarToOptimizationPolicyConfiguration"
489 "PAPEngineForwarder":{
490 "forwarderType":"PAPEngine",
491 "forwarderClassName":"org.onap.policy.distribution.forwarding.xacml.pdp.XacmlPdpPolicyForwarder",
492 "forwarderConfigurationName": "xacmlPdpConfiguration"
498 "receptionHandlerConfigurationParameters":{
500 "parameterClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandlerConfigurationParameterGroup",
502 "asdcAddress": "sdc-be.onap:8443",
503 "messageBusAddress": [
504 "message-router.onap"
507 "password": "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",
508 "pollingInterval":20,
510 "consumerId": "policy-id",
515 "consumerGroup": "policy-group",
516 "environmentName": "AUTO",
517 "keystorePath": "null",
518 "keystorePassword": "null",
519 "activeserverTlsAuth": false,
520 "isFilterinEmptyResources": true,
521 "isUseHttpsWithDmaap": false
525 "policyDecoderConfigurationParameters":{
526 "csarToOptimizationPolicyConfiguration":{
527 "parameterClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderCsarPdpxConfigurationParameterGroup",
529 "policyNamePrefix": "oofCasablanca",
538 "policyForwarderConfigurationParameters":{
539 "xacmlPdpConfiguration":{
540 "parameterClassName":"org.onap.policy.distribution.forwarding.xacml.pdp.XacmlPdpPolicyForwarderParameterGroup",
545 "userName": "testpdp",
546 "password": "alpha123",
547 "clientAuth": "cHl0aG9uOnRlc3Q=",
549 "pdpGroup": "pdpGroup"
556 The Distribution Engine
557 ^^^^^^^^^^^^^^^^^^^^^^^
559 .. container:: paragraph
561 The Distribution engine can be started using ``policy-dist.sh`` script.
562 The script is located in the source code at
563 *distribution/packages/policy-distribution-docker/src/main/docker*
568 .. container:: paragraph
570 On UNIX and Cygwin systems use ``policy-dist.sh`` script.
574 .. container:: paragraph
576 On Windows systems navigate to the distribution installation directory.
577 Run the following command
578 ``java -cp "etc:lib\*" org.onap.policy.distribution.main.startstop.Main -c <config-file-path>``
582 .. container:: paragraph
584 The Distribution engine comes with CLI arguments for setting
585 configuration. The configuration file is always required.
586 The option ``-h`` prints a help screen.
588 .. container:: listingblock
590 .. container:: content
594 usage: org.onap.policy.distribution.main.startstop.Main [options...]
596 -c,--config-file <CONFIG_FILE> the full path to the configuration file to use, the configuration file must be a Json file
597 containing the distribution configuration parameters
598 -h,--help outputs the usage of this command
599 -v,--version outputs the version of distribution system
602 The Distribution REST End-points
603 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
605 .. container:: paragraph
607 The distribution engine comes with built-in REST based
608 endpoints for fetching health check status & statistical data
609 of running distribution system.
611 .. container:: listingblock
613 .. container:: content
617 # Example Output from curl http -a '{user}:{password}' :6969/healthcheck
621 Content-Type: application/json
622 Date: Tue, 17 Apr 2018 10:51:14 GMT
623 Server: Jetty(9.3.20.v20170531)
632 # Example Output from curl http -a '{user}:{password}' :6969/statistics
636 Content-Type: application/json
637 Date: Tue, 17 Apr 2018 10:51:14 GMT
638 Server: Jetty(9.3.20.v20170531)
642 "distribution_complete_ok":8,
643 "distribution_complete_fail":2,