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 | |
| 4 | Installation of Amsterdam Controller and vCPE Policy |
| 5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | |
| 7 | .. contents:: |
| 8 | :depth: 2 |
| 9 | |
| 10 | This article explains how to install the Amsterdam policy controller and the Amsterdam 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/amsterdam | python -m json.tool |
| 28 | |
| 29 | You should get a response similar to the following: |
| 30 | |
| 31 | .. code-block:: bash |
| 32 | |
| 33 | { |
| 34 | "error": "amsterdam not found" |
| 35 | } |
| 36 | |
| 37 | Install the Amsterdam 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 | **Step 4:** Unzip the controller |
| 63 | |
| 64 | .. code-block:: bash |
| 65 | |
| 66 | unzip apps-controlloop-1.2.0.zip |
| 67 | |
| 68 | **Step 5:** Stop the policy engine |
| 69 | |
| 70 | .. code-block:: bash |
| 71 | |
| 72 | policy stop |
| 73 | |
| 74 | **Step 6:** Install the controller by running the controller installation script |
| 75 | |
| 76 | .. code-block:: bash |
| 77 | |
| 78 | ./apps-controlloop-installer |
| 79 | |
| 80 | **Step 7:** Install the controlloop-utils Drools PDP feature to allow standalone execution of control loop policies |
| 81 | |
| 82 | .. code-block:: bash |
| 83 | |
| 84 | features install controlloop-utils |
| 85 | features enable controlloop-utils |
| 86 | |
| 87 | **Step 8:** Start the policy engine |
| 88 | |
| 89 | .. code-block:: bash |
| 90 | |
| 91 | policy start |
| 92 | |
| 93 | **Step 9:** Check if the Amsterdam controller is loaded |
| 94 | .. code-block:: bash |
| 95 | |
| 96 | curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/amsterdam | python -m json.tool |
| 97 | |
| 98 | You should get a response similar to the following: |
| 99 | |
| 100 | .. code-block:: bash |
| 101 | :caption: Amsterdam Controller JSON Response |
| 102 | :linenos: |
| 103 | |
| 104 | { |
| 105 | "alive": true, |
| 106 | "drools": { |
| 107 | "alive": false, |
| 108 | "artifactId": "NO-ARTIFACT-ID", |
| 109 | "brained": false, |
| 110 | "canonicalSessionNames": [], |
| 111 | "container": null, |
| 112 | "groupId": "NO-GROUP-ID", |
| 113 | "locked": false, |
| 114 | "recentSinkEvents": [], |
| 115 | "recentSourceEvents": [], |
| 116 | "sessionNames": [], |
| 117 | "version": "NO-VERSION" |
| 118 | }, |
| 119 | "locked": false, |
| 120 | "name": "amsterdam", |
| 121 | "topicSinks": [ |
| 122 | { |
| 123 | "alive": true, |
| 124 | "allowSelfSignedCerts": false, |
| 125 | "apiKey": "", |
| 126 | "apiSecret": "", |
| 127 | "locked": false, |
| 128 | "partitionKey": "ea44d32e-e2e6-4a77-862b-aa33437179ed", |
| 129 | "recentEvents": [], |
| 130 | "servers": [ |
| 131 | "vm1.mr.simpledemo.openecomp.org" |
| 132 | ], |
| 133 | "topic": "APPC-CL", |
| 134 | "topicCommInfrastructure": "UEB", |
| 135 | "useHttps": false |
| 136 | }, |
| 137 | { |
| 138 | "alive": true, |
| 139 | "allowSelfSignedCerts": false, |
| 140 | "apiKey": "", |
| 141 | "apiSecret": "", |
| 142 | "locked": false, |
| 143 | "partitionKey": "47769d22-03c8-4993-9f67-fe326a491b23", |
| 144 | "recentEvents": [], |
| 145 | "servers": [ |
| 146 | "vm1.mr.simpledemo.openecomp.org" |
| 147 | ], |
| 148 | "topic": "APPC-LCM-READ", |
| 149 | "topicCommInfrastructure": "UEB", |
| 150 | "useHttps": false |
| 151 | }, |
| 152 | { |
| 153 | "alive": true, |
| 154 | "allowSelfSignedCerts": false, |
| 155 | "apiKey": "", |
| 156 | "apiSecret": "", |
| 157 | "locked": false, |
| 158 | "partitionKey": "c33ca5ca-6ebd-47d7-a495-5a54f8a2a15a", |
| 159 | "recentEvents": [], |
| 160 | "servers": [ |
| 161 | "vm1.mr.simpledemo.openecomp.org" |
| 162 | ], |
| 163 | "topic": "POLICY-CL-MGT", |
| 164 | "topicCommInfrastructure": "UEB", |
| 165 | "useHttps": false |
| 166 | } |
| 167 | ], |
| 168 | "topicSources": [ |
| 169 | { |
| 170 | "alive": true, |
| 171 | "allowSelfSignedCerts": false, |
| 172 | "apiKey": "", |
| 173 | "apiSecret": "", |
| 174 | "consumerGroup": "6dcfdfb8-7c54-4dbd-9337-e4f1883083fb", |
| 175 | "consumerInstance": "drools", |
| 176 | "fetchLimit": 100, |
| 177 | "fetchTimeout": 15000, |
| 178 | "locked": false, |
| 179 | "recentEvents": [], |
| 180 | "servers": [ |
| 181 | "vm1.mr.simpledemo.openecomp.org" |
| 182 | ], |
| 183 | "topic": "unauthenticated.DCAE_CL_OUTPUT", |
| 184 | "topicCommInfrastructure": "UEB", |
| 185 | "useHttps": false |
| 186 | }, |
| 187 | { |
| 188 | "alive": true, |
| 189 | "allowSelfSignedCerts": false, |
| 190 | "apiKey": "", |
| 191 | "apiSecret": "", |
| 192 | "consumerGroup": "4f558331-3d32-494b-b7dc-4d5a509dda0d", |
| 193 | "consumerInstance": "drools", |
| 194 | "fetchLimit": 100, |
| 195 | "fetchTimeout": 15000, |
| 196 | "locked": false, |
| 197 | "recentEvents": [], |
| 198 | "servers": [ |
| 199 | "vm1.mr.simpledemo.openecomp.org" |
| 200 | ], |
| 201 | "topic": "APPC-CL", |
| 202 | "topicCommInfrastructure": "UEB", |
| 203 | "useHttps": false |
| 204 | }, |
| 205 | { |
| 206 | "alive": true, |
| 207 | "allowSelfSignedCerts": false, |
| 208 | "apiKey": "", |
| 209 | "apiSecret": "", |
| 210 | "consumerGroup": "1e3edc1f-afa6-4ae5-907f-a7118ad7a0d2", |
| 211 | "consumerInstance": "drools", |
| 212 | "fetchLimit": 100, |
| 213 | "fetchTimeout": 15000, |
| 214 | "locked": false, |
| 215 | "recentEvents": [], |
| 216 | "servers": [ |
| 217 | "vm1.mr.simpledemo.openecomp.org" |
| 218 | ], |
| 219 | "topic": "APPC-LCM-WRITE", |
| 220 | "topicCommInfrastructure": "UEB", |
| 221 | "useHttps": false |
| 222 | } |
| 223 | ] |
| 224 | } |
| 225 | |
| 226 | |
| 227 | Install the Amsterdam vCPE Policy |
| 228 | --------------------------------- |
| 229 | |
| 230 | We now install the Amsterdam policies for the vCPE, vFirewall, vDNS & VOLTE use cases. |
| 231 | |
| 232 | **Step 1:** Log onto (or remain logged onto) the Drools PDP. |
| 233 | |
| 234 | .. code-block:: bash |
| 235 | |
| 236 | docker exec -it drools bash |
| 237 | |
| 238 | You now have a shell open in the Drools PDP container running in docker |
| 239 | |
| 240 | **Step 2:** Check that the Amsterdam policies are not loaded by querying for Drools facts |
| 241 | |
| 242 | .. code-block:: bash |
| 243 | |
| 244 | curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/amsterdam/drools/facts/amsterdam | python -m json.tool |
| 245 | |
| 246 | Expect the response {} indicating no policies are loaded. |
| 247 | |
| 248 | **Step 3:** Create a temporary directory for policy installation |
| 249 | |
| 250 | .. code-block:: bash |
| 251 | |
| 252 | mkdir /tmp/basex-controlloop |
| 253 | cd /tmp/basex-controlloop |
| 254 | |
| 255 | **Step 4:** Extract the policies from the control loop zip file previously downloaded from Nexus and expanded in steps 3 and 4 above. |
| 256 | |
| 257 | .. code-block:: bash |
| 258 | |
| 259 | tar zxvf /tmp/apps-controlloop/basex-controlloop-1.2.0.tar.gz |
| 260 | |
| 261 | **Step 5:** Install the Amsterdam policy rules, the script asks for a number of input parameters, accept the default for all parameters |
| 262 | |
| 263 | .. code-block:: bash |
| 264 | |
| 265 | bin/create-cl-amsterdam |
| 266 | |
Saryu Shah | 833a209 | 2018-05-03 17:50:48 +0000 | [diff] [blame^] | 267 | # - Type Y when asked for confirmation of parameters |
| 268 | # - Accept /tmp as the install directory |
| 269 | # - Type Y to agree to creation of a Maven Artifact |
Saryu Shah | b0c7e3b | 2018-05-01 01:12:23 +0000 | [diff] [blame] | 270 | |
| 271 | |
| 272 | **Step 6:** Maven artifact creation now proceeds. After some minutes, confirmation is requested for deployment of rules into Maven. |
| 273 | .. code-block:: bash |
| 274 | |
Saryu Shah | 833a209 | 2018-05-03 17:50:48 +0000 | [diff] [blame^] | 275 | # - Type Y to deploy the rules. |
Saryu Shah | b0c7e3b | 2018-05-01 01:12:23 +0000 | [diff] [blame] | 276 | |
| 277 | The rules are deployed into Maven. Expect the rule deployment process to take a number of minutes, perhaps 10 minutes. |
| 278 | |
| 279 | |
| 280 | **Step 7:** Copy the Amsterdam properties file into the Drools PDP configuration directory. This file configures the Drools PDP with the Amsterdam policies |
| 281 | |
| 282 | .. code-block:: bash |
| 283 | |
| 284 | cp /tmp/amsterdam/amsterdam-controller.properties /opt/app/policy/config |
| 285 | |
| 286 | **Step 8:** Stop and start the Drools PDP |
| 287 | |
| 288 | .. code-block:: bash |
| 289 | |
| 290 | policy stop |
| 291 | policy start |
| 292 | |
| 293 | **Step 9:** Now verify that the Amsterdam policies are loaded, there should be a fact in the Drools PDP |
| 294 | |
| 295 | .. code-block:: bash |
| 296 | |
| 297 | curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/amsterdam/drools/facts/amsterdam | python -m json.tool |
| 298 | |
| 299 | Expect the response: |
| 300 | |
| 301 | .. code-block:: bash |
| 302 | |
| 303 | { |
| 304 | "org.onap.policy.controlloop.Params": 1 |
| 305 | } |
| 306 | |
| 307 | |
| 308 | Execute the vCPE Use Case Manually |
| 309 | ---------------------------------- |
| 310 | |
| 311 | You can now run the vCPE Policy use case manually using the HowTos below: |
| 312 | * `Tutorial: Testing the vCPE use case in a standalone PDP-D <tutorial_vCPE.html>`_ |
| 313 | |
| 314 | .. note:: |
| 315 | 1. You should check that the topic names you use match those in the Amsterdam configuration file */opt/app/policy/config/amsterdam-controller.properties*. |
| 316 | 2. You should ensure that you change to the directory */tmp/amsterdam* prior to running those HowTos |
| 317 | |
| 318 | |
| 319 | |
| 320 | .. Installation of Amsterdam Controller and vCPE Policy : https://wiki.onap.org/display/DW/ONAP+Policy+Framework%3A+Installation+of+Amsterdam+Controller+and+vCPE+Policy |
| 321 | |
| 322 | |
| 323 | |
| 324 | End of Document |
| 325 | |