Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
grid5000
reference-repository
Commits
9e597963
Commit
9e597963
authored
May 20, 2018
by
Lucas Nussbaum
Browse files
[dev/network-description] Group links between switches as "2x10G"
parent
d6d912ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
generators/input-validators/check-network-description.rb
View file @
9e597963
...
...
@@ -254,6 +254,8 @@ def generate_dot(netnodes, links, site)
# separate links to equipments
eqlinks
=
links
.
select
{
|
l
|
[
'router'
,
'switch'
].
include?
(
l
[
'target_kind'
])
}
# group links between same pairs of switches
eqlinks
=
eqlinks
.
group_by
{
|
e
|
e
}.
to_a
.
map
{
|
e
|
e
[
0
][
'count'
]
=
e
[
1
].
length
;
e
[
0
]
}
# for links to nodes, re-process the links to facilitate grouping
nodeslinks
=
[]
links
.
select
{
|
l
|
[
'node'
].
include?
(
l
[
'target_kind'
])
}.
each
do
|
l
|
...
...
@@ -292,7 +294,11 @@ def generate_dot(netnodes, links, site)
# finally output links
# between network equipments
eqlinks
.
each
do
|
l
|
r
=
"
#{
l
[
'rate'
]
/
10
**
9
}
G"
if
l
[
'count'
]
==
1
r
=
"
#{
l
[
'rate'
]
/
10
**
9
}
G"
else
r
=
"
#{
l
[
'count'
]
}
x
#{
l
[
'rate'
]
/
10
**
9
}
G"
end
content
<<
"
\"
#{
l
[
'switch'
]
}
\"
--
\"
#{
l
[
'target'
]
}
\"
[label=
\"
#{
r
}
\"
];"
end
# between network equipments and nodes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment