-
Notifications
You must be signed in to change notification settings - Fork 225
feat: Added support for TLV_CODE_VENDOR_NAME #542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -406,6 +406,16 @@ def modelstr(self, e): | |||||||
| return super(TlvInfoDecoder, self).modelstr(e) | ||||||||
|
|
||||||||
| return t[2].decode("ascii") | ||||||||
|
|
||||||||
|
|
||||||||
| def vendorstr(self, e): | ||||||||
| ''' | ||||||||
| Returns the value field of the Vendor Name TLV as a string | ||||||||
| ''' | ||||||||
| (is_valid, t) = self.get_tlv_field(e, self._TLV_CODE_VENDOR_NAME) | ||||||||
| if not is_valid: | ||||||||
| return super(TlvInfoDecoder, self).vendorstr(e) | ||||||||
|
||||||||
| return super(TlvInfoDecoder, self).vendorstr(e) | |
| # Parent class does not define vendorstr(); return a safe default | |
| return "" |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,8 @@ | |||||||||
| TEST_PATH = os.path.dirname(os.path.abspath(__file__)) | ||||||||||
| EEPROM_HEX_FILE_FULL_PATH = os.path.join(TEST_PATH, EEPROM_HEX_FILE) | ||||||||||
| EEPROM_SYMLINK_FULL_PATH = os.path.join(TEST_PATH, EEPROM_SYMLINK) | ||||||||||
| EEPROM_HEX_FILE_V2 = os.path.join(TEST_PATH, "syseeprom_v2.hex") | ||||||||||
| EEPROM_SYMLINK_V2 = os.path.join(TEST_PATH, "vpd_info_v2") | ||||||||||
| class TestEepromTlvinfo: | ||||||||||
|
|
||||||||||
| @classmethod | ||||||||||
|
|
@@ -38,12 +40,15 @@ def setup_class(cls): | |||||||||
| if not os.path.exists(os.path.dirname(EEPROM_HEX_FILE_FULL_PATH)): | ||||||||||
| assert False, "File {} is not exist".format(EEPROM_HEX_FILE_FULL_PATH) | ||||||||||
| subprocess.check_call(['/usr/bin/xxd', '-r', '-p', EEPROM_HEX_FILE_FULL_PATH, EEPROM_SYMLINK_FULL_PATH]) | ||||||||||
|
||||||||||
| subprocess.check_call(['/usr/bin/xxd', '-r', '-p', EEPROM_HEX_FILE_FULL_PATH, EEPROM_SYMLINK_FULL_PATH]) | |
| subprocess.check_call(['/usr/bin/xxd', '-r', '-p', EEPROM_HEX_FILE_FULL_PATH, EEPROM_SYMLINK_FULL_PATH]) | |
| if not os.path.exists(EEPROM_HEX_FILE_V2): | |
| assert False, "File {} is not exist".format(EEPROM_HEX_FILE_V2) |
Copilot
AI
Mar 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is coverage for the happy path where Vendor Name TLV exists, but no test exercises vendorstr() behavior when the TLV is absent (e.g., using the existing v1 syseeprom.hex). After fixing the fallback behavior, consider adding an assertion in test_eeprom_tlvinfo_read_api for the expected default (empty string/None/etc.) to prevent regressions.
Copilot
AI
Mar 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description references dhclient.conf.j2 changes for DHCP option 60/61, but this repository/PR only appears to update the EEPROM TLV decoder and tests (no dhclient.conf.j2 present/modified here). Consider updating the PR description to match the actual scope of this repo change, or link to the other PRs where the DHCP config changes live.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| 54 6c 76 49 6e 66 6f 00 01 00 5e 22 06 45 43 49 | ||
| 31 32 33 2a 02 02 04 23 0b 46 4c 4d 32 35 31 39 | ||
| 30 37 55 37 21 0a 38 31 30 32 2d 36 34 48 2d 4f | ||
| 26 01 00 24 06 34 73 2d 30 70 d8 28 14 78 38 36 | ||
| 5f 36 34 2d 38 31 30 32 5f 36 34 68 5f 6f 2d 72 | ||
| 30 2b 05 43 69 73 63 6f 2d 05 43 69 73 63 6f 2c | ||
| 02 55 53 fe 04 e0 30 3f 8e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add test in https://github.com/sonic-net/sonic-platform-common/blob/cb5564c20ac74694f2391759f9235eee428a97d0/tests/eeprom_base_test.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests added as requested.