openstack-quantum-client 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,18 +3,24 @@ module Openstack
3
3
  module QuantumClient
4
4
  class Dhcp < L2l3
5
5
  def initialize(quantum_url)
6
- @quantum_url = "#{quantum_url}/dhcps.json"
6
+ @quantum_url = quantum_url
7
7
  end
8
8
 
9
9
  def create(name, address)
10
+ full_url = "#{quantum_url}/dhcps.json"
10
11
  post_to_quantum(
11
- @quantum_url,
12
+ full_url,
12
13
  {"dhcp" => {"name" => name, "address" => address}}
13
14
  )
14
15
  end
15
16
 
17
+ def reload(id)
18
+ HTTParty.put("#{@quantum_url}/dhcps/#{id}/reload.json")
19
+ end
20
+
16
21
  def list
17
- response = HTTParty.get(@quantum_url)
22
+ full_url = "#{quantum_url}/dhcps.json"
23
+ response = HTTParty.get(full_url)
18
24
  JSON.parse(response.body)["dhcps"] if response
19
25
  end
20
26
  end
@@ -3,15 +3,24 @@ module Openstack
3
3
  module QuantumClient
4
4
  class DhcpEntry < L2l3
5
5
  def initialize(quantum_url)
6
- @quantum_url = "#{quantum_url}/dhcp_entries.json"
6
+ @quantum_url = quantum_url
7
+ end
8
+
9
+ def list(filters={})
10
+ HTTParty.get("#{@quantum_url}/dhcp_entries.json", :query => filters)
7
11
  end
8
12
 
9
13
  def create(address, mac, name)
14
+ full_url = "#{quantum_url}/dhcp_entries.json"
10
15
  post_to_quantum(
11
- @quantum_url,
16
+ full_url,
12
17
  {"dhcp_entry" => {"mac" => mac, "address" => address, "name" => name}}
13
18
  )
14
19
  end
20
+
21
+ def delete(id)
22
+ HTTParty.delete("#{@quantum_url}/dhcp_entries/#{id}.json" )
23
+ end
15
24
  end
16
25
  end
17
26
  end
@@ -1,5 +1,5 @@
1
1
  module Openstack
2
2
  module QuantumClient
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
@@ -23,4 +23,18 @@ describe Openstack::QuantumClient::DhcpEntry do
23
23
  dhcp_entry_info.should_not be_nil
24
24
  dhcp_entry_info["id"].should match(/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/)
25
25
  end
26
+
27
+ it "should list the dhcp entries" do
28
+ vm = "machine0002"
29
+ dhcp_entry_info = @client.dhcp_entry.create("dhcp1", "192.168.3.4", vm).to_hash
30
+ @client.dhcp_entry.list["dhcp_entries"].should_not be_empty
31
+ @client.dhcp_entry.list(:name => "unknown")["dhcp_entries"].should be_empty
32
+ @client.dhcp_entry.list(:name => vm)["dhcp_entries"].first.should == dhcp_entry_info
33
+ end
34
+
35
+ it "should delete a dhcp entry" do
36
+ dhcp_entry_info = @client.dhcp_entry.create("dhcp1", "192.168.3.4", "machine0001")
37
+ response = @client.dhcp_entry.delete(dhcp_entry_info["id"])
38
+ response.code.should < 400
39
+ end
26
40
  end
@@ -29,4 +29,10 @@ describe Openstack::QuantumClient::Dhcp do
29
29
  dhcp_info.should_not be_nil
30
30
  dhcp_info.should be_instance_of(Array)
31
31
  end
32
+
33
+ it "should reload the dhcp" do
34
+ dhcp_info = @client.dhcp.create("dhcp1", "192.168.1.1")
35
+ response = @client.dhcp.reload(dhcp_info["id"])
36
+ response.code.should < 400
37
+ end
32
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstack-quantum-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-02 00:00:00.000000000 Z
13
+ date: 2012-02-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
17
- requirement: &19845920 !ruby/object:Gem::Requirement
17
+ requirement: &2151902440 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *19845920
25
+ version_requirements: *2151902440
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &19845280 !ruby/object:Gem::Requirement
28
+ requirement: &2151901800 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *19845280
36
+ version_requirements: *2151901800
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: fakeweb
39
- requirement: &19844260 !ruby/object:Gem::Requirement
39
+ requirement: &2151901280 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *19844260
47
+ version_requirements: *2151901280
48
48
  description: A simple gem to deal with openstack quantum
49
49
  email:
50
50
  - pothix@pothix.com
@@ -53,33 +53,32 @@ executables: []
53
53
  extensions: []
54
54
  extra_rdoc_files: []
55
55
  files:
56
+ - ./Gemfile
57
+ - ./lib/openstack-quantum-client/l2l3/attachment_detail.rb
58
+ - ./lib/openstack-quantum-client/l2l3/dhcp.rb
59
+ - ./lib/openstack-quantum-client/l2l3/dhcp_entry.rb
60
+ - ./lib/openstack-quantum-client/l2l3/filter_rule.rb
61
+ - ./lib/openstack-quantum-client/l2l3/filtered_range.rb
62
+ - ./lib/openstack-quantum-client/l2l3/firewall.rb
63
+ - ./lib/openstack-quantum-client/l2l3/network.rb
64
+ - ./lib/openstack-quantum-client/l2l3/port.rb
65
+ - ./lib/openstack-quantum-client/l2l3.rb
66
+ - ./lib/openstack-quantum-client/version.rb
67
+ - ./lib/openstack-quantum-client.rb
56
68
  - ./openstack-quantum-client.gemspec
69
+ - ./Rakefile
57
70
  - ./README.markdown
58
- - ./openstack-quantum-client-0.1.2.gem
59
- - ./spec/spec_helper.rb
60
- - ./spec/openstack-quantum-client/l2l3_spec.rb
71
+ - ./spec/openstack-quantum-client/l2l3/attachment_detail_spec.rb
61
72
  - ./spec/openstack-quantum-client/l2l3/dhcp_entry_spec.rb
73
+ - ./spec/openstack-quantum-client/l2l3/dhcp_spec.rb
74
+ - ./spec/openstack-quantum-client/l2l3/filter_rule_spec.rb
62
75
  - ./spec/openstack-quantum-client/l2l3/filtered_range_spec.rb
63
- - ./spec/openstack-quantum-client/l2l3/network_spec.rb
64
76
  - ./spec/openstack-quantum-client/l2l3/firewall_spec.rb
65
- - ./spec/openstack-quantum-client/l2l3/filter_rule_spec.rb
66
- - ./spec/openstack-quantum-client/l2l3/dhcp_spec.rb
77
+ - ./spec/openstack-quantum-client/l2l3/network_spec.rb
67
78
  - ./spec/openstack-quantum-client/l2l3/port_spec.rb
68
- - ./spec/openstack-quantum-client/l2l3/attachment_detail_spec.rb
79
+ - ./spec/openstack-quantum-client/l2l3_spec.rb
69
80
  - ./spec/openstack_quantum_client_spec.rb
70
- - ./Gemfile
71
- - ./Rakefile
72
- - ./lib/openstack-quantum-client.rb
73
- - ./lib/openstack-quantum-client/version.rb
74
- - ./lib/openstack-quantum-client/l2l3.rb
75
- - ./lib/openstack-quantum-client/l2l3/dhcp_entry.rb
76
- - ./lib/openstack-quantum-client/l2l3/attachment_detail.rb
77
- - ./lib/openstack-quantum-client/l2l3/firewall.rb
78
- - ./lib/openstack-quantum-client/l2l3/network.rb
79
- - ./lib/openstack-quantum-client/l2l3/filter_rule.rb
80
- - ./lib/openstack-quantum-client/l2l3/filtered_range.rb
81
- - ./lib/openstack-quantum-client/l2l3/port.rb
82
- - ./lib/openstack-quantum-client/l2l3/dhcp.rb
81
+ - ./spec/spec_helper.rb
83
82
  homepage: http://www.locaweb.com.br
84
83
  licenses: []
85
84
  post_install_message: