smart_proxy_dhcp_infoblox 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -10
- data/config/dhcp_infoblox.yml.example +17 -0
- data/lib/smart_proxy_dhcp_infoblox.rb +9 -3
- data/lib/smart_proxy_dhcp_infoblox/common_crud.rb +75 -0
- data/lib/smart_proxy_dhcp_infoblox/dhcp_infoblox_main.rb +39 -225
- data/lib/smart_proxy_dhcp_infoblox/dhcp_infoblox_plugin.rb +9 -17
- data/lib/smart_proxy_dhcp_infoblox/dhcp_infoblox_version.rb +1 -1
- data/lib/smart_proxy_dhcp_infoblox/fixed_address_crud.rb +53 -0
- data/lib/smart_proxy_dhcp_infoblox/grid_restart.rb +31 -0
- data/lib/smart_proxy_dhcp_infoblox/host_ipv4_address_crud.rb +60 -0
- data/lib/smart_proxy_dhcp_infoblox/ip_address_arithmetic.rb +34 -0
- data/lib/smart_proxy_dhcp_infoblox/network_address_range_regex_generator.rb +131 -0
- data/lib/smart_proxy_dhcp_infoblox/plugin_configuration.rb +37 -0
- data/lib/smart_proxy_dhcp_infoblox/record_type_validator.rb +8 -0
- data/lib/smart_proxy_dhcp_infoblox/unused_ips.rb +47 -0
- data/test/host_and_fixedaddress_crud_test.rb +169 -0
- data/test/infoblox_provider_test.rb +61 -0
- data/test/plugin_configuration_test.rb +73 -0
- data/test/record_type_validator_test.rb +20 -0
- data/test/regex_generator_test.rb +86 -0
- data/test/test_helper.rb +0 -2
- data/test/unused_ip_test.rb +48 -0
- metadata +25 -49
- data/config/dhcp_infoblox.yml +0 -14
- data/lib/smart_proxy_dhcp_infoblox/dhcp_infoblox_dependencies.rb +0 -5
- data/test/dhcp_infoblox_record_test.rb +0 -95
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_dhcp_infoblox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Klaas Demter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: mocha
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: test-unit
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
11
|
+
date: 2016-09-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
55
13
|
description: Infoblox DHCP provider plugin for Foreman's smart proxy
|
56
14
|
email:
|
57
15
|
- demter@atix.de
|
@@ -62,14 +20,27 @@ files:
|
|
62
20
|
- LICENSE
|
63
21
|
- README.md
|
64
22
|
- bundler.d/dhcp_infoblox.rb
|
65
|
-
- config/dhcp_infoblox.yml
|
23
|
+
- config/dhcp_infoblox.yml.example
|
66
24
|
- lib/smart_proxy_dhcp_infoblox.rb
|
67
|
-
- lib/smart_proxy_dhcp_infoblox/
|
25
|
+
- lib/smart_proxy_dhcp_infoblox/common_crud.rb
|
68
26
|
- lib/smart_proxy_dhcp_infoblox/dhcp_infoblox_main.rb
|
69
27
|
- lib/smart_proxy_dhcp_infoblox/dhcp_infoblox_plugin.rb
|
70
28
|
- lib/smart_proxy_dhcp_infoblox/dhcp_infoblox_version.rb
|
71
|
-
-
|
29
|
+
- lib/smart_proxy_dhcp_infoblox/fixed_address_crud.rb
|
30
|
+
- lib/smart_proxy_dhcp_infoblox/grid_restart.rb
|
31
|
+
- lib/smart_proxy_dhcp_infoblox/host_ipv4_address_crud.rb
|
32
|
+
- lib/smart_proxy_dhcp_infoblox/ip_address_arithmetic.rb
|
33
|
+
- lib/smart_proxy_dhcp_infoblox/network_address_range_regex_generator.rb
|
34
|
+
- lib/smart_proxy_dhcp_infoblox/plugin_configuration.rb
|
35
|
+
- lib/smart_proxy_dhcp_infoblox/record_type_validator.rb
|
36
|
+
- lib/smart_proxy_dhcp_infoblox/unused_ips.rb
|
37
|
+
- test/host_and_fixedaddress_crud_test.rb
|
38
|
+
- test/infoblox_provider_test.rb
|
39
|
+
- test/plugin_configuration_test.rb
|
40
|
+
- test/record_type_validator_test.rb
|
41
|
+
- test/regex_generator_test.rb
|
72
42
|
- test/test_helper.rb
|
43
|
+
- test/unused_ip_test.rb
|
73
44
|
homepage: https://github.com/theforeman/smart_proxy_dhcp_infoblox
|
74
45
|
licenses:
|
75
46
|
- GPLv3
|
@@ -95,5 +66,10 @@ signing_key:
|
|
95
66
|
specification_version: 4
|
96
67
|
summary: Infoblox DHCP provider plugin for Foreman's smart proxy
|
97
68
|
test_files:
|
98
|
-
- test/
|
69
|
+
- test/host_and_fixedaddress_crud_test.rb
|
70
|
+
- test/infoblox_provider_test.rb
|
71
|
+
- test/plugin_configuration_test.rb
|
72
|
+
- test/record_type_validator_test.rb
|
73
|
+
- test/regex_generator_test.rb
|
99
74
|
- test/test_helper.rb
|
75
|
+
- test/unused_ip_test.rb
|
data/config/dhcp_infoblox.yml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
---
|
2
|
-
#
|
3
|
-
# Configuration file for 'dhcp_infoblox' dhcp provider
|
4
|
-
#
|
5
|
-
# use :server setting in dhcp.yml if you are managing a dhcp server which is not localhost
|
6
|
-
# Infoblox settings:
|
7
|
-
:infoblox_user: "infoblox"
|
8
|
-
:infoblox_pw: "infoblox"
|
9
|
-
#Record type to manage. Can be "host" or "fixed_address"
|
10
|
-
:record_type: 'host'
|
11
|
-
#infoblox api version
|
12
|
-
:wapi_version: '2.0'
|
13
|
-
#Use pre-definded ranges in networks to find available IP's
|
14
|
-
:range: false
|
@@ -1,95 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'dns/dns_plugin'
|
3
|
-
require 'smart_proxy_dhcp_infoblox/dhcp_infoblox_plugin'
|
4
|
-
require 'smart_proxy_dhcp_infoblox/dhcp_infoblox_main'
|
5
|
-
|
6
|
-
|
7
|
-
class InfobloxRecordTest < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def test_default_settings
|
10
|
-
Proxy::Dns::Infoblox::Plugin.load_test_settings({})
|
11
|
-
assert_equal "default_value", Proxy::Dns::Nsupdate::Plugin.settings.required_setting
|
12
|
-
assert_equal "/must/exist", Proxy::Dns::Nsupdate::Plugin.settings.required_path
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_initialized_correctly
|
16
|
-
Proxy::Dns::Infoblox::Plugin.load_test_settings(:example_setting => 'a_value',
|
17
|
-
:required_setting => 'required_setting',
|
18
|
-
:optional_path => '/some/path',
|
19
|
-
:required_path => '/required/path')
|
20
|
-
|
21
|
-
assert_equal 'a_value', klass.new.example_setting
|
22
|
-
assert_equal 'required_value', klass.new.required_setting
|
23
|
-
assert_equal '/some/path', klass.new.optional_path
|
24
|
-
assert_equal '/required/path', klass.new.required_path
|
25
|
-
end
|
26
|
-
|
27
|
-
# Test that a missing :example_setting throws an error
|
28
|
-
# Test A record creation
|
29
|
-
def test_create_a
|
30
|
-
# Use mocha to expect any calls to backend services to prevent creating real records
|
31
|
-
# MyService.expects(:create).with(:ip => '10.1.1.1', :name => 'test.example.com').returns(true)
|
32
|
-
|
33
|
-
assert klass.new.create_a_record('test.example.com', '10.1.1.1')
|
34
|
-
end
|
35
|
-
|
36
|
-
# Test A record creation fails if the record exists
|
37
|
-
def test_create_a_conflict
|
38
|
-
# Use mocha to expect any calls to backend services to prevent creating real records
|
39
|
-
# MyService.expects(:create).with(:ip => '10.1.1.1', :name => 'test.example.com').returns(false)
|
40
|
-
|
41
|
-
assert_raise(Proxy::Dns::Collision) { klass.new.create_a_record('test.example.com', '10.1.1.1') }
|
42
|
-
end
|
43
|
-
|
44
|
-
# Test PTR record creation
|
45
|
-
def test_create_ptr
|
46
|
-
# Use mocha to expect any calls to backend services to prevent creating real records
|
47
|
-
# MyService.expects(:create_reverse).with(:ip => '10.1.1.1', :name => 'test.example.com').returns(true)
|
48
|
-
|
49
|
-
assert klass.new.create_ptr_record('test.example.com', '10.1.1.1')
|
50
|
-
end
|
51
|
-
|
52
|
-
# Test PTR record creation fails if the record exists
|
53
|
-
def test_create_ptr_conflict
|
54
|
-
# Use mocha to expect any calls to backend services to prevent creating real records
|
55
|
-
# MyService.expects(:create_reverse).with(:ip => '10.1.1.1', :name => 'test.example.com').returns(false)
|
56
|
-
|
57
|
-
assert_raise(Proxy::Dns::Collision) { klass.new.create_ptr_record('test.example.com', '10.1.1.1') }
|
58
|
-
end
|
59
|
-
|
60
|
-
# Test A record removal
|
61
|
-
def test_remove_a
|
62
|
-
# Use mocha to expect any calls to backend services to prevent deleting real records
|
63
|
-
# MyService.expects(:delete).with(:name => 'test.example.com').returns(true)
|
64
|
-
|
65
|
-
assert klass.new.remove_a_record('test.example.com')
|
66
|
-
end
|
67
|
-
|
68
|
-
# Test A record removal fails if the record doesn't exist
|
69
|
-
def test_remove_a_not_found
|
70
|
-
# Use mocha to expect any calls to backend services to prevent deleting real records
|
71
|
-
# MyService.expects(:delete).with(:name => 'test.example.com').returns(false)
|
72
|
-
|
73
|
-
assert_raise(Proxy::Dns::NotFound) { assert klass.new.remove_a_record('test.example.com') }
|
74
|
-
end
|
75
|
-
|
76
|
-
# Test PTR record removal
|
77
|
-
def test_remove_ptr
|
78
|
-
# Use mocha to expect any calls to backend services to prevent deleting real records
|
79
|
-
# MyService.expects(:delete).with(:ip => '10.1.1.1').returns(true)
|
80
|
-
|
81
|
-
assert klass.new.remove_ptr_record('1.1.1.10.in-addr.arpa')
|
82
|
-
end
|
83
|
-
|
84
|
-
# Test PTR record removal fails if the record doesn't exist
|
85
|
-
def test_remove_ptr_not_found
|
86
|
-
# Use mocha to expect any calls to backend services to prevent deleting real records
|
87
|
-
# MyService.expects(:delete).with(:ip => '10.1.1.1').returns(false)
|
88
|
-
|
89
|
-
assert_raise(Proxy::Dns::NotFound) { assert klass.new.remove_ptr_record('1.1.1.10.in-addr.arpa') }
|
90
|
-
end
|
91
|
-
|
92
|
-
def klass
|
93
|
-
Proxy::Dns::Infoblox::Record
|
94
|
-
end
|
95
|
-
end
|