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
ae97ad31
Commit
ae97ad31
authored
Sep 21, 2017
by
Lucas Nussbaum
Browse files
[dev] reorganize code to prepare work on new grouping
parent
c6ffec12
Changes
1
Hide whitespace changes
Inline
Side-by-side
generators/input-validators/check-network-description.rb
View file @
ae97ad31
...
...
@@ -220,6 +220,10 @@ def generate_dot(netnodes, links, site)
end
end
# remove duplicate reverse links between switches. We keep only the one where the target is the second node.
links
.
delete_if
{
|
l
|
[
'router'
,
'switch'
].
include?
(
l
[
'target_kind'
])
and
l
[
'target'
]
==
l
[
'nicknames'
].
first
}
# optimize links by grouping nodes to same switch
links
.
map
{
|
l
|
l
[
'switch'
]
}.
uniq
.
each
do
|
switch
|
# for each switch
puts
"optimizing
#{
switch
}
"
...
...
@@ -242,8 +246,6 @@ def generate_dot(netnodes, links, site)
end
end
# remove duplicate reverse links between switches. We keep only the one where the target is the second node.
links
.
delete_if
{
|
l
|
[
'router'
,
'switch'
].
include?
(
l
[
'target_kind'
])
and
l
[
'target'
]
==
l
[
'nicknames'
].
first
}
fd
=
File
::
new
(
"network_
#{
site
}
.dot"
,
'w'
)
fd
.
puts
"graph graphname {"
router
=
mynetnodes
.
select
{
|
n
|
n
[
'kind'
]
==
'router'
}.
first
[
'nickname'
]
...
...
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