Class: Y2Network::ConnectionConfig::IPConfig

Inherits:
Object
  • Object
show all
Includes:
Y2Network::CanBeCopied
Defined in:
src/lib/y2network/connection_config/ip_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Y2Network::CanBeCopied

#copy

Constructor Details

#initialize(address, id: "", label: nil, remote_address: nil, broadcast: nil) ⇒ IPConfig

Constructor

Parameters:

  • address (IPAddress)
  • id (String) (defaults to: "")

    ID (needed for sysconfig backend in order to write suffixes in ifcfg-* files)

  • label (String, nil) (defaults to: nil)
  • remote_address (IPaddress, nil) (defaults to: nil)
  • broadcast (IPaddress, nil) (defaults to: nil)

46
47
48
49
50
51
52
# File 'src/lib/y2network/connection_config/ip_config.rb', line 46

def initialize(address, id: "", label: nil, remote_address: nil, broadcast: nil)
  @address = address
  @id = id
  @label = label
  @remote_address = remote_address
  @broadcast = broadcast
end

Instance Attribute Details

#addressIPAddress

Returns IP address.

Returns:


28
29
30
# File 'src/lib/y2network/connection_config/ip_config.rb', line 28

def address
  @address
end

#broadcastIPAddress?

Returns Broadcast address.

Returns:


34
35
36
# File 'src/lib/y2network/connection_config/ip_config.rb', line 34

def broadcast
  @broadcast
end

#idString

Returns ID (needed for sysconfig backend in order to write suffixes in.

Returns:

  • (String)

    ID (needed for sysconfig backend in order to write suffixes in


36
37
38
# File 'src/lib/y2network/connection_config/ip_config.rb', line 36

def id
  @id
end

#labelString?

Returns Address label.

Returns:

  • (String, nil)

    Address label


30
31
32
# File 'src/lib/y2network/connection_config/ip_config.rb', line 30

def label
  @label
end

#remote_addressIPAddress?

Returns Remote IP address of a point to point connection.

Returns:

  • (IPAddress, nil)

    Remote IP address of a point to point connection


32
33
34
# File 'src/lib/y2network/connection_config/ip_config.rb', line 32

def remote_address
  @remote_address
end

Instance Method Details

#==(other) ⇒ Boolean

Determines whether IP configurations are equal

Returns:

  • (Boolean)

    true if both are equal; false otherwise


57
58
59
60
61
62
# File 'src/lib/y2network/connection_config/ip_config.rb', line 57

def ==(other)
  return false if other.nil?
  address == other.address && label == other.label &&
    remote_address == other.remote_address && broadcast == other.broadcast &&
    id == other.id
end