adapte la génération de la configuration des switchs pour les nouveaux switchs

Ignore-this: 80bb1dc084e7e53445fbba71dfcb45c7

darcs-hash:20101020162257-af139-f85e2b7f9803ac5c95d6f4dbbb52a6ec67a70c04.gz
This commit is contained in:
Jeremie Dimino 2010-10-20 18:22:57 +02:00
parent 98547f0590
commit 4b5fbee836

View file

@ -41,6 +41,7 @@ class switch(gen_config) :
config = """%(switch_config_header)s
hostname "%(switch)s"
%(module-type)s
;-------------------------------------------------------- Snmp
snmp-server contact "root@crans.org"
snmp-server location "Batiment %(bat)s"
@ -291,7 +292,7 @@ exit
old_config = NamedTemporaryFile()
res, msg = commands.getstatusoutput("scp bat%s-%i:cfg/startup-config %s" % (bat, sw_num, old_config.name))
if not res:
if res != 0:
raise RuntimeError(u"Erreur : impossible de récupérer l'ancienne configuration du switch")
params['switch_config_header'] = old_config.readline()
@ -301,6 +302,12 @@ exit
else:
params['switch_config_header']= '; J4899A Configuration Editor; Created on release #H.10.50'
model = params['switch_config_header'].split(' ', 2)[1]
if model == "J9145A":
params['module-type'] = 'module 1 type J9145A'
else:
params['module-type'] = ''
# IP
machine = self.db.search(switch)['machine'][0]
params['ip'] = str(machine.ip())