blob: 4456f2921ca66c1a2982f62bfebd20c873cb62ab [file] [log] [blame]
Saryu Shah53815932017-11-13 16:13:39 +00001
2.. This work is licensed under a Creative Commons Attribution 4.0 International License.
3.. http://creativecommons.org/licenses/by/4.0
4
Saryu Shahe92fd802018-03-23 17:01:47 +00005******************************
6Modifying the Release Template
7******************************
Saryu Shah53815932017-11-13 16:13:39 +00008
9.. contents::
10 :depth: 3
11
12
13This tutorial is intended for Policy Drools Applications developers who would like to test their code using the PDP-D in Eclipse instead of installing in a lab. The example for this tutorial will walk through making a change to the Amsterdam Control Loop Template, building the archetype project, and instantiating a controller with the PDP-D.
14
15Installing the Archetype Project in Eclipse
16^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17
18**STEP 1:** First, open the drools-pdp project in Eclipse and navigate to File New Project...
19
20 .. image:: mat_new_project.JPG
21
22**STEP 2:** Navigate to Maven Maven Project
23
24 .. image:: mat_maven_project.JPG
25
26**STEP 3:** For demo purposes, the location of the project will be put in Documents/demo. Hit next to proceed.
27
28 .. image:: mat_project_location.JPG
29
30**STEP 4:** Click "Configure" near the top right.
31
32 .. image:: mat_configure.JPG
33
Saryu Shah4da836e2018-03-30 18:12:47 +000034**STEP 5:** Add a Remote and/or a Local catalog
35
Saryu Shahb05e6d32018-04-02 19:44:56 +000036 **STEP 5.1:** Add a Remote Catalog to find the ONAP staged drools-applications
Saryu Shah4da836e2018-03-30 18:12:47 +000037
Saryu Shahb05e6d32018-04-02 19:44:56 +000038 **STEP 5.1.1:** Click "Add Remote Catalog..."
Saryu Shah53815932017-11-13 16:13:39 +000039
Saryu Shahb05e6d32018-04-02 19:44:56 +000040 .. image:: mat_add_local_catalog.JPG
Saryu Shah53815932017-11-13 16:13:39 +000041
Saryu Shahb05e6d32018-04-02 19:44:56 +000042 **STEP 5.1.2:** Add the ONAP Staging repository archetype-catalog.xml with a description if desired. Click "OK" then "Apply", then "OK".
Saryu Shah53815932017-11-13 16:13:39 +000043
Saryu Shahb05e6d32018-04-02 19:44:56 +000044 .. image:: mat_nexus_catalog.JPG
Saryu Shah53815932017-11-13 16:13:39 +000045
Saryu Shahb05e6d32018-04-02 19:44:56 +000046 **STEP 5.1.3:** The ONAP staging archetypes are now an option:
Saryu Shah53815932017-11-13 16:13:39 +000047
Saryu Shahb05e6d32018-04-02 19:44:56 +000048 .. image:: mat_archetypes.JPG
Saryu Shah53815932017-11-13 16:13:39 +000049
Saryu Shahb05e6d32018-04-02 19:44:56 +000050 **STEP 5.2:** Add a Local Catalog to find a local drools-applications in your .m2 local repository
Saryu Shah4da836e2018-03-30 18:12:47 +000051
Saryu Shahb05e6d32018-04-02 19:44:56 +000052 **STEP 5.2.1:** Click "Add Local Catalog..."
Saryu Shah4da836e2018-03-30 18:12:47 +000053
Saryu Shahb05e6d32018-04-02 19:44:56 +000054 .. image:: mat_add_local_catalog.JPG
Saryu Shah4da836e2018-03-30 18:12:47 +000055
Saryu Shahb05e6d32018-04-02 19:44:56 +000056 **STEP 5.2.2:** Browse to or type in the path to your .m2 repository, give it a name and click "OK"
Saryu Shah4da836e2018-03-30 18:12:47 +000057
Saryu Shahb05e6d32018-04-02 19:44:56 +000058 .. image:: mat_nexus_local_catalog.png
Saryu Shah4da836e2018-03-30 18:12:47 +000059
Saryu Shahb05e6d32018-04-02 19:44:56 +000060 **STEP 5.2.3:** The new local repository appears on the catalog list, click "Apply and Close"
Saryu Shah4da836e2018-03-30 18:12:47 +000061
Saryu Shahb05e6d32018-04-02 19:44:56 +000062 .. image:: mat_local_archetypes.png
Saryu Shah4da836e2018-03-30 18:12:47 +000063
64**STEP 6:** If you wish to use a snapshot version of drools-applications, make sure to check the "Include snapshot archetypes" box. Highlight the option with the Artifact Id "archetype-cl-amsterdam" and click next.
65
66 .. image:: mat_select_archetypes.png
67
68**STEP 7:** The following screen allows the user to modify some of the configurable parameters of the control loop. For this demo the default parameters that are already populated will be used. Fill out the Groud Id, Artifact Id, Version, and Package and hit "Finish". For the demo the following is used:
Saryu Shah53815932017-11-13 16:13:39 +000069
70 .. image:: mat_archetype_params.JPG
71
Saryu Shah4da836e2018-03-30 18:12:47 +000072**NOTE:** If you are using a snapshot version of drools-applications. make sure that the "dependenciesVersion" variable value you specify matches the drools-applications artifact versions
73
74 .. image:: mat_archetype_checkparams.png
75
76
77**STEP 8:** Depending on the IDE in use, an error may be generated about handling the kie-maven-plugin:6.5.0.Final:build plugin. This can be ignored, click "Finish" and then "OK" if a warning pops up about having build errors.
Saryu Shah53815932017-11-13 16:13:39 +000078
79 .. image:: mat_error.JPG
80
Saryu Shah4da836e2018-03-30 18:12:47 +000081**STEP 9:** Amsterdam can now be seen in the Project Explorer:
Saryu Shah53815932017-11-13 16:13:39 +000082
83 .. image:: mat_amsterdam_project.JPG
84
85
86Modifying the Amsterdam Template
87^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
89**STEP 1:** Expand the amsterdam project and "src/main/resources". The drl generated from the archetype will be present as follows:
90
91 .. image:: mat_amsterdam_drl.JPG
92
93**STEP 2:** Now a change will be added to the drl from above. For this tutorial, a new logging statement will be added that will show in the console of Eclipse when the changes are tested. We'll add this in the SETUP rule.
94
95 .. image:: mat_hello_world.JPG
96
97**STEP 3:** Right click on the Amsterdam project, hover over "Run As", then click "Maven build".
98
99 .. image:: mat_maven_build.JPG
100
101**STEP 4:** For the goals type "clean install", click "Apply" and then click "Run".
102
103 .. image:: mat_clean_install.JPG
104
105 .. image:: mat_build_success.JPG
106
107Running the PDP-D with the Amsterdam Controller
108^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
109
110**STEP 1:** Copy the controller properties file that was generated from the archetype in amsterdam/src/main/config into policy-management/src/main/config
111
112 .. image:: mat_amsterdam_controller.JPG
113
114**STEP 2:** Go src/main/java and expand the package "org.onap.policy.drools.system". Right click on "Main.java", then hover over "Run As..." and click "Java Application".
115
116 .. image:: mat_run_as.JPG
117
118**STEP 3:** Search through the console for the logging statement "\***** HELLO WORLD \*****". This indicates that the template change worked. Modifications can continue to be made and the Telemetry API can be used to interact with the PDP-D that is running in Eclipse and to test control loop flows.
119
120 .. image:: mat_console_output.JPG
121
122
123
124End of Document
125
126
Saryu Shah4da836e2018-03-30 18:12:47 +0000127.. SSNote: Beijing release update. https://wiki.onap.org/display/DW/Modifying+the+Release+template
Saryu Shah53815932017-11-13 16:13:39 +0000128.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Modifying+the+Amsterdam+release+template
129
130