Skip to content

Conversation

@marif-nexthop
Copy link
Contributor

@marif-nexthop marif-nexthop commented Dec 2, 2025

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

Remove hardcoded eth0 from MacAddressCheck and add configurable interface support.

The MacAddressCheck class had a hardcoded eth0 interface when validating that a network interface's MAC address matches the base MAC address stored in EEPROM. This hardcoded limitation prevented the class from being reusable for platforms with different management interface names.

In this PR:

  • Refactored MacAddressCheck to remove the hardcoded eth0 and make the interface name configurable
  • Enhanced platform_hw_test to leverage the improved MacAddressCheck by adding a -mgmt_interface command-line flag
  • Maintained backward compatibility by defaulting to eth0 when no interface is specified

Test Plan

Ran the test platform_hw_test on a Nexthop platform with -mgmt_interface=eth1 and it passed without any errors.

./bin/platform_hw_test -config_file=... -mgmt_interface=eth1

and it also passed on FBOSS supported HW platform with default options as expected.

./bin/platform_hw_test

@meta-cla meta-cla bot added the CLA Signed label Dec 2, 2025
…facebook#177)

<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please provide enough information so
that others can review your pull request. -->

**Pre-submission checklist**
- [x] I've ran the linters locally and fixed lint errors related to the
files I modified in this PR. You can install the linters by running `pip
install -r requirements-dev.txt && pre-commit install`
- [x] `pre-commit run`

# Summary
The MacAddressCheck test in `platform_hw_test`
(`PlatformHwTest.CorrectMacX86`) validates that a network interface's
MAC address matches the base MAC address stored in the EEPROM. The
interface was hardcoded to `eth0`.

On NH-4010, `eth0` has a locally-administered MAC (02:00:00:...) and is
unused while `eth1` has the EEPROM base MAC address, causing
`PlatformHwTest.CorrectMacX86` to fail.


<!-- Explain the motivation for making this change and any other context
that you think would help reviewers of your code. What existing problem
does the pull request solve? -->

Made the interface configurable via a command-line flag
`-mgmt_interface` of `platform_hw_test` (defaults to `eth0`).

NOTE: *Existing platforms continue to work without any changes.
Platforms like NH-4010 can specify an alternate interface.*

```
./bin/platform_hw_test -config_file=... -mgmt_interface=eth1
```

# Test Plan

<!-- Demonstrate the code is solid. Example: The exact commands you ran
and their output, screenshots / videos if the pull request changes the
user interface. How exactly did you verify that your PR solves the issue
you wanted to solve? -->

Ran the test `platform_hw_test` on NH-4010 platform with
`-mgmt_interface=eth1` and it passed without any errors.

<!-- If a relevant Github issue exists for this PR, please make sure you
link that issue to this PR -->
@marif-nexthop marif-nexthop force-pushed the marif.fboss-mac-addr-check branch from 0f9921b to b0ed3d8 Compare December 5, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant