Skip to content
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

[202111] [YANG] Fix issue: Non compliant leaf list in config_db schema #10768

Merged

Conversation

Junchao-Mellanox
Copy link
Collaborator

@Junchao-Mellanox Junchao-Mellanox commented May 6, 2022

Backport #10291 to 202111

Fix issue: Non compliant leaf list in config_db schema: #9801

The basic flow of DPB is like:

  1. Transfer config db json value to YANG json value, name it “yangIn”
  2. Validate “yangIn” by libyang
  3. Generate a YANG json value to represent the target configuration, name it “yangTarget”
  4. Do diff between “yangIn” and “yangTarget”
  5. Apply the diff to CONFIG DB json and save it back to DB

The fix:
• For step #1, If value of a leaf-list field string type, transfer it to a list by splitting it with “,” the purpose here is to make step#2 happy. We also need to save <table_name>..<field_name> to a set named “leaf_list_with_string_value_set”.
• For step#5, loop “leaf_list_with_string_value_set” and change those fields back to a string.

  1. Manual test
  2. Changed sample config DB and unit test passed

Conflicts:
src/sonic-yang-mgmt/sonic_yang_ext.py

Why I did it

How I did it

How to verify it

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

…net#10291)

Fix issue: Non compliant leaf list in config_db schema: sonic-net#9801

The basic flow of DPB is like:
1.	Transfer config db json value to YANG json value, name it “yangIn”
2.	Validate “yangIn” by libyang
3.	Generate a YANG json value to represent the target configuration, name it “yangTarget”
4.	Do diff between “yangIn” and “yangTarget”
5.	Apply the diff to CONFIG DB json and save it back to DB

The fix:
•	For step #1, If value of a leaf-list field string type, transfer it to a list by splitting it with “,” the purpose here is to make step#2 happy. We also need to save <table_name>.<key>.<field_name> to a set named “leaf_list_with_string_value_set”.
•	For step#5, loop “leaf_list_with_string_value_set” and change those fields back to a string.

1. Manual test
2. Changed sample config DB and unit test passed

Conflicts:
	src/sonic-yang-mgmt/sonic_yang_ext.py
@Junchao-Mellanox Junchao-Mellanox added the Request for 202111 Branch For PRs being requested for 202111 branch label May 6, 2022
@Junchao-Mellanox
Copy link
Collaborator Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Junchao-Mellanox
Copy link
Collaborator Author

Hi @judyjoseph , this is a backport for #10291 , could you please review and sign-off?

@dgsudharsan dgsudharsan removed the Request for 202111 Branch For PRs being requested for 202111 branch label May 9, 2022
@judyjoseph judyjoseph merged commit d0e7d9a into sonic-net:202111 May 9, 2022
@Junchao-Mellanox Junchao-Mellanox deleted the cp-fix-yang-leaf-list branch June 12, 2023 04:36
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.

5 participants