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