Replies: 2 comments
-
Yeah, but you would probably have to build the driver: Process for adding a driver is here: https://github.com/ktbyers/netmiko/blob/develop/VENDOR.md Process for testing is here: https://github.com/ktbyers/netmiko/blob/develop/TESTING.md If you don't have the background to do it, just let me know. |
Beta Was this translation helpful? Give feedback.
0 replies
-
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
-->Hey Kirk, I edited the Calix B6 code with the following. However I don’t have the background to go any further. """Calix E7 SSH Driver for Netmiko"""from typing import Anyimport timefrom os import path from paramiko import SSHClient from netmiko.cisco_base_connection import CiscoSSHConnectionfrom netmiko.ssh_auth import SSHClient_noauthfrom netmiko.exceptions import NetmikoTimeoutException class CalixE7Base(CiscoSSHConnection): """Common methods for Calix E7, both SSH and Telnet.""" def __init__(self, *args: Any, **kwargs: Any) -> None: default_enter = kwargs.get("default_enter") kwargs["default_enter"] = "\r\n" if default_enter is None else default_enter super().__init__(*args, **kwargs) def session_preparation(self) -> Any: """Prepare the session after the connection has been established.""" self.ansi_escape_codes = True self._test_channel_read(pattern=r"[>#]") self.set_base_prompt() self.set_terminal_width(command="terminal width 511", pattern="terminal") self.disable_paging() def special_login_handler(self, delay_factor: float = 1.0) -> None: """ Calix E7 presents with the following on login: login as: Password: **** """ new_data = "" time.sleep(0.1) start = time.time() login_timeout = 20 while time.time() - start < login_timeout: output = self.read_channel() if not new_data else new_data new_data = "" if output: if "login as:" in output: assert isinstance(self.username, str) self.write_channel(self.username + self.RETURN) elif "Password:" in output: assert isinstance(self.password, str) self.write_channel(self.password + self.RETURN) break time.sleep(0.1) else: # No new data...sleep longer time.sleep(0.5) new_data = self.read_channel() # If still no data, send an <enter> if not new_data: self.write_channel(self.RETURN) else: # no-break msg = """Login process failed to Calix E7 device. Unable to login in {login_timeout} seconds.""" raise NetmikoTimeoutException(msg) def check_config_mode(self, check_string: str = ")#", pattern: str = "") -> bool: """Checks if the device is in configuration mode""" return super().check_config_mode(check_string=check_string) def save_config( self, cmd: str = "copy run start", confirm: bool = False, confirm_response: str = "", ) -> str: return super().save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response ) class CalixE7SSH(CalixB6Base): """Calix E7 SSH Driver. To make it work, we have to override the SSHClient _auth method and manually handle the username/password. """ def _build_ssh_client(self) -> SSHClient: """Prepare for Paramiko SSH connection.""" # Create instance of SSHClient object # If not using SSH keys, we use noauth if not self.use_keys: remote_conn_pre: SSHClient = 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 class CalixE7Telnet(CalixE7Base): """Calix E7 Telnet Driver.""" pass Thanks, Andrew Daley From: Kirk ByersSent: Saturday, 12 March 2022 1:05 pmTo: ktbyers/netmikoCc: Andrew Daley; AuthorSubject: Re: [ktbyers/netmiko] Support for Calix E7 (Discussion #2679) Yeah, but you would probably have to build the driver:Process for adding a driver is here:https://github.com/ktbyers/netmiko/blob/develop/VENDOR.mdProcess for testing is here:https://github.com/ktbyers/netmiko/blob/develop/TESTING.mdIf you don't have the background to do it, just let me know.—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I noticed that there is Calix B6 on the device list. Is it possible to get Calix E7 on the list of supported devices?
Beta Was this translation helpful? Give feedback.
All reactions