|
19 | 19 | 'tx-0', 'tx-1', 'tx-2', 'tx-3', 'tx-4', 'tx-5', |
20 | 20 | ) |
21 | 21 | HEAP_INFO = ( 'Heap_id', 'Heap_size', 'Alloc_count', 'Free_count', 'Alloc_size', 'Free_size', 'Greatest_free_size' ) |
22 | | -IFACE_STATS = ( |
23 | | - 'rx_q0_errors', 'rx_q0_bytes', 'tx_q0_bytes', 'rx_q0_packets', 'tx_q0_packets', |
24 | | - 'rx_good_bytes', 'tx_good_bytes', 'rx_good_packets', 'tx_good_packets', |
25 | | - 'rx_errors', 'tx_errors', 'rx_missed_errors', 'rx_mbuf_allocation_errors', |
26 | | - 'nat_used_port_count', 'firewall_rule_count', |
| 22 | +ETHDEV_STATS = ( |
| 23 | + 'rx_good_bytes', 'rx_q0_bytes', 'tx_good_bytes', 'tx_q0_bytes', |
| 24 | + 'rx_errors', 'rx_mbuf_allocation_errors', 'rx_missed_errors', 'rx_q0_errors', 'tx_errors', |
| 25 | + 'rx_good_packets', 'rx_q0_packets', 'tx_good_packets', 'tx_q0_packets', |
27 | 26 | ) |
28 | 27 | HW_IFACE_STATS = ( |
29 | 28 | 'rx_broadcast_bytes', 'rx_broadcast_packets', 'tx_broadcast_bytes', 'tx_broadcast_packets', |
@@ -125,35 +124,43 @@ def test_telemetry_fwall(prepare_ifaces, grpc_client): |
125 | 124 |
|
126 | 125 | def test_telemetry_exporter(request, prepare_ifaces, start_exporter): |
127 | 126 | metrics = urlopen(f"http://localhost:{exporter_port}/metrics").read().decode('utf-8') |
128 | | - graph_stats, heap_info, interface_stats, htable_saturation = set(), set(), set(), set() |
| 127 | + graph_stats, heap_info, ethdev_stats, htable_saturation = set(), set(), set(), set() |
129 | 128 | for metric in metrics.splitlines(): |
130 | | - if metric.startswith('dpdk_graph_stat'): |
| 129 | + if metric.startswith('dps_graph_call_count'): |
131 | 130 | graph_stats.add(metric.split('"')[1]) |
132 | 131 | elif metric.startswith('dpdk_heap_info'): |
133 | 132 | heap_info.add(metric.split('"')[1]) |
134 | | - elif metric.startswith('dpdk_interface_stat'): |
135 | | - interface_stats.add(metric.split('"')[3]) |
136 | | - elif metric.startswith('hash_table_saturation'): |
| 133 | + elif metric.startswith(('dpdk_ethdev_errors_total', 'dpdk_ethdev_bytes_total', 'dpdk_ethdev_packets_total')): |
| 134 | + ethdev_stats.add(metric.split('"')[3]) |
| 135 | + elif metric.startswith('dps_hash_table_saturation'): |
137 | 136 | htable_saturation.add(metric.split('"')[3]) |
| 137 | + elif metric.startswith('dpdk_ethdev_link_status'): |
| 138 | + linkStatus = metric.split(' ')[1] |
| 139 | + assert linkStatus == '0' or linkStatus == '1', \ |
| 140 | + "Link status must be 0 or 1" |
| 141 | + # these metrics don't have any stat label, only checking if they are not empty |
| 142 | + elif metric.startswith(('dpdk_ethdev_misc', 'dps_firewall_rules_count', 'dps_virtsvc_used_ports_count', 'dps_nat_used_ports_count')): |
| 143 | + assert len(metric.split(' ')) > 1, \ |
| 144 | + f"Empty exported metric '{metric.split('{')[0]}' found" |
138 | 145 | else: |
139 | 146 | assert metric.startswith("#"), \ |
140 | 147 | f"Unknown exported metric '{metric.split('{')[0]}' found" |
141 | 148 | # meson options (e.g. enable_virtual_services) are hard to do in these scripts, so just check manually |
142 | 149 | graph_nodes = GRAPH_NODES |
143 | | - iface_stats = IFACE_STATS |
| 150 | + iface_stats = ETHDEV_STATS |
144 | 151 | if 'virtsvc' in graph_stats: |
145 | 152 | graph_nodes += ('virtsvc',) |
146 | 153 | if request.config.getoption("--hw"): |
147 | 154 | iface_stats += HW_IFACE_STATS |
148 | 155 | if PF1.tap == "pf1-tap": |
149 | 156 | graph_nodes += ('tx-6',) |
150 | | - if 'rx_q1_bytes' in interface_stats: |
| 157 | + if 'rx_q1_bytes' in ethdev_stats: |
151 | 158 | iface_stats += HW_PF1_IFACE_STATS |
152 | 159 | assert graph_stats == set(graph_nodes), \ |
153 | 160 | "Unexpected graph telemetry in exporter output" |
154 | 161 | assert heap_info == set(HEAP_INFO), \ |
155 | 162 | "Unexpected heap info in exporter output" |
156 | | - assert interface_stats == set(iface_stats) or interface_stats == set(iface_stats + ('virtsvc_used_port_count',)), \ |
157 | | - "Unexpected interface statistics in exporter output" |
| 163 | + assert ethdev_stats == set(iface_stats), \ |
| 164 | + "Unexpected ethdev statistics in exporter output" |
158 | 165 | assert htable_saturation == set(HASH_TABLES) or htable_saturation == set(HASH_TABLES + ('virtsvc_table_0', 'virtsvc_table_1')), \ |
159 | 166 | "Unexpected hash table info in exporter output" |
0 commit comments