Class: Proxy::DHCP::Infoblox::PluginConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_proxy_dhcp_infoblox/plugin_configuration.rb

Instance Method Summary collapse

Instance Method Details

#load_classesObject



3
4
5
6
7
8
9
10
11
# File 'lib/smart_proxy_dhcp_infoblox/plugin_configuration.rb', line 3

def load_classes
  require 'infoblox'
  require 'dhcp_common/dhcp_common'
  require 'dhcp_common/free_ips'
  require 'smart_proxy_dhcp_infoblox/host_ipv4_address_crud'
  require 'smart_proxy_dhcp_infoblox/fixed_address_crud'
  require 'smart_proxy_dhcp_infoblox/grid_restart'
  require 'smart_proxy_dhcp_infoblox/dhcp_infoblox_main'
end

#load_dependency_injection_wirings(c, settings) ⇒ Object



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
# File 'lib/smart_proxy_dhcp_infoblox/plugin_configuration.rb', line 13

def load_dependency_injection_wirings(c, settings)
  c.dependency :connection, (lambda {
    ::Infoblox.wapi_version = '2.0'
    ::Infoblox::Connection.new(:username => settings[:username], :password => settings[:password],
                               :host => settings[:server], :ssl_opts => { :verify => true },
                               :logger => ::Proxy::LogBuffer::Decorator.instance)
  })

  c.singleton_dependency :unused_ips, lambda { ::Proxy::DHCP::FreeIps.new(settings[:blacklist_duration_minutes]) }

  c.dependency :host_ipv4_crud, (lambda {
    ::Proxy::DHCP::Infoblox::HostIpv4AddressCRUD.new(c.get_dependency(:connection), settings[:dns_view])
  })
  c.dependency :fixed_address_crud, (lambda {
    ::Proxy::DHCP::Infoblox::FixedAddressCRUD.new(c.get_dependency(:connection), settings[:network_view])
  })
  c.dependency :grid_restart, lambda { ::Proxy::DHCP::Infoblox::GridRestart.new(c.get_dependency(:connection)) }
  c.dependency :dhcp_provider, (lambda {
    ::Proxy::DHCP::Infoblox::Provider.new(
      c.get_dependency(:connection),
      (settings[:record_type] == 'host') ? c.get_dependency(:host_ipv4_crud) : c.get_dependency(:fixed_address_crud),
      c.get_dependency(:grid_restart),
      c.get_dependency(:unused_ips),
      settings[:subnets],
      settings[:network_view])
  })
end