class Lsmap_net_entry

Attributes

backing[R]
bdphysloc[R]
physloc[R]
sea[R]
status[R]
svea[R]
sys[RW]
vios[RW]

Public Class Methods

new(string = nil, vios = nil, sys = nil) click to toggle source
# File lib/VIOS/lsmap_net_entry.rb, line 13
def initialize(string = nil, vios = nil, sys = nil)
  @vios = vios
  @sys = sys

  @physloc = nil
  @svea = nil
  @sea = nil
  @backing = nil
  @bdphysloc = nil
  @status = nil

  parse(string) unless string.empty?
end

Public Instance Methods

parse(string) click to toggle source
# File lib/VIOS/lsmap_net_entry.rb, line 27
  def parse(string)

    regexp_no_device = %r{^\s*SVEA\s+Physloc\s+
\s*[-\s]+\s*
\s*(ent\d+)\s+(\w{5}.\w{3}.\w{6,7}-V\d+-C\d+-T\d+)\s+
\s*SEA\s+NO\s+SHARED\s+ETHERNET\s+ADAPTER\s+FOUND\s*$}x

    regexp = %r{^\s*SVEA\s+Physloc\s+
\s*[-]+\s+[-]+\s+
\s*(ent\d+)\s+(\w{5}.\w{3}.\w{7}-V\d+-C\d+-T\d+)\s+
\s+
\s*SEA\s+(ent\d+)\s+
\s*Backing\s+device\s+(ent\d+)\s+
\s*Physloc\s+(\w{5}.\w{3}.\w{7}-P\d+-C\d+-T\d+)\s*$
}x

    regexp_with_status = %r{^\s*SVEA\s+Physloc\s+
\s*[-\s]+\s*
\s*(ent\d+)\s+(\w{5}.\w{3}.\w{6,7}-V\d+-C\d+-T\d+)\s+
\s*SEA\s+(ent\d+)\s+
\s*Backing\s+device\s+(ent\d+)\s+
\s*Status\s+(Available)\s+
\s*Physloc\s+(\w{5}.\w{3}.\w{6,7}-P\d+-C\d+-T\d+|\w{5}.\w{3}.\w{6,7}-P\d+-T\d+)\s*$
}x

    if match = regexp_no_device.match(string)
      @svea = match[1]
      @physloc = match[2]
    elsif match = regexp.match(string)
      @svea = match[1]
      @physloc = match[2]
      @sea = match[3]
      @backing = match[4]
      @bdphysloc = match[5]
    elsif match = regexp_with_status.match(string)
      @svea = match[1]
      @physloc = match[2]
      @sea = match[3]
      @backing = match[4]
      @status = match[5]
      @bdphysloc = match[6]
    else
      raise Exception, "Wrong string >#{string}<"
    end
  end