Class: Aio::Module::Cmd::Cisco::ShowIpOspfNeighbor
- Inherits:
-
Aio::Module::Cmd::Cisco
- Object
- Aio::Module::Cmd
- Aio::Module::Cmd::Cisco
- Aio::Module::Cmd::Cisco::ShowIpOspfNeighbor
- Includes:
- Aio::Module
- Defined in:
- lib/modules/cmd/cisco/show_ip_ospf_nei.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 ⇒ ShowIpOspfNeighbor
constructor
A new instance of ShowIpOspfNeighbor.
- #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 ⇒ ShowIpOspfNeighbor
Returns a new instance of ShowIpOspfNeighbor.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/modules/cmd/cisco/show_ip_ospf_nei.rb', line 8 def initialize super({ :cmd_full => "show ip ospf neighbor", :cmd_short => "sh ip o n", :author => "Elin", :description => "This is Cisco Command# show ip ospf neighbor", :ranking => Ranking_1, :platform => "all", }) end |
Instance Method Details
#parse ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/modules/cmd/cisco/show_ip_ospf_nei.rb', line 19 def parse context = self.context.dup useful[:ospf_neighbor] = {} context.readline_match_block(/Neighbor ID/) {|b|b} count = 0 context.readline_match_block_loop(/(?<neighbor_id>[^\s]+) (?<pri>\d+) (?<state>[^\s]+) (.*) (?<address>[^\s]+) (?<interface>.*)/, 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 |