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

Fix correction of ansi characters of next line #7

Open
wants to merge 91 commits into
base: v4.2.0-unyc
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
e517229
Update PLATFORMS.md to include audiocodes
ktbyers Aug 9, 2022
b0d5fb3
Added Cisco IOSXE and Ericsson IPOS platforms to SSH autodetect
bleuzkernel Aug 11, 2022
cfb7f07
Merge pull request #2898 from bleuzkernel/sshautodetect
ktbyers Aug 11, 2022
7aac84d
Added sleep to wait for session closure on old wlc
mfr-6 Jul 28, 2022
1b20b8e
Fix IOS-XR commit prompting issue, FIXES#2773 (#2925)
ktbyers Sep 1, 2022
6505dcc
Fix API docs link (#2926)
ktbyers Sep 1, 2022
55bcad6
Setting adtran terminal width (#2927)
ktbyers Sep 1, 2022
f3b5da2
Fix issue where check_file_exists_unix was incorrectly reporting a fi…
ktbyers Sep 2, 2022
8f30aa9
Improve Arista duplicate echo issue (#2944)
ktbyers Sep 13, 2022
2bf0184
Fix Huawei telnet regex pattern issue
TimGa Sep 16, 2022
5b6d5a9
Add support for scp on Ubiquiti edgerouter (#2950)
elavaud Sep 19, 2022
1685b3d
Added support for Arris CER and Casa CMTS platforms. (#2958)
vangesseld Sep 30, 2022
46a4dac
Remove config mode to MikroTik (#2957)
k-ribot Sep 30, 2022
6e6a8af
Fix issue #2973 with changing string for Cisco WLC for autodetect (#2…
ktbyers Oct 6, 2022
b3591d5
Add cisco viptela autodetect support (#2975)
ktbyers Oct 6, 2022
5ca2ea6
Simpler disabled algorithms for Paramiko server-sig-algs issue (#2979)
ktbyers Oct 7, 2022
595a4ad
Huawei - allow vrp versions < 8 (#3000)
elavaud Oct 26, 2022
b0f61a0
Revert pinning of textfsm (#3003)
jbemmel Oct 29, 2022
ac5cb8c
Mikrotik license handling (#3011)
ktbyers Oct 29, 2022
2c924cb
Update ssh_autodetect.py for Cisco WLC changes (#3020)
Nov 7, 2022
af18efa
Snmpdetect fix cisco_ios detection and add routeros (#3038)
kacem-expereo Dec 14, 2022
079b3ab
IPV6 support for SNMPDetect(#3027) (#3028)
kacem-expereo Dec 14, 2022
4e8f148
Fixing missing msg in ConnLogOnly (#3055)
ktbyers Dec 15, 2022
75b2e10
Trying to improve SSH autodetect for slow devices (#3056)
ktbyers Jan 6, 2023
f19ba68
Improving SSH autodetect for slow devices (#3074)
ktbyers Jan 9, 2023
b471b2a
dell: fix save_config for Dell Force10 / OS9 devices (#3070)
jonglezb Jan 13, 2023
7bf86af
Improve performance for Dell force10 and OS10 devices (#3069)
jonglezb Jan 13, 2023
ce8ac10
Minor fix to check_config_mode argument (#3082)
ktbyers Jan 13, 2023
1db1ca5
Fix oneos terminal width issue (#3080)
ktbyers Jan 13, 2023
372d986
Updated Adva drivers (#3079)
ktbyers Jan 13, 2023
056e727
Updated Hillstone StoneOS Driver (#3084)
ktbyers Jan 20, 2023
45ac460
Update adva_aos_fsp_150_f3.py (#3092)
guychilton77 Jan 26, 2023
507cfcc
Improve Fortinet driver (#3091)
ktbyers Jan 27, 2023
9dfad3b
Updated BaseConnection docstrings (#3095)
MarkWine Jan 30, 2023
a9d54d0
Docstring Updates (#3097)
ktbyers Jan 31, 2023
91497f6
Improve Palo-Alto login behavior due to fast echo of set cli scriptin…
ktbyers Feb 1, 2023
71122b9
Handle post-login yes/no acceptance on Huawei OLT (#3099)
ktbyers Feb 7, 2023
b610ebc
Extreme ERS handle additional 'Press ENTER to continue' msg (#3100)
ktbyers Feb 7, 2023
c199d7a
Upgrade to mypy 1.0.0 to fix CI-CD breakage (#3106)
ktbyers Feb 8, 2023
e458edb
Fixing issue with parenthesis and capture-group overlap for audiocode…
ktbyers Feb 8, 2023
97a0a84
Unit tests macos (#3107)
ktbyers Feb 10, 2023
69a69f6
Convert over to use Poetry (#3111)
ktbyers Feb 13, 2023
84c271f
Remove setup.py and requirements files (#3112)
ktbyers Feb 13, 2023
fe32145
Fix fortinet _get_output_mode_v7 when in multiple VDOM mode (#3115)
ktbyers Feb 14, 2023
b4916b9
Update pyats and genie (#3118)
ktbyers Feb 16, 2023
60b6971
Fix broken linter setup (pylama) (#3119)
ktbyers Feb 17, 2023
28ea0ae
Add oneaccess autodetect support (#3108)
bilalel Feb 18, 2023
973081a
ssh_autodetect fix for IOS XR (#3136)
davidox8 Mar 12, 2023
3f53bbf
add hp_procurve in ssh mapper dict for autodetect (#3132)
robinreinhardt Mar 12, 2023
2869ea4
Fix missing logo issue in EXAMPLES.md (#3139)
sharteeya Mar 14, 2023
a9be4d3
Pin to specific ubuntu version (#3153)
ktbyers Mar 30, 2023
578475a
Fix Huawei save_config behavior (#3161)
ktbyers Apr 11, 2023
9099f8b
Update dependencies for CI-CD (#3167)
ktbyers Apr 17, 2023
6edb519
Teldata CIT Driver (#3168)
ktbyers Apr 18, 2023
66e2351
Extreme ERS handle menu (#3169)
ktbyers Apr 18, 2023
e5723e4
Ciena fixes (#3170)
ktbyers Apr 18, 2023
5da1955
Cisco S200 Driver (#3171)
ktbyers Apr 18, 2023
0b047a1
Make Huawei telnet login consistent with SSH login (#3173)
ktbyers Apr 18, 2023
fdabb06
Add poetry install process for Netmiko 'develop' branch (#3174)
ktbyers Apr 19, 2023
e13564b
Ruckus Fastiron- Added "Login" as a RADIUS login option (#3179)
MitchAxtell Apr 27, 2023
aa88db2
Fix hostname change issue with commit on Junos (#3180)
ktbyers Apr 27, 2023
8cc0cd5
Add better support for read_timeout in send_config_set() particularly…
ktbyers May 3, 2023
dc5a604
Added support for Ericsson MINI-LINK (MLTN) 66XX & 63XX (updated) (#3…
ktbyers May 3, 2023
df617da
Add Netmiko entry points to Poetry (and corresponding tests) (#3192)
ktbyers May 4, 2023
070b01d
Improve behavior of normalize_linefeeds() method (#3193)
ktbyers May 4, 2023
a463d95
Add a check_state argument to enable() method (#3194)
ktbyers May 4, 2023
1b78c19
Update docs for Netmiko Release 4.2.0
ktbyers May 5, 2023
f808ab1
Roll version (#3197)
ktbyers May 5, 2023
9c84582
Performance graph updates for Netmiko 4.2.0 (#3201)
ktbyers May 5, 2023
f5bf592
Updating platforms.md for new drivers (#3202)
ktbyers May 5, 2023
e489d99
Update the supported device types in PLATFORMS.md (#3203)
ktbyers May 5, 2023
a05a935
merge conflict
ktbyers May 5, 2023
37b604d
Fix ciena logic (#3214)
ktbyers May 19, 2023
a10cf1a
nokia_sros: Disable paging in both CLI modes, independent of initial …
melewitz May 19, 2023
d8ef21d
Remove Arris and Casa from SSH autodetect (#2967)
ktbyers May 19, 2023
e07b787
Linux genie support (#3217)
ktbyers May 19, 2023
47820f7
Tplink read issue in session_preparation() (#3215)
ktbyers May 19, 2023
79b37bc
[MikroTik] Corrected the terminal size definition (#3228)
k-ribot Jun 9, 2023
c5038d3
Added search string to catch virtual arista devices (#3221)
carbonarok Jun 9, 2023
d7b956e
Fix hostnames and snmp autodetect issue (#3230)
ktbyers Jun 9, 2023
9b5137f
Fiberstore FSOS driver (#3231)
ktbyers Jun 9, 2023
0107c79
Fix bug in handling of subdirectories in remote_file_size #2168 (#3199)
dystland Jun 9, 2023
0f7def6
Implement TelnetFallback entry point to Netmiko (#3232)
ktbyers Jun 9, 2023
5f9eaa9
Improve Extreme SLX-OS autodetect (#3233)
ktbyers Jun 9, 2023
286cdd7
Updating to single command to parse 'set output mode' (#3248)
msozer-dn Jul 19, 2023
19d7ea5
Fix CI-CD breaking (#3255)
ktbyers Jul 19, 2023
20baa4e
Fix broken download badge (#3270)
ktbyers Aug 16, 2023
2e56b40
Drop PY3.7 support; restore PY3.11 to CI-CD (#3278)
ktbyers Aug 29, 2023
2e6c4d5
Add driver placeholder (#3283)
ktbyers Sep 1, 2023
824e2e6
Zyxel: Corrected inherited class
k-ribot Sep 5, 2023
9dee344
Zyxel: Correction of ANSI characters of next line
k-ribot Sep 5, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: linters
strategy:
matrix:
python-version: [ '3.10' ]
python-version: [ '3.11' ]
platform: [ubuntu-20.04]

runs-on: ${{ matrix.platform }}
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
shell: bash
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
platform: [ubuntu-20.04]

runs-on: ${{ matrix.platform }}
Expand Down
29 changes: 23 additions & 6 deletions PLATFORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
###### Regularly tested

- Arista vEOS
- Cisco ASA
- Cisco IOS
- Cisco IOS-XE
- Cisco IOS-XR
Expand All @@ -17,24 +16,30 @@

- 6Wind
- Adtran OS
- Adva AOS FSP150
- Adva AOS FSP150 F2 & F3
- Alcatel AOS6/AOS8
- Apresia Systems AEOS
- ARRIS CER
- AudioCodes Gateways & Controllers
- Broadcom ICOS
- Calix B6
- Casa Systems CMTS
- Centec Networks
- Cisco AireOS (Wireless LAN Controllers)
- Cisco ASA
- Cisco S200
- CloudGenix ION
- Dell OS9 (Force10)
- Dell OS10
- Dell PowerConnect
- Ericsson IPOS
- Ericsson MINI-LINK 66XX & 63XX
- Extreme ERS (Avaya)
- Extreme MLX/NetIron (Brocade/Foundry)
- Extreme TierraOS
- Extreme VDX (Brocade)
- Extreme VSP (Avaya)
- Fiberstore FSOS
- Hillstone StoneOS
- HPE Comware7
- Huawei
Expand All @@ -55,6 +60,7 @@
- Ruckus ICX/FastIron
- Ruijie Networks
- Supermicro SMIS
- Teldat CIT
- TPLink JetStream
- Ubiquiti EdgeSwitch
- Vyatta VyOS
Expand All @@ -67,10 +73,8 @@
- Accedian
- Allied Telesis AlliedWare Plus
- Aruba
- Arris CER
- Brocade Fabric OS
- C-DOT CROS
- Casa CMTS
- Ciena SAOS
- Citrix Netscaler
- Cisco Telepresence
Expand Down Expand Up @@ -118,6 +122,9 @@
- aruba_os
- aruba_osswitch
- aruba_procurve
- audiocode_66
- audiocode_72
- audiocode_shell
- avaya_ers
- avaya_vsp
- broadcom_icos
Expand All @@ -137,6 +144,7 @@
- cisco_ftd
- cisco_ios
- cisco_nxos
- cisco_s200
- cisco_s300
- cisco_tp
- cisco_viptela
Expand All @@ -159,6 +167,8 @@
- endace
- enterasys
- ericsson_ipos
- ericsson_mltn63
- ericsson_mltn66
- extreme
- extreme_ers
- extreme_exos
Expand All @@ -182,6 +192,7 @@
- huawei
- huawei_olt
- huawei_smartax
- huawei_vrp
- huawei_vrpv8
- ipinfusion_ocnos
- juniper
Expand All @@ -199,8 +210,8 @@
- netapp_cdot
- netgear_prosafe
- netscaler
- nokia_sros
- nokia_srl
- nokia_sros
- oneaccess_oneos
- ovs_linux
- paloalto_panos
Expand All @@ -213,6 +224,7 @@
- sixwind_os
- sophos_sfos
- supermicro_smis
- teldat_cit
- tplink_jetstream
- ubiquiti_edge
- ubiquiti_edgerouter
Expand All @@ -231,13 +243,17 @@
- apresia_aeos_telnet
- arista_eos_telnet
- aruba_procurve_telnet
- audiocode_72_telnet
- audiocode_66_telnet
- audiocode_shell_telnet
- brocade_fastiron_telnet
- brocade_netiron_telnet
- calix_b6_telnet
- centec_os_telnet
- ciena_saos_telnet
- cisco_ios_telnet
- cisco_xr_telnet
- cisco_s200_telnet
- cisco_s300_telnet
- dell_dnos6_telnet
- dell_powerconnect_telnet
Expand All @@ -261,6 +277,7 @@
- ruckus_fastiron_telnet
- ruijie_os_telnet
- supermicro_smis_telnet
- teldat_cit_telnet
- tplink_jetstream_telnet
- yamaha_telnet
- zte_zxros_telnet
Expand All @@ -279,4 +296,4 @@
- juniper_junos
- linux
- nokia_sros

- ubiquiti_edgerouter
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/netmiko.svg)](https://img.shields.io/pypi/pyversions/netmiko)
[![PyPI](https://img.shields.io/pypi/v/netmiko.svg)](https://pypi.python.org/pypi/netmiko)
[![Downloads](https://pepy.tech/badge/netmiko)](https://pepy.tech/project/netmiko)
[![Downloads](https://static.pepy.tech/badge/netmiko)](https://static.pepy.tech/badge/netmiko)
[![GitHub contributors](https://img.shields.io/github/contributors/ktbyers/netmiko.svg)](https://GitHub.com/ktbyers/netmiko/graphs/contributors/)
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

Expand Down
4 changes: 2 additions & 2 deletions _release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ while true; do
esac
done

pylama
pylama .
if [ $? -eq 0 ]; then
echo
echo "pylama ... [OK]"
Expand All @@ -32,7 +32,7 @@ else
fi

echo
python setup.py sdist bdist_wheel > /dev/null
poetry build > /dev/null
if [ $? -eq 0 ]; then
echo "creating distribution ... [OK]"
ls -ltr $DIR_PACKAGE
Expand Down
2 changes: 2 additions & 0 deletions netmiko/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def check_python_version(): # type: ignore


from netmiko.ssh_dispatcher import ConnectHandler # noqa
from netmiko.ssh_dispatcher import TelnetFallback # noqa
from netmiko.ssh_dispatcher import ConnLogOnly # noqa
from netmiko.ssh_dispatcher import ConnUnify # noqa
from netmiko.ssh_dispatcher import ssh_dispatcher # noqa
Expand Down Expand Up @@ -66,6 +67,7 @@ def check_python_version(): # type: ignore

__all__ = (
"ConnectHandler",
"AgnosticHandler",
"ConnLogOnly",
"ConnUnify",
"ssh_dispatcher",
Expand Down
2 changes: 1 addition & 1 deletion netmiko/ciena/ciena_saos.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def set_base_prompt(
prompt = self.find_prompt(delay_factor=delay_factor)

pattern = rf"^.+{self.prompt_pattern}$"
if re.search(pattern, prompt):
if not re.search(pattern, prompt):
raise ValueError(f"Router prompt not found: {repr(prompt)}")
# Strip off trailing terminator
self.base_prompt = prompt[:-1]
Expand Down
3 changes: 3 additions & 0 deletions netmiko/fiberstore/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from netmiko.fiberstore.fiberstore_fsos import FiberstoreFsosSSH

__all__ = ["FiberstoreFsosSSH"]
108 changes: 108 additions & 0 deletions netmiko/fiberstore/fiberstore_fsos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
"""Fiberstore FSOS Driver."""
from typing import Optional
from paramiko import SSHClient
from netmiko.ssh_auth import SSHClient_noauth
from netmiko.no_enable import NoEnable
import time
from os import path
from netmiko.cisco_base_connection import CiscoSSHConnection
from netmiko.exceptions import NetmikoAuthenticationException


class FiberstoreFsosSSH(NoEnable, CiscoSSHConnection):
"""
Fiberstore FSOS uses a non-standard SSH login mechanism. Consequently,
to make the login work, we have to override the SSHClient _auth method.
"""

def session_preparation(self) -> None:
"""Prepare the session after the connection has been established."""
self.ansi_escape_codes = True
output = self._test_channel_read()
if "% Authentication Failed" in output:
assert self.remote_conn is not None
self.remote_conn.close()
msg = f"Login failed: {self.host}"
raise NetmikoAuthenticationException(msg)

self.set_base_prompt()
self.disable_paging(command="terminal length 0")
# Clear the read buffer
time.sleep(0.3 * self.global_delay_factor)
self.clear_buffer()

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

def check_config_mode(
self,
check_string: str = "(config)#",
pattern: str = "",
force_regex: bool = False,
) -> bool:
return super().check_config_mode(
check_string=check_string, pattern=pattern, force_regex=force_regex
)

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 _build_ssh_client(self) -> SSHClient:
"""Allows you to bypass standard SSH auth while still supporting SSH keys."""

# If user does not provide SSH key, we use noauth
remote_conn_pre: SSHClient
if not self.use_keys:
remote_conn_pre = SSHClient_noauth()
else:
remote_conn_pre = SSHClient()

# Load host_keys for better SSH security
if self.system_host_keys:
remote_conn_pre.load_system_host_keys()
if self.alt_host_keys and path.isfile(self.alt_key_file):
remote_conn_pre.load_host_keys(self.alt_key_file)

# Default is to automatically add untrusted hosts (make sure appropriate for your env)
remote_conn_pre.set_missing_host_key_policy(self.key_policy)
return remote_conn_pre

def special_login_handler(self, delay_factor: float = 1.0) -> None:
"""
Fiberstore S3200 presents with the following on login
Username:
Password: ****
"""
delay_factor = self.select_delay_factor(delay_factor)
i = 0
output = ""
while i <= 12:
i += 1
time.sleep(delay_factor)
output = self.read_channel()
if output:
if "Username:" in output:
assert self.username is not None
self.write_channel(self.username + self.RETURN)
elif "Password:" in output:
assert self.password is not None
self.write_channel(self.password + self.RETURN)
return
8 changes: 1 addition & 7 deletions netmiko/fortinet/fortinet_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,7 @@ def _get_output_mode_v6(self) -> str:
if self._vdoms:
self._config_global()

self._send_command_str(
"config system console", expect_string=self.prompt_pattern
)
output = self._send_command_str(
"show full-configuration", expect_string=self.prompt_pattern
)
self._send_command_str("end", expect_string=self.prompt_pattern)
output = self._send_command_str("show full-configuration system console")

if self._vdoms:
self._exit_config_global()
Expand Down
6 changes: 3 additions & 3 deletions netmiko/mikrotik/mikrotik_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def _modify_connection_params(self) -> None:
c: disable console colors
e: enable dumb terminal mode
t: disable auto detect terminal capabilities
w511: set term width
h4098: set term height
511w: set term width
4098h: set term height
"""
self.username += "+ctw511h4098"
self.username += "+ct511w4098h"

def disable_paging(self, *args: Any, **kwargs: Any) -> str:
"""Mikrotik does not have paging by default."""
Expand Down
3 changes: 2 additions & 1 deletion netmiko/nokia/nokia_sros.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ def session_preparation(self) -> None:
command="environment console width 512", pattern="environment"
)
self.disable_paging(command="environment more false")
# To perform file operations we need to disable paging in classical-CLI also
self.disable_paging(command="//environment no more")
else:
# Classical CLI has no method to set the terminal width nor to disable command
# complete on space; consequently, cmd_verify needs disabled.
# Only disabled if not set under the ConnectHandler.
if self.global_cmd_verify is None:
self.global_cmd_verify = False
# Disable paging in both modes, file operations require no paging in classic
self.disable_paging(command="//environment more false")
self.disable_paging(command="environment no more", pattern="environment")

# Clear the read buffer
Expand Down
3 changes: 2 additions & 1 deletion netmiko/scp_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ def remote_file_size(
remote_out = "".join(remote_out_lines)
# Match line containing file name
assert isinstance(remote_file, str)
escape_file_name = re.escape(remote_file)
remote_file_base = os.path.basename(remote_file)
escape_file_name = re.escape(remote_file_base)
pattern = r".*({}).*".format(escape_file_name)
match = re.search(pattern, remote_out)
if match:
Expand Down
Loading
Loading