Skip to content

Commit

Permalink
Alaxala 2600s and 3600s driver (#3462)
Browse files Browse the repository at this point in the history
Co-authored-by: inabaahome <inasyu.1027@gmail.com>
Co-authored-by: Inaba S <120946763+inaba-vdom-0@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 10, 2024
1 parent 988892e commit ace6062
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions PLATFORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@

- A10
- Accedian
- Alaxala AX2600S and AX3600S
- Allied Telesis AlliedWare Plus
- Aruba OS (Wireless Controllers/WAPs)
- Aruba AOS-CX
Expand Down
3 changes: 3 additions & 0 deletions netmiko/alaxala/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from netmiko.alaxala.alaxala_ax36s import AlaxalaAx36sSSH

__all__ = ["AlaxalaAx36sSSH"]
79 changes: 79 additions & 0 deletions netmiko/alaxala/alaxala_ax36s.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import time
from typing import Optional

from netmiko.cisco_base_connection import CiscoSSHConnection


class AlaxalaAx36sBase(CiscoSSHConnection):
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.disable_paging(command="set terminal pager disable")

def set_base_prompt(
self,
pri_prompt_terminator: str = "#",
alt_prompt_terminator: str = ">",
delay_factor: float = 1.0,
pattern: Optional[str] = None,
) -> str:
base_prompt = super().set_base_prompt(
pri_prompt_terminator=pri_prompt_terminator,
alt_prompt_terminator=alt_prompt_terminator,
delay_factor=delay_factor,
pattern=pattern,
)
self.base_prompt = base_prompt[1:]
return self.base_prompt

def exit_config_mode(self, exit_command: str = "end", pattern: str = "") -> str:
"""
If there are unsaved configuration changes, the prompt is
"Unsaved changes found! Do you exit "configure" without save ? (y/n):" is output.
enter "y" to exit configure mode.
"""
output = ""
if self.check_config_mode():
self.write_channel(self.normalize_cmd(exit_command))
time.sleep(1)
output = self.read_channel()
if "(y/n)" in output:
self.write_channel("y\n")
if self.base_prompt not in output:
output += self.read_until_prompt(read_entire_line=True)
if self.check_config_mode():
raise ValueError("Failed to exit config mode.")
return output

def save_config(
self,
cmd: str = "write",
confirm: bool = False,
confirm_response: str = "",
) -> str:
"""
"save_config" must be executed in config mode.
if the configuration change is not saved,
a "!" will appear at the beginning of the prompt.
"""
output = ""
if not self.check_config_mode():
self.config_mode()
output = self._send_command_timing_str(
command_string=cmd, strip_prompt=False, strip_command=False
)
output += self._send_command_timing_str(
self.RETURN, strip_prompt=False, strip_command=False
)
self.exit_config_mode()
if self.base_prompt not in output:
output += self.read_until_prompt(read_entire_line=True)
return output


class AlaxalaAx36sSSH(AlaxalaAx36sBase):
"""AlaxalA AX36S SSH driver."""

pass
3 changes: 3 additions & 0 deletions netmiko/ssh_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from netmiko.accedian import AccedianSSH
from netmiko.adtran import AdtranOSSSH, AdtranOSTelnet
from netmiko.adva import AdvaAosFsp150F3SSH, AdvaAosFsp150F2SSH
from netmiko.alaxala import AlaxalaAx36sSSH
from netmiko.alcatel import AlcatelAosSSH
from netmiko.allied_telesis import AlliedTelesisAwplusSSH
from netmiko.arista import AristaSSH, AristaTelnet
Expand Down Expand Up @@ -157,6 +158,8 @@
"adtran_os": AdtranOSSSH,
"adva_fsp150f2": AdvaAosFsp150F2SSH,
"adva_fsp150f3": AdvaAosFsp150F3SSH,
"alaxala_ax36s": AlaxalaAx36sSSH,
"alaxala_ax26s": AlaxalaAx36sSSH,
"alcatel_aos": AlcatelAosSSH,
"alcatel_sros": NokiaSrosSSH,
"allied_telesis_awplus": AlliedTelesisAwplusSSH,
Expand Down

0 comments on commit ace6062

Please sign in to comment.