Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
CSIT-536 HC Test: support testing with ODL client
[csit.git]
/
resources
/
libraries
/
python
/
VatExecutor.py
diff --git
a/resources/libraries/python/VatExecutor.py
b/resources/libraries/python/VatExecutor.py
index
03b7321
..
9db53d3
100644
(file)
--- a/
resources/libraries/python/VatExecutor.py
+++ b/
resources/libraries/python/VatExecutor.py
@@
-19,6
+19,7
@@
from robot.api import logger
from resources.libraries.python.ssh import SSH
from resources.libraries.python.constants import Constants
from resources.libraries.python.ssh import SSH
from resources.libraries.python.constants import Constants
+from resources.libraries.python.VatHistory import VatHistory
__all__ = ['VatExecutor']
__all__ = ['VatExecutor']
@@
-30,7
+31,7
@@
def cleanup_vat_json_output(json_output):
Clean up VAT JSON output from clutter like vat# prompts and such.
:param json_output: Cluttered JSON output.
Clean up VAT JSON output from clutter like vat# prompts and such.
:param json_output: Cluttered JSON output.
- :return: Cleaned up output JSON string.
+ :return
s
: Cleaned up output JSON string.
"""
retval = json_output
"""
retval = json_output
@@
-156,14
+157,15
@@
class VatTerminal(object):
"""
"""
- __VAT_PROMPT =
"vat# "
- __LINUX_PROMPT =
":~$ "
+ __VAT_PROMPT =
("vat# ", )
+ __LINUX_PROMPT =
(":~$ ", "~]$ ")
def __init__(self, node, json_param=True):
json_text = ' json' if json_param else ''
self.json = json_param
def __init__(self, node, json_param=True):
json_text = ' json' if json_param else ''
self.json = json_param
+ self._node = node
self._ssh = SSH()
self._ssh = SSH()
- self._ssh.connect(node)
+ self._ssh.connect(
self._
node)
self._tty = self._ssh.interactive_terminal_open()
self._ssh.interactive_terminal_exec_command(
self._tty,
self._tty = self._ssh.interactive_terminal_open()
self._ssh.interactive_terminal_exec_command(
self._tty,
@@
-185,11
+187,11
@@
class VatTerminal(object):
:return: Command output in python representation of JSON format or
None if not in JSON mode.
"""
:return: Command output in python representation of JSON format or
None if not in JSON mode.
"""
+ VatHistory.add_to_vat_history(self._node, cmd)
logger.debug("Executing command in VAT terminal: {}".format(cmd))
try:
logger.debug("Executing command in VAT terminal: {}".format(cmd))
try:
- out = self._ssh.interactive_terminal_exec_command(self._tty,
- cmd,
- self.__VAT_PROMPT)
+ out = self._ssh.interactive_terminal_exec_command(self._tty, cmd,
+ self.__VAT_PROMPT)
except:
self._exec_failure = True
raise
except:
self._exec_failure = True
raise
@@
-201,10
+203,10
@@
class VatTerminal(object):
array_start = out.find('[')
array_end = out.rfind(']')
array_start = out.find('[')
array_end = out.rfind(']')
- if
-1 == obj_start and -1 == array_start
:
+ if
obj_start == -1 and array_start == -1
:
raise RuntimeError("VAT: no JSON data.")
raise RuntimeError("VAT: no JSON data.")
- if obj_start < array_start or
-1 == array_start
:
+ if obj_start < array_start or
array_start == -1
:
start = obj_start
end = obj_end + 1
else:
start = obj_start
end = obj_end + 1
else:
@@
-218,7
+220,7
@@
class VatTerminal(object):
def vat_terminal_close(self):
"""Close VAT terminal."""
def vat_terminal_close(self):
"""Close VAT terminal."""
- #interactive terminal is dead, we only need to close session
+ #
interactive terminal is dead, we only need to close session
if not self._exec_failure:
self._ssh.interactive_terminal_exec_command(self._tty,
'quit',
if not self._exec_failure:
self._ssh.interactive_terminal_exec_command(self._tty,
'quit',