Merge "Publish vfc-nslcm release version of 1.3.8"
[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 Now VF-C have the following repos in https://gerrit.onap.org/r/#/admin/projects/?filter=vfc
17
18 +--------------------------+-----------------------------------------------------+
19 |     **Repo Name**        |     Description                                     |
20 +==========================+=====================================================+
21 |     vfc/nfvo/lcm         |      NS life cycle management                       |
22 +--------------------------+-----------------------------------------------------+
23 | vfc/nfvo/resmanagement   |      NS Resource Management                         |
24 +--------------------------+-----------------------------------------------------+
25 |vfc/nfvo/driver/vnfm/svnfm|     Specific VNFM drivers                           |
26 +--------------------------+-----------------------------------------------------+
27 |vfc/nfvo/driver/vnfm/gvnfm|     Generic VNFM drivers                            |
28 +--------------------------+-----------------------------------------------------+
29 |vfc/nfvo/driver/sfc       |     SFC Driver                                      |
30 +--------------------------+-----------------------------------------------------+
31 |org.onap.vfc.nfvo.wfengine|     Work flow engine                                |
32 +--------------------------+-----------------------------------------------------+
33 |EMS-driver                |     VNF fcaps collect                               |
34 +--------------------------+-----------------------------------------------------+
35 |vfc/gvnfm/vnflcm          |     Generic VNFM VNF LCM                            |
36 +--------------------------+-----------------------------------------------------+
37 |vfc/gvnfm/vnfmgr          |     Generic VNFM VNF Mgr                            |
38 +--------------------------+-----------------------------------------------------+
39 |vfc/gvnfm/vnfres          |     Generic VNFM VNF Resource Management            |
40 +--------------------------+-----------------------------------------------------+
41 |vfc/nfvo/multivimproxy    | Multi-vim proxy, provide the multivim indirect mode |
42 |                          | proxy which can forward virtual resource requests to|
43 |                                                  | multivim and do some resource checking              |
44 +--------------------------+-----------------------------------------------------+
45 |vfc/nfvo/db               | Stand-alone database microservice, provides the     |
46 |                          |   database services for each VF-C component         |
47 +--------------------------+-----------------------------------------------------+
48
49 Note:
50   a. vfc/nfvo/driver/sfc it migrate from Open-O seed code and now haven't been used in any usecase in ONAP. 
51   b. vfc/nfvo/resmanagement is used to do the resource granting, but now VF-C has been integrated with OOF, this component will be deprecated in the future release.
52   c. vfc/nfvo/db provide the stand-alone database microservice in casablanca release, but now VF-C leverages OOM shared MariaDB-Gelera cluster. This repo still has redis to be used by VF-C component.
53
54
55 VF-C Docker Images
56
57 ::
58
59   docker run -d -p 3306:3306 -p 6379:6379 --name vfc-db -v /var/lib/mysql nexus3.onap.org:10001/onap/vfc/db
60   we use  ${VFC_DB_IP} as the IP of vfc-db component.
61   nexus3.onap.org:10001/onap/vfc/db:1.3.0
62   nexus3.onap.org:10001/onap/vfc/emsdriver:1.3.0
63   nexus3.onap.org:10001/onap/vfc/gvnfmdriver:1.3.0
64   nexus3.onap.org:10001/onap/vfc/jujudriver:1.3.0
65   nexus3.onap.org:10001/onap/vfc/multivimproxy:1.3.0
66   nexus3.onap.org:10001/onap/vfc/nfvo/svnfm/huawei:1.3.0
67   nexus3.onap.org:10001/onap/vfc/nfvo/svnfm/nokia:1.3.0
68   nexus3.onap.org:10001/onap/vfc/nfvo/svnfm/nokiav2:1.3.0
69   nexus3.onap.org:10001/onap/vfc/nslcm:1.3.0
70   nexus3.onap.org:10001/onap/vfc/resmanagement:1.3.0
71   nexus3.onap.org:10001/onap/vfc/vnflcm:1.3.0
72   nexus3.onap.org:10001/onap/vfc/vnfmgr:1.3.0
73   nexus3.onap.org:10001/onap/vfc/vnfres:1.3.0
74   nexus3.onap.org:10001/onap/vfc/wfengine-activiti:1.3.0
75   nexus3.onap.org:10001/onap/vfc/wfengine-mgrservice:1.3.0
76   nexus3.onap.org:10001/onap/vfc/ztesdncdriver:1.3.0
77   nexus3.onap.org:10001/onap/vfc/ztevnfmdriver:1.3.0
78   
79
80 **3 VF-C Deployment**
81 =====================
82
83 For initialization of docker there are 2 deployment options currently adpoted in ONAP:
84 - using heat template
85 - using OOM
86
87 From Casablanca release, OOM is the recommended way, so here mainly give the steps for OOM based deployment
88
89 For OOM deployment you can refer to the below links:
90
91 https://onap.readthedocs.io/en/latest/submodules/oom.git/docs/oom_setup_kubernetes_rancher.html
92 https://onap.readthedocs.io/en/latest/submodules/oom.git/docs/oom_quickstart_guide.html#quick-start-label
93
94 1. First ensure VF-C is marked true against field enabled in the oom/kubernetes/onap/values.yaml for successful deployment.
95
96 ::
97
98         vfc:
99                 enabled: true
100         vid:
101                 enabled: true
102         vnfsdk:
103                 enabled: true
104         vvp:
105                 enabled: false
106
107
108
109 2. Upgrade Images in OOM charts
110
111 Ensure the component version is right, you should check the respective component image version in VF-C charts.
112 If you need update the version, please modify values.yaml
113
114 eg.
115
116 ::
117         
118         oom/kubernetes/vfc/charts/vfc-nslcm/values.yaml
119
120         #################################################################
121         # Global configuration defaults.
122         #################################################################
123         global:
124                 nodePortPrefix: 302
125                 readinessRepository: oomk8s
126                 readinessImage: readiness-check:2.0.0
127                 loggingRepository: docker.elastic.co
128                 loggingImage: beats/filebeat:5.5.0
129
130         #################################################################
131         # Application configuration defaults.
132         #################################################################
133         # application image
134         flavor: small
135
136         repository: nexus3.onap.org:10001
137         image: onap/vfc/nslcm:1.3.7
138         pullPolicy: Always
139         
140
141 3. Rebuild all repos in helm
142
143 Every time you change the charts, you need to rebuild all repos to ensure the change can take effect.
144
145 Step1: Build vfc repo
146
147 ::
148
149         cd oom/kubernetes
150         make vfc 
151
152 Step2: Build ONAP repo
153
154 ::
155
156         cd oom/kubernetes
157         make onap(here can also execute make all)
158
159 Step3: Delete teh existing pods already deployed
160
161 ::
162
163         cd oom/kubernetes
164         helm del dev-vfc --purge
165
166 Step4: Deploy the new pods
167
168 ::
169
170         cd oom/kubernetes
171         helm instal local/vfc --namespace onap --name dev-vfc
172
173
174 Now VF-C will be upgraded with the new image version 
175
176 You will see all the pod is runing 
177         
178 ::
179
180         cd oom/kubernetes
181         dev-vfc-vfc-db-6c57b4fd47-7kbnj                               1/1       Running            2          79d
182         dev-vfc-vfc-ems-driver-65bd9bf5b-65gtg                        1/1       Running            48         79d
183         dev-vfc-vfc-generic-vnfm-driver-698c8d6698-2ctlg              2/2       Running            4          79d
184         dev-vfc-vfc-huawei-vnfm-driver-6d5db69469-277vb               2/2       Running            7          79d
185         dev-vfc-vfc-juju-vnfm-driver-68d4556dfd-hncrm                 2/2       Running            4          79d
186         dev-vfc-vfc-multivim-proxy-74d8fc568d-gn8gp                   1/1       Running            6          79d
187         dev-vfc-vfc-nokia-v2vnfm-driver-759687787f-fdfsg              1/1       Running            2          79d
188         dev-vfc-vfc-nokia-vnfm-driver-9cbcb9697-z7hp4                 2/2       Running            6          79d
189         dev-vfc-vfc-nslcm-97c97759f-x9r9h                             2/2       Running            9          79d
190         dev-vfc-vfc-resmgr-84b9b579c9-b7cbj                           2/2       Running            7          79d
191         dev-vfc-vfc-vnflcm-7cbdfcfd9b-bqwz8                           2/2       Running            13         79d
192         dev-vfc-vfc-vnfmgr-54bdfb84c4-kwbds                           2/2       Running            6          79d
193         dev-vfc-vfc-vnfres-7fdbc88945-t9nhd                           2/2       Running            5          79d
194         dev-vfc-vfc-workflow-5b745cf488-7z7nd                         1/1       Running            2          79d
195         dev-vfc-vfc-workflow-engine-6d5d8ffc7c-pjpmc                  1/1       Running            2          79d
196         dev-vfc-vfc-zte-sdnc-driver-6554df5856-ctjxh                  1/1       Running            7          79d
197         dev-vfc-vfc-zte-vnfm-driver-7dbd4f887-thvvg                   2/2       Running            8          79d
198
199
200 **4 VF-C health check**
201 ========================
202
203 When VF-C pod is up, if you want to check the service status, you can visit the following APIs in K8S cluster to check.
204 These swagger API will also show the APIs VF-C provided.
205
206 +--------------------------+---------------------------------------------------------------------------+
207 |     **Component Name**   |     health check API                                                      |
208 +==========================+===========================================================================+
209 |     vfc/nfvo/lcm         |     http://ClusterIP:8403/api/nslcm/v1/swagger.yaml                       |
210 +--------------------------+---------------------------------------------------------------------------+
211 |vfc/gvnfm/vnflcm          |     http://ClusterIP:8801/api/vnflcm/v1/swagger.yaml                      |
212 +--------------------------+---------------------------------------------------------------------------+
213 |vfc/gvnfm/vnfmgr          |     http://ClusterIP:8803/api/vnfmgr/v1/swagger.yaml                      |
214 +--------------------------+---------------------------------------------------------------------------+
215 |vfc/gvnfm/vnfres          |     http://ClusterIP:8802/api/vnfres/v1/swagger.yaml                      |
216 +--------------------------+---------------------------------------------------------------------------+
217
218 Here are only a few componnets as an example.
219
220 Take vnflcm as an example, you can visit the api as follow:
221
222 ::
223
224     ubuntu@oom-mr01-rancher:~$ kubectl -n onap get svc|grep vnflcm
225         vfc-vnflcm                         ClusterIP      10.43.71.4      <none>                                 8801/TCP                                                      87d
226         ubuntu@oom-mr01-rancher:~$ curl http://10.43.71.4:8801/api/vnflcm/v1/swagger.json
227         {"swagger": "2.0", "info": {"title": "vnflcm API", "description": "\n\nThe `swagger-ui` view can be found [here](/api/vnflcm/v1/swagger).\n
228         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
229         The swagger JSON document can be found [here](/api/vnflcm/v1/swagger.json)."........
230         
231         
232 Because VF-C expose service by ClusterIP, so that you can only visit the APIs in K8S cluster. 
233 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.
234 You can execute the following steps:
235
236 ::
237
238         ubuntu@oom-mr01-rancher:~$ kubectl -n onap get pod -o wide|grep msb-iag
239         dev-msb-msb-iag-6fbb5b4dbd-pxs8z                              2/2       Running            4          28d       10.42.72.222    mr01-node1   <none>
240         ubuntu@oom-mr01-rancher:~$ cat /etc/hosts |grep mr01-node1
241         172.60.2.39   mr01-node1
242         ubuntu@oom-mr01-rancher:~$ kubectl -n onap get svc|grep msb-iag
243         msb-iag                            NodePort       10.43.213.250   <none>                                 80:30280/TCP,443:30283/TCP                                    87d
244         ubuntu@oom-mr01-rancher:~$ curl http://172.60.2.39:30280/api/vnflcm/v1/swagger.json
245         {"swagger": "2.0", "info": {"title": "vnflcm API", "description": "\n\nThe `swagger-ui` view can be found [here](/api/vnflcm/v1/swagger).\n
246         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
247         The swagger JSON document can be found [here](/api/vnflcm/v1/swagger.json)."........
248
249
250 You can visit the http://172.60.2.39:30280/api/vnflcm/v1/swagger.json in the browser
251
252
253 **5 Debug and Testing in running Pod**
254 ======================================
255
256 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 resut.
257 Before you replace the file to the running pod,you need to close the pod livenessProbe and readinessProbe first to avoid the pod restart.
258
259 Take vfc-nslcm pod as an example:
260
261 ::
262
263     kubectl -n onap edit deployment dev-vfc-vfc-nslcm
264
265     spec:
266       containers:
267       - env:
268         - name: MSB_ADDR
269           value: msb-iag:80
270         - name: MYSQL_ADDR
271           value: vfc-db:3306
272         image: 172.30.1.66:10001/onap/vfc/nslcm:1.3.7
273         imagePullPolicy: Always
274         #livenessProbe:
275           #failureThreshold: 3
276           #initialDelaySeconds: 120
277           #periodSeconds: 10
278           #successThreshold: 1
279           #tcpSocket:
280             #port: 8806
281           #timeoutSeconds: 1
282         name: vfc-nslcm
283         ports:
284         - containerPort: 8806
285           protocol: TCP
286         #readinessProbe:
287           #failureThreshold: 3
288           #initialDelaySeconds: 10
289           #periodSeconds: 10
290           #successThreshold: 1
291           #tcpSocket:
292             #port: 8806
293           #timeoutSeconds: 1
294                   
295
296 Then you can replace the file into the pod. 
297
298
299 **6 Kubectl basic command**
300 ======================================
301
302 Basic operation of kubernests cluster(Take the namespace of onap in linux client as an example)
303
304 * Check the cluster node
305
306 ::
307             
308     kubectl  get node
309                  
310 * Check cluster namespace
311
312 ::
313                
314     kubectl  get ns
315                 
316 * View the pod information and the pod on which the node is located, under the namespace specified (for example, namespace on onap)
317
318 ::
319                      
320     kubectl get pod -o wide
321                 
322     kubectl get pod -n onap
323                 
324 * Connected to the docker in pod
325
326 ::
327       
328     Check the docker's name , return two dockers' name after execution, -c specifie the docker that needed ti go in.     
329             
330     kubectl -n onap get pod dev-vfc-nslcm-68cb7c9878-v4kt2 -o jsonpath={.spec.containers[*].name}
331                 
332     kubectl -n onap exec -it dev-vfc-nslcm-68cb7c9878-v4kt2 -c vfc-nslcm /bin/bash
333             
334 * Copy files (take the catlog 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
335
336 ::
337     
338     Copy from local to dockers in pod
339
340     kubectl -n onap cp copy_test.sh  dev-vfc-nslcm-68cb7c9878-v4kt2: -c vfc-nslcm
341                 
342     Copy pod's content to local��
343                 
344     kubectl -n onap cp dev-vfc-nslcm-68cb7c9878-v4kt2:copy_test.sh -c vfc-nslcm /tmp/copy_test.sh
345                 
346 * Remote command (to see the current path of the container as an example)
347
348 ::
349     
350     kubectl -n onap exec -it dev-vfc-nslcm-68cb7c9878-v4kt2 -c vfc-nslcm pwd
351                 
352 * View pod basic information and logs (no -c parameter added for single container pod)
353
354 ::
355                 
356     kubectl  -n onap describe  pod dev-vfc-nslcm-68cb7c9878-v4kt2
357                   
358     kubectl -n onap logs dev-vfc-nslcm-68cb7c9878-v4kt2 -c vfc-nslcm
359   
360 * Check the service listener port and manually expose the port, which is commonly used for testing, such as nginx under test namespace
361
362 ::
363                  
364     1>Build namespace
365         
366         kubectl create namespace test
367                   
368     2>create pod with 3 replication
369         
370         kubectl run nginx --image=nginx --replicas=3 -n test
371                   
372     3>Pod exposed ports for nginx (target port, source port target-port)
373                         
374         kubectl expose deployment nginx --port=88 --target-port=80 --type=LoadBalancer -n test
375                   
376         or
377                   
378         kubectl expose deployment nginx --port=88 --target-port=80 --type=NodePort -n test
379
380     4> Check svc(ports that pod exposed , The cluster internally accesses this pod via port 88., external access to the cluster using floatingip+30531)
381                   
382         kubectl get svc -n test
383                   
384         NAME      TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
385         nginx     LoadBalancer   10.43.45.186   10.0.0.3      88:30531/TCP   3m
386                    
387         NAME      TYPE           CLUSTER-IP     EXTERNAL-IP              PORT(S)                    AGE
388         nginx     NodePort       10.43.45.186                               88:30531/TCP   3m
389                    
390                    
391         Nodes within the CLUSTER can be accessed via cluster-ip +88 port
392         Outside the cluster, it is accessible via either EXTERNAL IP or the Floating IP+30531, which is the node name of the pod
393         The floatingip corresponding to the node name can be viewed in the /etc/hosts of the rancher machine or in the documentation
394
395                                
396 * Modify the container image and pod strategy (deployment, statefulset), the completion of modification will trigger the rolling update
397
398 ::
399                   
400     1>To determine whether the pod is a stateful application (efullset) or a stateful application (deployment)
401                     
402         kubectl  -n onap describe  pod dev-vfc-nslcm-68cb7c9878-v4kt2 |grep Controlled
403                     
404     2>Stateless application deployment              
405                     
406         kubectl  -n onap get deploy |grep  nslcm
407                     
408         kubectl -n onap edit deploy  dev-vfc-nslcm-68cb7c9878-v4kt2
409             
410     3>Stateful application statefulset
411                     
412         kubectl  -n onap get statefulset |grep cassandra
413                         
414         kubectl -n onap edit statefulset dev-aai-cassandra                    
415                     
416               
417 * Restart pod(After removing the pod, deployment will recreate a same pod and randomly assign it to any node.)
418
419 ::
420                  
421     kubectl -n onap delete pod dev-vfc-nslcm-68cb7c9878-v4kt2 -c vfc-nslcm
422               
423
424 * View the virtual machine where the portal-app resides in order to add host resolution          
425
426 ::
427       
428     10.0.0.13 corresponding Floating IP is 172.30.3.36
429                     
430     kubectl -n onap get svc  |grep portal-app  
431                     
432     portal-app                 LoadBalancer   10.43.181.163   10.0.0.13     8989:30215/TCP,8403:30213/TCP,8010:30214/TCP,8443:30225/TCP
433                     
434 * pod expansion and shrinkage
435
436 ::
437     
438     pod expansion��kubectl  scale deployment nginx --replicas 3
439
440     pod shrinkage�� kubectl  scale deployment nginx --replicas 1
441     
442