Sha256: a1f1f6c2898704eeba3a470d6f8e31e6c38d330db4b34115ccd2dc3340b8cd5c

Contents?: true

Size: 874 Bytes

Versions: 3

Compression:

Stored size: 874 Bytes

Contents

class ZyNOSGS < Oxidized::Model
  # Used in Zyxel GS1900 switches, tested with GS1900-8
  prompt /^.*# $/
  comment '! '
  expect /^--More--$/ do |data, re|
    send ' '
    data.sub re, ''
  end

  # replace all used vt100 control sequences
  expect /\e\[\??\d+(;\d+)*[A-Za-z]/ do |data, re|
    data.gsub re, ''
  end
  cmd 'show running-config' do |cfg|
    cfg.gsub! /(System Up Time:) \S+(.*)/, '\\1 <time>'
    # Remove garbage vt100 control sequences
    # Backspace 0x07 char or escape char + control chars
    cfg.gsub! /[\b]|\e\[A|\e\[2K/, ''
    cfg
  end

  cfg :telnet, :ssh do
    username /^(User name|.*Username):/
    password /^\r?Password:/
  end
  cfg :telnet do
    pre_logout do
      send "exit\r"
    end
  end
  cfg :ssh do
    pre_logout do
      # Yes, that GS1900 switch needs two exit !
      send "exit\n"
      send "exit\n"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oxidized-0.29.0 lib/oxidized/model/zynosgs.rb
oxidized-0.28.0 lib/oxidized/model/zynosgs.rb
oxidized-0.27.0 lib/oxidized/model/zynosgs.rb