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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cac94f37298a23f89c92bcb0448a3b3743174dc5
4
- data.tar.gz: bd8bb309b4312f7d93f59b4125322fe57357ff80
3
+ metadata.gz: cfbcf124c9f12166a20cf549f684d7b6b5edb3ab
4
+ data.tar.gz: 9a317c8cc4dd290297ac00cf4888b855b1f10303
5
5
  SHA512:
6
- metadata.gz: 85e95475ba8f626a95d45aa7c7cd2d2eed8cafbb576a334e355a3b588238905104d773056a7e51258d953d41035901e55540080cdae098658222c7bf4bf00d42
7
- data.tar.gz: 0c2402aadad2f6564683713cad70006a9ad52cbe1bdb7697f259dd56339618e25c168ef7286f4ea96f697dde26e80c76fa54bfbc58fa43cb5c0667f844d73284
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
 
@@ -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 = 'ssh, telnet'
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
@@ -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
- @ssh.close if not @ssh.closed?
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
- @telnet = Net::Telnet.new 'Host' => @node.ip, 'Timeout' => @timeout,
14
- 'Model' => @node.model
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
@@ -28,6 +28,10 @@ class IOS < Oxidized::Model
28
28
  cfg
29
29
  end
30
30
 
31
+ cmd 'show version' do |cfg|
32
+ comment cfg.lines.first
33
+ end
34
+
31
35
  cmd 'show inventory' do |cfg|
32
36
  comment cfg
33
37
  end
@@ -2,6 +2,7 @@ class IOSXR < Oxidized::Model
2
2
 
3
3
  # IOS XR model #
4
4
 
5
+ prompt /^([\w.@:\/-]+[#>]\s?)$/
5
6
  comment '! '
6
7
 
7
8
  cmd :all do |cfg|
@@ -26,7 +26,7 @@ class IronWare < Oxidized::Model
26
26
  end
27
27
 
28
28
  cfg :telnet, :ssh do
29
- post_login 'terminal length 0'
29
+ post_login 'skip-page-display'
30
30
  pre_logout 'exit'
31
31
  end
32
32
 
@@ -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
@@ -18,7 +18,7 @@ class JunOS < Oxidized::Model
18
18
  cfg
19
19
  end
20
20
 
21
- cmd 'show configuration'
21
+ cmd 'show configuration | display omit'
22
22
 
23
23
  cmd 'show version' do |cfg|
24
24
  @model = $1 if cfg.match /^Model: (\S+)/
@@ -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
- post_login 'terminal datadump'
34
- post_login 'enable'
35
- pre_logout 'exit'
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
@@ -27,6 +27,7 @@ class Procurve < Oxidized::Model
27
27
  end
28
28
 
29
29
  cmd 'show system-information' do |cfg|
30
+ cfg = cfg.split("\n")[0..-8].join("\n")
30
31
  comment cfg
31
32
  end
32
33
 
@@ -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
@@ -1,6 +1,7 @@
1
1
  module Oxidized
2
2
  class Git < Output
3
3
  begin
4
+ gem 'rugged', '~> 0.21.0'
4
5
  require 'rugged'
5
6
  rescue LoadError
6
7
  raise OxidizedError, 'rugged not found: sudo gem install rugged'
data/oxidized.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'oxidized'
3
- s.version = '0.2.2'
3
+ s.version = '0.2.3'
4
4
  s.licenses = %w( Apache-2.0 )
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = [ 'Saku Ytti' ]
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.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-07-24 00:00:00.000000000 Z
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