-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GCU] Copying config_db before callding sonic_yang.loadData (#1983)
#### What I did Adding unit-test for cases where `PatchSorter.sort` is called to update config that has tables without YANG. This would sometimes throw the error ``` KeyError: 'NameOfTableWithoutYang' ``` This error happened because `find_ref_paths` would remove tables without yang as a side-effect. Earlier this was fixed by cropping tables without yang models from current and target configs. That fix had 2 issues: - It is not addressing the real problem which is cropping the config as a side effect to `find_ref_paths` - If the move generated by the inner logic of `PatchSorter` was to replace whole config, it would result in replacing whole config with the config with cropped non-yang tables #### How I did it - Fixing `find_ref_paths` to not crop the given config as a side-effect - Added a unit-test for that - Revert the change to crop current config and target config in `PatchSorter.sort` - Added a unit-test to verify replace whole config move does not result unintentionally in removing tables without yang - Added unit-test to verify calling `PatchSorter.sort` on a config with non-yang tables does not result in the exception: ``` KeyError: 'NameOfTableWithoutYang' ``` #### How to verify it unit-tests #### Previous command output (if the output of a command-line utility has changed) #### New command output (if the output of a command-line utility has changed)
- Loading branch information
Showing
5 changed files
with
81 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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