Installation of Beijing Controller and Policies¶
Contents
This article explains how to install the Beijing policy controller and the Beijing policies on a raw ONAP Policy Framework installation running in Docker.
To build a raw Policy Framework installation, please follow either of the HowTo articles below prior to using this HowTo:
You should have the ONAP Policy Framework running in Docker and started the Policy Framework with docker-compose.
Test that the ONAP Policy Framework is up and is empty¶
Step 1: Run the command below.
curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/beijing | python -m json.tool
You should get a response similar to the following:
{ "error": "beijing not found" }
Install the Beijing policy controller¶
Step 1: Log onto the Drools PDP.
docker exec -it drools bash
You now have a shell open in the Drools PDP container running in docker
Step 2: Create a temporary directory for controller installation
mkdir /tmp/apps-controlloop cd /tmp/apps-controlloop
Step 3: Download the latest controller from Nexus (1.2.0 at the time of writing)
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.zipAlternatively, you can build the drools-applications component of the Policy Framework from source and install it from the following location on your build host
~/.m2/repository/org/onap/policy/drools-applications/controlloop/packages/apps-controlloop/1.2.0/apps-controlloop-1.2.0.zip
Step 4: Unzip the controller
unzip apps-controlloop-1.2.0.zip
Step 5: Update the installation script to install the Beijing controller
vi apps-controlloop-installer # Change the line # "features enable controlloop-amsterdam" # to # "features enable controlloop-beijing"
Step 6: Stop the policy engine
policy stop
Step 7: Install the controller by running the controller installation script
./apps-controlloop-installer
Step 8: Install the controlloop-utils Drools PDP feature to allow standalone execution of control loop policies
features install controlloop-utils features enable controlloop-utils
Step 9: Start the policy engine
policy startMonitor the CPU for a few minutes with the top command until it settles down after the policy start.
- Step 10: Check if the Beijing controller is loaded
curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/beijing | python -m json.tool
You should get a response similar to the following:
1 "alive": true, 2 "drools": { 3 "alive": true, 4 "artifactId": "controller-beijing", 5 "brained": true, 6 "groupId": "org.onap.policy.drools-applications.controlloop.common", 7 "locked": false, 8 "modelClassLoaderHash": 1562533966, 9 "recentSinkEvents": [], 10 "recentSourceEvents": [], 11 "sessionCoordinates": [ 12 "org.onap.policy.drools-applications.controlloop.common:controller-beijing:1.2.0:beijing" 13 ], 14 "sessions": [ 15 "beijing" 16 ], 17 "version": "1.2.0" 18 }, 19 "locked": false, 20 "name": "beijing", 21 "topicSinks": [ 22 { 23 "alive": true, 24 "allowSelfSignedCerts": false, 25 "apiKey": "", 26 "apiSecret": "", 27 "locked": false, 28 "partitionKey": "86d1234b-e431-4191-b7c6-56d2d2909a97", 29 "recentEvents": [], 30 "servers": [ 31 "vm1.mr.simpledemo.openecomp.org" 32 ], 33 "topic": "APPC-CL", 34 "topicCommInfrastructure": "UEB", 35 "useHttps": false 36 }, 37 { 38 "alive": true, 39 "allowSelfSignedCerts": false, 40 "apiKey": "", 41 "apiSecret": "", 42 "locked": false, 43 "partitionKey": "dea0f440-0232-4f63-b79e-6d51f3674d35", 44 "recentEvents": [], 45 "servers": [ 46 "vm1.mr.simpledemo.openecomp.org" 47 ], 48 "topic": "APPC-LCM-READ", 49 "topicCommInfrastructure": "UEB", 50 "useHttps": false 51 }, 52 { 53 "alive": true, 54 "allowSelfSignedCerts": false, 55 "apiKey": "", 56 "apiSecret": "", 57 "locked": false, 58 "partitionKey": "2918d779-870d-429b-b469-78677d027deb", 59 "recentEvents": [], 60 "servers": [ 61 "vm1.mr.simpledemo.openecomp.org" 62 ], 63 "topic": "POLICY-CL-MGT", 64 "topicCommInfrastructure": "UEB", 65 "useHttps": false 66 } 67 ], 68 "topicSources": [ 69 { 70 "alive": true, 71 "allowSelfSignedCerts": false, 72 "apiKey": "", 73 "apiSecret": "", 74 "consumerGroup": "31740f8e-f878-4347-849e-3b3352c28dff", 75 "consumerInstance": "drools", 76 "fetchLimit": 100, 77 "fetchTimeout": 15000, 78 "locked": false, 79 "recentEvents": [], 80 "servers": [ 81 "vm1.mr.simpledemo.openecomp.org" 82 ], 83 "topic": "PDPD-CONFIGURATION", 84 "topicCommInfrastructure": "UEB", 85 "useHttps": false 86 }, 87 { 88 "alive": true, 89 "allowSelfSignedCerts": false, 90 "apiKey": "", 91 "apiSecret": "", 92 "consumerGroup": "429aa858-633e-43dc-8619-7004e133d650", 93 "consumerInstance": "drools", 94 "fetchLimit": 100, 95 "fetchTimeout": 15000, 96 "locked": false, 97 "recentEvents": [], 98 "servers": [ 99 "vm1.mr.simpledemo.openecomp.org" 100 ], 101 "topic": "unauthenticated.DCAE_CL_OUTPUT", 102 "topicCommInfrastructure": "UEB", 103 "useHttps": false 104 }, 105 { 106 "alive": true, 107 "allowSelfSignedCerts": false, 108 "apiKey": "", 109 "apiSecret": "", 110 "consumerGroup": "1bf6854d-a0f1-4d03-baaf-084e6f365a86", 111 "consumerInstance": "drools", 112 "fetchLimit": 100, 113 "fetchTimeout": 15000, 114 "locked": false, 115 "recentEvents": [], 116 "servers": [ 117 "vm1.mr.simpledemo.openecomp.org" 118 ], 119 "topic": "APPC-CL", 120 "topicCommInfrastructure": "UEB", 121 "useHttps": false 122 }, 123 { 124 "alive": true, 125 "allowSelfSignedCerts": false, 126 "apiKey": "", 127 "apiSecret": "", 128 "consumerGroup": "3f0d7fdf-956d-4749-be54-1adb32ccfa4f", 129 "consumerInstance": "drools", 130 "fetchLimit": 100, 131 "fetchTimeout": 15000, 132 "locked": false, 133 "recentEvents": [], 134 "servers": [ 135 "vm1.mr.simpledemo.openecomp.org" 136 ], 137 "topic": "APPC-LCM-WRITE", 138 "topicCommInfrastructure": "UEB", 139 "useHttps": false 140 } 141 ] 142}
Install the Beijing vCPE Policy¶
We now install the Beijing policies for the vCPE, vFirewall, vDNS & VOLTE use cases.
Step 1: Log onto (or remain logged onto) the Drools PDP.
docker exec -it drools bash
You now have a shell open in the Drools PDP container running in docker
Step 2: Check that the Beijing policies are not loaded by querying for Drools facts
curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/beijing/drools/facts/beijing | python -m json.tool
Expect the response {} indicating no policies are loaded.
Step 3: Create a temporary directory for policy installation
mkdir /tmp/basex-controlloop cd /tmp/basex-controlloop
Step 4: Extract the policies from the control loop zip file previously downloaded from Nexus and expanded in steps 3 and 4 above.
tar zxvf /tmp/apps-controlloop/basex-controlloop-1.2.0.tar.gz
Step 5: Install the Beijing policy rules, the script asks for a number of input parameters, accept the default for all parameters
bin/create-cl-beijing # - Type Y when asked for confirmation of parameters # - Accept /tmp as the install directory # - Type Y to agree to creation of a Maven Artifact
- Step 6: Maven artifact creation now proceeds. After some minutes, confirmation is requested for deployment of rules into Maven.
# - Type Y to deploy the rules.
The rules are deployed into Maven. Expect the rule deployment process to take a number of minutes, perhaps 10 minutes.
Step 7: Copy the Beijing properties file into the Drools PDP configuration directory. This file configures the Drools PDP with the Beijing policies
cp /tmp/beijing/beijing-controller.properties /opt/app/policy/config
Step 8: Stop and start the Drools PDP
policy stop policy startAgain, monitor the processes with top and wait for the PDP to fully start.
Step 9: Push the Beijing policy facts to the Drools PDP
bin/push-policies-beijing # When the script prompts for the path to the properties file, enter the following: # /opt/app/policy/config/beijing-controller.properties
Step 10: Now verify that the Beijing policies are loaded, there should be four facts (one per use case) in the Drools PDP
curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/beijing/drools/facts/beijing | python -m json.tool
Expect the response:
{ "org.onap.policy.controlloop.params.ControlLoopParams": 4 }
Execute the vCPE Use Case Manually¶
- You can now run the vCPE Policy use case manually using the HowTos below:
Note
You should check that the topic names you use match those in the Beijing configuration file /opt/app/policy/config/beijing-controller.properties.
You should ensure that you change to the directory /tmp/beijing prior to running those HowTos
End of Document