@@ -28,48 +28,51 @@ def validate_exporters(exporters: list[dict[str, str]], tracker_info: dict[str,
28
28
Returns
29
29
-------
30
30
list
31
- Failure message if any exporter configuration does not match.
31
+ List of failure messages for any exporter configuration that does not match.
32
32
"""
33
- failed_log = []
33
+ failure_messages = []
34
34
for exporter in exporters :
35
35
exporter_name = exporter .name
36
36
actual_exporter_info = tracker_info ["exporters" ].get (exporter_name )
37
37
if not actual_exporter_info :
38
- failed_log .append (f"Exporter: { exporter_name } - Not configured" )
38
+ failure_messages .append (f"Exporter: { exporter_name } - Not configured" )
39
39
continue
40
40
local_interface = actual_exporter_info ["localIntf" ]
41
41
template_interval = actual_exporter_info ["templateInterval" ]
42
42
43
43
if local_interface != exporter .local_interface :
44
- failed_log .append (f"Exporter: { exporter_name } - Incorrect local interface - Expected: { exporter .local_interface } Actual: { local_interface } " )
44
+ failure_messages .append (f"Exporter: { exporter_name } - Incorrect local interface - Expected: { exporter .local_interface } , Actual: { local_interface } " )
45
45
46
46
if template_interval != exporter .template_interval :
47
- failed_log .append (f"Exporter: { exporter_name } - Incorrect template interval - Expected: { exporter .template_interval } Actual: { template_interval } " )
48
- return failed_log
47
+ failure_messages .append (f"Exporter: { exporter_name } - Incorrect template interval - Expected: { exporter .template_interval } , Actual: { template_interval } " )
48
+ return failure_messages
49
49
50
50
51
51
class VerifyHardwareFlowTrackerStatus (AntaTest ):
52
- """Verifies the hardware flow tracking.
52
+ """Verifies the hardware flow tracking configuration .
53
53
54
54
This test performs the following checks:
55
55
56
56
1. Confirms that hardware flow tracking is running.
57
- 2. Confirms that the specified input tracker is active.
58
- 3. Optionally, checks the tracker interval/timeout configuration.
59
- 4. Optionally, verifies the tracker exporter configuration
57
+ 2. For each specified flow tracker:
58
+ - Confirms that the specified input tracker is active.
59
+ - Optionally, checks the tracker interval/timeout configuration.
60
+ - Optionally, verifies the tracker exporter configuration
60
61
61
62
Expected Results
62
63
----------------
63
64
* Success: The test will pass if all of the following conditions are met:
64
- - All Hardware flow tracking is running.
65
- - The specified input tracker is active.
66
- - The tracker interval/timeout matches the expected values, if provided.
67
- - The exporter configuration matches the expected values, if provided.
65
+ - Hardware flow tracking is running.
66
+ - For each specified flow tracker:
67
+ - The flow tracker is active.
68
+ - The tracker interval/timeout matches the expected values, if provided.
69
+ - The exporter configuration matches the expected values, if provided.
68
70
* Failure: The test will fail if any of the following conditions are met:
69
71
- Hardware flow tracking is not running.
70
- - The specified input tracker is not active.
71
- - The tracker interval/timeout does not match the expected values, if provided.
72
- - The exporter configuration does not match the expected values, if provided.
72
+ - For each specified flow tracker:
73
+ - The flow tracker is not active.
74
+ - The tracker interval/timeout does not match the expected values, if provided.
75
+ - The exporter configuration does not match the expected values, if provided.
73
76
74
77
Examples
75
78
--------
@@ -128,11 +131,11 @@ def test(self) -> None:
128
131
act_interval = tracker_info .get ("activeInterval" )
129
132
if not all ([inactive_interval == act_inactive , on_interval == act_interval ]):
130
133
self .result .is_failure (
131
- f"{ tracker } { tracker .record_export } - Incorrect durations - InActive Timeout: { act_inactive } OnActive Interval: { act_interval } "
134
+ f"{ tracker } , { tracker .record_export } - Incorrect durations - Inactive Timeout: { act_inactive } , OnActive Interval: { act_interval } "
132
135
)
133
136
134
137
# Check the input hardware tracker exporters configuration
135
138
if tracker .exporters :
136
- failed_log = validate_exporters (tracker .exporters , tracker_info )
137
- for log in failed_log :
138
- self .result .is_failure (f"{ tracker } { log } " )
139
+ failure_messages = validate_exporters (tracker .exporters , tracker_info )
140
+ for message in failure_messages :
141
+ self .result .is_failure (f"{ tracker } , { message } " )
0 commit comments