X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FVPPUtil.py;h=64bba75e539b9769cbfdfbae0c357f62dc54c9b0;hp=1bc1b4358e335050b8c2d3b352f846ee80f1d105;hb=33bd6f2425ddff8e4167d36ea61b64ac81da3a65;hpb=935734b04269b8fe5348e1c2b168dd5c6cd9339a diff --git a/resources/libraries/python/VPPUtil.py b/resources/libraries/python/VPPUtil.py index 1bc1b4358e..64bba75e53 100644 --- a/resources/libraries/python/VPPUtil.py +++ b/resources/libraries/python/VPPUtil.py @@ -146,19 +146,22 @@ class VPPUtil(object): otherwise show only version. :type node: dict :type verbose: bool + :returns: VPP version. + :rtype: str """ with PapiExecutor(node) as papi_exec: - papi_resp = papi_exec.add('show_version').execute_should_pass() - data = papi_resp.reply[0]['api_reply']['show_version_reply'] + data = papi_exec.add('show_version').execute_should_pass().\ + verify_reply() version = ('VPP version: {ver}\n'. format(ver=data['version'].rstrip('\0x00'))) if verbose: version += ('Compile date: {date}\n' - 'Compile location: {loc}\n '. + 'Compile location: {cl}\n '. format(date=data['build_date'].rstrip('\0x00'), - loc=data['build_directory'].rstrip('\0x00'))) + cl=data['build_directory'].rstrip('\0x00'))) logger.info(version) + return data['version'].rstrip('\0x00') @staticmethod def vpp_show_version_verbose(node): @@ -303,7 +306,6 @@ class VPPUtil(object): :returns: VPP thread data. :rtype: list """ - with PapiExecutor(node) as papi_exec: - resp = papi_exec.add('show_threads').execute_should_pass() - return resp.reply[0]['api_reply']['show_threads_reply']['thread_data'] + return papi_exec.add('show_threads').execute_should_pass().\ + verify_reply()["thread_data"]