Skip to content

Commit ffdaef9

Browse files
authored
[chassis-packet][SNMP] Enable SNMP dynamic frequency on packet chassis (#21430)
<!-- Please make sure you've read and understood our contributing guidelines: https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md failure_prs.log Make sure all your commits include a signature generated with `git commit -s` ** If this is a bug fix, make sure your description includes "fixes #xxxx", or "closes #xxxx" or "resolves #xxxx" Please provide the following information: --> #### Why I did it It's one part of the fixes of #21314 SNMP walker request will always timeout when 100% CPU utilization. ##### Work item tracking - Microsoft ADO **30112399**: #### How I did it Enable SNMP dynamic frequency on packet chassis. #### How to verify it snmp/test_snmp_cpu.py(https://github.com/sonic-net/sonic-mgmt/blob/master/tests/snmp/test_snmp_cpu.py) tests the scenario. And the test case passes in my local run. <!-- If PR needs to be backported, then the PR must be tested against the base branch and the earliest backport release branch and provide tested image version on these two branches. For example, if the PR is requested for master, 202211 and 202012, then the requester needs to provide test results on master and 202012. --> #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 - [ ] 202205 - [ ] 202211 - [ ] 202305 - [x] 202405 #### Tested branch (Please provide the tested image version) <!-- - Please provide tested image version - e.g. - [x] 20201231.100 --> - [ ] <!-- image version 1 --> - [ ] <!-- image version 2 --> #### Description for the changelog <!-- Write a short (one line) summary that describes the changes in this pull request for inclusion in the changelog: --> For issue: #21314 Change of SNMP-AgentX sonic-net/sonic-snmpagent#345 will fix the issue. But we want to limit the scope of the change, since we only see this issue on packet-chassis and old devices with low performance CPUs. <!-- Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU. --> #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md --> #### A picture of a cute animal (not mandatory but encouraged)
1 parent ad2cfab commit ffdaef9

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

dockers/docker-snmp/Dockerfile.j2

+3-2
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,15 @@ RUN apt-get -y purge \
6666
find / | grep -E "__pycache__" | xargs rm -rf && \
6767
rm -rf /debs /python-wheels ~/.cache
6868

69+
COPY ["docker-snmp-init.sh", "/usr/bin/"]
6970
COPY ["start.sh", "/usr/bin/"]
7071
COPY ["snmp_yml_to_configdb.py", "/usr/bin/"]
71-
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
7272
COPY ["*.j2", "/usr/share/sonic/templates/"]
7373
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
7474
COPY ["critical_processes", "/etc/supervisor"]
7575

7676
# Although exposing ports is not needed for host net mode, keep it for possible bridge mode
7777
EXPOSE 161/udp 162/udp
7878

79-
ENTRYPOINT ["/usr/local/bin/supervisord"]
79+
RUN chmod +x /usr/bin/docker-snmp-init.sh
80+
ENTRYPOINT ["/usr/bin/docker-snmp-init.sh"]
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
#Generate supervisord.conf based on device metadata
3+
mkdir -p /etc/supervisor/conf.d/
4+
sonic-cfggen -d -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
5+
exec /usr/local/bin/supervisord

dockers/docker-snmp/supervisord.conf dockers/docker-snmp/supervisord.conf.j2

+4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ dependent_startup=true
5050
dependent_startup_wait_for=start:exited
5151

5252
[program:snmp-subagent]
53+
{% if DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
54+
command=/usr/bin/env python3 -m sonic_ax_impl --enable_dynamic_frequency
55+
{% else %}
5356
command=/usr/bin/env python3 -m sonic_ax_impl
57+
{% endif %}
5458
priority=4
5559
autostart=false
5660
autorestart=false

0 commit comments

Comments
 (0)