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