diff --git a/CHANGELOG.md b/CHANGELOG.md index 1147701eb..ddeea8ec8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] ### Added +- vsololt: new model for VSOL GPON OLT (@Vantomas) ### Changed diff --git a/docs/Supported-OS-Types.md b/docs/Supported-OS-Types.md index 3022e222a..3b6360524 100644 --- a/docs/Supported-OS-Types.md +++ b/docs/Supported-OS-Types.md @@ -191,6 +191,7 @@ |VMWare |NSX Edge (configuration) |[nsxconfig](/lib/oxidized/model/nsxconfig.rb) | |NSX Edge (firewall rules) |[nsxfirewall](/lib/oxidized/model/nsxfirewall.rb) | |NSX Distributed Firewall |[nsxdfw](/lib/oxidized/model/nsxdfw.rb) +|VSOL |GPON OLT |[vsololt](/lib/oxidized/model/vsololt.rb) |@Vantomas | |VYOS Networks |VYOS |[vyos](/lib/oxidized/model/vyos.rb) | |Fork of Vyatta, tracking the supported versions (>= 1.4.x) |Watchguard |Fireware OS |[firewareos](/lib/oxidized/model/firewareos.rb) |Waystream (PacketFront)|iBOS (Intelligent Broadband OS)|[ibos](/lib/oxidized/model/ibos.rb) diff --git a/lib/oxidized/model/vsololt.rb b/lib/oxidized/model/vsololt.rb new file mode 100644 index 000000000..4549369e9 --- /dev/null +++ b/lib/oxidized/model/vsololt.rb @@ -0,0 +1,93 @@ +class VSOLOLT < Oxidized::Model + using Refinements + + # Tested with VSOL V1600G0-B GPON OLT, software V1.4.13R + + # The device runs its CLI in three modes, all matched here: + # user mode: RT87_23|87.23.4-Komin_OLT> + # enable mode: RT87_23|87.23.4-Komin_OLT# + # config mode: RT87_23|87.23.4-Komin_OLT(config)# + # The hostname can contain '|', '.', '-' and the prompt appends '(config)'. + prompt /^([\w.@|()\/-]+[#>]\s?)$/ + comment '! ' + + # The OLT continuously prints log events into the SSH session and there is no + # known way to disable them. They all start with a "YYYY/MM/DD HH:MM:SS" + # timestamp, e.g.: + # 2026/05/25 17:08:24 ONU Port Los PON 0/3 ONU 50 sn ... LAN1 LINK DOWN + # Strip them so they don't pollute the collected configuration. + cmd :all do |cfg| + cfg.gsub! /^\d{4}\/\d{2}\/\d{2}\s+\d{2}:\d{2}:\d{2}\s+.*$\n?/, '' + # Pager redraw orphans: after we answer the " --More-- " pager with a space, + # the device erases its 10-character prompt by emitting 10x BACKSPACE + + # 10x SPACE + 10x BACKSPACE before redrawing the next line in its place. + # Left untouched, this glues the last line of a page to the first line of + # the next one. (See tnsr.rb for an analogous case with a different byte + # count: there the prompt is "--More--" cleared with 8x \x08\x20\x08.) + cfg.gsub! /\x08{10}\x20{10}\x08{10}/, '' + # NUL byte trailing the " --More-- " marker, in case expect didn't catch it. + cfg.gsub! "\x00", '' + cfg.cut_both + end + + # Pager handling. The device paginates with a " --More-- \x00" line (note the + # leading/trailing space and the trailing NUL byte). Advance with a space. + # Only consume the spaces on the pager's own line (and the NUL) here, NOT the + # preceding newline, so the previous config line stays on its own line. The + # backspace/space redraw orphans are cleaned in cmd :all above. + expect /\x20*--More--\x20*\x00?/ do |data, re| + send ' ' + data.sub re, '' + end + + cmd :secret do |cfg| + # SNMP community string. It appears both as "snmp-server community ro|rw" + # and inside "snmp-server host ... version 2c community "; anchor to + # "snmp-server" so we don't touch the word "community" elsewhere. + cfg.gsub! /^(snmp-server .*community) \S+/, '\\1