Skip to content

Commit

Permalink
Qos SAI test restructure (sonic-net#1682)
Browse files Browse the repository at this point in the history
* Qos SAI test restructure

Signed-off-by: Neetha John <nejo@microsoft.com>
  • Loading branch information
neethajohn authored May 20, 2020
1 parent 87f3a23 commit f17471c
Show file tree
Hide file tree
Showing 4 changed files with 440 additions and 1,013 deletions.
4 changes: 4 additions & 0 deletions ansible/group_vars/sonic/vars
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ sonic_version: "v2"

broadcom_hwskus: [ "Force10-S6000", "Accton-AS7712-32X", "Celestica-DX010-C32", "Seastone-DX010", "Celestica-E1031-T48S4"]

broadcom_td2_hwskus: ['Force10-S6000', 'Force10-S6000-Q24S32', 'Arista-7050-QX32', 'Arista-7050-QX-32S']
broadcom_th_hwskus: ['Force10-S6100', 'Arista-7060CX-32S-C32', 'Arista-7060CX-32S-C32-T1', 'Arista-7060CX-32S-D48C8', 'Celestica-DX010-C32', "Seastone-DX010" ]
broadcom_th2_hwskus: ['Arista-7260CX3-D108C8', 'Arista-7260CX3-C64', 'Arista-7260CX3-Q64']

mellanox_spc1_hwskus: [ 'ACS-MSN2700', 'ACS-MSN2740', 'ACS-MSN2100', 'ACS-MSN2410', 'ACS-MSN2010', 'Mellanox-SN2700', 'Mellanox-SN2700-D48C8' ]
mellanox_spc2_hwskus: [ 'ACS-MSN3700', 'ACS-MSN3700C', 'ACS-MSN3800', 'Mellanox-SN3800-D112C8' ]
mellanox_spc3_hwskus: [ 'ACS-MSN4700' ]
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/test/tasks/qos_get_ports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@
target_pg: '3-4'
target_buffer_profile_type: 'ingress lossless'

- name: Set lossless buffer profile
set_fact:
lossless_buffer_profile: "{{ buffer_profile }}"

- name: Set lossless MAX buffer size
set_fact:
lossless_buffer_max_size: "{{buffer_headroom.stdout|int}}"
Expand Down
144 changes: 83 additions & 61 deletions ansible/roles/test/tasks/qos_sai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,36 @@
minigraph_facts: host={{inventory_hostname}}
become: no

- name: Get ports info.
include_tasks: roles/test/tasks/qos_get_ports.yml

- name: Check if lossless buffer profile is derived
fail: msg="Lossless Buffer profile could not be retreived"
when: lossless_buffer_profile is not defined or minigraph_hwsku is not defined

- set_fact:
defined_asic_list: ['td2', 'th', 'th2', 'spc1', 'spc2', 'spc3']
speed_cablelen: "{{ lossless_buffer_profile }}"

- set_fact: speed_cablelen="{{speed_cablelen | regex_replace('BUFFER_PROFILE\|pg_lossless_(.*)_profile', '\\1')}}"

- name: Get asic type
set_fact: asic_type="{{ item }}"
when:
- hostvars[inventory_hostname][sonic_asic_type + '_' + item + '_hwskus'] is defined
- minigraph_hwsku in hostvars[inventory_hostname][sonic_asic_type + '_' + item + '_hwskus']
with_items: "{{ defined_asic_list }}"

- debug: msg="asic type is {{ asic_type }}, portspeed_cablelen is {{ speed_cablelen }}"

- name: check if the device has configured qos parameters
fail: msg="device doesn't have configured qos parameters"
when: minigraph_hwsku is not defined or qos_params[minigraph_hwsku] is not defined
when: qos_params[asic_type] is not defined or qos_params[asic_type][speed_cablelen] is not defined

- name: set qos parameters for the device
set_fact: qp={{qos_params[minigraph_hwsku]}}
set_fact:
qp: "{{qos_params[asic_type]}}"
qp_sc: "{{qos_params[asic_type][speed_cablelen]}}"

- name: Ensure LLDP Daemon stopped
become: yes
Expand All @@ -52,14 +76,15 @@

- meta: flush_handlers

- block:
- name: Deploy script to DUT/syncd
copy: src=roles/test/files/mlnx/packets_aging.py dest=/root/packets_aging.py
- name: Deploy script to DUT/syncd
copy: src=roles/test/files/mlnx/packets_aging.py dest=/root/packets_aging.py
delegate_to: "{{ ansible_host }}_syncd"
when: minigraph_hwsku is defined and minigraph_hwsku in mellanox_hwskus

- name: Disable Mellanox packet aging
shell: python /root/packets_aging.py disable
register: result
failed_when: result.stderr != ''
- name: Disable Mellanox packet aging
shell: python /root/packets_aging.py disable
register: result
failed_when: result.stderr != ''
delegate_to: "{{ ansible_host }}_syncd"
when: minigraph_hwsku is defined and minigraph_hwsku in mellanox_hwskus

Expand All @@ -83,9 +108,6 @@
- port_map_file='/root/{{ptf_portmap | basename}}'
- sonic_asic_type='{{sonic_asic_type}}'

- name: Get ports info.
include_tasks: roles/test/tasks/qos_get_ports.yml

# Unpause all paused port
- include_tasks: qos_sai_ptf.yml
vars:
Expand Down Expand Up @@ -135,39 +157,39 @@
# XOFF limit
- include_tasks: qos_sai_ptf.yml
vars:
test_name: xoff limit ptf test dscp = {{qp.xoff_1.dscp}}, ecn = {{qp.xoff_1.ecn}}
test_name: xoff limit ptf test dscp = {{qp_sc.xoff_1.dscp}}, ecn = {{qp_sc.xoff_1.ecn}}
test_path: sai_qos_tests.PFCtest
test_params:
- dscp='{{qp.xoff_1.dscp}}'
- ecn='{{qp.xoff_1.ecn}}'
- pg='{{qp.xoff_1.pg}}'
- dscp='{{qp_sc.xoff_1.dscp}}'
- ecn='{{qp_sc.xoff_1.ecn}}'
- pg='{{qp_sc.xoff_1.pg}}'
- buffer_max_size='{{lossless_buffer_max_size|int}}'
- queue_max_size='{{lossless_queue_max_size|int}}'
- dst_port_id='{{dst_port_id}}'
- dst_port_ip='{{dst_port_ip}}'
- src_port_id='{{src_port_id}}'
- src_port_ip='{{src_port_ip}}'
- pkts_num_leak_out='{{qp.xoff_1.pkts_num_leak_out}}'
- pkts_num_trig_pfc='{{qp.xoff_1.pkts_num_trig_pfc}}'
- pkts_num_trig_ingr_drp='{{qp.xoff_1.pkts_num_trig_ingr_drp}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- pkts_num_trig_pfc='{{qp_sc.xoff_1.pkts_num_trig_pfc}}'
- pkts_num_trig_ingr_drp='{{qp_sc.xoff_1.pkts_num_trig_ingr_drp}}'

- include_tasks: qos_sai_ptf.yml
vars:
test_name: xoff limit ptf test dscp = {{qp.xoff_2.dscp}}, ecn = {{qp.xoff_2.ecn}}
test_name: xoff limit ptf test dscp = {{qp_sc.xoff_2.dscp}}, ecn = {{qp_sc.xoff_2.ecn}}
test_path: sai_qos_tests.PFCtest
test_params:
- dscp='{{qp.xoff_2.dscp}}'
- ecn='{{qp.xoff_2.ecn}}'
- pg='{{qp.xoff_2.pg}}'
- dscp='{{qp_sc.xoff_2.dscp}}'
- ecn='{{qp_sc.xoff_2.ecn}}'
- pg='{{qp_sc.xoff_2.pg}}'
- buffer_max_size='{{lossless_buffer_max_size|int}}'
- queue_max_size='{{lossless_queue_max_size|int}}'
- dst_port_id='{{dst_port_id}}'
- dst_port_ip='{{dst_port_ip}}'
- src_port_id='{{src_port_id}}'
- src_port_ip='{{src_port_ip}}'
- pkts_num_leak_out='{{qp.xoff_2.pkts_num_leak_out}}'
- pkts_num_trig_pfc='{{qp.xoff_2.pkts_num_trig_pfc}}'
- pkts_num_trig_ingr_drp='{{qp.xoff_2.pkts_num_trig_ingr_drp}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- pkts_num_trig_pfc='{{qp_sc.xoff_2.pkts_num_trig_pfc}}'
- pkts_num_trig_ingr_drp='{{qp_sc.xoff_2.pkts_num_trig_ingr_drp}}'

# XON limit
- include_tasks: qos_sai_ptf.yml
Expand All @@ -187,7 +209,7 @@
- dst_port_3_ip='{{dst_port_3_ip}}'
- src_port_id='{{src_port_id}}'
- src_port_ip='{{src_port_ip}}'
- pkts_num_leak_out='{{qp.xon_1.pkts_num_leak_out}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- pkts_num_trig_pfc='{{qp.xon_1.pkts_num_trig_pfc}}'
- pkts_num_dismiss_pfc='{{qp.xon_1.pkts_num_dismiss_pfc}}'

Expand All @@ -208,29 +230,29 @@
- dst_port_3_ip='{{dst_port_3_ip}}'
- src_port_id='{{src_port_id}}'
- src_port_ip='{{src_port_ip}}'
- pkts_num_leak_out='{{qp.xon_2.pkts_num_leak_out}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- pkts_num_trig_pfc='{{qp.xon_2.pkts_num_trig_pfc}}'
- pkts_num_dismiss_pfc='{{qp.xon_2.pkts_num_dismiss_pfc}}'

# Headroom pool size
- include_tasks: qos_sai_ptf.yml
vars:
test_name: headroom pool size ptf test ecn = {{qp.hdrm_pool_size.ecn}}
test_name: headroom pool size ptf test ecn = {{qp_sc.hdrm_pool_size.ecn}}
test_path: sai_qos_tests.HdrmPoolSizeTest
test_params:
- testbed_type='{{testbed_type}}'
- dscps={{qp.hdrm_pool_size.dscps}}
- ecn={{qp.hdrm_pool_size.ecn}}
- pgs={{qp.hdrm_pool_size.pgs}}
- src_port_ids={{qp.hdrm_pool_size.src_port_ids}}
- src_port_ips=[{% for pid in qp.hdrm_pool_size.src_port_ids %}{% if not loop.last %}'{{testing_ports_ip[pid|string]}}', {% else %}'{{testing_ports_ip[pid|string]}}'{% endif %}{% endfor %}]
- dst_port_id={{qp.hdrm_pool_size.dst_port_id}}
- dst_port_ip='{{testing_ports_ip[qp.hdrm_pool_size.dst_port_id|string]}}'
- pgs_num={{qp.hdrm_pool_size.pgs_num }}
- pkts_num_leak_out={{qp.hdrm_pool_size.pkts_num_leak_out}}
- pkts_num_trig_pfc={{qp.hdrm_pool_size.pkts_num_trig_pfc}}
- pkts_num_hdrm_full={{qp.hdrm_pool_size.pkts_num_hdrm_full}}
- pkts_num_hdrm_partial={{qp.hdrm_pool_size.pkts_num_hdrm_partial}}
- dscps={{qp_sc.hdrm_pool_size.dscps}}
- ecn={{qp_sc.hdrm_pool_size.ecn}}
- pgs={{qp_sc.hdrm_pool_size.pgs}}
- src_port_ids={{qp_sc.hdrm_pool_size.src_port_ids}}
- src_port_ips=[{% for pid in qp_sc.hdrm_pool_size.src_port_ids %}{% if not loop.last %}'{{testing_ports_ip[pid|string]}}', {% else %}'{{testing_ports_ip[pid|string]}}'{% endif %}{% endfor %}]
- dst_port_id={{qp_sc.hdrm_pool_size.dst_port_id}}
- dst_port_ip='{{testing_ports_ip[qp_sc.hdrm_pool_size.dst_port_id|string]}}'
- pgs_num={{qp_sc.hdrm_pool_size.pgs_num }}
- pkts_num_leak_out={{qp_sc.pkts_num_leak_out}}
- pkts_num_trig_pfc={{qp_sc.hdrm_pool_size.pkts_num_trig_pfc}}
- pkts_num_hdrm_full={{qp_sc.hdrm_pool_size.pkts_num_hdrm_full}}
- pkts_num_hdrm_partial={{qp_sc.hdrm_pool_size.pkts_num_hdrm_partial}}
when: minigraph_hwsku is defined and
minigraph_hwsku in ['Arista-7060CX-32S-C32', 'Celestica-DX010-C32', 'Arista-7260CX3-D108C8', 'Force10-S6100', 'Arista-7260CX3-Q64']

Expand All @@ -251,7 +273,7 @@
- dst_port_2_ip='{{dst_port_2_ip}}'
- src_port_id='{{src_port_id}}'
- src_port_ip='{{src_port_ip}}'
- pkts_num_leak_out='{{qp.lossy_queue_1.pkts_num_leak_out}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- pkts_num_trig_egr_drp='{{qp.lossy_queue_1.pkts_num_trig_egr_drp}}'

# DSCP to queue mapping
Expand Down Expand Up @@ -284,7 +306,7 @@
- q5_num_of_pkts='{{qp.wrr.q5_num_of_pkts}}'
- q6_num_of_pkts='{{qp.wrr.q6_num_of_pkts}}'
- limit='{{qp.wrr.limit}}'
- pkts_num_leak_out='{{qp.wrr.pkts_num_leak_out}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- debug:
var: out.stdout_lines

Expand All @@ -306,7 +328,7 @@
- dst_port_ip='{{dst_port_ip}}'
- src_port_id='{{src_port_id}}'
- src_port_ip='{{src_port_ip}}'
- pkts_num_leak_out='{{qp.wm_pg_shared_lossless.pkts_num_leak_out}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- pkts_num_fill_min='{{qp.wm_pg_shared_lossless.pkts_num_fill_min}}'
- pkts_num_fill_shared='{{qp.wm_pg_shared_lossless.pkts_num_trig_pfc}}'
- cell_size='{{qp.wm_pg_shared_lossless.cell_size}}'
Expand Down Expand Up @@ -335,7 +357,7 @@
- dst_port_ip='{{dst_port_ip}}'
- src_port_id='{{src_port_id}}'
- src_port_ip='{{src_port_ip}}'
- pkts_num_leak_out='{{qp.wm_pg_shared_lossy.pkts_num_leak_out}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- pkts_num_fill_min='{{qp.wm_pg_shared_lossy.pkts_num_fill_min}}'
- pkts_num_fill_shared='{{qp.wm_pg_shared_lossy.pkts_num_trig_egr_drp|int - 1}}'
- cell_size='{{qp.wm_pg_shared_lossy.cell_size}}'
Expand All @@ -357,17 +379,17 @@
test_name: PG headroom watermark test
test_path: sai_qos_tests.PGHeadroomWatermarkTest
test_params:
- dscp='{{qp.wm_pg_headroom.dscp}}'
- ecn='{{qp.wm_pg_headroom.ecn}}'
- pg='{{qp.wm_pg_headroom.pg}}'
- dscp='{{qp_sc.wm_pg_headroom.dscp}}'
- ecn='{{qp_sc.wm_pg_headroom.ecn}}'
- pg='{{qp_sc.wm_pg_headroom.pg}}'
- dst_port_id='{{dst_port_id}}'
- dst_port_ip='{{dst_port_ip}}'
- src_port_id='{{src_port_id}}'
- src_port_ip='{{src_port_ip}}'
- pkts_num_leak_out='{{qp.wm_pg_headroom.pkts_num_leak_out}}'
- pkts_num_trig_pfc='{{qp.wm_pg_headroom.pkts_num_trig_pfc}}'
- pkts_num_trig_ingr_drp='{{qp.wm_pg_headroom.pkts_num_trig_ingr_drp}}'
- cell_size='{{qp.wm_pg_headroom.cell_size}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- pkts_num_trig_pfc='{{qp_sc.wm_pg_headroom.pkts_num_trig_pfc}}'
- pkts_num_trig_ingr_drp='{{qp_sc.wm_pg_headroom.pkts_num_trig_ingr_drp}}'
- cell_size='{{qp_sc.wm_pg_headroom.cell_size}}'
- debug:
var: out.stdout_lines

Expand All @@ -382,17 +404,17 @@
test_name: Queue shared watermark test, lossless traffic
test_path: sai_qos_tests.QSharedWatermarkTest
test_params:
- dscp='{{qp.wm_q_shared_lossless.dscp}}'
- ecn='{{qp.wm_q_shared_lossless.ecn}}'
- queue='{{qp.wm_q_shared_lossless.queue}}'
- dscp='{{qp_sc.wm_q_shared_lossless.dscp}}'
- ecn='{{qp_sc.wm_q_shared_lossless.ecn}}'
- queue='{{qp_sc.wm_q_shared_lossless.queue}}'
- dst_port_id='{{dst_port_id}}'
- dst_port_ip='{{dst_port_ip}}'
- src_port_id='{{src_port_id}}'
- src_port_ip='{{src_port_ip}}'
- pkts_num_leak_out='{{qp.wm_q_shared_lossless.pkts_num_leak_out}}'
- pkts_num_fill_min='{{qp.wm_q_shared_lossless.pkts_num_fill_min}}'
- pkts_num_trig_drp='{{qp.wm_q_shared_lossless.pkts_num_trig_ingr_drp}}'
- cell_size='{{qp.wm_q_shared_lossless.cell_size}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- pkts_num_fill_min='{{qp_sc.wm_q_shared_lossless.pkts_num_fill_min}}'
- pkts_num_trig_drp='{{qp_sc.wm_q_shared_lossless.pkts_num_trig_ingr_drp}}'
- cell_size='{{qp_sc.wm_q_shared_lossless.cell_size}}'
- debug:
var: out.stdout_lines

Expand All @@ -414,7 +436,7 @@
- dst_port_ip='{{dst_port_ip}}'
- src_port_id='{{src_port_id}}'
- src_port_ip='{{src_port_ip}}'
- pkts_num_leak_out='{{qp.wm_q_shared_lossy.pkts_num_leak_out}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- pkts_num_fill_min='{{qp.wm_q_shared_lossy.pkts_num_fill_min}}'
- pkts_num_trig_drp='{{qp.wm_q_shared_lossy.pkts_num_trig_egr_drp}}'
- cell_size='{{qp.wm_q_shared_lossy.cell_size}}'
Expand Down Expand Up @@ -466,7 +488,7 @@
- q5_num_of_pkts='{{qp.wrr_chg.q5_num_of_pkts}}'
- q6_num_of_pkts='{{qp.wrr_chg.q6_num_of_pkts}}'
- limit='{{qp.wrr_chg.limit}}'
- pkts_num_leak_out='{{qp.wrr_chg.pkts_num_leak_out}}'
- pkts_num_leak_out='{{qp_sc.pkts_num_leak_out}}'
- debug:
var: out.stdout_lines

Expand Down
Loading

0 comments on commit f17471c

Please sign in to comment.