Sha256: 6fcf74eff34c170e858ead83e76306a11aba7848fa5e1c25324717718e5d77bf
Contents?: true
Size: 998 Bytes
Versions: 18
Compression:
Stored size: 998 Bytes
Contents
#coding=utf-8 require "aio/core" class Aio::Module::Cmd::H3C::DisplayOspfPeer < Aio::Module::Cmd::H3C include Aio::Module def initialize super({ :cmd_full => "display ospf peer", :cmd_short => "dis ospf p", :author => "Elin", :description => "This is H3C Command# display ospf peer", :ranking => Ranking_1, :platform => "all" }) end def parse context = self.context.dup useful[:ospf_neighbor] = {} count = 0 context.readline_range_loop(/Route/, reg_blank) do |cont| cont.readline_match_block(/Route/) {|b|b} cont.readline_match_block_loop(/(?<neighbor_id>[^\s]+) (?<address>[^\s]+) (?<pri>\d+) (.*) (?<interface>.*) (?<state>.*)/, reg_blank) do |block| nei = {} nei_id = block[:neighbor_id] useful[:ospf_neighbor][nei_id.to_sym] = nei block.update(nei, :neighbor_id) block.update(nei, :pri) block.update(nei, :state) block.update(nei, :address) block.update(nei, :interface) count += 1 end end end end
Version data entries
18 entries across 18 versions & 1 rubygems