24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/puppet/parser/functions/platform_get.rb', line 24
newfunction(:platform_get, type: :rvalue) do |_args|
data = lookupvar('cisco')
return '' if data.nil?
pi = data['hardware']['type']
case pi
when /Nexus\s?3\d\d\d/
if function_platform_fretta([])
cisco_hardware = 'n3k-f'
else
cisco_hardware = 'n3k'
end
when /Nexus\s?5\d\d\d/
cisco_hardware = 'n5k'
when /Nexus\s?6\d\d\d/
cisco_hardware = 'n6k'
when /Nexus\s?7\d\d\d/
cisco_hardware = 'n7k'
when /Nexus\s?9\d+\s\S+-EX/
cisco_hardware = 'n9k-ex'
when /(Nexus\s?9\d\d\d|NX-OSv Chassis)/
if function_platform_fretta([])
cisco_hardware = 'n9k-f'
else
cisco_hardware = 'n9k'
end
else
fail Puppet::ParseError, "Unrecognized platform type: #{pi}\n#{__FILE__}"
end
cisco_hardware
end
|