fog-maestrodev 1.18.0.20131209091424 → 1.18.0.20131218202447

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. data/.gitignore +1 -0
  2. data/CONTRIBUTING.md +22 -0
  3. data/LICENSE.md +20 -0
  4. data/README.md +29 -42
  5. data/fog.gemspec +3 -3
  6. data/lib/fog/aws/compute.rb +1 -0
  7. data/lib/fog/aws/models/compute/subnet.rb +4 -0
  8. data/lib/fog/aws/models/compute/vpc.rb +5 -0
  9. data/lib/fog/aws/models/rds/server.rb +2 -0
  10. data/lib/fog/aws/models/storage/file.rb +2 -2
  11. data/lib/fog/aws/parsers/compute/assign_private_ip_addresses.rb +25 -0
  12. data/lib/fog/aws/requests/compute/assign_private_ip_addresses.rb +60 -0
  13. data/lib/fog/aws/requests/compute/describe_subnets.rb +8 -0
  14. data/lib/fog/aws/requests/compute/describe_vpcs.rb +8 -0
  15. data/lib/fog/cloudstack.rb +1 -1
  16. data/lib/fog/core/connection.rb +1 -2
  17. data/lib/fog/core/hmac.rb +3 -3
  18. data/lib/fog/core/mock.rb +2 -2
  19. data/lib/fog/core/wait_for.rb +1 -1
  20. data/lib/fog/core/{timeout.rb → wait_for_defaults.rb} +10 -0
  21. data/lib/fog/core.rb +1 -1
  22. data/lib/fog/google/compute.rb +19 -11
  23. data/lib/fog/google/examples/create.rb +12 -1
  24. data/lib/fog/google/examples/eric-fail.rb +13 -2
  25. data/lib/fog/google/examples/image_create.rb +0 -1
  26. data/lib/fog/google/examples/launch_micro_instance.rb +1 -2
  27. data/lib/fog/google/examples/metadata.rb +14 -2
  28. data/lib/fog/google/examples/network.rb +13 -2
  29. data/lib/fog/google/models/compute/disk.rb +10 -8
  30. data/lib/fog/google/models/compute/image.rb +8 -3
  31. data/lib/fog/google/models/compute/server.rb +19 -4
  32. data/lib/fog/google/models/compute/servers.rb +25 -9
  33. data/lib/fog/google/requests/compute/insert_disk.rb +6 -3
  34. data/lib/fog/google/requests/compute/insert_image.rb +1 -5
  35. data/lib/fog/google/requests/compute/insert_server.rb +8 -21
  36. data/lib/fog/openstack/compute.rb +3 -0
  37. data/lib/fog/openstack/models/compute/host.rb +1 -0
  38. data/lib/fog/openstack/models/compute/security_group.rb +18 -4
  39. data/lib/fog/openstack/models/compute/security_group_rule.rb +32 -0
  40. data/lib/fog/openstack/models/compute/security_group_rules.rb +22 -0
  41. data/lib/fog/openstack/network.rb +33 -3
  42. data/lib/fog/openstack/requests/compute/create_security_group.rb +3 -3
  43. data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +1 -1
  44. data/lib/fog/openstack/requests/compute/create_server.rb +12 -5
  45. data/lib/fog/openstack/requests/compute/delete_security_group.rb +1 -1
  46. data/lib/fog/openstack/requests/compute/delete_security_group_rule.rb +2 -0
  47. data/lib/fog/openstack/requests/compute/get_security_group.rb +14 -24
  48. data/lib/fog/openstack/requests/compute/get_security_group_rule.rb +38 -0
  49. data/lib/fog/openstack/requests/compute/list_hosts.rb +3 -3
  50. data/lib/fog/openstack/volume.rb +3 -1
  51. data/lib/fog/rackspace/docs/auto_scale.md +9 -9
  52. data/lib/fog/rackspace/docs/getting_started.md +1 -0
  53. data/lib/fog/rackspace/docs/queues.md +312 -0
  54. data/lib/fog/vcloud_director/README.md +2 -0
  55. data/lib/fog/vcloud_director/compute.rb +78 -8
  56. data/lib/fog/vcloud_director/generators/compute/org_vdc_network.rb +91 -0
  57. data/lib/fog/vcloud_director/generators/compute/vapp.rb +30 -0
  58. data/lib/fog/vcloud_director/models/compute/vm_customization.rb +2 -0
  59. data/lib/fog/vcloud_director/parsers/compute/vm_customization.rb +2 -0
  60. data/lib/fog/vcloud_director/requests/compute/delete_network.rb +64 -0
  61. data/lib/fog/vcloud_director/requests/compute/get_execute_query.rb +433 -333
  62. data/lib/fog/vcloud_director/requests/compute/get_vapp_metadata.rb +3 -1
  63. data/lib/fog/vcloud_director/requests/compute/post_attach_disk.rb +1 -1
  64. data/lib/fog/vcloud_director/requests/compute/post_create_org_vdc_network.rb +83 -0
  65. data/lib/fog/vcloud_director/requests/compute/post_detach_disk.rb +1 -1
  66. data/lib/fog/vcloud_director/requests/compute/post_eject_cd_rom.rb +1 -1
  67. data/lib/fog/vcloud_director/requests/compute/post_insert_cd_rom.rb +1 -1
  68. data/lib/fog/vcloud_director/requests/compute/put_guest_customization_section_vapp.rb +1 -0
  69. data/lib/fog/vcloud_director/requests/compute/put_vapp_name_and_description.rb +37 -0
  70. data/lib/fog/vsphere/models/compute/server.rb +1 -1
  71. data/lib/fog/xenserver/compute.rb +35 -0
  72. data/lib/fog/xenserver/models/compute/blob.rb +22 -0
  73. data/lib/fog/xenserver/models/compute/blobs.rb +25 -0
  74. data/lib/fog/xenserver/models/compute/bond.rb +23 -0
  75. data/lib/fog/xenserver/models/compute/bonds.rb +25 -0
  76. data/lib/fog/xenserver/models/compute/console.rb +3 -1
  77. data/lib/fog/xenserver/models/compute/crash_dump.rb +19 -0
  78. data/lib/fog/xenserver/models/compute/crash_dumps.rb +25 -0
  79. data/lib/fog/xenserver/models/compute/dr_task.rb +17 -0
  80. data/lib/fog/xenserver/models/compute/dr_tasks.rb +25 -0
  81. data/lib/fog/xenserver/models/compute/gpu_group.rb +22 -0
  82. data/lib/fog/xenserver/models/compute/gpu_groups.rb +25 -0
  83. data/lib/fog/xenserver/models/compute/guest_metrics.rb +2 -1
  84. data/lib/fog/xenserver/models/compute/host.rb +41 -8
  85. data/lib/fog/xenserver/models/compute/host_cpu.rb +2 -1
  86. data/lib/fog/xenserver/models/compute/host_crash_dump.rb +20 -0
  87. data/lib/fog/xenserver/models/compute/host_crash_dumps.rb +25 -0
  88. data/lib/fog/xenserver/models/compute/host_metrics.rb +1 -1
  89. data/lib/fog/xenserver/models/compute/host_patch.rb +25 -0
  90. data/lib/fog/xenserver/models/compute/host_patchs.rb +25 -0
  91. data/lib/fog/xenserver/models/compute/network.rb +7 -6
  92. data/lib/fog/xenserver/models/compute/pbd.rb +3 -1
  93. data/lib/fog/xenserver/models/compute/pci.rb +22 -0
  94. data/lib/fog/xenserver/models/compute/pcis.rb +25 -0
  95. data/lib/fog/xenserver/models/compute/pgpu.rb +20 -0
  96. data/lib/fog/xenserver/models/compute/pgpus.rb +25 -0
  97. data/lib/fog/xenserver/models/compute/pif.rb +19 -8
  98. data/lib/fog/xenserver/models/compute/pif_metrics.rb +28 -0
  99. data/lib/fog/xenserver/models/compute/pifs_metrics.rb +25 -0
  100. data/lib/fog/xenserver/models/compute/pool.rb +18 -1
  101. data/lib/fog/xenserver/models/compute/pool_patch.rb +24 -0
  102. data/lib/fog/xenserver/models/compute/pool_patchs.rb +25 -0
  103. data/lib/fog/xenserver/models/compute/role.rb +19 -0
  104. data/lib/fog/xenserver/models/compute/roles.rb +25 -0
  105. data/lib/fog/xenserver/models/compute/server.rb +59 -26
  106. data/lib/fog/xenserver/models/compute/server_appliance.rb +21 -0
  107. data/lib/fog/xenserver/models/compute/server_appliances.rb +25 -0
  108. data/lib/fog/xenserver/models/compute/storage_manager.rb +28 -0
  109. data/lib/fog/xenserver/models/compute/storage_managers.rb +25 -0
  110. data/lib/fog/xenserver/models/compute/storage_repository.rb +4 -1
  111. data/lib/fog/xenserver/models/compute/tunnel.rb +20 -0
  112. data/lib/fog/xenserver/models/compute/tunnels.rb +25 -0
  113. data/lib/fog/xenserver/models/compute/vbd.rb +3 -2
  114. data/lib/fog/xenserver/models/compute/vbd_metrics.rb +1 -1
  115. data/lib/fog/xenserver/models/compute/vdi.rb +4 -1
  116. data/lib/fog/xenserver/models/compute/vif.rb +11 -2
  117. data/lib/fog/xenserver/models/compute/vlan.rb +2 -1
  118. data/lib/fog/xenserver/models/compute/vmpp.rb +35 -0
  119. data/lib/fog/xenserver/models/compute/vmpps.rb +25 -0
  120. data/lib/fog/xenserver/models/compute/vtpm.rb +18 -0
  121. data/lib/fog/xenserver/models/compute/vtpms.rb +25 -0
  122. data/tests/aws/requests/compute/assign_private_ip_tests.rb +52 -0
  123. data/tests/google/models/compute/servers_tests.rb +12 -1
  124. data/tests/google/requests/compute/image_tests.rb +0 -1
  125. data/tests/helpers/mock_helper.rb +1 -1
  126. data/tests/openstack/models/compute/security_group_tests.rb +54 -0
  127. data/tests/openstack/requests/compute/security_group_tests.rb +22 -20
  128. data/tests/openstack/requests/network/network_tests.rb +8 -8
  129. data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +17 -8
  130. data/tests/vcloud_director/requests/compute/network_tests.rb +25 -1
  131. data/tests/vcloud_director/requests/compute/query_tests.rb +67 -2
  132. metadata +125 -132
  133. checksums.yaml +0 -15
@@ -6,15 +6,18 @@ module Fog
6
6
 
7
7
  class StorageRepository < Fog::Model
8
8
  # API Reference here:
9
- # http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/api/?c=SR
9
+ # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=SR
10
10
 
11
11
  identity :reference
12
12
 
13
13
  attribute :name, :aliases => :name_label
14
14
  attribute :description, :aliases => :name_description
15
15
  attribute :uuid
16
+ attribute :blobs
16
17
  attribute :allowed_operations
17
18
  attribute :current_operations
19
+ attribute :introduced_by
20
+ attribute :local_cache_enabled
18
21
  attribute :content_type
19
22
  attribute :other_config
20
23
  attribute :__pbds, :aliases => :PBDs
@@ -0,0 +1,20 @@
1
+ require 'fog/core/model'
2
+
3
+ module Fog
4
+ module Compute
5
+ class XenServer
6
+ class Tunnel < Fog::Model
7
+ # API Reference here:
8
+ # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=tunnel
9
+
10
+ identity :reference
11
+
12
+ attribute :access_pif, :aliases => :access_PIF
13
+ attribute :other_config
14
+ attribute :status
15
+ attribute :transport_pif, :aliases => :transport_PIF
16
+ attribute :uuid
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,25 @@
1
+ require 'fog/core/collection'
2
+ require 'fog/xenserver/models/compute/tunnel'
3
+
4
+ module Fog
5
+ module Compute
6
+ class XenServer
7
+ class Tunnels < Fog::Collection
8
+ model Fog::Compute::XenServer::Tunnel
9
+
10
+ def all(options={})
11
+ data = service.get_records 'tunnel'
12
+ load(data)
13
+ end
14
+
15
+ def get( tunnel_ref )
16
+ if tunnel_ref && tunnel = service.get_record( tunnel_ref, 'tunnel' )
17
+ new(tunnel)
18
+ else
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -6,7 +6,7 @@ module Fog
6
6
 
7
7
  class VBD < Fog::Model
8
8
  # API Reference here:
9
- # http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/api/?c=VBD
9
+ # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VBD
10
10
 
11
11
  identity :reference
12
12
 
@@ -22,8 +22,8 @@ module Fog
22
22
  attribute :type
23
23
  attribute :userdevice
24
24
  attribute :empty
25
- attribute :type
26
25
  attribute :mode
26
+ attribute :other_config
27
27
  attribute :storage_lock
28
28
  attribute :runtime_properties
29
29
  attribute :unpluggable
@@ -31,6 +31,7 @@ module Fog
31
31
  attribute :qos_supported_algorithms
32
32
  attribute :qos_algorithm_params
33
33
  attribute :qos_algorithm_type
34
+ attribute :qos_supported_algorithms
34
35
  attribute :empty
35
36
  attribute :__metrics, :aliases => :metrics
36
37
 
@@ -6,7 +6,7 @@ module Fog
6
6
 
7
7
  class VbdMetrics < Fog::Model
8
8
  # API Reference here:
9
- # http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/api/?c=VBD_metrics
9
+ # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VBD_metrics
10
10
 
11
11
  identity :reference
12
12
 
@@ -6,7 +6,7 @@ module Fog
6
6
 
7
7
  class VDI < Fog::Model
8
8
  # API Reference here:
9
- # http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/api/?c=VDI
9
+ # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VDI
10
10
 
11
11
  identity :reference
12
12
 
@@ -22,6 +22,7 @@ module Fog
22
22
  attribute :read_only
23
23
  attribute :current_operations
24
24
  attribute :allowed_operations
25
+ attribute :__crash_dumps, :aliases => :crash_dumps
25
26
  attribute :type
26
27
  attribute :other_config
27
28
  attribute :tags
@@ -30,6 +31,8 @@ module Fog
30
31
  attribute :missing
31
32
  attribute :location
32
33
  attribute :managed
34
+ attribute :metadata_latest
35
+ attribute :metadata_of_pool
33
36
  attribute :allow_caching
34
37
  attribute :on_boot
35
38
  attribute :sm_config
@@ -6,17 +6,26 @@ module Fog
6
6
 
7
7
  class VIF < Fog::Model
8
8
  # API Reference here:
9
- # http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/api/?c=VIF
9
+ # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VIF
10
10
 
11
11
  identity :reference
12
12
 
13
13
  attribute :mac, :aliases => :MAC
14
14
  attribute :uuid
15
15
  attribute :allowed_operations
16
+ attribute :current_operations
16
17
  attribute :currently_attached
17
18
  attribute :device
19
+ attribute :ipv4_allowed
20
+ attribute :ipv6_allowed
21
+ attribute :locking_mode
18
22
  attribute :mac_autogenerated, :aliases => :MAC_autogenerated
19
- attribute :metrics
23
+ attribute :__metrics, :aliases => :metrics
24
+ attribute :other_config
25
+ attribute :qos_algorithm_params
26
+ attribute :qos_algorithm_type
27
+ attribute :qos_supported_algorithms
28
+ attribute :runtime_properties
20
29
  attribute :mtu, :aliases => :MTU
21
30
  attribute :__network, :aliases => :network
22
31
  attribute :status_code
@@ -6,12 +6,13 @@ module Fog
6
6
 
7
7
  class VLAN < Fog::Model
8
8
  # API Reference here:
9
- # @see http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/api/?c=VLAN
9
+ # @see http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VLAN
10
10
 
11
11
  identity :reference
12
12
 
13
13
  attribute :uuid
14
14
  attribute :tag, :type => :integer
15
+ attribute :other_config
15
16
  attribute :__untagged_pif, :aliases => :untagged_PIF
16
17
  attribute :__tagged_pif, :aliases => :tagged_PIF
17
18
 
@@ -0,0 +1,35 @@
1
+ require 'fog/core/model'
2
+
3
+ module Fog
4
+ module Compute
5
+ class XenServer
6
+ class Vmpp < Fog::Model
7
+ # API Reference here:
8
+ # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VMPP
9
+
10
+ identity :reference
11
+
12
+ attribute :alarm_config
13
+ attribute :archive_frequency
14
+ attribute :archive_last_run_time
15
+ attribute :archive_schedule
16
+ attribute :archive_target_config
17
+ attribute :archive_target_type
18
+ attribute :backup_frequency
19
+ attribute :backup_last_run_time
20
+ attribute :backup_retention_value
21
+ attribute :backup_schedule
22
+ attribute :backup_type
23
+ attribute :is_alarm_enabled
24
+ attribute :is_archive_running
25
+ attribute :is_backup_running
26
+ attribute :is_policy_enabled
27
+ attribute :description, :aliases => :name_description
28
+ attribute :name, :aliases => :name_label
29
+ attribute :recent_alerts
30
+ attribute :uuid
31
+ attribute :__vms, :aliases => :VMs
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,25 @@
1
+ require 'fog/core/collection'
2
+ require 'fog/xenserver/models/compute/vmpp'
3
+
4
+ module Fog
5
+ module Compute
6
+ class XenServer
7
+ class Vmpps < Fog::Collection
8
+ model Fog::Compute::XenServer::Vmpp
9
+
10
+ def all(options={})
11
+ data = service.get_records 'VMPP'
12
+ load(data)
13
+ end
14
+
15
+ def get( vmpp_ref )
16
+ if vmpp_ref && vmpp = service.get_record( vmpp_ref, 'VMPP' )
17
+ new(vmpp)
18
+ else
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,18 @@
1
+ require 'fog/core/model'
2
+
3
+ module Fog
4
+ module Compute
5
+ class XenServer
6
+ class Vtpm < Fog::Model
7
+ # API Reference here:
8
+ # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VTPM
9
+
10
+ identity :reference
11
+
12
+ attribute :__backend, :aliases => :backend
13
+ attribute :uuid
14
+ attribute :__vm, :aliases => :vm
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,25 @@
1
+ require 'fog/core/collection'
2
+ require 'fog/xenserver/models/compute/vtpm'
3
+
4
+ module Fog
5
+ module Compute
6
+ class XenServer
7
+ class Vtpms < Fog::Collection
8
+ model Fog::Compute::XenServer::Vtpm
9
+
10
+ def all(options={})
11
+ data = service.get_records 'VTPM'
12
+ load(data)
13
+ end
14
+
15
+ def get( vtpm_ref )
16
+ if vtpm_ref && vtpm = service.get_record( vtpm_ref, 'VTPM' )
17
+ new(vtpm)
18
+ else
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,52 @@
1
+ Shindo.tests('Fog::Compute[:aws] | internet_gateway requests', ['aws']) do
2
+
3
+ tests('success') do
4
+
5
+ @vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
6
+ @vpc_id = @vpc.id
7
+
8
+ @subnet=Fog::Compute[:aws].subnets.create('vpc_id' => @vpc_id, 'cidr_block' => '10.0.10.0/24')
9
+ @subnet_id = @subnet.subnet_id
10
+
11
+ @network_interface = Fog::Compute[:aws].network_interfaces.new(:subnet_id => @subnet_id)
12
+ @network_interface.save
13
+ @network_interface_id = @network_interface.network_interface_id
14
+
15
+ @ip_address = Fog::AWS::Mock.ip_address
16
+ @second_ip_address = Fog::AWS::Mock.ip_address
17
+
18
+ tests("#assign_private_ip_addresses('#{@network_interface_id}', {'PrivateIpAddresses'=>['#{@ip_address}','#{@second_ip_address}']})").formats(AWS::Compute::Formats::BASIC) do
19
+ Fog::Compute[:aws].assign_private_ip_addresses(@network_interface_id, { 'PrivateIpAddresses' =>[@ip_address, @second_ip_address]}).body
20
+ end
21
+
22
+ tests("#assign_private_ip_addresses('#{@network_interface_id}', {'SecondaryPrivateIpAddressCount'=>4})").formats(AWS::Compute::Formats::BASIC) do
23
+ Fog::Compute[:aws].assign_private_ip_addresses(@network_interface_id, {'SecondaryPrivateIpAddressCount'=>4}).body
24
+ end
25
+
26
+ @network_interface.destroy
27
+ @subnet.destroy
28
+ @vpc.destroy
29
+ end
30
+
31
+ tests('failure') do
32
+ @vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
33
+ @vpc_id = @vpc.id
34
+
35
+ @subnet=Fog::Compute[:aws].subnets.create('vpc_id' => @vpc_id, 'cidr_block' => '10.0.10.0/24')
36
+ @subnet_id = @subnet.subnet_id
37
+
38
+ @network_interface = Fog::Compute[:aws].network_interfaces.new(:subnet_id => @subnet_id)
39
+ @network_interface.save
40
+ @network_interface_id = @network_interface.network_interface_id
41
+
42
+ @ip_address = Fog::AWS::Mock.ip_address
43
+
44
+ tests("#assign_private_ip_addresses('#{@network_interface_id}', {'PrivateIpAddresses'=>['#{@ip_address}','#{@second_ip_address}'], 'SecondaryPrivateIpAddressCount'=>4 })").raises(Fog::Compute::AWS::Error) do
45
+ Fog::Compute[:aws].assign_private_ip_addresses(@network_interface_id, { 'PrivateIpAddresses' =>[@ip_address, @second_ip_address], 'SecondaryPrivateIpAddressCount'=>4 }).body
46
+ end
47
+
48
+ @network_interface.destroy
49
+ @subnet.destroy
50
+ @vpc.destroy
51
+ end
52
+ end
@@ -1,5 +1,16 @@
1
1
  Shindo.tests("Fog::Compute[:google] | servers", ['google']) do
2
2
 
3
- collection_tests(Fog::Compute[:google].servers, {:name => 'fogservername', :zone_name => 'us-central1-a', :machine_type => 'n1-standard-1'})
3
+ @google = Fog::Compute[:google]
4
+
5
+ @zone = 'us-central1-a'
6
+ @disk = @google.disks.create({
7
+ :name => "fogservername",
8
+ :size_gb => "2",
9
+ :zone_name => @zone,
10
+ :source_image => "debian-7-wheezy-v20131120",
11
+ })
12
+ @disk.wait_for { ready? }
13
+
14
+ collection_tests(Fog::Compute[:google].servers, {:name => 'fogservername', :zone_name => @zone, :machine_type => 'n1-standard-1', :disks => [@disk]})
4
15
 
5
16
  end
@@ -24,7 +24,6 @@ Shindo.tests('Fog::Compute[:google] | image requests', ['google']) do
24
24
  'name' => String,
25
25
  'description' => String,
26
26
  'sourceType' => String,
27
- 'preferredKernel' => String,
28
27
  'rawDisk' => {
29
28
  'containerType' => String,
30
29
  'source' => String
@@ -82,7 +82,7 @@ if Fog.mock?
82
82
  :vcloud_host => 'vcloud_host',
83
83
  :vcloud_password => 'vcloud_password',
84
84
  :vcloud_username => 'vcloud_username',
85
- :vcloud_director_host => 'vcloud_director_host',
85
+ :vcloud_director_host => 'vcloud-director-host',
86
86
  :vcloud_director_password => 'vcloud_director_password',
87
87
  :vcloud_director_username => 'vcd_user@vcd_org_name',
88
88
  :voxel_api_key => 'voxel_api_key',
@@ -0,0 +1,54 @@
1
+ Shindo.tests("Fog::Compute[:openstack] | security_group", ['openstack']) do
2
+ tests('success') do
3
+ begin
4
+ fog = Fog::Compute[:openstack]
5
+
6
+ security_group = fog.security_groups.create(
7
+ :name => 'my_group',
8
+ :description => 'my group'
9
+ )
10
+
11
+ tests('#create').succeeds do
12
+ security_group = fog.security_groups.create(
13
+ :name => 'my_group',
14
+ :description => 'my group'
15
+ )
16
+
17
+ returns('my_group') { security_group.name }
18
+ returns('my group') { security_group.description }
19
+ returns([]) { security_group.security_group_rules }
20
+ returns(true) { security_group.tenant_id != nil }
21
+ end
22
+
23
+ tests('#rules').succeeds do
24
+ tests("#create").succeeds do
25
+ rules_count = security_group.security_group_rules.count
26
+ rule = security_group.security_group_rules.create(
27
+ :parent_group_id => security_group.id,
28
+ :ip_protocol => 'tcp',
29
+ :from_port => 1234,
30
+ :to_port => 1234,
31
+ :ip_range => { "cidr" => "0.0.0.0/0" }
32
+ )
33
+ returns(true) { security_group.security_group_rules.count == (rules_count + 1) }
34
+ security_group_rule = security_group.security_group_rules.detect { |r| r.id == rule.id }
35
+ returns(true) { security_group_rule.attributes == rule.attributes }
36
+ end
37
+
38
+ tests("#destroy").succeeds do
39
+ rule = security_group.security_group_rules.create(
40
+ :parent_group_id => security_group.id,
41
+ :ip_protocol => 'tcp',
42
+ :from_port => 1234,
43
+ :to_port => 1234,
44
+ :ip_range => { "cidr" => "0.0.0.0/0" }
45
+ )
46
+ rule.destroy
47
+ returns(true) { rule.reload == nil }
48
+ end
49
+ end
50
+ ensure
51
+ security_group.destroy if security_group
52
+ end
53
+ end
54
+ end
@@ -10,23 +10,26 @@ Shindo.tests('Fog::Compute[:openstack] | security group requests', ['openstack']
10
10
  }
11
11
 
12
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,
13
+ "id" => Integer,
14
+ "from_port" => Integer,
15
+ "to_port" => Integer,
16
+ "ip_protocol" => String,
17
+ "group" => Hash,
18
+ "ip_range" => Hash,
19
19
  "parent_group_id" => Integer
20
20
  }
21
21
 
22
22
  tests('success') do
23
23
  tests('#create_security_group(name, description)').formats({"security_group" => @security_group_format}) do
24
- Fog::Compute[:openstack].create_security_group('from_shindo_test', 'this is from the shindo test').body
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
25
27
  end
26
28
 
27
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
28
- parent_group_id = Fog::Compute[:openstack].list_security_groups.body['security_groups'].last['id']
29
- Fog::Compute[:openstack].create_security_group_rule(parent_group_id, "tcp", 2222, 3333, "20.20.20.20/24").body
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
30
33
  end
31
34
 
32
35
  tests('#list_security_groups').formats({"security_groups" => [@security_group_format]}) do
@@ -34,25 +37,24 @@ Shindo.tests('Fog::Compute[:openstack] | security group requests', ['openstack']
34
37
  end
35
38
 
36
39
  tests('#get_security_group(security_group_id)').formats({"security_group" => @security_group_format}) do
37
- group_id = Fog::Compute[:openstack].list_security_groups.body['security_groups'].last['id']
38
- Fog::Compute[:openstack].get_security_group(group_id).body
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
39
46
  end
40
47
 
41
48
  tests('#delete_security_group_rule(security_group_rule_id)').succeeds do
42
- security_group_rule_id = Fog::Compute[:openstack].list_security_groups.body['security_groups'].last['rules'].last['id']
43
- Fog::Compute[:openstack].delete_security_group_rule(security_group_rule_id)
49
+ Fog::Compute[:openstack].delete_security_group_rule(@security_group_rule_id)
44
50
  end
45
51
 
46
52
  tests('#delete_security_group(security_group_id)').succeeds do
47
- compute = Fog::Compute[:openstack]
48
-
49
- group_id = compute.list_security_groups.body['security_groups'].last['id']
50
-
51
- compute.delete_security_group(group_id)
53
+ Fog::Compute[:openstack].delete_security_group(@security_group_id)
52
54
 
53
55
  returns(false) {
54
- groups = compute.list_security_groups.body['security_groups']
55
- groups.any? { |group| group['id'] == group_id }
56
+ groups = Fog::Compute[:openstack].list_security_groups.body['security_groups']
57
+ groups.any? { |group| group['id'] == @security_group_id }
56
58
  }
57
59
  end
58
60
  end # tests('success')
@@ -1,13 +1,13 @@
1
1
  Shindo.tests('Fog::Network[:openstack] | network requests', ['openstack']) do
2
2
 
3
3
  @network_format = {
4
- 'id' => String,
5
- 'name' => String,
6
- 'subnets' => Array,
7
- 'shared' => Fog::Boolean,
8
- 'status' => String,
9
- 'admin_state_up' => Fog::Boolean,
10
- 'tenant_id' => String
4
+ 'id' => String,
5
+ 'name' => String,
6
+ 'subnets' => Array,
7
+ 'shared' => Fog::Boolean,
8
+ 'status' => String,
9
+ 'admin_state_up' => Fog::Boolean,
10
+ 'tenant_id' => String,
11
11
  }
12
12
 
13
13
  @network_format_extensions = {
@@ -98,7 +98,7 @@ Shindo.tests('Fog::Network[:openstack] | network requests', ['openstack']) do
98
98
  Fog::Network[:openstack].delete_network(0)
99
99
  end
100
100
  end
101
-
101
+
102
102
  # Cleaning up the mess
103
103
  Fog::Network[:openstack].networks.each do |n|
104
104
  Fog::Network[:openstack].delete_network(n.id)
@@ -34,11 +34,17 @@ Shindo.tests('Compute::VcloudDirector | edge gateway requests', ['vclouddirector
34
34
  @service = Fog::Compute::VcloudDirector.new
35
35
  @org = VcloudDirector::Compute::Helper.current_org(@service)
36
36
 
37
- tests('Get first vDC') do
38
- link = @org[:Link].detect do |l|
39
- l[:type] == 'application/vnd.vmware.vcloud.vdc+xml'
37
+ tests('Get first vDC with an EdgeGatewayRecord') do
38
+ @org[:Link].each do |l|
39
+ if l[:type] == 'application/vnd.vmware.vcloud.vdc+xml'
40
+ id = l[:href].split('/').last
41
+ edge_gateways = @service.get_org_vdc_gateways(id).body
42
+ if edge_gateways && edge_gateways[:EdgeGatewayRecord].size >= 1
43
+ @vdc_id = id
44
+ break
45
+ end
46
+ end
40
47
  end
41
- @vdc_id = link[:href].split('/').last
42
48
  end
43
49
 
44
50
  tests('#get_org_vdc_gateways').data_matches_schema(VcloudDirector::Compute::Schema::QUERY_RESULT_RECORDS_TYPE) do
@@ -52,17 +58,20 @@ Shindo.tests('Compute::VcloudDirector | edge gateway requests', ['vclouddirector
52
58
 
53
59
  @edge_gateways[:EdgeGatewayRecord].each do |result|
54
60
  tests("each EdgeGatewayRecord").
55
- data_matches_schema(VcloudDirector::Compute::Schema::QUERY_RESULT_EDGE_GATEWAY_RECORD_TYPE) { result }
61
+ data_matches_schema(VcloudDirector::Compute::Schema::QUERY_RESULT_EDGE_GATEWAY_RECORD_TYPE) do
62
+ result
63
+ end
56
64
  end
57
65
 
58
66
  tests('#get_edge_gateway').data_matches_schema(VcloudDirector::Compute::Schema::GATEWAY_TYPE) do
59
67
  @edge_gateway_id = @edge_gateways[:EdgeGatewayRecord].first[:href].split('/').last
60
- @orginal_gateway_conf = @service.get_edge_gateway(@edge_gateway_id).body
68
+ @original_gateway_conf = @service.get_edge_gateway(@edge_gateway_id).body
61
69
  end
62
70
 
71
+
63
72
  tests('#configure_edge_gateway_services') do
64
73
 
65
- rule = @orginal_gateway_conf[:Configuration][:EdgeGatewayServiceConfiguration][:FirewallService][:FirewallRule].find { |rule| rule[:Id] == FIREWALL_RULE_ID }
74
+ rule = @original_gateway_conf[:Configuration][:EdgeGatewayServiceConfiguration][:FirewallService][:FirewallRule].find { |rule| rule[:Id] == FIREWALL_RULE_ID }
66
75
  raise('fail fast if our test firewall rule already exists - its likely left over from a broken test run') if rule
67
76
 
68
77
  response = @service.post_configure_edge_gateway_services(@edge_gateway_id, @new_edge_gateway_configuration)
@@ -75,7 +84,7 @@ Shindo.tests('Compute::VcloudDirector | edge gateway requests', ['vclouddirector
75
84
 
76
85
  tests('#remove the firewall rule added by test').returns(nil) do
77
86
  response = @service.post_configure_edge_gateway_services(@edge_gateway_id,
78
- @orginal_gateway_conf[:Configuration][:EdgeGatewayServiceConfiguration])
87
+ @original_gateway_conf[:Configuration][:EdgeGatewayServiceConfiguration])
79
88
  @service.process_task(response.body)
80
89
  edge_gateway = @service.get_edge_gateway(@edge_gateway_id).body
81
90
  edge_gateway[:Configuration][:EdgeGatewayServiceConfiguration][:FirewallService][:FirewallRule].find { |rule| rule[:Id] == FIREWALL_RULE_ID }
@@ -7,7 +7,7 @@ Shindo.tests('Compute::VcloudDirector | network requests', ['vclouddirector']) d
7
7
  :id => String,
8
8
  :description => Fog::Nullable::String,
9
9
  :is_inherited => Fog::Boolean,
10
- :gateway => String,
10
+ :gateway => Fog::Nullable::String,
11
11
  :netmask => String,
12
12
  :dns1 => Fog::Nullable::String,
13
13
  :dns2 => Fog::Nullable::String,
@@ -21,6 +21,14 @@ Shindo.tests('Compute::VcloudDirector | network requests', ['vclouddirector']) d
21
21
  @service = Fog::Compute::VcloudDirector.new
22
22
  @org = VcloudDirector::Compute::Helper.current_org(@service)
23
23
 
24
+ tests('Create network in non-existent vDC').raises(Fog::Compute::VcloudDirector::Forbidden) do
25
+ @service.post_create_org_vdc_network('00000000-0000-0000-0000-000000000000', 'bob')
26
+ end
27
+
28
+ tests('Delete non-existent OrgNetwork').raises(Fog::Compute::VcloudDirector::Forbidden) do
29
+ @service.delete_network('00000000-0000-0000-0000-000000000000')
30
+ end
31
+
24
32
  tests('#get_network').data_matches_schema(GET_NETWORK_FORMAT) do
25
33
  link = @org[:Link].detect do |l|
26
34
  l[:rel] == 'down' && l[:type] == 'application/vnd.vmware.vcloud.orgNetwork+xml'
@@ -40,4 +48,20 @@ Shindo.tests('Compute::VcloudDirector | network requests', ['vclouddirector']) d
40
48
  @service.get_network('00000000-0000-0000-0000-000000000000')
41
49
  end
42
50
 
51
+ # at the moment just test delete_network in Mock mode, until we have
52
+ # ability to create a test one in Real mode
53
+ if Fog.mocking?
54
+ # TODO replace with a Query API lookup when available
55
+ net_id = @service.data[:networks].keys.first
56
+ @delete_task = @service.delete_network(net_id).body
57
+ tests('#delete_network returns Task').data_matches_schema(VcloudDirector::Compute::Schema::TASK_TYPE) do
58
+ @delete_task
59
+ end
60
+ @service.process_task(@delete_task)
61
+ tests('#delete_network succeeds').returns(nil) do
62
+ # network missing now?
63
+ net_id = @service.data[:networks][net_id]
64
+ end
65
+ end
66
+
43
67
  end