Skip to content

Commit

Permalink
Modified test cases by QOS DB reference format remove
Browse files Browse the repository at this point in the history
Syntax error fix

Addressed review comment
  • Loading branch information
AshokDaparthi committed Sep 2, 2021
1 parent 6e98e95 commit e80769d
Show file tree
Hide file tree
Showing 17 changed files with 794 additions and 793 deletions.
36 changes: 18 additions & 18 deletions ansible/roles/fanout/templates/sonic_deploy_arista_7060.j2
Original file line number Diff line number Diff line change
Expand Up @@ -67,52 +67,52 @@
"QUEUE": {
{% for alias in device_conn[inventory_hostname] %}
"{{ alias }}|0": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
},
"{{ alias }}|1": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
},
"{{ alias }}|2": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
},
"{{ alias }}|3": {
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]",
"scheduler": "[SCHEDULER|scheduler.1]"
"wred_profile": "AZURE_LOSSLESS",
"scheduler": "scheduler.1"
},
"{{ alias }}|4": {
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]",
"scheduler": "[SCHEDULER|scheduler.1]"
"wred_profile": "AZURE_LOSSLESS",
"scheduler": "scheduler.1"
},
"{{ alias }}|5": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
},
"{{ alias }}|6": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
}{% if not loop.last %},{% endif %}
{% endfor %}
},

"BUFFER_QUEUE": {
{% for alias in device_conn[inventory_hostname] %}
"{{ alias }}|0-2": {
"profile": "[BUFFER_PROFILE|egress_lossy_profile]"
"profile": "egress_lossy_profile"
},
"{{ alias }}|3-4": {
"profile": "[BUFFER_PROFILE|egress_lossless_profile]"
"profile": "egress_lossless_profile"
},
"{{ alias }}|5-6": {
"profile": "[BUFFER_PROFILE|egress_lossy_profile]"
"profile": "egress_lossy_profile"
}{% if not loop.last %},{% endif %}
{% endfor %}
},

"BUFFER_PG": {
{% for alias in device_conn[inventory_hostname] %}
"{{ alias }}|0": {
"profile": "[BUFFER_PROFILE|ingress_lossy_profile]"
"profile": "ingress_lossy_profile"
},
"{{ alias }}|3-4": {
"profile": "[BUFFER_PROFILE|pg_lossless_100000_300m_profile]"
"profile": "pg_lossless_100000_300m_profile"
}{% if not loop.last %},{% endif %}
{% endfor %}
},
Expand Down Expand Up @@ -188,25 +188,25 @@
"BUFFER_PROFILE": {
"egress_lossless_profile": {
"static_th": "15982720",
"pool": "[BUFFER_POOL|egress_lossless_pool]",
"pool": "egress_lossless_pool",
"size": "1518"
},
"egress_lossy_profile": {
"dynamic_th": "3",
"pool": "[BUFFER_POOL|egress_lossy_pool]",
"pool": "egress_lossy_pool",
"size": "1518"
},
"ingress_lossy_profile": {
"dynamic_th": "3",
"pool": "[BUFFER_POOL|ingress_lossless_pool]",
"pool": "ingress_lossless_pool",
"size": "0"
},
"pg_lossless_100000_300m_profile": {
"xon_offset": "2288",
"dynamic_th": "0",
"xon": "2288",
"xoff": "268736",
"pool": "[BUFFER_POOL|ingress_lossless_pool]",
"pool": "ingress_lossless_pool",
"size": "1248"
}
}
Expand Down
20 changes: 10 additions & 10 deletions ansible/roles/test/tasks/qos_get_max_buff_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@

- name: Parse buffer profile name
set_fact:
buffer_profile="{{buffer_profile.stdout|replace('[','')|replace(']','')}}"
buffer_profile="{{buffer_profile.stdout}}"


- name: Get {{target_buffer_profile_type}} buffer headroom size for {{target_port_name}} port
shell: redis-cli -n 4 HGET "{{buffer_profile}}" size
shell: redis-cli -n 4 HGET "BUFFER_PROFILE|{{buffer_profile}}" size
register: buffer_headroom

- fail:
Expand All @@ -41,15 +41,15 @@


- name: Get {{target_buffer_profile_type}} buffer pool profile for {{target_port_name}} port
shell: redis-cli -n 4 HGET "{{buffer_profile}}" pool
shell: redis-cli -n 4 HGET "BUFFER_PROFILE|{{buffer_profile}}" pool
register: buffer_pool_id

- name: Parse {{target_buffer_profile_type}} buffer pool profile name
set_fact:
buffer_pool_id="{{buffer_pool_id.stdout|replace('[','')|replace(']','')}}"
buffer_pool_id="{{buffer_pool_id.stdout}}"

- name: Get {{target_buffer_profile_type}} buffer alpha ID for {{target_port_name}} port
shell: redis-cli -n 4 HGET "{{buffer_profile}}" dynamic_th
shell: redis-cli -n 4 HGET "BUFFER_PROFILE|{{buffer_profile}}" dynamic_th
register: buffer_alpha_raw

# static threshold
Expand All @@ -60,7 +60,7 @@
"{{target_buffer_profile_type}} buffer uses static threshold"
- name: Get {{target_buffer_profile_type}} buffer alpha ID for {{target_port_name}} port
shell: redis-cli -n 4 HGET "{{buffer_profile}}" static_th
shell: redis-cli -n 4 HGET "BUFFER_PROFILE|{{buffer_profile}}" static_th
register: buffer_static_th

- fail:
Expand All @@ -78,7 +78,7 @@
buffer_alpha="{{2|pow(buffer_alpha_raw.stdout|int)}}"

- name: Get {{target_buffer_profile_type}} buffer pool size for {{target_port_name}} port
shell: redis-cli -n 4 HGET "{{buffer_pool_id}}" size
shell: redis-cli -n 4 HGET "BUFFER_POOL|{{buffer_pool_id}}" size
register: buffer_pool_size

- fail:
Expand All @@ -93,7 +93,7 @@

# ingress lossless specific
- name: Get XON for {{target_port_name}} port
shell: redis-cli -n 4 HGET "{{buffer_profile}}" xon
shell: redis-cli -n 4 HGET "BUFFER_PROFILE|{{buffer_profile}}" xon
register: buffer_xon
when: buffer_profile != "" and "pg_lossless" in buffer_profile

Expand All @@ -104,7 +104,7 @@

# ingress lossless specific
- name: Get XOFF for {{target_port_name}} port
shell: redis-cli -n 4 HGET "{{buffer_profile}}" xoff
shell: redis-cli -n 4 HGET "BUFFER_PROFILE|{{buffer_profile}}" xoff
register: buffer_xoff
when: buffer_profile != "" and 'pg_lossless' in buffer_profile

Expand All @@ -117,7 +117,7 @@
# This is perhaps the only useful section in this yaml play
- block:
- set_fact:
buffer_pool_name="{{buffer_pool_id|replace('BUFFER_POOL|','')}}"
buffer_pool_name="{{buffer_pool_id}}"

- name: Get {{buffer_pool_name}} VOID
shell: redis-cli -n 2 HGET COUNTERS_BUFFER_POOL_NAME_MAP "{{buffer_pool_name}}"
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/test/tasks/qos_sai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
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')}}"
- set_fact: speed_cablelen="{{speed_cablelen | regex_replace('pg_lossless_(.*)_profile', '\\1')}}"

- name: Get asic type
set_fact: asic_type="{{ item }}"
Expand Down
6 changes: 3 additions & 3 deletions ansible/roles/test/templates/qos_lossy_profile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"BUFFER_PROFILE": {
"pg_lossy_TEST_profile": {
"dynamic_th": "-8",
"pool": "[{{ buffer_pool_id }}]",
"pool": "{{ buffer_pool_id }}",
{% if buffer_headroom.stdout != '0' %}
"size": "{{ buffer_headroom.stdout }}"
{% else %}
Expand All @@ -15,9 +15,9 @@
"BUFFER_PG": {
"{{ dut_switch_ports[src_port_id|int] }}|0-1": {
{% if pfc_generate_buffer_profile == 'True' %}
"profile": "[BUFFER_PROFILE|pg_lossy_TEST_profile]"
"profile": "pg_lossy_TEST_profile"
{% else %}
"profile": "[{{ buffer_profile }}]"
"profile": "{{ buffer_profile }}"
{% endif %}
}
}
Expand Down
6 changes: 3 additions & 3 deletions ansible/roles/test/templates/qos_pfc_profile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"xon": "{{ buffer_xon.stdout }}",
"dynamic_th": "-8",
"xoff": "{{ buffer_xoff.stdout }}",
"pool": "[{{ buffer_pool_id }}]",
"pool": "{{ buffer_pool_id }}",
"size": "{{ buffer_headroom.stdout }}"
}
},
{% endif %}
"BUFFER_PG": {
"{{ dut_switch_ports[src_port_id|int] }}|3-4": {
{% if pfc_generate_buffer_profile == 'True' %}
"profile": "[BUFFER_PROFILE|pg_lossless_PFC_TEST_profile]"
"profile": "pg_lossless_PFC_TEST_profile"
{% else %}
"profile": "[{{ buffer_profile }}]"
"profile": "{{ buffer_profile }}"
{% endif %}
}
}
Expand Down
34 changes: 17 additions & 17 deletions ansible/vars/configlet/t1-64-lag-clet/clet-add.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,59 +121,59 @@
{
"QUEUE": {
"Ethernet63|0": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
},
"Ethernet63|1": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
},
"Ethernet63|2": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
},
"Ethernet63|3": {
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]",
"scheduler": "[SCHEDULER|scheduler.1]"
"wred_profile": "AZURE_LOSSLESS",
"scheduler": "scheduler.1"
},
"Ethernet63|4": {
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]",
"scheduler": "[SCHEDULER|scheduler.1]"
"wred_profile": "AZURE_LOSSLESS",
"scheduler": "scheduler.1"
},
"Ethernet63|5": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
},
"Ethernet63|6": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
}
}
},
{
"BUFFER_PG": {
"Ethernet63|0": {
"profile": "[BUFFER_PROFILE|ingress_lossy_profile]"
"profile": "ingress_lossy_profile"
}
}
},
{
"BUFFER_QUEUE": {
"Ethernet63|0-2": {
"profile": "[BUFFER_PROFILE|egress_lossy_profile]"
"profile": "egress_lossy_profile"
},
"Ethernet63|3-4": {
"profile": "[BUFFER_PROFILE|egress_lossless_profile]"
"profile": "egress_lossless_profile"
},
"Ethernet63|5-6": {
"profile": "[BUFFER_PROFILE|egress_lossy_profile]"
"profile": "egress_lossy_profile"
}

}
},
{
"PORT_QOS_MAP": {
"Ethernet63": {
"tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]",
"tc_to_pg_map": "AZURE",
"tc_to_queue_map": "AZURE",
"pfc_enable": "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]"
"pfc_to_queue_map": "AZURE",
"dscp_to_tc_map": "AZURE"
}
}
},
Expand Down
18 changes: 9 additions & 9 deletions spytest/apis/qos/cos.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def config_port_qos_map(dut, obj_name, interface, **kwargs):
st.log("Please provide obj_name like 'AZURE' and interface like 'Ethernet0,Ethernet1'")
return False
else:
cos_specific_dict = {"tc_to_queue_map": "[TC_TO_QUEUE_MAP|" + obj_name + "]", "dscp_to_tc_map": "[DSCP_TO_TC_MAP|" + obj_name + "]" }
cos_specific_dict = {"tc_to_queue_map": obj_name, "dscp_to_tc_map": obj_name}
temp_data[interface] = cos_specific_dict
final_data['PORT_QOS_MAP'] = temp_data
final_data = json.dumps(final_data)
Expand Down Expand Up @@ -64,19 +64,19 @@ def config_port_qos_map_all(dut, qos_maps, cli_type=''):
if qos_map['port'] not in temp_data:
temp_data[qos_map['port']] = {}
if qos_map['map'] == 'dot1p_to_tc_map':
temp_data[qos_map['port']].update(dot1p_to_tc_map="[DOT1P_TO_TC_MAP|{}]".format(qos_map['obj_name']))
temp_data[qos_map['port']].update(dot1p_to_tc_map="{}".format(qos_map['obj_name']))
elif qos_map['map'] == 'dscp_to_tc_map':
temp_data[qos_map['port']].update(dscp_to_tc_map="[DSCP_TO_TC_MAP|{}]".format(qos_map['obj_name']))
temp_data[qos_map['port']].update(dscp_to_tc_map="{}".format(qos_map['obj_name']))
elif qos_map['map'] == 'pfc_to_queue_map':
temp_data[qos_map['port']].update(pfc_to_queue_map="[MAP_PFC_PRIORITY_TO_QUEUE|{}]".format(qos_map['obj_name']))
temp_data[qos_map['port']].update(pfc_to_queue_map="{}".format(qos_map['obj_name']))
elif qos_map['map'] == 'tc_to_dot1p_map':
temp_data[qos_map['port']].update(tc_to_dot1p_map="[TC_TO_DOT1P_MAP|{}]".format(qos_map['obj_name']))
temp_data[qos_map['port']].update(tc_to_dot1p_map="{}".format(qos_map['obj_name']))
elif qos_map['map'] == 'tc_to_dscp_map':
temp_data[qos_map['port']].update(tc_to_dscp_map="[TC_TO_DSCP_MAP|{}]".format(qos_map['obj_name']))
temp_data[qos_map['port']].update(tc_to_dscp_map="{}".format(qos_map['obj_name']))
elif qos_map['map'] == 'tc_to_pg_map':
temp_data[qos_map['port']].update(tc_to_pg_map="[TC_TO_PRIORITY_GROUP_MAP|{}]".format(qos_map['obj_name']))
temp_data[qos_map['port']].update(tc_to_pg_map="{}".format(qos_map['obj_name']))
elif qos_map['map'] == 'tc_to_queue_map':
temp_data[qos_map['port']].update(tc_to_queue_map="[TC_TO_QUEUE_MAP|{}]".format(qos_map['obj_name']))
temp_data[qos_map['port']].update(tc_to_queue_map="{}".format(qos_map['obj_name']))
else:
st.error('Invalid map: {}'.format(qos_map['map']))
return False
Expand Down Expand Up @@ -840,4 +840,4 @@ def get_non_range_map_data_from_range_map_data(dict_data):
temp.extend(re.findall(r"\d+", key))
retval.update({i:value for i in temp})
st.debug("The updated non-range map data is: {}".format(retval))
return retval
return retval
6 changes: 3 additions & 3 deletions spytest/apis/qos/qos_shaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def apply_port_shaping_config(dut, shaper_data, **kwargs):
json_data = {"PORT_QOS_MAP": {}, "SCHEDULER": {policy_name: {}}}
if shaper_data.get("port"):
ports = make_list(shaper_data["port"])
json_data["PORT_QOS_MAP"] = {port: {"scheduler": "[SCHEDULER|{}]".format(policy_name)} for port in ports}
json_data["PORT_QOS_MAP"] = {port: {"scheduler": "{}".format(policy_name)} for port in ports}
else:
json_data.pop("PORT_QOS_MAP")
if ("pir" in shaper_data) or ("pbs" in shaper_data) or shaper_data.get("meter_type"):
Expand Down Expand Up @@ -146,7 +146,7 @@ def apply_queue_shaping_config(dut, shaper_data, **kwargs):
config_data["SCHEDULER"].update(temp)
if ports:
queue_map = dict()
queue_map = {"{}|{}".format(port, ent['queue']): {"scheduler": "[SCHEDULER|{}]".format(policy)} for port in ports}
queue_map = {"{}|{}".format(port, ent['queue']): {"scheduler": "{}".format(policy)} for port in ports}
config_data["QUEUE"].update(queue_map)
config_data2 = {key: value for key, value in config_data.items()}
for key, value in config_data2.items():
Expand Down Expand Up @@ -303,7 +303,7 @@ def apply_queue_shcheduling_config(dut, scheduler_data, **kwargs):
if ent.get('type'):
temp[policy].update(type = ent['type'].upper())
if ports:
queue_map = {"{}|{}".format(port, ent['queue']) : {"scheduler": "[SCHEDULER|{}]".format(policy)} for port in ports}
queue_map = {"{}|{}".format(port, ent['queue']) : {"scheduler": "{}".format(policy)} for port in ports}
if temp[policy]:
config_data['SCHEDULER'].update(temp)
if queue_map:
Expand Down
2 changes: 1 addition & 1 deletion spytest/apis/qos/wred.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def apply_wred_ecn_config(dut, config, cli_type=''):
temp['queue'] = list(range(int(queue1), int(queue2)+1))
else:
temp['queue'] = q.split(',')
temp['wred_profile'] = wred_map['wred_profile'][14:-1]
temp['wred_profile'] = wred_map['wred_profile']
config_apply_list.append(temp)
st.debug('port map data is: {}'.format(config_apply_list))
for entry in config_apply_list:
Expand Down
Loading

0 comments on commit e80769d

Please sign in to comment.