-
Notifications
You must be signed in to change notification settings - Fork 918
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into opengear-config-2880
- Loading branch information
Showing
27 changed files
with
278 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.