Skip to content

Conversation

rafalglx
Copy link

@rafalglx rafalglx commented Sep 4, 2025

This pull request adds new functionality to the Dell OS9 switch management module by introducing a method to retrieve the port name associated with a given MAC address, along with comprehensive unit tests to ensure its reliability. The changes enhance both the feature set and the test coverage of the codebase.

New Feature: Port Lookup by MAC Address

  • Added the get_port_by_mac method to the DellOS9 class in dell_os9/base.py, which retrieves the port name for a specified MAC address, including error handling for invalid or unknown MACs.

Testing Enhancements

  • Created new unit tests in test_base.py to verify the behavior of get_port_by_mac, covering successful lookup, MAC address not found, and invalid MAC address scenarios.

@Copilot Copilot AI review requested due to automatic review settings September 4, 2025 13:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the get_port_by_mac method for DellOS9 switch management to resolve issue #4. The implementation allows querying the switch's MAC address table to find which port a specific MAC address is connected to.

  • Adds get_port_by_mac method to DellOS9 base class with MAC validation and port lookup functionality
  • Includes comprehensive test coverage for successful lookups, not found cases, and invalid MAC addresses
  • Uses regex pattern matching to parse the switch's MAC address table output

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
mfd_switchmanagement/vendors/dell/dell_os9/base.py Implements get_port_by_mac method with MAC validation and switch command execution
tests/unit/test_mfd_switchmanagement/test_vendors/test_dell/test_dell_os9/test_base.py Adds comprehensive test suite covering success, failure, and validation scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Fixes intel#4
Signed-off-by: Rafał Głombiowski <[email protected]>
@hcymerys hcymerys force-pushed the fix__Add_get_port_by_mac_for_DellOS9 branch from c9920f6 to 463c206 Compare September 12, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants