oxidized 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e120e1cba4d53d4ddc38c897d735bc48af36cd3d
4
- data.tar.gz: e02f9953659fa973777ff3a8120c9d4a28426e0e
3
+ metadata.gz: 0a288d5c83803a09ffbdee23a63fd68cf3be696c
4
+ data.tar.gz: 63e08af5b3211db7e2d49148d086a5d8baa2fc2b
5
5
  SHA512:
6
- metadata.gz: 5f441707347f65ae7e4919ad7ffe392b807484740d59faf88f071c89ec04504ce5320e4211724945bb81c9ee577f239001c32bbf5364b5a6c587e8a5f0393e96
7
- data.tar.gz: 8097bad5db23fedf183fa7e2ca17d238e199feb8862d5def0d04d4a3075d901db92729871b9adabdb42a412f5ee4bf4c7804d62a2d6533900b42f2275f23a63d
6
+ metadata.gz: 9554362efb378cfe476e3da1db3e8eb260b4ee728415c8e05a693d17b0272f3a817a359aade873681c8bff7df69b708070eba8d9d8bdab1589ec844c31f68955
7
+ data.tar.gz: f477bc518d72be9ecc545899af5f45fe6fac550bd8b8b1cbfb3186a7c9c0c2787a12127b86f85999885853a4db5c5ec9ac10bcae7f647c43ec0f3b7e0c288802
data/CHANGELOG.md CHANGED
@@ -1,2 +1,10 @@
1
+ # 0.2.0
2
+ - FEATURE: Force10 model added by @lysiszegerman
3
+ - FEATURE: ScreenOS model added by @lysiszegerman
4
+ - FEATURE: FabricOS model added by @thakala
5
+ - FEATURE: ASA model added by @thakala
6
+ - FEATURE: Vyattamodel added by @thakala
7
+ - BUGFIX: Oxidized::String convenience methods for models fixed
8
+
1
9
  # 0.1.1
2
10
  - BUGFIX: vars needs to return value of r, not value of evaluation
data/README.md CHANGED
@@ -8,8 +8,29 @@
8
8
  * restful API to fetch configurations (/node/fetch/[NODE] or /node/fetch/group/[NODE])
9
9
  * restful API to show list of nodes (GET /nodes)
10
10
 
11
+ # Supported OS types
12
+
13
+ * A10 Networks ACOS
14
+ * Alcatel-Lucent Operating System AOS
15
+ * Alcatel-Lucent Operating System AOS7
16
+ * Alcatel-Lucent Operating System Wireless
17
+ * Alcatel-Lucent TiMOS
18
+ * Arista EOS
19
+ * Brocade Fabric OS
20
+ * Brocade Ironware
21
+ * Cisco AireOS
22
+ * Cisco ASA
23
+ * Cisco IOS
24
+ * Cisco IOS-XR
25
+ * DELL PowerConnect
26
+ * Force10 FTOS
27
+ * FortiGate FortiOS
28
+ * HP ProCurve
29
+ * Juniper JunOS
30
+
11
31
  # Install
12
- * early days, but try:
32
+
33
+ * Debian
13
34
  1. apt-get install ruby ruby-dev libsqlite3-dev libssl-dev
14
35
  2. gem install oxidized
15
36
  3. gem install oxidized-script oxidized-web # if you don't install oxidized-web, make sure you remove "rest" from your config
@@ -18,6 +39,38 @@
18
39
  6. (maybe point to your rancid/router.db or copy it there)
19
40
  7. oxidized
20
41
 
42
+ * CentOS, Oracle Linux, Red Hat Linux version 6
43
+ 1. Install Ruby 1.9.3 or greater
44
+ * For Ruby 2.1.2 installation instructions see "Installing Ruby 2.1.2 using RVM"
45
+ 2. Install Oxidized dependencies
46
+ * yum install cmake sqlite-devel openssl-devel
47
+ 3. Install Oxidized daemon and Web front-end from Ruby Gems
48
+ * gem install oxidized
49
+ * gem install oxidized-script oxidized-web
50
+ 4. Start Oxidized, this will create initial configuration
51
+ * oxidized
52
+ 5. Edit Oxidized configuration and create device database
53
+ * vi ~/.config/oxidized/config
54
+ * vi ~/.config/oxidized/router.db
55
+ 6. If you are using file system storage create config directory
56
+ * mkdir -p ~/.config/oxidized/configs/default
57
+ 7. Start Oxidized
58
+ * oxidized
59
+
60
+ * Installing Ruby 2.1.2 using RVM
61
+ 1. Install Ruby 2.1.2 build dependencies
62
+ * yum install curl gcc-c++ patch readline readline-devel zlib zlib-devel
63
+ * yum install libyaml-devel libffi-devel openssl-devel make cmake
64
+ * yum install bzip2 autoconf automake libtool bison iconv-devel
65
+ 2. Install RVM
66
+ * curl -L get.rvm.io | bash -s stable
67
+ 3. Setup RVM environment
68
+ * source /etc/profile.d/rvm.sh
69
+ 4. Compile and install Ruby 2.1.2
70
+ * rvm install 2.1.2
71
+ 5. Set Ruby 2.1.2 as default
72
+ * rvm use --default 2.1.2
73
+
21
74
  # API
22
75
  ## Input
23
76
  * gets config from nodes
@@ -67,7 +120,7 @@ source:
67
120
  default: sql
68
121
  sql:
69
122
  adapter: sqlite
70
- file: "/usr/local/lan/corona.db"
123
+ database: "/usr/local/lan/corona.db"
71
124
  table: device
72
125
  map:
73
126
  name: ptr
data/TODO.md CHANGED
@@ -4,17 +4,6 @@
4
4
  * if now is less than job_ended+iteration same chance to remove thread?
5
5
  * should we try to avoid max threads from being hit? (like maybe non-success thread is pulling average?)
6
6
 
7
- # config
8
- * save keys as strings, load as symbols?
9
-
10
- # other
11
- should it offer cli mass config-pusher? (I think not, I have ideas for such
12
- program and I'm not sure if synergies are high enough for shared code without
13
- making both bit awkward)
14
-
15
- use sidekiq? Any benefits?
16
-
17
-
18
7
  # docs, testing
19
8
  * yard docs
20
9
  * rspec tests
@@ -0,0 +1,48 @@
1
+ class ASA < Oxidized::Model
2
+
3
+ # Cisco ASA model #
4
+ # Only SSH supported for the sake of security
5
+
6
+ prompt /^\r*([\w]+[#>]\s?)$/
7
+ comment '! '
8
+
9
+ cmd :all do |cfg|
10
+ cfg.each_line.to_a[1..-2].join
11
+ end
12
+
13
+ cmd :secret do |cfg|
14
+ cfg.gsub! /enable password (\S+) (.*)/, 'enable password <secret hidden> \2'
15
+ cfg.gsub! /username (\S+) password (\S+) (.*)/, 'username \1 password <secret hidden> \3'
16
+ cfg
17
+ end
18
+
19
+ cmd 'show clock' do |cfg|
20
+ comment cfg
21
+ end
22
+
23
+ cmd 'show version' do |cfg|
24
+ comment cfg
25
+ end
26
+
27
+ cmd 'show running-config' do |cfg|
28
+ cfg = cfg.each_line.to_a[3..-1].join
29
+ cfg.gsub! /^: [^\n]*\n/, ''
30
+ cfg
31
+ end
32
+
33
+ cmd 'show inventory' do |cfg|
34
+ comment cfg
35
+ end
36
+
37
+ cfg :ssh do
38
+ if vars :enable
39
+ post_login do
40
+ send "enable\n"
41
+ send vars(:enable) + "\n"
42
+ end
43
+ end
44
+ post_login 'terminal pager 0'
45
+ pre_logout 'exit'
46
+ end
47
+
48
+ end
@@ -0,0 +1,21 @@
1
+ class FabricOS < Oxidized::Model
2
+
3
+ # Brocade Fabric OS model #
4
+ ## FIXME: Only ssh exec mode support, no telnet, no ssh screenscraping
5
+
6
+ prompt /^([\w]+:+[\w]+[>]\s)$/
7
+ comment '# '
8
+
9
+ cmd 'chassisShow' do |cfg|
10
+ comment cfg
11
+ end
12
+
13
+ cmd 'configShow -all' do |cfg|
14
+ cfg
15
+ end
16
+
17
+ cfg :ssh do
18
+ exec true # don't run shell, run each command in exec channel
19
+ end
20
+
21
+ end
@@ -0,0 +1,47 @@
1
+ class FTOS < Oxidized::Model
2
+
3
+ # Force10 FTOS model #
4
+
5
+ comment '! '
6
+
7
+ cmd :all do |cfg|
8
+ cfg.each_line.to_a[2..-2].join
9
+ end
10
+
11
+ cmd :secret do |cfg|
12
+ cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
13
+ cfg.gsub! /secret (\d+) (\S+).*/, '<secret hidden>'
14
+ cfg
15
+ end
16
+
17
+ cmd 'show inventory' do |cfg|
18
+ comment cfg
19
+ end
20
+
21
+ cmd 'show inventory media' do |cfg|
22
+ comment cfg
23
+ end
24
+
25
+ cmd 'show running-config' do |cfg|
26
+ cfg = cfg.each_line.to_a[3..-1].join
27
+ cfg
28
+ end
29
+
30
+ cfg :telnet do
31
+ username /^Login:/
32
+ password /^Password:/
33
+ end
34
+
35
+ cfg :telnet, :ssh do
36
+ post_login 'terminal length 0'
37
+ post_login 'terminal width 0'
38
+ if vars :enable
39
+ post_login do
40
+ send "enable\n"
41
+ send vars(:enable) + "\n"
42
+ end
43
+ end
44
+ pre_logout 'exit'
45
+ end
46
+
47
+ end
@@ -0,0 +1,39 @@
1
+ class ScreenOS < Oxidized::Model
2
+
3
+ # Netscreen ScreenOS model #
4
+
5
+ comment '! '
6
+
7
+ prompt '/^([\w.-\(\)]+->\s?)$/'
8
+
9
+ cmd :all do |cfg|
10
+ cfg.each_line.to_a[2..-2].join
11
+ end
12
+
13
+ cmd :secret do |cfg|
14
+ cfg.gsub! /^(set admin name) .*|^(set admin password) .*/, '\\1 <removed>'
15
+ cfg.gsub! /^(set admin user .* password) .* (.*)/, '\\1 <removed> \\2'
16
+ cfg.gsub! /(secret|password|preshare) .*/, '\\1 <secret hidden>'
17
+ cfg
18
+ end
19
+
20
+ cmd 'get system' do |cfg|
21
+ comment cfg
22
+ end
23
+
24
+ cmd 'get config' do |cfg|
25
+ cfg = cfg.each_line.to_a[3..-1].join
26
+ cfg
27
+ end
28
+
29
+ cfg :telnet do
30
+ username '/^login:/'
31
+ password '/^password:/'
32
+ end
33
+
34
+ cfg :telnet, :ssh do
35
+ post_login 'set console page 0'
36
+ pre_logout 'exit'
37
+ end
38
+
39
+ end
@@ -0,0 +1,27 @@
1
+ class Vyatta < Oxidized::Model
2
+
3
+ # Brocade Vyatta / VyOS model #
4
+
5
+ prompt /\@.*?\:~\$\s/
6
+
7
+ cmd :all do |cfg|
8
+ cfg = cfg.lines.to_a[1..-2].join
9
+ end
10
+
11
+ cmd :secret do |cfg|
12
+ cfg.gsub! /community (\S+) {/, 'community <hidden> {'
13
+ cfg
14
+ end
15
+
16
+ cmd 'show configuration | no-more'
17
+
18
+ cfg :telnet do
19
+ username /login:\s/
20
+ password /^Password:\s/
21
+ end
22
+
23
+ cfg :telnet, :ssh do
24
+ pre_logout 'exit'
25
+ end
26
+
27
+ end
@@ -3,11 +3,11 @@ module Oxidized
3
3
  class String < String
4
4
  # @return [Oxidized::String] copy of self with last line removed
5
5
  def cut_tail
6
- Oxy::String.new each_line.to_a[0..-2].join
6
+ Oxidized::String.new each_line.to_a[0..-2].join
7
7
  end
8
8
  # @return [Oxidized::String] copy of self with first line removed
9
9
  def cut_head
10
- Oxy::String.new each_line.to_a[1..-1].join
10
+ Oxidized::String.new each_line.to_a[1..-1].join
11
11
  end
12
12
  end
13
13
  end
data/oxidized.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'oxidized'
3
- s.version = '0.1.1'
4
- s.licenses = ['Apache-2.0']
3
+ s.version = '0.2.0'
4
+ s.licenses = %w( Apache-2.0 )
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = [ 'Saku Ytti' ]
7
7
  s.email = %w( saku@ytti.fi )
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.executables = %w( oxidized )
14
14
  s.require_path = 'lib'
15
15
 
16
- s.required_ruby_version = '>= 1.9.3'
17
- s.add_dependency 'asetus', '~> 0.1'
18
- s.add_dependency 'slop', '~> 3.5'
19
- s.add_dependency 'net-ssh', '~> 2.8'
16
+ s.required_ruby_version = '>= 1.9.3'
17
+ s.add_runtime_dependency 'asetus', '~> 0.1'
18
+ s.add_runtime_dependency 'slop', '~> 3.5'
19
+ s.add_runtime_dependency 'net-ssh', '~> 2.8'
20
20
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxidized
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
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-21 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asetus
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: slop
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.5'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: net-ssh
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.8'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.8'
55
55
  description: software to fetch configuration from network devices and store them
@@ -86,8 +86,11 @@ files:
86
86
  - lib/oxidized/model/aos.rb
87
87
  - lib/oxidized/model/aos7.rb
88
88
  - lib/oxidized/model/aosw.rb
89
+ - lib/oxidized/model/asa.rb
89
90
  - lib/oxidized/model/eos.rb
91
+ - lib/oxidized/model/fabricos.rb
90
92
  - lib/oxidized/model/fortios.rb
93
+ - lib/oxidized/model/ftos.rb
91
94
  - lib/oxidized/model/ios.rb
92
95
  - lib/oxidized/model/iosxr.rb
93
96
  - lib/oxidized/model/ironware.rb
@@ -95,7 +98,9 @@ files:
95
98
  - lib/oxidized/model/model.rb
96
99
  - lib/oxidized/model/powerconnect.rb
97
100
  - lib/oxidized/model/procurve.rb
101
+ - lib/oxidized/model/screenos.rb
98
102
  - lib/oxidized/model/timos.rb
103
+ - lib/oxidized/model/vyatta.rb
99
104
  - lib/oxidized/node.rb
100
105
  - lib/oxidized/node/stats.rb
101
106
  - lib/oxidized/nodes.rb
@@ -119,17 +124,17 @@ require_paths:
119
124
  - lib
120
125
  required_ruby_version: !ruby/object:Gem::Requirement
121
126
  requirements:
122
- - - '>='
127
+ - - ">="
123
128
  - !ruby/object:Gem::Version
124
129
  version: 1.9.3
125
130
  required_rubygems_version: !ruby/object:Gem::Requirement
126
131
  requirements:
127
- - - '>='
132
+ - - ">="
128
133
  - !ruby/object:Gem::Version
129
134
  version: '0'
130
135
  requirements: []
131
136
  rubyforge_project: oxidized
132
- rubygems_version: 2.0.14
137
+ rubygems_version: 2.2.2
133
138
  signing_key:
134
139
  specification_version: 4
135
140
  summary: feeble attempt at rancid