From 5c4daa5541a5f6e5e091ae1de9f130be7466e652 Mon Sep 17 00:00:00 2001 From: luyf5 Date: Wed, 1 Sep 2021 15:27:47 +0800 Subject: [PATCH] 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 --- pyghmi/ipmi/command.py | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index c44b4535..5cbefcd7 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -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)