Fonction aiguillage suivant constructeur

master
chirac 6 years ago
parent a4922017e8
commit b1319bfcc2

@ -85,7 +85,17 @@ class Switch:
self.preprocess_hp()
self.conf = self.hp_tpl.render(switch=self.switch, additionals=self.additionals)
def gen_conf_and_write(self):
"""Génère la conf suivant le bon constructeur et l'écrit"""
if self.switch["model"]:
constructor = self.switch["model"]["constructor"].lower()
if "hp" in constructor or "aruba" in constructor:
self.gen_conf_hp()
self.write_conf()
def write_conf(self):
"""Ecriture de la conf du switch dans le fichier qui va bien"""
with open("generated/" + self.get_conf_file_name(), 'w+') as f:
f.write(self.conf)
@ -95,6 +105,7 @@ print("gen tpl")
sw = Switch()
for switch in all_switchs:
sw.switch = switch
# sw.gen_conf_and_write()
sw.gen_conf_hp()
sw.write_conf()

Loading…
Cancel
Save