Class: VirtualAdapter
- Inherits:
-
Object
- Object
- VirtualAdapter
- Defined in:
- lib/HMC/virtual_adapter.rb
Direct Known Subclasses
VirtualEthAdapter, VirtualFCAdapter, VirtualScsiAdapter, VirtualSerialAdapter
Instance Attribute Summary collapse
-
#_type ⇒ Object
readonly
type of input / output (data can be taken from profile or real setup (lshwres…)).
-
#frame ⇒ Object
Returns the value of attribute frame.
-
#isRequired ⇒ Object
Returns the value of attribute isRequired.
-
#lpar_id ⇒ Object
Returns the value of attribute lpar_id.
-
#lpar_name ⇒ Object
below data can be taken only from lshwres, they are exist only for running lpars.
-
#state ⇒ Object
Returns the value of attribute state.
-
#vios ⇒ Object
for compare where important are only adapters.
-
#virtualSlotNumber ⇒ Object
Returns the value of attribute virtualSlotNumber.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #diff(other_adapter, profile1, profile2, null_0_none_equal = false) ⇒ Object
-
#initialize(string = '') ⇒ VirtualAdapter
constructor
A new instance of VirtualAdapter.
Constructor Details
#initialize(string = '') ⇒ VirtualAdapter
Returns a new instance of VirtualAdapter.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/HMC/virtual_adapter.rb', line 19 def initialize(string = '') @lpar_name = nil @lpar_id = nil @state = nil @isRequired = 0 @_type = 'profile' @vios = nil @frame = nil @params = [] end |
Instance Attribute Details
#_type ⇒ Object (readonly)
type of input / output (data can be taken from profile or real setup (lshwres…))
12 13 14 |
# File 'lib/HMC/virtual_adapter.rb', line 12 def _type @_type end |
#frame ⇒ Object
Returns the value of attribute frame.
16 17 18 |
# File 'lib/HMC/virtual_adapter.rb', line 16 def frame @frame end |
#isRequired ⇒ Object
Returns the value of attribute isRequired.
4 5 6 |
# File 'lib/HMC/virtual_adapter.rb', line 4 def isRequired @isRequired end |
#lpar_id ⇒ Object
Returns the value of attribute lpar_id.
8 9 10 |
# File 'lib/HMC/virtual_adapter.rb', line 8 def lpar_id @lpar_id end |
#lpar_name ⇒ Object
below data can be taken only from lshwres, they are exist only for running lpars
7 8 9 |
# File 'lib/HMC/virtual_adapter.rb', line 7 def lpar_name @lpar_name end |
#state ⇒ Object
Returns the value of attribute state.
9 10 11 |
# File 'lib/HMC/virtual_adapter.rb', line 9 def state @state end |
#vios ⇒ Object
for compare where important are only adapters
15 16 17 |
# File 'lib/HMC/virtual_adapter.rb', line 15 def vios @vios end |
#virtualSlotNumber ⇒ Object
Returns the value of attribute virtualSlotNumber.
3 4 5 |
# File 'lib/HMC/virtual_adapter.rb', line 3 def virtualSlotNumber @virtualSlotNumber end |
Instance Method Details
#==(other) ⇒ Object
57 58 59 |
# File 'lib/HMC/virtual_adapter.rb', line 57 def ==(other) to_s == other.to_s end |
#diff(other_adapter, profile1, profile2, null_0_none_equal = false) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/HMC/virtual_adapter.rb', line 32 def diff(other_adapter, profile1, profile2, null_0_none_equal = false ) diff = {} if self.class.name != other_adapter.class.name raise "Wrong type of adapter has been compared #{other_adapter.class.name}" end @params.sort.each do |param| next if instance_variable_get("@#{param}") == other_adapter.instance_variable_get("@#{param}") if null_0_none_equal a = instance_variable_get("@#{param}") b = other_adapter.instance_variable_get("@#{param}") next if ( a.to_s == '0' || a == 'none' || a == 'null') && (b.to_s == '0' || b == 'none' || b == 'null') end diff_entry = {} diff_entry[profile2] = other_adapter.instance_variable_get("@#{param}") diff_entry[profile1] = instance_variable_get("@#{param}") diff[param.to_s] = diff_entry end diff end |