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

upstream snmp sonic-yang files #10828

Merged
merged 6 commits into from
Aug 17, 2022

Conversation

suresh-rupanagudi
Copy link
Contributor

@suresh-rupanagudi suresh-rupanagudi commented May 13, 2022

Fix #10549
Fix #10550

Why I did it

Create sonic yang model for SNMP
Tables:SNMP, SNMP_COMMUNITY

How I did it

Defined yang models based for SNMP based on snmp.yml

How to verify it

Added test cases to verify

"sonic-snmp:sonic-snmp": {
"sonic-snmp:SNMP_COMMUNITY": {
"SNMP_COMMUNITY_LIST": [
{
Copy link
Contributor

@ganglyu ganglyu May 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taken care. Please see new changes

description
"SNMP System Contact.";
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace tab

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken care.

container CONTACT {
leaf Contact {
type string {
length "1..255";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not to allow configuration of empty string.

ganglyu
ganglyu previously approved these changes May 16, 2022
@ganglyu ganglyu self-requested a review May 16, 2022 07:27
@liushilongbuaa
Copy link
Contributor

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

"Contact": "sonic-support@xxx.com"
},
"LOCATION": {
"Location": "Sonic Location"
Copy link
Collaborator

@qiluo-msft qiluo-msft May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sonic

It is not invented by SONiC. Let's call it "SNMP Server Location" #Closed


"SNMP": {
"CONTACT": {
"Contact": "sonic-support@xxx.com"
Copy link
Collaborator

@qiluo-msft qiluo-msft May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sonic-support@xxx.com

Let's use testuser@contoso.com which is more safe. #Closed

ganglyu
ganglyu previously approved these changes May 18, 2022
@suresh-rupanagudi
Copy link
Contributor Author

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 10828 in repo Azure/sonic-buildimage

@suresh-rupanagudi
Copy link
Contributor 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).

@qiluo-msft
Copy link
Collaborator

Could you help resolve the conflict, and merge latest master if not following it?

@qiluo-msft
Copy link
Collaborator

Could you merge master again and resolve the conflicts?

@suresh-rupanagudi
Copy link
Contributor Author

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 10828 in repo Azure/sonic-buildimage

@suresh-rupanagudi
Copy link
Contributor 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).

@wen587
Copy link
Contributor

wen587 commented Jul 28, 2022

Hi @suresh-rupanagudi , I saw the test always fail on GCU test.

Error: Given patch will produce invalid config. Error: Data Loading Failed\nAll Keys are not parsed in SNMP_COMMUNITY\ndict_keys(['public'])\nexceptionList:[\"'TYPE'\"]",

Here is the reason:
In your defined YANG MODEL, the leaf type is lowercase. https://github.com/Azure/sonic-buildimage/blob/8bd08d2658bf28524cec08da7138ba630c22f4dd/src/sonic-yang-models/yang-models/sonic-snmp.yang#L63

But in SONiC default config, the type is by default uppercase. Below is the example of my SONiC config.

    "SNMP_COMMUNITY": {
        "public": {
            "TYPE": "RO"                    <=uppercase `TYPE`
        }
    }

I think the default SONiC SNMP config need to be updated.

@suresh-rupanagudi
Copy link
Contributor Author

Thanks JingWeng, Gang for looking into this.
1)why are we not getting this error when we build "sonic-broadcom.bin" locally?.
What needs to be done to run this locally?.

Now solution is
1)to change "type" to "TYPE" in yang file. OR
2)change "TYPE" to "type" in snmp_yml_to_configdb.py file. We might also need to take care all the tests where community is used.
Yang standard allows defining identifier with capital letters.
But I could not see any yang module using this.
Please let me know

From rfc8407.

"Identifiers SHOULD follow a consistent naming pattern throughout the
module. Only lowercase letters, numbers, and dashes SHOULD be used
in identifier names. Uppercase characters, the period character, and
the underscore character MAY be used if the identifier represents a
well-known value that uses these characters. YANG does not permit
any other characters in YANG identifiers."

@ganglyu
Copy link
Contributor

ganglyu commented Jul 28, 2022 via email

@wen587
Copy link
Contributor

wen587 commented Aug 11, 2022

Thanks JingWeng, Gang for looking into this. 1)why are we not getting this error when we build "sonic-broadcom.bin" locally?. What needs to be done to run this locally?.

1)Because it doesn't have any test failures during the image build.
It failed during the sonic-mgmt test, because the actual config is not as that as we defined.

For example, you define the SNMP_COMMUNITY['public']['type'] with RO or RW, so you just test the config here with

        "SNMP_COMMUNITY": {
            "public": {
                "type": "RO"           <===== lowercase 'type'
            },

However it tested real machine during sonic-mgmt test and found that the real config doesn't validate SNMP_COMMUNITY's YANG. Because the real config is

    "SNMP_COMMUNITY": {
        "public": {
            "TYPE": "RO"             <===== uppercase 'TYPE'
        }
    },

What needs to be done to run this locally?.

I think you can modify the config here and change type to TYPE. It also need related YANG model update.

@suresh-rupanagudi
Copy link
Contributor 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).

@suresh-rupanagudi
Copy link
Contributor Author

Hi jingwenxie,
Can you please look at failures.

@yxieca
Copy link
Contributor

yxieca commented Aug 26, 2022

@suresh-rupanagudi this change cannot be cherrypicked to 202205 cleanly. Please create new PR for 202205 branch.

@yxieca
Copy link
Contributor

yxieca commented Jan 19, 2023

@suresh-rupanagudi, @zhangyanzhao, can you help create separate PR for 202205 branch? If the change has been done. Please link the 202205 PR to this PR so that I can close the cherry-picking request.

@suresh-rupanagudi
Copy link
Contributor Author

ETA for PR on 202205 branch is 2/20/2023

@yxieca yxieca added the Request for 202111 Branch For PRs being requested for 202111 branch label Feb 2, 2023
@yxieca
Copy link
Contributor

yxieca commented Feb 2, 2023

@suresh-rupanagudi is this PR not needed for 202211 branch?

@yxieca yxieca added Request for 202205 Branch and removed Request for 202205 Branch Request for 202111 Branch For PRs being requested for 202111 branch labels Feb 2, 2023
@suresh-rupanagudi
Copy link
Contributor Author

Hi,
Created new PR on 202205
#13896

Not sure if this PR required for 202211 branch. Please cherry pick changes if required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[yang] Need Yang for SNMP_COMMUNITY table [yang] Need Yang for SNMP table
7 participants