[SNMP:Contact] Fix for config replace failure with SNMP Contact issue #1774
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
==> Issue:
• Config replace/yang-validation fails for SNMP contact configuration.
• In SNMP contact CLI, email field is mandatory
Related to sonic-net/sonic-buildimage#12620
==> Root Cause:
• sonic-snmp.yang defines leaf Contact, but sonic-utilities (CLI backend) writes to ConfigDB with key {contact_name}. So YANG validation fails when the key is {contact_name} and not the string "Contact"
• CLI current implementation is expecting two mandatory arguments
==> Fix:
• sonic-utilities (CLI backend) code is updated to use Yang leaf name "Contact" string as key and user passed input as "value"
• CLI implementation (sonic-utilities) is changed to expect only a single string, where user can pass any string of choice (name, email, phone, address or combination of these). Accordingly, "show" CLIs will display only "contact" instead of "name" & "email"
Tests:
PRs :
sonic-buildimage - sonic-net/sonic-buildimage#19834
sonic-utilities - sonic-net/sonic-utilities#3476
SONiC (docs) - #1774
Signed-off-by: Anukul Verma anukverm@cisco.com