Files
snmp-armada-app/stx-snmp-helm/centos/docker/stx-fm-subagent
Takamasa Takenaka 5642841ebc Retry get alarms/events for SNMP if it fails
Root cause:
SNMP sub-agent uses fm-common library to connect database
to obtain alarm/event list. But after swact, it does not
detect disconnection and as the result, the functions to
obtain alarm/event returns false and does not return proper
list.

Analysis:
fm-common library to connect to the database. It checks
connection by PQstatus() and it will reconnect if it find
connection error. But PQstatus responses CONNECTION_OK
even after swact. The other option to check connection is
using PQPing(). But this method also responses PQPING_OK
even after awact, too.
Other option is sending real SQL and it is same as to
retry. So this solution is to retry to obtain alarm/
event list if it fails.

Solution:
When SNMP sub-agent calls to obtain alarm/event list
and it returns false, retry it. Internally, it reconnects
automatically and it returns the proper list.

Test Plan:
Test the following steps for snmpget, snmpgetnext, snmpbulkget
and snmpwalk in IPv4 and IPv6:
1. Execute "system host-swact controller-n"
2. Send snmp command and record response
3. Send snmp command and record response
4. Compare 2. and 3. response and confirm they are matched
=> all cases PASS

Closes-bug: 1949083

Signed-off-by: Takamasa Takenaka <takamasa.takenaka@windriver.com>
Change-Id: Ib58f9f657bb5ac8c3b505eee5443a24bedb2463e
2021-11-01 17:05:47 +00:00
..