-
Notifications
You must be signed in to change notification settings - Fork 918
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New model for Ruijie Networks RGOS devices (#2837)
- Loading branch information
1 parent
3d9f986
commit dab52d0
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |