Mise jour

darcs-hash:20050927222828-41617-e8dcdb7b0f8e346b890de8be29d9a9e3a638b335.gz
This commit is contained in:
pauget 2005-09-28 00:28:28 +02:00
parent 23fc01ac38
commit eb9965d6e9

View file

@ -29,7 +29,7 @@ from annuaires import bat_switchs
class switch(gen_config) : class switch(gen_config) :
# Répertoire ou écire les fichiers de conf # Répertoire ou écire les fichiers de conf
CONF_REP='/var/tftp_switchs/' # avec un / derrière CONF_REP='/tmp/' # avec un / derrière
config = """; %(modele)s Configuration Editor; Created on release #H.08.53 config = """; %(modele)s Configuration Editor; Created on release #H.08.53
@ -47,28 +47,28 @@ snmp-server community "public" Operator
;-------------------------------------------------------- Réglage heure/date ;-------------------------------------------------------- Réglage heure/date
time timezone 60 time timezone 60
time daylight-time-rule Western-Europe time daylight-time-rule Western-Europe
sntp server 138.231.136.6 sntp server 138.231.144.3
timesync sntp timesync sntp
sntp unicast sntp unicast
;-------------------------------------------------------- Misc ;-------------------------------------------------------- Misc
console inactivity-timer 30 console inactivity-timer 30
;-------------------------------------------------------- Logs ;-------------------------------------------------------- Logs
logging 138.231.136.7 logging 138.231.144.7
;-------------------------------------------------------- Logs ;-------------------------------------------------------- Logs
%(INTERFACES_CONF)s %(INTERFACES_CONF)s
;-------------------------------------------------------- IP du switch ;-------------------------------------------------------- IP du switch
ip default-gateway 138.231.136.4 ip default-gateway 138.231.144.4
vlan 1 vlan 1
name "DEFAULT_VLAN" name "DEFAULT_VLAN"
untagged 1-%(nb_prises)d untagged 1-%(nb_prises)d
ip address %(ip)s 255.255.248.0 no ip address
ip igmp ip igmp
no ip igmp querier no ip igmp querier
exit exit
vlan 2 vlan 2
name "Wifi" name "Serveurs"
tagged %(ports_wifi)s ip address %(ip)s 255.255.255.0
ip igmp blocked %(ports_wifi)s tagged %(uplinks)s
exit exit
;-------------------------------------------------------- Accès d'adminsitration ;-------------------------------------------------------- Accès d'adminsitration
no telnet-server no telnet-server
@ -77,9 +77,8 @@ aaa authentication ssh login public-key
aaa authentication ssh enable public-key aaa authentication ssh enable public-key
ip ssh ip ssh
ip ssh version 2 ip ssh version 2
ip authorized-managers 138.231.136.0 255.255.255.0 ip authorized-managers 138.231.144.0 255.255.255.0
ip authorized-managers 138.231.137.216 ip ssh filetransfer
ip authorized-managers 138.231.137.215
;-------------------------------------------------------- Spanning-tree ;-------------------------------------------------------- Spanning-tree
spanning-tree spanning-tree
; Config des uplinks ; Config des uplinks
@ -93,8 +92,8 @@ radius-server key %(radius_key)s
%(radius-serveurs)s %(radius-serveurs)s
;-------------------------------------------------------- Filtrage mac ;-------------------------------------------------------- Filtrage mac
aaa port-access mac-based %(non_uplinks)s aaa port-access mac-based %(non_uplinks)s
aaa port-access mac-based %(non_uplinks)s addr-limit 32 aaa port-access mac-based %(non_uplinks)s addr-limit 3
aaa port-access mac-based %(non_uplinks)s logoff-period 9999999 aaa port-access mac-based %(non_uplinks)s logoff-period 3600
aaa port-access mac-based addr-format multi-colon aaa port-access mac-based addr-format multi-colon
;-------------------------------------------------------- Bricoles ;-------------------------------------------------------- Bricoles
no cdp run no cdp run
@ -108,7 +107,7 @@ no stack
exit exit
""" """
# Serveurs radius # Serveurs radius
rad_servs = [ '138.231.136.10' , '138.231.136.18', '138.231.136.6' ] rad_servs = [ '138.231.144.10' , '138.231.144.18' ]
rad_template = "radius-server host %s\n" rad_template = "radius-server host %s\n"
def __init__(self,truc): def __init__(self,truc):
@ -236,10 +235,7 @@ exit
'radius-serveurs' : rad[:-1] % tuple(self.rad_servs)} 'radius-serveurs' : rad[:-1] % tuple(self.rad_servs)}
# Numéro du switch # Numéro du switch
try :
sw_num = int(switch[5]) sw_num = int(switch[5])
except :
sw_num = 0
# Nombre de prises et modèle # Nombre de prises et modèle
nb_prises = conn.nb_prises() nb_prises = conn.nb_prises()
@ -293,7 +289,7 @@ exit
prise_params['nom'] = 'Chambre' prise_params['nom'] = 'Chambre'
if len(chbres) > 1 : prise_params['nom'] += 's' if len(chbres) > 1 : prise_params['nom'] += 's'
for chbre in chbres : for chbre in chbres :
prise_params['nom'] += '_' + chbre prise_params['nom'] += '_%s%s' % (bat.upper(), chbre)
# Besoin d'activer la prise ? # Besoin d'activer la prise ?
act = 0 act = 0