Skip to content

Commit

Permalink
Improve Arista duplicate echo issue (#2944)
Browse files Browse the repository at this point in the history
* Improve Arista duplicate echo issue

* Add test_channel_read() on login
  • Loading branch information
ktbyers authored Sep 13, 2022
1 parent f3b5da2 commit 8f30aa9
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion netmiko/arista/arista.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,33 @@


class AristaBase(CiscoSSHConnection):
prompt_pattern = r"[$>#]"

def session_preparation(self) -> None:
"""Prepare the session after the connection has been established."""
self._test_channel_read(pattern=self.prompt_pattern)
cmd = "terminal width 511"
# Arista will echo immediately and then when the device really responds (like NX-OS)
self.set_terminal_width(command=cmd, pattern=r"Width set to")
self.disable_paging(cmd_verify=False, pattern=r"Pagination disabled")
self.set_base_prompt()

def find_prompt(
self, delay_factor: float = 1.0, pattern: Optional[str] = None
) -> str:
"""
Arista's sometimes duplicate the command echo if they fall behind.
arista9-napalm#
show version | json
arista9-napalm#show version | json
Using the terminating pattern tries to ensure that it is less likely they
fall behind.
"""
if not pattern:
pattern = self.prompt_pattern
return super().find_prompt(delay_factor=delay_factor, pattern=pattern)

def enable(
self,
cmd: str = "enable",
Expand Down

0 comments on commit 8f30aa9

Please sign in to comment.