openstack 1.0.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +54 -4
- data/VERSION +1 -1
- data/lib/openstack.rb +4 -2
- data/lib/openstack/connection.rb +5 -1
- data/lib/openstack/network/connection.rb +100 -0
- data/lib/openstack/network/network.rb +26 -0
- data/lib/openstack/network/port.rb +32 -0
- data/lib/openstack/network/subnet.rb +33 -0
- data/lib/openstack/swift/connection.rb +1 -1
- data/test/authentication_test.rb +5 -19
- metadata +7 -3
data/README.rdoc
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
== Description
|
4
4
|
|
5
|
-
Ruby Openstack Compute, Object-Store
|
6
|
-
|
5
|
+
Ruby Openstack Compute, Object-Store, Block Storage and Network (Quantum) bindings for the OpenStack API.
|
6
|
+
a
|
7
7
|
http://api.openstack.org/api-reference.html
|
8
8
|
|
9
9
|
Currently supports both v1.0 and v2.0 (keystone) auth.
|
10
10
|
|
11
|
-
Use OpenStack::Connection.create to get a handle to an OpenStack service - set the :service_type parameter to
|
11
|
+
Use OpenStack::Connection.create to get a handle to an OpenStack service - set the :service_type parameter to 'compute', 'object-store', 'volume' or 'network' (defaults to 'compute'). If the requested service is not deployed the gem will throw a OpenStack::Exception::NotImplemented (501) - e.g. :service_type is 'object-store' but swift service isn't deployed.
|
12
12
|
|
13
13
|
The OpenStack::Connection.create class method is a factory constructor which will return the appropriate Connection object, depending on the ':service_type' parameter passed with the options hash: set to either 'compute', 'volume', or 'object-store' (defaults to 'compute') - see below for examples.
|
14
14
|
|
@@ -367,9 +367,59 @@ See the class definitions for documentation on specific methods and operations.
|
|
367
367
|
=> OpenStack::Exception::ItemNotFound: The resource could not be found
|
368
368
|
|
369
369
|
|
370
|
+
== Examples for Network (Quantum):
|
371
|
+
|
372
|
+
quantum = OpenStack::Connection.create({:username => "admin", :api_key=>"le-password", :auth_method=>"password", :auth_url => "http://192.168.1.21:5000/v2.0/", :authtenant_name =>"admin", :service_type=>"network"})
|
373
|
+
|
374
|
+
#Create a network:
|
375
|
+
>> net2 = quantum.create_network("my_net")
|
376
|
+
=> #<OpenStack::Network::Network:0xa8aff70 @id="6b09a5b3-02d3-4996-9933-4792bd4ca11e",@name="my_net", @admin_state_up=true, @status="ACTIVE", @subnets=[], @shared=false, @tenant_id="7be215d541ea4db4a23b3a84b0882408">
|
377
|
+
|
378
|
+
#List networks:
|
379
|
+
>> quantum.networks
|
380
|
+
=> [#<OpenStack::Network::Network:0xa7c8f94 @id="b4abfaff-9e24-4192-9219-a4a60819aba2", @name="net_1363343212", @admin_state_up=true, @status="ACTIVE",
|
381
|
+
@subnets=["34ea9f1e-d71a-48bd-89b0-af2f5c051912","7780f890-8334-43a1-934c-f1ce5edc4561"], @shared=false, @tenant_id="7be215d541ea4db4a23b3a84b0882408">, #<OpenStack::Network::Network:0xa7c8ef4 @id="1cfad632-3473-4c5b-b2d3-405cc3093286", @name="net_1363344435", @admin_state_up=true, @status="ACTIVE", @subnets=["c4293c24-07d0-47dc-bead-ec8d3934b8db"], @shared=false, @tenant_id="7be215d541ea4db4a23b3a84b0882408">]
|
382
|
+
|
383
|
+
>> net1 = quantum.network("b4abfaff-9e24-4192-9219-a4a60819aba2")
|
384
|
+
=> #<OpenStack::Network::Network:0xa7f28e4 @id="b4abfaff-9e24-4192-9219-a4a60819aba2", @name="net_1363343212", @admin_state_up=true, @status="ACTIVE", @subnets=["34ea9f1e-d71a-48bd-89b0-af2f5c051912", "7780f890-8334-43a1-934c-f1ce5edc4561"], @shared=false, @tenant_id="7be215d541ea4db4a23b3a84b0882408">
|
385
|
+
|
386
|
+
#Delete a Network:
|
387
|
+
>> quantum.delete_network("6b09a5b3-02d3-4996-9933-4792bd4ca11e")
|
388
|
+
=> true
|
389
|
+
|
390
|
+
#Create a Subnet:
|
391
|
+
>> subnet1 = quantum.create_subnet("b4abfaff-9e24-4192-9219-a4a60819aba2","192.168.1.0/24")
|
392
|
+
=> #<OpenStack::Network::Subnet:0xa772a2c @id="e978da1c-9c95-4e58-b4b6-4dcce4640a7f", @network_id="b4abfaff-9e24-4192-9219-a4a60819aba2", @name="", @ip_version=4, @cidr="192.168.1.0/24", @gateway_ip="192.168.1.1", @dns_nameservers=[], @allocation_pools=[{"start"=>"192.168.1.2", "end"=>"192.168.1.254"}], @host_routes=[], @enable_dhcp=true, @tenant_id="7be215d541ea4db4a23b3a84b0882408">
|
393
|
+
|
394
|
+
#List Subnets:
|
395
|
+
>> quantum.subnets
|
396
|
+
=> [#<OpenStack::Network::Subnet:0xa850958 @id="34ea9f1e-d71a-48bd-89b0-af2f5c051912", @network_id="b4abfaff-9e24-4192-9219-a4a60819aba2", @name="", @ip_version=4, @cidr="123.123.0.0/16", @gateway_ip="123.123.0.1", @dns_nameservers=[], @allocation_pools=[{"start"=>"123.123.0.2", "end"=>"123.123.255.254"}], @host_routes=[], @enable_dhcp=true, @tenant_id="7be215d541ea4db4a23b3a84b0882408">, #<OpenStack::Network::Subnet:0xa850868 @id="7780f890-8334-43a1-934c-f1ce5edc4561", @network_id="b4abfaff-9e24-4192-9219-a4a60819aba2", @name="", @ip_version=4, @cidr="192.168.1.0/24", @gateway_ip="192.168.1.1", @dns_nameservers=[], @allocation_pools=[{"start"=>"192.168.1.2", "end"=>"192.168.1.254"}], @host_routes=[], @enable_dhcp=true, @tenant_id="7be215d541ea4db4a23b3a84b0882408">]
|
397
|
+
|
398
|
+
>> subnet1 = quantum.subnet("34ea9f1e-d71a-48bd-89b0-af2f5c051912")
|
399
|
+
=> #<OpenStack::Network::Subnet:0xa88ec1c @id="34ea9f1e-d71a-48bd-89b0-af2f5c051912", @network_id="b4abfaff-9e24-4192-9219-a4a60819aba2", @name="", @ip_version=4, @cidr="123.123.0.0/16", @gateway_ip="123.123.0.1", @dns_nameservers=[], @allocation_pools=[{"start"=>"123.123.0.2", "end"=>"123.123.255.254"}], @host_routes=[], @enable_dhcp=true, @tenant_id="7be215d541ea4db4a23b3a84b0882408">
|
400
|
+
|
401
|
+
#Delete a Subnet:
|
402
|
+
>> quantum.delete_subnet("89136e4d-da26-4495-9384-0fd1309e274a")
|
403
|
+
=> true
|
404
|
+
|
405
|
+
#Create a Port:
|
406
|
+
>> created_port = quantum.create_port(network.id, {"fixed_ips"=>[{"subnet_id"=>subnet.id}], "device_id"=>machine.id})
|
407
|
+
=> #<OpenStack::Network::Port:0x95a833c @id="d601db9e-c936-4811-904a-bb5a27d105f3", @network_id="c4dfe90e-a7ce-41f7-b9b2-2f9773f42a6b", @name="", @admin_state_up=true, @status="ACTIVE", @mac_address="fa:16:3e:f4:e8:bc", @fixed_ips=[{"subnet_id"=>"f78bfc05-ead0-40a6-8325-a35eb2b535c3", "ip_address"=>"10.0.0.4"}], @device_id="fe4022fa-a77c-4adf-be45-6e069fb3a314", @device_owner="", @tenant_id="7be215d541ea4db4a23b3a84b0882408">
|
408
|
+
|
409
|
+
#List Ports:
|
410
|
+
>> quantum.ports
|
411
|
+
=> [#<OpenStack::Network::Port:0xa73bdd8 @id="f0db2c95-9449-4eb3-8b12-c66b23c8de41", @network_id="b4abfaff-9e24-4192-9219-a4a60819aba2", @name="", @admin_state_up=true, @status="ACTIVE", @mac_address="fa:16:3e:7e:e0:1b", @fixed_ips=[{"subnet_id"=>"34ea9f1e-d71a-48bd-89b0-af2f5c051912", "ip_address"=>"123.123.0.2"}], @device_id="4357665c-e2fe-4bf0-8a69-b531d11add2d", @device_owner="compute:nova", @tenant_id="7be215d541ea4db4a23b3a84b0882408">, #<OpenStack::Network::Port:0xa73bcac @id="93c210cd-b086-49e1-aa12-d207aa28a981", @network_id="b4abfaff-9e24-4192-9219-a4a60819aba2", @name="", @admin_state_up=true, @status="ACTIVE", @mac_address="fa:16:3e:08:eb:92", @fixed_ips=[{"subnet_id"=>"34ea9f1e-d71a-48bd-89b0-af2f5c051912", "ip_address"=>"123.123.0.3"}], @device_id="5a114ba2-4f49-4655-93f9-96954632cb67", @device_owner="compute:nova", @tenant_id="7be215d541ea4db4a23b3a84b0882408">]
|
412
|
+
|
413
|
+
>> port1 = quantum.port("f0db2c95-9449-4eb3-8b12-c66b23c8de41")
|
414
|
+
=> #<OpenStack::Network::Port:0xa70f51c @id="f0db2c95-9449-4eb3-8b12-c66b23c8de41", @network_id="b4abfaff-9e24-4192-9219-a4a60819aba2", @name="", @admin_state_up=true, @status="ACTIVE", @mac_address="fa:16:3e:7e:e0:1b", @fixed_ips=[{"subnet_id"=>"34ea9f1e-d71a-48bd-89b0-af2f5c051912", "ip_address"=>"123.123.0.2"}], @device_id="4357665c-e2fe-4bf0-8a69-b531d11add2d", @device_owner="compute:nova", @tenant_id="7be215d541ea4db4a23b3a84b0882408">
|
415
|
+
|
416
|
+
#Delete a Port:
|
417
|
+
>> quantum.delete_port("f0db2c95-9449-4eb3-8b12-c66b23c8de41")
|
418
|
+
=> true
|
419
|
+
|
370
420
|
== Authors
|
371
421
|
|
372
|
-
By Dan Prince <dprince@redhat.com>, Naveed Massjouni <naveedm9@gmail.com
|
422
|
+
By Marios Andreou (marios@redhat.com), Dan Prince <dprince@redhat.com>, Naveed Massjouni <naveedm9@gmail.com>
|
373
423
|
|
374
424
|
Initial code checkin on May 23rd 2012 - code refactored from and based on the Rackspace Cloud Servers gem
|
375
425
|
(https://github.com/rackspace/ruby-openstack-compute) and Rackspace Cloud Files gem (https://github.com/rackspace/ruby-cloudfiles).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/lib/openstack.rb
CHANGED
@@ -46,8 +46,10 @@ module OpenStack
|
|
46
46
|
require 'openstack/volume/volume'
|
47
47
|
require 'openstack/volume/snapshot'
|
48
48
|
require 'openstack/image/connection'
|
49
|
-
|
50
|
-
|
49
|
+
require 'openstack/network/connection'
|
50
|
+
require 'openstack/network/network'
|
51
|
+
require 'openstack/network/subnet'
|
52
|
+
require 'openstack/network/port'
|
51
53
|
# Constants that set limits on server creation
|
52
54
|
MAX_PERSONALITY_ITEMS = 5
|
53
55
|
MAX_PERSONALITY_FILE_SIZE = 10240
|
data/lib/openstack/connection.rb
CHANGED
@@ -68,6 +68,8 @@ class Connection
|
|
68
68
|
OpenStack::Volume::Connection.new(connection)
|
69
69
|
when "image"
|
70
70
|
OpenStack::Image::Connection.new(connection)
|
71
|
+
when "network"
|
72
|
+
OpenStack::Network::Connection.new(connection)
|
71
73
|
else
|
72
74
|
raise Exception::InvalidArgument, "Invalid :service_type parameter: #{@service_type}"
|
73
75
|
end
|
@@ -430,6 +432,8 @@ class Exception
|
|
430
432
|
end
|
431
433
|
class ResourceStateConflict < ComputeError # :nodoc:
|
432
434
|
end
|
435
|
+
class QuantumError < ComputeError # :nodoc:
|
436
|
+
end
|
433
437
|
|
434
438
|
# Plus some others that we define here
|
435
439
|
|
@@ -467,7 +471,7 @@ class Exception
|
|
467
471
|
info=val
|
468
472
|
end
|
469
473
|
exception_class = self.const_get(fault[0,1].capitalize+fault[1,fault.length])
|
470
|
-
raise exception_class.new(info["message"], response.code, response.body)
|
474
|
+
raise exception_class.new((info["message"] || info), response.code, response.body)
|
471
475
|
end
|
472
476
|
rescue JSON::ParserError => parse_error
|
473
477
|
deal_with_faulty_error(response, parse_error)
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module OpenStack
|
2
|
+
module Network
|
3
|
+
|
4
|
+
class Connection
|
5
|
+
|
6
|
+
attr_accessor :connection
|
7
|
+
|
8
|
+
def initialize(connection)
|
9
|
+
@connection = connection
|
10
|
+
OpenStack::Authentication.init(@connection)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns true if the authentication was successful and returns false otherwise.
|
14
|
+
#
|
15
|
+
# cs.authok?
|
16
|
+
# => true
|
17
|
+
def authok?
|
18
|
+
@connection.authok
|
19
|
+
end
|
20
|
+
|
21
|
+
def list_networks
|
22
|
+
response = @connection.req("GET", "/networks")
|
23
|
+
nets_hash = JSON.parse(response.body)["networks"]
|
24
|
+
nets_hash.inject([]){|res, current| res << OpenStack::Network::Network.new(current); res}
|
25
|
+
end
|
26
|
+
alias :networks :list_networks
|
27
|
+
|
28
|
+
def get_network(network_id)
|
29
|
+
response = @connection.req("GET", "/networks/#{network_id}")
|
30
|
+
OpenStack::Network::Network.new(JSON.parse(response.body)["network"])
|
31
|
+
end
|
32
|
+
alias :network :get_network
|
33
|
+
|
34
|
+
def create_network(name)
|
35
|
+
req_body = JSON.generate({"network"=>{"name"=>name}})
|
36
|
+
response = @connection.req("POST", "/networks", {:data=>req_body})
|
37
|
+
OpenStack::Network::Network.new(JSON.parse(response.body)["network"])
|
38
|
+
end
|
39
|
+
|
40
|
+
def delete_network(id)
|
41
|
+
@connection.req("DELETE", "/networks/#{id}")
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
45
|
+
def list_subnets
|
46
|
+
response = @connection.req("GET", "/subnets")
|
47
|
+
nets_hash = JSON.parse(response.body)["subnets"]
|
48
|
+
nets_hash.inject([]){|res, current| res << OpenStack::Network::Subnet.new(current); res}
|
49
|
+
end
|
50
|
+
alias :subnets :list_subnets
|
51
|
+
|
52
|
+
def get_subnet(subnet_id)
|
53
|
+
response = @connection.req("GET", "/subnets/#{subnet_id}")
|
54
|
+
OpenStack::Network::Subnet.new(JSON.parse(response.body)["subnet"])
|
55
|
+
end
|
56
|
+
alias :subnet :get_subnet
|
57
|
+
|
58
|
+
def create_subnet(network_id, cidr, ip_version="4", opts={})
|
59
|
+
body_hash = {"subnet"=>{"network_id"=> network_id, "cidr"=>cidr, "ip_version"=>ip_version}}
|
60
|
+
body_hash["subnet"].merge!(opts) #fixme - validation?
|
61
|
+
req_body = JSON.generate(body_hash)
|
62
|
+
response = @connection.req("POST", "/subnets", {:data=>req_body})
|
63
|
+
OpenStack::Network::Subnet.new(JSON.parse(response.body)["subnet"])
|
64
|
+
end
|
65
|
+
|
66
|
+
def delete_subnet(id)
|
67
|
+
@connection.req("DELETE", "/subnets/#{id}")
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
def list_ports
|
72
|
+
response = @connection.req("GET", "/ports")
|
73
|
+
ports_hash = JSON.parse(response.body)["ports"]
|
74
|
+
ports_hash.inject([]){|res, current| res << OpenStack::Network::Port.new(current); res}
|
75
|
+
end
|
76
|
+
alias :ports :list_ports
|
77
|
+
|
78
|
+
def get_port(port_id)
|
79
|
+
response = @connection.req("GET", "/ports/#{port_id}")
|
80
|
+
OpenStack::Network::Port.new(JSON.parse(response.body)["port"])
|
81
|
+
end
|
82
|
+
alias :port :get_port
|
83
|
+
|
84
|
+
def create_port(network_id, opts={})
|
85
|
+
body_hash = {"port"=>{"network_id"=> network_id}}
|
86
|
+
body_hash["port"].merge!(opts) #fixme - validation?
|
87
|
+
req_body = JSON.generate(body_hash)
|
88
|
+
response = @connection.req("POST", "/ports", {:data=>req_body})
|
89
|
+
OpenStack::Network::Port.new(JSON.parse(response.body)["port"])
|
90
|
+
end
|
91
|
+
|
92
|
+
def delete_port(id)
|
93
|
+
@connection.req("DELETE", "/ports/#{id}")
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module OpenStack
|
2
|
+
module Network
|
3
|
+
class Network
|
4
|
+
|
5
|
+
attr_reader :id
|
6
|
+
attr_reader :name
|
7
|
+
attr_reader :admin_state_up
|
8
|
+
attr_reader :status
|
9
|
+
attr_reader :subnets
|
10
|
+
attr_reader :shared
|
11
|
+
attr_reader :tenant_id
|
12
|
+
|
13
|
+
def initialize(net_info={})
|
14
|
+
@id = net_info["id"]
|
15
|
+
@name = net_info["name"]
|
16
|
+
@admin_state_up = net_info["admin_state_up"]
|
17
|
+
@status = net_info["status"]
|
18
|
+
@subnets = net_info["subnets"]
|
19
|
+
@shared = net_info["shared"]
|
20
|
+
@tenant_id = net_info["tenant_id"]
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module OpenStack
|
2
|
+
module Network
|
3
|
+
class Port
|
4
|
+
|
5
|
+
attr_reader :id
|
6
|
+
attr_reader :network_id
|
7
|
+
attr_reader :name
|
8
|
+
attr_reader :admin_state_up
|
9
|
+
attr_reader :status
|
10
|
+
attr_reader :mac_address
|
11
|
+
attr_reader :fixed_ips
|
12
|
+
attr_reader :device_id
|
13
|
+
attr_reader :device_owner
|
14
|
+
attr_reader :tenant_id
|
15
|
+
|
16
|
+
def initialize(port_hash)
|
17
|
+
@id = port_hash["id"]
|
18
|
+
@network_id = port_hash["network_id"]
|
19
|
+
@name = port_hash["name"]
|
20
|
+
@admin_state_up = port_hash["admin_state_up"]
|
21
|
+
@status = port_hash["status"]
|
22
|
+
@mac_address = port_hash["mac_address"]
|
23
|
+
@fixed_ips = port_hash["fixed_ips"]
|
24
|
+
@device_id = port_hash["device_id"]
|
25
|
+
@device_owner = port_hash["device_owner"]
|
26
|
+
@tenant_id = port_hash["tenant_id"]
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module OpenStack
|
2
|
+
module Network
|
3
|
+
class Subnet
|
4
|
+
|
5
|
+
attr_reader :id
|
6
|
+
attr_reader :network_id
|
7
|
+
attr_reader :name
|
8
|
+
attr_reader :ip_version
|
9
|
+
attr_reader :cidr
|
10
|
+
attr_reader :gateway_ip
|
11
|
+
attr_reader :dns_nameservers
|
12
|
+
attr_reader :allocation_pools
|
13
|
+
attr_reader :host_routes
|
14
|
+
attr_reader :enable_dhcp
|
15
|
+
attr_reader :tenant_id
|
16
|
+
|
17
|
+
def initialize(subnet_hash)
|
18
|
+
@id = subnet_hash["id"]
|
19
|
+
@network_id = subnet_hash["network_id"]
|
20
|
+
@name = subnet_hash["name"]
|
21
|
+
@ip_version = subnet_hash["ip_version"]
|
22
|
+
@cidr = subnet_hash["cidr"]
|
23
|
+
@gateway_ip = subnet_hash["gateway_ip"]
|
24
|
+
@dns_nameservers = subnet_hash["dns_nameservers"]
|
25
|
+
@allocation_pools = subnet_hash["allocation_pools"]
|
26
|
+
@host_routes = subnet_hash["host_routes"]
|
27
|
+
@enable_dhcp = subnet_hash["enable_dhcp"]
|
28
|
+
@tenant_id = subnet_hash["tenant_id"]
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -127,7 +127,7 @@ module Swift
|
|
127
127
|
raise OpenStack::Exception::InvalidArgument.new("Container name cannot contain '/'") if containername.match("/")
|
128
128
|
raise OpenStack::Exception::InvalidArgument.new("Container name is limited to 256 characters") if containername.length > 256
|
129
129
|
path = "/#{URI.encode(containername.to_s)}"
|
130
|
-
@connection.req("PUT", path)
|
130
|
+
@connection.req("PUT", path, {:headers=>{"Content-Length"=>"0"}})
|
131
131
|
OpenStack::Swift::Container.new(self, containername)
|
132
132
|
end
|
133
133
|
|
data/test/authentication_test.rb
CHANGED
@@ -33,35 +33,21 @@ class AuthenticationTest < Test::Unit::TestCase
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def test_service_uri
|
37
37
|
server = get_test_auth_server
|
38
38
|
Net::HTTP.stubs(:new).returns(server)
|
39
39
|
server.stubs(:started?).returns(true)
|
40
|
-
connection =
|
40
|
+
connection = v2_auth_connection_stub
|
41
41
|
result = OpenStack::Authentication.init(connection)
|
42
42
|
assert_equal("compute.south.host", result.uri.host)
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
server = get_test_auth_server
|
47
|
-
Net::HTTP.stubs(:new).returns(server)
|
48
|
-
server.stubs(:started?).returns(true)
|
49
|
-
connection = stub(:authuser => 'good_user', :auth_method=>"password", :authtenant => {:type=>"tenantName", :value=>'good_tenant'}, :authkey => 'bad_key', :auth_host => "a.b.c", :auth_port => "443", :auth_scheme => "https", :auth_path => "/v2.0", :authok= => true, :authtoken= => true, :service_host= => "", :service_path= => "", :service_path => "", :service_port= => "", :service_scheme= => "", :proxy_host => nil, :proxy_port => nil, :api_path => '/foo', :service_type => "nova", :service_name => "cloudCompute", :region => "South")
|
50
|
-
result = OpenStack::Authentication.init(connection)
|
51
|
-
assert_equal("nova.south.host", result.uri.host)
|
52
|
-
end
|
45
|
+
private
|
53
46
|
|
54
|
-
def
|
55
|
-
|
56
|
-
Net::HTTP.stubs(:new).returns(server)
|
57
|
-
server.stubs(:started?).returns(true)
|
58
|
-
connection = stub(:authuser => 'good_user', :auth_method => "password", :authtenant => {:type=>"tenantName", :value=>'good_tenant'}, :authkey => 'bad_key', :auth_host => "a.b.c", :auth_port => "443", :auth_scheme => "https", :auth_path => "/v2.0", :authok= => true, :authtoken= => true, :service_host= => "", :service_path= => "", :service_path => "", :service_port= => "", :service_scheme= => "", :proxy_host => nil, :proxy_port => nil, :api_path => '/foo', :service_type => "nova", :service_name => nil, :region => "North")
|
59
|
-
result = OpenStack::Authentication.init(connection)
|
60
|
-
assert_equal("nova.north.host", result.uri.host)
|
47
|
+
def v2_auth_connection_stub
|
48
|
+
stub(:authuser => 'good_user', :auth_method => "password",:authtenant => {:type=>"tenantName", :value=>'good_tenant'} , :regions_list => {"North"=> [{:service=>"compute", :versionId=>nil}, {:service=>"nova", :versionId=>nil}], "South"=>[{:service=>"compute", :versionId=>nil}, {:service=>"nova", :versionId=>nil}] }, :authkey => 'bad_key', :auth_host => "a.b.c", :auth_port => "443", :auth_scheme => "https", :auth_path => "/v2.0", :authok= => true, :authtoken= => true, :service_host= => "", :service_path= => "", :service_path => "", :service_port= => "", :service_scheme= => "", :proxy_host => nil, :proxy_port => nil, :api_path => '/foo', :service_type => "compute", :service_name => "cloudServers", :region => "South")
|
61
49
|
end
|
62
50
|
|
63
|
-
|
64
|
-
private
|
65
51
|
def get_test_auth_server
|
66
52
|
json_response = %{{
|
67
53
|
"access":{
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-03-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mocha
|
@@ -82,6 +82,10 @@ files:
|
|
82
82
|
- lib/openstack/compute/server.rb
|
83
83
|
- lib/openstack/connection.rb
|
84
84
|
- lib/openstack/image/connection.rb
|
85
|
+
- lib/openstack/network/connection.rb
|
86
|
+
- lib/openstack/network/network.rb
|
87
|
+
- lib/openstack/network/port.rb
|
88
|
+
- lib/openstack/network/subnet.rb
|
85
89
|
- lib/openstack/swift/connection.rb
|
86
90
|
- lib/openstack/swift/container.rb
|
87
91
|
- lib/openstack/swift/storage_object.rb
|
@@ -114,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
118
|
version: '0'
|
115
119
|
requirements: []
|
116
120
|
rubyforge_project:
|
117
|
-
rubygems_version: 1.8.
|
121
|
+
rubygems_version: 1.8.25
|
118
122
|
signing_key:
|
119
123
|
specification_version: 3
|
120
124
|
summary: OpenStack Ruby API
|