SNMP spytest test cases fail due to SNMP service failure. SNMP service exceeds the restart limit.
Steps to reproduce the issue:
Have a two router setup with Sonic
Run the spytest test case: system/test_snmp.py::test_ft_snmp_link_down_trap
Describe the results you received:
2021-01-21 01:19:47,122 T0000: INFO Restarting the 'snmp' service , post configuring snmp community.
2021-01-21 01:19:47,123 T0000: INFO ####### Restarting snmp service ########
2021-01-21 01:19:47,323 T0000: INFO [D1-SD1] SCMD: sudo service snmp restart
2021-01-21 01:19:58,538 T0000: INFO [D1-SD1] Job for snmp.service failed.
.
.
2021-01-21 01:20:07,401 T0047: INFO [D1-SD1] Jan 21 01:20:05.547450 sonic ERR systemd[1]: Failed to start SNMP container.
Describe the results you expected:
Not to have the script fail while restarting the SNMP container.
There are two possibilities:
a. The test case is incorrectly written
b. Sonic software is restarting the SNMP docker more times than expected.
Additional information you deem important (e.g. issue happens only occasionally):
SNMP service has a limit of 3 starts within 1200 seconds (20 m). The script restarts the SNMP multiple times:
When the config is applied
Enable service timers
Before the start of test (after configuring SNMP)
When configuring : snmptrap modify
After the test (after removing SNMP)
(1) and (2) do not contribute towards the limit. (3), (4) and (5) occur within 20m and (5) fails.
(4) is expected. The sonic code restarts SNMP docker when snmptrap is modified.
It seems like things are working as expected but it is not clear as to why the test is written in this way
SNMP Failure logs at the end of the test:
Jan 21 01:19:57 sonic systemd[1]: snmp.service: Start request repeated too quickly.
Jan 21 01:19:57 sonic systemd[1]: Failed to start SNMP container.
Jan 21 01:19:57 sonic systemd[1]: snmp.service: Unit entered failed state.
Jan 21 01:19:57 sonic systemd[1]: snmp.service: Failed with result 'start-limit-hit'.
Jan 21 01:20:05 sonic systemd[1]: snmp.service: Start request repeated too quickly.
Jan 21 01:20:05 sonic systemd[1]: Failed to start SNMP container.
Jan 21 01:20:05 sonic systemd[1]: snmp.service: Failed with result 'start-limit-hit'.
Jan 21 01:20:48 sonic systemd[1]: snmp.service: Start request repeated too quickly.
Jan 21 01:20:48 sonic systemd[1]: Failed to start SNMP container.
Jan 21 01:20:48 sonic systemd[1]: snmp.service: Failed with result 'start-limit-hit'.
Description
SNMP spytest test cases fail due to SNMP service failure. SNMP service exceeds the restart limit.
Steps to reproduce the issue:
Describe the results you received: 2021-01-21 01:19:47,122 T0000: INFO Restarting the 'snmp' service , post configuring snmp community. 2021-01-21 01:19:47,123 T0000: INFO ####### Restarting snmp service ######## 2021-01-21 01:19:47,323 T0000: INFO [D1-SD1] SCMD: sudo service snmp restart 2021-01-21 01:19:58,538 T0000: INFO [D1-SD1] Job for snmp.service failed. . . 2021-01-21 01:20:07,401 T0047: INFO [D1-SD1] Jan 21 01:20:05.547450 sonic ERR systemd[1]: Failed to start SNMP container.
Describe the results you expected: Not to have the script fail while restarting the SNMP container. There are two possibilities: a. The test case is incorrectly written b. Sonic software is restarting the SNMP docker more times than expected.
Additional information you deem important (e.g. issue happens only occasionally):
SNMP service has a limit of 3 starts within 1200 seconds (20 m). The script restarts the SNMP multiple times:
SNMP Failure logs at the end of the test: Jan 21 01:19:57 sonic systemd[1]: snmp.service: Start request repeated too quickly. Jan 21 01:19:57 sonic systemd[1]: Failed to start SNMP container. Jan 21 01:19:57 sonic systemd[1]: snmp.service: Unit entered failed state. Jan 21 01:19:57 sonic systemd[1]: snmp.service: Failed with result 'start-limit-hit'. Jan 21 01:20:05 sonic systemd[1]: snmp.service: Start request repeated too quickly. Jan 21 01:20:05 sonic systemd[1]: Failed to start SNMP container. Jan 21 01:20:05 sonic systemd[1]: snmp.service: Failed with result 'start-limit-hit'. Jan 21 01:20:48 sonic systemd[1]: snmp.service: Start request repeated too quickly. Jan 21 01:20:48 sonic systemd[1]: Failed to start SNMP container. Jan 21 01:20:48 sonic systemd[1]: snmp.service: Failed with result 'start-limit-hit'.