This commit is contained in:
romain
2025-07-10 13:33:56 +02:00
parent 6010d0999e
commit ddfbdffa3d
7 changed files with 1033 additions and 14 deletions

10
main.py
View File

@@ -1,8 +1,9 @@
# main.py
import json
from pathlib import Path
from utils.texttools import split_display_sections
from models.hpe5130 import SwitchHPE5130
from output.export_json import export_switch_to_json
def read_file_with_fallback(path: Path) -> str:
@@ -14,7 +15,7 @@ def read_file_with_fallback(path: Path) -> str:
def main():
log_path = Path("data/example-a.log")
log_path = Path("data/example.log")
if not log_path.exists():
print(f"Fichier non trouvé : {log_path}")
return
@@ -27,10 +28,7 @@ def main():
switch.parse_block(section["section"], section["content"])
output_path = Path("data/switch_parsed.json")
with open(output_path, "w", encoding="utf-8") as f:
json.dump(switch.to_dict(), f, indent=2, ensure_ascii=False)
print(f"Switch exporté dans {output_path}")
export_switch_to_json(switch, output_path)
if __name__ == "__main__":