Repository navigation
[Nexthop][fboss2-dev] Add loopback interface creation and addressing to config interface - #1565
Open
hillol-nexthop wants to merge 3 commits into
Open
hillol-nexthop wants to merge 3 commits into
hillol-nexthop wants to merge 3 commits into
Conversation
hillol-nexthop
marked this pull request as draft
August 27, 2026 17:08
hillol-nexthop
force-pushed
the
loopback-interface-config
branch
from
August 27, 2026 17:15
c7f9716 to
5532ea1
Compare
hillol-nexthop
marked this pull request as ready for review
August 27, 2026 17:16
hillol-nexthop
force-pushed
the
loopback-interface-config
branch
2 times, most recently
from
August 27, 2026 17:41
6f3f8c0 to
4a9857b
Compare
rabbit-nexthop
force-pushed
the
loopback-interface-config
branch
2 times, most recently
from
September 2, 2026 08:00
ae075a5 to
1647144
Compare
hillol-nexthop
force-pushed
the
loopback-interface-config
branch
from
October 12, 2026 05:41
1647144 to
d5c5fd3
Compare
Adds loopback support to the existing `config interface` / `delete interface` families, following the bootstrap-config convention: loopback<N> is the virtual (isVirtual=true) interface at intfID == vlanID == 10 + N, backed by the same-numbered VLAN named fbossLoopback<N>. - `loopback<N>` tokens now resolve in InterfaceList: by literal interface name, by the conventional fbossLoopback<N> name (Meta-style configs), or by the conventional intfID for the unnamed bootstrap loopback0. - `config interface loopback<N> ...` creates the virtual interface (plus its backing routable VLAN) when absent, then applies the requested attributes; a bare `config interface loopback<N>` just creates it. Occupied conventional ids (a non-loopback interface at intfID 10+N, or a data VLAN at the same id) are refused with a specific error. - ip-address / ipv6-address add and delete work on loopbacks through the existing attribute paths once the token resolves; multiple mixed v4/v6 host addresses per loopback are supported and re-adding an address is a clean no-op. - A bare `delete interface loopback<N>` removes the virtual interface together with its backing VLAN (via VlanManager::deleteVlan). It is refused, leaving the config untouched, when that VLAN has member ports, is the default VLAN, or is a port's ingress VLAN; ports and loopbacks may be mixed in one delete command. All changes commit HITLESS, matching the rest of the config interface family.
- Drop the bare `config interface loopback<N>` early return; the common save/return path already handles it once the incomplete-command guard skips created loopbacks. - Split the validation half of VlanManager::deleteVlan into VlanManager::checkDeletable and call it from the loopback delete path instead of re-implementing the default-VLAN and ingress-VLAN refusals. - Remove the interface erase after deleteVlan; deleteVlan already cascades the interface, and a loopback without a backing VLAN is now refused. - Merge the two loopback integration tests into one create/address/delete round trip. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
hillol-nexthop
force-pushed
the
loopback-interface-config
branch
from
October 22, 2026 08:03
d5c5fd3 to
5f3096b
Compare
Contributor
Author
|
Rebased onto main and ported the internal review fixes: the bare-loopback create now shares the common save path, |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds loopback interface support to the existing
config interface/delete interfacefamilies, reusing theconfig interface <name> ip-address <A.B.C.D/N>syntax. Loopbacks follow the deployment convention:loopback<N>is the virtual (isVirtual=true) interface atintfID == vlanID == 10 + N, backed by the same-numbered routable VLAN namedfbossLoopback<N>.loopback<N>token now resolves inInterfaceList— by literal interface name, by the conventionalfbossLoopback<N>name (Meta-style configs), or by the conventional intfID withisVirtualset (the bootstrap loopback0 ships unnamed).config interface loopback<N> ...creates the virtual interface plus its backing VLAN when absent, then applies the requested attributes; a bareconfig interface loopback<N>just creates it. Occupied conventional ids — a non-loopback interface atintfID 10+N, a same-numbered VLAN owned by another interface, or a data VLAN with member ports — are refused with specific errors, since the agent requires every VLAN-type interface to reference an existing VLAN and be its only interface.ip-address/ipv6-addressadd and delete work on loopbacks through the existing attribute paths once the token resolves; multiple mixed v4/v6 host addresses per loopback are supported, and re-applying an address is a clean no-op.delete interface loopback<N>removes the virtual interface together with its backing VLAN (viaVlanManager::deleteVlan, so the pair goes as a unit). Refused, with the config untouched, when the VLAN has member ports, is the default VLAN, or is a port's ingress VLAN — those are data VLANs and belong todelete vlan. Ports and loopbacks may be mixed in one command.config interfacefamily.Test Plan
Unit tests (new
CmdConfigInterfaceLoopbackTest.cpp, seed mirroring the deployed loopback layout plus a Meta-style named loopback with production-shaped /32 + /128 addresses):Integration tests (new
ConfigLoopbackInterfaceTest), run on a lab:Sample usage on the same device (bootstrap loopback0 is unnamed, intfID 10):
(
loopback9above was created by the CLI viaconfig interface loopback9 ip-address ...in the integration run — interface + backing VLAN created at the conventional ids, committed hitlessly; the test then removes it withdelete interface loopback9and verifies both the interface and VLAN 19 are gone from the running config.)Review Findings
Pre-publication automated review (7 reviewer passes; no blocking correctness defects found on the tested paths). Known concerns listed for reviewer attention:
CmdConfigInterface.cpp:343routablenot fixed up to thefbossLoopback<N>/routable=trueconvention).CmdConfigInterface.cpp:317loopback5 Loopback5) yield a misleading "already in use by a non-loopback interface" error; nothing is saved.CmdConfigInterface.cpp:731mtu,profileon a loopback) can throw; on-disk config is untouched sincesaveConfigis skipped.CmdConfigInterface.cpp:750config interface loopback<N>on an already-existing loopback throws "Incomplete command" rather than being an idempotent no-op.InterfaceList.cpp:42fbossLoopback<N>resolution does not checkisVirtual, unlike the intfID fallback.