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,57 +1,60 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
context "with a valid Public IP uri" do
|
19
|
-
it "has the right number of Internet Services before" do
|
20
|
-
before_services = @vcloud.get_internet_services(@public_ip.href)
|
21
|
-
before_services.body.links.should have(2).links
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
|
+
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
|
+
subject { @vcloud }
|
6
|
+
|
7
|
+
it { should respond_to :add_internet_service }
|
8
|
+
|
9
|
+
describe "#add_internet_service" do
|
10
|
+
before do
|
11
|
+
@public_ip = @vcloud.vdcs[0].public_ips[0]
|
12
|
+
@new_service_data = { :name => "Test Service",
|
13
|
+
:protocol => "HTTP",
|
14
|
+
:port => "80",
|
15
|
+
:enabled => "true",
|
16
|
+
:description => "this is a test",
|
17
|
+
:redirect_url => "" }
|
22
18
|
end
|
23
19
|
|
24
|
-
|
20
|
+
context "with a valid Public IP uri" do
|
21
|
+
it "has the right number of Internet Services before" do
|
22
|
+
before_services = @vcloud.get_internet_services(@public_ip.href)
|
23
|
+
before_services.body[:InternetService].should have(2).services
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
subject
|
28
|
-
@vcloud.get_internet_services(@public_ip.href).body.links.should have(3).links
|
29
|
-
end
|
26
|
+
subject { @vcloud.add_internet_service(@public_ip.href.to_s + "/internetServices", @new_service_data ) }
|
30
27
|
|
31
|
-
|
28
|
+
it "has the right number of Internet Services after" do
|
29
|
+
subject
|
30
|
+
@vcloud.get_internet_services(@public_ip.href).body[:InternetService].should have(3).services
|
31
|
+
end
|
32
32
|
|
33
|
-
|
33
|
+
it_should_behave_like "all responses"
|
34
34
|
|
35
|
-
|
36
|
-
specify { body.href.to_s.should == Fog::Vcloud::Terremark::Ecloud::Mock.internet_service_href( { :id => 372 } ) }
|
37
|
-
specify { body.name.should == "Test Service" }
|
38
|
-
specify { body.protocol.should == "HTTP" }
|
39
|
-
specify { body.enabled.should == true }
|
40
|
-
specify { body.description.should == "this is a test" }
|
35
|
+
let(:body) { subject.body }
|
41
36
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
its(:body) { should be_an_instance_of Hash }
|
38
|
+
specify { body[:Href].should == Fog::Vcloud::Terremark::Ecloud::Mock.internet_service_href( { :id => 372 } ) }
|
39
|
+
specify { body[:Name].should == "Test Service" }
|
40
|
+
specify { body[:Protocol].should == "HTTP" }
|
41
|
+
specify { body[:Enabled].should == "true" }
|
42
|
+
specify { body[:Description].should == "this is a test" }
|
47
43
|
|
48
|
-
|
44
|
+
let(:public_ip) { subject.body[:PublicIpAddress] }
|
45
|
+
specify { public_ip.should be_an_instance_of Hash }
|
46
|
+
specify { public_ip[:Name].should == @public_ip.name }
|
47
|
+
specify { public_ip[:Id].should == @public_ip.id }
|
49
48
|
|
50
|
-
|
51
|
-
subject { lambda { @vcloud.add_internet_service(URI.parse('https://www.fakey.c/piv8vc99'), @new_service_data ) } }
|
49
|
+
end
|
52
50
|
|
53
|
-
|
51
|
+
context "with a public_ips_uri that doesn't exist" do
|
52
|
+
subject { lambda { @vcloud.add_internet_service(URI.parse('https://www.fakey.c/piv8vc99'), @new_service_data ) } }
|
53
|
+
|
54
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
55
|
+
end
|
54
56
|
end
|
55
57
|
end
|
58
|
+
else
|
56
59
|
end
|
57
60
|
|
@@ -1,44 +1,49 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
|
+
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
|
+
subject { @vcloud }
|
6
|
+
|
7
|
+
it { should respond_to :configure_internet_service }
|
8
|
+
|
9
|
+
describe "#configure_internet_service" do
|
10
|
+
before do
|
11
|
+
@public_ip = @vcloud.vdcs[0].public_ips[0]
|
12
|
+
@original_service = @vcloud.get_internet_services(@public_ip.href).body[:InternetService].first
|
13
|
+
@ip_data = { :id => @public_ip.id, :name => @public_ip.name, :href => @public_ip.href.to_s }
|
14
|
+
@service_data = { :name => @original_service[:Name], :protocol => @original_service[:Protocol],
|
15
|
+
:port => @original_service[:Port], :description => @original_service[:Description],
|
16
|
+
:enabled => @original_service[:Enabled], :redirect_url => @original_service[:RedirectURL],
|
17
|
+
:id => @original_service[:Id], :href => @original_service[:Href], :timeout => @original_service[:Timeout] }
|
18
|
+
end
|
16
19
|
|
17
|
-
|
20
|
+
context "with a valid Internet Service uri and valid data" do
|
18
21
|
|
19
|
-
|
22
|
+
subject { @vcloud.configure_internet_service(@original_service[:Href], @service_data, @ip_data) }
|
20
23
|
|
21
|
-
|
24
|
+
it_should_behave_like "all responses"
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
+
context "with some changed data" do
|
27
|
+
before do
|
28
|
+
@service_data[:description] = "TEST BOOM"
|
29
|
+
end
|
30
|
+
it "should change data" do
|
31
|
+
@original_service[:Description].should == "Web Servers"
|
32
|
+
result = subject
|
33
|
+
result.body[:Description].should == "TEST BOOM"
|
34
|
+
@vcloud.get_internet_services(@public_ip.href).body[:InternetService].first[:Description].should == "TEST BOOM"
|
35
|
+
end
|
26
36
|
end
|
27
|
-
it "should change data" do
|
28
|
-
@original_service.description.should == "Web Servers"
|
29
|
-
result = subject
|
30
|
-
result.body.description.should == "TEST BOOM"
|
31
|
-
@vcloud.get_internet_services(@public_ip.href).body.links.first.description.should == "TEST BOOM"
|
32
|
-
end
|
33
|
-
end
|
34
37
|
|
35
|
-
|
38
|
+
end
|
36
39
|
|
37
|
-
|
38
|
-
|
40
|
+
context "with an internet_services_uri that doesn't exist" do
|
41
|
+
subject { lambda { @vcloud.configure_internet_service(URI.parse('https://www.fakey.c/piv8vc99'), @service_data, @ip_data ) } }
|
39
42
|
|
40
|
-
|
43
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
44
|
+
end
|
41
45
|
end
|
42
46
|
end
|
47
|
+
else
|
43
48
|
end
|
44
49
|
|
@@ -1,34 +1,37 @@
|
|
1
|
-
require
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
#it { should respond_to :delete_internet_service }
|
7
8
|
|
8
|
-
|
9
|
-
before do
|
10
|
-
|
11
|
-
|
12
|
-
end
|
9
|
+
#describe "#delete_internet_service" do
|
10
|
+
# before do
|
11
|
+
# @public_ip = @vcloud.vdcs[0].public_ips[0]
|
12
|
+
# @before_services = @vcloud.get_internet_services(@public_ip.href)
|
13
|
+
# end
|
13
14
|
|
14
|
-
context "with a valid internet service uri" do
|
15
|
-
|
15
|
+
# context "with a valid internet service uri" do
|
16
|
+
# subject { @vcloud.delete_internet_service(@before_services.body.tap{|o| pp o}.links[0].href) }
|
17
|
+
#
|
18
|
+
# specify { @before_services.body.links.should have(2).links }
|
16
19
|
|
17
|
-
|
20
|
+
# it "has the right number of Internet Services after" do
|
21
|
+
# subject
|
22
|
+
# after_services = @vcloud.get_internet_services(@public_ip.href)
|
23
|
+
# after_services.body.links.should have(1).link
|
24
|
+
# end
|
18
25
|
|
19
|
-
|
20
|
-
subject
|
21
|
-
after_services = @vcloud.get_internet_services(@public_ip.href)
|
22
|
-
after_services.body.links.should have(1).link
|
23
|
-
end
|
26
|
+
# end
|
24
27
|
|
25
|
-
|
28
|
+
# context "with a public_ips_uri that doesn't exist" do
|
29
|
+
# subject { lambda { @vcloud.delete_internet_service(URI.parse('https://www.fakey.c/piv8vc99')) } }
|
26
30
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
it_should_behave_like "a request for a resource that doesn't exist"
|
31
|
-
end
|
31
|
+
# it_should_behave_like "a request for a resource that doesn't exist"
|
32
|
+
# end
|
33
|
+
#end
|
32
34
|
end
|
35
|
+
else
|
33
36
|
end
|
34
37
|
|
@@ -1,57 +1,65 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
|
+
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
|
+
subject { @vcloud }
|
6
|
+
|
7
|
+
it { should respond_to :get_internet_services }
|
8
|
+
|
9
|
+
describe "#get_internet_services" do
|
10
|
+
context "with a valid VDC internet_services_uri" do
|
11
|
+
before { @services = @vcloud.get_internet_services( @mock_vdc[:href] + "/internetServices" ) }
|
12
|
+
subject { @services }
|
13
|
+
|
14
|
+
it_should_behave_like "all responses"
|
15
|
+
it { should have_headers_denoting_a_content_type_of "application/vnd.tmrk.ecloud.internetServicesList+xml" }
|
16
|
+
|
17
|
+
describe "#body" do
|
18
|
+
subject { @services.body }
|
19
|
+
|
20
|
+
it { should have(3).items }
|
21
|
+
|
22
|
+
its(:xmlns) { should == "urn:tmrk:eCloudExtensions-2.3" }
|
23
|
+
its(:xmlns_i) { should == "http://www.w3.org/2001/XMLSchema-instance" }
|
24
|
+
|
25
|
+
context "[:InternetService]" do
|
26
|
+
subject { @services.body[:InternetService] }
|
27
|
+
|
28
|
+
it { should have(4).items }
|
29
|
+
|
30
|
+
[0,1,2,3].each do |idx|
|
31
|
+
let(:service) { subject[idx] }
|
32
|
+
let(:mock_service) { @mock_vdc[:public_ips].map { |ip| ip[:services] }.flatten[idx] }
|
33
|
+
let(:mock_ip) { @mock_vdc[:public_ips].detect { |ip| ip[:services].detect { |ipservice| ipservice[:id] == service[:Id] } } }
|
34
|
+
specify { service.should be_an_instance_of Hash }
|
35
|
+
specify { service.should have(11).attributes }
|
36
|
+
specify { service[:Name].should == mock_service[:name] }
|
37
|
+
specify { service[:Id].should == mock_service[:id] }
|
38
|
+
specify { service[:Href].should == Fog::Vcloud::Terremark::Ecloud::Mock.internet_service_href(mock_service) }
|
39
|
+
|
40
|
+
specify { service[:PublicIpAddress].should be_an_instance_of Hash }
|
41
|
+
specify { service[:PublicIpAddress].should have(3).attributes }
|
42
|
+
specify { service[:PublicIpAddress][:Name].should == mock_ip[:name] }
|
43
|
+
specify { service[:PublicIpAddress][:Id].should == mock_ip[:id] }
|
44
|
+
|
45
|
+
specify { service[:Port].should == mock_service[:port] }
|
46
|
+
specify { service[:Protocol].should == mock_service[:protocol] }
|
47
|
+
specify { service[:Enabled].should == mock_service[:enabled] }
|
48
|
+
specify { service[:Timeout].should == mock_service[:timeout] }
|
49
|
+
specify { service[:Description].should == mock_service[:description] }
|
50
|
+
specify { service[:RedirectURL].should == "" }
|
51
|
+
specify { service[:Monitor].should == "" }
|
52
|
+
end
|
46
53
|
end
|
47
54
|
end
|
48
55
|
end
|
49
|
-
end
|
50
56
|
|
51
|
-
|
52
|
-
|
57
|
+
context "with a public_ips_uri that doesn't exist" do
|
58
|
+
subject { lambda { @vcloud.get_internet_services(URI.parse('https://www.fakey.c/piv8vc99')) } }
|
53
59
|
|
54
|
-
|
60
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
61
|
+
end
|
55
62
|
end
|
56
63
|
end
|
64
|
+
else
|
57
65
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
|
+
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
|
+
subject { @vcloud }
|
6
|
+
|
7
|
+
it { should respond_to :get_network_ip }
|
8
|
+
|
9
|
+
describe "#get_network_ip" do
|
10
|
+
context "with a valid ip_uri" do
|
11
|
+
before do
|
12
|
+
@mock_network = @mock_vdc[:networks][0]
|
13
|
+
@mock_ip = @mock_network[:ips].keys.first
|
14
|
+
@mock_ip_href = "#{Fog::Vcloud::Terremark::Ecloud::Mock.extension_url}/ip/#{@mock_ip.gsub('.','')}"
|
15
|
+
@ip = @vcloud.get_network_ip( @mock_ip_href )
|
16
|
+
end
|
17
|
+
|
18
|
+
subject { @ip }
|
19
|
+
|
20
|
+
it_should_behave_like "all responses"
|
21
|
+
it { should have_headers_denoting_a_content_type_of "application/vnd.tmrk.ecloud.ip+xml" }
|
22
|
+
|
23
|
+
describe "#body" do
|
24
|
+
subject { @ip.body }
|
25
|
+
|
26
|
+
its(:Name) { should == @mock_ip }
|
27
|
+
its(:Href) { should == @mock_ip_href }
|
28
|
+
its(:Id) { should == @mock_ip.gsub('.','') }
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "with an ip_uri that doesn't exist" do
|
34
|
+
subject { lambda { @vcloud.get_network_ip('https://www.fakey.c/piv89') } }
|
35
|
+
|
36
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
else
|
41
|
+
end
|
@@ -1,54 +1,59 @@
|
|
1
|
-
require
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :get_network_ips }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
describe "#get_network_ips" do
|
10
|
+
context "with a valid VDC network ips_uri" do
|
11
|
+
before { @ips = @vcloud.get_network_ips( @mock_network[:href] + "/ips" ) }
|
12
|
+
subject { @ips }
|
12
13
|
|
13
|
-
|
14
|
+
it_should_behave_like "all responses"
|
15
|
+
it { should have_headers_denoting_a_content_type_of "application/vnd.tmrk.ecloud.ipAddressesList+xml" }
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
describe "#body" do
|
18
|
+
subject { @ips.body }
|
17
19
|
|
18
|
-
|
20
|
+
it { should have(1).item }
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
subject { @ips.body.addresses }
|
22
|
+
context "[:IpAddress]" do
|
23
|
+
subject { @ips.body[:IpAddress] }
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
let(:address) { subject[0] }
|
28
|
-
|
29
|
-
specify { address.status.should == "Assigned" }
|
30
|
-
specify { address.server.should == "Broom 1" }
|
31
|
-
specify { address.name.should == "1.2.3.3" }
|
25
|
+
# Note the real TMRK API returns only "assigned" ips currently
|
26
|
+
# This is a bug they've slated to fix in the next release.
|
27
|
+
it { should have(252).addresses }
|
32
28
|
|
33
29
|
end
|
34
30
|
|
35
|
-
|
36
|
-
let(:address) {
|
37
|
-
|
38
|
-
specify { address.
|
39
|
-
specify { address.
|
40
|
-
specify { address.
|
41
|
-
|
31
|
+
context "one we know is assigned" do
|
32
|
+
let(:address) { @ips.body[:IpAddress][0] }
|
33
|
+
specify { address.should have(5).keys }
|
34
|
+
specify { address[:Status].should == "Assigned" }
|
35
|
+
specify { address[:Server].should == "Broom 1" }
|
36
|
+
specify { address[:Name].should == "1.2.3.3" }
|
37
|
+
specify { address[:RnatAddress].should == "99.1.2.3" }
|
42
38
|
end
|
43
39
|
|
40
|
+
context "one we know is assigned" do
|
41
|
+
let(:address) { @ips.body[:IpAddress][100] }
|
42
|
+
specify { address.should have(4).keys }
|
43
|
+
specify { address[:Status].should == "Available" }
|
44
|
+
specify { address.has_key?(:Server).should be_false }
|
45
|
+
specify { address[:Name].should == "1.2.3.103" }
|
46
|
+
specify { address[:RnatAddress].should == "99.1.2.3" }
|
47
|
+
end
|
44
48
|
end
|
45
49
|
end
|
46
|
-
end
|
47
50
|
|
48
|
-
|
49
|
-
|
51
|
+
context "with a network ips uri that doesn't exist" do
|
52
|
+
subject { lambda { @vcloud.get_network_ips(URI.parse('https://www.fakey.c/piv8vc99')) } }
|
50
53
|
|
51
|
-
|
54
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
55
|
+
end
|
52
56
|
end
|
53
57
|
end
|
58
|
+
else
|
54
59
|
end
|