#coding=utf-8 require "aio/core" class Aio::Module::Cmd::H3C::DisplayCurrent < Aio::Module::Cmd::H3C include Aio::Module 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 # # 此模块暂时只支持将dis cur中的接口信息提取出来,不做任何处理 # 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 end