diff --git a/scripts/devis_reseau.py b/scripts/devis_reseau.py index 079ece2..ff8476a 100644 --- a/scripts/devis_reseau.py +++ b/scripts/devis_reseau.py @@ -45,7 +45,9 @@ def decouvrir() -> list[tuple[str, str, dict]]: for chemin in sorted(DOSSIER_INSTANCES.glob("*/plan/nomenclature.yml")): n = yaml.safe_load(chemin.read_text(encoding="utf-8")) or {} # Un tenant federe = une nomenclature avec un index (l'adressage en decoule). - if n.get("index") is not None and n.get("categories"): + # `federe: false` exclut un bac a sable local (labo) du reseau converge : + # il ne partage pas la fabric de production, on ne provisionne pas ses VLAN. + if n.get("index") is not None and n.get("categories") and n.get("federe", True): nom = chemin.parent.parent.name tenants.append((nom, prefixe(nom), n)) tenants.sort(key=lambda t: t[2]["index"]) @@ -68,7 +70,7 @@ def generer(tenants: list[tuple[str, str, dict]]) -> str: for zone in sorted(n["categories"]): c = n["categories"][zone] out.append(f"vlan {vlan_de(n['index'], zone)}") - out.append(f" name {pfx}-{c['libelle']}") + out.append(f" name {pfx}{n['index']}-{c['libelle']}") out += ["!", "! ----- 2. Interfaces de routage (SVI = passerelle des hotes) -----"] for nom, pfx, n in tenants: m = masque(int(n.get("cidr_hote", 24))) @@ -77,12 +79,12 @@ def generer(tenants: list[tuple[str, str, dict]]) -> str: out.append(f"interface Vlan{vlan_de(n['index'], zone)}") out.append(f" description {nom}-{c['libelle']}") out.append(f" ip address {passerelle_de(n['index'], zone)} {m}") - out.append(f" ip access-group {pfx}-ISOLATION in") + out.append(f" ip access-group {pfx}{n['index']}-ISOLATION in") out.append(" no shutdown") out += ["!", "! ----- 3. ACL d'isolation tenant (default-deny inter-tenant) -----"] for nom, pfx, n in tenants: reseau, wild = reseau_wildcard(supernet_de(n["index"])) - out.append(f"ip access-list extended {pfx}-ISOLATION") + out.append(f"ip access-list extended {pfx}{n['index']}-ISOLATION") out.append(f" remark Intra-tenant {nom} : routage local autorise") out.append(f" permit ip {reseau} {wild} {reseau} {wild}") for autre_nom, _, autre in tenants: