Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/train/platforms/detect/helpers/os_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def brocade_version
def cisco_show_version
return @cache[:cisco] if @cache.key?(:cisco)

res = command_output("show version")
# Limit result size using output modifier (since IOS 12.0), if supported
res = command_output("show version | grep [Vv]ersion|Hardware")
res = command_output("show version") unless res.include? 'Cisco'

m = res.match(/Cisco IOS Software, [^,]+? \(([^,]+?)\), Version (\d+\.\d+)/)
unless m.nil?
Expand All @@ -98,6 +100,12 @@ def cisco_show_version
return @cache[:cisco] = { version: v, type: "nexus" }
end

m = res.match(/Cisco Adaptive Security Appliance Software Version (\d+\.\d+)/)
unless m.nil?
model = res.match(/Hardware:\s+(ASA\d+)/)
return @cache[:cisco] = { version: m[1], model: model[1], type: "asa" }
end

@cache[:cisco] = nil
end

Expand Down
9 changes: 9 additions & 0 deletions lib/train/platforms/detect/specifications/os.rb
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,15 @@ def self.load
@platform[:uuid_command] = "show version | include Processor"
true
end
plat.name("cisco_asa").title("Cisco ASA OS").in_family("cisco")
.detect do
v = cisco_show_version
next unless v[:type] == "asa"

@platform[:release] = v[:version]
@platform[:arch] = nil
true
end

# brocade family
plat.family("brocade").title("Brocade Family").in_family("os")
Expand Down