Skip to content

[snappi] test_m2o_fluctuating_lossless fails on VOQ platforms #28038

Description

@ysmanman

Is it platform specific

generic

Importance or Severity

Medium

Description of the bug

test_m2o_fluctuating_lossless fails on VOQ while calculating expected background loss:

     def get_queue_scheduler_weight_dict(host_ans, asic_value=None, port=None,                                                                                                                                                                                                                                                                                                                                                                                                            
                                        qos_map_profile=None):                                                                                                                                                                                                                                                                                                                                                                                                                           
        """                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
        Build a per-queue scheduler/weight map for an interface by joining the                                                                                                                                                                                                                                                                                                                                                                                                           
        ``QUEUE`` and ``SCHEDULER`` config-DB tables, and optionally annotating                                                                                                                                                                                                                                                                                                                                                                                                          
        each queue with one of its DSCP values via ``DSCP_TO_TC_MAP`` and                                                                                                                                                                                                                                                                                                                                                                                                                
        ``TC_TO_QUEUE_MAP``.                                                                                                                                                                                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        Args:                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
            host_ans: Ansible host instance of the device.                                                                                                                                                                                                                                                                                                                                                                                                                               
            asic_value: asic namespace; pass ``None`` (default) or the string                                                                                                                                                                                                                                                                                                                                                                                                            
                ``"None"`` for single-asic devices.                                                                                                                                                                                                                                                                                                                                                                                                                                      
            port (str, optional): interface name to read ``QUEUE`` for. Defaults                                                                                                                                                                                                                                                                                                                                                                                                         
                to the first interface present in ``QUEUE``.                                                                                                                                                                                                                                                                                                                                                                                                                             
            qos_map_profile (str, optional): name of the profile inside                                                                                                                                                                                                                                                                                                                                                                                                                  
                ``DSCP_TO_TC_MAP`` / ``TC_TO_QUEUE_MAP`` to use for the ``dscp``                                                                                                                                                                                                                                                                                                                                                                                                         
                field. Defaults to the first profile (typically ``"AZURE"``).                                                                                                                                                                                                                                                                                                                                                                                                            
                If the maps are missing, ``dscp`` is set to ``None``.                                                                                                                                                                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        Returns:                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
            dict[int, dict]: ``{queue: {"scheduler": <name>, "type": <DWRR/...>,                                                                                                                                                                                                                                                                                                                                                                                             
            "weight": <int>, "dscp": <int|None>}}``. The result always covers                                                                                                                                                                                                                                                                                                                                                                                                
            queues 0-7; any queue not present in the per-port ``QUEUE`` config                                                                                                                                                                                                                                                                                                                                                                                                           
            (or whose scheduler is missing from ``SCHEDULER``) falls back to a                                                                                                                                                                                                                                                                                                                                                                                                           
            default entry with equal DWRR weight 15.                                                                                                                                                                                                                                                                                                                                                                                                                                     
        """                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
        if asic_value in (None, "None"):                                                                                                                                                                                                                                                                                                                                                                                                                                                 
            config_facts = host_ans.config_facts(host=host_ans.hostname,                                                                                                                                                                                                                                                                                                                                                                                                                 
                                                 source="running")["ansible_facts"]                                                                                                                                                                                                                                                                                                                                                                                                      
        else:                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
            config_facts = host_ans.config_facts(host=host_ans.hostname,                                                                                                                                                                                                                                                                                                                                                                                                                 
                                                 source="running",                                                                                                                                                                                                                                                                                                                                                                                                                       
                                                 namespace=asic_value)["ansible_facts"]                                                                                                                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        queue_cfg_all = config_facts.get("QUEUE") or {}                                                                                                                                                                                                                                                                                                                                                                                                                                  
        scheduler_cfg = config_facts.get("SCHEDULER") or {}                                                                                                                                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        dscp_to_tc = config_facts.get("DSCP_TO_TC_MAP") or {}                                                                                                                                                                                                                                                                                                                                                                                                                            
        tc_to_queue = config_facts.get("TC_TO_QUEUE_MAP") or {}                                                                                                                                                                                                                                                                                                                                                                                                                          
        if qos_map_profile is None and dscp_to_tc:                                                                                                                                                                                                                                                                                                                                                                                                                                       
            qos_map_profile = next(iter(dscp_to_tc))                                                                                                                                                                                                                                                                                                                                                                                                                                     
        dscp_to_tc_map = dscp_to_tc.get(qos_map_profile, {}) if qos_map_profile else {}                                                                                                                                                                                                                                                                                                                                                                                                  
        tc_to_queue_map = tc_to_queue.get(qos_map_profile, {}) if qos_map_profile else {}                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        queue_to_dscp = {}                                                                                                                                                                                                                                                                                                                                                                                                                                                               
        for dscp, tc in dscp_to_tc_map.items():                                                                                                                                                                                                                                                                                                                                                                                                                                          
            q = tc_to_queue_map.get(str(tc))                                                                                                                                                                                                                                                                                                                                                                                                                                             
            if q is not None:                                                                                                                                                                                                                                                                                                                                                                                                                                                            
                queue_to_dscp.setdefault(int(q), int(dscp))                                                                                                                                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        # default entry with equal DWRR weight 15                                                                                                                                                                                                                                                                                                                                                                                                                                        
        result = {                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
            q: {"scheduler": None, "type": "DWRR", "weight": 15,                                                                                                                                                                                                                                                                                                                                                                                                                         
                "dscp": queue_to_dscp.get(q)}                                                                                                                                                                                                                                                                                                                                                                                                                                            
            for q in range(8)                                                                                                                                                                                                                                                                                                                                                                                                                                                            
        }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        if not queue_cfg_all:                                                                                                                                                                                                                                                                                                                                                                                                                                                            
            return result                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        if port is None:                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
            port = next(iter(queue_cfg_all))                                                                                                                                                                                                                                                                                                                                                                                                                                             
        if port not in queue_cfg_all:                                                                                                                                                                                                                                                                                                                                                                                                                                                    
>           raise KeyError("Port {} not found in QUEUE config (available: {})".format(port, sorted(queue_cfg_all)))                                                                                                                                                                                                                                                                                                                                                                   
E           KeyError: "Port Ethernet64 not found in QUEUE config (available: ['xxx370'])"                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
asic_value = 'asic0'                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
config_facts = {'ACL_TABLE': {'DATAACL': {'policy_desc': 'DATAACL', 'ports': ['Ethernet64', 'Ethernet136'], 'stage': 'ingress', 'type... and/or use are subject to monitoring.\n\nHelp:    https://sonic-net.github.io/SONiC/\n\n', 'state': 'disabled'}}, ...}                                                                                                                                                                                                                          
dscp       = '9'                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
dscp_to_tc = {'AZURE': {'0': '1', '1': '1', '10': '1', '11': '1', ...}}                                                                                                                                                                                                                                                                                                                                                                                                                  
dscp_to_tc_map = {'0': '1', '1': '1', '10': '1', '11': '1', ...}                                                                                                                                                                                                                                                                                                                                                                                                                         
host_ans   = <MultiAsicSonicHost xxx370>                                                                                                                                                                                                                                                                                                                                                                                                                                           
port       = 'Ethernet64'                                                                                                                                                                                                                                                                                                                                                                                                                                                                
q          = '1'                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
qos_map_profile = 'AZURE'                                                                                                                                                                                                                                                                                                                                                                                                                                                                
queue_cfg_all = {'xxx370': {'asic0|Ethernet0|3': {'wred_profile': 'AZURE_LOSSLESS'}, 'asic0|Ethernet0|4': {'wred_profile': 'AZURE_LOSS...c0|Ethernet104|3': {'wred_profile': 'AZURE_LOSSLESS'}, 'asic0|Ethernet104|4': {'wred_profile': 'AZURE_LOSSLESS'}, ...}}                                                                                                                                                                                                                         
queue_to_dscp = {1: 0, 3: 3, 4: 4, 5: 46, ...}                                                                                                                                                                                                                                                                                                                                                                                                                                           
result     = {0: {'scheduler': None, 'type': 'DWRR', 'weight': 15, 'dscp': 8}, 1: {'scheduler': None, 'type': 'DWRR', 'weight': 15,...: None, 'type': 'DWRR', 'weight': 15, 'dscp': 5}, 3: {'scheduler': None, 'type': 'DWRR', 'weight': 15, 'dscp': 3}, ...}                                                                                                                                                                                                                            
scheduler_cfg = {'scheduler.0': {'type': 'DWRR', 'weight': '14'}, 'scheduler.1': {'type': 'DWRR', 'weight': '15'}}                                                                                                                                                                                                                                                                                                                                                                       
tc         = '1'                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
tc_to_queue = {'AZURE': {'0': '0', '1': '1', '2': '2', '3': '3', ...}}                                                                                                                                                                                                                                                                                                                                                                                                                   
tc_to_queue_map = {'0': '0', '1': '1', '2': '2', '3': '3', ...}                                                                                                                                                                                                                                                                                                                                                                                                                          

get_queue_scheduler_weight_dict() expected QUEUE config-facts in a per-port form such as:

{"Ethernet64": {"3": {"scheduler": "scheduler.1"}}}

However, in VOQ system, the running config facts are returned with hostname wrapper and composite keys:

{"xxx370": {"asic0|Ethernet64|3": {"scheduler": "scheduler.1"}}}

Steps to Reproduce

Run test_m2o_fluctuating_lossless on VOQ system.

Actual Behavior and Expected Behavior

test_m2o_fluctuating_lossless should pass on VOQ system.

Relevant log output

Output of show version

Attach files (if any)

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions