Skip to content

Add PVST test plan for two/four VLAN T0 topologies#2

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1765583093-pvst-vlan-topology-tests
Open

Add PVST test plan for two/four VLAN T0 topologies#2
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1765583093-pvst-vlan-topology-tests

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Description of PR

Summary:
This PR adds a comprehensive test module for validating Per-VLAN Spanning Tree (PVST) functionality in SONiC using two/four VLAN T0 topologies. The tests verify that PVST creates independent STP instances per VLAN and that these instances operate correctly.

Test Categories Implemented:

  1. Per-VLAN STP Instance Independence - Verifies separate instances, bridge priorities, and root bridges per VLAN
  2. Interface-Specific PVST Configuration - Tests portfast, BPDU filter, root guard, BPDU guard, cost, and priority settings
  3. Topology Change Resilience - Validates VLAN isolation during topology changes
  4. Protocol Variant Testing - Tests PVST and RPVST modes and transitions
  5. Configuration Persistence - Verifies config save and VLAN config independence

Reviewer Notes:

  • Start review at the test class definitions and fixture setup
  • The TWO_VLAN_CONFIG and FOUR_VLAN_CONFIG dictionaries are defined for reference but tests use pvst_data.vlan_list_* variables
  • Reboot persistence test is skipped by default (requires manual execution in appropriate environment)
  • Some tests log warnings instead of failing when root bridge election depends on MAC addresses

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Approach

What is the motivation for this PR?

To provide automated validation of PVST functionality in SONiC, ensuring that per-VLAN spanning tree instances operate independently as expected.

How did you do it?

Created a new SPyTest test module using the existing PVST API (spytest/apis/switching/pvst.py) with test classes organized by functionality. Tests use the topology configurations from ansible/vars/topo_t0-isolated-d16u16s1.yml.

How did you verify/test it?

  • Lint checks passed (flake8 --select=E9,F63,F7,F82)
  • Tests require execution on actual SONiC testbed with appropriate topology

Any platform specific information?

Tests are designed to work with any platform supporting PVST/RPVST.

Supported testbed topology if it's a new test case?

  • t0-isolated-d16u16s1 with two_vlan_a or four_vlan_a VLAN configurations
  • Requires minimum topology: D1D2:4, D1T1:2, D2T1:2

Documentation

Test module includes comprehensive docstrings describing test cases and steps.


Link to Devin run: https://cisco-demo.devinenterprise.com/sessions/c327341f8de74d5283c788e47524faf6
Requested by: Arthur Poon (arthur.poon@cognition.ai) (@arthurkkp-cog)

This commit implements a comprehensive test plan for validating Per-VLAN
Spanning Tree (PVST) functionality in SONiC using two/four VLAN T0 topologies.

Test Cases Implemented:
1. Per-VLAN STP Instance Independence
   - Verify separate STP instances per VLAN
   - Test independent bridge priorities
   - Test independent root bridges

2. Interface-Specific PVST Configuration
   - Portfast configuration
   - BPDU filter configuration
   - Root guard configuration
   - BPDU guard configuration
   - Interface cost per VLAN
   - Interface priority per VLAN

3. Topology Change Resilience
   - VLAN isolation on topology change
   - STP convergence per VLAN
   - Multiple VLAN stability

4. Protocol Variant Testing
   - PVST mode configuration
   - RPVST mode configuration
   - PVST to RPVST transition
   - VLAN parameters with protocol variants

5. Configuration Persistence
   - Configuration save
   - Configuration persistence after reboot
   - VLAN configuration independence

VLAN Configurations Used:
- two_vlan_a: Vlan1000, Vlan1100
- four_vlan_a: Vlan1000, Vlan1100, Vlan1200, Vlan1300

Topology Files:
- ansible/vars/topo_t0-isolated-d16u16s1.yml

Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

bpar9 pushed a commit that referenced this pull request Apr 17, 2026
…kets not received on collector interface (sonic-net#22186)

* [sonic-mgmt] Fix sflow/test_sflow.py failures with expected sflow packets not received on collector interface

Issue #1:
In some cases (like sflow config enabled for first time, device reboot),
hsflowd daemon is taking little over 3 mins to be fully initialized and
process collector config. During this window, hsflowd service won't send
sflow packets ('CounterSample', 'FlowSample' etc) to collector interface
and thus test can fail with i) "Packets are not received in active
collector, collector\d+" and ii) "Expected Number of samples are not
collected from Interface Ethernet\d+ in collector collector\d+ , Received \d+"

hsflowd service is writing to "/etc/hsflowd.auto" once it's processed
collector configuration. Thus waiting for collector info to be present in
"/etc/hsflowd.auto" seems to be safe option before proceeding with
sflow traffic verfication.

Issue #2:
If the test expects flow samples/packets on the collector interface but they aren't
seen for some reason, then we are hitting "KeyError: 'flow_port_count'". Due to
counter samples seen on collector interface, "data['total_samples']" will not be
zero but "data['total_flow_count']" will be 0 and lead to KeyError when tried to
access "data['flow_port_count']". Fix is to have assert on "total_flow_count" and
"total_counter_count" before calling corresponding sample analyze functions.

Signed-off-by: Vinod <vkjammala@arista.com>

* Addressing review comments

1) Enhanced "wait_until_hsflowd_ready" to make it wait for all the
   collector IPs (instead of calling it sequentially for each IP)
2) Add docstring for "wait_until_hsflowd_ready" function
3) Updated "ast.literal_eval" usage to handle the case where
   "active_collectors" is passed as empty string ("" instead of "[]")

Signed-off-by: Vinod <vkjammala@arista.com>

* Fix pre-commit check failures

Signed-off-by: Vinod <vkjammala@arista.com>

* Revert PR#21674 partially to enable "sflow/test_sflow.py" test

Signed-off-by: Vinod <vkjammala@arista.com>

---------

Signed-off-by: Vinod <vkjammala@arista.com>
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.

0 participants