oxidized icon indicating copy to clipboard operation
oxidized copied to clipboard

Extreme Switch/xos.rb not matching configured prompt

Open miukumac opened this issue 1 year ago • 8 comments

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.

miukumac avatar Sep 05 '24 08:09 miukumac

This issue is stale because it has been open 90 days with no activity.

github-actions[bot] avatar Dec 05 '24 02:12 github-actions[bot]

Have you had any progress on this? I'm having the exact same issue

KarlTheFish avatar Jan 23 '25 13:01 KarlTheFish

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.

miukumac avatar Jan 23 '25 16:01 miukumac

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.

KarlTheFish avatar Jan 24 '25 12:01 KarlTheFish

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.

robertcheramy avatar Jan 30 '25 06:01 robertcheramy

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

robertcheramy avatar Jan 30 '25 06:01 robertcheramy

This issue is stale because it has been open 90 days with no activity.

github-actions[bot] avatar May 01 '25 02:05 github-actions[bot]

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.

robertcheramy avatar May 02 '25 18:05 robertcheramy

No input = no resolution.

robertcheramy avatar Jun 30 '25 05:06 robertcheramy

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+)? [#>] $/

robertcheramy avatar Jun 30 '25 05:06 robertcheramy