Class: Construqt::Services::DhcpV6Relay

Inherits:
Object
  • Object
show all
Defined in:
lib/construqt/services.rb

Defined Under Namespace

Classes: Server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ DhcpV6Relay

Returns a new instance of DhcpV6Relay.



25
26
27
28
# File 'lib/construqt/services.rb', line 25

def initialize(name)
  self.name = name
  self.servers = []
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



24
25
26
# File 'lib/construqt/services.rb', line 24

def name
  @name
end

#serversObject

Returns the value of attribute servers.



24
25
26
# File 'lib/construqt/services.rb', line 24

def servers
  @servers
end

#servicesObject

Returns the value of attribute services.



24
25
26
# File 'lib/construqt/services.rb', line 24

def services
  @services
end

Instance Method Details

#add_server(name) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/construqt/services.rb', line 32

def add_server(name)
  (ip, iface) = name.split("%")
  throw "ip not set #{name}" unless ip
  ip = IPAddress.parse(ip)
  throw "ip must be a v6 address" unless ip.ipv6?
  throw "iface not set #{name}" if iface.nil? || iface.empty?
  server = Server.new
  server.ip = ip
  server.iface = iface
  self.servers << server
  self
end