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

Aruba AOS-CX vendor module #3393

Merged
merged 4 commits into from
May 3, 2024
Merged
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: 2 additions & 1 deletion netmiko/aruba/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from netmiko.aruba.aruba_ssh import ArubaSSH
from netmiko.aruba.aruba_aoscx_ssh import ArubaAosCxSSH

__all__ = ["ArubaSSH"]
__all__ = ["ArubaSSH", "ArubaAosCxSSH"]
48 changes: 48 additions & 0 deletions netmiko/aruba/aruba_aoscx_ssh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""
Aruba AOS CX support.

For use with Aruba AOS CX devices.

"""
from typing import Any
from netmiko.cisco_base_connection import CiscoSSHConnection


class ArubaAosCxSSH(CiscoSSHConnection):
"""Aruba AOS CX support"""

def __init__(self, **kwargs: Any) -> None:
if kwargs.get("default_enter") is None:
kwargs["default_enter"] = "\r"
return super().__init__(**kwargs)

def session_preparation(self) -> None:
# Aruba switches output ansi codes TODO: does Aos CX do?
self.ansi_escape_codes = True
self._test_channel_read(pattern=r"[>#]")
self.set_base_prompt()
self.disable_paging(command="no page")

def check_config_mode(
self,
check_string: str = "(config)#",
pattern: str = r"[>#]",
force_regex: bool = False,
) -> bool:
"""
Checks if the device is in configuration mode or not.

Aruba uses "(<controller name>)(config)#" as config prompt
"""
return super().check_config_mode(check_string=check_string, pattern=pattern)

def config_mode(
self,
config_command: str = "configure term",
pattern: str = "",
re_flags: int = 0,
) -> str:
"""Aruba auto completes on space so 'configure' needs fully spelled-out."""
return super().config_mode(
config_command=config_command, pattern=pattern, re_flags=re_flags
)
3 changes: 2 additions & 1 deletion netmiko/ssh_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from netmiko.arista import AristaFileTransfer
from netmiko.arris import ArrisCERSSH
from netmiko.apresia import ApresiaAeosSSH, ApresiaAeosTelnet
from netmiko.aruba import ArubaSSH
from netmiko.aruba import ArubaSSH, ArubaAosCxSSH
from netmiko.audiocode import (
Audiocode72SSH,
Audiocode66SSH,
Expand Down Expand Up @@ -160,6 +160,7 @@
"arista_eos": AristaSSH,
"arris_cer": ArrisCERSSH,
"aruba_os": ArubaSSH,
"aruba_aoscx": ArubaAosCxSSH,
"aruba_osswitch": HPProcurveSSH,
"aruba_procurve": HPProcurveSSH,
"audiocode_72": Audiocode72SSH,
Expand Down
Loading