Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
47d4cee5
Commit
47d4cee5
authored
May 14, 2018
by
grisel-davy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gestion des boucles dans le graph et des doublons dans les liens
parent
b2d57ec8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
topologie/templates/topologie/graph_switch.dot
topologie/templates/topologie/graph_switch.dot
+2
-2
topologie/views.py
topologie/views.py
+14
-11
No files found.
topologie/templates/topologie/graph_switch.dot
View file @
47d4cee5
{
%
block
graph_dot
%
}
digraph
{
strict
digraph
{
graph
[
label
=
"TOPOLOGIE DU RÉSEAU"
,
labelloc
=
t
,
fontsize
=
40
]
;
node
[
fontname
=
Helvetica
fontsize
=
8
shape
=
plaintext
]
;
edge
[
arrowhead
=
odot
,
arrowtail
=
dot
]
;
edge
[
arrowhead
=
none
]
;
{
%
block
subgraphs
%
}
...
...
topologie/views.py
View file @
47d4cee5
...
...
@@ -1010,6 +1010,7 @@ def make_machine_graph():
#Tant que la liste des oubliés n'est pas vide i.e on les a pas tous passer
while
missing
:
links
,
new_detected
=
recursive_switchs
(
missing
[
0
].
ports
.
filter
(
related
=
None
).
first
(),
None
,
[
missing
[
0
]])
for
link
in
links
:
dico
[
'links'
].
append
(
link
)
...
...
@@ -1053,21 +1054,23 @@ def recursive_switchs(port_start, switch_before, detected):
"""
Parcour récursivement le switchs auquel appartient port_start pour trouver les ports suivants liés
"""
links_return
=
[]
#Liste de dictionaires qui stockes les nouveaux liens détéctés
l_ports
=
port_start
.
switch
.
ports
.
filter
(
related__isnull
=
False
)
#Liste des ports dont le related est non null
for
port
in
l_ports
:
#Pas le switch dont on vient, pas le switch actuel
if
port
.
related
.
switch
!=
switch_before
and
port
.
related
.
switch
!=
port
.
switch
:
detected
.
append
(
port_start
.
switch
)
detected
.
append
(
port
.
related
.
switch
)
detected
.
append
(
port_start
.
switch
)
links_return
=
[]
#Liste de dictionaires qui stockes les nouveaux liens trouvés
for
port
in
port_start
.
switch
.
ports
.
filter
(
related__isnull
=
False
):
#Liste des ports dont le related est non null
if
port
.
related
.
switch
!=
switch_before
and
port
.
related
.
switch
!=
port
.
switch
:
#Pas le switch dont on descend, pas le switch actuel
links
=
{
'depart'
:
port_start
.
switch
.
id
,
'arrive'
:
port
.
related
.
switch
.
id
}
links_down
,
detected
=
recursive_switchs
(
port
.
related
,
port_start
.
switch
,
detected
)
if
(
port
.
related
.
switch
not
in
detected
):
links_down
,
detected
=
recursive_switchs
(
port
.
related
,
port_start
.
switch
,
detected
)
for
link
in
links_down
:
if
link
:
links_return
.
append
(
link
)
detected
.
append
(
port
.
related
.
switch
)
links_return
.
append
(
links
)
for
link
in
links_down
:
if
link
:
links_return
.
append
(
link
)
return
(
links_return
,
detected
)
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