summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2014-08-19 09:18:19 +0300
committerSaku Ytti <saku@ytti.fi>2014-08-19 09:18:19 +0300
commit32733012e2bcda5373406aec8156dcb9c00a58ce (patch)
treeea10b2bbb9f247993f12671885463e6cb77b52e7
parentc85133df29bb3dbe259b876a223056e4aef01010 (diff)
parent620afed89162aae2f67be79e2a10ca929448ff1d (diff)
Merge branch 'master' into cfg_as_object
-rw-r--r--CHANGELOG.md3
-rw-r--r--README.md1
-rw-r--r--lib/oxidized/model/ciscosmb.rb48
3 files changed, 52 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 01df3ef..0607845 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+# 0.2.4
+ - FEATURE: Cisco SMB (Nikola series VxWorks) model by @thetamind
+
# 0.2.3
- BUGFIX: rescue @ssh.close when far end closes disgracefully (ALU ISAM)
- BUGFIX: bugfixes to models
diff --git a/README.md b/README.md
index 348aa3a..41f1bed 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,7 @@
* Cisco ASA
* Cisco IOS
* Cisco IOS-XR
+ * Cisco SMB (Nikola series)
* DELL PowerConnect
* Force10 FTOS
* FortiGate FortiOS
diff --git a/lib/oxidized/model/ciscosmb.rb b/lib/oxidized/model/ciscosmb.rb
new file mode 100644
index 0000000..718c60e
--- /dev/null
+++ b/lib/oxidized/model/ciscosmb.rb
@@ -0,0 +1,48 @@
+class CiscoSMB < Oxidized::Model
+
+ # Cisco Small Business 200, 300, 500, and ESW2 series switches
+ # http://www.cisco.com/c/en/us/support/switches/small-business-300-series-managed-switches/products-release-notes-list.html
+
+ prompt /^\r?([\w.@()-]+[#>]\s?)$/
+ comment '! '
+
+ cmd :all do |cfg|
+ lines = cfg.each_line.to_a[1..-2]
+ # Remove \r from beginning of response
+ lines[0].gsub!(/^\r.*?/, '') if lines.length > 0
+ lines.join
+ end
+
+ cmd :secret do |cfg|
+ cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
+ cfg.gsub! /username (\S+) privilege (\d+) (\S+).*/, '<secret hidden>'
+ cfg
+ end
+
+ cmd 'show version' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show inventory' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show running-config' do |cfg|
+ cfg = cfg.each_line.to_a[0..-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
+
+ cfg :telnet, :ssh do
+ username /^User Name:/
+ password /^\r?Password:$/
+ post_login 'terminal datadump' # Disable pager
+ post_login 'terminal width 0'
+ pre_logout 'exit'
+ end
+
+end