X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FVPPUtil.py;h=8f9b593902f5f68685c03ad48a6c3de141311c8e;hb=a46ab8cc305fe9d7e96d321ae8cd0ac7a6fc1e24;hp=676671f15e5d2695a297747ec8ce1fddaa428df9;hpb=33fb34665214bbbd0a4b3154169b21c2da01f69b;p=csit.git diff --git a/resources/libraries/python/VPPUtil.py b/resources/libraries/python/VPPUtil.py index 676671f15e..8f9b593902 100644 --- a/resources/libraries/python/VPPUtil.py +++ b/resources/libraries/python/VPPUtil.py @@ -13,14 +13,12 @@ """VPP util library.""" -import binascii - from robot.api import logger from resources.libraries.python.Constants import Constants from resources.libraries.python.DUTSetup import DUTSetup from resources.libraries.python.L2Util import L2Util -from resources.libraries.python.PapiExecutor import PapiExecutor +from resources.libraries.python.PapiExecutor import PapiSocketExecutor from resources.libraries.python.ssh import exec_cmd_no_error from resources.libraries.python.topology import NodeType @@ -136,6 +134,7 @@ class VPPUtil(object): VPPUtil.verify_vpp_started(node) # Verify responsivness of PAPI. VPPUtil.show_log(node) + VPPUtil.vpp_show_version(node) finally: DUTSetup.get_service_logs(node, Constants.VPP_UNIT) @@ -162,7 +161,7 @@ class VPPUtil(object): :returns: VPP version. :rtype: str """ - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: reply = papi_exec.add('show_version').get_reply() return_version = reply['version'].rstrip('\0x00') version = 'VPP version: {ver}\n'.format(ver=return_version) @@ -194,16 +193,25 @@ class VPPUtil(object): """ cmd = 'sw_interface_dump' - args = dict(name_filter_valid=0, name_filter='') + args = dict( + name_filter_valid=False, + name_filter='' + ) err_msg = 'Failed to get interface dump on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: details = papi_exec.add(cmd, **args).get_details(err_msg) for if_dump in details: - if_dump['interface_name'] = if_dump['interface_name'].rstrip('\x00') - if_dump['tag'] = if_dump['tag'].rstrip('\x00') - if_dump['l2_address'] = L2Util.bin_to_mac(if_dump['l2_address']) + if_dump['l2_address'] = str(if_dump['l2_address']) + if_dump['b_dmac'] = str(if_dump['b_dmac']) + if_dump['b_smac'] = str(if_dump['b_smac']) + if_dump['flags'] = if_dump['flags'].value + if_dump['type'] = if_dump['type'].value + if_dump['link_duplex'] = if_dump['link_duplex'].value + if_dump['sub_if_flags'] = if_dump['sub_if_flags'].value \ + if hasattr(if_dump['sub_if_flags'], 'value') \ + else int(if_dump['sub_if_flags']) # TODO: return only base data logger.trace('Interface data of host {host}:\n{details}'.format( host=node['host'], details=details)) @@ -221,12 +229,13 @@ class VPPUtil(object): cmds = [ "trace add dpdk-input 50", "trace add vhost-user-input 50", - "trace add memif-input 50" + "trace add memif-input 50", + "trace add avf-input 50" ] for cmd in cmds: try: - PapiExecutor.run_cli_cmd(node, cmd) + PapiSocketExecutor.run_cli_cmd(node, cmd) except AssertionError: if fail_on_error: raise @@ -252,7 +261,7 @@ class VPPUtil(object): :param node: DUT node to set up. :type node: dict """ - PapiExecutor.run_cli_cmd(node, "elog trace api cli barrier") + PapiSocketExecutor.run_cli_cmd(node, "elog trace api cli barrier") @staticmethod def vpp_enable_elog_traces_on_all_duts(nodes): @@ -272,7 +281,7 @@ class VPPUtil(object): :param node: DUT node to show traces on. :type node: dict """ - PapiExecutor.run_cli_cmd(node, "show event-logger") + PapiSocketExecutor.run_cli_cmd(node, "show event-logger") @staticmethod def show_event_logger_on_all_duts(nodes): @@ -294,7 +303,7 @@ class VPPUtil(object): :returns: VPP log data. :rtype: list """ - return PapiExecutor.run_cli_cmd(node, "show log") + return PapiSocketExecutor.run_cli_cmd(node, "show log") @staticmethod def vpp_show_threads(node): @@ -305,7 +314,7 @@ class VPPUtil(object): :returns: VPP thread data. :rtype: list """ - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: reply = papi_exec.add('show_threads').get_reply() threads_data = list()