+ # hide dpdk_port_num key so we can abstract
+ def find_interface_by_port(self, port):
+ for interface in self.interfaces:
+ virtual_intf = interface["virtual-interface"]
+ # we have to convert to int to compare
+ if int(virtual_intf['dpdk_port_num']) == port:
+ return interface
+
+ def port_num(self, name):
+ # 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
+ """
+ intf = self.find_interface(name=name)
+ return int(intf["virtual-interface"]["dpdk_port_num"])
+
+ def port_nums(self, intfs):
+ return [self.port_num(i) for i in intfs]
+