blob: 52011a5f08e863b6138f448213b586ff0afd2837 [file] [log] [blame]
Li Xinhui3457d6e2018-04-16 16:51:15 +08001..
2 This work is licensed under a Creative Commons Attribution 4.0
3 International License.
Ethan Lynn2906f882018-01-15 10:32:43 +08004
liangke01ef9142017-10-12 18:09:15 +08005================================
6MultiCloud Fake_Cloud User Case
7================================
8
9
10
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080011multilcoud-vmware server not only provide vio plugin to access real openstack
12platform,but
liangke01ef9142017-10-12 18:09:15 +080013also provide fake_cloud plugin which simulate thereal VIO function.The fake
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080014cloud is suitable for testing openstack function if there is not real VIO
15platform.
liangke01ef9142017-10-12 18:09:15 +080016
17
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080018Make sure you environment have msb,aai service and multicloud-vmware config
19file has the right msb_ip and
liangke01ef9142017-10-12 18:09:15 +080020msb_port value,The config file path is vio/vio/pub/config/congfig.py
21
22
23
24Register Fake Cloud to AAI
25~~~~~~~~~~~~~~~~~~~~~~~~~~
26
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080027Register vio information into AAI service with region name "vmware" and region
28id "fake"
liangke01ef9142017-10-12 18:09:15 +080029
30.. code-block:: console
31
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080032 $ curl -X PUT -H "X-TransactionId":"get_aai_subr" -H "X-FromAppId":"AAI" -H "Accept":"application/json" \
liangkeabfed002017-10-23 16:24:37 +080033 -H "Content-Type:"application/json" -H "Authorization:Basic QUFJOkFBSQ==" \
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080034 https://aai_ip:aai_port/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/vmware/fake \
35 -d "{
36 "cloud-owner": "vmware",
liangkeabfed002017-10-23 16:24:37 +080037 "cloud-region-id": "fake",
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080038 "cloud-type": "vmware",
39 "cloud-region-version": "4.0",
liangkeabfed002017-10-23 16:24:37 +080040 "identity-url": "http://MSB_IP:MSB_PORT/api/multicloud/v0/vmware_fake/identity/v3",
41 "cloud-zone": "cloud zone",
42 "complex-name": "complex name",
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080043 "esr-system-info-list": {
44 "esr-system-info": [
45 {
liangkeabfed002017-10-23 16:24:37 +080046 "system-name": "vmware-fake-cloud",
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080047 "type": "vim",
48 "service-url": "http://127.0.0.1:5000/v3",
49 "user-name": "admin",
50 "password": "vmware",
liangkeabfed002017-10-23 16:24:37 +080051 "system-type": "VIM",
52 "ssl-insecure": true,
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080053 "cloud-domain": "default",
54 "default-tenant": "admin",
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080055 }
56 ]
57 }
58 }"
liangke01ef9142017-10-12 18:09:15 +080059
liangke01ef9142017-10-12 18:09:15 +080060the identity url reprent the fake cloud identity url.
61
62
63
64Test Examples
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080065~~~~~~~~~~~~~
liangke01ef9142017-10-12 18:09:15 +080066
liangkeabfed002017-10-23 16:24:37 +080067the ${fake_identiy_url}= "http://MSB_IP:MSB_PORT/api/multicloud/v0/vmware_fake/identity/v3"
liangke01ef9142017-10-12 18:09:15 +080068the ${msb_address} = "MSB_IP:MSB_PORT"
69
70Get auth token
71--------------
72
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080073# send request to multicloud-framework(broker) service to get token of keystone
74V3
liangke01ef9142017-10-12 18:09:15 +080075
76.. code-block:: console
77
liangke147839b2017-10-23 15:07:39 +080078 $ curl -X POST -d @test.json -H 'Content-Type:application/json' http://MSB_IP:MSB_PORT/api/multicloud/v0/vmware_fake/identity/v3/auth/tokens
liangke01ef9142017-10-12 18:09:15 +080079
80test.json content example:
81
82::
83
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080084 {
liangkeabfed002017-10-23 16:24:37 +080085 "auth": {
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080086 "scope": {"project": {"id": “<project-id>”}},
87 "identity":
88 {
89 "password": {"user": {"domain": {"name": “<doman-name>”}, "password": “<user-password>”, "name": “<user-name>”}}, "methods": ["password"]
90 }
liangke01ef9142017-10-12 18:09:15 +080091 }
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080092 }
liangke01ef9142017-10-12 18:09:15 +080093
94
95Response:
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080096There are a large amounts of data including service endpoint, user information,
97etc.
98For our testing We take nova and identity service endpoint address and auth
99token which is in response header named X-Subject-Token”.
liangke01ef9142017-10-12 18:09:15 +0800100
Ethan Lynnb3e79cc2018-06-05 17:26:55 +0800101# you can find the endpoint url namespace is
102"api/multicloiud-vio/v0/vmware_fake", it represent the multicloud-vio service,
103So requests sending to mulitcloud-vio will be forwarded to fake cloud.the ip
104and port reprenst ${msb_address}
liangke01ef9142017-10-12 18:09:15 +0800105
106
Ethan Lynnb3e79cc2018-06-05 17:26:55 +0800107Identity endpoint::
liangke01ef9142017-10-12 18:09:15 +0800108
Ethan Lynnb3e79cc2018-06-05 17:26:55 +0800109 http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity
110
111Nova endpoint::
112
113 http://$msb_address/api/multicloud-vio/v0/vmware_fake/compute/<user-tenantid>
liangke01ef9142017-10-12 18:09:15 +0800114
115
116List projects
117-------------
118
Ethan Lynnb3e79cc2018-06-05 17:26:55 +0800119Use identitys endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/
liangke01ef9142017-10-12 18:09:15 +0800120
121.. code-block:: console
122
123 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/projects
124
125
126Get os Hypervisor
127-----------------
128
129Use novas endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<user-tenantid>
130
131
132.. code-block:: console
133
134 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/os-hypervisors/detail
135
136
137List instance of users project
138--------------------------------
139
140.. code-block:: console
141
142 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers
143
144
145Show instance detail
146--------------------
147
148you need to input <server-id> in url path.
149
150.. code-block:: console
151
152 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vimid/nova/tenantid/servers/<server-id>
153
154
155Shutdown instance
156-----------------
157
158you need to input <server-id> in url path
159
160.. code-block:: console
161
162 $ curl -X POST -d '{"os-stop":null}' -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers/<server-id>/action
163
164
165Start instance
166--------------
167
168you need to input <server-id> in url path
169
170.. code-block:: console
171
172 $ curl -X POST -d '{"os-start":null}' -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers/<server-id>/action
173
174
175Suspend instance
176----------------
177
178you need to input <server-id> in url path
179
180.. code-block:: console
181
182 $ curl -X POST -d '{"suspend":null}' -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers/<server-id>/action
183
184
185Resume instance
186----------------
187
188you need to input <server-id> in url path
189
190.. code-block:: console
191
192 $ curl -X POST -d '{"resume":null}' -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers/<server-id>/action
193
194
195Pause instance
196--------------
197
198you need to input <server-id> in url path
199
200.. code-block:: console
201
202 $ curl -X POST -d '{"pause":null}' -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers/<server-id>/action
203
204
205Unpasue instance
206----------------
207
208you need to input <server-id> in url path
209
210.. code-block:: console
211
212 $ curl -X POST -d '{"unpause":null}' -H 'X-Auth-Token:<token> -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers/<server-id>/action
213
214
215Reboot instance
216---------------
217
218you need to input <server-id> in url path
219
220.. code-block:: console
221
222 $ curl -X POST -d '{"reboot":{"type":"HARD"}}' -H 'X-Auth-Token:<token> -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers/<server-id>/action
223
liangke147839b2017-10-23 15:07:39 +0800224
225list heat stacks
226----------------
227
228.. code-block:: console
229
230 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks
231
232
233create preview stack
234--------------------
235
236.. code-block:: console
237
238 $ curl -X POST -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks/preview \
239 -d "{
240 "files": {},
241 "disable_rollback": true,
242 "parameters": {
243 "flavor": "m1.heat"
244 },
245 "stack_name": "teststack",
246 "template": {
247 "heat_template_version": "2013-05-23",
248 "description": "Simple template to test heat commands",
249 "parameters": {
250 "flavor": {
251 "default": "m1.tiny",
252 "type": "string"
253 }
254 },
255 "resources": {
256 "hello_world": {
257 "type": "OS::Nova::Server",
258 "properties": {
259 "key_name": "heat_key",
260 "flavor": {
261 "get_param": "flavor"
262 },
263 "image": "40be8d1a-3eb9-40de-8abd-43237517384f",
264 "user_data": "#!/bin/bash -xv\necho \"hello world\" &gt; /root/hello-world.txt\n"
265 }
266 }
267 }
268 },
269 "timeout_mins": 60
270 }"
271
272
273create stack
274-------------
275
276.. code-block:: console
277
278 $ curl -X POST -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks \
279 -d "{
280 "files": {},
281 "disable_rollback": true,
282 "parameters": {
283 "flavor": "m1.heat"
284 },
285 "stack_name": "teststack",
286 "template": {
287 "heat_template_version": "2013-05-23",
288 "description": "Simple template to test heat commands",
289 "parameters": {
290 "flavor": {
291 "default": "m1.tiny",
292 "type": "string"
293 }
294 },
295 "resources": {
296 "hello_world": {
297 "type": "OS::Nova::Server",
298 "properties": {
299 "key_name": "heat_key",
300 "flavor": {
301 "get_param": "flavor"
302 },
303 "image": "40be8d1a-3eb9-40de-8abd-43237517384f",
304 "user_data": "#!/bin/bash -xv\necho \"hello world\" &gt; /root/hello-world.txt\n"
305 }
306 }
307 }
308 },
309 "timeout_mins": 60
310 }"
311
312
313delete stack
314------------
315
316.. code-block:: console
317
318 $ curl -X DELETE -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks/<stack_name>/<stack_id>
319