Set default command timeout (#98)
* adding read_timeout_override netmiko option --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Petr Klima <petr.klima@madeta.cz>
This commit is contained in:
1 parent
ce7f542df9
commit
6062084fb9
2 files changed
+49
-2
No files matched your search
+2
-2
@@ -100,11 +100,11 @@ class S350Driver(NetworkDriver):
|
|||||||
try:
|
try:
|
||||||
if isinstance(command, list):
|
if isinstance(command, list):
|
||||||
for cmd in command:
|
for cmd in command:
|
||||||
output = self.device.send_command(cmd)
|
output = self.device.send_command(cmd, read_timeout=self.timeout)
|
||||||
if "% Invalid" not in output:
|
if "% Invalid" not in output:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
output = self.device.send_command(command)
|
output = self.device.send_command(command, read_timeout=self.timeout)
|
||||||
return output.strip()
|
return output.strip()
|
||||||
except (socket.error, EOFError) as e:
|
except (socket.error, EOFError) as e:
|
||||||
raise ConnectionClosedException(str(e))
|
raise ConnectionClosedException(str(e))
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# Commands file for utility 'generate_mocked_data.sh'
|
||||||
|
#
|
||||||
|
# This will help you to make bunch of command output files for napalm drivers unit tests
|
||||||
|
#
|
||||||
|
# There is not any IP, MAC or names obfuscation or anonymizations!
|
||||||
|
# Before using outputs as a unit test files it is recommendet to protect
|
||||||
|
# your privacy information yourself by editing output files.
|
||||||
|
|
||||||
|
# Available variables
|
||||||
|
# $INTERFACE - for detailed interface information
|
||||||
|
# $LLDPINTERFACE - for detailed LLDP information
|
||||||
|
|
||||||
|
# Define empty array of commands
|
||||||
|
COMMANDS=()
|
||||||
|
|
||||||
|
# This is example set of commands for napalm driver 's350' (Cisco SMB)
|
||||||
|
|
||||||
|
# system info
|
||||||
|
COMMANDS+=("show version")
|
||||||
|
COMMANDS+=("show system")
|
||||||
|
COMMANDS+=("show inventory")
|
||||||
|
|
||||||
|
# config commands
|
||||||
|
COMMANDS+=("show startup-config")
|
||||||
|
COMMANDS+=("show running-config")
|
||||||
|
COMMANDS+=("show running-config detailed")
|
||||||
|
|
||||||
|
# interface commands
|
||||||
|
COMMANDS+=("show interfaces status")
|
||||||
|
COMMANDS+=("show interfaces description")
|
||||||
|
COMMANDS+=("show interface switchport $INTERFACE")
|
||||||
|
COMMANDS+=("show ports jumbo-frame")
|
||||||
|
|
||||||
|
# ip commands
|
||||||
|
COMMANDS+=("show hosts")
|
||||||
|
COMMANDS+=("show ip interface")
|
||||||
|
COMMANDS+=("show ipv6 interface brief")
|
||||||
|
COMMANDS+=("show arp")
|
||||||
|
|
||||||
|
# lldp commands
|
||||||
|
COMMANDS+=("show lldp neighbors")
|
||||||
|
COMMANDS+=("show lldp local $LLDPINTERFACE")
|
||||||
|
COMMANDS+=("show lldp neighbors $LLDPINTERFACE")
|
||||||
|
|
||||||
|
# ntp commands
|
||||||
|
COMMANDS+=("show sntp status")
|
||||||
|
|
||||||
Reference in new issue
Block a user