8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 23:43:47 +00:00

Ajout des bornes wifi

This commit is contained in:
grisel-davy 2018-04-18 18:38:59 +02:00
parent 30140de2ae
commit 22d49864a7
2 changed files with 22 additions and 4 deletions

View file

@ -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=<

View file

@ -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':[]})
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)