liangke | 01ef914 | 2017-10-12 18:09:15 +0800 | [diff] [blame] | 1 | ================================ |
| 2 | MultiCloud Fake_Cloud User Case |
| 3 | ================================ |
| 4 | |
| 5 | |
| 6 | |
| 7 | multilcoud-vmware server not only provide vio plugin to access real openstack platform,but |
| 8 | also provide fake_cloud plugin which simulate thereal VIO function.The fake |
| 9 | cloud is suitable for testing openstack function if there is not real VIO platform. |
| 10 | |
| 11 | |
| 12 | Make sure you environment have msb,aai service and multicloud-vmware config file has the right msb_ip and |
| 13 | msb_port value,The config file path is vio/vio/pub/config/congfig.py |
| 14 | |
| 15 | |
| 16 | |
| 17 | Register Fake Cloud to AAI |
| 18 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 19 | |
| 20 | Register vio information into AAI service with region name "vmware" and region id "fake" |
| 21 | |
| 22 | .. code-block:: console |
| 23 | |
Ethan Lynn | 42fbfdc | 2017-10-20 13:52:45 +0800 | [diff] [blame] | 24 | $ curl -X PUT -H "X-TransactionId":"get_aai_subr" -H "X-FromAppId":"AAI" -H "Accept":"application/json" \ |
liangke | abfed00 | 2017-10-23 16:24:37 +0800 | [diff] [blame^] | 25 | -H "Content-Type:"application/json" -H "Authorization:Basic QUFJOkFBSQ==" \ |
Ethan Lynn | 42fbfdc | 2017-10-20 13:52:45 +0800 | [diff] [blame] | 26 | https://aai_ip:aai_port/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/vmware/fake \ |
| 27 | -d "{ |
| 28 | "cloud-owner": "vmware", |
liangke | abfed00 | 2017-10-23 16:24:37 +0800 | [diff] [blame^] | 29 | "cloud-region-id": "fake", |
Ethan Lynn | 42fbfdc | 2017-10-20 13:52:45 +0800 | [diff] [blame] | 30 | "cloud-type": "vmware", |
| 31 | "cloud-region-version": "4.0", |
liangke | abfed00 | 2017-10-23 16:24:37 +0800 | [diff] [blame^] | 32 | "identity-url": "http://MSB_IP:MSB_PORT/api/multicloud/v0/vmware_fake/identity/v3", |
| 33 | "cloud-zone": "cloud zone", |
| 34 | "complex-name": "complex name", |
Ethan Lynn | 42fbfdc | 2017-10-20 13:52:45 +0800 | [diff] [blame] | 35 | "esr-system-info-list": { |
| 36 | "esr-system-info": [ |
| 37 | { |
liangke | abfed00 | 2017-10-23 16:24:37 +0800 | [diff] [blame^] | 38 | "system-name": "vmware-fake-cloud", |
Ethan Lynn | 42fbfdc | 2017-10-20 13:52:45 +0800 | [diff] [blame] | 39 | "type": "vim", |
| 40 | "service-url": "http://127.0.0.1:5000/v3", |
| 41 | "user-name": "admin", |
| 42 | "password": "vmware", |
liangke | abfed00 | 2017-10-23 16:24:37 +0800 | [diff] [blame^] | 43 | "system-type": "VIM", |
| 44 | "ssl-insecure": true, |
Ethan Lynn | 42fbfdc | 2017-10-20 13:52:45 +0800 | [diff] [blame] | 45 | "cloud-domain": "default", |
| 46 | "default-tenant": "admin", |
Ethan Lynn | 42fbfdc | 2017-10-20 13:52:45 +0800 | [diff] [blame] | 47 | } |
| 48 | ] |
| 49 | } |
| 50 | }" |
liangke | 01ef914 | 2017-10-12 18:09:15 +0800 | [diff] [blame] | 51 | |
| 52 | |
| 53 | the identity url reprent the fake cloud identity url. |
| 54 | |
| 55 | |
| 56 | |
| 57 | Test Examples |
Ethan Lynn | 42fbfdc | 2017-10-20 13:52:45 +0800 | [diff] [blame] | 58 | ~~~~~~~~~~~~~ |
liangke | 01ef914 | 2017-10-12 18:09:15 +0800 | [diff] [blame] | 59 | |
liangke | abfed00 | 2017-10-23 16:24:37 +0800 | [diff] [blame^] | 60 | the ${fake_identiy_url}= "http://MSB_IP:MSB_PORT/api/multicloud/v0/vmware_fake/identity/v3" |
liangke | 01ef914 | 2017-10-12 18:09:15 +0800 | [diff] [blame] | 61 | the ${msb_address} = "MSB_IP:MSB_PORT" |
| 62 | |
| 63 | Get auth token |
| 64 | -------------- |
| 65 | |
| 66 | # send request to multicloud-framework(broker) service to get token |
| 67 | |
| 68 | .. code-block:: console |
| 69 | |
| 70 | $ curl -X POST -d @test.json -H 'Content-Type:application/json' ${fake_identiy_url} |
| 71 | |
| 72 | test.json content example: |
| 73 | |
| 74 | :: |
| 75 | |
| 76 | { |
liangke | abfed00 | 2017-10-23 16:24:37 +0800 | [diff] [blame^] | 77 | "auth": { |
liangke | 01ef914 | 2017-10-12 18:09:15 +0800 | [diff] [blame] | 78 | "scope": {"project": {"id": “<project-id>”}}, |
| 79 | "identity": |
| 80 | { |
| 81 | "password": {"user": {"domain": {"name": “<doman-name>”}, "password": “<user-password>”, "name": “<user-name>”}}, "methods": ["password"] |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | |
| 87 | Response: |
| 88 | There are a large amounts of data including service endpoint, user information, etc. |
| 89 | For our testing We take nova and identity service endpoint address and auth token which is in response header named “X-Subject-Token”. |
| 90 | |
| 91 | # you can find the endpoint url namespace is "api/multicloiud-vio/v0/vmware_fake", it represent the multicloud-vio service, So |
| 92 | requests sending to mulitcloud-vio will be forwarded to fake cloud.the ip and port reprenst ${msb_address} |
| 93 | |
| 94 | |
| 95 | Identity endpoint: |
| 96 | http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity |
| 97 | |
| 98 | Nova endpoint: |
| 99 | http://$msb_address/api/multicloud-vio/v0/vmware_fake/compute/<user-tenantid> |
| 100 | |
| 101 | |
| 102 | List projects |
| 103 | ------------- |
| 104 | |
| 105 | Use identity’s endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/ |
| 106 | |
| 107 | .. code-block:: console |
| 108 | |
| 109 | $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/projects |
| 110 | |
| 111 | |
| 112 | Get os Hypervisor |
| 113 | ----------------- |
| 114 | |
| 115 | Use nova’s endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<user-tenantid> |
| 116 | |
| 117 | |
| 118 | .. code-block:: console |
| 119 | |
| 120 | $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/os-hypervisors/detail |
| 121 | |
| 122 | |
| 123 | List instance of user’s project |
| 124 | -------------------------------- |
| 125 | |
| 126 | .. code-block:: console |
| 127 | |
| 128 | $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers |
| 129 | |
| 130 | |
| 131 | Show instance detail |
| 132 | -------------------- |
| 133 | |
| 134 | you need to input <server-id> in url path. |
| 135 | |
| 136 | .. code-block:: console |
| 137 | |
| 138 | $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vimid/nova/tenantid/servers/<server-id> |
| 139 | |
| 140 | |
| 141 | Shutdown instance |
| 142 | ----------------- |
| 143 | |
| 144 | you need to input <server-id> in url path |
| 145 | |
| 146 | .. code-block:: console |
| 147 | |
| 148 | $ 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 |
| 149 | |
| 150 | |
| 151 | Start instance |
| 152 | -------------- |
| 153 | |
| 154 | you need to input <server-id> in url path |
| 155 | |
| 156 | .. code-block:: console |
| 157 | |
| 158 | $ 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 |
| 159 | |
| 160 | |
| 161 | Suspend instance |
| 162 | ---------------- |
| 163 | |
| 164 | you need to input <server-id> in url path |
| 165 | |
| 166 | .. code-block:: console |
| 167 | |
| 168 | $ 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 |
| 169 | |
| 170 | |
| 171 | Resume instance |
| 172 | ---------------- |
| 173 | |
| 174 | you need to input <server-id> in url path |
| 175 | |
| 176 | .. code-block:: console |
| 177 | |
| 178 | $ 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 |
| 179 | |
| 180 | |
| 181 | Pause instance |
| 182 | -------------- |
| 183 | |
| 184 | you need to input <server-id> in url path |
| 185 | |
| 186 | .. code-block:: console |
| 187 | |
| 188 | $ 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 |
| 189 | |
| 190 | |
| 191 | Unpasue instance |
| 192 | ---------------- |
| 193 | |
| 194 | you need to input <server-id> in url path |
| 195 | |
| 196 | .. code-block:: console |
| 197 | |
| 198 | $ 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 |
| 199 | |
| 200 | |
| 201 | Reboot instance |
| 202 | --------------- |
| 203 | |
| 204 | you need to input <server-id> in url path |
| 205 | |
| 206 | .. code-block:: console |
| 207 | |
| 208 | $ 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 |
| 209 | |