[action] [PR:8744] Add a function to compare running config. #8846
Merged
yejianquan merged 1 commit intosonic-net:202205from Jul 7, 2023
Merged
[action] [PR:8744] Add a function to compare running config. #8846yejianquan merged 1 commit intosonic-net:202205from
yejianquan merged 1 commit intosonic-net:202205from
Conversation
Description of PR
We only use `==` to compare running config before, but our running config is a nested dict, and if the value is disordered, it will wrongly return false. Just in module `acl/test_acl_outer_vlan.py`, it somehow change the order of part of the running dict from `{"DATAACL": {"ports": ["PortChannel101", "PortChannel102", "PortChannel104", "PortChannel103"]}}` to `{"DATAACL": {"ports": ["PortChannel101", "PortChannel102", "PortChannel103", "PortChannel104"]}}`. And this disorder will cause config reload after running all cases in this module. In this PR, I add a function to compare running config, which will avoid such wrong judgement caused by order.
What is the motivation for this PR?
We only use `==` to compare running config before, but our running config is a nested dict, and if the value is disordered, it will wrongly return false. Just in module `acl/test_acl_outer_vlan.py`, it somehow change the order of part of the running dict from `{"DATAACL": {"ports": ["PortChannel101", "PortChannel102", "PortChannel104", "PortChannel103"]}}` to `{"DATAACL": {"ports": ["PortChannel101", "PortChannel102", "PortChannel103", "PortChannel104"]}}`. And this disorder will cause config reload after running all cases in this module. In this PR, I add a function to compare running config, which will avoid such wrong judgement caused by order.
How did you do it?
Add a function to compare two running config dict.
How did you verify/test it?
```
06:35:15 conftest.core_dump_and_config_check L2115 INFO | Core dump and config check passed for acl/test_acl_outer_vlan.py
```
Signed-off-by: Yutong Zhang <yutongzhang@microsoft.com>
6 tasks
Collaborator
Author
|
Original PR: #8744 |
yutongzhang-microsoft
approved these changes
Jul 7, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
We only use
==to compare running config before, but our running config is a nested dict, and if the value is disordered, it will wrongly return false. Just in moduleacl/test_acl_outer_vlan.py, it somehow change the order of part of the running dict from{"DATAACL": {"ports": ["PortChannel101", "PortChannel102", "PortChannel104", "PortChannel103"]}}to{"DATAACL": {"ports": ["PortChannel101", "PortChannel102", "PortChannel103", "PortChannel104"]}}. And this disorder will cause config reload after running all cases in this module. In this PR, I add a function to compare running config, which will avoid such wrong judgement caused by order.Summary:
Fixes # (issue)
Type of change
Back port request
Approach
What is the motivation for this PR?
We only use
==to compare running config before, but our running config is a nested dict, and if the value is disordered, it will wrongly return false. Just in moduleacl/test_acl_outer_vlan.py, it somehow change the order of part of the running dict from{"DATAACL": {"ports": ["PortChannel101", "PortChannel102", "PortChannel104", "PortChannel103"]}}to{"DATAACL": {"ports": ["PortChannel101", "PortChannel102", "PortChannel103", "PortChannel104"]}}. And this disorder will cause config reload after running all cases in this module. In this PR, I add a function to compare running config, which will avoid such wrong judgement caused by order.How did you do it?
Add a function to compare two running config dict.
How did you verify/test it?
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation