Open alexrallen opened 2 years ago
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 https://github.com/Azure/sonic-buildimage/pull/7838 passed in this case ?
"BUFFER_PORT_EGRESS_PROFILE_LIST": {
"Ethernet9": {
"profile_list": ["egress_lossless_profile", "egress_lossy_profile"] <<<< List is not correct config?
}
},
Ideal fix maybe to convert String to List in Back-end i.e. in orchagent code. OR have a must condition or custom-validator here.
@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?
@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?
what is the appropriate configuration (a comma separated string)
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)
"sonic-buffer-port-egress-profile-list:sonic-buffer-port-egress-profile-list": {
"sonic-buffer-port-egress-profile-list:BUFFER_PORT_EGRESS_PROFILE_LIST": {
"BUFFER_PORT_EGRESS_PROFILE_LIST_LIST": [
{
"port": "Ethernet4",
"profile_list": ["lossless_buffer_profile", "lossless_buffer_profile2"]
}
]
}
}
This is what we are giving in CONFIG_DB
"BUFFER_PORT_EGRESS_PROFILE_LIST": {
"Ethernet0": {
"profile_list": "egress_lossless_profile,egress_lossy_profile"
}
}
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 as Lists ("profile_list": ["lossless_buffer_profile", "lossless_buffer_profile2"]). Rather these leaves should have been a comma separated string ("profile_list": "lossless_buffer_profile, lossless_buffer_profile2".).
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.