SIGN IN SIGN UP

snmp: Handle duplicate client creation

afterSnmpClientCreate() had no handler for ObjectAlreadyExists from
the D-Bus Network.Client.Create method. When phosphor-snmp detected a
duplicate SNMP client (same address and port), it threw
ObjectAlreadyExists (errno EEXIST). Since EEXIST != EBADR, the
existing fallthrough logic incorrectly returned
PropertyValueOutOfRange with "SNMPv2c"/"Protocol" instead of
reporting the actual cause.

Add an explicit check for ObjectAlreadyExists before the EBADR check
and map it to the correct Redfish response (resourceAlreadyExists).

Related:
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/90890
https://gerrit.openbmc.org/c/openbmc/phosphor-snmp/+/92218

Change-Id: Ia038795366bf7bf6acf9adcd09ae24d4c56e7172
Signed-off-by: Vijaysankar Ravi <vijaysankarr@ami.com>
V
Vijaysankar Ravi committed
f188deed858de6148365763e641eb5d397e21c23
Parent: 7ca7107