1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
.. This work is licensed under a
.. Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
Policy Docker Usage
--------------------------
.. contents::
:depth: 3
Starting the ONAP Policy Framework Docker Containers
****************************************************
In order to start the containers, you can use *docker-compose*. This uses the *docker-compose.yml* yaml file to
bring up the ONAP Policy Framework. This file is located in the policy/docker repository. In the csit folder there
are scripts to *automatically* bring up components in Docker, without the need to build all the images locally.
Clone the read-only version of policy/docker repo from gerrit:
.. code-block:: bash
git clone "https://gerrit.onap.org/r/policy/docker"
The docker compose structure
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
After cloning the docker repository, the scripts and compose files are under the *compose/* folder.
.. code-block:: bash
docker
compose
config -- all the components configurations
metrics -- configuration for Prometheus server and Grafana dashboards
docker-compose.gui.yml -- compose file with gui services
docker-compose.yml -- compose file with policy components services, including simulator, prometheus and grafana
export-ports.sh -- script to export the http ports for all components and where the images are collected from
get-versions.sh -- script to get the latest SNAPSHOT version of images based on branch (master is default)
start-compose.sh -- script to start the containers / applications
stop-compose.sh -- script to stop the containers / applications
wait_for_port.sh -- helper script to allow some wait time before an application is completely up and running
Start the containers automatically
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Assuming all the scripts are being executed from the compose folder.
To start all components without Policy GUI:
.. code-block:: bash
./start-compose.sh
To start all components with Policy GUI:
.. code-block:: bash
./start-compose.sh --gui
To start all components with Grafana dashboards and Prometheus server:
.. code-block:: bash
./start-compose.sh --grafana
**You now have a full standalone ONAP Policy framework up and running!**
To stop all containers, use stop-compose.sh
.. code-block:: bash
./stop-compose.sh
Building the ONAP Policy Framework Docker Images
************************************************
If you want to use your own local images, you can build them following these instructions:
**Step 1:** Build the Policy API Docker image
.. code-block:: bash
cd ~/git/onap/policy/api/packages
mvn clean install -P docker
**Step 2:** Build the Policy PAP Docker image
.. code-block:: bash
cd ~/git/onap/policy/pap/packages
mvn clean install -P docker
**Step 3:** Build the Drools PDP docker image.
This image is a standalone vanilla Drools engine, which does not contain any pre-built drools rules or applications.
.. code-block:: bash
cd ~/git/onap/policy/drools-pdp/
mvn clean install -P docker
**Step 4:** Build the Drools Application Control Loop image.
This image has the drools use case application and the supporting software built together with the Drools PDP engine.
It is recommended to use this image if you are first working with ONAP Policy and wish to test or learn how the use
cases work.
.. code-block:: bash
cd ~/git/onap/policy/drools-applications
mvn clean install -P docker
**Step 5:** Build the Apex PDP docker image:
.. code-block:: bash
cd ~/git/onap/policy/apex-pdp
mvn clean install -P docker
**Step 6:** Build the XACML PDP docker image:
.. code-block:: bash
cd ~/git/onap/policy/xacml-pdp/packages
mvn clean install -P docker
**Step 7:** Build the Policy SDC Distribution docker image:
.. code-block:: bash
cd ~/git/onap/policy/distribution/packages
mvn clean install -P docker
**Step 8:** Build the Policy Message Router Simulator
.. code-block:: bash
cd ~/git/onap/policy/models/models-sim/packages
mvn clean install -P docker
Start the containers manually
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Step 1:** Set the containers location and project.
For *local* images, set CONTAINER_LOCATION="", located at the `export-ports.sh` script
*You will need to build locally all the images using the steps in the previous section*
For *remote* images set CONTAINER_LOCATION="nexus3.onap.org:10001/"
**Step 2:** Set gerrit branch
By default, the `start-compose.sh` script will use the `get-versions.sh` to bring up latest SNAPSHOT version.
To use a different branch, edit the variable GERRIT_BRANCH located at the start of `get-versions.sh` to the
branch needed.
**Step 3:** Get all the images versions
Use the script get-versions.sh
.. code-block:: bash
source ./get-versions.sh
**Step 4:** Run the system using the `start-compose.sh` script
.. code-block:: bash
./start-compose.sh <component> [--grafana] [--gui]
The <component> input is any of the policy components available:
- api
- pap
- apex-pdp
- distribution
- drools-pdp
- drools-applications
- xacml-pdp
- policy-acm-runtime
Debugging docker containers
^^^^^^^^^^^^^^^^^^^^^^^^^^^
To debug code against docker compose, the java parameters for jmxremote needs to be added to the start script
in the component.
Example:
For Policy PAP, edit the `policy-pap.sh` script:
.. code-block:: bash
vi ~git/onap/policy/pap/packages/policy-pap-docker/src/main/docker/policy-pap.sh
Before the `-jar /app/pap.jar \ ` line, add the following block:
.. code-block:: bash
-Dcom.sun.management.jmxremote.rmi.port=5005 \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.port=5005 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
On `docker-compose.yml` compose file, add to the port section the mapping 5005.
.. code-block:: yaml
pap:
image: ${CONTAINER_LOCATION}onap/policy-pap:${POLICY_PAP_VERSION}
container_name: policy-pap
depends_on:
- mariadb
- simulator
- api
hostname: policy-pap
ports:
- ${PAP_PORT}:6969
- 5005:5005
That should allow an IDE to connect remotely to the 5005 port.
Follow the instructions of the IDE being used to add a remote connection.
For Intellij, under Run/Debug Configurations, add a new Remote JVM Debug, point Use module classpath to the
<component>-main sub-project.
|