occi-api 4.2.0.beta.15 → 4.2.0.beta.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -6
- data/lib/occi/api/client/base/stubs.rb +0 -36
- data/lib/occi/api/client/client_http.rb +0 -47
- data/lib/occi/api/client/http/helpers.rb +0 -2
- data/lib/occi/api/dsl.rb +3 -3
- data/lib/occi/api/version.rb +1 -1
- data/occi-api.gemspec +1 -1
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/creates_a_new_compute_resource.yml +840 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/creates_a_new_network_resource.yml +848 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/creates_a_new_storage_resource.yml +840 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/deletes_a_compute_resource.yml +836 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/deletes_a_network_resource.yml +844 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/deletes_a_storage_resource.yml +836 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/describes_all_available_mixins.yml +647 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/describes_compute_resources.yml +885 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/describes_network_resources.yml +1038 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/describes_os_tpl_mixins.yml +647 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/describes_resource_tpl_mixins.yml +648 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/describes_storage_resources.yml +1144 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/establishes_connection.yml +789 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/lists_all_available_mixins.yml +647 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/lists_compute_resources.yml +836 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/lists_network_resources.yml +842 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/lists_os_tpl_mixins.yml +647 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/lists_resource_tpl_mixins.yml +647 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/lists_storage_resources.yml +846 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/refreshes_its_model.yml +1524 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/triggers_an_action_on_a_compute_resource.yml +846 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/triggers_an_action_on_a_network_resource.yml +840 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_application/occi_json/triggers_an_action_on_a_storage_resource.yml +846 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/creates_a_new_compute_resource.yml +321 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/creates_a_new_network_resource.yml +326 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/creates_a_new_storage_resource.yml +321 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/deletes_a_compute_resource.yml +311 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/deletes_a_network_resource.yml +310 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/deletes_a_storage_resource.yml +311 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/{using_media_type_text_plain/refreshes_its_model.yml → using_media_type_text/plain/describes_all_available_mixins.yml} +160 -124
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/describes_compute_resources.yml +752 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/describes_network_resources.yml +977 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/describes_storage_resources.yml +1178 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/establishes_connection.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/fails_to_list_mixins_with_only_self_no_related_without_include_self_true.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/{using_media_type_text_plain/describes_storage_resources.yml → using_media_type_text/plain/finds_and_describes_scoped_os_tpl_mixin.yml} +196 -104
- data/spec/cassettes/Occi_Api_Client_ClientHttp/{using_media_type_text_plain/describes_network_resources.yml → using_media_type_text/plain/finds_and_describes_scoped_resource_tpl_mixin.yml} +203 -51
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/finds_and_describes_unscoped_mixin.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/instantiates_a_compute_resource_using_type_identifier.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/instantiates_a_compute_resource_using_type_name.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/instantiates_a_network_resource_using_type_identifier.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/instantiates_a_network_resource_using_type_name.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/instantiates_a_storage_resource_using_type_identifier.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/instantiates_a_storage_resource_using_type_name.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_all_available_entity_type_identifiers.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_all_available_entity_types.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_all_available_link_type_identifiers.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_all_available_link_types.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_all_available_mixin_type_identifiers.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_all_available_mixin_types.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_all_available_mixins.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_all_available_resource_type_identifiers.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_all_available_resource_types.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_compute_resources.yml +311 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_mixins_including_self.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_mixins_with_only_self_no_related_.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_network_resources.yml +315 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_os_tpl_mixins.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/{using_media_type_text_plain/describes_compute_resources.yml → using_media_type_text/plain/lists_resource_tpl_mixins.yml} +209 -55
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/lists_storage_resources.yml +321 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/looks_up_a_mixin_type_identifier_for_os_tpl.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/looks_up_a_mixin_type_identifier_for_resource_tpl.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/raises_an_error_when_looking_for_a_non-existent_mixin_type.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/refreshes_its_model.yml +472 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/returns_nil_when_looking_for_a_non-existent_mixin.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/returns_nil_when_looking_for_a_non-existent_mixin_of_a_specific_type.yml +262 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/triggers_an_action_on_a_compute_resource.yml +312 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/triggers_an_action_on_a_network_resource.yml +315 -0
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text/plain/triggers_an_action_on_a_storage_resource.yml +312 -0
- data/spec/cassettes/Occi_Api_Dsl/_connect/accepts_block_options.yml +261 -0
- data/spec/cassettes/Occi_Api_Dsl/_connect/connects_successfully_through_HTTP.yml +259 -0
- data/spec/occi/api/client/client_http_spec.rb +253 -99
- data/spec/occi/api/dsl_spec.rb +53 -3
- data/spec/occi/helpers/helpers_spec.rb +11 -0
- data/spec/spec_helper.rb +1 -0
- metadata +76 -15
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/establishes_connection.yml +0 -266
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_compute_resources.yml +0 -308
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_network_resources.yml +0 -308
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_storage_resources.yml +0 -310
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/net_http_example_response.yml +0 -266
- data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/replacements.txt +0 -38
- data/spec/occi/api/client/base/stubs_spec.rb +0 -53
@@ -0,0 +1,259 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: head
|
5
|
+
uri: https://rocci-test:edited@localhost:3300/-/
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/occi+json
|
12
|
+
User-Agent:
|
13
|
+
- rOCCI-core/4.2.5 rOCCI-api/4.2.0.beta.12 OCCI/1.1 ruby-x86_64-linux/1.9.3p194
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Date:
|
20
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
21
|
+
Server:
|
22
|
+
- Apache/2.2.22 (Debian)
|
23
|
+
X-Frame-Options:
|
24
|
+
- SAMEORIGIN
|
25
|
+
X-Xss-Protection:
|
26
|
+
- 1; mode=block
|
27
|
+
X-Content-Type-Options:
|
28
|
+
- nosniff
|
29
|
+
X-Ua-Compatible:
|
30
|
+
- chrome=1
|
31
|
+
Etag:
|
32
|
+
- ! '"9a80c19cda19e561a54636aa65dab712"'
|
33
|
+
Cache-Control:
|
34
|
+
- max-age=0, private, must-revalidate
|
35
|
+
X-Request-Id:
|
36
|
+
- 83be8d98-a5cd-4064-aa2f-5b6c4b1ec44d
|
37
|
+
X-Runtime:
|
38
|
+
- '0.320579'
|
39
|
+
X-Powered-By:
|
40
|
+
- Phusion Passenger 4.0.29
|
41
|
+
Status:
|
42
|
+
- 200 OK
|
43
|
+
Content-Type:
|
44
|
+
- application/occi+json; charset=utf-8
|
45
|
+
body:
|
46
|
+
encoding: US-ASCII
|
47
|
+
string: ''
|
48
|
+
http_version:
|
49
|
+
recorded_at: Thu, 01 Jan 1970 00:00:00 GMT
|
50
|
+
- request:
|
51
|
+
method: get
|
52
|
+
uri: https://rocci-test:edited@localhost:3300/-/
|
53
|
+
body:
|
54
|
+
encoding: US-ASCII
|
55
|
+
string: ''
|
56
|
+
headers:
|
57
|
+
Accept:
|
58
|
+
- text/plain,text/occi
|
59
|
+
User-Agent:
|
60
|
+
- rOCCI-core/4.2.5 rOCCI-api/4.2.0.beta.12 OCCI/1.1 ruby-x86_64-linux/1.9.3p194
|
61
|
+
response:
|
62
|
+
status:
|
63
|
+
code: 200
|
64
|
+
message: OK
|
65
|
+
headers:
|
66
|
+
Date:
|
67
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
68
|
+
Server:
|
69
|
+
- Apache/2.2.22 (Debian)
|
70
|
+
X-Frame-Options:
|
71
|
+
- SAMEORIGIN
|
72
|
+
X-Xss-Protection:
|
73
|
+
- 1; mode=block
|
74
|
+
X-Content-Type-Options:
|
75
|
+
- nosniff
|
76
|
+
X-Ua-Compatible:
|
77
|
+
- chrome=1
|
78
|
+
Etag:
|
79
|
+
- ! '"b0aa754c2f8fc412fd49133185b80445"'
|
80
|
+
Cache-Control:
|
81
|
+
- max-age=0, private, must-revalidate
|
82
|
+
X-Request-Id:
|
83
|
+
- 88d306a1-4b33-4150-a72d-4976958f6a62
|
84
|
+
X-Runtime:
|
85
|
+
- '0.189222'
|
86
|
+
X-Powered-By:
|
87
|
+
- Phusion Passenger 4.0.29
|
88
|
+
Status:
|
89
|
+
- 200 OK
|
90
|
+
Vary:
|
91
|
+
- Accept-Encoding
|
92
|
+
Transfer-Encoding:
|
93
|
+
- chunked
|
94
|
+
Content-Type:
|
95
|
+
- text/plain; charset=utf-8
|
96
|
+
body:
|
97
|
+
encoding: US-ASCII
|
98
|
+
string: ! 'Category: entity;scheme="http://schemas.ogf.org/occi/core#";class="kind";title="entity";location="/entity/";attributes="occi.core.id{immutable}
|
99
|
+
occi.core.title"
|
100
|
+
|
101
|
+
Category: resource;scheme="http://schemas.ogf.org/occi/core#";class="kind";title="resource";rel="http://schemas.ogf.org/occi/core#entity";location="/resource/";attributes="occi.core.id{immutable}
|
102
|
+
occi.core.title occi.core.summary"
|
103
|
+
|
104
|
+
Category: link;scheme="http://schemas.ogf.org/occi/core#";class="kind";title="link";rel="http://schemas.ogf.org/occi/core#entity";location="/link/";attributes="occi.core.id{immutable}
|
105
|
+
occi.core.title occi.core.target occi.core.source"
|
106
|
+
|
107
|
+
Category: compute;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind";title="compute
|
108
|
+
resource";rel="http://schemas.ogf.org/occi/core#resource";location="/compute/";attributes="occi.core.id{immutable}
|
109
|
+
occi.core.title occi.core.summary occi.compute.architecture occi.compute.cores
|
110
|
+
occi.compute.hostname occi.compute.memory occi.compute.speed occi.compute.state{immutable}";actions="http://schemas.ogf.org/occi/infrastructure/compute/action#start
|
111
|
+
http://schemas.ogf.org/occi/infrastructure/compute/action#stop http://schemas.ogf.org/occi/infrastructure/compute/action#restart
|
112
|
+
http://schemas.ogf.org/occi/infrastructure/compute/action#suspend"
|
113
|
+
|
114
|
+
Category: storage;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind";title="storage
|
115
|
+
resource";rel="http://schemas.ogf.org/occi/core#resource";location="/storage/";attributes="occi.core.id{immutable}
|
116
|
+
occi.core.title occi.core.summary occi.storage.size occi.storage.state{immutable}";actions="http://schemas.ogf.org/occi/infrastructure/storage/action#online
|
117
|
+
http://schemas.ogf.org/occi/infrastructure/storage/action#offline http://schemas.ogf.org/occi/infrastructure/storage/action#backup
|
118
|
+
http://schemas.ogf.org/occi/infrastructure/storage/action#snapshot http://schemas.ogf.org/occi/infrastructure/storage/action#resize"
|
119
|
+
|
120
|
+
Category: network;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind";title="network
|
121
|
+
resource";rel="http://schemas.ogf.org/occi/core#resource";location="/network/";attributes="occi.core.id{immutable}
|
122
|
+
occi.core.title occi.core.summary occi.network.vlan occi.network.label occi.network.state{immutable}";actions="http://schemas.ogf.org/occi/infrastructure/network/action#up
|
123
|
+
http://schemas.ogf.org/occi/infrastructure/network/action#down"
|
124
|
+
|
125
|
+
Category: networkinterface;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind";title="networkinterface
|
126
|
+
link";rel="http://schemas.ogf.org/occi/core#link";location="/link/networkinterface/";attributes="occi.core.id{immutable}
|
127
|
+
occi.core.title occi.core.target occi.core.source occi.networkinterface.interface{immutable}
|
128
|
+
occi.networkinterface.mac occi.networkinterface.state{immutable}";actions="http://schemas.ogf.org/occi/infrastructure/networkinterface/action#up
|
129
|
+
http://schemas.ogf.org/occi/infrastructure/networkinterface/action#down"
|
130
|
+
|
131
|
+
Category: storagelink;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind";title="storage
|
132
|
+
link";rel="http://schemas.ogf.org/occi/core#link";location="/link/storagelink/";attributes="occi.core.id{immutable}
|
133
|
+
occi.core.title occi.core.target occi.core.source occi.storagelink.deviceid
|
134
|
+
occi.storagelink.mountpoint occi.storagelink.state{immutable}";actions="http://schemas.ogf.org/occi/infrastructure/storagelink/action#online
|
135
|
+
http://schemas.ogf.org/occi/infrastructure/storagelink/action#offline"
|
136
|
+
|
137
|
+
Category: console;scheme="http://schemas.ogf.org/occi/infrastructure/compute#";class="kind";title="Link
|
138
|
+
to the VM''s console";rel="http://schemas.ogf.org/occi/core#link";location="/link/consolelink/"
|
139
|
+
|
140
|
+
Category: resource_tpl;scheme="http://schemas.ogf.org/occi/infrastructure#";class="mixin";title="resource
|
141
|
+
template";location="/mixin/resource_tpl/"
|
142
|
+
|
143
|
+
Category: os_tpl;scheme="http://schemas.ogf.org/occi/infrastructure#";class="mixin";title="operating
|
144
|
+
system template";location="/mixin/os_tpl/"
|
145
|
+
|
146
|
+
Category: ipnetwork;scheme="http://schemas.ogf.org/occi/infrastructure/network#";class="mixin";title="IP
|
147
|
+
network mixin";location="/mixin/ipnetwork/";attributes="occi.network.address
|
148
|
+
occi.network.gateway occi.network.allocation"
|
149
|
+
|
150
|
+
Category: ipnetworkinterface;scheme="http://schemas.ogf.org/occi/infrastructure/networkinterface#";class="mixin";title="IP
|
151
|
+
network interface mixin";location="/mixin/ipnetworkinterface/";attributes="occi.networkinterface.address
|
152
|
+
occi.networkinterface.gateway occi.networkinterface.allocation"
|
153
|
+
|
154
|
+
Category: public_key;scheme="http://schemas.openstack.org/instance/credentials#";class="mixin";title="OpenStack''s
|
155
|
+
contextualization extension - credentials";location="/mixin/public_key/";attributes="org.openstack.credentials.publickey.name
|
156
|
+
org.openstack.credentials.publickey.data"
|
157
|
+
|
158
|
+
Category: user_data;scheme="http://schemas.openstack.org/compute/instance#";class="mixin";title="OpenStack''s
|
159
|
+
contextualization extension - user_data";location="/mixin/user_data/";attributes="org.openstack.compute.user_data"
|
160
|
+
|
161
|
+
Category: storage;scheme="http://opennebula.org/occi/infrastructure#";class="mixin";title="OpenNebula
|
162
|
+
specific Storage attributes";location="/mixin/storage/";attributes="org.opennebula.storage.id{immutable}
|
163
|
+
org.opennebula.storage.type org.opennebula.storage.persistent org.opennebula.storage.dev_prefix
|
164
|
+
org.opennebula.storage.bus org.opennebula.storage.driver org.opennebula.storage.fstype
|
165
|
+
org.opennebula.storage.path"
|
166
|
+
|
167
|
+
Category: compute;scheme="http://opennebula.org/occi/infrastructure#";class="mixin";title="OpenNebula
|
168
|
+
specific Compute attributes";location="/mixin/compute/";attributes="org.opennebula.compute.id{immutable}
|
169
|
+
org.opennebula.compute.cpu org.opennebula.compute.kernel org.opennebula.compute.initrd
|
170
|
+
org.opennebula.compute.root org.opennebula.compute.kernel_cmd org.opennebula.compute.bootloader
|
171
|
+
org.opennebula.compute.boot"
|
172
|
+
|
173
|
+
Category: networkinterface;scheme="http://opennebula.org/occi/infrastructure#";class="mixin";title="OpenNebula
|
174
|
+
specific Networkinterface attributes";location="/mixin/networkinterface/";attributes="org.opennebula.networkinterface.bridge
|
175
|
+
org.opennebula.networkinterface.script org.opennebula.networkinterface.model
|
176
|
+
org.opennebula.networkinterface.white_ports_tcp org.opennebula.networkinterface.black_ports_tcp
|
177
|
+
org.opennebula.networkinterface.white_ports_udp org.opennebula.networkinterface.black_ports_udp
|
178
|
+
org.opennebula.networkinterface.icmp"
|
179
|
+
|
180
|
+
Category: storagelink;scheme="http://opennebula.org/occi/infrastructure#";class="mixin";title="OpenNebula
|
181
|
+
specific Storagelink attributes";location="/mixin/storagelink/";attributes="org.opennebula.storagelink.bus
|
182
|
+
org.opennebula.storagelink.driver org.opennebula.storagelink.dev_prefix"
|
183
|
+
|
184
|
+
Category: network;scheme="http://opennebula.org/occi/infrastructure#";class="mixin";title="OpenNebula
|
185
|
+
specific Network attributes";location="/mixin/network/";attributes="org.opennebula.network.id{immutable}
|
186
|
+
org.opennebula.network.bridge org.opennebula.network.vlan org.opennebula.network.phydev
|
187
|
+
org.opennebula.network.ip_start org.opennebula.network.ip_end"
|
188
|
+
|
189
|
+
Category: uuid_monitoring_4;scheme="http://localhost/occi/infrastructure/os_tpl#";class="mixin";title="monitoring";rel="http://schemas.ogf.org/occi/infrastructure#os_tpl";location="/mixin/os_tpl/uuid_monitoring_4/"
|
190
|
+
|
191
|
+
Category: uuid_debianvm_5;scheme="http://localhost/occi/infrastructure/os_tpl#";class="mixin";title="debianvm";rel="http://schemas.ogf.org/occi/infrastructure#os_tpl";location="/mixin/os_tpl/uuid_debianvm_5/"
|
192
|
+
|
193
|
+
Category: uuid_monitoring_hubik_1280;scheme="http://localhost/occi/infrastructure/os_tpl#";class="mixin";title="monitoring-hubik";rel="http://schemas.ogf.org/occi/infrastructure#os_tpl";location="/mixin/os_tpl/uuid_monitoring_hubik_1280/"
|
194
|
+
|
195
|
+
Category: medium;scheme="http://sitespecific.localhost/occi/infrastructure/resource_tpl#";class="mixin";title="Medium
|
196
|
+
Instance";rel="http://schemas.ogf.org/occi/infrastructure#resource_tpl";location="/mixin/resource_tpl/medium/";attributes="occi.compute.architecture{immutable}
|
197
|
+
occi.compute.cores{immutable} occi.compute.speed{immutable} occi.compute.memory{immutable}"
|
198
|
+
|
199
|
+
Category: small;scheme="http://sitespecific.localhost/occi/infrastructure/resource_tpl#";class="mixin";title="Small
|
200
|
+
Instance";rel="http://schemas.ogf.org/occi/infrastructure#resource_tpl";location="/mixin/resource_tpl/small/";attributes="occi.compute.architecture{immutable}
|
201
|
+
occi.compute.cores{immutable} occi.compute.speed{immutable} occi.compute.memory{immutable}"
|
202
|
+
|
203
|
+
Category: extra_large;scheme="http://sitespecific.localhost/occi/infrastructure/resource_tpl#";class="mixin";title="Extra
|
204
|
+
Large Instance";rel="http://schemas.ogf.org/occi/infrastructure#resource_tpl";location="/mixin/resource_tpl/extra_large/";attributes="occi.compute.architecture{immutable}
|
205
|
+
occi.compute.cores{immutable} occi.compute.speed{immutable} occi.compute.memory{immutable}"
|
206
|
+
|
207
|
+
Category: large;scheme="http://sitespecific.localhost/occi/infrastructure/resource_tpl#";class="mixin";title="Large
|
208
|
+
Instance";rel="http://schemas.ogf.org/occi/infrastructure#resource_tpl";location="/mixin/resource_tpl/large/";attributes="occi.compute.architecture{immutable}
|
209
|
+
occi.compute.cores{immutable} occi.compute.speed{immutable} occi.compute.memory{immutable}"
|
210
|
+
|
211
|
+
Category: start;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";class="action";title="start
|
212
|
+
compute instance"
|
213
|
+
|
214
|
+
Category: stop;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";class="action";title="stop
|
215
|
+
compute instance";attributes="method"
|
216
|
+
|
217
|
+
Category: restart;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";class="action";title="restart
|
218
|
+
compute instance";attributes="method"
|
219
|
+
|
220
|
+
Category: suspend;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";class="action";title="suspend
|
221
|
+
compute instance";attributes="method"
|
222
|
+
|
223
|
+
Category: online;scheme="http://schemas.ogf.org/occi/infrastructure/storage/action#";class="action";title="activate
|
224
|
+
storage"
|
225
|
+
|
226
|
+
Category: offline;scheme="http://schemas.ogf.org/occi/infrastructure/storage/action#";class="action";title="deactivate
|
227
|
+
storage"
|
228
|
+
|
229
|
+
Category: backup;scheme="http://schemas.ogf.org/occi/infrastructure/storage/action#";class="action";title="backup
|
230
|
+
storage"
|
231
|
+
|
232
|
+
Category: snapshot;scheme="http://schemas.ogf.org/occi/infrastructure/storage/action#";class="action";title="snapshot
|
233
|
+
storage"
|
234
|
+
|
235
|
+
Category: resize;scheme="http://schemas.ogf.org/occi/infrastructure/storage/action#";class="action";title="resize
|
236
|
+
storage";attributes="size{required}"
|
237
|
+
|
238
|
+
Category: up;scheme="http://schemas.ogf.org/occi/infrastructure/network/action#";class="action";title="activate
|
239
|
+
network"
|
240
|
+
|
241
|
+
Category: down;scheme="http://schemas.ogf.org/occi/infrastructure/network/action#";class="action";title="deactivate
|
242
|
+
network"
|
243
|
+
|
244
|
+
Category: up;scheme="http://schemas.ogf.org/occi/infrastructure/networkinterface/action#";class="action";title="activate
|
245
|
+
networkinterface"
|
246
|
+
|
247
|
+
Category: down;scheme="http://schemas.ogf.org/occi/infrastructure/networkinterface/action#";class="action";title="deactivate
|
248
|
+
networkinterface"
|
249
|
+
|
250
|
+
Category: online;scheme="http://schemas.ogf.org/occi/infrastructure/storagelink/action#";class="action";title="activate
|
251
|
+
storagelink"
|
252
|
+
|
253
|
+
Category: offline;scheme="http://schemas.ogf.org/occi/infrastructure/storagelink/action#";class="action";title="deactivate
|
254
|
+
storagelink"
|
255
|
+
|
256
|
+
'
|
257
|
+
http_version:
|
258
|
+
recorded_at: Thu, 01 Jan 1970 00:00:00 GMT
|
259
|
+
recorded_with: VCR 2.8.0
|
@@ -4,15 +4,17 @@ module Occi
|
|
4
4
|
module Api
|
5
5
|
module Client
|
6
6
|
|
7
|
-
|
7
|
+
|
8
|
+
# vcr_options = { :record => :new_episodes } # To be used only when (re)implementing tests
|
9
|
+
vcr_options = { :record => :none }
|
8
10
|
describe ClientHttp, :vcr => vcr_options do
|
9
11
|
|
10
12
|
context "using media type text/plain" do
|
11
13
|
|
12
14
|
before(:each) do
|
13
15
|
@client = Occi::Api::Client::ClientHttp.new({
|
14
|
-
:endpoint => 'https://localhost:3300',
|
15
|
-
:auth => { :type
|
16
|
+
:endpoint => ENV['ROCCI_SPEC_ENDPOINT'] || 'https://localhost:3300',
|
17
|
+
:auth => hash_or_nil_helper( ENV['ROCCI_SPEC_AUTH_JSON'] ) || { :type => "basic", :username => "rocci-test", :password => "edited"},
|
16
18
|
:log => { :out => "/dev/null",
|
17
19
|
:level => Occi::Api::Log::DEBUG },
|
18
20
|
:auto_connect => true,
|
@@ -116,52 +118,53 @@ module Occi
|
|
116
118
|
)
|
117
119
|
end
|
118
120
|
|
119
|
-
it "lists compute resources"
|
120
|
-
@client.list("compute").should eq ["https://localhost:3300/compute/
|
121
|
+
it "lists compute resources" do
|
122
|
+
@client.list("compute").should eq ["https://localhost:3300/compute/4011"]
|
121
123
|
end
|
122
124
|
|
123
|
-
it "lists network resources"
|
124
|
-
@client.list("network").should eq ["https://localhost:3300/network/
|
125
|
+
it "lists network resources" do
|
126
|
+
@client.list("network").should eq ["https://localhost:3300/network/1", "https://localhost:3300/network/2", "https://localhost:3300/network/12"]
|
125
127
|
end
|
126
128
|
|
127
|
-
it "lists storage resources"
|
129
|
+
it "lists storage resources" do
|
128
130
|
@client.list("storage").should include(
|
129
|
-
"https://localhost:3300/storage/
|
130
|
-
"https://localhost:3300/storage/
|
131
|
+
"https://localhost:3300/storage/4",
|
132
|
+
"https://localhost:3300/storage/547"
|
131
133
|
)
|
132
134
|
end
|
133
135
|
|
134
136
|
it "lists all available mixins" do
|
135
137
|
@client.list_mixins.should include(
|
136
|
-
"http://
|
137
|
-
"http://
|
138
|
-
"http://
|
139
|
-
"http://
|
140
|
-
"http://
|
138
|
+
"http://sitespecific.localhost/occi/infrastructure/resource_tpl#large",
|
139
|
+
"http://sitespecific.localhost/occi/infrastructure/resource_tpl#extra_large",
|
140
|
+
"http://sitespecific.localhost/occi/infrastructure/resource_tpl#medium",
|
141
|
+
"http://sitespecific.localhost/occi/infrastructure/resource_tpl#small",
|
142
|
+
"http://localhost/occi/infrastructure/os_tpl#uuid_monitoring_4"
|
141
143
|
)
|
142
144
|
end
|
143
145
|
|
144
146
|
it "lists os_tpl mixins" do
|
145
147
|
mixins = Occi::Core::Mixins.new
|
146
|
-
mixins << Occi::Core::Mixin.new("http://
|
148
|
+
mixins << Occi::Core::Mixin.new("http://localhost/occi/infrastructure/os_tpl#", "uuid_monitoring_4")
|
149
|
+
mixins << Occi::Core::Mixin.new("http://localhost/occi/infrastructure/os_tpl#", "uuid_debianvm_5")
|
147
150
|
|
148
|
-
expect(@client.get_mixins("os_tpl"))
|
149
|
-
expect(@client.get_os_tpls)
|
151
|
+
expect(mixins).to be_subset(@client.get_mixins("os_tpl"))
|
152
|
+
expect(mixins).to be_subset(@client.get_os_tpls)
|
150
153
|
end
|
151
154
|
|
152
155
|
it "lists mixins including self" do
|
153
156
|
mixins = Occi::Core::Mixins.new
|
154
157
|
mixins << Occi::Core::Mixin.new("http://schemas.ogf.org/occi/infrastructure#", "os_tpl")
|
155
|
-
mixins << Occi::Core::Mixin.new("http://
|
158
|
+
mixins << Occi::Core::Mixin.new("http://localhost/occi/infrastructure/os_tpl#", "uuid_monitoring_4")
|
156
159
|
|
157
|
-
expect(@client.get_mixins("os_tpl", true))
|
160
|
+
expect(mixins).to be_subset(@client.get_mixins("os_tpl", true))
|
158
161
|
end
|
159
162
|
|
160
163
|
it "lists mixins with only self (no related)" do
|
161
164
|
mixins = Occi::Core::Mixins.new
|
162
|
-
mixins << Occi::Core::Mixin.new("http://
|
165
|
+
mixins << Occi::Core::Mixin.new("http://localhost/occi/infrastructure/os_tpl#", "uuid_monitoring_4")
|
163
166
|
|
164
|
-
expect(@client.get_mixins("http://
|
167
|
+
expect(@client.get_mixins("http://localhost/occi/infrastructure/os_tpl#uuid_monitoring_4", true)).to eq mixins
|
165
168
|
end
|
166
169
|
|
167
170
|
it "fails to list mixins with only self (no related) without include_self=true" do
|
@@ -171,71 +174,68 @@ module Occi
|
|
171
174
|
|
172
175
|
it "lists resource_tpl mixins" do
|
173
176
|
mixins = Occi::Core::Mixins.new
|
174
|
-
mixins << Occi::Core::Mixin.new("http://
|
175
|
-
mixins << Occi::Core::Mixin.new("http://
|
176
|
-
mixins << Occi::Core::Mixin.new("http://
|
177
|
-
mixins << Occi::Core::Mixin.new("http://
|
177
|
+
mixins << Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl#", "large")
|
178
|
+
mixins << Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl#", "extra_large")
|
179
|
+
mixins << Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl#", "medium")
|
180
|
+
mixins << Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl#", "small")
|
178
181
|
|
179
|
-
expect(@client.get_mixins("resource_tpl"))
|
180
|
-
expect(@client.get_resource_tpls)
|
182
|
+
expect(mixins).to be_subset(@client.get_mixins("resource_tpl"))
|
183
|
+
expect(mixins).to be_subset(@client.get_resource_tpls)
|
181
184
|
end
|
182
185
|
|
183
|
-
it "describes compute resources"
|
186
|
+
it "describes compute resources" do
|
184
187
|
cmpts = @client.describe("compute")
|
185
188
|
|
186
189
|
cmpts.length.should eq 1
|
187
|
-
cmpts.first.attributes['occi.core.id'].should eq('
|
188
|
-
cmpts.first.attributes['occi.core.title'].should eq('
|
190
|
+
cmpts.first.attributes['occi.core.id'].should eq('4011')
|
191
|
+
cmpts.first.attributes['occi.core.title'].should eq('DebianTest')
|
189
192
|
cmpts.first.attributes['occi.compute.cores'].should eq(2)
|
190
193
|
cmpts.first.attributes['org.opennebula.compute.cpu'].should eq(2.0)
|
191
|
-
cmpts.first.attributes['occi.compute.memory'].should eq(
|
194
|
+
cmpts.first.attributes['occi.compute.memory'].should eq(4.0)
|
192
195
|
end
|
193
196
|
|
194
|
-
it "describes network resources"
|
197
|
+
it "describes network resources" do
|
195
198
|
nets = @client.describe "network"
|
196
199
|
|
197
|
-
nets.length.
|
198
|
-
nets.
|
199
|
-
nets.first.attributes['occi.core.title'].should eq('private')
|
200
|
-
nets.first.attributes['occi.network.allocation'].should eq('dynamic')
|
201
|
-
nets.first.attributes['org.opennebula.network.id'].should eq("1")
|
200
|
+
expect(nets.length).to eq 4
|
201
|
+
expect(nets.to_a.select{ |item| item.attributes['occi.core.id'] == '1' && item.attributes['occi.core.title'] == 'public' && item.attributes['occi.network.allocation'] == 'static' && item.attributes['org.opennebula.network.id'] == '1'}.any?).to eql true
|
202
202
|
end
|
203
203
|
|
204
|
-
it "describes storage resources"
|
204
|
+
it "describes storage resources" do
|
205
205
|
stors = @client.describe "storage"
|
206
206
|
|
207
|
-
stors.length.
|
208
|
-
stors.to_a.
|
209
|
-
stors.to_a.
|
210
|
-
stors.to_a.
|
211
|
-
stors.to_a.
|
207
|
+
expect(stors.length).to eq 6
|
208
|
+
expect(stors.to_a.select{ |item| item.attributes['occi.core.id'] == '547' }.any?).to eql true
|
209
|
+
expect(stors.to_a.select{ |item| item.attributes['occi.core.title'] == 'winByAli' }.any?).to eql true
|
210
|
+
expect(stors.to_a.select{ |item| item.attributes['occi.storage.state'] == 'online' }.any?).to eql true
|
211
|
+
expect(stors.to_a.select{ |item| item.attributes['org.opennebula.storage.id'] == '547' }.any?).to eql true
|
212
212
|
|
213
|
-
stors.
|
213
|
+
expect(stors.to_a.select{ |item| item.attributes['occi.core.id'] == '375' }.any?).to eql true
|
214
214
|
end
|
215
215
|
|
216
216
|
it "describes all available mixins" do
|
217
|
-
@client.get_mixins.
|
218
|
-
Occi::Core::Mixin.new("http://
|
219
|
-
Occi::Core::Mixin.new("http://
|
220
|
-
Occi::Core::Mixin.new("http://
|
221
|
-
Occi::Core::Mixin.new("http://
|
222
|
-
Occi::Core::Mixin.new("http://
|
217
|
+
expect(@client.get_mixins).to include(
|
218
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "large"),
|
219
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "extra_large"),
|
220
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "medium"),
|
221
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "small"),
|
222
|
+
Occi::Core::Mixin.new("http://localhost/occi/infrastructure/os_tpl", "uuid_monitoring_4")
|
223
223
|
)
|
224
224
|
end
|
225
225
|
|
226
226
|
it "finds and describes unscoped mixin" do
|
227
|
-
mxn = @client.get_mixin('
|
228
|
-
mxn.type_identifier.should eq 'http://
|
227
|
+
mxn = @client.get_mixin('uuid_monitoring_4', nil, true)
|
228
|
+
mxn.type_identifier.should eq 'http://localhost/occi/infrastructure/os_tpl#uuid_monitoring_4'
|
229
229
|
end
|
230
230
|
|
231
231
|
it "finds and describes scoped os_tpl mixin" do
|
232
|
-
mxn = @client.get_mixin('
|
233
|
-
mxn.type_identifier.should eq 'http://
|
232
|
+
mxn = @client.get_mixin('uuid_monitoring_4', "os_tpl", true)
|
233
|
+
mxn.type_identifier.should eq 'http://localhost/occi/infrastructure/os_tpl#uuid_monitoring_4'
|
234
234
|
end
|
235
235
|
|
236
236
|
it "finds and describes scoped resource_tpl mixin" do
|
237
237
|
mxn = @client.get_mixin('large', "resource_tpl", true)
|
238
|
-
mxn.type_identifier.should eq 'http://
|
238
|
+
mxn.type_identifier.should eq 'http://sitespecific.localhost/occi/infrastructure/resource_tpl#large'
|
239
239
|
end
|
240
240
|
|
241
241
|
it "returns nil when looking for a non-existent mixin" do
|
@@ -252,27 +252,60 @@ module Occi
|
|
252
252
|
expect{ @client.get_mixin('blablabla', 'blabla', true) }.to raise_error
|
253
253
|
end
|
254
254
|
|
255
|
-
it "creates a new compute resource"
|
256
|
-
|
257
|
-
|
255
|
+
it "creates a new compute resource" do
|
256
|
+
compt = Occi::Infrastructure::Compute.new
|
257
|
+
compt.mixins << 'http://localhost/occi/infrastructure/os_tpl#uuid_debianvm_5'
|
258
|
+
compt.mixins << "http://sitespecific.localhost/occi/infrastructure/resource_tpl#small"
|
259
|
+
expect(@client.create compt).to eql "https://localhost:3300/compute/4015"
|
260
|
+
end
|
258
261
|
|
259
|
-
it "creates a new
|
262
|
+
it "creates a new storage resource" do
|
263
|
+
stor = Occi::Infrastructure::Storage.new
|
264
|
+
stor.size=0.006
|
265
|
+
stor.title='spec'
|
266
|
+
expect(@client.create stor).to eql 'https://localhost:3300/storage/696'
|
267
|
+
end
|
260
268
|
|
261
|
-
it "
|
269
|
+
it "creates a new network resource" do
|
270
|
+
net = Occi::Infrastructure::Network.new
|
271
|
+
net.mixins << "http://opennebula.org/occi/infrastructure#network"
|
272
|
+
net.title='privatetest'
|
273
|
+
net.allocation='static'
|
274
|
+
net.attributes["org.opennebula.network.bridge"]="xenbr0"
|
275
|
+
expect(@client.create net).to eql 'https://localhost:3300/network/63'
|
276
|
+
end
|
262
277
|
|
263
|
-
it "deletes a compute resource"
|
278
|
+
it "deletes a compute resource" do
|
279
|
+
expect(@client.delete 'https://localhost:3300/compute/4015').to eql true
|
280
|
+
end
|
264
281
|
|
265
|
-
it "deletes a network resource"
|
282
|
+
it "deletes a network resource" do
|
283
|
+
expect(@client.delete 'https://localhost:3300/network/63').to eql true
|
284
|
+
end
|
266
285
|
|
267
|
-
it "deletes a storage resource"
|
286
|
+
it "deletes a storage resource" do
|
287
|
+
expect(@client.delete 'https://localhost:3300/storage/696').to eql true
|
288
|
+
end
|
268
289
|
|
269
|
-
it "triggers an action on a compute resource"
|
290
|
+
it "triggers an action on a compute resource" do
|
291
|
+
startaction = Occi::Core::Action.new scheme='http://schemas.ogf.org/occi/infrastructure/compute/action#', term='start', title='start compute instance'
|
292
|
+
startactioninstance = Occi::Core::ActionInstance.new startaction, nil
|
293
|
+
expect(@client.trigger "https://localhost:3300/compute/4096", startactioninstance).to eq true
|
294
|
+
end
|
270
295
|
|
271
|
-
it "triggers an action on a storage resource"
|
296
|
+
it "triggers an action on a storage resource" do
|
297
|
+
onlineaction = Occi::Core::Action.new scheme='http://schemas.ogf.org/occi/infrastructure/storage/action#', term='online', title='activate storage'
|
298
|
+
onlineactioninstance = Occi::Core::ActionInstance.new onlineaction, nil
|
299
|
+
expect(@client.trigger "https://localhost:3300/storage/709", onlineactioninstance).to eq true
|
300
|
+
end
|
272
301
|
|
273
|
-
it "triggers an action on a network resource"
|
302
|
+
it "triggers an action on a network resource" do
|
303
|
+
upaction = Occi::Core::Action.new scheme='http://schemas.ogf.org/occi/infrastructure/network/action#', term='up', title='activate network'
|
304
|
+
upactioninstance = Occi::Core::ActionInstance.new upaction, nil
|
305
|
+
expect(@client.trigger "https://localhost:3300/network/66", upactioninstance).to eq true
|
306
|
+
end
|
274
307
|
|
275
|
-
it "refreshes its model"
|
308
|
+
it "refreshes its model" do
|
276
309
|
@client.refresh
|
277
310
|
end
|
278
311
|
|
@@ -289,61 +322,182 @@ module Occi
|
|
289
322
|
context "using media type application/occi+json" do
|
290
323
|
|
291
324
|
before(:each) do
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
325
|
+
@client = Occi::Api::Client::ClientHttp.new({
|
326
|
+
:endpoint => ENV['ROCCI_SPEC_ENDPOINT'] || 'https://localhost:3300',
|
327
|
+
:auth => hash_or_nil_helper( ENV['ROCCI_SPEC_AUTH_JSON'] ) || { :type => "basic", :username => "rocci-test", :password => "edited"},
|
328
|
+
:log => { :out => "/dev/null",
|
329
|
+
:level => Occi::Log::DEBUG },
|
330
|
+
:auto_connect => true,
|
331
|
+
:media_type => "application/occi+json"
|
332
|
+
})
|
333
|
+
end
|
334
|
+
|
335
|
+
after(:each) do
|
336
|
+
@client.logger.close if @client && @client.logger
|
337
|
+
end
|
338
|
+
|
339
|
+
it "establishes connection" do
|
340
|
+
@client.connected.should be_true
|
341
|
+
end
|
342
|
+
|
343
|
+
it "lists compute resources" do
|
344
|
+
expect(@client.list("compute")).to eq ["https://localhost:3300/compute/4011"]
|
345
|
+
end
|
346
|
+
|
347
|
+
it "lists network resources" do
|
348
|
+
@client.list("network").should eq ["https://localhost:3300/network/1", "https://localhost:3300/network/2", "https://localhost:3300/network/12", "https://localhost:3300/network/61"]
|
349
|
+
end
|
350
|
+
|
351
|
+
it "lists storage resources" do
|
352
|
+
@client.list("storage").should include(
|
353
|
+
"https://localhost:3300/storage/4",
|
354
|
+
"https://localhost:3300/storage/547"
|
355
|
+
)
|
356
|
+
end
|
357
|
+
|
358
|
+
it "lists all available mixins" do
|
359
|
+
@client.list_mixins.should include(
|
360
|
+
"http://sitespecific.localhost/occi/infrastructure/resource_tpl#large",
|
361
|
+
"http://sitespecific.localhost/occi/infrastructure/resource_tpl#extra_large",
|
362
|
+
"http://sitespecific.localhost/occi/infrastructure/resource_tpl#medium",
|
363
|
+
"http://sitespecific.localhost/occi/infrastructure/resource_tpl#small",
|
364
|
+
"http://localhost/occi/infrastructure/os_tpl#uuid_monitoring_4"
|
365
|
+
)
|
300
366
|
end
|
301
367
|
|
302
|
-
it "
|
368
|
+
it "lists os_tpl mixins" do
|
369
|
+
mixins = Occi::Core::Mixins.new
|
370
|
+
mixins << Occi::Core::Mixin.new("http://localhost/occi/infrastructure/os_tpl#", "uuid_monitoring_4")
|
371
|
+
mixins << Occi::Core::Mixin.new("http://localhost/occi/infrastructure/os_tpl#", "uuid_debianvm_5")
|
303
372
|
|
304
|
-
|
373
|
+
expect(mixins).to be_subset(@client.get_mixins("os_tpl"))
|
374
|
+
expect(mixins).to be_subset(@client.get_os_tpls)
|
375
|
+
end
|
305
376
|
|
306
|
-
it "lists
|
377
|
+
it "lists resource_tpl mixins" do
|
378
|
+
mixins = Occi::Core::Mixins.new
|
379
|
+
mixins << Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl#", "large")
|
380
|
+
mixins << Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl#", "extra_large")
|
381
|
+
mixins << Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl#", "medium")
|
382
|
+
mixins << Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl#", "small")
|
307
383
|
|
308
|
-
|
384
|
+
expect(mixins).to be_subset(@client.get_mixins("resource_tpl"))
|
385
|
+
expect(mixins).to be_subset(@client.get_resource_tpls)
|
386
|
+
end
|
309
387
|
|
310
|
-
it "
|
388
|
+
it "describes compute resources" do
|
389
|
+
cmpts = @client.describe("compute")
|
311
390
|
|
312
|
-
|
391
|
+
cmpts.length.should eq 1
|
392
|
+
cmpts.first.attributes['occi.core.id'].should eq('4011')
|
393
|
+
cmpts.first.attributes['occi.core.title'].should eq('DebianTest')
|
394
|
+
cmpts.first.attributes['occi.compute.cores'].should eq(2)
|
395
|
+
cmpts.first.attributes['org.opennebula.compute.cpu'].should eq(2.0)
|
396
|
+
cmpts.first.attributes['occi.compute.memory'].should eq(4.0)
|
397
|
+
end
|
313
398
|
|
314
|
-
it "
|
399
|
+
it "describes network resources" do
|
400
|
+
nets = @client.describe "network"
|
315
401
|
|
316
|
-
|
402
|
+
expect(nets.length).to eq 4
|
403
|
+
expect(nets.to_a.select{ |item| item.attributes['occi.core.id'] == '1' && item.attributes['occi.core.title'] == 'public' && item.attributes['occi.network.allocation'] == 'static' && item.attributes['org.opennebula.network.id'] == '1'}.any?).to eql true
|
404
|
+
end
|
317
405
|
|
318
|
-
it "describes
|
406
|
+
it "describes storage resources" do
|
407
|
+
stors = @client.describe "storage"
|
319
408
|
|
320
|
-
|
409
|
+
expect(stors.length).to eq 6
|
410
|
+
expect(stors.to_a.select{ |item| item.attributes['occi.core.id'] == '547' }.any?).to eql true
|
411
|
+
expect(stors.to_a.select{ |item| item.attributes['occi.core.title'] == 'winByAli' }.any?).to eql true
|
412
|
+
expect(stors.to_a.select{ |item| item.attributes['occi.storage.state'] == 'online' }.any?).to eql true
|
413
|
+
expect(stors.to_a.select{ |item| item.attributes['org.opennebula.storage.id'] == '547' }.any?).to eql true
|
321
414
|
|
322
|
-
|
415
|
+
expect(stors.to_a.select{ |item| item.attributes['occi.core.id'] == '375' }.any?).to eql true
|
416
|
+
end
|
323
417
|
|
324
|
-
it "describes
|
418
|
+
it "describes all available mixins" do
|
419
|
+
expect(@client.get_mixins).to include(
|
420
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "large"),
|
421
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "extra_large"),
|
422
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "medium"),
|
423
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "small"),
|
424
|
+
Occi::Core::Mixin.new("http://localhost/occi/infrastructure/os_tpl", "uuid_monitoring_4")
|
425
|
+
)
|
426
|
+
end
|
325
427
|
|
326
|
-
it "describes
|
428
|
+
it "describes os_tpl mixins" do
|
429
|
+
expect(@client.get_mixins("os_tpl")).to include(
|
430
|
+
Occi::Core::Mixin.new("http://localhost/occi/infrastructure/os_tpl", "uuid_monitoring_4")
|
431
|
+
)
|
432
|
+
end
|
327
433
|
|
328
|
-
it "
|
434
|
+
it "describes resource_tpl mixins" do
|
435
|
+
expect(@client.get_mixins).to include(
|
436
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "large"),
|
437
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "extra_large"),
|
438
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "medium"),
|
439
|
+
Occi::Core::Mixin.new("http://sitespecific.localhost/occi/infrastructure/resource_tpl", "small"),
|
440
|
+
)
|
441
|
+
end
|
329
442
|
|
330
|
-
it "creates a new
|
443
|
+
it "creates a new compute resource" do
|
444
|
+
compt = Occi::Infrastructure::Compute.new
|
445
|
+
compt.mixins << 'http://localhost/occi/infrastructure/os_tpl#uuid_debianvm_5'
|
446
|
+
compt.mixins << "http://sitespecific.localhost/occi/infrastructure/resource_tpl#small"
|
447
|
+
expect(@client.create compt).to eql "https://localhost:3300/compute/4017"
|
448
|
+
end
|
331
449
|
|
332
|
-
it "creates a new
|
450
|
+
it "creates a new storage resource" do
|
451
|
+
stor = Occi::Infrastructure::Storage.new
|
452
|
+
stor.size=0.006
|
453
|
+
stor.title='spec'
|
454
|
+
expect(@client.create stor).to eql 'https://localhost:3300/storage/697'
|
455
|
+
end
|
333
456
|
|
334
|
-
it "
|
457
|
+
it "creates a new network resource" do
|
458
|
+
net = Occi::Infrastructure::Network.new
|
459
|
+
net.mixins << "http://opennebula.org/occi/infrastructure#network"
|
460
|
+
net.title='privatetest'
|
461
|
+
net.allocation='static'
|
462
|
+
net.attributes["org.opennebula.network.bridge"]="xenbr0"
|
463
|
+
expect(@client.create net).to eql 'https://localhost:3300/network/64'
|
464
|
+
end
|
335
465
|
|
336
|
-
it "deletes a
|
466
|
+
it "deletes a compute resource" do
|
467
|
+
expect(@client.delete 'https://localhost:3300/compute/4017').to eql true
|
468
|
+
end
|
337
469
|
|
338
|
-
it "deletes a
|
470
|
+
it "deletes a network resource" do
|
471
|
+
expect(@client.delete 'https://localhost:3300/network/64').to eql true
|
472
|
+
end
|
473
|
+
|
474
|
+
it "deletes a storage resource" do
|
475
|
+
expect(@client.delete 'https://localhost:3300/storage/697').to eql true
|
476
|
+
end
|
339
477
|
|
340
|
-
it "triggers an action on a compute resource"
|
478
|
+
it "triggers an action on a compute resource" do
|
479
|
+
startaction = Occi::Core::Action.new scheme='http://schemas.ogf.org/occi/infrastructure/compute/action#', term='start', title='start compute instance'
|
480
|
+
startactioninstance = Occi::Core::ActionInstance.new startaction, nil
|
481
|
+
expect(@client.trigger "https://localhost:3300/compute/4096", startactioninstance).to eq true
|
482
|
+
end
|
341
483
|
|
342
|
-
it "triggers an action on a storage resource"
|
484
|
+
it "triggers an action on a storage resource" do
|
485
|
+
onlineaction = Occi::Core::Action.new scheme='http://schemas.ogf.org/occi/infrastructure/storage/action#', term='online', title='activate storage'
|
486
|
+
onlineactioninstance = Occi::Core::ActionInstance.new onlineaction, nil
|
487
|
+
# offlineaction = Occi::Core::Action.new scheme='http://schemas.ogf.org/occi/infrastructure/storage/action#', term='offline', title='deactivate storage'
|
488
|
+
# offlineactioninstance = Occi::Core::ActionInstance.new offlineaction, nil
|
489
|
+
expect(@client.trigger "https://localhost:3300/storage/709", onlineactioninstance).to eq true
|
490
|
+
end
|
343
491
|
|
344
|
-
it "triggers an action on a network resource"
|
492
|
+
it "triggers an action on a network resource" do
|
493
|
+
upaction = Occi::Core::Action.new scheme='http://schemas.ogf.org/occi/infrastructure/network/action#', term='up', title='activate network'
|
494
|
+
upactioninstance = Occi::Core::ActionInstance.new upaction, nil
|
495
|
+
expect(@client.trigger "https://localhost:3300/network/66", upactioninstance).to eq true
|
496
|
+
end
|
345
497
|
|
346
|
-
it "refreshes its model"
|
498
|
+
it "refreshes its model" do
|
499
|
+
@client.refresh
|
500
|
+
end
|
347
501
|
|
348
502
|
end
|
349
503
|
end
|