summaryrefslogtreecommitdiffstats
path: root/docs/platform/installationVM.rst
blob: e690497aa53732f3b4806cb2def48a52d79ce5de (plain)
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0

Standalone Installation in Virtual Machine 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. contents::
    :depth: 2

Overview
---------

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.
	* Install policy framework on a Virtual Machine using the integration script.
	* Install the Beijing controller.
	* Install and Push Beijing policy for vCPE, vFirewall, vDNS & VOLTE use cases.
	* Verify the use cases manually.

.. note:: 
	* Either use sudo access to run the commands or login through root user.
	* These steps have been verified for a VM with Ubuntu OS.

**Follow the steps below to install policy framework in a virtual machine using the integration script.**

Docker Installation
-------------------

**Step 1:** Make the etc/hosts entries

	.. code-block:: bash 
	
	    echo $(hostname -I | cut -d\  -f1) $(hostname) | sudo tee -a /etc/hosts

**Step 2:** Make the DNS entries

	.. code-block:: bash 
	
	    echo "nameserver <PrimaryDNSIPIP>" >> /etc/resolvconf/resolv.conf.d/head
	    echo "nameserver <SecondaryDNSIP>" >> /etc/resolvconf/resolv.conf.d/head
	    resolvconf -u

**Step 3:** Update the ubuntu software installer

	.. code-block:: bash 
	
	    apt-get update

**Step 4:** Check and Install Java

	.. code-block:: bash 
	
	    apt-get install -y openjdk-8-jdk
	    java -version

	Ensure that the Java version that is executing is *OpenJDK version 8*

**Step 5:** Check and Install GIT

	.. code-block:: bash 
	
	    apt-get install git 
	    git -version

**Step 6:** Check and Install Maven

	.. code-block:: bash 
	
	    apt-get install maven
	    mvn -version

**Step 7:** Check and Install docker and docker-compose

	.. code-block:: bash 
	
	    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
	    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
	    apt-get update
	    apt-cache policy docker-ce
	    apt-get install -y docker-ce
	    systemctl status docker
	    docker ps
	    apt install docker-compose
	    docker-compose

**Step 8:** Check the MTU size of the eth0 interface on your VM, it is 9126 in the example below

	.. code-block:: bash 
	
	    ifconfig
	    eth0      Link encap:Ethernet  HWaddr 02:42:ac:12:00:07  
	              inet addr:172.18.0.7  Bcast:0.0.0.0  Mask:255.255.0.0
	              inet6 addr: fe80::42:acff:fe12:7/64 Scope:Link
	              UP BROADCAST RUNNING MULTICAST  MTU:9126  Metric:1
	              RX packets:44955 errors:0 dropped:0 overruns:0 frame:0
	              TX packets:75017 errors:0 dropped:0 overruns:0 carrier:0
	              collisions:0 txqueuelen:0 
	              RX bytes:8712526 (8.7 MB)  TX bytes:7079733 (7.0 MB)

**Step 9:** Configure the DNS settings in the Docker daemon configuration file /etc/docker/daemon.json

	* add or edit the first line below for your DNS settings *<PrimaryDNSIP>* and *<SecondaryDNSIP>*
	* add or edit the second line below for your MTU size *<MTUSize>*, taken from the command in step 8 above

	.. code-block:: bash 
	
	    add "dns": ["<PrimaryDNSIP>", "<SecondaryDNSIP>"]
	    add "mtu": <MTUSize>

**Step 10:** Restart the docker service

	.. code-block:: bash 
	
	    service docker restart

**Step 11:** Change the permissions of the Docker Daemon configuration file

	.. code-block:: bash 
	
	    chmod 565 /etc/docker/daemon.json

**Step 12:** Configure the DNS settings in the Docker configuration file */etc/default/docker* 

	* add or edit the line below for your DNS settings *<PrimaryDNSIP>* and *<SecondaryDNSIP>* 

	.. code-block:: bash 
	
	    add DOCKER_OPTS="--dns <PrimaryDNSIP> --dns <SecondaryDNSIP>"

**Step 13:** Change the permissions of the Docker socket file

	.. code-block:: bash 
	
	    chmod 565 /var/run/docker.sock

**Step 14:** Check the status of the Docker service and ensure it is running correctly

	.. code-block:: bash 
	
	    service docker status
	    docker ps

Install the ONAP Policy Framework
---------------------------------

**Step 1:** Clone the integration git repository

	.. code-block:: bash 
	
	    git clone https://gerrit.onap.org/r/integration

**Step 2:** Change to the policy integration script location

	.. code-block:: bash 
	
	    cd integration/test/csit/scripts/policy/

**Step 3:** Edit the Policy integration script script1.sh

	.. code-block:: bash 
	
	    # - set the MTU value <MTUValue> to the same value as read in step 8 above
	    # - set the value of PRELOAD_POLICIES to true
	    # - change the name of the docker compose Yaml file to remove the -integration part of the file name from
	    #       "docker-compose -f docker-compose-integration.yml up -d"
	    #   to  
	    #       "docker-compose -f docker-compose.yml up -d"

	    export MTU=<MTUValue>
	    export PRELOAD_POLICIES=true
	    docker-compose -f docker-compose.yml up -d

**Step 4:** Run the integration script for automated installation

	.. code-block:: bash 
	
	    ./script1.sh | tee /tmp/log.txt

	Note: It may take up to 60 minutes for the installation to complete. You can view installation logs in /tmp/log.txt


**Step 5:** Verify the installation

	.. code-block:: bash 
	
	    echo $(hostname -I | cut -d\  -f1) $(hostname) | sudo tee -a /etc/hosts
	    docker ps
	    
	    CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS                                            NAMES
	    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
	    52a910a3678b        onap/policy-pe             "bash ./do-start.sh …"   2 days ago          Up 2 days           0.0.0.0:8081->8081/tcp                           pdp
	    aa9bb20efe59        onap/policy-pe             "bash ./do-start.sh …"   2 days ago          Up 2 days                                                            brmsgw
	    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
	    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
	    fd48c851b6be        mariadb:10.0.34            "docker-entrypoint.s…"   2 days ago          Up 2 days           0.0.0.0:3306->3306/tcp                           mariadb


Installation of Controllers and Policies
----------------------------------------

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.

    * `Installation of Amsterdam Controller and vCPE Policy <installAmsterController.html>`_
    * `Installation of Beijing Controller and Policies <installBeijingController.html>`_


Useful Commands
---------------

The following command returns a JSON document containing the configuration information from the PDP.

.. code-block:: bash 
   :caption: To return a JSON document containing the configuration information from the PDP
	
    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


Run following command to check PDP, PAP and PDP-D Health status

.. code-block:: bash 
   :caption: To check PDP, PAP and PDP-D Health status
	
    http -a 'healthcheck:zb!XztG34' :6969/healthcheck 
     
    HTTP/1.1 200 OK
    Content-Length: 276
    Content-Type: application/json
    Date: Tue, 17 Apr 2018 10:51:14 GMT
    Server: Jetty(9.3.20.v20170531)
    {  
       "details":[  
          {  
             "code":200,
             "healthy":true,
             "message":"alive",
             "name":"PDP-D",
             "url":"self"
          },
          {  
             "code":200,
             "healthy":true,
             "message":"",
             "name":"PAP",
             "url":"http://pap:9091/pap/test"
          },
          {  
             "code":200,
             "healthy":true,
             "message":"",
             "name":"PDP",
             "url":"http://pdp:8081/pdp/test"
          }
       ],
       "healthy":true
    }

Run following command to make sure all topics are created

.. code-block:: bash 
   :caption: To check all topics are created
	
    curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/topics/sources | python -m json.tool


.. _Standalone installation in Virtual Machine: https://wiki.onap.org/display/DW/ONAP+Policy+Framework%3A+Standalone+installation+in+Virtual+Machine



End of Document