From 39f8b87743390c1e7526b77ed87c3c2557ef3ce4 Mon Sep 17 00:00:00 2001 From: Ronan Fourneuve Date: Thu, 20 Nov 2025 22:01:23 +0100 Subject: [PATCH] fin TP3 --- TP_03/config/R1_CPE_LYON_BAT_A_OSPF.conf | 10 + TP_03/config/R1_CPE_LYON_BAT_B.conf | 5 +- TP_03/config/R1_CPE_LYON_BAT_B_OSPF.conf | 10 + TP_03/config/R2_CPE_LYON_BAT_A_OSPF.conf | 10 + TP_03/config/R2_CPE_LYON_BAT_B.conf | 5 +- TP_03/config/R2_CPE_LYON_BAT_B_OSPF.conf | 10 + TP_03/data/R1_CPE_LYON_BAT_A_OSPF.json | 8 + TP_03/data/R1_CPE_LYON_BAT_B_OSPF.json | 8 + TP_03/data/R2_CPE_LYON_BAT_A_OSPF.json | 8 + TP_03/data/R2_CPE_LYON_BAT_B_OSPF.json | 8 + TP_03/nornir.log | 553 +++++++++++++++++++++++ TP_03/scripts/create_config.py | 23 +- TP_03/scripts/run_nornir.py | 57 ++- TP_03/templates/config_ospf.j2 | 6 + TP_03/templates/vlan_router.j2 | 2 +- 15 files changed, 692 insertions(+), 31 deletions(-) create mode 100644 TP_03/config/R1_CPE_LYON_BAT_A_OSPF.conf create mode 100644 TP_03/config/R1_CPE_LYON_BAT_B_OSPF.conf create mode 100644 TP_03/config/R2_CPE_LYON_BAT_A_OSPF.conf create mode 100644 TP_03/config/R2_CPE_LYON_BAT_B_OSPF.conf create mode 100644 TP_03/data/R1_CPE_LYON_BAT_A_OSPF.json create mode 100644 TP_03/data/R1_CPE_LYON_BAT_B_OSPF.json create mode 100644 TP_03/data/R2_CPE_LYON_BAT_A_OSPF.json create mode 100644 TP_03/data/R2_CPE_LYON_BAT_B_OSPF.json create mode 100644 TP_03/templates/config_ospf.j2 diff --git a/TP_03/config/R1_CPE_LYON_BAT_A_OSPF.conf b/TP_03/config/R1_CPE_LYON_BAT_A_OSPF.conf new file mode 100644 index 0000000..efd0e72 --- /dev/null +++ b/TP_03/config/R1_CPE_LYON_BAT_A_OSPF.conf @@ -0,0 +1,10 @@ +router ospf 1 + router-id 1.1.1.1 + + network 172.16.10.0 0.0.0.255 area 0 + + network 172.16.20.0 0.0.0.255 area 0 + + network 172.16.100.0 0.0.0.63 area 0 + +end \ No newline at end of file diff --git a/TP_03/config/R1_CPE_LYON_BAT_B.conf b/TP_03/config/R1_CPE_LYON_BAT_B.conf index 3f103a4..19ffaba 100644 --- a/TP_03/config/R1_CPE_LYON_BAT_B.conf +++ b/TP_03/config/R1_CPE_LYON_BAT_B.conf @@ -1,10 +1,7 @@ interface g3/0 - encapsulation dot1Q - description "**NO DESCRIPTION**" - ip address + no shutdown exit - interface g3/0.10 encapsulation dot1Q 10 description "Gateway for teacher vlan" diff --git a/TP_03/config/R1_CPE_LYON_BAT_B_OSPF.conf b/TP_03/config/R1_CPE_LYON_BAT_B_OSPF.conf new file mode 100644 index 0000000..009dcc1 --- /dev/null +++ b/TP_03/config/R1_CPE_LYON_BAT_B_OSPF.conf @@ -0,0 +1,10 @@ +router ospf 1 + router-id 4.4.4.4 + + network 172.16.30.0 0.0.0.255 area 0 + + network 172.16.40.0 0.0.0.255 area 0 + + network 172.16.100.64 0.0.0.63 area 0 + +end \ No newline at end of file diff --git a/TP_03/config/R2_CPE_LYON_BAT_A_OSPF.conf b/TP_03/config/R2_CPE_LYON_BAT_A_OSPF.conf new file mode 100644 index 0000000..b4febc7 --- /dev/null +++ b/TP_03/config/R2_CPE_LYON_BAT_A_OSPF.conf @@ -0,0 +1,10 @@ +router ospf 1 + router-id 2.2.2.2 + + network 172.16.10.0 0.0.0.255 area 0 + + network 172.16.20.0 0.0.0.255 area 0 + + network 172.16.100.0 0.0.0.63 area 0 + +end \ No newline at end of file diff --git a/TP_03/config/R2_CPE_LYON_BAT_B.conf b/TP_03/config/R2_CPE_LYON_BAT_B.conf index 1421cb3..279f0d4 100644 --- a/TP_03/config/R2_CPE_LYON_BAT_B.conf +++ b/TP_03/config/R2_CPE_LYON_BAT_B.conf @@ -1,10 +1,7 @@ interface g3/0 - encapsulation dot1Q - description "**NO DESCRIPTION**" - ip address + no shutdown exit - interface g3/0.10 encapsulation dot1Q 10 description "Gateway for teacher vlan" diff --git a/TP_03/config/R2_CPE_LYON_BAT_B_OSPF.conf b/TP_03/config/R2_CPE_LYON_BAT_B_OSPF.conf new file mode 100644 index 0000000..c6c5862 --- /dev/null +++ b/TP_03/config/R2_CPE_LYON_BAT_B_OSPF.conf @@ -0,0 +1,10 @@ +router ospf 1 + router-id 3.3.3.3 + + network 172.16.30.0 0.0.0.255 area 0 + + network 172.16.40.0 0.0.0.255 area 0 + + network 172.16.100.64 0.0.0.63 area 0 + +end \ No newline at end of file diff --git a/TP_03/data/R1_CPE_LYON_BAT_A_OSPF.json b/TP_03/data/R1_CPE_LYON_BAT_A_OSPF.json new file mode 100644 index 0000000..f59f02e --- /dev/null +++ b/TP_03/data/R1_CPE_LYON_BAT_A_OSPF.json @@ -0,0 +1,8 @@ +{ + "id_router": "1.1.1.1", + "networks": [ + "172.16.10.0 0.0.0.255", + "172.16.20.0 0.0.0.255", + "172.16.100.0 0.0.0.63" + ] +} diff --git a/TP_03/data/R1_CPE_LYON_BAT_B_OSPF.json b/TP_03/data/R1_CPE_LYON_BAT_B_OSPF.json new file mode 100644 index 0000000..2dc7bd6 --- /dev/null +++ b/TP_03/data/R1_CPE_LYON_BAT_B_OSPF.json @@ -0,0 +1,8 @@ +{ + "id_router": "4.4.4.4", + "networks": [ + "172.16.30.0 0.0.0.255", + "172.16.40.0 0.0.0.255", + "172.16.100.64 0.0.0.63" + ] +} \ No newline at end of file diff --git a/TP_03/data/R2_CPE_LYON_BAT_A_OSPF.json b/TP_03/data/R2_CPE_LYON_BAT_A_OSPF.json new file mode 100644 index 0000000..3476c41 --- /dev/null +++ b/TP_03/data/R2_CPE_LYON_BAT_A_OSPF.json @@ -0,0 +1,8 @@ +{ + "id_router": "2.2.2.2", + "networks": [ + "172.16.10.0 0.0.0.255", + "172.16.20.0 0.0.0.255", + "172.16.100.0 0.0.0.63" + ] +} diff --git a/TP_03/data/R2_CPE_LYON_BAT_B_OSPF.json b/TP_03/data/R2_CPE_LYON_BAT_B_OSPF.json new file mode 100644 index 0000000..c290f41 --- /dev/null +++ b/TP_03/data/R2_CPE_LYON_BAT_B_OSPF.json @@ -0,0 +1,8 @@ +{ + "id_router": "3.3.3.3", + "networks": [ + "172.16.30.0 0.0.0.255", + "172.16.40.0 0.0.0.255", + "172.16.100.64 0.0.0.63" + ] +} \ No newline at end of file diff --git a/TP_03/nornir.log b/TP_03/nornir.log index 0b81415..5cf7fc7 100644 --- a/TP_03/nornir.log +++ b/TP_03/nornir.log @@ -464,3 +464,556 @@ Traceback (most recent call last): nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) +2025-11-20 21:11:48,739 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:11:51,507 - nornir.core - INFO - run() - Running task 'Déploiement config R2-CPE-BAT-A' with args {'config_file': 'config/R2_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:11:56,613 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-B' with args {'config_file': 'config/R1_CPE_LYON_BAT_B.conf'} on 1 hosts +2025-11-20 21:12:03,372 - nornir.core - INFO - run() - Running task 'Déploiement config R2-CPE-BAT-B' with args {'config_file': 'config/R2_CPE_LYON_BAT_B.conf'} on 1 hosts +2025-11-20 21:12:10,472 - nornir.core - INFO - run() - Running task 'Déploiement config ESW1-CPE-BAT-A' with args {'config_file': 'config/ESW1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:12:23,848 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A_VRRP.conf'} on 4 hosts +2025-11-20 21:12:28,587 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R2-CPE-BAT-A' with args {'config_file': 'config/R2_CPE_LYON_BAT_A_VRRP.conf'} on 4 hosts +2025-11-20 21:12:47,761 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-B': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R3.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:12:47,762 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-B': task 'Déploiement VRRP R2-CPE-BAT-A' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:12:47,811 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-B': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R4.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:12:47,812 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-B': task 'Déploiement VRRP R2-CPE-BAT-A' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:12:47,813 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R1-CPE-BAT-B' with args {'config_file': 'config/R1_CPE_LYON_BAT_B_VRRP.conf'} on 2 hosts +2025-11-20 21:12:50,067 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R2-CPE-BAT-B' with args {'config_file': 'config/R2_CPE_LYON_BAT_B_VRRP.conf'} on 2 hosts +2025-11-20 21:13:05,466 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-A': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R1\\-CPE\\-BAT\\-A.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:13:05,468 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-A': task 'Déploiement VRRP R2-CPE-BAT-B' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:13:06,974 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-A': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R2\\-CPE\\-BAT\\-A.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:13:06,974 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-A': task 'Déploiement VRRP R2-CPE-BAT-B' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:13:34,441 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:13:36,525 - nornir.core - INFO - run() - Running task 'Déploiement config R2-CPE-BAT-A' with args {'config_file': 'config/R2_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:13:41,177 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-B' with args {'config_file': 'config/R1_CPE_LYON_BAT_B.conf'} on 1 hosts +2025-11-20 21:13:47,459 - nornir.core - INFO - run() - Running task 'Déploiement config R2-CPE-BAT-B' with args {'config_file': 'config/R2_CPE_LYON_BAT_B.conf'} on 1 hosts +2025-11-20 21:13:53,898 - nornir.core - INFO - run() - Running task 'Déploiement config ESW1-CPE-BAT-A' with args {'config_file': 'config/ESW1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:14:06,475 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A_VRRP.conf'} on 4 hosts +2025-11-20 21:14:10,913 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R2-CPE-BAT-A' with args {'config_file': 'config/R2_CPE_LYON_BAT_A_VRRP.conf'} on 4 hosts +2025-11-20 21:14:30,002 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-B': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R3.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:14:30,002 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-B': task 'Déploiement VRRP R2-CPE-BAT-A' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:14:30,129 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-B': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R4.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:14:30,130 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-B': task 'Déploiement VRRP R2-CPE-BAT-A' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:14:30,130 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R1-CPE-BAT-B' with args {'config_file': 'config/R1_CPE_LYON_BAT_B_VRRP.conf'} on 2 hosts +2025-11-20 21:14:32,579 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R2-CPE-BAT-B' with args {'config_file': 'config/R2_CPE_LYON_BAT_B_VRRP.conf'} on 2 hosts +2025-11-20 21:14:48,020 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-A': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R1\\-CPE\\-BAT\\-A.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:14:48,021 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-A': task 'Déploiement VRRP R2-CPE-BAT-B' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:14:49,392 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-A': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R2\\-CPE\\-BAT\\-A.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:14:49,392 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-A': task 'Déploiement VRRP R2-CPE-BAT-B' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:17:25,458 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:17:27,600 - nornir.core - INFO - run() - Running task 'Déploiement config R2-CPE-BAT-A' with args {'config_file': 'config/R2_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:17:32,343 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-B' with args {'config_file': 'config/R1_CPE_LYON_BAT_B.conf'} on 1 hosts +2025-11-20 21:17:38,480 - nornir.core - INFO - run() - Running task 'Déploiement config R2-CPE-BAT-B' with args {'config_file': 'config/R2_CPE_LYON_BAT_B.conf'} on 1 hosts +2025-11-20 21:17:44,843 - nornir.core - INFO - run() - Running task 'Déploiement config ESW1-CPE-BAT-A' with args {'config_file': 'config/ESW1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:17:57,065 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A_VRRP.conf'} on 4 hosts +2025-11-20 21:19:58,532 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:20:00,681 - nornir.core - INFO - run() - Running task 'Déploiement config R2-CPE-BAT-A' with args {'config_file': 'config/R2_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:20:05,531 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-B' with args {'config_file': 'config/R1_CPE_LYON_BAT_B.conf'} on 1 hosts +2025-11-20 21:20:11,738 - nornir.core - INFO - run() - Running task 'Déploiement config R2-CPE-BAT-B' with args {'config_file': 'config/R2_CPE_LYON_BAT_B.conf'} on 1 hosts +2025-11-20 21:20:18,241 - nornir.core - INFO - run() - Running task 'Déploiement config ESW1-CPE-BAT-A' with args {'config_file': 'config/ESW1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:20:30,799 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A_VRRP.conf'} on 4 hosts +2025-11-20 21:20:35,209 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R2-CPE-BAT-A' with args {'config_file': 'config/R2_CPE_LYON_BAT_A_VRRP.conf'} on 4 hosts +2025-11-20 21:20:54,322 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-B': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R3.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:20:54,323 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-B': task 'Déploiement VRRP R2-CPE-BAT-A' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:20:54,493 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-B': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R4.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:20:54,494 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-B': task 'Déploiement VRRP R2-CPE-BAT-A' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:20:54,495 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R1-CPE-BAT-B' with args {'config_file': 'config/R1_CPE_LYON_BAT_B_VRRP.conf'} on 2 hosts +2025-11-20 21:20:56,827 - nornir.core - INFO - run() - Running task 'Déploiement VRRP R2-CPE-BAT-B' with args {'config_file': 'config/R2_CPE_LYON_BAT_B_VRRP.conf'} on 2 hosts +2025-11-20 21:21:12,196 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-A': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R1\\-CPE\\-BAT\\-A.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:21:12,197 - nornir.core.task - ERROR - start() - Host 'R1-CPE-BAT-A': task 'Déploiement VRRP R2-CPE-BAT-B' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:21:13,682 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-A': task 'netmiko_send_config' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config + result = net_connect.send_config_set(config_commands=config_commands, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator + return_val = func(self, *args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 2341, in send_config_set + output += self.read_until_pattern( + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/netmiko/base_connection.py", line 755, in read_until_pattern + raise ReadTimeout(msg) +netmiko.exceptions.ReadTimeout: + +Pattern not detected: '(?:R2\\-CPE\\-BAT\\-A.*$|#.*$)' in output. + +Things you might try to fix this: +1. Adjust the regex pattern to better identify the terminating string. Note, in +many situations the pattern is automatically based on the network device's prompt. +2. Increase the read_timeout to a larger value. + +You can also look at the Netmiko session_log or debug log for more information. + + + +2025-11-20 21:21:13,683 - nornir.core.task - ERROR - start() - Host 'R2-CPE-BAT-A': task 'Déploiement VRRP R2-CPE-BAT-B' failed with traceback: +Traceback (most recent call last): + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 98, in start + r = self.task(self, **self.params) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/workspace/devnet/TP_03/scripts/run_nornir.py", line 174, in deploy_config_from_file + result = task.run(task=netmiko_send_config, config_commands=commands) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/cpe/.local/share/virtualenvs/TP_03-khcHFeCv/lib/python3.12/site-packages/nornir/core/task.py", line 173, in run + raise NornirSubTaskError(task=run_task, result=r) +nornir.core.exceptions.NornirSubTaskError: Subtask: netmiko_send_config (failed) + + +2025-11-20 21:22:11,524 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:23:41,278 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:23:55,536 - nornir.core - INFO - run() - Running task 'Déploiement config R1-CPE-BAT-A' with args {'config_file': 'config/R1_CPE_LYON_BAT_A.conf'} on 1 hosts +2025-11-20 21:25:27,809 - nornir.core - INFO - run() - Running task 'deploy_main' with args {} on 1 hosts +2025-11-20 21:25:29,862 - nornir.core - INFO - run() - Running task 'deploy_main' with args {} on 1 hosts +2025-11-20 21:25:35,067 - nornir.core - INFO - run() - Running task 'deploy_main' with args {} on 1 hosts +2025-11-20 21:25:41,403 - nornir.core - INFO - run() - Running task 'deploy_main' with args {} on 1 hosts +2025-11-20 21:25:47,999 - nornir.core - INFO - run() - Running task 'deploy_main' with args {} on 1 hosts +2025-11-20 21:26:00,926 - nornir.core - INFO - run() - Running task 'deploy_vrrp' with args {} on 4 hosts +2025-11-20 21:56:47,496 - nornir.core - INFO - run() - Running task 'deploy_main' with args {} on 1 hosts +2025-11-20 21:56:49,729 - nornir.core - INFO - run() - Running task 'deploy_main' with args {} on 1 hosts +2025-11-20 21:56:54,540 - nornir.core - INFO - run() - Running task 'deploy_main' with args {} on 1 hosts +2025-11-20 21:57:00,521 - nornir.core - INFO - run() - Running task 'deploy_main' with args {} on 1 hosts +2025-11-20 21:57:06,949 - nornir.core - INFO - run() - Running task 'deploy_main' with args {} on 1 hosts +2025-11-20 21:57:20,248 - nornir.core - INFO - run() - Running task 'deploy_vrrp' with args {} on 4 hosts +2025-11-20 21:57:25,691 - nornir.core - INFO - run() - Running task 'deploy_ospf' with args {} on 4 hosts diff --git a/TP_03/scripts/create_config.py b/TP_03/scripts/create_config.py index 627777e..2631f70 100644 --- a/TP_03/scripts/create_config.py +++ b/TP_03/scripts/create_config.py @@ -30,13 +30,20 @@ def create_config_cpe_lyon_batA(): R2_LYON_BAT_A_config_vrrp = render_network_config(template_name='vrrp_router.j2', data=R2_LYON_BAT_A_data) R1_LYON_BAT_A_config_vrrp = render_network_config(template_name='vrrp_router.j2', data=R1_LYON_BAT_A_data) + + R2_LYON_BAT_A_config_ospf_data = load_json_data_from_file(file_path='data/R2_CPE_LYON_BAT_A_OSPF.json') + R2_LYON_BAT_A_config_ospf = render_network_config(template_name='config_ospf.j2', data=R2_LYON_BAT_A_config_ospf_data) + R1_LYON_BAT_A_config_ospf_data = load_json_data_from_file(file_path='data/R1_CPE_LYON_BAT_A_OSPF.json') + R1_LYON_BAT_A_config_ospf = render_network_config(template_name='config_ospf.j2', data=R1_LYON_BAT_A_config_ospf_data) return { 'esw1': ESW1_CPE_LYON_BAT_A_config, 'r1': R1_LYON_BAT_A_config, 'r2': R2_LYON_BAT_A_config, 'r1_vrrp' : R1_LYON_BAT_A_config_vrrp, - 'r2_vrrp' : R2_LYON_BAT_A_config_vrrp + 'r2_vrrp' : R2_LYON_BAT_A_config_vrrp, + 'r1_ospf' : R1_LYON_BAT_A_config_ospf, + 'r2_ospf' : R2_LYON_BAT_A_config_ospf } def create_config_cpe_lyon_batB(): @@ -51,12 +58,20 @@ def create_config_cpe_lyon_batB(): R2_LYON_BAT_B_config_vrrp = render_network_config(template_name='vrrp_router.j2', data=R2_LYON_BAT_B_data) R1_LYON_BAT_B_config_vrrp = render_network_config(template_name='vrrp_router.j2', data=R1_LYON_BAT_B_data) + + R2_LYON_BAT_B_config_ospf_data = load_json_data_from_file(file_path='data/R2_CPE_LYON_BAT_B_OSPF.json') + R2_LYON_BAT_B_config_ospf = render_network_config(template_name='config_ospf.j2', data=R2_LYON_BAT_B_config_ospf_data) + R1_LYON_BAT_B_config_ospf_data = load_json_data_from_file(file_path='data/R1_CPE_LYON_BAT_B_OSPF.json') + R1_LYON_BAT_B_config_ospf = render_network_config(template_name='config_ospf.j2', data=R1_LYON_BAT_B_config_ospf_data) + return { 'esw1': ESW1_CPE_LYON_BAT_B_config, 'r1': R1_LYON_BAT_B_config, 'r2': R2_LYON_BAT_B_config, 'r1_vrrp' : R1_LYON_BAT_B_config_vrrp, - 'r2_vrrp' : R2_LYON_BAT_B_config_vrrp + 'r2_vrrp' : R2_LYON_BAT_B_config_vrrp, + 'r1_ospf' : R1_LYON_BAT_B_config_ospf, + 'r2_ospf' : R2_LYON_BAT_B_config_ospf } if __name__ == "__main__": @@ -72,6 +87,8 @@ if __name__ == "__main__": save_built_config('config/ESW1_CPE_LYON_BAT_A.conf', config.get('esw1')) save_built_config('config/R1_CPE_LYON_BAT_A_VRRP.conf', config.get('r1_vrrp')) save_built_config('config/R2_CPE_LYON_BAT_A_VRRP.conf', config.get('r2_vrrp')) + save_built_config('config/R1_CPE_LYON_BAT_A_OSPF.conf', config.get('r1_ospf')) + save_built_config('config/R2_CPE_LYON_BAT_A_OSPF.conf', config.get('r2_ospf')) #question 5: config = create_config_cpe_lyon_batB() @@ -80,4 +97,6 @@ if __name__ == "__main__": save_built_config('config/ESW1_CPE_LYON_BAT_B.conf', config.get('esw1')) save_built_config('config/R1_CPE_LYON_BAT_B_VRRP.conf', config.get('r1_vrrp')) save_built_config('config/R2_CPE_LYON_BAT_B_VRRP.conf', config.get('r2_vrrp')) + save_built_config('config/R1_CPE_LYON_BAT_B_OSPF.conf', config.get('r1_ospf')) + save_built_config('config/R2_CPE_LYON_BAT_B_OSPF.conf', config.get('r2_ospf')) \ No newline at end of file diff --git a/TP_03/scripts/run_nornir.py b/TP_03/scripts/run_nornir.py index 5436aa5..e79424a 100644 --- a/TP_03/scripts/run_nornir.py +++ b/TP_03/scripts/run_nornir.py @@ -167,6 +167,7 @@ def question_38(nr): resultR2 = filtreR2.run(task=netmiko_save_config) print_result(resultR1) print_result(resultR2) + def deploy_config_from_file(task: Task, config_file: str) -> Result: """Déploie la configuration depuis un fichier sur un équipement via Nornir/Netmiko.""" with open(config_file, "r") as f: @@ -177,36 +178,52 @@ def deploy_config_from_file(task: Task, config_file: str) -> Result: print_result(result) return result +def deploy_vrrp(task): + vrrp_filename = task.host.name.replace("-", "_").replace("CPE", "CPE_LYON") + "_VRRP.conf" + task.run( + task=deploy_config_from_file, + config_file=f"config/{vrrp_filename}", + name=f"Déploiement VRRP {task.host.name}" + ) + +def deploy_ospf(task): + vrrp_filename = task.host.name.replace("-", "_").replace("CPE", "CPE_LYON") + "_OSPF.conf" + task.run( + task=deploy_config_from_file, + config_file=f"config/{vrrp_filename}", + name=f"Déploiement VRRP {task.host.name}" + ) + + def deploy_to_hosts(nr, host_patterns): """Déploie les configurations pour tous les hôtes et ajoute le fichier VRRP pour les routers.""" + for pattern in host_patterns: # Filtrer uniquement par nom pour tous filtered_hosts = nr.filter(name=pattern) if not filtered_hosts.inventory.hosts: print(f"Aucun hôte correspondant à '{pattern}'") continue - - for host_name, host_obj in filtered_hosts.inventory.hosts.items(): - # Nom de fichier principal - filename = host_obj.name.replace("-", "_").replace("CPE", "CPE_LYON") - - # Déploiement du fichier principal - filtered_hosts.run( + + # Déploiement des configs principales + def deploy_main(task): + filename = task.host.name.replace("-", "_").replace("CPE", "CPE_LYON") + ".conf" + task.run( task=deploy_config_from_file, - config_file=f"config/{filename}.conf", - name=f"Déploiement config {host_obj.name}" + config_file=f"config/{filename}", + name=f"Déploiement config {task.host.name}" ) - - # Déploiement des fichiers VRRP uniquement pour les routers - routers = nr.filter(device_type='router') - for host_name, host_obj in routers.inventory.hosts.items(): - vrrp_filename = host_obj.name.replace("-", "_").replace("CPE", "CPE_LYON") + "_VRRP.conf" - routers.run( - task=deploy_config_from_file, - config_file=f"config/{vrrp_filename}", - name=f"Déploiement VRRP {host_obj.name}" - ) - + + filtered_hosts.run(task=deploy_main) + + # Déploiement VRRP uniquement pour les routers + routers = nr.filter(device_type="router") + routers.run(task=deploy_vrrp) + routers.run(task=deploy_ospf) + + + + def question_39(nr): host_patterns = [ 'R1-CPE-BAT-A', diff --git a/TP_03/templates/config_ospf.j2 b/TP_03/templates/config_ospf.j2 new file mode 100644 index 0000000..ff1e492 --- /dev/null +++ b/TP_03/templates/config_ospf.j2 @@ -0,0 +1,6 @@ +router ospf 1 + router-id {{ id_router }} +{% for network in networks %} + network {{ network }} area 0 +{% endfor %} +end \ No newline at end of file diff --git a/TP_03/templates/vlan_router.j2 b/TP_03/templates/vlan_router.j2 index 6f4505f..829494a 100644 --- a/TP_03/templates/vlan_router.j2 +++ b/TP_03/templates/vlan_router.j2 @@ -4,7 +4,7 @@ interface {{ interface.name }} no shutdown exit -{%- elif "3/0" == interface.name %} +{%- elif "g3/0" == interface.name %} interface {{ interface.name }} no shutdown exit