X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FInterfaceUtil.py;h=d78984b1ca06250f6aa30ad34594d4f5b8efd5d0;hb=5899ac744eb5f722f53151c98e5acfdbdf678d0c;hp=939d8083dc9cff232502fdc0573ac6b981e999ec;hpb=935734b04269b8fe5348e1c2b168dd5c6cd9339a;p=csit.git diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 939d8083dc..d78984b1ca 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Cisco and/or its affiliates. +# Copyright (c) 2019 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -1325,18 +1325,22 @@ class InterfaceUtil(object): exec_cmd_no_error(node, cmd, sudo=True) @staticmethod - def init_avf_interface(node, ifc_key, numvfs=1, topology_type='L2'): + def init_avf_interface(node, ifc_key, numvfs=1, traffic_type='L2'): """Init PCI device by creating VFs and bind them to vfio-pci for AVF driver testing on DUT. :param node: DUT node. :param ifc_key: Interface key from topology file. :param numvfs: Number of VFs to initialize, 0 - disable the VFs. - :param topology_type: Topology type. + :param traffic_type: Expected type of traffic, affects spoofing. + Default value "L2" sets linux interface spoof off. + Other values do not do that. + Note: This is NOT the usual traffic profile + (which is python module name to initialize TG with). :type node: dict :type ifc_key: str :type numvfs: int - :type topology_type: str + :type traffic_type: str :returns: Virtual Function topology interface keys. :rtype: list """ @@ -1375,7 +1379,7 @@ class InterfaceUtil(object): format(pci=pf_pci_addr) InterfaceUtil.set_linux_interface_trust_on(node, pf_dev, vf_id=vf_id) - if topology_type == 'L2': + if traffic_type == 'L2': InterfaceUtil.set_linux_interface_spoof_off(node, pf_dev, vf_id=vf_id) InterfaceUtil.set_linux_interface_mac(node, pf_dev, vf_mac_addr, @@ -1644,8 +1648,9 @@ class InterfaceUtil(object): cmd=cmd, host=node['host']) with PapiExecutor(node) as papi_exec: for ifc in node['interfaces'].values(): - papi_exec.add(cmd, sw_if_index=ifc['vpp_sw_index']) - papi_resp = papi_exec.execute_should_pass(err_msg) + if ifc['vpp_sw_index'] is not None: + papi_exec.add(cmd, sw_if_index=ifc['vpp_sw_index']) + papi_resp = papi_exec.get_dump(err_msg) thr_mapping = [s[cmd_reply] for r in papi_resp.reply for s in r['api_reply']] return sorted(thr_mapping, key=lambda k: k['sw_if_index'])