Skip to content

Commit 111dcf7

Browse files
authored
[EEPROM] Add new function part_number_str to TlvInfoDecoder (sonic-net#121)
Add a new function to TlvInfoDecoder which can return device part number as a string.
1 parent 422687f commit 111dcf7

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

sonic_platform_base/sonic_eeprom/eeprom_tlvinfo.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,16 @@ def serial_number_str(self, e):
505505
return t[2]
506506

507507

508+
def part_number_str(self, e):
509+
'''
510+
Returns the value field of the Part Number TLV as a string
511+
'''
512+
valid, t = self.get_tlv_field(e, self._TLV_CODE_PART_NUMBER)
513+
if not valid:
514+
return super(TlvInfoDecoder, self).part_number_str(e)
515+
return t[2]
516+
517+
508518
def decoder(self, s, t):
509519
'''
510520
Return a string representing the contents of the TLV field. The format of

0 commit comments

Comments
 (0)