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

[yang] sonic-snmp.yang does not align with ConfigDB #12620

Open
isabelmsft opened this issue Nov 7, 2022 · 3 comments
Open

[yang] sonic-snmp.yang does not align with ConfigDB #12620

isabelmsft opened this issue Nov 7, 2022 · 3 comments
Assignees
Labels
Triaged this issue has been triaged YANG YANG model related changes

Comments

@isabelmsft
Copy link
Contributor

isabelmsft commented Nov 7, 2022

Description

sonic-snmp.yang defines leaf Contact, but sonic-utilities writes to ConfigDB with key {contact name}. So YANG validation fails when the key is {contact name} and not the string "Contact"

      leaf Contact {
          type string {
             length "1..255";
          }
          description
            "SNMP System Contact.";
        }

Steps to reproduce the issue:

  1. Create JsonPatch to write to SNMP contact field. Sample JsonPatch:
[{"op": "add", "path": "/SNMP/CONTACT", "value": {}}, {"op": "add", "path": "/SNMP/CONTACT/joe", "value": "joe@contoso.com"}]
  1. Using GCU with JsonPatch above, attempt to update SNMP contact field
admin@vlab-01:~$ sudo config apply-patch patch.json 
Patch Applier: Patch application starting.
Patch Applier: Patch: [{"op": "add", "path": "/SNMP/CONTACT", "value": {}}, {"op": "add", "path": "/SNMP/CONTACT/joe", "value": "joe@contoso.com"}]
Patch Applier: Getting current config db.
Patch Applier: Simulating the target full config after applying the patch.
Patch Applier: Validating target config does not have empty tables, since they do not show up in ConfigDb.
Patch Applier: Sorting patch updates.
Failed to apply patch
Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH
Try "config apply-patch -h" for help.

Error: Given patch will produce invalid config. Error: Data Loading Failed
All Keys are not parsed in SNMP
dict_keys(['joe'])
exceptionList:[]

Describe the results you received:

Failed application of JsonPatch, unable to write to SNMP contact field

Describe the results you expected:

Successful application of JsonPatch

@isabelmsft isabelmsft added the YANG YANG model related changes label Nov 7, 2022
@prgeor prgeor added the Triaged this issue has been triaged label Nov 9, 2022
@qiluo-msft
Copy link
Collaborator

@suresh-rupanagudi Could you help check this bug?

@suresh-rupanagudi
Copy link
Contributor

As per RFC3418 sysContact is defined as follows. Why doe we need to create contact with key?.

sysContact OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"The textual identification of the contact person for
this managed node, together with information on how
to contact this person. If no contact information is
known, the value is the zero-length string."
::= { system 4 }

@zhangyanzhao
Copy link
Collaborator

@qiluo-msft will investigate and update the sonic-utilities logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triaged this issue has been triaged YANG YANG model related changes
Projects
None yet
Development

No branches or pull requests

5 participants