Created
December 13, 2020 07:18
-
-
Save mdpuma/0df4bc4fe6dd8d0aad6d0445902a9f63 to your computer and use it in GitHub Desktop.
VSOL OLT oxidized model
This file contains hidden or 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
| class VSOLOLT < Oxidized::Model | |
| prompt /^([\w.@()-]+[#>]\s?)$/ | |
| comment '! ' | |
| cmd :all do |cfg| | |
| cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, '' | |
| cfg.cut_both | |
| end | |
| # cmd :secret do |cfg| | |
| # cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>' | |
| # cfg.gsub! /^(tacacs-server (.+ )?key) .+/, '\\1 <secret hidden>' | |
| # cfg.gsub! /^username (\S+) privilege (\d+) (\S+).*/, '<secret hidden>' | |
| # cfg.gsub! /^(enable (password|secret)( level \d+)? \d) .+/, '\\1 <secret hidden>' | |
| # cfg | |
| # end | |
| # cmd 'show version-running' do |cfg| | |
| # comment cfg | |
| # end | |
| # | |
| # cmd 'show patch-running' do |cfg| | |
| # comment cfg | |
| # end | |
| cmd 'show running-config' do |cfg| | |
| cfg.gsub! /^Current configuration:/, '' | |
| cfg | |
| end | |
| cfg :telnet do | |
| username /^Login:/i | |
| password /^Password:/i | |
| end | |
| cfg :telnet, :ssh do | |
| # preferred way to handle additional passwords | |
| post_login do | |
| if vars(:enable) == true | |
| cmd "enable" | |
| elsif vars(:enable) | |
| cmd "enable", /^[pP]assword:/ | |
| cmd vars(:enable) | |
| end | |
| end | |
| post_login 'terminal length 0' | |
| pre_logout 'disable' | |
| pre_logout 'exit' | |
| end | |
| end |
Small change -> VSOL V1600G1 OLT series -> ssh connection:
prompt /^([\w.@()-]+[#>]\s?)$/
comment '! '
cmd :all do |cfg|
cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
cfg.cut_both
end
# cmd :secret do |cfg|
# cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
# cfg.gsub! /^(tacacs-server (.+ )?key) .+/, '\\1 <secret hidden>'
# cfg.gsub! /^username (\S+) privilege (\d+) (\S+).*/, '<secret hidden>'
# cfg.gsub! /^(enable (password|secret)( level \d+)? \d) .+/, '\\1 <secret hidden>'
# cfg
# end
# cmd 'show version-running' do |cfg|
# comment cfg
# end
#
# cmd 'show patch-running' do |cfg|
# comment cfg
# end
cmd 'show running-config' do |cfg|
cfg.gsub! /^Current configuration:/, ''
cfg
end
cfg :telnet, :ssh do
username /^Login:/i
password /^Password:/i
# preferred way to handle additional passwords
post_login do
if vars(:enable) == true
cmd "enable"
elsif vars(:enable)
cmd "enable", /^[pP]assword:/
cmd vars(:enable)
end
end
post_login 'terminal length 0'
pre_logout 'disable'
pre_logout 'exit'
end
end
FOR
Hardware Version V1.3.4 Firmware Version V2.03.75R (tested on UPLINK EPON OLT 4440 as it seems to use the same firmware as VSOL)
This also works for UPLINK EPON OLT 4440 or should work on any uplink OLT.
class VSOLOLT < Oxidized::Model
prompt /^([\w.@()-]+[#>]\s?)$/
comment '! '
cmd :all do |cfg|
cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
cfg.gsub!(/^show running-config$/, '')
cfg.gsub!(/^.*\s*#\s*$/, '')
# Remove leading and trailing whitespace
cfg.strip!
# Remove empty lines
cfg.gsub!(/^\s*$/, '')
cfg
end
cmd 'show running-config' do |cfg|
cfg.gsub! /^Current configuration:/, ''
cfg
end
cfg :telnet, :ssh do
username /^Login:/i
password /^Password:/i
# preferred way to handle additional passwords
post_login do
if vars(:enable) == true
cmd "enable"
elsif vars(:enable)
cmd "enable", /^[pP]assword:/
cmd vars(:enable)
end
end
post_login 'terminal length 0'
pre_logout 'disable'
pre_logout 'exit'
end
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
I try to use this script, but doesn't work for me.
The OLT Model is 1600G1.
Can you help me with this?
my debbug
ssh login