Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reference-repository
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
grid5000
reference-repository
Commits
6980a5dc
Commit
6980a5dc
authored
1 year ago
by
POUILLOUX Laurent
Browse files
Options
Downloads
Patches
Plain Diff
[network] add shape and change color
parent
3253459f
No related branches found
No related tags found
No related merge requests found
Pipeline
#939999
passed
1 year ago
Stage: lint
Stage: validate
Stage: generate
Stage: deploy
Stage: checks
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/refrepo/valid/network.rb
+22
-12
22 additions, 12 deletions
lib/refrepo/valid/network.rb
with
22 additions
and
12 deletions
lib/refrepo/valid/network.rb
+
22
−
12
View file @
6980a5dc
...
...
@@ -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
|
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment