Sha256: bcbb58ab028ee4a61d3bf37611ee3447669af1697ccd0e48343b9470a43571d5

Contents?: true

Size: 933 Bytes

Versions: 2

Compression:

Stored size: 933 Bytes

Contents

#coding=utf-8

require "aio/core"

class Aio::Module::Cmd::Cisco::ShowRun < Aio::Module::Cmd::Cisco
  include Aio::Module

  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

  #
  # 此模块暂时只支持将show run中的接口信息提取出来,不做任何处理
  #
  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aio_elin-1.1.8 lib/modules/cmd/cisco/show_run.rb
aio_elin-1.1.7 lib/modules/cmd/cisco/show_run.rb