Skip to content

Commit

Permalink
New model for Ruijie Networks RGOS devices (#2837)
Browse files Browse the repository at this point in the history
  • Loading branch information
spike77453 authored Jul 4, 2023
1 parent 3d9f986 commit dab52d0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## Added
- model for D-Link cisco like CLI (@mirackle-spb)
- model for Ruijie Networks RGOS devices (@spike77453)

+ Added ability to send mail with the Docker container
+ Documentation to send mail with hooks
Expand Down
2 changes: 2 additions & 0 deletions docs/Supported-OS-Types.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@
* [AlteonOS](/lib/oxidized/model/alteonos.rb)
* Raisecom
* [Raisecom](/lib/oxidized/model/raisecom.rb)
* Ruijie Networks
* [RGOS](/lib/oxidized/model/rgos.rb)
* QTECH
* [QSW-2800, QSW-3400, QSW-3450, QSW-3500](/lib/oxidized/model/qtech.rb)
* Quanta
Expand Down
33 changes: 33 additions & 0 deletions lib/oxidized/model/rgos.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
class RGOS < Oxidized::Model
using Refinements

comment '! '

cmd :secret do |cfg|
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
cfg.gsub! /^(username .+ (password|secret) \d) .+/, '\\1 <secret hidden>'
cfg.gsub! /^(enable (password|secret)( level \d+)?( \d)?) .+/, '\\1 <secret hidden>'
cfg
end

cmd 'show version' do |cfg|
cfg = cfg.each_line.reject { |line| line.match /^System start time/ }.join
cfg = cfg.each_line.reject { |line| line.match /^System uptime/ }.join
comment "#{cfg.cut_both}\n"
end

cmd 'show running-config' do |cfg|
cfg = cfg.each_line.reject { |line| line.match /^Building configuration.../ }.join
cfg = cfg.each_line.reject { |line| line.match /^Current configuration : \d+ bytes/ }.join
cfg = cfg.each_line.reject { |line| line.match /^version [\d\w()]+/ }.join
# remove empty lines
cfg = cfg.each_line.reject { |line| line.match /^[\r\n\s\u0000#]+$/ }.join
cfg.cut_both
end

cfg :telnet, :ssh do
post_login 'terminal length 0'
post_login 'terminal width 0'
pre_logout 'exit'
end
end

0 comments on commit dab52d0

Please sign in to comment.