fog 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -8
- data/Gemfile.lock +3 -3
- data/bin/fog +2 -10
- data/fog.gemspec +45 -20
- data/lib/fog.rb +2 -1
- data/lib/fog/attributes.rb +48 -8
- data/lib/fog/aws/ec2.rb +5 -2
- data/lib/fog/aws/elb.rb +5 -2
- data/lib/fog/aws/models/ec2/server.rb +1 -1
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +43 -12
- data/lib/fog/aws/s3.rb +2 -2
- data/lib/fog/aws/simpledb.rb +15 -3
- data/lib/fog/bin.rb +11 -2
- data/lib/fog/bluebox.rb +5 -1
- data/lib/fog/connection.rb +9 -1
- data/lib/fog/credentials.rb +3 -0
- data/lib/fog/new_servers.rb +89 -0
- data/lib/fog/new_servers/bin.rb +30 -0
- data/lib/fog/new_servers/requests/add_server.rb +39 -0
- data/lib/fog/new_servers/requests/cancel_server.rb +36 -0
- data/lib/fog/new_servers/requests/get_server.rb +42 -0
- data/lib/fog/new_servers/requests/list_images.rb +33 -0
- data/lib/fog/new_servers/requests/list_plans.rb +36 -0
- data/lib/fog/new_servers/requests/list_servers.rb +43 -0
- data/lib/fog/new_servers/requests/reboot_server.rb +30 -0
- data/lib/fog/parser.rb +6 -0
- data/lib/fog/rackspace/files.rb +8 -2
- data/lib/fog/rackspace/models/servers/server.rb +5 -0
- data/lib/fog/rackspace/servers.rb +5 -1
- data/lib/fog/service.rb +6 -1
- data/lib/fog/slicehost.rb +5 -1
- data/lib/fog/terremark/ecloud.rb +1 -0
- data/lib/fog/terremark/shared.rb +4 -1
- data/lib/fog/terremark/vcloud.rb +1 -0
- data/lib/fog/vcloud.rb +150 -141
- data/lib/fog/vcloud/bin.rb +2 -2
- data/lib/fog/vcloud/collection.rb +3 -84
- data/lib/fog/vcloud/extension.rb +44 -0
- data/lib/fog/vcloud/generators.rb +33 -0
- data/lib/fog/vcloud/model.rb +5 -38
- data/lib/fog/vcloud/models/vdc.rb +14 -24
- data/lib/fog/vcloud/models/vdcs.rb +13 -8
- data/lib/fog/vcloud/requests/get_network.rb +4 -11
- data/lib/fog/vcloud/requests/get_organization.rb +4 -11
- data/lib/fog/vcloud/requests/get_vdc.rb +4 -12
- data/lib/fog/vcloud/requests/get_versions.rb +4 -13
- data/lib/fog/vcloud/requests/login.rb +4 -4
- data/lib/fog/vcloud/terremark/ecloud.rb +125 -54
- data/lib/fog/vcloud/terremark/ecloud/models/catalog.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/catalog_item.rb +31 -0
- data/lib/fog/vcloud/terremark/ecloud/models/internet_service.rb +21 -22
- data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +11 -25
- data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +38 -5
- data/lib/fog/vcloud/terremark/ecloud/models/ips.rb +11 -15
- data/lib/fog/vcloud/terremark/ecloud/models/network.rb +52 -11
- data/lib/fog/vcloud/terremark/ecloud/models/networks.rb +14 -13
- data/lib/fog/vcloud/terremark/ecloud/models/node.rb +47 -0
- data/lib/fog/vcloud/terremark/ecloud/models/nodes.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/public_ip.rb +6 -9
- data/lib/fog/vcloud/terremark/ecloud/models/public_ips.rb +19 -3
- data/lib/fog/vcloud/terremark/ecloud/models/server.rb +203 -0
- data/lib/fog/vcloud/terremark/ecloud/models/servers.rb +43 -0
- data/lib/fog/vcloud/terremark/ecloud/models/task.rb +22 -0
- data/lib/fog/vcloud/terremark/ecloud/models/tasks.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +32 -10
- data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +5 -6
- data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +23 -10
- data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +54 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +14 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb +53 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb +52 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb +42 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb +115 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_internet_service.rb +4 -23
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_node.rb +0 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb +19 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog_item.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_customization_options.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb +9 -16
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network.rb +8 -14
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb +36 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb +44 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +11 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_node.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_nodes.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ip.rb +5 -19
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ips.rb +5 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task_list.rb +19 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vapp.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb +7 -15
- data/lib/fog/vcloud/terremark/ecloud/requests/power_off.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_on.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_reset.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_shutdown.rb +18 -0
- data/lib/fog/vcloud/terremark/vcloud.rb +4 -18
- data/lib/fog/vcloud/terremark/vcloud/requests/get_vdc.rb +4 -12
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +18 -0
- data/spec/vcloud/bin_spec.rb +2 -2
- data/spec/vcloud/models/vdc_spec.rb +35 -29
- data/spec/vcloud/requests/get_network_spec.rb +32 -43
- data/spec/vcloud/requests/get_organization_spec.rb +45 -38
- data/spec/vcloud/requests/get_vdc_spec.rb +42 -32
- data/spec/vcloud/requests/get_versions_spec.rb +17 -17
- data/spec/vcloud/requests/login_spec.rb +7 -4
- data/spec/vcloud/spec_helper.rb +137 -46
- data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +53 -58
- data/spec/vcloud/terremark/ecloud/models/internet_services_spec.rb +20 -20
- data/spec/vcloud/terremark/ecloud/models/ip_spec.rb +22 -21
- data/spec/vcloud/terremark/ecloud/models/ips_spec.rb +18 -18
- data/spec/vcloud/terremark/ecloud/models/network_spec.rb +55 -51
- data/spec/vcloud/terremark/ecloud/models/networks_spec.rb +16 -15
- data/spec/vcloud/terremark/ecloud/models/public_ip_spec.rb +26 -27
- data/spec/vcloud/terremark/ecloud/models/public_ips_spec.rb +16 -15
- data/spec/vcloud/terremark/ecloud/models/vdc_spec.rb +52 -36
- data/spec/vcloud/terremark/ecloud/models/vdcs_spec.rb +18 -15
- data/spec/vcloud/terremark/ecloud/requests/add_internet_service_spec.rb +46 -43
- data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +37 -32
- data/spec/vcloud/terremark/ecloud/requests/delete_internet_service_spec.rb +26 -23
- data/spec/vcloud/terremark/ecloud/requests/get_internet_services_spec.rb +57 -49
- data/spec/vcloud/terremark/ecloud/requests/get_network_ip_spec.rb +41 -0
- data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +39 -34
- data/spec/vcloud/terremark/ecloud/requests/get_network_spec.rb +26 -48
- data/spec/vcloud/terremark/ecloud/requests/get_public_ip_spec.rb +25 -26
- data/spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb +35 -27
- data/spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb +85 -110
- data/spec/vcloud/terremark/ecloud/requests/login_spec.rb +7 -4
- data/spec/vcloud/vcloud_spec.rb +9 -8
- metadata +62 -26
- data/lib/fog/vcloud/parser.rb +0 -42
- data/lib/fog/vcloud/parsers/get_organization.rb +0 -37
- data/lib/fog/vcloud/parsers/get_vdc.rb +0 -62
- data/lib/fog/vcloud/parsers/get_versions.rb +0 -46
- data/lib/fog/vcloud/parsers/login.rb +0 -36
- data/lib/fog/vcloud/parsers/network.rb +0 -53
- data/lib/fog/vcloud/terremark/all.rb +0 -9
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_internet_services.rb +0 -59
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ip.rb +0 -30
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ips.rb +0 -40
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb +0 -59
- data/lib/fog/vcloud/terremark/ecloud/parsers/internet_service.rb +0 -58
- data/lib/fog/vcloud/terremark/ecloud/parsers/network.rb +0 -28
- data/lib/fog/vcloud/terremark/ecloud/parsers/network_ips.rb +0 -31
- data/lib/fog/vcloud/terremark/ecloud/requests/login.rb +0 -27
- data/lib/fog/vcloud/terremark/vcloud/parsers/get_vdc.rb +0 -34
- data/spec/vcloud/terremark/vcloud/requests/get_vdc_spec.rb +0 -74
@@ -1,28 +1,28 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','..','..','spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
its(:vcloud_type) { should be_nil }
|
14
|
-
it { should_not respond_to :create }
|
15
|
-
end
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud::Terremark::Ecloud::Ips", :type => :mock_tmrk_ecloud_model do
|
5
|
+
subject { @vcloud }
|
6
|
+
|
7
|
+
it { should_not respond_to :ips }
|
8
|
+
|
9
|
+
describe :class do
|
10
|
+
subject { @vcloud.vdcs[0].networks[0].ips.class }
|
11
|
+
its(:model) { should == Fog::Vcloud::Terremark::Ecloud::Ip }
|
12
|
+
end
|
16
13
|
|
17
|
-
|
18
|
-
|
14
|
+
describe :ips do
|
15
|
+
subject { @vcloud.vdcs[0].networks[0].ips.reload; @vcloud.vdcs[0].networks[0].ips }
|
16
|
+
it { should_not respond_to :create }
|
19
17
|
|
20
|
-
|
18
|
+
it { should be_an_instance_of Fog::Vcloud::Terremark::Ecloud::Ips }
|
21
19
|
|
22
|
-
|
20
|
+
its(:length) { should == 252 }
|
23
21
|
|
24
|
-
|
22
|
+
it { should have_members_of_the_right_model }
|
23
|
+
end
|
25
24
|
end
|
25
|
+
else
|
26
26
|
end
|
27
27
|
|
28
28
|
|
@@ -1,65 +1,69 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','..','..','spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud::Terremark::Ecloud::Network", :type => :mock_tmrk_ecloud_model do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
describe :class do
|
8
|
+
subject { Fog::Vcloud::Terremark::Ecloud::Network }
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
context "with no uri" do
|
14
|
-
|
15
|
-
subject { Fog::Vcloud::Terremark::Ecloud::Network.new() }
|
16
|
-
|
17
|
-
its(:href) { should be_nil }
|
18
|
-
its(:identity) { should be_nil }
|
19
|
-
its(:name) { should be_nil }
|
20
|
-
its(:type) { should be_nil }
|
21
|
-
its(:features) { should be_nil }
|
22
|
-
its(:configuration) { should be_nil }
|
23
|
-
its(:ips_link) { should be_nil }
|
24
|
-
its(:xmlns) { should be_nil }
|
25
|
-
end
|
26
|
-
|
27
|
-
context "as a collection member" do
|
28
|
-
subject { @vcloud.vdcs[0].networks[0] }
|
29
|
-
|
30
|
-
it { should be_an_instance_of Fog::Vcloud::Terremark::Ecloud::Network }
|
31
|
-
|
32
|
-
it_should_behave_like "it has a vcloud v0.8 xmlns"
|
10
|
+
it { should have_identity :href }
|
11
|
+
it { should have_only_these_attributes [:href, :name, :id, :features, :links, :type, :gateway, :broadcast, :address, :rnat, :extension_href] }
|
12
|
+
end
|
33
13
|
|
34
|
-
|
35
|
-
its(:identity) { should == URI.parse(@mock_network[:href]) }
|
36
|
-
its(:name) { should == @mock_network[:name] }
|
37
|
-
its(:type) { should == "application/vnd.vmware.vcloud.network+xml" }
|
14
|
+
context "with no uri" do
|
38
15
|
|
39
|
-
|
16
|
+
subject { Fog::Vcloud::Terremark::Ecloud::Network.new() }
|
40
17
|
|
41
|
-
|
42
|
-
let(:feature) { subject.features[0] }
|
43
|
-
specify { feature.should be_an_instance_of Struct::VcloudNetworkFenceMode }
|
44
|
-
specify { feature.mode.should == "isolated" }
|
18
|
+
it { should have_all_attributes_be_nil }
|
45
19
|
end
|
46
20
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
21
|
+
context "as a collection member" do
|
22
|
+
subject { @vcloud.vdcs[0].networks[0].reload; @vcloud.vdcs[0].networks[0] }
|
23
|
+
|
24
|
+
it { should be_an_instance_of Fog::Vcloud::Terremark::Ecloud::Network }
|
25
|
+
|
26
|
+
its(:href) { should == @mock_network[:href] }
|
27
|
+
its(:identity) { should == @mock_network[:href] }
|
28
|
+
its(:name) { should == @mock_network[:name] }
|
29
|
+
its(:type) { should == "application/vnd.vmware.vcloud.network+xml" }
|
30
|
+
its(:id) { should == @mock_network[:id] }
|
31
|
+
its(:gateway) { should == @mock_network[:gateway] }
|
32
|
+
its(:broadcast) { should == IPAddr.new(@mock_network[:subnet]).to_range.last.to_s }
|
33
|
+
its(:address) { should == @mock_network[:subnet].split("/")[0] }
|
34
|
+
its(:rnat) { should == @mock_network[:rnat] }
|
35
|
+
its(:extension_href) { should == @mock_network[:extension_href] }
|
36
|
+
|
37
|
+
it { should have(1).features }
|
38
|
+
|
39
|
+
describe :features do
|
40
|
+
let(:feature) { subject.features[0] }
|
41
|
+
specify { feature.should be_an_instance_of Hash }
|
42
|
+
specify { feature[:FenceMode].should == @mock_network[:features][0][:value] }
|
43
|
+
end
|
44
|
+
|
45
|
+
it { should have(2).links }
|
46
|
+
|
47
|
+
describe :links do
|
48
|
+
context "[0]" do
|
49
|
+
let(:link) { subject.links[0] }
|
50
|
+
specify { link[:rel].should == "down" }
|
51
|
+
specify { link[:href].should == "#{@mock_network[:href]}/ips" }
|
52
|
+
specify { link[:type].should == "application/xml" }
|
53
|
+
specify { link[:name].should == "IP Addresses" }
|
54
|
+
end
|
55
|
+
|
56
|
+
context "[1]" do
|
57
|
+
let(:link) { subject.links[1] }
|
58
|
+
specify { link[:rel].should == "down" }
|
59
|
+
specify { link[:href].should == @mock_network[:extension_href] }
|
60
|
+
specify { link[:type].should == "application/xml" }
|
61
|
+
specify { link[:name].should == @mock_network[:name] }
|
62
|
+
end
|
63
|
+
end
|
54
64
|
|
55
|
-
describe :ips_link do
|
56
|
-
let(:ips_link) { subject.ips_link }
|
57
|
-
specify { ips_link.rel.should == "down" }
|
58
|
-
specify { ips_link.href.should == URI.parse(@mock_network[:href] + "/ips") }
|
59
|
-
specify { ips_link.type.should == "application/xml" }
|
60
|
-
specify { ips_link.name.should == "IP Addresses" }
|
61
65
|
end
|
62
|
-
|
63
66
|
end
|
67
|
+
else
|
64
68
|
end
|
65
69
|
|
@@ -1,26 +1,27 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','..','..','spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud::Terremark::Ecloud::Networks", :type => :mock_tmrk_ecloud_model do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :networks }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
its(:all_request) { should be_an_instance_of Proc }
|
13
|
-
its(:vcloud_type) { should == "application/vnd.vmware.vcloud.network+xml" }
|
14
|
-
end
|
9
|
+
describe :class do
|
10
|
+
subject { @vcloud.networks.class }
|
11
|
+
its(:model) { should == Fog::Vcloud::Terremark::Ecloud::Network }
|
12
|
+
end
|
15
13
|
|
16
|
-
|
17
|
-
|
14
|
+
describe :networks do
|
15
|
+
subject { @vcloud.vdcs[0].networks }
|
16
|
+
it { should_not respond_to :create }
|
18
17
|
|
19
|
-
|
18
|
+
it { should be_an_instance_of Fog::Vcloud::Terremark::Ecloud::Networks }
|
20
19
|
|
21
|
-
|
20
|
+
its(:length) { should == 2 }
|
22
21
|
|
23
|
-
|
22
|
+
it { should have_members_of_the_right_model }
|
23
|
+
end
|
24
24
|
end
|
25
|
+
else
|
25
26
|
end
|
26
27
|
|
@@ -1,41 +1,40 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','..','..','spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud::Terremark::Ecloud::PublicIp", :type => :mock_tmrk_ecloud_model do
|
5
|
+
before do
|
6
|
+
@mock_ip = @mock_vdc[:public_ips].first
|
7
|
+
end
|
8
8
|
|
9
|
-
|
9
|
+
subject { @vcloud }
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
describe :class do
|
12
|
+
subject { Fog::Vcloud::Terremark::Ecloud::PublicIp }
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
it { should have_identity :href }
|
15
|
+
it { should have_only_these_attributes [:name, :id, :href] }
|
16
|
+
end
|
17
17
|
|
18
|
-
|
18
|
+
context "with no uri" do
|
19
19
|
|
20
|
-
|
20
|
+
subject { Fog::Vcloud::Terremark::Ecloud::PublicIp.new() }
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
it { should have_all_attributes_be_nil }
|
23
|
+
end
|
24
|
+
|
25
|
+
context "as a collection member" do
|
26
|
+
subject { @vcloud.vdcs[0].public_ips[0].reload; @vcloud.vdcs[0].public_ips[0] }
|
27
27
|
|
28
|
-
|
29
|
-
subject { @vcloud.vdcs[0].public_ips[0] }
|
28
|
+
it { should be_an_instance_of Fog::Vcloud::Terremark::Ecloud::PublicIp }
|
30
29
|
|
31
|
-
|
30
|
+
its(:href) { should == @mock_ip[:href] }
|
31
|
+
its(:identity) { should == @mock_ip[:href] }
|
32
|
+
its(:name) { should == @mock_ip[:name] }
|
33
|
+
its(:id) { should == @mock_ip[:id] }
|
32
34
|
|
33
|
-
|
34
|
-
its(:identity) { should == @mock_ip_uri }
|
35
|
-
its(:name) { should == @mock_ip[:name] }
|
36
|
-
its(:id) { should == @mock_ip[:id] }
|
35
|
+
its(:internet_services) { should have(2).services }
|
37
36
|
|
38
|
-
|
39
|
-
|
37
|
+
end
|
40
38
|
end
|
39
|
+
else
|
41
40
|
end
|
@@ -1,26 +1,27 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','..','..','spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud::Terremark::Ecloud::PublicIps", :type => :mock_tmrk_ecloud_model do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :public_ips }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
its(:all_request) { should be_an_instance_of Proc }
|
13
|
-
its(:vcloud_type) { should == "application/vnd.tmrk.ecloud.publicIp+xml" }
|
14
|
-
end
|
9
|
+
describe :class do
|
10
|
+
subject { @vcloud.public_ips.class }
|
11
|
+
its(:model) { should == Fog::Vcloud::Terremark::Ecloud::PublicIp }
|
12
|
+
end
|
15
13
|
|
16
|
-
|
17
|
-
|
14
|
+
describe :public_ips do
|
15
|
+
subject { @vcloud.vdcs[0].public_ips }
|
16
|
+
it { should_not respond_to :create }
|
18
17
|
|
19
|
-
|
18
|
+
it { should be_an_instance_of Fog::Vcloud::Terremark::Ecloud::PublicIps }
|
20
19
|
|
21
|
-
|
20
|
+
its(:length) { should == 3 }
|
22
21
|
|
23
|
-
|
22
|
+
it { should have_members_of_the_right_model }
|
23
|
+
end
|
24
24
|
end
|
25
|
+
else
|
25
26
|
end
|
26
27
|
|
@@ -1,47 +1,63 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','..','..','spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud::Terremark::Ecloud::Vdc", :type => :mock_tmrk_ecloud_model do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :get_vdc }
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
describe :class do
|
10
|
+
subject { Fog::Vcloud::Terremark::Ecloud::Vdc }
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
12
|
+
it { should have_identity :href }
|
13
|
+
it { should have_only_these_attributes [:href, :name, :type, :description, :other_links, :compute_capacity, :storage_capacity, :available_networks,
|
14
|
+
:resource_entities, :deployed_vm_quota, :instantiated_vm_quota] }
|
15
|
+
end
|
16
16
|
|
17
|
-
|
17
|
+
context "with no uri" do
|
18
18
|
|
19
|
-
|
19
|
+
subject { Fog::Vcloud::Terremark::Ecloud::Vdc.new() }
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
it { should have_all_attributes_be_nil }
|
22
|
+
end
|
23
|
+
|
24
|
+
context "as a collection member" do
|
25
|
+
subject { @vcloud.vdcs[0].reload; @vcloud.vdcs[0] }
|
26
|
+
|
27
|
+
its(:href) { should == @mock_vdc[:href] }
|
28
|
+
its(:identity) { should == @mock_vdc[:href] }
|
29
|
+
its(:name) { should == @mock_vdc[:name] }
|
30
|
+
its(:public_ips) { should be_an_instance_of Fog::Vcloud::Terremark::Ecloud::PublicIps }
|
31
|
+
its(:other_links) { should have(4).items }
|
32
|
+
its(:resource_entities) { should have(3).items }
|
33
|
+
its(:available_networks) { should have(2).items }
|
34
|
+
|
35
|
+
its(:compute_capacity) { should == {:Memory =>
|
36
|
+
{:Allocated => @mock_vdc[:memory][:allocated], :Units => "bytes * 2^20"},
|
37
|
+
:DeployedVmsQuota =>
|
38
|
+
{:Limit => "-1", :Used => "-1"},
|
39
|
+
:InstantiatedVmsQuota =>
|
40
|
+
{:Limit => "-1", :Used => "-1"},
|
41
|
+
:Cpu =>
|
42
|
+
{:Allocated => @mock_vdc[:cpu][:allocated], :Units => "hz * 10^6"}} }
|
43
|
+
|
44
|
+
its(:storage_capacity) { should == {:Allocated => @mock_vdc[:storage][:allocated], :Used => @mock_vdc[:storage][:used], :Units => "bytes * 10^9"} }
|
45
|
+
|
46
|
+
its(:deployed_vm_quota) { should == nil }
|
47
|
+
its(:instantiated_vm_quota) { should == nil }
|
48
|
+
|
49
|
+
its(:public_ips) { should have(3).public_ips }
|
50
|
+
its(:internet_services) { should have(4).services }
|
51
|
+
its(:networks) { should have(2).networks }
|
52
|
+
its(:servers) { should have(3).servers }
|
53
|
+
|
54
|
+
#FIXME: need to mock tasks related requests first
|
55
|
+
#its(:tasks) { should have(0).tasks }
|
56
|
+
|
57
|
+
#FIXME: need to mock catalog related requests first
|
58
|
+
#its(:catalog) { should have(0).entries }
|
24
59
|
|
25
|
-
|
26
|
-
subject { @vcloud.vdcs[0] }
|
27
|
-
|
28
|
-
its(:href) { should == URI.parse(@mock_vdc[:href]) }
|
29
|
-
its(:identity) { should == URI.parse(@mock_vdc[:href]) }
|
30
|
-
its(:name) { should == @mock_vdc[:name] }
|
31
|
-
its(:public_ips) { should be_an_instance_of Fog::Vcloud::Terremark::Ecloud::PublicIps }
|
32
|
-
its(:other_links) { should have(4).items }
|
33
|
-
its(:resource_entity_links) { should have(3).items }
|
34
|
-
its(:network_links) { should have(2).items }
|
35
|
-
|
36
|
-
its(:cpu_capacity) { should == Struct::VcloudXCapacity.new('hz * 10^6',@mock_vdc[:cpu][:allocated]) }
|
37
|
-
its(:memory_capacity) { should == Struct::VcloudXCapacity.new('bytes * 2^20',@mock_vdc[:memory][:allocated]) }
|
38
|
-
its(:storage_capacity) { should == Struct::VcloudXCapacity.new('bytes * 10^9',@mock_vdc[:storage][:allocated], @mock_vdc[:storage][:used]) }
|
39
|
-
|
40
|
-
its(:deployed_vm_quota) { should == Struct::VcloudXCapacity.new(nil,nil,-1,-1) }
|
41
|
-
its(:instantiated_vm_quota) { should == Struct::VcloudXCapacity.new(nil,nil,-1,-1) }
|
42
|
-
|
43
|
-
its(:public_ips) { should have(3).public_ips }
|
44
|
-
its(:internet_services) { should have(4).services }
|
45
|
-
|
60
|
+
end
|
46
61
|
end
|
62
|
+
else
|
47
63
|
end
|
@@ -1,25 +1,28 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'..','..','..','spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud::Terremark::Ecloud::Vdcs", :type => :mock_tmrk_ecloud_model do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :vdcs }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
describe :class do
|
10
|
+
subject { @vcloud.vdcs.class }
|
11
|
+
its(:model) { should == Fog::Vcloud::Terremark::Ecloud::Vdc }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe :vdcs do
|
15
|
+
subject { @vcloud.vdcs }
|
16
|
+
it { should_not respond_to :create }
|
15
17
|
|
16
|
-
|
17
|
-
subject { @vcloud.vdcs }
|
18
|
+
it { should be_an_instance_of Fog::Vcloud::Terremark::Ecloud::Vdcs }
|
18
19
|
|
19
|
-
|
20
|
+
its(:length) { should == 2 }
|
20
21
|
|
21
|
-
|
22
|
+
it { should have_members_of_the_right_model }
|
22
23
|
|
23
|
-
|
24
|
+
its(:organization_uri) { should == @mock_organization[:info][:href] }
|
25
|
+
end
|
24
26
|
end
|
27
|
+
else
|
25
28
|
end
|