- master_thread_id, latency_thread_id, socket, threads = \
- CpuUtils.get_affinity_trex(
- self._node, tg_if1, tg_if2,
- tg_dtc=Constants.TREX_CORE_COUNT)
-
- 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!"
- )
-
- if Constants.TREX_RX_DESCRIPTORS_COUNT != 0:
- exec_cmd_no_error(
- self._node,
- f"sh -c 'cat << EOF >> /etc/trex_cfg.yaml\n"
- f" rx_desc: {Constants.TREX_RX_DESCRIPTORS_COUNT}\n"
- f"EOF'",
- sudo=True, message=u"T-Rex rx_desc modification!"
- )
-
- if Constants.TREX_TX_DESCRIPTORS_COUNT != 0:
- exec_cmd_no_error(
- self._node,
- f"sh -c 'cat << EOF >> /etc/trex_cfg.yaml\n"
- f" tx_desc: {Constants.TREX_TX_DESCRIPTORS_COUNT}\n"
- f"EOF'",
- sudo=True, message=u"T-Rex tx_desc modification!"
- )
- else:
- raise ValueError(u"Unknown OSI layer!")
-
- TrafficGenerator.startup_trex(
- self._node, osi_layer, subtype=subtype
- )