blob: 58d7a5ab64c93d32cb16834af735b5a38761c470 [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
24$ curl -X PUT -H "X-TransactionId":"get_aai_subr" -H "X-FromAppId":"AAI" -H "Accept":"application/json" \
25 -H "Content-Type:"application/json" \
26 https://aai_ip:aai_port/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/vmware/fake \
27
28 -d "{
29 "cloud-owner": "vmware",
30 "cloud-region-id": "vio",
31 "cloud-type": "vmware",
32 "cloud-region-version": "4.0",
33 "identity-url": "http://MSB_IP:MSB_PORT/api/multicloud-vio/v0/vmware_fake/identity/v3",
34 "sriov-automation": false,
35 "resource-version": "1505892661724",
36 "esr-system-info-list": {
37 "esr-system-info": [
38 {
39 "esr-system-info-id": "62e17285-c207-42b0-9d55-b472b274c254",
40 "system-name": "vim-fake-cloud",
41 "type": "vim",
42 "service-url": "http://127.0.0.1:5000/v3",
43 "user-name": "admin",
44 "password": "vmware",
45 "system-type": "vim",
46 "ssl-insecure": false,
47 "cloud-domain": "default",
48 "default-tenant": "admin",
49 "resource-version": "1505892661819"
50 }
51 ]
52 }
53 }"
54
55
56the identity url reprent the fake cloud identity url.
57
58
59
60Test Examples
61~~~~~~~~~~~~
62
63the ${fake_identiy_url}= "http://MSB_IP:MSB_PORT/api/multicloud-vio/v0/vmware_fake/identity/v3"
64the ${msb_address} = "MSB_IP:MSB_PORT"
65
66Get auth token
67--------------
68
69# send request to multicloud-framework(broker) service to get token
70
71.. code-block:: console
72
73 $ curl -X POST -d @test.json -H 'Content-Type:application/json' ${fake_identiy_url}
74
75test.json content example:
76
77::
78
79 {
80 "auth": sudo pip install virtualenv{
81 "scope": {"project": {"id": “<project-id>”}},
82 "identity":
83 {
84 "password": {"user": {"domain": {"name": “<doman-name>”}, "password": “<user-password>”, "name": “<user-name>”}}, "methods": ["password"]
85 }
86 }
87 }
88
89
90Response:
91There are a large amounts of data including service endpoint, user information, etc.
92For our testing We take nova and identity service endpoint address and auth token which is in response header named X-Subject-Token”.
93
94# you can find the endpoint url namespace is "api/multicloiud-vio/v0/vmware_fake", it represent the multicloud-vio service, So
95requests sending to mulitcloud-vio will be forwarded to fake cloud.the ip and port reprenst ${msb_address}
96
97
98Identity endpoint:
99 http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity
100
101Nova endpoint:
102 http://$msb_address/api/multicloud-vio/v0/vmware_fake/compute/<user-tenantid>
103
104
105List projects
106-------------
107
108Use identitys endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/
109
110.. code-block:: console
111
112 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/projects
113
114
115Get os Hypervisor
116-----------------
117
118Use novas endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<user-tenantid>
119
120
121.. code-block:: console
122
123 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/os-hypervisors/detail
124
125
126List instance of users project
127--------------------------------
128
129.. code-block:: console
130
131 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers
132
133
134Show instance detail
135--------------------
136
137you need to input <server-id> in url path.
138
139.. code-block:: console
140
141 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vimid/nova/tenantid/servers/<server-id>
142
143
144Shutdown instance
145-----------------
146
147you need to input <server-id> in url path
148
149.. code-block:: console
150
151 $ 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
152
153
154Start instance
155--------------
156
157you need to input <server-id> in url path
158
159.. code-block:: console
160
161 $ 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
162
163
164Suspend instance
165----------------
166
167you need to input <server-id> in url path
168
169.. code-block:: console
170
171 $ 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
172
173
174Resume instance
175----------------
176
177you need to input <server-id> in url path
178
179.. code-block:: console
180
181 $ 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
182
183
184Pause instance
185--------------
186
187you need to input <server-id> in url path
188
189.. code-block:: console
190
191 $ 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
192
193
194Unpasue instance
195----------------
196
197you need to input <server-id> in url path
198
199.. code-block:: console
200
201 $ 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
202
203
204Reboot instance
205---------------
206
207you need to input <server-id> in url path
208
209.. code-block:: console
210
211 $ 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
212