def fetch_sel(self, ipmicmd, clear=False):
        records = []
        # First we do a fetch all without reservation, reducing the risk
        # of having a long lived reservation that gets canceled in the middle
        endat = self._fetch_entries(ipmicmd, 0, records)
        if clear and records:  # don't bother clearing if there were no records
            # To do clear, we make a reservation first...
            rsp = ipmicmd.xraw_command(netfn=0xa, command=0x42)
            rsvid = struct.unpack_from('<H', rsp['data'])[0]
            # Then we refetch the tail with reservation (check for change)
            del records[-1]  # remove the record that's about to be duplicated
            self._fetch_entries(ipmicmd, endat, records, rsvid)
            # finally clear the SEL
            # 0XAA means start initiate, 0x524c43 is 'RCL' or 'CLR' backwards
            clrdata = bytearray(struct.pack('<HI', rsvid, 0xAA524C43))
            ipmicmd.xraw_command(netfn=0xa, command=0x47, data=clrdata)
        # Now to fixup the record timestamps... first we need to get the BMC
        # opinion of current time
        _fix_sel_time(records, ipmicmd)
        return records
Fetch SEL entries
dataset/ETHPy150Open openstack/pyghmi/pyghmi/ipmi/events.py/EventHandler.fetch_sel