[sonic_cli_gen] Add YANG refine support#2804
Conversation
|
@qiluo-msft could you please help to review? |
|
@qiluo-msft kindly reminder to review. |
|
@qiluo-msft any comments or we can go a head and merge? |
|
|
||
| if y_leaf.get('mandatory') is not None: | ||
| return True | ||
| if y_leaf.get('mandatory') is None: |
There was a problem hiding this comment.
This is not a bug fix.
I've changed the logic of this function because before YANG refine support feature extension the YANG leaf[mandatory] statement has only the true value OR YANG leaf[mandatory] doesn't exist at all
There was a problem hiding this comment.
Logic of both code is same.
Though, assume we have to wrap it in try-catch. In that case, what should be return value from catch block i.e. in exception case?
-- If false then current block is good.
-- If true then new block is good.
I prefer, false, because by default, each node is non mandatory.
Signed-off-by: vadymhlushko-mlnx <[email protected]>
f37bd24 to
ad4776f
Compare
|
@qiluo-msft will further check and merge. Thanks. |
|
@qiluo-msft since it has been approved, would you please help to merge it. |
|
enhancement, no for cherry-pick |
#### What I did Add [YANG "refine"](https://www.rfc-editor.org/rfc/rfc7950.html#section-7.13.2) support for the `sonic_cli_gen` utility. YANG refine is used to override the `description` and `mandatory` statements for YANG `grouping`. #### How I did it Modify the `sonic_cli_gen/yang_parser.py` #### How to verify it Modify the `sonic_cli_gen` UT
|
@StormLiangMS it should be cherry-picked to the |
|
@StormLiangMS This is not a feature enhancement but required for yang models that are backported as fix to use refine keyword. Please help to cherry-pick |
|
@StormLiangMS This change was not cherry-picked to 202305 but the label was added. Can you please check? |
#### What I did Add [YANG "refine"](https://www.rfc-editor.org/rfc/rfc7950.html#section-7.13.2) support for the `sonic_cli_gen` utility. YANG refine is used to override the `description` and `mandatory` statements for YANG `grouping`. #### How I did it Modify the `sonic_cli_gen/yang_parser.py` #### How to verify it Modify the `sonic_cli_gen` UT
What I did
Add YANG "refine" support for the
sonic_cli_genutility.YANG refine is used to override the
descriptionandmandatorystatements for YANGgrouping.How I did it
Modify the
sonic_cli_gen/yang_parser.pyHow to verify it
Modify the
sonic_cli_genUTPrevious 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)