Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions tests/saitests/py3/sai_qos_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,11 @@ def get_rx_port(dp, device_number, src_port_id, dst_mac, dst_ip, src_ip, src_vla
return result.port


def get_counter_names(sonic_version):
def get_counter_names(sonic_version, platform_asic=None):
ingress_counters = [INGRESS_DROP]
egress_counters = [EGRESS_DROP]

if '201811' not in sonic_version:
if '201811' not in sonic_version and platform_asic not in ['broadcom-dnx']:
ingress_counters.append(INGRESS_PORT_BUFFER_DROP)
egress_counters.append(EGRESS_PORT_BUFFER_DROP)

Expand Down Expand Up @@ -1669,7 +1669,7 @@ def runTest(self):

pkt_dst_mac = router_mac if router_mac != '' else dst_port_mac
# get counter names to query
ingress_counters, egress_counters = get_counter_names(sonic_version)
ingress_counters, egress_counters = get_counter_names(sonic_version, platform_asic)

# get a snapshot of PG drop packets counter
if '201811' not in sonic_version and ('mellanox' in asic_type or 'cisco-8000' in asic_type):
Expand Down Expand Up @@ -2377,7 +2377,7 @@ def runTest(self):
margin = 1

# get counter names to query
ingress_counters, egress_counters = get_counter_names(sonic_version)
ingress_counters, egress_counters = get_counter_names(sonic_version, platform_asic)

port_counter_indexes = [pg]
port_counter_indexes += ingress_counters
Expand Down Expand Up @@ -2847,7 +2847,7 @@ def setUp(self):
sys.stderr.flush()
# get counter names to query
self.ingress_counters, self.egress_counters = get_counter_names(
self.sonic_version)
self.sonic_version, self.platform_asic)

self.dst_port_id = self.test_params['dst_port_id']
self.dst_port_ip = self.test_params['dst_port_ip']
Expand Down Expand Up @@ -3850,7 +3850,7 @@ def runTest(self):
platform_asic = self.test_params['platform_asic']

# get counter names to query
ingress_counters, egress_counters = get_counter_names(sonic_version)
ingress_counters, egress_counters = get_counter_names(sonic_version, platform_asic)

# prepare tcp packet data
ttl = 64
Expand Down Expand Up @@ -4297,8 +4297,9 @@ def runTest(self):
router_mac = self.test_params['router_mac']
print("router_mac: %s" % (router_mac), file=sys.stderr)
pg = int(self.test_params['pg'])
platform_asic = self.test_params['platform_asic']
ingress_counters, egress_counters = get_counter_names(
self.test_params['sonic_version'])
self.test_params['sonic_version'], platform_asic)
dst_port_id = int(self.test_params['dst_port_id'])
dst_port_ip = self.test_params['dst_port_ip']
dst_port_mac = self.dataplane.get_mac(0, dst_port_id)
Expand All @@ -4314,7 +4315,6 @@ def runTest(self):
cell_size = int(self.test_params['cell_size'])
hwsku = self.test_params['hwsku']
internal_hdr_size = self.test_params.get('internal_hdr_size', 0)
platform_asic = self.test_params['platform_asic']

if 'packet_size' in list(self.test_params.keys()):
packet_length = int(self.test_params['packet_size'])
Expand Down Expand Up @@ -4919,8 +4919,9 @@ def runTest(self):
switch_init(self.clients)

# Parse input parameters
platform_asic = self.test_params['platform_asic']
ingress_counters, egress_counters = get_counter_names(
self.test_params['sonic_version'])
self.test_params['sonic_version'], platform_asic)
dscp = int(self.test_params['dscp'])
ecn = int(self.test_params['ecn'])
router_mac = self.test_params['router_mac']
Expand All @@ -4940,7 +4941,6 @@ def runTest(self):
pkts_num_trig_drp = int(self.test_params['pkts_num_trig_drp'])
cell_size = int(self.test_params['cell_size'])
hwsku = self.test_params['hwsku']
platform_asic = self.test_params['platform_asic']

if 'packet_size' in list(self.test_params.keys()):
packet_length = int(self.test_params['packet_size'])
Expand Down
6 changes: 6 additions & 0 deletions tests/saitests/py3/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,12 +792,18 @@ def sai_thrift_read_port_counters(client, asic_type, port):
port_cnt_ids.append(SAI_PORT_STAT_IF_IN_UCAST_PKTS)
port_cnt_ids.append(SAI_PORT_STAT_IF_IN_NON_UCAST_PKTS)
port_cnt_ids.append(SAI_PORT_STAT_IF_OUT_NON_UCAST_PKTS)
if asic_type == 'broadcom':
port_cnt_ids.remove(SAI_PORT_STAT_IN_DROPPED_PKTS)
port_cnt_ids.remove(SAI_PORT_STAT_OUT_DROPPED_PKTS)
if asic_type != 'mellanox':
port_cnt_ids.append(SAI_PORT_STAT_IF_OUT_QLEN)

counters_results = []
counters_results = client.sai_thrift_get_port_stats(
port, port_cnt_ids, len(port_cnt_ids))
if asic_type == 'broadcom':
counters_results.insert(12, 0)
counters_results.insert(13, 0)
if asic_type == 'mellanox':
counters_results.append(0)

Expand Down