Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 3fd6236e authored by Baptiste Jonglez's avatar Baptiste Jonglez Committed by JONGLEZ Baptiste
Browse files

[gen] [wiki] [site_hardware] Refactor generation of network description

parent c7fc0504
No related branches found
No related tags found
1 merge request!269[wiki] Add SR-IOV information and improve network tables
...@@ -386,33 +386,33 @@ def get_hardware(sites) ...@@ -386,33 +386,33 @@ def get_hardware(sites)
} }
nic_c = 0 nic_c = 0
hard['network_description'] = network_description.map do |e| hard['network_description'] = network_description.map do |e|
s = e['count'] > 1 ? "\n* " : '' desc = []
s += e['unavailable_for_experiment'] ? '<span style="color:grey">' : ''
if e['name'].nil? or e['name'] == e['device'] if e['name'].nil? or e['name'] == e['device']
s += e['device'] desc.append(e['device'])
else else
s += e['device'] + "/" + e['name'] desc.append(e['device'] + "/" + e['name'])
end end
s += ', ' desc.append(e['interface'])
s += e['interface']
s += ', '
if !(e['unwired'] and e['unavailable_for_experiment']) if !(e['unwired'] and e['unavailable_for_experiment'])
s += 'configured rate: ' + (e['unwired'] ? 'n/c' : G5K.get_rate(e['rate'])) desc.append('configured rate: ' + (e['unwired'] ? 'n/c' : G5K.get_rate(e['rate'])))
s += ', '
end end
if !(e['model'] == 'N/A N/A' and e['unavailable_for_experiment']) # don't include interface model if not available if !(e['model'] == 'N/A N/A' and e['unavailable_for_experiment']) # don't include interface model if not available
e['model'] = 'N/A' if e['model'] == 'N/A N/A' e['model'] = 'N/A' if e['model'] == 'N/A N/A'
s += 'model: '+ e['model'] + ', ' desc.append('model: '+ e['model'])
end end
s += 'driver: ' + e['driver'] if e['driver'] desc.append('driver: ' + e['driver']) if e['driver']
if e['unavailable_for_experiment'] # Generate final string and then adjust
s += ' - unavailable for experiment' s = desc.join(', ')
if e['no_kavlan']
s += ' - no KaVLAN'
elsif e['unavailable_for_experiment']
s = '<span style="color:grey">' + s + ' - unavailable for experiment</span>'
elsif e['device'] =~ /eth/ elsif e['device'] =~ /eth/
s += ' [[Advanced_KaVLAN#A_simple_multi_NICs_example|(multi NICs example)]]' if !nic_c.zero? and not e.fetch('no_kavlan') s += ' [[Advanced_KaVLAN#A_simple_multi_NICs_example|(multi NICs example)]]' if !nic_c.zero?
nic_c += 1 nic_c += 1
end end
s += ' - no KaVLAN' if e['no_kavlan'] s = "\n* " + s
s += e['unavailable_for_experiment'] ? '</span>' : ''
s s
end.join('<br />') end.join('<br />')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment