Update git submodules
[doc.git] / docs / guides / onap-user / cloud_site / openstack / index.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2 .. International License.  http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2017 AT&T Intellectual Property.  All rights reserved.
4
5
6 Adding a new Openstack Cloud Site to ONAP
7 =========================================
8
9 The following guide describe how to configure ONAP to be able to instantiate
10 a service in a new cloud site based on Openstack.
11
12 There are 2 methods for ONAP to communicate with Openstack in order
13 to instantiate a service:
14
15 method 1 : ONAP SO => Openstack
16 method 2 : ONAP SO => ONAP MultiCloud => Openstack
17
18 In this guideline the following parameter/value will be used
19
20 * Complex Name: My_Complex
21 * Region Name: INTEGRATION_CENTER
22 * Cloud Owner: MyCompanyName
23
24
25 Method 1 : without ONAP MultiCloud
26 ----------------------------------
27
28 TO BE DESCRIBED
29
30
31
32 Method 2 : using ONAP MultiCloud
33 --------------------------------
34
35
36 STEP 1 : declare Cloud Site in ONAP SO to interact with ONAP multiCloud
37 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38
39 The MariaDB database of ONAP SO needs to be modified.
40
41 In the ONAP SO, the use of ONAP Multicloud for that Cloud Site need
42 to be indicated.
43
44 ONAP SO will communicate with ONAP MultiCloud like if MultiCloud would be
45 an Openstack system.
46
47
48 Connect to ONAP SO pod
49
50 In a Unix Terminal, to get the SO pods id that is providing
51 the MariaDB database:
52
53 ::
54
55   kubectl -n onap get pod | grep mariadb-galera
56
57 To connect to that SO pod
58 (in this example, the SO pod id is "onap-mariadb-galera-mariadb-galera-0"):
59
60 ::
61
62   kubectl -n onap exec -ti onap-mariadb-galera-mariadb-galera-0 sh
63
64 Then modify the data in the MariaDB:
65
66
67 A "mso_id" and "mso_pass" are required even if, with multicloud,
68 only credentials managed by ESR will be used.
69
70 Nevertheless, you need to provide a correct encrypted value for the pass value.
71
72 "MyCompanyName" is a cloud owner value. WARNING : do not use underscore
73 in the value.
74
75 "INTEGRATION_CENTER" is the region name
76
77 ::
78
79   mysql --user=so_admin --password=so_Admin123
80   USE catalogdb
81   INSERT INTO identity_services VALUES('MC_KEYSTONE', 'http://msb-iag.onap:80/api/multicloud/v1/MyCompanyName_INTEGRATION_CENTER/identity/v2.0', 'admin', '5b6f369745f5f0e1c61da7f0656f3daf93c8030a2ea94b7964c67abdcfb49bdf2fa2266344b4caaca1eba8264d277831', 'service', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'lastUser', '2019-07-05 10:32:00', '2019-07-05 10:32:00');
82   INSERT INTO cloud_sites VALUES('INTEGRATION_CENTER', 'INTEGRATION_CENTER', 'MC_KEYSTONE', 2.5, 'INTEGRATION_CENTER', NULL, NULL, NULL, 'MySelf', '2019-07-05 10:32:00', '2019-07-05 10:32:00');
83
84
85 You need then to change the ONAP SO VNF Adapter Rest API endpoint version:
86
87 in a unix terminal:
88
89 to find the right config map name:
90
91 ::
92
93   kubectl -n onap get configmap | grep so-so-bpmn-infra-app-configmap
94
95
96 to edit and change the configmap:
97
98 ::
99
100   kubectl -n onap edit configmap onap-so-so-bpmn-infra-app-configmap
101
102 in the section "vnf", modify the rest endpoint:
103
104 ::
105
106            vnf:
107              endpoint: http://so-openstack-adapter.onap:8087/services/VnfAdapter
108              rest:
109   -            endpoint: http://so-openstack-adapter.onap:8087/services/rest/v1/vnfs
110   +            endpoint: http://so-openstack-adapter.onap:8087/services/rest/v2/vnfs
111            volume-groups:
112              rest:
113                endpoint: http://so-openstack-adapter.onapg:8087/services/rest/v1/volume-groups
114
115
116 Having modified the configmap, it is necessary to delete the pod in order
117 it takes the modification into account.
118
119 to find the right pod name:
120
121 ::
122
123   kubectl -n onap get po | grep so-so
124
125
126 You need to find the pod that is similar to the following pod id:
127
128 "onap-so-so-6b9f64b887-jgrdp"
129
130
131 to delete the pod:
132
133 ::
134
135   kubectl -n onap delete onap-so-so-6b9f64b887-jgrdp
136
137
138 Then, wait for the pod to restart. To check:
139
140 ::
141
142   kubectl -n onap get po | grep so-so
143
144
145
146
147 STEP 2 : declare the new cloud Site in ONAP AAI
148 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
149
150
151 declare a Complex in ONAP AAI
152
153
154 A Cloud Site is located in a Building called "Complex" object
155 in ONAP AAI datamodel.
156
157 AAI REST API is used to declare the complex object.
158
159 Here is an example using "curl" tool to send the API request.
160
161 The new Complex is named "My_Complex" in this example.
162
163
164 ::
165
166   curl -X PUT \
167   https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/complexes/complex/My_Complex \
168   -H 'Accept: application/json' \
169   -H 'Authorization: Basic QUFJOkFBSQ==' \
170   -H 'Cache-Control: no-cache' \
171   -H 'Content-Type: application/json' \
172   -H 'Real-Time: true' \
173   -H 'X-FromAppId: jimmy-postman' \
174   -H 'X-TransactionId: 9999' \
175   -d '{
176     "physical-location-id": "My_Complex",
177     "data-center-code": "example-data-center-code-val-5556",
178     "complex-name": "My_Complex",
179     "identity-url": "example-identity-url-val-56898",
180     "physical-location-type": "example-physical-location-type-val-7608",
181     "street1": "example-street1-val-34205",
182     "street2": "example-street2-val-99210",
183     "city": "Beijing",
184     "state": "example-state-val-59487",
185     "postal-code": "100000",
186     "country": "example-country-val-94173",
187     "region": "example-region-val-13893",
188     "latitude": "39.9042",
189     "longitude": "106.4074",
190     "elevation": "example-elevation-val-30253",
191     "lata": "example-lata-val-46073"
192     }' -k
193
194
195 Check the Complexes in ONAP AAI:
196
197 ::
198
199   curl -X GET \
200     https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/complexes \
201     -H 'Accept: application/json' \
202     -H 'Authorization: Basic QUFJOkFBSQ==' \
203     -H 'X-FromAppId: AAI' \
204     -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
205     -H 'cache-control: no-cache' -k
206
207
208
209
210 declare a Cloud Site in ONAP AAI
211
212
213 To declare a Cloud Site, you need to use the AAI REST API.
214
215 The new Cloud site is named "INTEGRATION_CENTER" in this example.
216
217 There is also a "Cloud Owner" notion in ONAP AAI datamodel.
218
219 The new Cloud Owner is named "MyCompanyName" in this example.
220
221 In Openstack, there is also a "region" notion. You need to get the value of
222 the region that has been set when deploying your openstack platform
223
224 In the following example the openstack region has the value "RegionOne"
225 (in the parameter "cloud-extra-info")
226
227 parameter "complex-name" relate to the Complex you previously declared.
228
229 parameter "cloud-type" take the value "openstack"
230
231 parameter "cloud-region-version" is refering to your openstack version
232
233 parameter "cloud-extra-info" will contain the Openstack "region".
234 Here, the region ID of the deployed openstack cloud site will be set.
235
236 In the following example the openstack region has the value "RegionOne".
237
238 parameter "esr-system-info-list" will contain the list of openstack platform
239 credentials that will allow ONAP MultiCloud to communicate with the Cloud Site.
240
241
242 ::
243
244   curl -X PUT \
245   https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/MyCompanyName/INTEGRATION_CENTER \
246   -H 'Accept: application/json' \
247   -H 'Authorization: Basic QUFJOkFBSQ==' \
248   -H 'Cache-Control: no-cache' \
249   -H 'Content-Type: application/json' \
250   -H 'Postman-Token: 8b9b95ae-91d6-4436-90fa-69cb4d2db99c' \
251   -H 'Real-Time: true' \
252   -H 'X-FromAppId: jimmy-postman' \
253   -H 'X-TransactionId: 9999' \
254   -d '{
255       "cloud-owner": "MyCompanyName",
256       "cloud-region-id": "INTEGRATION_CENTER",
257       "cloud-type": "openstack",
258       "owner-defined-type": "N/A",
259       "cloud-region-version": "pike",
260       "complex-name": "My_Complex",
261       "cloud-zone": "CloudZone",
262       "sriov-automation": false,
263       "identity-url": "WillBeUpdatedByMultiCloud",
264       "cloud-extra-info":"{\"openstack-region-id\":\"RegionOne\"}"
265       "esr-system-info-list": {
266           "esr-system-info": [
267               {
268               "esr-system-info-id": "<random UUID, e.g. 5c85ce1f-aa78-4ebf-8d6f-4b62773e9bde>",
269               "service-url": "http://<your openstack keystone endpoint, e.g. http://10.12.25.2:5000/v3>",
270               "user-name": "<your openstack user>",
271               "password": "<your openstack password>",
272               "system-type": "VIM",
273               "ssl-insecure": true,
274               "cloud-domain": "Default",
275               "default-tenant": "<your openstack project name>",
276               "system-status": "active"
277               }
278           ]
279         }
280       }' -k
281
282
283 Associate Cloud site to a Complex in ONAP AAI:
284
285
286 ::
287
288   curl -X PUT \
289     https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/MyCompanyName/INTEGRATION_CENTER/relationship-list/relationship \
290     -H 'Accept: application/json' \
291     -H 'Authorization: Basic QUFJOkFBSQ==' \
292     -H 'Content-Type: application/json' \
293     -H 'X-FromAppId: AAI' \
294     -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
295     -H 'cache-control: no-cache' \
296     -d '{
297       "related-to": "complex",
298       "related-link": "/aai/v16/cloud-infrastructure/complexes/complex/My_Complex",
299       "relationship-data": [
300           {
301           "relationship-key": "complex.physical-location-id",
302           "relationship-value": "My_Complex"
303           }
304           ]
305       }' -k
306
307
308 Check the Cloud Site creation in ONAP AAI:
309
310 ::
311
312   curl -X GET \
313     https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/cloud-regions \
314     -H 'Accept: application/json' \
315     -H 'Authorization: Basic QUFJOkFBSQ==' \
316     -H 'X-FromAppId: AAI' \
317     -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
318     -H 'cache-control: no-cache' -k
319
320
321 Associate an Availability zone to a Cloud site in ONAP AAI:
322
323 ::
324
325   curl -X PUT \
326     https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/MyCompanyName/INTEGRATION_CENTER/availability-zones/availability-zone/brittany \
327     -H 'Accept: application/json' \
328     -H 'Authorization: Basic QUFJOkFBSQ==' \
329     -H 'Content-Type: application/json' \
330     -H 'X-FromAppId: AAI' \
331     -H 'X-TransactionId: get_aai_subscr' \
332     -H 'cache-control: no-cache' \
333     -d '{
334       "availability-zone-name": "brittany",
335       "hypervisor-type": "KVM"
336   }'
337
338
339 Check the operation:
340
341 ::
342
343   curl -X GET \
344     https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/MyCompanyName/INTEGRATION_CENTER/availability-zones \
345     -H 'Accept: application/json' \
346     -H 'Authorization: Basic QUFJOkFBSQ==' \
347     -H 'Content-Type: application/json' \
348     -H 'X-FromAppId: AAI' \
349     -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
350     -H 'cache-control: no-cache'
351
352
353
354 STEP 3 : Register the Cloud Site in ONAP Multicloud
355 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
356
357 ::
358
359   curl -X POST \
360   http://msb.api.discovery.simpledemo.onap.org:30280/api/multicloud/v1/MyCompanyName_INTEGRATION_CENTER/registry \
361   -H 'Accept: application/json' \
362   -H 'Cache-Control: no-cache' \
363   -H 'Content-Type: application/json' \
364
365
366 check registration:
367
368 ::
369
370   curl -X GET \
371   https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/MyCompanyName/INTEGRATION_CENTER?depth=all \
372   -H 'Accept: application/json' \
373   -H 'Authorization: Basic QUFJOkFBSQ==' \
374   -H 'Cache-Control: no-cache' \
375   -H 'Content-Type: application/json' \
376   -H 'Real-Time: true' \
377   -H 'X-FromAppId: jimmy-postman' \
378   -H 'X-TransactionId: 9999' -k