Skip to content

Commit

Permalink
Merge branch 'master' into opengear-config-2880
Browse files Browse the repository at this point in the history
  • Loading branch information
aschaber1 authored Oct 30, 2023
2 parents a5252af + 0b851f6 commit ec27fac
Show file tree
Hide file tree
Showing 27 changed files with 278 additions and 33 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: "Stale Issue/PR cleanup"
on:
schedule:
Expand All @@ -14,3 +15,6 @@ jobs:
- uses: actions/stale@v8
with:
operations-per-run: 500
days-before-issue-stale: 90
days-before-close: 30

23 changes: 19 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- model for D-Link cisco like CLI (@mirackle-spb)
- model for Ruijie Networks RGOS devices (@spike77453)
- Add serial number collection to Opengear (@ermuller)

+ Added ability to send mail with the Docker container
+ Documentation to send mail with hooks
- added support for AricentISS 2.x firmware (@davromaniak)
- model for Asterfusion Network Operating System (@avl-dev)
- pagination for http source (@davama)
- model for Ericsson Miniling 6600 series (@schouwenburg)
- model for Mimosa B11 (@ritzbhuj)
- Added ability to send mail with the Docker container
- Documentation to send mail with hooks

## Changed
- tp-link: fixed enable mode post login entrance (@mirackle-spb)
- dlink: fixed prompt for other dlink switches, added additional uptime removal expressions (@mirackle-spb)
- Collect VC info for juniper ex3400 (@ermuller)
- adva: fix config content for recovery process, collect config delta instead of current (@MichiMeyer)
- iosxr: include last config changed by in model (@electrocret)
- Added support for Nokia SAR 7705 HMC in SROS model (@schouwenburg)

## Fixed

Expand All @@ -25,7 +35,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- fixed netscaler backups with hostname set #2828 (@electrocret)
- Do not redirect stderr when fetching opnsense version since default shell (csh) doesn't support it (@spike77453)
- Fix missing configuration for Opengear (@ermuller)

- Fixed fan RPM speeds included in Aruba CX diffs (@danpoltawski)
- Gitcrypt output refinements (@electrocret)
- Remove constantly updating dates from backup of Adtran config (@davesbell)
- fixed prompt for Cumulus to allow usernames with dots and dashes (@ktims)
- fixed source http when source is librenms (@davama)
- fixed prompt detection for Netgear M4250-10G2XF-PoE+ and M4300-28G-PoE+ (@rexhaugen)

## [0.29.1 - 2023-04-24]

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@

Oxidized is a network device configuration backup tool. It's a RANCID replacement!

Light and extensible, Oxidized supports over 130 operating system types.
It is light and extensible and supports over 130 operating system types.

Feature highlights:

* Automatically adds/removes threads to meet configured retrieval interval
* Restful API to a move node immediately to head-of-queue (GET/POST /node/next/[NODE])
* Syslog udp+file example to catch config change events (IOS/JunOS) and trigger a config fetch
* Will signal which IOS/JunOS user made the change, can then be used by output modules (via POST)
* The `git` output module uses this info - 'git blame' will show who changed each line, and when
* The `git` output module uses this info - 'git blame' will show who changed each line
* Restful API to reload list of nodes (GET /reload)
* Restful API to fetch configurations (/node/fetch/[NODE] or /node/fetch/group/[NODE])
* Restful API to show list of nodes (GET /nodes)
* Restful API to show list of version for a node (/node/version[NODE]) and diffs

Check out the [Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU#t=3h) video on YouTube!
Check out the [Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU?t=3h) video on YouTube!

> :warning: [Maintainer Wanted!](#help-needed) :warning:
>
Expand Down
13 changes: 13 additions & 0 deletions docs/Sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,16 @@ source:
scheme: https
secure: false
```

HTTP source also supports pagination. Two settings must be enabled. (`pagination` as a bool and `pagination_key_name` as a string)
The `pagination_key_name` setting is the key name that an api returns to find the url of the next page.

**Disclaimer**: currently only tested with netbox as the source

```yaml
source:
default: http
http:
pagination: true
pagination_key_name: 'next'
```
8 changes: 8 additions & 0 deletions docs/Supported-OS-Types.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* [AEN](/lib/oxidized/model/aen.rb)
* Acme Packet
* [ACMEPACKET](/lib/oxidized/model/acmepacket.rb)
* AddPack
* [AddPack](/lib/oxidized/model/addpack.rb)
* Adtran
* [Total Access (AOS)](/lib/oxidized/model/adtran.rb)
* Alcatel-Lucent
Expand All @@ -32,6 +34,8 @@
* Aruba
* [AOS-CX](/lib/oxidized/model/aoscx.rb)
* [AOSW](/lib/oxidized/model/aosw.rb)
* Asterfusion
* [AsterNOS](/lib/oxidized/model/asternos.rb)
* AudioCodes
* [AudioCodes](/lib/oxdized/model/audiocodes.rb)
* [MediaPack MP-1xx, Mediant1000](/lib/oxdized/model/audiocodesmp.rb)
Expand Down Expand Up @@ -117,6 +121,7 @@
* [Eltex](/lib/oxidized/model/eltex.rb)
* Ericsson/Redback
* [IPOS (former SEOS)](/lib/oxidized/model/ipos.rb)
* [Minilink 6600](/lib/oxidized/model/ml66.rb)
* Extreme Networks
* [Enterasys B/C-Series](/lib/oxidized/model/enterasys.rb)
* [Enterasys 800-Series](/lib/oxidized/model/enterasys800.rb)
Expand Down Expand Up @@ -183,6 +188,8 @@
* Mikrotik
* [RouterOS](/lib/oxidized/model/routeros.rb)
* [SwOS and SwOS Lite](/lib/oxidized/model/swos.rb)
* Mimosa
* [Mimosa (B11)](/lib/oxidized/model/mimosab11.rb)
* Motorola
* [RFS](/lib/oxidized/model/mtrlrfs.rb)
* MRV
Expand Down Expand Up @@ -271,5 +278,6 @@
* Zyxel
* [ZyNOS](/lib/oxidized/model/zynos.rb)
* [ZyNOS GS-series variant](/lib/oxidized/model/zynosgs.rb)
* [ZyNOS ADSL](/lib/oxidized/model/zynosadsl.rb)
* [NDMS](/lib/oxidized/model/ndms.rb)
* [1308](/lib/oxidized/model/zy1308.rb)
26 changes: 26 additions & 0 deletions lib/oxidized/model/addpack.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class AddPack < Oxidized::Model
# Used in AddPack Voip, such as AP100B, AP100_G2, AP700, AP1000, AP1100F

using Refinements
PROMPT = /^.*[>#]\s?$/

expect /-- [Mm]ore --/ do |data, re|
send ' '
data.sub re, ''
end

prompt PROMPT
cmd 'enable'

cmd 'show running-config' do |cfg|
cfg.gsub! /^Building configuration.../, ''
cfg.gsub! /^*show running-config/, ''
cfg.gsub! PROMPT, ''
cfg
end

cfg :telnet do
username /[Ll]ogin:\s?/
password /[Pp]assword:\s?/
end
end
6 changes: 5 additions & 1 deletion lib/oxidized/model/adtran.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ class Adtran < Oxidized::Model
cfg
end

cmd 'show running-config'
cmd 'show running-config' do |cfg|
# Strip out line at the top which displays the current date/time
# ! Created : Mon Jun 26 2023 10:07:07
cfg.gsub! /! Createds+:.*\n/, ''
end

cfg :ssh do
if vars :enable
Expand Down
2 changes: 1 addition & 1 deletion lib/oxidized/model/adva.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ADVA < Oxidized::Model
cfg.cut_both
end

cmd 'show running-config current' do |cfg|
cmd 'show running-config delta' do |cfg|
cfg.each_line.reject { |line| line.match /^Preparing configuration file.*/ }.join
end

Expand Down
3 changes: 2 additions & 1 deletion lib/oxidized/model/aoscx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Aoscx < Oxidized::Model
cfg.gsub! /^(\d\/\d\/\d.*\s+)\d+\s+$/, '\\1<hidden>'
cfg.gsub! /^(\d+\/\S+\s+\S+\s+)\d+\.\d+\s+C(.*)/, '\\1<hidden>\\2'
cfg.gsub! /^(LC.*\s+)\d+\.\d+\s+(C.*)$/, '\\1 <hidden> \\2'
cfg.gsub! /^(\S+\s+\S+\s+\s+\S+\s+)(slow|normal|medium|fast|max)(\s+\S+\s+\S+\s+)\d+/, '\\1<speed>\\3<rpm>'
comment cfg
end

Expand All @@ -69,7 +70,7 @@ class Aoscx < Oxidized::Model
comment cfg
end

cmd 'show system | exclude "Up Time" | exclude "CPU" | exclude "Memory"' do |cfg|
cmd 'show system | exclude "Up Time|CPU|Memory|Pkts .x|Lowest|Missed"' do |cfg|
comment cfg
end

Expand Down
7 changes: 7 additions & 0 deletions lib/oxidized/model/aricentiss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# #show version
# Switch ID Hardware Version Firmware Version
# 0 SSE-G48-TG4 (P2-01) 1.0.16-9
# and
# # show version
# Switch ID Hardware Version Firmware Version
# 0 MBM-XEM-002 (B6-01) 2.1.3-25

class AricentISS < Oxidized::Model
using Refinements
Expand All @@ -13,6 +17,9 @@ class AricentISS < Oxidized::Model
# 1.0.18-15 is known to include the corrected spelling
post_login 'no cli pagination'
post_login 'no cli pagignation'
# Starting firmware 2.0, pagination is done differently.
# This configuration is reset after the session ends.
post_login 'conf t; set cli pagination off; exit'
pre_logout 'exit'
end

Expand Down
23 changes: 23 additions & 0 deletions lib/oxidized/model/asternos.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class AsterNOS < Oxidized::Model
using Refinements

prompt /^[^\$]+\$/
comment '# '

cmd :all do |cfg|
cfg = cfg.each_line.to_a[1..-2].join
end

cmd 'show version' do |cfg|
# @model = Regexp.last_match(1) if cfg =~ /^Model: (\S+)/
comment cfg
end

cmd "show runningconfiguration all"


cfg :ssh do
# exec true
pre_logout 'exit'
end
end
2 changes: 1 addition & 1 deletion lib/oxidized/model/cumulus.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Cumulus < Oxidized::Model
using Refinements

prompt /^((\w*)@(.*)):/
prompt /^(([\w.-]*)@(.*)):/
comment '# '

# add a comment in the final conf
Expand Down
6 changes: 4 additions & 2 deletions lib/oxidized/model/dlink.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ class Dlink < Oxidized::Model
using Refinements

# D-LINK Switches
# Add support dgs 1100 series (tested only with dgs-1100-10/me)

prompt /^(\r*[\w\s.@()\/:-]+[#>]\s?)$/
prompt /[\w.@()\/:-]+[#>]\s?$/
comment '# '

cmd :secret do |cfg|
Expand All @@ -19,6 +18,9 @@ class Dlink < Oxidized::Model

cmd 'show switch' do |cfg|
cfg.gsub! /^System Uptime\s.+/, '' # Omit constantly changing uptime info
cfg.gsub! /^System up time\s.+/, '' # Omit constantly changing uptime info
cfg.gsub! /^System Time\s.+/, '' # Omit constantly changing uptime info
cfg.gsub! /^RTC Time\s.+/, '' # Omit constantly changing uptime info
comment cfg
end

Expand Down
2 changes: 1 addition & 1 deletion lib/oxidized/model/iosxr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class IOSXR < Oxidized::Model
end

cmd 'show running-config' do |cfg|
cfg = cfg.each_line.to_a[3..-1].join
cfg = cfg.each_line.to_a[1..-1].join
cfg
end

Expand Down
2 changes: 1 addition & 1 deletion lib/oxidized/model/junos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def telnet
case @model
when 'mx960'
out << cmd('show chassis fabric reachability') { |cfg| comment cfg }
when /^(ex22|ex33|ex4|ex8|qfx)/
when /^(ex22|ex3[34]|ex4|ex8|qfx)/
out << cmd('show virtual-chassis') { |cfg| comment cfg }
end
out
Expand Down
34 changes: 34 additions & 0 deletions lib/oxidized/model/mimosab11.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
begin
# Mechanize has to be intialized here as the login needs a POST request
require "mechanize"
rescue LoadError
# Oxidized requires mechanize
raise Oxidized::OxidizedError, "mechanize not found: sudo gem install mechanize"
end

class Mimosab11 < Oxidized::Model
using Refinements
# Callback cfg_cb function to login(POST) then get(GET) the configuration
cfg_cb = lambda do
@e = Mechanize.new
# Set login query endpoint(lqe) and login POST data(lqp)
lqe = "https://#{@node.ip}/?q=index.login&mimosa_ajax=1"
lgp = { "username" => "configure", "password" => @password }
# Set get request endpoint(gc) for config
gc = "https://#{@node.ip}/?q=preferences.configure&mimosa_action=download"
# Not to verify self signed
@e.verify_mode = 0
@e.post(lqe, lgp)
cfg = @e.get(gc)
cfg.body
end

cmd cfg_cb do |cfg|
cfg
end

cfg :http do
@username = @node.auth[:username]
@password = @node.auth[:password]
end
end
34 changes: 34 additions & 0 deletions lib/oxidized/model/ml66.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
class ML66 < Oxidized::Model
comment '! '
prompt /.*#/

expect /User:.*$/ do |data, re|
send "admin_user\n"
send "#{@node.auth[:password]}\n"
data.sub re, ''
end

cmd 'show version' do |cfg|
cfg.gsub! /Uptime/, ''
comment cfg
end

cmd 'show inventory hw all' do |cfg|
comment cfg
end

cmd 'show inventory sw all' do |cfg|
comment cfg
end

cmd 'show license status all' do |cfg|
comment cfg
end

cmd 'show running-config'

cfg :ssh do
pre_logout 'logout'
end

end
2 changes: 1 addition & 1 deletion lib/oxidized/model/netgear.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Netgear < Oxidized::Model
using Refinements

comment '!'
prompt /^(\([\w\s\-.]+\)\s[#>])$/
prompt /^(\([\w\s\-\+.]+\)\s?[#>])$/

cmd :secret do |cfg|
cfg.gsub!(/password (\S+)/, 'password <hidden>')
Expand Down
8 changes: 4 additions & 4 deletions lib/oxidized/model/routeros.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ class RouterOS < Oxidized::Model
cfg
end

cmd '/system routerboard print without-paging' do |cfg|
cmd '/system routerboard print' do |cfg|
cfg = cfg.each_line.grep(/(model|firmware-type|current-firmware|serial-number):/).join
comment cfg
end

cmd '/system package update print without-paging' do |cfg|
version_line = cfg.each_line.grep(/installed-version: /)[0]
@ros_version = /: ([0-9])/.match(version_line)[1].to_i
cmd '/system package update print' do |cfg|
version_line = cfg.each_line.grep(/installed-version:\s|current-version:\s/)[0]
@ros_version = /([0-9])/.match(version_line)[0].to_i
comment version_line
end

Expand Down
Loading

0 comments on commit ec27fac

Please sign in to comment.