Skip to content

[Nexthop][fboss2-dev] Add integration tests for IpInIpTunnel DSCP/ECN modes and termination type - #1811

Open
abhinav-nexthop wants to merge 2 commits into
meta:mainfrom
nexthop-ai:tunnel-ip-in-ip-attrs
Open

abhinav-nexthop wants to merge 2 commits into
meta:mainfrom
nexthop-ai:tunnel-ip-in-ip-attrs

Conversation

@abhinav-nexthop

@abhinav-nexthop abhinav-nexthop commented Oct 19, 2026 •

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

Add integration tests for IpInIpTunnel.dscpMode and ecnMode

Summary

Adds TunnelIpInIpTest.DecapDscpMode, TunnelIpInIpTest.EncapDscpMode and
TunnelIpInIpTest.DecapEcnMode, covering IpInIpTunnel.dscpMode and
IpInIpTunnel.ecnMode as written by:

fboss2-dev config tunnel ip-in-ip <encap|decap> <id> dscp-mode <uniform|pipe>
fboss2-dev config tunnel ip-in-ip decap <id> ecn-mode <uniform|pipe>

Only modes that SaiTunnelManager::addTunnel programs into the SAI tunnel are
tested:

  • DSCP: passed as the SAI tunnel's EncapDscpMode for encap and
    DecapDscpMode for decap; the other direction is pinned to uniform.
  • Decap ECN: passed as the SAI tunnel's DecapEcnMode (pipe ->
    COPY_FROM_OUTER).

Encap ecn-mode is not tested: the IP-in-IP tunnel never sets EncapEcnMode,
and for encap tunnels the decap attributes are hard-coded, so the configured
value never reaches SAI.

All three tests share a fixture helper, checkTunnelMode(direction, mode),
which creates the tunnel with the mode set to pipe (the agent default is
uniform) and checks:

  • the mode is PIPE in the running config and in switch state
  • the new SAI tunnel object (show hw-object IPTUNNEL) has the expected
    attribute set, and for DSCP the other direction left at uniform
  • after deleting the tunnel and its underlay VLAN, the SAI object is gone

The cleanup runs from a scope guard, so a failed check still leaves the switch
as it was found. Tomahawk6 has no SAI tunnel support, so the tunnel suite does
not apply there.

Add integration test for IpInIpTunnel.tunnelTermType

Summary

Adds TunnelIpInIpTest.DecapTerminationType, covering IpInIpTunnel.tunnelTermType as written by:

fboss2-dev config tunnel ip-in-ip decap <id> termination-type <p2p|p2mp>

The agent defaults to P2MP, so the test creates a decap tunnel with termination-type p2p (plus the source a P2P term matches on) and checks:

  • tunnelTermType is P2P in the running config and in switch state
  • the new SAI tunnel term (show hw-object IPTUNNEL) is P2P (Type: 0) and matches both the destination and the outer source; a P2MP term has no source
  • after deleting the tunnel and its underlay VLAN, the term is gone

The hw-object reading and the tunnel/VLAN cleanup move into two fixture helpers, saiTunnelObjects(prefix) and deleteTunnelAndUnderlay(...), which this test reuses. The cleanup runs from a scope guard, so a failed check still leaves the switch as it was found. Tomahawk6 has no SAI tunnel support, so the tunnel suite does not apply there.

Test Plan

$ fboss2_integration_test --gtest_filter='TunnelIpInIpTest.*'
[==========] Running 13 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 13 tests from TunnelIpInIpTest
[ RUN      ] TunnelIpInIpTest.CreateDecapTunnelAndVerifyRunningConfig
[       OK ] TunnelIpInIpTest.CreateDecapTunnelAndVerifyRunningConfig (73 ms)
[ RUN      ] TunnelIpInIpTest.CreateEncapTunnelAndVerifyRunningConfig
[       OK ] TunnelIpInIpTest.CreateEncapTunnelAndVerifyRunningConfig (51 ms)
[ RUN      ] TunnelIpInIpTest.DeleteDecapTunnel
[       OK ] TunnelIpInIpTest.DeleteDecapTunnel (64 ms)
[ RUN      ] TunnelIpInIpTest.DecapDscpMode
[       OK ] TunnelIpInIpTest.DecapDscpMode (93 ms)
[ RUN      ] TunnelIpInIpTest.DecapEcnMode
[       OK ] TunnelIpInIpTest.DecapEcnMode (90 ms)
[ RUN      ] TunnelIpInIpTest.DecapTerminationType
[       OK ] TunnelIpInIpTest.DecapTerminationType (89 ms)
[ RUN      ] TunnelIpInIpTest.ResetOptionalAttrOnDecapTunnel
[       OK ] TunnelIpInIpTest.ResetOptionalAttrOnDecapTunnel (72 ms)
[ RUN      ] TunnelIpInIpTest.EncapDscpMode
[       OK ] TunnelIpInIpTest.EncapDscpMode (111 ms)
[ RUN      ] TunnelIpInIpTest.EncapRejectsTerminationType
[       OK ] TunnelIpInIpTest.EncapRejectsTerminationType (10 ms)
[ RUN      ] TunnelIpInIpTest.DecapRejectsUnsupportedTerminationType
[       OK ] TunnelIpInIpTest.DecapRejectsUnsupportedTerminationType (9 ms)
[ RUN      ] TunnelIpInIpTest.DeleteWrongDirectionRejected
[       OK ] TunnelIpInIpTest.DeleteWrongDirectionRejected (56 ms)
[ RUN      ] TunnelIpInIpTest.EncapWithoutSourceRejected
[       OK ] TunnelIpInIpTest.EncapWithoutSourceRejected (10 ms)
[ RUN      ] TunnelIpInIpTest.DeleteNonExistentIsIdempotent
[       OK ] TunnelIpInIpTest.DeleteNonExistentIsIdempotent (8 ms)
[----------] 13 tests from TunnelIpInIpTest (742 ms total)
[----------] Global test environment tear-down
[==========] 13 tests from 1 test suite ran. (742 ms total)
[  PASSED  ] 13 tests.

@meta-codesync

meta-codesync Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@joseph5wu has imported this pull request. If you are a Meta employee, you can view this in D131621314.

@abhinav-nexthop abhinav-nexthop changed the title [Nexthop][fboss2-dev] Add integration tests for IpInIpTunnel IP masks and DSCP/ECN modes [Nexthop][fboss2-dev] Add integration tests for IpInIpTunnel DSCP/ECN modes and termination type Nov 13, 2026
@facebook-github-tools

Copy link
Copy Markdown

@abhinav-nexthop has updated the pull request. You must reimport the pull request before landing.

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.

2 participants