From e3a1e661577e162e67f419524860e66f7c9cd668 Mon Sep 17 00:00:00 2001 From: Robert Drake Date: Mon, 9 Jan 2017 15:12:28 -0500 Subject: adding zhone OLT/MX GPON/MetroE/DSL gear --- README.md | 2 ++ lib/oxidized/model/zhoneolt.rb | 52 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 lib/oxidized/model/zhoneolt.rb diff --git a/README.md b/README.md index da1fac8..c64a270 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,8 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen * [EdgeSwitch](lib/oxidized/model/edgeswitch.rb) * Watchguard * [Fireware OS](lib/oxidized/model/firewareos.rb) + * Zhone + * [Zhone (OLT and MX)](lib/oxidized/model/zhoneolt.rb) * Zyxel * [ZyNOS](lib/oxidized/model/zynos.rb) diff --git a/lib/oxidized/model/zhoneolt.rb b/lib/oxidized/model/zhoneolt.rb new file mode 100644 index 0000000..b60edb2 --- /dev/null +++ b/lib/oxidized/model/zhoneolt.rb @@ -0,0 +1,52 @@ +class ZhoneOLT < Oxidized::Model + # Zhone OLT/MetroE/DSL devices (ONT uses a completely different CLI) + + # the prompt can be anything on zhone, but it defaults to 'zXX>' and we + # always use hostname> + prompt /^(\r*[\w.@():-]+[>]\s?)$/ + comment '# ' + + cmd :secret do |cfg| + cfg.gsub! /^(set configsyncpasswd = ) \S+/, '\\1 ' + cfg.gsub! /^(set user-pass = ) \S+/, '\\1 ' + cfg.gsub! /^(set auth-key = ) \S+/, '\\1 ' + cfg.gsub! /^(set priv-key = ) \S+/, '\\1 ' + cfg.gsub! /^(set ftp-password = ) \S+/, '\\1 ' + cfg.gsub! /^(set community-name = ) \S+/, '\\1 ' + cfg.gsub! /^(set communityname = ) \S+/, '\\1 ' + cfg + end + + cmd :all do |cfg| + cfg.each_line.to_a[1..-2].map{|line|line.delete("\r").rstrip}.join("\n") + "\n" + end + + cmd 'swversion' do |cfg| + comment cfg + end + + cmd 'slots' do |cfg| + comment cfg + end + + cmd 'eeshow card' do |cfg| + comment cfg + end + + cmd 'ethrpshow' do |cfg| + cfg = cfg.each_line.select { |line| line.match /Vendor (Name|OUI|Part|Revision)|Serial Number|Manufacturing Date/ }.join + comment cfg + end + + cmd 'dump console' do |cfg| + cfg = cfg.each_line.select { |line| not line.match /To Abort the operation enter Ctrl-C/ }.join + end + + # zhone technically supports ssh, but it locks up a ton. Especially when + # showing large amounts of output, like "dump console" + cfg :telnet do + username /\r*login:/ + password /\r*password:/ + pre_logout 'logout' + end +end -- cgit v1.2.1