Add route flow counter related test cases#5134
Add route flow counter related test cases#5134Junchao-Mellanox wants to merge 10 commits intosonic-net:masterfrom
Conversation
Change-Id: I4b9b1dd1c5372645c67511ddcc667b99f427d556
|
This pull request introduces 1 alert when merging 5469367 into 8b81dc8 - view on LGTM.com new alerts:
|
Change-Id: I70d4fdd3160e7a31dfca66d829491b19630adc92
|
The failure is expected because some the feature PRs are still in review. |
Conflicts: tests/vxlan/test_vnet_vxlan.py Change-Id: Ia9bc3b3523c6c3f547a745ed1530fb7c143bac45
|
@roysr-nv could you please review? |
roy-sror
left a comment
There was a problem hiding this comment.
Hi Junchao,
Apart from the specific comments, I have some general notes:
- Please use allure steps.
- I suggest to combine test_update_route_pattern and test_add_remove_route - I don't see any reason to cover it separately.
- in the new route flow tests - please make sure that cleanup is done in any case, even if exception is thrown during the test execution.
- Can you please share the test runtime.
| support_route_flow_counter = True | ||
| elif support == 'false': | ||
| support_route_flow_counter = False | ||
| return support_route_flow_counter is not None |
There was a problem hiding this comment.
Can't we simply return the variable?
There was a problem hiding this comment.
No. get_route_flow_counter_capability is a callback of wait_until, the return value indicates that whether wait_until need continue running. If we return the support_route_flow_counter, there could be case that: support_route_flow_counter is False and wait_until will continue running until timeout.
There was a problem hiding this comment.
how about raising an exception if the value is None? wait_until should return False in that case
There was a problem hiding this comment.
The semantic here is to "wait support_route_flow_counter until there is a value", so I support "return support_route_flow_counter is not None" just matches the semantic.
| dut.command('counterpoll flowcnt-route interval {}'.format(interval)) | ||
|
|
||
|
|
||
| def set_route_flow_counter_pattern(dut, route_pattern, max_match_count=30): |
There was a problem hiding this comment.
To me it seems more readable to get another parameter- VRF, rather than encapsulating it in the route pattern string
There was a problem hiding this comment.
Indeed, using VRF and prefix here makes this function more readable. However, I would like to keep this based on two reasons:
- Most of case VRF is none(default VRF)
- If we use VRF and prefix, the caller has to use a tuple (, ) to represent the route pattern, it increases unneeded complexity of caller side. And a tuple is not so readable.
| Returns: | ||
| bool: Match if True. | ||
| """ | ||
| logger.info('Expected stats: {}'.format(expect_stats)) |
There was a problem hiding this comment.
here I suggest to exit the function only once(at the end), so we can set the rc and message when needed and return it at the end
There was a problem hiding this comment.
Prefer to keep this. There is a "for loop in for loop" in this function, it is hard to use rc in the inner loop.
for key, value in expect_stats.items():
if key not in actual_stats:
return False, 'Failed to find {} in result'.format(key)
for stats_type, expect_value in value.items():
if int(expect_value) != int(actual_stats[key][stats_type].replace(',', '')):
return False, 'Expected {} value of {} is {}, but got {}'.format(stats_type, key, expect_value, actual_stats[key][stats_type])
I will fix 1~3. For item#2, I will remove test_add_remove_route since it is fully covered by test_update_route_pattern. Will update test runtime after all fixes. |
Change-Id: Iad925eaf3c605780e9d41802240ba89b8a4dce2f
|
Hi @roysr-nv, the test run time is about 180 seconds. |
Change-Id: I75d88cdd90244de99f832f154716ca6ad001c1b2
|
Hi @roysr-nv, could you please review again? |
|
This pull request introduces 2 alerts when merging 5d6cc25 into 71e0833 - view on LGTM.com new alerts:
|
Change-Id: If6e571d803b7ba8702164f000ac7a0a10919f175
|
This pull request introduces 2 alerts when merging 0d7cd5f into 38d6d3a - view on LGTM.com new alerts:
|
|
This pull request introduces 2 alerts when merging 6f2fe3e into c453cf4 - view on LGTM.com new alerts:
|
Change-Id: I89c90deabd38720136ab2dea5b1eb38283f1bcf2
|
This pull request introduces 2 alerts when merging f9278f7 into b2cc638 - view on LGTM.com new alerts:
|
Change-Id: I7b304d40004ea699c29d61d88b7bd1f64ec63a53
|
This pull request introduces 2 alerts when merging e2fe2d8 into 1193c99 - view on LGTM.com new alerts:
|
|
/azp run Azure.sonic-mgmt |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
It seems it is not using the latest sonic-utilities. |
|
/azpw run Azure.sonic-mgmt |
|
/AzurePipelines run Azure.sonic-mgmt |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azpw run Azure.sonic-mgmt |
|
/AzurePipelines run Azure.sonic-mgmt |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azpw run Azure.sonic-mgmt |
|
/AzurePipelines run Azure.sonic-mgmt |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Azure.sonic-mgmt |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azpw run Azure.sonic-mgmt |
|
/AzurePipelines run Azure.sonic-mgmt |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
This pull request introduces 2 alerts when merging 8e31615 into 99ef5c3 - view on LGTM.com new alerts:
|
|
Closed as this PR always use old SONiC image, new PR created: #5736 |
HLD:
sonic-net/SONiC#908
Change-Id: I4b9b1dd1c5372645c67511ddcc667b99f427d556
Description of PR
Summary:
Added test cases for route flow counter feature
Type of change
Back port request
Approach
What is the motivation for this PR?
Add route flow counter related test cases
How did you do it?
How did you verify/test it?
Run the test cases
Any platform specific information?
N/A
Supported testbed topology if it's a new test case?
N/A
Documentation