Rubyipmi::Ipmitool::Lan

Attributes

channel[RW]
info[RW]

Public Class Methods

new(opts = ObservableHash.new) click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 8
def initialize(opts = ObservableHash.new)
  super("ipmitool", opts)
  @info = {}
  @channel = 2

end

Public Instance Methods

dhcp?() click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 103
def dhcp?
  if @info.length < 1
    parse(print)
  end
  @info["ip address source"].match(/dhcp/) != nil
end
gateway() click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 61
def gateway
  if @info.length < 1
    parse(print)
  end
  @info["default gateway ip"]
end
gateway=(address) click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 96
def gateway=(address)
  @options["cmdargs"] = "lan set #{channel} defgw #{address}"
  value = runcmd
  @options.delete_notify("cmdargs")
  return value
end
ip() click to toggle source

def snmp

if @info.length < 1
  parse(print)
end
# Some systems do not report the snmp string
@info["snmp community string"]

end

# File lib/rubyipmi/ipmitool/commands/lan.rb, line 40
def ip
  if @info.length < 1
    parse(print)
  end
  @info["ip address"]
end
ip=(address) click to toggle source

def snmp=(community)

@options["cmdargs"] = "lan set #{channel} snmp #{community}"
value = runcmd
@options.delete_notify("cmdargs")
return value

end

# File lib/rubyipmi/ipmitool/commands/lan.rb, line 82
def ip=(address)
  @options["cmdargs"] = "lan set #{channel} ipaddr #{address}"
  value = runcmd
  @options.delete_notify("cmdargs")
  return value
end
mac() click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 47
def mac
  if @info.length < 1
    parse(print)
  end
  @info["mac address"]
end
netmask() click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 54
def netmask
  if @info.length < 1
    parse(print)
  end
  @info["subnet mask"]
end
netmask=(mask) click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 89
def netmask=(mask)
  @options["cmdargs"] = "lan set #{channel} netmask #{mask}"
  value = runcmd
  @options.delete_notify("cmdargs")
  return value
end
parse(landata) click to toggle source

def vlanid=(vlan)

@options["cmdargs"] = "lan set #{channel} vlan id #{vlan}"
value = runcmd
@options.delete_notify("cmdargs")
return value

end

# File lib/rubyipmi/ipmitool/commands/lan.rb, line 125
def parse(landata)
  multikey = ""
  multivalue = {}

  landata.lines.each do |line|
    # clean up the data from spaces
    item = line.split(':', 2)
    key = item.first.strip.downcase
    value = item.last.strip
    @info[key] = value

  end
  return @info
end
static?() click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 110
def static?
  if @info.length < 1
    parse(print)
  end
  @info["ip address source"].match(/static/) != nil
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.