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 | Standalone Installation in Virtual Machine |
| 5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | |
| 7 | .. contents:: |
| 8 | :depth: 2 |
| 9 | |
| 10 | Overview |
| 11 | --------- |
| 12 | |
| 13 | This document explains the steps required to install ONAP policy framework in a standalone virtual machine. The following steps are explained in detail with required commands. |
| 14 | * Install policy framework on a Virtual Machine using the integration script. |
| 15 | * Install the Beijing controller. |
| 16 | * Install and Push Beijing policy for vCPE, vFirewall, vDNS & VOLTE use cases. |
| 17 | * Verify the use cases manually. |
| 18 | |
| 19 | .. note:: |
| 20 | * Either use sudo access to run the commands or login through root user. |
| 21 | * These steps have been verified for a VM with Ubuntu OS. |
| 22 | |
| 23 | **Follow the steps below to install policy framework in a virtual machine using the integration script.** |
| 24 | |
| 25 | Docker Installation |
| 26 | ------------------- |
| 27 | |
| 28 | **Step 1:** Make the etc/hosts entries |
| 29 | |
| 30 | .. code-block:: bash |
| 31 | |
| 32 | echo $(hostname -I | cut -d\ -f1) $(hostname) | sudo tee -a /etc/hosts |
| 33 | |
| 34 | **Step 2:** Make the DNS entries |
| 35 | |
| 36 | .. code-block:: bash |
| 37 | |
| 38 | echo "nameserver <PrimaryDNSIPIP>" >> /etc/resolvconf/resolv.conf.d/head |
| 39 | echo "nameserver <SecondaryDNSIP>" >> /etc/resolvconf/resolv.conf.d/head |
| 40 | resolvconf -u |
| 41 | |
| 42 | **Step 3:** Update the ubuntu software installer |
| 43 | |
| 44 | .. code-block:: bash |
| 45 | |
| 46 | apt-get update |
| 47 | |
| 48 | **Step 4:** Check and Install Java |
| 49 | |
| 50 | .. code-block:: bash |
| 51 | |
| 52 | apt-get install -y openjdk-8-jdk |
| 53 | java -version |
| 54 | |
| 55 | Ensure that the Java version that is executing is *OpenJDK version 8* |
| 56 | |
| 57 | **Step 5:** Check and Install GIT |
| 58 | |
| 59 | .. code-block:: bash |
| 60 | |
| 61 | apt-get install git |
| 62 | git -version |
| 63 | |
| 64 | **Step 6:** Check and Install Maven |
| 65 | |
| 66 | .. code-block:: bash |
| 67 | |
| 68 | apt-get install maven |
| 69 | mvn -version |
| 70 | |
| 71 | **Step 7:** Check and Install docker and docker-compose |
| 72 | |
| 73 | .. code-block:: bash |
| 74 | |
| 75 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| 76 | add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
| 77 | apt-get update |
| 78 | apt-cache policy docker-ce |
| 79 | apt-get install -y docker-ce |
| 80 | systemctl status docker |
| 81 | docker ps |
| 82 | apt install docker-compose |
| 83 | docker-compose |
| 84 | |
| 85 | **Step 8:** Check the MTU size of the eth0 interface on your VM, it is 9126 in the example below |
| 86 | |
| 87 | .. code-block:: bash |
| 88 | |
| 89 | ifconfig |
| 90 | eth0 Link encap:Ethernet HWaddr 02:42:ac:12:00:07 |
| 91 | inet addr:172.18.0.7 Bcast:0.0.0.0 Mask:255.255.0.0 |
| 92 | inet6 addr: fe80::42:acff:fe12:7/64 Scope:Link |
| 93 | UP BROADCAST RUNNING MULTICAST MTU:9126 Metric:1 |
| 94 | RX packets:44955 errors:0 dropped:0 overruns:0 frame:0 |
| 95 | TX packets:75017 errors:0 dropped:0 overruns:0 carrier:0 |
| 96 | collisions:0 txqueuelen:0 |
| 97 | RX bytes:8712526 (8.7 MB) TX bytes:7079733 (7.0 MB) |
| 98 | |
| 99 | **Step 9:** Configure the DNS settings in the Docker daemon configuration file /etc/docker/daemon.json |
| 100 | |
| 101 | * add or edit the first line below for your DNS settings *<PrimaryDNSIP>* and *<SecondaryDNSIP>* |
| 102 | * add or edit the second line below for your MTU size *<MTUSize>*, taken from the command in step 8 above |
| 103 | |
| 104 | .. code-block:: bash |
| 105 | |
| 106 | add "dns": ["<PrimaryDNSIP>", "<SecondaryDNSIP>"] |
| 107 | add "mtu": <MTUSize> |
| 108 | |
| 109 | **Step 10:** Restart the docker service |
| 110 | |
| 111 | .. code-block:: bash |
| 112 | |
| 113 | service docker restart |
| 114 | |
| 115 | **Step 11:** Change the permissions of the Docker Daemon configuration file |
| 116 | |
| 117 | .. code-block:: bash |
| 118 | |
| 119 | chmod 565 /etc/docker/daemon.json |
| 120 | |
| 121 | **Step 12:** Configure the DNS settings in the Docker configuration file */etc/default/docker* |
| 122 | |
| 123 | * add or edit the line below for your DNS settings *<PrimaryDNSIP>* and *<SecondaryDNSIP>* |
| 124 | |
| 125 | .. code-block:: bash |
| 126 | |
| 127 | add DOCKER_OPTS="--dns <PrimaryDNSIP> --dns <SecondaryDNSIP>" |
| 128 | |
| 129 | **Step 13:** Change the permissions of the Docker socket file |
| 130 | |
| 131 | .. code-block:: bash |
| 132 | |
| 133 | chmod 565 /var/run/docker.sock |
| 134 | |
| 135 | **Step 14:** Check the status of the Docker service and ensure it is running correctly |
| 136 | |
| 137 | .. code-block:: bash |
| 138 | |
| 139 | service docker status |
| 140 | docker ps |
| 141 | |
| 142 | Install the ONAP Policy Framework |
| 143 | --------------------------------- |
| 144 | |
| 145 | **Step 1:** Clone the integration git repository |
| 146 | |
| 147 | .. code-block:: bash |
| 148 | |
| 149 | git clone https://gerrit.onap.org/r/integration |
| 150 | |
| 151 | **Step 2:** Change to the policy integration script location |
| 152 | |
| 153 | .. code-block:: bash |
| 154 | |
| 155 | cd integration/test/csit/scripts/policy/ |
| 156 | |
| 157 | **Step 3:** Edit the Policy integration script script1.sh |
| 158 | |
| 159 | .. code-block:: bash |
| 160 | |
| 161 | # - set the MTU value <MTUValue> to the same value as read in step 8 above |
| 162 | # - set the value of PRELOAD_POLICIES to true |
| 163 | # - change the name of the docker compose Yaml file to remove the -integration part of the file name from |
| 164 | # "docker-compose -f docker-compose-integration.yml up -d" |
| 165 | # to |
| 166 | # "docker-compose -f docker-compose.yml up -d" |
| 167 | |
| 168 | export MTU=<MTUValue> |
| 169 | export PRELOAD_POLICIES=true |
| 170 | docker-compose -f docker-compose.yml up -d |
| 171 | |
| 172 | **Step 4:** Run the integration script for automated installation |
| 173 | |
| 174 | .. code-block:: bash |
| 175 | |
| 176 | ./script1.sh | tee /tmp/log.txt |
| 177 | |
| 178 | Note: It may take up to 60 minutes for the installation to complete. You can view installation logs in /tmp/log.txt |
| 179 | |
| 180 | |
| 181 | **Step 5:** Verify the installation |
| 182 | |
| 183 | .. code-block:: bash |
| 184 | |
| 185 | echo $(hostname -I | cut -d\ -f1) $(hostname) | sudo tee -a /etc/hosts |
| 186 | docker ps |
| 187 | |
| 188 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| 189 | 2d04434c5354 onap/policy-drools "/bin/sh -c ./do-sta…" 2 days ago Up 2 days 0.0.0.0:6969->6969/tcp, 0.0.0.0:9696->9696/tcp drools |
| 190 | 52a910a3678b onap/policy-pe "bash ./do-start.sh …" 2 days ago Up 2 days 0.0.0.0:8081->8081/tcp pdp |
| 191 | aa9bb20efe59 onap/policy-pe "bash ./do-start.sh …" 2 days ago Up 2 days brmsgw |
| 192 | 7cdf4919044b onap/policy-pe "bash ./do-start.sh …" 2 days ago Up 2 days 0.0.0.0:8443->8443/tcp, 0.0.0.0:9091->9091/tcp pap |
| 193 | 394854eab2bc sonatype/nexus:2.14.8-01 "/bin/sh -c '${JAVA_…" 2 days ago Up 2 days 0.0.0.0:9081->8081/tcp nexus |
| 194 | fd48c851b6be mariadb:10.0.34 "docker-entrypoint.s…" 2 days ago Up 2 days 0.0.0.0:3306->3306/tcp mariadb |
| 195 | |
| 196 | |
| 197 | Installation of Controllers and Policies |
| 198 | ---------------------------------------- |
| 199 | |
| 200 | You may now install a controller and policies on the ONAP Policy Framework. Follow either of the HowTos below to install either the Amsterdam or Beijing controller and policies. |
| 201 | |
| 202 | * `Installation of Amsterdam Controller and vCPE Policy <installAmsterController.html>`_ |
| 203 | * `Installation of Beijing Controller and Policies <installBeijingController.html>`_ |
| 204 | |
| 205 | |
| 206 | Useful Commands |
| 207 | --------------- |
| 208 | |
| 209 | The following command returns a JSON document containing the configuration information from the PDP. |
| 210 | |
| 211 | .. code-block:: bash |
| 212 | :caption: To return a JSON document containing the configuration information from the PDP |
| 213 | |
| 214 | curl -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": ".*"}' http://localhost:8081/pdp/api/getConfig | python -m json.tool |
| 215 | |
| 216 | |
| 217 | Run following command to check PDP, PAP and PDP-D Health status |
| 218 | |
| 219 | .. code-block:: bash |
| 220 | :caption: To check PDP, PAP and PDP-D Health status |
| 221 | |
| 222 | http -a 'healthcheck:zb!XztG34' :6969/healthcheck |
| 223 | |
| 224 | HTTP/1.1 200 OK |
| 225 | Content-Length: 276 |
| 226 | Content-Type: application/json |
| 227 | Date: Tue, 17 Apr 2018 10:51:14 GMT |
| 228 | Server: Jetty(9.3.20.v20170531) |
| 229 | { |
| 230 | "details":[ |
| 231 | { |
| 232 | "code":200, |
| 233 | "healthy":true, |
| 234 | "message":"alive", |
| 235 | "name":"PDP-D", |
| 236 | "url":"self" |
| 237 | }, |
| 238 | { |
| 239 | "code":200, |
| 240 | "healthy":true, |
| 241 | "message":"", |
| 242 | "name":"PAP", |
| 243 | "url":"http://pap:9091/pap/test" |
| 244 | }, |
| 245 | { |
| 246 | "code":200, |
| 247 | "healthy":true, |
| 248 | "message":"", |
| 249 | "name":"PDP", |
| 250 | "url":"http://pdp:8081/pdp/test" |
| 251 | } |
| 252 | ], |
| 253 | "healthy":true |
| 254 | } |
| 255 | |
| 256 | Run following command to make sure all topics are created |
| 257 | |
| 258 | .. code-block:: bash |
| 259 | :caption: To check all topics are created |
| 260 | |
| 261 | curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/topics/sources | python -m json.tool |
| 262 | |
| 263 | |
| 264 | .. _Standalone installation in Virtual Machine: https://wiki.onap.org/display/DW/ONAP+Policy+Framework%3A+Standalone+installation+in+Virtual+Machine |
| 265 | |
| 266 | |
| 267 | |
| 268 | End of Document |
| 269 | |