Class: Y2Network::BootProtocol

Inherits:
Object
  • Object
show all
Defined in:
src/lib/y2network/boot_protocol.rb

Overview

This class represents the boot protocols which are supported (not all by all backends).

Constant Summary collapse

IBFT =

iBFT boot protocol

new("ibft")
STATIC =

statically assigned interface properties

new("static")
DHCP =

DHCP for both ipv4 and ipv6

new("dhcp")
DHCP4 =

DHCP for ipv4 only

new("dhcp4")
DHCP6 =

DHCP for ipv6 only

new("dhcp6")
DHCP_AUTOIP =

combination of zeroconf for ipv4 and DHCP for ipv6

new("dhcp+autoip")
AUTOIP =

zeroconf for ipv4

new("autoip")
NONE =

do not assign properties. Usefull for bond slave or bridge port

new("none")

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ BootProtocol

Constructor


50
51
52
# File 'src/lib/y2network/boot_protocol.rb', line 50

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameString (readonly)


45
46
47
# File 'src/lib/y2network/boot_protocol.rb', line 45

def name
  @name
end

Class Method Details

.allArray<BootProtocol>

Returns all the existing protocols


29
30
31
32
33
# File 'src/lib/y2network/boot_protocol.rb', line 29

def all
  @all ||= BootProtocol.constants
                       .map { |c| BootProtocol.const_get(c) }
                       .select { |c| c.is_a?(BootProtocol) }
end

.from_name(name) ⇒ BootProtocol?

Returns the boot protocol with a given name


39
40
41
# File 'src/lib/y2network/boot_protocol.rb', line 39

def from_name(name)
  all.find { |t| t.name == name }
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

Determines whether two objects are equivalent

They are equal when they refer to the same boot protocol (through the name).


74
75
76
# File 'src/lib/y2network/boot_protocol.rb', line 74

def ==(other)
  name == other.name
end

#dhcp?Boolean

checks if boot protocol is at least partially configured by dhcp


57
58
59
# File 'src/lib/y2network/boot_protocol.rb', line 57

def dhcp?
  [DHCP4, DHCP6, DHCP, DHCP_AUTOIP].include?(self)
end

#static?Boolean

Checks if boot protocol is static


64
65
66
# File 'src/lib/y2network/boot_protocol.rb', line 64

def static?
  STATIC == self
end