Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Comware) "Current terminal monitor is off" Flapping issue #1754

Closed
berilslv opened this issue Mar 22, 2019 · 3 comments
Closed

(Comware) "Current terminal monitor is off" Flapping issue #1754

berilslv opened this issue Mar 22, 2019 · 3 comments
Labels

Comments

@berilslv
Copy link

berilslv commented Mar 22, 2019

Hi Oxidized enthusiasts,

Im facing problem with git version flapping. Exactly the same problem as #1447 .
Problem screenshot: Here

I tried to solve issue by adding vars_map:

#IGNORE_DISPLAY_MY
if vars :ignore_display
cfg.gsub! /"! Info: Current terminal monitor is off. .*/, ''
Oxidized.logger.debug "Ignoring terminal off"
end

But without success.
I hope for some advices.

Have a nice friday guys! ;)

@berilslv
Copy link
Author

Can somebody help me with this issue? Im still getting this current info flapping.

@raunz
Copy link
Contributor

raunz commented Sep 20, 2019

I ran into the same problem with current master comware model and HP 1910/1920 switches.
First issue with the same problem seems to be #1447
These 19x0 units are tricky and cause very funky stuff with using 'send'
Here a snippet of writeshark telnet tcp stream with current master comware.rb and it explains how 'send' commands get input/output/prompts totally messed up:

Username:oxidizeduser
oxidizeduser
Password:oxidizedpass

<hp1910switch>_cmdline-mode on
_y
512900
xtd-cli-mode on
y
512900
screen-length disable
.cmdline-mode on
All commands can be displayed and executed. Continue? [Y/N]y
Please input password:******
Warning: Now you enter an all-command mode for developer's testing, some commands may affect operation by wrong use, please carefully use it with our engineer's direction.
<hp1910switch>xundo terminal monitor
.td-cli-mode on
                     ^
 % Unrecognized command found at '^' position.
<hp1910switch>ydisplay version
.
                     ^
 % Unrecognized command found at '^' position.
<hp1910switch>display device
.512900
                     ^
 % Unrecognized command found at '^' position.
<hp1910switch>sdisplay device manuinfo
.creen-length disableundo terminal monitor
                                   ^
 % Unrecognized command found at '^' position.
<hp1910switch>ddisplay current-configuration
.isplay version
HPE Comware Platform Software
Comware Software, Version 5.20.99, Release 1113
Copyright (c) 2010-2016 Hewlett Packard Enterprise Development LP
HPE 1910-24 Switch uptime is 127 weeks, 5 days, 11 hours, 55 minutes

HPE 1910-24 Switch
128M    bytes DRAM
32M     bytes Flash Memory
Config Register points to Flash

Hardware Version is REV.A
Bootrom Version is 117
[SubSlot 0] 24FE+2GE Combo Hardware Version is REV.A

<hp1910switch>dquit
isplay device

After struggling with this I achieved not the prettiest but working model, which successfully works with the following units on telnet and ssh input:

  • HPE 1910-24 Switch
  • HPE 1920-8G Switch
  • HPE 5820X-24XG-SFP+ Switch with 2 Processors
  • MSR954 JH299A
  • Switch 4200G 24-Port Software Version 3Com OS V3.02.04s56
  • Switch 4210G 24-Port Software Version 5.20 Release 2202P18
    I don't have 1950 unit, but I expect it to work too...

Here's my current comware.rb. Instead of 'send' I use 'cmd' with additional prompt regex.

class Comware < Oxidized::Model
  # HP (A-series)/H3C/3Com Comware

  # sometimes the prompt might have a leading nul or trailing ASCII Bell (^G)
  prompt /^\0*(<[\w.-]+>).*$/
  comment '# '

  # example how to handle pager
  # expect /^\s*---- More ----$/ do |data, re|
  #  send ' '
  #  data.sub re, ''
  # end

  cmd :all do |cfg|
    # cfg.gsub! /^.*\e\[42D/, ''        # example how to handle pager
    # skip rogue ^M
    cfg = cfg.delete "\r"
    cfg.cut_both
  end

  cmd :secret do |cfg|
    cfg.gsub! /^( snmp-agent community).*/, '\\1 <configuration removed>'
    cfg.gsub! /^( password hash).*/, '\\1 <configuration removed>'
    cfg.gsub! /^( password cipher).*/, '\\1 <configuration removed>'
    cfg
  end

  cfg :telnet do
    username /^(Username|login):/
    password /^Password:/
  end

  cfg :telnet, :ssh do
    # enable command-line mode on SMB comware switches (HP V1910, V1920)
    # autodetection is hard, because the 'summary' command is paged, and
    # the pager cannot be disabled before _cmdline-mode on.
    if vars :comware_cmdline
      post_login do
        # HP V1910, V1920
        cmd '_cmdline-mode on', /(#{@node.prompt}|Continue)/
        cmd 'y', /(#{@node.prompt}|input password)/
        cmd vars(:comware_cmdline)

        # HP V1950
        cmd 'xtd-cli-mode on', /(#{@node.prompt}|Continue)/
        cmd 'y', /(#{@node.prompt}|input password)/
        cmd vars(:comware_cmdline)
      end
    end

    post_login do
      cmd 'screen-length disable'
      cmd 'undo terminal monitor'
    end
    pre_logout 'quit'
  end

  cmd 'display version' do |cfg|
    cfg = cfg.each_line.reject { |l| l.match /uptime/i }.join
    comment cfg
  end

  cmd 'display device' do |cfg|
    comment cfg
  end

  cmd 'display device manuinfo' do |cfg|
    cfg = cfg.each_line.reject { |l| l.match 'FF'.hex.chr }.join
    comment cfg
  end

  cmd 'display current-configuration' do |cfg|
    cfg
  end
end

@berilslv
Copy link
Author

I ran into the same problem with current master comware model and HP 1910/1920 switches.
First issue with the same problem seems to be #1447
These 19x0 units are tricky and cause very funky stuff with using 'send'
Here a snippet of writeshark telnet tcp stream with current master comware.rb and it explains how 'send' commands get input/output/prompts totally messed up:

Username:oxidizeduser
oxidizeduser
Password:oxidizedpass

<hp1910switch>_cmdline-mode on
_y
512900
xtd-cli-mode on
y
512900
screen-length disable
.cmdline-mode on
All commands can be displayed and executed. Continue? [Y/N]y
Please input password:******
Warning: Now you enter an all-command mode for developer's testing, some commands may affect operation by wrong use, please carefully use it with our engineer's direction.
<hp1910switch>xundo terminal monitor
.td-cli-mode on
                     ^
 % Unrecognized command found at '^' position.
<hp1910switch>ydisplay version
.
                     ^
 % Unrecognized command found at '^' position.
<hp1910switch>display device
.512900
                     ^
 % Unrecognized command found at '^' position.
<hp1910switch>sdisplay device manuinfo
.creen-length disableundo terminal monitor
                                   ^
 % Unrecognized command found at '^' position.
<hp1910switch>ddisplay current-configuration
.isplay version
HPE Comware Platform Software
Comware Software, Version 5.20.99, Release 1113
Copyright (c) 2010-2016 Hewlett Packard Enterprise Development LP
HPE 1910-24 Switch uptime is 127 weeks, 5 days, 11 hours, 55 minutes

HPE 1910-24 Switch
128M    bytes DRAM
32M     bytes Flash Memory
Config Register points to Flash

Hardware Version is REV.A
Bootrom Version is 117
[SubSlot 0] 24FE+2GE Combo Hardware Version is REV.A

<hp1910switch>dquit
isplay device

After struggling with this I achieved not the prettiest but working model, which successfully works with the following units on telnet and ssh input:

  • HPE 1910-24 Switch
  • HPE 1920-8G Switch
  • HPE 5820X-24XG-SFP+ Switch with 2 Processors
  • MSR954 JH299A
  • Switch 4200G 24-Port Software Version 3Com OS V3.02.04s56
  • Switch 4210G 24-Port Software Version 5.20 Release 2202P18
    I don't have 1950 unit, but I expect it to work too...

Here's my current comware.rb. Instead of 'send' I use 'cmd' with additional prompt regex.

class Comware < Oxidized::Model
  # HP (A-series)/H3C/3Com Comware

  # sometimes the prompt might have a leading nul or trailing ASCII Bell (^G)
  prompt /^\0*(<[\w.-]+>).*$/
  comment '# '

  # example how to handle pager
  # expect /^\s*---- More ----$/ do |data, re|
  #  send ' '
  #  data.sub re, ''
  # end

  cmd :all do |cfg|
    # cfg.gsub! /^.*\e\[42D/, ''        # example how to handle pager
    # skip rogue ^M
    cfg = cfg.delete "\r"
    cfg.cut_both
  end

  cmd :secret do |cfg|
    cfg.gsub! /^( snmp-agent community).*/, '\\1 <configuration removed>'
    cfg.gsub! /^( password hash).*/, '\\1 <configuration removed>'
    cfg.gsub! /^( password cipher).*/, '\\1 <configuration removed>'
    cfg
  end

  cfg :telnet do
    username /^(Username|login):/
    password /^Password:/
  end

  cfg :telnet, :ssh do
    # enable command-line mode on SMB comware switches (HP V1910, V1920)
    # autodetection is hard, because the 'summary' command is paged, and
    # the pager cannot be disabled before _cmdline-mode on.
    if vars :comware_cmdline
      post_login do
        # HP V1910, V1920
        cmd '_cmdline-mode on', /(#{@node.prompt}|Continue)/
        cmd 'y', /(#{@node.prompt}|input password)/
        cmd vars(:comware_cmdline)

        # HP V1950
        cmd 'xtd-cli-mode on', /(#{@node.prompt}|Continue)/
        cmd 'y', /(#{@node.prompt}|input password)/
        cmd vars(:comware_cmdline)
      end
    end

    post_login do
      cmd 'screen-length disable'
      cmd 'undo terminal monitor'
    end
    pre_logout 'quit'
  end

  cmd 'display version' do |cfg|
    cfg = cfg.each_line.reject { |l| l.match /uptime/i }.join
    comment cfg
  end

  cmd 'display device' do |cfg|
    comment cfg
  end

  cmd 'display device manuinfo' do |cfg|
    cfg = cfg.each_line.reject { |l| l.match 'FF'.hex.chr }.join
    comment cfg
  end

  cmd 'display current-configuration' do |cfg|
    cfg
  end
end

Thanks mate for your great answer! I hope this will help for somebody, as i have migrated to different IT structure! ;)

@github-actions github-actions bot added the Stale label May 3, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants