Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 9 additions & 9 deletions tests/pfcwd/test_pfcwd_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ def storm_setup(self, init=False):

class SendVerifyTraffic():
""" PTF test """
def __init__(self, ptf, eth0_mac, pfc_params):
def __init__(self, ptf, router_mac, pfc_params):
"""
Args:
ptf(AnsibleHost) : ptf instance
eth0_mac(string) : mac addr of eth0
router_mac(string) : router mac address
ptf_params(dict) : all PFC test params specific to the DUT port
"""
self.ptf = ptf
self.eth0_mac = eth0_mac
self.router_mac = Ethernet0_mac
self.pfc_queue_index = pfc_params['queue_index']
self.pfc_wd_test_pkt_count = pfc_params['test_pkt_count']
self.pfc_wd_rx_port_id = pfc_params['rx_port_id']
Expand All @@ -289,7 +289,7 @@ def verify_tx_egress(self, action):
dst_port = "[" + str(self.pfc_wd_test_port_id) + "]"
if action == "forward" and type(self.pfc_wd_test_port_ids) == list:
dst_port = "".join(str(self.pfc_wd_test_port_ids)).replace(',', '')
ptf_params = {'router_mac': self.eth0_mac,
ptf_params = {'router_mac': self.router_mac,
'queue_index': self.pfc_queue_index,
'pkt_count': self.pfc_wd_test_pkt_count,
'port_src': self.pfc_wd_rx_port_id[0],
Expand All @@ -315,7 +315,7 @@ def verify_rx_ingress(self, action):
dst_port = "".join(str(self.pfc_wd_rx_port_id)).replace(',', '')
else:
dst_port = "[ " + str(self.pfc_wd_rx_port_id) + " ]"
ptf_params = {'router_mac': self.eth0_mac,
ptf_params = {'router_mac': self.router_mac,
'queue_index': self.pfc_queue_index,
'pkt_count': self.pfc_wd_test_pkt_count,
'port_src': self.pfc_wd_test_port_id,
Expand All @@ -337,7 +337,7 @@ def verify_other_pfc_queue(self):
dst_port = "".join(str(self.pfc_wd_test_port_ids)).replace(',', '')
else:
dst_port = "[ " + str(self.pfc_wd_test_port_ids) + " ]"
ptf_params = {'router_mac': self.eth0_mac,
ptf_params = {'router_mac': self.router_mac,
'queue_index': self.pfc_queue_index - 1,
'pkt_count': self.pfc_wd_test_pkt_count,
'port_src': self.pfc_wd_rx_port_id[0],
Expand All @@ -359,7 +359,7 @@ def verify_other_pfc_pg(self):
dst_port = "".join(str(self.pfc_wd_rx_port_id)).replace(',', '')
else:
dst_port = "[ " + str(self.pfc_wd_rx_port_id) + " ]"
ptf_params = {'router_mac': self.eth0_mac,
ptf_params = {'router_mac': self.router_mac,
'queue_index': self.pfc_queue_index - 1,
'pkt_count': self.pfc_wd_test_pkt_count,
'port_src': self.pfc_wd_test_port_id,
Expand All @@ -377,7 +377,7 @@ def fill_buffer(self):
Send traffic to fill up the buffer. No verification
"""
logger.info("Send packets to {} to fill up the buffer".format(self.pfc_wd_test_port))
ptf_params = {'router_mac': self.eth0_mac,
ptf_params = {'router_mac': self.router_mac,
'queue_index': self.pfc_queue_index,
'pkt_count': self.pfc_wd_test_pkt_count,
'port_src': self.pfc_wd_rx_port_id[0],
Expand Down Expand Up @@ -529,7 +529,7 @@ def test_pfcwd_actions(self, request, setup_pfc_test, fanout_graph_facts, ptfhos
logger.info("")
logger.info("--- Testing various Pfcwd actions on {} ---".format(port))
self.setup_test_params(port, setup_info['vlan'], init=not idx)
self.traffic_inst = SendVerifyTraffic(self.ptf, dut_facts['ansible_eth0']['macaddress'], self.pfc_wd)
self.traffic_inst = SendVerifyTraffic(self.ptf, dut_facts['ansible_Ethernet0']['macaddress'], self.pfc_wd)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not all platform HWSKU has Ethernet0 enabled. This is another loophole. We might want to read the config_db to get the mac address instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agree, config_db is better. I fixed this PR but apparently it is the same problem in a lot of tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Please, take a look at #2552 which does similar change for all the pytest tests that are using ansible_Ethernet0

pfc_wd_restore_time_large = request.config.getoption("--restore-time")
# wait time before we check the logs for the 'restore' signature. 'pfc_wd_restore_time_large' is in ms.
self.timers['pfc_wd_wait_for_restore_time'] = int(pfc_wd_restore_time_large / 1000 * 2)
Expand Down
12 changes: 6 additions & 6 deletions tests/pfcwd/test_pfcwd_warm_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,16 @@ def storm_setup(self, port, queue, storm_defer=False):

class SendVerifyTraffic(object):
""" PTF test """
def __init__(self, ptf, eth0_mac, pfc_params, queue):
def __init__(self, ptf, router_mac, pfc_params, queue):
"""
Args:
ptf(AnsibleHost) : ptf instance
eth0_mac(string) : mac addr of eth0
router_mac(string) : router mac address
ptf_params(dict) : all PFC test params specific to the DUT port
queue(int): queue to check the wd action
"""
self.ptf = ptf
self.eth0_mac = eth0_mac
self.router_mac = router_mac
self.pfc_wd_test_pkt_count = pfc_params['test_pkt_count']
self.pfc_wd_rx_port_id = pfc_params['rx_port_id']
self.pfc_wd_test_port = pfc_params['test_port']
Expand All @@ -217,7 +217,7 @@ def verify_tx_egress(self, wd_action):
dst_port = "[" + str(self.pfc_wd_test_port_id) + "]"
if wd_action == "forward" and type(self.pfc_wd_test_port_ids) == list:
dst_port = "".join(str(self.pfc_wd_test_port_ids)).replace(',', '')
ptf_params = {'router_mac': self.eth0_mac,
ptf_params = {'router_mac': self.router_mac,
'queue_index': self.queue,
'pkt_count': self.pfc_wd_test_pkt_count,
'port_src': self.pfc_wd_rx_port_id[0],
Expand All @@ -243,7 +243,7 @@ def verify_rx_ingress(self, wd_action):
dst_port = "".join(str(self.pfc_wd_rx_port_id)).replace(',', '')
else:
dst_port = "[ " + str(self.pfc_wd_rx_port_id) + " ]"
ptf_params = {'router_mac': self.eth0_mac,
ptf_params = {'router_mac': self.router_mac,
'queue_index': self.queue,
'pkt_count': self.pfc_wd_test_pkt_count,
'port_src': self.pfc_wd_test_port_id,
Expand Down Expand Up @@ -500,7 +500,7 @@ def pfcwd_wb_helper(self, request, testcase_actions, setup_pfc_test, fanout_grap
else:
self.oid_map[(port, queue)] = PfcCmd.get_queue_oid(self.dut, port, queue)

self.traffic_inst = SendVerifyTraffic(self.ptf, dut_facts['ansible_eth0']['macaddress'], self.pfc_wd, queue)
self.traffic_inst = SendVerifyTraffic(self.ptf, dut_facts['ansible_Ethernet0']['macaddress'], self.pfc_wd, queue)
self.run_test(port, queue, detect=(bitmask & 1),
storm_start=not t_idx or storm_deferred or storm_restored,
first_detect_after_wb=(t_idx == 2 and not p_idx and not q_idx and not storm_deferred),
Expand Down