configuration des switchs pour le vlan radin

darcs-hash:20080903214336-af139-6bf2dd68929226d335f0ba1edeceb92d0bc7ce60.gz
This commit is contained in:
Jeremie Dimino 2008-09-03 23:43:36 +02:00
parent 1d302635e1
commit bfc806f945

View file

@ -79,6 +79,11 @@ vlan 4
%(prises_hotspot)s %(prises_hotspot)s
no ip address no ip address
exit exit
vlan 6
name "Radin"
%(prises_radin)
no ip address
exit
;------------------------------------------------------- Accès d'administration ;------------------------------------------------------- Accès d'administration
no telnet-server no telnet-server
no web-management no web-management
@ -278,7 +283,8 @@ exit
vlans = { 'wifi_tagged' : [] , 'wifi_untagged' : [] , vlans = { 'wifi_tagged' : [] , 'wifi_untagged' : [] ,
'hotspot_tagged' : [], 'hotspot_untagged' : [], 'hotspot_tagged' : [], 'hotspot_untagged' : [],
'adm_tagged' : [] , 'adm_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 # Génération de la conf de chaque prise
for prise in range(1,nb_prises+1): for prise in range(1,nb_prises+1):
@ -297,6 +303,7 @@ exit
vlans['adm_tagged'].append(prise) vlans['adm_tagged'].append(prise)
vlans['wifi_tagged'].append(prise) vlans['wifi_tagged'].append(prise)
vlans['hotspot_tagged'].append(prise) vlans['hotspot_tagged'].append(prise)
vlans['radin_tagged'].append(prise)
params['INTERFACES_CONF'] += self.interface_template % prise_params params['INTERFACES_CONF'] += self.interface_template % prise_params
continue continue
@ -341,11 +348,11 @@ exit
vlans['adm_tagged'].append(prise) vlans['adm_tagged'].append(prise)
vlans['wifi_tagged'].append(prise) vlans['wifi_tagged'].append(prise)
vlans['hotspot_tagged'].append(prise) vlans['hotspot_tagged'].append(prise)
vlans['radin_tagged'].append(prise)
params['INTERFACES_CONF'] += self.interface_template % prise_params params['INTERFACES_CONF'] += self.interface_template % prise_params
continue continue
vlans['default_untagged'].append(prise)
# A quelle chambre correspond la prise ? # A quelle chambre correspond la prise ?
if prise_chbres.has_key(annu_prise) : if prise_chbres.has_key(annu_prise) :
chbres = prise_chbres[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 ? # Besoin d'activer la prise ?
prise_params['etat']='\n disable' prise_params['etat']='\n disable'
for chbre in chbres : 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'] : for res in res['adherent'] + res['club'] :
if res.adherentPayant() :
quelqu_un_a_paye = True
if 'bloq' not in res.blacklist_actif() : if 'bloq' not in res.blacklist_actif() :
prise_params['etat']='' prise_params['etat']=''
break 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 params['INTERFACES_CONF'] += self.interface_template % prise_params
# Petite verif # Petite verif
@ -427,7 +443,7 @@ aaa port-access mac-based %(prise)s logoff-period 3600
vlans[key]=mk_list(prises) vlans[key]=mk_list(prises)
# Config des vlan # Config des vlan
for v in ('default', 'adm', 'wifi', 'hotspot') : for v in ('default', 'adm', 'wifi', 'hotspot', 'radin') :
params['prises_%s' % v] = '' params['prises_%s' % v] = ''
for t in ('tagged' , 'untagged') : for t in ('tagged' , 'untagged') :
if vlans['%s_%s' % (v,t)] : if vlans['%s_%s' % (v,t)] :