Skip to content
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
1 change: 1 addition & 0 deletions PLATFORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- ARRIS CER
- Aruba OS Switch
- AudioCodes Gateways & Controllers
- Aviat WTM Outdoor Radio
- Broadcom ICOS
- Calix B6
- Casa Systems CMTS
Expand Down
3 changes: 3 additions & 0 deletions netmiko/aviat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from netmiko.aviat.aviat_ssh import AviatWTMSSH

__all__ = ["AviatWTMSSH"]
77 changes: 77 additions & 0 deletions netmiko/aviat/aviat_ssh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from typing import Optional
from netmiko.no_enable import NoEnable
from netmiko.cisco_base_connection import CiscoSSHConnection


class AviatWTMSSH(NoEnable, CiscoSSHConnection):
"""Aviat WTM Outdoor Radio support"""

def session_preparation(self) -> None:
self._test_channel_read()
self.disable_paging()
self.set_base_prompt()

def disable_paging(
self,
command: str = "session paginate false",
delay_factor: Optional[float] = None,
cmd_verify: bool = True,
pattern: Optional[str] = None,
) -> str:
return self.send_config_set(
config_commands=command,
)

def find_prompt(
self, delay_factor: float = 1.0, pattern: Optional[str] = r"[$>#]"
) -> str:
return super().find_prompt(delay_factor=delay_factor, pattern=pattern)

def exit_config_mode(
self,
exit_config: str = "end",
pattern: str = r"(?:Uncommitted changes.*CANCEL|#)",
) -> str:
"""
Exits from configuration mode. Overwritten from base class because the device
prompts to save uncommitted changes when exiting config mode and requires user confirmation.
If 'Uncommitted changes found' is detected in the output, the function sends a 'confirm'
command.
"""
confirm: str = "yes"
output = ""
if self.check_config_mode():
self.write_channel(self.normalize_cmd(exit_config))
# Make sure you read until you detect the command echo (avoid getting out of sync)
if self.global_cmd_verify is not False:
output += self.read_until_pattern(pattern=exit_config)
# Read until we detect the uncommitted changes pattern or the usual prompt pattern
output += self.read_until_pattern(pattern=pattern)
# If uncommitted changes were found, confirm them
if "Uncommitted changes found" in output:
self.write_channel(self.normalize_cmd(confirm))
output += self.read_until_pattern(pattern=r"[$>#]")
if self.check_config_mode():
raise ValueError("Failed to exit configuration mode")
return output

def config_mode(
self,
config_command: str = "config",
pattern: str = "",
re_flags: int = 0,
) -> str:
return super().config_mode(
config_command=config_command, pattern=pattern, re_flags=re_flags
)

def save_config(
self, cmd: str = "", confirm: bool = False, confirm_response: str = ""
) -> str:
"""
Aviat WTM Outdoor Radio does not have a 'save config' command. Instead,
when changes are detected in config mode, the user is prompted to commit these
changes. This happens either when trying to exit config mode or when the 'commit'
command is typed in config mode.
"""
raise NotImplementedError
7 changes: 4 additions & 3 deletions netmiko/ssh_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Audiocode66Telnet,
AudiocodeShellTelnet,
)

from netmiko.aviat import AviatWTMSSH
from netmiko.bintec import BintecBossSSH, BintecBossTelnet
from netmiko.brocade import BrocadeFOSSSH
from netmiko.broadcom import BroadcomIcosSSH
Expand Down Expand Up @@ -150,6 +150,8 @@
from netmiko.silverpeak import SilverPeakVXOASSH
from netmiko.sixwind import SixwindOSSSH
from netmiko.sophos import SophosSfosSSH
from netmiko.supermicro import SmciSwitchSmisSSH
from netmiko.supermicro import SmciSwitchSmisTelnet
from netmiko.teldat import TeldatCITSSH, TeldatCITTelnet
from netmiko.telcosystems import TelcoSystemsBinosSSH, TelcoSystemsBinosTelnet
from netmiko.terminal_server import TerminalServerSSH, TerminalServerTelnet
Expand All @@ -164,8 +166,6 @@
from netmiko.yamaha import YamahaTelnet
from netmiko.zte import ZteZxrosSSH
from netmiko.zte import ZteZxrosTelnet
from netmiko.supermicro import SmciSwitchSmisSSH
from netmiko.supermicro import SmciSwitchSmisTelnet
from netmiko.zyxel import ZyxelSSH

if TYPE_CHECKING:
Expand Down Expand Up @@ -200,6 +200,7 @@
"audiocode_shell": AudiocodeShellSSH,
"avaya_ers": ExtremeErsSSH,
"avaya_vsp": ExtremeVspSSH,
"aviat_wtm": AviatWTMSSH,
"bintec_boss": BintecBossSSH,
"broadcom_icos": BroadcomIcosSSH,
"brocade_fos": BrocadeFOSSSH,
Expand Down
2 changes: 0 additions & 2 deletions tests/test_netmiko_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ def test_send_command_genie(net_connect, commands, expected_responses):


def test_send_multiline_timing(net_connect):

debug = False

if (
Expand All @@ -237,7 +236,6 @@ def test_send_multiline_timing(net_connect):


def test_send_multiline(net_connect):

debug = False
if (
"cisco_ios" not in net_connect.device_type
Expand Down