fix doc config files and doc files + top-level tox.ini
[vfc/nfvo/lcm.git] / docs / platform / installation / installation / vfc-over-oom.rst
1 .. contents::
2    :depth: 3
3 ..
4
5    **VFC Installation over OOM**
6    **V0.1**
7
8 1 **Scope**
9 =============
10
11 This is a guide to help developer or tester to try to install VF-C over OOM
12
13 2 **Component & function**
14 ==========================
15
16 Repos:
17 ~~~~~~
18
19 Now VF-C have the following repos in https://gerrit.onap.org/r/admin/repos/q/filter:vfc
20
21 .. list-table::
22    :widths: 30 60 10
23    :header-rows: 1
24
25    * - URL
26      - Method
27      - Description
28    * - vfc/nfvo/lcm
29      - NS life cycle management
30      -
31    * - vfc/nfvo/driver/vnfm/svnfm
32      - Specific VNFM drivers
33      -
34    * - vfc/nfvo/driver/vnfm/gvnfm
35      - Generic VNFM drivers
36      -
37    * - vfc/nfvo/db
38      - Stand-alone database microservice, provides the database service for each VF-C component
39      -
40    * - vfc/nfvo/driver/ems
41      - VNF fcaps collect
42      - Deprecated
43    * - vfc/nfvo/driver/sfc
44      - SFC Driver
45      - Deprecated
46    * - vfc/nfvo/resmanagement
47      - NS Resource Management
48      - Deprecated
49    * - vfc/nfvo/wfengine
50      - Work flow engine
51      - Deprecated
52    * - vfc/nfvo/multivimproxy
53      - Multi-vim proxy provides the multivim indirect mode proxy
54      - Deprecated
55    * - vfc/gvnfm/vnflcm
56      - Generic VNFM VNF LCM
57      -
58    * - vfc/gvnfm/vnfmgr
59      - Generic VNFM VNF Mgr
60      -
61    * - vfc/gvnfm/vnfres
62      - Generic VNFM VNF Resource Management
63      -
64
65 VF-C Docker Images:
66 ~~~~~~~~~~~~~~~~~~~~~~~~
67
68 ::
69
70   nexus3.onap.org:10001/onap/vfc/nslcm
71   nexus3.onap.org:10001/onap/vfc/db
72   nexus3.onap.org:10001/onap/vfc/gvnfmdriver
73   nexus3.onap.org:10001/onap/vfc/nfvo/svnfm/huawei
74   nexus3.onap.org:10001/onap/vfc/ztevnfmdriver
75   nexus3.onap.org:10001/onap/vfc/vnflcm
76   nexus3.onap.org:10001/onap/vfc/vnfmgr
77   nexus3.onap.org:10001/onap/vfc/vnfres
78
79
80 Deprecated from Guilin Release:
81 ::
82
83   nexus3.onap.org:10001/onap/vfc/nfvo/svnfm/nokia
84   nexus3.onap.org:10001/onap/vfc/nfvo/svnfm/nokiav2
85   nexus3.onap.org:10001/onap/vfc/emsdriver
86   nexus3.onap.org:10001/onap/vfc/jujudriver
87   nexus3.onap.org:10001/onap/vfc/multivimproxy
88   nexus3.onap.org:10001/onap/vfc/resmanagement
89   nexus3.onap.org:10001/onap/vfc/wfengine-activiti
90   nexus3.onap.org:10001/onap/vfc/wfengine-mgrservice
91   nexus3.onap.org:10001/onap/vfc/ztesdncdriver
92
93
94 **3 VF-C Deployment**
95 =====================
96
97 For initialization of docker there are 2 deployment options currently used in ONAP:
98 - using heat template
99 - using OOM
100
101 From Casablanca release, OOM is the recommended way, so here mainly give the steps for OOM based deployment
102
103 For OOM deployment you can refer to the OOM section in ONAP documentation.
104
105 .. * https://docs.onap.org/projects/onap-oom/en/latest/oom_user_guide.html#oom-user-guide
106 .. * https://docs.onap.org/projects/onap-oom/en/latest/oom_quickstart_guide.html#oom-quickstart-guide
107
108 1. First ensure VF-C is marked true against field enabled in the oom/kubernetes/onap/values.yaml for successful deployment.
109
110 ::
111
112         vfc:
113                 enabled: true
114         vid:
115                 enabled: true
116         vnfsdk:
117                 enabled: true
118         vvp:
119                 enabled: false
120
121
122
123 2. Upgrade Images in OOM charts
124
125 Ensure the component version is right, you should check the respective component image version in VF-C charts.
126 If you need update the version, please modify values.yaml
127
128 eg.
129
130 ::
131         
132     oom/kubernetes/vfc/charts/vfc-nslcm/values.yaml
133
134     #################################################################
135     # Application configuration defaults.
136     #################################################################
137     # application image
138     flavor: small
139
140     repository: nexus3.onap.org:10001
141     image: onap/vfc/nslcm:1.4.1
142     pullPolicy: Always
143         
144
145 3. Rebuild all repos in helm
146
147 Every time you change the charts, you need to rebuild all repos to ensure the change can take effect.
148
149 Step1: Build vfc repo
150
151 ::
152
153         cd oom/kubernetes
154         make vfc 
155
156 Step2: Build ONAP repo
157
158 ::
159
160         cd oom/kubernetes
161         make onap(here can also execute make all)
162
163 Step3: Delete the release already deployed
164
165 ::
166
167         cd oom/kubernetes
168         helm delete dev-vfc --purge
169
170 Step4: Deploy the new pods
171
172 ::
173
174         cd oom/kubernetes
175         helm install local/vfc --namespace onap --name dev-vfc
176
177
178 Now VF-C will be upgraded with the new image version 
179
180 You will see all the pods are running
181         
182 ::
183
184     dev-vfc-generic-vnfm-driver-6fcf454665-6pmfv       2/2     Running            0          11d
185     dev-vfc-huawei-vnfm-driver-6f6c465c76-ktpch        2/2     Running            0          11d
186     dev-vfc-mariadb-0                                  2/2     Running            0          11d
187     dev-vfc-mariadb-1                                  2/2     Running            2          11d
188     dev-vfc-mariadb-2                                  2/2     Running            0          11d
189     dev-vfc-nslcm-6dd99f94f4-vxdkc                     2/2     Running            0          11d
190     dev-vfc-redis-5d7d494fdf-crv8c                     1/1     Running            0          11d
191     dev-vfc-vnflcm-5497c66465-f5mh7                    2/2     Running            0          11d
192     dev-vfc-vnfmgr-5459b488d9-6vg75                    2/2     Running            0          11d
193     dev-vfc-vnfres-5577d674cf-g9fz7                    2/2     Running            0          11d
194     dev-vfc-zte-vnfm-driver-6685b74f95-r5phc           2/2     Running            2          11d
195
196
197 **4 VF-C health check**
198 ========================
199
200 When VF-C pods are up, if you want to check the service status, you can visit the following APIs in K8S cluster to check.
201 These swagger API will also show the APIs VF-C provided.
202
203 +--------------------------+---------------------------------------------------------------------------+
204 |     **Component Name**   |     health check API                                                      |
205 +==========================+===========================================================================+
206 |     vfc/nfvo/lcm         |     http://ClusterIP:8403/api/nslcm/v1/swagger.yaml                       |
207 +--------------------------+---------------------------------------------------------------------------+
208 |vfc/gvnfm/vnflcm          |     http://ClusterIP:8801/api/vnflcm/v1/swagger.yaml                      |
209 +--------------------------+---------------------------------------------------------------------------+
210 |vfc/gvnfm/vnfmgr          |     http://ClusterIP:8803/api/vnfmgr/v1/swagger.yaml                      |
211 +--------------------------+---------------------------------------------------------------------------+
212 |vfc/gvnfm/vnfres          |     http://ClusterIP:8802/api/vnfres/v1/swagger.yaml                      |
213 +--------------------------+---------------------------------------------------------------------------+
214
215 Here are only a few components as an example.
216
217 Take vnflcm as an example, you can visit the API as follow:
218
219 ::
220
221     ubuntu@oom-mr01-rancher:~$ kubectl -n onap get svc|grep vnflcm
222     vfc-vnflcm                         ClusterIP      10.43.71.4      <none>                                 8801/TCP                                                      87d
223     ubuntu@oom-mr01-rancher:~$ curl http://10.43.71.4:8801/api/vnflcm/v1/swagger.json
224     {"swagger": "2.0", "info": {"title": "vnflcm API", "description": "\n\nThe `swagger-ui` view can be found [here](/api/vnflcm/v1/swagger).\n
225     The `ReDoc` view can be found [here](/api/vnflcm/v1/redoc).\nThe swagger YAML document can be found [here](/api/vnflcm/v1/swagger.yaml).\n
226     The swagger JSON document can be found [here](/api/vnflcm/v1/swagger.json)."........
227         
228         
229 Because VF-C expose service by ClusterIP, so that you can only visit the APIs in K8S cluster.
230
231 If you want to visit VF-C APIs outside of K8S cluster, you can visit these APIs via MSB, because all VF-C APIs have been registered to MSB.
232
233 You can execute the following steps:
234
235 ::
236
237         ubuntu@oom-mr01-rancher:~$ kubectl -n onap get pod -o wide|grep msb-iag
238         dev-msb-msb-iag-6fbb5b4dbd-pxs8z                              2/2       Running            4          28d       10.42.72.222    mr01-node1   <none>
239         ubuntu@oom-mr01-rancher:~$ cat /etc/hosts |grep mr01-node1
240         172.60.2.39   mr01-node1
241         ubuntu@oom-mr01-rancher:~$ kubectl -n onap get svc|grep msb-iag
242         msb-iag                            NodePort       10.43.213.250   <none>                                 80:30280/TCP,443:30283/TCP                                    87d
243         ubuntu@oom-mr01-rancher:~$ curl http://172.60.2.39:30280/api/vnflcm/v1/swagger.json
244         {"swagger": "2.0", "info": {"title": "vnflcm API", "description": "\n\nThe `swagger-ui` view can be found [here](/api/vnflcm/v1/swagger).\n
245         The `ReDoc` view can be found [here](/api/vnflcm/v1/redoc).\nThe swagger YAML document can be found [here](/api/vnflcm/v1/swagger.yaml).\n
246         The swagger JSON document can be found [here](/api/vnflcm/v1/swagger.json)."........
247
248
249 You can visit the http://172.60.2.39:30280/api/vnflcm/v1/swagger.json in the browser
250
251
252 **5 Debug and Testing in running Pod**
253 ======================================
254
255 When you are doing the testing and would like to replace some new file like binary or some script and want to check the new result.
256
257 Take vfc-nslcm pod as an example:
258
259 ::
260
261     kubectl -n onap edit deployment dev-vfc-nslcm
262
263     spec:
264       containers:
265       - args:
266         - -c
267         - MYSQL_AUTH=${MYSQL_ROOT_USER}:${MYSQL_ROOT_PASSWORD} ./docker-entrypoint.sh
268         command:
269         - sh
270         env:
271         - name: MSB_HOST
272           value: https://msb-iag:443
273         - name: SSL_ENABLED
274           value: "false"
275         - name: MYSQL_ADDR
276           value: vfc-mariadb:3306
277         - name: MYSQL_ROOT_USER
278           value: root
279         - name: MYSQL_ROOT_PASSWORD
280           valueFrom:
281             secretKeyRef:
282               key: password
283               name: dev-vfc-db-root-pass
284         - name: REDIS_HOST
285           value: vfc-redis
286         - name: REDIS_PORT
287           value: "6379"
288         - name: REG_TO_MSB_WHEN_START
289           value: "false"
290         image: 192.168.235.22:10001/onap/vfc/nslcm:1.4.1
291         imagePullPolicy: IfNotPresent
292         livenessProbe:
293           failureThreshold: 3
294           initialDelaySeconds: 120
295           periodSeconds: 10
296           successThreshold: 1
297           tcpSocket:
298             port: 8403
299           timeoutSeconds: 1
300         name: vfc-nslcm
301         ports:
302         - containerPort: 8403
303           protocol: TCP
304         readinessProbe:
305
306 Then you can replace the value into the pod.
307
308
309 **6 Kubectl basic command**
310 ======================================
311
312 Basic operation of kubernests cluster(Take the namespace of onap in linux client as an example)
313
314 * Check the cluster node
315
316 ::
317             
318     kubectl  get node
319                  
320 * Check cluster namespace
321
322 ::
323                
324     kubectl  get ns
325                 
326 * View the pod information and the pod on which the node is located, under the namespace specified (for example, namespace on onap)
327
328 ::
329                      
330     kubectl get pod -o wide -n onap
331
332 * Connected to the docker in pod
333
334 ::
335       
336     Check the docker's name , return two dockers' name after execution, -c specifie the docker that needed ti go in.     
337             
338     kubectl -n onap get pod dev-vfc-nslcm-68cb7c9878-v4kt2 -o jsonpath={.spec.containers[*].name}
339                 
340     kubectl -n onap exec -it dev-vfc-nslcm-68cb7c9878-v4kt2 -c vfc-nslcm /bin/bash
341             
342 * Copy files (take the catalog example). When the data copy is lost after the pod is restarted or migrated, the multi-copy pod copy operation only exists for the current pod
343
344 ::
345     
346     Copy from local to dockers in pod
347
348     kubectl -n onap cp copy_test.sh  dev-vfc-nslcm-68cb7c9878-v4kt2: -c vfc-nslcm
349                 
350     Copy pod's content to local machine
351                 
352     kubectl -n onap cp dev-vfc-nslcm-68cb7c9878-v4kt2:copy_test.sh -c vfc-nslcm /tmp/copy_test.sh
353                 
354 * Remote command (to see the current path of the container as an example)
355
356 ::
357     
358     kubectl -n onap exec -it dev-vfc-nslcm-68cb7c9878-v4kt2 -c vfc-nslcm pwd
359                 
360 * View pod basic information and logs (no -c parameter added for single container pod)
361
362 ::
363                 
364     kubectl -n onap describe pod dev-vfc-nslcm-68cb7c9878-v4kt2
365                   
366     kubectl -n onap logs dev-vfc-nslcm-68cb7c9878-v4kt2 -c vfc-nslcm
367   
368 * Check the service listening port and manually expose the port, which is commonly used for testing, such as nginx under test namespace
369
370 ::
371                  
372     1>Build namespace
373         
374         kubectl create namespace test
375                   
376     2>create pod with 3 replication
377         
378         kubectl run nginx --image=nginx --replicas=3 -n test
379                   
380     3>Pod exposed ports for nginx (target port, source port target-port)
381                         
382         kubectl expose deployment nginx --port=88 --target-port=80 --type=LoadBalancer -n test
383                   
384         or
385                   
386         kubectl expose deployment nginx --port=88 --target-port=80 --type=NodePort -n test
387
388     4> Check svc(ports that pod exposed , The cluster internally accesses this pod via port 88., external access to the cluster using floatingip+30531)
389                   
390         kubectl get svc -n test
391                   
392         NAME      TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
393         nginx     LoadBalancer   10.43.45.186   10.0.0.3      88:30531/TCP   3m
394                    
395         NAME      TYPE           CLUSTER-IP     EXTERNAL-IP              PORT(S)                    AGE
396         nginx     NodePort       10.43.45.186                               88:30531/TCP   3m
397                    
398                    
399         Nodes within the CLUSTER can be accessed via cluster-ip +88 port
400         Outside the cluster, it is accessible via either EXTERNAL IP or the Floating IP+30531, which is the node name of the pod
401         The floatingip corresponding to the node name can be viewed in the /etc/hosts of the rancher machine or in the documentation
402
403                                
404 * Modify the container image and pod strategy (deployment, statefulset), the completion of modification will trigger the rolling update
405
406 ::
407                   
408     1>To determine whether the pod is a stateful application (efullset) or a stateful application (deployment)
409                     
410         kubectl  -n onap describe  pod dev-vfc-nslcm-68cb7c9878-v4kt2 |grep Controlled
411                     
412     2>Stateless application deployment              
413                     
414         kubectl  -n onap get deploy |grep  nslcm
415                     
416         kubectl -n onap edit deploy  dev-vfc-nslcm-68cb7c9878-v4kt2
417             
418     3>Stateful application statefulset
419                     
420         kubectl  -n onap get statefulset |grep cassandra
421                         
422         kubectl -n onap edit statefulset dev-aai-cassandra                    
423                     
424               
425 * Restart pod(After removing the pod, deployment will recreate a same pod and randomly assign it to any node.)
426
427 ::
428                  
429     kubectl -n onap delete pod dev-vfc-nslcm-68cb7c9878-v4kt2 -c vfc-nslcm
430               
431
432 * View the virtual machine where the portal-app resides in order to add host resolution          
433
434 ::
435       
436     10.0.0.13 corresponding Floating IP is 172.30.3.36
437                     
438     kubectl -n onap get svc  |grep portal-app  
439                     
440     portal-app                 LoadBalancer   10.43.181.163   10.0.0.13     8989:30215/TCP,8403:30213/TCP,8010:30214/TCP,8443:30225/TCP
441                     
442 * Pod expansion and shrinkage
443
444   pod expansion::
445
446     kubectl scale deployment nginx --replicas=3
447
448   pod shrinkage::
449
450     kubectl scale deployment nginx --replicas=1