Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH Support for FS devices #3372

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions netmiko/fs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from netmiko.fs.fs_os import FSOSSSH, FSOSTelnet

__all__ = ["FSOSSSH", "FSOSTelnet"]
39 changes: 39 additions & 0 deletions netmiko/fs/fs_os.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""FS Support"""
import time
from typing import Any

from netmiko.cisco_base_connection import CiscoBaseConnection


class FSOSBase(CiscoBaseConnection):
def session_preparation(self) -> None:
"""Prepare the session after the connection has been established."""
self._test_channel_read(pattern=r"[>#]")
self.set_base_prompt()
"""FS OS requires enable mode to set terminal width"""
self.enable()
self.set_terminal_width(command="terminal width 256", pattern="terminal")
self.disable_paging(command="terminal length 0")
# Clear the read buffer
time.sleep(0.3 * self.global_delay_factor)
self.clear_buffer()

def save_config(
self, cmd: str = "write", confirm: bool = False, confirm_response: str = ""
) -> str:
"""Save config: write"""
return super().save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
)


class FSOSSSH(FSOSBase):

pass


class FSOSTelnet(FSOSBase):
def __init__(self, *args: Any, **kwargs: Any) -> None:
default_enter = kwargs.get("default_enter")
kwargs["default_enter"] = "\r\n" if default_enter is None else default_enter
super().__init__(*args, **kwargs)
2 changes: 2 additions & 0 deletions netmiko/ssh_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
from netmiko.ruckus import RuckusFastironSSH
from netmiko.ruckus import RuckusFastironTelnet
from netmiko.ruijie import RuijieOSSSH, RuijieOSTelnet
from netmiko.fs import FSOSSSH, FSOSTelnet
from netmiko.sixwind import SixwindOSSSH
from netmiko.sophos import SophosSfosSSH
from netmiko.teldat import TeldatCITSSH, TeldatCITTelnet
Expand Down Expand Up @@ -263,6 +264,7 @@
"raisecom_roap": RaisecomRoapSSH,
"ruckus_fastiron": RuckusFastironSSH,
"ruijie_os": RuijieOSSSH,
"fs_os":FSOSSSH,
"sixwind_os": SixwindOSSSH,
"sophos_sfos": SophosSfosSSH,
"supermicro_smis": SmciSwitchSmisSSH,
Expand Down
Loading