fog-openstack 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.travis.yml +6 -2
- data/README.md +4 -0
- data/Rakefile +10 -2
- data/fog-openstack.gemspec +2 -3
- data/gemfiles/Gemfile-1.9 +1 -1
- data/lib/fog/openstack.rb +14 -6
- data/lib/fog/openstack/baremetal.rb +1 -1
- data/lib/fog/openstack/common.rb +0 -2
- data/lib/fog/openstack/compute.rb +78 -75
- data/lib/fog/openstack/core.rb +2 -1
- data/lib/fog/openstack/docs/compute.md +1 -1
- data/lib/fog/openstack/docs/network.md +283 -0
- data/lib/fog/openstack/docs/nfv.md +144 -0
- data/lib/fog/openstack/examples/compute/block_device_mapping_v2.rb +4 -4
- data/lib/fog/openstack/examples/network/network_add_port.rb +21 -0
- data/lib/fog/openstack/examples/network/network_rbac.rb +69 -0
- data/lib/fog/openstack/identity.rb +14 -22
- data/lib/fog/openstack/identity_v2.rb +1 -1
- data/lib/fog/openstack/image_v1.rb +13 -28
- data/lib/fog/openstack/image_v2.rb +15 -17
- data/lib/fog/openstack/introspection.rb +1 -1
- data/lib/fog/openstack/metering.rb +1 -1
- data/lib/fog/openstack/models/collection.rb +4 -1
- data/lib/fog/openstack/models/compute/availability_zone.rb +5 -0
- data/lib/fog/openstack/models/compute/flavor.rb +21 -9
- data/lib/fog/openstack/models/compute/server.rb +64 -77
- data/lib/fog/openstack/models/compute/snapshot.rb +6 -6
- data/lib/fog/openstack/models/compute/volume_attachment.rb +15 -0
- data/lib/fog/openstack/models/compute/volume_attachments.rb +20 -0
- data/lib/fog/openstack/models/identity_v3/projects.rb +1 -1
- data/lib/fog/openstack/models/identity_v3/users.rb +2 -2
- data/lib/fog/openstack/models/image_v2/image.rb +41 -22
- data/lib/fog/openstack/models/network/floating_ip.rb +1 -0
- data/lib/fog/openstack/models/network/rbac_policies.rb +33 -0
- data/lib/fog/openstack/models/network/rbac_policy.rb +35 -0
- data/lib/fog/openstack/models/nfv/vnf.rb +58 -0
- data/lib/fog/openstack/models/nfv/vnfd.rb +53 -0
- data/lib/fog/openstack/models/nfv/vnfds.rb +28 -0
- data/lib/fog/openstack/models/nfv/vnfs.rb +28 -0
- data/lib/fog/openstack/models/volume/snapshot.rb +38 -0
- data/lib/fog/openstack/models/volume/snapshots.rb +26 -0
- data/lib/fog/openstack/models/volume/volume.rb +32 -2
- data/lib/fog/openstack/models/volume/volume_type.rb +3 -4
- data/lib/fog/openstack/models/volume_v1/snapshot.rb +43 -0
- data/lib/fog/openstack/models/volume_v1/snapshots.rb +16 -0
- data/lib/fog/openstack/models/volume_v1/volume.rb +12 -2
- data/lib/fog/openstack/models/volume_v2/snapshot.rb +43 -0
- data/lib/fog/openstack/models/volume_v2/snapshots.rb +16 -0
- data/lib/fog/openstack/models/volume_v2/volume.rb +12 -3
- data/lib/fog/openstack/network.rb +53 -46
- data/lib/fog/openstack/nfv.rb +158 -0
- data/lib/fog/openstack/orchestration.rb +1 -1
- data/lib/fog/openstack/planning.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +1 -1
- data/lib/fog/openstack/requests/compute/{create_volume_snapshot.rb → create_snapshot.rb} +16 -16
- data/lib/fog/openstack/requests/compute/delete_flavor_metadata.rb +30 -0
- data/lib/fog/openstack/requests/compute/evacuate_server.rb +8 -7
- data/lib/fog/openstack/requests/compute/get_key_pair.rb +49 -0
- data/lib/fog/openstack/requests/compute/list_availability_zones.rb +23 -0
- data/lib/fog/openstack/requests/compute/list_volume_attachments.rb +31 -0
- data/lib/fog/openstack/requests/compute/update_flavor_metadata.rb +33 -0
- data/lib/fog/openstack/requests/network/create_rbac_policy.rb +42 -0
- data/lib/fog/openstack/requests/network/delete_rbac_policy.rb +28 -0
- data/lib/fog/openstack/requests/network/get_rbac_policy.rb +28 -0
- data/lib/fog/openstack/requests/network/list_rbac_policies.rb +25 -0
- data/lib/fog/openstack/requests/network/update_port.rb +8 -7
- data/lib/fog/openstack/requests/network/update_rbac_policy.rb +41 -0
- data/lib/fog/openstack/requests/nfv/create_vnf.rb +37 -0
- data/lib/fog/openstack/requests/nfv/create_vnfd.rb +35 -0
- data/lib/fog/openstack/requests/nfv/delete_vnf.rb +23 -0
- data/lib/fog/openstack/requests/nfv/delete_vnfd.rb +23 -0
- data/lib/fog/openstack/requests/nfv/get_vnf.rb +24 -0
- data/lib/fog/openstack/requests/nfv/get_vnfd.rb +24 -0
- data/lib/fog/openstack/requests/nfv/list_vnfds.rb +25 -0
- data/lib/fog/openstack/requests/nfv/list_vnfs.rb +25 -0
- data/lib/fog/openstack/requests/nfv/update_vnf.rb +35 -0
- data/lib/fog/openstack/requests/volume/action.rb +16 -0
- data/lib/fog/openstack/requests/volume/create_snapshot.rb +18 -0
- data/lib/fog/openstack/requests/volume/delete_metadata.rb +15 -0
- data/lib/fog/openstack/requests/volume/delete_snapshot.rb +5 -5
- data/lib/fog/openstack/requests/volume/delete_snapshot_metadata.rb +15 -0
- data/lib/fog/openstack/requests/volume/replace_metadata.rb +20 -0
- data/lib/fog/openstack/requests/volume/update_metadata.rb +20 -0
- data/lib/fog/openstack/requests/volume/update_snapshot.rb +37 -0
- data/lib/fog/openstack/requests/volume/update_snapshot_metadata.rb +20 -0
- data/lib/fog/openstack/requests/volume/update_volume.rb +25 -0
- data/lib/fog/openstack/requests/volume_v1/action.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/create_snapshot.rb +45 -0
- data/lib/fog/openstack/requests/volume_v1/delete_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/delete_snapshot_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/replace_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/update_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/update_snapshot.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/update_snapshot_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/update_volume.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/action.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/create_snapshot.rb +45 -0
- data/lib/fog/openstack/requests/volume_v2/delete_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/delete_snapshot_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/replace_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/update_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/update_snapshot.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/update_snapshot_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/update_volume.rb +2 -0
- data/lib/fog/openstack/storage.rb +1 -1
- data/lib/fog/openstack/version.rb +1 -1
- data/lib/fog/openstack/volume.rb +1 -1
- data/lib/fog/openstack/volume_v1.rb +29 -21
- data/lib/fog/openstack/volume_v2.rb +29 -21
- data/supported.md +54 -0
- data/tests/openstack/models/identity/ec2_credential_tests.rb +1 -1
- data/tests/openstack/models/identity/ec2_credentials_tests.rb +1 -1
- data/tests/openstack/models/identity/role_tests.rb +8 -3
- data/tests/openstack/models/identity/roles_tests.rb +5 -4
- data/tests/openstack/models/identity/tenant_tests.rb +7 -4
- data/tests/openstack/models/identity/tenants_tests.rb +10 -5
- data/tests/openstack/models/identity/user_tests.rb +4 -3
- data/tests/openstack/models/identity/users_tests.rb +10 -6
- data/tests/openstack/models/nfv/vnf_tests.rb +35 -0
- data/tests/openstack/models/nfv/vnfd_tests.rb +23 -0
- data/tests/openstack/models/nfv/vnfds_tests.rb +31 -0
- data/tests/openstack/models/nfv/vnfs_tests.rb +38 -0
- data/tests/openstack/requests/identity/ec2_credentials_tests.rb +6 -9
- data/tests/openstack/requests/identity/helper.rb +12 -4
- data/tests/openstack/requests/identity/role_tests.rb +13 -10
- data/tests/openstack/requests/identity/tenant_tests.rb +10 -9
- data/tests/openstack/requests/identity/user_tests.rb +11 -6
- data/tests/openstack/requests/image/image_tests.rb +1 -0
- data/tests/openstack/requests/nfv/vnf_tests.rb +70 -0
- data/tests/openstack/requests/nfv/vnfd_tests.rb +44 -0
- metadata +81 -31
- data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +0 -26
- data/lib/fog/openstack/requests/volume_v1/create_volume_snapshot.rb +0 -44
- data/lib/fog/openstack/requests/volume_v2/create_volume_snapshot.rb +0 -43
- data/tests/openstack/authenticate_tests.rb +0 -200
- data/tests/openstack/identity_version_tests.rb +0 -25
- data/tests/openstack/storage_tests.rb +0 -18
- data/tests/openstack/version_tests.rb +0 -55
- data/tests/openstack/volume_tests.rb +0 -18
@@ -1,26 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Volume
|
3
|
-
class OpenStack
|
4
|
-
module Real
|
5
|
-
private
|
6
|
-
def _create_volume_snapshot(data)
|
7
|
-
data = {
|
8
|
-
'snapshot' => {
|
9
|
-
'volume_id' => volume_id,
|
10
|
-
'display_name' => name,
|
11
|
-
'display_description' => description,
|
12
|
-
'force' => force
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
request(
|
17
|
-
:body => Fog::JSON.encode(data),
|
18
|
-
:expects => [200, 202],
|
19
|
-
:method => 'POST',
|
20
|
-
:path => "snapshots"
|
21
|
-
)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Volume
|
3
|
-
class OpenStack
|
4
|
-
class V1
|
5
|
-
class Real
|
6
|
-
def create_volume_snapshot(volume_id, name, description, force=false)
|
7
|
-
data = {
|
8
|
-
'snapshot' => {
|
9
|
-
'volume_id' => volume_id,
|
10
|
-
'display_name' => name,
|
11
|
-
'display_description' => description,
|
12
|
-
'force' => force
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
_create_volume_snapshot(data)
|
17
|
-
end
|
18
|
-
|
19
|
-
include Fog::Volume::OpenStack::Real
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
class Mock
|
24
|
-
def create_volume_snapshot(volume_id, name, description, force=false)
|
25
|
-
response = Excon::Response.new
|
26
|
-
response.status = 202
|
27
|
-
response.body = {
|
28
|
-
"snapshot" => {
|
29
|
-
"status" => "creating",
|
30
|
-
"display_name" => name,
|
31
|
-
"created_at" => Time.now,
|
32
|
-
"display_description" => description,
|
33
|
-
"volume_id" => volume_id,
|
34
|
-
"id" => "5",
|
35
|
-
"size" => 1
|
36
|
-
}
|
37
|
-
}
|
38
|
-
response
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Volume
|
3
|
-
class OpenStack
|
4
|
-
class V2
|
5
|
-
class Real
|
6
|
-
def create_volume_snapshot(volume_id, name, description, force=false)
|
7
|
-
data = {
|
8
|
-
'snapshot' => {
|
9
|
-
'volume_id' => volume_id,
|
10
|
-
'name' => name,
|
11
|
-
'description' => description,
|
12
|
-
'force' => force
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
_create_volume_snapshot(data)
|
17
|
-
end
|
18
|
-
|
19
|
-
include Fog::Volume::OpenStack::Real
|
20
|
-
end
|
21
|
-
|
22
|
-
class Mock
|
23
|
-
def create_volume_snapshot(volume_id, name, description, force=false)
|
24
|
-
response = Excon::Response.new
|
25
|
-
response.status = 202
|
26
|
-
response.body = {
|
27
|
-
"snapshot" => {
|
28
|
-
"status" => "creating",
|
29
|
-
"name" => name,
|
30
|
-
"created_at" => Time.now,
|
31
|
-
"description" => description,
|
32
|
-
"volume_id" => volume_id,
|
33
|
-
"id" => "5",
|
34
|
-
"size" => 1
|
35
|
-
}
|
36
|
-
}
|
37
|
-
response
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,200 +0,0 @@
|
|
1
|
-
require 'fog/core'
|
2
|
-
require 'fog/json'
|
3
|
-
require 'fog/openstack'
|
4
|
-
require 'fog/openstack/identity'
|
5
|
-
require 'fog/openstack/identity_v2'
|
6
|
-
require 'fog/openstack/identity_v3'
|
7
|
-
|
8
|
-
Shindo.tests('OpenStack | authenticate', ['openstack']) do
|
9
|
-
begin
|
10
|
-
@old_mock_value = Excon.defaults[:mock]
|
11
|
-
Excon.defaults[:mock] = true
|
12
|
-
Excon.stubs.clear
|
13
|
-
|
14
|
-
expires = Time.now.utc + 600
|
15
|
-
token = Fog::Mock.random_numbers(8).to_s
|
16
|
-
tenant_token = Fog::Mock.random_numbers(8).to_s
|
17
|
-
|
18
|
-
body = {
|
19
|
-
"access" => {
|
20
|
-
"token" => {
|
21
|
-
"expires" => expires.iso8601,
|
22
|
-
"id" => token,
|
23
|
-
"tenant" => {
|
24
|
-
"enabled" => true,
|
25
|
-
"description" => nil,
|
26
|
-
"name" => "admin",
|
27
|
-
"id" => tenant_token,
|
28
|
-
}
|
29
|
-
},
|
30
|
-
"serviceCatalog" => [{
|
31
|
-
"endpoints" => [{
|
32
|
-
"adminURL" =>
|
33
|
-
"http://example:8774/v2/#{tenant_token}",
|
34
|
-
"region" => "RegionOne",
|
35
|
-
"internalURL" =>
|
36
|
-
"http://example:8774/v2/#{tenant_token}",
|
37
|
-
"id" => Fog::Mock.random_numbers(8).to_s,
|
38
|
-
"publicURL" =>
|
39
|
-
"http://example:8774/v2/#{tenant_token}"
|
40
|
-
}],
|
41
|
-
"endpoints_links" => [],
|
42
|
-
"type" => "compute",
|
43
|
-
"name" => "nova"
|
44
|
-
},
|
45
|
-
{ "endpoints" => [{
|
46
|
-
"adminURL" => "http://example:9292",
|
47
|
-
"region" => "RegionOne",
|
48
|
-
"internalURL" => "http://example:9292",
|
49
|
-
"id" => Fog::Mock.random_numbers(8).to_s,
|
50
|
-
"publicURL" => "http://example:9292"
|
51
|
-
}],
|
52
|
-
"endpoints_links" => [],
|
53
|
-
"type" => "image",
|
54
|
-
"name" => "glance"
|
55
|
-
}],
|
56
|
-
"user" => {
|
57
|
-
"username" => "admin",
|
58
|
-
"roles_links" => [],
|
59
|
-
"id" => Fog::Mock.random_numbers(8).to_s,
|
60
|
-
"roles" => [
|
61
|
-
{ "name" => "admin" },
|
62
|
-
{ "name" => "KeystoneAdmin" },
|
63
|
-
{ "name" => "KeystoneServiceAdmin" }
|
64
|
-
],
|
65
|
-
"name" => "admin"
|
66
|
-
},
|
67
|
-
"metadata" => {
|
68
|
-
"is_admin" => 0,
|
69
|
-
"roles" => [
|
70
|
-
Fog::Mock.random_numbers(8).to_s,
|
71
|
-
Fog::Mock.random_numbers(8).to_s,
|
72
|
-
Fog::Mock.random_numbers(8).to_s,]}}}
|
73
|
-
|
74
|
-
tests("v2") do
|
75
|
-
Excon.stub({ :method => 'POST', :path => "/v2.0/tokens" },
|
76
|
-
{ :status => 200, :body => Fog::JSON.encode(body) })
|
77
|
-
|
78
|
-
expected = {
|
79
|
-
:user => body['access']['user'],
|
80
|
-
:tenant => body['access']['token']['tenant'],
|
81
|
-
:identity_public_endpoint => nil,
|
82
|
-
:server_management_url =>
|
83
|
-
body['access']['serviceCatalog'].
|
84
|
-
first['endpoints'].first['publicURL'],
|
85
|
-
:token => token,
|
86
|
-
:expires => expires.iso8601,
|
87
|
-
:current_user_id => body['access']['user']['id'],
|
88
|
-
:unscoped_token => token,
|
89
|
-
}
|
90
|
-
|
91
|
-
returns(expected) do
|
92
|
-
Fog::OpenStack.authenticate_v2(
|
93
|
-
:openstack_auth_uri => URI('http://example/v2.0/tokens'),
|
94
|
-
:openstack_tenant => 'admin',
|
95
|
-
:openstack_service_type => %w[compute])
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
tests("validate token") do
|
100
|
-
Fog::Identity[:openstack].validate_token(token, tenant_token)
|
101
|
-
Fog::Identity[:openstack].validate_token(token)
|
102
|
-
end
|
103
|
-
|
104
|
-
tests("check token") do
|
105
|
-
Fog::Identity[:openstack].check_token(token, tenant_token)
|
106
|
-
Fog::Identity[:openstack].check_token(token)
|
107
|
-
end
|
108
|
-
|
109
|
-
tests("v2 missing service") do
|
110
|
-
Excon.stub({ :method => 'POST', :path => "/v2.0/tokens" },
|
111
|
-
{ :status => 200, :body => Fog::JSON.encode(body) })
|
112
|
-
|
113
|
-
raises(Fog::Errors::NotFound,
|
114
|
-
'Could not find service network. Have compute, image') do
|
115
|
-
Fog::OpenStack.authenticate_v2(
|
116
|
-
:openstack_auth_uri => URI('http://example/v2.0/tokens'),
|
117
|
-
:openstack_tenant => 'admin',
|
118
|
-
:openstack_service_type => %w[network])
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
tests("v2 missing storage service") do
|
123
|
-
Excon.stub({ :method => 'POST', :path => "/v2.0/tokens" },
|
124
|
-
{ :status => 200, :body => Fog::JSON.encode(body) })
|
125
|
-
|
126
|
-
raises(NoMethodError,
|
127
|
-
"undefined method `join' for \"object-store\":String") do
|
128
|
-
Fog::OpenStack.authenticate_v2(
|
129
|
-
:openstack_auth_uri => URI('http://example/v2.0/tokens'),
|
130
|
-
:openstack_tenant => 'admin',
|
131
|
-
:openstack_service_type => 'object-store')
|
132
|
-
end
|
133
|
-
raises(Fog::Errors::NotFound,
|
134
|
-
"Could not find service object-store. Have compute, image") do
|
135
|
-
Fog::OpenStack.authenticate_v2(
|
136
|
-
:openstack_auth_uri => URI('http://example/v2.0/tokens'),
|
137
|
-
:openstack_tenant => 'admin',
|
138
|
-
:openstack_service_type => %w[object-store])
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
tests("v2 auth with two compute services") do
|
143
|
-
body_clone = body.clone
|
144
|
-
body_clone["access"]["serviceCatalog"] <<
|
145
|
-
{
|
146
|
-
"endpoints" => [{
|
147
|
-
"adminURL" =>
|
148
|
-
"http://example2:8774/v2/#{tenant_token}",
|
149
|
-
"region" => "RegionOne",
|
150
|
-
"internalURL" =>
|
151
|
-
"http://example2:8774/v2/#{tenant_token}",
|
152
|
-
"id" => Fog::Mock.random_numbers(8).to_s,
|
153
|
-
"publicURL" =>
|
154
|
-
"http://example2:8774/v2/#{tenant_token}"
|
155
|
-
}],
|
156
|
-
"endpoints_links" => [],
|
157
|
-
"type" => "compute",
|
158
|
-
"name" => "nova2"
|
159
|
-
}
|
160
|
-
|
161
|
-
Excon.stub({ :method => 'POST', :path => "/v2.0/tokens" },
|
162
|
-
{ :status => 200, :body => Fog::JSON.encode(body_clone) })
|
163
|
-
|
164
|
-
returns("http://example2:8774/v2/#{tenant_token}") do
|
165
|
-
Fog::OpenStack.authenticate_v2(
|
166
|
-
:openstack_auth_uri => URI('http://example/v2.0/tokens'),
|
167
|
-
:openstack_tenant => 'admin',
|
168
|
-
:openstack_service_type => %w[compute],
|
169
|
-
:openstack_service_name => 'nova2')[:server_management_url]
|
170
|
-
end
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
tests("legacy v1 auth") do
|
175
|
-
headers = {
|
176
|
-
"X-Storage-Url" => "https://swift.myhost.com/v1/AUTH_tenant",
|
177
|
-
"X-Auth-Token" => "AUTH_yui193bdc00c1c46c5858788yuio0e1e2p",
|
178
|
-
"X-Trans-Id" => "iu99nm9999f9b999c9b999dad9cd999e99",
|
179
|
-
"Content-Length" => "0",
|
180
|
-
"Date" => "Wed, 07 Aug 2013 11:11:11 GMT"
|
181
|
-
}
|
182
|
-
|
183
|
-
Excon.stub({:method => 'GET', :path => "/auth/v1.0"},
|
184
|
-
{:status => 200, :body => "", :headers => headers})
|
185
|
-
|
186
|
-
returns("https://swift.myhost.com/v1/AUTH_tenant") do
|
187
|
-
Fog::OpenStack.authenticate_v1(
|
188
|
-
:openstack_auth_uri => URI('https://swift.myhost.com/auth/v1.0'),
|
189
|
-
:openstack_username => 'tenant:dev',
|
190
|
-
:openstack_api_key => 'secret_key',
|
191
|
-
:openstack_service_type => %w[storage])[:server_management_url]
|
192
|
-
end
|
193
|
-
|
194
|
-
end
|
195
|
-
|
196
|
-
ensure
|
197
|
-
Excon.stubs.clear
|
198
|
-
Excon.defaults[:mock] = @old_mock_value
|
199
|
-
end
|
200
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Identity[:openstack] | versions', ['openstack', 'identity']) do
|
2
|
-
begin
|
3
|
-
@old_mock_value = Excon.defaults[:mock]
|
4
|
-
@old_credentials = Fog.credentials
|
5
|
-
|
6
|
-
tests('v2') do
|
7
|
-
Fog.credentials = {:openstack_auth_url => 'http://openstack:35357/v2.0/tokens'}
|
8
|
-
|
9
|
-
returns(Fog::Identity::OpenStack::V2::Mock) do
|
10
|
-
Fog::Identity[:openstack].class
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
tests('v3') do
|
15
|
-
Fog.credentials = {:openstack_auth_url => 'http://openstack:35357/v3/auth/tokens'}
|
16
|
-
|
17
|
-
returns(Fog::Identity::OpenStack::V3::Mock) do
|
18
|
-
Fog::Identity[:openstack].class
|
19
|
-
end
|
20
|
-
end
|
21
|
-
ensure
|
22
|
-
Excon.defaults[:mock] = @old_mock_value
|
23
|
-
Fog.credentials = @old_credentials
|
24
|
-
end
|
25
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Storage[:openstack]', ['openstack', 'storage']) do
|
2
|
-
|
3
|
-
storage = Fog::Storage[:openstack]
|
4
|
-
original_path = storage.instance_variable_get :@path
|
5
|
-
|
6
|
-
tests("account changes") do
|
7
|
-
test("#change_account") do
|
8
|
-
new_account = 'AUTH_1234567890'
|
9
|
-
storage.change_account new_account
|
10
|
-
storage.instance_variable_get(:@path) != original_path
|
11
|
-
end
|
12
|
-
test("#reset_account_name") do
|
13
|
-
storage.reset_account_name
|
14
|
-
storage.instance_variable_get(:@path) == original_path
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
Shindo.tests('OpenStack | versions', ['openstack']) do
|
2
|
-
begin
|
3
|
-
@old_mock_value = Excon.defaults[:mock]
|
4
|
-
Excon.defaults[:mock] = true
|
5
|
-
Excon.stubs.clear
|
6
|
-
|
7
|
-
body = {
|
8
|
-
"versions" => [
|
9
|
-
{ "status" => "CURRENT", "id" => "v2.0", "links" => [ {
|
10
|
-
"href" => "http://example:9292/v2/",
|
11
|
-
"rel" => "self" }
|
12
|
-
]
|
13
|
-
},
|
14
|
-
{ "status" => "CURRENT", "id" => "v1.1", "links" => [ {
|
15
|
-
"href" => "http://exampple:9292/v1/",
|
16
|
-
"rel" => "self"
|
17
|
-
}
|
18
|
-
]
|
19
|
-
},
|
20
|
-
{ "status" => "SUPPORTED", "id"=>"v1.0", "links" => [ {
|
21
|
-
"href" => "http://example:9292/v1/",
|
22
|
-
"rel" => "self"
|
23
|
-
}
|
24
|
-
]
|
25
|
-
}
|
26
|
-
]
|
27
|
-
}
|
28
|
-
|
29
|
-
tests("supported") do
|
30
|
-
Excon.stub({ :method => 'GET' },
|
31
|
-
{ :status => 300, :body => Fog::JSON.encode(body) })
|
32
|
-
|
33
|
-
returns("v1.1") do
|
34
|
-
Fog::OpenStack.get_supported_version(/v1(\.(0|1))*/,
|
35
|
-
URI('http://example/'),
|
36
|
-
"authtoken")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
tests("unsupported") do
|
41
|
-
Excon.stub({ :method => 'GET' },
|
42
|
-
{ :status => 300, :body => Fog::JSON.encode(body) })
|
43
|
-
|
44
|
-
raises(Fog::OpenStack::Errors::ServiceUnavailable) do
|
45
|
-
Fog::OpenStack.get_supported_version(/v3(\.(0|1))*/,
|
46
|
-
URI('http://example/'),
|
47
|
-
"authtoken")
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
ensure
|
52
|
-
Excon.stubs.clear
|
53
|
-
Excon.defaults[:mock] = @old_mock_value
|
54
|
-
end
|
55
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'fog/openstack/volume'
|
2
|
-
require 'fog/openstack/volume_v1'
|
3
|
-
require 'fog/openstack/volume_v2'
|
4
|
-
|
5
|
-
Shindo.tests('Fog::Volume[:openstack]', ['openstack', 'volume']) do
|
6
|
-
|
7
|
-
volume = Fog::Volume[:openstack]
|
8
|
-
|
9
|
-
tests("Volumes collection") do
|
10
|
-
%w{ volumes }.each do |collection|
|
11
|
-
test("it should respond to #{collection}") { volume.respond_to? collection }
|
12
|
-
test("it should respond to #{collection}.all") { eval("volume.#{collection}").respond_to? 'all' }
|
13
|
-
# not implemented
|
14
|
-
#test("it should respond to #{collection}.get") { eval("volume.#{collection}").respond_to? 'get' }
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|