class Aio::Module::Cmd::H3C::DisplayIpRoutingStat
Public Class Methods
new()
click to toggle source
Calls superclass method
Aio::Module::Cmd::new
# File lib/modules/cmd/h3c/display_ip_routing_stat.rb, line 8 def initialize super({ :cmd_full => "display ip routing-table statistics", :cmd_short => "dis ip rout stat", :author => "Elin", :description => "This is H3C Command# display ip routing-table statistics", :ranking => Ranking_1, :platform => "all", :benchmark => {} }) end
Public Instance Methods
parse()
click to toggle source
# File lib/modules/cmd/h3c/display_ip_routing_stat.rb, line 20 def parse cont = self.context.dup stat = {} useful[:route_summary] = stat #cont.readline_match_block(/Proto route active added deleted freed/) cont.readline_match_block(/DIRECT (?<route>\d+) (?<active>\d+) (?<added>\d+) (?<deleted>\d+) (?<freed>\d+)/) do |block| stat_dir = {} stat[:direct] = stat_dir block.update(stat_dir, :route) block.update(stat_dir, :active) block.update(stat_dir, :added) block.update(stat_dir, :deleted) block.update(stat_dir, :freed) end cont.readline_match_block(/STATIC (?<route>\d+) (?<active>\d+) (?<added>\d+) (?<deleted>\d+) (?<freed>\d+)/) do |block| stat_sta = {} stat[:static] = stat_sta block.update(stat_sta, :route) block.update(stat_sta, :active) block.update(stat_sta, :added) block.update(stat_sta, :deleted) block.update(stat_sta, :freed) end cont.readline_match_block(/RIP (?<route>\d+) (?<active>\d+) (?<added>\d+) (?<deleted>\d+) (?<freed>\d+)/) do |block| stat_rip = {} stat[:rip] = stat_rip block.update(stat_rip, :route) block.update(stat_rip, :active) block.update(stat_rip, :added) block.update(stat_rip, :deleted) block.update(stat_rip, :freed) end cont.readline_match_block(/OSPF (?<route>\d+) (?<active>\d+) (?<added>\d+) (?<deleted>\d+) (?<freed>\d+)/) do |block| stat_ospf = {} stat[:ospf] = stat_ospf block.update(stat_ospf, :route) block.update(stat_ospf, :active) block.update(stat_ospf, :added) block.update(stat_ospf, :deleted) block.update(stat_ospf, :freed) end cont.readline_match_block(/IS-IS (?<route>\d+) (?<active>\d+) (?<added>\d+) (?<deleted>\d+) (?<freed>\d+)/) do |block| stat_isis = {} stat[:isis] = stat_isis block.update(stat_isis, :route) block.update(stat_isis, :active) block.update(stat_isis, :added) block.update(stat_isis, :deleted) block.update(stat_isis, :freed) end cont.readline_match_block(/BGP (?<route>\d+) (?<active>\d+) (?<added>\d+) (?<deleted>\d+) (?<freed>\d+)/) do |block| stat_bgp = {} stat[:bgp] = stat_bgp block.update(stat_bgp, :route) block.update(stat_bgp, :active) block.update(stat_bgp, :added) block.update(stat_bgp, :deleted) block.update(stat_bgp, :freed) end cont.readline_match_block(/Total (?<route>\d+) (?<active>\d+) (?<added>\d+) (?<deleted>\d+) (?<freed>\d+)/) do |block| stat_total = {} stat[:total] = stat_total block.update(stat_total, :route) block.update(stat_total, :active) block.update(stat_total, :added) block.update(stat_total, :deleted) block.update(stat_total, :freed) end end