summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZsolt Zsiros <ZsZs73@users.noreply.github.com>2018-04-16 14:48:43 +0200
committerNeil Lathwood <gh+n@laf.io>2018-04-16 13:48:43 +0100
commitb29550ce0cfaf6192652747d340da2dc777ac22b (patch)
treecd4f073e6b9007d72c532b547f84ec7d5e9b8897
parentb1b983432b75bbe61edf70323793df344fea5522 (diff)
model: netgear.rb support for older models (#1268)
* Added support for older models (FW 5.x.y.z like on GS110TP, GS748Tv4, etc) * Fixed prompt regex * docs/Model-Notes/Netgear created * docs/Model-Notes/Netgear fixed typos
-rw-r--r--docs/Model-Notes/Netgear.md66
-rw-r--r--docs/Model-Notes/README.md1
-rw-r--r--lib/oxidized/model/netgear.rb5
3 files changed, 70 insertions, 2 deletions
diff --git a/docs/Model-Notes/Netgear.md b/docs/Model-Notes/Netgear.md
new file mode 100644
index 0000000..9bfd094
--- /dev/null
+++ b/docs/Model-Notes/Netgear.md
@@ -0,0 +1,66 @@
+Netgear Configuration
+=====================
+
+There are several models available with CLI management via telnet (port 60000), but they all behave like one of the following:
+- older models:
+```
+Connected to 192.168.3.201.
+
+(GS748Tv4)
+Applying Interface configuration, please wait ...admin
+Password:********
+(GS748Tv4) >enable
+Password:
+
+(GS748Tv4) #terminal length 0
+
+(GS748Tv4) #show running-config
+```
+
+- newer models:
+```
+Connected to 172.0.3.203.
+
+User:admin
+Password:********
+(GS724Tv4) >enable
+
+(GS724Tv4) #terminal length 0
+
+(GS724Tv4) #show running-config
+```
+
+The main differences are:
+- the prompt for username is different (looks quite strange for older models)
+- enable password
+ - the older model prompts for enable password and it expects empty string
+ - the newer model does not prompt for enable password at all
+
+Configuration for older/newer models: make sure you have defined variable 'enable':
+- `'true'` for newer models
+- `''` empty string: for older models
+
+One possible configuration:
+- oxidized config
+```
+source:
+ default: csv
+ csv:
+ file: "/home/oxidized/.config/oxidized/router.db"
+ delimiter: !ruby/regexp /:/
+ map:
+ name: 0
+ model: 1
+ username: 2
+ password: 3
+ vars_map:
+ enable: 4
+ telnet_port: 5
+```
+- router.db
+```
+switchOldFW:netgear:admin:adminpw::60000
+switchNewFW:netgear:admin:adminpw:true:60000
+```
+
+[Reference](https://github.com/ytti/oxidized/pull/1268) \ No newline at end of file
diff --git a/docs/Model-Notes/README.md b/docs/Model-Notes/README.md
index c4b0ed1..fd1298e 100644
--- a/docs/Model-Notes/README.md
+++ b/docs/Model-Notes/README.md
@@ -12,6 +12,7 @@ AireOS|[AireOS](AireOS.md)|29 Nov 2017
Arbor Networks|[ArbOS](ArbOS.md)|27 Feb 2018
Huawei|[VRP](VRP-Huawei.md)|17 Nov 2017
Juniper|[MX/QFX/EX/SRX/J Series](JunOS.md)|18 Jan 2018
+Netgear|[Netgear](Netgear.md)|11 Apr 2018
Zyxel|[XGS4600 Series](XGS4600-Zyxel.md)|23 Jan 2018
If you discover additional caveats or problems please make sure to consult the [GitHub issues for oxidized](https://github.com/ytti/oxidized/issues) known issues.
diff --git a/lib/oxidized/model/netgear.rb b/lib/oxidized/model/netgear.rb
index 0ab1349..a32eb66 100644
--- a/lib/oxidized/model/netgear.rb
+++ b/lib/oxidized/model/netgear.rb
@@ -1,15 +1,16 @@
class Netgear < Oxidized::Model
comment '!'
- prompt /^(\([\w\-.]+\)\s[#>])$/
+ prompt /^(\([\w\s\-.]+\)\s[#>])$/
cmd :secret do |cfg|
cfg.gsub!(/password (\S+)/, 'password <hidden>')
+ cfg.gsub!(/encrypted (\S+)/, 'encrypted <hidden>')
cfg
end
cfg :telnet do
- username /^User:/
+ username /^(User:|Applying Interface configuration, please wait ...)/
end
cfg :telnet, :ssh do