repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
thoughtbot/shoulda-matchers | https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb | lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb | module Shoulda
module Matchers
module ActiveRecord
module AssociationMatchers
# @private
class ThroughMatcher
attr_accessor :missing_option
def initialize(through, name)
@through = through
@name = name
@missing_option = ''
en... | ruby | MIT | c0b8352200b90642fef2edadfe0c4fb58f6ec0f8 | 2026-01-04T15:50:06.860443Z | false |
thoughtbot/shoulda-matchers | https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb | lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb | module Shoulda
module Matchers
module ActiveRecord
module AssociationMatchers
# @private
class DependentMatcher
attr_accessor :missing_option
def initialize(dependent, name)
@dependent = dependent
@name = name
@missing_option = ''
... | ruby | MIT | c0b8352200b90642fef2edadfe0c4fb58f6ec0f8 | 2026-01-04T15:50:06.860443Z | false |
thoughtbot/shoulda-matchers | https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb | lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb | module Shoulda
module Matchers
module ActiveRecord
module AssociationMatchers
# @private
class InverseOfMatcher
attr_accessor :missing_option
def initialize(inverse_of, name)
@inverse_of = inverse_of
@name = name
@missing_option = ''
... | ruby | MIT | c0b8352200b90642fef2edadfe0c4fb58f6ec0f8 | 2026-01-04T15:50:06.860443Z | false |
thoughtbot/shoulda-matchers | https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb | lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb | module Shoulda
module Matchers
module ActiveRecord
module AssociationMatchers
# @private
class OptionalMatcher
attr_reader :missing_option
def initialize(attribute_name, optional)
@attribute_name = attribute_name
@optional = optional
@... | ruby | MIT | c0b8352200b90642fef2edadfe0c4fb58f6ec0f8 | 2026-01-04T15:50:06.860443Z | false |
thoughtbot/shoulda-matchers | https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb | lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb | require 'delegate'
module Shoulda
module Matchers
module ActiveRecord
module AssociationMatchers
# @private
class ModelReflection < SimpleDelegator
def initialize(reflection)
super(reflection)
@reflection = reflection
@subject = reflection.activ... | ruby | MIT | c0b8352200b90642fef2edadfe0c4fb58f6ec0f8 | 2026-01-04T15:50:06.860443Z | false |
thoughtbot/shoulda-matchers | https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb | lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb | module Shoulda
module Matchers
module ActiveRecord
module AssociationMatchers
# @private
class RequiredMatcher
attr_reader :missing_option
def initialize(attribute_name, required)
@attribute_name = attribute_name
@required = required
@... | ruby | MIT | c0b8352200b90642fef2edadfe0c4fb58f6ec0f8 | 2026-01-04T15:50:06.860443Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/extra/nagios_check_failing_nodes.rb | extra/nagios_check_failing_nodes.rb | #!/usr/bin/env ruby
## contrib via https://github.com/ytti/oxidized/issues/67
require 'open-uri'
require 'json'
critical = false
pending = false
critical_nodes = []
pending_nodes = []
json = JSON.parse(URI("http://localhost:8888/nodes.json").open(&:read))
json.each do |node|
next if !ARGV.empty? && (ARGV[0] != no... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/extra/rest_client.rb | extra/rest_client.rb | module Oxidized
class RestClient
require 'net/http'
require 'json'
require 'uri'
require 'asetus'
class Config
ROOT = ENV['OXIDIZED_HOME'] || File.join(Dir.home, '.config', 'oxidized')
end
CFGS = Asetus.new name: 'oxidized', load: false, key_to_s: true
CFGS.default.rest = '127.... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/extra/device2yaml.rb | extra/device2yaml.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'net/ssh'
require 'optparse'
require 'etc'
require 'timeout'
# This script logs in a network device and outputs a YAML file that can be
# used for model unit tests in spec/model/
# For more information, see docs/DeviceSimulation.md
################# Methods
#... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/extra/syslog.rb | extra/syslog.rb | #!/usr/bin/env ruby
# IOS:
# logging discriminator CFG mnemonics includes CONFIG_I
# logging host SERVER discriminator CFG
# JunOS:
# set system syslog host SERVER interactive-commands notice
# set system syslog host SERVER match "^mgd\[[0-9]+\]: UI_COMMIT: .*"
# Ports < 1024 need extra privileges, use a port higher... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/nodes_spec.rb | spec/nodes_spec.rb | require_relative 'spec_helper'
describe Oxidized::Nodes do
before(:each) do
Resolv.any_instance.stubs(:getaddress)
Oxidized.asetus = Asetus.new
opts = {
input: 'ssh',
output: 'git',
model: 'junos',
username: 'alma',
password: 'armud',
prompt: 'test_prompt'
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/core_spec.rb | spec/core_spec.rb | require_relative 'spec_helper'
require 'oxidized/core'
require 'oxidized/web'
describe Oxidized::Core do
before do
Oxidized.asetus = Asetus.new
Oxidized::Manager.expects(:new)
Oxidized.stubs(:mgr=)
Oxidized::HookManager.expects(:from_config)
Oxidized.stubs(:hooks=)
@mock_nodes = mock('Oxid... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/cli_spec.rb | spec/cli_spec.rb | require_relative 'spec_helper'
require 'oxidized/cli'
describe Oxidized::CLI do
before(:each) do
@original = ARGV
Oxidized.asetus = Asetus.new
end
after(:each) do
ARGV.replace @original
end
%w[-v --version].each do |option|
describe option do
before { ARGV.replace([option]) }
i... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/logger_spec.rb | spec/logger_spec.rb | require_relative 'spec_helper'
describe Oxidized::Logger do
before(:each) do
Oxidized.asetus = Asetus.new
@saved_level = SemanticLogger.default_level
# Remove the appender from spec_helper
SemanticLogger.clear_appenders!
# Reverse possible log level definition in spec_helper
SemanticLogger.de... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/refinements_spec.rb | spec/refinements_spec.rb | require_relative 'spec_helper'
require 'refinements'
describe Refinements do
using Refinements
describe '#init' do
it 'initializer test' do
output = String.new("test")
_(output).must_equal 'test'
_(output).must_be_instance_of String
_(output.respond_to?(:cut_both)).must_equal true
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/manager_spec.rb | spec/manager_spec.rb | require_relative 'spec_helper'
describe Oxidized::Manager do
before(:each) do
Oxidized.asetus = Asetus.new
end
describe '#add_source' do
it 'loads a source when available' do
Oxidized.config.source.csv.file = '/some/path'
Oxidized.config.source.csv.map.name = '0'
result = Oxidized.mgr.... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/job_spec.rb | spec/job_spec.rb | require_relative 'spec_helper'
require 'oxidized/job'
describe Oxidized::Job do
before(:each) do
Oxidized.asetus = Asetus.new
Oxidized.config.timelimit = 300
end
it "gets a status :timelimit when the job timelimit is reached" do
node = mock("Oxidized::Node")
node.expects(:name).returns("SW123").t... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/config_spec.rb | spec/config_spec.rb | require_relative 'spec_helper'
require 'oxidized/config'
describe 'Oxidized::Config' do
describe '#load' do
it 'raises Oxidized::NoConfig when no config file is provided' do
Asetus.any_instance.expects(:load)
Asetus.any_instance.expects(:create).returns(true)
err = _(-> { Oxidized::Config.load... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/spec_helper.rb | spec/spec_helper.rb | require 'simplecov'
SimpleCov.start
require 'minitest/autorun'
require 'mocha/minitest'
require 'oxidized'
Oxidized.mgr = Oxidized::Manager.new
# The default log level is :info; uncomment & adapt to set another log level in the tests
# SemanticLogger.default_level = :debug
SemanticLogger.add_appender(io: $stderr)
de... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/node_spec.rb | spec/node_spec.rb | require_relative 'spec_helper'
describe Oxidized::Node do
before(:each) do
Oxidized.asetus = Asetus.new
Oxidized.config.timelimit = 300
Oxidized::Node.any_instance.stubs(:resolve_repo)
Oxidized::Node.any_instance.stubs(:resolve_output)
@node = Oxidized::Node.new(name: 'example.com',
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/hook/githubrepo_spec.rb | spec/hook/githubrepo_spec.rb | require_relative '../spec_helper'
require 'rugged'
require 'oxidized/hook/githubrepo'
describe GithubRepo do
let(:credentials) { mock }
let(:remote) { mock 'remote' }
let(:remotes) { mock 'remotes' }
let(:repo_head) { mock 'repo_head' }
let(:repo) { mock 'repo' }
let(:gr) { GithubRepo.new }
let(:local_br... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/model/atoms.rb | spec/model/atoms.rb | # Automatic Trivial Oxidized Model Spec - ATOMS
# Simple model testing for the simple/common case
class ATOMS
DIRECTORY = File.join(File.dirname(__FILE__), 'data').freeze
class ATOMSError < StandardError; end
# Returns a list of all tests matching the data files under ATOMS::DIRECTORY
def self.all
# enumer... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/model/apc_aos_spec.rb | spec/model/apc_aos_spec.rb | require_relative '../spec_helper'
describe 'Model apc_aos' do
before(:each) do
Oxidized.asetus = Asetus.new
Oxidized::Node.any_instance.stubs(:resolve_repo)
Oxidized::Node.any_instance.stubs(:resolve_output)
end
it "fetches the configuration with ftp" do
@node = Oxidized::Node.new(name: 'ex... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/model/model_helper.rb | spec/model/model_helper.rb | # frozen_string_literal: true
require_relative '../spec_helper'
require_relative 'atoms'
require 'yaml'
def init_model_helper
Oxidized.asetus = Asetus.new
Oxidized.config.timeout = 5
Oxidized.config.prompt = /^([\w.@-]+[#>]\s?)$/
Oxidized::Node.any_instance.stubs(:resolve_repo)
Oxidized::Node.any_instance.s... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/model/model_spec.rb | spec/model/model_spec.rb | require_relative '../spec_helper'
require 'oxidized/model/model'
# rubocop:disable Style/FormatStringToken
class TestModel < Oxidized::Model
using Refinements
comment '! '
metadata :top do
comment "Fetched by Oxidized with model #{self.class.name} from host #{@node.name} [#{@node.ip}]\n"
end
metadata... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/model/model_helper_spec.rb | spec/model/model_helper_spec.rb | require_relative 'model_helper'
# This class is used to test the developpent of model_helper.rb
# it uses the Garderos model, as model_helper.rb was deveopped with it
describe 'Model Helper' do
before(:each) do
init_model_helper
@node = MockSsh.get_node('garderos')
@test = ATOMS::TestOutput.new('garderos... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/model/custom_metadata_spec.rb | spec/model/custom_metadata_spec.rb | require_relative '../spec_helper'
require 'oxidized/model/opnsense'
require 'oxidized/model/pfsense'
# Testing models with custom metatada
describe 'custom metadata models' do
before do
Oxidized.asetus = Asetus.new
@mock_node = mock('Oxidized::Node')
@mock_node.stubs(:name).returns('router1')
@mock... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/model/cumulus_spec.rb | spec/model/cumulus_spec.rb | require_relative 'model_helper'
describe 'Model Cumulus' do
before(:each) do
init_model_helper
end
it 'runs on MSN2010 with Cumulus Linux 5.9.2 (nvue mode)' do
# Reload node with vars cumulus_use_nvue set
@node = Oxidized::Node.new(name: 'example.com',
input: 'ssh',
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/model/atoms_generate.rb | spec/model/atoms_generate.rb | require_relative 'model_helper'
# We use empty tests because we need the mock / stub feature of minitest/mocha
# to simulate SSH in order to generate the output
describe('') do
it('') do
ATOMS.get(ATOMS::TestOutput, '*#simulation.yaml').each do |test|
print "Generating output file for #{test}... "
be... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/model/model_atoms_spec.rb | spec/model/model_atoms_spec.rb | require_relative 'model_helper'
describe 'ATOMS tests' do
ATOMS.all.each do |test|
before { init_model_helper }
case test.type
when 'output'
it "#{test} has expected output" do
skip("check simulation+output data file for #{test}") if test.skip?
cfg = MockSsh.get_result(self, test).... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/source/source_spec.rb | spec/source/source_spec.rb | require_relative '../spec_helper'
require 'oxidized/source/source'
describe Oxidized::Source do
describe '#map_model' do
before(:each) do
Asetus.any_instance.expects(:load)
Asetus.any_instance.expects(:create).returns(false)
# Set :home_dir to make sure the OXIDIZED_HOME environment variable i... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/source/jsonfile_spec.rb | spec/source/jsonfile_spec.rb | require_relative '../spec_helper'
require 'oxidized/source/jsonfile'
describe Oxidized::Source::JSONFile do
describe '#setup' do
before(:each) do
Asetus.any_instance.expects(:load)
Asetus.any_instance.expects(:create).returns(false)
# Set :home_dir to make sure the OXIDIZED_HOME environment va... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/source/csv_spec.rb | spec/source/csv_spec.rb | require_relative '../spec_helper'
require 'oxidized/source/csv'
describe Oxidized::Source::CSV do
describe '#setup' do
before(:each) do
Asetus.any_instance.expects(:load)
Asetus.any_instance.expects(:create).returns(false)
# Set :home_dir to make sure the OXIDIZED_HOME environment variable is ... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/source/sql_spec.rb | spec/source/sql_spec.rb | require_relative '../spec_helper'
require 'oxidized/source/sql'
describe Oxidized::Source::SQL do
describe '#setup' do
before(:each) do
Asetus.any_instance.expects(:load)
Asetus.any_instance.expects(:create).returns(false)
# Set :home_dir to make sure the OXIDIZED_HOME environment variable is ... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/source/http_spec.rb | spec/source/http_spec.rb | require_relative '../spec_helper'
require 'oxidized/source/http'
describe Oxidized::Source::HTTP do
before(:each) do
Oxidized.asetus = Asetus.new
end
describe '#setup' do
before(:each) do
Asetus.any_instance.expects(:load)
Asetus.any_instance.expects(:create).returns(false)
# Set :hom... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/input/http_spec.rb | spec/input/http_spec.rb | require_relative '../spec_helper'
require 'oxidized/input/http'
describe Oxidized::HTTP do
before(:each) do
Oxidized.asetus = Asetus.new
Oxidized::Node.any_instance.stubs(:resolve_repo)
Oxidized::Node.any_instance.stubs(:resolve_input)
Oxidized::Node.any_instance.stubs(:resolve_output)
end
def g... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/input/ssh_spec.rb | spec/input/ssh_spec.rb | require_relative '../spec_helper'
require 'oxidized/input/ssh'
describe Oxidized::SSH do
before(:each) do
Oxidized.asetus = Asetus.new
Oxidized.config.timeout = 30
Oxidized.config.input.ssh.secure = true
Oxidized::Node.any_instance.stubs(:resolve_repo)
Oxidized::Node.any_instance.stubs(:resolve_i... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/config/vars_spec.rb | spec/config/vars_spec.rb | require_relative '../spec_helper'
require 'oxidized/config/vars'
def vars(name, vars = {})
vars = vars.transform_keys(&:to_s)
klass = Class.new
klass.instance_variable_set(:@node, get_node(vars))
klass.extend(Oxidized::Config::Vars)
klass.vars(name)
end
def get_node(vars = {})
Oxidized::Node.new(name: ... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/output/file_spec.rb | spec/output/file_spec.rb | require_relative '../spec_helper'
require 'oxidized/output/file'
describe 'Oxidized::Output::File' do
describe '#setup' do
it 'raises Oxidized::NoConfig when no config is provided' do
Asetus.any_instance.expects(:load)
Asetus.any_instance.expects(:create).returns(false)
# we do not want to crea... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/output/output_spec.rb | spec/output/output_spec.rb | require_relative '../spec_helper'
require 'oxidized/output/output'
require 'oxidized/output/git'
require 'oxidized/output/file'
require 'oxidized/output/http'
describe 'Oxidized::Output' do
describe '.clean_obsolete_nodes' do
before do
Oxidized.asetus = Asetus.new
end
it 'runs on git' do
Oxid... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/output/git_spec.rb | spec/output/git_spec.rb | require_relative 'git_helper'
describe Oxidized::Output::Git do
describe '#yield_repo_and_path' do
# Note that #yield_repo_and_path is private, so we can not call it directy
# we use @git.send(:yield_repo_and_path, ...) to bypass the protection
before do
Oxidized.asetus = Asetus.new
# Default... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/spec/output/git_helper.rb | spec/output/git_helper.rb | require 'simplecov'
require 'minitest/autorun'
require 'mocha/minitest'
require 'oxidized'
require 'oxidized/output/git'
Oxidized.mgr = Oxidized::Manager.new
class RepoMock
attr_reader :commits, :head
def initialize
@commits = []
end
HeadMock = Struct.new(:target)
TargetMock = Struct.new(:oid)
def... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/refinements.rb | lib/refinements.rb | module Refinements
# Use the 'refine' keyword to define refinements for the String class
refine String do
attr_accessor :type, :cmd, :name
# @return [String] copy of self with last line removed
def cut_tail(lines = 1)
return "" if length.zero?
each_line.to_a[0..(-1 - lines)].join
end
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized.rb | lib/oxidized.rb | require 'fileutils'
require 'refinements'
require 'semantic_logger'
module Oxidized
class OxidizedError < StandardError; end
include SemanticLogger::Loggable
Directory = File.expand_path(File.join(File.dirname(__FILE__), '../'))
require 'oxidized/version'
require 'oxidized/config'
require 'oxidized/confi... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/core.rb | lib/oxidized/core.rb | module Oxidized
class << self
def new(*args)
Core.new args
end
end
class Core
include SemanticLogger::Loggable
class NoNodesFound < OxidizedError; end
def initialize(_args)
Oxidized.mgr = Manager.new
Oxidized.hooks = HookManager.from_config(Oxidized.config)
nodes = N... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/version.rb | lib/oxidized/version.rb | # frozen_string_literal: true
module Oxidized
VERSION = '0.35.0'
VERSION_FULL = '0.35.0'
def self.version_set
version_full = %x(git describe --tags).chop rescue ""
version = %x(git describe --tags --abbrev=0).chop rescue ""
return false unless [version, version_full].none?(&:empty?)
Oxidiz... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/logger.rb | lib/oxidized/logger.rb | require 'semantic_logger'
module Oxidized
module Logger
include SemanticLogger::Loggable
def self.setup
config = Oxidized.config
FileUtils.mkdir_p(Config::LOG) unless File.directory?(Config::LOG)
SemanticLogger.add_signal_handler
if config.use_syslog?
SemanticLogger.add_app... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/nodes.rb | lib/oxidized/nodes.rb | module Oxidized
require 'ipaddr'
require 'oxidized/node'
class NotSupported < OxidizedError; end
class NodeNotFound < OxidizedError; end
class Nodes < Array
include SemanticLogger::Loggable
attr_accessor :source, :jobs
alias put unshift
def load(node_want = nil)
with_lock do
ne... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/node.rb | lib/oxidized/node.rb | module Oxidized
require 'resolv'
require_relative 'node/stats'
class MethodNotFound < OxidizedError; end
class ModelNotFound < OxidizedError; end
class Node
include SemanticLogger::Loggable
attr_reader :name, :ip, :model, :input, :output, :group, :auth, :prompt, :timeout, :vars, :last, :repo
at... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/signals.rb | lib/oxidized/signals.rb | # Monkey patch Signal.trap for Puma to keep it from overriding our handlers
# Also prevent Puma from registering its own SIGHUP handler
module Puma
class Signal
class << self
alias os_trap trap
def Signal.trap(sig, &block)
sigshortname = sig.gsub "SIG", ''
Oxidized::Signals.register_si... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/cli.rb | lib/oxidized/cli.rb | require 'semantic_logger'
module Oxidized
class CLI
include SemanticLogger::Loggable
require 'slop'
require 'oxidized'
require 'English'
def run
check_pid
Process.daemon if @opts[:daemonize]
write_pid
begin
logger.info "Oxidized starting, running as pid #{$PROCES... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/hook.rb | lib/oxidized/hook.rb | module Oxidized
class HookManager
include SemanticLogger::Loggable
class << self
def from_config(cfg)
mgr = new
cfg.hooks.each do |name, h_cfg|
h_cfg.events.each do |event|
mgr.register event.to_sym, name, h_cfg.type, h_cfg
end
end
mgr
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/worker.rb | lib/oxidized/worker.rb | module Oxidized
require 'oxidized/job'
require 'oxidized/jobs'
class Worker
include SemanticLogger::Loggable
def initialize(nodes)
@jobs_done = 0
@nodes = nodes
@jobs = Jobs.new(Oxidized.config.threads, Oxidized.config.use_max_threads, Oxidized.config.interval, @nodes)
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/config.rb | lib/oxidized/config.rb | module Oxidized
require 'asetus'
class NoConfig < OxidizedError; end
class InvalidConfig < OxidizedError; end
class Config
ROOT = ENV['OXIDIZED_HOME'] || File.join(Dir.home, '.config', 'oxidized')
CRASH = File.join(ENV['OXIDIZED_LOGS'] || ROOT, 'crash')
LOG = File.join(ENV['OXIDIZ... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/manager.rb | lib/oxidized/manager.rb | module Oxidized
require 'oxidized/model/model'
require 'oxidized/input/input'
require 'oxidized/output/output'
require 'oxidized/source/source'
class Manager
class << self
def load(dir, file, namespace)
require File.join dir, file + '.rb'
# Search the object to load in namespace
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/jobs.rb | lib/oxidized/jobs.rb | module Oxidized
class Jobs < Array
AVERAGE_DURATION = 5 # initially presume nodes take 5s to complete
MAX_INTER_JOB_GAP = 300 # add job if more than X from last job started
attr_accessor :interval, :max, :want
def initialize(max, use_max_threads, interval, nodes)
@max = max
@use_max_th... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/job.rb | lib/oxidized/job.rb | module Oxidized
class Job < Thread
include SemanticLogger::Loggable
attr_reader :start, :end, :status, :time, :node, :config
def initialize(node)
@node = node
@start = Time.now.utc
self.name = "Job '#{@node.name}'"
super do
logger.debug "Starting fetching process for #{@n... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/hook/awssns.rb | lib/oxidized/hook/awssns.rb | require 'aws-sdk'
class AwsSns < Oxidized::Hook
def validate_cfg!
raise KeyError, 'hook.region is required' unless cfg.has_key?('region')
raise KeyError, 'hook.topic_arn is required' unless cfg.has_key?('topic_arn')
end
def run_hook(ctx)
sns = Aws::SNS::Resource.new(region: cfg.region)
topic = s... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/hook/xmppdiff.rb | lib/oxidized/hook/xmppdiff.rb | require 'xmpp4r'
require 'xmpp4r/muc/helper/simplemucclient'
class XMPPDiff < Oxidized::Hook
def connect
@client = Jabber::Client.new(Jabber::JID.new(cfg.jid))
logger.info "Connecting to XMPP"
begin
Timeout.timeout(15) do
begin
@client.connect
rescue StandardError => e
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/hook/exec.rb | lib/oxidized/hook/exec.rb | class Exec < Oxidized::Hook
include Process
def initialize
super
@timeout = 60
@async = false
end
def validate_cfg!
# Syntax check
if cfg.has_key? "timeout"
@timeout = cfg.timeout
raise "invalid timeout value" unless @timeout.is_a?(Integer) &&
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/hook/noophook.rb | lib/oxidized/hook/noophook.rb | class NoopHook < Oxidized::Hook
def validate_cfg!
logger.info "Validate config"
end
def run_hook(ctx)
logger.info "Run hook with context: #{ctx}"
end
end
| ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/hook/githubrepo.rb | lib/oxidized/hook/githubrepo.rb | require 'rugged'
class GithubRepo < Oxidized::Hook
def validate_cfg!
raise KeyError, 'hook.remote_repo is required' unless cfg.has_key?('remote_repo')
end
def run_hook(ctx)
unless ctx.node
logger.error 'GithubRepo.run_hook: no node provided'
return
end
unless ctx.node.repo
log... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/hook/ciscosparkdiff.rb | lib/oxidized/hook/ciscosparkdiff.rb | require 'cisco_spark'
# defaults to posting a diff, if messageformat is supplied them a message will be posted too
# diff defaults to true
# Modified from slackdiff
class CiscoSparkDiff < Oxidized::Hook
def validate_cfg!
raise KeyError, 'hook.accesskey is required' unless cfg.has_key?('accesskey')
raise Key... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/hook/slackdiff.rb | lib/oxidized/hook/slackdiff.rb | require 'slack_ruby_client'
require 'uri'
require 'net/http'
# defaults to posting a diff, if messageformat is supplied them a message will be posted too
# diff defaults to true
class SlackDiff < Oxidized::Hook
def validate_cfg!
raise KeyError, 'hook.token is required' unless cfg.has_key?('token')
raise Key... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/gcombnps.rb | lib/oxidized/model/gcombnps.rb | class GcomBNPS < Oxidized::Model
using Refinements
# For switches from GCOM Technologies Co.,Ltd. running the "Broadband Network Platform Software"
# Author: Frederik Kriewitz <frederik@kriewitz.eu>
#
# tested with:
# - S5330 (aka Fiberstore S3800)
prompt /^\r?([\w.@()-]+?(\(1-\d+ chars\))?[#>:]\s?)$/ ... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/openwrt.rb | lib/oxidized/model/openwrt.rb | class OpenWrt < Oxidized::Model
using Refinements
prompt /^[^#]+#/
comment '#'
cmd 'cat /etc/banner' do |cfg|
comment "#### Info: /etc/banner #####\n#{cfg}"
end
cmd 'cat /proc/cpuinfo' do |cfg|
comment "#### Info: /proc/cpuinfo #####\n#{cfg}"
end
cmd 'cat /etc/openwrt_release' do |cfg|
c... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/enterprise_sonic.rb | lib/oxidized/model/enterprise_sonic.rb | class Enterprise_SONiC < Oxidized::Model # rubocop:disable Naming/ClassAndModuleCamelCase
using Refinements
# Remove ANSI escape codes
expect /\e\[[0-?]*[ -\/]*[@-~]\r?/ do |data, re|
data.gsub re, ''
end
# Matches both sonic-cli and linux terminal
prompt /^(?:[\w.-]+@[\w.-]+:[~\w\/-]+\$|[\w.-]+#)\s*/... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/acsw.rb | lib/oxidized/model/acsw.rb | class ACSW < Oxidized::Model
using Refinements
prompt /([\w.@()\/\\-]+[#>]\s?)/
comment '! '
cmd :all do |cfg|
cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
cfg.cut_both
end
cmd :secret do |cfg|
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
c... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/xos.rb | lib/oxidized/model/xos.rb | class XOS < Oxidized::Model
using Refinements
# Extreme Networks XOS
prompt /^\s?\*?\s?[-\w]+\s?[-\w.~]+(:\d+)? [#>] $/
comment '# '
cmd :all do |cfg|
# xos inserts leading \r characters and other trailing white space.
# this deletes extraneous \r and trailing white space.
cfg.each_line.to_a[1... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/aosw.rb | lib/oxidized/model/aosw.rb | class AOSW < Oxidized::Model
using Refinements
# AOSW Aruba Wireless, IAP, Instant Controller and Mobility Access Switches
# Used in Alcatel OAW-4750 WLAN controller
# Also Dell controllers
# HPE Aruba Switches should use a different model as the software is based on the HP Procurve line.
# Support for I... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/audiocodes.rb | lib/oxidized/model/audiocodes.rb | class AudioCodes < Oxidized::Model
using Refinements
# Pull config from AudioCodes Mediant devices from version > 7.0
prompt /^\r?([\w.@() -]+[#>]\s?)$/
comment '## '
expect /\s*--MORE--$/ do |data, re|
send ' '
data.sub re, ''
end
cmd "show running-config\r\n" do |cfg|
cfg
end
cfg :... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/audiocodesmp.rb | lib/oxidized/model/audiocodesmp.rb | class AudioCodesMP < Oxidized::Model
using Refinements
# AudioCodes MediaPack MP1xx and Mediant 1000 devices (firmware v4.xx, v5.xx, v6.xx) by pedjajks@gmail.com
prompt /^\/\w*>/
comment ';'
cmd 'conf' do
end
cmd 'cf get' do |cfg|
lines = cfg.each_line.to_a[0..-1]
# remove any garbage before ... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/lancom.rb | lib/oxidized/model/lancom.rb | class LANCOM < Oxidized::Model
using Refinements
# LANCOM Systems GmbH
# tested on LANCOM 1781EF+ router using Lancom OS 10.32.0176RU9 / 21.04.2020
comment '# '
prompt />\s?$/
cmd "sysinfo\r" do |cfg|
cfg.gsub! /^TIME:.*\n/, ''
comment cfg
end
cmd "readscript\r"
cfg :telnet do
usernam... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/airos.rb | lib/oxidized/model/airos.rb | class Airos < Oxidized::Model
using Refinements
# Ubiquiti AirOS circa 5.x
prompt /^[^#]+# /
comment '# '
cmd 'cat /etc/board.info' do |cfg|
cfg.split("\n").map { |line| "# #{line}" }.join("\n") + "\n"
end
cmd 'cat /etc/version' do |cfg|
comment "airos version: #{cfg}"
end
cmd 'sort /tmp/... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/yamaha.rb | lib/oxidized/model/yamaha.rb | class Yamaha < Oxidized::Model
using Refinements
prompt /^([\w.@()-]+[#>]\s?)$/
comment '# '
expect /^---more---$/ do |data, re|
send ' '
data.sub re, ''
end
# non-preferred way to handle additional PW prompt
# expect /^[\w.]+>$/ do |data|
# send "enable\n"
# send vars(:enable) + "\n"
#... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/supermicro.rb | lib/oxidized/model/supermicro.rb | # Backward compatibility shim for deprecated model `supermicro`.
# Migrate your source from `supermicro` to `edgecos`.
require_relative 'edgecos'
Supermicro = EdgeCOS
logger.warn "Using deprecated model supermicro, use edgecos instead."
# Deprecated
| ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/opnsense.rb | lib/oxidized/model/opnsense.rb | class OpnSense < Oxidized::Model
using Refinements
# minimum required permissions: "System: Shell account access"
# must enable SSH and password-based SSH access
cmd 'cat /conf/config.xml' do |cfg|
cfg.gsub! /\s<revision>\s*<time>\d*<\/time>\s*.*\s*.*\s*<\/revision>/, ''
cfg.gsub! /\s<last_rule_upd_ti... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/hatteras.rb | lib/oxidized/model/hatteras.rb | class Hatteras < Oxidized::Model
using Refinements
# Hatteras Networks
prompt /^(\r?[\w.@()-]+[#>]\s?)$/
comment '# '
expect /WARNING: System configuration changes will be lost when the device restarts./ do |data, re|
send "y\r"
data.sub re, ''
end
cmd :secret do |cfg|
cfg.gsub! /^(communi... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/planet.rb | lib/oxidized/model/planet.rb | class Planet < Oxidized::Model
using Refinements
prompt /^\r?([\w.@()-]+[#>]\s?)$/
comment '! '
# example how to handle pager
# expect /^\s--More--\s+.*$/ do |data, re|
# send ' '
# data.sub re, ''
# end
# non-preferred way to handle additional PW prompt
# expect /^[\w.]+>$/ do |data|
# send ... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/adtran.rb | lib/oxidized/model/adtran.rb | class Adtran < Oxidized::Model
using Refinements
# Adtran
prompt /([\w.@-]+[#>]\s?)$/
cmd :all do |cfg|
cfg.each_line.to_a[2..-2].map { |line| line.delete("\r").rstrip }.join("\n") + "\n"
end
cmd :secret do |cfg|
cfg.gsub!(/password (\S+)/, 'password <hidden>')
cfg
end
cmd 'show running... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/fsos.rb | lib/oxidized/model/fsos.rb | class FSOS < Oxidized::Model
# Fiberstore / fs.com
using Refinements
comment '! '
prompt /^([\w.@()-]+[#>]\s?)$/
# Handle paging
expect /^ --More--.*$/ do |data, re|
send ' '
data.sub re, ''
end
cmd :secret do |cfg|
cfg.gsub! /(secret \w+) (\S+).*/, '\\1 <secret hidden>'
cfg.gsub! /(pa... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/aireos.rb | lib/oxidized/model/aireos.rb | class Aireos < Oxidized::Model
using Refinements
# AireOS (at least I think that is what it's called, hard to find data)
# Used in Cisco WLC 5500
comment '# ' # this complains too, can't find real comment char
prompt /^\([^)]+\)\s>/
cmd :all do |cfg|
cfg.cut_both
end
# show sysinfo?
# show swi... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/procurve.rb | lib/oxidized/model/procurve.rb | class Procurve < Oxidized::Model
using Refinements
# previous command is repeated followed by "\eE", which sometimes ends up on last line
# ssh switches prompt may start with \r, followed by the prompt itself, regex ([\w\s.-]+[#>] ), which ends the line
# telnet switches may start with various vt100 control ch... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/datacom.rb | lib/oxidized/model/datacom.rb | class DataCom < Oxidized::Model
using Refinements
comment '! '
expect /^--More--\s+$/ do |data, re|
send ' '
data.sub re, ''
end
cmd :all do |cfg|
cfg.cut_head.cut_both.cut_tail
end
cmd 'show firmware' do |cfg|
comment cfg
end
cmd 'show system' do |cfg|
comment cfg
end
cm... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/acmepacket.rb | lib/oxidized/model/acmepacket.rb | class ACMEPACKET < Oxidized::Model
using Refinements
# Oracle ACME Packet 3k, 4k, 6k series
prompt /^\r*([\w.@()-\/]+[#>]\s?)$/
comment '! '
cmd :all do |cfg, cmdstring|
new_cfg = comment "COMMAND: #{cmdstring}\n"
new_cfg << cfg.cut_both
end
cmd 'show version' do |cfg|
comment cfg
end
... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/lenovonos.rb | lib/oxidized/model/lenovonos.rb | class LenovoNOS < Oxidized::Model
using Refinements
prompt /^([\w.@()-]+[#>]\s?)$/
comment '! '
def comment_ext(header, output)
data = ''
data << header
data << "\n"
data << output
data << "\n"
comment data
end
cmd :all do |cfg|
cfg.gsub! /^% Invalid input detected at '\^' mar... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/weos.rb | lib/oxidized/model/weos.rb | class WEOS < Oxidized::Model
using Refinements
# Westell WEOS, works with Westell 8178G, Westell 8266G
prompt /^(\s[\w.@-]+[#>]\s?)$/
cmd :all do |cfg|
cfg.cut_both
end
cmd 'show running-config' do |cfg|
cfg
end
cfg :telnet do
username /login:/
password /assword:/
post_login 'cl... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/truenas.rb | lib/oxidized/model/truenas.rb | class TrueNAS < Oxidized::Model
using Refinements
comment '# '
cmd('uname -a') { |cfg| comment cfg }
cmd('cat /etc/version') { |cfg| comment cfg }
cmd('sqlite3 "file:///data/freenas-v1.db?mode=ro&immutable=1" .dump') do |cfg|
cfg.lines.reject do |line|
line.match(/^INSERT INTO storage_replication ... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/cnos.rb | lib/oxidized/model/cnos.rb | # model for Centec Networks CNOS based switches
class CNOS < Oxidized::Model
using Refinements
comment '! '
cmd :secret do |cfg|
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
cfg.gsub! /^(username .+ (password|secret) \d) .+/, '\\1 <secret hidden>'
cfg.gsub! /^(enable (passwo... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/h3c.rb | lib/oxidized/model/h3c.rb | class H3C < Oxidized::Model
using Refinements
# H3C
prompt /^[<\[][\w.-]+[>\]]$/
comment '# '
cmd :secret do |cfg|
cfg.gsub! /(pin verify (?:auto|)).*/, '\\1 <PIN hidden>'
cfg.gsub! /(%\^%#.*%\^%#)/, '<secret hidden>'
cfg
end
cmd :all do |cfg|
cfg.cut_both
end
cfg :telnet do
u... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/asa.rb | lib/oxidized/model/asa.rb | class ASA < Oxidized::Model
using Refinements
# Cisco ASA model #
# Only SSH supported for the sake of security
prompt /^\r*([\w.@()-\/]+[#>]\s?)$/
comment '! '
cmd :all do |cfg|
cfg.cut_both
end
cmd :secret do |cfg|
cfg.gsub! /enable password (\S+) (.*)/, 'enable password <secret hidden> \... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/icotera.rb | lib/oxidized/model/icotera.rb | class Icotera < Oxidized::Model
using Refinements
comment '## '
cmd :all do |cfg|
cfg.cut_both
end
cmd 'show management' do |cfg|
cfg.gsub! /^\s+System uptime.*\n/, ""
cfg.gsub! /^\s+Bytes in.*\n/, ""
cfg.gsub! /^\s+Pkts in.*\n/, ""
cfg.gsub! /^\s+Ucast in.*\n/, ""
cfg.gsub! /^\s+Bc... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/dlinknextgen.rb | lib/oxidized/model/dlinknextgen.rb | class DlinkNextGen < Oxidized::Model
using Refinements
# D-LINK next generation cli Switches
# Add support DXS-1210-12SC
prompt /[\w.@()\/-]+[#>]\s?$/
comment '# '
cmd :all do |cfg|
cfg.each_line.to_a[2..-2].map { |line| line.delete("\r").rstrip }.join("\n") + "\n"
end
cmd :secret do |cfg|
c... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/br6910.rb | lib/oxidized/model/br6910.rb | class BR6910 < Oxidized::Model
using Refinements
prompt /^([\w.@()-]+[#>]\s?)$/
comment '! '
# not possible to disable paging prior to show running-config
expect /^((.*)Others to exit ---(.*))$/ do |data, re|
send 'a'
data.sub re, ''
end
cmd :all do |cfg|
# sometimes br6910s inserts arbitra... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/enterasys.rb | lib/oxidized/model/enterasys.rb | class Enterasys < Oxidized::Model
using Refinements
# Enterasys B3/C3 models #
prompt /^.+\w\((su|rw)\)->\s?$/
comment '!'
# Handle paging
expect /^--More--.*$/ do |data, re|
send ' '
data.sub re, ''
end
cmd :all do |cfg|
cfg.each_line.to_a[2..-3].map { |line| line.delete("\r").rstrip }... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/tnsr.rb | lib/oxidized/model/tnsr.rb | class TNSR < Oxidized::Model
using Refinements
# Netgate TNSR #
# prompt examples
# https://docs.netgate.com/tnsr/en/latest/basics/working-cli.html#command-prompt
# "<hostname> tnsr<(mode)># " <-- with trailing whitespace
# tnsr-dev-25-02 tnsr#
# tnsr-dev-25-02 tnsr(config)# <-- after "configure ter... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/ciscosma.rb | lib/oxidized/model/ciscosma.rb | class CiscoSMA < Oxidized::Model
using Refinements
# SMA prompt "mail.example.com> "
prompt /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/
comment '! '
# Select passphrase display option
expect /using loadconfig command\. \[Y\]>/ do |data, re|
send "y\n"
data.sub re, ''
end
# handle paging
ex... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/voss.rb | lib/oxidized/model/voss.rb | class Voss < Oxidized::Model
using Refinements
# Extreme/Avaya VSP Operating System Software(VOSS)
# Created by danielcoxman@gmail.com
# March 16, 2019
# This was tested on vsp4k and vsp8k
comment '# '
prompt /^[^\s#>]+[#>]$/
# needed for proper formatting after post_login
cmd('') { |cfg| comment ... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/cumulus.rb | lib/oxidized/model/cumulus.rb | class Cumulus < Oxidized::Model
using Refinements
# Regular expression explanation:
# ^ : match begin of line, to have the most specific prompt
# [\w.-]+@[\w.-]+ : user@hostname
# (:mgmt)? : optional when logged in out of band
# :~[#$] $ : end of prompt, containing the l... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
ytti/oxidized | https://github.com/ytti/oxidized/blob/918108d44574eb39b56c1c1161619558adfe9c4c/lib/oxidized/model/arubainstant.rb | lib/oxidized/model/arubainstant.rb | class ArubaInstant < Oxidized::Model
using Refinements
# Aruba IAP, Instant Controller
comment '# '
prompt(/^ ?[\w:.@-]+[#>] $/)
cmd :all do |cfg|
# Remove command echo and prompt
cfg.cut_both
end
cmd :secret do |cfg|
cfg.gsub!(/ipsec (\S+)$/, 'ipsec <secret removed>')
cfg.gsub!(/commu... | ruby | Apache-2.0 | 918108d44574eb39b56c1c1161619558adfe9c4c | 2026-01-04T15:51:18.431860Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.