示例#1
0
 def probe(self):
     if self.info.get('enclosure.bay', 0) == 0:
         self.scan()
     if self.info.get('enclosure.bay', 0) != 0:
         # scan has already populated info
         return
     ff = self.info.get('attributes', {}).get('enclosure-form-factor', '')
     if ff != 'dense-computing':
         return
     try:
         # we are a dense platform, but the SLP data did not give us slot
         # attempt to probe using IPMI
         ipmicmd = self._get_ipmicmd()
         guiddata = ipmicmd.xraw_command(netfn=6, command=8)
         self.info['uuid'] = pygutil.decode_wireformat_uuid(
             guiddata['data']).lower()
         ipmicmd.oem_init()
         bayid = ipmicmd._oem.immhandler.get_property(
             '/v2/cmm/sp/7')
         if not bayid:
             return
         self.info['enclosure.bay'] = int(bayid)
         smmid = ipmicmd._oem.immhandler.get_property(
             '/v2/ibmc/smm/chassis/uuid')
         if not smmid:
             return
         smmid = smmid.lower().replace(' ', '')
         smmid = '{0}-{1}-{2}-{3}-{4}'.format(smmid[:8], smmid[8:12],
                                              smmid[12:16], smmid[16:20],
                                              smmid[20:])
         self.info['enclosure.uuid'] = smmid
         self.info['enclosure.type'] = 'smm'
     except pygexc.IpmiException as ie:
         print(repr(ie))
         raise
示例#2
0
 def process_fru(self, fru):
     if fru is None:
         return fru
     if self.has_tsm:
         fru['oem_parser'] = 'lenovo'
         # Thinkserver lays out specific interpretation of the
         # board extra fields
         _, _, wwn1, wwn2, mac1, mac2 = fru['board_extra']
         if wwn1 not in ('0000000000000000', ''):
             fru['WWN 1'] = wwn1
         if wwn2 not in ('0000000000000000', ''):
             fru['WWN 2'] = wwn2
         if mac1 not in ('00:00:00:00:00:00', ''):
             fru['MAC Address 1'] = mac1
         if mac2 not in ('00:00:00:00:00:00', ''):
             fru['MAC Address 2'] = mac2
         try:
             # The product_extra field is UUID as the system would present
             # in DMI.  This is different than the two UUIDs that
             # it returns for get device and get system uuid...
             byteguid = fru['product_extra'][0]
             # It can present itself as claiming to be ASCII when it
             # is actually raw hex.  As a result it triggers the mechanism
             # to strip \x00 from the end of text strings.  Work around this
             # by padding with \x00 to the right if less than 16 long
             byteguid.extend('\x00' * (16 - len(byteguid)))
             fru['UUID'] = util.decode_wireformat_uuid(byteguid)
         except (AttributeError, KeyError):
             pass
         return fru
     else:
         fru['oem_parser'] = None
         return fru
示例#3
0
 def process_fru(self, fru):
     if fru is None:
         return fru
     if self.has_tsm:
         fru['oem_parser'] = 'lenovo'
         # Thinkserver lays out specific interpretation of the
         # board extra fields
         try:
             _, _, wwn1, wwn2, mac1, mac2 = fru['board_extra']
             if wwn1 not in ('0000000000000000', ''):
                 fru['WWN 1'] = wwn1
             if wwn2 not in ('0000000000000000', ''):
                 fru['WWN 2'] = wwn2
             if mac1 not in ('00:00:00:00:00:00', ''):
                 fru['MAC Address 1'] = mac1
             if mac2 not in ('00:00:00:00:00:00', ''):
                 fru['MAC Address 2'] = mac2
         except (AttributeError, KeyError):
             pass
         try:
             # The product_extra field is UUID as the system would present
             # in DMI.  This is different than the two UUIDs that
             # it returns for get device and get system uuid...
             byteguid = fru['product_extra'][0]
             # It can present itself as claiming to be ASCII when it
             # is actually raw hex.  As a result it triggers the mechanism
             # to strip \x00 from the end of text strings.  Work around this
             # by padding with \x00 to the right if less than 16 long
             byteguid.extend('\x00' * (16 - len(byteguid)))
             if byteguid not in ('\x20' * 16, '\x00' * 16, '\xff' * 16):
                 fru['UUID'] = util.decode_wireformat_uuid(byteguid)
         except (AttributeError, KeyError):
             pass
         return fru
     else:
         fru['oem_parser'] = None
         return fru
示例#4
0
 def process_fru(self, fru):
     if fru is None:
         return fru
     if self.has_tsm:
         fru['oem_parser'] = 'lenovo'
         # Thinkserver lays out specific interpretation of the
         # board extra fields
         try:
             _, _, wwn1, wwn2, mac1, mac2 = fru['board_extra']
             if wwn1 not in ('0000000000000000', ''):
                 fru['WWN 1'] = wwn1
             if wwn2 not in ('0000000000000000', ''):
                 fru['WWN 2'] = wwn2
             if mac1 not in ('00:00:00:00:00:00', ''):
                 fru['MAC Address 1'] = mac1
             if mac2 not in ('00:00:00:00:00:00', ''):
                 fru['MAC Address 2'] = mac2
         except (AttributeError, KeyError):
             pass
         try:
             # The product_extra field is UUID as the system would present
             # in DMI.  This is different than the two UUIDs that
             # it returns for get device and get system uuid...
             byteguid = fru['product_extra'][0]
             # It can present itself as claiming to be ASCII when it
             # is actually raw hex.  As a result it triggers the mechanism
             # to strip \x00 from the end of text strings.  Work around this
             # by padding with \x00 to the right if less than 16 long
             byteguid.extend('\x00' * (16 - len(byteguid)))
             if byteguid not in ('\x20' * 16, '\x00' * 16, '\xff' * 16):
                 fru['UUID'] = util.decode_wireformat_uuid(byteguid)
         except (AttributeError, KeyError, IndexError):
             pass
         return fru
     elif self.has_imm:
         fru['oem_parser'] = 'lenovo'
         try:
             bextra = fru['board_extra']
             fru['FRU Number'] = bextra[0]
             fru['Revision'] = bextra[4]
             macs = bextra[6]
             macprefix = None
             idx = 0
             endidx = len(macs) - 5
             macprefix = None
             while idx < endidx:
                 currmac = macs[idx:idx + 6]
                 if not isinstance(currmac, bytearray):
                     # invalid vpd format, abort attempts to extract
                     # mac in this way
                     break
                 if currmac == b'\x00\x00\x00\x00\x00\x00':
                     break
                 # VPD may veer off, detect and break off
                 if macprefix is None:
                     macprefix = currmac[:3]
                 elif currmac[:3] != macprefix:
                     break
                 ms = mac_format.format(*currmac)
                 ifidx = idx / 6 + 1
                 fru['MAC Address {0}'.format(ifidx)] = ms
                 idx = idx + 6
         except (AttributeError, KeyError, IndexError):
             pass
         return fru
     elif self.is_fpc == 2:  # SMM variant
         fru['oem_parser'] = 'lenovo'
         return self.smmhandler.process_fru(fru)
     else:
         fru['oem_parser'] = None
         return fru
示例#5
0
 def process_fru(self, fru):
     if fru is None:
         return fru
     if self.has_tsm:
         fru['oem_parser'] = 'lenovo'
         # Thinkserver lays out specific interpretation of the
         # board extra fields
         try:
             _, _, wwn1, wwn2, mac1, mac2 = fru['board_extra']
             if wwn1 not in ('0000000000000000', ''):
                 fru['WWN 1'] = wwn1
             if wwn2 not in ('0000000000000000', ''):
                 fru['WWN 2'] = wwn2
             if mac1 not in ('00:00:00:00:00:00', ''):
                 fru['MAC Address 1'] = mac1
             if mac2 not in ('00:00:00:00:00:00', ''):
                 fru['MAC Address 2'] = mac2
         except (AttributeError, KeyError):
             pass
         try:
             # The product_extra field is UUID as the system would present
             # in DMI.  This is different than the two UUIDs that
             # it returns for get device and get system uuid...
             byteguid = fru['product_extra'][0]
             # It can present itself as claiming to be ASCII when it
             # is actually raw hex.  As a result it triggers the mechanism
             # to strip \x00 from the end of text strings.  Work around this
             # by padding with \x00 to the right if less than 16 long
             byteguid.extend('\x00' * (16 - len(byteguid)))
             if byteguid not in ('\x20' * 16, '\x00' * 16, '\xff' * 16):
                 fru['UUID'] = util.decode_wireformat_uuid(byteguid)
         except (AttributeError, KeyError, IndexError):
             pass
         return fru
     elif self.has_imm:
         fru['oem_parser'] = 'lenovo'
         try:
             bextra = fru['board_extra']
             fru['FRU Number'] = bextra[0]
             fru['Revision'] = bextra[4]
             macs = bextra[6]
             macprefix = None
             idx = 0
             endidx = len(macs) - 5
             macprefix = None
             while idx < endidx:
                 currmac = macs[idx:idx+6]
                 if currmac == b'\x00\x00\x00\x00\x00\x00':
                     break
                 # VPD may veer off, detect and break off
                 if macprefix is None:
                     macprefix = currmac[:3]
                 elif currmac[:3] != macprefix:
                     break
                 ms = mac_format.format(*currmac)
                 ifidx = idx / 6 + 1
                 fru['MAC Address {0}'.format(ifidx)] = ms
                 idx = idx + 6
         except (AttributeError, KeyError, IndexError):
             pass
         return fru
     else:
         fru['oem_parser'] = None
         return fru