summaryrefslogtreecommitdiffstats
path: root/docs/Multicloud-Fake_Cloud-Guide.rst
blob: dc8af4c0d2049ab3e0969841551420d16e8cf794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
================================
MultiCloud Fake_Cloud User Case
================================



multilcoud-vmware server not only provide vio plugin to access real openstack platform,but
also provide fake_cloud plugin which simulate thereal VIO function.The fake
cloud is suitable for testing openstack function if there is not real VIO platform.


Make sure you environment have msb,aai service and multicloud-vmware config file has the right msb_ip and
msb_port value,The config file path is vio/vio/pub/config/congfig.py



Register Fake Cloud to AAI
~~~~~~~~~~~~~~~~~~~~~~~~~~

Register vio information into AAI service with region name "vmware" and region id "fake"

.. code-block:: console

  $ curl -X PUT  -H "X-TransactionId":"get_aai_subr" -H "X-FromAppId":"AAI" -H "Accept":"application/json" \
    -H "Content-Type:"application/json" \
    https://aai_ip:aai_port/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/vmware/fake \
      -d "{
            "cloud-owner": "vmware",
            "cloud-region-id": "vio",
            "cloud-type": "vmware",
            "cloud-region-version": "4.0",
            "identity-url": "http://MSB_IP:MSB_PORT/api/multicloud-vio/v0/vmware_fake/identity/v3",
            "sriov-automation": false,
            "resource-version": "1505892661724",
            "esr-system-info-list": {
                "esr-system-info": [
                    {
                        "esr-system-info-id": "62e17285-c207-42b0-9d55-b472b274c254",
                        "system-name": "vim-fake-cloud",
                        "type": "vim",
                        "service-url": "http://127.0.0.1:5000/v3",
                        "user-name": "admin",
                        "password": "vmware",
                        "system-type": "vim",
                        "ssl-insecure": false,
                        "cloud-domain": "default",
                        "default-tenant": "admin",
                        "resource-version": "1505892661819"
                    }
                ]
            }
      }"


the identity url reprent the fake cloud identity url.



Test Examples
~~~~~~~~~~~~~

the ${fake_identiy_url}= "http://MSB_IP:MSB_PORT/api/multicloud-vio/v0/vmware_fake/identity/v3"
the ${msb_address} =  "MSB_IP:MSB_PORT"

Get auth token
--------------

# send request to multicloud-framework(broker) service to get token

.. code-block:: console

  $ curl -X  POST   -d @test.json  -H 'Content-Type:application/json'   ${fake_identiy_url}

test.json content example:

::

  {
    "auth": sudo pip install virtualenv{
      "scope": {"project": {"id": “<project-id>”}},
      "identity":
	  {
		"password": {"user": {"domain": {"name": “<doman-name>”}, "password": “<user-password>”, "name": “<user-name>”}}, "methods": ["password"]
	  }
    }
  }


Response:
There are a large amounts of data including service endpoint, user information, etc.
For our testing  We  take nova and identity service endpoint address and auth token which is in response header named “X-Subject-Token”.

# you can find the endpoint url namespace is "api/multicloiud-vio/v0/vmware_fake", it represent the multicloud-vio service, So
requests sending to mulitcloud-vio will be forwarded to fake cloud.the ip and port reprenst ${msb_address}


Identity endpoint:
	http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity

Nova endpoint:
	http://$msb_address/api/multicloud-vio/v0/vmware_fake/compute/<user-tenantid>


List projects
-------------

Use identity’s endpoint:  http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/

.. code-block:: console

  $ curl -X GET   -H 'X-Auth-Token:<token>'  http://$msb_address/api/multicloud-vio/v0/vmware_fake/identity/projects


Get os Hypervisor
-----------------

Use nova’s endpoint:  http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<user-tenantid>


.. code-block:: console

  $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/os-hypervisors/detail


List instance of  user’s project
--------------------------------

.. code-block:: console

  $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vmware_fake/nova/<tenantid>/servers


Show instance detail
--------------------

you need to input <server-id> in url path.

.. code-block:: console

  $ curl -X GET -H 'X-Auth-Token:<token>' http://$msb_address/api/multicloud-vio/v0/vimid/nova/tenantid/servers/<server-id>


Shutdown instance
-----------------

you need to input <server-id> in url path

.. code-block:: console

  $ 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


Start instance
--------------

you need to input <server-id> in url path

.. code-block:: console

  $ 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


Suspend instance
----------------

you need to input <server-id> in url path

.. code-block:: console

   $ 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


Resume  instance
----------------

you need to input <server-id> in url path

.. code-block:: console

  $ 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


Pause instance
--------------

you need to input <server-id> in url path

.. code-block:: console

  $ 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


Unpasue instance
----------------

you need to input <server-id> in url path

.. code-block:: console

  $ 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


Reboot instance
---------------

you need to input <server-id> in url path

.. code-block:: console

  $ 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