2
0
mirror of https://opendev.org/x/pyghmi synced 2026-08-28 09:36:43 +00:00

TSMC failed to configure the trap destination

https://gitlab.icelab.lenovo.com/pygcon/pyghmi/commit/2fddbb49fca2b24a7fbc5a3a715f7c5e7121074e (101993) [trap_register] TSMC failed to configure the trap destination on sd350

Configure the destination type to PET trap first, in case the type is email.
In the case of email, TMM will reject to accept the ip as the destination.

Change-Id: Id581bd8204489de1d88d0bc21b74c71e8ed68de2
This commit is contained in:
luyf5
2021-09-01 15:27:47 +08:00
parent 9d548ce378
commit 5c4daa5541
+13 -19
View File
@@ -1208,25 +1208,7 @@ class Command(object):
"""
if channel is None:
channel = self.get_network_channel()
if ip is not None:
destdata = bytearray((channel, 19, destination))
try:
parsedip = socket.inet_aton(ip)
destdata.extend((0, 0))
destdata.extend(parsedip)
destdata.extend(b'\x00\x00\x00\x00\x00\x00')
except socket.error:
if self._supports_standard_ipv6:
parsedip = socket.inet_pton(socket.AF_INET6, ip)
destdata.append(0b10000000)
destdata.extend(parsedip)
else:
destdata = None
self.oem_init()
self._oem.set_alert_ipv6_destination(ip, destination,
channel)
if destdata:
self.xraw_command(netfn=0xc, command=1, data=destdata)
if (acknowledge_required is not None
or retries is not None
or acknowledge_timeout is not None):
@@ -1247,6 +1229,18 @@ class Command(object):
destreq = bytearray((channel, 18))
destreq.extend(currtype)
self.xraw_command(netfn=0xc, command=1, data=destreq)
if ip is not None:
destdata = bytearray((channel, 19, destination))
try:
parsedip = socket.inet_pton(socket.AF_INET, ip)
destdata.extend((0, 0))
destdata.extend(parsedip)
destdata.extend('\x00\x00\x00\x00\x00\x00')
except socket.error:
parsedip = socket.inet_pton(socket.AF_INET6, ip)
destdata.append(0b10000000)
destdata.extend(parsedip)
self.xraw_command(netfn=0xc, command=1, data=destdata)
if not ip == '0.0.0.0':
self._assure_alert_policy(channel, destination)