Skip to content
Merged
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
26 changes: 20 additions & 6 deletions ansible/roles/test/files/ptftests/advanced-reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def generate_ping_dut_lo(self):
ip_src=self.from_server_src_addr,
ip_dst=dut_lo_ipv4)

self.ping_dut_exp_packet = Mask(exp_packet)
self.ping_dut_exp_packet = Mask(exp_packet)
self.ping_dut_exp_packet.set_do_not_care_scapy(scapy.Ether, "dst")
self.ping_dut_exp_packet.set_do_not_care_scapy(scapy.IP, "dst")
self.ping_dut_exp_packet.set_do_not_care_scapy(scapy.IP, "id")
Expand Down Expand Up @@ -1559,12 +1559,15 @@ def no_flood(self, packet):
"""
This method filters packets which are unique (i.e. no floods).
"""
if (not int(str(packet[scapyall.TCP].payload)) in self.unique_id) and (packet[scapyall.Ether].src == self.dut_mac):
if (not int(str(packet[scapyall.TCP].payload)) in self.unique_id) and \
(packet[scapyall.Ether].src == self.dut_mac or packet[scapyall.Ether].src == self.vlan_mac):
# This is a unique (no flooded) received packet.
# for dualtor, t1->server rcvd pkt will have src MAC as vlan_mac, and server->t1 rcvd pkt will have src MAC as dut_mac
self.unique_id.append(int(str(packet[scapyall.TCP].payload)))
return True
elif packet[scapyall.Ether].dst == self.dut_mac:
elif packet[scapyall.Ether].dst == self.dut_mac or packet[scapyall.Ether].dst == self.vlan_mac:
# This is a sent packet.
# for dualtor, t1->server sent pkt will have dst MAC as dut_mac, and server->t1 sent pkt will have dst MAC as vlan_mac
return True
else:
return False
Expand Down Expand Up @@ -1630,14 +1633,18 @@ def examine_flow(self, filename = None):
missed_t1_to_vlan = 0
self.disruption_start, self.disruption_stop = None, None
for packet in packets:
if packet[scapyall.Ether].dst == self.dut_mac:
if packet[scapyall.Ether].dst == self.dut_mac or packet[scapyall.Ether].dst == self.vlan_mac:
# This is a sent packet - keep track of it as payload_id:timestamp.
# for dualtor both MACs are needed:
# t1->server sent pkt will have dst MAC as dut_mac, and server->t1 sent pkt will have dst MAC as vlan_mac
sent_payload = int(str(packet[scapyall.TCP].payload))
sent_packets[sent_payload] = packet.time
sent_counter += 1
continue
if packet[scapyall.Ether].src == self.dut_mac:
if packet[scapyall.Ether].src == self.dut_mac or packet[scapyall.Ether].src == self.vlan_mac:
# This is a received packet.
# for dualtor both MACs are needed:
# t1->server rcvd pkt will have src MAC as vlan_mac, and server->t1 rcvd pkt will have src MAC as dut_mac
received_time = packet.time
received_payload = int(str(packet[scapyall.TCP].payload))
if (received_payload % 5) == 0 : # From vlan to T1.
Expand All @@ -1652,6 +1659,8 @@ def examine_flow(self, filename = None):
continue
if received_payload - prev_payload > 1:
# Packets in a row are missing, a disruption.
self.log("received_payload: {}, prev_payload: {}, sent_counter: {}, received_counter: {}".format(
received_payload, prev_payload, sent_counter, received_counter))
lost_id = (received_payload -1) - prev_payload # How many packets lost in a row.
disrupt = (sent_packets[received_payload] - sent_packets[prev_payload + 1]) # How long disrupt lasted.
# Add disrupt to the dict:
Expand Down Expand Up @@ -1762,7 +1771,7 @@ def wait_dut_to_warm_up(self):
up_time = None

if elapsed > warm_up_timeout_secs:
raise Exception("Control plane didn't come up within warm up timeout")
raise Exception("IO didn't come up within warm up timeout. Control plane: {}, Data plane: {}".format(ctrlplane, dataplane))
time.sleep(1)

# check until flooding is over. Flooding happens when FDB entry of
Expand Down Expand Up @@ -1974,6 +1983,11 @@ def pingDut(self):

total_rcv_pkt_cnt = testutils.count_matched_packets_all_ports(self, self.ping_dut_exp_packet, self.vlan_ports, timeout=self.PKT_TOUT)

if self.vlan_mac != self.dut_mac:
# handle two-for-one icmp reply for dual tor (when vlan and dut mac are diff):
# icmp_responder will also generate a response for this ICMP req, ignore that reply
total_rcv_pkt_cnt = total_rcv_pkt_cnt - self.ping_dut_pkts

self.log("Send %5d Received %5d ping DUT" % (self.ping_dut_pkts, total_rcv_pkt_cnt), True)

return total_rcv_pkt_cnt
Expand Down
13 changes: 11 additions & 2 deletions tests/common/fixtures/advanced_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AdvancedReboot:
Test cases can trigger test start utilizing runRebootTestcase API.
"""

def __init__(self, request, duthost, ptfhost, localhost, tbinfo, creds, **kwargs):
def __init__(self, request, duthosts, duthost, ptfhost, localhost, tbinfo, creds, **kwargs):
"""
Class constructor.
@param request: pytest request object
Expand Down Expand Up @@ -76,6 +76,7 @@ def __init__(self, request, duthost, ptfhost, localhost, tbinfo, creds, **kwargs
self.kvmTest = False

self.request = request
self.duthosts = duthosts
self.duthost = duthost
self.ptfhost = ptfhost
self.localhost = localhost
Expand Down Expand Up @@ -598,6 +599,10 @@ def runRebootTestcase(self, prebootList=None, inbootList=None, prebootFiles='pee
return self.runRebootTest()

def __setupRebootOper(self, rebootOper):
if "dualtor" in self.getTestbedType():
for device in self.duthosts:
device.shell("config mux mode manual all")

down_ports = 0
if "dut_lag_member_down" in str(rebootOper) \
or "neigh_lag_member_down" in str(rebootOper) \
Expand Down Expand Up @@ -640,6 +645,10 @@ def __verifyRebootOper(self, rebootOper):
rebootOper.verify()

def __revertRebootOper(self, rebootOper):
if "dualtor" in self.getTestbedType():
for device in self.duthosts:
device.shell("config mux mode auto all")

if isinstance(rebootOper, SadOperation):
logger.info('Running revert handler for reboot operation {}'.format(rebootOper))
rebootOper.revert()
Expand Down Expand Up @@ -820,7 +829,7 @@ def get_advanced_reboot(**kwargs):
API that returns instances of AdvancedReboot class
"""
assert len(instances) == 0, "Only one instance of reboot data is allowed"
advancedReboot = AdvancedReboot(request, duthost, ptfhost, localhost, tbinfo, creds, **kwargs)
advancedReboot = AdvancedReboot(request, duthosts, duthost, ptfhost, localhost, tbinfo, creds, **kwargs)
instances.append(advancedReboot)
return advancedReboot

Expand Down
3 changes: 3 additions & 0 deletions tests/platform_tests/test_advanced_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from tests.platform_tests.verify_dut_health import add_fail_step_to_reboot # lgtm[py/unused-import]
from tests.platform_tests.warmboot_sad_cases import get_sad_case_list, SAD_CASE_LIST

from tests.common.fixtures.ptfhost_utils import run_icmp_responder
from tests.common.fixtures.ptfhost_utils import run_garp_service

pytestmark = [
pytest.mark.disable_loganalyzer,
pytest.mark.topology('t0'),
Expand Down