fog-openstack 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/fog-openstack.gemspec +1 -1
  3. data/lib/fog/openstack.rb +46 -33
  4. data/lib/fog/openstack/docs/compute.md +2 -3
  5. data/lib/fog/openstack/docs/getting_started.md +5 -5
  6. data/lib/fog/openstack/docs/introspection.md +251 -0
  7. data/lib/fog/openstack/docs/metering.md +15 -1
  8. data/lib/fog/openstack/docs/planning.md +2 -2
  9. data/lib/fog/openstack/docs/storage.md +3 -4
  10. data/lib/fog/openstack/examples/compute/basics.rb +1 -1
  11. data/lib/fog/openstack/examples/compute/block_device_mapping_v2.rb +1 -3
  12. data/lib/fog/openstack/examples/identity/basics.rb +6 -7
  13. data/lib/fog/openstack/examples/image/upload-test-image.rb +5 -8
  14. data/lib/fog/openstack/examples/introspection/basics.rb +75 -0
  15. data/lib/fog/openstack/examples/planning/basics.rb +1 -1
  16. data/lib/fog/openstack/examples/storage/set-account-quota.rb +7 -9
  17. data/lib/fog/openstack/identity.rb +99 -5
  18. data/lib/fog/openstack/identity_v2.rb +4 -23
  19. data/lib/fog/openstack/identity_v3.rb +10 -22
  20. data/lib/fog/openstack/introspection.rb +133 -0
  21. data/lib/fog/openstack/models/introspection/rules.rb +29 -0
  22. data/lib/fog/openstack/models/introspection/rules_collection.rb +32 -0
  23. data/lib/fog/openstack/models/metering/events.rb +2 -2
  24. data/lib/fog/openstack/models/network/floating_ip.rb +24 -3
  25. data/lib/fog/openstack/network.rb +1 -0
  26. data/lib/fog/openstack/requests/compute/get_volume_details.rb +4 -0
  27. data/lib/fog/openstack/requests/introspection/abort_introspection.rb +25 -0
  28. data/lib/fog/openstack/requests/introspection/create_introspection.rb +35 -0
  29. data/lib/fog/openstack/requests/introspection/create_rules.rb +37 -0
  30. data/lib/fog/openstack/requests/introspection/delete_rules.rb +23 -0
  31. data/lib/fog/openstack/requests/introspection/delete_rules_all.rb +23 -0
  32. data/lib/fog/openstack/requests/introspection/get_introspection.rb +24 -0
  33. data/lib/fog/openstack/requests/introspection/get_introspection_details.rb +24 -0
  34. data/lib/fog/openstack/requests/introspection/get_rules.rb +24 -0
  35. data/lib/fog/openstack/requests/introspection/list_rules.rb +24 -0
  36. data/lib/fog/openstack/version.rb +1 -1
  37. data/tests/fixtures/introspection.yaml +287 -0
  38. data/tests/openstack/identity_version_tests.rb +25 -0
  39. data/tests/openstack/models/network/floating_ip_tests.rb +14 -1
  40. data/tests/openstack/requests/introspection/introspection_tests.rb +297 -0
  41. data/tests/openstack/requests/introspection/rules_tests.rb +46 -0
  42. metadata +22 -4
@@ -0,0 +1,25 @@
1
+ Shindo.tests('Fog::Identity[:openstack] | versions', ['openstack', 'identity']) do
2
+ begin
3
+ @old_mock_value = Excon.defaults[:mock]
4
+ @old_credentials = Fog.credentials
5
+
6
+ tests('v2') do
7
+ Fog.credentials = {:openstack_auth_url => 'http://openstack:35357/v2.0/tokens'}
8
+
9
+ returns(Fog::Identity::OpenStack::V2::Mock) do
10
+ Fog::Identity[:openstack].class
11
+ end
12
+ end
13
+
14
+ tests('v3') do
15
+ Fog.credentials = {:openstack_auth_url => 'http://openstack:35357/v3/auth/tokens'}
16
+
17
+ returns(Fog::Identity::OpenStack::V3::Mock) do
18
+ Fog::Identity[:openstack].class
19
+ end
20
+ end
21
+ ensure
22
+ Excon.defaults[:mock] = @old_mock_value
23
+ Fog.credentials = @old_credentials
24
+ end
25
+ end
@@ -17,6 +17,19 @@ Shindo.tests("Fog::Network[:openstack] | floating_ip", ['openstack']) do
17
17
  @instance.destroy == true
18
18
  end
19
19
 
20
- end
20
+ tests('#associate').succeeds do
21
+ port_id = 'p0000000-0000-0000-0000-000000000000'
22
+ fixed_ip_address = '8.8.8.8'
23
+ @instance.associate(port_id, fixed_ip_address)
24
+ returns(port_id) { @instance.port_id }
25
+ returns(fixed_ip_address) { @instance.fixed_ip_address }
26
+ end
21
27
 
28
+ tests('#disassociate').succeeds do
29
+ fixed_ip_address = '8.8.8.8'
30
+ @instance.disassociate(fixed_ip_address)
31
+ returns(nil) { @instance.port_id }
32
+ returns(nil) { @instance.fixed_ip_address }
33
+ end
34
+ end
22
35
  end
@@ -0,0 +1,297 @@
1
+ Shindo.tests('Fog::Introspection::OpenStack | Introspection requests', ['openstack']) do
2
+ @inspector = Fog::Introspection::OpenStack.new
3
+
4
+ @node_uuid = Fog::UUID.uuid
5
+
6
+ @introspection_finished = {
7
+ "error" => "null",
8
+ "finished" => "true"
9
+ }
10
+
11
+ @introspection_data = {
12
+ "cpu_arch" => String,
13
+ "macs" => Array,
14
+ "root_disk" => {
15
+ "rotational" => Fog::Boolean,
16
+ "vendor" => String,
17
+ "name" => String,
18
+ "wwn_vendor_extension" => Fog::Nullable::String,
19
+ "wwn_with_extension" => Fog::Nullable::String,
20
+ "model" => Fog::Nullable::String,
21
+ "wwn" => Fog::Nullable::String,
22
+ "serial" => Fog::Nullable::String,
23
+ "size" => Integer,
24
+ },
25
+ "extra" => {
26
+ "network" => {
27
+ "eth0" => {
28
+ "vlan-challenged" => String,
29
+ "tx-udp_tnl-segmentation" => String,
30
+ "ipv4-network" => String,
31
+ "rx-vlan-stag-filter" => String,
32
+ "highdma" => String,
33
+ "tx-nocache-copy" => String,
34
+ "tx-gso-robust" => String,
35
+ "fcoe-mtu" => String,
36
+ "netns-local" => String,
37
+ "udp-fragmentation-offload" => String,
38
+ "serial" => String,
39
+ "latency" => Integer,
40
+ "tx-checksumming/tx-checksum-ipv6" => String,
41
+ "tx-checksumming/tx-checksum-ipv4" => String,
42
+ "ipv4-netmask" => String,
43
+ "tcp-segmentation-offload/tx-tcp-segmentation" => String,
44
+ "tx-ipip-segmentation" => String,
45
+ "rx-vlan-offload" => String,
46
+ "tx-gre-segmentation" => String,
47
+ "tx-checksumming/tx-checksum-ip-generic" => String,
48
+ "tcp-segmentation-offload/tx-tcp-ecn-segmentation" => String,
49
+ "tx-checksumming/tx-checksum-fcoe-crc" => String,
50
+ "ipv4" => String,
51
+ "businfo" => String,
52
+ "rx-vlan-stag-hw-parse" => String,
53
+ "tx-vlan-offload" => String,
54
+ "product" => String,
55
+ "vendor" => String,
56
+ "tx-checksumming/tx-checksum-sctp" => String,
57
+ "driver" => String,
58
+ "tx-sit-segmentation" => String,
59
+ "busy-poll" => String,
60
+ "tx-vlan-stag-hw-insert" => String,
61
+ "scatter-gather/tx-scatter-gather" => String,
62
+ "link" => String,
63
+ "ntuple-filters" => String,
64
+ "rx-all" => String,
65
+ "tcp-segmentation-offload" => String,
66
+ "tcp-segmentation-offload/tx-tcp6-segmentation" => String,
67
+ "rx-checksumming" => String,
68
+ "rx-fcs" => String,
69
+ "tx-lockless" => String,
70
+ "generic-segmentation-offload" => String,
71
+ "tx-fcoe-segmentation" => String,
72
+ "tx-checksumming" => String,
73
+ "ipv4-cidr" => Integer,
74
+ "large-receive-offload" => String,
75
+ "rx-vlan-filter" => String,
76
+ "receive-hashing" => String,
77
+ "scatter-gather/tx-scatter-gather-fraglist" => String,
78
+ "generic-receive-offload" => String,
79
+ "loopback" => String,
80
+ "scatter-gather" => String,
81
+ "tx-mpls-segmentation" => String
82
+ },
83
+ "eth1" => {
84
+ "vlan-challenged" => String,
85
+ "tx-udp_tnl-segmentation" => String,
86
+ "tx-vlan-stag-hw-insert" => String,
87
+ "rx-vlan-stag-filter" => String,
88
+ "highdma" => String,
89
+ "tx-nocache-copy" => String,
90
+ "tx-gso-robust" => String,
91
+ "fcoe-mtu" => String,
92
+ "netns-local" => String,
93
+ "udp-fragmentation-offload" => String,
94
+ "serial" => String,
95
+ "latency" => Integer,
96
+ "tx-checksumming/tx-checksum-ipv6" => String,
97
+ "tx-checksumming/tx-checksum-ipv4" => String,
98
+ "tx-fcoe-segmentation" => String,
99
+ "tcp-segmentation-offload/tx-tcp-segmentation" => String,
100
+ "tx-ipip-segmentation" => String,
101
+ "rx-vlan-offload" => String,
102
+ "tx-gre-segmentation" => String,
103
+ "tx-checksumming/tx-checksum-ip-generic" => String,
104
+ "tcp-segmentation-offload/tx-tcp-ecn-segmentation" => String,
105
+ "tx-checksumming/tx-checksum-fcoe-crc" => String,
106
+ "rx-vlan-stag-hw-parse" => String,
107
+ "businfo" => String,
108
+ "tx-vlan-offload" => String,
109
+ "product" => String,
110
+ "vendor" => String,
111
+ "tx-checksumming/tx-checksum-sctp" => String,
112
+ "driver" => String,
113
+ "tx-sit-segmentation" => String,
114
+ "busy-poll" => String,
115
+ "scatter-gather/tx-scatter-gather" => String,
116
+ "link" => String,
117
+ "ntuple-filters" => String,
118
+ "rx-all" => String,
119
+ "tcp-segmentation-offload" => String,
120
+ "tcp-segmentation-offload/tx-tcp6-segmentation" => String,
121
+ "rx-checksumming" => String,
122
+ "tx-lockless" => String,
123
+ "generic-segmentation-offload" => String,
124
+ "loopback" => String,
125
+ "tx-checksumming" => String,
126
+ "large-receive-offload" => String,
127
+ "rx-vlan-filter" => String,
128
+ "receive-hashing" => String,
129
+ "scatter-gather/tx-scatter-gather-fraglist" => String,
130
+ "generic-receive-offload" => String,
131
+ "rx-fcs" => String,
132
+ "scatter-gather" => String,
133
+ "tx-mpls-segmentation" => String
134
+ }
135
+ },
136
+ "firmware" => {
137
+ "bios" => {
138
+ "date" => String,
139
+ "version" => String,
140
+ "vendor" => String
141
+ }
142
+ },
143
+ "system" => {
144
+ "kernel" => {
145
+ "cmdline" => String,
146
+ "version" => String,
147
+ "arch" => String
148
+ },
149
+ "product" => {
150
+ "version" => String,
151
+ "vendor" => String,
152
+ "name" => String,
153
+ "uuid" => String
154
+ },
155
+ "os" => {
156
+ "version" => String,
157
+ "vendor" => String
158
+ }
159
+ },
160
+ "memory" => {
161
+ "total" => {
162
+ "size" => Integer
163
+ }
164
+ },
165
+ "disk" => {
166
+ "vda" => {
167
+ "optimal_io_size" => Integer,
168
+ "physical_block_size" => Integer,
169
+ "rotational" => Integer,
170
+ "vendor" => String,
171
+ "size" => Integer
172
+ },
173
+ "logical" => {"count" => Integer}
174
+ },
175
+ "cpu" => {
176
+ "logical" => {"number" => Integer},
177
+ "physical_0" => {
178
+ "physid" => Integer,
179
+ "product" => String,
180
+ "frequency" => Integer,
181
+ "vendor" => String,
182
+ "flags" => String
183
+ },
184
+ "physical_1" => {
185
+ "physid" => Integer,
186
+ "product" => String,
187
+ "frequency" => Integer,
188
+ "vendor" => String,
189
+ "flags" => String
190
+ },
191
+ "physical_2" => {
192
+ "physid" => Integer,
193
+ "product" => String,
194
+ "frequency" => Integer,
195
+ "vendor" => String,
196
+ "flags" => String
197
+ },
198
+ "physical_3" => {
199
+ "physid" => Integer,
200
+ "product" => String,
201
+ "frequency" => Integer,
202
+ "vendor" => String,
203
+ "flags" => String
204
+ },
205
+ "physical" => {"number" => Integer}
206
+ }
207
+ },
208
+ "interfaces" => {
209
+ "eth0" => {
210
+ "ip" => String,
211
+ "mac" => String
212
+ }
213
+ },
214
+ "cpus" => 4,
215
+ "boot_interface" => String,
216
+ "memory_mb" => Integer,
217
+ "ipmi_address" => String,
218
+ "inventory" => {
219
+ "bmc_address" => String,
220
+ "interfaces" => [
221
+ {
222
+ "ipv4_address" => Fog::Nullable::String,
223
+ "switch_port_descr" => Fog::Nullable::String,
224
+ "switch_chassis_descr" => Fog::Nullable::String,
225
+ "name" => String,
226
+ "mac_address" => String
227
+ },
228
+ {
229
+ "ipv4_address" => Fog::Nullable::String,
230
+ "switch_port_descr" => Fog::Nullable::String,
231
+ "switch_chassis_descr" => Fog::Nullable::String,
232
+ "name" => String,
233
+ "mac_address" => String
234
+ }
235
+ ],
236
+ "disks" => [
237
+ {
238
+ "rotational" => Fog::Boolean,
239
+ "vendor" => String,
240
+ "name" => String,
241
+ "wwn_vendor_extension" => Fog::Nullable::String,
242
+ "wwn_with_extension" => Fog::Nullable::String,
243
+ "model" => Fog::Nullable::String,
244
+ "wwn" => Fog::Nullable::String,
245
+ "serial" => Fog::Nullable::String,
246
+ "size" => Integer
247
+ }
248
+ ],
249
+ "system_vendor" => {
250
+ "serial_number" => String,
251
+ "product_name" => String,
252
+ "manufacturer" => String
253
+ },
254
+ "memory" => {
255
+ "physical_mb" => Integer,
256
+ "total" => Integer
257
+ },
258
+ "cpu" => {
259
+ "count" => Integer,
260
+ "frequency" => String,
261
+ "model_name" => String,
262
+ "architecture" => String
263
+ }
264
+ },
265
+ "error" => Fog::Nullable::String,
266
+ "local_gb" => Integer,
267
+ "all_interfaces" => {
268
+ "eth0" => {
269
+ "ip" => Fog::Nullable::String,
270
+ "mac" => String
271
+ },
272
+ "eth1" => {
273
+ "ip" => Fog::Nullable::String,
274
+ "mac" => String
275
+ }
276
+ },
277
+ "logs" => String
278
+ }
279
+
280
+ tests('success') do
281
+ tests('#create_introspection').succeeds do
282
+ @inspector.create_introspection(@node_uuid).body
283
+ end
284
+
285
+ tests('#abort_introspection').succeeds do
286
+ @inspector.abort_introspection(@node_uuid).body
287
+ end
288
+
289
+ tests('#get_introspection').data_matches_schema(@introspection_finished) do
290
+ @inspector.get_introspection(@node_uuid).body
291
+ end
292
+
293
+ tests('#get_introspection_details').data_matches_schema('data' => @introspection_data) do
294
+ @inspector.get_introspection_details(@node_uuid).body
295
+ end
296
+ end
297
+ end
@@ -0,0 +1,46 @@
1
+ Shindo.tests('@inspector | Introspection rules requests', ['openstack']) do
2
+ @inspector = Fog::Introspection::OpenStack.new
3
+ @rules_id = Fog::UUID.uuid
4
+ @rules = {
5
+ 'description' => Fog::Nullable::String,
6
+ 'actions' => Array,
7
+ 'conditions' => Array,
8
+ 'uuid' => Fog::Nullable::String,
9
+ }
10
+
11
+ tests('success') do
12
+ tests('#list_rules').data_matches_schema('rules' => @rules) do
13
+ @inspector.list_rules.body
14
+ end
15
+
16
+ tests('#create_rules').data_matches_schema('rules' => @rules) do
17
+ attributes = {
18
+ "actions" => {
19
+ "action" => "set-attribute",
20
+ "path" => "/driver_info/ipmi_address",
21
+ "value" => "{data[inventory][bmc_address]}"
22
+ },
23
+ "conditions" => {
24
+ "field" => "node://property.path",
25
+ "op" => "eq",
26
+ "value" => "val",
27
+ },
28
+ "description" => "",
29
+ "uuid" => ""
30
+ }
31
+ @inspector.create_rules(attributes).body
32
+ end
33
+
34
+ tests('#get_rules').data_matches_schema('rules' => @rules) do
35
+ @inspector.get_rules(@rules_id).body
36
+ end
37
+
38
+ tests('#delete_rules').succeeds do
39
+ @inspector.delete_rules(@rules_id)
40
+ end
41
+
42
+ tests('#delete_rules_all').succeeds do
43
+ @inspector.delete_rules_all
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-17 00:00:00.000000000 Z
11
+ date: 2016-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.35'
19
+ version: '1.37'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.35'
26
+ version: '1.37'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fog-json
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -196,6 +196,7 @@ files:
196
196
  - lib/fog/openstack/core.rb
197
197
  - lib/fog/openstack/docs/compute.md
198
198
  - lib/fog/openstack/docs/getting_started.md
199
+ - lib/fog/openstack/docs/introspection.md
199
200
  - lib/fog/openstack/docs/metering.md
200
201
  - lib/fog/openstack/docs/orchestration.md
201
202
  - lib/fog/openstack/docs/planning.md
@@ -205,6 +206,7 @@ files:
205
206
  - lib/fog/openstack/examples/compute/block_device_mapping_v2.rb
206
207
  - lib/fog/openstack/examples/identity/basics.rb
207
208
  - lib/fog/openstack/examples/image/upload-test-image.rb
209
+ - lib/fog/openstack/examples/introspection/basics.rb
208
210
  - lib/fog/openstack/examples/network/network_subnets_routers.rb
209
211
  - lib/fog/openstack/examples/planning/basics.rb
210
212
  - lib/fog/openstack/examples/storage/set-account-quota.rb
@@ -214,6 +216,7 @@ files:
214
216
  - lib/fog/openstack/image.rb
215
217
  - lib/fog/openstack/image_v1.rb
216
218
  - lib/fog/openstack/image_v2.rb
219
+ - lib/fog/openstack/introspection.rb
217
220
  - lib/fog/openstack/metering.rb
218
221
  - lib/fog/openstack/models/baremetal/chassis.rb
219
222
  - lib/fog/openstack/models/baremetal/chassis_collection.rb
@@ -290,6 +293,8 @@ files:
290
293
  - lib/fog/openstack/models/image_v1/images.rb
291
294
  - lib/fog/openstack/models/image_v2/image.rb
292
295
  - lib/fog/openstack/models/image_v2/images.rb
296
+ - lib/fog/openstack/models/introspection/rules.rb
297
+ - lib/fog/openstack/models/introspection/rules_collection.rb
293
298
  - lib/fog/openstack/models/meta_parent.rb
294
299
  - lib/fog/openstack/models/metering/event.rb
295
300
  - lib/fog/openstack/models/metering/events.rb
@@ -652,6 +657,15 @@ files:
652
657
  - lib/fog/openstack/requests/image_v2/update_image.rb
653
658
  - lib/fog/openstack/requests/image_v2/update_image_member.rb
654
659
  - lib/fog/openstack/requests/image_v2/upload_image.rb
660
+ - lib/fog/openstack/requests/introspection/abort_introspection.rb
661
+ - lib/fog/openstack/requests/introspection/create_introspection.rb
662
+ - lib/fog/openstack/requests/introspection/create_rules.rb
663
+ - lib/fog/openstack/requests/introspection/delete_rules.rb
664
+ - lib/fog/openstack/requests/introspection/delete_rules_all.rb
665
+ - lib/fog/openstack/requests/introspection/get_introspection.rb
666
+ - lib/fog/openstack/requests/introspection/get_introspection_details.rb
667
+ - lib/fog/openstack/requests/introspection/get_rules.rb
668
+ - lib/fog/openstack/requests/introspection/list_rules.rb
655
669
  - lib/fog/openstack/requests/metering/get_event.rb
656
670
  - lib/fog/openstack/requests/metering/get_resource.rb
657
671
  - lib/fog/openstack/requests/metering/get_samples.rb
@@ -886,6 +900,7 @@ files:
886
900
  - lib/fog/openstack/volume.rb
887
901
  - lib/fog/openstack/volume_v1.rb
888
902
  - lib/fog/openstack/volume_v2.rb
903
+ - tests/fixtures/introspection.yaml
889
904
  - tests/helper.rb
890
905
  - tests/helpers/collection_helper.rb
891
906
  - tests/helpers/compute/flavors_helper.rb
@@ -899,6 +914,7 @@ files:
899
914
  - tests/helpers/schema_validator_tests.rb
900
915
  - tests/helpers/succeeds_helper.rb
901
916
  - tests/openstack/authenticate_tests.rb
917
+ - tests/openstack/identity_version_tests.rb
902
918
  - tests/openstack/models/compute/images_tests.rb
903
919
  - tests/openstack/models/compute/security_group_tests.rb
904
920
  - tests/openstack/models/compute/server_tests.rb
@@ -971,6 +987,8 @@ files:
971
987
  - tests/openstack/requests/identity/tenant_tests.rb
972
988
  - tests/openstack/requests/identity/user_tests.rb
973
989
  - tests/openstack/requests/image/image_tests.rb
990
+ - tests/openstack/requests/introspection/introspection_tests.rb
991
+ - tests/openstack/requests/introspection/rules_tests.rb
974
992
  - tests/openstack/requests/metering/event_tests.rb
975
993
  - tests/openstack/requests/metering/meter_tests.rb
976
994
  - tests/openstack/requests/metering/resource_tests.rb