Update API spec to support multi-tenants
[multicloud/framework.git] / docs / MultiCloud-Test-Guide.rst
1 ..
2  This work is licensed under a Creative Commons Attribution 4.0
3  International License.
4
5 ==========================
6 ONAP MultiCloud Test Guide
7 ==========================
8
9 Test Examples
10 ~~~~~~~~~~~~~
11
12 The env HOST_IP is msb-iag service cluster-ip value is "10.43.188.78"(see it
13 above).
14 The vimid is "vmware_vio"  the registered name in aai.
15
16
17 Get V2 auth token
18 -----------------
19
20 # VIO openstack  support keystone V2 version, vio proxy-plugin will check the
21 request body format, if request body format
22 # is keystone V2 format will access keystone V2  service, if not it will access
23 keystone V3 service.
24 # this example show how to access keystone V2 service.
25
26 .. code-block:: console
27
28   $ curl -X POST -d @testV2.json  -H 'Content-Type:application/json'  http://$msb_address/api/multicloud/v0/<vimid>/identity/v2.0/tokens
29
30 testV2.json content:
31
32 ::
33
34   {
35         "auth": {
36             "tenantName": "admin",
37             "passwordCredentials": {
38                 "username": "admin",
39                 "password": "vmware"
40             }
41         }
42   }
43
44
45 Response:
46 There are a large amounts of data including service endpoint, user information,
47 etc.
48 For our testing  We  take nova and identity service endpoint address and auth
49 token which is in response header named “X-Subject-Token”.
50
51 # you can find the endpoint url namespace is "api/multicloiud-vio/v0", it
52 represent the multicloud-vio service, So
53 requests sending to mulitcloud-vio will be forwarded to backend  VIO openstack.
54
55
56 Identity endpoint::
57
58   http://$msb_address/api/multicloud-vio/v0/<vimid>/identity
59
60 Nova endpoint::
61
62   http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<user-tenantid>
63
64
65 Get V3 auth token
66 -----------------
67
68 # send request to multicloud-framework(broker) service to get token
69
70 .. code-block:: console
71
72   $ curl -X  POST   -d @test.json  -H 'Content-Type:application/json'   http://$msb_address/api/multicloud/v0/<vimid>/identity/v3/auth/tokens
73
74 test.json content example:
75
76 ::
77
78   {
79     "auth": sudo pip install virtualenv{
80       "scope": {"project": {"id": “<project-id>”}},
81       "identity":
82     {
83     "password": {"user": {"domain": {"name": “<doman-name>”}, "password": “<user-password>”, "name": “<user-name>”}}, "methods": ["password"]
84     }
85     }
86   }
87
88
89 Response:
90 There are a large amounts of data including service endpoint, user information,
91 etc.
92 For our testing  We  take nova and identity service endpoint address and auth
93 token which is in response header named “X-Subject-Token”.
94
95 # you can find the endpoint url namespace is "api/multicloiud-vio/v0", it
96 represent the multicloud-vio service, So
97 requests sending to mulitcloud-vio will be forwarded to backend  VIO openstack.
98
99
100 Identity endpoint::
101
102   http://$msb_address/api/multicloud-vio/v0/<vimid>/identity
103
104 Nova endpoint::
105
106   http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<user-tenantid>
107
108
109 List projects
110 -------------
111
112 Use identity’s endpoint:  http://$msb_address/api/multicloud-vio/v0/<vimid>/identity/
113
114 .. code-block:: console
115
116   $ curl -X GET   -H 'X-Auth-Token:<token>'  http://$msb_address/api/multicloud-vio/v0/<vimid>/identity/projects
117
118
119 Get os Hypervisor
120 -----------------
121
122 Use nova’s endpoint:  http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<user-tenantid>
123
124
125 .. code-block:: console
126
127   $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/os-hypervisors/detail
128
129
130 List instance of  user’s project
131 --------------------------------
132
133 .. code-block:: console
134
135   $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/<vimid>/nova/<tenantid>/servers
136
137
138 Show instance detail
139 --------------------
140
141 you need to input <server-id> in url path.
142
143 .. code-block:: console
144
145   $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vimid/nova/tenantid/servers/<server-id>
146
147
148 Shutdown instance
149 -----------------
150
151 you need to input <server-id> in url path
152
153 .. code-block:: console
154
155   $ 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
156
157
158 Start instance
159 --------------
160
161 you need to input <server-id> in url path
162
163 .. code-block:: console
164
165   $ 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
166
167
168 Suspend instance
169 ----------------
170
171 you need to input <server-id> in url path
172
173 .. code-block:: console
174
175    $ 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
176
177
178 Resume  instance
179 ----------------
180
181 you need to input <server-id> in url path
182
183 .. code-block:: console
184
185   $ 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
186
187
188 Pause instance
189 --------------
190
191 you need to input <server-id> in url path
192
193 .. code-block:: console
194
195   $ 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
196
197
198 Unpasue instance
199 ----------------
200
201 you need to input <server-id> in url path
202
203 .. code-block:: console
204
205   $ 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
206
207
208 Reboot instance
209 ---------------
210
211 you need to input <server-id> in url path
212
213 .. code-block:: console
214
215   $ 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
216
217
218 Upload Image Task
219 -----------------
220
221 create uploading image task by image url:
222
223 .. code-block:: console
224
225    $ curl -X POST -d '{"input": {"image_properties":
226      {"container_format": "bare", "name": "<image_name>"},
227      "import_from_format": "<disk_format>",
228      "import_from": "<image_url>"},
229      "type": "import"}'
230      -H 'X-Auth-Token:<token>' -H 'Content-Type:application/json' http://$msb_address/api/multicloud-vio/v0/<vimid>/glance/v2/tasks
231
232 get the taskid from response body,then query the task status by taskid.
233
234 .. code-block:: console
235
236    $ curl -X GET -H 'X-Auth-Token:<token>'  http://$msb_address/api/multicloud-vio/v0/<vimid>/glance/v2/tasks/<taskid>
237
238 You can see the description and properties of task in response body,if 'status'
239 is  success, it will show image_id in result block.
240
241 query the image status by image_id
242
243 .. code-block:: console
244
245   $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/<vimid>/glance/v2/images/<image_id>