Skip to content

feat(lwtunnel): Add lwtunnel_bpf LISA test for Linux kernel lwtunnel functionality#4298

Merged
LiliDeng merged 8 commits intomicrosoft:mainfrom
rlmenge:rlmenge/lwtunnel
Mar 13, 2026
Merged

feat(lwtunnel): Add lwtunnel_bpf LISA test for Linux kernel lwtunnel functionality#4298
LiliDeng merged 8 commits intomicrosoft:mainfrom
rlmenge:rlmenge/lwtunnel

Conversation

@rlmenge
Copy link
Copy Markdown
Collaborator

@rlmenge rlmenge commented Feb 25, 2026

Create test suite that validates LWTUNNEL and LWTUNNEL_BPF kernel functionality:

  • Check CONFIG_LWTUNNEL and CONFIG_LWTUNNEL_BPF kernel configs
  • Compile a minimal BPF program with clang
  • Attach it to a route via 'ip route encap bpf'
  • Verify the BPF encap route is created successfully

Additional features

  • Kept the bpf program in the test itself as it is very small.
  • Restricted the test to AzureLinux as that is the target OS

Tested on AzureLinux 3.0 VMs. (Note this is not currently supported so the test will skip until microsoft/azurelinux#15607 is merged)

Create test suite that validates LWTUNNEL and LWTUNNEL_BPF kernel
functionality:
- Check CONFIG_LWTUNNEL and CONFIG_LWTUNNEL_BPF kernel configs
- Compile a minimal BPF program with clang
- Attach it to a route via 'ip route encap bpf'
- Verify the BPF encap route is created successfully

The test properly skips when kernel configs are not enabled or when
required tooling (clang/llvm) is unavailable.

Co-authored-by: binnacle-bot <noreply@binnacle.bot>
@rlmenge rlmenge marked this pull request as draft February 25, 2026 02:18
@rlmenge rlmenge marked this pull request as ready for review February 25, 2026 03:54
Comment thread lisa/microsoft/testsuites/network/lwtunnel.py Outdated
Comment thread lisa/microsoft/testsuites/network/lwtunnel.py Outdated
rlmenge added 3 commits March 10, 2026 13:27
Since clang and kernel headers are verified beforehand now, a
compile failure is a genuine test failure, not a missing prerequisite.
Replace manual ip.run + SkippedException with ip.create_virtual_interface,
which handles existence checks and failure assertions internally.
No BPF program is pinned to /sys/fs/bpf/ in this test, so the
variable and its cleanup were dead code.
Comment thread lisa/microsoft/testsuites/network/lwtunnel.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new LISA network functional test suite to validate Linux LWTUNNEL/LWTUNNEL_BPF by compiling a minimal BPF program and attaching it to a route using ip route encap bpf, with the suite gated to AzureLinux 3.0+.

Changes:

  • Add LwtunnelSuite with an AzureLinux-only gate in before_case.
  • Add verify_lwtunnel_bpf_support to validate required kernel configs, compile a minimal BPF program, and verify a BPF-encap route can be created.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread lisa/microsoft/testsuites/network/lwtunnel.py
Comment thread lisa/microsoft/testsuites/network/lwtunnel.py
Comment thread lisa/microsoft/testsuites/network/lwtunnel.py Outdated
Comment thread lisa/microsoft/testsuites/network/lwtunnel.py
Comment thread lisa/microsoft/testsuites/network/lwtunnel.py
rlmenge added 3 commits March 12, 2026 11:15
Define ls, ip, rm, and tee just before they are first used instead
of all at once at the top of the method.
PurePath is host-OS dependent and would produce a WindowsPath on a
Windows controller, breaking file writes on the Linux target.
Files are under /tmp which is world-writable, so root is not needed.
This aligns with the non-sudo clang presence check and avoids
mismatches when sudo uses a restricted secure_path.
@LiliDeng LiliDeng merged commit 4c9a6b0 into microsoft:main Mar 13, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants