Implement attribute based infra for transceiver onboarding#21042
Implement attribute based infra for transceiver onboarding#21042prgeor merged 7 commits intosonic-net:masterfrom
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull Request Overview
This PR implements an attribute-based infrastructure for transceiver onboarding, introducing a layered configuration system that merges base port attributes with category-specific attributes (e.g., EEPROM) using a priority-based resolution mechanism. The infrastructure supports deployment template validation to ensure required attributes are present.
Key changes:
- Multi-layer attribute merging system with 8 priority levels (defaults → platform → hwsku → deployment → vendor → part number → platform overrides → DUT-specific)
- Port specification expansion supporting ranges, steps, and mixed formats
- Comprehensive test suite with 17 tests validating core functionality and error scenarios
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/transceiver/infra/utils.py | Utility function for formatting nested dictionaries in log output |
| tests/transceiver/infra/test_transceiver_attribute_infra.py | Comprehensive test suite covering attribute loading, merging, validation, and error handling |
| tests/transceiver/infra/template_validator.py | Validates port attributes against deployment templates with compliance reporting |
| tests/transceiver/infra/port_spec.py | Expands port specifications (ranges, steps, lists) into individual port names |
| tests/transceiver/infra/paths.py | Centralized path constants for inventory structure |
| tests/transceiver/infra/exceptions.py | Custom exception classes for attribute infrastructure |
| tests/transceiver/infra/dut_info_loader.py | Loads and processes dut_info.json to build base port attributes |
| tests/transceiver/infra/config_parser.py | Parses transceiver configuration strings into structured components |
| tests/transceiver/infra/attribute_manager.py | Merges category attributes with base attributes using priority resolution |
| tests/transceiver/eeprom/test_eeprom_basic.py | Test validating EEPROM content via CLI against expected attributes |
| tests/transceiver/conftest.py | Pytest fixtures for attribute infrastructure initialization and validation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
04c5faa to
7fc2181
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
|
|
||
| # Root directory (relative to repository root) | ||
| REL_TRANSCEIVER_INV_DIR = os.path.join('ansible', 'files', 'transceiver', 'inventory') |
There was a problem hiding this comment.
Will it cause issue if the test is run from different directory? Have we thought about using pathlib.Path(__file__) and then traversing from there to get to the root directory?
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
d12be9d to
473ca8a
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
- Add attribute_manager.py for layered attribute merging - Add config_parser.py for transceiver configuration parsing - Add dut_info_loader.py for DUT inventory loading - Add port_spec.py for port specification expansion - Add comprehensive test suite with 17 passing tests - Add eeprom attribute validation tests - Add conftest.py for test fixtures Signed-off-by: Mihir Patel <patelmi@microsoft.com>
Signed-off-by: Mihir Patel <patelmi@microsoft.com>
Signed-off-by: Mihir Patel <patelmi@microsoft.com>
Signed-off-by: Mihir Patel <patelmi@microsoft.com>
Signed-off-by: Mihir Patel <patelmi@microsoft.com>
473ca8a to
a4d41df
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Mihir Patel <patelmi@microsoft.com>
1e1be4b to
e1bb47b
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Mihir Patel <patelmi@microsoft.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description of PR
Code changes to support the attribute infra per #20230 for onboarding transceivers
Summary:
Fixes # (issue)
Type of change
Back port request
Approach
What is the motivation for this PR?
Code changes to support the attribute infra per #20230 for onboarding transceivers
How did you do it?
How did you verify/test it?
Ensured that the sonic-mgmt test passes
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation
#20230
ADO - 35139411