Skip to content

[action] [PR:8744] Add a function to compare running config. #8846

Merged
yejianquan merged 1 commit intosonic-net:202205from
mssonicbld:cherry/202205/8744
Jul 7, 2023
Merged

[action] [PR:8744] Add a function to compare running config. #8846
yejianquan merged 1 commit intosonic-net:202205from
mssonicbld:cherry/202205/8744

Conversation

@mssonicbld
Copy link
Copy Markdown
Collaborator

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.

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205

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 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

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

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>
@mssonicbld
Copy link
Copy Markdown
Collaborator Author

Original PR: #8744

@yejianquan yejianquan merged commit 9a82429 into sonic-net:202205 Jul 7, 2023
@mssonicbld mssonicbld deleted the cherry/202205/8744 branch February 4, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants