add delay factor
This commit is contained in:
parent
86744e5d81
commit
df0e4da626
|
@ -78,15 +78,11 @@ def connect_to_device(vendor: str, host: str, name: str="") -> ConnectHandler:
|
|||
def send_command(connection: ConnectHandler, command: str) -> str:
|
||||
log.info("send command")
|
||||
try:
|
||||
result: str = connection.send_command(command, read_timeout=cfg.net_dev.read_timeout)
|
||||
result: str = connection.send_command(command, read_timeout=cfg.net_dev.read_timeout, delay_factor=2)
|
||||
log.info('command send success')
|
||||
except exceptions.NetmikoTimeoutException:
|
||||
result = "NetmikoTimeoutException"
|
||||
except exceptions.ReadTimeout:
|
||||
try:
|
||||
result: str = connection.send_command(command, read_timeout=cfg.net_dev.read_timeout)
|
||||
log.info('the second time command send success')
|
||||
except exceptions.ReadTimeout:
|
||||
result = "ReadTimeout"
|
||||
return result
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ class ConfigNetDev:
|
|||
pwd: str = os.getenv("NET_DEV_PWD")
|
||||
ssh_port: int = config["net_dev"].getint("ssh_port")
|
||||
read_timeout: int = config["net_dev"].getint("read_timeout")
|
||||
delay_factor: int = config["net_dev"].getint("delay_factor")
|
||||
debug: bool = config["net_dev"].getboolean("debug")
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ debug: False
|
|||
# Порт на который подключаться по ssh
|
||||
ssh_port: 22
|
||||
read_timeout: 30
|
||||
delay_factor: 2
|
||||
|
||||
[log]
|
||||
# Уровень логов в консоль
|
||||
|
|
Loading…
Reference in New Issue