Class: Y2Network::PhysicalInterface

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

Overview

Physical interface class (ethernet, wireless, infiniband...)

Instance Attribute Summary collapse

Attributes inherited from Interface

#firmware_configured_by, #hardware, #name, #old_name, #renaming_mechanism, #type, #udev_rule

Instance Method Summary collapse

Methods inherited from Interface

#==, #config, #connected?, #drivers, #firmware_configured?, from_connection, #hash, #hotplug?, #rename, #update_udev_rule

Constructor Details

#initialize(name, type: InterfaceType::ETHERNET, hardware: nil) ⇒ PhysicalInterface

Constructor

Parameters:

  • name (String)

    Interface name (e.g., "eth0")

  • type (InterfaceType) (defaults to: InterfaceType::ETHERNET)

    Interface type

  • hardware (Hwinfo) (defaults to: nil)

    Hardware information



41
42
43
44
45
46
# File 'src/lib/y2network/physical_interface.rb', line 41

def initialize(name, type: InterfaceType::ETHERNET, hardware: nil)
  super(name, type: type)
  # @hardware and @name should not change during life of the object
  @hardware = hardware || Hwinfo.for(name) || Hwinfo.new
  @description = @hardware.name
end

Instance Attribute Details

#custom_driverString

User selected driver

This driver will be set using a udev rule.

Returns:

  • (String)


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

def custom_driver
  @custom_driver
end

#ethtool_optionsString

Returns:

  • (String)


27
28
29
# File 'src/lib/y2network/physical_interface.rb', line 27

def ethtool_options
  @ethtool_options
end

Instance Method Details

#current_driverString

Returns the name of the current driver

Returns:

  • (String)


58
59
60
# File 'src/lib/y2network/physical_interface.rb', line 58

def current_driver
  @hardware.module
end

#modaliasString?

Returns interface modalias

Returns:

  • (String, nil)

    Modalias



51
52
53
# File 'src/lib/y2network/physical_interface.rb', line 51

def modalias
  @hardware.modalias
end

#present?Boolean

Determines whether the interface is present (attached)

It relies in the hardware information

Returns:

  • (Boolean)

See Also:

  • Interface#present?


68
69
70
# File 'src/lib/y2network/physical_interface.rb', line 68

def present?
  @hardware.present?
end