class Rubyipmi::Ipmitool::Lan
Constants
- MAX_RETRY
Attributes
channel[RW]
info[RW]
Public Class Methods
new(opts = ObservableHash.new)
click to toggle source
Calls superclass method
Rubyipmi::BaseCommand::new
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 9 def initialize(opts = ObservableHash.new) super("ipmitool", opts) @info = {} @channel = 2 end
Public Instance Methods
channel=(num)
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 21 def channel=(num) refresh @channel = num end
dhcp?()
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 97 def dhcp? info.fetch("ip_address_source",nil).match(/dhcp/i) != nil end
gateway()
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 61 def gateway info.fetch("default_gateway_ip",nil) end
gateway=(address)
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 90 def gateway=(address) @options["cmdargs"] = "lan set #{channel} defgw ipaddr #{address}" value = runcmd @options.delete_notify("cmdargs") return value end
ip()
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 49 def ip info.fetch("ip_address",nil) 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 76 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 53 def mac info.fetch("mac_address",nil) end
netmask()
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 57 def netmask info.fetch("subnet_mask",nil) end
netmask=(mask)
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 83 def netmask=(mask) @options["cmdargs"] = "lan set #{channel} netmask #{mask}" value = runcmd @options.delete_notify("cmdargs") return value end
refresh()
click to toggle source
sets the info var to be empty causing the variable to repopulate upon the next call to info
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 17 def refresh @info = {} end
snmp()
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 45 def snmp info.fetch("snmp_community_string",nil) end
static?()
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 101 def static? info.fetch("ip_address_source",nil).match(/static/i) != nil end
vlanid()
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 65 def vlanid info.fetch("802.1q_vlan_id",nil) end
vlanid=(vlan)
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 105 def vlanid=(vlan) @options["cmdargs"] = "lan set #{channel} vlan id #{vlan}" value = runcmd @options.delete_notify("cmdargs") return value end
Private Instance Methods
normalize(text)
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 135 def normalize(text) text.gsub(/\ /, '_').gsub(/\./, '').downcase end
parse(landata)
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 123 def parse(landata) landata.lines.each do |line| # clean up the data from spaces item = line.split(':', 2) key = normalize(item.first.strip) value = item.last.strip @info[key] = value end return @info end
print()
click to toggle source
# File lib/rubyipmi/ipmitool/commands/lan.rb, line 114 def print @options["cmdargs"] = "lan print" value = runcmd @options.delete_notify("cmdargs") if value @result end end