summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile11
-rw-r--r--README.md62
-rw-r--r--lib/oxidized/model/aosw.rb13
-rw-r--r--lib/oxidized/model/masteros.rb46
-rw-r--r--lib/oxidized/output/git.rb4
5 files changed, 131 insertions, 5 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..b2aecfb
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,11 @@
+FROM debian:latest
+MAINTAINER Samer Abdel-Hafez <sam@arahant.net>
+
+RUN apt-get update && \
+ apt-get install -y ruby ruby-dev libsqlite3-dev libssl-dev pkg-config make cmake
+
+RUN gem install oxidized oxidized-web --no-ri --no-rdoc
+
+RUN apt-get remove -y ruby-dev pkg-config make cmake
+
+RUN apt-get -y autoremove \ No newline at end of file
diff --git a/README.md b/README.md
index 554ab60..f6ce764 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,8 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen
* [CentOS, Oracle Linux, Red Hat Linux version 6](#centos-oracle-linux-red-hat-linux-version 6)
3. [Initial Configuration](#configuration)
4. [Installing Ruby 2.1.2 using RVM](#installing-ruby-2.1.2-using-rvm)
-5. [Cookbook](#cookbook)
+5. [Running with Docker](#running-with-docker)
+6. [Cookbook](#cookbook)
* [Debugging](#debugging)
* [Privileged mode](#privileged-mode)
* [Source: CSV](#source-csv)
@@ -33,7 +34,7 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen
* [Output: File](#output-file)
* [Output types](#output-types)
* [Advanced Configuration](#advanced-configuration)
-6. [Ruby API](#ruby-api)
+7. [Ruby API](#ruby-api)
* [Input](#input)
* [Output](#output)
* [Source](#source)
@@ -69,6 +70,7 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen
* Juniper JunOS
* Juniper ScreenOS (Netscreen)
* Mikrotik RouterOS
+ * MRV Master-OS
* Ubiquiti AirOS
* Palo Alto PAN-OS
* Zyxel ZyNOS
@@ -162,6 +164,43 @@ rvm install 2.1.2
rvm use --default 2.1.2
```
+# Running with Docker
+1. clone git repo:
+
+```
+ root@bla:~# git clone https://github.com/ytti/oxidized
+```
+2. build container locally:
+```
+ root@bla:~# docker build -q -t oxidized/oxidized:latest oxidized/
+```
+3. create config directory in main system:
+```
+ root@bla~:# mkdir /etc/oxidized
+```
+4. run container the first time:
+```
+ root@bla:~# docker run -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest oxidized
+```
+5. add 'router.db' to /etc/oxidized:
+```
+ root@bla:~# vim /etc/oxidized/router.db
+ [ ... ]
+ root@bla:~#
+```
+6. run container again:
+```
+ root@bla:~# docker run -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest oxidized
+ oxidized[1]: Oxidized starting, running as pid 1
+ oxidized[1]: Loaded 1 nodes
+ Puma 2.13.4 starting...
+ * Min threads: 0, max threads: 16
+ * Environment: development
+ * Listening on tcp://0.0.0.0:8888
+ ^C
+
+ root@bla:~#
+```
## Cookbook
### Debugging
@@ -445,3 +484,22 @@ The following objects exist in Oxidized.
* cfg is executed in input/output/source context
* cmd is executed in instance of model
* 'junos', 'ios', 'ironware' and 'powerconnect' implemented
+
+
+# License and Copyright
+
+Copyright 2013-2015 Saku Ytti <saku@ytti.fi>
+ 2013-2015 Samer Abdel-Hafez <sam@arahant.net>
+
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/lib/oxidized/model/aosw.rb b/lib/oxidized/model/aosw.rb
index 203c5e0..43e1cff 100644
--- a/lib/oxidized/model/aosw.rb
+++ b/lib/oxidized/model/aosw.rb
@@ -5,7 +5,7 @@ class AOSW < Oxidized::Model
# Also Dell controllers
comment '# '
- prompt /^\([^)]+\) #/
+ prompt /^\([^)]+\) [#>]/
cmd :all do |cfg|
cfg.each_line.to_a[1..-2].join
@@ -36,7 +36,16 @@ class AOSW < Oxidized::Model
end
cfg :telnet, :ssh do
+ if vars :enable
+ post_login do
+ send 'enable\n'
+ send vars(:enable) + '\n'
+ end
+ end
post_login 'no paging'
+ if vars :enable
+ pre_logout 'exit'
+ end
pre_logout 'exit'
end
@@ -50,7 +59,7 @@ class AOSW < Oxidized::Model
next if line.match /[0-9]+ (RPM|mV|C)$/
out << line.strip
end
- out = out.join "\n"
+ out = comment out.join "\n"
out << "\n"
end
diff --git a/lib/oxidized/model/masteros.rb b/lib/oxidized/model/masteros.rb
new file mode 100644
index 0000000..3f5a2fc
--- /dev/null
+++ b/lib/oxidized/model/masteros.rb
@@ -0,0 +1,46 @@
+class MasterOS < Oxidized::Model
+
+ # MRV MasterOS model #
+
+comment '!'
+
+ cmd :secret do |cfg|
+ cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
+ cfg.gsub! /username (\S+) password encrypted (\S+) class (\S+).*/, '<secret hidden>'
+ cfg
+ end
+
+ cmd :all do |cfg|
+ cfg.each_line.to_a[1..-2].join
+ end
+
+ cmd 'show inventory' do |cfg|
+ cfg = cfg.each_line.to_a[0..-2].join
+ comment cfg
+ end
+
+ cmd 'show plugins' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show hw-config' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show running-config' do |cfg|
+ cfg = cfg.each_line.to_a[3..-1].join
+ cfg
+ end
+
+ cfg :telnet, :ssh do
+ post_login 'no pager'
+ if vars :enable
+ post_login do
+ send "enable\n"
+ send vars(:enable) + "\n"
+ end
+ end
+ pre_logout 'exit'
+ end
+
+end \ No newline at end of file
diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb
index b1212f1..81be162 100644
--- a/lib/oxidized/output/git.rb
+++ b/lib/oxidized/output/git.rb
@@ -80,6 +80,8 @@ class Git < Output
hash = {}
hash[:date] = commit.time.to_s
hash[:oid] = commit.oid
+ hash[:author] = commit.author
+ hash[:message] = commit.message
tab[i += 1] = hash
end
end
@@ -185,4 +187,4 @@ class Git < Output
end
end
end
-end \ No newline at end of file
+end