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

Convert snmp.yml to configdb #6205

Merged
merged 10 commits into from
Dec 28, 2020

Conversation

tsvanduyn
Copy link
Contributor

- Why I did it
This PR is in preparation to move from snmp.yml to configdb. This will more closely align with other commands in sonic and use configdb as the source of truth for snmp configuration.

Note: This is the first of 2 PR's to enable this. This PR will not change any functionality but will allow the snmp.yml file info to be put into the configdb.

Once this is verified as working as expected then the updates to the Jinja2 template to only use the snmp info from the configdb and the update to the start.sh to exclude the import of data from the snmp.yml will be done. (This will allow us backward compatiblity since the snmp.yml file info will be installed in the configdb at docker container startup with the conversion script.)

Eventually we will be able to remove the need for the snmp.yml file.

- How I did it
I've created a script that takes the snmp.yml variables and converts them to the configdb format.
In addition this file was added to the dockerfile.j2 so that file will be copied in the container.
As well as updating the start.sh file to automatically run the python conversion script each time the docker container is restarted.

- How to verify it

Before docker restart:

admin@str-s6000-acs-11:~$ sudo vim /etc/sonic/snmp.yml
snmp_location: Emerald City
snmp_rocommunities: [public, Bill, Travis]
snmp_rwcommunity: Joker

admin@str-s6000-acs-11:~$ redis-cli -n 4 keys "*" | grep -i snmp 
SNMP|CONTACT
FEATURE|snmp
admin@str-s6000-acs-11:~$ 

After docker restart:

admin@str-s6000-acs-11:~$ redis-cli -n 4 keys "*" | grep -i snmp 
SNMP|LOCATION
SNMP_COMMUNITY|Joker
SNMP_COMMUNITY|Travis
SNMP|CONTACT
SNMP_COMMUNITY|Bill
SNMP_COMMUNITY|public
FEATURE|snmp
admin@str-s6000-acs-11:~$ 

admin@str-s6000-acs-11:~$ cat /etc/sonic/snmp.yml
snmp_location: Emerald City
snmp_rocommunities: [public, Bill, Travis]
snmp_rwcommunity: Joker
admin@str-s6000-acs-11:~$ 

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

dockers/docker-snmp/snmp_yml_to_configdb.py Outdated Show resolved Hide resolved
dockers/docker-snmp/start.sh Outdated Show resolved Hide resolved
dockers/docker-snmp/snmp_yml_to_configdb.py Outdated Show resolved Hide resolved
dockers/docker-snmp/snmp_yml_to_configdb.py Outdated Show resolved Hide resolved
@lgtm-com

This comment has been minimized.

@tsvanduyn
Copy link
Contributor Author

retest this please

1 similar comment
@tsvanduyn
Copy link
Contributor Author

retest this please

Copy link
Collaborator

@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

dockers/docker-snmp/snmp_yml_to_configdb.py Outdated Show resolved Hide resolved
dockers/docker-snmp/snmp_yml_to_configdb.py Outdated Show resolved Hide resolved
jleveque
jleveque previously approved these changes Dec 18, 2020
@lguohan
Copy link
Collaborator

lguohan commented Dec 21, 2020

retest vs please

@lguohan
Copy link
Collaborator

lguohan commented Dec 21, 2020

retest vsimage please

@jleveque
Copy link
Contributor

Retest vsimage 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.

5 participants