-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from jerearista/Arista_EOS
Add detection for Arista EOS
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# encoding: utf-8 | ||
# author: Jere Julian | ||
# | ||
# Arista EOS has 2 modes. Most compliance tests will use the network CLI | ||
# but when working with vagrant, its common to encounter the raw bash shell. | ||
require 'json' | ||
|
||
module Train::Extras | ||
module DetectAristaEos | ||
def detect_arista_eos | ||
if unix_file?('/usr/bin/FastCli') | ||
output = @backend.run_command('FastCli -p 15 -c "show version | json"').stdout | ||
@platform[:name] = 'arista_eos_bash' | ||
family = 'fedora' | ||
else | ||
output = @backend.run_command('show version | json').stdout | ||
end | ||
|
||
unless output.empty? | ||
eos_ver = JSON.parse(output) | ||
@platform[:name] = @platform[:name] || 'arista_eos' | ||
family ||= 'arista_eos' | ||
@platform[:family] = family | ||
@platform[:release] = eos_ver['version'] | ||
@platform[:arch] = eos_ver['architecture'] | ||
true | ||
end | ||
end | ||
end | ||
end |