oxidized 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +5 -0
- data/lib/oxidized/config.rb +2 -1
- data/lib/oxidized/input/ssh.rb +4 -1
- data/lib/oxidized/input/telnet.rb +6 -2
- data/lib/oxidized/model/airos.rb +20 -0
- data/lib/oxidized/model/ios.rb +4 -0
- data/lib/oxidized/model/iosxr.rb +1 -0
- data/lib/oxidized/model/ironware.rb +1 -1
- data/lib/oxidized/model/isam.rb +35 -0
- data/lib/oxidized/model/junos.rb +1 -1
- data/lib/oxidized/model/powerconnect.rb +9 -4
- data/lib/oxidized/model/procurve.rb +1 -0
- data/lib/oxidized/model/vrp.rb +34 -0
- data/lib/oxidized/output/git.rb +1 -0
- data/oxidized.gemspec +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfbcf124c9f12166a20cf549f684d7b6b5edb3ab
|
4
|
+
data.tar.gz: 9a317c8cc4dd290297ac00cf4888b855b1f10303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ad3cf531b7be26691abe59a8581be106c07b5a039c5eafec5dae3f170b28e9d7d3f8bb45cfe4516787604ddddec27b52d9ac55644e7c64ba11ffb4601e03d54
|
7
|
+
data.tar.gz: 72ad3d8512564340980e742c98f70977ffc8b5f9b5212a44b194f116afd1b3915f9348df9b066a531ce89ce67313ebceb44e816ed7dad4dcb36aa50820763955
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 0.2.3
|
2
|
+
- BUGFIX: rescue @ssh.close when far end closes disgracefully (ALU ISAM)
|
3
|
+
- BUGFIX: bugfixes to models
|
4
|
+
- FEATURE: Alcatel-Lucent ISAM 7302/7330 model added by @jalmargyyk
|
5
|
+
- FEATURE: Huawei VRP model added by @jalmargyyk
|
6
|
+
- FEATURE: Ubiquiti AirOS added by @willglyn
|
7
|
+
- FEATURE: Support 'input' debug in config, ssh/telnet use it to write session log
|
8
|
+
|
1
9
|
# 0.2.2
|
2
10
|
- BUGFIX: mark node as failure if unknown error is raised
|
3
11
|
|
data/README.md
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
# Supported OS types
|
12
12
|
|
13
13
|
* A10 Networks ACOS
|
14
|
+
* Alcatel-Lucent ISAM 7302/7330
|
14
15
|
* Alcatel-Lucent Operating System AOS
|
15
16
|
* Alcatel-Lucent Operating System AOS7
|
16
17
|
* Alcatel-Lucent Operating System Wireless
|
@@ -18,6 +19,7 @@
|
|
18
19
|
* Arista EOS
|
19
20
|
* Brocade Fabric OS
|
20
21
|
* Brocade Ironware
|
22
|
+
* Brocade Vyatta
|
21
23
|
* Cisco AireOS
|
22
24
|
* Cisco ASA
|
23
25
|
* Cisco IOS
|
@@ -26,7 +28,10 @@
|
|
26
28
|
* Force10 FTOS
|
27
29
|
* FortiGate FortiOS
|
28
30
|
* HP ProCurve
|
31
|
+
* Huawei VRP
|
29
32
|
* Juniper JunOS
|
33
|
+
* Juniper ScreenOS (Netscreen)
|
34
|
+
* Ubiquiti AirOS
|
30
35
|
|
31
36
|
# Install
|
32
37
|
|
data/lib/oxidized/config.rb
CHANGED
@@ -29,7 +29,8 @@ module Oxidized
|
|
29
29
|
CFGS.default.vars = {} # could be 'enable'=>'enablePW'
|
30
30
|
CFGS.default.groups = {} # group level configuration
|
31
31
|
|
32
|
-
CFGS.default.input.default
|
32
|
+
CFGS.default.input.default = 'ssh, telnet'
|
33
|
+
CFGS.default.input.debug = false # or String for session log file
|
33
34
|
CFGS.default.input.ssh.secure = false # complain about changed certs
|
34
35
|
|
35
36
|
CFGS.default.output.default = 'file' # file, git
|
data/lib/oxidized/input/ssh.rb
CHANGED
@@ -20,6 +20,7 @@ module Oxidized
|
|
20
20
|
@output = ''
|
21
21
|
@node.model.cfg['ssh'].each { |cb| instance_exec(&cb) }
|
22
22
|
secure = CFG.input.ssh.secure
|
23
|
+
@log = File.open(CFG.input.debug?.to_s + '-ssh', 'w') if CFG.input.debug?
|
23
24
|
@ssh = Net::SSH.start @node.ip, @node.auth[:username],
|
24
25
|
:password => @node.auth[:password], :timeout => CFG.timeout,
|
25
26
|
:paranoid => secure
|
@@ -59,12 +60,14 @@ module Oxidized
|
|
59
60
|
Timeout::timeout(CFG.timeout) { @ssh.loop }
|
60
61
|
rescue Errno::ECONNRESET, Net::SSH::Disconnect, IOError
|
61
62
|
ensure
|
62
|
-
@
|
63
|
+
@log.close if CFG.input.debug?
|
64
|
+
(@ssh.close rescue true) unless @ssh.closed?
|
63
65
|
end
|
64
66
|
|
65
67
|
def shell_open ssh
|
66
68
|
@ses = ssh.open_channel do |ch|
|
67
69
|
ch.on_data do |_ch, data|
|
70
|
+
@log.print data if CFG.input.debug?
|
68
71
|
@output << data
|
69
72
|
@output = @node.model.expects @output
|
70
73
|
end
|
@@ -10,8 +10,12 @@ module Oxidized
|
|
10
10
|
@node = node
|
11
11
|
@timeout = CFG.timeout
|
12
12
|
@node.model.cfg['telnet'].each { |cb| instance_exec(&cb) }
|
13
|
-
|
14
|
-
|
13
|
+
|
14
|
+
opt = { 'Host' => @node.ip, 'Timeout' => @timeout,
|
15
|
+
'Model' => @node.model }
|
16
|
+
opt['Output_log'] = CFG.input.debug?.to_s + '-telnet' if CFG.input.debug?
|
17
|
+
|
18
|
+
@telnet = Net::Telnet.new opt
|
15
19
|
expect username
|
16
20
|
@telnet.puts @node.auth[:username]
|
17
21
|
expect password
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Airos < Oxidized::Model
|
2
|
+
# Ubiquiti AirOS circa 5.x
|
3
|
+
|
4
|
+
prompt /^[^#]+# /
|
5
|
+
|
6
|
+
cmd 'cat /etc/board.info' do |cfg|
|
7
|
+
cfg.split("\n").map { |line| "# #{line}" }.join("\n") + "\n"
|
8
|
+
end
|
9
|
+
|
10
|
+
cmd 'cat /tmp/system.cfg'
|
11
|
+
|
12
|
+
cmd :secret do |cfg|
|
13
|
+
cfg.gsub! /^(users\.\d+\.password|snmp\.community)=.+/, "# \\1=<hidden>"
|
14
|
+
cfg
|
15
|
+
end
|
16
|
+
|
17
|
+
cfg :ssh do
|
18
|
+
exec true
|
19
|
+
end
|
20
|
+
end
|
data/lib/oxidized/model/ios.rb
CHANGED
data/lib/oxidized/model/iosxr.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
class ISAM < Oxidized::Model
|
2
|
+
#Alcatel ISAM 7302/7330 FTTN
|
3
|
+
|
4
|
+
prompt /^([\w.:@-]+>#\s)$/
|
5
|
+
comment '# '
|
6
|
+
|
7
|
+
cmd :all do |cfg|
|
8
|
+
cfg.each_line.to_a[1..-2].join
|
9
|
+
end
|
10
|
+
|
11
|
+
cfg :telnet do
|
12
|
+
username /^login:\s*/
|
13
|
+
password /^password:\s*/
|
14
|
+
end
|
15
|
+
|
16
|
+
cfg :telnet, :ssh do
|
17
|
+
post_login 'environment prompt "%n># "'
|
18
|
+
post_login 'environment mode batch'
|
19
|
+
post_login 'environment inhibit-alarms print no-more'
|
20
|
+
pre_logout 'logout'
|
21
|
+
end
|
22
|
+
|
23
|
+
cmd 'show software-mngt oswp detail' do |cfg|
|
24
|
+
comment cfg
|
25
|
+
end
|
26
|
+
|
27
|
+
cmd 'show equipment slot detail' do |cfg|
|
28
|
+
comment cfg
|
29
|
+
end
|
30
|
+
|
31
|
+
cmd 'info configure flat' do |cfg|
|
32
|
+
cfg
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/lib/oxidized/model/junos.rb
CHANGED
@@ -19,7 +19,7 @@ class PowerConnect < Oxidized::Model
|
|
19
19
|
|
20
20
|
cmd 'show system' do |cfg|
|
21
21
|
cfg = cfg.each_line.take_while { |line| not line.match(/uptime/i) }
|
22
|
-
comment cfg
|
22
|
+
comment cfg.join "\n"
|
23
23
|
end
|
24
24
|
|
25
25
|
cmd 'show running-config'
|
@@ -30,9 +30,14 @@ class PowerConnect < Oxidized::Model
|
|
30
30
|
end
|
31
31
|
|
32
32
|
cfg :telnet, :ssh do
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
if vars :enable
|
34
|
+
send "enable\n"
|
35
|
+
send vars(:enable) + "\n"
|
36
|
+
end
|
37
|
+
|
38
|
+
post_login "terminal length 0"
|
39
|
+
pre_logout "logout"
|
40
|
+
|
36
41
|
end
|
37
42
|
|
38
43
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class VRP < Oxidized::Model
|
2
|
+
# Huawei VRP
|
3
|
+
|
4
|
+
prompt /^(<[\w.-]+>)$/
|
5
|
+
comment '# '
|
6
|
+
|
7
|
+
cmd :all do |cfg|
|
8
|
+
cfg.each_line.to_a[1..-2].join
|
9
|
+
end
|
10
|
+
|
11
|
+
cfg :telnet do
|
12
|
+
username /^Username:$/
|
13
|
+
password /^Password:$/
|
14
|
+
end
|
15
|
+
|
16
|
+
cfg :telnet, :ssh do
|
17
|
+
post_login 'screen-length 0 temporary'
|
18
|
+
pre_logout 'quit'
|
19
|
+
end
|
20
|
+
|
21
|
+
cmd 'display version' do |cfg|
|
22
|
+
cfg = cfg.each_line.select {|l| not l.match /uptime/ }.join
|
23
|
+
comment cfg
|
24
|
+
end
|
25
|
+
|
26
|
+
cmd 'display device' do |cfg|
|
27
|
+
comment cfg
|
28
|
+
end
|
29
|
+
|
30
|
+
cmd 'display current-configuration all' do |cfg|
|
31
|
+
cfg
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/lib/oxidized/output/git.rb
CHANGED
data/oxidized.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oxidized
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saku Ytti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asetus
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/oxidized/manager.rb
|
84
84
|
- lib/oxidized/model/acos.rb
|
85
85
|
- lib/oxidized/model/aireos.rb
|
86
|
+
- lib/oxidized/model/airos.rb
|
86
87
|
- lib/oxidized/model/aos.rb
|
87
88
|
- lib/oxidized/model/aos7.rb
|
88
89
|
- lib/oxidized/model/aosw.rb
|
@@ -94,12 +95,14 @@ files:
|
|
94
95
|
- lib/oxidized/model/ios.rb
|
95
96
|
- lib/oxidized/model/iosxr.rb
|
96
97
|
- lib/oxidized/model/ironware.rb
|
98
|
+
- lib/oxidized/model/isam.rb
|
97
99
|
- lib/oxidized/model/junos.rb
|
98
100
|
- lib/oxidized/model/model.rb
|
99
101
|
- lib/oxidized/model/powerconnect.rb
|
100
102
|
- lib/oxidized/model/procurve.rb
|
101
103
|
- lib/oxidized/model/screenos.rb
|
102
104
|
- lib/oxidized/model/timos.rb
|
105
|
+
- lib/oxidized/model/vrp.rb
|
103
106
|
- lib/oxidized/model/vyatta.rb
|
104
107
|
- lib/oxidized/node.rb
|
105
108
|
- lib/oxidized/node/stats.rb
|