diff --git a/lib/jnpr/junos/transport/tty.py b/lib/jnpr/junos/transport/tty.py
index 204206a47..2b418051f 100644
--- a/lib/jnpr/junos/transport/tty.py
+++ b/lib/jnpr/junos/transport/tty.py
@@ -217,14 +217,19 @@ def _ev_tty_nologin():
# assume we're in a hung state, i.e. we don't see
# a login prompt for whatever reason
self.state = self._ST_TTY_NOLOGIN
- if self.console_has_banner:
- # if console connection has a banner or warning,
- # use this hack
- sleep(5)
- self.write("\n")
- else:
- # @@@ this is still a hack - used by default
- self.write("")
+ # For console based telnet connection a new-line is required.
+ # Code modified to check with a newline for telnet based connections.
+ # Keeping below code as a comment for future enhancement.
+ # if self.console_has_banner:
+ # # if console connection has a banner or warning,
+ # # use this hack
+ # sleep(5)
+ # self.write("\n")
+ sleep(5)
+ self.write("\n")
+ else:
+ # @@@ this is still a hack - used by default
+ self.write("")
def _ev_shell():
if self.state == self._ST_INIT:
diff --git a/lib/jnpr/junos/transport/tty_telnet.py b/lib/jnpr/junos/transport/tty_telnet.py
index 30cef24cc..057676c5a 100644
--- a/lib/jnpr/junos/transport/tty_telnet.py
+++ b/lib/jnpr/junos/transport/tty_telnet.py
@@ -67,7 +67,9 @@ def _tty_open(self):
sleep(self.RETRY_BACKOFF)
else:
raise RuntimeError("open_fail: port not ready")
- self.write("\n")
+ # the below line was added for console based telnet connection as it needs newline to work.
+ # it causes issue in EVO devices. Keeping it as a comment for future enhancement.
+ # self.write("\n")
def _tty_close(self):
self._tn.close()
diff --git a/tests/unit/transport/test_tty.py b/tests/unit/transport/test_tty.py
index b8361e0e3..88129c071 100644
--- a/tests/unit/transport/test_tty.py
+++ b/tests/unit/transport/test_tty.py
@@ -39,6 +39,10 @@ def test_tty_no_login(self, mock_sleep):
self.terminal.read_prompt.return_value = (None, "testing")
self.terminal.write = MagicMock()
self.assertRaises(RuntimeError, self.terminal._login_state_machine)
+ self.terminal.write.assert_called_with("\n")
+ self.terminal.read_prompt.return_value = (None, "testing")
+ self.terminal.write = MagicMock()
+ self.assertRaises(RuntimeError, self.terminal._login_state_machine)
self.terminal.write.assert_called_with("")
@patch("jnpr.junos.transport.tty.sleep")