-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Missing container in list support in YANG Model #16704 #18091
Conversation
Add support container in list Signed-off-by: vkuk <vkuk@marvell.com>
@wen587 - could you review |
Can we add some test for this? |
I as far as I can see, all tests use existing yang models. And none of them used this feature before. Can I add dummy yang model just for testing ? |
Hi @VladimirKuk , can you check if the buildimage will pass all checks if rebase your PR upon this DHCP PR: #16290 |
Add support container in list Signed-off-by: vkuk <vkuk@marvell.com>
Added test yang model for single/multiple choice(s) in container/list Add test yang model for container in list Signed-off-by: vkuk <vkuk@marvell.com>
Hi @kellyyeh , could you check if your sonic-buildimage PR checker pass or not after placing your PR upon this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Hi, @qiluo-msft, @ganglyu, Could you review so the PR can be merged ? |
@wen587 Is there someone else who can review this ? |
@qiluo-msft please help review or find someone who can review it. |
cases = choice['case'] | ||
# If single choice exists in container/list | ||
if isinstance(choices, dict): | ||
cases = choices['case'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding that this should be validated by libyang. Since the choice is already checked, at least one case must be present otherwise yang file won't be valid.
cases = choice['case'] | ||
# If single choice exists in container/list | ||
if isinstance(choices, dict): | ||
cases = choices['case'] | ||
for case in cases: | ||
self._fillLeafDict(case.get('leaf'), leafDict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 2 lines are duplicated, you may consider reusing. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, but throughout the code every time, there are separation between single element (dict) and multiple (list), they are handled separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no easy way to reuse.
Signed-off-by: vkuk <vkuk@marvell.com>
@qiluo-msft will follow-up. |
Fixes "Missing container in list support in YANG Model #16704"
Why I did it
Adds support for container in list
How I did it
Identify container in list's leaf and add its data.
Fixes "Update dhcpv6 option yang model" #16290
Why I did it
Adds support for single "choice" statement in container/list
How I did it
Check if choice data is dictionary (instead of list).
How to verify it
Reconstruction details in bug's description.
Tested branch (Please provide the tested image version)
202311
Description for the changelog
Adds support for container in list to yang parsing
Link to config_db schema for YANG module changes
https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#dhcp_relay
Signed-off-by: vkuk [vkuk@marvell.com]