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
9 changes: 8 additions & 1 deletion netmiko/nokia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@
)

from netmiko.nokia.nokia_srl import NokiaSrlSSH
from netmiko.nokia.nokia_isam import NokiaIsamSSH

__all__ = ["NokiaSrosSSH", "NokiaSrosFileTransfer", "NokiaSrosTelnet", "NokiaSrlSSH"]
__all__ = [
"NokiaSrosSSH",
"NokiaSrosFileTransfer",
"NokiaSrosTelnet",
"NokiaSrlSSH",
"NokiaIsamSSH",
]
71 changes: 71 additions & 0 deletions netmiko/nokia/nokia_isam.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import time
import re
from typing import Any

from netmiko.base_connection import BaseConnection
from netmiko.no_enable import NoEnable


class NokiaIsamSSH(BaseConnection, NoEnable):

def session_preparation(self) -> None:
self._test_channel_read()
self.set_base_prompt()
commands = [
"environment inhibit-alarms",
"environment screen-length 0",
]
for command in commands:
self.disable_paging(command=command, cmd_verify=True, pattern=r"#")
time.sleep(0.3 * self.global_delay_factor)
self.clear_buffer()

def set_base_prompt(self, *args: Any, **kwargs: Any) -> str:
"""Remove the > when navigating into the different config level."""
cur_base_prompt = super().set_base_prompt(*args, **kwargs)
match = re.search(r"\*?(.*?)(>.*)*#", cur_base_prompt)
if match:
# strip off >... from base_prompt; strip off leading *
self.base_prompt: str = match.group(1)

return self.base_prompt

def cleanup(self, command: str = "logout") -> None:
"""Gracefully exit the SSH session."""
try:
if self.check_config_mode():
self.exit_config_mode()
except Exception:
pass
# Always try to send final command
if self.session_log:
self.session_log.fin = True
self.write_channel(command + self.RETURN)

def check_config_mode(
self,
check_string: str = "configure#",
pattern: str = "",
force_regex: bool = False,
) -> bool:
"""Use equivalent enable method."""
return super().check_config_mode(check_string=check_string)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? It seems inconsistent with set_base_prompt and what I am seeing on the CLI behavior (but really hard for me to find documentation on this platform so maybe I am wrong here).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default promp is name># and when you go into config mode it becomes name>configure#

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what happens when to the prompt when you traverse down the configuration tree?

I am having a lot of trouble finding documentation on this platform, but it looks to me like it does something like:

name>configure#

And

configure>system>security#

Note, I definitely could be wrong given the difficult obtaining documentation on this platform.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Noppes Any update on my question here?


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

def exit_config_mode(self, exit_config: str = "exit", pattern: str = "") -> str:
return super().exit_config_mode(exit_config=exit_config)

def save_config(
self, cmd: str = "admin save", confirm: bool = False, confirm_response: str = ""
) -> str:
return self._send_command_str(
command_string=cmd,
strip_prompt=False,
strip_command=False,
)
2 changes: 2 additions & 0 deletions netmiko/ssh_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
from netmiko.mrv import MrvOptiswitchSSH
from netmiko.netapp import NetAppcDotSSH
from netmiko.nokia import (
NokiaIsamSSH,
NokiaSrosSSH,
NokiaSrosFileTransfer,
NokiaSrosTelnet,
Expand Down Expand Up @@ -304,6 +305,7 @@
"netapp_cdot": NetAppcDotSSH,
"netgear_prosafe": NetgearProSafeSSH,
"netscaler": NetscalerSSH,
"nokia_isam": NokiaIsamSSH,
"nokia_sros": NokiaSrosSSH,
"nokia_srl": NokiaSrlSSH,
"oneaccess_oneos": OneaccessOneOSSSH,
Expand Down