summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/alteonos.rb
blob: 5a5bef36b4b95977c598034130a83450a2c3a3a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
class ALTEONOS < Oxidized::Model
  prompt  /^\(?.+\)?\s?[#>]/

  comment '! '

  cmd :secret do |cfg|
    cfg.gsub!(/^([\s\t]*admpw ).*/, '\1 <password removed>')
    cfg.gsub!(/^([\s\t]*pswd ).*/, '\1 <password removed>')
    cfg.gsub!(/^([\s\t]*esecret ).*/, '\1 <password removed>')
    cfg
  end

  ##############################################################################################
  #                                 Added to remove                                            #
  #                                                                                            #
  # /* Configuration dump taken 14:10:20 Fri Jul 28, 2017 (DST)                                #
  # /* Configuration last applied at 16:17:05 Fri Jul 14, 2017                                 #
  # /* Configuration last save at 16:17:43 Fri Jul 14, 2017                                    #
  # /* Version 29.0.3.12, vXXXXXXXX,  Base MAC address XXXXXXXXXXX                             #
  # /* To restore SSL Offloading configuration and management HTTPS access,                    #
  # /* it is recommended to include the private keys in the dump.                              #
  #                                       OR                                                   #
  # /* To restore SSL Offloading configuration and management HTTPS access,it is recommended   #
  # /* to include the private keys in the dump.                                                #
  #                                                                                            #
  ##############################################################################################

  cmd 'cfg/dump' do |cfg|
    cfg.gsub! /^([\s\t\/*]*Configuration).*/, ''
    cfg.gsub! /^([\s\t\/*]*Version).*/, ''
    cfg.gsub! /^([\s\t\/*]*To restore ).*/, ''
    cfg.gsub! /^([\s\t\/*]*it is recommended to include).*/, ''
    cfg.gsub! /^([\s\t\/*]*to include ).*/, ''
    cfg
  end

  # Answer for Dispay private keys
  expect /^Display private keys\?\s?\[y\/n\]: $/ do |data, re|
    send "n\r"
    data.sub re, ''
  end

  # Answer for sync to peer on exit
  expect /^Confirm Sync to Peer\s?\[y\/n\]: $/ do |data, re|
    send "n\r"
    data.sub re, ''
  end

  # Answer for  Unsaved configuration
  expect /^(WARNING: There are unsaved configuration changes).*/ do |data, re|
    send "n\r"
    data.sub re, ''
  end

  cfg :ssh do
    pre_logout 'exit'
  end
end