Skip to content

Commit ecbbc3c

Browse files
committed
udpate telemetry pytest to reflect name changes
1 parent 76b94b4 commit ecbbc3c

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

test/local/test_telemetry.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@
1919
'tx-0', 'tx-1', 'tx-2', 'tx-3', 'tx-4', 'tx-5',
2020
)
2121
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',
2726
)
2827
HW_IFACE_STATS = (
2928
'rx_broadcast_bytes', 'rx_broadcast_packets', 'tx_broadcast_bytes', 'tx_broadcast_packets',
@@ -125,35 +124,43 @@ def test_telemetry_fwall(prepare_ifaces, grpc_client):
125124

126125
def test_telemetry_exporter(request, prepare_ifaces, start_exporter):
127126
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()
129128
for metric in metrics.splitlines():
130-
if metric.startswith('dpdk_graph_stat'):
129+
if metric.startswith('dps_graph_call_count'):
131130
graph_stats.add(metric.split('"')[1])
132131
elif metric.startswith('dpdk_heap_info'):
133132
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'):
137136
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"
138145
else:
139146
assert metric.startswith("#"), \
140147
f"Unknown exported metric '{metric.split('{')[0]}' found"
141148
# meson options (e.g. enable_virtual_services) are hard to do in these scripts, so just check manually
142149
graph_nodes = GRAPH_NODES
143-
iface_stats = IFACE_STATS
150+
iface_stats = ETHDEV_STATS
144151
if 'virtsvc' in graph_stats:
145152
graph_nodes += ('virtsvc',)
146153
if request.config.getoption("--hw"):
147154
iface_stats += HW_IFACE_STATS
148155
if PF1.tap == "pf1-tap":
149156
graph_nodes += ('tx-6',)
150-
if 'rx_q1_bytes' in interface_stats:
157+
if 'rx_q1_bytes' in ethdev_stats:
151158
iface_stats += HW_PF1_IFACE_STATS
152159
assert graph_stats == set(graph_nodes), \
153160
"Unexpected graph telemetry in exporter output"
154161
assert heap_info == set(HEAP_INFO), \
155162
"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"
158165
assert htable_saturation == set(HASH_TABLES) or htable_saturation == set(HASH_TABLES + ('virtsvc_table_0', 'virtsvc_table_1')), \
159166
"Unexpected hash table info in exporter output"

0 commit comments

Comments
 (0)