12c40a195dcaa3a1c32e34549573dddbf2ccc2ba
[vfc/nfvo/lcm.git] / docs / platform / installation / user-guide / ns-instantiate-guide.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3
4 NS LCM Guide Using VF-C
5 -----------------------
6
7 VF-C supports vCPE use case in R3, all VNFs are deployed through VF-C GVNFM .
8 This page describes how to use VF-C to instantiate NS
9
10 Before you try, please prepare two csar file: 
11
12 * VNF csar
13 * NS csar
14
15 If you don't have any csar, you can download the simple csar from https://wiki.onap.org/display/DW/VF-C+User+Guide 
16
17
18 Environment
19 +++++++++++
20 VF-C components can run as docker, docker service should be installed before install VF-C components.
21
22 The following scripts show the docker service install commands in centos7.
23
24 ::
25
26   yum install docker
27   systemctl enable docker.service
28   systemctl start docker.service
29
30 Steps
31 +++++
32
33
34
35 If you want to  try VF-C,  the small project set should include: VF-C , Multicloud, MSB, A&AI.
36
37 VF-C components need to register to MSB when starting, so MSB components should be installed first,you can refer the following link to install MSB.
38
39 http://onap.readthedocs.io/en/latest/submodules/msb/apigateway.git/docs/platform/installation.html
40
41 Note: In the following steps, we use ${MSB_IP} as the IP of msb_apigateway component.
42
43 1. Install vfc-nfvo-db component
44
45 ::
46
47   docker run -d -p 3306:3306 -p 6379:6379 --name vfc-db -v /var/lib/mysql nexus3.onap.org:10001/onap/vfc/db
48   we use  ${VFC_DB_IP} as the IP of vfc-db component.
49
50 2. Install vfc-nfvo-lcm component.
51
52 ::
53
54   docker run -d -p 8403:8403 --name vfc-nslcm -e MSB_ADDR=${MSB_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306
55   nexus3.onap.org:10001/onap/vfc/nslcm
56
57 3. Install vfc-nfvo-catalog component.
58
59 ::
60
61   docker run -d -p 8806:8806 --name vfc-catalog -e MSB_ADDR=${MSB_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/vfc/catalog
62
63 4. Install vfc-nfvo-gvnfmdriver component.
64
65 ::
66
67   docker run -d -p 8484:8484 --name vfc-gvnfmdriver -e MSB_ADDR=${MSB_IP}:80 nexus3.onap.org:10001/onap/vfc/gvnfmdriver
68
69 5. Install vfc-gvnfm-vnflcm component.
70
71 ::
72
73   docker run -d -p 8801:8801 --name vfc-vnflcm -e MSB_ADDR=${MSB_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/vfc/vnflcm
74
75
76 ESR Registration
77 ++++++++++++++++
78
79
80 Before we instantiate a service, we need to register vim and vnfm which is used to deploy vnfs.
81
82   1.VIM Registration
83
84   |image1|
85
86   .. |image1| image:: vim.png
87    :width: 1000px
88    :height: 600px
89
90
91   2. GVNFM Registration
92
93   For VF-C, because we use GVNFM to deploy vnfs , so you can register GVNFM in esr gui as follows:
94
95   |image2|
96
97   .. |image2| image:: gvnfm.png
98    :width: 1000px
99    :height: 600px
100
101
102 Note: 
103   a. type should be gvnfmdriver which is the same with gvnfmdriver microservice.
104   b. url is the msb-iag NodeIp:port.
105   c. vim corresponds to cloudowner_cloudregionid which registered in step1.
106
107 Package Onboarding
108 ++++++++++++++++++
109
110
111 VF-C R3 support VNF/PNF/NS csar package upload from local csar file. VNF/PNF csar package should be uploaded first, then NS csar package can be uploaded.
112 Before onboarding a package,  should create one record first. 
113
114
115 1. Create VNF package record  in catalog DB
116
117 ::
118
119   curl -X POST \
120
121   http://172.30.3.104:30280/api/vnfpkgm/v1/vnf_packages \
122
123   -H 'Postman-Token: f9c45dea-b7bb-4acd-89e1-b9b1c3d70d8a' \
124   -H 'accept: application/json' \
125   -H 'cache-control: no-cache' \
126   -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
127   -F 'userDefinedData= "key2": "value2"'
128
129 Note:  
130   a. 172.30.3.104:30280 is the node IP and exposed port where the msb-iag pod is located. 
131   b. userDefinedData is the key value pair which defined for the vnf package we created
132
133 2. Upload VNF package to VF-C catalog
134
135 ::
136
137   curl -X PUT \
138   http://172.30.3.104:30280/api/vnfpkgm/v1/vnf_packages/38037a12-a0d4-4aa4-ac50-cd6b05ce0b24/package_content \
139   -H 'Postman-Token: 88ada218-86fd-4cd7-a06e-cc462f5df651' \
140   -H 'cache-control: no-cache'
141   -H 'accept: application/json' \
142   -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
143   -F 'file=@C:\ONAP\Integration\R3\vCPE\vnf-vsn.csar'
144
145 Note:
146   a. 38037a12-a0d4-4aa4-ac50-cd6b05ce0b24 is the vnf_pkg_id which we get from the first step.
147   b. -F is used to specify the local vnf package file
148
149 3. Create NS package record in catalog DB
150
151 ::
152
153   curl -X POST \
154
155   http://172.30.3.104:30280/api/nsd/v1/ns_descriptors \
156   -H 'Postman-Token: 71b11910-1708-471c-84bb-5b0dd8d214a2' \
157   -H 'accept: application/json' \
158   -H 'cache-control: no-cache' \
159   -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
160   -F 'userDefinedData= "key1": "value1"'
161
162 Note:
163   a. userDefinedData is the key value pair which defined for the ns package we created
164
165 4. Upload NS package to VF-C catalog
166
167 ::
168
169   curl -X PUT \
170   http://172.30.3.104:30280/api/nsd/v1/ns_descriptors/79ca81ec-10e0-44e4-bc85-ba968f345711/nsd_content \
171   -H 'Postman-Token: f16e4a54-a514-4878-b307-9b80c630166e' \
172   -H 'cache-control: no-cache'
173   -H 'accept: application/json' \
174   -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
175   -F 'file=@C:\ONAP\Integration\R3\vCPE\ns.csar'
176
177 Note:
178   a.  -F is used to specify the local ns package file
179
180
181 NS Life Cycle Management
182 ++++++++++++++++++++++++
183
184
185 Currently VF-C GVNFM support NS create/Instantiate/terminate/delete/heal.
186
187 VF-C R3 healing only suport restart a vm of an VNF. 
188
189 1. NS Create 
190
191 ::
192
193   curl -X POST \
194   http://172.30.3.104:30280/api/nslcm/v1/ns \
195   -H 'Postman-Token: 27e2c576-2d9b-4753-a6b0-6262a4a7ec86' \
196   -H 'accept: application/json' \
197   -H 'cache-control: no-cache' \
198   -H 'content-type: application/json' \
199   -d '{
200        "context": {
201                 "globalCustomerId": "global-customer-id-test1",
202                 "serviceType": "service-type-test1"
203         },
204         "csarId": "79ca81ec-10e0-44e4-bc85-ba968f345711",
205         "nsName": "ns_vsn",
206         "description": "description"
207         }'
208
209 Note:
210   a. globalCustomerId  and serviceType is defined in A&AI.
211   b. csar Id is the NS package id  which is consistent with the catalog ns package id.
212   c. nsName is the NS name 
213
214 2. NS Instantiate
215
216 ::
217
218    curl -X POST \
219   http://172.30.3.104:30280/api/nslcm/v1/ns/f0b4c09f-c653-438a-b091-5218b0f806ec/instantiate \
220   -H 'Postman-Token: 2a9542b2-3364-4a40-8513-45e10b8ca2ce' \
221   -H 'accept: application/json' \
222   -H 'cache-control: no-cache' \
223   -H 'content-type: application/json' \
224     -d '{
225          "additionalParamForNs": {
226                 "sdnControllerId": "2"
227          },
228          "locationConstraints": [{
229                 "vnfProfileId": "45711f40-3f43-415b-bb45-46e5c6940735",
230                 "locationConstraints": {
231                       "vimId": "CPE-DC_RegionOne"
232                 }
233                 }]
234          }'
235
236 Note:
237   a.  f0b4c09f-c653-438a-b091-5218b0f806ec is the ns instance id which create in step 1 : NS create.
238   b.  locationConstraints  is an array which contains all the vnfs included under NS locationConstraints is used to define the VIM( cloudOwner_cloudRegionId)  that the VNF will be deployed vnfProfileId is the vnf descriptor id which defined in NS template  under  node_templates . 
239
240
241  |image3|
242
243   .. |image3| image:: image2018-12-10_12-1-36.png
244    :width: 5.97047in
245    :height: 2.63208in
246
247   c.   before instantiate, you should create one volumntype which called root.
248
249 3. NS Heal
250
251 ::
252
253   curl -X PUT \
254    http://172.30.3.104:30280/api/nslcm/v1/ns/f0b4c09f-c653-438a-b091-5218b0f806ec/heal \
255   -H 'Content-Type: application/json' \
256   -H 'Postman-Token: f18754b8-ed68-43b0-ae55-b8b8780e5c6a' \
257   -H 'accept: application/json' \
258   -H 'cache-control: no-cache' \
259   -d '{   "vnfInstanceId": "044b705c-e44d-4733-ab64-987f46d9b567", 
260                     "cause": "restartvm",  
261                     "additionalParams": {    
262                                                         "action": "restartvm",  
263                                                          "actionvminfo": {   
264                                                          "vmid": "1623cd25-ae6f-4880-8132-15914367e47b",
265                                                          "vduid": "",    
266                                                           "vmname": "1623cd25-ae6f-4880-8132-15914367e47b"  
267         }}  
268         }'
269
270 Note:
271   a.  f0b4c09f-c653-438a-b091-5218b0f806ec  is the ns instance id which create in step 1 : NS create.
272   b.   "vnfInstanceId": "044b705c-e44d-4733-ab64-987f46d9b567" is the VNF instanceId, we can get this from A&AI or VF-C DB.
273   c.  action only support restartvm  in Casablanca release.
274   d.  actionvminfo only supports to include one vm , vmid is the vmid which is the same with the vmid in cloud. 
275
276 4. NS Terminate
277
278 ::
279
280   curl -X POST \
281   http://172.30.3.104:30280/api/nslcm/v1/ns/f0b4c09f-c653-438a-b091-5218b0f806ec/terminate \
282   -H 'Postman-Token: 5190e46f-f612-432a-90d8-161ea67778b2' \
283   -H 'accept: application/json' \
284   -H 'cache-control: no-cache' \
285   -H 'content-type: application/json' \
286   -d 'gracefulTerminationTimeout: 600,
287   \terminationType: FORCEFUL'
288
289 Note:
290   a.  f0b4c09f-c653-438a-b091-5218b0f806ec  is the ns instance id which create in step 1 : NS create.
291   b.  terminateType supports FORCEFUL and GRACEFULLc.  gracefulTerminationTimeout is the wait time before execute terminate.
292
293 5. NS delete
294
295 ::
296
297   curl -X DELETE \
298   http://172.30.3.104:30280/api/nslcm/v1/ns/f0b4c09f-c653-438a-b091-5218b0f806ec \
299   -H 'Postman-Token: 62b35de6-1785-40ed-8026-06d73f9770d8' \
300   -H 'cache-control: no-cache'
301
302 Note:
303   a.  f0b4c09f-c653-438a-b091-5218b0f806ec is the ns instance id which create in step 1 : NS create