- name = interface["name"]
- # this is not DPDK port num, but this is whatever number we gave
- # when we selected ports and programmed the profile
- port = self.vnfd_helper.port_num(name)
- if port in ports:
- samples[name] = {
- "rx_throughput_kps": float(last_result["Rx_Rate_Kbps"][port]),
- "tx_throughput_kps": float(last_result["Tx_Rate_Kbps"][port]),
- "rx_throughput_mbps": float(last_result["Rx_Rate_Mbps"][port]),
- "tx_throughput_mbps": float(last_result["Tx_Rate_Mbps"][port]),
- "in_packets": int(last_result["Valid_Frames_Rx"][port]),
- "out_packets": int(last_result["Frames_Tx"][port]),
- "RxThroughput": int(last_result["Valid_Frames_Rx"][port]) / 30,
- "TxThroughput": int(last_result["Frames_Tx"][port]) / 30,
- }
- if key:
- avg_latency = latency["Store-Forward_Avg_latency_ns"][port]
- min_latency = latency["Store-Forward_Min_latency_ns"][port]
- max_latency = latency["Store-Forward_Max_latency_ns"][port]
- samples[name][key] = \
- {"Store-Forward_Avg_latency_ns": avg_latency,
- "Store-Forward_Min_latency_ns": min_latency,
- "Store-Forward_Max_latency_ns": max_latency}
+ # reverse lookup port name from port_num so the stats dict is descriptive
+ intf = self.vnfd_helper.find_interface_by_port(port_num)
+ port_name = intf["name"]
+ samples[port_name] = {
+ "rx_throughput_kps": float(last_result["Rx_Rate_Kbps"][port_num]),
+ "tx_throughput_kps": float(last_result["Tx_Rate_Kbps"][port_num]),
+ "rx_throughput_mbps": float(last_result["Rx_Rate_Mbps"][port_num]),
+ "tx_throughput_mbps": float(last_result["Tx_Rate_Mbps"][port_num]),
+ "in_packets": int(last_result["Valid_Frames_Rx"][port_num]),
+ "out_packets": int(last_result["Frames_Tx"][port_num]),
+ "RxThroughput": int(last_result["Valid_Frames_Rx"][port_num]) / 30,
+ "TxThroughput": int(last_result["Frames_Tx"][port_num]) / 30,
+ }
+ if key:
+ avg_latency = latency["Store-Forward_Avg_latency_ns"][port_num]
+ min_latency = latency["Store-Forward_Min_latency_ns"][port_num]
+ max_latency = latency["Store-Forward_Max_latency_ns"][port_num]
+ samples[port_name][key] = \
+ {"Store-Forward_Avg_latency_ns": avg_latency,
+ "Store-Forward_Min_latency_ns": min_latency,
+ "Store-Forward_Max_latency_ns": max_latency}