Skip to content

Commit a7b9d75

Browse files
NOS-225: Check for no packets received in sflow PTF test (sonic-net#1111)
<!-- Please make sure you've read and understood our contributing guidelines; https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md Please provide following information to help code review process a bit easier: --> ### Description of PR <!-- - Please include a summary of the change and which issue is fixed. - Please also include relevant motivation and context. Where should reviewer start? background context? - List any dependencies that are required for this change. --> Summary: Currently the test will fail with a KeyError somewhere random, because it assumes it will always get at least one packet. But if the test is badly failing, that might not be true. Better to have a clear error and failure point. Fixes # (issue) ### Type of change <!-- - Fill x for your type of change. - e.g. - [x] Bug fix --> - [x] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [ ] Test case improvement ### Back port request - [x] 202505 - [x] 202511 ### Approach #### What is the motivation for this PR? #### How did you do it? #### How did you verify/test it? #### Any platform specific information? #### Supported testbed topology if it's a new test case? ### Documentation <!-- (If it's a new feature, new test case) Did you update documentation/Wiki relevant to your implementation? Link to the wiki page? -->
1 parent b74ad71 commit a7b9d75

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

ansible/roles/test/files/ptftests/py3/sflow_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ def analyze_counter_sample(self, data, collector, polling_int, port_sample):
231231
# ---------------------------------------------------------------------------
232232

233233
def analyze_flow_sample(self, data, collector):
234+
self.assertTrue(data.get('flow_port_count', False), "No packets collected on any interface")
234235
logging.info("packets collected from interfaces ifindex : %s" %
235236
data['flow_port_count'])
236237
logging.info("Expected number of packets from each port : %s to %s" % (

0 commit comments

Comments
 (0)