class Aio::Module::Cmd::Cisco::ShowRun

Public Class Methods

new() click to toggle source
Calls superclass method Aio::Module::Cmd::new
# File lib/modules/cmd/cisco/show_run.rb, line 8
def initialize
  super({
    :cmd_full                 => "show run",
    :cmd_short                => "sh run",
    :author                           => "Elin",
    :description  => "This is Cisco Command# show run",
    :key_stand        => true,
    :platform                 => "all"
  })
end

Public Instance Methods

parse() click to toggle source

此模块暂时只支持将show run中的接口信息提取出来,不做任何处理

# File lib/modules/cmd/cisco/show_run.rb, line 22
def parse
  context = self.context.dup
  iface_config = {}
  useful[:iface_config] = iface_config

  # NOTE 删除
  context.readline_match_block(/Building configuration/) do |block|
    key_stand_cisco
  end

  context.readline_range_loop(/interface (Fast|Gigabit)Ethernet/, reg_separator) do |cont|
    iface_name = cont.shift.split(' ')[1]
    iface_cont = cont.join("\n")

    iface_config[iface_name] = iface_cont
  end
end