summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/powerconnect.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/model/powerconnect.rb')
-rw-r--r--lib/oxidized/model/powerconnect.rb27
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb
index a1fe229..531ad0b 100644
--- a/lib/oxidized/model/powerconnect.rb
+++ b/lib/oxidized/model/powerconnect.rb
@@ -19,9 +19,8 @@ class PowerConnect < Oxidized::Model
end
cmd 'show system' do |cfg|
- cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] }
- cfg = cfg[0..-28]<<" "
- comment cfg.join("\n")
+ @model = $1 if cfg.match /Power[C|c]onnect (\d{4})[P|F]?/
+ clean cfg
end
cmd 'show running-config'
@@ -39,9 +38,31 @@ class PowerConnect < Oxidized::Model
end
end
+ post_login "terminal datadump"
post_login "terminal length 0"
pre_logout "logout"
+ pre_logout "exit"
end
+ def clean cfg
+ out = []
+ skip_block = false
+ cfg.each_line do |line|
+ if line.match /Up\sTime|Temperature|Power Supplies/i
+ # For 34xx, 54xx, 55xx, and 8024F we should skip this block (terminated by a blank line)
+ skip_block = true if @model =~ /^(34|35)(24|48)$|^(54|55)(24|48)$|^8024$/
+ end
+ # If we have lines to skip do this until we reach and empty line
+ if skip_block
+ skip_block = false if /\S/ !~ line
+ next
+ end
+ out << line.strip
+ end
+ out = comment out.join "\n"
+ out << "\n"
+ end
+
+
end