Handle multiple sub prompts for network_cli connection (#35361)

* Handle multiple sub prompts for network_cli connection

Fixes #35349

*  Check if the same prompt is repeated in consecutive window
   if it is repeated it indicates there is problem with answer
   provided
*  In that case report error to user

* Fix CI failure

* Fixes #35349

*  Add prompt_retry count to control max number of times
   to expect the same prompt before it error's out

*  Make required changes in ios and eos terminal plugin to handle
   wrong enable password correctly and return proper error
   message to user.

*  Check if the same prompt is repeated in consecutive window
   if it is repeated it indicates there is the problem with an answer
   provided

*  In that case report error to user
This commit is contained in:
Ganesh Nalawade 2018-01-31 18:33:23 +05:30 committed by GitHub
parent 63639abb01
commit 9aadd8704a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 20 deletions

View file

@ -94,14 +94,14 @@ class CliconfBase(with_metaclass(ABCMeta, object)):
display.display('closing shell due to command timeout (%s seconds).' % self._connection._play_context.timeout, log_only=True)
self.close()
def send_command(self, command, prompt=None, answer=None, sendonly=False, newline=True):
def send_command(self, command, prompt=None, answer=None, sendonly=False, newline=True, prompt_retry_check=False):
"""Executes a cli command and returns the results
This method will execute the CLI command on the connection and return
the results to the caller. The command output will be returned as a
string
"""
kwargs = {'command': to_bytes(command), 'sendonly': sendonly,
'newline': newline}
'newline': newline, 'prompt_retry_check': prompt_retry_check}
if prompt is not None:
kwargs['prompt'] = to_bytes(prompt)
if answer is not None: