From 3c4744eefdee2c4c334384ce18a80381a2bb59ff Mon Sep 17 00:00:00 2001 From: Daniel Allaire Date: Fri, 6 Mar 2026 14:50:02 -0500 Subject: [PATCH] Setup json du BPM --- bpm/life-noc.json | 1151 +++++++++++++++++++++++++++++++++++++++ scripts/generate_bpm.py | 136 +++++ 2 files changed, 1287 insertions(+) create mode 100644 bpm/life-noc.json create mode 100755 scripts/generate_bpm.py diff --git a/bpm/life-noc.json b/bpm/life-noc.json new file mode 100644 index 0000000..028e221 --- /dev/null +++ b/bpm/life-noc.json @@ -0,0 +1,1151 @@ +{ + "version": 1, + "processes": [ + { + "name": "LIFE-NOC", + "operator": "worst", + "nodes": [ + { + "type": "process", + "name": "REVUE" + }, + { + "type": "process", + "name": "FOCUS" + }, + { + "type": "process", + "name": "FINANCES-PERSONNELLES" + }, + { + "type": "process", + "name": "FISCALITE-PERSONNELLE" + }, + { + "type": "process", + "name": "OBLIGATIONS-LEGALES-PERSONNELLES" + }, + { + "type": "process", + "name": "MAISON" + }, + { + "type": "process", + "name": "GARAGE-ET-RANGEMENT" + }, + { + "type": "process", + "name": "ENERGIE" + }, + { + "type": "process", + "name": "RESILIENCE" + }, + { + "type": "process", + "name": "STOCK-ALIMENTAIRE" + }, + { + "type": "process", + "name": "SANTE" + }, + { + "type": "process", + "name": "VOITURE" + }, + { + "type": "process", + "name": "JARDIN" + }, + { + "type": "process", + "name": "OUTILS-ET-EQUIPEMENTS" + }, + { + "type": "process", + "name": "INFORMATIQUE-PERSONNELLE" + }, + { + "type": "process", + "name": "INFRASTRUCTURE-CHEZLEPRO" + }, + { + "type": "process", + "name": "RESEAU-CHEZLEPRO" + }, + { + "type": "process", + "name": "SECURITE-CHEZLEPRO" + }, + { + "type": "process", + "name": "EXPLOITATION-CHEZLEPRO" + }, + { + "type": "process", + "name": "OBLIGATIONS-CHEZLEPRO" + }, + { + "type": "process", + "name": "ACTIFS-CHEZLEPRO" + }, + { + "type": "process", + "name": "PROJETS" + }, + { + "type": "process", + "name": "COMMUNAUTE" + }, + { + "type": "process", + "name": "DOCUMENTATION" + }, + { + "type": "process", + "name": "ANIMAUX" + } + ] + }, + { + "name": "REVUE", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "revue-revue-quotidienne-life-noc" + }, + { + "type": "service", + "host": "life-noc", + "service": "revue-revue-hebdomadaire-priorites" + }, + { + "type": "service", + "host": "life-noc", + "service": "revue-revue-mensuelle-systeme-vie" + }, + { + "type": "service", + "host": "life-noc", + "service": "revue-revue-trimestrielle-orientation" + } + ] + }, + { + "name": "FOCUS", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "focus-entretien-processus-focus" + }, + { + "type": "service", + "host": "life-noc", + "service": "focus-nettoyage-inbox-mentale" + }, + { + "type": "service", + "host": "life-noc", + "service": "focus-revue-limitation-engagements" + } + ] + }, + { + "name": "FINANCES-PERSONNELLES", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "finances-personnelles-revision-comptes-bancaires" + }, + { + "type": "service", + "host": "life-noc", + "service": "finances-personnelles-verification-cartes-credit" + }, + { + "type": "service", + "host": "life-noc", + "service": "finances-personnelles-paiement-cartes-credit" + }, + { + "type": "service", + "host": "life-noc", + "service": "finances-personnelles-revision-budget-personnel" + }, + { + "type": "service", + "host": "life-noc", + "service": "finances-personnelles-verification-prelevements-automatiques" + }, + { + "type": "service", + "host": "life-noc", + "service": "finances-personnelles-verification-placements" + }, + { + "type": "service", + "host": "life-noc", + "service": "finances-personnelles-verification-cotisations-reer" + }, + { + "type": "service", + "host": "life-noc", + "service": "finances-personnelles-verification-celi" + }, + { + "type": "service", + "host": "life-noc", + "service": "finances-personnelles-preparation-dossier-financier-annuel" + } + ] + }, + { + "name": "FISCALITE-PERSONNELLE", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "fiscalite-personnelle-preparation-documents-impots" + }, + { + "type": "service", + "host": "life-noc", + "service": "fiscalite-personnelle-production-impots-federal" + }, + { + "type": "service", + "host": "life-noc", + "service": "fiscalite-personnelle-production-impots-quebec" + }, + { + "type": "service", + "host": "life-noc", + "service": "fiscalite-personnelle-paiement-solde-impots" + }, + { + "type": "service", + "host": "life-noc", + "service": "fiscalite-personnelle-verification-avis-cotisation" + }, + { + "type": "service", + "host": "life-noc", + "service": "fiscalite-personnelle-archivage-documents-fiscaux" + }, + { + "type": "service", + "host": "life-noc", + "service": "fiscalite-personnelle-verification-acomptes-provisionnels" + } + ] + }, + { + "name": "OBLIGATIONS-LEGALES-PERSONNELLES", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "obligations-legales-personnelles-verification-testament" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-legales-personnelles-verification-mandat-inaptitude" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-legales-personnelles-verification-directives-medicales" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-legales-personnelles-verification-papiers-identite" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-legales-personnelles-renouvellement-permis-conduire" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-legales-personnelles-verification-carte-assurance-maladie" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-legales-personnelles-verification-passeport" + } + ] + }, + { + "name": "MAISON", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "maison-remplacement-filtre-fournaise" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-inspection-fournaise" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-inspection-thermopompe" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-nettoyage-unites-exterieures" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-inspection-toiture" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-inspection-gouttieres" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-inspection-fondation" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-verification-drainage-terrain" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-test-detecteurs-fumee" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-test-detecteurs-co" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-remplacement-piles-detecteurs" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-verification-plomberie-visible" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-inspection-sump-pump" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-verification-calfetrage" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-inspection-portes-garage" + }, + { + "type": "service", + "host": "life-noc", + "service": "maison-verification-extincteurs" + } + ] + }, + { + "name": "GARAGE-ET-RANGEMENT", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "garage-et-rangement-inspection-rangement-plafond" + }, + { + "type": "service", + "host": "life-noc", + "service": "garage-et-rangement-revue-inventaire-garage" + }, + { + "type": "service", + "host": "life-noc", + "service": "garage-et-rangement-verification-rouille-outillage" + }, + { + "type": "service", + "host": "life-noc", + "service": "garage-et-rangement-inspection-securite-garage" + }, + { + "type": "service", + "host": "life-noc", + "service": "garage-et-rangement-rotation-stockage-bacs" + } + ] + }, + { + "name": "ENERGIE", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "energie-inspection-batteries-lifepo4" + }, + { + "type": "service", + "host": "life-noc", + "service": "energie-verification-tension-batteries" + }, + { + "type": "service", + "host": "life-noc", + "service": "energie-verification-smartshunt" + }, + { + "type": "service", + "host": "life-noc", + "service": "energie-verification-cerbo-gx" + }, + { + "type": "service", + "host": "life-noc", + "service": "energie-verification-can-rs485" + }, + { + "type": "service", + "host": "life-noc", + "service": "energie-inspection-cablage-energie" + }, + { + "type": "service", + "host": "life-noc", + "service": "energie-verification-busbars" + }, + { + "type": "service", + "host": "life-noc", + "service": "energie-verification-parametres-charge" + }, + { + "type": "service", + "host": "life-noc", + "service": "energie-test-charge-batteries" + }, + { + "type": "service", + "host": "life-noc", + "service": "energie-test-comportement-onduleur" + }, + { + "type": "service", + "host": "life-noc", + "service": "energie-verification-journal-evenements-victron" + } + ] + }, + { + "name": "RESILIENCE", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "resilience-test-generatrice-propane" + }, + { + "type": "service", + "host": "life-noc", + "service": "resilience-verification-carburant-generatrice" + }, + { + "type": "service", + "host": "life-noc", + "service": "resilience-verification-procedure-bascule" + }, + { + "type": "service", + "host": "life-noc", + "service": "resilience-verification-stock-lampes-piles" + }, + { + "type": "service", + "host": "life-noc", + "service": "resilience-verification-trousses-urgence" + }, + { + "type": "service", + "host": "life-noc", + "service": "resilience-revision-plan-urgence" + }, + { + "type": "service", + "host": "life-noc", + "service": "resilience-test-autonomie-base" + }, + { + "type": "service", + "host": "life-noc", + "service": "resilience-verification-moyens-cuisson-secours" + } + ] + }, + { + "name": "STOCK-ALIMENTAIRE", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "stock-alimentaire-rotation-nourriture-seche" + }, + { + "type": "service", + "host": "life-noc", + "service": "stock-alimentaire-verification-reserve-eau" + }, + { + "type": "service", + "host": "life-noc", + "service": "stock-alimentaire-verification-mylar-absorbeurs" + }, + { + "type": "service", + "host": "life-noc", + "service": "stock-alimentaire-revue-inventaire-conserves" + }, + { + "type": "service", + "host": "life-noc", + "service": "stock-alimentaire-revue-inventaire-farine-riz-pates" + }, + { + "type": "service", + "host": "life-noc", + "service": "stock-alimentaire-verification-bacs-legumes-racines" + }, + { + "type": "service", + "host": "life-noc", + "service": "stock-alimentaire-revue-supplements-vitamines" + } + ] + }, + { + "name": "SANTE", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "sante-verification-trousse-premiers-soins" + }, + { + "type": "service", + "host": "life-noc", + "service": "sante-verification-expiration-medicaments" + }, + { + "type": "service", + "host": "life-noc", + "service": "sante-revision-rendez-vous-medicaux" + }, + { + "type": "service", + "host": "life-noc", + "service": "sante-verification-lunettes-prescriptions" + }, + { + "type": "service", + "host": "life-noc", + "service": "sante-verification-dossier-sante" + } + ] + }, + { + "name": "VOITURE", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "voiture-verification-huile-moteur" + }, + { + "type": "service", + "host": "life-noc", + "service": "voiture-inspection-freins" + }, + { + "type": "service", + "host": "life-noc", + "service": "voiture-verification-pneus" + }, + { + "type": "service", + "host": "life-noc", + "service": "voiture-ajustement-valves" + }, + { + "type": "service", + "host": "life-noc", + "service": "voiture-verification-timing-belt" + }, + { + "type": "service", + "host": "life-noc", + "service": "voiture-verification-batterie-voiture" + }, + { + "type": "service", + "host": "life-noc", + "service": "voiture-verification-balais-essuie-glace" + }, + { + "type": "service", + "host": "life-noc", + "service": "voiture-verification-liquides" + }, + { + "type": "service", + "host": "life-noc", + "service": "voiture-verification-eclairage" + }, + { + "type": "service", + "host": "life-noc", + "service": "voiture-verification-immatriculation-assurance" + } + ] + }, + { + "name": "JARDIN", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "jardin-inspection-vignes" + }, + { + "type": "service", + "host": "life-noc", + "service": "jardin-entretien-bleuetiers" + }, + { + "type": "service", + "host": "life-noc", + "service": "jardin-entretien-framboisiers" + }, + { + "type": "service", + "host": "life-noc", + "service": "jardin-inspection-kiwis-nordiques" + }, + { + "type": "service", + "host": "life-noc", + "service": "jardin-entretien-rhubarbe" + }, + { + "type": "service", + "host": "life-noc", + "service": "jardin-inspection-groseillier" + }, + { + "type": "service", + "host": "life-noc", + "service": "jardin-inspection-muriers" + }, + { + "type": "service", + "host": "life-noc", + "service": "jardin-entretien-houblon" + }, + { + "type": "service", + "host": "life-noc", + "service": "jardin-revision-pharmacopée-jardin" + }, + { + "type": "service", + "host": "life-noc", + "service": "jardin-revision-armoire-produits-jardin" + } + ] + }, + { + "name": "OUTILS-ET-EQUIPEMENTS", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "outils-et-equipements-entretien-outils-jardin" + }, + { + "type": "service", + "host": "life-noc", + "service": "outils-et-equipements-inspection-outils-electriques" + }, + { + "type": "service", + "host": "life-noc", + "service": "outils-et-equipements-verification-rallonges-et-connecteurs" + }, + { + "type": "service", + "host": "life-noc", + "service": "outils-et-equipements-verification-compresseur-et-accessoires" + }, + { + "type": "service", + "host": "life-noc", + "service": "outils-et-equipements-revision-inventaire-outillage" + } + ] + }, + { + "name": "INFORMATIQUE-PERSONNELLE", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "informatique-personnelle-verification-sauvegardes-personnelles" + }, + { + "type": "service", + "host": "life-noc", + "service": "informatique-personnelle-nettoyage-stockage-personnel" + }, + { + "type": "service", + "host": "life-noc", + "service": "informatique-personnelle-verification-comptes-importants" + }, + { + "type": "service", + "host": "life-noc", + "service": "informatique-personnelle-revue-mots-de-passe-personnels" + }, + { + "type": "service", + "host": "life-noc", + "service": "informatique-personnelle-verification-documents-cloud-personnels" + } + ] + }, + { + "name": "INFRASTRUCTURE-CHEZLEPRO", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-proxmox" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-ceph" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-test-restauration-backups" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-pbs-truenas" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-ups-infrastructure" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-capacite-stockage" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-apt-cacher-ng" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-icinga2" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-keycloak-openldap" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-nextcloud" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-mailcow" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-openvas" + }, + { + "type": "service", + "host": "life-noc", + "service": "infrastructure-chezlepro-verification-journaux-systemes" + } + ] + }, + { + "name": "RESEAU-CHEZLEPRO", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "reseau-chezlepro-verification-firewalls" + }, + { + "type": "service", + "host": "life-noc", + "service": "reseau-chezlepro-verification-vpn-openvpn" + }, + { + "type": "service", + "host": "life-noc", + "service": "reseau-chezlepro-verification-crl-certificats" + }, + { + "type": "service", + "host": "life-noc", + "service": "reseau-chezlepro-verification-switches" + }, + { + "type": "service", + "host": "life-noc", + "service": "reseau-chezlepro-verification-vlans-segmentation" + }, + { + "type": "service", + "host": "life-noc", + "service": "reseau-chezlepro-verification-dns" + }, + { + "type": "service", + "host": "life-noc", + "service": "reseau-chezlepro-verification-dynamic-dns" + }, + { + "type": "service", + "host": "life-noc", + "service": "reseau-chezlepro-audit-regles-firewall" + }, + { + "type": "service", + "host": "life-noc", + "service": "reseau-chezlepro-verification-geoblocking" + }, + { + "type": "service", + "host": "life-noc", + "service": "reseau-chezlepro-verification-certificats-publics" + } + ] + }, + { + "name": "SECURITE-CHEZLEPRO", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "securite-chezlepro-verification-mises-a-jour-securite" + }, + { + "type": "service", + "host": "life-noc", + "service": "securite-chezlepro-audit-comptes-acces" + }, + { + "type": "service", + "host": "life-noc", + "service": "securite-chezlepro-verification-ids-snort" + }, + { + "type": "service", + "host": "life-noc", + "service": "securite-chezlepro-revue-pki-privee" + }, + { + "type": "service", + "host": "life-noc", + "service": "securite-chezlepro-revue-politiques-securite" + }, + { + "type": "service", + "host": "life-noc", + "service": "securite-chezlepro-verification-sauvegardes-configuration" + } + ] + }, + { + "name": "EXPLOITATION-CHEZLEPRO", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "exploitation-chezlepro-revision-playbooks-ansible" + }, + { + "type": "service", + "host": "life-noc", + "service": "exploitation-chezlepro-verification-inventaires-ansible" + }, + { + "type": "service", + "host": "life-noc", + "service": "exploitation-chezlepro-revision-documentation-technique" + }, + { + "type": "service", + "host": "life-noc", + "service": "exploitation-chezlepro-verification-procedures-reprise" + }, + { + "type": "service", + "host": "life-noc", + "service": "exploitation-chezlepro-revue-capacite-ressources" + }, + { + "type": "service", + "host": "life-noc", + "service": "exploitation-chezlepro-verification-jobs-automatises" + } + ] + }, + { + "name": "OBLIGATIONS-CHEZLEPRO", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "obligations-chezlepro-verification-registraire-entreprise" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-chezlepro-verification-declarations-taxes" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-chezlepro-verification-dossier-comptable-entreprise" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-chezlepro-verification-facturation-clients" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-chezlepro-verification-paiements-fournisseurs" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-chezlepro-verification-contrats-ententes" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-chezlepro-verification-assurances-entreprise" + }, + { + "type": "service", + "host": "life-noc", + "service": "obligations-chezlepro-archivage-documents-entreprise" + } + ] + }, + { + "name": "ACTIFS-CHEZLEPRO", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "actifs-chezlepro-revision-inventaire-materiel" + }, + { + "type": "service", + "host": "life-noc", + "service": "actifs-chezlepro-verification-amortissables" + }, + { + "type": "service", + "host": "life-noc", + "service": "actifs-chezlepro-verification-serveurs-et-composants" + }, + { + "type": "service", + "host": "life-noc", + "service": "actifs-chezlepro-verification-reserve-pieces" + }, + { + "type": "service", + "host": "life-noc", + "service": "actifs-chezlepro-revision-actifs-transferts" + } + ] + }, + { + "name": "PROJETS", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "projets-revision-life-noc" + }, + { + "type": "service", + "host": "life-noc", + "service": "projets-revision-alliance-boreale" + }, + { + "type": "service", + "host": "life-noc", + "service": "projets-revision-erplibre" + }, + { + "type": "service", + "host": "life-noc", + "service": "projets-revision-semence-numerique" + }, + { + "type": "service", + "host": "life-noc", + "service": "projets-revision-ortrux-1" + }, + { + "type": "service", + "host": "life-noc", + "service": "projets-revision-district16" + } + ] + }, + { + "name": "COMMUNAUTE", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "communaute-verification-outils-aa" + }, + { + "type": "service", + "host": "life-noc", + "service": "communaute-verification-espace-87-16" + }, + { + "type": "service", + "host": "life-noc", + "service": "communaute-verification-salles-visio-groupes" + }, + { + "type": "service", + "host": "life-noc", + "service": "communaute-verification-depots-rapports-rsg" + }, + { + "type": "service", + "host": "life-noc", + "service": "communaute-revision-outils-communication-communaute" + } + ] + }, + { + "name": "DOCUMENTATION", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "documentation-revue-docs-personnelles-importantes" + }, + { + "type": "service", + "host": "life-noc", + "service": "documentation-revue-wiki-technique" + }, + { + "type": "service", + "host": "life-noc", + "service": "documentation-revue-base-connaissances" + }, + { + "type": "service", + "host": "life-noc", + "service": "documentation-verification-sauvegarde-docs-cles" + } + ] + }, + { + "name": "ANIMAUX", + "operator": "worst", + "nodes": [ + { + "type": "service", + "host": "life-noc", + "service": "animaux-verification-stock-nourriture-chats" + }, + { + "type": "service", + "host": "life-noc", + "service": "animaux-verification-friandises-et-litiere" + }, + { + "type": "service", + "host": "life-noc", + "service": "animaux-revision-routine-soins-animaux" + } + ] + } + ] +} \ No newline at end of file diff --git a/scripts/generate_bpm.py b/scripts/generate_bpm.py new file mode 100755 index 0000000..46da8d2 --- /dev/null +++ b/scripts/generate_bpm.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 + +from pathlib import Path +import json +import re +import sys +import yaml + + +INPUT_FILE = Path("domains.yaml") +OUTPUT_DIR = Path("bpm") +OUTPUT_FILE = OUTPUT_DIR / "life-noc.json" +HOST_NAME = "life-noc" + + +def slugify(value: str) -> str: + value = value.strip().lower() + replacements = { + "à": "a", "â": "a", "ä": "a", + "ç": "c", + "é": "e", "è": "e", "ê": "e", "ë": "e", + "î": "i", "ï": "i", + "ô": "o", "ö": "o", + "ù": "u", "û": "u", "ü": "u", + "ÿ": "y", + "œ": "oe", + "æ": "ae", + "'": "", + "’": "", + } + for old, new in replacements.items(): + value = value.replace(old, new) + value = re.sub(r"[^a-z0-9\-]+", "-", value) + value = re.sub(r"-{2,}", "-", value) + return value.strip("-") + + +def build_service_name(domain_slug: str, item_name: str) -> str: + return f"{domain_slug}-{item_name.strip()}" + + +def make_leaf_node(service_name: str) -> dict: + return { + "type": "service", + "host": HOST_NAME, + "service": service_name + } + + +def make_domain_process(domain_label: str, domain_slug: str, services: list[dict]) -> dict: + leaves = [] + for item in services: + service_name = build_service_name(domain_slug, item["name"]) + leaves.append(make_leaf_node(service_name)) + + return { + "name": domain_label.upper(), + "operator": "worst", + "nodes": leaves + } + + +def main() -> int: + if not INPUT_FILE.exists(): + print(f"Erreur: fichier introuvable: {INPUT_FILE}", file=sys.stderr) + return 1 + + with INPUT_FILE.open("r", encoding="utf-8") as f: + data = yaml.safe_load(f) + + if not isinstance(data, dict) or "domains" not in data: + print("Erreur: le YAML doit contenir une clé racine 'domains'.", file=sys.stderr) + return 1 + + domains = data["domains"] + if not isinstance(domains, dict): + print("Erreur: 'domains' doit être un objet YAML.", file=sys.stderr) + return 1 + + processes = [] + root_nodes = [] + + for raw_domain, services in domains.items(): + if not isinstance(services, list): + print(f"Erreur: le domaine '{raw_domain}' doit contenir une liste.", file=sys.stderr) + return 1 + + for idx, item in enumerate(services, start=1): + if not isinstance(item, dict): + print(f"Erreur: entrée invalide dans '{raw_domain}' à la position {idx}.", file=sys.stderr) + return 1 + missing = [key for key in ("name", "date", "notes") if key not in item] + if missing: + print( + f"Erreur: dans le domaine '{raw_domain}', entrée {idx}, champs manquants: {', '.join(missing)}", + file=sys.stderr, + ) + return 1 + + domain_slug = slugify(str(raw_domain)) + domain_label = str(raw_domain) + + domain_process = make_domain_process(domain_label, domain_slug, services) + processes.append(domain_process) + + root_nodes.append({ + "type": "process", + "name": domain_label.upper() + }) + + root_process = { + "name": "LIFE-NOC", + "operator": "worst", + "nodes": root_nodes + } + + bpm_document = { + "version": 1, + "processes": [root_process] + processes + } + + OUTPUT_DIR.mkdir(parents=True, exist_ok=True) + with OUTPUT_FILE.open("w", encoding="utf-8") as f: + json.dump(bpm_document, f, ensure_ascii=False, indent=2) + + print(f"BPM généré: {OUTPUT_FILE}") + print("Processus générés :") + print(" - LIFE-NOC") + for raw_domain in domains.keys(): + print(f" - {str(raw_domain).upper()}") + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())