aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-09-17 13:00:39 +0200
committerVratko Polak <vrpolak@cisco.com>2019-09-17 12:30:19 +0000
commit8b1bead7b4b70e3ff4e7d4cb82940695d763ed2d (patch)
tree2471e40a115e6bc8ea38f5e2ad79834992f1ad0c /resources/libraries
parentb61e34657e58cbe6c8476f6708d62168ffd80775 (diff)
Update CRC list and support 21997/7
- Attempt to repair IPsec LispGpe perf suite. + Collection name to reflect the current stable vpp. + Add messages found in CSIT L1 keywords. - Uncommented (instead of deleted) untestable messages. Reasons: - Honeycomb. - Messages used by unused keywords. + Listed reasons. Honeycomb not mentioned if both reasons apply. + Delete CRC items for commands not found in keywords anymore. + Add CRCs from .json.api files (as teardown is hard to execute). + Define and restore alphabetical order. + Add hints to find used API commands (not entirely reliable). + Move used commands to "cmd = " form so hints find them. + Argument to run_cli_command changed from "cmd" to "cli_cmd". + Except also struct.error where IOError is excepted. Change-Id: I61058dbe1e33296908aabd0c13433bb16cfa6adf Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/python/Memif.py3
-rw-r--r--resources/libraries/python/PapiExecutor.py33
-rw-r--r--resources/libraries/python/Trace.py4
-rw-r--r--resources/libraries/python/VPPUtil.py6
4 files changed, 26 insertions, 20 deletions
diff --git a/resources/libraries/python/Memif.py b/resources/libraries/python/Memif.py
index f60972f64d..24fda52677 100644
--- a/resources/libraries/python/Memif.py
+++ b/resources/libraries/python/Memif.py
@@ -42,8 +42,9 @@ class Memif(object):
:returns: List of memif interfaces extracted from Papi response.
:rtype: list
"""
+ cmd = "memif_dump"
with PapiSocketExecutor(node) as papi_exec:
- details = papi_exec.add("memif_dump").get_details()
+ details = papi_exec.add(cmd).get_details()
for memif in details:
memif["hw_addr"] = str(memif["hw_addr"])
diff --git a/resources/libraries/python/PapiExecutor.py b/resources/libraries/python/PapiExecutor.py
index aec43b6694..d651e78cca 100644
--- a/resources/libraries/python/PapiExecutor.py
+++ b/resources/libraries/python/PapiExecutor.py
@@ -19,6 +19,7 @@ import copy
import glob
import json
import shutil
+import struct # vpp-papi can raise struct.error
import subprocess
import sys
import tempfile
@@ -95,8 +96,9 @@ class PapiSocketExecutor(object):
Note: Use only with "with" statement, e.g.:
+ cmd = 'show_version'
with PapiSocketExecutor(node) as papi_exec:
- reply = papi_exec.add('show_version').get_reply(err_msg)
+ reply = papi_exec.add(cmd).get_reply(err_msg)
This class processes two classes of VPP PAPI methods:
1. Simple request / reply: method='request'.
@@ -110,8 +112,9 @@ class PapiSocketExecutor(object):
a. One request with no arguments:
+ cmd = 'show_version'
with PapiSocketExecutor(node) as papi_exec:
- reply = papi_exec.add('show_version').get_reply(err_msg)
+ reply = papi_exec.add(cmd).get_reply(err_msg)
b. Three requests with arguments, the second and the third ones are the same
but with different arguments.
@@ -293,7 +296,7 @@ class PapiSocketExecutor(object):
for _ in xrange(2):
try:
vpp_instance.connect_sync("csit_socket")
- except IOError as err:
+ except (IOError, struct.error) as err:
logger.warn("Got initial connect error {err!r}".format(err=err))
vpp_instance.disconnect()
else:
@@ -419,29 +422,29 @@ class PapiSocketExecutor(object):
return self._execute(err_msg)
@staticmethod
- def run_cli_cmd(node, cmd, log=True,
+ def run_cli_cmd(node, cli_cmd, log=True,
remote_vpp_socket=Constants.SOCKSVR_PATH):
"""Run a CLI command as cli_inband, return the "reply" field of reply.
Optionally, log the field value.
:param node: Node to run command on.
- :param cmd: The CLI command to be run on the node.
+ :param cli_cmd: The CLI command to be run on the node.
:param remote_vpp_socket: Path to remote socket to tunnel to.
:param log: If True, the response is logged.
:type node: dict
:type remote_vpp_socket: str
- :type cmd: str
+ :type cli_cmd: str
:type log: bool
:returns: CLI output.
:rtype: str
"""
- cli = 'cli_inband'
- args = dict(cmd=cmd)
+ cmd = 'cli_inband'
+ args = dict(cmd=cli_cmd)
err_msg = "Failed to run 'cli_inband {cmd}' PAPI command on host " \
"{host}".format(host=node['host'], cmd=cmd)
with PapiSocketExecutor(node, remote_vpp_socket) as papi_exec:
- reply = papi_exec.add(cli, **args).get_reply(err_msg)["reply"]
+ reply = papi_exec.add(cmd, **args).get_reply(err_msg)["reply"]
if log:
logger.info(
"{cmd} ({host} - {remote_vpp_socket}):\n{reply}".
@@ -450,21 +453,21 @@ class PapiSocketExecutor(object):
return reply
@staticmethod
- def run_cli_cmd_on_all_sockets(node, cmd, log=True):
+ def run_cli_cmd_on_all_sockets(node, cli_cmd, log=True):
"""Run a CLI command as cli_inband, on all sockets in topology file.
:param node: Node to run command on.
- :param cmd: The CLI command to be run on the node.
+ :param cli_cmd: The CLI command to be run on the node.
:param log: If True, the response is logged.
:type node: dict
- :type cmd: str
+ :type cli_cmd: str
:type log: bool
"""
sockets = Topology.get_node_sockets(node, socket_type=SocketType.PAPI)
if sockets:
for socket in sockets.values():
PapiSocketExecutor.run_cli_cmd(
- node, cmd, log=log, remote_vpp_socket=socket)
+ node, cli_cmd, log=log, remote_vpp_socket=socket)
@staticmethod
def dump_and_log(node, cmds):
@@ -511,7 +514,7 @@ class PapiSocketExecutor(object):
try:
try:
reply = papi_fn(**command["api_args"])
- except IOError as err:
+ except (IOError, struct.error) as err:
# Ocassionally an error happens, try reconnect.
logger.warn("Reconnect after error: {err!r}".format(
err=err))
@@ -521,7 +524,7 @@ class PapiSocketExecutor(object):
self.vpp_instance.connect_sync("csit_socket")
logger.trace("Reconnected.")
reply = papi_fn(**command["api_args"])
- except (AttributeError, IOError) as err:
+ except (AttributeError, IOError, struct.error) as err:
raise_from(AssertionError(err_msg), err, level="INFO")
# *_dump commands return list of objects, convert, ordinary reply.
if not isinstance(reply, list):
diff --git a/resources/libraries/python/Trace.py b/resources/libraries/python/Trace.py
index 5f885d6c60..27cc30476e 100644
--- a/resources/libraries/python/Trace.py
+++ b/resources/libraries/python/Trace.py
@@ -35,7 +35,7 @@ class Trace(object):
for node in nodes.values():
if node['type'] == NodeType.DUT:
PapiSocketExecutor.run_cli_cmd(
- node, cmd="show trace {max}".format(max=maximum))
+ node, "show trace {max}".format(max=maximum))
@staticmethod
def clear_packet_trace_on_all_duts(nodes):
@@ -46,4 +46,4 @@ class Trace(object):
"""
for node in nodes.values():
if node['type'] == NodeType.DUT:
- PapiSocketExecutor.run_cli_cmd(node, cmd="clear trace")
+ PapiSocketExecutor.run_cli_cmd(node, "clear trace")
diff --git a/resources/libraries/python/VPPUtil.py b/resources/libraries/python/VPPUtil.py
index 4e2b2373c4..6e3ff707ea 100644
--- a/resources/libraries/python/VPPUtil.py
+++ b/resources/libraries/python/VPPUtil.py
@@ -160,8 +160,9 @@ class VPPUtil(object):
:returns: VPP version.
:rtype: str
"""
+ cmd = 'show_version'
with PapiSocketExecutor(node) as papi_exec:
- reply = papi_exec.add('show_version').get_reply()
+ reply = papi_exec.add(cmd).get_reply()
return_version = reply['version'].rstrip('\0x00')
version = 'VPP version: {ver}\n'.format(ver=return_version)
if verbose:
@@ -313,8 +314,9 @@ class VPPUtil(object):
:returns: VPP thread data.
:rtype: list
"""
+ cmd = 'show_threads'
with PapiSocketExecutor(node) as papi_exec:
- reply = papi_exec.add('show_threads').get_reply()
+ reply = papi_exec.add(cmd).get_reply()
threads_data = list()
for thread in reply["thread_data"]: