summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorp-sherratt <me@paul.sh>2013-09-05 21:31:16 +0100
committerp-sherratt <me@paul.sh>2013-09-05 21:31:16 +0100
commitc5e835ee282ef60aed54fd3a7d086724d5174aaf (patch)
tree683cb9c8f0d836b785a91bc91d94fbccd2afbcaf /lib
parentb19297dde99dfa2430f96ab90b9daeed2a9f340b (diff)
filter mpls te bandwidth line from config if auto-bw is configured, and always attempt to enable if :enable password is configured
Diffstat (limited to 'lib')
-rw-r--r--lib/oxidized/model/ios.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/oxidized/model/ios.rb b/lib/oxidized/model/ios.rb
index 3fcc7ae..a216126 100644
--- a/lib/oxidized/model/ios.rb
+++ b/lib/oxidized/model/ios.rb
@@ -23,7 +23,11 @@ class IOS < Oxidized::Model
cmd 'show running-config' do |cfg|
cfg = cfg.each_line.to_a[3..-1].join
+ cfg.gsub! /^Current configuration : [^\n]*\n/, ''
cfg.sub! /^(ntp clock-period).*/, '! \1'
+ cfg.gsub! /^\ tunnel\ mpls\ traffic-eng\ bandwidth[^\n]*\n*(
+ (?:\ [^\n]*\n*)*
+ tunnel\ mpls\ traffic-eng\ auto-bw)/mx, '\1'
cfg
end
@@ -40,10 +44,12 @@ class IOS < Oxidized::Model
post_login 'terminal length 0'
post_login 'terminal width 0'
# preferred way to handle additional passwords
- #post_login do
- # send "enable\n"
- # send CFG.vars[:enable] + "\n"
- #end
+ if CFG.vars[:enable] and CFG.vars[:enable] != ''
+ post_login do
+ send "enable\n"
+ send CFG.vars[:enable] + "\n"
+ end
+ end
pre_logout 'exit'
end