-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[yang] DPB fails when BUFFER_PORT_EGRESS_PROFILE is configured #9801
Comments
Need BUFFER_PORT_EGRESS_PROFILE YANG model owner to take a look. Viswanath will follow up. |
Hi @zhangyanzhao, I suppose this issue is related to function _findYangTypedValue: https://github.com/Azure/sonic-buildimage/blob/b621dafff77642db541553f5a2f8ec85e70ea695/src/sonic-yang-mgmt/sonic_yang_ext.py#L410 The issue is that when a CONFIG DB field is defined as "leaf-list", it is usually a comma separated string in CONFIG DB. In this case, the value is "egress_lossless_profile,egress_lossy_profile". Function _findYangTypedValue will iterate this string and put it to vValue. Hence, the vValue is "e,g,r,e,s,s...". Apparently, "e" is not a valid value of field "profile_list". I suppose a possible fix is to fix function _findYangTypedValue line 410 to something like: if leafDict[key]['__isleafList']:
vValue = list()
if isinstance(value, str):
value = (x.strip() for x in value.split(','))
for v in value:
vValue.append(_yangConvert(v)) I did a simple test based on the fix, it works, but I suppose we still need sonic-yang-mgmt owner to confirm that this is a valid fix. |
@praveen-li @zhangyanzhao @zhenggen-xu Can you please prioritize this? |
Not sure, How the tests for PR #7838 passed in this case ? @AmitKaushik7, @dgsudharsan @zhangyanzhaoSeems by using a HACK in test config. I guess, SOT for config is important, because either config used in test or used in this issue is wrong.
Ideal fix maybe to convert String to List in Back-end i.e. in orchagent code. OR |
@bandaru-viswanath will work with @dgsudharsan and @praveen-li on this issue. |
@bandaru-viswanath any update? as this issue for 202111 can you please provide ETA? |
@liat-grozovik We checked and asked the concerned person to work on this. Will get back to you on the ETA. |
Hi @liat-grozovik , I have a proposal for this issue, will include you to the loop. |
@alexrallen Could you help me understand the problem statement?
I checked code in src/sonic-yang-models/tests/files/sample_config_db.json, and the appropriate configuration should be a list of strings. |
This is what is used in the test for this Yang model (this is working)
This is what we are giving in CONFIG_DB
You can see the former is a JSON list and the latter is a comma separated list. This is a discrepancy. |
As alexrallen pointed that BUFFER_PORT_EGRESS_PROFILE_LIST and BUFFER_PORT_INGRESS_PROFILE_LIST yang files are incorrectly having the profile_list |
#### Why I did it Fix issue: Non compliant leaf list in config_db schema: #9801 #### How I did it 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. #### How to verify it 1. Manual test 2. Changed sample config DB and unit test passed
…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
#10768) 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>.<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
…net#10291) #### Why I did it Fix issue: Non compliant leaf list in config_db schema: sonic-net#9801 #### How I did it 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. #### How to verify it 1. Manual test 2. Changed sample config DB and unit test passed
When we configure the following buffer profiles....
Dynamic port breakout fails with...
This is likely due to the fact that the Yang model is configured with the following expectation for profile_list (a JSON list) which does not match what is the appropriate configuration (a comma separated string).
This needs to be reconciled in some manner.
The text was updated successfully, but these errors were encountered: