Skip to content

Commit

Permalink
[EEPROM] Add new function part_number_str to TlvInfoDecoder (sonic-ne…
Browse files Browse the repository at this point in the history
…t#121)

Add a new function to TlvInfoDecoder which can return device part number as a string.
  • Loading branch information
keboliu authored Sep 25, 2020
1 parent 422687f commit 111dcf7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sonic_platform_base/sonic_eeprom/eeprom_tlvinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,16 @@ def serial_number_str(self, e):
return t[2]


def part_number_str(self, e):
'''
Returns the value field of the Part Number TLV as a string
'''
valid, t = self.get_tlv_field(e, self._TLV_CODE_PART_NUMBER)
if not valid:
return super(TlvInfoDecoder, self).part_number_str(e)
return t[2]


def decoder(self, s, t):
'''
Return a string representing the contents of the TLV field. The format of
Expand Down

0 comments on commit 111dcf7

Please sign in to comment.