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" \ |
| 25 | -H "Content-Type:"application/json" \ |
| 26 | https://aai_ip:aai_port/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/vmware/fake \ |
| 27 | -d "{ |
| 28 | "cloud-owner": "vmware", |
| 29 | "cloud-region-id": "vio", |
| 30 | "cloud-type": "vmware", |
| 31 | "cloud-region-version": "4.0", |
| 32 | "identity-url": "http://MSB_IP:MSB_PORT/api/multicloud-vio/v0/vmware_fake/identity/v3", |
| 33 | "sriov-automation": false, |
| 34 | "resource-version": "1505892661724", |
| 35 | "esr-system-info-list": { |
| 36 | "esr-system-info": [ |
| 37 | { |
| 38 | "esr-system-info-id": "62e17285-c207-42b0-9d55-b472b274c254", |
| 39 | "system-name": "vim-fake-cloud", |
| 40 | "type": "vim", |
| 41 | "service-url": "http://127.0.0.1:5000/v3", |
| 42 | "user-name": "admin", |
| 43 | "password": "vmware", |
| 44 | "system-type": "vim", |
| 45 | "ssl-insecure": false, |
| 46 | "cloud-domain": "default", |
| 47 | "default-tenant": "admin", |
| 48 | "resource-version": "1505892661819" |
| 49 | } |
| 50 | ] |
| 51 | } |
| 52 | }" |
liangke | 01ef914 | 2017-10-12 18:09:15 +0800 | [diff] [blame] | 53 | |
| 54 | |
| 55 | the identity url reprent the fake cloud identity url. |
| 56 | |
| 57 | |
| 58 | |
| 59 | Test Examples |
Ethan Lynn | 42fbfdc | 2017-10-20 13:52:45 +0800 | [diff] [blame^] | 60 | ~~~~~~~~~~~~~ |
liangke | 01ef914 | 2017-10-12 18:09:15 +0800 | [diff] [blame] | 61 | |
| 62 | the ${fake_identiy_url}= "http://MSB_IP:MSB_PORT/api/multicloud-vio/v0/vmware_fake/identity/v3" |
| 63 | the ${msb_address} = "MSB_IP:MSB_PORT" |
| 64 | |
| 65 | Get 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' ${fake_identiy_url} |
| 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, etc. |
| 91 | For our testing We take nova and identity service endpoint address and auth token which is in response header named “X-Subject-Token”. |
| 92 | |
| 93 | # you can find the endpoint url namespace is "api/multicloiud-vio/v0/vmware_fake", it represent the multicloud-vio service, So |
| 94 | requests sending to mulitcloud-vio will be forwarded to fake cloud.the ip and port reprenst ${msb_address} |
| 95 | |
| 96 | |
| 97 | Identity endpoint: |
| 98 | http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity |
| 99 | |
| 100 | Nova endpoint: |
| 101 | http://$msb_address/api/multicloud-vio/v0/vmware_fake/compute/<user-tenantid> |
| 102 | |
| 103 | |
| 104 | List projects |
| 105 | ------------- |
| 106 | |
| 107 | Use identity’s endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/ |
| 108 | |
| 109 | .. code-block:: console |
| 110 | |
| 111 | $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/projects |
| 112 | |
| 113 | |
| 114 | Get os Hypervisor |
| 115 | ----------------- |
| 116 | |
| 117 | Use nova’s endpoint: http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<user-tenantid> |
| 118 | |
| 119 | |
| 120 | .. code-block:: console |
| 121 | |
| 122 | $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/os-hypervisors/detail |
| 123 | |
| 124 | |
| 125 | List instance of user’s project |
| 126 | -------------------------------- |
| 127 | |
| 128 | .. code-block:: console |
| 129 | |
| 130 | $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers |
| 131 | |
| 132 | |
| 133 | Show instance detail |
| 134 | -------------------- |
| 135 | |
| 136 | you need to input <server-id> in url path. |
| 137 | |
| 138 | .. code-block:: console |
| 139 | |
| 140 | $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vimid/nova/tenantid/servers/<server-id> |
| 141 | |
| 142 | |
| 143 | Shutdown instance |
| 144 | ----------------- |
| 145 | |
| 146 | you need to input <server-id> in url path |
| 147 | |
| 148 | .. code-block:: console |
| 149 | |
| 150 | $ 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 |
| 151 | |
| 152 | |
| 153 | Start instance |
| 154 | -------------- |
| 155 | |
| 156 | you need to input <server-id> in url path |
| 157 | |
| 158 | .. code-block:: console |
| 159 | |
| 160 | $ 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 |
| 161 | |
| 162 | |
| 163 | Suspend instance |
| 164 | ---------------- |
| 165 | |
| 166 | you need to input <server-id> in url path |
| 167 | |
| 168 | .. code-block:: console |
| 169 | |
| 170 | $ 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 |
| 171 | |
| 172 | |
| 173 | Resume instance |
| 174 | ---------------- |
| 175 | |
| 176 | you need to input <server-id> in url path |
| 177 | |
| 178 | .. code-block:: console |
| 179 | |
| 180 | $ 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 |
| 181 | |
| 182 | |
| 183 | Pause instance |
| 184 | -------------- |
| 185 | |
| 186 | you need to input <server-id> in url path |
| 187 | |
| 188 | .. code-block:: console |
| 189 | |
| 190 | $ 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 |
| 191 | |
| 192 | |
| 193 | Unpasue instance |
| 194 | ---------------- |
| 195 | |
| 196 | you need to input <server-id> in url path |
| 197 | |
| 198 | .. code-block:: console |
| 199 | |
| 200 | $ 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 |
| 201 | |
| 202 | |
| 203 | Reboot instance |
| 204 | --------------- |
| 205 | |
| 206 | you need to input <server-id> in url path |
| 207 | |
| 208 | .. code-block:: console |
| 209 | |
| 210 | $ 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 |
| 211 | |