You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem
So to be clear this is Day one of me using oxidized. I was able to get it setup and retrieve cisco, juniper, and dell os10 configurations.
So a good start.
I am unable to sucessfully get the config from a dell switch running sonic. I initially connect to the device and receive an
"admin@switch1-1:~$" prompt.
I then need to type sonic-cli and i will then get a
'switch1-1# ' prompt
where i can issue a show run. the admin @ is dropped.
I have tried putting post_login 'sonic-cli' and also 'sonic-cli\n' but that did not work. The debug log shows it sending the command. instead i get the error below in the logs. of note the prompt with # includes a space after the # but i believe the regex accounts for this. also issueing sonic-cli changes prompt but otherwise generates no output so i am unsure if that is an issue.
i have also tried the regex ^([\w.@-]+[#>]|[\w.@-]+:?~?$)\s?$ which seems to match both where the original didnt but the net result is the same.
Expected behavior
I would hope to retreive the config.
Configuration
i believe the config is ok since it works for all the other models. here is the prompt regex. prompt: !ruby/regexp /^([\w.@-]+[#>]|[\w.@-]+:~\$)\s?$/
its unclear to me if the prompt regex is needed to account for the ~$ prompt as opposed to the # prompt. I see it supposedly sends the sonic-cli command based on the logs so I assume that means the prompt is sufficient but i could be mistaken.
here is the model file, it is honestly a copy of another with a few edits. again day 1 so i may have something obv wrong. i was a little unsure about the cfg :telnet, :ssh do section with a post_login section vs the generic post_login section below that.
class SONICOS < Oxidized::Model
using Refinements
# For switches running Dell EMC Sonic #
#
# Tested with : Dell PowerSwitch S4148U-ON
comment '! '
cmd :all do |cfg|
cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
cfg.each_line.to_a[2..-2].join
end
cmd :secret do |cfg|
cfg.gsub! /(password )(\S+)/, '\1<secret hidden>'
cfg
end
#cmd 'show inventory' do |cfg|
# comment cfg
#end
#cmd 'show inventory media' do |cfg|
# comment cfg
#end
cmd 'show running-configuration' do |cfg|
cfg.each_line.to_a[3..-1].join
end
cfg :telnet do
username /^Login:/
password /^Password:/
end
cfg :telnet, :ssh do
post_login do
send "sonic-cli"
end
post_login 'sonic-cli'
pre_logout 'exit'
pre_logout 'exit'
end
end
Logs
D, [2025-03-06T00:10:04.608204 #1931] DEBUG -- : lib/oxidized/input/ssh.rb: Connecting to MONSW-MDF1-1
D, [2025-03-06T00:10:04.608416 #1931] DEBUG -- : AUTH METHODS::["none", "publickey", "password"]
D, [2025-03-06T00:10:04.938186 #1931] DEBUG -- : lib/oxidized/input/ssh.rb: expecting [/^([\w.@-]+[#>]|[\w.@-]+:~\$)\s?$/] at MONSW-MDF1-1
D, [2025-03-06T00:10:05.609165 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:05.940574 #1931] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login commands at MONSW-MDF1-1
D, [2025-03-06T00:10:05.940622 #1931] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login command: nil, block: #<Proc:0x00007248113a0dd8 /opt/oxidized/.config/oxidized/model/sonicos.rb:38> at MONSW-MDF1-1
D, [2025-03-06T00:10:05.940639 #1931] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login command: "sonic-cli", block: nil at MONSW-MDF1-1
D, [2025-03-06T00:10:05.940650 #1931] DEBUG -- : lib/oxidized/input/ssh.rb "sonic-cli" @ MONSW-MDF1-1 with expect: /^([\w.@-]+[#>]|[\w.@-]+:~\$)\s?$/
D, [2025-03-06T00:10:05.940774 #1931] DEBUG -- : lib/oxidized/input/ssh.rb: expecting [/^([\w.@-]+[#>]|[\w.@-]+:~\$)\s?$/] at MONSW-MDF1-1
D, [2025-03-06T00:10:06.610303 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:07.611408 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:08.612555 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:09.613687 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:10.614812 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:11.615919 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:12.617070 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:13.618219 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:14.619346 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:15.620432 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:16.621538 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:17.622618 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:18.623734 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:19.624845 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:20.625945 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:21.627049 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:22.628179 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:23.629301 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:24.630445 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2025-03-06T00:10:25.631575 #1931] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
W, [2025-03-06T00:10:25.941125 #1931] WARN -- : 192.168.207.5 raised Timeout::Error with msg "execution expired"
D, [2025-03-06T00:10:25.941190 #1931] DEBUG -- : lib/oxidized/node.rb: Oxidized::SSH failed for MONSW-MDF1-1
.
Running environment (please complete the following information):
OS: [e.g. ubuntu 24.]
oxidized version: [e.g. 0.32.1]
The text was updated successfully, but these errors were encountered:
just wanted to add that i created a new user on the switch and that user bypasses the switch:~$ prompt and does not require sonic-cli to be issued. once that problem was behind me I was able to make a simple model and it works as expected. I suspect I will need to understand what I was doing wrong though in the future so I would still appreciate any assistance with the above issue.
typing sonic-cli basically clears the screen and changes the prompt, I dont know if there are special considerations I need to build out to account for that. i had a similar problem with junos logging in as root and I couldn't get the "cli" command to work properly either so these are very similar and I used the same fix of a new/non-built-in account to sidestep it. Id like better understanding of how to overcome this though.
Describe the problem
So to be clear this is Day one of me using oxidized. I was able to get it setup and retrieve cisco, juniper, and dell os10 configurations.
So a good start.
I am unable to sucessfully get the config from a dell switch running sonic. I initially connect to the device and receive an
"admin@switch1-1:~$" prompt.
I then need to type sonic-cli and i will then get a
'switch1-1# ' prompt
where i can issue a show run. the admin @ is dropped.
I have tried putting post_login 'sonic-cli' and also 'sonic-cli\n' but that did not work. The debug log shows it sending the command. instead i get the error below in the logs. of note the prompt with # includes a space after the # but i believe the regex accounts for this. also issueing sonic-cli changes prompt but otherwise generates no output so i am unsure if that is an issue.
i have also tried the regex ^([\w.@-]+[#>]|[\w.@-]+:?~?$)\s?$ which seems to match both where the original didnt but the net result is the same.
Expected behavior
I would hope to retreive the config.
Configuration
Logs
Running environment (please complete the following information):
The text was updated successfully, but these errors were encountered: