class Aio::Module::Cmd::H3C::DisplayCurrent

Public Class Methods

new() click to toggle source
Calls superclass method Aio::Module::Cmd::new
# File lib/modules/cmd/h3c/display_current.rb, line 8
def initialize
  super({
    :cmd_full         => "display current",
    :cmd_short        => "dis cu",
    :author                   => "Elin",
    :description => "This is H3C Command# display current",
    :ranking          => Ranking_1,
    :key_stand        => true,
                      :platform                    => "all"
  })
end

Public Instance Methods

parse() click to toggle source

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

# File lib/modules/cmd/h3c/display_current.rb, line 23
def parse
  context = self.context.dup
  iface_config = {}
  useful[:iface_config] = iface_config

  # NOTE 删除
  context.readline_match_block(/^sysname/) do |cont| 
    key_stand_h3c
  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