Class: Aio::Module::Cmd::H3C::DisplayIpRoutingStat
- Inherits:
-
Aio::Module::Cmd::H3C
- Object
- Aio::Module::Cmd
- Aio::Module::Cmd::H3C
- Aio::Module::Cmd::H3C::DisplayIpRoutingStat
- Includes:
- Aio::Module
- Defined in:
- lib/modules/cmd/h3c/display_ip_routing_stat.rb
Instance Attribute Summary
Attributes inherited from Aio::Module::Cmd
#cmd_info, #context, #device_info, #ext_info, #useful, #warning_klass
Instance Method Summary collapse
-
#initialize ⇒ DisplayIpRoutingStat
constructor
A new instance of DisplayIpRoutingStat.
- #parse ⇒ Object
Methods inherited from Aio::Module::Cmd
#author, #benchmark, #clear_useful, #cmd_full, #cmd_short, #description, #division, #key_stand, #license, #platform, #ranking, #set_defaults, #type
Methods included from Ui::Verbose
#clear_line, #print_error, #print_good, #progress_bar
Constructor Details
#initialize ⇒ DisplayIpRoutingStat
Returns a new instance of DisplayIpRoutingStat.
8 9 10 11 12 13 14 15 16 17 18 |
# 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 |
Instance Method Details
#parse ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# 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 |