Skip to content

Comments

Update qos sai cases for ipv6 only topo (#20798)#879

Merged
r12f merged 2 commits intoAzure:202412from
JibinBao:cp_qos_sai_v6_2412
Jan 21, 2026
Merged

Update qos sai cases for ipv6 only topo (#20798)#879
r12f merged 2 commits intoAzure:202412from
JibinBao:cp_qos_sai_v6_2412

Conversation

@JibinBao
Copy link

Description of PR

Update qos sai cases for ipv6 only topo

  1. Update the method to get the test port and ip for v6
  2. Update the method to generate the arp for v6
  3. Update the method to get the dst port for v6
  4. Update the method to send v6 packet

Summary:
Fixes # (issue)

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

Approach

What is the motivation for this PR?

Update qos sai case for ipv6 only topo

How did you do it?

  1. Update the method to get the test port and ip for v6
  2. Update the method to generate the arp for v6
  3. Update the method to get the dst port for v6
  4. Update the method to send v6 packet

How did you verify/test it?

Run qos sai tests on v6 topo

Any platform specific information?

SPC5

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

V6 topo

Documentation

@JibinBao
Copy link
Author

Hi @r12f , Can you please review it

@r12f
Copy link
Contributor

r12f commented Nov 21, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

self.__deleteTmpSwitchConfig(duthost)

@pytest.fixture(scope='class', autouse=True)
def update_delay_first_probe_time_for_v6_top(self, get_src_dst_asic_and_duts, tbinfo, dutConfig):

Choose a reason for hiding this comment

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

can we rename the function to "update_delay_first_probe_time_for_v6_topo" or "update_delay_first_probe_time_for_v6_topology" ?

ecn=ecn,
ttl=ttl)
if ip_type == 'ipv6':
pkt = construct_ipv6_pkt(packet_length,

Choose a reason for hiding this comment

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

there are many repetitive conditional checks like this.
This pattern appears throughout the code, even though the IPv4 and IPv6 functions are very similar. The challenge is to use a unified API by redirecting function pointers at runtime based on the ip_type parameter.

can we Leverage Python's dynamic nature to bind different function implementations to the same attribute name during test initialization. This eliminates repetitive conditionals in the test logic.

for example:

    def setUp(self):
        """Initialize and setup IP version specific function bindings"""
        super().setUp()
        
        # Get IP type from test parameters
        ip_type = self.test_params.get('ip_type', 'ipv4')
        
        # Dynamically bind functions based on IP type
        # This creates instance attributes that point to different implementations
        if ip_type == 'ipv6':
            # Redirect: IPv4 API name points to IPv6 implementation
            self.construct_ip_pkt = construct_ipv6_pkt
            self._get_rx_port_func = get_rx_port_ipv6
        else:
            # IPv4: use original implementations
            self.construct_ip_pkt = construct_ip_pkt
            self._get_rx_port_func = get_rx_port
    
    def runTest(self):
        # ... parameter initialization ...
        
        # Unified API call - no conditional logic needed
        # Automatically routes to correct implementation
        pkt = self.construct_ip_pkt(
            packet_length,
            pkt_dst_mac,
            src_port_mac,
            src_port_ip,
            dst_port_ip,
            dscp,
            src_port_vlan,
            ecn=ecn,
            ttl=ttl
        )
        
        # Unified API call - no conditional logic needed
        dst_port_id = self._get_rx_port_func(
            self, 0, src_port_id, pkt_dst_mac, 
            dst_port_ip, src_port_ip, src_port_vlan
        )

Copy link
Author

Choose a reason for hiding this comment

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

Since the original PR was merged to master branch. Can we keep it as it?
If need, can we open a ticket and then optimize it?

@r12f
Copy link
Contributor

r12f commented Jan 9, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

* Update qos sai case for ipv6 only topo

1. Update the method to get the test port and ip for v6
2. Update the method to generate the arp for v6
3. Update the method to get the dst port for v6
4. Update the method to send v6 packet
@JibinBao
Copy link
Author

Hi @r12f,
Fixed

@r12f
Copy link
Contributor

r12f commented Jan 13, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@r12f r12f merged commit a30b6ac into Azure:202412 Jan 21, 2026
14 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