diff options
author | Tibor Frank <tifrank@cisco.com> | 2019-06-11 14:38:06 +0200 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2019-06-19 14:29:58 +0200 |
commit | 287ef8c6dc057220e403a1493cb23450dd8db2b2 (patch) | |
tree | 197499ed596036033dd8baf041c8d2d35b5c1ca9 /resources/libraries/python/PapiExecutor.py | |
parent | 0e28406b43bf4ce145f1530f15dbb00957edf945 (diff) |
VAT-to-PAPI: NATUtil
Change-Id: Id64bbf899e78c7c55410a8ce608393c22fa596ab
Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/libraries/python/PapiExecutor.py')
-rw-r--r-- | resources/libraries/python/PapiExecutor.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/resources/libraries/python/PapiExecutor.py b/resources/libraries/python/PapiExecutor.py index c2f966fb6d..98eb59cae7 100644 --- a/resources/libraries/python/PapiExecutor.py +++ b/resources/libraries/python/PapiExecutor.py @@ -17,6 +17,8 @@ import binascii import json +from pprint import pformat + from robot.api import logger from resources.libraries.python.Constants import Constants @@ -366,6 +368,21 @@ class PapiExecutor(object): ignore_errors=ignore_errors, err_msg=err_msg, timeout=timeout) @staticmethod + def dump_and_log(node, cmds): + """Dump and log requested information. + + :param node: DUT node. + :param cmds: Dump commands to be executed. + :type node: dict + :type cmds: list + """ + with PapiExecutor(node) as papi_exec: + for cmd in cmds: + dump = papi_exec.add(cmd).get_dump() + logger.debug("{cmd}:\n{data}".format( + cmd=cmd, data=pformat(dump.reply[0]["api_reply"]))) + + @staticmethod def run_cli_cmd(node, cmd, log=True): """Run a CLI command. |