From 2389e11ed5046b6217763dc3d1bd9321e2e4ac31 Mon Sep 17 00:00:00 2001 From: Ronan Fourneuve Date: Thu, 13 Nov 2025 09:45:43 +0100 Subject: [PATCH] Ajout Config ESW3 --- TP-02/data/vlan_ESW3.json | 23 +++++++++++++++++++++++ TP-02/data/vlan_R03.json | 19 +++++++++++++++++++ TP-02/scripts/create_config.py | 12 +++++++++--- 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 TP-02/data/vlan_ESW3.json create mode 100644 TP-02/data/vlan_R03.json diff --git a/TP-02/data/vlan_ESW3.json b/TP-02/data/vlan_ESW3.json new file mode 100644 index 0000000..a0c4234 --- /dev/null +++ b/TP-02/data/vlan_ESW3.json @@ -0,0 +1,23 @@ +{ + "hostname": "ESW3", + "interfaces": [ + { + "name": "f1/1", + "mode": "access", + "vlan_id": "10", + "description": "Connexion vers le VLAN 10" + }, + { + "name": "f1/2", + "mode": "access", + "vlan_id": "20", + "description": "Connexion vers le VLAN 20" + }, + { + "name": "f1/0", + "mode": "trunk", + "vlan_id": "10,20", + "description": "Connexion vers le routeur R2" + } + ] +} diff --git a/TP-02/data/vlan_R03.json b/TP-02/data/vlan_R03.json new file mode 100644 index 0000000..393c1ab --- /dev/null +++ b/TP-02/data/vlan_R03.json @@ -0,0 +1,19 @@ +{ +"hostname": "R3", +"interfaces": [ +{ + "name": "g0/0.10", + "description": "Gateway pour le reseau 172.16.50.0/24", + "ip": "172.16.50.254", + "mask": "255.255.255.0", + "vlan_id": "10" + }, + { + "name": "g0/0.20", + "description": "Gateway pour le reseau 172.16.60.0/24", + "ip": "172.16.60.254", + "mask": "255.255.255.0", + "vlan_id": "20" + } + ] +} \ No newline at end of file diff --git a/TP-02/scripts/create_config.py b/TP-02/scripts/create_config.py index b9a3106..683be6d 100644 --- a/TP-02/scripts/create_config.py +++ b/TP-02/scripts/create_config.py @@ -41,6 +41,12 @@ def create_vlan_config_cpe_paris(): """ Must return two values : router config and the switch config """ + esw3_data = load_json_data_from_file(file_path='data/vlan_ESW3.json') + esw3_config = render_network_config(template_name='vlan_switch.j2', data=esw3_data) + + R3_data = load_json_data_from_file(file_path='data/vlan_R03.json') + R3_config = render_network_config(template_name='vlan_router.j2', data=R3_data) + return R3_config,esw3_config pass @@ -52,6 +58,6 @@ if __name__ == "__main__": save_built_config('config/vlan_R02.conf', r02_config) save_built_config('config/vlan_ESW2.conf', esw2_config) - # r03_config, esw3_config = create_vlan_config_cpe_paris() - # save_built_config('config/vlan_R03.conf', r03_config) - # save_built_config('config/vlan_ESW3.conf', esw3_config) + r03_config, esw3_config = create_vlan_config_cpe_paris() + save_built_config('config/vlan_R03.conf', r03_config) + save_built_config('config/vlan_ESW3.conf', esw3_config)