+ iface1_pci = topo.get_interface_pci_addr(node, interface1)
+ iface2_pci = topo.get_interface_pci_addr(node, interface2)
+ iface1_mac = topo.get_interface_mac(node, interface1)
+ iface2_mac = topo.get_interface_mac(node, interface2)
+ if min(iface1_pci, iface2_pci) != iface1_pci:
+ iface1_mac, iface2_mac = iface2_mac, iface1_mac
+ iface1_pci, iface2_pci = iface2_pci, iface1_pci
+ self._ifaces_reordered = 1
+
+ iface1_mac_hex = "0x"+iface1_mac.replace(":", ",0x")
+ iface2_mac_hex = "0x"+iface2_mac.replace(":", ",0x")
+
+ if test_type == 'L2':
+ (ret, stdout, stderr) = ssh.exec_command(
+ "sudo sh -c 'cat << EOF > /etc/trex_cfg.yaml\n"
+ "- port_limit : 2\n"
+ " version : 2\n"
+ " interfaces : [\"{}\",\"{}\"]\n"
+ " port_info :\n"
+ " - dest_mac : [{}]\n"
+ " src_mac : [{}]\n"
+ " - dest_mac : [{}]\n"
+ " src_mac : [{}]\n"
+ "EOF'"\
+ .format(iface1_pci, iface2_pci,
+ iface2_mac_hex, iface1_mac_hex,
+ iface1_mac_hex, iface2_mac_hex))
+ if int(ret) != 0:
+ logger.error("failed to create t-rex config: {}"\
+ .format(stdout + stderr))
+ raise RuntimeError('trex config generation error')
+ elif test_type == 'L3':
+ raise NotImplementedError("L3 test_type not supported")
+ else:
+ raise Exception("test_type unknown")
+
+