Class: Y2Network::S390GroupDevice
- Inherits:
-
Object
- Object
- Y2Network::S390GroupDevice
- Includes:
- Yast2::Equatable, Yast::Logger
- Defined in:
- src/lib/y2network/s390_group_device.rb
Overview
This class represents z Systems network devices which requires the use of multiple I/O subchannels as 'QETH', 'CTC' and 'LCS' devices.
Constant Summary collapse
- CONFIGURE_CMD =
Command for configuring z Systems specific devices
"/sbin/chzdev".freeze
- LIST_CMD =
Command for displaying configuration of z Systems specific devices
"/sbin/lszdev".freeze
- SUPPORTED_TYPES =
["qeth", "lcs", "ctc"].freeze
Instance Attribute Summary collapse
-
#id ⇒ String
(also: #name)
The device id.
- #interface ⇒ Y2Network::Interface?
- #online ⇒ Boolean
- #type ⇒ Y2Network::InterfaceType
Class Method Summary collapse
-
.all(offline: false) ⇒ Array<Y2Network::S390GroupDevice>
Convenience method to obtain the all the supported types s390 group devices.
-
.list(type, offline = true) ⇒ Array<Y2Network::S390GroupDevice>
Returns the list of S390 group devices of the given type.
-
.offline ⇒ Object
Convenience method to obtain the all the offline s390 network group devices.
Instance Method Summary collapse
-
#hardware ⇒ Object
Obtains the hwinfo associated with the read channel.
-
#initialize(type, id, online = false, interface = nil) ⇒ S390GroupDevice
constructor
A new instance of S390GroupDevice.
-
#offline? ⇒ Boolean
Check whether the device is offline or not.
Constructor Details
#initialize(type, id, online = false, interface = nil) ⇒ S390GroupDevice
Returns a new instance of S390GroupDevice.
56 57 58 59 60 61 |
# File 'src/lib/y2network/s390_group_device.rb', line 56 def initialize(type, id, online = false, interface = nil) @type = Y2Network::InterfaceType.from_short_name(type) @id = id @interface = interface @online = online end |
Instance Attribute Details
#id ⇒ String Also known as: name
Returns the device id.
42 43 44 |
# File 'src/lib/y2network/s390_group_device.rb', line 42 def id @id end |
#interface ⇒ Y2Network::Interface?
44 45 46 |
# File 'src/lib/y2network/s390_group_device.rb', line 44 def interface @interface end |
#online ⇒ Boolean
46 47 48 |
# File 'src/lib/y2network/s390_group_device.rb', line 46 def online @online end |
#type ⇒ Y2Network::InterfaceType
40 41 42 |
# File 'src/lib/y2network/s390_group_device.rb', line 40 def type @type end |
Class Method Details
.all(offline: false) ⇒ Array<Y2Network::S390GroupDevice>
Convenience method to obtain the all the supported types s390 group devices.
96 97 98 |
# File 'src/lib/y2network/s390_group_device.rb', line 96 def all(offline: false) SUPPORTED_TYPES.map { |t| list(t, offline) }.flatten end |
.list(type, offline = true) ⇒ Array<Y2Network::S390GroupDevice>
Returns the list of S390 group devices of the given type
80 81 82 83 84 85 86 87 88 |
# File 'src/lib/y2network/s390_group_device.rb', line 80 def list(type, offline = true) cmd = [LIST_CMD, type, "-c", "id,on,names", "-n"] cmd << "--offline" if offline Yast::Execute.stdout.locally!(*cmd).split("\n").map do |device| id, online, iface_name = device.split new(type, id, online == "yes", iface_name) end end |
.offline ⇒ Object
Convenience method to obtain the all the offline s390 network group devices.
102 103 104 |
# File 'src/lib/y2network/s390_group_device.rb', line 102 def offline all(offline: true) end |
Instance Method Details
#hardware ⇒ Object
Obtains the hwinfo associated with the read channel
64 65 66 |
# File 'src/lib/y2network/s390_group_device.rb', line 64 def hardware Y2Network::Hwinfo.netcards.find { |h| h.busid == id.to_s.split(":").first } end |
#offline? ⇒ Boolean
Check whether the device is offline or not
69 70 71 |
# File 'src/lib/y2network/s390_group_device.rb', line 69 def offline? !online end |