Skip to content

Commit 91a38f7

Browse files
mssonicbldPriyanshTratiya
authored andcommitted
Fix/nonlinear high nexthop dataplane downtime (sonic-net#21939) (sonic-net#22204)
* ptf dataplane cleaners for in between test runs Signed-off-by: Priyansh Tratiya <[email protected]> Co-authored-by: Priyansh <[email protected]> Signed-off-by: Lakshmi Yarramaneni <[email protected]>
1 parent 7d41af7 commit 91a38f7

1 file changed

Lines changed: 17 additions & 20 deletions

File tree

tests/bgp/test_ipv6_bgp_scale.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,8 @@ def test_nexthop_group_member_scale(
620620
localhost,
621621
tbinfo,
622622
bgp_peers_info,
623+
clean_ptf_dataplane,
623624
setup_routes_before_test,
624-
topo_bgp_routes,
625625
request
626626
):
627627
'''
@@ -645,6 +645,7 @@ def test_nexthop_group_member_scale(
645645
global global_icmp_type
646646
global_icmp_type += 1
647647
pdp = ptfadapter.dataplane
648+
pdp.clear_masks()
648649
pdp.set_qlen(PACKET_QUEUE_LENGTH)
649650
exp_mask = setup_packet_mask_counters(pdp, global_icmp_type)
650651
injection_bgp_neighbor = random.choice(list(bgp_peers_info.keys()))
@@ -716,34 +717,28 @@ def test_nexthop_group_member_scale(
716717
terminated.set()
717718
traffic_thread.join()
718719
end_time = datetime.datetime.now()
719-
validate_rx_tx_counters(pdp, end_time, start_time, exp_mask, _get_max_time('dataplane_downtime', 1))
720+
acceptable_downtime = validate_rx_tx_counters(pdp, end_time, start_time, exp_mask,
721+
_get_max_time('dataplane_downtime', 1))
722+
if not acceptable_downtime:
723+
for ptfhost in ptfhosts:
724+
ptf_ip = ptfhost.mgmt_ip
725+
announce_routes(localhost, tbinfo, ptf_ip, servers_dut_interfaces.get(ptf_ip, ''))
726+
pytest.fail(f"Dataplane downtime is too high, threshold is "
727+
f"{_get_max_time('dataplane_downtime', 1)} seconds")
720728
if not result.get("converged"):
721729
pytest.fail("BGP routes are not stable in long time")
722730
finally:
723-
for ptfhost in ptfhosts:
724-
ptf_ip = ptfhost.mgmt_ip
725-
change_routes_on_peers(localhost, ptf_ip, topo_name, peers_routes_to_change, ACTION_ANNOUNCE,
726-
servers_dut_interfaces.get(ptf_ip, ''))
731+
pass
727732
# ------------announce routes and test ------------ #
728733
current_test = request.node.name + "_announce"
729734
global_icmp_type += 1
735+
pdp.clear_masks()
730736
exp_mask = setup_packet_mask_counters(pdp, global_icmp_type)
731737
pkts = generate_packets(
732738
neighbor_ecmp_routes[injection_bgp_neighbor],
733739
duthost.facts['router_mac'],
734740
pdp.get_mac(pdp.port_to_device(injection_port), injection_port)
735741
)
736-
for hostname, routes in peers_routes_to_change.items():
737-
for route in routes:
738-
prefix = route[0].upper()
739-
found = False
740-
for topo_route in topo_bgp_routes[hostname]['ipv6']:
741-
if topo_route[0] == prefix:
742-
route[2] = topo_route[2]
743-
found = True
744-
break
745-
if not found:
746-
logger.warning('Fail to update AS path of route %s, because of prefix was not found in topo', route[0])
747742
terminated = Event()
748743
traffic_thread = Thread(
749744
target=send_packets, args=(terminated, pdp, pdp.port_to_device(injection_port), injection_port, pkts)
@@ -753,8 +748,7 @@ def test_nexthop_group_member_scale(
753748
traffic_thread.start()
754749
for ptfhost in ptfhosts:
755750
ptf_ip = ptfhost.mgmt_ip
756-
change_routes_on_peers(localhost, ptf_ip, topo_name, peers_routes_to_change, ACTION_ANNOUNCE,
757-
servers_dut_interfaces.get(ptf_ip, ''))
751+
announce_routes(localhost, tbinfo, ptf_ip, servers_dut_interfaces.get(ptf_ip, ''))
758752
compressed_startup_routes = compress_expected_routes(startup_routes)
759753
result = check_bgp_routes_converged(
760754
duthost=duthost,
@@ -769,7 +763,10 @@ def test_nexthop_group_member_scale(
769763
terminated.set()
770764
traffic_thread.join()
771765
end_time = datetime.datetime.now()
772-
validate_rx_tx_counters(pdp, end_time, start_time, exp_mask, _get_max_time('dataplane_downtime', 1))
766+
acceptable_downtime = validate_rx_tx_counters(pdp, end_time, start_time, exp_mask,
767+
_get_max_time('dataplane_downtime', 1))
768+
if not acceptable_downtime:
769+
pytest.fail(f"Dataplane downtime is too high, threshold is {_get_max_time('dataplane_downtime', 1)} seconds")
773770
if not result.get("converged"):
774771
pytest.fail("BGP routes are not stable in long time")
775772

0 commit comments

Comments
 (0)