Extreme Switch/xos.rb not matching configured prompt
I have a problem with a couple of Extreme switches where Oxidized is unable to back them up due to not matching prompt:
Copyright (C) 1996-2024 Extreme Networks, Inc. All rights reserved.
This product is protected by one or more US patents listed at https://www.extremenetworks.com/company/legal/patents/ along with their foreign counterparts.
==============================================================================
Press the <tab> or '?' key at any time for completions.
Remember to save your configuration changes.
There have been 728 successful logins since last reboot and 0 failed logins since last successful login
Last successful login was on: Thu Sep 5 07:10:06 2024
Slot-1 VPEX SW-00035-002.1 # not matching configured prompt (?-mix:^\s?\*?\s?[-\w]+\s?[-\w.~]+(:\d+)? [#>] $)"
W, [2024-09-05T07:32:20.271620 #30] WARN -- : 10.243.52.5 raised Oxidized::PromptUndetect with msg "unable to detect prompt: (?-mix:^\s?\*?\s?[-\w]+\s?[-\w.~]+(:\d+)? [#>] $)"
W, [2024-09-05T07:32:20.944131 #30] WARN -- : extreme-kytkimet/SW-00035-002 status no_connection, retry attempt 2
W, [2024-09-05T07:32:36.141592 #30] WARN -- : 10.243.52.5 raised Oxidized::PromptUndetect with msg "ExtremeXOS
I've been trying different regex combinations but I haven't been able to nail the right one or perhaps code needs changing elsewhere too.
This issue is stale because it has been open 90 days with no activity.
Have you had any progress on this? I'm having the exact same issue
I made an awful hack that simply ignores things since I ran out of time trying to debug for the proper prompt (in the xos.rb file):
prompt /^\s?*?\s?[-\w]+\s?[-\w.~]+(:\d+)? [#>] $/ -> prompt /^[^#]+/
It's a "just accept whatever crap comes from the switch" solution and is not a fix.
Thanks. This is what ended up working for me:
prompt /^\(\S+\) [>#]\s?.*$/
YMMV, I have an old Extreme XOS with prompt that looks like this:
(super-ancient-machine001) >
or this
(super-ancient-machine001) #
depending on whether or not it's in enable mode.
I'm trying to solve this issue, without producing a regression to the work of @Faddy96 . I've collected all the prompts I could find in issues and PR regarding xos.rp, resulting in following prompt tests (to be saved under spec/model/data/xos:generic:prompt.yaml):
pass:
# Prompts from PR #2075
# unsaved config
- "* mydevice-eu-sw02 > "
# saved config
- "my-device02.1 # "
- "my-device02.2 # "
# old xos
- "ancient-device02:1 # "
# Prompts from issue #2107
- "Slot-1 stack_office_x3.1 # "
# Prompts from issue #2113
- "* sw0.l9.kv.1 # "
- "* sw0.l9.kv.2 # "
# Prompts from issue #3259
- "Slot-1 VPEX SW-00035-002.1 # "
- "(super-ancient-machine001) > "
- "(super-ancient-machine001) # "
@KarlTheFish - can you confirm there is a space at the end of the prompt in your super-ancient-machine? There was no space in your comment, but every other prompt I have found has a space.
The proposed prompt solving the issue for @KarlTheFish does not work with previous prompts. Having prompt unit tests will help me to find the hopefully best possible regexp, but I have to be sure the input data is correct.
Can you try the prompt in 030e58f649edefd6afbfda28488c489171395e60 ?
Hows does the prompt in super-ancient-machine looks like when the config is unsaved? Can super-ancient-machine have a stack?
I suppose the match post_login has to be fixed:
cfg :telnet, :ssh do
post_login do
data = cmd 'disable clipaging session'
match = data.match /^disable clipaging session\n\r?\*?\s?[-\w]+\s?[-\w.~]+(:\d+)? [#>] $/m
next if match
This issue is stale because it has been open 90 days with no activity.
I will close this issue and delete the branch 3259-xos-prompt if no one can confirm it works on their hardware and answer the questions above.
No input = no resolution.
Note for future use: This was the list of prompts I collected:
pass:
# Prompts from PR #2075
# unsaved config
- "* mydevice-eu-sw02 > "
# saved config
- "my-device02.1 # "
- "my-device02.2 # "
# old xos
- "ancient-device02:1 # "
# Prompts from issue #2107
- "Slot-1 stack_office_x3.1 # "
# Prompts from issue #2113
- "* sw0.l9.kv.1 # "
- "* sw0.l9.kv.2 # "
# Prompts from issue #3259
- "Slot-1 VPEX SW-00035-002.1 # "
- "(super-ancient-machine001) > "
- "(super-ancient-machine001) # "
And the prompt I designed:
# (\* )? (opt) unsaved configuration
# (Slot-\d+ )? (opt) slot for stacks
# (VPEX )? (opt) VPEX = Virtual port extender
# \(? (opt) parenthesis around hostname
# [\w\-.~]+ hostname
# \)? (opt) parenthesis around hostname
# ([.:]\d+)? (opt) prompt counting
# [#>] trailing text
prompt /^(\* )?(Slot-\d+ )?(VPEX )?\(?[\w\-.~]+\)?([.:]\d+)? [#>] $/