diff options
Diffstat (limited to 'yardstick/network_services/vnf_generic/vnf/base.py')
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/base.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/base.py b/yardstick/network_services/vnf_generic/vnf/base.py index 42e3d2a48..67634a79c 100644 --- a/yardstick/network_services/vnf_generic/vnf/base.py +++ b/yardstick/network_services/vnf_generic/vnf/base.py @@ -106,20 +106,28 @@ class VnfdHelper(dict): if int(virtual_intf['dpdk_port_num']) == port: return interface - def port_num(self, name): + def port_num(self, port): # we need interface name -> DPDK port num (PMD ID) -> LINK ID # LINK ID -> PMD ID is governed by the port mask """ :rtype: int - :type name: str + :type port: str """ - intf = self.find_interface(name=name) + if isinstance(port, dict): + intf = port + else: + intf = self.find_interface(name=port) return int(intf["virtual-interface"]["dpdk_port_num"]) def port_nums(self, intfs): return [self.port_num(i) for i in intfs] + def ports_iter(self): + for port_name in self.port_pairs.all_ports: + port_num = self.port_num(port_name) + yield port_name, port_num + class VNFObject(object): |