Skip to content

[Nexthop][fboss2-dev] Delete the underlay VLAN in TunnelIpInIpTest tests that commit a tunnel - #1902

Open
abhinav-nexthop wants to merge 4 commits into
meta:mainfrom
nexthop-ai:tunnel-underlay-vlan-leak
Open

abhinav-nexthop wants to merge 4 commits into
meta:mainfrom
nexthop-ai:tunnel-underlay-vlan-leak

Conversation

@abhinav-nexthop

Copy link
Copy Markdown
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

Depends on #1811, which adds the deleteTunnelAndUnderlay() helper this change calls. Only the last commit is new here.

Summary

Each TunnelIpInIpTest case gets its underlay interface from ensureUnderlayIntfId(), which creates a VLAN on the first free ID in 2000-2099. Five tests commit that VLAN but never delete it: CreateDecapTunnelAndVerifyRunningConfig, CreateEncapTunnelAndVerifyRunningConfig, DeleteDecapTunnel, ResetOptionalAttrOnDecapTunnel and DeleteWrongDirectionRejected. The fixture's TearDown only removes the tunnels, so every run leaves 5 VLANs behind on the switch.

On a platform whose port interfaces already use most of 2000-2099, this runs the window dry. When 2000 is the only free ID, the first test keeps it and every test after it fails with:

No VLAN ID free in [2000, 2099] for the tunnel underlay

The fix arms deleteTunnelAndUnderlay() in a SCOPE_EXIT in those five tests, the same cleanup the mask, mode and termination-type tests use. It deletes the tunnel, then the underlay VLAN, and checks both are gone, even if the test fails halfway. The three reject tests are left alone, since they discard the session and never commit the VLAN.

Test Plan

Full TunnelIpInIpTest suite on a switch where VLAN 2000 is the only free ID in the window. Every test now gets VLAN 2000 and gives it back before the next one starts.

$ fboss2_integration_test --gtest_filter='TunnelIpInIpTest.*'
[==========] Running 18 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 18 tests from TunnelIpInIpTest
[ RUN      ] TunnelIpInIpTest.CreateDecapTunnelAndVerifyRunningConfig
[       OK ] TunnelIpInIpTest.CreateDecapTunnelAndVerifyRunningConfig (196 ms)
[ RUN      ] TunnelIpInIpTest.DecapDestinationMask
[       OK ] TunnelIpInIpTest.DecapDestinationMask (184 ms)
[ RUN      ] TunnelIpInIpTest.DecapSourceMask
[       OK ] TunnelIpInIpTest.DecapSourceMask (209 ms)
[ RUN      ] TunnelIpInIpTest.CreateEncapTunnelAndVerifyRunningConfig
[       OK ] TunnelIpInIpTest.CreateEncapTunnelAndVerifyRunningConfig (182 ms)
[ RUN      ] TunnelIpInIpTest.EncapDestinationMask
[       OK ] TunnelIpInIpTest.EncapDestinationMask (177 ms)
[ RUN      ] TunnelIpInIpTest.EncapSourceMask
[       OK ] TunnelIpInIpTest.EncapSourceMask (184 ms)
[ RUN      ] TunnelIpInIpTest.DeleteDecapTunnel
[       OK ] TunnelIpInIpTest.DeleteDecapTunnel (188 ms)
[ RUN      ] TunnelIpInIpTest.DecapDscpMode
[       OK ] TunnelIpInIpTest.DecapDscpMode (243 ms)
[ RUN      ] TunnelIpInIpTest.DecapEcnMode
[       OK ] TunnelIpInIpTest.DecapEcnMode (186 ms)
[ RUN      ] TunnelIpInIpTest.DecapTerminationType
[       OK ] TunnelIpInIpTest.DecapTerminationType (187 ms)
[ RUN      ] TunnelIpInIpTest.ResetOptionalAttrOnDecapTunnel
[       OK ] TunnelIpInIpTest.ResetOptionalAttrOnDecapTunnel (251 ms)
[ RUN      ] TunnelIpInIpTest.EncapDscpMode
[       OK ] TunnelIpInIpTest.EncapDscpMode (187 ms)
[ RUN      ] TunnelIpInIpTest.EncapEcnMode
[       OK ] TunnelIpInIpTest.EncapEcnMode (211 ms)
[ RUN      ] TunnelIpInIpTest.EncapRejectsTerminationType
[       OK ] TunnelIpInIpTest.EncapRejectsTerminationType (24 ms)
[ RUN      ] TunnelIpInIpTest.DecapRejectsUnsupportedTerminationType
[       OK ] TunnelIpInIpTest.DecapRejectsUnsupportedTerminationType (23 ms)
[ RUN      ] TunnelIpInIpTest.DeleteWrongDirectionRejected
[       OK ] TunnelIpInIpTest.DeleteWrongDirectionRejected (191 ms)
[ RUN      ] TunnelIpInIpTest.EncapWithoutSourceRejected
[       OK ] TunnelIpInIpTest.EncapWithoutSourceRejected (22 ms)
[ RUN      ] TunnelIpInIpTest.DeleteNonExistentIsIdempotent
[       OK ] TunnelIpInIpTest.DeleteNonExistentIsIdempotent (17 ms)
[----------] 18 tests from TunnelIpInIpTest (2871 ms total)
[----------] Global test environment tear-down
[==========] 18 tests from 1 test suite ran. (2871 ms total)
[  PASSED  ] 18 tests.

@abhinav-nexthop
abhinav-nexthop requested a review from a team as a code owner November 3, 2026 12:38
@meta-cla meta-cla Bot added the CLA Signed label Nov 3, 2026
@github-actions github-actions Bot added nexthop project:fboss2-dev FBOSS project: fboss2-dev labels Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant