fog-openstack 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -28
  3. data/docs/workflow.md +129 -0
  4. data/examples/workflow/workflow-examples.rb +387 -0
  5. data/gemfiles/Gemfile-1.9 +1 -0
  6. data/lib/fog/openstack.rb +5 -1
  7. data/lib/fog/openstack/baremetal.rb +14 -38
  8. data/lib/fog/openstack/compute.rb +4 -33
  9. data/lib/fog/openstack/core.rb +104 -50
  10. data/lib/fog/openstack/identity.rb +2 -1
  11. data/lib/fog/openstack/identity_v2.rb +0 -2
  12. data/lib/fog/openstack/identity_v3.rb +0 -2
  13. data/lib/fog/openstack/image_v1.rb +6 -6
  14. data/lib/fog/openstack/image_v2.rb +7 -6
  15. data/lib/fog/openstack/introspection.rb +10 -35
  16. data/lib/fog/openstack/metering.rb +16 -35
  17. data/lib/fog/openstack/monitoring.rb +5 -31
  18. data/lib/fog/openstack/network.rb +5 -34
  19. data/lib/fog/openstack/nfv.rb +10 -35
  20. data/lib/fog/openstack/orchestration.rb +5 -40
  21. data/lib/fog/openstack/planning.rb +11 -36
  22. data/lib/fog/openstack/requests/compute/get_limits.rb +8 -7
  23. data/lib/fog/openstack/requests/network/update_router.rb +1 -1
  24. data/lib/fog/openstack/requests/workflow_v2/create_action.rb +28 -0
  25. data/lib/fog/openstack/requests/workflow_v2/create_action_execution.rb +31 -0
  26. data/lib/fog/openstack/requests/workflow_v2/create_cron_trigger.rb +55 -0
  27. data/lib/fog/openstack/requests/workflow_v2/create_environment.rb +31 -0
  28. data/lib/fog/openstack/requests/workflow_v2/create_execution.rb +30 -0
  29. data/lib/fog/openstack/requests/workflow_v2/create_workbook.rb +28 -0
  30. data/lib/fog/openstack/requests/workflow_v2/create_workflow.rb +28 -0
  31. data/lib/fog/openstack/requests/workflow_v2/delete_action.rb +25 -0
  32. data/lib/fog/openstack/requests/workflow_v2/delete_action_execution.rb +25 -0
  33. data/lib/fog/openstack/requests/workflow_v2/delete_cron_trigger.rb +25 -0
  34. data/lib/fog/openstack/requests/workflow_v2/delete_environment.rb +25 -0
  35. data/lib/fog/openstack/requests/workflow_v2/delete_execution.rb +25 -0
  36. data/lib/fog/openstack/requests/workflow_v2/delete_workbook.rb +25 -0
  37. data/lib/fog/openstack/requests/workflow_v2/delete_workflow.rb +25 -0
  38. data/lib/fog/openstack/requests/workflow_v2/get_action.rb +27 -0
  39. data/lib/fog/openstack/requests/workflow_v2/get_action_execution.rb +26 -0
  40. data/lib/fog/openstack/requests/workflow_v2/get_cron_trigger.rb +28 -0
  41. data/lib/fog/openstack/requests/workflow_v2/get_environment.rb +28 -0
  42. data/lib/fog/openstack/requests/workflow_v2/get_execution.rb +26 -0
  43. data/lib/fog/openstack/requests/workflow_v2/get_task.rb +27 -0
  44. data/lib/fog/openstack/requests/workflow_v2/get_workbook.rb +28 -0
  45. data/lib/fog/openstack/requests/workflow_v2/get_workflow.rb +28 -0
  46. data/lib/fog/openstack/requests/workflow_v2/list_action_executions.rb +28 -0
  47. data/lib/fog/openstack/requests/workflow_v2/list_actions.rb +30 -0
  48. data/lib/fog/openstack/requests/workflow_v2/list_cron_triggers.rb +28 -0
  49. data/lib/fog/openstack/requests/workflow_v2/list_environments.rb +28 -0
  50. data/lib/fog/openstack/requests/workflow_v2/list_executions.rb +28 -0
  51. data/lib/fog/openstack/requests/workflow_v2/list_services.rb +28 -0
  52. data/lib/fog/openstack/requests/workflow_v2/list_tasks.rb +28 -0
  53. data/lib/fog/openstack/requests/workflow_v2/list_workbooks.rb +28 -0
  54. data/lib/fog/openstack/requests/workflow_v2/list_workflows.rb +30 -0
  55. data/lib/fog/openstack/requests/workflow_v2/rerun_task.rb +33 -0
  56. data/lib/fog/openstack/requests/workflow_v2/update_action.rb +28 -0
  57. data/lib/fog/openstack/requests/workflow_v2/update_action_execution.rb +33 -0
  58. data/lib/fog/openstack/requests/workflow_v2/update_environment.rb +31 -0
  59. data/lib/fog/openstack/requests/workflow_v2/update_execution.rb +33 -0
  60. data/lib/fog/openstack/requests/workflow_v2/update_workbook.rb +28 -0
  61. data/lib/fog/openstack/requests/workflow_v2/update_workflow.rb +28 -0
  62. data/lib/fog/openstack/requests/workflow_v2/validate_action.rb +28 -0
  63. data/lib/fog/openstack/requests/workflow_v2/validate_workbook.rb +28 -0
  64. data/lib/fog/openstack/requests/workflow_v2/validate_workflow.rb +28 -0
  65. data/lib/fog/openstack/storage.rb +4 -35
  66. data/lib/fog/openstack/version.rb +1 -1
  67. data/lib/fog/openstack/volume_v1.rb +7 -5
  68. data/lib/fog/openstack/volume_v2.rb +7 -5
  69. data/lib/fog/openstack/workflow.rb +12 -0
  70. data/lib/fog/openstack/workflow_v2.rb +160 -0
  71. metadata +48 -95
  72. data/lib/fog/openstack/common.rb +0 -44
  73. data/tests/openstack/models/compute/images_tests.rb +0 -13
  74. data/tests/openstack/models/compute/security_group_tests.rb +0 -54
  75. data/tests/openstack/models/compute/server_tests.rb +0 -220
  76. data/tests/openstack/models/compute/service_tests.rb +0 -17
  77. data/tests/openstack/models/image/image_tests.rb +0 -36
  78. data/tests/openstack/models/image/images_tests.rb +0 -19
  79. data/tests/openstack/models/network/floating_ip_tests.rb +0 -35
  80. data/tests/openstack/models/network/floating_ips_tests.rb +0 -19
  81. data/tests/openstack/models/network/ike_policies_tests.rb +0 -28
  82. data/tests/openstack/models/network/ike_policy_tests.rb +0 -36
  83. data/tests/openstack/models/network/ipsec_policies_tests.rb +0 -26
  84. data/tests/openstack/models/network/ipsec_policy_tests.rb +0 -36
  85. data/tests/openstack/models/network/ipsec_site_connection_tests.rb +0 -50
  86. data/tests/openstack/models/network/ipsec_site_connections_tests.rb +0 -32
  87. data/tests/openstack/models/network/lb_health_monitor_tests.rb +0 -52
  88. data/tests/openstack/models/network/lb_health_monitors_tests.rb +0 -21
  89. data/tests/openstack/models/network/lb_member_tests.rb +0 -28
  90. data/tests/openstack/models/network/lb_members_tests.rb +0 -21
  91. data/tests/openstack/models/network/lb_pool_tests.rb +0 -53
  92. data/tests/openstack/models/network/lb_pools_tests.rb +0 -20
  93. data/tests/openstack/models/network/lb_vip_tests.rb +0 -39
  94. data/tests/openstack/models/network/lb_vips_tests.rb +0 -21
  95. data/tests/openstack/models/network/network_tests.rb +0 -61
  96. data/tests/openstack/models/network/networks_tests.rb +0 -21
  97. data/tests/openstack/models/network/port_tests.rb +0 -28
  98. data/tests/openstack/models/network/ports_tests.rb +0 -25
  99. data/tests/openstack/models/network/router_tests.rb +0 -39
  100. data/tests/openstack/models/network/routers_tests.rb +0 -21
  101. data/tests/openstack/models/network/security_group_rule_tests.rb +0 -27
  102. data/tests/openstack/models/network/security_group_rules_tests.rb +0 -25
  103. data/tests/openstack/models/network/security_group_tests.rb +0 -17
  104. data/tests/openstack/models/network/security_groups_tests.rb +0 -16
  105. data/tests/openstack/models/network/subnet_tests.rb +0 -30
  106. data/tests/openstack/models/network/subnets_tests.rb +0 -27
  107. data/tests/openstack/models/network/vpn_service_tests.rb +0 -27
  108. data/tests/openstack/models/network/vpn_services_tests.rb +0 -22
  109. data/tests/openstack/models/nfv/vnf_tests.rb +0 -35
  110. data/tests/openstack/models/nfv/vnfd_tests.rb +0 -23
  111. data/tests/openstack/models/nfv/vnfds_tests.rb +0 -31
  112. data/tests/openstack/models/nfv/vnfs_tests.rb +0 -38
  113. data/tests/openstack/models/planning/.gitkeep +0 -0
  114. data/tests/openstack/models/planning/plan_tests.rb +0 -51
  115. data/tests/openstack/models/planning/plans_tests.rb +0 -18
  116. data/tests/openstack/models/planning/role_tests.rb +0 -14
  117. data/tests/openstack/models/storage/file_tests.rb +0 -251
  118. data/tests/openstack/requests/compute/address_tests.rb +0 -58
  119. data/tests/openstack/requests/compute/aggregate_tests.rb +0 -59
  120. data/tests/openstack/requests/compute/availability_zone_tests.rb +0 -18
  121. data/tests/openstack/requests/compute/flavor_tests.rb +0 -95
  122. data/tests/openstack/requests/compute/helper.rb +0 -41
  123. data/tests/openstack/requests/compute/image_tests.rb +0 -58
  124. data/tests/openstack/requests/compute/keypair_tests.rb +0 -30
  125. data/tests/openstack/requests/compute/limit_tests.rb +0 -59
  126. data/tests/openstack/requests/compute/quota_tests.rb +0 -60
  127. data/tests/openstack/requests/compute/security_group_tests.rb +0 -61
  128. data/tests/openstack/requests/compute/server_tests.rb +0 -289
  129. data/tests/openstack/requests/compute/service_tests.rb +0 -33
  130. data/tests/openstack/requests/compute/tenant_tests.rb +0 -19
  131. data/tests/openstack/requests/compute/volume_tests.rb +0 -38
  132. data/tests/openstack/requests/image/image_tests.rb +0 -135
  133. data/tests/openstack/requests/metering/event_tests.rb +0 -17
  134. data/tests/openstack/requests/metering/meter_tests.rb +0 -52
  135. data/tests/openstack/requests/metering/resource_tests.rb +0 -19
  136. data/tests/openstack/requests/network/ike_policy_tests.rb +0 -65
  137. data/tests/openstack/requests/network/ipsec_policy_tests.rb +0 -65
  138. data/tests/openstack/requests/network/ipsec_site_connection_tests.rb +0 -82
  139. data/tests/openstack/requests/network/lb_health_monitor_tests.rb +0 -93
  140. data/tests/openstack/requests/network/lb_member_tests.rb +0 -60
  141. data/tests/openstack/requests/network/lb_pool_tests.rb +0 -80
  142. data/tests/openstack/requests/network/lb_vip_tests.rb +0 -71
  143. data/tests/openstack/requests/network/network_tests.rb +0 -107
  144. data/tests/openstack/requests/network/port_tests.rb +0 -66
  145. data/tests/openstack/requests/network/quota_tests.rb +0 -65
  146. data/tests/openstack/requests/network/router_tests.rb +0 -73
  147. data/tests/openstack/requests/network/security_group_rule_tests.rb +0 -58
  148. data/tests/openstack/requests/network/security_group_tests.rb +0 -43
  149. data/tests/openstack/requests/network/subnet_tests.rb +0 -66
  150. data/tests/openstack/requests/network/vpn_service_tests.rb +0 -61
  151. data/tests/openstack/requests/nfv/vnf_tests.rb +0 -70
  152. data/tests/openstack/requests/nfv/vnfd_tests.rb +0 -44
  153. data/tests/openstack/requests/orchestration/stack_tests.rb +0 -64
  154. data/tests/openstack/requests/planning/.gitkeep +0 -0
  155. data/tests/openstack/requests/planning/plan_tests.rb +0 -65
  156. data/tests/openstack/requests/planning/role_tests.rb +0 -16
  157. data/tests/openstack/requests/storage/container_tests.rb +0 -64
  158. data/tests/openstack/requests/storage/large_object_tests.rb +0 -372
  159. data/tests/openstack/requests/storage/object_tests.rb +0 -208
  160. data/tests/openstack/requests/volume/availability_zone_tests.rb +0 -13
  161. data/tests/openstack/requests/volume/quota_tests.rb +0 -50
  162. data/tests/openstack/requests/volume/volume_type_tests.rb +0 -32
@@ -1,18 +0,0 @@
1
- Shindo.tests('Fog::Compute[:openstack] | availability zone requests', ['openstack']) do
2
-
3
- @flavor_format = {
4
- 'zoneName' => String,
5
- 'hosts' => Fog::Nullable::Hash,
6
- 'zoneState' => Hash,
7
- }
8
-
9
- tests('success') do
10
- tests('#list_zones').data_matches_schema({'availabilityZoneInfo' => [@flavor_format]}) do
11
- Fog::Compute[:openstack].list_zones.body
12
- end
13
-
14
- tests('#list_zones_detailed').data_matches_schema({'availabilityZoneInfo' => [@flavor_format]}) do
15
- Fog::Compute[:openstack].list_zones_detailed.body
16
- end
17
- end
18
- end
@@ -1,95 +0,0 @@
1
- Shindo.tests('Fog::Compute[:openstack] | flavor requests', ['openstack']) do
2
-
3
- @flavor_format = {
4
- 'id' => String,
5
- 'name' => String,
6
- 'disk' => Integer,
7
- 'ram' => Integer,
8
- 'links' => Array,
9
- 'swap' => Fog::Nullable::String,
10
- 'rxtx_factor' => Fog::Nullable::Float,
11
- 'OS-FLV-EXT-DATA:ephemeral' => Integer,
12
- 'os-flavor-access:is_public' => Fog::Nullable::Boolean,
13
- 'OS-FLV-DISABLED:disabled' => Fog::Nullable::Boolean,
14
- 'vcpus' => Integer
15
- }
16
-
17
- tests('success') do
18
-
19
- tests('#get_flavor_details(1)').data_matches_schema(@flavor_format) do
20
- Fog::Compute[:openstack].get_flavor_details("1").body['flavor']
21
- end
22
-
23
- tests('#list_flavors').data_matches_schema({'flavors' => [OpenStack::Compute::Formats::SUMMARY]}) do
24
- Fog::Compute[:openstack].list_flavors.body
25
- end
26
-
27
- tests('#list_flavors_detail').data_matches_schema({'flavors' => [@flavor_format]}) do
28
- Fog::Compute[:openstack].list_flavors_detail.body
29
- end
30
-
31
- tests('#create_flavor(attributes)').data_matches_schema({'flavor' => @flavor_format}) do
32
- attributes = {:flavor_id => '100', :name => 'shindo test flavor', :disk => 10, :ram => 10, :vcpus => 10, :swap => "0", :rxtx_factor => 2.4, :ephemeral => 0, :is_public => false}
33
- Fog::Compute[:openstack].create_flavor(attributes).body
34
- end
35
-
36
- tests('add_flavor_access(flavor_ref, tenant_id)').data_matches_schema({'flavor_access' => [{'tenant_id' => String, 'flavor_id' => String}]}) do
37
- Fog::Compute[:openstack].add_flavor_access(100, 1).body
38
- end
39
-
40
- tests('remove_flavor_access(flavor_ref, tenant_id)').data_matches_schema({'flavor_access' => []}) do
41
- Fog::Compute[:openstack].remove_flavor_access(100, 1).body
42
- end
43
-
44
- tests('list_tenants_with_flavor_access(flavor_ref)').data_matches_schema({'flavor_access' => [{'tenant_id' => String, 'flavor_id' => String}]}) do
45
- Fog::Compute[:openstack].list_tenants_with_flavor_access(100).body
46
- end
47
-
48
- tests('delete_flavor(flavor_id)').succeeds do
49
- Fog::Compute[:openstack].delete_flavor('100')
50
- end
51
-
52
- tests('#get_flavor_metadata(flavor_ref)').data_matches_schema('extra_specs' => {'cpu_arch' => String}) do
53
- Fog::Compute[:openstack].get_flavor_metadata("1").body
54
- end
55
-
56
- tests('#create_flavor_metadata(flavor_ref, metadata)').data_matches_schema('extra_specs' => {'cpu_arch' => String}) do
57
- metadata = {:cpu_arch => 'x86_64'}
58
- Fog::Compute[:openstack].create_flavor_metadata("1", metadata).body
59
- end
60
- end
61
-
62
- tests('failure') do
63
-
64
- tests('#get_flavor_details(0)').raises(Fog::Compute::OpenStack::NotFound) do
65
- Fog::Compute[:openstack].get_flavor_details("0")
66
- end
67
-
68
- tests('add_flavor_access(1234, 1)').raises(Fog::Compute::OpenStack::NotFound) do
69
- pending if Fog.mocking?
70
- Fog::Compute[:openstack].add_flavor_access(1234, 1).body
71
- end
72
-
73
- tests('remove_flavor_access(1234, 1)').raises(Fog::Compute::OpenStack::NotFound) do
74
- pending if Fog.mocking?
75
- Fog::Compute[:openstack].remove_flavor_access(1234, 1).body
76
- end
77
-
78
- tests('list_tenants_with_flavor_access(1234)').raises(Fog::Compute::OpenStack::NotFound) do
79
- pending if Fog.mocking?
80
- Fog::Compute[:openstack].list_tenants_with_flavor_access(1234)
81
- end
82
-
83
- tests('get_flavor_metadata(flavor_ref)').raises(Fog::Compute::OpenStack::NotFound) do
84
- pending if Fog.mocking?
85
- Fog::Compute[:openstack].get_flavor_metadata("1234").body
86
- end
87
-
88
- tests('create_flavor_metadata(flavor_ref)').raises(Fog::Compute::OpenStack::NotFound) do
89
- pending if Fog.mocking?
90
- metadata = {:cpu_arch => 'x86_64'}
91
- Fog::Compute[:openstack].create_flavor_metadata("1234", metadata).body
92
- end
93
- end
94
-
95
- end
@@ -1,41 +0,0 @@
1
- class OpenStack
2
- module Compute
3
- module Formats
4
- SUMMARY = {
5
- 'id' => String,
6
- 'name' => String,
7
- 'links' => Array
8
- }
9
- end
10
- end
11
- end
12
-
13
- def compute
14
- Fog::Compute[:openstack]
15
- end
16
-
17
- def get_flavor_ref
18
- ENV['OPENSTACK_FLAVOR_REF'] || compute.list_flavors.body['flavors'].first['id']
19
- end
20
-
21
- def get_image_ref
22
- ENV['OPENSTACK_IMAGE_REF'] || compute.list_images.body['images'].first['id']
23
- end
24
-
25
- def get_volume_ref
26
- ENV['OPENSTACK_VOLUME_REF'] || compute.list_volumes.body['volumes'].first['id']
27
- end
28
-
29
- def get_flavor_ref_resize
30
- # by default we simply add one to the default flavor ref
31
- ENV['OPENSTACK_FLAVOR_REF_RESIZE'] || (get_flavor_ref.to_i + 1).to_s
32
- end
33
-
34
- def set_password_enabled
35
- pw_enabled = ENV['OPENSTACK_SET_PASSWORD_ENABLED'] || "true"
36
- return pw_enabled == "true"
37
- end
38
-
39
- def get_security_group_ref
40
- ENV['OPENSTACK_SECURITY_GROUP_REF'] || compute.list_security_groups.body['security_groups'].first['name']
41
- end
@@ -1,58 +0,0 @@
1
- require 'fog/openstack'
2
-
3
- Shindo.tests('Fog::Compute[:openstack] | image requests', ['openstack']) do
4
-
5
- @image_format = {
6
- 'created' => Fog::Nullable::String,
7
- 'id' => String,
8
- 'name' => String,
9
- 'progress' => Fog::Nullable::Integer,
10
- 'status' => String,
11
- 'updated' => String,
12
- 'minRam' => Integer,
13
- 'minDisk' => Integer,
14
- 'server' => Fog::Nullable::Hash,
15
- 'metadata' => Hash,
16
- 'links' => Array
17
- }
18
-
19
- tests('success') do
20
- # Setup
21
- @image_id = Fog::Compute[:openstack].images[0].id
22
- unless Fog.mocking?
23
- Fog::Compute[:openstack].images.get(@image_id).wait_for { ready? }
24
- end
25
-
26
- tests("#get_image_details(#{@image_id})").formats(@image_format) do
27
- pending if Fog.mocking?
28
- Fog::Compute[:openstack].get_image_details(@image_id).body['image']
29
- end
30
-
31
- tests('#list_images').formats({'images' => [OpenStack::Compute::Formats::SUMMARY]}) do
32
- Fog::Compute[:openstack].list_images.body
33
- end
34
-
35
- tests('#list_images_detail').formats({'images' => [@image_format]}) do
36
- Fog::Compute[:openstack].list_images_detail.body
37
- end
38
-
39
- # Teardown
40
- unless Fog.mocking?
41
- Fog::Compute[:openstack].images.get(@image_id).wait_for { ready? }
42
- end
43
- end
44
-
45
- tests('failure') do
46
- tests('#delete_image(0)').raises(Fog::Compute::OpenStack::NotFound) do
47
- pending if Fog.mocking?
48
- Fog::Compute[:openstack].delete_image(0)
49
- end
50
-
51
- tests('#get_image_details(0)').raises(Fog::Compute::OpenStack::NotFound) do
52
- pending if Fog.mocking?
53
- Fog::Compute[:openstack].get_image_details(0)
54
- end
55
-
56
- end
57
-
58
- end
@@ -1,30 +0,0 @@
1
- Shindo.tests('Fog::Compute[:openstack] | keypair requests', ['openstack']) do
2
-
3
- @keypair_format = {
4
- "public_key" => String,
5
- "private_key" => String,
6
- "user_id" => String,
7
- "name" => String,
8
- "fingerprint" => String
9
- }
10
-
11
- @keypair_list_format = {
12
- "public_key" => String,
13
- "name" => String,
14
- "fingerprint" => String
15
- }
16
-
17
- tests('success') do
18
- tests('#create_key_pair((key_name, public_key = nil))').formats({"keypair" => @keypair_format}) do
19
- Fog::Compute[:openstack].create_key_pair('from_shindo_test').body
20
- end
21
-
22
- tests('#list_key_pairs').formats({"keypairs" => [{"keypair" => @keypair_list_format}]}) do
23
- Fog::Compute[:openstack].list_key_pairs.body
24
- end
25
-
26
- tests('#delete_key_pair(key_name)').succeeds do
27
- Fog::Compute[:openstack].delete_key_pair('from_shindo_test')
28
- end
29
- end
30
- end
@@ -1,59 +0,0 @@
1
- Shindo.tests('Fog::Compute[:openstack] | limits requests', ['openstack']) do
2
- @rate_limit_format = {
3
- 'regex' => String,
4
- 'uri' => String,
5
- 'limit' => Array
6
- }
7
-
8
- @rate_limit_usage_format = {
9
- 'next-available' => String,
10
- 'unit' => String,
11
- 'verb' => String,
12
- 'remaining' => Fixnum,
13
- 'value' => Fixnum
14
- }
15
-
16
- @absolute_limits_format = {
17
- 'maxServerMeta' => Fixnum,
18
- 'maxTotalInstances' => Fixnum,
19
- 'maxPersonality' => Fixnum,
20
- 'maxImageMeta' => Fixnum,
21
- 'maxPersonalitySize' => Fixnum,
22
- 'maxSecurityGroupRules' => Fixnum,
23
- 'maxTotalKeypairs' => Fixnum,
24
- 'maxSecurityGroups' => Fixnum,
25
- 'maxTotalCores' => Fixnum,
26
- 'maxTotalFloatingIps' => Fixnum,
27
- 'maxTotalRAMSize' => Fixnum,
28
- 'totalCoresUsed' => Fixnum,
29
- 'totalRAMUsed' => Fixnum,
30
- 'totalInstancesUsed' => Fixnum,
31
- 'totalSecurityGroupsUsed' => Fixnum,
32
- 'totalFloatingIpsUsed' => Fixnum
33
- }
34
-
35
- @limits_format = {
36
- 'rate' => Array,
37
- 'absolute' => Hash
38
- }
39
-
40
- tests('success') do
41
- tests('#get_limits') do
42
- tests('format').formats(@limits_format) do
43
- Fog::Compute[:openstack].get_limits.body['limits']
44
- end
45
-
46
- tests('rate limit format').formats(@rate_limit_format) do
47
- Fog::Compute[:openstack].get_limits.body['limits']['rate'].first
48
- end
49
-
50
- tests('rate limit usage format').formats(@rate_limit_usage_format) do
51
- Fog::Compute[:openstack].get_limits.body['limits']['rate'].first['limit'].first
52
- end
53
-
54
- tests('absolute limits format').formats(@absolute_limits_format) do
55
- Fog::Compute[:openstack].get_limits.body['limits']['absolute']
56
- end
57
- end
58
- end
59
- end
@@ -1,60 +0,0 @@
1
- Shindo.tests('Fog::Compute[:openstack] | quota requests', ['openstack']) do
2
-
3
- @tenant_id = Fog::Compute[:openstack].list_tenants.body['tenants'].first['id']
4
- @quota_set_format = {
5
- 'key_pairs' => Fixnum,
6
- 'metadata_items' => Fixnum,
7
- 'injected_file_content_bytes' => Fixnum,
8
- 'injected_file_path_bytes' => Fixnum,
9
- 'injected_files' => Fixnum,
10
- 'ram' => Fixnum,
11
- 'floating_ips' => Fixnum,
12
- 'instances' => Fixnum,
13
- 'cores' => Fixnum,
14
- 'security_groups' => Fog::Nullable::Integer,
15
- 'security_group_rules' => Fog::Nullable::Integer,
16
- 'volumes' => Fog::Nullable::Integer,
17
- 'gigabytes' => Fog::Nullable::Integer,
18
- 'id' => String
19
- }
20
-
21
- tests('success') do
22
-
23
- tests('#get_quota_defaults').formats({ 'quota_set' => @quota_set_format }) do
24
- Fog::Compute[:openstack].get_quota_defaults(@tenant_id).body
25
- end
26
-
27
- tests('#get_quota').formats(@quota_set_format) do
28
- @quota = Fog::Compute[:openstack].get_quota(@tenant_id).body['quota_set']
29
- @quota
30
- end
31
-
32
- tests('#update_quota') do
33
-
34
- new_values = @quota.merge({
35
- 'floating_ips' => @quota['floating_ips']/2,
36
- 'cores' => @quota['cores']/2
37
- })
38
-
39
- succeeds do
40
- Fog::Compute[:openstack].update_quota(@tenant_id, new_values.clone)
41
- end
42
-
43
- returns(new_values, 'returns new values') do
44
- Fog::Compute[:openstack].get_quota(@tenant_id).body['quota_set']
45
- end
46
-
47
- # set quota back to old values
48
- succeeds do
49
- Fog::Compute[:openstack].update_quota(@tenant_id, @quota.clone)
50
- end
51
-
52
- # ensure old values are restored
53
- returns(@quota, 'old values restored') do
54
- Fog::Compute[:openstack].get_quota(@tenant_id).body['quota_set']
55
- end
56
-
57
- end
58
-
59
- end
60
- end
@@ -1,61 +0,0 @@
1
- Shindo.tests('Fog::Compute[:openstack] | security group requests', ['openstack']) do
2
- @security_group = Hash.new
3
- @security_group_rule = Hash.new
4
- @security_group_format = {
5
- "id" => Integer,
6
- "rules" => Array,
7
- "tenant_id" => String,
8
- "name" => String,
9
- "description" => String
10
- }
11
-
12
- @security_group_rule_format = {
13
- "id" => Integer,
14
- "from_port" => Integer,
15
- "to_port" => Integer,
16
- "ip_protocol" => String,
17
- "group" => Hash,
18
- "ip_range" => Hash,
19
- "parent_group_id" => Integer
20
- }
21
-
22
- tests('success') do
23
- tests('#create_security_group(name, description)').formats({"security_group" => @security_group_format}) do
24
- security_group = Fog::Compute[:openstack].create_security_group('from_shindo_test', 'this is from the shindo test').body
25
- @security_group_id = security_group['security_group']['id']
26
- security_group
27
- end
28
-
29
- tests('#create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group_id=nil)').formats({"security_group_rule" => @security_group_rule_format}) do
30
- security_group_rule = Fog::Compute[:openstack].create_security_group_rule(@security_group_id, "tcp", 2222, 3333, "20.20.20.20/24").body
31
- @security_group_rule_id = security_group_rule['security_group_rule']['id']
32
- security_group_rule
33
- end
34
-
35
- tests('#list_security_groups').formats({"security_groups" => [@security_group_format]}) do
36
- Fog::Compute[:openstack].list_security_groups.body
37
- end
38
-
39
- tests('#get_security_group(security_group_id)').formats({"security_group" => @security_group_format}) do
40
- Fog::Compute[:openstack].get_security_group(@security_group_id).body
41
- end
42
-
43
- tests('#get_security_group_rule').formats({"security_group_rule" => @security_group_rule_format}) do
44
- Fog::Compute[:openstack].create_security_group_rule(@security_group_id, "tcp", 2222, 3333, "20.20.20.20/24").body
45
- Fog::Compute[:openstack].get_security_group_rule(@security_group_rule_id).body
46
- end
47
-
48
- tests('#delete_security_group_rule(security_group_rule_id)').succeeds do
49
- Fog::Compute[:openstack].delete_security_group_rule(@security_group_rule_id)
50
- end
51
-
52
- tests('#delete_security_group(security_group_id)').succeeds do
53
- Fog::Compute[:openstack].delete_security_group(@security_group_id)
54
-
55
- returns(false) {
56
- groups = Fog::Compute[:openstack].list_security_groups.body['security_groups']
57
- groups.any? { |group| group['id'] == @security_group_id }
58
- }
59
- end
60
- end # tests('success')
61
- end
@@ -1,289 +0,0 @@
1
- Shindo.tests('Fog::Compute[:openstack] | server requests', ['openstack']) do
2
-
3
- @base_server_format = {
4
- 'id' => String,
5
- 'addresses' => Hash,
6
- 'flavor' => Hash,
7
- 'hostId' => String,
8
- 'metadata' => Hash,
9
- 'name' => String,
10
- 'progress' => Integer,
11
- 'status' => String,
12
- 'accessIPv4' => Fog::Nullable::String,
13
- 'accessIPv6' => Fog::Nullable::String,
14
- 'links' => Array,
15
- 'created' => String,
16
- 'updated' => String,
17
- 'user_id' => String,
18
- 'config_drive' => String,
19
- }
20
-
21
- @server_from_image_format = @base_server_format.merge('image' => Hash)
22
-
23
- @create_format = {
24
- 'adminPass' => String,
25
- 'id' => String,
26
- 'links' => Array,
27
- 'security_groups' => Fog::Nullable::Array,
28
- }
29
-
30
- @reservation_format = {
31
- 'reservation_id' => String,
32
- }
33
-
34
- @image_format = {
35
- 'created' => Fog::Nullable::String,
36
- 'id' => String,
37
- 'name' => String,
38
- 'progress' => Fog::Nullable::Integer,
39
- 'status' => String,
40
- 'updated' => String,
41
- 'minRam' => Integer,
42
- 'minDisk' => Integer,
43
- 'server' => Hash,
44
- 'metadata' => Hash,
45
- 'links' => Array
46
- }
47
-
48
- tests('success') do
49
-
50
- @image_id = get_image_ref
51
- @snapshot_id = nil
52
- @flavor_id = get_flavor_ref
53
- @security_group_name = get_security_group_ref
54
-
55
- #CREATE_SERVER_WITH_BLOCK_DEVICE_MAPPING
56
- tests('#create_server("test", nil , #{@flavor_id}) with a block_device_mapping').formats(@create_format, false) do
57
- @volume1_id = compute.create_volume('test', 'this is a test volume', 1).body["volume"]["id"]
58
- volume_data = {
59
- :delete_on_termination => true,
60
- :device_name => "vda",
61
- :volume_id => @volume1_id,
62
- :volume_size => 1,
63
- }
64
- data = compute.create_server("test", nil, @flavor_id, "block_device_mapping" => volume_data).body['server']
65
- @server_id = data['id']
66
- data
67
- end
68
-
69
- tests("#get_server_details(#{@server_id})").formats(@base_server_format, false) do
70
- compute.get_server_details(@server_id).body['server']
71
- end
72
-
73
- tests("#block_device_mapping").succeeds do
74
- compute.servers.get(@server_id).volumes.first.id == @volume1_id
75
- end
76
-
77
- #CREATE_SERVER_WITH_BLOCK_DEVICE_MAPPING_V2
78
- tests('#create_server("test", nil , #{@flavor_id}) with multiple block_device_mapping_v2').formats(@create_format, false) do
79
- @volume2_id = compute.create_volume('test', 'this is a test volume', 1).body["volume"]["id"]
80
- volume_data = [{
81
- :boot_index => 0,
82
- :uuid => @volume1_id,
83
- :device_name => "vda",
84
- :source_type => "volume",
85
- :destination_type => "volume",
86
- :delete_on_termination => true,
87
- :volume_size => 20
88
- }, {
89
- :boot_index => 1,
90
- :uuid => @volume2_id,
91
- :device_name => "vdb",
92
- :source_type => "volume",
93
- :destination_type => "volume",
94
- :delete_on_termination => true,
95
- :volume_size => 10
96
- }]
97
- data = compute.create_server("test", nil, @flavor_id, "block_device_mapping_v2" => volume_data).body['server']
98
- @server_id = data['id']
99
- data
100
- end
101
-
102
- tests("#get_server_details(#{@server_id})").formats(@base_server_format, false) do
103
- compute.get_server_details(@server_id).body['server']
104
- end
105
-
106
- tests("#block_device_mapping_v2").succeeds do
107
- compute.servers.get(@server_id).volumes.collect(&:id).sort == [@volume1_id, @volume2_id].sort
108
- end
109
-
110
- #CREATE_SINGLE_FROM_IMAGE
111
- tests('#create_server("test", #{@image_id} , 19)').formats(@create_format, false) do
112
- data = Fog::Compute[:openstack].create_server("test", @image_id, @flavor_id).body['server']
113
- @server_id = data['id']
114
- data
115
- end
116
-
117
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? }
118
-
119
- tests("#get_server_details(#{@server_id})").formats(@server_from_image_format, false) do
120
- Fog::Compute[:openstack].get_server_details(@server_id).body['server']
121
- end
122
-
123
- #MULTI_CREATE_FROM_IMAGE
124
- tests('#create_server("test", #{@image_id} , 19, {"min_count" => 2, "return_reservation_id" => "True"})').formats(@reservation_format, false) do
125
- data = Fog::Compute[:openstack].create_server("test", @image_id, @flavor_id, {"min_count" => 2, "return_reservation_id" => "True"}).body
126
- @reservation_id = data['reservation_id']
127
- data
128
- end
129
-
130
- tests('#validate_multi_create') do
131
- passed = false
132
- @multi_create_servers = []
133
- if Fog.mocking?
134
- @multi_create_servers = [Fog::Mock.random_numbers(6).to_s, Fog::Mock.random_numbers(6).to_s]
135
- else
136
- @multi_create_servers = Fog::Compute[:openstack].list_servers_detail({'reservation_id' => @reservation_id}).body['servers'].map{|server| server['id']}
137
- end
138
- if (@multi_create_servers.size == 2)
139
- passed = true
140
- end
141
- end
142
- unless Fog.mocking?
143
- @multi_create_servers.each {|server|
144
- Fog::Compute[:openstack].servers.get(server).destroy
145
- }
146
- end
147
-
148
- #LIST
149
- #NOTE: we can remove strict=false if we remove uuid from GET /servers
150
- tests('#list_servers').formats({'servers' => [OpenStack::Compute::Formats::SUMMARY]}, false) do
151
- Fog::Compute[:openstack].list_servers.body
152
- end
153
-
154
- #DETAILS
155
- tests('#list_servers_detail').formats({'servers' => [@server_from_image_format]}, false) do
156
- Fog::Compute[:openstack].list_servers_detail.body
157
- end
158
-
159
- #CHANGE PASSWORD
160
- if set_password_enabled
161
- tests("#change_server_password(#{@server_id}, 'fogupdatedserver')").succeeds do
162
- Fog::Compute[:openstack].change_server_password(@server_id, 'foggy')
163
- end
164
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? }
165
- end
166
-
167
- #UPDATE SERVER NAME
168
- tests("#update_server(#{@server_id}, :name => 'fogupdatedserver')").succeeds do
169
- Fog::Compute[:openstack].update_server(@server_id, :name => 'fogupdatedserver')
170
- end
171
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? }
172
-
173
- #ADD SECURITY GROUP
174
- tests("#add_security_group(#{@server_id}, #{@security_group_name})").succeeds do
175
- Fog::Compute[:openstack].add_security_group(@server_id, @security_group_name)
176
- end
177
-
178
- #REMOVE SECURITY GROUP
179
- tests("#remove_security_group(#{@server_id}, #{@security_group_name})").succeeds do
180
- Fog::Compute[:openstack].remove_security_group(@server_id, @security_group_name)
181
- end
182
-
183
- #CREATE IMAGE WITH METADATA
184
- tests("#create_image(#{@server_id}, 'fog')").formats('image' => @image_format) do
185
- data = Fog::Compute[:openstack].create_image(@server_id, 'fog', {"foo" => "bar"}).body
186
- @snapshot_id = data['image']['id']
187
- data
188
- end
189
- Fog::Compute[:openstack].images.get(@snapshot_id).wait_for { ready? }
190
-
191
- #REBUILD
192
- tests("#rebuild_server(#{@server_id}, #{@snapshot_id}, 'fog')").formats({'server' => @server_from_image_format}, false) do
193
- Fog::Compute[:openstack].rebuild_server(@server_id, @snapshot_id, 'fog', 'newpass', {"foo" => "bar"}).body
194
- end
195
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking?
196
-
197
- #RESIZE
198
- tests("#resize_server(#{@server_id}, #{get_flavor_ref_resize})").succeeds do
199
- Fog::Compute[:openstack].resize_server(@server_id, get_flavor_ref_resize)
200
- end
201
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { self.state == 'VERIFY_RESIZE' } if not Fog.mocking?
202
-
203
- #RESIZE CONFIRM
204
- tests("#resize_confirm(#{@server_id}, #{get_flavor_ref_resize})").succeeds do
205
- Fog::Compute[:openstack].confirm_resize_server(@server_id)
206
- end
207
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking?
208
-
209
- #REBOOT - HARD
210
- tests("#reboot_server(#{@server_id}, 'HARD')").succeeds do
211
- Fog::Compute[:openstack].reboot_server(@server_id, 'HARD')
212
- end
213
-
214
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking?
215
-
216
- #REBOOT - SOFT
217
- tests("#reboot_server(#{@server_id}, 'SOFT')").succeeds do
218
- Fog::Compute[:openstack].reboot_server(@server_id, 'SOFT')
219
- end
220
-
221
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking?
222
-
223
- #STOP
224
- tests("#stop_server(#{@server_id})").succeeds do
225
- Fog::Compute[:openstack].stop_server(@server_id)
226
- end
227
-
228
- #START
229
- tests("#start_server(#{@server_id})").succeeds do
230
- Fog::Compute[:openstack].start_server(@server_id)
231
- end
232
-
233
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking?
234
-
235
- tests("#shelve_server(#{@server_id})").succeeds do
236
- Fog::Compute[:openstack].shelve_server(@server_id)
237
- end
238
-
239
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking?
240
-
241
- tests("#unshelve_server(#{@server_id})").succeeds do
242
- Fog::Compute[:openstack].unshelve_server(@server_id)
243
- end
244
-
245
- Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking?
246
-
247
- #DELETE
248
- tests("#delete_server(#{@server_id})").succeeds do
249
- Fog::Compute[:openstack].delete_server(@server_id)
250
- end
251
-
252
- #DELETE IMAGE
253
- tests("#delete_image(#{@snapshot_id})").succeeds do
254
- Fog::Compute[:openstack].delete_image(@snapshot_id)
255
- end
256
-
257
- end
258
-
259
- tests('failure') do
260
-
261
- tests('#delete_server(0)').raises(Fog::Compute::OpenStack::NotFound) do
262
- Fog::Compute[:openstack].delete_server(0)
263
- end
264
-
265
- tests('#get_server_details(0)').raises(Fog::Compute::OpenStack::NotFound) do
266
- Fog::Compute[:openstack].get_server_details(0)
267
- end
268
-
269
- tests("#update_server(0, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')").raises(Fog::Compute::OpenStack::NotFound) do
270
- Fog::Compute[:openstack].update_server(0, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')
271
- end
272
-
273
- tests('#reboot_server(0)').raises(Fog::Compute::OpenStack::NotFound) do
274
- pending if Fog.mocking?
275
- Fog::Compute[:openstack].reboot_server(0)
276
- end
277
-
278
- tests('#start_server(0)').raises(Fog::Compute::OpenStack::NotFound) do
279
- pending if Fog.mocking?
280
- Fog::Compute[:openstack].start_server(0)
281
- end
282
-
283
- tests('#stop_server(0)').raises(Fog::Compute::OpenStack::NotFound) do
284
- pending if Fog.mocking?
285
- Fog::Compute[:openstack].stop_server(0)
286
- end
287
- end
288
-
289
- end