Skip to content

Commit

Permalink
use the timer based send command, instead of waiting for the unreliab…
Browse files Browse the repository at this point in the history
…le opengear CLI
  • Loading branch information
yeled committed Feb 24, 2020
1 parent b63cf08 commit 6cef9e4
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions napalm_opengear/opengear.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,11 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)
self.netmiko_optional_args = netmiko_args(optional_args)

def _send_command(self, command):
try:
if isinstance(command, list):
for cmd in command:
output = self.device.send_command(cmd)
if "% Invalid" not in output:
break
else:
output = self.device.send_command(command)
return output
except (socket.error, EOFError) as e:
raise ConnectionException(str(e))
"""Wrapper for Netmiko's send_command_timer method.
We use this because OpenGear prompt is weird.
"""
return self.device.send_command_timing(command)


def cli(self, cmd):
"""send some commands via sudo."""
Expand Down

0 comments on commit 6cef9e4

Please sign in to comment.