Module netmiko.keymile.keymile_ssh
Expand source code
from typing import Any, Optional
import time
from netmiko.no_enable import NoEnable
from netmiko.no_config import NoConfig
from netmiko.cisco.cisco_ios import CiscoIosBase
class KeymileSSH(NoEnable, NoConfig, CiscoIosBase):
def __init__(self, **kwargs: Any) -> None:
kwargs.setdefault("default_enter", "\r\n")
super().__init__(**kwargs)
def session_preparation(self) -> None:
"""Prepare the session after the connection has been established."""
self._test_channel_read(pattern=r">")
self.set_base_prompt()
time.sleep(0.3 * self.global_delay_factor)
self.clear_buffer()
def disable_paging(self, *args: Any, **kwargs: Any) -> str:
"""Keymile does not use paging."""
return ""
def strip_prompt(self, a_string: str) -> str:
"""Remove appending empty line and prompt from output"""
a_string = a_string[:-1]
return super().strip_prompt(a_string=a_string)
def set_base_prompt(
self,
pri_prompt_terminator: str = ">",
alt_prompt_terminator: str = ">",
delay_factor: float = 1.0,
pattern: Optional[str] = None,
) -> str:
"""set prompt termination to >"""
return super().set_base_prompt(
pri_prompt_terminator=pri_prompt_terminator,
alt_prompt_terminator=alt_prompt_terminator,
delay_factor=delay_factor,
pattern=pattern,
)
Classes
class KeymileSSH (**kwargs: Any)
-
Class for platforms that have no enable mode.
Netmiko translates the meaning of "enable" mode to be a proxy for "can go into config mode". In other words, that you ultimately have privileges to execute configuration changes.
The expectation on platforms that have no method for elevating privileges is that the standard default privileges allow configuration changes.
Consequently check_enable_mode returns True by default for platforms that don't explicitly support enable mode.
Expand source code
class KeymileSSH(NoEnable, NoConfig, CiscoIosBase): def __init__(self, **kwargs: Any) -> None: kwargs.setdefault("default_enter", "\r\n") super().__init__(**kwargs) def session_preparation(self) -> None: """Prepare the session after the connection has been established.""" self._test_channel_read(pattern=r">") self.set_base_prompt() time.sleep(0.3 * self.global_delay_factor) self.clear_buffer() def disable_paging(self, *args: Any, **kwargs: Any) -> str: """Keymile does not use paging.""" return "" def strip_prompt(self, a_string: str) -> str: """Remove appending empty line and prompt from output""" a_string = a_string[:-1] return super().strip_prompt(a_string=a_string) def set_base_prompt( self, pri_prompt_terminator: str = ">", alt_prompt_terminator: str = ">", delay_factor: float = 1.0, pattern: Optional[str] = None, ) -> str: """set prompt termination to >""" return super().set_base_prompt( pri_prompt_terminator=pri_prompt_terminator, alt_prompt_terminator=alt_prompt_terminator, delay_factor=delay_factor, pattern=pattern, )
Ancestors
Methods
def disable_paging(self, *args: Any, **kwargs: Any) ‑> str
-
Keymile does not use paging.
Expand source code
def disable_paging(self, *args: Any, **kwargs: Any) -> str: """Keymile does not use paging.""" return ""
def set_base_prompt(self, pri_prompt_terminator: str = '>', alt_prompt_terminator: str = '>', delay_factor: float = 1.0, pattern: Optional[str] = None) ‑> str
-
set prompt termination to >
Expand source code
def set_base_prompt( self, pri_prompt_terminator: str = ">", alt_prompt_terminator: str = ">", delay_factor: float = 1.0, pattern: Optional[str] = None, ) -> str: """set prompt termination to >""" return super().set_base_prompt( pri_prompt_terminator=pri_prompt_terminator, alt_prompt_terminator=alt_prompt_terminator, delay_factor=delay_factor, pattern=pattern, )
def strip_prompt(self, a_string: str) ‑> str
-
Remove appending empty line and prompt from output
Expand source code
def strip_prompt(self, a_string: str) -> str: """Remove appending empty line and prompt from output""" a_string = a_string[:-1] return super().strip_prompt(a_string=a_string)
Inherited members
CiscoIosBase
:check_config_mode
check_enable_mode
cleanup
clear_buffer
commit
config_mode
disconnect
enable
establish_connection
exit_config_mode
exit_enable_mode
find_prompt
is_alive
normalize_cmd
normalize_linefeeds
paramiko_cleanup
read_channel
read_channel_timing
read_until_pattern
read_until_prompt
read_until_prompt_or_pattern
run_ttp
save_config
select_delay_factor
send_command
send_command_expect
send_command_timing
send_config_from_file
send_config_set
send_multiline
session_preparation
set_terminal_width
special_login_handler
strip_ansi_escape_codes
strip_backspaces
strip_command
telnet_login
write_channel