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