Class: Y2Network::BootProtocol
- Inherits:
-
Object
- Object
- Y2Network::BootProtocol
- 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
-
#name ⇒ String
(also: #to_s)
readonly
Returns protocol name.
Class Method Summary collapse
-
.all ⇒ Array<BootProtocol>
Returns all the existing protocols.
-
.from_name(name) ⇒ BootProtocol?
Returns the boot protocol with a given name.
Instance Method Summary collapse
-
#dhcp? ⇒ Boolean
checks if boot protocol is at least partially configured by dhcp.
-
#initialize(name) ⇒ BootProtocol
constructor
Constructor.
-
#static? ⇒ Boolean
Checks if boot protocol is static.
Constructor Details
#initialize(name) ⇒ BootProtocol
Constructor
56 57 58 |
# File 'src/lib/y2network/boot_protocol.rb', line 56 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ String (readonly) Also known as: to_s
Returns protocol name
48 49 50 |
# File 'src/lib/y2network/boot_protocol.rb', line 48 def name @name end |
Class Method Details
.all ⇒ Array<BootProtocol>
Returns all the existing protocols
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
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
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
70 71 72 |
# File 'src/lib/y2network/boot_protocol.rb', line 70 def static? STATIC == self end |