Skip to content

[sonic-yang-mgmt] Adding in_place flag to sonic_yang.loadData #9224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

ghooo
Copy link
Contributor

@ghooo ghooo commented Nov 10, 2021

Why I did it

sonic_yang.loadData was by default removing tables without YANG from the input configdbJson i.e. modifying it in place

How I did it

Added an in_place flag so caller of loadData can decide whether to modify input in place or not.

How to verify it

unit-test added

@ghooo ghooo requested a review from lguohan as a code owner November 10, 2021 17:47
@qiluo-msft
Copy link
Collaborator

@praveen-li Could you help review?

returns: True - success False - failed
"""
def loadData(self, configdbJson, debug=False):
def loadData(self, configdbJson, debug=False, remove_non_yang_in_place=True):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove_non_yang_in_place

About the parameter name, how about copyJson?

@@ -1038,16 +1039,21 @@ def _findXpathList(self, xpath, list, keys):
load_data: load Config DB, crop, xlate and create data tree from it. (Public)
input: data
debug Flag
remove_non_yang_in_place Flag that indicates whether to remove tables without YANG
from configdbJson directly or create a copy and modify it
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modify configdbJson directly or ...

@qiluo-msft
Copy link
Collaborator

       raise SonicYangException("Data Loading Failed\n{}".format(str(e)))

Should we return False according to the function comment?


Refers to: src/sonic-yang-mgmt/sonic_yang_ext.py:1073 in 699c9d4. [](commit_id = 699c9d4, deletion_comment = False)

@ghooo ghooo closed this Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants