blob: ea4148c9d42f8451d92d328ee10d94048919d1de [file] [log] [blame]
liangke01ef9142017-10-12 18:09:15 +08001================================
2MultiCloud Fake_Cloud User Case
3================================
4
5
6
7multilcoud-vmware server not only provide vio plugin to access real openstack platform,but
8also provide fake_cloud plugin which simulate thereal VIO function.The fake
9cloud is suitable for testing openstack function if there is not real VIO platform.
10
11
12Make sure you environment have msb,aai service and multicloud-vmware config file has the right msb_ip and
13msb_port value,The config file path is vio/vio/pub/config/congfig.py
14
15
16
17Register Fake Cloud to AAI
18~~~~~~~~~~~~~~~~~~~~~~~~~~
19
20Register vio information into AAI service with region name "vmware" and region id "fake"
21
22.. code-block:: console
23
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080024 $ curl -X PUT -H "X-TransactionId":"get_aai_subr" -H "X-FromAppId":"AAI" -H "Accept":"application/json" \
liangkeabfed002017-10-23 16:24:37 +080025 -H "Content-Type:"application/json" -H "Authorization:Basic QUFJOkFBSQ==" \
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080026 https://aai_ip:aai_port/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/vmware/fake \
27 -d "{
28 "cloud-owner": "vmware",
liangkeabfed002017-10-23 16:24:37 +080029 "cloud-region-id": "fake",
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080030 "cloud-type": "vmware",
31 "cloud-region-version": "4.0",
liangkeabfed002017-10-23 16:24:37 +080032 "identity-url": "http://MSB_IP:MSB_PORT/api/multicloud/v0/vmware_fake/identity/v3",
33 "cloud-zone": "cloud zone",
34 "complex-name": "complex name",
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080035 "esr-system-info-list": {
36 "esr-system-info": [
37 {
liangkeabfed002017-10-23 16:24:37 +080038 "system-name": "vmware-fake-cloud",
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080039 "type": "vim",
40 "service-url": "http://127.0.0.1:5000/v3",
41 "user-name": "admin",
42 "password": "vmware",
liangkeabfed002017-10-23 16:24:37 +080043 "system-type": "VIM",
44 "ssl-insecure": true,
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080045 "cloud-domain": "default",
46 "default-tenant": "admin",
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080047 }
48 ]
49 }
50 }"
liangke01ef9142017-10-12 18:09:15 +080051
liangke01ef9142017-10-12 18:09:15 +080052the identity url reprent the fake cloud identity url.
53
54
55
56Test Examples
Ethan Lynn42fbfdc2017-10-20 13:52:45 +080057~~~~~~~~~~~~~
liangke01ef9142017-10-12 18:09:15 +080058
liangkeabfed002017-10-23 16:24:37 +080059the ${fake_identiy_url}= "http://MSB_IP:MSB_PORT/api/multicloud/v0/vmware_fake/identity/v3"
liangke01ef9142017-10-12 18:09:15 +080060the ${msb_address} = "MSB_IP:MSB_PORT"
61
62Get auth token
63--------------
64
liangke147839b2017-10-23 15:07:39 +080065# send request to multicloud-framework(broker) service to get token of keystone V3
liangke01ef9142017-10-12 18:09:15 +080066
67.. code-block:: console
68
liangke147839b2017-10-23 15:07:39 +080069 $ 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 +080070
71test.json content example:
72
73::
74
75 {
liangkeabfed002017-10-23 16:24:37 +080076 "auth": {
liangke01ef9142017-10-12 18:09:15 +080077 "scope": {"project": {"id": “<project-id>”}},
78 "identity":
79 {
80 "password": {"user": {"domain": {"name": “<doman-name>”}, "password": “<user-password>”, "name": “<user-name>”}}, "methods": ["password"]
81 }
82 }
83 }
84
85
86Response:
87There are a large amounts of data including service endpoint, user information, etc.
88For our testing We take nova and identity service endpoint address and auth token which is in response header named X-Subject-Token”.
89
90# you can find the endpoint url namespace is "api/multicloiud-vio/v0/vmware_fake", it represent the multicloud-vio service, So
91requests sending to mulitcloud-vio will be forwarded to fake cloud.the ip and port reprenst ${msb_address}
92
93
94Identity endpoint:
95 http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity
96
97Nova endpoint:
98 http://$msb_address/api/multicloud-vio/v0/vmware_fake/compute/<user-tenantid>
99
100
101List projects
102-------------
103
104Use identitys endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/
105
106.. code-block:: console
107
108 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/projects
109
110
111Get os Hypervisor
112-----------------
113
114Use novas endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<user-tenantid>
115
116
117.. code-block:: console
118
119 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/os-hypervisors/detail
120
121
122List instance of users project
123--------------------------------
124
125.. code-block:: console
126
127 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers
128
129
130Show instance detail
131--------------------
132
133you need to input <server-id> in url path.
134
135.. code-block:: console
136
137 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vimid/nova/tenantid/servers/<server-id>
138
139
140Shutdown instance
141-----------------
142
143you need to input <server-id> in url path
144
145.. code-block:: console
146
147 $ 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
148
149
150Start instance
151--------------
152
153you need to input <server-id> in url path
154
155.. code-block:: console
156
157 $ 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
158
159
160Suspend instance
161----------------
162
163you need to input <server-id> in url path
164
165.. code-block:: console
166
167 $ 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
168
169
170Resume instance
171----------------
172
173you need to input <server-id> in url path
174
175.. code-block:: console
176
177 $ 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
178
179
180Pause instance
181--------------
182
183you need to input <server-id> in url path
184
185.. code-block:: console
186
187 $ 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
188
189
190Unpasue instance
191----------------
192
193you need to input <server-id> in url path
194
195.. code-block:: console
196
197 $ 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
198
199
200Reboot instance
201---------------
202
203you need to input <server-id> in url path
204
205.. code-block:: console
206
207 $ 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
208
liangke147839b2017-10-23 15:07:39 +0800209
210list heat stacks
211----------------
212
213.. code-block:: console
214
215 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks
216
217
218create preview stack
219--------------------
220
221.. code-block:: console
222
223 $ curl -X POST -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks/preview \
224 -d "{
225 "files": {},
226 "disable_rollback": true,
227 "parameters": {
228 "flavor": "m1.heat"
229 },
230 "stack_name": "teststack",
231 "template": {
232 "heat_template_version": "2013-05-23",
233 "description": "Simple template to test heat commands",
234 "parameters": {
235 "flavor": {
236 "default": "m1.tiny",
237 "type": "string"
238 }
239 },
240 "resources": {
241 "hello_world": {
242 "type": "OS::Nova::Server",
243 "properties": {
244 "key_name": "heat_key",
245 "flavor": {
246 "get_param": "flavor"
247 },
248 "image": "40be8d1a-3eb9-40de-8abd-43237517384f",
249 "user_data": "#!/bin/bash -xv\necho \"hello world\" &gt; /root/hello-world.txt\n"
250 }
251 }
252 }
253 },
254 "timeout_mins": 60
255 }"
256
257
258create stack
259-------------
260
261.. code-block:: console
262
263 $ curl -X POST -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks \
264 -d "{
265 "files": {},
266 "disable_rollback": true,
267 "parameters": {
268 "flavor": "m1.heat"
269 },
270 "stack_name": "teststack",
271 "template": {
272 "heat_template_version": "2013-05-23",
273 "description": "Simple template to test heat commands",
274 "parameters": {
275 "flavor": {
276 "default": "m1.tiny",
277 "type": "string"
278 }
279 },
280 "resources": {
281 "hello_world": {
282 "type": "OS::Nova::Server",
283 "properties": {
284 "key_name": "heat_key",
285 "flavor": {
286 "get_param": "flavor"
287 },
288 "image": "40be8d1a-3eb9-40de-8abd-43237517384f",
289 "user_data": "#!/bin/bash -xv\necho \"hello world\" &gt; /root/hello-world.txt\n"
290 }
291 }
292 }
293 },
294 "timeout_mins": 60
295 }"
296
297
298delete stack
299------------
300
301.. code-block:: console
302
303 $ curl -X DELETE -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks/<stack_name>/<stack_id>
304