Saryu Shah | b0c7e3b | 2018-05-01 01:12:23 +0000 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 2 | .. http://creativecommons.org/licenses/by/4.0 |
| 3 | |
Saryu Shah | 833a209 | 2018-05-03 17:50:48 +0000 | [diff] [blame] | 4 | Installation of Beijing Controller and Policies |
| 5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Saryu Shah | b0c7e3b | 2018-05-01 01:12:23 +0000 | [diff] [blame] | 6 | |
| 7 | .. contents:: |
| 8 | :depth: 2 |
| 9 | |
| 10 | This article explains how to install the Beijing policy controller and the Beijing policies on a raw ONAP Policy Framework installation running in Docker. |
| 11 | |
| 12 | To build a raw Policy Framework installation, please follow either of the HowTo articles below prior to using this HowTo: |
| 13 | |
| 14 | * `Standalone Quick Start <installation.html>`_ |
| 15 | * `Standalone installation in Virtual Machine <installationVM.html>`_ |
| 16 | |
| 17 | You should have the ONAP Policy Framework running in Docker and started the Policy Framework with *docker-compose*. |
| 18 | |
| 19 | |
| 20 | Test that the ONAP Policy Framework is up and is empty |
| 21 | ------------------------------------------------------ |
| 22 | |
| 23 | **Step 1:** Run the command below. |
| 24 | |
| 25 | .. code-block:: bash |
| 26 | |
| 27 | curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/beijing | python -m json.tool |
| 28 | |
| 29 | You should get a response similar to the following: |
| 30 | |
| 31 | .. code-block:: bash |
| 32 | |
| 33 | { |
| 34 | "error": "beijing not found" |
| 35 | } |
| 36 | |
| 37 | Install the Beijing policy controller |
| 38 | --------------------------------------- |
| 39 | |
| 40 | **Step 1:** Log onto the Drools PDP. |
| 41 | |
| 42 | .. code-block:: bash |
| 43 | |
| 44 | docker exec -it drools bash |
| 45 | |
| 46 | You now have a shell open in the Drools PDP container running in docker |
| 47 | |
| 48 | |
| 49 | **Step 2:** Create a temporary directory for controller installation |
| 50 | |
| 51 | .. code-block:: bash |
| 52 | |
| 53 | mkdir /tmp/apps-controlloop |
| 54 | cd /tmp/apps-controlloop |
| 55 | |
| 56 | **Step 3:** Download the latest controller from Nexus (1.2.0 at the time of writing) |
| 57 | |
| 58 | .. code-block:: bash |
| 59 | |
| 60 | wget https://nexus.onap.org/content/repositories/releases/org/onap/policy/drools-applications/controlloop/packages/apps-controlloop/1.2.0/apps-controlloop-1.2.0.zip |
| 61 | |
| 62 | Alternatively, you can build the drools-applications component of the Policy Framework from source and install it from the following location on your build host |
| 63 | |
| 64 | .. code-block:: bash |
| 65 | |
| 66 | ~/.m2/repository/org/onap/policy/drools-applications/controlloop/packages/apps-controlloop/1.2.0/apps-controlloop-1.2.0.zip |
| 67 | |
| 68 | |
| 69 | **Step 4:** Unzip the controller |
| 70 | |
| 71 | .. code-block:: bash |
| 72 | |
| 73 | unzip apps-controlloop-1.2.0.zip |
| 74 | |
| 75 | **Step 5:** Update the installation script to install the Beijing controller |
| 76 | |
| 77 | .. code-block:: bash |
| 78 | |
| 79 | vi apps-controlloop-installer |
| 80 | |
Saryu Shah | 833a209 | 2018-05-03 17:50:48 +0000 | [diff] [blame] | 81 | # Change the line |
| 82 | # "features enable controlloop-amsterdam" |
| 83 | # to |
| 84 | # "features enable controlloop-beijing" |
Saryu Shah | b0c7e3b | 2018-05-01 01:12:23 +0000 | [diff] [blame] | 85 | |
| 86 | |
| 87 | **Step 6:** Stop the policy engine |
| 88 | |
| 89 | .. code-block:: bash |
| 90 | |
| 91 | policy stop |
| 92 | |
| 93 | **Step 7:** Install the controller by running the controller installation script |
| 94 | |
| 95 | .. code-block:: bash |
| 96 | |
| 97 | ./apps-controlloop-installer |
| 98 | |
| 99 | **Step 8:** Install the *controlloop-utils* Drools PDP feature to allow standalone execution of control loop policies |
| 100 | |
| 101 | .. code-block:: bash |
| 102 | |
| 103 | features install controlloop-utils |
| 104 | features enable controlloop-utils |
| 105 | |
| 106 | **Step 9:** Start the policy engine |
| 107 | |
| 108 | .. code-block:: bash |
| 109 | |
| 110 | policy start |
| 111 | |
| 112 | Monitor the CPU for a few minutes with the top command until it settles down after the policy start. |
| 113 | |
| 114 | **Step 10:** Check if the Beijing controller is loaded |
| 115 | .. code-block:: bash |
| 116 | |
| 117 | curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/beijing | python -m json.tool |
| 118 | |
| 119 | You should get a response similar to the following: |
| 120 | |
| 121 | .. code-block:: bash |
| 122 | :caption: Beijing Controller JSON Response |
| 123 | :linenos: |
| 124 | |
| 125 | "alive": true, |
| 126 | "drools": { |
| 127 | "alive": true, |
| 128 | "artifactId": "controller-beijing", |
| 129 | "brained": true, |
| 130 | "groupId": "org.onap.policy.drools-applications.controlloop.common", |
| 131 | "locked": false, |
| 132 | "modelClassLoaderHash": 1562533966, |
| 133 | "recentSinkEvents": [], |
| 134 | "recentSourceEvents": [], |
| 135 | "sessionCoordinates": [ |
| 136 | "org.onap.policy.drools-applications.controlloop.common:controller-beijing:1.2.0:beijing" |
| 137 | ], |
| 138 | "sessions": [ |
| 139 | "beijing" |
| 140 | ], |
| 141 | "version": "1.2.0" |
| 142 | }, |
| 143 | "locked": false, |
| 144 | "name": "beijing", |
| 145 | "topicSinks": [ |
| 146 | { |
| 147 | "alive": true, |
| 148 | "allowSelfSignedCerts": false, |
| 149 | "apiKey": "", |
| 150 | "apiSecret": "", |
| 151 | "locked": false, |
| 152 | "partitionKey": "86d1234b-e431-4191-b7c6-56d2d2909a97", |
| 153 | "recentEvents": [], |
| 154 | "servers": [ |
| 155 | "vm1.mr.simpledemo.openecomp.org" |
| 156 | ], |
| 157 | "topic": "APPC-CL", |
| 158 | "topicCommInfrastructure": "UEB", |
| 159 | "useHttps": false |
| 160 | }, |
| 161 | { |
| 162 | "alive": true, |
| 163 | "allowSelfSignedCerts": false, |
| 164 | "apiKey": "", |
| 165 | "apiSecret": "", |
| 166 | "locked": false, |
| 167 | "partitionKey": "dea0f440-0232-4f63-b79e-6d51f3674d35", |
| 168 | "recentEvents": [], |
| 169 | "servers": [ |
| 170 | "vm1.mr.simpledemo.openecomp.org" |
| 171 | ], |
| 172 | "topic": "APPC-LCM-READ", |
| 173 | "topicCommInfrastructure": "UEB", |
| 174 | "useHttps": false |
| 175 | }, |
| 176 | { |
| 177 | "alive": true, |
| 178 | "allowSelfSignedCerts": false, |
| 179 | "apiKey": "", |
| 180 | "apiSecret": "", |
| 181 | "locked": false, |
| 182 | "partitionKey": "2918d779-870d-429b-b469-78677d027deb", |
| 183 | "recentEvents": [], |
| 184 | "servers": [ |
| 185 | "vm1.mr.simpledemo.openecomp.org" |
| 186 | ], |
| 187 | "topic": "POLICY-CL-MGT", |
| 188 | "topicCommInfrastructure": "UEB", |
| 189 | "useHttps": false |
| 190 | } |
| 191 | ], |
| 192 | "topicSources": [ |
| 193 | { |
| 194 | "alive": true, |
| 195 | "allowSelfSignedCerts": false, |
| 196 | "apiKey": "", |
| 197 | "apiSecret": "", |
| 198 | "consumerGroup": "31740f8e-f878-4347-849e-3b3352c28dff", |
| 199 | "consumerInstance": "drools", |
| 200 | "fetchLimit": 100, |
| 201 | "fetchTimeout": 15000, |
| 202 | "locked": false, |
| 203 | "recentEvents": [], |
| 204 | "servers": [ |
| 205 | "vm1.mr.simpledemo.openecomp.org" |
| 206 | ], |
| 207 | "topic": "PDPD-CONFIGURATION", |
| 208 | "topicCommInfrastructure": "UEB", |
| 209 | "useHttps": false |
| 210 | }, |
| 211 | { |
| 212 | "alive": true, |
| 213 | "allowSelfSignedCerts": false, |
| 214 | "apiKey": "", |
| 215 | "apiSecret": "", |
| 216 | "consumerGroup": "429aa858-633e-43dc-8619-7004e133d650", |
| 217 | "consumerInstance": "drools", |
| 218 | "fetchLimit": 100, |
| 219 | "fetchTimeout": 15000, |
| 220 | "locked": false, |
| 221 | "recentEvents": [], |
| 222 | "servers": [ |
| 223 | "vm1.mr.simpledemo.openecomp.org" |
| 224 | ], |
| 225 | "topic": "unauthenticated.DCAE_CL_OUTPUT", |
| 226 | "topicCommInfrastructure": "UEB", |
| 227 | "useHttps": false |
| 228 | }, |
| 229 | { |
| 230 | "alive": true, |
| 231 | "allowSelfSignedCerts": false, |
| 232 | "apiKey": "", |
| 233 | "apiSecret": "", |
| 234 | "consumerGroup": "1bf6854d-a0f1-4d03-baaf-084e6f365a86", |
| 235 | "consumerInstance": "drools", |
| 236 | "fetchLimit": 100, |
| 237 | "fetchTimeout": 15000, |
| 238 | "locked": false, |
| 239 | "recentEvents": [], |
| 240 | "servers": [ |
| 241 | "vm1.mr.simpledemo.openecomp.org" |
| 242 | ], |
| 243 | "topic": "APPC-CL", |
| 244 | "topicCommInfrastructure": "UEB", |
| 245 | "useHttps": false |
| 246 | }, |
| 247 | { |
| 248 | "alive": true, |
| 249 | "allowSelfSignedCerts": false, |
| 250 | "apiKey": "", |
| 251 | "apiSecret": "", |
| 252 | "consumerGroup": "3f0d7fdf-956d-4749-be54-1adb32ccfa4f", |
| 253 | "consumerInstance": "drools", |
| 254 | "fetchLimit": 100, |
| 255 | "fetchTimeout": 15000, |
| 256 | "locked": false, |
| 257 | "recentEvents": [], |
| 258 | "servers": [ |
| 259 | "vm1.mr.simpledemo.openecomp.org" |
| 260 | ], |
| 261 | "topic": "APPC-LCM-WRITE", |
| 262 | "topicCommInfrastructure": "UEB", |
| 263 | "useHttps": false |
| 264 | } |
| 265 | ] |
| 266 | } |
| 267 | |
| 268 | |
| 269 | |
| 270 | Install the Beijing vCPE Policy |
| 271 | --------------------------------- |
| 272 | |
| 273 | We now install the Beijing policies for the vCPE, vFirewall, vDNS & VOLTE use cases. |
| 274 | |
| 275 | **Step 1:** Log onto (or remain logged onto) the Drools PDP. |
| 276 | |
| 277 | .. code-block:: bash |
| 278 | |
| 279 | docker exec -it drools bash |
| 280 | |
| 281 | You now have a shell open in the Drools PDP container running in docker |
| 282 | |
| 283 | **Step 2:** Check that the Beijing policies are not loaded by querying for Drools facts |
| 284 | |
| 285 | .. code-block:: bash |
| 286 | |
| 287 | curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/beijing/drools/facts/beijing | python -m json.tool |
| 288 | |
| 289 | Expect the response {} indicating no policies are loaded. |
| 290 | |
| 291 | **Step 3:** Create a temporary directory for policy installation |
| 292 | |
| 293 | .. code-block:: bash |
| 294 | |
| 295 | mkdir /tmp/basex-controlloop |
| 296 | cd /tmp/basex-controlloop |
| 297 | |
| 298 | **Step 4:** Extract the policies from the control loop zip file previously downloaded from Nexus and expanded in steps 3 and 4 above. |
| 299 | |
| 300 | .. code-block:: bash |
| 301 | |
| 302 | tar zxvf /tmp/apps-controlloop/basex-controlloop-1.2.0.tar.gz |
| 303 | |
| 304 | **Step 5:** Install the Beijing policy rules, the script asks for a number of input parameters, accept the default for all parameters |
| 305 | |
| 306 | .. code-block:: bash |
| 307 | |
| 308 | bin/create-cl-beijing |
| 309 | |
Saryu Shah | 833a209 | 2018-05-03 17:50:48 +0000 | [diff] [blame] | 310 | # - Type Y when asked for confirmation of parameters |
| 311 | # - Accept /tmp as the install directory |
| 312 | # - Type Y to agree to creation of a Maven Artifact |
Saryu Shah | b0c7e3b | 2018-05-01 01:12:23 +0000 | [diff] [blame] | 313 | |
| 314 | |
| 315 | **Step 6:** Maven artifact creation now proceeds. After some minutes, confirmation is requested for deployment of rules into Maven. |
| 316 | .. code-block:: bash |
| 317 | |
Saryu Shah | 833a209 | 2018-05-03 17:50:48 +0000 | [diff] [blame] | 318 | # - Type Y to deploy the rules. |
Saryu Shah | b0c7e3b | 2018-05-01 01:12:23 +0000 | [diff] [blame] | 319 | |
| 320 | The rules are deployed into Maven. Expect the rule deployment process to take a number of minutes, perhaps 10 minutes. |
| 321 | |
| 322 | |
| 323 | **Step 7:** Copy the Beijing properties file into the Drools PDP configuration directory. This file configures the Drools PDP with the Beijing policies |
| 324 | |
| 325 | .. code-block:: bash |
| 326 | |
| 327 | cp /tmp/beijing/beijing-controller.properties /opt/app/policy/config |
| 328 | |
| 329 | **Step 8:** Stop and start the Drools PDP |
| 330 | |
| 331 | .. code-block:: bash |
| 332 | |
| 333 | policy stop |
| 334 | policy start |
| 335 | |
| 336 | Again, monitor the processes with top and wait for the PDP to fully start. |
| 337 | |
| 338 | **Step 9:** Push the Beijing policy facts to the Drools PDP |
| 339 | |
| 340 | .. code-block:: bash |
| 341 | |
| 342 | bin/push-policies-beijing |
| 343 | |
Saryu Shah | 833a209 | 2018-05-03 17:50:48 +0000 | [diff] [blame] | 344 | # When the script prompts for the path to the properties file, enter the following: |
| 345 | # /opt/app/policy/config/beijing-controller.properties |
Saryu Shah | b0c7e3b | 2018-05-01 01:12:23 +0000 | [diff] [blame] | 346 | |
| 347 | |
| 348 | **Step 10:** Now verify that the Beijing policies are loaded, there should be four facts (one per use case) in the Drools PDP |
| 349 | |
| 350 | .. code-block:: bash |
| 351 | |
| 352 | curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/beijing/drools/facts/beijing | python -m json.tool |
| 353 | |
| 354 | Expect the response: |
| 355 | |
| 356 | .. code-block:: bash |
| 357 | |
| 358 | { |
| 359 | "org.onap.policy.controlloop.params.ControlLoopParams": 4 |
| 360 | } |
| 361 | |
| 362 | |
| 363 | Execute the vCPE Use Case Manually |
| 364 | ---------------------------------- |
| 365 | |
| 366 | You can now run the vCPE Policy use case manually using the HowTos below: |
| 367 | * `Tutorial: Testing the vCPE use case in a standalone PDP-D <tutorial_vCPE.html>`_ |
| 368 | * `Tutorial: Testing the vDNS Use Case in a standalone PDP-D <tutorial_vDNS.html>`_ |
| 369 | * `Tutorial: Testing the vFW flow in a standalone PDP-D <tutorial_vFW.html>`_ |
| 370 | * `Tutorial: Testing the VOLTE Use Case in a standalone PDP-D <tutorial_VOLTE.html>`_ |
| 371 | |
| 372 | |
| 373 | .. note:: |
| 374 | 1. You should check that the topic names you use match those in the Beijing configuration file */opt/app/policy/config/beijing-controller.properties*. |
| 375 | 2. You should ensure that you change to the directory */tmp/beijing* prior to running those HowTos |
| 376 | |
| 377 | |
| 378 | |
| 379 | .. Installation of Beijing Controller and Policies : https://wiki.onap.org/display/DW/ONAP+Policy+Framework%3A+Installation+of+Beijing+Controller+and+Policies |
| 380 | |
| 381 | |
| 382 | |
| 383 | End of Document |
| 384 | |