|
@@ -152,14 +152,21 @@ class ObjectTelnet(ObjectConnection):
|
|
|
:param command:
|
|
|
:param expected: Expected string to stop listening
|
|
|
"""
|
|
|
+ self.command_print(command)
|
|
|
command = command.strip()
|
|
|
- if not (command[:-1] == self.NEW_LINE_UNIX or command[:-2] == self.NEW_LINE_WINDOWS):
|
|
|
- self.command_print(command)
|
|
|
- if not self.command_enable(command) and not self.command_quit(command):
|
|
|
- command = command.rstrip(self.NEW_LINE_WINDOWS).rstrip(self.NEW_LINE_UNIX)
|
|
|
- if command.__len__() > 0:
|
|
|
- self.tn.write(command + self.NEW_LINE_UNIX)
|
|
|
- self.read_data([expected])
|
|
|
+ if "\\n" in command and (len(command) == 4 or len(command) == 2):
|
|
|
+ print "Sendig ENTER \\r\\n"
|
|
|
+ command = '\r\n'
|
|
|
+ else:
|
|
|
+ command = command.rstrip(self.NEW_LINE_WINDOWS).rstrip(self.NEW_LINE_UNIX)
|
|
|
+ if not self.command_enable(command) and not self.command_quit(command):
|
|
|
+ if command.__len__() > 0:
|
|
|
+ if self.debug:
|
|
|
+ print "Send: "
|
|
|
+ print command
|
|
|
+ self.stdin.write(command + self.NEW_LINE_UNIX)
|
|
|
+ self.stdin.flush()
|
|
|
+ self.read_data(expected)
|
|
|
|
|
|
def read_data(self, expected):
|
|
|
"""
|