File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 13
13
require 'train/extras/os_detect_unix'
14
14
require 'train/extras/os_detect_windows'
15
15
require 'train/extras/os_detect_esx'
16
+ require 'train/extras/os_detect_arista_eos'
16
17
17
18
module Train ::Extras
18
19
class OSCommon
@@ -21,6 +22,7 @@ class OSCommon
21
22
include Train ::Extras ::DetectUnix
22
23
include Train ::Extras ::DetectWindows
23
24
include Train ::Extras ::DetectEsx
25
+ include Train ::Extras ::DetectAristaEos
24
26
25
27
attr_accessor :backend
26
28
def initialize ( backend , platform = nil )
@@ -122,6 +124,7 @@ def detect_family_type # rubocop:disable Metrics/CyclomaticComplexity, Metrics/P
122
124
# unix based systems combine the above
123
125
return true if pf == 'unix' and detect_darwin
124
126
return true if pf == 'unix' and detect_esx
127
+ return true if pf == 'unix' and detect_arista_eos
125
128
return true if pf == 'unix' and detect_via_uname
126
129
127
130
# if we arrive here, we most likey have a regular linux
Original file line number Diff line number Diff line change
1
+ # encoding: utf-8
2
+ # author: Jere Julian
3
+ #
4
+ # Arista EOS has 2 modes. Most compliance tests will use the network CLI
5
+ # but when working with vagrant, its common to encounter the raw bash shell.
6
+ require 'json'
7
+
8
+ module Train ::Extras
9
+ module DetectAristaEos
10
+ def detect_arista_eos
11
+ if unix_file? ( '/usr/bin/FastCli' )
12
+ output = @backend . run_command ( 'FastCli -p 15 -c "show version | json"' ) . stdout
13
+ @platform [ :name ] = 'arista_eos_bash'
14
+ family = 'fedora'
15
+ else
16
+ output = @backend . run_command ( 'show version | json' ) . stdout
17
+ end
18
+
19
+ unless output . empty?
20
+ eos_ver = JSON . parse ( output )
21
+ @platform [ :name ] = @platform [ :name ] || 'arista_eos'
22
+ family ||= 'arista_eos'
23
+ @platform [ :family ] = family
24
+ @platform [ :release ] = eos_ver [ 'version' ]
25
+ @platform [ :arch ] = eos_ver [ 'architecture' ]
26
+ true
27
+ end
28
+ end
29
+ end
30
+ end
You can’t perform that action at this time.
0 commit comments