Update fake_cloud registry and keystone v2.0
[multicloud/framework.git] / docs / MultiCloud-Deployment-Guide.rst
1 ================================
2 ONAP MultiCloud Deployment Guide
3 ================================
4
5 prepare docker environment
6 ~~~~~~~~~~~~~~~~~~~~~~~~~~
7
8 Please refer to onap deployment in kubernetes website(https://wiki.onap.org/display/DW/ONAP+on+Kubernetes)
9 to setup kubernets cluster.
10
11
12 After installing kubectl and helm, execute "kubectl cluster-info" command to verify your kubernets cluster.
13
14 Clone oom project:  git clone http://gerrit.onap.org/r/oom
15 Source the setenv.bash script in /oom/kubernetes/oneclick/, it will set your helm list of components to start/delete
16 Run the one time config pod - which mounts the volume /dockerdata/ contained in the pod config-init.
17
18 .. code-block:: console
19
20   $ cd  oom/kubernetes/config
21   $ cp onap-parameters-sample.yaml onap-parameters.yaml
22   $ ./createConfig.sh -n onap
23
24 wait for "onap" namespace created, pod "config-init" created
25
26 .. code-block:: console
27
28   $ kubectl get namespaces
29   +------------+------------+------+
30   | NAME       |     STATUS |  AGE |
31   +------------+------------+------+
32   |default           Active    10d |
33   |kube-public       Active    10d |
34   |kube-system       Active    10d |
35   |onap              Active    9d  |
36   +------------+------------+------+
37
38 startup containers
39 ~~~~~~~~~~~~~~~~~~
40
41 first run kube2msb container.
42
43 .. code-block:: console
44
45  $ cd oom/kubernetes/oneclick
46  $ ./createAll.bash -n onap -a kube2msb
47
48 run msb container
49
50 .. code-block:: console
51
52   $ ./createAll.bash -n onap -a msb
53
54 run aai container
55
56 .. code-block:: console
57
58   $ ./createAll.bash -n onap -a aai
59
60
61 Finally run multicloud container
62
63 .. code-block:: console
64
65   $ ./createAll.bash -n onap -a multicloud
66
67 get all pods
68
69 .. code-block:: console
70
71   $ kubectl get pods --all-namespaces
72   +---------------+---------------------------------------+--------+-----------+----------+-----+
73   |NAMESPACE      |  NAME                                 | READY  |   STATUS  |RESTARTS  | AGE |
74   +---------------+---------------------------------------+--------+-----------+----------+-----+
75   |kube-system       heapster-4285517626-2k4l1               1/1       Running   1          9d  |
76   |kube-system       kube-dns-2514474280-mxh18               3/3       Running   3          9d  |
77   |kube-system       kubernetes-dashboard-716739405-jl6mk    1/1       Running   1          9d  |
78   |kube-system       monitoring-grafana-3552275057-hrpn5     1/1       Running   1          9d  |
79   |kube-system       monitoring-influxdb-4110454889-t8tpv    1/1       Running   1          9d  |
80   |kube-system       tiller-deploy-737598192-8q523           1/1       Running   1          9d  |
81   |onap-aai          aai-resources-837807428-2t158           1/1       Running   0          2d  |
82   |onap-aai          aai-service-3869033750-1nvg5            1/1       Running   0          2d  |
83   |onap-aai          aai-traversal-50329389-gnsnk            1/1       Running   0          2d  |
84   |onap-aai          data-router-2254557428-zwxx1            1/1       Running   0          2d  |
85   |onap-aai          elasticsearch-622738319-sx6q1           1/1       Running   0          2d  |
86   |onap-aai          gremlin-671060974-npsg5                 1/1       Running   0          2d  |
87   |onap-aai          hbase-3690059193-2pjc5                  1/1       Running   0          2d  |
88   |onap-aai          model-loader-service-849987455-w6vwn    1/1       Running   0          2d  |
89   |onap-aai          search-data-service-4105978183-p1nnj    1/1       Running   0          2d  |
90   |onap-aai          sparky-be-2696729089-mcjbw              1/1       Running   0          2d  |
91   |onap-kube2msb     kube2msb-registrator-1600827891-1s3s4   1/1       Running   3          7d  |
92   |onap-msb          msb-consul-3388279333-hbr16             1/1       Running   0          2d  |
93   |onap-msb          msb-discovery-1109629174-t14q8          1/1       Running   0          2d  |
94   |onap-msb          msb-eag-3969419634-2fdnr                1/1       Running   0          2d  |
95   |onap-msb          msb-iag-1114772402-sjlww                1/1       Running   0          2d  |
96   |onap-multicloud   framework-1225620501-9567n              1/1       Running   0          21h |
97   |onap-multicloud   multicloud-vio-269945856-rl6w6          1/1       Running   0          21h |
98   +---------------+---------------------------------------+--------+-----------+----------+-----+
99
100 get cluster-ip and port
101
102 .. code-block:: console
103
104   $ kubectl get svc --all-namespaces
105   +---------------+----------------------+---------------+-------------+-------------------------------------------------------------------+--------+
106   | NAMESPACE     |      NAME            |  CLUSTER-IP   | EXTERNAL-IP |               PORT(S)                                             |  AGE   |
107   +---------------+----------------------+---------------+-------------+-------------------------------------------------------------------+--------+
108   |default           kubernetes             10.43.0.1       <none>        443/TCP                                                             10d   |
109   |kube-system       heapster               10.43.96.134    <none>        80/TCP                                                              10d   |
110   |kube-system       kube-dns               10.43.0.10      <none>        53/UDP,53/TCP                                                       10d   |
111   |kube-system       kubernetes-dashboard   10.43.9.43      <none>        9090/TCP                                                            10d   |
112   |kube-system       monitoring-grafana     10.43.210.16    <none>        80/TCP                                                              10d   |
113   |kube-system       monitoring-influxdb    10.43.32.60     <none>        8086/TCP                                                            10d   |
114   |kube-system       tiller-deploy          10.43.84.208    <none>        44134/TCP                                                           10d   |
115   |onap-aai          aai-resources          None            <none>        8447/TCP,5005/TCP                                                   2d    |
116   |onap-aai          aai-service            10.43.88.92     <nodes>       8443:30233/TCP,8080:30232/TCP                                       2d    |
117   |onap-aai          aai-traversal          None            <none>        8446/TCP,5005/TCP                                                   2d    |
118   |onap-aai          elasticsearch          None            <none>        9200/TCP                                                            2d    |
119   |onap-aai          gremlin                None            <none>        8182/TCP                                                            2d    |
120   |onap-aai          hbase                  None            <none>        2181/TCP,8080/TCP,8085/TCP,9090/TCP,16000/TCP,16010/TCP,16201/TCP   2d    |
121   |onap-aai          model-loader-service   10.43.172.213   <nodes>       8443:30229/TCP,8080:30210/TCP                                       2d    |
122   |onap-aai          search-data-service    None            <none>        9509/TCP                                                            2d    |
123   |onap-aai          sparky-be              None            <none>        9517/TCP                                                            2d    |
124   |onap-msb          msb-consul             10.43.41.203    <nodes>       8500:30500/TCP                                                      2d    |
125   |onap-msb          msb-discovery          10.43.6.205     <nodes>       10081:30081/TCP                                                     2d    |
126   |onap-msb          msb-eag                10.43.81.104    <nodes>       80:30082/TCP                                                        2d    |
127   |onap-msb          msb-iag                10.43.188.78    <nodes>       80:30080/TCP                                                        2d    |
128   |onap-multicloud   framework              10.43.97.54     <nodes>       9001:30291/TCP                                                      21h   |
129   |onap-multicloud   multicloud-vio         10.43.230.197   <nodes>       9004:30294/TCP                                                      21h   |
130   +---------------+----------------------+---------------+-------------+-------------------------------------------------------------------+--------+
131
132
133 Now msb,aai and multicloud container are online, navigate to http://msb_docker_host_ip:30081/iui/microservices/index.html,
134 you can see  multicloud endpoint have been registered.
135
136 No      Service Name    Version NameSpace       Url     Protocol        Visualrange     Control
137 1       multicloud      v0              /api/multicloud/v0      REST    InSystem
138 2       multicloud-vio  v0              /api/multicloud-vio/v0  REST    InSystem
139
140 Then register vio information into AAI service with region name "vmware" and region id "vio"
141
142 .. code-block:: console
143
144   $ curl -X PUT -H "Authorization: Basic QUFJOkFBSQ==" -H "Content-Type: application/json" -H "X-TransactionId:get_aai_subcr" \
145       https://aai_resource_docker_host_ip:30233/aai/v01/cloud-infrastructure/cloud-regions/cloud-region/vmware/vio \
146       -d "{
147            "cloud-type": "vmware",
148            "cloud-region-version": "4.0",
149            "esr-system-info-list": {
150            "esr-system-info": [
151              {
152               "esr-system-info-id": "123-456",
153               "system-name": "vim-vio",
154               "system-type": "vim",
155               "type": "vim",
156               "user-name": "admin",
157               "password": "vmware",
158               "service-url": "<keystone auth url>",
159               "cloud-domain": "default",
160               "default-tenant": "admin",
161               "ssl-insecure": false
162              }
163            ]
164           }
165         }"
166
167 Test Examples
168 ~~~~~~~~~~~~~
169
170 The env HOST_IP is msb-iag service cluster-ip value is "10.43.188.78"(see it above).
171 The vimid is "vmware_vio"  the registered name in aai.
172
173
174 Get V2 auth token
175 -----------------
176
177 # VIO openstack  support keystone V2 version, vio proxy-plugin will check the request body format, if request body format
178 # is keystone V2 format will access keystone V2  service, if not it will access keystone V3 service.
179 # this example show how to access keystone V2 service.
180 .. code-block:: console
181
182   $ curl -X POST -d @testV2.json  -H 'Content-Type:application/json'  http://$msb_address/api/multicloud/v0/<vimid>/identity/v2.0/tokens
183
184 testV2.json content:
185
186 ::
187
188   {
189         "auth": {
190             "tenantName": "admin",
191             "passwordCredentials": {
192                 "username": "admin",
193                 "password": "vmware"
194             }
195         }
196   }
197
198
199 Response:
200 There are a large amounts of data including service endpoint, user information, etc.
201 For our testing  We  take nova and identity service endpoint address and auth token which is in response header named “X-Subject-Token”.
202
203 # you can find the endpoint url namespace is "api/multicloiud-vio/v0", it represent the multicloud-vio service, So
204 requests sending to mulitcloud-vio will be forwarded to backend  VIO openstack.
205
206
207 Identity endpoint:
208         http://$msb_address/api/multicloud-vio/v0/<vimid>/identity
209
210 Nova endpoint:
211         http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<user-tenantid>
212
213
214 Get V3 auth token
215 -----------------
216
217 # send request to multicloud-framework(broker) service to get token
218
219 .. code-block:: console
220
221   $ curl -X  POST   -d @test.json  -H 'Content-Type:application/json'   http://$msb_address/api/multicloud/v0/<vimid>/identity/v3/auth/tokens
222
223 test.json content example:
224
225 ::
226
227   {
228     "auth": sudo pip install virtualenv{
229       "scope": {"project": {"id": “<project-id>”}},
230       "identity":
231           {
232                 "password": {"user": {"domain": {"name": “<doman-name>”}, "password": “<user-password>”, "name": “<user-name>”}}, "methods": ["password"]
233           }
234     }
235   }
236
237
238 Response:
239 There are a large amounts of data including service endpoint, user information, etc.
240 For our testing  We  take nova and identity service endpoint address and auth token which is in response header named “X-Subject-Token”.
241
242 # you can find the endpoint url namespace is "api/multicloiud-vio/v0", it represent the multicloud-vio service, So
243 requests sending to mulitcloud-vio will be forwarded to backend  VIO openstack.
244
245
246 Identity endpoint:
247         http://$msb_address/api/multicloud-vio/v0/<vimid>/identity
248
249 Nova endpoint:
250         http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<user-tenantid>
251
252
253 List projects
254 -------------
255
256 Use identity’s endpoint:  http://$msb_address/api/multicloud-vio/v0/<vimid>/identity/
257
258 .. code-block:: console
259
260   $ curl -X GET   -H 'X-Auth-Token:<token>'  http://$msb_address/api/multicloud-vio/v0/<vimid>/identity/projects
261
262
263 Get os Hypervisor
264 -----------------
265
266 Use nova’s endpoint:  http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<user-tenantid>
267
268
269 .. code-block:: console
270
271   $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/os-hypervisors/detail
272
273
274 List instance of  user’s project
275 --------------------------------
276
277 .. code-block:: console
278
279   $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/servers
280
281
282 Show instance detail
283 --------------------
284
285 you need to input <server-id> in url path.
286
287 .. code-block:: console
288
289   $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vimid/nova/tenantid/servers/<server-id>
290
291
292 Shutdown instance
293 -----------------
294
295 you need to input <server-id> in url path
296
297 .. code-block:: console
298
299   $ curl -X POST -d '{"os-stop":null}' -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/servers/<server-id>/action
300
301
302 Start instance
303 --------------
304
305 you need to input <server-id> in url path
306
307 .. code-block:: console
308
309   $ curl -X POST -d '{"os-start":null}' -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/servers/<server-id>/action
310
311
312 Suspend instance
313 ----------------
314
315 you need to input <server-id> in url path
316
317 .. code-block:: console
318
319    $ curl -X POST -d '{"suspend":null}' -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/servers/<server-id>/action
320
321
322 Resume  instance
323 ----------------
324
325 you need to input <server-id> in url path
326
327 .. code-block:: console
328
329   $ curl -X POST -d '{"resume":null}' -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json'  http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/servers/<server-id>/action
330
331
332 Pause instance
333 --------------
334
335 you need to input <server-id> in url path
336
337 .. code-block:: console
338
339   $ curl -X POST -d '{"pause":null}' -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/servers/<server-id>/action
340
341
342 Unpasue instance
343 ----------------
344
345 you need to input <server-id> in url path
346
347 .. code-block:: console
348
349   $ curl -X POST -d '{"unpause":null}' -H 'X-Auth-Token:<token> -H 'Content-Type:application/json'  http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/servers/<server-id>/action
350
351
352 Reboot instance
353 ---------------
354
355 you need to input <server-id> in url path
356
357 .. code-block:: console
358
359   $ curl -X POST -d '{"reboot":{"type":"HARD"}}' -H 'X-Auth-Token:<token> -H 'Content-Type:application/json'  http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/servers/<server-id>/action
360
361
362 Upload Image Task
363 -----------------
364
365 create uploading image task by image url:
366
367 .. code-block:: console
368
369    $ curl -X POST -d '{"input": {"image_properties":
370      {"container_format": "bare", "name": "<image_name>"},
371      "import_from_format": "<disk_format>",
372      "import_from": "<image_url>"},
373      "type": "import"}'
374      -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/<vimid>/glance/v2/tasks
375
376 get the taskid from response body,then query the task status by taskid.
377
378 .. code-block:: console
379
380    $ curl -X GET -H 'X-Auth-Token:<token>'  http://$msb_address/api/multicloud-vio/v0/<vimid>/glance/v2/tasks/<taskid>
381
382 You can see the description and properties of task in response body,if 'status' is  success, it will show image_id in
383 result block.
384
385 query the image status by image_id
386
387 .. code-block:: console
388
389   $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/<vimid>/glance/v2/images/<image_id>
390
391
392
393
394
395
396