Skip to content

Commit

Permalink
Added documentation so yard shows 100% coverage (but it shows warning…
Browse files Browse the repository at this point in the history
…s about the dsl in models)
  • Loading branch information
skiera6 committed Oct 26, 2024
1 parent 222cabc commit 86cd2a9
Show file tree
Hide file tree
Showing 182 changed files with 1,352 additions and 176 deletions.
1 change: 0 additions & 1 deletion lib/oxidized/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def self.load(cmd_opts = {})
raise Error::InvalidConfig, "Error loading config: #{e.message}"
end


# @!visibility private
# If the configuration is being created for the first time, raise NoConfig
raise Error::NoConfig, "edit #{@configfile}" if asetus.create
Expand Down
2 changes: 1 addition & 1 deletion lib/oxidized/hook/githubrepo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,6 @@ def remote_branch(repo)
head_branch = repo.branches[repo.head.name]
repo.branches['origin/' + head_branch.name]
end
end
end
end
end
2 changes: 1 addition & 1 deletion lib/oxidized/input/ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def connect(node)
begin
login
rescue Timeout::Error
raise PromptUndetect, [@output, 'not matching configured prompt', @node.prompt].join(' ')
raise Error::PromptUndetect, [@output, 'not matching configured prompt', @node.prompt].join(' ')
end
end
connected?
Expand Down
7 changes: 7 additions & 0 deletions lib/oxidized/model/acmepacket.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
module Oxidized
module Models
# Represents the ACMEPACKET model.
#
# Handles configuration retrieval and processing for ACMEPACKET devices.

class ACMEPACKET < Oxidized::Models::Model
using Refinements

# @!visibility private
# Oracle ACME Packet 3k, 4k, 6k series

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^\r*([\w.@()-\/]+[#>]\s?)$/

comment '! '
Expand Down
8 changes: 8 additions & 0 deletions lib/oxidized/model/acos.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module Oxidized
module Models
# Represents the ACOS model.
#
# Handles configuration retrieval and processing for ACOS devices.

class ACOS < Oxidized::Models::Model
using Refinements

Expand All @@ -10,6 +14,10 @@ class ACOS < Oxidized::Models::Model

# @!visibility private
# ACOS prompt changes depending on the state of the device

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^([-\w.\/:?\[\]()]+[#>]\s?)$/

cmd :secret do |cfg|
Expand Down
7 changes: 7 additions & 0 deletions lib/oxidized/model/acsw.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
module Oxidized
module Models
# Represents the ACSW model.
#
# Handles configuration retrieval and processing for ACSW devices.

class ACSW < Oxidized::Models::Model
using Refinements

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /([\w.@()\/\\-]+[#>]\s?)/
comment '! '

Expand Down
5 changes: 5 additions & 0 deletions lib/oxidized/model/addpack.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
module Oxidized
module Models
# Represents the AddPack model.
#
# Handles configuration retrieval and processing for AddPack devices.

class AddPack < Oxidized::Models::Model
# @!visibility private
# Used in AddPack Voip, such as AP100B, AP100_G2, AP700, AP1000, AP1100F

using Refinements
# Regular expression to match the device prompt.
PROMPT = /^.*[>#]\s?$/

expect /-- [Mm]ore --/ do |data, re|
Expand Down
7 changes: 7 additions & 0 deletions lib/oxidized/model/adtran.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
module Oxidized
module Models
# Represents the Adtran model.
#
# Handles configuration retrieval and processing for Adtran devices.

class Adtran < Oxidized::Models::Model
using Refinements

# @!visibility private
# Adtran

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /([\w.@-]+[#>]\s?)$/

cmd :all do |cfg|
Expand Down
7 changes: 7 additions & 0 deletions lib/oxidized/model/adva.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ module Models
# ```
#
# Back to [Model-Notes](README.md)
# Represents the ADVA model.
#
# Handles configuration retrieval and processing for ADVA devices.

class ADVA < Oxidized::Models::Model
using Refinements

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /\w+-+[#>]\s?$/
comment '# '

Expand Down
7 changes: 7 additions & 0 deletions lib/oxidized/model/aen.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module Oxidized
module Models
# Represents the AEN model.
#
# Handles configuration retrieval and processing for AEN devices.

class AEN < Oxidized::Models::Model
using Refinements

Expand All @@ -8,6 +12,9 @@ class AEN < Oxidized::Models::Model

comment '# '

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^([-\w.\/:?\[\]()]+:\s?)$/

cmd 'configuration generate-script module all' do |cfg|
Expand Down
18 changes: 18 additions & 0 deletions lib/oxidized/model/aireos.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module Oxidized
module Models
# Represents the Aireos model.
#
# Handles configuration retrieval and processing for Aireos devices.
#
# # Cisco WLC Configuration
#
# Create a user with read-write privilege:
Expand All @@ -11,6 +15,7 @@ module Models
# Oxidized needs read-write privilege in order to execute 'config paging disable'.
#
# Back to [Model-Notes](README.md)

class Aireos < Oxidized::Models::Model
using Refinements

Expand All @@ -19,6 +24,10 @@ class Aireos < Oxidized::Models::Model
# Used in Cisco WLC 5500

comment '# ' # this complains too, can't find real comment char

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^\([^)]+\)\s>/

cmd :all do |cfg|
Expand Down Expand Up @@ -56,6 +65,15 @@ class Aireos < Oxidized::Models::Model
end
end

# Cleans the configuration by removing unnecessary lines.
#
# This method processes the raw configuration data by:
# - Removing empty lines.
# - Removing lines matching specific rogue patterns.
# - Stripping leading carriage returns and whitespace.
#
# @param cfg [String] The raw configuration data.
# @return [String] The cleaned configuration data.
def clean(cfg)
out = []
cfg.each_line do |line|
Expand Down
7 changes: 7 additions & 0 deletions lib/oxidized/model/airfiber.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
module Oxidized
module Models
# Represents the Airfiber model.
#
# Handles configuration retrieval and processing for Airfiber devices.

class Airfiber < Oxidized::Models::Model
using Refinements

# @!visibility private
# Ubiquiti Airfiber (tested with Airfiber 11FX)

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^AF[\w\.-]+#/i

cmd :all do |cfg|
Expand Down
7 changes: 7 additions & 0 deletions lib/oxidized/model/airos.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
module Oxidized
module Models
# Represents the Airos model.
#
# Handles configuration retrieval and processing for Airos devices.

class Airos < Oxidized::Models::Model
using Refinements

# @!visibility private
# Ubiquiti AirOS circa 5.x

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^[^#]+# /
comment '# '

Expand Down
9 changes: 8 additions & 1 deletion lib/oxidized/model/alteonos.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
module Oxidized
module Models
# Represents the ALTEONOS model.
#
# Handles configuration retrieval and processing for ALTEONOS devices.

class ALTEONOS < Oxidized::Models::Model
using Refinements

prompt /^\(?.+\)?\s?[#>]/
# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^\(?.+\)?\s?[#>]/

comment '! '

Expand Down
4 changes: 4 additions & 0 deletions lib/oxidized/model/alvarion.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module Oxidized
module Models
# Represents the Alvarion model.
#
# Handles configuration retrieval and processing for Alvarion devices.

class Alvarion < Oxidized::Models::Model
using Refinements

Expand Down
4 changes: 4 additions & 0 deletions lib/oxidized/model/aos.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module Oxidized
module Models
# Represents the AOS model.
#
# Handles configuration retrieval and processing for AOS devices.

class AOS < Oxidized::Models::Model
using Refinements

Expand Down
4 changes: 4 additions & 0 deletions lib/oxidized/model/aos7.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module Oxidized
module Models
# Represents the AOS7 model.
#
# Handles configuration retrieval and processing for AOS7 devices.

class AOS7 < Oxidized::Models::Model
using Refinements

Expand Down
8 changes: 8 additions & 0 deletions lib/oxidized/model/aoscx.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module Oxidized
module Models
# Represents the Aoscx model.
#
# Handles configuration retrieval and processing for Aoscx devices.

class Aoscx < Oxidized::Models::Model
using Refinements

Expand All @@ -8,6 +12,10 @@ class Aoscx < Oxidized::Models::Model
# ssh switches prompt may start with \r, followed by the prompt itself, regex ([\w\s.-]+[#>] ), which ends the line
# telnet switchs may start with various vt100 control characters, regex (\e\[24;[0-9][hH]), follwed by the prompt, followed
# by at least 3 other vt100 characters

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /(^\r|\e\[24;[0-9][hH])?([\w\s.-]+[#>] )($|(\e\[24;[0-9][0-9]?[hH]){3})/

comment '! '
Expand Down
8 changes: 8 additions & 0 deletions lib/oxidized/model/aosw.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module Oxidized
module Models
# Represents the AOSW model.
#
# Handles configuration retrieval and processing for AOSW devices.

class AOSW < Oxidized::Models::Model
using Refinements

Expand All @@ -20,6 +24,10 @@ class AOSW < Oxidized::Models::Model

# @!visibility private
# see /spec/model/aosw_spec.rb for prompt examples

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^\(?[\w\:.@-]+\)? ?[*^]?(\[[\w\/]+\] ?)?[#>] ?$/

# @!visibility private
Expand Down
4 changes: 4 additions & 0 deletions lib/oxidized/model/apc_aos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ module Models
# password: apc-password
# input: ftp
# ```
# Represents the Apc_aos model.
#
# Handles configuration retrieval and processing for Apc_aos devices.

class Apc_aos < Oxidized::Models::Model # rubocop:disable Naming/ClassAndModuleCamelCase
using Refinements

Expand Down
7 changes: 7 additions & 0 deletions lib/oxidized/model/arbos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ module Models
#
# Back to [Model-Notes](README.md)

# Represents the ARBOS model.
#
# Handles configuration retrieval and processing for ARBOS devices.

class ARBOS < Oxidized::Models::Model
using Refinements

# @!visibility private
# Arbor OS model #

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^[\S\s]+\n([\w.@-]+[:\/#>]+)\s?$/
comment '# '

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 @@ -9,9 +9,16 @@ module Models
# Switch ID Hardware Version Firmware Version
# 0 MBM-XEM-002 (B6-01) 2.1.3-25

# Represents the AricentISS model.
#
# Handles configuration retrieval and processing for AricentISS devices.

class AricentISS < Oxidized::Models::Model
using Refinements

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^(\e\[27m)?[ \r]*[\w-]+# ?$/

cfg :ssh do
Expand Down
7 changes: 7 additions & 0 deletions lib/oxidized/model/asa.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
module Oxidized
module Models
# Represents the ASA model.
#
# Handles configuration retrieval and processing for ASA devices.

class ASA < Oxidized::Models::Model
using Refinements

# @!visibility private
# Cisco ASA model #
# Only SSH supported for the sake of security

# @!method prompt(regex)
# Sets the prompt for the device.
# @param regex [Regexp] The regular expression that matches the prompt.
prompt /^\r*([\w.@()-\/]+[#>]\s?)$/
comment '! '

Expand Down
Loading

0 comments on commit 86cd2a9

Please sign in to comment.