Skip to content

[Nexthop] Distro CLI getip and ssh commands#975

Open
travisb-nexthop wants to merge 1 commit intofacebook:mainfrom
nexthop-ai:distro_cli_1_getip_ssh
Open

[Nexthop] Distro CLI getip and ssh commands#975
travisb-nexthop wants to merge 1 commit intofacebook:mainfrom
nexthop-ai:distro_cli_1_getip_ssh

Conversation

@travisb-nexthop
Copy link
Contributor

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

The Distro CLI getip and ssh commands make a best-effort attempt to determine an IP for the given switch based on its MAC address and then either return that IP or directly ssh to it.

It does so by connecting to the Distro Infra container and checking on the configured interface for pre-existing IP neighbor/ARP entries. If no such entries are found it will attempt a subnet ping to refresh the Linux kernel neighbor entries.

In most cases this is sufficient after the system has PXE booted and therefore the neighbor cache is filled. In situations where this does not successfully find the IP, manually pinging the switch hostname will prime the cache.

Test Plan

Testing is as easy as starting the Distro Infra container:

$ ./distro_infra.sh --intf eth1 --persist-dir data

Then running the fboss-image device getip command with the appropriate MAC address:

$ ./fboss-image device dc:da:4d:fc:ad:2d getip
[0.00s] Getting IP for device dc:da:4d:fc:ad:2d
10.250.33.2

The Distro CLI getip and ssh commands make a best-effort attempt to
determine an IP for the given switch based on its MAC address and then
either return that IP or directly ssh to it.

It does so by connecting to the Distro Infra container and checking on
the configured interface for pre-existing IP neighbor/ARP entries. If
no such entries are found it will attempt a subnet ping to refresh the
Linux kernel neighbor entries.

In most cases this is sufficient after the system has PXE booted and
therefore the neighbor cache is filled.

Testing is as easy as starting the Distro Infra container:
```
$ ./distro_infra.sh --intf eth1 --persist-dir data
```

Then running the fboss-image device getip command with the appropriate
MAC address:
```
$ ./fboss-image device dc:da:4d:fc:ad:2d getip
[0.00s] Getting IP for device dc:da:4d:fc:ad:2d
10.250.33.2
```
@meta-cla meta-cla bot added the CLA Signed label Mar 4, 2026
@travisb-nexthop travisb-nexthop marked this pull request as ready for review March 4, 2026 19:10
@travisb-nexthop travisb-nexthop requested a review from a team as a code owner March 4, 2026 19:10
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