Class: Y2Network::BootProtocol

Inherits:
Object
  • Object
show all
Includes:
Yast2::Equatable
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 port or bridge port

new("none")

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ BootProtocol

Constructor

Parameters:

  • name (String)

    protocol name



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

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameString (readonly) Also known as: to_s

Returns protocol name

Returns:

  • (String)

    Returns protocol name



48
49
50
# File 'src/lib/y2network/boot_protocol.rb', line 48

def name
  @name
end

Class Method Details

.allArray<BootProtocol>

Returns all the existing protocols

Returns:



32
33
34
35
36
# File 'src/lib/y2network/boot_protocol.rb', line 32

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

Parameters:

  • name (String)

Returns:



42
43
44
# File 'src/lib/y2network/boot_protocol.rb', line 42

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

Instance Method Details

#dhcp?Boolean

checks if boot protocol is at least partially configured by dhcp

Returns:

  • (Boolean)


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

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

#static?Boolean

Checks if boot protocol is static

Returns:

  • (Boolean)


70
71
72
# File 'src/lib/y2network/boot_protocol.rb', line 70

def static?
  STATIC == self
end