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