Skip to content

Commit 64ce659

Browse files
committed
Huawei SmartAX infoswitch off fix
1 parent 66b6868 commit 64ce659

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

netmiko/huawei/huawei_smartax.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def session_preparation(self) -> None:
2323

2424
self.set_base_prompt()
2525
self._disable_smart_interaction()
26+
self._disable_infoswitch_cli()
2627
self.disable_paging()
2728

2829
def strip_ansi_escape_codes(self, string_buffer: str) -> str:
@@ -41,6 +42,18 @@ def strip_ansi_escape_codes(self, string_buffer: str) -> str:
4142
log.debug(f"repr = {repr(output)}")
4243
return super().strip_ansi_escape_codes(output)
4344

45+
def _disable_infoswitch_cli(self, command: str = "infoswitch cli OFF") -> None:
46+
"""SmartAX sends debugging output to the terminal by default--disable this."""
47+
priv_escalation = False
48+
# infoswitch cli OFF requires enable mode
49+
if self.check_enable_mode():
50+
self.enable()
51+
priv_escalation = True
52+
pattern = re.escape(self.base_prompt)
53+
self._send_command_str(command, expect_string=rf"{pattern}#")
54+
if priv_escalation:
55+
self.exit_enable_mode()
56+
4457
def _disable_smart_interaction(
4558
self, command: str = "undo smart", delay_factor: float = 1.0
4659
) -> None:

0 commit comments

Comments
 (0)