- if osi_layer in (u"L2", u"L3", u"L7"):
- exec_cmd_no_error(
- self._node,
- f"sh -c 'cat << EOF > /etc/trex_cfg.yaml\n"
- f"- version: 2\n"
- f" c: {len(threads)}\n"
- f" limit_memory: {Constants.TREX_LIMIT_MEMORY}\n"
- f" interfaces: [\"{if1[u'pci']}\",\"{if2[u'pci']}\"]\n"
- f" port_info:\n"
- f" - dest_mac: \'{if1[u'adj_addr']}\'\n"
- f" src_mac: \'{if1[u'addr']}\'\n"
- f" - dest_mac: \'{if2[u'adj_addr']}\'\n"
- f" src_mac: \'{if2[u'addr']}\'\n"
- f" platform :\n"
- f" master_thread_id: {master_thread_id}\n"
- f" latency_thread_id: {latency_thread_id}\n"
- f" dual_if:\n"
- f" - socket: {socket}\n"
- f" threads: {threads}\n"
- f"EOF'",
- sudo=True, message=u"T-Rex config generation!"
- )
- else:
- raise ValueError(u"Unknown OSI layer!")
+ if subtype == NodeSubTypeTG.TREX:
+ trex_topology = list()
+ self._mode = TrexMode.ASTF if osi_layer == "L7" else TrexMode.STL
+
+ for l in range(1, parallel_links*2, 2):
+ tg_if1_adj_addr = topology[f"TG_pf{l+1}_mac"][0]
+ tg_if2_adj_addr = topology[f"TG_pf{l}_mac"][0]
+ if osi_layer in ("L3", "L7") and "DUT1" in topology.keys():
+ ifl = BuiltIn().get_variable_value("${int}")
+ last = topology["duts_count"]
+ tg_if1_adj_addr = Topology().get_interface_mac(
+ topology["DUT1"],
+ BuiltIn().get_variable_value(
+ f"${{DUT1_{ifl}{l}}}[0]"
+ )
+ )
+ tg_if2_adj_addr = Topology().get_interface_mac(
+ topology[f"DUT{last}"],
+ BuiltIn().get_variable_value(
+ f"${{DUT{last}_{ifl}{l+1}}}[0]"
+ )
+ )