diff --git a/gestion/gen_confs/switchs.py b/gestion/gen_confs/switchs.py index e4f95773..3ef0407c 100755 --- a/gestion/gen_confs/switchs.py +++ b/gestion/gen_confs/switchs.py @@ -79,6 +79,11 @@ vlan 4 %(prises_hotspot)s no ip address exit +vlan 6 + name "Radin" + %(prises_radin) + no ip address + exit ;------------------------------------------------------- Accès d'administration no telnet-server no web-management @@ -278,7 +283,8 @@ exit vlans = { 'wifi_tagged' : [] , 'wifi_untagged' : [] , 'hotspot_tagged' : [], 'hotspot_untagged' : [], 'adm_tagged' : [] , 'adm_untagged' : [] , - 'default_tagged' : [] , 'default_untagged' : [] } + 'default_tagged' : [] , 'default_untagged' : [], + 'radin_tagged' : [], 'radin_untagged' : [] } # Génération de la conf de chaque prise for prise in range(1,nb_prises+1): @@ -297,6 +303,7 @@ exit vlans['adm_tagged'].append(prise) vlans['wifi_tagged'].append(prise) vlans['hotspot_tagged'].append(prise) + vlans['radin_tagged'].append(prise) params['INTERFACES_CONF'] += self.interface_template % prise_params continue @@ -341,11 +348,11 @@ exit vlans['adm_tagged'].append(prise) vlans['wifi_tagged'].append(prise) vlans['hotspot_tagged'].append(prise) + vlans['radin_tagged'].append(prise) params['INTERFACES_CONF'] += self.interface_template % prise_params continue - vlans['default_untagged'].append(prise) # A quelle chambre correspond la prise ? if prise_chbres.has_key(annu_prise) : chbres = prise_chbres[annu_prise] @@ -375,12 +382,21 @@ aaa port-access mac-based %(prise)s logoff-period 3600 # Besoin d'activer la prise ? prise_params['etat']='\n disable' for chbre in chbres : - res = self.db.search('chbre=%s%s&paiement=ok' % (bat.upper(), chbre) ) + res = self.db.search('chbre=%s%s' % (bat.upper(), chbre) ) + quelqu_un_a_paye = False for res in res['adherent'] + res['club'] : + if res.adherentPayant() : + quelqu_un_a_paye = True if 'bloq' not in res.blacklist_actif() : prise_params['etat']='' break - + if quelqu_un_a_paye : + # Si quelqu'un a payé on lui met le vlan default + vlans['default_untagged'].append(prise) + else : + # Sinon tout le monde reste sur le vlan radin + vlans['radin_untagged'].append(prise) + params['INTERFACES_CONF'] += self.interface_template % prise_params # Petite verif @@ -427,7 +443,7 @@ aaa port-access mac-based %(prise)s logoff-period 3600 vlans[key]=mk_list(prises) # Config des vlan - for v in ('default', 'adm', 'wifi', 'hotspot') : + for v in ('default', 'adm', 'wifi', 'hotspot', 'radin') : params['prises_%s' % v] = '' for t in ('tagged' , 'untagged') : if vlans['%s_%s' % (v,t)] :