- self._ssh.connect(node)
- self._tty = self._ssh.interactive_terminal_open()
- self._ssh.interactive_terminal_exec_command(
- self._tty,
- 'sudo -S {}{}'.format(Constants.VAT_BIN_NAME, json_text),
- self.__VAT_PROMPT)
+ self._ssh.connect(self._node)
+ try:
+ self._tty = self._ssh.interactive_terminal_open()
+ except Exception:
+ raise RuntimeError("Cannot open interactive terminal on node {0}".
+ format(self._node))
+
+ for _ in range(3):
+ try:
+ self._ssh.interactive_terminal_exec_command(
+ self._tty,
+ 'sudo -S {0}{1}'.format(Constants.VAT_BIN_NAME, json_text),
+ self.__VAT_PROMPT)
+ except Exception: #pylint: disable=broad-except
+ continue
+ else:
+ break
+ else:
+ vpp_pid = get_vpp_pid(self._node)
+ if vpp_pid:
+ if isinstance(vpp_pid, int):
+ logger.trace("VPP running on node {0}".
+ format(self._node['host']))
+ else:
+ logger.error("More instances of VPP running on node {0}.".
+ format(self._node['host']))
+ else:
+ logger.error("VPP not running on node {0}.".
+ format(self._node['host']))
+ raise RuntimeError("Failed to open VAT console on node {0}".
+ format(self._node['host']))
+