2 This work is licensed under a Creative Commons Attribution 4.0
6 MultiCloud VMware OpenStack Simulated API User Case
7 ---------------------------------------------------
9 When there's no real VIO environment at hands, we could still use fake_cloud APIs
10 in VIO plugin to test ONAP functions. These set of APIs simulate the real VIO functions
11 to interact with ONAP components.
13 Make sure you environment have msb,aai service and multicloud-vmware config
14 file has the right msb_ip and
15 msb_port value,The config file path is vio/vio/pub/config/congfig.py
19 Register Fake Cloud to AAI
20 ~~~~~~~~~~~~~~~~~~~~~~~~~~
22 Register vio information into AAI service with region name "vmware" and region
25 .. code-block:: console
27 $ curl -X PUT -H "X-TransactionId":"get_aai_subr" -H "X-FromAppId":"AAI" -H "Accept":"application/json" \
28 -H "Content-Type:"application/json" -H "Authorization:Basic QUFJOkFBSQ==" \
29 https://aai_ip:aai_port/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/vmware/fake \
31 "cloud-owner": "vmware",
32 "cloud-region-id": "fake",
33 "cloud-type": "vmware",
34 "cloud-region-version": "4.0",
35 "identity-url": "http://MSB_IP:MSB_PORT/api/multicloud/v0/vmware_fake/identity/v3",
36 "cloud-zone": "cloud zone",
37 "complex-name": "complex name",
38 "esr-system-info-list": {
41 "system-name": "vmware-fake-cloud",
43 "service-url": "http://127.0.0.1:5000/v3",
48 "cloud-domain": "default",
49 "default-tenant": "admin",
55 the identity url reprent the fake cloud identity url.
62 the ${fake_identiy_url}= "http://MSB_IP:MSB_PORT/api/multicloud/v0/vmware_fake/identity/v3"
63 the ${msb_address} = "MSB_IP:MSB_PORT"
68 # send request to multicloud-framework(broker) service to get token of keystone
71 .. code-block:: console
73 $ 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
75 test.json content example:
81 "scope": {"project": {"id": “<project-id>”}},
84 "password": {"user": {"domain": {"name": “<doman-name>”}, "password": “<user-password>”, "name": “<user-name>”}}, "methods": ["password"]
91 There are a large amounts of data including service endpoint, user information,
93 For our testing We take nova and identity service endpoint address and auth
94 token which is in response header named “X-Subject-Token”.
96 # you can find the endpoint url namespace is
97 "api/multicloiud-vio/v0/vmware_fake", it represent the multicloud-vio service,
98 So requests sending to mulitcloud-vio will be forwarded to fake cloud.the ip
99 and port reprenst ${msb_address}
104 http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity
108 http://$msb_address/api/multicloud-vio/v0/vmware_fake/compute/<user-tenantid>
114 Use identity’s endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/
116 .. code-block:: console
118 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/projects
124 Use nova’s endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<user-tenantid>
127 .. code-block:: console
129 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/os-hypervisors/detail
132 List instance of user’s project
133 --------------------------------
135 .. code-block:: console
137 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers
143 you need to input <server-id> in url path.
145 .. code-block:: console
147 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vimid/nova/tenantid/servers/<server-id>
153 you need to input <server-id> in url path
155 .. code-block:: console
157 $ 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
163 you need to input <server-id> in url path
165 .. code-block:: console
167 $ 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
173 you need to input <server-id> in url path
175 .. code-block:: console
177 $ 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
183 you need to input <server-id> in url path
185 .. code-block:: console
187 $ 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
193 you need to input <server-id> in url path
195 .. code-block:: console
197 $ 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
203 you need to input <server-id> in url path
205 .. code-block:: console
207 $ 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
213 you need to input <server-id> in url path
215 .. code-block:: console
217 $ 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
223 .. code-block:: console
225 $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks
231 .. code-block:: console
233 $ curl -X POST -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks/preview \
236 "disable_rollback": true,
240 "stack_name": "teststack",
242 "heat_template_version": "2013-05-23",
243 "description": "Simple template to test heat commands",
246 "default": "m1.tiny",
252 "type": "OS::Nova::Server",
254 "key_name": "heat_key",
256 "get_param": "flavor"
258 "image": "40be8d1a-3eb9-40de-8abd-43237517384f",
259 "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n"
271 .. code-block:: console
273 $ curl -X POST -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks \
276 "disable_rollback": true,
280 "stack_name": "teststack",
282 "heat_template_version": "2013-05-23",
283 "description": "Simple template to test heat commands",
286 "default": "m1.tiny",
292 "type": "OS::Nova::Server",
294 "key_name": "heat_key",
296 "get_param": "flavor"
298 "image": "40be8d1a-3eb9-40de-8abd-43237517384f",
299 "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n"
311 .. code-block:: console
313 $ curl -X DELETE -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/heat/<tenantid>/stacks/<stack_name>/<stack_id>