Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 6980a5dc authored by POUILLOUX Laurent's avatar POUILLOUX Laurent
Browse files

[network] add shape and change color

parent 3253459f
Branches
No related tags found
No related merge requests found
Pipeline #939999 passed
......@@ -324,6 +324,25 @@ def generate_dot(netnodes, links, site)
nodeslinks.map! { |e| e[1] = sh("echo #{e[1].uniq.join(' ')}|nodeset -f"); e }
# define line thickness, node color and shape
thickness = {"1G" => 0.1,
"10G" => 0.4,
"2x10G" => 0.8,
"4x10G" => 1.5,
"25G" => 1,
"40G" => 1.5,
"2x40G" => 2.0,
"100G" => 2.5,
"2x100G" => 3}
colors = {"router" => "indianred",
"switch" => "gold",
"cluster" => "aquamarine1"}
shapes = {"router" => "hexagon",
"switch" => "box3d",
"cluster" => "oval"}
header = []
content = []
trailer = []
......@@ -337,23 +356,14 @@ def generate_dot(netnodes, links, site)
header << "splines=true;"
header << "ranksep=2.0;"
# output graph nodes, equipment first
mynetnodes.select { |n| n['kind'] == 'router' or n['kind'] == 'switch' }.map { |e| e['uid'] }.sort.each do |eq|
content << "\"#{eq}\" [shape=box color=\"gold\" style=\"filled\"];"
mynetnodes.select { |n| n['kind'] == 'router' or n['kind'] == 'switch' }.sort_by{|e| e['uid']}.each do |eq|
content << "\"#{eq['uid']}\" [shape=#{shapes[eq['kind']]} color=\"#{colors[eq['kind']]}\" style=\"filled\"];"
end
# then nodes groups
nodeslinks.each do |e|
content << "\"#{e[1]}\" [color=\"chartreuse2\" style=\"filled\"];"
content << "\"#{e[1]}\" [shape=#{shapes['cluster']} color=\"#{colors['cluster']}\" style=\"filled\"];"
end
# define line thickness
thickness = {"1G" => 0.1,
"10G" => 0.4,
"2x10G" => 0.8,
"25G" => 1,
"40G" => 1.5,
"2x40G" => 2.0,
"100G" => 2.5,
"2x100G" => 3}
# finally output links
# between network equipments
eqlinks.each do |l|
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment