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

[config] Add snmp-community command to set SNMP community string #687

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

samaity
Copy link
Contributor

@samaity samaity commented Sep 30, 2019

Signed-off-by: Sangita Maity sangitamaity0211@gmail.com

- What I did
added a new command called snmp-community to set SNMP community string or add to snmp_rocommunities.

- How I did it

followed the below doc.
Set SNMP community string

- How to verify it

before this feature is implemented, there was no snmp-community command under config CLI.

There's only one SNMP community string named public

admin@lnos-x1-a-fab01:~$ sudo cat /etc/sonic/snmp.yml
snmp_location: public
snmp_rocommunity : public




admin@lnos-x1-a-fab01:~$ sudo docker exec -it snmp snmpwalk -v2c -c public 127.0.0.1 iso.3.6.1.2.1.1.1.0

iso.3.6.1.2.1.1.1.0 = STRING: "SONiC Software Version: SONiC.lnos_v2.0.0 - HwSku: Seastone-DX010-10-50 - Distribution: Debian 9.11 - Kernel: 4.9.0-9-amd64"

There is no SNMP community string named new_public. so, snmpwalk got failed.

admin@lnos-x1-a-fab01:~$ sudo docker exec -it snmp snmpwalk -v2c -c new_public 127.0.0.1 iso.3.6.1.2.1.1.1.0

Timeout: No Response from 127.0.0.1
admin@lnos-x1-a-fab01:~$

After this feature is implemented

admin@lnos-x1-a-fab01:~$ sudo config snmp-community new_public
Restarting SNMP service...

so a new SNMP community string named new_public has been added.

admin@lnos-x1-a-fab01:~$ cat /etc/sonic/snmp.yml
snmp_location: public
snmp_rocommunities:
- public
- new_public

Both the community strings are working fine with snmpwalk.

admin@lnos-x1-a-fab01:~$ sudo docker exec -it snmp snmpwalk -v2c -c public 127.0.0.1 iso.3.6.1.2.1.1.1.0
iso.3.6.1.2.1.1.1.0 = STRING: "SONiC Software Version: SONiC.lnos_v2.0.0 - HwSku: Seastone-DX010-10-50 - Distribution: Debian 9.11 - Kernel: 4.9.0-9-amd64"

admin@lnos-x1-a-fab01:~$ sudo docker exec -it snmp snmpwalk -v2c -c new_public 127.0.0.1 iso.3.6.1.2.1.1.1.0
iso.3.6.1.2.1.1.1.0 = STRING: "SONiC Software Version: SONiC.lnos_v2.0.0 - HwSku: Seastone-DX010-10-50 - Distribution: Debian 9.11 - Kernel: 4.9.0-9-amd64"

@samaity
Copy link
Contributor Author

samaity commented Oct 15, 2019

@jleveque, kindly review this PR.

jleveque
jleveque previously approved these changes Oct 16, 2019
Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

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

Looks good to me. @qiluo-msft to review, as well.

@samaity
Copy link
Contributor Author

samaity commented Oct 16, 2019

Looks good to me. @qiluo-msft to review, as well.

Thank you @jleveque for this quick review!!! 👍

config/main.py Outdated Show resolved Hide resolved
Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

As comments

config/main.py Outdated Show resolved Hide resolved
Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

New comments added.

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

New comments added.

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
config/main.py Outdated Show resolved Hide resolved
Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

As comment

config/main.py Outdated Show resolved Hide resolved
Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

minor format issues

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@jleveque
Copy link
Contributor

Retest this please

@samaity
Copy link
Contributor Author

samaity commented Feb 5, 2020

@jleveque, do you have any idea when it can be merged? I can see three test case failures which is not related to my changes, I believe. Is there something I can do from my end?

@samaity
Copy link
Contributor Author

samaity commented Mar 9, 2020

retest this please

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.

3 participants