Class: Brocade::SAN::Wwn
- Inherits:
-
Object
- Object
- Brocade::SAN::Wwn
- Defined in:
- lib/brocadesan/wwn.rb
Overview
Wwn model
Constant Summary collapse
- VALUE_RULE =
value naming rule value ca be only WWN
50:00:10:20:30:40:50:60
'([\da-f]{2}:){7}[\da-f]{2}'
Instance Attribute Summary collapse
-
#dev_type ⇒ Object
readonly
device type - usualy target or initiator.
-
#domain_id ⇒ Object
readonly
domain of switch where wwn is online.
-
#port_index ⇒ Object
readonly
port index where wwn is located.
-
#symbol ⇒ Object
readonly
description of WWN is provided by device itself.
-
#value ⇒ Object
readonly
returns value of the WWN.
Class Method Summary collapse
-
.verify_value(str) ⇒ Object
verifies if
str
matches convetion defined in Wwn::VALUE_RULE raises Switch::Error: Incorrect value format if not this method is used internally mostly.
Instance Method Summary collapse
-
#initialize(value, dev_type, domain_id, port_index, opts = {}) ⇒ Wwn
constructor
init method.
-
#name ⇒ Object
shadows value.
- #to_s ⇒ Object
Constructor Details
#initialize(value, dev_type, domain_id, port_index, opts = {}) ⇒ Wwn
init method
opts => :symbol => “text” - device description
49 50 51 52 53 54 55 56 |
# File 'lib/brocadesan/wwn.rb', line 49 def initialize(value,dev_type,domain_id,port_index,opts={}) # :nodoc: Wwn::verify_value(value) @value=value @dev_type=dev_type @domain_id=domain_id.to_i @port_index=port_index.to_i @symbol= !opts[:symbol].nil? ? opts[:symbol] : "" end |
Instance Attribute Details
#dev_type ⇒ Object (readonly)
device type - usualy target or initiator
14 15 16 |
# File 'lib/brocadesan/wwn.rb', line 14 def dev_type @dev_type end |
#domain_id ⇒ Object (readonly)
domain of switch where wwn is online
domain of 0 means the switch does not have any domain id
24 25 26 |
# File 'lib/brocadesan/wwn.rb', line 24 def domain_id @domain_id end |
#port_index ⇒ Object (readonly)
port index where wwn is located
18 19 20 |
# File 'lib/brocadesan/wwn.rb', line 18 def port_index @port_index end |
#symbol ⇒ Object (readonly)
description of WWN is provided by device itself
10 11 12 |
# File 'lib/brocadesan/wwn.rb', line 10 def symbol @symbol end |
#value ⇒ Object (readonly)
returns value of the WWN
6 7 8 |
# File 'lib/brocadesan/wwn.rb', line 6 def value @value end |
Class Method Details
.verify_value(str) ⇒ Object
verifies if str
matches convetion defined in Wwn::VALUE_RULE raises Switch::Error: Incorrect value format if not this method is used internally mostly
37 38 39 |
# File 'lib/brocadesan/wwn.rb', line 37 def self.verify_value(str) raise Switch::Error.new("Incorrect value format \"#{str}\"") if !str.match(/#{VALUE_RULE}/i) end |
Instance Method Details
#name ⇒ Object
shadows value
42 43 44 |
# File 'lib/brocadesan/wwn.rb', line 42 def name @value end |
#to_s ⇒ Object
58 59 60 |
# File 'lib/brocadesan/wwn.rb', line 58 def to_s @value end |