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
2 changes: 2 additions & 0 deletions PLATFORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
- Fortinet
- Garderos GRS
- Genexis Saturn SOLT33 (telnet only)
- Hirschmann HiOS
- Lancom LCOS SX4
- Moxa EDS
- MRV Communications OptiSwitch
Expand Down Expand Up @@ -233,6 +234,7 @@
- generic_termserver
- h3c_comware
- hillstone_stoneos
- hirschmann_hios
- hp_comware
- hp_procurve
- huawei
Expand Down
3 changes: 3 additions & 0 deletions netmiko/hirschmann/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from netmiko.hirschmann.hirschmann_hios import HirschmannHiOSSSH

__all__ = ["HirschmannHiOSSSH"]
29 changes: 29 additions & 0 deletions netmiko/hirschmann/hirschmann_hios.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Tested with Hirschmann BRS20 (Bobcat Rail Switch) running HiOS.
"""

from netmiko.cisco_base_connection import CiscoBaseConnection


class HirschmannHiOSBase(CiscoBaseConnection):
"""Base class for Hirschmann HiOS devices."""

def session_preparation(self) -> None:
"""Prepare the session after the connection has been established."""
self._test_channel_read(pattern=r"[>#]")
self.set_base_prompt()
self.disable_paging(command="cli numlines 0")

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


class HirschmannHiOSSSH(HirschmannHiOSBase):
"""Hirschmann HiOS SSH driver."""

pass
5 changes: 5 additions & 0 deletions netmiko/snmp_autodetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@
"expr": re.compile(r".*RouterOS.*", re.IGNORECASE),
"priority": 60,
},
"hirschmann_hios": {
"oid": ".1.3.6.1.2.1.1.1.0",
"expr": re.compile(r".*Hirschmann BOBCAT.*"),
"priority": 60,
},
}

# Ensure all SNMP device types are supported by Netmiko
Expand Down
36 changes: 36 additions & 0 deletions netmiko/ssh_autodetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@
"priority": 99,
"dispatch": "_autodetect_std",
},
"hirschmann_hios": {
"cmd": "",
"search_patterns": [r"Release HiOS-"],
"re_flags": 0,
"priority": 99,
"dispatch": "_autodetect_login_banner",
},
"hp_comware": {
"cmd": "display version",
"search_patterns": ["HPE Comware", "HP Comware"],
Expand Down Expand Up @@ -574,6 +581,35 @@ def _autodetect_remote_version(
return 0
return 0

def _autodetect_login_banner(
self,
search_patterns: Optional[List[str]] = None,
re_flags: int = re.IGNORECASE,
priority: int = 99,
**kwargs: Any
) -> int:
"""
Method to try auto-detect the device type, by matching a regular expression on the
login banner.

Parameters
----------
search_patterns : list
A list of regular expression to look for in the login banner (default: None).
re_flags: re.flags, optional
Any flags from the python re module to modify the regular expression
(default: re.IGNORECASE).
priority: int, optional
The confidence the match is right between 0 and 99 (default: 99).
"""
if not search_patterns:
return 0
for pattern in search_patterns:
match = re.search(pattern, self.initial_buffer, flags=re_flags)
if match:
return priority
return 0

def _autodetect_std(
self,
cmd: str = "",
Expand Down
2 changes: 2 additions & 0 deletions netmiko/ssh_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
from netmiko.garderos import GarderosGrsSSH
from netmiko.genexis import GenexisSOLT33Telnet
from netmiko.hillstone import HillstoneStoneosSSH
from netmiko.hirschmann.hirschmann_hios import HirschmannHiOSSSH
from netmiko.hp import HPProcurveSSH, HPProcurveTelnet, HPComwareSSH, HPComwareTelnet
from netmiko.huawei import HuaweiSSH, HuaweiVrpv8SSH, HuaweiTelnet
from netmiko.huawei import HuaweiSmartAXSSH, HuaweiSmartAXSSHMMI
Expand Down Expand Up @@ -279,6 +280,7 @@
"generic_termserver": TerminalServerSSH,
"h3c_comware": HPComwareSSH,
"hillstone_stoneos": HillstoneStoneosSSH,
"hirschmann_hios": HirschmannHiOSSSH,
"hp_comware": HPComwareSSH,
"hp_procurve": HPProcurveSSH,
"huawei": HuaweiSSH,
Expand Down