From fe009983904195412b2e4bab52f9e274bdb4bf82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Ribot?= <98583408+k-ribot@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:22:02 +0100 Subject: [PATCH] Zyxel: Correction of ANSI characters of next line (#3524) --- netmiko/zyxel/zyxel_ssh.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/netmiko/zyxel/zyxel_ssh.py b/netmiko/zyxel/zyxel_ssh.py index 7ac0005dc..ddebc18e9 100644 --- a/netmiko/zyxel/zyxel_ssh.py +++ b/netmiko/zyxel/zyxel_ssh.py @@ -1,3 +1,5 @@ +import re + from typing import Any, Sequence, Iterator, TextIO, Union from netmiko.cisco_base_connection import CiscoSSHConnection from netmiko.no_enable import NoEnable @@ -28,3 +30,8 @@ def session_preparation(self) -> None: super().session_preparation() # Zyxel switches output ansi codes self.ansi_escape_codes = True + + def strip_ansi_escape_codes(self, string_buffer: str) -> str: + """Replace '^J' code by next line""" + output = re.sub(r"^\^J", self.RETURN, string_buffer) + return super().strip_ansi_escape_codes(output)