-
Notifications
You must be signed in to change notification settings - Fork 908
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# ADVA Configuration | ||
|
||
To ensure Oxidized can fetch the configuration, you have to make sure that `cli-paging` is set to `disabled` for the user that is used to connect to the ADVA devices. | ||
|
||
Back to [Model-Notes](README.md) |
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,66 @@ | ||
# Oxidized model for ADVA devices | ||
# | ||
# IMPORTANT: To get this working, cli-paging must be disbaled | ||
# # for the user that is used to fetch the configuration. | ||
|
||
class ADVA < Oxidized::Model | ||
prompt /ADVA[\w\-]+[#>]\s?$/ | ||
comment '# ' | ||
|
||
cmd :secret do |cfg| | ||
cfg.gsub! /community "[^"]+"/, 'community "<hidden>"' | ||
cfg | ||
end | ||
|
||
cmd :all do |cfg| | ||
cfg.cut_both | ||
end | ||
|
||
cmd 'show running-config current' do |cfg| | ||
cfg.each_line.reject { |line| line.match /^Preparing configuration file.*/ }.join | ||
end | ||
|
||
cmd 'show system' do |cfg| | ||
cfg.each_line.reject { |line| line.match /.*(Local time|Up time).*/ }.join | ||
|
||
cfg = "COMMAND: show system\n\n" + cfg | ||
cfg = comment cfg | ||
"\n\n" + cfg | ||
end | ||
|
||
cmd 'network-element ne-1' | ||
|
||
cmd 'show shelf-info' do |cfg| | ||
cfg = "COMMAND: show shelf-info\n\n" + cfg | ||
cfg = comment cfg | ||
"\n\n" + cfg | ||
end | ||
|
||
post do | ||
ports = [] | ||
ports_output = '' | ||
|
||
cmd 'show ports' do |cfg| | ||
cfg.each_line do |line| | ||
port = line.match(/\|((access|network)[^\|]+)\|/) | ||
ports << port if port | ||
end | ||
end | ||
|
||
ports.each do |port| | ||
port_command = 'show ' + port[2] + '-port ' + port[1] | ||
|
||
ports_output << cmd(port_command) { |cfg| | ||
cfg = "COMMAND: " + port_command + "\n\n" + cfg | ||
cfg = comment cfg | ||
"\n\n" + cfg | ||
} | ||
end | ||
|
||
ports_output | ||
end | ||
|
||
cfg :ssh do | ||
pre_logout 'logout' | ||
end | ||
end |