Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[QOS - Test PFC Pause] Multi VLAN Support #16725

Merged

Conversation

matthew-soulsby
Copy link
Contributor

@matthew-soulsby matthew-soulsby commented Jan 30, 2025

Description of PR

Summary:

Type of change

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

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405
  • 202411

Approach

What is the motivation for this PR?

As new testbeds are being created with more VLANs, the assumption that a device should only contain 1 VLAN no longer holds. As such, certain helpers/parts of the framework need to be modified to allow for multiple VLANs to be present and tested.

How did you do it?

  1. Added a get_all_vlans function to extract all vlans from the duthost object
  2. The functions which get information related to vlans (get_active_vlan_members and get_vlan_subnet) now take a vlan configuration dictionary (which itself is taken from the get_all_vlans function)
  3. pfc_test_setup now returns a list of VLAN configurations, instead of just one
  4. The run_test wrapper now runs the relevant test for each VLAN supplied
  5. Also removed gen_testbed_t0, which is not used anywhere (validated with grep)

How did you verify/test it?

Before this change, running the qos/test_pfc_pause.py on a testbed with multiple VLANs produced the following output:

@pytest.fixture(scope="module", autouse=True)
    def pfc_test_setup(duthosts, rand_one_dut_hostname, tbinfo, ptfhost):
        """
        Generate configurations for the tests
   
        Args:
            duthosts(AnsibleHost) : multi dut instance
            rand_one_dut_hostname(string) : one of the dut instances from the multi dut
   
        Yields:
            setup(dict): DUT interfaces, PTF interfaces, PTF IP addresses, and PTF MAC addresses
        """
   
        """ Get all the active physical interfaces enslaved to the Vlan """
        """ These interfaces are actually server-faced interfaces at T0 """
        duthost = duthosts[rand_one_dut_hostname]
>       vlan_members, vlan_id = get_active_vlan_members(duthost)
E       TypeError: cannot unpack non-iterable NoneType object

With these changes, it is now successfully running:
image

202405 Evidence:
image

202411 Evidence:
image

Any platform specific information?

Any platform with only one VLAN - as each of the new lists/dicts will only contain one VLAN, iterating through them will cause the same behaviour as before.

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

N/A

Documentation

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ZhaohuiS
Copy link
Contributor

ZhaohuiS commented Feb 5, 2025

@matthew-soulsby This PR almost refactors the qos_pause related scripts, could you please also verify if this change will not fail the test result on single vlan testbed?

@matthew-soulsby
Copy link
Contributor Author

matthew-soulsby commented Feb 5, 2025

@matthew-soulsby This PR almost refactors the qos_pause related scripts, could you please also verify if this change will not fail the test result on single vlan testbed?

Sure, sounds good, I'll run on a single VLAN testbed and add a comment with the results.

@matthew-soulsby
Copy link
Contributor Author

@ZhaohuiS Running on a single VLAN testbed results in expected pass:
image

How does that look?

Copy link
Contributor

@ZhaohuiS ZhaohuiS left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@lipxu lipxu left a comment

Choose a reason for hiding this comment

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

Approved with comments.

@StormLiangMS
Copy link
Collaborator

Hi @matthew-soulsby could you update test results with sonic-mgmt 202405 and 202411 branches before cherry pick?

Copy link
Collaborator

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

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

LGTM

@StormLiangMS StormLiangMS merged commit e8cacfb into sonic-net:master Feb 18, 2025
15 checks passed
@matthew-soulsby
Copy link
Contributor Author

Hi @matthew-soulsby could you update test results with sonic-mgmt 202405 and 202411 branches before cherry pick?

Hi @StormLiangMS, just updated the results section with the requested results - how does it look now?

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Feb 19, 2025
What is the motivation for this PR?
As new testbeds are being created with more VLANs, the assumption that a device should only contain 1 VLAN no longer holds. As such, certain helpers/parts of the framework need to be modified to allow for multiple VLANs to be present and tested.

How did you do it?
Added a get_all_vlans function to extract all vlans from the duthost object
The functions which get information related to vlans (get_active_vlan_members and get_vlan_subnet) now take a vlan configuration dictionary (which itself is taken from the get_all_vlans function)
pfc_test_setup now returns a list of VLAN configurations, instead of just one
The run_test wrapper now runs the relevant test for each VLAN supplied
Also removed gen_testbed_t0, which is not used anywhere (validated with grep)
How did you verify/test it?
Before this change, running the qos/test_pfc_pause.py on a testbed with multiple VLANs produced the following output:

@pytest.fixture(scope="module", autouse=True)
    def pfc_test_setup(duthosts, rand_one_dut_hostname, tbinfo, ptfhost):
        """
        Generate configurations for the tests
   
        Args:
            duthosts(AnsibleHost) : multi dut instance
            rand_one_dut_hostname(string) : one of the dut instances from the multi dut
   
        Yields:
            setup(dict): DUT interfaces, PTF interfaces, PTF IP addresses, and PTF MAC addresses
        """
   
        """ Get all the active physical interfaces enslaved to the Vlan """
        """ These interfaces are actually server-faced interfaces at T0 """
        duthost = duthosts[rand_one_dut_hostname]
>       vlan_members, vlan_id = get_active_vlan_members(duthost)
E       TypeError: cannot unpack non-iterable NoneType object
With these changes, it is now successfully running:
image

Any platform specific information?
Any platform with only one VLAN - as each of the new lists/dicts will only contain one VLAN, iterating through them will cause the same behaviour as before.
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202411: #17021

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Feb 19, 2025
What is the motivation for this PR?
As new testbeds are being created with more VLANs, the assumption that a device should only contain 1 VLAN no longer holds. As such, certain helpers/parts of the framework need to be modified to allow for multiple VLANs to be present and tested.

How did you do it?
Added a get_all_vlans function to extract all vlans from the duthost object
The functions which get information related to vlans (get_active_vlan_members and get_vlan_subnet) now take a vlan configuration dictionary (which itself is taken from the get_all_vlans function)
pfc_test_setup now returns a list of VLAN configurations, instead of just one
The run_test wrapper now runs the relevant test for each VLAN supplied
Also removed gen_testbed_t0, which is not used anywhere (validated with grep)
How did you verify/test it?
Before this change, running the qos/test_pfc_pause.py on a testbed with multiple VLANs produced the following output:

@pytest.fixture(scope="module", autouse=True)
    def pfc_test_setup(duthosts, rand_one_dut_hostname, tbinfo, ptfhost):
        """
        Generate configurations for the tests
   
        Args:
            duthosts(AnsibleHost) : multi dut instance
            rand_one_dut_hostname(string) : one of the dut instances from the multi dut
   
        Yields:
            setup(dict): DUT interfaces, PTF interfaces, PTF IP addresses, and PTF MAC addresses
        """
   
        """ Get all the active physical interfaces enslaved to the Vlan """
        """ These interfaces are actually server-faced interfaces at T0 """
        duthost = duthosts[rand_one_dut_hostname]
>       vlan_members, vlan_id = get_active_vlan_members(duthost)
E       TypeError: cannot unpack non-iterable NoneType object
With these changes, it is now successfully running:
image

Any platform specific information?
Any platform with only one VLAN - as each of the new lists/dicts will only contain one VLAN, iterating through them will cause the same behaviour as before.
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202405: #17022

mssonicbld pushed a commit that referenced this pull request Feb 20, 2025
What is the motivation for this PR?
As new testbeds are being created with more VLANs, the assumption that a device should only contain 1 VLAN no longer holds. As such, certain helpers/parts of the framework need to be modified to allow for multiple VLANs to be present and tested.

How did you do it?
Added a get_all_vlans function to extract all vlans from the duthost object
The functions which get information related to vlans (get_active_vlan_members and get_vlan_subnet) now take a vlan configuration dictionary (which itself is taken from the get_all_vlans function)
pfc_test_setup now returns a list of VLAN configurations, instead of just one
The run_test wrapper now runs the relevant test for each VLAN supplied
Also removed gen_testbed_t0, which is not used anywhere (validated with grep)
How did you verify/test it?
Before this change, running the qos/test_pfc_pause.py on a testbed with multiple VLANs produced the following output:

@pytest.fixture(scope="module", autouse=True)
    def pfc_test_setup(duthosts, rand_one_dut_hostname, tbinfo, ptfhost):
        """
        Generate configurations for the tests
   
        Args:
            duthosts(AnsibleHost) : multi dut instance
            rand_one_dut_hostname(string) : one of the dut instances from the multi dut
   
        Yields:
            setup(dict): DUT interfaces, PTF interfaces, PTF IP addresses, and PTF MAC addresses
        """
   
        """ Get all the active physical interfaces enslaved to the Vlan """
        """ These interfaces are actually server-faced interfaces at T0 """
        duthost = duthosts[rand_one_dut_hostname]
>       vlan_members, vlan_id = get_active_vlan_members(duthost)
E       TypeError: cannot unpack non-iterable NoneType object
With these changes, it is now successfully running:
image

Any platform specific information?
Any platform with only one VLAN - as each of the new lists/dicts will only contain one VLAN, iterating through them will cause the same behaviour as before.
@matthew-soulsby matthew-soulsby deleted the mattsoulsby/pfc-multi-vlan branch February 21, 2025 00:03
mssonicbld pushed a commit that referenced this pull request Feb 21, 2025
What is the motivation for this PR?
As new testbeds are being created with more VLANs, the assumption that a device should only contain 1 VLAN no longer holds. As such, certain helpers/parts of the framework need to be modified to allow for multiple VLANs to be present and tested.

How did you do it?
Added a get_all_vlans function to extract all vlans from the duthost object
The functions which get information related to vlans (get_active_vlan_members and get_vlan_subnet) now take a vlan configuration dictionary (which itself is taken from the get_all_vlans function)
pfc_test_setup now returns a list of VLAN configurations, instead of just one
The run_test wrapper now runs the relevant test for each VLAN supplied
Also removed gen_testbed_t0, which is not used anywhere (validated with grep)
How did you verify/test it?
Before this change, running the qos/test_pfc_pause.py on a testbed with multiple VLANs produced the following output:

@pytest.fixture(scope="module", autouse=True)
    def pfc_test_setup(duthosts, rand_one_dut_hostname, tbinfo, ptfhost):
        """
        Generate configurations for the tests
   
        Args:
            duthosts(AnsibleHost) : multi dut instance
            rand_one_dut_hostname(string) : one of the dut instances from the multi dut
   
        Yields:
            setup(dict): DUT interfaces, PTF interfaces, PTF IP addresses, and PTF MAC addresses
        """
   
        """ Get all the active physical interfaces enslaved to the Vlan """
        """ These interfaces are actually server-faced interfaces at T0 """
        duthost = duthosts[rand_one_dut_hostname]
>       vlan_members, vlan_id = get_active_vlan_members(duthost)
E       TypeError: cannot unpack non-iterable NoneType object
With these changes, it is now successfully running:
image

Any platform specific information?
Any platform with only one VLAN - as each of the new lists/dicts will only contain one VLAN, iterating through them will cause the same behaviour as before.
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants