X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FMemif.py;h=f60972f64d0f81d1ea912d541e87b07e3b586f4f;hb=2b67e8064904d4e43d1a9c8587b972d66ba3bf11;hp=5c38ec46f5e8fa0c8f24516b3243597503067f30;hpb=33fb34665214bbbd0a4b3154169b21c2da01f69b;p=csit.git diff --git a/resources/libraries/python/Memif.py b/resources/libraries/python/Memif.py index 5c38ec46f5..f60972f64d 100644 --- a/resources/libraries/python/Memif.py +++ b/resources/libraries/python/Memif.py @@ -18,8 +18,7 @@ from enum import IntEnum from robot.api import logger from resources.libraries.python.topology import NodeType, Topology -from resources.libraries.python.PapiExecutor import PapiExecutor -from resources.libraries.python.L2Util import L2Util +from resources.libraries.python.PapiExecutor import PapiSocketExecutor class MemifRole(IntEnum): @@ -43,12 +42,15 @@ class Memif(object): :returns: List of memif interfaces extracted from Papi response. :rtype: list """ - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: details = papi_exec.add("memif_dump").get_details() for memif in details: - memif["if_name"] = memif["if_name"].rstrip('\x00') - memif["hw_addr"] = L2Util.bin_to_mac(memif["hw_addr"]) + memif["hw_addr"] = str(memif["hw_addr"]) + memif["role"] = memif["role"].value + memif["mode"] = memif["mode"].value + memif["flags"] = memif["flags"].value \ + if hasattr(memif["flags"], 'value') else int(memif["flags"]) logger.debug("MEMIF details:\n{details}".format(details=details)) @@ -74,11 +76,11 @@ class Memif(object): err_msg = 'Failed to create memif socket on host {host}'.format( host=node['host']) args = dict( - is_add=int(is_add), + is_add=is_add, socket_id=int(sid), socket_filename=str('/tmp/' + filename) ) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: return papi_exec.add(cmd, **args).get_reply(err_msg) @staticmethod @@ -108,9 +110,10 @@ class Memif(object): rx_queues=int(rxq), tx_queues=int(txq), socket_id=int(sid), - id=int(mid) + id=int(mid), + secret="" ) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: return papi_exec.add(cmd, **args).get_sw_if_index(err_msg) @staticmethod