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
22d49864
Commit
22d49864
authored
Apr 18, 2018
by
grisel-davy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout des bornes wifi
parent
30140de2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
+22
-4
topologie/templates/topologie/graph_switch.dot
topologie/templates/topologie/graph_switch.dot
+7
-0
topologie/views.py
topologie/views.py
+15
-4
No files found.
topologie/templates/topologie/graph_switch.dot
View file @
22d49864
...
...
@@ -11,6 +11,13 @@ edge[arrowhead=odot,arrowtail=dot]
{
%
for
sub
in
subs
%
}
subgraph
cluster_
{{
sub
.
bat_id
}}
{
label
=
"Batiment {{ sub.bat_name }}"
;
{
%
block
bornes
%
}
{
%
for
borne
in
sub
.
bornes
%
}
node
[
label
=
"{{borne.name}}"
]
{{
borne
.
id
}};
{
%
endfor
%
}
{
%
endblock
%
}
{
%
block
switchs
%
}
{
%
for
switch
in
sub
.
switchs
%
}
node
[
label
=<
...
...
topologie/views.py
View file @
22d49864
...
...
@@ -944,21 +944,31 @@ def make_machine_graph():
"""
Crée le fichier dot et l'image du graph des Switchs
"""
dico
=
{
'subs'
:[],
'links'
:[],
'alone'
:[]}
dico
=
{
'subs'
:[],
'links'
:[],
'alone'
:[]
,
'bornes'
:[]
}
missing
=
[]
detected
=
[]
for
sw
in
Switch
.
objects
.
all
():
if
(
sw
not
in
detected
):
missing
.
append
(
sw
)
for
building
in
Building
.
objects
.
all
():
#Parcour tous les batiments
dico
[
'subs'
].
append
({
'bat_id'
:
building
.
id
,
'bat_name'
:
building
,
'switchs'
:[]})
for
switch
in
Switch
.
objects
.
filter
(
switchbay__building
=
building
):
#Parcour tous les switchs de ce batiment
dico
[
'subs'
][
-
1
][
'switchs'
].
append
({
'name'
:
switch
.
main_interface
().
domain
.
name
,
'nombre'
:
switch
.
number
,
'model'
:
switch
.
model
,
'id'
:
switch
.
id
,
'batiment'
:
building
,
'ports'
:[]})
dico
[
'subs'
].
append
({
'bat_id'
:
building
.
id
,
'bat_name'
:
building
,
'switchs'
:[],
'bornes'
:[]})
for
switch
in
Switch
.
objects
.
filter
(
switchbay__building
=
building
):
#Parcour tous les switchs de ce batiment
dico
[
'subs'
][
-
1
][
'switchs'
].
append
({
'name'
:
switch
.
main_interface
().
domain
.
name
,
'nombre'
:
switch
.
number
,
'model'
:
switch
.
model
,
'id'
:
switch
.
id
,
'batiment'
:
building
,
'ports'
:[]})
for
p
in
switch
.
ports
.
all
().
filter
(
related__isnull
=
False
):
#Parcour tout les ports liés de ce switch
dico
[
'subs'
][
-
1
][
'switchs'
][
-
1
][
'ports'
].
append
({
'numero'
:
p
.
port
,
'related'
:
p
.
related
.
switch
.
main_interface
().
domain
.
name
})
for
ap
in
AccessPoint
.
all_ap_in
(
building
):
dico
[
'subs'
][
-
1
][
'bornes'
].
append
({
'name'
:
ap
.
short_name
,
'id'
:
ap
.
id
})
dico
[
'links'
].
append
({
'depart'
:
ap
.
switch
()[
0
].
id
,
'arrive'
:
ap
.
id
})
for
ap
in
AccessPoint
.
objects
.
all
():
dico
[
'bornes'
].
append
({
'name'
:
str
(
ap
)})
while
(
missing
!=
[]):
#Tant que la liste des oubliés n'est pas vide i.e on les a pas tous passer
links
,
new_detected
=
recursive_switchs
(
missing
[
0
].
ports
.
all
().
filter
(
related
=
None
).
first
(),
None
,[
missing
[
0
]])
for
link
in
links
:
...
...
@@ -1017,5 +1027,6 @@ def recursive_switchs(port_start, switch_before, detected):
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