Missing container in list support in YANG Model #16704#18091
Missing container in list support in YANG Model #16704#18091qiluo-msft merged 4 commits intosonic-net:masterfrom
Conversation
Add support container in list Signed-off-by: vkuk <[email protected]>
|
@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 <[email protected]>
Added test yang model for single/multiple choice(s) in container/list Add test yang model for container in list Signed-off-by: vkuk <[email protected]>
|
Hi @kellyyeh , could you check if your sonic-buildimage PR checker pass or not after placing your PR upon this PR? |
|
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.
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.
| if isinstance(choices, dict): | ||
| cases = choices['case'] | ||
| for case in cases: | ||
| self._fillLeafDict(case.get('leaf'), leafDict) |
There was a problem hiding this comment.
The 2 lines are duplicated, you may consider reusing. #Closed
There was a problem hiding this comment.
You are right, but throughout the code every time, there are separation between single element (dict) and multiple (list), they are handled separately.
Signed-off-by: vkuk <[email protected]>
|
@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 [[email protected]]